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 <iostream> #include <map> #include <vector> #include <string> int main () { int n; std::cin >> n; std::vector<std::pair<std::string, int>> v(n); for (int i = 0; i < n; ++i) { std::cin >> v[i].first >> v[i].second; } int max_score = -1000000; std::map<std::string, int> res; std::map<std::string, int>...
C++
c9e9b82185481951911db3af72fd04e7
3ca797cb0d9a87da18452c01644f10bf
1,500
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <queue> #include <iomanip> #include <cstdio> #include <limits> #include <cm...
C++
c9e9b82185481951911db3af72fd04e7
e4a07345f7796dacff2213ee63033377
1,500
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <cstdio> #include <cmath> #include <string> using namespace std; const int INF=1e+9; struct node { string nam; int ace, id; }; istream &operator>>(istream &stream, node &a) { stream>>a.nam>>a.ace; return stream; } node mass[1000]; boo...
C++
c9e9b82185481951911db3af72fd04e7
480105f0521f334f0027054f3130f662
1,500
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <cstdio> #include <algorithm> #include <cmath> #include <string> using namespace std; const int INF=1e+9; struct node { string nam; int ace, id; }; istream &operator>>(istream &stream, node &a) { stream>>a.nam>>a.ace; return stream; } ...
C++
c9e9b82185481951911db3af72fd04e7
31f70d36eb418302d2548b274bab7f3e
1,500
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <cstdio> #include <algorithm> #include <cmath> #include <string> using namespace std; const int INF=1e+9; struct node { string nam; int ace, id; }; istream &operator>>(istream &stream, node &a) { stream>>a.nam>>a.ace; return stream; } ...
C++
c9e9b82185481951911db3af72fd04e7
ed0912fa949e41139bbf643130e2c71c
1,500
PASSED
#include <iostream> #include <string> using namespace std; typedef struct Person{ int num; string name; int mnum; } person; int findmax(person l[],int c){ int maxi,max,min=1000; max=l[0].num; maxi=0; min=l[0].mnum; for (int i=1;i<c;i++){ if (l[i].num==max && l[i].mnum>min){ maxi=i; max=l[i].num; m...
C++
c9e9b82185481951911db3af72fd04e7
0dadb9111f367c5b6e0f5a701bc06d4d
1,500
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct player { char name[33]; int point; }; struct game { char name[33]; int point; }; bool isWin(char* winList[1000], char name[33], int win_count) { for (int i = 0; i < win_count; i++) { if (strcmp(winList[i], name) == 0) { ...
C++
c9e9b82185481951911db3af72fd04e7
f284684a4ed0b73748914872a8e2fc1e
1,500
PASSED
// Problem : E. Largest Beautiful Number // Contest : Codeforces - Educational Codeforces Round 39 (Rated for Div. 2) // URL : https://codeforces.com/contest/946/problem/E // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) //look at my code //my code is ama...
C++
da6d85aaa51901892b861dcbc5e63536
29ad95d04b0498c5a21c5ca81f83e526
2,200
PASSED
#include <bits/stdc++.h> #include <unistd.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 3e18; const ll fact_table = 800008; double Pi = 3.1415926535897932384626; //vector<ll> G[550010]; vector<P> tree[500010]; priority_queue <ll> pql; priority_queue <P> pqp; //big prio...
C++
da6d85aaa51901892b861dcbc5e63536
6c851b6f7195649c74037cf8a71b0b17
2,200
PASSED
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define pb push_back #define lp(i,a,n) for(int i=a;i<=n;++i) #define lpd(i,a,n) for(int i=a;i>=n;--i) #define mem(a,b) memset(a,b,sizeof a) #define all(v) v.begin(),v.end() #define println(a) cout <<(a) <<endl #define sz(x) ((int)(x).size())...
C++
da6d85aaa51901892b861dcbc5e63536
da5d73a88b8d3fb60e10750964819580
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int t, n, S[10], L[10], B, T, sMax, p, b, G, l; string s; cin >> t; for (int i = 0; i < t; i++) { cin >> s; n = s.length(); T = 0; B = 0; for (int i = 0; i < 10; i++)...
C++
da6d85aaa51901892b861dcbc5e63536
c4aae2b0df848cd87f27d4156d317903
2,200
PASSED
#pragma region Header #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <stdio.h> #include <vector> #include <string> #include <cstring> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <bitset> #include <queue> #include <stack> #include <cmath> #include <algorithm> #...
C++
da6d85aaa51901892b861dcbc5e63536
238923ff6ee222a1471a63bac9857cc3
2,200
PASSED
#pragma region Header #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <stdio.h> #include <vector> #include <string> #include <cstring> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <bitset> #include <queue> #include <stack> #include <cmath> #include <algorithm> #...
C++
da6d85aaa51901892b861dcbc5e63536
152f9657f6c6825df3ef092449fec63b
2,200
PASSED
#pragma region Header #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <stdio.h> #include <vector> #include <string> #include <cstring> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <bitset> #include <queue> #include <stack> #include <cmath> #include <algorithm> #...
C++
da6d85aaa51901892b861dcbc5e63536
62cb8debd6bbb65525a79e9cf7d1ffa2
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> int size(const T &x) { return x.size(); } #define rep(i,a,b) for(int i = (a); i < (b); i++) #define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it) #define pb push_back #define fs first #define sc second typedef pair<int,...
C++
da6d85aaa51901892b861dcbc5e63536
00e5a4b4235ea75a29e3fab6d1992704
2,200
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long int ll; string solve(string s){ int dig[10] = {0}, n = s.length(), a[n + 1]; for(int j = 0; j < n; j++){ a[j] = s[j] - '0', dig[s[j] - '0']++; dig[a[j]] %= 2; } /*int fg = 1; for(int j = 0; j < 1...
C++
da6d85aaa51901892b861dcbc5e63536
407702cfe5bea57f9d7b01a599f06702
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int cnt[10], oddCnt; bool check10Pref(string s) { for (int i = 0; i < (int)s.size() - 1; i++) { if (s[i] != (i ? '0' : '1')) return false; } return true; } void rem(int c) { oddCnt += ((--cnt[c] & 1) ? 1 : -1); } void add(int c) { oddCnt += ((++cnt[c] & 1) ? 1 : -1)...
C++
da6d85aaa51901892b861dcbc5e63536
da3422f3d771a0c846a7676d914dade0
2,200
PASSED
#include <stdio.h> #include <stdlib.h> int calcMinutes(h,m); int main() { int counter = 0, n , hours, minutes; scanf("%d",&n); while(counter < n) { scanf("%d %d",&hours,&minutes); if(hours>=0 && hours<=23 && minutes>=0 && minutes<=60) { printf("%d\n",calcMinutes(hours,minu...
C
f4982de28aca7080342eb1d0ff87734c
ba9fd4a0cad8d86bd47aedd71c57a007
800
PASSED
//minutes before new year #include<stdio.h> #define MAX 1440 main(){ int t,h[MAX],m[MAX],r[MAX],i=0; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d %d\n",&h[i],&m[i]); } for(i=0;i<t;i++){ r[i]=(1440-((h[i]*60)+m[i])); } for(i=0;i<t;i++){ printf("%d\n",r[i]); } }
C
f4982de28aca7080342eb1d0ff87734c
568d588b3d79f04dcd2db128291ba0de
800
PASSED
#include <stdio.h> #include <stdlib.h> int main() { int t,i,m,h ; scanf("%d",&t); for (i=0 ; i<t ; i++){ scanf("%d",&h); scanf("%d",&m); if ((h!=0)||(m!=0)){ printf("%d\n",((24-h-1)*60)+(60-m)); } } return 0; }
C
f4982de28aca7080342eb1d0ff87734c
f5a74e44d2e3db43ad32bc426ab2ca1a
800
PASSED
#include<stdio.h> int main() { int t,h,m,h1,m1,tm,i; scanf("%d",&t); for(i=1;i<=t;i++) { scanf("%d%d",&h,&m); h1=23-h; m1=60-m; tm=h1*60+m1; printf("%d\n",tm); } return 0; }
C
f4982de28aca7080342eb1d0ff87734c
b4364d86204199420d38845c25581f29
800
PASSED
#include<stdio.h> int main() { int t,d; scanf("%d",&t); while(t--) { int h,m; scanf("%d%d",&h,&m); d=1440-((60*h)+m); printf("%d\n",d); } return 0; }
C
f4982de28aca7080342eb1d0ff87734c
0671d4334536ce669349e3e47ca9b2c7
800
PASSED
#include <stdio.h> /*primer raboty 12:10:00 + 80 -> 12:11:10*/ struct Time { int hour; int minute; }; int main() { int n, i; scanf("%d", &n); struct Time time[n]; for(i = 0; i < n; i++) scanf("%d %d", &time[i].hour, &time[i...
C
f4982de28aca7080342eb1d0ff87734c
04f854322504383460edf9f42e901f34
800
PASSED
#include <stdio.h> int main() { int h,m,minLeft,testcase; scanf("%d",&testcase); for(int i=0;i<testcase;i++) { scanf("%d",&h); scanf("%d",&m); minLeft=1440-((h*60)+m); printf("%d\n",minLeft); } }
C
f4982de28aca7080342eb1d0ff87734c
17de26ad22f0db136301abb492d8e327
800
PASSED
#include <stdio.h> int main(void){ int hour,minutes,cases; scanf("%d",&cases); for(int i=0;i<cases;i++){ scanf("%d %d",&hour,&minutes); printf("%d\n",(24-hour-1)*60+(60-minutes)); } return 0; }
C
f4982de28aca7080342eb1d0ff87734c
3da6ca5e491c2f8d18c3dc5855bb337d
800
PASSED
#include <stdio.h> int main(void) { int h,m,t[1439],n,i; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%d",&h,&m); t[i]=((23-h)*60)+(60-m); } for(i=0;i<n;i++) { printf("%d\n",t[i]); } }
C
f4982de28aca7080342eb1d0ff87734c
6d402402e7cbdead23c318ec81c326fe
800
PASSED
#include <stdio.h> int tet(int h, int m){ if((0>=h && h>24) || (0>=m && m>60)) return 0; else return 1; } int main(){ int t; scanf("%d",&t); for(int i=1;i<=t;i++){ int h,m; scanf("%d%d",&h,&m); int sp=(23-h)*60+(60-m); if(tet(h,m)) printf("%d\n",sp); } }
C
f4982de28aca7080342eb1d0ff87734c
7a646ce382bfd6cb31d4f3f9b200f8d0
800
PASSED
/*benamekhoda*/ #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <cstdlib> #include <math.h> #include <cmath> #include <ctime> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #define rep(i, n) for(LL i = 0; i < n; i++) typedef lo...
C++
2e6bf9154d9da6ac134b52144d5322ca
a44823ce086e992fed1b12a0f39898c4
1,400
PASSED
#include <vector> #include <cstdio> #include <algorithm> #define pb(x) push_back(x) using namespace std; const int maxn = 1010,INF = 2e8; int n,m,cnt,v[maxn],ans; vector<int>g[maxn]; int a[maxn],w[maxn],vis[maxn]; bool cmp(const int &A,const int &B){ return w[A] < w[B] || (w[A] == w[B] && v[A] > v[B]); } int main...
C++
2e6bf9154d9da6ac134b52144d5322ca
d4917148658acd3b87fc3e7917ec0109
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <set> #include <vector> #include <queue> #define mm 2005 using namespace std; const int mod = 1000000007; typedef long long LL; typedef pair<int,int> P; vector<P> by; int a[mm]; int main() { in...
C++
2e6bf9154d9da6ac134b52144d5322ca
39b19ac97e52655fbd96da721f1a6d76
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; typedef vector <vi> vvi; typedef vector <ii> vii; typedef vector <vii> vvii; #define endl '\n' #define PB push_back #define MP make_pair #define OO (1000000000) #define EPS (1e-9) #define MOD (100000...
C++
2e6bf9154d9da6ac134b52144d5322ca
459aeccecfb632e70be3d535e319f87d
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; typedef vector <vi> vvi; typedef vector <ii> vii; typedef vector <vii> vvii; #define endl '\n' #define PB push_back #define MP make_pair #define OO (1000000000) #define EPS (1e-9) #define MOD (100000...
C++
2e6bf9154d9da6ac134b52144d5322ca
e6036671976ae87896f1c946a1abb5d7
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; typedef vector <vi> vvi; typedef vector <ii> vii; typedef vector <vii> vvii; #define endl '\n' #define PB push_back #define MP make_pair #define OO (1000000000) #define EPS (1e-9) #define MOD (100000...
C++
2e6bf9154d9da6ac134b52144d5322ca
6be210a2e15276b671e32d3ad780e266
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; #define MAXN 1010 set<int> adj[MAXN]; int v[MAXN], cost[MAXN]; ii order[MAXN]; int main(){ int n, m; while(scanf("%d%d", &n, &m) > 0){ for(int i=1; i<=n; i++){ scanf("%d", &v[i]); cost[i] = 0; order[i] = ii(v[i], i); ...
C++
2e6bf9154d9da6ac134b52144d5322ca
69d702491b74a297ee593b988e89cd58
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; #define MAXN 1010 int n, m, v[MAXN], cost[MAXN]; ii order[MAXN]; set<int> adj[MAXN]; int main(){ while(scanf("%d%d", &n, &m) > 0){ for(int i=1; i<=n; i++){ scanf("%d", &v[i]); cost[i] = 0; order[i] = ii(v[i], i); } ...
C++
2e6bf9154d9da6ac134b52144d5322ca
23b5abfcb1c9da5f6158633293d31f72
1,400
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; #define pb push_back #define all(v) v.begin(), v.end() using namespace std; long long lcm(int a, int b) { return (a / __gcd(a, b)) * b; } int main() { long long t; t=1; while (t--) { ll t,n,m; cin>>n>>m; vect...
C++
2e6bf9154d9da6ac134b52144d5322ca
2c8852d7b8a6fc7648112cc746a379dd
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int> v(n); vector<vector<int> > ne(n); for(int i = 0 ; i < n ; i ++){ cin>>v[i]; } long long int res=0; for(int i = 0,a,b ; i < m ; i ++){ cin>>a>>b;a--;b--; res+=min(v[a],v[b]); ...
C++
2e6bf9154d9da6ac134b52144d5322ca
3b02e2a3af1dcf1d9c216d6650f09ce7
1,400
PASSED
o=[] n,q=map(int,input().split()) table = [[0 for i in range(n)] for j in range(2)] pairs=0 for i in range(q): r,c=map(lambda s:int(s)-1,input().split()) d=0 if table[r][c]==0: table[r][c]=1 d+=1 else: table[r][c]=0 d-=1 for i in range(-1,2): if c+i>=0 an...
Python
af036416721694d1843368988ca78e8e
9c950e1320be759c760800361a94b5b9
1,400
PASSED
#Ashish_Sagar n,q=map(int,input().split()) l=[[0]*n for j in range(2)] blocked=0 for i in range(q): a,b=(map(int,input().split())) if l[a-1][b-1]==0: l[a-1][b-1]=1 if a==1: if l[1][b-1]==1: blocked+=1 if b>1 and l[1][b-2]==1: blocked+=1 ...
Python
af036416721694d1843368988ca78e8e
25a19a53c728e809be8e6b4498b73751
1,400
PASSED
n,q=map(int,input().strip().split()) a=[[0 for _ in range(n+2)]for _ in range(3)] res=0 for i in range(q) : r,c=map(int,input().strip().split()) if a[r][c]!=0 : a[r][c]=0 if (r==1) : res-=(a[2][c]+a[2][c-1]+a[2][c+1]) else : res-=(a[1][c]+a[1][c-1]+a[1][c+1]) ...
Python
af036416721694d1843368988ca78e8e
f941ee659d78d5e6df960a9964696afd
1,400
PASSED
n,q = map(int,input().split()) l = set() close = set() for i in range(q): x,y = map(int,input().split()) # l = [] if (x,y) not in l: l.add((x,y)) if x == 1: if (x+1,y) in l: close.add(((x,y),(x+1,y))) if (x+1,y+1) in l: close.add(((x,y),(x+1,y+1))) if (x+1,y-1) in l: close.add(((x,y),(x+1,y...
Python
af036416721694d1843368988ca78e8e
c709093ab03236685b1e053e33ba10a2
1,400
PASSED
R=lambda:map(int,input().split()) n,q=R() n+=1 a=0,[0]*n,[0]*n k=0 for _ in[0]*q:r,c=R();a[r][c]^=1;k+=(2*a[r][c]-1)*sum(a[r^3][c-1:c+2]);print('YNeos'[k>0::2])
Python
af036416721694d1843368988ca78e8e
a11f8422f0dd7ab8b147496ebe9fdc69
1,400
PASSED
n,q = map(int,input().split()) A = [0 for i in range(n)] B = [0 for i in range(n)] x = 0 for _ in range(q): r,c = map(int,input().split()) if(r==1): if(A[c-1]==0): A[c-1] = 1 x+=B[c-1] if(c-1>0): x+=B[c-2] if(c-1<n-1): x+=B...
Python
af036416721694d1843368988ca78e8e
2289694b3db5cfd88086a830a9f207e4
1,400
PASSED
n,q = map(int,input().split()) tiles = {} for x in range(1,n+1):tiles[(1,x)]=False;tiles[(2,x)]=False cnt = 0 for i in range(q): c,r = map(int,input().split()) tiles[(c,r)] = not tiles[(c,r)] if tiles[(c,r)] and tiles[(c%2+1,r)]: cnt+=1 if r+1<=n and tiles[(c,r)] and tiles[(c%2+1,r+1)]: ...
Python
af036416721694d1843368988ca78e8e
60cc3877c2895013e366cb4865348952
1,400
PASSED
if __name__ == "__main__": N, Q = map(int, input().split()) res = 0 val = [[0 for j in range(N + 1)] for i in range(3)] blocked = [False for j in range(N + 1)] for q in range(Q): r, c = map(int, input().split()) val[r][c] ^= 1 if c > 1: res -= blocked[c - 1] ...
Python
af036416721694d1843368988ca78e8e
0e7665a1f779a0027813f9e4a7cd64d6
1,400
PASSED
(n, q) = map(int, input().split()) total = [[0]*(n + 2) for i in range(2)] trap = 0 for i in range(q): (a, b) = map(int, input().split()) if total[a % 2][b] == 1: total[a % 2][b] = 0 trap -= total[(a+1) % 2][b-1] + total[(a+1) % 2][b] + total[(a+1) % 2][b+1] else: total[a % 2][b] = 1...
Python
af036416721694d1843368988ca78e8e
7c6d295b5d51c36e8d7bafa31270a2c8
1,400
PASSED
import math def main(): n, q = map(int, input().split()) dct_used = set() pairs = set() for i in range(q): toUse = list(map(int, input().split())) toUse[0] -= 1 toUse = tuple(toUse) if toUse in dct_used: for k in range(toUse[1] - 1, toUse[1] + 2): ...
Python
af036416721694d1843368988ca78e8e
0416132da6d62b0a2ed41fb008f6c70e
1,400
PASSED
#include <iostream> #include <streambuf> #include <sstream> #include <fstream> #include <algorithm> #include <cctype> #include <locale> #include <functional> #include <vector> #include <list> #include <unordered_map> #include <unordered_set> #include <map> #include <set> using namespace std; typedef long L; typedef u...
C++
9534b468bfb6126fc16b896532ced8c5
fc6ea9c83af4b4a4e70526c4ed3ac7b4
1,900
PASSED
#pragma comment(linker, "/STACK:256000000") #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <string> #include <queue> #include <set> #include <map> #include <sstream> #include <cmath> using namespace std; #define forn(i, n) for (int i = 0; i < int(n); i++) #define f...
C++
9534b468bfb6126fc16b896532ced8c5
1323efea0d5f1bcc7365a18ecbb21680
1,900
PASSED
#include<set> #include<map> #include<list> #include<queue> #include<stack> #include<string> #include<time.h> #include<math.h> #include<memory> #include<vector> #include<bitset> #include<fstream> #include<stdio.h> #include<utility> #include<string.h> #include<iostream> #include<stdlib.h> #include<algorithm> using namesp...
C++
9534b468bfb6126fc16b896532ced8c5
a4aa95039161e16a5de55989436c50ea
1,900
PASSED
#include <iostream> #include <algorithm> using namespace std; int dp[5002][2512][2][2]; int a[5002]; const int inf = 1000 * 1000 * 1000 + 1000; int main(){ int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 0; i <= n; i++) { for(int j = 0; j<= n/2 + 2; j++){ ...
C++
9534b468bfb6126fc16b896532ced8c5
9e5d06bffe77391aabbf97a15c780f55
1,900
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; int d[5001][2502][2]; int main() { int n; cin >> n; vector<int> a; a.push_back(-1); int last = -1; for (int i = 0; i < 2502; i++) { d[0][i][0] = 2000000000; d[0][i][1] = 2000000000; } d[0][0][0] = 0; for (int i = 0; i < n; ...
C++
9534b468bfb6126fc16b896532ced8c5
520b21de630fbc8cc94143a05be791fb
1,900
PASSED
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<cctype> #include<iostream> #include<string> #include<sstream> #include<set> #include<map> #include<vector> #include<algorithm> #include<queue> #include<utility> using namespace std; #define i64 long long int // #define i128 __int128_t int n...
C++
9534b468bfb6126fc16b896532ced8c5
e622fce752219839c5403ef5b12faff8
1,900
PASSED
#include<iostream> #include<vector> #include<set> #include<math.h> #include<algorithm> #define ll long long using namespace std; ll n; ll a[5010]; ll dp[5010][2510][2]; ll la[5010]; ll ra[5010]; ll solve(int i, int k, bool mb) { if (k<0)return 99999999999999; if (i >= n){ if (k == 0||(k==1&&mb==1&&i==n)) return ...
C++
9534b468bfb6126fc16b896532ced8c5
869abb7a79198fe6c35701305c1de400
1,900
PASSED
#define DEBUG 0 #include <algorithm> #include <functional> #include <numeric> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <cstring> #include <cassert> #include <string> #include <vector> #include <list> #include <map> #includ...
C++
9534b468bfb6126fc16b896532ced8c5
e9e16e0af4b35ec1baa35df6fe328e57
1,900
PASSED
using System; using System.Collections; using System.Dynamic; using System.Text; using System.Globalization; using System.Linq; using System.Collections.Generic; namespace CodeForces { class Program { public static readonly int oo = Convert.ToInt32(1E9D); static void Main(String[] agrs) ...
C#
9534b468bfb6126fc16b896532ced8c5
26d7008acd76aa693a0065dea75ce99b
1,900
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int totNums = Convert.ToInt32(Console.ReadLine()); int[] numb = new int[totNums + 1]; ...
C#
9534b468bfb6126fc16b896532ced8c5
3a4d06b8624d2544461c1b8c6c25efea
1,900
PASSED
#include <algorithm> #include <string> #include <set> #include <map> #include <vector> #include <queue> #include <iostream> #include <iterator> #include <sstream> #include <cmath> #include <cstdio> #include <cstdlib> #include <numeric> #include <memory.h> #include <iomanip> using namespace std; #define FO...
C++
b9db66824bff45d354afddd2efb2593a
0ddb7d7427788f8677f663adbd8f1b21
2,300
PASSED
// In the name of God #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cstring> #include <string> #include <set> #include <map> #include <complex> #include <cmath> #include <fstream> #include <iomanip> #include <deque> #define pf push_front #define pb push_back using namespace st...
C++
b9db66824bff45d354afddd2efb2593a
8ab0d17d699e6fd4a0764f732ddd004b
2,300
PASSED
//In the name of God #include <iostream> #include <iomanip> using namespace std; typedef long double LD; const LD oo = 1e9 + 10; const int N = 5e5 + 2; int n, rep = 80, x[N], v[N]; bool flag; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> v[i]; LD st = 0, ed...
C++
b9db66824bff45d354afddd2efb2593a
d1a4dfbeb688e239177f9aef725fe234
2,300
PASSED
//In the name of God #include <iostream> #include <iomanip> using namespace std; typedef long double LD; const LD oo = 1e9 + 10; const int N = 5e5 + 2; int n, rep = 80, x[N], v[N]; bool flag; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> v[i]; LD st = 0, ed...
C++
b9db66824bff45d354afddd2efb2593a
6da786666bec3546c259a9218509d102
2,300
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <cstdio> using namespace std; const int INFI = 1e9 +12; typedef pair<double,double> part; vector <part> coll; int n; double time ( int ind , double dis ) { return dis / (double)( coll[ind].second ); } double binary( double begi...
C++
b9db66824bff45d354afddd2efb2593a
ff5a3aeeba2c0fc5d90fef11ab2764a2
2,300
PASSED
#include <cstdio> #include <algorithm> #define double long double using namespace std; struct P { int pos,v; inline bool operator<(const P& X)const { return this->pos<X.pos; } inline void Read() { scanf("%d%d",&pos,&v); } }p[500005]; int n; int main() { scanf("%d",&n); ...
C++
b9db66824bff45d354afddd2efb2593a
ceae6bc2a7022b6709fe1ff244c2b087
2,300
PASSED
#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <bitset> #include <cstdio> #include <vector> #include <string> #include <fstream> #include <iomanip> #include <cstdlib> #include <numeric> #include <sstream> #include <string.h> #i...
C++
b9db66824bff45d354afddd2efb2593a
b63572ef8a3f3782c068aa63e87a8604
2,300
PASSED
#include <cstdio> #include <vector> #define min_val -1E12 using namespace std; struct data{double p,v;data(int a=0,int b=0){p=a;v=b;}}; vector<data> in; int n; bool can(double T){ double best=min_val,TP; int i,l=in.size(); for(i=0;i<l;++i){ if(in[i].v>=0){if(best<(TP=in[i].p+in[i].v*T))best=TP;} else if...
C++
b9db66824bff45d354afddd2efb2593a
5fde246ba5c997c4cbd2488f336e1749
2,300
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #define EPS 1E-9 #define min_val -1000000000000.0 using namespace std; struct data{ double p,v; data(int a=0,int b=0){p=a;v=b;} }; vector<data> in; int n; bool can(double T){ double best=min_val,TP; int i,l=in.size(); for(i=0;i<l;++i...
C++
b9db66824bff45d354afddd2efb2593a
02e2d0f33456b0d5e3dbe2f39f4000e0
2,300
PASSED
#define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<vector> #include<set> #include<map> #include<stack> #include<queue> #include<string> #include<sstream> #include<deque> #include<math.h> #include<cstring> #include <bitset> #include<algorithm> #include<stdio.h> #include<stdlib.h> #define all(v) v.begin(),v.en...
C++
b9db66824bff45d354afddd2efb2593a
13ae6773a875856d2480ddd2f37f4dbc
2,300
PASSED
#include"bits/stdc++.h" #define LL long long #define PII pair<int,int> #define PPI pair<PII,int> #define PIP pair<int,PII> #define PPP pair<PII,PII> #define X first #define Y second #define INF 1000000007 #define FOR(a,b,c) for(int a=b;a<=c;a++) #define FO_(a,b,c) for(int a=b;a>=c;a--) #define REP(i,u,v) for(int i=H[u]...
C++
9a1bdded55976e70574484956d414bba
a46473461bd056228c71d97fca75a71c
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 5005; const int md = 1000000007; int Rank[maxn], SA[maxn], height[maxn]; int t1[maxn], t2[maxn], t3[maxn], t4[maxn]; int rmq[maxn][15], pw[15], Log[maxn]; int dp[maxn][maxn], g[maxn][maxn]; char str[maxn]; void Swap(int*& x, int...
C++
9a1bdded55976e70574484956d414bba
9839087db39f544f257f358f6aba6d5c
2,700
PASSED
#include<bits/stdc++.h> using namespace std; string s; int sz; typedef long long ll; ll num[5005]; bool les(int i,int j,int l){ if(i<1)return 1; if(l<60){ while(l){ if(s[i]>s[j])return 0; if(s[j]>s[i])return 1; ++i;++j;--l; } return 1; } if(num...
C++
9a1bdded55976e70574484956d414bba
0d8432f327e769b5d965715100ddc3da
2,700
PASSED
/* In the name of God */ #include<bits/stdc++.h> using namespace std; //#define int long long #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define F first #define S second #define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define Dec cout<<fixed<< setpre...
C++
9a1bdded55976e70574484956d414bba
5234d4c29c2d3d86e82258b006a5241a
2,700
PASSED
//* #include <stdio.h> #include <string.h> #include <ctype.h> #include <limits.h> #include <iostream> #include <queue> #include <algorithm> #include <vector> #include <set> #include <map> #include <string> #include <functional> #define MOD 1000000007 #define MAX ((1<<30)-1) #define MAX2 ((1ll<<62)-1) #pragma warning(di...
C++
9a1bdded55976e70574484956d414bba
e81a898cb1ff4d6225b146cc8693be19
2,700
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <string.h> #include <vector> #include <set> #include <map> #include <queue> using namespace std; #define ll long long #define ld long double #define ull unsigned long long #define pb push_back #define mp make_pair #...
C++
9a1bdded55976e70574484956d414bba
8746fc0a9d32c1776d8290f9e64b24da
2,700
PASSED
#include <set> #include <map> #include <queue> #include <deque> #include <cmath> #include <ctime> #include <bitset> #include <vector> #include <string> #include <cstdio> #include <cassert> #include <cstring> #include <iostream> #include <algorithm> #define For(i,x,y) for(int i=(int)(x);i<=(int)(y);i++) #define Forn(i,...
C++
9a1bdded55976e70574484956d414bba
99765620a27aef090fcdb684025819f1
2,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; int const N = 5000 + 20, INF = 2e9, MOD = 1e9 + 7; int n, dp[N][N], clc[N][N], ans = INF, res, pw[N], cd[N][N]; bool mark[N][N], vis[N]; string s; inline void sMin (int &a, int b) { a = min(a, b);...
C++
9a1bdded55976e70574484956d414bba
ec454c0ff864b30465db316c9a26f737
2,700
PASSED
#include <stdio.h> #include <vector> #include <string> #include <algorithm> #include <string.h> //#include <conio.h> #include <map> #include <fstream> #include <cmath> #include <queue> #include <bitset> #include <stack> #include <iostream> #include <set> #include <time.h> #include <functional> #define mp(x,y) make_pai...
C++
9a1bdded55976e70574484956d414bba
8c84b4cc99ee7f161e722e6ada44a2b7
2,700
PASSED
#include<bits/stdc++.h> #define rep(i,j,k)for(int i=j;i<=k;i++) #define dep(i,j,k)for(int i=j;i>=k;i--) using namespace std; typedef long long ll; const int N=5010,mod=1e9+7; char s[N]; int l,nxt[N],f[N][N],g[N][N],tf[N][N],tg[N][N],lcp[N][N]; int main() { scanf("%s",s);l=strlen(s);rep(i,0,l-1)s[i]-='0';s[l]=1; dep(i,l...
C++
9a1bdded55976e70574484956d414bba
5180ac3e5586af1cc8fc9a074dca85b8
2,700
PASSED
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int main() { int n,i; scanf("%d",&n); for (i = 0; i < n/4; ++i) { printf("a"); printf("b"); printf("b"); pri...
C
fbde86a29f416b3d83bcc63fb3776776
1539eaf7f1d61c8b7dfdeaf4419bac82
1,000
PASSED
#include<stdio.h> char a[5]="aabb"; int main() { int n; while(scanf("%d",&n)!=EOF) { for(int i=0; i<n; i++) { printf("%c",a[i%4]); } printf("\n"); } }
C
fbde86a29f416b3d83bcc63fb3776776
3a58e7daea49f341c33675d274f16602
1,000
PASSED
#include<stdio.h> char a[5]="aabb"; int main() { int n; while(scanf("%d",&n)!=EOF) { if(n==3) printf("bba\n"); else for(int i=0; i<n; i++) { printf("%c",a[i%4]); } printf("\n"); } }
C
fbde86a29f416b3d83bcc63fb3776776
20be257edc6949649a66c46160e1bf6b
1,000
PASSED
#include <stdio.h> #include<string.h> #define si(a) scanf("%d",&a); #define sl(a) scanf("%lld",&a); #define ss(a) gets(a); #define rep(i,start,n) for(i=start;i<n;i++) #define debugl(a) printf("%lld\n",a); #define debugi(a) printf("%d\n",a); int main() { long long int t; sl(t); if(t==2)printf("aa"); e...
C
fbde86a29f416b3d83bcc63fb3776776
2cb9aad3fee39c77678db8b65f253708
1,000
PASSED
#include <stdio.h> #include<stdlib.h> int main() { int i,n; scanf("%d",&n); for(i=1;i<=n;i++) { if(i%4==1 || i%4==2) printf("a"); else printf("b"); } printf("\n"); return 0; }
C
fbde86a29f416b3d83bcc63fb3776776
4a499e0823e0d47342d7c61fd26a52c6
1,000
PASSED
import java.util.*; public class Solution { public static void main(String args[] ) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char s[] = {'a' , 'a' , 'b' , 'b'}; for(int i = 0; i < n ; i++) System.out.print(s[i%4]); } }
Java
fbde86a29f416b3d83bcc63fb3776776
c724444b598dd8609803ada886d12bf5
1,000
PASSED
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); if (n >= 4) { int count = n / 4; for (int i = 0; i < count; i++) { System.out.print("aabb"...
Java
fbde86a29f416b3d83bcc63fb3776776
dc4aec5fed9aa298a40c58a165d04dd1
1,000
PASSED
//package HackerEarthA; import java.io.*; import java.util.*; import java.util.Map.Entry; import java.text.*; import java.math.*; import java.util.regex.*; /** * * @author prabhat */ public class easy18{ public static long[] BIT; public static long[] tree; public static long[] sum; public sta...
Java
fbde86a29f416b3d83bcc63fb3776776
723b18eca87aeb403a5fffe0cf31f93d
1,000
PASSED
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count=0; for(int i=0;i<n;i++) System.out.print((i&2)==0?"b":"a"); } }
Java
fbde86a29f416b3d83bcc63fb3776776
4deb998dab3b2aee9bc424b315813219
1,000
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class start { static int x[]; public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedRead...
Java
fbde86a29f416b3d83bcc63fb3776776
27e0913f8360219e1cfb293f3d5f9f99
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; int count=0; int a[1005]; int b[1005]; cin>>n>>k; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ cin>>b[i]; } for(int i=0;i<n;i++){ if(b[i]-a[i]>=0){ b[i]-=a[i]; ...
C++
02bb7502135afa0f3bb26527427ba9e3
206d6ebde3e22fa6b96d4bd61d4243ee
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int a[1005],b[1005]; int n; bool check(int f,int k){ for(int i = 0; i < n; i++){ if(a[i]*f <= b[i]){ } else k -= (a[i]*f-b[i]); } if(k < 0) return false; return true; } int main(){ int k; int c, mn=1000000000,mx=0; int...
C++
02bb7502135afa0f3bb26527427ba9e3
efa56a485f1561f3ca1658f932e7b504
1,400
PASSED
#include<iostream> #include<set> #include<map> #include<vector> #include<list> #include<string.h> #include<cmath> #include<algorithm> #include<string> #include<sstream> #include<stack> using namespace std; typedef unsigned long long int ull; typedef long long int ll; #define pb push_back #define mp make_pair #define...
C++
02bb7502135afa0f3bb26527427ba9e3
1fb599a125282f133753bd2fc078cee8
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int a[100002],b[100002]; int main() { int n,k,i; int minm=10001; scanf("%d%d",&n,&k); for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=1;i<=n;i++) scanf("%d",&b[i]); for(i=1;i<=n;i++) { minm=min(minm,b[i]/a[i]); } for(...
C++
02bb7502135afa0f3bb26527427ba9e3
f914271b660f81906d9636fd641b8232
1,400
PASSED
#include <bits/stdc++.h> #define pb push_back #define sz(a) (int)a.size() #define mp make_pair #define all(a) a.begin(),a.end() #define forn(i, n) for (int i = 0; i < n; ++i) #define forv(i, v) for (int i = 0; i < sz(v); ++i) #define _(a, b) memset(a, b, sizeof a) typedef long long ll; typedef unsigned long long ull;...
C++
02bb7502135afa0f3bb26527427ba9e3
442d3bdde9a49d6cc15d7eb4cb4f8d8e
1,400
PASSED
#include<bits/stdc++.h> using namespace std; long long a,s,d[100002],f[100002],ans,h,j,k,l,i,n,m; main(){ cin>>n>>m; for(int i=0;i<n;i++)cin>>d[i]; for(int i=0;i<n;i++)cin>>f[i]; h=9000000000; while(h-ans>1){ k=(h+ans)/2; s=m; j=1; for(i=0;i<n;i++){ if(k*d...
C++
02bb7502135afa0f3bb26527427ba9e3
e4a0f56275e2b43057fb188d44e505ef
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int a[100010]; int b[100010]; int n,k,result; void search(long long left,long long right) { long long mid=(left+right)/2; long long cnt=0; for(int i=1;i<=n;i++) { if(mid*a[i]>b[i]) { cnt+=mid*a[i]-b[i]; } if(cnt>k)...
C++
02bb7502135afa0f3bb26527427ba9e3
a30570508d377c182daa0642d16334bb
1,400
PASSED
#include<cstdio> #include<algorithm> #include<iostream> #define ll long long using namespace std; ll n,k,a[233333],b[233333]; ll max(ll a,ll b) { if(a>b) return a; return b; } bool check(ll x) //目测是这里有问题 { ll kkksc03=k; //orz kkksc03 Luogu ll cnt=0; //计数用 for(int i=1;i<=n;i++) if(b[i]+kkksc03>=a[i]*...
C++
02bb7502135afa0f3bb26527427ba9e3
3ede71fb0fc336255861ba75a68e06ce
1,400
PASSED
#include<stdio.h> #include<algorithm> #define imax 1005 using namespace std; int in[imax],have[imax],imin[imax],re[imax]; int main(){ int n,k,i; while(~scanf("%d%d",&n,&k)) { for(i=0;i<n;i++) scanf("%d",&in[i]); for(i=0;i<n;i++) { scanf("%d",&have[i]); imin[i]=have[i]/in[i]; } int minn=imin[0]; for(i=0;i<n...
C++
02bb7502135afa0f3bb26527427ba9e3
642676bd425f23a5936e966c43d130e7
1,400
PASSED
#include <iostream> #include <cstdio> using namespace std; int n, m, cnt = -1; int a[1001], b[1001]; bool ind = false; int main(){ cin >> n >> m; for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) scanf("%d", &b[i]); while(true){ cnt++; for(int i = 1; i <= n; i++){ ...
C++
02bb7502135afa0f3bb26527427ba9e3
47e7062c97f2421dc70371d9eaaa1807
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n--) { long long s,a,b,c; cin>>s>>a>>b>>c; s/=c; s+=(s/a)*b; cout<<s<<endl; } }
C++
ec8060260a6c7f4ff3e6afc9fd248afc
acbd0cdfa985747080a4f27a6ef62aa3
800
PASSED
/* Various :))))) CF handel:N.Asghari vjudge:N_Asghari ??????? ||||| :)) @ @ :)) ---- */ #include<iostream> #include<string> #include<vector> #include<map> #include<cmath> #include<math.h> #include<algorithm> #include<stack> #include<queue> #include<sstream> #include<set> #include<cstdio> #include<stdio.h> #inc...
C++
ec8060260a6c7f4ff3e6afc9fd248afc
b98e2e6af5d959d6e50a16a57840a359
800
PASSED
#include<stdio.h> int main() { long long int i,j,k,s,a,b,c,tm,ans,fr,sa; int t; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%lld%lld%lld%lld",&s,&a,&b,&c); //for(i=0;i<t;i++){ {sa=s/c; fr=sa/a; tm=b*fr; ans=sa+tm;} printf("%lld\n",ans);} } ...
C++
ec8060260a6c7f4ff3e6afc9fd248afc
5106b16c12b2a10d7136b109ba08428b
800
PASSED