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> #include <stdint.h> using namespace std; #define int long long #define pb push_back #define in insert #define F first #define S second #define mod 1000000007 #define endl '\n' #define all(x) x.begin(),x.end() #define w(x) int x;cin>>x; while(x-->0) #define memset(a,b) memset(a,b,sizeof(a)) #d...
C++
a9473e6ec81c10c4f88973ac2d60ad04
26eafb0bcecf6c452e76e430a0b35213
2,100
PASSED
#include <bits/stdc++.h> #include <stdint.h> using namespace std; #define int long long #define pb push_back #define in insert #define F first #define S second #define mod 1000000007 #define endl '\n' #define all(x) x.begin(),x.end() #define w(x) int x;cin>>x; while(x-->0) #define memset(a,b) memset(a,b,sizeof(a)) #d...
C++
a9473e6ec81c10c4f88973ac2d60ad04
772a753f1ee80b25efa08f1d63c157e0
2,100
PASSED
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include<bits/stdc++.h> #define rc(x) return cout<<x<<endl,0 #define pb push_back #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; typedef long double ld; const l...
C++
a5f650b6f5737f654eb30f1e57ce03d6
83f2e2f469cbe59f4c2e576d46a4279c
2,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef double db; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; #define endl "\n" #define fi first #define se second #define mp make_pair #define pb push_back #define pw(x) (1ll << (x)) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(...
C++
a5f650b6f5737f654eb30f1e57ce03d6
6d18d87b1e054ae512d6dc9651837fca
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb push_back #define pii pair<int,int> #define pll pair<ll,ll> #define uu first #define vv second #define MOD 1000000007 #define inf 1000000000 #define limit 10001000 ll ar[2005][1005]; bool eq[2005][1005]; int ...
C++
a5f650b6f5737f654eb30f1e57ce03d6
7e86300609733c40a444f2c4b831b733
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb push_back #define pii pair<int,int> #define pll pair<ll,ll> #define uu first #define vv second #define MOD 1000000007 #define inf 1000000000 #define limit 10001000 ll ar[2005][1005]; bool eq[2005][1005]; char w...
C++
a5f650b6f5737f654eb30f1e57ce03d6
9110a091aa0c58982e894e81719556c8
2,500
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <cmath> using namespace std; #define mp make_pair #define pb push_back #define ll long long #define maxN 1024 int n, m, k, i, j, cnt; char s[maxN]; int ln[maxN][maxN], co[maxN][maxN], dif, tot; int ans[maxN][max...
C++
a5f650b6f5737f654eb30f1e57ce03d6
7cb7979ff2b7a67b19d53015a992a93a
2,500
PASSED
#include <cstdio> #include <algorithm> using namespace std; const int MAXN = 1005; int N, M, K; char hor[MAXN][MAXN], ver[MAXN][MAXN]; int sol[MAXN][MAXN]; void load() { scanf("%d%d%d", &N, &M, &K); for (int i = 0; i < N - 1; i++) scanf("%s%s", hor[i], ver[i]); scanf("%s", hor[N - 1]); } void solve() { ...
C++
a5f650b6f5737f654eb30f1e57ce03d6
d93c11a99085f87eb39c9824ccff3307
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define mp make_pair #define pb push_back #define sqr(a) ((a) * (a)) #define sz(a) int(a.size()) #define all(a) a.begin(), a.end() #define forn(i, n) for(int i = 0; i < int(n); i++) #define fore(i, l, r) for(int i = int(l); i < int(r); ...
C++
a5f650b6f5737f654eb30f1e57ce03d6
c31ea438027ccf9edec2bbe38f0a842e
2,500
PASSED
#include <iostream> #include <fstream> #include <set> #include <string> #include <map> #include <queue> #include <algorithm> #include <deque> #include <memory.h> #include <assert.h> #include <cstring> #include <cmath> #define all(a) (a).begin(), (a).end() #define sz(a) (int)(a).size() #define pb push_back using names...
C++
a5f650b6f5737f654eb30f1e57ce03d6
168d06a49d96ac683d6162d8f6901b20
2,500
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define int long long #define ull unsigned long long #define pb push_back using namespace std; using namespace __gnu_pbds; typedef tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order...
C++
a5f650b6f5737f654eb30f1e57ce03d6
1906762c48c1fef9684daba129702ad9
2,500
PASSED
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define N 1005 int n, m, k, sum, cnt, flag, a[N][N]; char h[N][N], v[N][N]; int main() { scanf("%d%d%d", &n, &m, &k), sum = n * (m - 1) + (n - 1) * (m); rep(i, n) { scanf("%s", h[i]); ...
C++
a5f650b6f5737f654eb30f1e57ce03d6
39afa4aed6a3cb02c97568c98343191b
2,500
PASSED
#include<bits/stdc++.h> using namespace std; char s[55],s2[55]; char t2[10]="abacaba"; int q[105]; int main() { int t; cin>>t; while(t--) { int n,tt=0,tt2=0,ans=0,ans2=0,tot=0; cin>>n; scanf("%s",s+1); for(int i=1;i<=n-6;i++) { int flag=1; for(int j=i;j<=i+6;j++) { if(s[j]!='?'&&s[j]!=t2[j-i]...
C++
f6b7ad10382135b293bd3f2f3257d4d3
865ab8cce1775cab9dcab7319c48d8f9
1,500
PASSED
#include<bits/stdc++.h> using namespace std; string p="abacaba"; int main(){ int T; cin>>T; while(T--){ int n; cin>>n; string s; cin>>s; int sum=0; for(int i=0;i<s.size()-6;i++){ for(int j=i;j<=i+6;j++){ if(s[j]=='?')break; if(s[j]!=p[j-i])break; if(j==i+6)sum++; } } if(sum>1){ c...
C++
f6b7ad10382135b293bd3f2f3257d4d3
f0d4888d63ce37b9e1f052c284d09f75
1,500
PASSED
// https://beenpow.github.io/ #include<bits/stdc++.h> #define endl '\n' #define pb push_back //#define f first //#define s second #define all(v) (v).begin(), (v).end() #define rep(i,a,b) for(int i=a;i<b;i++) #define r_rep(i,a,b) for(int i=a;i>b;i--) #define vi vector<int> #define vll vector<ll> #define vpi vector<pair<...
C++
f6b7ad10382135b293bd3f2f3257d4d3
a31072ef8d2ecf271297cb1a6cbc5da9
1,500
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; long long int countFreq(string &pat, string &txt); int main() { long long int t,n,i,j,k,p; string s; string c="abacaba"; cin>>t; for(k=0;k<t;k++) { cin>>n; cin>>s; long long int cnt=countFreq(c,s); i...
C++
f6b7ad10382135b293bd3f2f3257d4d3
d471f21b2eff5124e12626b46cd2d54c
1,500
PASSED
#include<iostream> #include<algorithm> #include<map> #include<string.h> #include<vector> #include<string> #include<queue> #define ll long long const int inf = 1e9 + 7; using namespace std; #define IOS ios::sync_with_stdio(false),cout.tie(0) const string T = "abacaba"; string s; int n; bool check(string &a) { int cnt =...
C++
f6b7ad10382135b293bd3f2f3257d4d3
d5380b7d6f29984c04e9a273a3749322
1,500
PASSED
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int T,n,cnt,tot,ans[105]; char s[100],t[20]={'a','b','a','c','a','b','a'},c[100]; bool tag; inline int read() { int f=1,w=0; char ch=0; while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { w=(w<<1)+...
C++
f6b7ad10382135b293bd3f2f3257d4d3
f9f5bad43c894454e690269cec1b923b
1,500
PASSED
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int T,n,cnt,tot,ans[105]; char s[100],t[20]={'a','b','a','c','a','b','a'},c[100]; bool tag; inline int read() { int f=1,w=0; char ch=0; while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } ...
C++
f6b7ad10382135b293bd3f2f3257d4d3
504c14a930bc67de9457c2978abdc422
1,500
PASSED
#include<bits/stdc++.h> #define ll long long int #define mod 1000000007 using namespace std; int isSubstring(string s1, string s2) { int M = s1.length(); int N = s2.length(); for (int i = 0; i <= N - M; i++) { int j; for (j = 0; j < M; j++) if (s2[i...
C++
f6b7ad10382135b293bd3f2f3257d4d3
c5cb8fedbc5045f69e60c9c20e2bfaa5
1,500
PASSED
#include<bits/stdc++.h> #define ll long long int #define mod 1000000007 using namespace std; int contain(string s,string t) { int i,cnt=0,n=s.size(); for(i=0;i<=n-7;i++) { if(s.substr(i,7)==t) { cnt++; } } return cnt; } void process(string s) { int i,n=s.size(); for(i=0;i<n;i++) { if(s[i]=='?') ...
C++
f6b7ad10382135b293bd3f2f3257d4d3
1fff968216d6c215d07d156e72136830
1,500
PASSED
#include<Bits/stdc++.h> using namespace std; const string ans="abacaba"; string a; int num,t,n; bool flag; void clear() { num=0; a.erase(n); n=0; } bool cha(string hush,int w) { num=0; for(int i=0;i<7;i++) { if(hush[w+i]=='?')hush[w+i]=ans[i]; if(hush[w+i]!='?'&&hush[w+i]!=ans[i])return 0; } for(int ...
C++
f6b7ad10382135b293bd3f2f3257d4d3
053abd06b1cdac0f9a17bc5b77df5180
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n, cont=0; string s; cin>>n>>s; cont=0; bool band=true; for(int i=0; i<n; i++){ for(int j=i+1; j<n && band==true; j++){ if(s[i]==s[j]){ cont++; band=false; } } ...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
155bec9acc4493d90c1c53b416f4ffe4
1,000
PASSED
#include <iostream> #include <string> using namespace std; int main() { int n, r = 0; int alpha[26] = { 0 }; string s; cin >> n >> s; if (n > 26) { cout << -1 << endl; return 0; } for(char c : s) { if (alpha[c-'a']++ >= 1) { r += 1; } } cout << r << endl...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
c3afd11e052f492c765a55f6c6c08bd0
1,000
PASSED
#include <cstdio> #include <cstdlib> #include <string.h> #include <string> #include <math.h> #include <algorithm> #include <iostream> #include <queue> #include <stack> #include <map> #include <set> typedef long long ll; using namespace std; int a[30]; int main() { int n; string s; cin >> n; cin>>s; ...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
ba89f785094b2025867c4cbe7c06c1b5
1,000
PASSED
#include <iostream> #include <string> #include <set> using namespace std; int main () { int n; string w; set <char> s; cin >> n >> w; for(const char &c : w) s.insert(c); cout << ((int)((n<=26)?(n-s.size()):-1)) << endl; return 0; }
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
92e20a53715ddb10f7c3d455a4d15527
1,000
PASSED
#include <iostream> #include <set> using namespace std; int main () { int n; string w; set <char> s; cin >> n >> w; for(const char &c : w) s.insert(c); cout << (n>26?(int)(-1):(int)(n-s.size())) << endl; return 0; }
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
b69f79825375b41c0fad17f54f235339
1,000
PASSED
#include <iostream> #include <set> using namespace std; int main () { int n; string w; set <char> s; cin >> n; if(n > 26) { cout << -1 << endl; return 0; } cin >> w; for(const char &c : w) s.insert(c); cout << (n - s.size()) << endl; return 0; }
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
69dc4bd12755f42217fc8789c6d5af6b
1,000
PASSED
#include <iostream> #include <set> using namespace std; int main () { int n; string w; set <char> s; cin >> n >> w; for(const char &c : w) s.insert(c); printf("%d\n",((n>26)? -1 : (n-s.size()) ) ); return 0; }
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
019f5ddf686fd90364aa678888e2d5b9
1,000
PASSED
#include<bits/stdc++.h> #include<math.h> #include<vector> #include<stack> #include<queue> #include<iostream> #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair<int,int> Test; int main() { #ifndef ONLINE_JUDGE freopen("input...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
f27d9ae0672079e6150d60300d6e2e83
1,000
PASSED
// In the name of Allah // #include<algorithm> #include<iostream> using namespace std; int main() { int n,ans = 0,ans1 = 0,sum = 0; string s; cin >> n; cin >> s; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (s[i] == '0') { break; } if (s[i] == s[j] && s[i] != '0')...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
5e2720b2bcab59f232af142c5145e61b
1,000
PASSED
#include<bits/stdc++.h> #define MAX 100004 #define ll long long int using namespace std; int a[500]; int main() { int n; cin>>n; string s; cin>>s; for(int i=0;i<s.length();i++) { a[s[i]]+=1; } int sum=0,discnt=0; for(int i=0;i<300;i++) { if(a[i]>=1) { ...
C++
d9e9c53b391eb44f469cc92fdcf3ea0a
b0d339849e8ae9a0c8759a5962dcf7da
1,000
PASSED
//CF301 #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef pair<int,P> P1; typede...
C++
991a9b3904884c8d19ec7c665f2fcd95
4e56ade7bd9698a7ef6acbdb6bcb2b3d
2,100
PASSED
#include <stdio.h> #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <string> #include <queue> #include <map> #include <set> #include <cmath> #include <sstream> #include <stack> #include <string.h> #include <list> #include <assert.h> #define pb push_back #define mp make_pair #defin...
C++
991a9b3904884c8d19ec7c665f2fcd95
106b12f124efae27a359ff0c27cbe667
2,100
PASSED
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <sstream> #include <map> #include <set> #include <queue> #include <stack> #include <fstream> #incl...
C++
991a9b3904884c8d19ec7c665f2fcd95
3c19ff17858b6c0d802338068c450a94
2,100
PASSED
#include<stdio.h> #include<string.h> #include<math.h> #include<queue> #include<stdlib.h> using namespace std; #define maxm 110 #define inf (1<<29) struct node{ int no; int rem; node(){} node(int _no,int _rem){ no=_no,rem=_rem; } }; bool operator <(const node &a,const node &b){ return a...
C++
991a9b3904884c8d19ec7c665f2fcd95
6677a22e0185f2fa8bd06d38fb916134
2,100
PASSED
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_DEPRECATE #include <iostream> #include <cstdio> #include <cstdlib> #include <vector> #include <sstream> #include <string> #include <map> #include <set> #include <algorithm> #include <iomanip> #include <functional> #include <bitset> #include <cassert> #include <cmath> #in...
C++
991a9b3904884c8d19ec7c665f2fcd95
b0cd3a816a6ec14e65d9f817fb2b078b
2,100
PASSED
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<iostream> #include<vector> #include<map> using namespace std; const int N = 205; typedef __int64 ll; int dp[N],a[N],x[N],y[N],g[N][N],ot[N],q[N*N]; int main() { int n,i,j,d; scanf("%d%d",&n,&d); for(i=2;i<n;i++)scanf("%d",&a[i])...
C++
991a9b3904884c8d19ec7c665f2fcd95
3691a654d40af55442cd3ddd8b098d01
2,100
PASSED
#include <unordered_map> #include <unordered_set> #include <functional> #include <algorithm> #include <iostream> #include <iomanip> #include <numeric> #include <bitset> #include <string> #include <vector> #include <deque> #include <list> #include <map> #include <set> using namespace std; #define FOR(i,b,e) for( int i ...
C++
991a9b3904884c8d19ec7c665f2fcd95
1a4e299ead22efe854cb2868e076bd01
2,100
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <unordered_set> using namespace std; const int N = 101; const int INF = 1e9; int n, d; int a[N]; int x[N], y[N]; int g[N][N]; int ...
C++
991a9b3904884c8d19ec7c665f2fcd95
230905f743185a7f5cebdbc46764fe28
2,100
PASSED
#include <iostream> #include <stdio.h> #include <limits.h> #include <float.h> #include <math.h> #include <algorithm> #include <cstdlib> #include <memory.h> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <time.h> #include <string.h> #include <cmath> #include <iomanip> #include...
C++
991a9b3904884c8d19ec7c665f2fcd95
c2c8717feccf0252d7126c9e0c996f67
2,100
PASSED
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<algorithm> #include<iostream> #include<vector> #include<string> #include<queue> #include<set> #include<stack> using namespace std; struct pr { long long a1, a2; int v; int d; int f; pr(int ve, int de, int fe, long l...
C++
991a9b3904884c8d19ec7c665f2fcd95
23dde12f2ef05d6aa9ac5471aa4630af
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAXN 100005 int a[MAXN]; int main() { int t; cin>>t; while(t--) { int n,k; scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) scanf("%d",a+i); int flag=0; int q=0; for(int i=1;...
C++
2d988fe01f91847dcad52111c468c0ba
1dcf8461706f158b8e4c285fa5ba371e
2,000
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; inline int read () { int ret = 0, t = 1; char c = getchar(); while ((c < '0' || c > '9') && c != '-') c = getchar(); if (c == '-') t = -1, c = getchar(); while (c >= '0' && c <= '9') ret = ret * 10 +...
C++
2d988fe01f91847dcad52111c468c0ba
44a23e0f167aa57f9ee40686f9e215c0
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define R return #define B break #define C continue #define sf scanf #define pf printf #define pb push_back #define F first #define S second using namespace std; const ll Mod=1e9+7; ll poww(ll a,ll b,ll mod){ ll res=1;if(b<0)b=(b%(mod-1)+mod-1)%(mod-1); for(;b;b>...
C++
2d988fe01f91847dcad52111c468c0ba
4eb0b0a9837df0cc82dc5e4a8f1492b8
2,000
PASSED
#include <bits/stdc++.h> using namespace std; int n, k, t, a[100100]; bool work() { int cnt = 0; bool k_in = false; for (int i = 1, j = 1; i <= n; i++) { cnt += a[i] >= k ? 1 : -1; if (a[i] == k) k_in = true; if (cnt < 0) { cnt = 0; j = i + 1; k_in = false; continue; ...
C++
2d988fe01f91847dcad52111c468c0ba
1ab7d411cf953a47baf5bb91b45a27be
2,000
PASSED
#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 100010; int a[N]; int main() { int t, n, k; scanf("%d", &t); while(t--) { scanf("%d%d", &n, &k); bool not_has_k = true; for(int i = 1; i <= n; i++) { scanf("%d", a + i); if(a[i] == k) not_has_k = f...
C++
2d988fe01f91847dcad52111c468c0ba
1c6633d75cc5c560c20e04063f481a2a
2,000
PASSED
//#include<bits/stdc++.h> #include<iostream> #include<string> #include<cstdio> #include<vector> #include<string.h> #include<cstring> #include<set> #include<queue> #include<algorithm> #include<math.h> #include<stdio.h> #include<map> #include<stack> #include<list> #include<assert.h> #define INF 0x3f3f3f3f #define LLINF 1...
C++
2d988fe01f91847dcad52111c468c0ba
d82c376d8c24880d05fdd2ea76521db9
2,000
PASSED
/* be name Khoda */ #include <bits/stdc++.h> using namespace std; const int N = 100 * 1001; int n, k, a[N], t; bool ok, val; int main() { cin >> t; while (t--) { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == k) ok = true; } a[n] = 0; if (!ok) cout << "NO\n"; else if...
C++
2d988fe01f91847dcad52111c468c0ba
2cc21cb25ae74b81b222e2a1d0438309
2,000
PASSED
//#include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> //#include <queue> //#include <stack> #include <cstring> #include <cassert> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
C++
2d988fe01f91847dcad52111c468c0ba
b521c6f30125d43000d566ca2c4b7302
2,000
PASSED
//#include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> //#include <queue> //#include <stack> #include <cstring> #include <cassert> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
C++
2d988fe01f91847dcad52111c468c0ba
9b898be1ec0b7d9719eb2ca167f197b8
2,000
PASSED
//#include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> //#include <queue> //#include <stack> #include <cstring> #include <cassert> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
C++
2d988fe01f91847dcad52111c468c0ba
f855fd2c8e5066fc26fa80be6f9e0c9c
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long int n,i,p,q,sum1,sum3,sum=0; cin >> n; long long int a[n]; for(i=0;i<n;i++) { cin >> a[i]; } p=0; q=n-1; sum1=a[p],sum3=a[q]; while(p<q) { if(sum1<sum3) { p++; ...
C++
f2fc865a44b39179261a7311adf48390
366d30a695f3d273b0a8c205d962f01b
1,200
PASSED
#include <iostream> #include <algorithm> #include <cstring> #define N 200005 #define ll long long using namespace std; int an[N]; int main() { int n; cin>>n; for(int i=0;i<n;++i) { cin>>an[i]; } int a=0,c=n-1; ll sum=0; ll sum1=an[a],sum2=an[c]; while(a<c) { /*if(a==0&&c==n-1) { sum1+=an[a]; ...
C++
f2fc865a44b39179261a7311adf48390
753a4d781d2b3b73143c4f8398023f62
1,200
PASSED
#include<stdio.h> #include<algorithm> using namespace std; int n,a[200001]; int main( ) { scanf("%d",&n); for(int i=0 ; i<n ; i++) scanf("%d",&a[i]); int st,en; st=0,en=n-1; long long sumst=0,sumen=0,num=-1; sumst+=a[st]; sumen+=a[en]; while(st<en) { if(sumst>sumen) ...
C++
f2fc865a44b39179261a7311adf48390
0ea0b3c18f07cc3f4ac1264672ccf605
1,200
PASSED
#include<bits/stdc++.h> using namespace std; long long ans; int main() { int n, l, r; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { scanf ("%d", &arr[i]); } long long sum1, sum2; l = 0; r = n - 1; sum1 = arr[l]; sum2 = arr[r]; while (l < r) { if (sum1...
C++
f2fc865a44b39179261a7311adf48390
2d15ac23294256975659da1286a391b7
1,200
PASSED
#include<iostream> using namespace std; int main() { int n; cin >> n; int *arr = new int [n]; for (int i=0;i<n;i++) cin >> arr[i]; long long int sum1 = arr[0]; long long int sum3 = arr[n-1]; int i=0,j=n-1; if (n==1) { cout << "0"; return 0; } while ((j-i)>1) { if (sum1 < sum3) { sum1 = sum1 + a...
C++
f2fc865a44b39179261a7311adf48390
bff56f775a719e99cbc27cc6355b459f
1,200
PASSED
#include<bits/stdc++.h> #define ll long long #define R return #define C continue #define B break using namespace std; ll mod=1e18+9; ll poww(ll x,ll y){ if (y==0) R 1; if (x==1) R 1; if (x==0) R 0; if (y==1) R x; ll d=poww(x,y/2); d%=mod; if (y%2) R (((d*d)%mod)*x)%mod; R (d*d)%mod; } ve...
C++
f2fc865a44b39179261a7311adf48390
d6576032c0c31846126c19a2406035e6
1,200
PASSED
#include <iostream> using namespace std; #include<stdio.h> int main(){ long long N,Sum=0,sum1=0,sum3=0,pos1=0,pos2=0; //scanf("%LLD",&N); cin>>N; long long arr [N]; for(int i=0;i<N;i++){ // scanf("%LLD",&arr[i]); cin>>arr[i]; Sum+=arr[i]; } for(int i=0; i<N; i++){ sum1+=arr[i]; //printf("sum1:%d",su...
C++
f2fc865a44b39179261a7311adf48390
f00c07f2833c3d56fd0bd316ded57008
1,200
PASSED
#include<bits\stdc++.h> using namespace std; const int maxn = 3e5+10; typedef long long ll; ll a[maxn]; int main(void) { ll n,sum1 = 0,sum2 = 0,sum = 0,pos1,pos2; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; sum += a[i]; } for(int i=0;i<n;i++){ sum1 += a[i]; if(sum1 >= (...
C++
f2fc865a44b39179261a7311adf48390
0c93fe0edbb04c08e30630525dce7baa
1,200
PASSED
#include<iostream> using namespace std; int main(){ long long n,i,j,a=0,b=0,sum=0; cin>>n; int c[n]; for(i=0;i<n;i++){ cin>>c[i]; } i=0;j=n-1; while(i<j){ a=a+c[i]; b=b+c[j]; if(a==b){ sum=b; i++; j--; } el...
C++
f2fc865a44b39179261a7311adf48390
f04db27c621ae2136e29d1ca28332d35
1,200
PASSED
#include<bits/stdc++.h> using namespace std; long long sum[200010], a[200010],n,maxn=-1; int main() { cin>>n; memset(sum,0,sizeof(sum)); for(int i=1;i<=n;i++) cin>>a[i],sum[i]+=sum[i-1]+a[i]; int i,j; for(i=1,j=n;i<j;) if(sum[i]==sum[n]-sum[j-1]) maxn=sum[i],i++,j--; else if(su...
C++
f2fc865a44b39179261a7311adf48390
089241b5418a6f304ed68313fea80f6f
1,200
PASSED
#include <bits/stdc++.h> #define pb push_back #define time { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); } using namespace std; //ifstream in("reform.in"); //ofstream out("reform.out"); typedef long long ll; typedef long double ld; typedef unsigned long long ull; t...
C++
eab8e5ac203d9f10c893ea35d249fe84
faf29c2eb82cbbb15dc4e6081f7358d0
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define all(v) v.begin(),v.end() #define count_ones __builtin_popcountl #define int long long int #define endl "\n" #define mod(x,m) ((x%m+m)%m) #define limit 1000000007 #define fori(x,n) for(int i=x;i<n;i++) #define forj(y,m) for(int j=y;j<m;j++) #define fork(z,m1) for(int...
C++
eab8e5ac203d9f10c893ea35d249fe84
d1d44bd6a9421d6dab579024acb7ae64
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define ull unsigned long long #define pu push #define REP(i,a,b) for (int i=a; i<=b; i++) #define REPD(i,a,b) for (int i=a; i>=b; i--) using namespace std; const int di[] = {-1,0,1,0}; const int dj[] = {0,1,0,-1}; const int dl[] = {0,0,0,-1}; const int...
C++
eab8e5ac203d9f10c893ea35d249fe84
779766707098530cdfe4667533c3f479
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define MOD 1000000007 #define PI 3.1415926535897932 #define ms(s, n) memset(s, n, sizeof(s)) #define prec(n) fixed<<setprecision(n) #define eps 0.000001 #define all(v) v.begin(), v.end() #define bolt ios::sync_with_stdio(0);cin.t...
C++
eab8e5ac203d9f10c893ea35d249fe84
b0a43ca2d39e9ffa39f95da738438a33
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define MOD 1000000007 #define PI 3.1415926535897932 #define ms(s, n) memset(s, n, sizeof(s)) #define prec(n) fixed<<setprecision(n) #define eps 0.000001 #define all(v) v.begin(), v.end() #define bolt ios::sync_with_stdio(0);cin.t...
C++
eab8e5ac203d9f10c893ea35d249fe84
c3c42011b30fd234de1f6373c5e2125b
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string s,x; // cout<<(1<<30); while(1){ cin>>s; if(s!="start"){ exit(0); } else{ long a,b,x,y,c,d; x=1;y=2; for(int i=1;;){ cout<<"? "<<x<<" "<<y<<endl; ...
C++
eab8e5ac203d9f10c893ea35d249fe84
093b5dd932797abc71473469966e5da6
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string s,x; // cout<<(1<<30); while(1){ cin>>s; if(s!="start"){ exit(0); } else{ long a,b,x,y,c,d; x=1;y=2; for(int i=1;;){ cout<<"? "<<x<<" "<<y<<endl; ...
C++
eab8e5ac203d9f10c893ea35d249fe84
541d8734d276bfb6a0927ab3a8c0e1a5
2,000
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less #define MAX 5002 #define pb push_back #define For(i,s,e) for (ll i=(s); i<(e); i++) #define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" " #define Foe(i,...
C++
eab8e5ac203d9f10c893ea35d249fe84
a2f22801af160476843a899bec628895
2,000
PASSED
// #include <bits/stdc++.h> #include<cstdio> #include<iostream> #include<vector> #include<map> #include<queue> #include<algorithm> #include<deque> #include<cmath> #include<set> #include<cstring> #include<string.h> using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; //---------------- #define int long...
C++
eab8e5ac203d9f10c893ea35d249fe84
c55e5b2ea72f823671a08f87d980a062
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define Sheryang main const int maxn = 1e6 + 7; typedef long long ll; const int mod = 1e9 + 7; int read() {int c = getchar(), Nig = 1, x = 0; while (!isdigit(c) && c != '-')c = getchar(); if (c == '-')Nig = -1, c = getchar(); while (isdigit(c))x = ((x << 1) + (x << 3)) + (c^...
C++
eab8e5ac203d9f10c893ea35d249fe84
ba0f3367ef7ee35e6dd175952dc01d6f
2,000
PASSED
#include <iostream> #include <vector> #include <string.h> #include <algorithm> #include <stdio.h> using namespace std; const int Max=410000; int a[Max]; int p1[Max]; int p2[Max]; int mp1[Max]; int mp2[Max]; int n; void input() { memset(mp1,63,sizeof(mp1)); memset(mp2,63,sizeof(mp2)); //memset(p1,0,sizeo...
C++
eefea51c77b411640a3b92b9f2dd2cf1
c880a4109c1378504dc695c68aa09db9
1,900
PASSED
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <cmath> using namespace std; const int N = 1e5 + 5; int n, tot, s1[N], s2[N], p1[N], p2[N]; char ch; struct result { int s, t; result(){} result(const int &_s, const int &_t): s(_s), t(_t){} inline bool operator < (const result...
C++
eefea51c77b411640a3b92b9f2dd2cf1
65c816320bb0203ac6e0537d598ee92b
1,900
PASSED
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <cmath> using namespace std; const int N = 3e5 + 5; int n, tot, s1[N], s2[N], p1[N], p2[N]; struct result { int s, t; result(){} result(const int &_s, const int &_t): s(_s), t(_t){} inline bool operator < (const res...
C++
eefea51c77b411640a3b92b9f2dd2cf1
ad886eb624ad2b108fac294e38a04918
1,900
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <algorithm> #include <cstring> #include <string> #include <memory.h> #include <sstream> #include <vector> using namespace std; vector<int> sum1; vector<int> sum2; bool f (...
C++
eefea51c77b411640a3b92b9f2dd2cf1
2f5557228b2edec0b8691857f801417e
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> using namespace std; #define MAXN 200200 int n, a[MAXN], firs[MAXN][3], wins[MAXN][3]; // firs(i,j) is the first index at which player j achieves i wins vector <pair<int, int> > ans; int main() { cin >> n; for(int i ...
C++
eefea51c77b411640a3b92b9f2dd2cf1
fca8ad0328c9795a524dc35582252f89
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> using namespace std; int n, a[200200], setw[200200][3], first2[200200][3]; vector <pair<int, int> > ans; int main() { cin >> n; for(int i=1;i<200200;i++) first2[i][1] = first2[i][2] = 1 << 20; for(int i=...
C++
eefea51c77b411640a3b92b9f2dd2cf1
5d2a61aa0a78ccfa7e453e890f62e3db
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> using namespace std; int n, a[200200], setw[200200][3], first2[200200][3]; vector <pair<int, int> > ans; int main() { cin >> n; for(int i=1;i<200200;i++) first2[i][1] = first2[i][2] = 1 << 20; for(int i=...
C++
eefea51c77b411640a3b92b9f2dd2cf1
646f7ab2cdfa4dfa46b1dab514cb7e47
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> using namespace std; int n, a[200200], setw[200200][3], first2[200200][3]; vector <pair<int, int> > ans; int main() { cin >> n; for(int i=1;i<200200;i++) first2[i][1] = first2[i][2] = 1 << 20; for(int i=...
C++
eefea51c77b411640a3b92b9f2dd2cf1
51719e42a335ef25abd5c319622aeec8
1,900
PASSED
#include <algorithm> #include <iostream> #include <stdlib.h> #include <string.h> #include <iomanip> #include <stdio.h> #include <string> #include <queue> #include <cmath> #include <stack> #include <time.h> #include <map> #include <set> #define eps 1e-8 #define M 1000100 #define LL long long //#define LL long long #defi...
C++
eefea51c77b411640a3b92b9f2dd2cf1
488a51e28ec0595aa30943e935d1275f
1,900
PASSED
// // main.cpp // Tennis Game // // Created by Iago Almeida Neves on 12/22/14. // Copyright (c) 2014 Iago Almeida Neves. All rights reserved. // #include <bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f #define MOD 1000000007 #define _ ios_base::sync_with_stdio(false); cin.tie(NULL); typedef long long l...
C++
eefea51c77b411640a3b92b9f2dd2cf1
b0761a26813249b4bc19a49bc416fd0e
1,900
PASSED
#include <bits/stdc++.h> #define fst first #define snd second using namespace::std; typedef long long ll; const int maxn = 2e5 + 5; const ll mod = 1e9 + 7; ll ans, suml[maxn], sumr[maxn]; char s[maxn]; int n; ll inv[maxn], power[maxn]; ll mod_pow(ll x, ll k, ll p) { ll ret = 1; while (k) { if (k ...
C++
75e6bc042f61d2dd61165866a13d1c6d
6fc67b2b688ea7c4b388dba316e60df7
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1e9 + 7; vector <ll> fact; pair<ll, pair<ll, ll> > extendedEuclid(ll a, ll b) { if (a == 0) return make_pair(b, make_pair(0, 1)); pair<ll, pair<ll, ll> > p; p = extendedEuclid(b % a, a); return make_pair(p.first, make_pair(p....
C++
75e6bc042f61d2dd61165866a13d1c6d
5997ed32b736cf06aa37f33e5b73d4c2
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1e9 + 7; vector <ll> fact; // C function for extended Euclidean Algorithm ll gcdExtended(ll a, ll b, ll *x, ll *y) { // Base Case if (a == 0) { *x = 0, *y = 1; return b; } ll x1, y1; // To store results ...
C++
75e6bc042f61d2dd61165866a13d1c6d
9e191a9df4ea6701d0a3393f0454d9d3
2,300
PASSED
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <cmath> #include <ctime> #include <queue> #include <set> #include <map> #include <string> #include <bitset> #include <vector> #include <complex> #include <algorithm> using namespace std; typedef long long ll; typedef double db; typedef...
C++
75e6bc042f61d2dd61165866a13d1c6d
4b7d0f5deaa9eeb0c0eebb14495caeba
2,300
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int maxn=2e5+7; const int mod=1e9+7; int dp1[maxn],dp2[maxn],ans,fact[maxn]; string s; void precom(){ for(int i=0;i<s.size();i++){ dp1[i]+=dp1[i-1]; if(s[i]=='(')dp1[i]++; } for(int i=s.size()-1;i>=0;i--){ dp2[...
C++
75e6bc042f61d2dd61165866a13d1c6d
6e165fc40a233b86bcd15ecf77919554
2,300
PASSED
#include <iostream> #include <string> using namespace std; #define M ((int)1e9 + 7) int fact[200001]; void e_gcd(int a,int b,int& x,int& y){ if(!a){ x=0; y=1; return; } int x1,y1; e_gcd(b%a,a,x1,y1); x=y1-(b/a)*x1; y=x1; return; } inline int a_mod(int a,int b){ return ((long long)(a+b))%M; } inline int m_...
C++
75e6bc042f61d2dd61165866a13d1c6d
69f31f7da1f2964495925c3cbf8c8fd8
2,300
PASSED
#include <iostream> #include <string> using namespace std; #define M ((int)1e9 + 7) int fact[200001]; void e_gcd(int a,int b,int& x,int& y){ if(!a){ x=0; y=1; return; } int x1,y1; e_gcd(b%a,a,x1,y1); x=y1-(b/a)*x1; y=x1; return; } inline int F(int n) { return (n < 0) ? 0 : fact[n]; } inline int a_mod(int ...
C++
75e6bc042f61d2dd61165866a13d1c6d
3bbfab099df7e5983d814514d3cc3166
2,300
PASSED
#include <iostream> #include <vector> #include <cstdint> using namespace std; int mod = (int)1e9 + 7; int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) { if (!a) { x = 0; y = 1; return b; } int64_t x1, y1; int64_t d = extGcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return d; } inli...
C++
75e6bc042f61d2dd61165866a13d1c6d
03706865d5287c90cf648f731977752e
2,300
PASSED
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second #define mp make_pair #define pb push_back #define int ll using namespace std; const int md=1000000007; const int N=400001; string s; int f[N]; int o[N]; int st[N]; int bin(int a,int n) { int res=1; while(n) { if(n&...
C++
75e6bc042f61d2dd61165866a13d1c6d
495ce0fed219972b3421bdcbac9fe38e
2,300
PASSED
#include <iostream> #include <string> using namespace std; const int mod = 1e9+7; string s; int fact[200009],inv[200009],factinv[200009]; int combination(int n,int k){ if (n < 0 || k < 0 || n-k < 0) return 0; return 1LL*fact[n]*factinv[k]%mod*factinv[n-k]%mod; } int main(){ fact[0] = 1; for (int i = 1...
C++
75e6bc042f61d2dd61165866a13d1c6d
183e542fafc77528a9aa842aba48ee5f
2,300
PASSED
#include<bits/stdc++.h> #define FORA(i,n,ii,s) for(int i=s;i<n;i+=ii) #define FORF(i,n,j) for(int i=j;i<n;i++) #define FOR(i,n) for(int i=0;i<n;i++) #define FORD(i,n) for(int i=n;i>0;i--) #define MIN(x,y) ((x<y)?x:y) #define MAX(x,y) ((x>y)?x:y) using namespace std; int n; int p1[200]; int p2[200]; int add(int p1[],int...
C++
c2362d3254aefe30da99c4aeb4e1a894
651eb3f294d29cf3241c7809545fa833
2,200
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <vector> #include <map> #include <set> #include <deque> #include <list> #include <algorithm> #include <cmath> #include <climits> #define Long long long #define IntPair pair<int, int> using namespace std; int main() { const int max = 200...
C++
c2362d3254aefe30da99c4aeb4e1a894
779012ab1f5f0b17516647f574426e2c
2,200
PASSED
/* ****GT_18**** */ #include<bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int,ll int> #define vi vector<ll int> #define all(a) (a).begin(),(a).end() #define F first #define S second #define sz(x) (ll in...
C++
c2362d3254aefe30da99c4aeb4e1a894
a306d2e7bfb9713c7d825b3d035a15a1
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 200 + 5; int n, ed[N]; LL a[N][N]; void init() { a[1][0] = 1; ed[1] = 0; for (int i = 2; i <= 160; ++i) { int mx = 0; for (int j = 0; j <= 160; ++j) { a[i][j + 1] = a[i - 1][j]; if (a[i][j] + a[i - 2][j] > 1) { a[i][j] -...
C++
c2362d3254aefe30da99c4aeb4e1a894
1f0479aa860622dd28d3af4636028461
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define ALL(A) (A).begin(), (A).end() #define CLR(A, X) memset(A, X, sizeof(A)) typedef long long LL; typedef pair<int, int> PII; const double eps = 1e-10; const double PI = acos(-1.0); const auto INF = 0x3f3f3f3f; int...
C++
c2362d3254aefe30da99c4aeb4e1a894
0687bed3a2f32ff70a303fabdea88279
2,200
PASSED
#include<bits/stdc++.h> using namespace std; int n; int q[200][200]; int main() { q[1][0]=1; q[2][1]=1; for(int i=3;i<=156;i++) { bool flag=false; for(int j=1;j<=156;j++) q[i][j]=q[i-1][j-1]; for(int j=0;j<=156;j++) { if(q[i][j]-q[i-2][j]>1 || q[i][j]-q[i-2][j...
C++
c2362d3254aefe30da99c4aeb4e1a894
0659783842abd5f673ecd36d7b42ae32
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int ans1[505][505], ans2[505][505], p, x = -1, y = -1; int main() { int n; scanf("%d", &n); ans1[1][1] = 1; ans2[1][0] = 1; for(int i = 2; i <= n; i++) { p = 0; for(int j = 0; j <= 200; j++) { if(j) { if(!p) { ans1[i][j] = ans1[i-1...
C++
c2362d3254aefe30da99c4aeb4e1a894
b48e88d3f926f674f3b3c5ced37fc194
2,200
PASSED
/******************************** * Author : Vinayak Sachdeva * * MNIT JAIPUR, INDIA * ********************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> #include <limits.h> #include <vector> #include <utility> #include <queue> using name...
C++
c2362d3254aefe30da99c4aeb4e1a894
bc1407c8f1b7951903d0ac7b5cd4864f
2,200
PASSED