source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define f first #define s second #define Mp make_pair #define pb push_back #define pii pair<int, int> #define forn(strt, finish, step) for( int i = strt; i < finish; i += step ) const ll Maxn = 100*1000 + 10, Mod = 1000*1000*1000+7; int n, cnt[M...
C++
6dafebcc521b7523427724753187715a
0183ed8fb71ea7f2ab3443a3ccd26351
1,600
PASSED
/* ID: Imtiaz_Riton PROG: restore LANG: C++ */ #include <bits/stdc++.h> #define ll long long #define ld long double #define nl "\n"; #define ii pair<int, int> #define inf 1 << 29 #define base 37 using namespace std; const int M = 1e5 + 7; vector < int > g[M], res; int repair[M], dp[M]; void df...
C++
6dafebcc521b7523427724753187715a
6dd3451955517a3242c6a9be11e7d0ca
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; bool pro[MAXN]; int n, b[MAXN]; vector<pair<int, int>> v, g[MAXN]; vector<int> ans; pair<int, int> parent[MAXN]; void dfs(int v = 1, int p = -1){ for(auto[u, t] : g[v]) if(u != p) b[u] = b[v] + (t == 2), parent[u] = {v, ...
C++
6dafebcc521b7523427724753187715a
21c0fc6553a5dfcf5a9de6c9d629b891
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; bool process[MAXN]; int dp[MAXN],niv[MAXN]; vector<pair<int,int> > g[MAXN],g1; vector<int> rr; void dfs(int u, int tam){ process[u] = true; for(int i = 0;i < g[u].size();i++){ pair<int,int> v = g[u][i]; if(process[v.first]) continue; n...
C++
6dafebcc521b7523427724753187715a
6b0fd74030dafcc21c8e2884de70b8a1
1,600
PASSED
#include <bits/stdc++.h> #define loop(i,a,b) for(int i=a;i<b;i++) #define pb(x) push_back(x) #define F first #define S second using namespace std; int n; const int N=1e5+9; vector<int> g[N]; vector<int> gp[N]; bool white[N]; int sub[N]; bool visit[N]; unordered_set<int> st; //int ans=0; int dfs(int u,int p){ // cout<<...
C++
6dafebcc521b7523427724753187715a
38c2f20d176969ad3e51ad410cb1c426
1,600
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> using namespace std; #define INF (1LL<<61) #define maxn 111111 struct st { __int64 x,y; }point[maxn],go[maxn]; __int64 dis(st a,st b) { return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); } int cam(const void *x,const void ...
C++
74da42a1627e4a00fbaae91c75140287
9ea3a5a666cab2ada1835b631d02c866
2,200
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> using namespace std; #define INF (1LL<<61) #define maxn 111111 struct st { __int64 x,y; }point[maxn],go[maxn]; __int64 dis(st a,st b) { return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); } int cam(const void *x,const void ...
C++
74da42a1627e4a00fbaae91c75140287
55dcbca4cc67a557c7d8747912572140
2,200
PASSED
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstdio> #include<vector> #include<cmath> #include<set> #include<map> using namespace std; #define x first #define y second #define mp make_pair #define ll long long #define pb push_back #define pow hi1 #define bro pair<int, int> #define all(a) (a).begin(...
C++
74da42a1627e4a00fbaae91c75140287
a5adcd261d393ca1c0ca76d0b2e2fb43
2,200
PASSED
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstdio> #include<vector> #include<cmath> #include<set> #include<map> using namespace std; #define x first #define y second #define mp make_pair #define ll long long #define pb push_back #define bro pair<int, int> #define all(a) (a).begin(), (a).end() co...
C++
74da42a1627e4a00fbaae91c75140287
1aaaf64b5d4e677d35e07984c7d45e39
2,200
PASSED
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstdio> #include<vector> #include<cmath> #include<set> #include<map> using namespace std; #define x first #define y second #define mp make_pair #define ll long long #define pb push_back #define bro pair<int, int> #define all(a) (a).begin(), (a).end() co...
C++
74da42a1627e4a00fbaae91c75140287
520568bfcda53d6420801b62b3788dfe
2,200
PASSED
#include <bits/stdc++.h> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <iostream> #include <algorithm> #include <string> #include <queue> #include <stack> #include <map> #include <set> #define IO ios::sync_with_stdio(false);\ cin.tie(0);\ cout.tie(0); typedef long long LL...
C++
74da42a1627e4a00fbaae91c75140287
2876c467d561e47e863aae229c1f40a2
2,200
PASSED
#include<stdio.h> #include<string.h> #include<vector> #include<algorithm> #include<iostream> #include<queue> using namespace std; #define N 100050 #define ll long long ll a[N], sum[N]; ll n; int main(){ ll u, v, i, j, que; sum[0] = 0; while(~scanf("%I64d",&n)){ for(i=1;...
C++
74da42a1627e4a00fbaae91c75140287
c0f5894ae4ade18e93fd5eee49809284
2,200
PASSED
#include <iostream> #include <string> #include <cstdlib> #include <algorithm> #include <vector> #include <string.h> #include <utility> #include <queue> #include <stack> #include <iomanip> #include <ctype.h> #include <sstream> #include <map> #include <set> #include <stdio.h> #include <assert.h> #include <ctype.h> #inclu...
C++
74da42a1627e4a00fbaae91c75140287
bc384f9506e2acbb9e8378d81c13dc77
2,200
PASSED
//Solution by Daniyar Maminov #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <math.h> #include <vector> #include <c...
C++
74da42a1627e4a00fbaae91c75140287
37e339a8b7b829fdabd1753aa09281d5
2,200
PASSED
//Solution by Daniyar Maminov #include<iostream> #include<fstream> #include<string> #include<algorithm> #include<math.h> #include<vector> #include<cstring>...
C++
74da42a1627e4a00fbaae91c75140287
6517d61582a56b0295971c383bc1ca47
2,200
PASSED
#include<bits/stdc++.h> using namespace std; int n,q; int sq=320; const int mxn=(1e5)+5; int a[mxn]; int ans[mxn]; int val[mxn]; void update(int i,int x) { int j=i; a[i]=x; while(j/sq==i/sq&&j>=0) { if(j+a[j]>=n) ans[j]=j,val[j]=1; else { if((j+a[j])/sq==i...
C++
72e62f8dab43725ae5f4dd4d73d3d626
ef890868ee35efcb30edded4c7b77e64
2,700
PASSED
#pragma GCC target ("avx2") #pragma GCC optimization ("Ofast") #pragma GCC optimization ("unroll-loops") #pragma comment(linker,"/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //order_of_key(k): Number of items strictly smaller than k ....
C++
72e62f8dab43725ae5f4dd4d73d3d626
ebb4052098de3b9655f719b52f176488
2,700
PASSED
//ITNOA #include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back const long long INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7,MAXL=25; typedef long long ll; typedef pair<int,int> pii; typedef pair<pii,ll> piii; void OUT(long double o,int x){ cout<<fixed<<setprecision(x)<<o; return; } ...
C++
72e62f8dab43725ae5f4dd4d73d3d626
c7d0009092ea75c047afa9a114018d81
2,700
PASSED
//ITNOA #include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back const long long INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7,MAXL=25; typedef long long ll; typedef pair<int,int> pii; typedef pair<pii,ll> piii; void OUT(long double o,int x){ cout<<fixed<<setprecision(x)<<o; return; } ...
C++
72e62f8dab43725ae5f4dd4d73d3d626
8c530639e15d052c965ad7d019dff19d
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10, root = 340; int n, m; int v[maxn], qtd[maxn], ultimo[maxn], prox[maxn]; void build() { for(int i = n ; i > 0 ; --i) { int ini, fim; ini = i/root; fim = ini + 1; ini *= root, fim *= root; for(int j = i ; j >= max(ini, 1) ; --j) { ...
C++
72e62f8dab43725ae5f4dd4d73d3d626
8f99916b2acfb0dda233dc2d2339ca63
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10, root = 340; int n, m; int v[maxn], amf[maxn], lastb[maxn], nextb[maxn]; void build() { for(int i = n ; i > 0 ; --i) { int bi, bf; bi = i/root; bf = bi + 1; bi *= root, bf *= root; for(int j = i ; j >= max(bi, 1) ; --j) { if(v[...
C++
72e62f8dab43725ae5f4dd4d73d3d626
54b72cb1312b22aaa0d468a4284be961
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10, root = 340; int n, m; int v[maxn], amf[maxn], lastb[maxn], nextb[maxn]; void build() { for(int i = n ; i > 0 ; --i) { int bi, bf; bi = i/root; bf = bi + 1; bi *= root, bf *= root; for(int j = i ; j >= max(bi, 1) ; --j) { if(v[...
C++
72e62f8dab43725ae5f4dd4d73d3d626
f53e253d6b427aad44bbdd8f87bd9fdb
2,700
PASSED
#include<algorithm> #include<iostream> #include<iomanip> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<queue> #include<stack> #include<ctime> #include<set> #include<map> #include<bitset> #include<vector> #include<climits> #define LL long long #define LBT(x) x&(-x) using namespace std; in...
C++
72e62f8dab43725ae5f4dd4d73d3d626
e326397763b707ec228bc1e719241d03
2,700
PASSED
#include<cstdio> #include<cmath> using namespace std; const int maxn=2e5+10; int n,m,a[maxn],k,l[maxn]; struct node{ int next,w,k; }pos[maxn*2]; void ask(int x) { int tmp=x,ans=0,cnt=tmp; while(pos[tmp].k) { ans+=pos[tmp].w; cnt=tmp; tmp=pos[tmp].next; } tmp=cnt; while(pos[tmp].k==pos[cnt].k)cnt=tmp,tmp+=a...
C++
72e62f8dab43725ae5f4dd4d73d3d626
74ebe50c6a70eb8d875f48e0680c596f
2,700
PASSED
#include<stdio.h> const int maxn=200005; int i,j,k,m,n; int bnc[maxn]; inline void swp(int &a,int &b){ a+=b,b=a-b,a-=b; } inline int max(int a,int b){ return a>b? a:b; } struct Link_Cut_Tree{ int val[maxn],chd[maxn][2],f[maxn],tag[maxn],size[maxn],maxx[maxn]; inline void init(int n){ for(int i=1;i<=n...
C++
72e62f8dab43725ae5f4dd4d73d3d626
7d335c271a2200fa07935c87325ca803
2,700
PASSED
#include<stdio.h> //#include<conio.h> int main() { int n,m,mid,i,temp1,temp2,found=0,j,count=0,ans=0; int str[105][105]; // printf("enter the value of n and m:"); scanf("%d %d",&n,&m); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) scanf("%d",&str[i][j]); } ans=n; if(n%2==1) mid=n; else { do { mid=ans/2;...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
e724c7f28fbeadd9b5c5811b54608d00
1,300
PASSED
#include<stdio.h> int main(){ int i,j,n,m,a[100][100],ans; scanf("%d%d",&n,&m); for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&a[i][j]); } } while(n>0){ ans=n; if(n%2==0){ for(i=n/2;i<n;i++){ for(j=0;j<m;j++){ ...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
d30e3382c21e7d27b09a7c1d6ef3176c
1,300
PASSED
#include<stdio.h> int main() { int n,m; scanf("%d %d",&n,&m); int i,j,arr[105][105]; for(i=0;i<n;++i) { for(j=0;j<m;++j) { scanf("%d",&arr[i][j]); } } if(n%2==1) printf("%d",n); else { int prev=1; int ch=0; int div=2...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
089bdd13539a0b55156633f76b2b68d2
1,300
PASSED
#include <stdio.h> #include<stdio.h> #include<math.h> #include<string.h> int main(void) { int n,m,matrix[102][102],min=0,i,j,k; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) scanf("%d",&matrix[i][j]); } min=n; if(n%2==1){ printf("%d",n); return 0; } i=n/2; j=(n/2)+1; while(n...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
f01f468746f888b7cc8cfcf0fac7a576
1,300
PASSED
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <ctype.h> #define MAXN 1005 #define N 205 #define INF 1<<30 #define eps 1.0e-10 #define For(i,m,n) for(i=(m);i<n;i++) #define MAX(x,y) (x)>(y)?(x):(y) #define MIN(x,y) (x)<(y)?(x):(y) int a[N][N], n, m; int judge(int t) { int ...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
5350a8c13d7f88ba522442bc0218fa3f
1,300
PASSED
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> int ma[110][110]; bool equals(int a,int b,int length) { int j; for (j=1;j<=length;j++) { if (ma[a][j] != ma[b][j]) { return false; } else { if (j==length) return true; } } return fal...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
1540fca066f6fb8b02e72193374f765e
1,300
PASSED
#include <stdio.h> #define maxlen 105 int N; int check(int s,int e,int col,int mx[][maxlen]) { int upi,downi,j,ok=0; if(e&1) return N; upi=(s+e)/2,downi=upi+1; while(upi>=1) { for(j=1;j<=col;j++) if(mx[upi][j]!=mx[downi][j]) {ok=1;break;} if(ok) break; upi--,downi++;...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
5b2a084c8a788ab4f985c72ef164b343
1,300
PASSED
#include <stdio.h> int main(int argc, char *argv[]) { int n, m, a[100][100] = {}, num; int i, j, l; scanf("%d%d", &n, &m); num = n; for(i = 0; i < n; i++) for( j = 0; j < m; j++) scanf("%d", &a[i][j]); for(;num > 1; ) { if(num%2 == 1) { ...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
3605a548477cede2fcba276b15232ff2
1,300
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> char str[100+1][10000+10]; int main() { int n,k; scanf("%d%d",&n,&k); getchar(); int i,j; for(i=0;i<n;i++) gets(str[i]); if(n&1) printf("%d",n); else { int rows = n; int flag = 0; for(i=0...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
ee8c3083baa309ef00b6c94fcce40d0e
1,300
PASSED
#include<stdio.h> int A[105][105]; int divide(int n, int m) { if(n == 1) return n; if(n%2 != 0) return n; int i,j,flag; for(i=n/2;i<n;++i) { flag = 1; for(j=0;j<m;++j) { if(A[i][j] != A[n-i-1][j]) { flag = 0; break; } } if(flag == 0) break; } if(flag == 0) return n; else re...
C
90125e9d42c6dcb0bf3b2b5e4d0f845e
361c87640a7b7d60e2b8bd83ecd7d0e0
1,300
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int t; cin>>t; int n,a[10000]; while(t--) { cin>>n; int freq[10000]={0}; set<int> s; vector<int> ans; for(int i=0;i<n;i++) { cin>>a[i]; freq[a[i]]++; } ...
C++
ebd4411d03bbce51e2b53064146644d4
0e7edafcf554e011e90922a09ba32e4f
1,900
PASSED
#include <algorithm> #include <cstring> #include <iostream> #include <set> #include <vector> int numCount[1002]; void solve() { int n; std::cin >> n; std::memset(numCount, 0, sizeof(int) * 1001); std::vector<int> Nums; for (int i = 0; i < n; ++i) { int x; std::cin >> x; ...
C++
ebd4411d03bbce51e2b53064146644d4
afcad0af9c0d87084742353bc04f44fa
1,900
PASSED
//#include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> //#include <queue> //#include <stack> #include <cstring> #include <cassert> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
C++
ebd4411d03bbce51e2b53064146644d4
fd6e52360a502153cd0cb14e182bbeb6
1,900
PASSED
#define fi first #define se second #define mp make_pair #define pb push_back #define LOCAL 1 #include<bits/stdc++.h> using namespace std; #ifdef LOCAL #define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n" #define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ #else #define d...
C++
ebd4411d03bbce51e2b53064146644d4
b07b7b846dd6ddc96d08d1a6a8d32c64
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) #define mem(a) memset(a,0,sizeof(a)) int t,n; int a[2005],vis[2005],ans[2005]; int main(){ cin>>t; while(t--){ cin>>n; mem(vis); rep(i,1,n){ cin>>a[i]; vis[a[i]]++; } int sum=0; int end=n; re...
C++
ebd4411d03bbce51e2b53064146644d4
489fb31bd58affadebf8dab227385c21
1,900
PASSED
#include "cstdio" #include "cstdlib" #include "cstring" #include "iostream" #include "queue" #define LL long long using namespace std; const LL inf=0x3f3f3f3f3f3f3f3f; int T; int n; int a[1100]; int cnt[1100]; int k; int x[2100]; bool check() { for (int i = 1; i < n; i++) { if (a[i] > a[i+1]) return false...
C++
ebd4411d03bbce51e2b53064146644d4
bb22aae9c200ba305d553543d49e8c1b
1,900
PASSED
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define full(a) a.begin(),a.end() #define rfull(a) a.rbegin(),a.rend() using namespace std; const double pi=acos(-1.0); const double pii=2*pi; const double eps=1e-6; const long long MOD=1e9+7; int mex(vector<int>& a){ ...
C++
ebd4411d03bbce51e2b53064146644d4
6957d527ee3090760c3214df75b1e121
1,900
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1005; int T,n,x,a[N],b[N],vis[N]; vector<int> ans; int mex(){ memset(b,0,sizeof b); for (int i=0;i<n;i++)b[a[i]]=1; int ans=0; while (b[ans])ans++; return ans; } int check(){ for (int i=0;i<n-1;i++) if (a[i]>a[i+1])return 0; return 1; } int main(){ scan...
C++
ebd4411d03bbce51e2b53064146644d4
e91fb484d4f70e3555f2b9360f09dbc5
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=2e5+9; const int mod=1e9+7; #define PII pair<int,int> #define mk make_pair int n,a[maxn],b[maxn]; int MEX() { for(int i=0;i<=n;i++)b[i]=0; for(int i=0;i<n;i++)b[a[i]]++; for(int i=0;i<=n;i++)if(!b[i])return i; } bool check() { for(int...
C++
ebd4411d03bbce51e2b53064146644d4
cae3bac2048dcdc7b6fb03c93bc78fda
1,900
PASSED
#include<bits/stdc++.h> #define ll long long int #define PI 3.14159265358979 #define zig ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; const unsigned ll N=1e16+7; unsigned ll powr(unsigned ll base, unsigned ll exp) { unsigned ll ans=1; base%=N; if (base==0) ...
C++
ebd4411d03bbce51e2b53064146644d4
54aae26ba78a431088f8515c87a7b14a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; int n, x=0; string a; int main() { cin>>n; while(n!=0) { cin>>a; if(a=="x++" ||a=="++x" ||a=="X++" ||a=="++X") x++; else { x--; } n--; } cout<<x; }
C++
f3cf7726739290b280230b562cac7a74
cc09fa4c5077b36f83153e1cde9130a7
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,t; t=0; string s; cin>>n; for (int i=0;i<n;i++) { cin>>s; if (s=="++X" || s=="X++") { t++; } if(s=="--X" || s=="X--") { t--; } } cou...
C++
f3cf7726739290b280230b562cac7a74
4cc6e78eb2dc4383823986f82ef4b281
800
PASSED
#include<iostream> #include<string> using namespace std; int main() { int n; static int x=0; cin>>n; string s; int i; for(i=0;i<n;i++) { cin>>s; if(s=="X++"||s=="++X") x++; else x--; } cout<<x; }
C++
f3cf7726739290b280230b562cac7a74
ab8146dad882dfadc021430dc6377c34
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,i,x=0; cin>>n; string s; for(i=0; i<n; i++){ cin>>s; if(s[0] == '+' && s[1]=='+' && s[2]=='X'){ x++; } if(s[0] == 'X' && s[1]=='+' && s[2]=='+'){ x++; } if(s[0] == '-' && s[1]=='-' && s[2]=='X'){ x--; } if(s[0]...
C++
f3cf7726739290b280230b562cac7a74
6578023e905d0f7330005ce25b776af3
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,i,x=0; cin>>n; string s; for(i=0; i<n; i++){ cin>>s; if(s[0] == '+' && s[1]=='+' && s[2]=='X'){ x++; } if(s[0] == 'X' && s[1]=='+' && s[2]=='+'){ x++; } if(s[0] == '-' && s[1]=='-' && s[2]=='X'){ x--; } if(s[0]...
C++
f3cf7726739290b280230b562cac7a74
924fd994cf2cb4db95e450abbad1a9bf
800
PASSED
#include<iostream> using namespace std; int main( ) { string b; int n,x=0; cin>>n; while(n--) { cin>>b; if(b[0]=='-'||b[2]=='-') x--; else if(b[0]=='+'||b[2]=='+') x++; } cout<<x; return 0; }
C++
f3cf7726739290b280230b562cac7a74
db8aaea6eaab4b211b7c0c203dcbb4b5
800
PASSED
#include <stdio.h> int main (void) { int num1, value=0, i, j; char str1[4]; scanf("%d", &num1); gets(str1); for(i=0 ; i<num1; i++ ) { gets(str1); for(j=0 ; j<3 ; j++) { if(str1[j]== '+') { value++; break; } else i...
C++
f3cf7726739290b280230b562cac7a74
be78bf164dab2179f96ba669c8c5fab9
800
PASSED
#include <bits/stdc++.h> #include<algorithm> #include<math.h> using namespace std; int main() {int t,i,j,l=0,m=0,n=0,o=0,p,z[1000],s=0,sum=0; char str[1000]; string str1("++X"); string str2("X++"); string str3("--X"); string str4("X--"); cin>>t; p=t; for(i=0;i<t;i++) {cin>>str; for(j=0;j<3;j++) {if(str[j]==str1[j]) l...
C++
f3cf7726739290b280230b562cac7a74
ca8a5d18dd592bca0f6c118813b333bf
800
PASSED
#include <bits/stdc++.h> #include<algorithm> #include<math.h> using namespace std; int main() {int t,i,j,l=0,m=0,n=0,o=0,p,z[1000],s=0,sum=0; char str[1000]; string str1("++X"); string str2("X++"); string str3("--X"); string str4("X--"); cin>>t; p=t; for(i=0;i<t;i++) {cin>>str; for(j=0;j<3;j++) {if(str[j]==str1[j]) l...
C++
f3cf7726739290b280230b562cac7a74
e0b82752c6347b0a0855de236d9e305a
800
PASSED
#include <stdio.h> int main(void) { int n,x=0; scanf("%d",&n); char a,b,c,s; while(n--) { //printf("DAF\n"); scanf(" %c %c %c",&a,&b,&c); if(a=='X') { if(b=='-') x--; else x++; } else { if(a=='-') ...
C++
f3cf7726739290b280230b562cac7a74
d684fead04a84694d34066f16fa8fc32
800
PASSED
import math t=int(input()) for _ in range(0,t): n,k=map(int,input().split(" ")) need=math.floor((k-1)//(n-1)) print(k+need)
Python
7d6f76e24fe9a352beea820ab56f03b6
83641157346168524dfcefc5d55e6430
1,200
PASSED
for i in range(int(input())): a,b=map(int,input().split(" ")) print(b+(b-1)//(a-1))
Python
7d6f76e24fe9a352beea820ab56f03b6
63450139da3c5c9d17bd1c1a7caafa86
1,200
PASSED
for _ in " "*int(input()): n,k=map(int,input().split()) s1=k-1 k+=(s1//(n-1)) print(k)
Python
7d6f76e24fe9a352beea820ab56f03b6
9c0cc6c847b5e5488452cc599dc1d5c4
1,200
PASSED
for _ in " "*int(input()):n,k=map(int,input().split());k+=(k//(n-1));print(k-1+(k%n!=0))
Python
7d6f76e24fe9a352beea820ab56f03b6
3f7398303bc1bc80a852998a545eb019
1,200
PASSED
for _ in " "*int(input()):n,k=map(int,input().split());print(k+(k//(n-1))-1+((k+(k//(n-1)))%n!=0))
Python
7d6f76e24fe9a352beea820ab56f03b6
7e4e1a80e5c304388344a5a15b5a0e63
1,200
PASSED
for _ in " "*int(input()):n,k=map(int,input().split());print((k+(k//(n-1)))if((k+(k//(n-1)))%n)else(k+(k//(n-1))-1))
Python
7d6f76e24fe9a352beea820ab56f03b6
ee97c9bcb77da6aa7ed1d08eb5751323
1,200
PASSED
t=int(input()) for i in range(t): n,k=map(int,input().split()) print((k-1)//(n-1) +k)
Python
7d6f76e24fe9a352beea820ab56f03b6
07420e5dbef391b90c6b421908fb9da7
1,200
PASSED
def check(n,k): div=k//n number=k number1=number+div while (number1//n)!=(number//n): temp=number1 number1+=(number1//n-number//n) number=temp return number1 t=int(input()) i=0 while i<t: arr=list(map(int,input().split())) n=check(arr[0],arr[1]) print(n) i+=1...
Python
7d6f76e24fe9a352beea820ab56f03b6
13cbf5b62a64e7f4d067aabf6c51b910
1,200
PASSED
def check(n,k): div=k//(n-1) rem=k%(n-1) number=div*n+rem if rem==0: number-=1 return number t=int(input()) i=0 while i<t: arr=list(map(int,input().split())) n=check(arr[0],arr[1]) print(n) i+=1
Python
7d6f76e24fe9a352beea820ab56f03b6
ba28c33ae88563c70afe776d9b88fd61
1,200
PASSED
for _ in range(int(input())): n, k = list(map(int, input().split())) num = k // (n - 1) if k % (n - 1) == 0: ans = num * n - 1 else: ans = num * n + k % (n - 1) print(ans)
Python
7d6f76e24fe9a352beea820ab56f03b6
c711e4c4c83d2beec52d9bd5c0f9d7b4
1,200
PASSED
#include<algorithm> #include<cassert> #include<complex> #include<map> #include<iomanip> #include<sstream> #include<queue> #include<set> #include<string> #include<vector> #include<iostream> #include<cstring> #include<cstdio> #define FOR(i, a, b) for(int i =(a); i <=(b); ++i) #define FORD(i, a, b) for(int i = (a); i >= ...
C++
69bfbd43579d74b921c08214cd5c9484
161765d48fa4bdfd0a9c9a2a3ccb83f9
2,300
PASSED
#include <iostream> #include <fstream> #include <vector> #include <memory.h> #include <string> #include <cstring> #include <algorithm> #include <map> #include <set> #include <assert.h> #include <queue> #include <sstream> using namespace std; int n, m, l, r, x, tp; int mTree[800000]; long long sTree[800000]; int a[8000...
C++
69bfbd43579d74b921c08214cd5c9484
5795d44680e8bc5be4985605297dc36b
2,300
PASSED
#include <cstdio> #include <algorithm> using namespace std; typedef long long llint; const int MAXN = 100100, offset = 1 << 17; int n, m; int a[MAXN]; struct tournament { llint data[2*offset]; pair<int,int> mx[2*offset]; llint get (int x, int lo, int hi, int from, int to) { if (lo >= to || hi <...
C++
69bfbd43579d74b921c08214cd5c9484
033727f08a0c9566d629436727d8bc7c
2,300
PASSED
#include <iostream> using namespace std; typedef long long ll; const int Nmax = 1 << 18; int mx[Nmax]; ll sum[Nmax]; inline int max(int x, int y) { return x > y ? x : y; } ll result(int pos, int s, int f, int l, int r); void updatemod(int pos, int s, int f, int l, int r, int x); void update(int s, int k, int x); in...
C++
69bfbd43579d74b921c08214cd5c9484
f7adeda42913a148af9a56e8dd40030b
2,300
PASSED
// به نام خدا #pragma comment(linker,"/STACK:100000000,100000000") #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <cstdlib> #include <math.h> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <iomanip> #...
C++
69bfbd43579d74b921c08214cd5c9484
892c1aa016b8706a70d52ec51b663f6e
2,300
PASSED
// به نام خدا #pragma comment(linker,"/STACK:100000000,100000000") #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <cstdlib> #include <math.h> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <iomanip> #...
C++
69bfbd43579d74b921c08214cd5c9484
b3369d8bc680ce889e41d920e3cfec3f
2,300
PASSED
#include <algorithm> #include <iostream> #include <iomanip> #include <cstring> #include <climits> #include <complex> #include <fstream> #include <cassert> #include <cstdio> #include <bitset> #include <vector> #include <deque> #include <queue> #include <stack> #include <ctime> #include <set> #include <map> #include <cma...
C++
69bfbd43579d74b921c08214cd5c9484
4e8038df44c9183dd0915f3298bcefd9
2,300
PASSED
#include <cstdio> #include <iostream> #include <vector> using namespace std; typedef long long int ll; struct node{ ll l,r,sum,max; //necessito std=c++0x per a construir rapid }; vector<node> segtree; void build(int l, int r, int id){ if(l<=r){ segtree[id]={l,r,0,0}; if(l<r){ int ...
C++
69bfbd43579d74b921c08214cd5c9484
abe5e607d12dd2feae466a889b9a675a
2,300
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <string.h> #include <strings.h> #include <string> #include <algorithm> #include <vector> #include <set> #include <iostream> #include <sstream> #include <iomanip> #include <math.h> #include <cmath> #include <map> #include <list> #include <queue> #include <...
C++
69bfbd43579d74b921c08214cd5c9484
0d49f988725faf09b457d60ce823ec78
2,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; #define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i)) #define rof(i,a,b) for(int (i)=(...
C++
69bfbd43579d74b921c08214cd5c9484
7f26ce03c0a68c1c1948721e92fff3aa
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXn = 1e5 + 5, SQ = 318; int n, m, q, dsu[SQ][MAXn], hp[MAXn], hp2[MAXn]; map<pair<int, int>, int> mp; vector<pair<int, int> > v[MAXn]; vector<int> Big; int getdsu(int a, int b) { if (dsu[b][a] == a) return a; dsu[b][a] = getdsu(dsu[b][a], b); return dsu[b...
C++
ff95750a3f37352d61777c8e0a18f52f
f74532100a54089316ab3eeeab53df1c
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int parent[100005]; int rank[100005]; map<int, int>color[100005]; map<int, int>::iterator utr, vtr; map<pair<int, int>, int>ans; void init() { int i; for(i=1;i<=100000;i++) ::parent[i] = i; } int getpar(int x) { if(::parent[x]==x) return x; else return ::parent[x] ...
C++
ff95750a3f37352d61777c8e0a18f52f
aad3d42284402f2bef259b0befc1929b
2,400
PASSED
#include<bits/stdc++.h> #define push_back emplace_back #define fi first #define se second #define pii pair<int,int> #define mp make_pair using namespace std; const int N=1e5+5; const int SQ=300; int n,m,res[N],q,p[N],qu[N],qv[N]; pii ask[N]; vector<pii>c[N]; vector<int>query[N]; int Find(int x) { if(x==p[x]) ret...
C++
ff95750a3f37352d61777c8e0a18f52f
77710901304067465bbbd317c0d1a05d
2,400
PASSED
#include<iostream> #include<stdio.h> #include<vector> #define pb push_back using namespace std; const int MAXN = 100000; int a[MAXN + 1],t[MAXN + 1],cnt[MAXN + 1],used[MAXN],res[MAXN + 1]; vector< vector<int> > g(MAXN); int dfs(int v) { used[v] = 1; int res = 0; for(size_t i = 0; i < g[v].size(); i++) { int to = ...
C++
9dde408b94853b061e2ab1312b0ad4cc
899d612a9a96c4702a2e8e9ee4bfc03f
2,500
PASSED
#include <iostream> #include <vector> #include <cstring> using namespace std ; const int maxn = 100 * 1000 ; int n , m ; int num[maxn+1] ; bool is[maxn] ; int dp[maxn+1] ; vector <int> v[maxn] ; int dfs (int a) { is[a] = true ; int ans = 1 ; for (int i = 0 ; i < (int)v[a].size() ; ++i) if (!is[v[a][...
C++
9dde408b94853b061e2ab1312b0ad4cc
ac21889f2c62aafc5e41eebef65219c6
2,500
PASSED
#include <iostream> #include <cstdlib> #include <cmath> #include <cstdio> #include <string> #include <ctime> #include <vector> #include <set> #include <queue> #include <algorithm> #include <cassert> #ifdef _WIN32 # define I64 "%I64d" #else # define I64 "%lld" #endif #define fs first #define sc second #define pb push_...
C++
9dde408b94853b061e2ab1312b0ad4cc
b946ea1ea3e037e4abbd5276f020618a
2,500
PASSED
/* Author : RISHAV GOYAL */ #include <bits/stdc++.h> // sherlock holmes using namespace std; #define LL long long int #define UL unsigned long long int #define imax INT_MAX #define imin INT_MIN #define LLmax LLONG_MAX #define LLmin LLONG_MIN #define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++) #define rep(i,n) fo...
C++
9dde408b94853b061e2ab1312b0ad4cc
14c8568fbcbcd92e148d100ea9ea5479
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define TASK "95e" #define input_file TASK".inp" #define output_file TASK".out" #define X first #define Y second #define FOR(i,a,b) for (i=(a);i<=(b);i++) #define FORD(i,a,b) for (i=(a);i>=(b);i--) #define itr(t) vector<t>::iterator #define ritr(t) vector<t>::reverse_it...
C++
9dde408b94853b061e2ab1312b0ad4cc
024b734e81f99b3d0f7dee5c765460d4
2,500
PASSED
#include<stdio.h> #include<string> #include<math.h> #include<stdlib.h> #include<set> #include<bitset> #include<map> #include<vector> #include<string.h> #include<algorithm> #include<iostream> #include<queue> #include<deque> #include<stack> #include<cmath> #include<ctime> #include<complex> #include<list> using namespace ...
C++
9dde408b94853b061e2ab1312b0ad4cc
2e2f177afd308c6b1c3193ecf586f32c
2,500
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <cstdio> #include <string> #include <stack> #include <queue> #include <set> #include <map> #include <string.h> #include <cassert> using namespace std; #define GI ({int t;scanf("%d",&t);t;}) #define FOR(i,a,b) for(int i=a;i<b;i++) #de...
C++
9dde408b94853b061e2ab1312b0ad4cc
e9dfeddd0d6f6fdd3150b14d74e0840a
2,500
PASSED
#include <cstdio> #include <cstring> #include <queue> #include <algorithm> using namespace std; const int MAX_N = 1e5 + 5; const int INF = 1e9 + 7; int F[MAX_N]; int A[MAX_N]; int dp[MAX_N]; int N[MAX_N]; int lucky[1000]; int top, n, num_lucky; void init() { queue <int> mp; while (!mp.empty()) mp.pop(); ...
C++
9dde408b94853b061e2ab1312b0ad4cc
0d1d9ce76d1969145819c40277beb550
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1e5+5; const int inf=1e9; int n,m; int father[maxn],size[maxn]; void reset() { for(int i=1;i<=n;i++) { father[i]=i; size[i]=1; } } int findf(int x) { return father[x]==x?x:father[x]=findf(father[x]); } void join(int a,int b) { int x=findf(a),y=findf...
C++
9dde408b94853b061e2ab1312b0ad4cc
1a5db7212f14f8fdcf684d570b3f3589
2,500
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <cstring> #include <cstdlib> #include <map> #define f first #define s second #define ll long long #define ull unsigned long long #define mp make_pair ...
C++
9dde408b94853b061e2ab1312b0ad4cc
5e36f98ce66f58751ec4fba224315416
2,500
PASSED
#include <iostream> using namespace std; bool checkPalindrom(int n){ int m = n, count = 1; while (m!=0){ count = count * 10; m = m / 10; } count = count /10; m = n; int x; while (m != 0){ x += count * (m % 10); m = m / 10; count = count / 10; } return (x == n); } int a[2000000...
C++
e6e760164882b9e194a17663625be27d
a6a9688e0ce44e3455b814b07e9113c2
1,600
PASSED
#include <iostream> #include <cstdio> using namespace std ; #include <vector> int a[2000003] = {0} ; int rev(int n){ int q,d,r,ret ;ret = 0 ;d = 10 ;q = 1 ; while(n != 0){ r = n%d ;n = n/d ;ret = ret*10 + r ; } return ret ; } void prime(){ a[0] = 1 ;a[1] = 1 ; for(int i = 2;i ...
C++
e6e760164882b9e194a17663625be27d
967bf8de00b19a2be747424c088f2171
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1200000; using namespace std; int sumpri = 0; int sumpal = 0; bool pri[maxn]; bool pal[maxn]; void pre_pri(){ memset(pri,false,sizeof(pri)); for (int i = 2 ; i < maxn; i ++){ if(!pri[i]){ ...
C++
e6e760164882b9e194a17663625be27d
2ce4ec57c4984853ae2d862ccbc967b2
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1500000; using namespace std; bool pri_f[maxn]; int pri[maxn]; int pal[maxn]; void pre_pri(){ memset(pri_f,false,sizeof(pri_f)); memset(pri,0,sizeof(pri)); pri[1] = 0; for (int i = 2 ; i < max...
C++
e6e760164882b9e194a17663625be27d
32c5971e36139b0dc0df1ba3d1f8834b
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1500000; using namespace std; bool pri_f[maxn]; int pri[maxn]; int pal[maxn]; void pre_pri(){ memset(pri_f,false,sizeof(pri_f)); memset(pri,0,sizeof(pri)); pri[1] = 0; for (int i = 2 ; i < max...
C++
e6e760164882b9e194a17663625be27d
a5188bd73f072323fdbf5b4ecf40f76e
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1.5*10e6; using namespace std; bool pri_f[maxn]; int pri[maxn]; int pal[maxn]; void pre_pri(){ memset(pri_f,false,sizeof(pri_f)); memset(pri,0,sizeof(pri)); pri[1] = 0; for (int i = 2 ; i < ma...
C++
e6e760164882b9e194a17663625be27d
92313707317db4a042efe2a3dbe4e10e
1,600
PASSED
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; //freopen("D.in","r",stdi...
C++
e6e760164882b9e194a17663625be27d
d52892214621843b80ab3c48b801be79
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1200000; using namespace std; bool pri_f[maxn]; int pri[maxn]; int pal[maxn]; void pre_pri(){ memset(pri_f,false,sizeof(pri_f)); memset(pri,0,sizeof(pri)); pri[1] = 0; for (int i = 2 ; i < max...
C++
e6e760164882b9e194a17663625be27d
c695b6d2c972326ead342060f7360390
1,600
PASSED
#include <iostream> #include <set> #include <algorithm> #include <cstdio> #include <cstring> const int maxn = 1.2*10e6; using namespace std; bool pri_f[maxn]; int pri[maxn]; int pal[maxn]; void pre_pri(){ memset(pri_f,false,sizeof(pri_f)); memset(pri,0,sizeof(pri)); pri[1] = 0; for (int i = 2 ; i < ma...
C++
e6e760164882b9e194a17663625be27d
87d74aab8161acbc933013eac29df733
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int p,q; int rev(int x) { int ret = 0 ; while(x) { ret*=10; ret+=x%10; x/=10; } return ret; } bool vis[4000000+10]; void init() { vis[1]=1; for(int i=2;i<=4000000;i++) if(!vis[i]) for(int j=i+i;j<=400000...
C++
e6e760164882b9e194a17663625be27d
9f7122e0b5f1034036dfaf8ad6ec7d5b
1,600
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; typedef long long LL; LL vertex[8][3]; void printVertice() { for (int i = 0; i < 8; ++i) { for (int j = 0; j < 3; ++j) { cout << vertex[i][j]; if (j != 2) cout << " "; } cout << endl; } } inline LL sqr(c...
C++
55da4611bc78d55c228d0ce78bd02fd3
7ad939726425c5fb04453bef2101237c
2,000
PASSED
// asdasdasda as dasd #include <bits/stdc++.h> using namespace std; #define REP(a,b,c) for(int a=b;a<c;a++) #define asd(x) cout<<__LINE__<<" :: "<<#x<< ": "<<x<<endl; #define asdf(x, y) cout<<__LINE__<<" :: "<<#x<< ": "<<x<<" | "<<#y<< ": "<<y<<endl; typedef pair<int,int> ii; typedef pair<ii, int...
C++
55da4611bc78d55c228d0ce78bd02fd3
dd03c766a869316ed4253c21c41eb107
2,000
PASSED