-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.cpp
More file actions
executable file
·77 lines (72 loc) · 1.5 KB
/
Copy pathbase.cpp
File metadata and controls
executable file
·77 lines (72 loc) · 1.5 KB
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
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define M 1000000007
#define V vector
#define F(a, b, c) for (a = b; a <= c; ++a)
#define I cin
#define O cout
#define pb push_back
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define umap unordered_map
#define mp make_pair
#define found(m, x) (m.find(x) != m.end())
bool isPowerOfTwo(ll x)
{
return x && (!(x & (x - 1)));
}
bool isPrime(ll n)
{
if (n < 2)
return false;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (ll i = 6; i * i <= n; i += 6)
if (n % (i - 1) == 0 || n % (i + 1) == 0)
return false;
return true;
}
// https://cp-algorithms.com/algebra/binary-exp.html#toc-tgt-3
ll binpow(ll a, ll b)
{
a %= M;
ll res = 1;
while (b > 0)
{
if (b & 1)
res = res * a % M;
a = a * a % M;
b >>= 1;
}
return res;
}
// https://lemire.me/blog/2013/12/26/fastest-way-to-compute-the-greatest-common-divisor/
unsigned gcd(unsigned u, unsigned v)
{
auto shift = __builtin_ctz(u | v);
u >>= __builtin_ctz(u);
do
{
v >>= __builtin_ctz(v);
if (u > v)
std::swap(u, v);
} while ((v -= u));
return u << shift;
}
int main()
{
I.sync_with_stdio(false);
I.tie(0);
ll t, n, q, i, j, k;
I >> t;
while (t--)
{
}
return 0;
}