0% found this document useful (0 votes)
10 views2 pages

Code

The document is a C++ code snippet that includes various standard libraries and defines several utility functions for modular arithmetic, such as multiplication, normalization, exponentiation, subtraction, addition, and finding the modular inverse. It also defines constants for the modulus and infinity values. The main function is empty, indicating that the code is likely a template for further development.

Uploaded by

S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Code

The document is a C++ code snippet that includes various standard libraries and defines several utility functions for modular arithmetic, such as multiplication, normalization, exponentiation, subtraction, addition, and finding the modular inverse. It also defines constants for the modulus and infinity values. The main function is empty, indicating that the code is likely a template for further development.

Uploaded by

S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
#include <cmath>
#include <functional>
#define mp make_pair
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define MOD 998244353 //(1000*1000*1000+7)


#define inf1 2e9
#define inf2 2e18
inline int mul(int a, int b) {
return int(a * 1ll * b % MOD);
}

inline int norm(int a) {


if (a >= MOD)
a -= MOD;
if (a < 0)
a += MOD;
return a;
}

inline int binPow(int a, int k) {


int ans = 1;
while (k > 0) {
if (k & 1)
ans = mul(ans, a);
a = mul(a, a);
k >>= 1;
}
return ans;
}

inline int subtract(int a, int b) {


return norm(a - b);
}

inline int sum(int a, int b) {


return int((a + b) % MOD);
}

inline int inv(int a) {


return binPow(a, MOD - 2);
}
ll ceil_int(ll a, ll b) {
return a / b + (a%b != 0);
}

int main() {
cin.sync_with_stdio(false);
cin.tie(0);

return 0;
}

You might also like