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; int main() { int n; cin >> n; string s; cin >> s; map<char, int> mp; int i,j,z=0,ne=0; string one="1 ", zero="0 "; for (i=0;i<n;i++) { mp[s[i]]++; } z = mp['z']; ne = mp['n']; string final = ""; for (i=0;i<ne;i++) final = final + one; for (i=0;i<z...
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
f5a5e95e50a99d007ddf490dc040c2ce
800
PASSED
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define dofloat cout<<fixed<<setprecision(8) #define pb push_back #define mp make_pair #define bitcount __builtin_popcount #define all(vec) vec.begin(),vec.end() #define rall(vec) vec.rbegin(),vec.rend() using namespace std; typedef...
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
b617229d326f05561a8adb295a9a7448
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin>>n; ll ans1,ans0; string s; cin>>s; ll c=0; for(int i=0;i<n;i++) { if(s[i]=='n') c++; } for(int i=0;i<c;i++) cout<<"1"<<" "; for(int i=0;i<(n-c*3)/4;i++) cout<<"0"<<" "; }
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
f109fccb966db3d1aa818010cfb2741d
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin>>n>>s; sort(s.begin(),s.end()); for (int i=0; i<n; i++) { if (s[i]=='n')cout<<1<<" ";else if (s[i]=='r')cout<<0<<" "; } }
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
1d6249a774357adfbd966f44e6fe02b4
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin>>n>>s; sort(s.begin(),s.end()); for (int i=0; i<n; i+=1) { if (s[i]=='n')cout<<1<<" "; else if (s[i]=='z')cout<<0<<" "; } }
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
89d606cc3239796d3ae52926a30bae95
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin>>n>>s; sort(s.begin(), s.end()); for (int i=0; i<s.size(); i++) { if (s[i]=='z') cout<<0<<" ";else if (s[i]=='n')cout<<1<<" "; } }
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
16c08f6df104d6117cb874fcc341ba22
800
PASSED
#include <bits/stdc++.h> using namespace std; #define jeno_joyer_khuda_thake int main (void) #define kaj_shesh return 0 #define sf scanf #define pf printf #define ssf ...
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
4fde349412f62a9f410e0c34fce9f995
800
PASSED
// bits/stdc++.h works in linux. // It loads most of the libraries of C++ required. #include <bits/stdc++.h> #include <string> #include <stdio.h> #include <ctype.h> using namespace std; int main() { // Read the number of test cases. int T; scanf("%d", &T); char s[T+1]; scanf("%s", s); int num_...
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
a6b09a7d6ed6cfdd6570ecc51c1f543c
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int z=0; cin>>z; string s; cin>>s; for(int i=0;i<z;i++) { if(s[i]=='n') cout<<"1"<<" "; } for(int i=0;i<z;i++) { if(s[i]=='z') cout<<"0"<<" "; } }
C++
5e5dbd70c7fcedf0f965aed5bafeb06c
868208c69db2bb6ed4298c8ba5e88c6b
800
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
ceb69992b8f32cd95fa92aa06ca1fc41
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
53bfa723afbdfcb9d5c1b394e3db100f
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
8b7afd1d9520ca7f2a0cfa12f1bbc247
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
2aeed21eb3df90384059194647e79885
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
1454096295b476b0c3391b8063c6a553
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
82f11252d46847555bf87ff285aae398
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
b6214a094c1181da4c10718de5b3c241
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
ea126e48cc1fd18a066fcbc31ae5b362
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
1644570dfea4b3a5abbee4143aab8948
2,200
PASSED
/** Adjacency list implementation of Edmonds-Karp algorithm. For Undirected graphs, add each edge in both directions Source : Emaxx (modified) Running time: O(VE^2) INPUT: - graph, constructed using AddEdge() - source and sink OUTPUT: - maximum flow value - To obtain actual flow values, loo...
C++
f404720fd6624174c33d93af6349e561
530acbcc29f0f956226a1f316049c077
2,200
PASSED
// Original submission: https://codeforces.com/contest/911/submission/33820899 // What's different about that one from mine? #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") # include <iostream> # include <stdio.h> using na...
C++
56c375ba93e136715a2276d2e560dd51
7ade1871da9c78bbb9f7261d1e661695
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define N 200005 #define M 100 #define S 450 // #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) char buf[1<<21],*p1=buf,*p2=buf; int read(){ int w=0,f=1; char c=' '; while(c<'0'||c>'9')c=getchar(),f=c=='-'?-1:f; while(c>='0'&&c<='9')w=...
C++
56c375ba93e136715a2276d2e560dd51
4dbfb5a3ff646da78772ebe6b7f7f68d
2,500
PASSED
#include <bits/stdc++.h> using namespace std; struct Node { vector <char> c; bool hasCarry; Node() { c.resize(100); for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void clear() { for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void updateN(char u, char v) { for (char &x : c) { ...
C++
56c375ba93e136715a2276d2e560dd51
07b6e07f8cd1527ed4c7c2e97498d06d
2,500
PASSED
#include <bits/stdc++.h> using namespace std; struct Node { vector <char> c; bool hasCarry; Node() { c.resize(100); for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void clear() { for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void updateN(char u, char v) { for (char &x : c) { ...
C++
56c375ba93e136715a2276d2e560dd51
6ebe2023f933c557cb667381efd18193
2,500
PASSED
#include <bits/stdc++.h> using namespace std; struct Node { vector <char> c; bool hasCarry; Node() { c.resize(100); for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void clear() { for (int i = 0; i < 100; i++) c[i] = i; hasCarry = 0; } void updateN(char u, char v) { for (char &x : c) { ...
C++
56c375ba93e136715a2276d2e560dd51
02763be644f6690cf01c223612357117
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 6e5 + 1; const int MX = 100; int d[N][MX]; int v, a[N]; void push(int v) { for (int i = 0; i < MX; ++i) { d[2*v + 1][i] = d[v][d[2*v + 1][i]]; d[2*v + 2][i] = d[v][d[2*v + 2][i]]; } for (int i = 0; i < MX; ++i) d[v][i] = i...
C++
56c375ba93e136715a2276d2e560dd51
fcd49cf4767b7394207d8c28aba11726
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int N = 200005; short tr[1<<19][101]; bool lz[1<<19]; short a[N]; void push(int v, int l, int r){ if(lz[v]){ if(l != r){ int v1 = v<<1; int v2 = v1|1; for(int i = 0; i <= 100;...
C++
56c375ba93e136715a2276d2e560dd51
1d717f4d190c6aad111a363372a3743a
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int N = 200005; int tr[N<<2][101]; bool lz[N<<2]; int a[N]; void push(int v, int l, int r){ if(lz[v]){ if(l != r){ int v1 = v<<1; int v2 = v1|1; for(int i = 0; i <= 100; i++){...
C++
56c375ba93e136715a2276d2e560dd51
5f40f79178a064d6aed8e4e322f652ff
2,500
PASSED
/// FUCK YOU, PIECE OF SHIT #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") # include <iostream> # include <stdio.h> using namespace std; unsigned char a[200000]; int main() { ios_base::sync_with_stdio(false); c...
C++
56c375ba93e136715a2276d2e560dd51
44eaf256c8b87228307b841bd919b480
2,500
PASSED
/// FUCK YOU, PIECE OF SHIT #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") # include <iostream> # include <stdio.h> using namespace std; unsigned char a[200000]; int main() { ios_base::sync_with_stdio(false); c...
C++
56c375ba93e136715a2276d2e560dd51
d5d82715a95e0df079cf7c9ea2d9b5b9
2,500
PASSED
/* ------------------------- Hachiikung --------------------------------- ---------------------- Worrachate Bosri ------------------------------ ------ Faculty of Computer Engineering Chulalongkorn University ------ */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #includ...
C++
5f7d501171f293e126dd807c65c1d1b4
33777819ee49344f340ddc63caa7b5f6
2,400
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #define maxn 199999999999999LL using namespace std; long long n,m,i,j,k,p; long long dis[200005],sum[100005],a[100005],t[100005],h[100005],d[200005]; long long head,tail,q[100005],f[100005][105]; bool cmp(...
C++
5f7d501171f293e126dd807c65c1d1b4
5ca952caebaf7c5d60ff0b6978d964ef
2,400
PASSED
#include<cstdio> #include<cmath> #include<stack> #include<map> #include<set> #include<queue> #include<deque> #include<string> #include<utility> #include<sstream> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long lld; const lld inf = 100100100100100100LL; const int N = 1001...
C++
5f7d501171f293e126dd807c65c1d1b4
1863b2829d8410c4cce94ff9f5559b6a
2,400
PASSED
#include<cstdio> #include<cmath> #include<stack> #include<map> #include<set> #include<queue> #include<deque> #include<string> #include<utility> #include<sstream> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long lld; const lld inf = 100100100100100100LL; const int N = 1001...
C++
5f7d501171f293e126dd807c65c1d1b4
c974250e7ec3d0db15826ea103a05c80
2,400
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define NN 100010 #define PP 120 #define INF 10000000000000000LL int n,m,p; int d[NN],t[NN],q[NN]; long long f[NN][2],sum[NN]; int main(){ int a,b; int pas,now; int i,j,he,ta; scanf("%d%d%d",&n,&m,&p); ...
C++
5f7d501171f293e126dd807c65c1d1b4
6fe770695fa5dec1fe029cb054c7830e
2,400
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
5f7d501171f293e126dd807c65c1d1b4
ea698d17abf8625d31a1d29efff1a16f
2,400
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
5f7d501171f293e126dd807c65c1d1b4
4563299295fbf3804e8ca8e785f9e6ea
2,400
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
5f7d501171f293e126dd807c65c1d1b4
ba40740df5aaa6172868b46cda4cf3ce
2,400
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
5f7d501171f293e126dd807c65c1d1b4
6f1143d728d477ed9ba2fa73587654fb
2,400
PASSED
#define ll __int64 #define vi vector <int> #define pii pair <int,int> #define FOR(i, a, b) for (i = (a); i <= (b); i++) #define REP(i, a) for (i = 0; i < (a); i++) #define ALL(v) (v).begin(), (v).end() #define SET(a, x) memset((a), (x), sizeof(a)) #define SZ(a) ((int)(a).size()) #define CL(a) ((a).clear()) #define SORT...
C++
5f7d501171f293e126dd807c65c1d1b4
efbb4b92081bae87cc58da95ed821f14
2,400
PASSED
#include <iostream> #include <string> using namespace std; int main() { int n, count = 0; cin >> n; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; if (b - a >= 2) { count++; } } cout << count; return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
903fc9538d5072b42e8e67c0b90c8999
800
PASSED
#include<iostream> using namespace std; int main(){ int n; cin >> n; int a, b, count = 0; while (n--) { cin >> a >> b; if(b - a >= 2) ++count; } cout << count << endl; return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
bf7f138855b4cbfd219dddd244573432
800
PASSED
#include<stdio.h> int main() { int a,b,c,count=0; scanf("%d",&a); for(int i=0;i<a;i++) { scanf("%d%d",&b,&c); if((c-b)>=2) count++; } printf("%d",count); return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
c6e266d97db10f6ebbd2231b89e4eb2d
800
PASSED
#include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { int n; cin>>n; int count=0; while(n--){ int p,q; cin>>p>>q; if(q-p>=2)count++; } cout<<count<<"\n"; return 0; } ...
C++
2a6c457012f7ceb589b3dea6b889f7cb
36431d4597a9f1c514e4b47f62eb8399
800
PASSED
#include <stdio.h> int main(void){ int n,q,cnt=0; int p; scanf("%d",&n); while(n--){ scanf("%d%d",&p,&q); if (q-p>1) cnt++; } printf("%d",cnt); return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
4a923b1f8e7bc06da6a6a38d500b36ab
800
PASSED
#include<stdio.h> int main() { int a,b,c,count=0; scanf("%d",&a); for(int i=0;i<a;i++) { scanf("%d%d",&b,&c); if((c-b)>=2) count++; } printf("%d",count); return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
dbcd191b9c000930ce8d6db2a9fe7bdd
800
PASSED
#include<stdio.h> int main(void) { int n;int m=0; scanf("%d",&n); while(n--) { int a,b; scanf("%d%d",&a,&b); if(b-a>=2) m++; } printf("%d\n",m); }
C++
2a6c457012f7ceb589b3dea6b889f7cb
5f746391b51d7a4385dde6bafd7c063d
800
PASSED
#include<stdio.h> int main() { int n,i,count=0 ,p[103],q[103]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%d",&p[i],&q[i]); if(q[i]-p[i]>=2) count++; } printf("%d\n",count); }
C++
2a6c457012f7ceb589b3dea6b889f7cb
01cfd4ebed0d762e78c78930c17d0363
800
PASSED
#include <cstdio> int main(void) { int n, p, q, count = 0; scanf("%d",&n); while(n--) { scanf("%d%d",&p,&q); if(q - p >= 2) { count++; } } printf("%d\n",count); return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
a3d140f934bd28dae884e1957ba5223e
800
PASSED
#include <iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include <vector> using namespace std; int main() { int a,b,cot=0,n; cin>>n; while(n--) { cin>>a>>b; if(b-a>=2) cot++; } cout<<cot<<endl; return 0; }
C++
2a6c457012f7ceb589b3dea6b889f7cb
b7e362880375618971257e066f3956de
800
PASSED
#include <bits/stdc++.h> #define ll long long #define N 500005 using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string a,b,c; cin>>a>>b>>c; int cnta[300]={0},cntb[300]={0},cntc[300]={0}; for (auto x:a) cnta[x]++; for (auto x:b) cntb[x]++; for (auto x:c) cntc[x]++; in...
C++
9dc956306e2826229e393657f2d0d9bd
c355a000711bc87b395a5904b30ceac7
1,800
PASSED
#include<bits/stdc++.h> #define pr(x) cerr << "\n" << (#x) << " is " << (x) << endl #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define ull unsigned long long #define Toggle(n,i) (n^(1<<i)) #define Check(n,i) (n&(1<<i)) #define Set(n,i) (n|(1<<i)) #define Reset(n,i) (n&(~(1<<i))) ...
C++
9dc956306e2826229e393657f2d0d9bd
87f186bf1d5f1577cc70daf7b84a29a4
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int i,i0,n,m,cnt[150],cnta[150],cntb[150],maxn,maxi,tmp[150],t,non,maxi2; char s[100005],a[100005],b[100005]; int main() { while(scanf("%s %s %s",s,a,b)!=EOF) { maxi=maxi2=t=maxn=0; n=strlen(s); for(i=0;i<n;i++)cnt[s[i]]++; n=strlen(a)...
C++
9dc956306e2826229e393657f2d0d9bd
3590144b85b6900bc92fe1f0c590750f
1,800
PASSED
#include<bits/stdc++.h> using namespace std; // constructive algorithm and hashing int B[26]; int A[26]; int C[26]; int main() { //ios_base::sync_with_stdio(false); //cin.tie(NULL); string base; string a; string c; cin>>base; cin>>a; cin>>c; for(int i=0;i<base.size();i++) B[...
C++
9dc956306e2826229e393657f2d0d9bd
f2fb8936c6d642b577cb6fee5a1c7364
1,800
PASSED
#include <bits/stdc++.h> using namespace std; /* Algorithm: a = "pozdravstaklenidodiri" b = "niste" c = "dobri" STEP 1. Find the frequency array of string a. a b c d e f g h i j k l m n o p q r s t u v w x y z freq(a) = {2 0 0 3 1 0 0 0 3 0 1 1 0 1 2 1 0 2 1 1 0 1 0 0 0 1} STEP 2. Determine which s...
C++
9dc956306e2826229e393657f2d0d9bd
c0ca1c656dca91ca62c7993fb1e13934
1,800
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds ; #define ll long long #define pp pair<ll,ll> #define rep(i,a,b) for(ll i=a;i<b;i+=1) #define all(c) (c).begin(),(c).end() #define pb push_back #define sz(a) int((a).size()...
C++
9dc956306e2826229e393657f2d0d9bd
d504bc8bd2770f1dc3811d0d2d9da932
1,800
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds ; #define ll long long #define pp pair<ll,ll> #define rep(i,a,b) for(ll i=a;i<b;i+=1) #define all(c) (c).begin(),(c).end() #define pb push_back #define sz(a) int((a).size()...
C++
9dc956306e2826229e393657f2d0d9bd
2b4dddeb9005e7c1282c9bf661037c35
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define F first #define S second #define ii pair <int,int> #define ever (;;) const int N = 100100; char A[N],B[N],C[N]; string s,a,b,sol; int ans,cnt1,cnt2,f1[26],f2[26],f3[26]; int main() { scanf("%s%s%s",&A,&B,&C); ...
C++
9dc956306e2826229e393657f2d0d9bd
5b8e94539296e5f754848c5f9216433a
1,800
PASSED
#include "bits/stdc++.h" using namespace std; string arr[3]; int cnt[3][26] = {0}; int main(){ for(int i = 0 ; i < 3 ; ++i){ cin >> arr[i]; } for(int i = 0 ; i < 3 ; ++i){ for(auto it : arr[i]){ cnt[i][it - 'a']++; } } int mn = 1 << 20; for(int i = 0 ; i < 26 ...
C++
9dc956306e2826229e393657f2d0d9bd
f74629c789bb67d5954279f877030148
1,800
PASSED
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long int lli; typedef unsigned long long int uli; typedef long double Lf; typedef pair<int,int> pii; typedef vector<int> vi; #define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL) #define mod 1000000007 #define N 2005 #define NN 2005 #...
C++
9dc956306e2826229e393657f2d0d9bd
5d16e9bc6a891f1b8baef1bab8e63e68
1,800
PASSED
def test(s): lines = s.split("\n") s, n = tuple(map(int,lines[0].split())) li_x = [] li_y = [] for i in range(1,n+1): x, y =tuple(map(int,lines[i].split())) li_x.append(x) li_y.append(y) lt_both = zip(li_x, li_y) lt_both = sorted(lt_both)...
Python
98f5b6aac08f48f95b2a8ce0738de657
90ce033e902d98d9883c4706938b4caf
1,000
PASSED
s, n = map(int, raw_input().split()) a = [(map(int, raw_input().split())) for _ in xrange(n)] for x, y in sorted(a): if s > x: s += y else: print 'NO' exit() print 'YES'
Python
98f5b6aac08f48f95b2a8ce0738de657
9de7fbfa849d80fb0feb5c166304a4fe
1,000
PASSED
s,n=map(int,raw_input().split()) dic={} a=[] flag=True for i in range(n): x,y=map(int,raw_input().split()) dic[i]=(x,y) # print dic l=dic.values() l=sorted(l) for i in range(n): # print s,l[i][0] if l[i][0]>=s: flag=False break else: # print s s+=l[i][1] # print s if flag==False: print "NO" else: print...
Python
98f5b6aac08f48f95b2a8ce0738de657
25cd78776854655b2689264b09e7d2e3
1,000
PASSED
n,t = map(int,raw_input().split()) x = [] y = [] for i in range(t): xi,yi = map(int,raw_input().split()) x.append(xi) y.append(yi) for i in range(t): for j in range(i+1,t): if x[i]>x[j]: x[i] = x[i] + x[j] x[j] = x[i] - x[j] x[i] = x[i] - x[j] y[i] = y[i] + y[j] y[j] = y[i] - y[j] y[i] = y[i] - ...
Python
98f5b6aac08f48f95b2a8ce0738de657
55beefb5fce92a60a8c74d34cc559ee3
1,000
PASSED
(s, n) = map(int, raw_input().split()) ok = True a=[map(int, raw_input().split()) for _ in xrange(n)] a.sort() for x, y in a: if s > x: s += y else: ok = False if ok: print "YES" else: print "NO"
Python
98f5b6aac08f48f95b2a8ce0738de657
b2f98128b62b4fb339e68995089f6c6a
1,000
PASSED
(s, n) = map(int, raw_input().split()) a=[map(int, raw_input().split()) for _ in xrange(n)] a.sort() for x, y in a: if s > x: s += y else: print "NO" exit() print "YES"
Python
98f5b6aac08f48f95b2a8ce0738de657
86af44b9513be5415473579f6155f7c1
1,000
PASSED
s=list(map(int,raw_input().split())) n=s[1] s=s[0] dra=list() for x in range(n): l=list(map(int,raw_input().split())) dra+=[l] #print dra dra=sorted(dra,key=lambda strength:strength[0]) flag = True for x in range(n): if(dra[x][0]>=s): print "NO" flag=False break else: s+=...
Python
98f5b6aac08f48f95b2a8ce0738de657
76f1e5901d6064a6c91d4a27f61eeb3a
1,000
PASSED
# # 230A. Dragons # strength, no_of_matches = map(int, raw_input().strip().split()) matches = [] for i in range(no_of_matches): k = list(map(int, raw_input().strip().split())) matches.append(k) matches = sorted(matches, key=lambda x:x[0]) for dragon_strength, bonus in matches: if dragon_strength >= str...
Python
98f5b6aac08f48f95b2a8ce0738de657
354b2bd239f4f2e4c76c552f9d00be50
1,000
PASSED
string = raw_input().split(' ') string = map(lambda x:int(x),string) d = [] for i in range(string[1]): temp = raw_input().split(' ') temp = map(lambda x:int(x),temp) d.append(temp) import operator d = sorted(d, key=operator.itemgetter(0)) for v in d: if(string[0]<=v[0]): print('NO') exit() else: string[0]+=...
Python
98f5b6aac08f48f95b2a8ce0738de657
3038e04eb8e1428d94ca4b3c190ae0d4
1,000
PASSED
#!/usr/bin/env/python " A Problem in Div2 " def solve(): line = raw_input() a = line.split() s = int(a[0]) n = int(a[1]) dragon = list() for i in xrange(n): line = raw_input() a = line.split() dragon.append(((int)(a[0]), (int)(a[1]))) dragon.sort(cmp=lambda x,y:cmp(x[0],y[0])) yes = True for i in xran...
Python
98f5b6aac08f48f95b2a8ce0738de657
52bf678a3f78f2301ac491d37f4c82a5
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second typedef long long ll; double PI=3.14159265358979323846; const int MAX=1e9; const int rx[8] = {1, 1, 1, -1, -1, -1, 0, 0}; const int ry[8] = {0, -1, 1, 0, -1, 1, 1, -1}; int months[...
C++
993f96a62a2ba75a12684b75a5b2f1ed
5162aff844a56c40b03387566fe14168
1,900
PASSED
#include<algorithm> #include<fstream> #include<string> #include<map> #include<string.h> #include<vector> #include<list> #include <set> #include<stack> #include<iostream> #include<queue> #include<math.h> #include<stdio.h> #define ll long long #define MAX 200005 #define MAXX 1000000000000000000 #define ii pair<int,int> #...
C++
993f96a62a2ba75a12684b75a5b2f1ed
59dabece97cad43500816801be524cdd
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define st first #define nd second #define lb lower_bound #define ub upper_bound typedef long long ll; typedef pair<ll,ll> pll; typedef vector<ll> vll; typedef vector<pll> vpll; const double EPS=0.000001; const ll INF=1e18; const ll mod=1e9+7; ll...
C++
993f96a62a2ba75a12684b75a5b2f1ed
5cce1dea8507ff051e303a653a1988b8
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision #pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns #define all(a) a.begin(),a.end() #define...
C++
993f96a62a2ba75a12684b75a5b2f1ed
1467930a0a125d6c267fc9b983db4a77
1,900
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 1e6+10; const int INF = 0x3f3f3f3f; typedef long long ll; typedef int INT ; #define int long long int digit[20]; int dp[20][30]; int dfs(int pos,int num,int limit){ if(pos<0&&num>=0) return 1; if(pos<0||num<0) return 0; if(!limit&&dp[pos][num]) r...
C++
993f96a62a2ba75a12684b75a5b2f1ed
ea9f8efd5bf197b7bb61ece7ea4c0870
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; LL a[20]; LL dp[20][30]; LL dfs(int pos,int num,int limit) { if(pos<0&&num>=0) return 1; if(pos<0||num<0) return 0; LL &dpnow = dp[pos][num]; if(!limit && dpnow) { return dpnow; } LL res = 0; int up = limit ? a[pos] : 9; for(int i=0; i<=up; i+...
C++
993f96a62a2ba75a12684b75a5b2f1ed
86bdb3eec2757f7e6dcfd353b66e860f
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 5; int a[20]; LL dp[20][20]; LL dfs(int cur,int num,bool limit) { if(num < 0) return 0; if(cur == 0) { return (num >= 0); } LL &dpnow = dp[cur][num]; if(!limit && dpnow) return dpnow; LL res = 0; int up = limit ? a[cur] : 9...
C++
993f96a62a2ba75a12684b75a5b2f1ed
16b55fdc3e8079c19735ac5357530386
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; LL a[20]; LL dp[20][30]; LL dfs(int pos,int num,int limit) { if(pos<=0 && num>=0) return 1; if(pos<=0 || num< 0) return 0; LL &dpnow = dp[pos][num]; if(!limit && dpnow) { return dpnow; } LL res = 0; int up = limit ? a[pos] : 9; for(int i=0; i<...
C++
993f96a62a2ba75a12684b75a5b2f1ed
eca16f0d58d24037c2d92d1b7fe00b33
1,900
PASSED
#include <bits/stdc++.h> #define mem(a) memset(a,0,sizeof(a)) using namespace std; typedef long long ll; ll d[20][4],n,b[30]; ll dfs(int n,bool f,int num){//n为当前考虑的位数,t为前一位的数字 //f为true表示之前所有的位都达到了最大值 if(!n)return 1; if(!f&&d[n][num])return d[n][num]; ll ans=0,m=f?b[n]:9; for(int i=0;i<=m;i++){ if(i==0){ ...
C++
993f96a62a2ba75a12684b75a5b2f1ed
d6f48c32f51c46a1ceada79faabd8a78
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i = 0 ; i < n; i++) vector<long long> v; void build(int pos, int nnulos, long long value){ if(pos == 18){ v.push_back(value); return ; } build(pos + 1, nnulos, value * 10); // equivale a add um zero a direita ...
C++
993f96a62a2ba75a12684b75a5b2f1ed
8881abd95dd61afa936aa8989e74bd44
1,900
PASSED
/* [ Christ Crucified Is God's Power and Wisdom ] For the message of the cross is foolishness to those who are perishing, but to us who are being saved it is the power of God. */ #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <stack> #include <queue> #include <map> #include <set> #i...
C++
52b8b6c68518d5129272b8c56e5b7662
0ae9100bf58eb6192182cef28c3610aa
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define mp make_pair #define SZ(x) ((int)(x.size())) #define FOI(i,a,n) for(int (i)=int(a);(i)<=int(n);++(i)) #define FOD(i,a,n) for(int (i)=int(a);(i)>=int(n);--(i)) #define IN(x,y) ((y).find((x))!=(y).end()) #define ...
C++
52b8b6c68518d5129272b8c56e5b7662
ea5ea8932831ea8a898c3cc5f6930ef7
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second typedef pair<long long,long long> ii; int t,n,used[15],check[15]; ii a[15]; bool cmp1(const ii &a,const ii &c){ if(a.se!=c.se) return a.se<c.se; else return a.fi<c.fi; } long long b[15],cnt,sum; int main(){ cin.tie(0)...
C++
52b8b6c68518d5129272b8c56e5b7662
b7e572e2f9c432cae43d3b3b5019cccf
2,200
PASSED
#include<bits/stdc++.h> #include<string.h> #define ll long long #define pf print #define sf scanf #define ff first #define ss second #define clr clear() #define sz size() #define pb push_back #define mk make_pair #define pi acos(-1) #define inf 2000000000000000000 #define mod 998244353 #define ull unsigned long long in...
C++
52b8b6c68518d5129272b8c56e5b7662
2c916c0590bd16f3ac42cde8971c7b50
2,200
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; int n; ll a[10]; int p[10]; int primes[10]; int ans = 1e9; bool check() { ll par_value[10]; for (int i = 0; i <= n; ++i) { par_value[i] = 1; } for (int i = 1; i <= n; ++i) { if (p[i] == 0) { continue; } if ((double)par_...
C++
52b8b6c68518d5129272b8c56e5b7662
22bab96180d3d0cee7110a28dbb2b78a
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 9; long long a[N] ; int vis[N]; map<long long, vector<int> > pf; vector<int> getprimefactors(long long n){ vector<int> ret; for (int i = 2 ;i * 1ll * i <= n ;i++) while (n % i == 0) ret.push_back(i) , n /= i; if (n > 1) ...
C++
52b8b6c68518d5129272b8c56e5b7662
3febc93be8f1b52a0e19a6ef5e91d81a
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; int t, n; long long a[10], npd[10], dp[10][1<<10]; void megumi() { scanf("%d", &n); long long ans = inf; for(int i = 0; i < n; i++) { for(int j = 0; j < (1<<n); j++) dp[i][j] = inf; } for(int i = 0; i < n; i++) scanf("%ll...
C++
52b8b6c68518d5129272b8c56e5b7662
14db6490a467c70e493b947bd875af91
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 10; int n, ptr[N], sumExp[N]; long long a[N], rem[N]; int ans = 1e9; int nprime = 0; void bt (int pos) { if (pos == n + 1) { int res = 0; for (int i = 1; i <= n; i++) res += (ptr[i] == 0 ? sumExp[i] : 0); for (int i = 2; i <= n;...
C++
52b8b6c68518d5129272b8c56e5b7662
3fb358bb7adfc38af69124f0715f74a2
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second int test,n; long long a[17],cur[17],last[17],p[17],res=0,fist[17]; void check(){ long long ans=n,cnt=0; for(int i=1;i<=n;i++){ ans+=fist[i]; if(fist[i]==1) ans--; if...
C++
52b8b6c68518d5129272b8c56e5b7662
c942604288539a730380ee60351d8d9b
2,200
PASSED
// In The Name Of God : #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <bits/stdc++.h> using namespace std ; using namespace __gnu_pbds; #define X first #define Y second #define int long long typedef long long ll ; #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.t...
C++
52b8b6c68518d5129272b8c56e5b7662
609b17e9fc26da2a19635486e3c61d38
2,200
PASSED
#include <iostream> #include <fstream> #include <vector> #include <algorithm> //#define FILE //#define DEBUG #ifdef DEBUG #define TIMER #define INFO #endif #ifdef FILE #define OUT fout #define IN fin #else #define OUT cout #define IN cin #endif #ifdef TIMER #include "SimpleTimer.h" SimpleTimer simple_timer; #endif ...
C++
653455bb6762effbf7358d75660a7689
d4a00bce53b92508288e1635a77e54dd
800
PASSED
#include<bits/stdc++.h> using namespace std; int main () { int n,x=0,y=0; cin>>n; int arr[n]; for(int i=0;i<n;i++) { cin>>arr[i]; } for(int i=0;i<n;i++) { if(arr[i]==0 && arr[i+1]==1 || arr[i]==1 && arr[i+1]==0) { x=i+1; } } for(int i=n...
C++
653455bb6762effbf7358d75660a7689
7a3d46bc765a9b9df1683be90e3b5b42
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int liz = -1; int lio = -1; for (int i = 0; i < n; i++) { int m; cin >> m; m ? lio = i : liz = i; } cout << min(liz,lio)+1...
C++
653455bb6762effbf7358d75660a7689
27104448d922afed4e42ea41a539bc3a
800
PASSED
#include<bits/stdc++.h> #define ll long int using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t,n,x,k,i,g,q,c; // cin>>t; t=1; while(t--) { cin>>n; int a[n]; int cnt1=0; int cnt2=0; int k1=0; int k2=0; for(i=0;i<n;i++) { ...
C++
653455bb6762effbf7358d75660a7689
836a7534f1d52604d255ccf0be261b2e
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; int arr[n+1]; int v[2]; for(int i=1;i<=n;i++){ cin>>arr[i]; v[arr[i]]=i; } cout<<min(v[0],v[1]); }
C++
653455bb6762effbf7358d75660a7689
eac3f197518781d1d06aa475ad9ce0aa
800
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ordered_set = tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ; #define double long double #define ull unsigned long long #define...
C++
653455bb6762effbf7358d75660a7689
a72d23172737a191286bc8e1885ab7ef
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,left,right,ip,i; for(cin>>n,i=1;n>0;n--,i++) { cin>>ip; if(ip==0) left=i; else right=i; } cout<<min(left,right); return 0; }
C++
653455bb6762effbf7358d75660a7689
c1ed64475a2ede2a4073b93e12ba3994
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int one = 0, zero = 0, o = 0, z = 0; int n, k, cnt = 0; vector <int> vec; cin >> n; for (int i = 0; i < n; i++) { cin >> k; vec.push_back(k); if(vec[i] == 1) { one++; } else { zero++; } } for(int i = ...
C++
653455bb6762effbf7358d75660a7689
c7e3e3f4c8e50db21c638da7b7ed891f
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long int one = 0, zero = 0, o = 0, z = 0; long long int n, k, cnt = 0; vector <int> vec; cin >> n; for (int i = 0; i < n; i++) { cin >> k; vec.push_back(k); if(vec[i] == 1) { one++; } else { zero++; ...
C++
653455bb6762effbf7358d75660a7689
75e8ef0841fb507a1389adcea285ee44
800
PASSED
#pragma GCC optimize("O3") #include <iostream> #include <bits/stdc++.h> #include <vector> #include <string> #include <sstream> #include <algorithm> #define pb push_back #define in insert #define er erase #define rd(x) cin >> x; #define w(x) cout << x; #define wln(x) cout << x << endl; using namespace std; int i,j; ve...
C++
653455bb6762effbf7358d75660a7689
c545ede4707c918040f9afd8b2b73c50
800
PASSED
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Codeforces implements Runnable { private BufferedReader br = null; private PrintWriter pw = null; private StringTokenizer stk = new StringTokenizer(""); public static void main(String[] arg...
Java
b4341e1b0ec0b7341fdbe6edfe81a0d4
030d17c6fa00b6d657099ffd75629f2b
1,400
PASSED