This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define sc scanf | |
#define scin(x) sc("%d",&(x)) | |
#define scin2(x,y) sc("%d %d",&(x),&(y)) | |
#define pf printf | |
#define vi vector<int> | |
#define RUN_CASE(t,T) for(__typeof(t) t=1;t<=T;t++) | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define Input freopen("in.txt","r",stdin) | |
#define Output freopen("out.txt","w",stdout) | |
#define ll long long int | |
#define ull unsigned long long int | |
#define pii pair<int,int> | |
#define pll pair<ll,ll> | |
#define sc scanf | |
#define scin(x) sc("%d",&(x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define ll long long int | |
#define scln(x) sc("%lld",&(x)) | |
#define MOD 998244353 | |
#define RUN_CASE(t,T) for(__typeof(t) t=1;t<=T;t++) | |
using namespace std; | |
ll BigMod(ll a,ll b) | |
{ | |
if(b == 0)return 1%MOD; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define scin(x) sc("%d",&(x)) | |
#define scin2(x,y) sc("%d %d",&(x),&(y)) | |
#define ms(a,b) memset(a,b,sizeof(a)) | |
#define pb(a) push_back(a) | |
#define vi vector<int> | |
#define RUN_CASE(t,T) for(__typeof(t) t=1;t<=T;t++) | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ll long long int | |
#define sz 100005 | |
ll ara[sz],fre[sz],divbyi[sz],gcdgreater[sz],exact[sz]; | |
void Solve(int t) | |
{ | |
ll i,j,k,n,g,gcdsum=0; | |
cin>>n; | |
for(i=1 ; i<=n ; i++){ | |
cin>>ara[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ll long long int | |
#define sz 100005 | |
ll ara[sz],fre[sz],divbyi[sz],gcdgreater[sz],exact[sz]; | |
void Solve(int t) | |
{ | |
ll i,j,k,n,q,g; | |
cin>>n>>q; | |
for(i=1 ; i<=n ; i++){ | |
cin>>ara[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ll long long int | |
#define sz 100005 | |
ll ara[sz],fre[sz],divbyi[sz],gcdgreater[sz],exact[sz]; | |
void Solve(int t) | |
{ | |
ll i,j,k,n,q,g; | |
cin>>n>>q; | |
for(i=1 ; i<=n ; i++){ | |
cin>>ara[i] | |
fre[ara[i]]++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ll FuN(ll a , ll b , ll m) | |
{ | |
if(b == 1) | |
return (a%m); | |
ll half = b/2; | |
ll ret = FuN(a , half , m)%m; | |
if(b%2 == 0) | |
return (ret + ret)%m; | |
else | |
return ((ret + ret)%m + a)%m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int N = 1e5+9; | |
int tot_node = 1; | |
int to[N][62] , endmark[N]; | |
void Add(char *s) | |
{ | |
int sz = strlen(s) , curr = 1; ///curr - Root node | |
if(sz > 2) | |
sort(s+1 , s+sz-1); | |
for(int i=0 ; i<sz ; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define sz 100009 | |
const ll p1 = 331; | |
const ll p2 = 41; | |
const ll m1 = 1000000871; | |
const ll m2 = 1000003751; | |
pll hash_sum[2][sz]; ///First-Hash for p1 ; Second-Hash for p2; hash_sum[0]-hash value of string-1 ; hash_sum[1]-hash value of string-2 | |
ll p_pow[2][sz]; | |
void Power() | |
{ |
NewerOlder