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> #include <complex> #define Write freopen("out.txt","w",stdout) #define Read freopen("in.txt","r",stdin) #define si(a) scanf("%d",&a) #define sii(a,b) scanf("%d %d",&a,&b) #define siii(a,b,c) scanf("%d %d %d",&a,&b,&c) #define sl(a) scanf("%lld",&a) #define sll(a...
C++
6fc3da19da8d9ab024cdd5acfc4f4164
48a811839be72367786cd26d9bb45d90
1,300
PASSED
#include<bits/stdc++.h> #include <complex> #define Write freopen("out.txt","w",stdout) #define Read freopen("in.txt","r",stdin) #define si(a) scanf("%d",&a) #define sii(a,b) scanf("%d %d",&a,&b) #define siii(a,b,c) scanf("%d %d %d",&a,&b,&c) #define sl(a) scanf("%lld",&a) #define sll(a...
C++
6fc3da19da8d9ab024cdd5acfc4f4164
026b70c708f9aeb7d714a9675145b2f2
1,300
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> ...
C++
875851f43c7a6e09cd3d20f2a6980d40
c039887e4c61a01271bea6252842bd10
2,200
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> ...
C++
875851f43c7a6e09cd3d20f2a6980d40
547f5b79e9bb01a72894b4800c26f245
2,200
PASSED
#include <iostream> #include <string> #include <stack> #include <map> #include <fstream> #include <vector> #include <list> #include <deque> #include <queue> #include <cmath> #include <set> #include <iomanip> #include <fstream> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <math.h> us...
C++
875851f43c7a6e09cd3d20f2a6980d40
1dbd7d2c281a912b83a26b0bb06468ce
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long int #define FF first #define SS second #define pb push_back #define mp make_pair #define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++) #define all(v) (v).begin(),(v).end() #define sz(x) (ll)...
C++
875851f43c7a6e09cd3d20f2a6980d40
1bf05465556e37e848f14eeec7adcbe9
2,200
PASSED
//In the name of God #include<bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(), x.end() const int N = 1e5 + 5; void solve() { ll m, d, w; cin >> m >> d >> w; if (d == 1) { cout << 0 << '\n'; return; } ll z = (w*(d - 1))/__gcd(w, d - 1); z /= (d - 1); ll ans = 0; ll limit =...
C++
875851f43c7a6e09cd3d20f2a6980d40
adb64607d09d1c68eefa647666f40305
2,200
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #ifdef BOI #include "debug.h" #else #define debug(args...) #endif #define endl '\n' using ll = long long; using namespace std; #define pi 3.14159 in...
C++
875851f43c7a6e09cd3d20f2a6980d40
26ece1cd01c26686099a4b7c5ba5730c
2,200
PASSED
// // main.cpp // 5 // // Created by 李志鹏 on 2020/7/29. // Copyright © 2020 李志鹏. All rights reserved. // #include <iostream> #include <cmath> #include <cstring> #include <vector> #include <queue> #include <map> #include <set> #include <algorithm> using namespace std; long long gcda(long long x, long long y) { ...
C++
875851f43c7a6e09cd3d20f2a6980d40
8c764f44165044c8ec76b5ce2fd3ac05
2,200
PASSED
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); } void solve() { long long ans = 0, m, d, w, lim, step, cn; cin >> m >> d >> w; lim = min(m, d); step = w / gcd(w, d - 1); cn = (lim - 1) / step; ans = lim * cn - cn * (cn + 1) / 2 * s...
C++
875851f43c7a6e09cd3d20f2a6980d40
15edd00e17a40a7f292925ba0c2e3901
2,200
PASSED
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define SAU using #define NAM namespace #define HAI std #define MUOI ; #define IM ; #define NOT ; #define G...
C++
875851f43c7a6e09cd3d20f2a6980d40
07297c272d274955a9f8b1ca5de29b99
2,200
PASSED
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define ll long long #define int long long #define FOR(i, x, y) for(int i = x; i <= y; ++i) #define pb push...
C++
875851f43c7a6e09cd3d20f2a6980d40
ad52401b0337ebff24d245186ee11e33
2,200
PASSED
#include<bits/stdc++.h> using namespace std; int mdeg[505]; int vis[505]; vector<pair<int,int> >edge; int main() { int n; scanf("%d", &n); int lon = 0; int tampon = 0; for (int i = 0; i < n; i++) { scanf("%d", &mdeg[i]); if (mdeg[i] > 1) lon++; if (mdeg[i] > 2) tampon += mdeg[i] - 2; } tampon += 2; int ad...
C++
69ee6170d9f1480647d1a3fed4d1f77b
a5e381c26141ea0851329b66903842b1
1,800
PASSED
#include <bits/stdc++.h> #define openfiles ifstream cin("input.txt"); ofstream cout("output.txt"); #define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define sp << " " << #define endl "\n" #define yes { cout << "YES" << endl; } #define no { cout << "NO" << endl; } #define forn(i, n) for (i...
C++
69ee6170d9f1480647d1a3fed4d1f77b
b51f55c570667ac05ad4a0f84a80baf6
1,800
PASSED
#include <bits/stdc++.h> //#include <ext/numeric> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update #define oo 0x3f3f3f3f #define OO 0x3f3f3f3f3f3f3f3f #define ones(n) __builtin_popcount(n) #define ONES(n) __builtin_popcountll(n) ...
C++
69ee6170d9f1480647d1a3fed4d1f77b
63ab4fcff3cad2280a18148c205eda7a
1,800
PASSED
//Daniel Grzegorzewski #include <bits/stdc++.h> #pragma GCC optimize("O3") #define MP make_pair #define PB push_back #define ST first #define ND second using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_s...
C++
69ee6170d9f1480647d1a3fed4d1f77b
f8b63740a6240fb3bbadac27af0673cd
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,a; cin>>n; int t[n+1]; vector<int> v1; vector<int> vn; int sum = 0; for(int i=1;i<=n;i++){ cin>>a; t[i] = 0; if(a==1) v1.push_back(i); else{ vn.push_back(i); t[i] = a; sum+=a-2; } } sum+=2; if(sum < v1.size()){ cout<<"NO"; re...
C++
69ee6170d9f1480647d1a3fed4d1f77b
bb6283cd55842fe4ffbca91eda194ffb
1,800
PASSED
#include <bits/stdc++.h> namespace myland{ using namespace std; namespace _abbr{ #define fi first #define se second #define pb push_back #define pr make_pair #define lb lower_bound #define ub upper_bound #define str string #define _1s __builtin_pop...
C++
69ee6170d9f1480647d1a3fed4d1f77b
7e980ecff7897cbc38b708ed62815bf7
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int n, m, ans, arr[1010]; vector<int> two, one; void input() { int i, j; cin>>n; for(i=1; i<=n; i++) cin>>arr[i]; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int i, j, temp=0; ...
C++
69ee6170d9f1480647d1a3fed4d1f77b
ba5d4219c88b1827dec6a3565da51129
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define PB push_back #define MP make_pair #define F first #define S second #define M 1000000007 #define vll vector<ll> #define pll pair<ll,ll> #define lb lower_bound #define ub upper_bound #define all(x) (x).begin(),(x).end() int main() { ios_base...
C++
69ee6170d9f1480647d1a3fed4d1f77b
ced7f16a17a3f2ac4780a210edb1dd3e
1,800
PASSED
#include <bits/stdc++.h> #define NMAX 100005 #define INF 0x3f3f3f3f using namespace std; vector<int> G[NMAX]; vector<pair<int,int>> lista1,lista2; vector<pair<int,int>> ans; int lant[NMAX]; int cate[NMAX]; int main() { int i,n,grad,st=1,dr=0,care=0,lg=0; cin>>n; for(i=1;i<=n;++i) { cin>>grad; if(grad>1) lis...
C++
69ee6170d9f1480647d1a3fed4d1f77b
354d2a33e4eeb734d12fc9349cb182ae
1,800
PASSED
#include <bits/stdc++.h> using namespace std; vector<pair<int,int> > ans; int main(){ int n; cin >> n; queue<int> q; queue<int>q1; int asd=0; int ccnt[1000]={}; for(int i=1;i<=n;i++){ int x; cin>>x; ccnt[i]=x; if(x==1)q1.push(i); else q.push(i); if(x==1)asd++; } int check=1; int diameter=min(2,...
C++
69ee6170d9f1480647d1a3fed4d1f77b
4ebc464a65504b784ea7eb7d61951529
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define in1(v1) cin >> v1 #define in2(v1, v2) cin >> v1 >> v2 #define in3(v1, v2, v3) cin >> v1 >> v2 >> v3 #define out1(v1) cout << v1 << "\n" #define out2(v1, v2) cout << v1 << " " << v2 << "\n" #define o...
C++
6be0731d9d2d55bf9aa3492a8161d23c
2fcaecdb28c5f60646640843d02e97ed
1,800
PASSED
//#pragma comment(linker, "/stack:200000000") #include<bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long const LL INF=1LL<<52; const double PI = acos(-1.0); typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vi; typedef vector<LL> vl; typedef vector<pii> vii;...
C++
6be0731d9d2d55bf9aa3492a8161d23c
6f218cd986c582c13f366b8d0db5bfbd
1,800
PASSED
#include <bits/stdc++.h> #define ill int long long #define ld long double #define pb push_back #define fi first #define se second using namespace std; int n,i,j,ans,a[1005],N=1e6+3; vector<int> my,me; bool used[2000006]; int main() { ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); cin>>n; for (i=...
C++
6be0731d9d2d55bf9aa3492a8161d23c
a18d2e0dfe8ccbb4b81a750248752238
1,800
PASSED
/*input 3 2 314 143 */ #include <bits/stdc++.h> using namespace std; const int MAXN = 2e6+10; vector<bool> isPrime(MAXN, true); void sieve() { isPrime[0] = false; isPrime[1] = false; for(int i = 2; i * i < MAXN; i++) { if(isPrime[i]) { for(int j = i*i; j < MAXN; j += i) { isPrime[j] = false; } } ...
C++
6be0731d9d2d55bf9aa3492a8161d23c
425c7cb1eac4c34f0ba232b3e86b74f1
1,800
PASSED
//#include<bits/stdc++.h> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <utility> #include <map> #include <set> #include <iterator> #include <iomanip> #define X first #define Y second using namespace std; typedef long double LD; typedef long long int LL; typed...
C++
6be0731d9d2d55bf9aa3492a8161d23c
9c744d830780ece7820353566cf62f4f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; bool eratostenes[2000010]; int tab[1000001]; int main() { eratostenes[0]=1; eratostenes[1]=1; int n, ile1=0,ile=0,czyp1=0,wp1; int v=0; bool mozliwe=0; cin>>n; for (int i=2;i<2000010;++i){ if (eratostenes[i]==0){ for (int j=...
C++
6be0731d9d2d55bf9aa3492a8161d23c
c57e18925eca4bb3c83b9d8b285f543d
1,800
PASSED
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #d...
C++
6be0731d9d2d55bf9aa3492a8161d23c
81c43b62ac4b9db8cf739b3d1dc97bc5
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int ll mx=1e3+7; ll prime[100000]; vector<ll>isprime(10000000,0); ll sprime(){ //memset(isprime,1,sizeof(isprime)); isprime[1]=1; for(ll i=3; i<=10000000; i+=2){ if(isprime[i]!=1) for(ll j=i; j<=10000000; j+=2*i){ ...
C++
6be0731d9d2d55bf9aa3492a8161d23c
38b415b3fb291d4eb7df7d91022f27b1
1,800
PASSED
#include<bits/stdc++.h> using namespace std; //Policy based Data Structure //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; #define fi(a,b) for(int i=a;i<b;i++) #define fj(a,b) for(int j=a;j<b;j++) #define tc() int t; cin>>t; while(t--) #define ll long long #define ull unsigned long long #def...
C++
6be0731d9d2d55bf9aa3492a8161d23c
43ad9c365c8549cd4067d6416472becf
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int LIM=2000000+5; const int N=1000+5; int n; int v[N]; int f[LIM]; int lp[LIM]; int p[LIM],cnt=0; inline bool isp(int x) { return (lp[x]==x); } vector<int>best(vector<int>a,vector<int>b) { if(a.size()>b.size()) { return a; } else ...
C++
6be0731d9d2d55bf9aa3492a8161d23c
85ce911b4894732351ef2dc62718d606
1,800
PASSED
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int a[26],b[26][26]; char str[30]; int main(int argc, char *argv[]) { int n,i,j,l; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s",str); l=strlen(str); for(j=0;j<l;j++) { a[str[j]-'a...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
e6d53514bd012ab63b94de06efcca66a
1,500
PASSED
#include<iostream> #include<string> #include<cstdio> using namespace std; int main() { string s,a[30]; int n; cin>>n; int i,j,k; int pos; char buff[3] = {0}; for(i=0;i<n;i++) { cin>>a[i]; } for(i=0;i<26;i++) { buff[0] = char('a'+i); for(j=0;j<n;j++) ...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
dea60aee8a856f90a4440433d0035d0a
1,500
PASSED
#include <iostream> #include <string> #include <set> #include <map> #include <vector> #include <stack> #include <queue> #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define LL long long #define cti const int #define ctll const long long #define dg(i) cout << "*" << i <...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
1dd274aa142355dc2990c0c3f47cfe9a
1,500
PASSED
#include <iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; int main() { int n,i=0; char str[30][21]; int alpha[26]={0}; int s2[26][26]={0}; int j=0; scanf("%d",&n); while(i<n) { ...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
527017e6f2e150b6c8acc8e68743dc2b
1,500
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include<set> #include<queue> #include<vector> #include<map> using namespace std; int main() { int n,i,j; set<char>s1; set<string>s2; char a[35][25]; char temp[3]; temp[2]=0; cha...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
25b1bdf51902f775cab01010f00b9164
1,500
PASSED
#include <cstdlib> #include <iostream> #include <vector> #include <fstream> #include <algorithm> #include <string> #include <numeric> using namespace std; #define ll long long const ll MAXN=10000; int n,m; vector<int> g[MAXN]; bool used[MAXN]; vector<vector<int> > comps; vector<int> comp; ll found=0; void dfs (in...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
0cdd9a5e282c576de93e6907d28a51a7
1,500
PASSED
#include <set> #include <map> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <vector> #include <string> #include <cctype> #include <cstdio> #include <iomanip> #include <sstream> #include <cstdlib> #include <cassert> #include <climits> #include <complex> #include <numeric> #include <valarra...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
951c8e2d35171e6cad924d07e68e607e
1,500
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <cstring> #include <set> #include <queue> #include <stack> #define go(i, k, n) for(int i=k; i<n;i++) #define s second #define f first #define pp pair #define ll long long using namespace std; int n,k,sum=0,ind; string...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
ded883b6b17ba372106531d38170b2b8
1,500
PASSED
/*Author : Vineet Kumar */ #include<cstdio> #include<iostream> #include<cstdlib> #include<cmath> #include<cstring> #include<climits> #include<algorithm> #include<vector> #include<set> #include<map> #include<bitset> #include<stack> #include<queue> using namespace std; #define FOR(i,a,b) for(int i= (int )a ; i < (int )...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
5cefa4f83556afbe13e5f25f5564a8bb
1,500
PASSED
#include <bits/stdc++.h> using namespace std; vector<string> pats; int solve(string &rpta) { bool si; while(rpta[rpta.size()-1] != '{') { for(int i = 0 ; i < pats.size() ; ++i) { for(int j = 0 ; j < pats[i].size()-rpta.size()+1 ; ++j) { int cnt=0; si = 1; for(int k = j ; k <...
C++
58fa5c2f270e2c34e8f9671d5ffdb9c8
07000288fc63d3c98d47491e37cf6a41
1,500
PASSED
#include <cstdio> #include <cmath> #include <iostream> #include <set> #include <algorithm> #include <vector> #include <map> #include <cassert> #include <string> #include <cstring> #include <queue> using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define S(x) scanf("%d",&x) #define S2(x,y) scanf("%d%...
C++
6a3d6919435e5ba63bb95cd387a11b06
ce2910f340c247a440ac21e632a40d25
2,200
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <vector> using namespace std; const int N = int(1e5) + 5; vector<pair<int, int> > G[N]; int rot[N]; int vis[N]; void dfs(int u, int fa, int d) { vis[u] = 1; rot[u] = d; for (int i = 0; i < G[u].size(); i++) { int v = G[u][i].firs...
C++
6a3d6919435e5ba63bb95cd387a11b06
238bfde0e9610f4db9f1528a0d68f4f9
2,200
PASSED
#include<iostream> #include<vector> #include<cstring> #include<cstdio> #define ll long long using namespace std; const ll mod=1000000007; struct edge{ int a,b,c; }e[101000]; vector<int>v1[101000],v2[101000]; int f[101000],q[101000],vis[101000]; void bfs(int fa){ int l,r; l=r=0; q[r++]=fa; vis[fa]=1...
C++
6a3d6919435e5ba63bb95cd387a11b06
23848349c4930e84505d81d5b1559431
2,200
PASSED
/************************************************************************* > File Name: C.cpp > Author: wmg_1001 > Mail: wmg_1007@163.com > Created Time: Thu 25 Jun 2015 03:14:35 AM CST ************************************************************************/ #include <iostream> #include <fstream> #i...
C++
6a3d6919435e5ba63bb95cd387a11b06
bf70ec2ecc401af1002533c342a1e63b
2,200
PASSED
//Bismillahir Rahmanir Rahim #include <bits/stdc++.h> using namespace std; vector<long long>adj[1000009],adjj[1000009]; long long color[1000009],flag,ans,ar[1000009],pr[1000009],ap[1000009],dis[1000009]; queue<long long>Q; void BFS(long long s) { while(!Q.empty()) Q.pop(); long long a,d,f,g,h,j,k,l; Q.pus...
C++
6a3d6919435e5ba63bb95cd387a11b06
f672847d28b491901ab9e0496aff90bc
2,200
PASSED
#include <fstream> #include <vector> #include <queue> #define MOD 1000000007 using namespace std; long int n, m; vector<long int> adiacentListL[100002]; vector<long int> adiacentListH[100002]; long int visit[100002], loveGroups, power2; void loveDFS(long int i) { queue<long int> q; q.push(i); visit[i]...
C++
6a3d6919435e5ba63bb95cd387a11b06
65f239097da0e8a71ec8e99c8f323508
2,200
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<vector> using namespace std; typedef long long LL; const int N = 100100; const LL mod = 1000000007; LL quick(LL a, int b) { LL c = 1; while(b) { if(b&1) c = c * a % mod; a = a * a % mod; b >>= 1; } ret...
C++
6a3d6919435e5ba63bb95cd387a11b06
a969e53049f68c5b7612a9b87bb990f0
2,200
PASSED
#include <cstdio> #include <iostream> #include <cstring> #include <vector> #include <algorithm> using namespace std; #define maxn 200020 #define MOD 1000000007 struct Edge{ int v, c; }edges[maxn]; int tot; vector<int>G[maxn]; int n, m; int color[maxn]; void add_edge(int a, int b, int c) { edges[tot].v = b; ed...
C++
6a3d6919435e5ba63bb95cd387a11b06
a26dd9e9444edea5b94fc34645f241c4
2,200
PASSED
#include <algorithm> #include <iomanip> #include <climits> #include <functional> #include <numeric> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cstring> #include <cassert> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <...
C++
6a3d6919435e5ba63bb95cd387a11b06
230aa3dfcd4ed170549c53f4cc194a05
2,200
PASSED
#include <bits/stdc++.h> #define LL long long #define pii pair <int, int> using namespace std; const int N = 100100; int head[N], c[N], tot; struct edge { int v, nx, c; edge () {} edge (int v, int nx, int c) : v (v), nx (nx), c (c) {} } e[N * 2]; void add (int u, int v, int c) { e[tot] = edge (v, he...
C++
6a3d6919435e5ba63bb95cd387a11b06
155122cc7cd821961a86b494892f366a
2,200
PASSED
// Best practice #include<bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // Common file // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // #include <functional> // for less #define int long long #define pb push_back #define pf emplace_...
C++
f942ed9c5e707d12be42d3ab55f39441
52c9826d78421d5ae6880610065de9f8
1,900
PASSED
#include <iostream> #include <vector> /* 7 1 4 4 2 3 2 1 */ int main() { int N; std::cin >> N; std::vector<int> v(N); for(int i = 0 ; i < N; ++i) std::cin >> v[i]; int oo = 10000; std::vector<std::vector<int>> dp(N, std::vector<int> (N, oo)); for(int i = 0; i < N - 1; ++i) { if(v[i] == v[i + 1]) dp[i][i +...
C++
f942ed9c5e707d12be42d3ab55f39441
5aad083c63b0153dfd5b6a111c3c6976
1,900
PASSED
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <ctime> #include <vector> #include <queue> #include <map> #include <set> #include<string> #include<string.h> #include<fstream> #include<stack> #include<iomanip> #include<bitset> #include<stdio.h> #...
C++
f942ed9c5e707d12be42d3ab55f39441
63a51c91059e8e2d2a7a7d2c885886b8
1,900
PASSED
//Apparat : drobucs, aleonov, vit_72 #include <iostream> #include <cmath> #include <vector> #include <map> #include <unordered_map> #include <set> #include <iomanip> #include <algorithm> #include <string> #include <queue> #include <numeric> //#pragma warning(disable : 4996) //#pragma GCC optimize("O3") using namespac...
C++
f942ed9c5e707d12be42d3ab55f39441
2cf55824229fad15caec1b834b683069
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <set> #include <queue> using namespace std; #define maxn (510) int dp[maxn][maxn]; int a[maxn]; int n; int inf; int solve(int l, int r) { if (l > r)return 0; if (dp[l][r] != inf) return dp[l][r]...
C++
f942ed9c5e707d12be42d3ab55f39441
fae6e32944131cc9ae23843ded74f25c
1,900
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int N; cin >> N; vector <vector<int>> matrix(N); vector<int> colour(N); for (int i = 0; i < N; ++i) { cin >> colour[i]; } for (int i = 0; i < N; ++i) { ...
C++
f942ed9c5e707d12be42d3ab55f39441
837b1aaf74dfa8bf369696d6d04c6d2d
1,900
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<ctime> #include<cstdlib> #include<queue> using namespace std; int a[550]; int dp[550][550]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; memset(dp,0x3f,sizeof(dp)); for(int len=1;len<=n;len+...
C++
f942ed9c5e707d12be42d3ab55f39441
20c73d0a99d143e856637834d852c433
1,900
PASSED
#include<iostream> #include<algorithm> using namespace std; #define N 510 int dp[N][N]; int a[N]; int main() { int n; cin>>n; for(int i=0; i<=505; ++i) for(int j=0; j<=505; ++j) dp[i][j] = 999; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { dp[i][i]=1; } for(int...
C++
f942ed9c5e707d12be42d3ab55f39441
622a90dbfc951ddabe5568ce35177cfb
1,900
PASSED
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; #define INF 1e9 typedef long long ll; int arr[505], dp[505][505]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } for (int len = 1; len <= n; len++) { for (int i = 0, j =...
C++
f942ed9c5e707d12be42d3ab55f39441
f526b16c775d1fa68190c5adcd06dd92
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <set> #include <map> #include <queue> #include <string> #include <algorithm> #include <time.h> //#include <math.h> #include <cmath> #include <fstream> #include <deque> #include <unordered_map> #include <unordered_set> #include <stdlib.h> #in...
C++
f942ed9c5e707d12be42d3ab55f39441
f2e156efcb865a0c5a00ed26cd023df8
1,900
PASSED
#include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> #include <set> using namespace std; int a[300002]; set<int> x[300002]; int main() { int n, q; scanf("%d", &n); scanf("%d", &q); int command, info, unreaded = 0, event_n = 0, skip = 0; for (int i = 0; i < q; ++i) ...
C++
a5e724081ad84f88813bb4de23a8230e
63ad9921b3e81b081d295eb30fdacf34
1,600
PASSED
#include <stack> #include <cmath> #include <map> #include <set> #include <queue> #include <math.h> #include <vector> #include <string.h> #include <iostream> #include <stdio.h> #include <cstdio> #include <algorithm> #include <cstdlib> #include <iostream> #include <string> using namespace std; typedef long long ll; co...
C++
a5e724081ad84f88813bb4de23a8230e
57ee0e2d7e4f6f325ec29021cf5836c9
1,600
PASSED
#include <set> #include <map> #include <stack> #include <queue> #include <cmath> #include <cstdio> #include <vector> #include <bitset> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define...
C++
a5e724081ad84f88813bb4de23a8230e
89d2188fbf9fb0b7528b6ab0021b3048
1,600
PASSED
#include <set> #include <map> #include <stack> #include <queue> #include <cmath> #include <cstdio> #include <vector> #include <bitset> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define...
C++
a5e724081ad84f88813bb4de23a8230e
a2f15adf22e7d7542ab4aa78dc9d554e
1,600
PASSED
#include<iostream> #include<stdio.h> #include<algorithm> #include<vector> #include<math.h> #include<string> #include<sstream> #include<set> #include<map> #include<stack> #include<queue> #include<deque> #include<memory.h> #include<ctime> #include<cassert> #include<limits.h> #include<unordered_map> #include<unordered_set...
C++
a5e724081ad84f88813bb4de23a8230e
da0e0979685699fec5b0518105dba0b8
1,600
PASSED
#include<iostream> #include<stdio.h> #include<algorithm> #include<vector> #include<math.h> #include<string> #include<sstream> #include<set> #include<map> #include<stack> #include<queue> #include<deque> #include<memory.h> #include<ctime> #include<cassert> #include<limits.h> #include<unordered_map> #include<unordered_set...
C++
a5e724081ad84f88813bb4de23a8230e
dbb553306ac23313777949f8ee7415dd
1,600
PASSED
#include <iostream> #include <vector> #include <map> #include <string> #include <algorithm> #include <memory.h> #include <cmath> #include <math.h> #include <string> #include <set> #include <sstream> #include <queue> #include <ctype.h> using namespace std; typedef long long ll; #define _CRT_SECURE_NO_WARNINGS int ma...
C++
a5e724081ad84f88813bb4de23a8230e
0dd8bedecd760a6042ebb3eb87424f55
1,600
PASSED
#include <iostream> #include <algorithm> #include <string.h> #include <string> #include <vector> #include <cmath> #include <queue> using namespace std; struct G { int num, X; G(int _num, int _X) { num = _num; X = _X; } }; vector <queue <int> > type(300010); queue <G> St; int main() { int n, m; scanf("%d %d", ...
C++
a5e724081ad84f88813bb4de23a8230e
cf43654e4003772ba73995f1410a3db0
1,600
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; typedef long long int ll; const int maxn = 100005; int cen[maxn*3]={0}; vector <int> a[maxn*5]; int main() { //freopen("in.txt","r",stdin); int n,q,t,e; scanf("%d %d",&n,&q); int sum = 0; int floo=0...
C++
a5e724081ad84f88813bb4de23a8230e
dc5cf90db503786dc817d14bb7374694
1,600
PASSED
#define TASK "fire" #define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/STACK:66777216") #include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <ctime> #include <map> #include <set> #include <string> #include <queue> #include <deque> #include <cassert> #include <cstdlib> #include <bits...
C++
a5e724081ad84f88813bb4de23a8230e
18e86f55c1f343b0fe42277ddee826e0
1,600
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int len = 1; int prev = sc.nextInt(); int max =...
Java
3b725f11009768904514d87e2c7714ee
2f673ecd32c98f7ab63d4e9427874497
1,700
PASSED
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Stack; public class C { static long totalDay = 0; static int k; public static void main(String[] args) { S...
Java
3b725f11009768904514d87e2c7714ee
5758f37f288bbb6861a452c46d04fe13
1,700
PASSED
import java.io.*; import java.util.*; public class C implements Runnable{ public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();} public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println("Go!"); int n = fs...
Java
3b725f11009768904514d87e2c7714ee
37148f8a4276b3d28e37097b189cf012
1,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
3b725f11009768904514d87e2c7714ee
90a8b795f79321c5079e20b86d840411
1,700
PASSED
import java.util.*; import java.util.stream.*; import java.io.*; import java.math.*; public class Main { static boolean FROM_FILE = false; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { if (FROM_FILE) { t...
Java
3b725f11009768904514d87e2c7714ee
d7562338fbe0a9523809ccb5f502b56b
1,700
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
3b725f11009768904514d87e2c7714ee
e0de4f445aa80ea75edab8db77221dba
1,700
PASSED
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.Scanner; import java.util.StringTokenizer; pub...
Java
3b725f11009768904514d87e2c7714ee
aa4e1ec694edbe6735b3cb384146b706
1,700
PASSED
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int y=0; int last = 0; int ans = 1; int max = Integer.MIN_VALUE; int[] data = new int[200000]; for(int i=0;i<n;i++){ int t = scanner.nextInt(...
Java
3b725f11009768904514d87e2c7714ee
012f81fd3d3ce3161dd51e292fde6a91
1,700
PASSED
import java.io.*; import java.util.*; public class CFC { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; privat...
Java
3b725f11009768904514d87e2c7714ee
5b53f3bfe379acceff67444f6d27a483
1,700
PASSED
import java.util.*; import java.io.*; import static java.lang.Math.abs; public class Main { static class Reader { BufferedReader in; Reader() throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); } Reader(String name) throws IOException { ...
Java
3b725f11009768904514d87e2c7714ee
6645bcf96cf5e19a682e0ee49aa13495
1,700
PASSED
#include<bits/stdc++.h> #define ll int #define pii pair<int,int > #define pll pair<long long ,long long > #define pbb pair<bool,bool> #define plll pair<long long,pair<long long ,long long > > #define sefi second.first #define sese second.second #define fi first #define se second #define ld long double #define pb pus...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
be5e74e07552707f59468e497faea52c
2,000
PASSED
// DANG's code // // LOVEPAL3000 // //#pragma 03 //#pragma GCC optimize("Os") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("O3") //#pragma GCC target("avx") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") //#include <boost/multiprecision/cpp_int.hpp> //using boost::multipr...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
0b766b2c4fc19e61d777c3aecf21f82f
2,000
PASSED
// DANG's code // // LOVEPAL3000 // //#pragma 03 //#pragma GCC optimize("Os") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("O3") //#pragma GCC target("avx") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") //#include <boost/multiprecision/cpp_int.hpp> //using boost::multipr...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
5a91b2b629c55f8954a20db956e4bb90
2,000
PASSED
#include <iostream> using namespace std; const int inf=64000000, maxn=1001; int a[maxn][maxn], dp[2][maxn][maxn]; char p[2*maxn]; bool mark[2][maxn][maxn]; int rec(bool q ,int x , int y) { int c=((q) ? 2 : 5); if(x < 0 || y < 0) return inf; if(mark[q][x][y]) return dp[q][x][y]; int s...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
e453c08ce01f6e65a9ce3c2a87659572
2,000
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1000+10; int n,kk,q,p; int A[N][N]; int dp1[N][N]; int dp2[N][N]; bool sefr=0; void bro(int x,int y,int p,int q) { while (x!=p) printf("D"),x++; while (y!=q) printf("R"),y++; } void bro2(int A[N][N],int x,int y) { if(x==1 && y==1) return; if (A[x-1][y]<A...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
5896137e9ceb6ce6a64d5bece3940492
2,000
PASSED
#include <algorithm> #include <iostream> #include <string> #include <vector> int num_p(int n, int p) { int ret = 0; while (n % p == 0) { ++ret; n /= p; } return ret; } struct E { int n; char p; }; std::string encode_path(const std::vector<std::vector<E>>& t) { std::string ret; int i = t.size(...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
48a96b4a70ce9a622392741063cfa7a5
2,000
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll mod= 1e9+7; int dp[1001][1001][2], p[1001][1001][2]; void prin(int x,int y, int l) { if(x==1&&y==1) return; if(p[x][y][l]==2) { prin(x-1,y,l); cout << 'D'; } else { prin(x,y-1,l); cout << 'R'; } } int main( ) { int n;...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
4f3250f9474ac36a3655772c273e9562
2,000
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll mod= 1e9+7; int main( ) { int n; cin>>n; int t[n+1][n+1][2]; int flag=-1; for(int i=1;i<=n;++i) { for(int j=1;j<=n;++j) { int k;cin>>k; ...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
8cae4b1f4fa146979c2d1bc7ded26351
2,000
PASSED
#include<iostream> using namespace std; const int m=0x3fffffff; int n,i,j,l,f[1001][1001][2]={0},k,x; char g[1001][1001][2]={0}; int prin(int x,int y) { if(x==1&&y==1) return 0; if(g[x][y][l]) { prin(x-1,y); cout << 'D'; } else { ...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
e3e2b233f3b617b56043d3b0f3312928
2,000
PASSED
#include<bits/stdc++.h> #include<time.h> #include<stdlib.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse4") #define pb push_back #define mp make_pair #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pll pair<ll,ll> #define vll ve...
C++
13c58291ab9cf7ad1b8c466c3e36aacf
ac73b66c0f19ad4c493e94e8d0f87ac7
2,000
PASSED
#include <iostream> #include <bits/stdc++.h> #define f first #define s second #define ll long long using namespace std; string s; string s1[1003]; int n; int main() { cin>>s; cin>>n; for(int i = 0; i < s.size(); i++) { if('A' <= s[i] && s[i] <= 'Z') { s[i] = char((s[i] - 'A') + 'a'); } if(s[i] == '0...
C++
0d70984ab8bd7aecd68c653adf54fc08
24dafdeacb1a11c759a547ee54e18f00
1,200
PASSED
#include<bits/stdc++.h> using namespace std; long long a[1000001],n,m=INT_MAX,b[1000001],c,k1,c1,r,l,x,m1=INT_MAX,p1,p,k,t,tx1=-1,ty1=-1,tx2=-1,ty2=-1,a1,b1,y,mid,mx=INT_MIN; //double qx; string s,s1,s2; char q; //char q[11][11]; //set <char> w,e; bool u[1000001]; map <long long,long long > mp; int main() { ios_bas...
C++
0d70984ab8bd7aecd68c653adf54fc08
b0b3a9ed6beb0e7194d513b992d0b304
1,200
PASSED
#include <iostream> #include <algorithm> #include <string> void process_login(std::string & login) { std::transform(login.begin(), login.end(), login.begin(), ::tolower); std::replace(login.begin(), login.end(), 'o', '0'); std::replace(login.begin(), login.end(), 'l', '1'); std::replace(login.begin(),...
C++
0d70984ab8bd7aecd68c653adf54fc08
6f6c8b16704b86c9553e0c7b29949f8d
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string ss , s; int n, count = 0 , ans = 0; cin >> ss >> n; for(int i = 0 ; i < n ; i ++){ cin >> s; for(int j = 0 ; j < s.size() ; j ++){ if(ss[j] == s[j] || ss[j] == s[j] - 'a' + 'A' || s[j] == ss[j] - 'a' + 'A' || s[j] == 'o' && ss[j] == '0' || ss[...
C++
0d70984ab8bd7aecd68c653adf54fc08
474537f3d2ac5943528e5dfc77811733
1,200
PASSED
//CODEFORCES #include <bits/stdc++.h> typedef long long ll; using namespace std; string mainLogin; vector<string> existLogins; int n; void inp () { cin >> mainLogin; cin >> n; existLogins.resize(n); for (int i = 0; i < n; i++) { cin >> existLogins[i]; } } bool check (const string &toCheck) { if (to...
C++
0d70984ab8bd7aecd68c653adf54fc08
6ccedf2baf6c1a79b635f84f206a3eb1
1,200
PASSED
#include<bits/stdc++.h> using namespace std; string s,t; int n; bool check, res; int main() { cin >> s >> n; for(int i = 0; i < s.size(); i++) if(islower(s[i])) s[i] -= 32; res = false; for(int i = 0; i < n; i++) { cin >> t; check = false; if(t.size() != s.size()) ...
C++
0d70984ab8bd7aecd68c653adf54fc08
2d8132d0786e5975c237a5e5f66ca5ee
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { string s, t, str_templ_1 = "1lLiI", str_templ_2 = "0Oo"; int n, leng, i; bool f; cin >> s >> n; leng = s.length(); for (int j = 0; j < n; j++) { cin >> t; if (t.length() == leng) { i = 0; f = true; ...
C++
0d70984ab8bd7aecd68c653adf54fc08
aa404778ed642c6aa9026b43c79c2838
1,200
PASSED
#include <string> #include <iostream> #include <vector> using namespace std; string s,tmp; long long n,h; bool piz; int main() { cin >> s >> n; h=s.size(); for (int i=0;i<h;++i) { s[i]=tolower(s[i]); if (s[i]=='0') { s[i]='o'; } if (s[i]=='l' || s[i]=='i') { ...
C++
0d70984ab8bd7aecd68c653adf54fc08
8299b9f6200348c1a7d1d85506dbb6b4
1,200
PASSED