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<stdio.h> int main() { int q,n,k,a,b,i,o=0,t[200001],j=0; scanf("%d",&q); while(q--) { scanf("%d%d",&n,&k); for(i=0; i<n; i++) { scanf("%d",&a); if(a&1) o++,t[j++]=i+1; } if(o<k||((k+o)&1)) printf("NO\n")...
C
7f5269f3357827b9d8682d70befd3de1
e6b3042c931e40150555bc45c7b8ab39
1,200
PASSED
#include<stdio.h> int main() { int x,y; scanf("%d",&x); for(y=1;y<=x;y++){ int a,b,s=0,i; scanf("%d %d",&a,&b); int aa[a]; for(i=0;i<a;i++) { scanf("%d",&aa[i]); if(aa[i]%2==1) { s++; } } if(s<b || (s-b)%2==1) { printf("NO\n...
C
7f5269f3357827b9d8682d70befd3de1
6daeabeaed22d6d32b75ddae564ed837
1,200
PASSED
#include<stdio.h> #define TAM 200001 int main(){ int q, n, k, a, cont, impar[TAM]; scanf("%d", &q); while(q--){ scanf("%d%d", &n, &k); cont = 0; for(int i=1; i<=n; i++){ scanf("%d", &a); if(a%2) impar[cont++] = i; } if(cont<k||(k%2 && cont%2==0)||(k%2==0 && cont%2)){ printf("NO\n"); con...
C
7f5269f3357827b9d8682d70befd3de1
9c65172a2f25ac57daab867ddd3fdef8
1,200
PASSED
#include <stdio.h> void main() { int q,n,k,r[200000],i,j,b,s; scanf("%d",&q); for(;q>0;q--) { s = 0; j = 1; scanf("%d %d",&n,&k); for(i=0;i<n;i++) { scanf("%d",&b); s += b%2; if (j < k && s % 2 == 1) { r[j-1] = i+1; j++; s = 0; } } if (j < k || (j == k && s % 2 == 0)) pri...
C
7f5269f3357827b9d8682d70befd3de1
d97e74ac21e49a1e609305775a6b9467
1,200
PASSED
#include <stdio.h> int main(void) { int i,j,q,n,k; int index[200001],count=0,a; scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d %d",&n,&k); count=0; for(j=0;j<n;j++){ scanf("%d",&a); if(a%2==1){ index[count++]=j+1; } } index[count-1]=n; if(count<k || (count-k)%2==1) printf("NO\n"); else{ ...
C
7f5269f3357827b9d8682d70befd3de1
2704ac30cd60818fb25385f2274394f3
1,200
PASSED
#include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { unsigned long int q; scanf("%ld",&q); for (unsigned long int i = 0; i < q; ++i) { unsigned long int count_odd = 0; unsigned long int indexer = 0; unsigned long int n,k; scanf("%ld %ld",&n,&k); unsigned long long int arr[n]; ...
C
7f5269f3357827b9d8682d70befd3de1
056eb32c4ec06b36cd12e04c3f93d9c1
1,200
PASSED
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,k,od=0; scanf("%d%d",&n,&k); int ar[n]; for(int i=0;i<n;i++) { scanf("%d",&ar[i]); if(ar[i]%2!=0) od++; } if(k==1) { if(od%2!=0) printf("YES\n%d\n",n); else printf("NO\n"...
C
7f5269f3357827b9d8682d70befd3de1
b2a16063c0b7139a2ab06d9e4a051b6d
1,200
PASSED
#include<stdio.h> int main() { int q,i; scanf("%d",&q); for(i=0;i<q;i++) { int n,j,k; scanf("%d %d",&n,&k); int a[n],even=0,x=0; for(j=0;j<n;j++) { scanf("%d",&a[j]); if(a[j]%2==0) { even++; } ...
C
7f5269f3357827b9d8682d70befd3de1
891b940bf276ada2e80d3ad672e383c3
1,200
PASSED
#include<stdio.h> int main() { long int T,n,i,j,k,l,Sum=0,c; scanf("%ld",&T); for(i=0;i<T;i++) { c=0; scanf("%ld",&n); scanf("%ld",&k); long int ar[n]; long int br[n]; for(j=0;j<n;j++) { scanf("%ld",&ar[j]); if(c==k-1) { Sum=Sum+ar[j]; continue; } Sum=Sum+ar[j]; if(Sum%2!=0) { b...
C
7f5269f3357827b9d8682d70befd3de1
8d75c67aba11115071aef59cd2ba1ba3
1,200
PASSED
#include <stdio.h> typedef long long ll; #define max(l,r) ((l)>(r)?l:r) #define min(l,r) ((l)<(r)?l:r) #define swap(l,r) {ll tp=l;l=r;r=tp;} #define rep(i,n) for(int i=0;i<(int)(n);i++) int n,t,k; int a[202020]; int solve(){ int ans = 0; int odd = 0; rep(i,n) if(a[i]%2) odd++; ...
C
7f5269f3357827b9d8682d70befd3de1
63bdff0eb5b118a8adcdadd6a9c2126f
1,200
PASSED
#include<cstdio> #include<cmath> #include<algorithm> using std::swap; #define int long long namespace QiFeng233{ const int maxn=4e6+10; const double pi=acos(-1); struct complex{//¸´ÊýÀàÐÍ double r,i; complex(double r=0,double i=0):r(r),i(i){} complex operator+(const complex &a)const{ return comple...
C++
97e68e5cf05c157b4f83eb07ff003790
431291438fb5238ea22fa20d4c030c3c
2,300
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; typedef complex<double> complex_t; const int MAXN = 810000; const double PI = acos(-1.0); int n,x; int a[MAXN]; ll res[MAXN],ans[MAXN]; namespace FFT{ int r[MAXN]; int init(int n){// n should be 2^k int len = 0; while((1<<len) < n) len++;...
C++
97e68e5cf05c157b4f83eb07ff003790
2f9c4627bc775750083e6c60e33afc43
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 500; const double Pi = acos(-1.0); int n, x; long long l, r[N], limit = 1, ans[N]; int a[N]; struct Complex { double x, y; Complex() {} Complex(double _x, double _y) :x(_x), y(_y) {} Complex operator + (const Complex & A) const { return Complex(x + A...
C++
97e68e5cf05c157b4f83eb07ff003790
03c6fc783a9559adf8368e05ff3626eb
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define next Next #define int long long const int N=1e6+5; const double P=acos(-1); int n,x,s,len,bit,rev[N],sum[N],ans[N]; struct node{ double x,y; }a[N],b[N]; node operator + (node a,node b){return (node){a.x+b.x,a.y+b.y};} node operator - (node a,node b){return (node)...
C++
97e68e5cf05c157b4f83eb07ff003790
9068f581bc9dd5b3adf5e7e2d4a94c00
2,300
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; typedef complex<double> cp; const int N=530000; const double pi=acos(-1); cp a[N],b[N],W,w,p; int n=1,m,i,j,k,x,sum,R[N],lst=-1;ll ans; inline void fft(cp*c,int t) { for(i=0;i<n;i++) R[i]<i? swap(c[R[i]],c[i]),0:0; for(i=1;i<n;i<<=1) for(j=...
C++
97e68e5cf05c157b4f83eb07ff003790
086dd569c8a90168bd378fd8320afdad
2,300
PASSED
// start fold #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<vector> #include<cstring> #include<set> #include<map> #include<cmath> #include<queue> #include<bitset> using namespace std; #define ri register int #define il inline #define LL long long #define ull unsigned long long #defi...
C++
97e68e5cf05c157b4f83eb07ff003790
20e4e04f4117c080bd9663e64cbd6c61
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef complex<double> Cp; typedef long long LL; const int N=6e5+10; const double PI=acos(-1.0); int n,m,l,X; int cnt[N],r[N],G[N]; Cp A[N],B[N]; void FFT(Cp C[],int t) { for(int i=0;i<n;i++) if(i<r[i]) swap(C[i],C[r[i]]); for(int i=1;i<n;i<<=1) { Cp x(cos(PI/i),t*sin(P...
C++
97e68e5cf05c157b4f83eb07ff003790
a5176e82a4d999046572b4b26dec7fa4
2,300
PASSED
#include<bits/stdc++.h> using namespace std; namespace red{ #define int long long #define lowbit(x) ((x)&(-x)) inline int read() { int x=0;char ch,f=1; for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar()); if(ch=='-') f=0,ch=getchar(); while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return...
C++
97e68e5cf05c157b4f83eb07ff003790
3fcc881ce879f5bb94462a40b0f89d07
2,300
PASSED
#include<cstdio> #include<cmath> #include<algorithm> #define N 800005 #define ll long long ll n,x,lim=1; ll sum[N],pos[N]; ll a[N],b[N],tot; ll SB=0; struct node{ long double r,i; }A[N],B[N],C[N]; const double pi=std::acos(-1); node operator+(node a,node b){ return (node){a.r+b.r,a.i+b.i}; } node operator-(node a,nod...
C++
97e68e5cf05c157b4f83eb07ff003790
43bf7b61d03111696ba3187ab2a16ab3
2,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define int long long int read() { int d = 0, w = 1; char ch = getchar(); while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') w = -1, ch = getchar(); while (ch >= '0'...
C++
97e68e5cf05c157b4f83eb07ff003790
11f9746b47538cc6135b442fdddeab46
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define mp make_pair #define pb push_back #define pii pair <int, int> #define piii pair<pii, int> #define vi vector<int> #define vpii vector<pii> #define read1(a) int a; scanf("%d", &a) #define read2(a, b) int a, b; scanf("%d %d",...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
54bc8c02e6f8ab578b0a0175d50a1882
2,300
PASSED
// In the name of God // Code by: mrMaster #include <bits/stdc++.h> using namespace std; #define int long long const int MN = 1e5 + 100; const int LG = 22; int dp1[MN] , dp2[MN] , cnt1[MN] , cnt2[MN]; int n,q; int h[MN],par[MN][LG]; vector<int>edges[MN]; void input() { int a,b; cin >> n >> q; for(int i=0;i<n-1...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
5e74c6383298ad77a30904f89e5e8e64
2,300
PASSED
// :) // Be name khoda #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define F first #define S second #define MP make_pair const int MAX = 1e5+9; const int MAXLOG = 18; const ll MOD = 1e9+7; vector <int> g[MAX]; ll n, m, sum[MAX], sz[MAX], dp[MAX]; int par[MAX][18], ...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
ffcc79a9c6c1d475ddfef4b2dd3f271c
2,300
PASSED
#include<iostream> #include<cstdio> #include<cstring> #define N 200010 #define ll long long using namespace std; int nxt[N<<1],to[N<<1],head[N],cnt; void add(int u,int v) { nxt[++cnt]=head[u]; to[cnt]=v; head[u]=cnt; } int fa[N],son[N]; ll dep[N],siz[N],dsiz[N]; int top[N],n; void dfs(int u,int f) { fa[u]=f; dep[u...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
a6ae53c93493b974905a77040d0594c1
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; vector < int > Adj[100001]; LL F[100001],G[100001]; LL sub[100001] , level[100001]; bool vis[100001]; int dp[21][100001]; const int MAXLG = 19; // G[u] : represents the summation Edges time // F[u] : represents the summation Edges time going up int ...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
cce3c7790fa25036086546184fa8aec2
2,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 100000 + 5; const int maxh = 20; int dfn[maxn][2], head[maxn], tot, dep[maxn], clk, par[maxn][maxh], sz[maxn], que[maxn]; struct edge { int to, next; e...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
da8ebdfdeb553fc1805b69adff6e3465
2,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 100000 + 5; const int maxh = 20; int dfn[maxn][2], head[maxn], tot, dep[maxn], clk, par[maxn][maxh], sz[maxn], que[maxn]; struct edge { int to, next; e...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
febc0106ab4f91996ef65b2094d4d656
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define N 100005 struct edge { int to,next; }e[N<<1]; int h[N],tp; void ae(int u,int v) { e[++tp].to=v; e[tp].next=h[u]; h[u]=tp; } int n,m; int fa[N][18],dep[N]; ll sum[N],sum2[N],siz[N]; void dfs(int u,int f) { siz[u]=1; for(int i=1;i<18;i++) fa...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
02772455b286fd375034b12c40487b64
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define pll pair<ll, ll> #define all(x) (x).begin(), (x).end() #define fi first #define se second const int NMAX = 100005; int n, m, x, y, lim, LCA; int lev[NMAX], f[20][NMAX], nr[...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
ced636536f0fd0dfd1e261468fb51cff
2,300
PASSED
//In the name of God! :) #include <iostream> #include <iomanip> #include <vector> #define pb push_back using namespace std; typedef long long ll; const int maxn = 1e5 + 100; int n, m, kid[maxn], hgt[maxn], par[maxn][35]; ll dis[maxn], disp[maxn]; vector <int> adj[maxn]; int parent (int v, int k){ for (int i = 0; i...
C++
2c1a2f8b91dd40e39763b5bedd8ad01a
d49c09ecc5da0b19937cb1531de09b79
2,300
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include <vector> #include <map> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; struct myp { ll vx, vy; bool operator == (const myp& o) const { return vx == o.vx || vy == o.v...
C++
9dc500c1f7fe621351c1d5359e71fda4
fc29d04325659a252e7179abe6c7f68c
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include <vector> #include <map> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; struct myp { ll vx, vy; bool operator == (const myp& o) const { return vx == o.vx || vy == o.v...
C++
9dc500c1f7fe621351c1d5359e71fda4
0df96fe3bf3dc20d8d7d2090d4c03921
2,000
PASSED
#include <bits/stdc++.h> #include <stdio.h> #include <math.h> #include <vector> #include <algorithm> //using namespace std; #define INF 0x3f3f3f3f #define INF64 0x3f3f3f3f3f3f3f3f using namespace std; const int maxN = 200005; int main() { int n, a, b; map<pair<long long int, long long int>, int> velocityCounter...
C++
9dc500c1f7fe621351c1d5359e71fda4
4c929d9f14f71f8062a89f48663ba2d8
2,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int llint; const double inf=1100000000.0; llint n,a,b,x,vx,vy,sol,uk; double k; map<llint,llint>mp; map<pair<llint,double>,llint>c; map<pair<llint,llint>,llint>spec; int main(){ cin>>n>>a>>b; for(int i=0;i<n;i++){ cin>>x>>vx>>vy; mp[vy-a*vx]++; if(v...
C++
9dc500c1f7fe621351c1d5359e71fda4
1b326f9882ffaf6dbbeaf1ad8db1537e
2,000
PASSED
#include <bits/stdc++.h> #define fio ios_base::sync_with_stdio(false);cin.tie(0); #define mp make_pair #define int int64_t using namespace std; const int N = 2e5 + 9; const int M = 1e9 + 7; int n, a, b, vx[N], vy[N], ans; map<pair<int, int> , int> cnt; map<int, int> f; int32_t main(){ #ifndef ONLINE_JUDGE freopen("i...
C++
9dc500c1f7fe621351c1d5359e71fda4
04d721cedf8790072585076f20b88c06
2,000
PASSED
#include <bits/stdc++.h> #define fio ios_base::sync_with_stdio(false);cin.tie(0); #define mp make_pair #define int int64_t using namespace std; const int N = 2e5 + 9; int n, a, b, vx[N], vy[N], ans; map<pair<int, int> , int> cnt; map<int, int> f; int32_t main(){ cin >> n >> a >> b; for(int i = 1; i <= n; i++){ cin...
C++
9dc500c1f7fe621351c1d5359e71fda4
5c40846939bd229ba5a2fcb2663310a9
2,000
PASSED
#include <cstdio> #include <map> #include <algorithm> using namespace std; pair <long long,long long> p; map <long long,int> many1; map <pair<long long,long long>,int> many2; int n;long long a,b,x,c,d,ans; int main() { scanf("%d%I64d%I64d",&n,&a,&b); for(int i=1;i<=n;i++) { scanf("%I64d%I64d%I64d",&x,&c,&d);p.fir...
C++
9dc500c1f7fe621351c1d5359e71fda4
b619aac44e30421954bae7d492b2675c
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld double #define mp make_pair #define pb push_back #define mod 1000000007 #define ff first #define ss second #define pll pair <ll,ll> #define nl "\n" ll s(ll d) { ll sum=(d*(d-1)); return sum; } int main() { ios_base::sync_with_stdio(fa...
C++
9dc500c1f7fe621351c1d5359e71fda4
0b331211c0aae69f36c47597c211eed4
2,000
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<vector> #include<map> #define LL long long const int maxn=2e5+5; struct G{ int xi,vx,vy; int val; bool operator <(const G&p)const{ return vx<p.vx; } }g[maxn]; int bit[maxn]; std::vector<G>fz[maxn]; std::map<LL,int>mapp; int v[maxn]; int vtot=0; int a...
C++
9dc500c1f7fe621351c1d5359e71fda4
f021e3b643bf56bfc4fc2763546d3a5e
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define LL long long struct hash_name{ size_t operator()(const pair<LL,LL> & p) const{ return p.first^p.second;//hash<string>()(p.name) ^ hash<int>()(p.age); } }; unordered_map<LL,int>sum; unordered_map<pair<LL,LL>,int,hash_name>tot; LL n,a,b,ans=0; int main(){ scanf...
C++
9dc500c1f7fe621351c1d5359e71fda4
0496d8d76e7d16dc6a78da07fe7c3ccc
2,000
PASSED
#include <bits/stdc++.h> #define fst first #define snd second #define N 212345 using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; int n, x, fmx, smx, d[N], res = 1; int main() { cin >> n; for(int i = 1; i <= n; i++){ ...
C++
c15ad483441864b3222eb62723b598e1
0d7ed9bebfe72ba0e1c01ad107a0c074
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int cnt[100005]; int main(){ int max1=0,max2=0,n,i,p; scanf("%d",&n); max1=0,max2=0; for(i=0;i<n;i++){ scanf("%d",&p); if(p>max1){ cnt[p]--; max2=max1; max1=p; }else{ if(p>max2){ cnt[max1]++; max2=p; }else{ continue; } } } int ans=...
C++
c15ad483441864b3222eb62723b598e1
ad1c75edbc41c8cebee16473c8cdedc3
1,700
PASSED
#include <iostream> using namespace std; int n,x,m,sec,ans=1,v[100100]; int main() { cin>>n; for(int i=0;i<n;++i) { cin>>x; if(x>m) { v[x]=1; sec=m; m=x; } else if(x>sec) { --v[m]; sec=x; } } for(int i=1;i<=n;++i) if(v[i]<v[ans]) ans=i; cout<<ans; return 0; }
C++
c15ad483441864b3222eb62723b598e1
e494b303847a97fb6c53c6decd3a8757
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> using namespace std; int n,ans,m1,m2,x,a[100010]; int main() { scanf("%d", &n); for (int i=1;i<=n;i++) { scanf("%d", &x); if (x>m1) { a[x] = 1;m2 = m1;m1 = x; } else if (x>m2) ...
C++
c15ad483441864b3222eb62723b598e1
9f29271a938247b74bbcf6b454065469
1,700
PASSED
#include <iostream> #include <stdio.h> using namespace std; int a[100010], max1[100010], max2[100010], c[100010], tg[100010], pos[100010]; int main() { //freopen("input.inp","r",stdin); int n; cin>>n; for (int i=1;i<=n;i++){ cin>>a[i]; pos[a[i]]=i; } for (int i=1;i<=n;i++){ ...
C++
c15ad483441864b3222eb62723b598e1
18036e0272ebacd3ea8ffc2933671180
1,700
PASSED
#include <iostream> #include <stdio.h> using namespace std; int a[100010], max1, max2; int main() { //freopen("input.inp","r",stdin); int n,k; cin>>n; for (int i=1;i<=n;i++){ cin>>k; if (k>max1){ max2=max1; max1=k; a[k]--; } else{ ...
C++
c15ad483441864b3222eb62723b598e1
1fe11da4882cba838e971bb184f98b6d
1,700
PASSED
#include <iostream> #include <stdio.h> using namespace std; int a[100010], max1[100010], max2[100010], c[100010], tg[100010], pos[100010]; int main() { //freopen("input.inp","r",stdin); int n; cin>>n; for (int i=1;i<=n;i++){ cin>>a[i]; pos[a[i]]=i; } for (int i=1;i<=n;i++){ ...
C++
c15ad483441864b3222eb62723b598e1
0147d62bd9221b7fc529d99c4c82ff1c
1,700
PASSED
#pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> #include<iostream> #include<map> #include<queue> #include<stack> #include<string> #include<functional> //#include<bits/stdc++.h> using namespace std; typedef long long lint;...
C++
c15ad483441864b3222eb62723b598e1
da1c00802d6c5f56cdfe303f2aad64f3
1,700
PASSED
#include <cstdio> #include <algorithm> #include <cstring> #include <map> #include <queue> #include <string> using namespace std; const int Tmax=1e5+5; int n,data[Tmax],cl[Tmax],cr[Tmax],num,ans,minn=Tmax,maxx=0,self[Tmax]; bool v[Tmax]; int lowbit(int x) { return x&-x; } int sum(int *c,int x) { int ret=0; whil...
C++
c15ad483441864b3222eb62723b598e1
fcdc09134675a82dde1f277c2785523c
1,700
PASSED
#include<iostream> #include<cstring> using namespace std; int main() { int n,a[100009]; int x[100009]; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; memset(x,0,sizeof(x)); int mx1=0,mx2=0; for(int i=1;i<=n;i++) if(a[i]>mx1)mx2=mx1,mx1=a[i],x[a[i]]--; else if(a[i]>mx2)x[mx1]++,mx2=a[i]; int ans=1; for(int i=2;i<=n;...
C++
c15ad483441864b3222eb62723b598e1
7a5652583f0aea479a03c19f796647bc
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <queue> #include <algorithm> #include <set> using namespace std; int data[200010]; int main() { int n,res,i,j,pos; while(~scanf("%d",&n)) { res = 0; for(i=0; i<n; i++) ...
C++
0ef324e3e314ea17c01aafb822e90c63
bafee2dae31c56213b4c2c7739e88847
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <queue> #include <algorithm> #include <set> using namespace std; int a[1000005]; int main() { int n; while(~scanf("%d",&n)) { for(int i=0; i<n; i++) scanf("%d",&a[i]); ...
C++
0ef324e3e314ea17c01aafb822e90c63
d1f74fe098bf7b5c93798a6bd48acaa5
2,100
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<iostream> #include<algorithm> #include<math.h> #include<vector> #include<set> #include<stack> #include<queue> using namespace std; #define inf 0x3f3f3f #define ll long long const ll mod=1e9+7; int p[200020]; int a[1000020]; int b[1000010]; int main() { ...
C++
0ef324e3e314ea17c01aafb822e90c63
cd2d68927eeb83423d9e132c5919a7d4
2,100
PASSED
#include<iostream> #include<algorithm> using namespace std; int main() { int n,j=2,ans=0,k=0,id=0,a[223456]; cin >> n;for (int i = 0; i<n; i++)cin >> a[i]; sort(a, a + n); n = unique(a, a + n) - a; for (int i = n - 1; i >= 0; i--) { j = 2; while (1) { k = a[i] / j...
C++
0ef324e3e314ea17c01aafb822e90c63
b6d3bc962490cf2bceebe2390e9d3c57
2,100
PASSED
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <cmath> #include <algorithm> #include <assert.h> typedef long long ll; #define mp make_pair #define mt(a, b, c) mp(a, mp(b, c)) using namespace std; int main() { i...
C++
0ef324e3e314ea17c01aafb822e90c63
5506b3eabb98be6197db6ee1f93b3bb4
2,100
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cassert> #include <iostream> #include <sstream> #include <vector> using namespace std; int a[222222]; int counts[1111111]; int last_increase[1111111] ; bool done[1111111]; int main() { int n; cin>>n; for(int i=0;i<...
C++
0ef324e3e314ea17c01aafb822e90c63
65e1753a19ca43f5fd4b2f7f8810b7e0
2,100
PASSED
#include <stdio.h> int d[200050]; int isLarger[2000050]; int chk[1000050]; int main() { int N, i, j, tmp, ans = 0; scanf("%d", &N); if(N == 1) { printf("0"); return 0; } for(i = 1; i <= N; i++) { scanf("%d", &d[i]); chk[d[i]] = 1; } for(i = 1; i <= 1000000; i+...
C++
0ef324e3e314ea17c01aafb822e90c63
ad8915b8e9de31c249f4873d70392aa2
2,100
PASSED
#include <vector> #include <stack> #include <iostream> #include <cstdio> #include <string> #include <cmath> #include <algorithm> #include <map> #include <functional> #include <set> #define mp(x, y) make_pair(x, y) using namespace std; typedef long long ll; const ll MOD = ll(1e9) + 7; int n; vector <int> a; int ma...
C++
0ef324e3e314ea17c01aafb822e90c63
54f6917e6bd1a4b32aa7e0855c87d1f4
2,100
PASSED
#pragma comment(linker,"/STACK:10000000000") #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <fstream> #include <iostream> #in...
C++
0ef324e3e314ea17c01aafb822e90c63
dda89f167ca5cf005c8d941b2ce71886
2,100
PASSED
#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <map> #include <vector> #include <stack> #include <queue> #include <set> #include <cassert> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; typedef pair<int,int> PII; typedef vector<int> VI; const int mo...
C++
0ef324e3e314ea17c01aafb822e90c63
b0620e392f6b3fecfd8343fbe8232698
2,100
PASSED
import java.util.Scanner; import java.util.*; public class code1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while (--t>=0) { int n=sc.nextInt(); long x=sc.nextInt(); long[]z=new long[n]; for (int i=0;i<n;i++) { z[i]=sc.nextInt(); ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
30966e88da4aa7067d0c29cbdca67c7d
1,400
PASSED
import java.util.*; public class ZeroArray { public long n; public long k; public long[] a; public ZeroArray(long n, long k, long[] a) { this.n = n; this.k = k; this.a = a; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
065b6642c11e2cac7e489ba8cfc1757f
1,400
PASSED
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
9f6af1f4878c9ecbebf9bf6ab4d39fd1
1,400
PASSED
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
45130fcb8fbda5bbb9da276caa5f1721
1,400
PASSED
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
9ee6773d7f340c76c459d936647faa86
1,400
PASSED
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
ed43b3e4c5b5a79bd70116dba94ce6be
1,400
PASSED
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
a8b4c115bedda3847e7c2e3620e3e19b
b73033a8544287dfb2b8cde3d910b85c
1,400
PASSED
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class stone { public static void main(String args[]) throws IOException { FastReader sc = new FastReader(); BufferedWriter w = new BufferedWriter(new PrintWriter(Sy...
Java
a8b4c115bedda3847e7c2e3620e3e19b
4c5268f0dd57643528b83027c6ec88c8
1,400
PASSED
import java.io.BufferedReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.IOException; public class codeforces { public static void main(String[] args) { scanner in = new scanner();...
Java
a8b4c115bedda3847e7c2e3620e3e19b
c1644528b2b3834021ca6ea0ae2564f4
1,400
PASSED
import java.util.*; import java.io.*; import java.math.BigInteger; public class CodeForcesZeroRemainderArray { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Inte...
Java
a8b4c115bedda3847e7c2e3620e3e19b
f773cccb3b419416517ebdcdaac2edba
1,400
PASSED
#include <bits/stdc++.h> using namespace std; //may thang kia dung co doc code tao va xam nua int main() { int pos[26], dp[26], ans = 10000000, n; bool exist = false; memset(pos, -1, sizeof(pos)); memset(dp, 0, sizeof(dp)); string s; cin >> s; for(int i = 0; i < s.length(); i++) { n = s[i] - 'a'; if(pos[n] ==...
C++
81a558873e39efca5066ef91a9255f11
a6c979e0cce7f42d5a068266b3cf590a
1,400
PASSED
#include <bits/stdc++.h> using namespace std; char str[1000005]; int vis[305]; int ans[305]; int main() { scanf("%s",str+1); int tmp=1e7; int len=strlen(str+1); //for(int i=0;i<300;i++) ans[i]=1e7; for(int i=1;i<=len;i++) { ans[str[i]]=max(ans[str[i]],i-vis[str[i]]); //printf("%c %d %d\n",s...
C++
81a558873e39efca5066ef91a9255f11
574e42d68fee39cd210939ea25edf65e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; char str[1000005]; int vis[305]; int ans[305]; int main() { scanf("%s",str+1); int tmp=1e7; int len=strlen(str+1); for(int i=1;i<=len;i++) { ans[str[i]]=max(ans[str[i]],i-vis[str[i]]); vis[str[i]]=i; } for(int i=0;i<=300;i++) if(ans[i]) { ans[...
C++
81a558873e39efca5066ef91a9255f11
633f5afe24c26b63337fe5062c98de85
1,400
PASSED
// Codeforces Bless me. #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <vector> #define loop(i, num) for (int i = 0; i < num; i++) using namespace std; string s; bool check(int l) { int letters[26]; loop (i, 26) { letters[i] = 0; ...
C++
81a558873e39efca5066ef91a9255f11
72adf61321dfa3d2b8b3554bab1434c1
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define debug(...) printf( __VA_ARGS__ ) //#define debug(...) /****nothing****/ #define pb push_back #define mp make_pair #define LL long long #define mem(arr,val) memset(arr,val,sizeof(arr)) int n,a[282][100007],b; string str; set<char> st; bool check(int len,char ch)...
C++
81a558873e39efca5066ef91a9255f11
aaf3228e5c37a399f36c2dac370ccf77
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define debug(...) printf( __VA_ARGS__ ) //#define debug(...) /****nothing****/ #define pb push_back #define mp make_pair #define LL long long #define mem(arr,val) memset(arr,val,sizeof(arr)) int n,pre[600],b,len[600]; char str[200000]; int main() { //freopen("d://...
C++
81a558873e39efca5066ef91a9255f11
aedb9167057374b72faca61df153d5fc
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define debug(...) printf( __VA_ARGS__ ) //#define debug(...) /****nothing****/ #define pb push_back #define mp make_pair #define LL long long #define mem(arr,val) memset(arr,val,sizeof(arr)) int n,pre[600],b,len[600]; char str[200000]; int main() { //freopen("d://...
C++
81a558873e39efca5066ef91a9255f11
8e97bb18a9993eeaae6d0ace03c21df8
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); int ans = INT_MAX; for(char c='a';c<='z';c++) { int mx = 0; int p = -1; for(int i=0;i<n;i++) { if(s[i]==c) { mx = max(mx,i-p); ...
C++
81a558873e39efca5066ef91a9255f11
51c39ac09a8f313cb370d4a4adc19270
1,400
PASSED
#include <bits/stdc++.h> #define ll long long #define Start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define dbg(...) cerr << "LINE(" << LINE << ") -> [" << #__VA_ARGS__ << "]: [", DBG(VA_ARGS) #define fr first #define sc second #define PI 3.14159265 #define ullt unsigned long long int using namespace std; void ...
C++
81a558873e39efca5066ef91a9255f11
64e20e80738eab04639c69aea61bb4cc
1,400
PASSED
// C. �-������������ ������ // http://codeforces.com/problemset/problem/888/C #include <iostream> #include <fstream> #include <vector> #include <set> #include <string> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <bitset> using namespace std; #define DEBUG #ifdef DEBUG istream& in =...
C++
81a558873e39efca5066ef91a9255f11
23d0a7e239c2af9611a03c4144a86492
1,400
PASSED
// finishing // #492 Div. 2 // C // https://codeforces.com/blog/entry/60443 // https://codeforces.com/submissions/c3n34ka #include <iostream> #include <vector> #include <set> void printVector(std::vector<int> &v) { for(int ii = 0; ii < (int)v.size(); ii++) { std::cout << v[ii]; } } void resetVector(std::vector<b...
C++
4671380d70876044e0ec7a9cab5e25ae
4f30d53c21774dd5c69a2657a82f5cb3
1,400
PASSED
// finishing // #492 Div. 2 // C #include <iostream> #include <vector> #include <set> void printVector(std::vector<int> &v) { for(int ii = 0; ii < (int)v.size(); ii++) { std::cout << v[ii]; } } void resetVector(std::vector<bool> &v) { for(int ii = 0; ii < (int)v.size(); ii++) { v[ii] = false; } } void pr...
C++
4671380d70876044e0ec7a9cab5e25ae
db26eba33b6c5395c041cdb827b5a571
1,400
PASSED
#include <bits/stdc++.h> #define ll long long #define M 1000000007 #define mp make_pair #define pb push_back #define p(k) printf("%d ",k) #define pl(k) printf("%lld ",k) #define pn(k) printf("%d\n",k) #define pln(k) printf("%lld\n",k) #define ps(str) printf("%s",str) #define s(k) scanf("%d",&k) #define sl(k) scanf("%ll...
C++
4671380d70876044e0ec7a9cab5e25ae
f868ca960e0dfd9d922321aa9317db64
1,400
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <set> typedef long long ll; int main(){ ll n; scanf("%lld", &n); std::vector<ll> v(n); for(ll p = 0; p < n; p++){scanf("%lld", &v[p]);} std::vector<ll> right(n); std::set<ll> ls, rs; std::vector<ll> rq(n, 0); for(ll p = n - 1; ...
C++
4671380d70876044e0ec7a9cab5e25ae
f54189608aef6dedc7b18de961a6f820
1,400
PASSED
#include<cstdio> #include<vector> #include<cmath> #include<string> #include<algorithm> using namespace std; int main() { long long n, m; long long i; long long arr[100001], acc[100001]; bool visited1[100001] = { 0, }, visited2[100001] = { 0, }; long long sol = 0; scanf("%lld", &n); scanf("%lld", &arr[0]); v...
C++
4671380d70876044e0ec7a9cab5e25ae
c556c098711380b7ed176336ff45e9a6
1,400
PASSED
#include <iomanip> #include <iostream> #include <vector> #include <set> #include <map> #include <algorithm> #include <ctime> #include <cstdio> #include <cmath> #include <queue> #include <bitset> #include <string> #define ll long long #define mp make_pair #define pb push_back using namespace std; const int N = 101...
C++
4671380d70876044e0ec7a9cab5e25ae
0ad983d16c455204caa61b545fed1a5d
1,400
PASSED
#include <iostream> #include <set> #define ll long long using namespace std; int n, a[100001], b[100001], c[100001]; ll ans = 0; int main() { set<int>A, B; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i < n; i++) A.insert(a[i]), b[i] = A.size(); for (int u = n; u > 1; u--) B.insert(a...
C++
4671380d70876044e0ec7a9cab5e25ae
dfcb9b10562bdf54398e69463dc95285
1,400
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <set> typedef long long ll; int main(){ ll n; scanf("%lld", &n); std::vector<ll> v(n); for(ll p = 0; p < n; p++){scanf("%lld", &v[p]);} std::vector<ll> right(n); std::set<ll> ls, rs; std::vector<ll> rq(n, 0); for(ll p = n - 1; ...
C++
4671380d70876044e0ec7a9cab5e25ae
e8cc440a37f30ec54926092a214a3045
1,400
PASSED
#include<iostream> #include<string> #include<fstream> #include<algorithm> #include<cmath> #include<map> #include<cstdlib> #include<vector> #include<set> using namespace std; ofstream fo("test.out"); ifstream fi("test.inp"); #define N 100005 //#define mod 1000000007 #define For for(long long i=1;i<=n;i++) #define For2 ...
C++
4671380d70876044e0ec7a9cab5e25ae
d47f800a3f333bcb84cf8d6578f0b367
1,400
PASSED
#include<cstdio> #include<memory.h> #include<iostream> #include<algorithm> #include<map> #include<queue> #include<stack> #include<string> #include<iostream> #include<iomanip> #include<stdio.h> #include<string.h> #include<queue> int n, arr[200000],temp[200000]; using namespace std; int main() { long long ans = 0; bool...
C++
4671380d70876044e0ec7a9cab5e25ae
960e1c2134a2fe0880bd59aa78a3b151
1,400
PASSED
# import all important libraries and inbuilt functions from __future__ import division, print_function from fractions import Fraction import sys,bisect,heapq,copyreg,copy,statistics,os from math import * from collections import Counter,defaultdict,deque,OrderedDict from itertools import combinations,permutations,acc...
Python
f82058f6ba3ce0da15a5ce059674af35
074dd53ed2887c27332f59609592fd16
800
PASSED
t = int(input()) while t: l = [] n = int(input()) b = n % 2 n = n // 2 a = 1 while n: l.append(str(a)) l.append(str(a)) a += 2 n -= 1 if b: l.append(str(a)) print(" ".join(l)) t -= 1
Python
f82058f6ba3ce0da15a5ce059674af35
d6687301920177e3b62eda30576535ef
800
PASSED
for _ in range(int(input())): n=int(input()) cnt=999 for i in range(n): print(cnt,end=" ") print()
Python
f82058f6ba3ce0da15a5ce059674af35
ded35175c0362f74d0495458cb402f98
800
PASSED
t=int(input()) while(t>0): n=[] m=int(input()) for i in range(m): n.append('1') print(' '.join(n)) t-=1
Python
f82058f6ba3ce0da15a5ce059674af35
06e68fe826a636785db537d8c8864c1f
800
PASSED
for x in range(int(input())): l=int(input()) lst=list() k=1 while(l>=1): lst.append(k) l=l-1 print(*lst)
Python
f82058f6ba3ce0da15a5ce059674af35
c387559f2effd1a0418b3b6ba43cdf7d
800
PASSED
def func(n): return ' '.join(['1' for i in range(n)]) def main(): t = int(input()) input_list = [int(input()) for i in range(t)] for i in list(map(func,input_list)): print(i) main()
Python
f82058f6ba3ce0da15a5ce059674af35
883e511e57b91ef9ccd93b4ec41b0b7b
800
PASSED
for _ in range(int(input())): n=int(input()) i=0;lists=[1] while i<n-1: lists.append(1) i=i+1 print(*lists)
Python
f82058f6ba3ce0da15a5ce059674af35
171632d901959024e99ab68106499f9d
800
PASSED
n=int(input()) for i in range(n): m=int(input()) for i in range(1,m+1): print(1,end=' ') print()
Python
f82058f6ba3ce0da15a5ce059674af35
3be0a631e9bfc3666023d2f3d3edf5e0
800
PASSED
for _ in range(int(input())): n=int(input()) for i in range(n): print(1,end=' ') print()
Python
f82058f6ba3ce0da15a5ce059674af35
ae9956b29ec0d1844432d2732a9a70f9
800
PASSED
for _ in range(int(input())): n=int(input()) for i in range(n): print(1,end=" ") print("")
Python
f82058f6ba3ce0da15a5ce059674af35
cf604cad01e5731aefac4664b7f6674e
800
PASSED