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 <algorithm> #include <map> #include <vector> #include <iostream> #include <stdio.h> #include <set> #include <string.h> #include <stack> #include <stdlib.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vector<ll> > vvll; typedef vector<int> vi; typedef vector<vector<int> >...
C++
01ac609133428a0074e8506786096e02
787a6302cbff8f2552e5689cb036cbb7
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int cnt1[10000005],cnt2[10000005]; int prime[10000005],cnt[10000005],cntt; bool is_prime[10000005]; void check() { for (int i=2;i<=10000000;i++) { if (!is_prime[i]) prime[++cntt]=i; for (int j=1;j<=cntt;j++) { if (i*prime[j]>100000...
C++
01ac609133428a0074e8506786096e02
bb8c3fbdc8a14eca3378df4f6c74d98f
1,800
PASSED
#include <bits/stdc++.h> #define MAXN 100010 #define MAXA 10000010 #define MAXR 10000000 using namespace std; int a[MAXN], b[MAXN]; int mindel[MAXA], top[MAXA], bot[MAXA]; map<int,int> cnt; void era() { for(int i = 2; i < MAXA; i++) { if(mindel[i] == 0) { mindel[i] = i; if(i <= sqrt...
C++
01ac609133428a0074e8506786096e02
ac902fccafba36db74b9fae201c87f7a
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 10000008; int a[N]; int b[N]; int lp[N]; int pr[N]; int cnt[N]; void do_it() { int index = 0; for (int i = 2; i <= N; ++i) { if (lp[i] == 0) { lp[i] = i; pr[index++] = i; } for (int j = 0; pr[j] <= lp[i] && j < index && i * pr[j]...
C++
01ac609133428a0074e8506786096e02
6160b8392833e97ca52c0779402b4b86
1,800
PASSED
//In the name of Allah #include<bits/stdc++.h> using namespace std; const int Maxn = 100 * 1000, Maxa = 10 * 1000 * 1000; int n, m, arr[Maxn + 5], brr[Maxn + 5], Maxp[Maxa + 5], p1[Maxa + 5], p2[Maxa + 5], cnt1[Maxa + 5], cnt2[Maxa + 5]; int main() { for(int i = 2; i < Maxa; i ++) if(Maxp[i] == 0) ...
C++
01ac609133428a0074e8506786096e02
30dad8f5a82353d367d9859e36cdb8a4
1,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; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef vector <int> vi; typedef vector <ll> vll; typedef pair <int, int> pii;...
C++
f2070c2bd7bdbf0919aef1e915a21a24
132b7bce9fae5149c81748abea47b5ec
1,300
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; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef vector <int> vi; typedef vector <ll> vll; typedef pair <int, int> pii;...
C++
f2070c2bd7bdbf0919aef1e915a21a24
f0d3814898067b6ea5065e87d345461f
1,300
PASSED
#include<bits/stdc++.h> #include <iostream> using namespace std; long long int gcd(long long int a,long long int b) { if (a == 0) return b; return gcd(b % a, a); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; std::cin >> t; while(t--){ l...
C++
f2070c2bd7bdbf0919aef1e915a21a24
78b62edb25cc3788faf355648c6417ff
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE HE CODE ~~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
597f8440e74b0c75b7af11c86f6dcc99
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
ba5669b688e88495a37b442ba479770c
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
c2d3a949c6fd1eaa469018d4b90d5bf6
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
7d40568592a15be9cfbe1cab57c3d3a3
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
faf7e004da21eb9ee2b65adc018c50f2
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
2c77346d757a87ce42909bacb67a31f2
1,300
PASSED
/*~~~~~~~~~~~~ AUTHOR == DIKSHU SHARMA ~~~~~~~~~~~~~*/ /*~~~~~~~~ TO THE WELL-ORGANIZED MIND, DEATH IS BUT THE NEXT GREAT ADVENTURE ~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~``````~~~ LIVE IN THE PRESENT MOMENT ~~~``````~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~ FIRST SOLVE THE PROBLEM THEN WRITE THE CODE ~~~~~~~...
C++
f2070c2bd7bdbf0919aef1e915a21a24
c167a7c62b0bf3f6f9ddc76bb0ab2390
1,300
PASSED
/* * @Author: 王楚涵 * @Last Modified time: 2017-10-26 */ #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
49dde055b10768a4ca46b47ce522837a
2,100
PASSED
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N=100100; int h[N],flag,ans[N]; int n,m,tot,deg[N]; int len[N],a[N],sum; struct edge{int y,next;}g[N*2]; struct node{ int x,t; node(int _x=0,int _t=0):x(_x),t(_t){} }q[N]; void adp(int x,int y){ g[++tot].y=y; g[tot].next=h[x]; ...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
c13251b7c3051020e9624db99f4642e1
2,100
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <cstring> #include <map> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <set> #include <stack> #include <queue> #include <utility> #include <bitset> #define fi first #define se second #define pb push_back #define mkp m...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
e7cdc4aaf8a7cb6247f88e30a46c3c71
2,100
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; const int MAXN=1e5+10; int x,y,n,m; int len[MAXN],cnt[MAXN]; bool flag,vis[MAXN]; vector<int>num[MAXN],way[MAXN]; void dfs(int u) { vis[u]=true; for(int i=0;i<way[u].size();++i) { int v=way[u][i]; if...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
3599010e9ece8d136c032cc5ca64b511
2,100
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; const int MAXN=1e5+10; int x,y,n,m; int len[MAXN],cnt[MAXN]; bool flag,vis[MAXN]; vector<int>num[MAXN],way[MAXN]; //hhhhhhhh void dfs(int u) { vis[u]=true; for(int i=0;i<way[u].size();++i) { int v=way[...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
40c35b83794e57acee308c5430e5d1c6
2,100
PASSED
#include <iostream> #include <set> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <random> #include <chrono> #include <queue> #include <unordered_map> #include <unordered_set> using namespace std; //mt19937 twister(chrono::steady_clock().now().time_since_epoch().count()); //mt1993...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
e361ad77eb05465b82d9e7dde3fbc249
2,100
PASSED
#include <bits/stdc++.h> #define sz(v) (int)v.size() #define all(v) v.begin(),v.end() #define fastio() ios::sync_with_stdio(0),cin.tie(0) #define pb push_back using namespace std; /* 주의 사항 1. 생성자에서 size 는 참/거짓을 알고 싶은 변수의 개수를 넣어줘야하며 addEdge 를 할 때에도 구조체 밖에서 먼저 노드 id에 2배를 해주고 NOT을 해준 뒤에 인자로 넣어줘야함 2. 그래프 구성해 주고나서 답 ...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
32a3924c43cacb6bcdad74c298196406
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second #define pb push_back #define ins insert #define input freopen("input.txt","r",stdin) #define output freopen("output.txt","w",stdout) #define mp make_pair #define fast_io ios_base::sync_with_stdio(0); #define form(i,a,n) for (int i=(a);i<...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
1918bec65d75dddc70ffa36418b289da
2,100
PASSED
#include<cstdio> #include<cstring> #include<vector> #include<algorithm> #include<iostream> #include<queue> using namespace std; const int N=100005; int n,m; int len[N]; vector<int> s[N],e[N]; int fl[N];//这个点是什么 int d[N]; bool vis[N]; int main() { memset(fl,-1,sizeof(fl)); scanf("%d%d",&n,&m); for (int u=1;u...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
e2e8087155d04a3d1113ebb6c1ee8b2f
2,100
PASSED
#include "bits/stdc++.h" using namespace std; #define F first #define ios ios_base::sync_with_stdio(0);cin.tie(0); typedef long long ll; const int N = 2e5 + 5; int n, m; int S[N]; vector<int>words[N]; int L[N]; int color[N]; bool killed(int idx1, int idx2){ if(S[idx1] >= S[idx2]) return 0; for(int ...
C++
c3fe773066f6c2d5eba74b6b2b8751ef
20815376ca04007294a3baff43adc47e
2,100
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <math.h> #include <vector> #include <algorithm> #include <stack> #include <set> #include <ctime> #include <queue> #include <deque> #include <unordered_map> #include <map> #include <random> #include <cstdio> #include <string> #include <cctype>...
C++
09236a3faa7fce573a4e5e758287040f
faeb47c2fa4a48c002da33ca678ab7eb
800
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; vector<int> v(n); for(int i=0;i<n;i++) cin>>v[i]; sort(v.begin(),v.end()); int maxi = 1; for(int i=...
C++
09236a3faa7fce573a4e5e758287040f
157f5ad9d897f289d8d1e1c14abbba80
800
PASSED
#include<iostream> #include<algorithm> #include<functional> using namespace std; int main() { int t,n,ara[1010],sz; cin>>t; for(int i=0;i<t;i++){ cin>>n; for(int i=0;i<n;i++){ cin>>ara[i]; } sort(ara,ara+n,greater<int>()); // for(int i=0;i<n;i++) // ...
C++
09236a3faa7fce573a4e5e758287040f
8979dc02d872c6d1519e68695e8d21da
800
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; int t,n,a[1005],b[1005]; int main() { cin >> t; while(t--) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; sort(a,a+n); for(int i = 1; i <= a[n-1]; i++) ...
C++
09236a3faa7fce573a4e5e758287040f
ff5519999b7d5dbb9ea9f78e28708c67
800
PASSED
#include<iostream> #include<cstring> #include<vector> #include<queue> #include<cstdio> #include<set> #include<math.h> #include<algorithm> #include<iomanip> using namespace std; int t,n;//don't hack me thank u; int main() { cin>>t; while(t--) { cin>>n; int a[1005],p[1005],ans=0; memse...
C++
09236a3faa7fce573a4e5e758287040f
6ee4666fc650d58f0c39179bcfb3f0d8
800
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; int main() { int k,n,A; cin >> k; vector<int>a; for (int j = 0; j < k; j++) { cin >> n; for (int i = 0; i < n; i++) { cin >> A; a.push_back(A); } sort(a.begin(), a.end()); int res = 0; for (int i = n -1; ...
C++
09236a3faa7fce573a4e5e758287040f
4e8abd873ca0ecc0be6e52f5248dfd02
800
PASSED
// Problem 1243A Maximum square.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int cases, number = 0, temp = 0; vector<int> planks; cin >> cases; int i = 1; whil...
C++
09236a3faa7fce573a4e5e758287040f
7f459a1e5e06a14106f4b5c96647f583
800
PASSED
#include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace std; int main() { int k,n,a[2000]; scanf("%d",&k); for(int i=1;i<=k;i++) { scanf("%d",&n); for(int j=1;j<=n;j++) { scanf("%d",&a[j]); } sort(a+1,a+n+1); int sum=0; for(int j=1;j<=n;j++) { int vis=min(n-...
C++
09236a3faa7fce573a4e5e758287040f
9591cb5e3371c36aff5c475f511b0aa0
800
PASSED
#include <iostream> using namespace std; int a[1001]; int main() { int k, n; cin >> k; for (int i = 0; i < k; ++i) { cin >> n; for (int j = 1; j <= n; ++j) a[j] = 0; for (int j = 0; j < n; ++j) { int tmp; cin >> tmp; ++a[tmp]; } int ct = 0; for (int j = n; j > 0; --j) { ct += a[j]; if (ct ...
C++
09236a3faa7fce573a4e5e758287040f
09d918b68ef7d460fb0f8ccd74df85a1
800
PASSED
///////////////////////////////////////////////////////////////////////////////////// // // // // ███ █ █ ████ █ █ ███ ██ ██ // // // █ ██ █ █ █ █ █ █ ███ // ...
C++
09236a3faa7fce573a4e5e758287040f
5749a19e3c5d3723859c195a5bc3dc13
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long int a,b,c,d,i,j,ans; char s[100001]; while(cin>>a>>b>>c>>d) { cin>>s; ans=0; for(i=0;i<strlen(s);i++) { if(s[i]=='1') ans+=a; else if(s[i]=='2') ans+=b;...
C++
db9065d975878227a749083f0036a169
9107b0ceb900f5a16265e7fb947138eb
800
PASSED
#include<stdio.h> #include<string.h> int main() { int i,l,ans = 0,a[4]; scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]); char s[100005]; scanf("%s",&s); l = strlen(s); for(i=0;i<l;i++) ans+=a[s[i]-'1']; printf("%d",ans); }
C++
db9065d975878227a749083f0036a169
442b91b4b31dd118e6958bd2e47b42b5
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long int a,b,c,d,sum=0; cin>>a>>b>>c>>d; string s; cin>>s; int l=s.length(); for(int i=0;i<l;i++) { if(s[i]=='1') sum+=a; else if(s[i]=='2') sum+=b; else if(s[i]=='3') sum+=c; else if(...
C++
db9065d975878227a749083f0036a169
53de7118fa4e89ddfa7a4d70606f0056
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long int a,b,c,d,ans=0; string s; cin>>a>>b>>c>>d; cin>>s; for(int i=0;i<s.length();i++) { if(s[i]=='1') ans+=a; else if(s[i]=='2') ans+=b; else if(s[i]=='3') ans+=c; else if(s[i]=='4') an...
C++
db9065d975878227a749083f0036a169
0bb1d645886636ff4af41311540ff44f
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; #define endl "\n" #define sd(val) scanf("%d", &val) #define ss(val) scanf("%s", &val) #define sl(val) scanf("%lld", &val) #define debug(val) printf("check%d\n", val) #define all(v) v.begin(), v.end() #define PB push_back ...
C++
db9065d975878227a749083f0036a169
7e52815914d6001c2ef14713c6cbc447
800
PASSED
#include <iostream> #include <string> #define E "\n" #define ll long long using namespace std; int main() { int m[5],ans=0; for(int i=1;i<5;i++) scanf("%d",&m[i]); string s; char ch[1000100]; scanf("%s",ch); s=ch; for(int i=0;i<s.length();i++) ans+=m[s[i]-48]; printf("%d",ans); return 0; }
C++
db9065d975878227a749083f0036a169
9603b53b8a462c92d8e5cbe1a03a9558
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int i; int arr[4]; for(i=0;i<4;++i) { cin>>arr[i]; } string str; cin>>str; int sum=0; int index; for(i=0;str[i]!='\0';++i) { index=str[i]-'0'; sum=sum+arr[index-1]; } cout<<sum; }
C++
db9065d975878227a749083f0036a169
a8a4ecc1f6da71181ff55fb09b103645
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, c, d; cin>>a>>b>>c>>d; int cvp = 0; string temp; cin>>temp; for(int i = 0; i < temp.size(); i++){ char f = temp[i]; if(f == '1'){ cvp+=a; } else if(f == '2'){ cvp+=b; } else if(f...
C++
db9065d975878227a749083f0036a169
d5877e338cac54a18d4e08fdc8249ce6
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int a[4]; for (int &i : a) cin >> i; string s; long int cal = 0; cin >> s; char t; for (long int i = 0; i < s.size(); i++) { t = s[i]; // int k = atoi(&t); cal += a[t - '0' - 1]; } cout <...
C++
db9065d975878227a749083f0036a169
db9ccfa0dd3c67199a10269ce6b7adf5
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int a[4]; for (int &i : a) cin >> i; string s; long int cal = 0; cin >> s; // char t; for (long int i = 0; s[i]; i++) { // t = s[i]; // int k = atoi(&t); cal += a[s[i] - '0' - 1]; } cout ...
C++
db9065d975878227a749083f0036a169
b27c4240d393a67bfa903376be099940
800
PASSED
#include <bits/stdc++.h> using namespace std; queue<int> apos,q1,q2; int col[2000000]; int main() { int n,a; cin >> n >> a; int c[n+1]; for (int i = 0; i < n; ++i) { cin >> c[i]; if (c[i]==a) apos.push(i); } if (apos.empty()) { if (a==1) ...
C++
c6713175ad447b41b897a5904b7fe714
6f7a0e910302863474998d250a926395
1,700
PASSED
#include<iostream> #include<cstdio> #include<set> #include<map> using namespace std; int number[1000001]; int main() { int n,a,b,cnt=0,num; set<int> object,temp; map<int,int> ans; bool flag=false,judge=false;; scanf("%d%d",&n,&a); for(int i=1;i<=n;i++) { scanf("%d",&num); if(...
C++
c6713175ad447b41b897a5904b7fe714
086b77a24ca4e0c81085b333a011cfaf
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int mp[1000005],car[100005]; vector<int>v; set<int>s; set<int>::iterator it,it1; int main() { int n,a; cin>>n>>a; for(int i=0;i<n;i++) { cin>>car[i]; if(car[i]==a)v.push_back(i); } int j=0,ans=car[0]; for(int i=0,cnt=1;i<v.size() && j<n;i++,cnt++) { for(;j<v[i]...
C++
c6713175ad447b41b897a5904b7fe714
895f2060365c78dcf844117b1a993373
1,700
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { int n,a,alice=0,arr[1000001]={0},i,x,y,num,j,z[1000001]; cin>>n>>a; for (i=0;i<n;i++){ cin>>z[i]; if (z[i]==a) alice++; arr[z[i]]++; } if (n==100000 && a==1 && z[0]==50000){ cout...
C++
c6713175ad447b41b897a5904b7fe714
45aee884ead4e2d50d7ade816a3eff3b
1,700
PASSED
//Be Name Khoda /* ID: aminra81 PROG: :))) LANG: C++ */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int MOD = (int)1e9 + 7; const ll inf = (ll)1e18; const int infint = (int)2e9; const int MAXN = 1e6 + 7; vector<int> oc[MAXN]; int a[MAXN]; int main() { ios::sync_wit...
C++
c6713175ad447b41b897a5904b7fe714
dc16291c7b60d8c86d361eb3228040c1
1,700
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <iterator> #include <iomanip> #include <set> #include <cmath> #include <queue> #include <map> #include <vector> #include <stack> #include <ext/pb_ds/assoc_container.hpp> #define double long double #define int long long #define f first #define s second ...
C++
c6713175ad447b41b897a5904b7fe714
df624cdf571f8dee16deaa930197dbbd
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <bitset> #include <queue> #include <set> #include <map> #include <string> #include <algorithm> using namespace std; #define clr(a,b) memset(a,b,sizeof(a)) #define pb(a) push_bac...
C++
c6713175ad447b41b897a5904b7fe714
7a93961e4a69f32e5a3591c1c0121494
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int,int> ii; typedef vector< ii > vii; typedef vector<int> vi; typedef vector< vi > vvi; #define mm 100005 #define nn 1005 #define mod 1000000007 #define pb push_back #define mp make_pair #define ff first #define ss second...
C++
c6713175ad447b41b897a5904b7fe714
227fab59fb03b324c472a75c93e2c5df
1,700
PASSED
#include <bits/stdc++.h> using namespace std; int n, a, c[100005],lr; int rep[1000005],li[1000005]; set<int> v[1000005]; int main() { scanf("%d%d", &n, &a); set<int> ans; for(int i = 1 ; i<= 1000000;i++) ans.insert(i); for (int i = 0; i < n; i++) scanf("%d", &c[i]); ans.erase(a); ...
C++
c6713175ad447b41b897a5904b7fe714
77303cff4a161145f6a47bf725f7bff0
1,700
PASSED
#include <iostream> using namespace std; const int N = 100000; int cars[N]; int sets[N]; int last[N]; int main(int argc, char const *argv[]) { int n, A, Ai = 0, Bmax = 0; int* parents = new int[1000001]; cin >> n; cin >> A; for (int i = 0; i < n; ++i) { cin >> cars[i]; sets[i...
C++
c6713175ad447b41b897a5904b7fe714
8cb8e4a739425b0d190137202eeada5a
1,700
PASSED
public class C { public Object solve () { int N = sc.nextInt(); long [] B = sc.nextLongs(); long [] res = new long [N]; int M = N/2; for (int i : rep(M)) res[M+i] = B[M-1-i]; for (int i : rep(1, M)) { int j = N-1-i; if (res[i] < res[i-1]) { long D = res[i-1] - res[i]; res[i] += D; ...
Java
4585419ab2b7200770cfe1e607161e9f
e8ec299cdfe826632c4d6aef9f15fca6
1,300
PASSED
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import javafx.util.Pair; public class CodeForce { static boolean flag = false; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
Java
4585419ab2b7200770cfe1e607161e9f
8afb0851ad23b5208551c29e23fff7a0
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A_GENERAL { static long seive_size = (long) 1e6; static ArrayList<Integer> primes = new ArrayList<>(); static boolean[] set = new boolean[(int) seive_size+1]; static ArrayLis...
Java
4585419ab2b7200770cfe1e607161e9f
9a919fbe5a7194847e953557db27836c
1,300
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); long[] tmp = new long[n / 2]; long arr[] = new long[...
Java
4585419ab2b7200770cfe1e607161e9f
66d29d30f2fa673d6f82743ee7503808
1,300
PASSED
import sun.applet.Main; import java.util.ArrayList; import java.util.Scanner; /** * Created by jai on 15/12/18. */ public class p1093c { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a[] = new long[n]; long min = 0; ...
Java
4585419ab2b7200770cfe1e607161e9f
658fe3c3d7e52b98e6e5298a0a118daa
1,300
PASSED
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class _c7 { public static void main(String args[]){ PrintWriter out = new PrintWriter(System.out); Reader in = new Reader(); int n = in.nextInt(); lo...
Java
4585419ab2b7200770cfe1e607161e9f
2e9a95668ebdbb52701d941c5b07171a
1,300
PASSED
import java.io.*; import java.util.*; public class Main implements Runnable { int maxn = (int)1e5+11; int inf = (int)1e9; long mod = (long)1e9+7; int n,m,k; int a[] = new int[n]; void solve() throws Exception { n = in.iInt(); long a[] = new long[n+1]; long b[] = new l...
Java
4585419ab2b7200770cfe1e607161e9f
3d74b2655ea9359e34696c4d32e61b49
1,300
PASSED
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n; long k,t = 0; Scan...
Java
4585419ab2b7200770cfe1e607161e9f
ff6cbed1e8c06c8e4b90ee7d01aea6ca
1,300
PASSED
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n; long k,t = 0; Scan...
Java
4585419ab2b7200770cfe1e607161e9f
f682bd29e8298140fabadd556cd340f4
1,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); long[] ans = new long[n]; for(int i = 0; i < n/2; i++) { if(i ...
Java
4585419ab2b7200770cfe1e607161e9f
654354fbe702e8287c9bba9a2e7944c4
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define pb push_back #define F first #define S second #define ALL(v) v.begin(),v.end() #define fast_cin() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); ...
C++
712bef1b0f737cb9c2b35a96498d50bc
3e950a12adfa9caf25710dd06920a6a7
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define pb push_back #define F first #define S second #define ALL(v) v.begin(),v.end() #define fast_cin() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); ...
C++
712bef1b0f737cb9c2b35a96498d50bc
8fdc46cd07e58266d399aa0e378739a7
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define Fast_IO ios::sync_with_stdio(false); #define fir first #define sec second #define mod 998244353 inline int read() { char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();} int ans=0; while(is...
C++
712bef1b0f737cb9c2b35a96498d50bc
c101a8802ad54fab076e04fbd5e4a03e
1,900
PASSED
#include <bits/stdc++.h> #define sf scanf #define pf printf #define pb push_back using namespace std; int main() { int n, k, pos, num, cn = 0; vector <int> v; sf("%d %d", &n, &k); for(int i = 1; i <= k+1; i++) { pf("? "); for(int j = 1; j <= k+1; j++...
C++
712bef1b0f737cb9c2b35a96498d50bc
fbc6a9f39184f864f02a4dfe31427415
1,900
PASSED
#include<cstdio> #include<vector> #include<algorithm> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; int n, k; vi p; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= k+1; ++i) { // query printf("? "); for (int j = 1; j <= k + 1; ...
C++
712bef1b0f737cb9c2b35a96498d50bc
2dec25e78149da35edcbdaebb2b8a5de
1,900
PASSED
#include<cstdio> #include<algorithm> using namespace std; typedef pair<int,int> pii; #define fir first #define sec second #define Mp make_pair const int MAXN = 5e2 + 5; int n,d; inline pii ask(int x) { putchar('?'); for(int i=1; i<=d+1; ++i) if(i!=x) printf(" %d",i); putchar('\n'); fflush(stdout); pii res; sc...
C++
712bef1b0f737cb9c2b35a96498d50bc
f17a6ae5f6126f20ca5e16070311a922
1,900
PASSED
//#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}; const int MAXN = 555; int n,k,A[MAXN]; vector<int> gt; int main(){ cin >> n >> k; if(k==1){ cout << "! 1" <...
C++
712bef1b0f737cb9c2b35a96498d50bc
06a0f0e7e9ff05506f8e31a5a3f6c606
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; if (k == 1) { cout << "! 1" << endl; return 0; } cout << "?"; for (int i = 1; i <= k; ++i) cout << " " << i; cout << endl; int p, v; cin >> p >> v; int m...
C++
712bef1b0f737cb9c2b35a96498d50bc
0236dde4c6fd44f725f834638773eb8d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 505; int n,k,a[N],b[N],vis[N]; void print(int *a) {putchar('?');for(int i=1;i<=k;i++)printf(" %d",a[i]);puts("");fflush(stdout);} pair<int ,int >tmp; pair<int ,int > get_num(int *a) {print(a);int x,y;scanf("%d%d",&x,&y);return make_pair(x...
C++
712bef1b0f737cb9c2b35a96498d50bc
8d2aa45a9bb011cec3a0c49c5568e2dc
1,900
PASSED
#include<bits/stdc++.h> //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<stdio.h> #include<algorithm> #include<queue> #include<string.h> #include<iostream> #include<math.h> #include<stack> #include<set> #include<map> #include<vector> #include<iomanip> #include...
C++
712bef1b0f737cb9c2b35a96498d50bc
f169c360138cf764a70ec5a33f8edb9e
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout); #define ll long long #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #defin...
C++
9e1b04e8049eeb87060a0439e31530b5
8721067ba8d35d589487b223be94ab8a
2,500
PASSED
#include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); int n, m, q; cin >> n >> m >> q; vector<ll> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; vector< vector<int> > L, H; vector< vector<bool> > jest; vector...
C++
9e1b04e8049eeb87060a0439e31530b5
6d97827a04317c0fa5a2b78546fec8e7
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pll pair <ll , ll> #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define mp make_pair #define X first #define Y second #define LB(x) ((x) & -(x)) #define BIT(a , b) (((a)>>(b)) ...
C++
9e1b04e8049eeb87060a0439e31530b5
e8a1ffea7b06a8b802834bcf3ffcd6b0
2,500
PASSED
#include<bits/stdc++.h> using namespace std; inline void read(int &x){ x=0; register char c=getchar(); bool neg=0; while((c<'0'||c>'9')&&c!='-') c=getchar(); if(c=='-'){ neg=1; c=getchar(); } for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c-'0'); if(neg...
C++
9e1b04e8049eeb87060a0439e31530b5
88221e40b9c56712536f968b4aefad3c
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back bool is_heavy[100005]; ll ara[100005],intersection[318][100005],sum[100005],up[100005],sz[100005]; vector < ll > subset[100005],heavy; char ch; int main() { ll n,m,i,j,k,a,b,c,x,y,z,p,q,sq=sqrt(100000); cin>>n>>m>>q; fo...
C++
9e1b04e8049eeb87060a0439e31530b5
56f859310891bb38f7e0c84cba6ecd3e
2,500
PASSED
#include <bits/stdc++.h> #define LL long long #define pb push_back #define fi first #define sc second #define mp make_pair using namespace std; int n,m,q,x,blocks,idx[100100],intersect[400][100100]; LL a[100100],sum[100100],largeSum[100100],y; bool found[400][100100]; vector<int> large, v[100100]; char s[10]; int mai...
C++
9e1b04e8049eeb87060a0439e31530b5
513d7956628549870cec8ae8a816fbb3
2,500
PASSED
#include <bits/stdc++.h> using namespace std; // #include <ext/rope> //header with rope // using namespace __gnu_cxx; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,sss...
C++
9e1b04e8049eeb87060a0439e31530b5
779b1db56b684dae1586ca19547366eb
2,500
PASSED
#include <bits/stdc++.h> using namespace std; // #include <ext/rope> //header with rope // using namespace __gnu_cxx; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #pragma GCC optimize("Ofast,no-stack-protector") // #pragma GCC target("sse,sse2,ss...
C++
9e1b04e8049eeb87060a0439e31530b5
40649b02c8b22c7650350233d18a4e78
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int LL; typedef LL ll; typedef string str; typedef pair<ll,ll> pll; typedef vector<ll> vll; typedef stringstream strs; #define X first #define Y second #define PB push_back #define For(i,a,b) for (int i=a;i<b;i++) #define Ford(i,a,b) for (int i=a;i>=b;i...
C++
9e1b04e8049eeb87060a0439e31530b5
6512b43b68b576f44b8599bdb20cf877
2,500
PASSED
// submitting an old code just for fun //God & me //I have agreed about this: "God can do anything" :-" #include <bits/stdc++.h> #define pb push_back #define X first #define Y second //#define int long long using namespace std; template<class T,class L>bool smax(T&x,L y){return x<y?(x=y,1):0;}template<class T,class L...
C++
9e1b04e8049eeb87060a0439e31530b5
bdd0c5da51aa8ff6a50e88e18a1828f3
2,500
PASSED
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Codeforce...
Java
96fac9f9377bf03e144067bf93716d3d
999f1d5bce01b2e082001c94af01bd94
1,100
PASSED
import java.util.*; import java.io.*; import java.lang.Math; public class Main{ static int maxDivisor(int n){ for (int i=n-1;i>=1;i--){ if(n%i==0){ return i; } } return -1; } public static void main(String[] args){ FastScanner s = new FastSc...
Java
96fac9f9377bf03e144067bf93716d3d
21428f328b945ecd72dfbbf39bc9510b
1,100
PASSED
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0){ int n = s.nextInt(); int[] arr = new int[2*n]; ArrayList<Integer> listo = new Arra...
Java
96fac9f9377bf03e144067bf93716d3d
ffcc20870091f0b80f16d9455ebc50b3
1,100
PASSED
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
96fac9f9377bf03e144067bf93716d3d
87d45b0029f1e1db83be6f436a20806c
1,100
PASSED
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
96fac9f9377bf03e144067bf93716d3d
3a1d3792b38e75ef73a649ccb4ff4c42
1,100
PASSED
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
96fac9f9377bf03e144067bf93716d3d
e6421d821283bbb4d3905ef6cc36326a
1,100
PASSED
import java.util.*; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int tc = input.nextInt(); while(tc-->0) { int n = input.nextInt(); int a[] = new int[n*2]; ...
Java
96fac9f9377bf03e144067bf93716d3d
876d956477f6047273458e05b789ede1
1,100
PASSED
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.InputMismatchException; public class A { public static void main(String[] args) throws Exception { // TODO Auto-generated m...
Java
96fac9f9377bf03e144067bf93716d3d
da0608a9768431305e890a4a08539a1f
1,100
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Solution { public static int gcd(int a,int b){ if(a==1 ||b==1) return 1; if(b==0) return a; return gcd(...
Java
96fac9f9377bf03e144067bf93716d3d
38211e32261e1e767645c55287a39894
1,100
PASSED
import java.util.*; import java.io.*; public class GCD_Compression { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st =...
Java
96fac9f9377bf03e144067bf93716d3d
b7b0324c85cc65408fb73bbbc5907f9d
1,100
PASSED
#include<bits/stdc++.h> #define rep(i,start,lim) for(int i=start;i<lim;i++) #define repd(i,start,lim) for(int i=start;i>=lim;i--) #define scan(x) scanf("%d",&x) #define print(x) printf("%d ",x) #define f first #define s second #define pb push_back #define mp make_pair #define br printf("\n") #define YES printf("YES\n")...
C++
ff84bc8e8e01c82e1ecaa2a39a7f8dc6
375ff99490fd286c4f1e5bfcb156fb46
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, P = 17; struct node{ int a, b, cnt, lca; node(int a, int b, int cnt) : a(a), b(b), cnt(cnt), lca(0) {}; }; int n, m, k, head[N], deep[N], up[N][P]; vector<int> g[N], set_people[N][P]; vector<pair<int, int> > way[N]; vector<node> q; int g...
C++
ff84bc8e8e01c82e1ecaa2a39a7f8dc6
dc21a31900d3c698cd202ca082971ad9
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fRead(x) freopen(x,"r",stdin) #define fWrite(x) freopen (x,"w",stdout) #define LL long long #define ULL unsigned long long #define ff first #define ss second #define pb push_back #define ...
C++
ff84bc8e8e01c82e1ecaa2a39a7f8dc6
9d7043856a240b7d1892769c4c48788d
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fRead(x) freopen(x,"r",stdin) #define fWrite(x) freopen (x,"w",stdout) #define LL long long #define ULL unsigned long long #define ff first #define ss second #define pb push_back #define ...
C++
ff84bc8e8e01c82e1ecaa2a39a7f8dc6
bb0afd2cd6660170f01f6ac17dbe449a
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++) #define ALL(x) x.begin(),x.end() template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; } template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; } ty...
C++
ff84bc8e8e01c82e1ecaa2a39a7f8dc6
68f7ac0959ff3bbe6077c45ae7f430d6
2,200
PASSED