temp

Créé Le diff n'expire jamais
14 suppressions
272 lignes
26 ajouts
280 lignes
#include "bits/stdc++.h"
#include "bits/stdc++.h"
using namespace std;
using namespace std;
#ifndef LOCAL
#ifndef LOCAL
#define endl '\n'
#define endl '\n'
#endif
#endif


#define fr(i, a, b) for(int i = a; i <= b; i++)
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pf push_front
#define pb push_back
#define pb push_back
#define fi first
#define fi first
#define se second
#define se second
#define all(x) x.begin(), x.end()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define sz(x) (int)x.size()
#define rsz resize()
#define rsz resize()
#define lb lower_bound
#define lb lower_bound
#define ub upper_bound
#define ub upper_bound
#define br cout << endl
#define br cout << endl


typedef long long ll;
typedef long long ll;
typedef long double f80;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,ll> pll;


int pct(int x) { return __builtin_popcount(x); }
int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bit(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int bit(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }


template<typename T>
template<typename T>
void leftShift(vector<T> &v, ll k) { k %= sz(v); if(k < 0) k += sz(v); rotate(v.begin(), v.begin() + k, v.end()); }
void leftShift(vector<T> &v, ll k) { k %= sz(v); if(k < 0) k += sz(v); rotate(v.begin(), v.begin() + k, v.end()); }
template<typename T>
template<typename T>
void rightSift(vector<T> &v, ll k) { leftShift(v, sz(v) - k); }
void rightSift(vector<T> &v, ll k) { leftShift(v, sz(v) - k); }


mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());


ll rand(ll l, ll r){
ll rand(ll l, ll r){
uniform_int_distribution<ll> uid(l, r);
uniform_int_distribution<ll> uid(l, r);
return uid(rng);
return uid(rng);
}
}


inline int nxt() {
inline int nxt() {
int x;
int x;
cin >> x;
cin >> x;
return x;
return x;
}
}


inline ll nxtll() {
inline ll nxtll() {
ll x;
ll x;
cin >> x;
cin >> x;
return x;
return x;
}
}


void pr() {}
void pr() {}
void sc() {}
void sc() {}


template <typename Head, typename... Tail>
template <typename Head, typename... Tail>
void pr(Head H, Tail... T) { cout << H << " "; pr(T...); }
void pr(Head H, Tail... T) { cout << H << " "; pr(T...); }


template <typename Head, typename... Tail>
template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }


#ifdef LOCAL
#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#else
#define debug(...) 42
#define debug(...) 42
#endif
#endif


#ifndef LOCAL
#ifndef LOCAL
string to_string(__int128 x) {
string to_string(__int128 x) {
string s = "";
string s = "";
bool neg = 0;
bool neg = 0;
if(x < 0) { s += "-"; neg = 1; x = -x; }
if(x < 0) { s += "-"; neg = 1; x = -x; }
if(!x) s += '0';
if(!x) s += '0';
while(x) {
while(x) {
int rem = x % 10;
int rem = x % 10;
s += to_string(rem);
s += to_string(rem);
x /= 10;
x /= 10;
}
}
reverse(s.begin() + neg, s.end());
reverse(s.begin() + neg, s.end());
return s;
return s;
}
}
#endif
#endif


const int mod = 1e9 + 7; // 998244353;
const int mod = 1e9 + 7; // 998244353;


int pwr(int a,int b) {
int pwr(int a,int b) {
int ans = 1;
int ans = 1;
while(b) {
while(b) {
if(b & 1) ans = (ans * 1LL * a) % mod;
if(b & 1) ans = (ans * 1LL * a) % mod;
a = (a * 1LL * a) % mod;
a = (a * 1LL * a) % mod;
b >>= 1;
b >>= 1;
}
}
return ans;
return ans;
}
}


/*
/*