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; int main() { int n; cin >> n; vector<int> p(n), deg(n); for (int i = 1; i < n; i++) { cin >> p[i]; p[i]--; deg[p[i]]++; } vector<int> sons_leaves(n); for (int i = 0; i < n; i++) { if (deg[i] == 0) { sons_leaves[p[i]]++; } } for ...
C++
69edc72ec29d4dd56751b281085c3591
749b89daba520afbc851f593bf1ac051
1,200
PASSED
#include <iostream> #include <cmath> #include <cstdio> #include <vector> #include <string> #include <sstream> #include <iomanip> #include <stack> #include <fstream> #include <algorithm> #include <set> #include <iterator> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define ll long ...
C++
69edc72ec29d4dd56751b281085c3591
574d187e3f01dbba04dee867fd9fd957
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,aux,nact; cin>>n; vector<vector<int> >ady(n+1); vector<int>tam(n+1,0); vector<int>ver(n+1,true); for(int i=2;i<n+1;i++){ cin>>aux; ady[aux].push_back(i); } queue<int>bfs; bfs.push(1); ver[1]=false; while(!bfs.empty()){ nact=bfs.front(); ...
C++
69edc72ec29d4dd56751b281085c3591
0023b9b8faa7c94fec4f56be78217c00
1,200
PASSED
#include <iostream> #include <iomanip> #include <map> #include <numeric> #include <set> #include <string> #include <queue> #include <unordered_map> #include <unordered_set> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<int> v; vector<int> z; v.push_back(0); z.push_back...
C++
69edc72ec29d4dd56751b281085c3591
f089352a212f56c84685b1d53dc4a949
1,200
PASSED
#include<bits/stdc++.h> using namespace std; //first bfs to solve in my life 555 int const N=1e3+5, M=1e7+5, OO = 0x3f3f3f3f; int n,m,u,v,comp; int cyc; bool f; vector <int> adj[N],ans; vector <int> path; bool isBi=1; bool vis[N], col[N],stc[N]; queue<int> q; vector<int> d(N), p(N),lch(N); void BFS(int s){ q.push(s); v...
C++
69edc72ec29d4dd56751b281085c3591
a2e9f6ebb990c2f77776459ccc9a3c4d
1,200
PASSED
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=(a); i<(b); i++) using namespace std; int main() { int n; cin >> n; map<int,vector<int>> modes; rep(i,2,n+1) { int k; cin >> k; modes[k].push_back(i); } string ans="YES"; rep(i,1,n+1) { int childr...
C++
69edc72ec29d4dd56751b281085c3591
c5f9bdb5e89637795b7dcc6eb64c2c3e
1,200
PASSED
// Sue Martinez #include<bits/stdc++.h> #define eps 1e-8 #define ll long long #define ed cout<<endl #define pb push_back #define pf push_front #define mp make_pair #define fi first #define ll long long #define se second #define inf 2e9 #define forn(i, n) for (int i = 0; i < int(n); i++) #define sz 1456789 #define all(x...
C++
69edc72ec29d4dd56751b281085c3591
eb2d27f43b1aa518a9ea621c9f3e4d63
1,200
PASSED
#include <iostream> using namespace std; int main () { int n, p[1005], count[1005] = {0}, check = 1; //count:點被連接的數量 cin >> n; for (int i = 2;i <= n;i++) { cin >> p[i]; count[p[i]]++; } for (int i = 2;i <= n;i++) { if (count[i] > 0) { count[p[i]]--; if (count[p[i]] < 3) { check = 0;...
C++
69edc72ec29d4dd56751b281085c3591
b09182fbc3f10acacde8955a113884c4
1,200
PASSED
#include <iostream> using namespace std; int main () { int n, p[1005], max = 0, count[1005] = {0}; cin >> n; for (int i = 2;i <= n;i++) { cin >> p[i]; count[p[i]]++; // if (p[i] > max) max = p[i]; } // // do // { // for (int i = 0;i < n;i++) // { // if (p[i] == max) // { // // } // } // }while(...
C++
69edc72ec29d4dd56751b281085c3591
e0d4047502bd2c0994992636c5e24973
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int n,q; vector<int> colors, first, last, euler_tour; vector<bool> visit; vector<vector<int> >ady; void tour(int x) { if (visit[x]) return; visit[x]= true; euler_tour.push_back(x); first[x] = euler_tour.size() - 1; for (int i : ady[x]) { ...
C++
5000fe8464139a4235ab6e51e5240e43
3416a7be4db5b156ec1d32c26a0cb770
2,100
PASSED
#include<bits/stdc++.h> #define pb push_back #define fr first #define sc second #define all(x) x.begin(), x.end() #define skip continue #define NAME "code" using namespace std; typedef long long ll; typedef long double ld; void faster(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);...
C++
5000fe8464139a4235ab6e51e5240e43
815320c50d3579483df8728186a48fed
2,100
PASSED
//bayemirov #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; #define pb push_back const int N = 5e6; vector<int> adj[N]; int tin[N], tout[N], timer = 1, c[N], a[N], n, m; l...
C++
5000fe8464139a4235ab6e51e5240e43
be541de2d95197bcdd06ab7d08ea45a7
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define md (st + nd) >> 1 #define lc (idx << 1) + 1 #define rc (idx << 1) + 2 const int N = 400005; vector <int> v[N]; long long tree[4*N]; bool lazy[4*N]; int c, a[N], l, r, bgn[N], sze[N], cnt, b[N]; void build(int idx, int st, int nd) { if (st == nd) { tree[idx] =...
C++
5000fe8464139a4235ab6e51e5240e43
164ff41f6edd50632c972eb695dc29d3
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define md (st + nd) >> 1 #define lc (idx << 1) + 1 #define rc (idx << 1) + 2 const int N = 400005; vector <int> v[N]; bitset <60> tree[4*N]; bool lazy[4*N]; int c, a[N], l, r, bgn[N], sze[N], cnt, b[N]; void build(int idx, int st, int nd) { if (st == nd) { tree[idx]...
C++
5000fe8464139a4235ab6e51e5240e43
2e83b93a156072458fb4cd5b4ba3253a
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; vector<vector<int>> adj; vector<int> v; vector<int> st, en; struct Segment{ vector<ll> tr; vector<ll> lz; int n; Segment() = default; Segment(int _n){ n = _n; tr.resize(4 * n); lz.resize(4 * n); for(auto & e : lz)e =...
C++
5000fe8464139a4235ab6e51e5240e43
a0f37118876da52eb2016852c559feef
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define lowbit(x) (x & (-x)) #define ffor(i,d,u) for(int i=(d);i<=(u);++i) #define _ffor(i,u,d) for(int i=(u);i>=(d);--i) #define INF 0x3f3f3f3f #define mst(arrary, count, kind, num) memset(arrary, num, sizeof(kind) * (count)) const ll LLINF = 0x3f3f3f3f...
C++
5000fe8464139a4235ab6e51e5240e43
3a35152a57dd811be96cfcc5e458b385
2,100
PASSED
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <cmath> #include <stack> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; #define all(a) a.begin(),a.end() #define pb push_back #define mp make_pair const int N...
C++
5000fe8464139a4235ab6e51e5240e43
a4da384c115b88ecd8b42d5d26748b47
2,100
PASSED
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <cmath> #include <stack> #include <vector> #include <bitset> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; #define all(a) a.begin(),a.end() #define pb push_back #define mp mak...
C++
5000fe8464139a4235ab6e51e5240e43
eaae14c0a3bfc950edd41d7609104f3c
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long vector <ll> euler; ll timer; vector <ll> adj[400005]; ll c[400005]; bool b[400005]; ll first[400005]; ll last[400005]; ll add[3200005]; ll seg[3200005]; void dfs(ll x) { b[x] = true; euler.push_back(x); first[x] = timer++; vector <ll> :: ...
C++
5000fe8464139a4235ab6e51e5240e43
40cf6e98cd0d52e6d8c37aff202fa0e3
2,100
PASSED
#include <iostream> #include <string> #include <map> #include <math.h> #include <vector> #include <algorithm> #include <cstdio> #include <set> #include <queue> #include <sstream> using namespace std; #define sqr(x) ((x)*(x)) #define PB(a) push_back(a) #define MP(a) make_pair(a) #define ll long long int gcd(int a, ...
C++
ce58d35343d66b962fb23b9963783acf
8dc73d86af0b90a72918c4bdea58b31d
2,100
PASSED
#include<iostream> #include<vector> #include<queue> #include<map> using namespace std; #define mx 100005 int ar[mx]; map<int, int> tree[4*mx]; void init(int x, int a, int b){ for(int i=a;i<=b;++i) tree[x][ar[i]]++; if(a!=b){ init(2*x,a,(a+b)/2); init(2*x+1,(a+b)/2+1,b); } } int q...
C++
ce58d35343d66b962fb23b9963783acf
9eb31e10c66bf156f1227fd0488d920d
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> using namespace std; typedef pair<int,int> pii; #define fi first #define se second #define mp make_pair #define pb push_back const int N = 100005; int n, m, now, nn; int anc[N][18], d[N], first[N], last...
C++
ce58d35343d66b962fb23b9963783acf
a9fe7e99b5b6f35783d6a6fce57c812f
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> using namespace std; typedef pair<int,int> pii; #define fi first #define se second #define mp make_pair #define pb push_back const int N = 100005; int n, m, now, nn; int anc[N][18], d[N], first[N], last...
C++
ce58d35343d66b962fb23b9963783acf
18c9ba640c5a49e7e3a0444aef3362d5
2,100
PASSED
#include<iostream> #include <string> #include <algorithm> #include <cmath> #include <iomanip> #include <map> #include <queue> #include<set> #include<stack> #include<cstdio> #include <unordered_map> #define PI 3.14159265 using namespace std; vector<int> node[100001]; int timestamp; int height[100001]; int dfsorder[110...
C++
ce58d35343d66b962fb23b9963783acf
b5f59d67417a9954416d31391eef9822
2,100
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <sstream> #include <utility> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <bitset> #include <algorithm> #include <cstdio> #include <cstdlib> #i...
C++
ce58d35343d66b962fb23b9963783acf
e0c6e597bc2cc95632f18dc77182f729
2,100
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <sstream> #include <utility> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <bitset> #include <algorithm> #include <cstdio> #include <cstdlib> #i...
C++
ce58d35343d66b962fb23b9963783acf
8eb4301f4c5582885b663b4bb77bcae5
2,100
PASSED
#include <cstdlib> #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <deque> #include <stack> #include <queue> #include <set> #include <map> #include <bitset> #include <ite...
C++
ce58d35343d66b962fb23b9963783acf
0b875c6363ae8b88b0e9e9c8fb05df1b
2,100
PASSED
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> #include<cmath> #include<queue> #include<vector> #include<stack> #include<map> #include<set> #include<algorithm> #define MOD 1000000007 #define LL __int64 #define mem(a,b) memset(a,b,sizeof(a)) #define MAX 100010 using namespace st...
C++
ce58d35343d66b962fb23b9963783acf
80f3f53d499be5424a3a3b2be9f590c9
2,100
PASSED
#define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> #include <vector> #include <algorithm> #include <stdlib.h> #include <ctime> #include <set> #include <map> #include <queue> #include <string> #include <math.h> #include <queue> #include <memory.h> #include <iostream> #include <stack> #include <complex> #include <list> ...
C++
ce58d35343d66b962fb23b9963783acf
eaf312def126995f58984320743f8c8b
2,100
PASSED
#pragma comment(linker, "/STACK:60000000") #include <iostream> #include <stdio.h> #include <limits.h> #include <float.h> #include <math.h> #include <algorithm> #include <cstdlib> #include <memory.h> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <time.h> #include <string.h> ...
C++
8d911f79dde31f2c6f62e73b925e6996
1d09197c96fec0e9342663b68b104a34
900
PASSED
//In the name of God #include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAXN=2100; vector <int> a[MAXN],p; int mark[MAXN],ans=0; void dfs(int x,int y) { mark[x]=y++; for(int i=0;i<a[x].size();i++) { int p=a[x][i]; if(mark[p]==0) dfs(p,y); } } int main()...
C++
8d911f79dde31f2c6f62e73b925e6996
77b989306858d9b6cf65091baafdb3cf
900
PASSED
//In the name of God #include <iostream> #include <cstdlib> #include <algorithm> #include <vector> #include <set> #include <map> using namespace std; #define mp make_pair #define lol long long const int MAXN=2010; vector <int> g[MAXN]; bool mark[MAXN]; int dist[MAXN]; int dfs(int v) { int ans=1; mark[v]=true; f...
C++
8d911f79dde31f2c6f62e73b925e6996
4a03c92a47382f870c70cfa45c43531d
900
PASSED
// http://www.codeforces.com/problemset/problem/116/C // TODO: This solution exceeds time limit on test 39 #include <iostream> #include <vector> #include <stack> using namespace std; int dfs(int m[2000], int i, int size) { int r = 0; stack<int> s; s.push(i); while (!s.empty()) { int i = s.top(); ...
C++
8d911f79dde31f2c6f62e73b925e6996
1edb5b0cd9ba2e50cfb1561bdd16b3f1
900
PASSED
#include <bits/stdc++.h> template<typename T> T gcd(T a, T b) { if(!b) return a; return gcd(b, a % b); } template<typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; ...
C++
8d911f79dde31f2c6f62e73b925e6996
f9808a0da556cec50902bb47b0aa970c
900
PASSED
#include <cstdio> #include <vector> #include <algorithm> #include <stack> using namespace std; int m = 1; void dfs( vector< int > graph[], bool deg[], int N ) { int i, j; bool visited[ N + 1 ]; int dist[ N + 1 ]; for ( i = 0; i <= N; ++i ) { visited[ i ] = false; dist[ i ] = 1; } stack< int > s; for ( i =...
C++
8d911f79dde31f2c6f62e73b925e6996
1549e4508772bb9acb7bbf8a2d14b05a
900
PASSED
#include <cstdio> #include <vector> #include <cstdio> #include <vector> #include <algorithm> #include <stack> using namespace std; int dist[ 1000001 ]; bool visited[ 1000001 ]; void dfs( vector< int > graph[], int u ) { visited[ u ] = true; if ( dist[ u ] > 0 ) { return; } int max = 0, i; for ( i = 0; i < gra...
C++
8d911f79dde31f2c6f62e73b925e6996
d2a651d10ce8754d7278d36fa3bcb0eb
900
PASSED
#include<cstdio> #include<iostream> #include<cstring> #include<map> #include<vector> #include<set> using namespace std; int main() { int t,i,j,k,a=0,b[2007][2]={0},flag[2007],max=1,n; scanf("%d",&n); for(i=1;i<=n;i++) {scanf("%d",&j); if(j==-1)b[i][1]=1; else {b[i][0]=j;} ...
C++
8d911f79dde31f2c6f62e73b925e6996
d910ae008f941b659cdb7e6febbaae73
900
PASSED
#include<set> #include<cmath> #include<vector> #include<string> #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int sum(0); int a[2005],num[2005]; int dfs(int n) { if (a[n]!=-1) if (num[n]==1) {num[n]+=dfs(a[n]);} else return num[n...
C++
8d911f79dde31f2c6f62e73b925e6996
747b93a6180bd98deaa2a90603bbab34
900
PASSED
#include<set> #include<cmath> #include<vector> #include<string> #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int sum(0); int a[2005]; int dfs(int n) { if (a[n]!=-1) {sum++; dfs(a[n]);} else return 0; } int main() { int n; while...
C++
8d911f79dde31f2c6f62e73b925e6996
50d74e5d3fc8ba95b3f77a3a7ca78f47
900
PASSED
using namespace std; #include<bits/stdc++.h> #define ll long long #define pb push_back #define MOD 1000000007 #define MAX 1000000 #define mp make_pair #define pii pair<int,int> #define vpii vector<pii> #define vi vector<int> #define vvi vector<vi> #define vll vector<ll> #define si set<int> #define all(s) s.begin(),s.en...
C++
11057f672524244f893493bc10218cbf
d37d21909a9c0f39e52cf49614ff7946
1,500
PASSED
using namespace std; #include<bits/stdc++.h> #define ll long long #define pb push_back #define MOD 1000000007 #define MAX 1000000 #define mp make_pair #define pii pair<int,int> #define vpii vector<pii> #define vi vector<int> #define vvi vector<vi> #define vll vector<ll> #define si set<int> #define all(s) s.begin(),s.en...
C++
11057f672524244f893493bc10218cbf
99415f20f0b88c2bc38430b5d1545cea
1,500
PASSED
#include <stdio.h> #include <set> using namespace std; set<int> hor,ver; multiset<int> hc,vc; int main() { int w,h,n; scanf ("%d %d %d",&w,&h,&n); ver.insert(0); ver.insert(w); vc.insert(w); hor.insert(0); hor.insert(h); hc.insert(h); while (n--){ char s[3]; int x; scanf ("%s %...
C++
11057f672524244f893493bc10218cbf
cbe8e5497c4b131bec8a876d9bb440a6
1,500
PASSED
#include<stdio.h> #include<iostream> #include<cstring> #include<algorithm> #include<vector> #include<string> #include<iomanip> #include<functional> #include<stack> #include<set> #include<map> #include<queue> using namespace std; multiset<int> wLength, hLength; set<int> xPoint, yPoint; int main() { #ifdef _CONSOLE ...
C++
11057f672524244f893493bc10218cbf
107be7b13e659f040cead50ebaf8a503
1,500
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<cstdio> #include<string.h> #include<map> using namespace std; long long ans[200010],arr[200010][2]; map<long long,long long> nxh,nxv,prh,prv; vector<long long> vech,vecv; int main(){ long long w,h,n; scanf("%I64d %I64d %I64d",&h,&w,&n); //pri...
C++
11057f672524244f893493bc10218cbf
7116c97767e1b9fc03bd91a2eb1f3ea6
1,500
PASSED
#include <iostream> #include <cmath> #include <set> #include <vector> using namespace std; #define MAXN 1010 long long llmax(long long a, long long b){ return a > b ? a : b; } int main() { set<int> hs, ws; int w, h, n; cin >> w >> h >> n; hs.insert(0); hs.insert(h); ws.insert(0); ws.insert(w...
C++
11057f672524244f893493bc10218cbf
c9bd62f87e604ca31a2e10285c1b4e52
1,500
PASSED
#include <iostream> #include <cmath> #include <set> #include <vector> using namespace std; #define MAXN 1010 long long llmax(long long a, long long b){ return a > b ? a : b; } int main() { ios_base::sync_with_stdio(false); set<int> hs, ws; int w, h, n; cin >> w >> h >> n; hs.insert(0); hs.in...
C++
11057f672524244f893493bc10218cbf
5b42c9fb4a76c15fcf7d0a17fc7a65c7
1,500
PASSED
#include <iostream> #include <cmath> #include <set> #include <vector> using namespace std; #define MAXN 1010 long long llmax(long long a, long long b){ return a > b ? a : b; } int main() { multiset<long long> hs, ws, lh, lw; int w, h, n; cin >> w >> h >> n; hs.insert(0); hs.insert(h); lh.insert(...
C++
11057f672524244f893493bc10218cbf
39cb966800599882e1f6dc3512b78695
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long llmax(long long a, long long b){ return a > b ? a : b; } int main() { ios_base::sync_with_stdio(false); set<int> hs, ws; multiset<int>lh, lw; int w, h, n; cin >> w >> h >> n; hs.insert(0); hs.insert(h); lh.insert(h); ws.insert(0...
C++
11057f672524244f893493bc10218cbf
a5d6d76bdcc518a34fa4f43f914f8247
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long llmax(long long a, long long b){ return a > b ? a : b; } int main() { set<int> hs, ws; multiset<int>lh, lw; int w, h, n; cin >> w >> h >> n; hs.insert(0); hs.insert(h); lh.insert(h); ws.insert(0); ws.insert(w); lw.insert(w); str...
C++
11057f672524244f893493bc10218cbf
a67af22081d10791864a9208bd71bafd
1,500
PASSED
#define _CRT_SECURE_NO_WARNINGS //#include "pch.h" #include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <queue> #include <climits> using namespace std; const int MAXN = 400000 + 5; int kkk[MAXN]; //int rest[MAXN]; vector<int> edges[MAXN]; int k; int anc[19][MAXN]; int depth[MAXN]; ...
C++
f021a305cf0a6130942b7f72634dae41
d1283aadff341c6249cbe8c671e179dd
3,300
PASSED
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i) #define ...
C++
f021a305cf0a6130942b7f72634dae41
58d371463a3327892ab8c6ee46730ab0
3,300
PASSED
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i) #define ...
C++
f021a305cf0a6130942b7f72634dae41
e942c90058cd988869de78320623e59a
3,300
PASSED
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi. .. dude? // problems that involves any kind of persistent data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma ...
C++
f021a305cf0a6130942b7f72634dae41
3a4892ff6a6785317b7b497153a73a88
3,300
PASSED
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi. .. dude? // problems that involves any kind of persistent data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma ...
C++
f021a305cf0a6130942b7f72634dae41
70aff40c7058b5116713de14783c6139
3,300
PASSED
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi. .. dude? // problems that involves any kind of persistent data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma ...
C++
f021a305cf0a6130942b7f72634dae41
45d24bb396d6312edff5ce1621030cd8
3,300
PASSED
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi. .. dude? // problems that involves any kind of persistent data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma ...
C++
f021a305cf0a6130942b7f72634dae41
cfa36ab476264201a800a9326229917f
3,300
PASSED
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstring> #include <queue> #include <list> #include <set> #include <map> #include <stack> #include <type_traits> #include <time.h> #include <fstream> #include <random> #include <chrono> #include <unordered_set> usin...
C++
f021a305cf0a6130942b7f72634dae41
d6c8e69e3e72b5231486b85338b7a37a
3,300
PASSED
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstring> #include <queue> #include <list> #include <set> #include <map> #include <stack> #include <type_traits> #include <time.h> #include <fstream> #include <random> #include <chrono> #include <unordered_set> usin...
C++
f021a305cf0a6130942b7f72634dae41
5561681ff2c069ba61cb8fe800b188a2
3,300
PASSED
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstring> #include <queue> #include <list> #include <set> #include <map> #include <stack> #include <type_traits> #include <time.h> #include <fstream> #include <random> #include <chrono> #include <unordered_set> usin...
C++
f021a305cf0a6130942b7f72634dae41
9d11ce815f44c445d5d573e17cd12cb8
3,300
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class R173_DIV2_3 { static String origString = ""; static String modifiedString = ""; static MyScanner scanner = new MyScanner(); ...
Java
113ae625e67c8ea5ab07be44c3b58a8f
e1e86424be2e0e020ad7f45b6cdbbee6
1,500
PASSED
import java.util.Scanner; public class Codeforces { static Scanner scanner; public static void main(String[] args) throws Exception { // TODO code application logic here scanner = new Scanner(System.in); String str; String str2; str = scanner.next(); ...
Java
113ae625e67c8ea5ab07be44c3b58a8f
dd28ba19f8726ae62ecccbd9c52fac33
1,500
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) { InputReader in = new InputReader(System.in); String a = in.next(); String b...
Java
113ae625e67c8ea5ab07be44c3b58a8f
f4170c471533e7b79b7f4843b14c81f6
1,500
PASSED
import java.io.BufferedInputStream; import java.util.Arrays; import java.util.Scanner; public class C282 { public static void main(String[] args) { Scanner scanner = new Scanner(new BufferedInputStream(System.in)); char[] first = scanner.next().toCharArray(); char[] second = scanner.next()....
Java
113ae625e67c8ea5ab07be44c3b58a8f
dec3d9cf333e3407a332fc206db902a9
1,500
PASSED
import java.util.*; import java.io.*; public class Task { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String a = br.readLine(); String b = br.readLine(); if (a.equals(b)) { System.out.println("YES"); retur...
Java
113ae625e67c8ea5ab07be44c3b58a8f
2ed5b0c13830dab41f6405630ab36979
1,500
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class XORandOR { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); String b = br.readLine(); if...
Java
113ae625e67c8ea5ab07be44c3b58a8f
150b092050f62b86c095fc744cde68df
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int main() { //freopen ("in.txt", "r", stdin); //freopen ("out.txt", "w", stdout); string a, b; while (cin >> a >> b) { if ((int) a.size() != (int) b.size()) { printf("NO\n"); } el...
C++
113ae625e67c8ea5ab07be44c3b58a8f
b1d09b18aaf6dcea3e5b2be3329345af
1,500
PASSED
#include <algorithm> #include <iostream> #include <cstdio> #include <queue> #include <cstring> #include <string> #include <vector> #include <list> #include <map> #include <set> #include <math.h> #define ll long long #define LD long double #define PR pair<int,int> #define Fox(i,n) for (i=0; i<n; i++) #define Fox1(i,n) ...
C++
113ae625e67c8ea5ab07be44c3b58a8f
82bcb966ea7acb492911b6085d36192d
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(false); cin.tie(false); int main() { string a, b; cin >> a >> b; if(a.size() != b.size()) { cout << "NO" << endl; return 0; } if(a.size() == 1) { if(a[0] != b[0]) { cout << "NO" <...
C++
113ae625e67c8ea5ab07be44c3b58a8f
5b4b133706ef73da18d32f10dc8ddbed
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string s,t,comp; int temp; cin>>s>>t; if(s.length()!=t.length()) { printf("NO\n"); } else if(s.find('1')!=s.npos && t.find('1')==t.npos) printf("NO\n"); else if(s.find('1')==s.npos && t.find('1')!=t.npos) printf("NO\n"); ...
C++
113ae625e67c8ea5ab07be44c3b58a8f
d4563fe74532eb4c24429c4744609fc5
1,500
PASSED
#include <bits/stdc++.h> #define itn int #define gI gi #define int long long using namespace std; typedef long long ll; inline int gi() { int f = 1, x = 0; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();} while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); retur...
C++
fa16d33fb9447eea06fcded0026c6e31
3ccb031fc1e0b8949ca76e079c25c4cb
1,200
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; for(int r=0;r<t;r++){ long long n; cin>>n; long long x=0,y=0; long long mi=100000000,ma=0; long long a[n]; cin>>a[0]; for(long long i=1;i<n;i++){ long long g=0; ...
C++
fa16d33fb9447eea06fcded0026c6e31
462632e095d0f3da8096af7351552479
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(ll i = 0; i < n; i++) #define rep2(i,start,end) for(ll i = start; i < end; i++) #define dwn(i,n) for(int i = n; i >= 0; i--) #define dwn2(i,start,end) for(ll i = start; i >= end; i--) #define pll pair<ll,ll> #define mk(x,y) make_pair...
C++
fa16d33fb9447eea06fcded0026c6e31
cb1f094d6b88db9b596881a95fc4ca82
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; int a[500000]; while(t--) { long long n,k,x,l=0,m=0,d=0; cin>>n; for(int i=0; i<n; i++) { cin>>a[i]; } for(int i=1; i<n; i++) { if(abs(a[i]-a[i-1])>1) ...
C++
fa16d33fb9447eea06fcded0026c6e31
b27a54104c1d4e8226f4d4212f9d738d
1,200
PASSED
#include <bits/stdc++.h> using namespace std; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void...
C++
fa16d33fb9447eea06fcded0026c6e31
3c83b77de2cb06b4da3f729db0b76477
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define llu unsigned long long int #define scll(x) scanf("%lld",&x) #define scld(x) scanf("%lf",&x) #define scull(x) scanf("%llu",&x) #define scch(x) scanf(" %c",&ch) #define Pi acos(-1.0) #define MEM(a,b) memset(a,b,sizeof(a))...
C++
fa16d33fb9447eea06fcded0026c6e31
373b010f8081c8cb0a3d853a0d271163
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >>t; int n; while(t--) { cin>>n; long long int ar[n]; bool f=false; int i; for( i=0;i<n;i++) { cin>>ar[i]; } for(i=0;i<n-1;i++) { if(fabs(ar[i]-ar[i+1])>=2) { f=true; break; } } if(f) { cout<<"yes\n"; cout<<i+1<<" "<<i+2<<en...
C++
fa16d33fb9447eea06fcded0026c6e31
0d953b43263e18b04aa6471049217796
1,200
PASSED
#include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <set> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); const long long INF = 0x3f3f3f3f; int main() { _ int t; cin >> t; while(...
C++
fa16d33fb9447eea06fcded0026c6e31
4cfefd1d0d9f9fe0f9c68967b7351d36
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int flag=0; long long n,maxi,mini,x,a; cin>>n; cin>>x; for(int i=2;i<=n;i++) { cin>>a; if(fabs(x-a)>=2) { flag=1; maxi=i; mini=i-1; } x=a; } if(flag) { puts("YES"); printf("%lld %...
C++
fa16d33fb9447eea06fcded0026c6e31
38a59a38f4a06f413c4479b65eb9dd61
1,200
PASSED
//https://codeforces.com/contest/1270/problem/B #include<bits/stdc++.h> #define pb push_back #define ss second #define ff first #define N 100005 #define inf 1000000009 #define ll long long #define mid(a,b) (a+b)/2 using namespace std; ll t,n,l,r,mn=10000000001,mx; int main() { cin>>t; while(t--) { ...
C++
fa16d33fb9447eea06fcded0026c6e31
3a9482065165f00c72e182e776b12fc7
1,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1010; int _w; int n, p[N]; ll query( int t, int i, int j, int k ) { printf( "%d %d %d %d\n", t, i, j, k ); fflush(stdout); ll ans; _w = scanf( "%lld", &ans ); return ans; } vector<int> after1, after2; void locate2() { int cnt =...
C++
6c0ed9fe0a104fc9380c199003a22e90
564f754c2cb76274892ae31006f37472
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define N 1005 int n; struct node{ int s,a,pos; }t[N]; bool cmp(node x,node y){ if(x.a<y.a)return 1; if(x.a>y.a)return 0; if(x.a==1)return x.s>y.s; return x.s<y.s; } signed main(){ scanf("%lld",&n); int maxn=-1,x=2,y; for(int i=1;i<=n;i++) t[i...
C++
6c0ed9fe0a104fc9380c199003a22e90
002a726b379019866c28405868255ba7
2,300
PASSED
#include<bits/stdc++.h> using namespace std; struct Point{ int id; long long area; Point(){} Point(int _id,long long _area) { id=_id; area=_area; } }; long long a[1010]; vector<Point> fro,beh; bool cmp(const Point &A,const Point &B) { return A.area<B.area; } int main() { int n; cin>>n; int p2=2; for(i...
C++
6c0ed9fe0a104fc9380c199003a22e90
9db5267b836965c85a21e4f71852e0cf
2,300
PASSED
// Problem : C. Point Ordering // Contest : Codeforces - Codeforces Round #601 (Div. 1) // URL : https://codeforces.com/contest/1254/problem/C // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; int N; vector<i...
C++
6c0ed9fe0a104fc9380c199003a22e90
3d16e55bac96d36f1848be4fc30e3806
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1005; vector <int> sigpos; vector <int> signeg; vector <int> recpos; vector <int> recneg; vector <int> ans; long long area[N]; long long query(int i, int j, int k, int ty) { long long resp; printf("%d %d %d %d\n", ty, i, j, k); fflush(stdout); scanf("%I...
C++
6c0ed9fe0a104fc9380c199003a22e90
61fb7144a183ecfbd660df24e464f5f0
2,300
PASSED
#include <cstdio> #include <algorithm> using namespace std; namespace zyt { const int N = 1010; typedef long long ll; int p1[N], p2[N], cnt1, cnt2, ans1[N], ans2[N]; ll s[N]; inline void ask(const int opt, const int i, const int j, const int k) { printf("%d %d %d %d\n", opt, i, j, k); fflush(stdout); } boo...
C++
6c0ed9fe0a104fc9380c199003a22e90
528456382c26778ada5c7d13e7f910b2
2,300
PASSED
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define sz(x) (int)(x).size() #define mem(a,v) memset((a), (v), sizeof (a)) #define enl printf("\n") #define case(t) printf("Case #%d: ", (t)) #define ni(n) scanf("%d",...
C++
6c0ed9fe0a104fc9380c199003a22e90
c5b7081865e755b24a72ad77012cc1e5
2,300
PASSED
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,double> #define ppap pair<pa,int> #define PI 3.14159265358979323846 #define paa pair<int,char> #define mp make_...
C++
6c0ed9fe0a104fc9380c199003a22e90
7c710f195e1d6e41d22a54259f1585fe
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> PII; const int maxn=100010; #define MP make_pair #define PB push_back #define lson o<<1,l,mid #define rson o<<1|1,mid+1,r #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define ROF(i,a,b) for(int i=(a);i>=(b);i--) #define MEM(x,v) me...
C++
6c0ed9fe0a104fc9380c199003a22e90
8601c9a099c904c01dcbb3b9b299b2a1
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pi; typedef pair<ll,pi> pii; ll T, N, M, P, Q, R, S, A, B, C, D, E, X, Y, Z; ll cross_product[1005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> N; for (int i = 3; i <= N; ++i){ cout << 2 << ' ' << 1 <...
C++
6c0ed9fe0a104fc9380c199003a22e90
102d3569f785b06743f0cded3ad5eb35
2,300
PASSED
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; /* spar5h */ public class cf3 implements Runnable{ static class pair { int i; long w; pair(int i, long w) { this.i = i; this.w = w; } } static class comp implements Comparator<pair> ...
Java
cc1b29b49711131d4790d91d0fae4a5a
ef0567ab129c72df936a28cef46fc6f3
1,600
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class B{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(...
Java
cc1b29b49711131d4790d91d0fae4a5a
9553c0f8358b921c56b375fd6c4e5180
1,600
PASSED
//package com.pb.codeforces.practice; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; public class CF1041C { public static class FastReader { BufferedReader br; StringTokenizer st;...
Java
cc1b29b49711131d4790d91d0fae4a5a
92bd6d2f5638d931ff55c79af59a34ee
1,600
PASSED
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class wef { public static class FastReader { BufferedReader br; StringTokenizer st; //it reads the data about the specified poin...
Java
cc1b29b49711131d4790d91d0fae4a5a
92854debc5fa6c0ef0342073fc216a9c
1,600
PASSED
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Main { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { this...
Java
cc1b29b49711131d4790d91d0fae4a5a
65ad6e8fc30c6d5c6887d92f0e6f9c3b
1,600
PASSED
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter out = new PrintWriter(System.out); //FastReader in = new FastReader(new FileInputStre...
Java
cc1b29b49711131d4790d91d0fae4a5a
d1012a47899218e4164d6826668a0e7c
1,600
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
cc1b29b49711131d4790d91d0fae4a5a
c77b2761ffc9620e9fcf638dceaebcce
1,600
PASSED
//package pro; import java.io.IOException; import java.util.*; public class Codechef2 { static FasterScanner in = new FasterScanner(); static class node{ long val; long co; node(long v, long c){ this.val=v; this.co=c; } } public static void main(String[] args) { int n = in.nextInt(); long m = in...
Java
cc1b29b49711131d4790d91d0fae4a5a
ab5254a7a63bb8a8c4b6924e3cc3dac7
1,600
PASSED
import java.util.*; import java.io.*; public class Forces{ public static void main(String ...arg) { Read cin = new Read(); int n = cin.nextInt(); long m = cin.nextLong(); long d = cin.nextLong(); ArrayList<ArrayList<Long>> arr = new ArrayList<>(); for(int i=0;i<n;i++) { arr.add(new ArrayList<Long>...
Java
cc1b29b49711131d4790d91d0fae4a5a
0f3196242365dd88a592d4cdc1c71417
1,600
PASSED
import java.io.*; import java.util.*; public class cf509C{ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int d = sc.nextInt(); int[] aa = new int[n]; TreeMap<Integer,Integer> tm = new TreeMap<Integer,Inte...
Java
cc1b29b49711131d4790d91d0fae4a5a
be88a985d08dd52a2e938132c1d01ad1
1,600
PASSED
//...START BY DOING WHAT IS NECESSARY, //THEN WHAT IS POSSIBLE //AND SUDDENLY YOU ARE DOING THE IMPOSSIBLE... //007naruto #include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define F first #define S second #define pf push_front #def...
C++
aab8d5a2d42b4199310f3f535a6b3bd7
383f24f8156d5b31e3d17056cb0b6fcb
1,400
PASSED