-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_arithm.cpp
86 lines (66 loc) · 1.41 KB
/
mod_arithm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* author: abhishekvtangod
**/
// #undef _GLIBCXX_DEBUG
// #undef _ABHI
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// oset<pair<ll,ll>> indexed_set;
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
void debug_out() { cerr << "]" << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << H << ", ";
debug_out(T...);
}
#ifdef _GLIBCXX_DEBUG
#define debug(x...) cerr << "[" << #x << "]:[", debug_out(x)
#else
#define debug(...) 42
#endif
struct mod_arithm{
// a^b % k
ll binary_exp(ll a, ll b, ll m){
ll ans = 1;
while(b){
if(b&1){
ans = (ans * a) % m;
}
// b/=2;
b = b>>1;
a = (a * a) % m;
}
return ans;
}
ll modInverse(ll n, ll m){
// n^m-2 % m
return binary_exp(n, m-2, m);
}
};
mod_arithm ma;
void solve(){
}
int main()
{
IOS;
#ifdef _ABHI
freopen("/home/abhi/Documents/input.txt", "r", stdin);
freopen("/home/abhi/Documents/output.txt", "w", stdout);
#endif
ll t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}