source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> using namespace std; bool solve() { string s; cin>>s; int a=0,b=0; if(s.size()<2||s[0]=='B'||s[s.size()-1]=='A') { return false; } int count = 0; for(int i=0;i<s.size();i++) { if(s[i]=='A') { count++; ...
C++
0b9be2f076cfa13cdc76c489bf1ea416
264a4f91ecec3c3a379338e593f685be
800
PASSED
#include <bits/stdc++.h> using namespace std; #define pix 600 #define nd && #define orr || #define N1 cout << "YES" << endl #define N2 cout << "NO" << endl #define pb push_back #define sort1(v) sort(v.begin(), v.end(), [] (int a, int b){return a>b;}); #define sort2(v) ...
C++
0b9be2f076cfa13cdc76c489bf1ea416
f6b471a08852cdccda6e437320b89ee0
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll MOD = 998244353; #define pb push_back #define mp make_pair #define pll pair<ll, ll> #define all(a) a.begin(), a.end() #define alld(d) d.begin(), d.end(), greater<ll>() #define vi vector<int> #define vll vector<long long> #define pb push...
C++
0b9be2f076cfa13cdc76c489bf1ea416
e0fa2364bec35973949a78b741052b7d
800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define ln "\n" #define ull unsigned long long #define rev(v) reverse(v.begin(),v.end()) #define srt(v) sort(v.begin(),v.end()) #define all(x) x.begin(),x.end() #define allr(x) x.rbegin(),x.rend() #define clr(x, val) memset((x), (val), sizeof(...
C++
0b9be2f076cfa13cdc76c489bf1ea416
cf6d0c0237fee3297436034a22bd8faf
800
PASSED
/* * Author: tobiasblack * * **/ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define pii pair<int,int> #define vi vector<int> #define vll vector<ll> #define vvi vector < vi > #define pll pair<long long, long long> ...
C++
0b9be2f076cfa13cdc76c489bf1ea416
1c0989bf6865b58c3758b6a5062b4e54
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; while(n--){ string s; cin>>s; int a=0,b=0; if(s[0]=='B'||s[s.size()-1]=='A') a=-1; else{ for(int i=0;i<s.size();i++){ if(s[i]=='A') a++; if(s[i]=='B') { a--; b++; } if(a<0) break; } } if(...
C++
0b9be2f076cfa13cdc76c489bf1ea416
335c831609c8101cb446362e54e088b5
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int t; cin >> t; while (t-- > 0) { string s; cin >> s; if (s[s.size() - 1] == 'A') { cout <<...
C++
0b9be2f076cfa13cdc76c489bf1ea416
faa1103efbedb5a2d77fd79de6cec011
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int t; cin >> t; while (t-- > 0) { string s; cin >> s; if ((s[0] == 'B') || (s[s.size() - 1] == 'A')) { ...
C++
0b9be2f076cfa13cdc76c489bf1ea416
64fabe95069044dc91cda6a73fd59f02
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int t; cin >> t; while (t-- > 0) { string s; cin>>s; bool ok=(s.back()=='B'); int sum=0; for (auto it:s){ if ...
C++
0b9be2f076cfa13cdc76c489bf1ea416
57994fca952b1398d8e33b95cad5f6ee
800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int ask(int x) { cout << "? " << x << endl; int h; cin >> h; return h; } int main() { int n; cin >> n; int s = -1; int l = 1, r = 5e6; while (l <= r) { int m = (l+r)/2; if (ask(m) == 1) { ...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
17124252b5291d4ae3a4766a359ff937
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() #define pii pair<int, int> const int N = 2e5 + 10, mod = 32768; const ll oo = 1e17; double eps = 1e-9; void realityisoftendisappointing(){ int n; cin >> n; auto ask = [&](int w){ cout << "? " <<...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
9868738ef7518f6662d918e6d40e6909
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() #define pii pair<int, int> const int N = 2e5 + 10, mod = 32768; const ll oo = 1e17; double eps = 1e-9; void realityisoftendisappointing(){ int n; cin >> n; auto ask = [&](int w){ cout << "? " <<...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
7610689a4bbcd3a0a3ccd48399cc75e1
2,200
PASSED
// Super Idol的笑容 // 都没你的甜 // 八月正午的阳光 // 都没你耀眼 // 热爱105°C的你 // 滴滴清纯的蒸馏水 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define int long long #d...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
5c4f3489ea9062b37bcdc8107c4b6459
2,200
PASSED
// Super Idol的笑容 // 都没你的甜 // 八月正午的阳光 // 都没你耀眼 // 热爱105°C的你 // 滴滴清纯的蒸馏水 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define int long long #d...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
5a516605bab03e57e50aa2c828c5a3fd
2,200
PASSED
// Super Idol的笑容 // 都没你的甜 // 八月正午的阳光 // 都没你耀眼 // 热爱105°C的你 // 滴滴清纯的蒸馏水 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define int long long #d...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
4f369a3546e1977bcfd47b4de8c7c1be
2,200
PASSED
// Super Idol的笑容 // 都没你的甜 // 八月正午的阳光 // 都没你耀眼 // 热爱105°C的你 // 滴滴清纯的蒸馏水 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define int long long #d...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
970b68907010dfe6c1956fa89883bfd4
2,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define int long long #define ll long long #define ii pair<ll,ll> #define iii pair<ii,ll> #define fi first ...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
aa4dd66ee3ae95250422f851c48c0950
2,200
PASSED
#include <bits/stdc++.h> #define ios ios::sync_with_stdio(0) #define all(v) v.begin(),v.end() #define p_b push_back #define endl '\n' #define S second #define F first typedef long long ll; typedef long double ld; const ll mod = 998244353; using namespace std; int ask(int w) { cout << "? " << ...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
5abaa46d5bb49692a026740104988018
2,200
PASSED
#include<bits/stdc++.h> //#define double long double //T.erase(unique(T.begin(),T.end()),T.end()); //written by djs100201 #define all(v) v.begin(),v.end() using namespace std; using ll = long long; using P = pair<ll, ll>; using PP = pair<ll, P>; const ll n_ = 1e6 + 100, inf = (ll)1e9 * (ll)1e9 + 7, mod = 1e9...
C++
8eb4ce3fb9f6220ab6dbc12819680c1e
92fcecad1118d104473e5731ab5c3fa3
2,200
PASSED
//SRI_SUNDARAN_13 #include <bits/stdc++.h> #include<math.h> //#include<ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/tree_policy.hpp> using namespace std; #define nline "\n" #define MOD 1000000007 #define f(i,n) for(int i=0;i<n;i++) template<typename T> istream &operator>>(istream &istream,vector<T...
C++
a91be662101762bcb2c58b8db9ff61e0
2dcd58785df0e7404304fcdcb8f58453
1,100
PASSED
#include <iostream> #include <bits/stdc++.h> #define loop(i,l,u) for(int i=l;i<u;i++) #define int long long int using namespace std; signed main(){ int t; cin>>t; loop(u,0,t){ int n; cin>>n; // vector<int> v(n); int a; int start=-1,end=-1; loop(i,0,n){ int x; ci...
C++
a91be662101762bcb2c58b8db9ff61e0
cc02d7f85bc69bd327097628045e1bb6
1,100
PASSED
#include <iostream> #include <bits/stdc++.h> #define loop(i,l,u) for(int i=l;i<u;i++) #define int long long int using namespace std; signed main(){ int t; cin>>t; loop(u,0,t){ int n; cin>>n; //vector<int> v(n); int ar[n]; int start=0,end=0; loop(i,0,n){ ...
C++
a91be662101762bcb2c58b8db9ff61e0
bf88d6724781564a2b6a3dab179222b7
1,100
PASSED
#include <iostream> #include <bits/stdc++.h> #define loop(i,l,u) for(int i=l;i<u;i++) #define int long long int using namespace std; signed main(){ int t; cin>>t; loop(u,0,t){ // int n; // cin>>n; // if(n==2) cout<<0<<"\n"; // else{ // //vector<int> v(n); // int ar[n]; ...
C++
a91be662101762bcb2c58b8db9ff61e0
79cfb8c5fdc6d090f378e620df12b5a5
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long struct el { int v; int link = 0; }; int main() { int t; cin >> t; while(t--) { int n; int ans = 0, sum = 0; cin >> n; vector <el> in(2 * n); for(int i = 0; i < n; ...
C++
a91be662101762bcb2c58b8db9ff61e0
147e5aa9192e442d2b3f90e7105e215b
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long const int N = 2e5 + 10; int n,m,k; int a[N]; int cal() { int cnt = 1; int f = 0; int px = -1; for(int i = 1 ; i < n ; i ++ ) { if(a[i] == a[i - 1]) { px = i;break; } } return px; } void solve() { cin >> n; fo...
C++
a91be662101762bcb2c58b8db9ff61e0
4deb9c9163555b2a84e2b959e78ed404
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, m, x, y, r, c; vector<int>a; int main() { int t; cin >> t; while (t--){ cin >> n; a = vector<int>(n); int mx = 0, ans = 0; for(auto &i : a){ cin >> i; mx = max(i+...
C++
a91be662101762bcb2c58b8db9ff61e0
99c49f6da12d0e67318df41b086e2ecf
1,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF=2e9+10; #define mod 1000000007; const ll mxn = 100005; void solve() { ll n; cin>>n; ll a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } ll prothom=-1; ll sesh=-1; for(int i=0;i<n-1;i++) { if(a[i]==a[i+1]) { if(prothom==-1) { prothom=...
C++
a91be662101762bcb2c58b8db9ff61e0
6cda3f336eb680a2aef37d348c4cd1eb
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int t; int main() { cin >> t; while (t--) { int n; cin >> n; vector<int>v(n, 0); for (int i = 0; i < n; i++) { cin >> v[i]; } int l = -1, r = -1; for (int i = 0; i < n - 1; i++) { if (v[i] == v[i + 1]) { l = i + 1; break; } }...
C++
a91be662101762bcb2c58b8db9ff61e0
4e9971e8b97bdd44eb42a82fe39300f3
1,100
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long int typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_stati...
C++
a91be662101762bcb2c58b8db9ff61e0
46df187505c1584f0fcf85ba7f78c0c5
1,100
PASSED
#include <bits/stdc++.h> using namespace std; bool solve() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } int l = 0; int r = 0; int extra[n + 1]; for (int i = 0; i <= n; i++) { extra[i...
C++
158bd0ab8f4319f5fd1e6062caddad4e
ba4a70340f3c41ab8e2252aca53527ac
1,700
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <utility> #include <cstdio> #include <stack> #include <fstream> #include <deque> #include <bitset> #include <queue> #include <set> #include <map> #include <cmath> #include <climits> #include <cstdint> #include <string> #include <cassert...
C++
158bd0ab8f4319f5fd1e6062caddad4e
6c3a75c7f5f91fdc3ad698a671d7184a
1,700
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <map> #include <set> #include <numeric> #include <memory> #include <random> using namespace std; typedef long long ll; typedef long double ld; void Solve() { int n;...
C++
158bd0ab8f4319f5fd1e6062caddad4e
7e34aed2d19ed8a51d5beaed824559c3
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define dd double #define sg string #define modd 1000000007 #define en "\n" #define sc(a) scanf("%lld",&a); #define f(i,a,n) for(ll i=a;i<n;i++) #define ps(a) printf("%lld ",a); #define pn(a) printf("%lld\n",a); int main() { /...
C++
158bd0ab8f4319f5fd1e6062caddad4e
ce85f527a3412909fcb4e856be0e9a33
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define dd double #define sg string #define modd 1000000007 #define en "\n" #define sc(a) scanf("%lld",&a); #define f(i,a,n) for(ll i=a;i<n;i++) #define ps(a) printf("%lld ",a); #define pn(a) printf("%lld\n",a); int main() { ...
C++
158bd0ab8f4319f5fd1e6062caddad4e
a077dc761308fcb9c30d9e000f865207
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define dd double #define sg string #define modd 1000000007 #define en "\n" #define sc(a) scanf("%lld",&a); #define f(i,a,n) for(ll i=a;i<n;i++) #define ps(a) printf("%lld ",a); #define pn(a) printf("%lld\n",a); int main() { ...
C++
158bd0ab8f4319f5fd1e6062caddad4e
aac83b1043882883d7ff73c79ff7cdfc
1,700
PASSED
///Bismillahir Rahmanir Rahim #include "bits/stdc++.h" using namespace std; #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define print_case cout<<"Case #"<<cs<<": " #define ll long long #define u64 uint64_...
C++
158bd0ab8f4319f5fd1e6062caddad4e
0a71a43e0f05de13f361495095f2aff0
1,700
PASSED
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template <typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_conta...
C++
158bd0ab8f4319f5fd1e6062caddad4e
bd8941e3352d4513a103a2710f5cd415
1,700
PASSED
#include<bits/stdc++.h> #define nl "\n" #define ll long long #define all(x) (x).begin(), (x).end() #define debug(x) cout<<#x<<" = "<<x<<nl; #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) using namespace std; int main() { fast(); int t; cin>>t; while(t--){ int n; ...
C++
158bd0ab8f4319f5fd1e6062caddad4e
60a9001ca3f9311eb6da34f4b9dd040e
1,700
PASSED
#include<bits/stdc++.h> #define nl "\n" #define ll long long #define all(x) (x).begin(), (x).end() #define debug(x) cout<<#x<<" = "<<x<<nl; #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) using namespace std; int main() { fast(); int t; cin>>t; while(t--){ int n; ...
C++
158bd0ab8f4319f5fd1e6062caddad4e
3ce282a239f06519e816451a35eb953d
1,700
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <iomanip> #include <algorithm> #include <ctime> #include <vector> #include <set> #include <iterator> #include <map> #include <functional> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <unordered_map> #...
C++
d1c3b8985d0c17e0806117bef30d7ff2
dc54a1259911001ed80b7c413ed9e665
2,700
PASSED
#include <bits/stdc++.h> int main() { using namespace std; ios_base::sync_with_stdio(false), cin.tie(nullptr); int N, Q; cin >> N >> Q; string S; cin >> S; std::vector<std::array<int, 2>> pref(N); for (int i = 1; i < N; i++) { pref[i] = pref[i-1]; if (S[i-1] == S[i]) pref[i][S[i]-'0']++; } fo...
C++
d1c3b8985d0c17e0806117bef30d7ff2
8161fd50f6c82ec5e3cbeef286473a6e
2,700
PASSED
/* Though leaves are many , the root is one. Through all the lying days of my youth I swayed my leaves and flowers in the sun. Now I may wither into the truth. - William Butler Yeats */ //#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags //#pragma GCC option(...
C++
d1c3b8985d0c17e0806117bef30d7ff2
6475dc6deaca58749fc016d30c3da1f0
2,700
PASSED
/** * author: gary * created: 29.04.2022 06:56:17 **/ #include<bits/stdc++.h> #define rb(a,b,c) for(int a=b;a<=c;++a) #define rl(a,b,c) for(int a=b;a>=c;--a) #define rep(a,b) for(int a=0;a<b;++a) #define LL long long #define PB push_back #define POB pop_back #define II(a,b) make_pair(a,b) #define FIR first #de...
C++
d1c3b8985d0c17e0806117bef30d7ff2
bca4ec7c885bb72b0406b62b0ffc645c
2,700
PASSED
#include<bits/stdc++.h> #define pii pair<int,int> #define fi first #define sc second #define pb push_back #define ll long long #define trav(v,x) for(auto v:x) #define all(x) (x).begin(), (x).end() #define VI vector<int> #define VLL vector<ll> #define pll pair<ll, ll> #define double long double //#define int...
C++
d1c3b8985d0c17e0806117bef30d7ff2
813ef6dcc9000778f996e78a4fa0aaa4
2,700
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; const int N=2e5+5; const int B=400; ll read(){static ll x;scanf("%lld",&x);return x;} void write(ll x){printf("%lld",x);} void print(ll x,char c='\n'){write(x),putchar(c);} char a[N]; struct Query { int l,r,id; bool operator <(const Query &a)const {...
C++
d1c3b8985d0c17e0806117bef30d7ff2
4ba3a5f677c408d8928670e37a5fbcc3
2,700
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; const int N=2e5+5; const int B=400; ll read(){static ll x;scanf("%lld",&x);return x;} void write(ll x){printf("%lld",x);} void print(ll x,char c='\n'){write(x),putchar(c);} char a[N]; struct Query { int l,r,id; bool operator <(const Que...
C++
d1c3b8985d0c17e0806117bef30d7ff2
228aa6bb2ea3968974a4710abd5a534b
2,700
PASSED
#include <bits/stdc++.h> using namespace std; enum{N = 200001}; int n,q; string s; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin>>n>>q; cin>>s; s = ' ' + s; int m[2][N]; for (int i = 2;i<=n;++i) { for (int j = 0;j<2;++j) m[j][i] = m[j][i-1]; ...
C++
d1c3b8985d0c17e0806117bef30d7ff2
758775866e467eab4ec42814a96afbc7
2,700
PASSED
#include<bits/stdc++.h> char f[200005];int n,i,q,x,y,p0[200005],p1[200005];main(){scanf("%d%d%s",&n,&q,f+1);f[1]=f[1]-48;for(i=2;i<=n;i++)f[i]=f[i]-48,p0[i]=p0[i-1]+!(f[i]||f[i-1]),p1[i]=p1[i-1]+(f[i]&&f[i-1]);while (q--){scanf("%d%d",&x,&y);printf("%d\n",std::max(p1[y]-p1[x],p0[y]-p0[x])+1);}}
C++
d1c3b8985d0c17e0806117bef30d7ff2
ff3a85d5150615707f3a2d2c1eab9fa4
2,700
PASSED
#include<bits/stdc++.h> char f[200005];int n,i,q,x,y,p0[200005],p1[200005];main(){scanf("%d%d%s",&n,&q,f+1);f[1]=f[1]-48;for (i=2;i<=n;i++) f[i]=f[i]-48,p0[i]=p0[i-1]+!(f[i]||f[i-1]),p1[i]=p1[i-1]+(f[i]&&f[i-1]);while (q--){scanf("%d%d",&x,&y);printf("%d\n",std::max(p1[y]-p1[x],p0[y]-p0[x])+1);}}
C++
d1c3b8985d0c17e0806117bef30d7ff2
77ee6eaa1103007eb649463d742f669c
2,700
PASSED
#include"bits/stdc++.h" #include<algorithm> #include<cassert> #include<cmath> #include<climits> #include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<vector> #include<stack> #include<string> #include<queue> using namespace std; #define ll long long #define int...
C++
01703877719e19dd8551e4599c3e1c85
f79ffe24410898ab28549cecb5b903f6
2,000
PASSED
#include"bits/stdc++.h" #include<algorithm> #include<cassert> #include<cmath> #include<climits> #include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<vector> #include<stack> #include<string> #include<queue> using namespace std; #define ll long long #define int...
C++
01703877719e19dd8551e4599c3e1c85
d8b562ac35955f8a7c41e7f32e576d1c
2,000
PASSED
#include"bits/stdc++.h" #include<algorithm> #include<cassert> #include<cmath> #include<climits> #include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<vector> #include<stack> #include<string> #include<queue> using namespace std; #define ll long long #define int...
C++
01703877719e19dd8551e4599c3e1c85
dcafd799087dc5312bbcb3d74e595a93
2,000
PASSED
#include"bits/stdc++.h" #include<algorithm> #include<cassert> #include<cmath> #include<climits> #include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<vector> #include<stack> #include<string> #include<queue> using namespace std; #define ll long long #define int...
C++
01703877719e19dd8551e4599c3e1c85
081878b25ccd57bc2eb39cf2c0fa24e4
2,000
PASSED
#include <bits/stdc++.h> #define PrintNo printf("NO\n") #define PrintYES printf("YES\n") const int N = 5e5 + 10; template < typename T > inline void read(T &cnt) { cnt = 0; char ch = getchar(); bool op = 1; for (; ! isdigit(ch); ch = getchar()) if (ch == '-') op = 0; for (; isdigit(ch); ch = getcha...
C++
01703877719e19dd8551e4599c3e1c85
596aa0e4d21fd219a0fa2e8ac450788a
2,000
PASSED
#include <bits/stdc++.h> #define PrintNo printf("NO\n") #define PrintYES printf("YES\n") const int N = 5e5 + 10; template < typename T > inline void read(T &cnt) { cnt = 0; char ch = getchar(); bool op = 1; for (; ! isdigit(ch); ch = getchar()) if (ch == '-') op = 0; for (; isdigit(ch); ch = getcha...
C++
01703877719e19dd8551e4599c3e1c85
492c350557ebce12e9d9eb8cbea04896
2,000
PASSED
#include <bits/stdc++.h> #define PrintNo printf("NO\n") #define PrintYES printf("YES\n") const int N = 5e5 + 10; template < typename T > inline void read(T &cnt) { cnt = 0; char ch = getchar(); bool op = 1; for (; ! isdigit(ch); ch = getchar()) if (ch == '-') op = 0; for (; isdigit(ch); ch = getcha...
C++
01703877719e19dd8551e4599c3e1c85
48eae99244f1fe21ad95238e21ba8abc
2,000
PASSED
#include <bits/stdc++.h> #include <algorithm> #include <vector> using namespace std; // #define int long long int #define endl "\n" #define mod 1000000007 vector<int> v[200005]; // int h[200005]; void solve() { int n; cin >> n; int a[n]; map<int, int> h; // memset(h, 0, sizeof h); for (i...
C++
01703877719e19dd8551e4599c3e1c85
ed1ae1b830199b2274ed84216fc143e0
2,000
PASSED
#include<bits/stdc++.h> #define mod 1000000007 #define pb push_back #define lb lower_bound #define fi first #define se second #define int long long using namespace std; typedef long long LL; typedef pair<LL, LL> pll; LL tc, n, a[200200], cnt0[200200], flg[200200]; pll cnt[200200]; vector<LL> v[200200]; ...
C++
01703877719e19dd8551e4599c3e1c85
492ef58235067f1c9394ee0ed3e229aa
2,000
PASSED
#include<bits/stdc++.h> #define mod 1000000007 #define pb push_back #define lb lower_bound #define fi first #define se second #define int long long using namespace std; typedef long long LL; typedef pair<LL, LL> pll; LL tc, n, a[200200], cnt0[200200], flg[200200]; pll cnt[200200]; vector<LL> v[200200]; ...
C++
01703877719e19dd8551e4599c3e1c85
ae095f8b0d6dac2ce6b0bf20ecfb874c
2,000
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include<map> #include<vector> #include<set> #include<stack> #define ll long long using namespace std; int a[211111]; struct node { int v,num; }b[211111]; stack<pair<int,int> > s; vector<int> c[211111]; ...
C++
a8f7f64db8fdf42294909774884bec96
6afb20b2283fbecedcc90f8c4c539d51
2,800
PASSED
#include <bits/stdc++.h> using namespace std; #define N 200005 #define LIM 1000005 #define ll long long #define pb push_back #define gc() (P1==P2 && (P2=(P1=buf)+fread(buf,1,LIM,stdin),P1==P2)?EOF:*P1++) mt19937 rand1(time(0));char *P1,*P2,buf[LIM]; int T,n,mx,S,gr,ans,a[N],b[N],cnt[N]; int cur[N],st[N],z[N],v...
C++
a8f7f64db8fdf42294909774884bec96
4db37fee70fd909f834dff8d413f095f
2,800
PASSED
#include<bits/stdc++.h> using namespace std; const int nax = 3e5 + 10; int n; int a[nax]; int b[nax]; int cnt[nax]; /** 1 5 2 2 2 1 5 2 2 5 2 1 _________ 1 2 3 3 3 3 3 3 1 2 correct = 1, but there's two easy cycles _________ 1 2 3 3 3 3 1 3 3 2 correct = 2, but there's only one cycle Is the number...
C++
a8f7f64db8fdf42294909774884bec96
2951f6d5b50b647b2c3f3d0873f58476
2,800
PASSED
#include <bits/stdc++.h> #define ll long long #define vc vector using namespace std; int main() { ll tcs;cin >> tcs; while(tcs--){ ll n;cin >> n; vc<ll> a(n), b(n); for(ll i=0;i<n;++i) cin >> a[i]; for(ll i=0;i<n;++i) cin >> b[i]; ...
C++
a8f7f64db8fdf42294909774884bec96
2b786b6c46ef5929c27fa238a158c49b
2,800
PASSED
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #define filei freopen("input.txt", "r", stdin); #define fileo freopen("output.txt", "w", stdout); #define gooi cout<<"Case #"<<i+...
C++
a8f7f64db8fdf42294909774884bec96
560afcb7637f79ebf24103da7a841dd1
2,800
PASSED
#include <bits/stdc++.h> #ifndef LBM_LOCAL #define debug(x...) 17 #endif using namespace std; namespace { // macros definitions #define Gint Read<ll>() #define Gstr Read<str>() #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define For(i, u, v) for (int i = (u), _n_ ...
C++
a8f7f64db8fdf42294909774884bec96
255b2f2892b2cee5e54b083666fc70a4
2,800
PASSED
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double lld; typedef complex<lld> cd; typedef ...
C++
a8f7f64db8fdf42294909774884bec96
a6c9e41f80288b49a18757f8696a457f
2,800
PASSED
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double lld; typedef complex<lld> cd; typedef ...
C++
a8f7f64db8fdf42294909774884bec96
8e061e88ac19c15ed79b781c16d62239
2,800
PASSED
/* _/ _/ _/_/_/ _/ _/ _/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ ...
C++
a8f7f64db8fdf42294909774884bec96
40248e0e605621f820c9899f4b423273
2,800
PASSED
/* _/ _/ _/_/_/ _/ _/ _/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ ...
C++
a8f7f64db8fdf42294909774884bec96
89dd99a1e5e8f7a599c9d35d3a794320
2,800
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { sz = 1; while (sz < n) { ...
C++
5c94d611589412b3be747b3ba9e58443
f6ba389865ff84892e8c3d447026d8b3
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { sz = 1; while (sz < n) { ...
C++
5c94d611589412b3be747b3ba9e58443
b46a0c8b829b03c9a3333eefe87717ea
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; /** Interface */ template<class T = int> inline T readInt(); inline double readDouble(); inline int readUInt(); inline int readChar(); inline void readWord(char *s); inline bool readLine(char ...
C++
5c94d611589412b3be747b3ba9e58443
4d9a41bc3f87e0d25a98a17ff287626d
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; /** Interface */ template<class T = int> inline T readInt(); inline double readDouble(); inline int readUInt(); inline int readChar(); inline void readWord(char *s); inline bool readLine(char ...
C++
5c94d611589412b3be747b3ba9e58443
3eeb4bfdd21250354c6bd753ec9fd85c
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; /** Interface */ template<class T = int> inline T readInt(); inline double readDouble(); inline int readUInt(); inline int readChar(); inline void readWord(char *s); inline bool readLine(char ...
C++
5c94d611589412b3be747b3ba9e58443
4e2af26bc429aa50bcd17b9c6a8fca0d
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; /** Interface */ template<class T = int> inline T readInt(); inline double readDouble(); inline int readUInt(); inline int readChar(); inline void readWord(char *s); inline bool readLine(char ...
C++
5c94d611589412b3be747b3ba9e58443
737544da3e508cb374955b51a378eaf3
3,000
PASSED
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { ...
C++
5c94d611589412b3be747b3ba9e58443
8f547e5d3f4eac38c355fd1ff634612d
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { sz = 1; while (sz < n) { ...
C++
5c94d611589412b3be747b3ba9e58443
a52e944397c5601d9da0cffe1fdd534b
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { sz = 1; while (sz < n) { ...
C++
5c94d611589412b3be747b3ba9e58443
f4ade7f7b46045ab40c4c455efeebea9
3,000
PASSED
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9 + 228; constexpr pair<int, int> def = {inf, -1}; struct LazySegmentTree { int sz = 1; vector<pair<int, int>> t; vector<int> tag; LazySegmentTree() = default; LazySegmentTree(int n) { sz = 1; while (sz < n) { ...
C++
5c94d611589412b3be747b3ba9e58443
0ad861310ca6b444caa1159d49c52981
3,000
PASSED
// Problem: G. Cross Xor // Contest: Codeforces - Codeforces Global Round 20 // URL: https://codeforces.com/contest/1672/problem/G // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) #pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> #inclu...
C++
45c1dd4eeba668a454dabf0993cdecac
a67b5d13a8d3680786fcb276777467c9
3,200
PASSED
// LUOGU_RID: 92770653 #pragma GCC optimize("Ofast","inline") #include<bits/stdc++.h> using namespace std; const int N=2e3+50,mod=998244353; int n,m,a[N][N],r[N],c[N],val[N*N*4],ro[N<<1],siz[N<<1][2],Xor[N<<1]; char z; inline int find(int x) { return x==ro[x]?x:(ro[x]=find(ro[x])); } char ch,B0[1<<15],...
C++
45c1dd4eeba668a454dabf0993cdecac
1a2fd7133ea1b4d7e3a7396830f5a5f0
3,200
PASSED
#pragma GCC optimize("Ofast","inline") #include<bits/stdc++.h> using namespace std; const int N=2e3+50,mod=998244353; int n,m,a[N][N],r[N],c[N],val[N*N*4],ro[N<<1],siz[N<<1][2],Xor[N<<1]; char z; inline int find(int x) { return x==ro[x]?x:(ro[x]=find(ro[x])); } char ch,B0[1<<15],*S=B0,*T=B0; #define g...
C++
45c1dd4eeba668a454dabf0993cdecac
3147fb9813d6a984923f00da80348f6f
3,200
PASSED
#pragma GCC optimize("Ofast","inline") #include<bits/stdc++.h> using namespace std; const int N=2e3+50,mod=998244353; int n,m,a[N][N],r[N],c[N],val[N*N*4],ro[N<<1],siz[N<<1][2],Xor[N<<1]; char z; inline int find(int x) { return x==ro[x]?x:(ro[x]=find(ro[x])); } char ch,B0[1<<15],*S=B0,*T=B0; #define g...
C++
45c1dd4eeba668a454dabf0993cdecac
3645fd20991755b2669289b37e19c15e
3,200
PASSED
#pragma GCC optimize("Ofast","inline") #include<bits/stdc++.h> using namespace std; const int N=2e3+50,mod=998244353; int n,m,a[N][N],r[N],c[N],val[N*N*4],ro[N<<1],siz[N<<1][2],Xor[N<<1]; char z; inline int find(int x) { return x==ro[x]?x:(ro[x]=find(ro[x])); } char ch,B0[1<<15],*S=B0,*T=B0; #define g...
C++
45c1dd4eeba668a454dabf0993cdecac
4ad7ede4f0e7ae6766d1d2ea0985b4b6
3,200
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e3+50,mod=998244353; int n,m,a[N][N],r[N],c[N],val[N*N*4],ro[N<<1],siz[N<<1][2],Xor[N<<1]; int find(int x) { return x==ro[x]?x:(ro[x]=find(ro[x])); } main() { cin>>n>>m; if(n%2==0&&m%2==0) { int ans=1; for(int i...
C++
45c1dd4eeba668a454dabf0993cdecac
7a9ec5ab024fbe647c5e061107beee9c
3,200
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 2010, P = 998244353; int r, c, ans, a[maxn * 2], fa[maxn * 2], xors[maxn * 2]; char str[maxn][maxn]; bool mark[maxn * 2]; int qp(int x, int y) { int z = 1; for (; y; y >>= 1, x = 1LL * x * x % P) { if (y & 1) z = 1LL * z * x % P...
C++
45c1dd4eeba668a454dabf0993cdecac
77c54ae329728c89801b78bfc188304f
3,200
PASSED
#include<cstdio> #include<algorithm> #include<cstring> typedef long long ll; using namespace std; const int MAXN=2005,mod=998244353; ll Fstpw(ll a,int b){ ll res=1; while(b){ if(b&1) res=res*a%mod; b>>=1; a=a*a%mod; } return res; } int n,m,k; char s[MAXN][MAXN]; struct LB{ ll a[MAXN]; int cnt; void Ins(ll ...
C++
45c1dd4eeba668a454dabf0993cdecac
c9c3c5ccea2350966c002e3eafa36f3a
3,200
PASSED
#include <iostream> #include <algorithm> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<vector> #include<iomanip> #include<ctime> #include<set> #include<map> #include<queue> #include<stack> #include<bitset> #include<cassert> #define sqr(x) ((x)*(x)) #define fz1(i,n) for ((...
C++
45c1dd4eeba668a454dabf0993cdecac
f85be49fbfd46b00674116ecfd488c9e
3,200
PASSED
// LUOGU_RID: 94425805 #include<bits/stdc++.h> #define fi first #define se second #define ll long long #define pb push_back #define db double #define inf 0x3f3f3f3f3f3f3f3f using namespace std; const int mod=998244353; int n,m,K,W,num,vis[4005],in[4005],L[2005],R[2005]; int V,E; char s[2005][2005]; vector<i...
C++
45c1dd4eeba668a454dabf0993cdecac
8ecb6d7c11be0e92860d5790ef4d409b
3,200
PASSED
//#pragma GCC optimize "tree-vectorize" //#pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <cmath> #include <cstdio> struct UnsafeInp...
C++
6f31e2bc222314236d35c9642a60812e
4a0dd1ffbf6abdb34bf603410a2cb9b9
2,900
PASSED
//#pragma GCC optimize "tree-vectorize" //#pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <cmath> #include <cstdio> struct UnsafeInp...
C++
6f31e2bc222314236d35c9642a60812e
f8ce5349d7acdfad8b6002d03ed3410b
2,900
PASSED
//#pragma GCC optimize "tree-vectorize" //#pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <cmath> #include <cstdio> struct UnsafeInp...
C++
6f31e2bc222314236d35c9642a60812e
85acddd7a67f969f1a04d755109840e9
2,900
PASSED
//#pragma GCC optimize "tree-vectorize" //#pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <cmath> #include <cstdio> struct UnsafeInp...
C++
6f31e2bc222314236d35c9642a60812e
c2ed0055a1e9f30df5105580fd4211ae
2,900
PASSED
//#pragma GCC optimize "tree-vectorize" //#pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <cmath> #include <cstdio> struct UnsafeInp...
C++
6f31e2bc222314236d35c9642a60812e
954833634596355be6ab02a991f84110
2,900
PASSED
#pragma GCC optimize "tree-vectorize" #pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <random> #include <vector> #include <forward_lis...
C++
6f31e2bc222314236d35c9642a60812e
1d198ee871e0bc914f3d7653050b97bb
2,900
PASSED
#pragma GCC optimize "tree-vectorize" #pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <random> #include <vector> #include <forward_lis...
C++
6f31e2bc222314236d35c9642a60812e
9ea3d243eced5b5bb725d748269b0ae9
2,900
PASSED
#pragma GCC optimize "tree-vectorize" #pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <random> #include <vector> #include <forward_lis...
C++
6f31e2bc222314236d35c9642a60812e
d302315f998d344fb5e30930f70e40d2
2,900
PASSED
#pragma GCC optimize "tree-vectorize" #pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <random> #include <vector> #include <forward_lis...
C++
6f31e2bc222314236d35c9642a60812e
f2acdf280cbcacf8a065e0e49e1fd182
2,900
PASSED
#pragma GCC optimize "tree-vectorize" #pragma GCC target "movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,clflushopt,xsavec,xsaves,adx,prfchw,lzcnt,abm" #include <algorithm> #include <iostream> #include <random> #include <vector> #include <tuple> #in...
C++
6f31e2bc222314236d35c9642a60812e
dae2bbc84600af00f03b210a7c5949a2
2,900
PASSED
#pragma GCC optimize(3) #pragma GCC target("avx,sse2,sse3,sse4,mmx") #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #include<bits/stdc++.h> using namespace std; long long a,b,c,T,d[1000001],an,ann,cn,cnt,f[1000001],v[1000001],st[1000001],mn[1000001],mn1[1000001],ans[21],h[21],fl[100001],cnn,t[100000...
C++
265ea62fbb748b1b02ca31f4a6ddecda
e76efa8c00216624ca07bcea7a333906
3,500
PASSED