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
#!/usr/bin/python def ir(): return int(raw_input()) def ia(): line = raw_input() line = line.split() return map(int, line) n = ir() a = ia() a = [e - 1 for e in a] g = [ [] for e in range(n)] w = [ None for e in range(n)] w[0] = 0 for i in range(n): if i+1<n : g[i].append(i+1) if i-1>=0:...
Python
d465aec304757dff34a770f7877dd940
91f799d8166c4e22ce673855af50e392
1,600
PASSED
#qk8a from sys import stdin from collections import deque n=int(stdin.readline()) a=[0]+map(int,stdin.readline().split()) dis=[None]*(n+1) dis[1]=0 que=deque([1]) while que: x=que.popleft() for i in [x-1,x+1,a[x]]: if i>=1 and i<=n and dis[i] is None : dis[i]=dis[x]+1 que.append(i) for i in range(1,n+1): pr...
Python
d465aec304757dff34a770f7877dd940
7bd71c09b96359e21cd5eff91169e39e
1,600
PASSED
import Queue n = int(raw_input()) l = [int(x) for x in raw_input().split()] t = [[] for _ in range(0, n+1)] d = [0 for _ in range(0, n+1)] for i in range(1, n+1): if i > 1: t[i-1].append(i) if i+1 < n+1: t[i+1].append(i) t[i].append(l[i-1]) ll = Queue.Queue() ll.put(1) while not ll.empty(): value = ll....
Python
d465aec304757dff34a770f7877dd940
aad24a816e8d73b9d5492c0097677f59
1,600
PASSED
from Queue import Queue n = input() a = map(int, raw_input().split()) a = [i-1 for i in a] dx = [-1] * n dx[0] = 0 Q = Queue() Q.put(0) while not Q.empty(): v = Q.get() for dl in (-1, 0, 1): u = v + dl if 0 <= u < n and dx[u] == -1: dx[u] = dx[v] + 1 Q.put(u) u = ...
Python
d465aec304757dff34a770f7877dd940
e5959a8627347ab6b9907d1110eda69d
1,600
PASSED
from collections import deque n = input() arr = [0] + map(int,raw_input().split()) #print "1" q = deque([1]) temp = [-1]*(n + 1) temp[1] = 0 #print len(arr),n while len(q) > 0 : x = q.popleft() #print len(q),x for var in [x - 1,x + 1,arr[x]] : if var >= 1 and var <= n and temp[var] == -1: temp[var] = temp[x] + ...
Python
d465aec304757dff34a770f7877dd940
0379b213e7245cd916b19201e9997703
1,600
PASSED
from Queue import Queue INF = 10**9 # 10^9 n = int(raw_input()) adj = [] dist = [] for i in xrange(n+1): adj.append([]) dist.append(INF) def bfs(vertice): q = Queue() q.put(vertice) dist[vertice] = 0 while not q.empty(): vertice = q.get() for vizinho in adj[verti...
Python
d465aec304757dff34a770f7877dd940
709435bf1f7c24217b27ee2ad28a3a2d
1,600
PASSED
import sys from collections import deque input = raw_input def solve(): n = int(input()) a = [val - 1 for val in list(map(int, input().split()))] queue = deque([(0, 0)]) ans = [-1] * n while len(queue) > 0: cur = queue.popleft() if cur[0] < 0 or cur[0] >= n or ans[cur[0]] != -1: cont...
Python
d465aec304757dff34a770f7877dd940
bedabcefcc459398877f69d39fc3c71f
1,600
PASSED
#bfs #input n = input() in_list = map(int, raw_input().split(" ")) #making a list of length n. temp_d = {} neigh_1 = [] neigh_2 = [] pre = [] neigh_1.append(1) val = -1 while len(temp_d) != n: val += 1 for i in list(set(neigh_1)): if i in temp_d: continue temp_d[i] = val n...
Python
d465aec304757dff34a770f7877dd940
c6d0b00689f1031ab7809b3fe216c643
1,600
PASSED
#re #bfs #input n = input() in_list = map(int, raw_input().split(" ")) #code. temp_d = [n]*(n) neigh_1 = [] neigh_2 = [] neigh_1.append(0) val = -1 c = n while c: val += 1 for i in list(set(neigh_1)): if temp_d[i] != n: continue temp_d[i] = val c -= 1 neigh_2.appe...
Python
d465aec304757dff34a770f7877dd940
fcd462b54b89c2b070fdc9c207a10ab6
1,600
PASSED
/// Saniuzzaman Robin /// /// CSE'08, Comilla University /// #include<bits/stdc++.h> /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>...
C++
430486b13b2f3be12cf47fac105056ae
2c07ce2d448e7dcb9d826a72ec4f4339
1,700
PASSED
# include <bits/stdc++.h> # define ll long long # define pb push_back # define ppb pop_back using namespace std; const ll N = 1e5 + 10; const ll inf = -1e18; const ll INF = 1e18; const ll mod = 1e9 + 7; const double PI = acos(-1); string a, b; int l, r, f, ans = 80000, cnt, z[5010]; int main() { ios_base::sync...
C++
430486b13b2f3be12cf47fac105056ae
ea9be5f615f85e9dbc37b8d25e1726a9
1,700
PASSED
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); string s, t; cin >> s >> t; for (int i = 0; i < t.size(); ++i) s = "$" + s + "$"; int ans = 1e9; for (int i = 0; i < s.size() - t.size() + 1; ++i) { int cur = 0; for (int j = 0; j < t.siz...
C++
430486b13b2f3be12cf47fac105056ae
31541ea949d8859fb3a143612719549b
1,700
PASSED
#include <iostream> #include <string> #include <cstring> #include <stdio.h> #include <algorithm> #include <cmath> #include <math.h> #include <set> #include <vector> #include <map> #include <queue> #include <stack> #include <sstream> #include <iomanip> #include <cstdio> #include <list> #include <fstream> #include <climi...
C++
430486b13b2f3be12cf47fac105056ae
844c45261520badeb52fc4b1e6eafd3b
1,700
PASSED
/* @Killmonger """"" """""" """"""""" """"""""" """"" """""" """"""""""" """"""""""" """"" """""" """""""""""" """""""""""" """"" """""" """""" ""...
C++
430486b13b2f3be12cf47fac105056ae
9c8c1d8f41ac6bfdac70976ea2959b00
1,700
PASSED
/* @Killmonger """"" """""" """"""""" """"""""" """"" """""" """"""""""" """"""""""" """"" """""" """""""""""" """""""""""" """"" """""" """""" ""...
C++
430486b13b2f3be12cf47fac105056ae
4ba635e6d92363d1934ccc921a6d2c0d
1,700
PASSED
// start of CP 2.0 #include <bits/stdc++.h> //____By:sirjan13____ #define ll long long int #define ld long double #define mod 1000000007 #define mod1 mod #define mod2 100000009 #define show(a) for(int i=0;i<a.size();i++) cout<<a[i]<<" "; #define fi first #define se second #define vi vector<int> #define vs vector<stri...
C++
430486b13b2f3be12cf47fac105056ae
480e2fb43b2a75dcb8c983afb4143612
1,700
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) ...
C++
430486b13b2f3be12cf47fac105056ae
b53baa369d9ce7e7fef9cb21ea798446
1,700
PASSED
/* Made by Narkhan Khamzabek */ #include<bits/stdc++.h> #define pb push_back #define sz(x) (int) x.size() using namespace std; int main () { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, u, t = ""; cin >> s >> u; for(int i = 1; i <= sz(u); i++) t += '5'; s = t + s + t; int ...
C++
430486b13b2f3be12cf47fac105056ae
e968e0ee73e30bae9ff7204f96628e58
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string x,y; cin>>x>>y; int n=min(x.size(),y.size()); int ans=0; for(int i=1;i<=2000;i++){ x+='3'; } for(int i=0;i<x.size();i++){ int cnt=0; for(int j=0;j<n;j++){ if(i+j<x.size() && x[i+j]==y[j]){ ...
C++
430486b13b2f3be12cf47fac105056ae
5c8d230e044a0d6f12fa192ae1e12e4c
1,700
PASSED
#include<bits/stdc++.h> #define lli long long int #define mod 1000000007 #define pb push_back #define pf push_front #define ulli unsigned long long int #define what_is(x) cerr << #x << " is " << x << endl; #define pi 2*acos(0.0) #define F first #define S second //#define endl '\n' #define all(x) x.begin(),x.end() usi...
C++
e86ffda4e59c87acafeb3bf0aa805a52
007a8dcbbac1b13b0df8e42ac13dc982
1,500
PASSED
#include <bits/stdc++.h> #define max(a,b) (a>b ? a:b) #define min(a,b) (a>b ? b:a) #define ll long long #define loop(i,e) for(int i = 0;i<e;i++) #define loopS(i,s,e) for(int i = s;i<e;i++) #define loopD(i,s,e) for(int i = s;i>=e;i--) using namespace std; int main(){ int q; cin >> q; while(q--){ int ...
C++
e86ffda4e59c87acafeb3bf0aa805a52
df85f3593b7ccbdeb8b6a9da75c386a0
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t=1; cin>>t; while(t--) { int n; cin>>n; //vector<vector<int>> v(n,vector<int> (6)); int v[n][6]; for(int i=0;i<n;i++) { for(int j=0;j<6;j++) cin>>v[i][j]; } ...
C++
e86ffda4e59c87acafeb3bf0aa805a52
f7faeae5ae65be1848b109084ad6d0e1
1,500
PASSED
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒mohammad▒▀██████▄ ░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████ ░▐██▒▒▒alwrawrah▒▒▒▒▒████▌ ░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌ ░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌ ░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌ ░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌ ░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌ ░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█ ░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀ ░░░░...
C++
e86ffda4e59c87acafeb3bf0aa805a52
ef3fe1d7f404c0944971ea4ea8e1d44c
1,500
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define mm 1000000007 #define mp make_pair #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define pll pai...
C++
e86ffda4e59c87acafeb3bf0aa805a52
8e9e08a9251549573c42e66431f07bf3
1,500
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define mm 1000000007 #define mp make_pair #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define pll pair<ll, ll> #define show(x) cout<<#x<<" "<<x<<'\n' #def...
C++
e86ffda4e59c87acafeb3bf0aa805a52
5f1fc86e6433e637cc288a1a10da40c0
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pb push_back #define mp(x,y) make_pair(x,y) #define scd(n) scanf("%d",&n) #define sclf(n) scanf("%lf",&n) #define scl(n) scanf("%lld",&n) #define repi(a,b,c) for(int i=a;i<b;i+=c) #define repis(a,b,c) for(int i...
C++
e86ffda4e59c87acafeb3bf0aa805a52
70f19bfa6bc69e8057e35709bca3854b
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pb push_back #define mp(x,y) make_pair(x,y) #define scd(n) scanf("%d",&n) #define sclf(n) scanf("%lf",&n) #define scl(n) scanf("%lld",&n) #define repi(a,b,c) for(int i=a;i<b;i+=c) #define repis(a,b,c) for(int i...
C++
e86ffda4e59c87acafeb3bf0aa805a52
671f7f1afee5b347db885b708fdc6880
1,500
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int q; cin>>q; for(int i=0;i<q;i++){ int n; cin>>n; vector <vector <int> > robot(n); for(int j=0; j<n;j++){ int a,b,f1,f2,f3,f4; cin>>a>>b>>f1>>f2>>f3>>f4; robot[j].pu...
C++
e86ffda4e59c87acafeb3bf0aa805a52
9840c72f0e01f994f88f82308b02d9c1
1,500
PASSED
#include <bits/stdc++.h> using namespace std; const int inf = 1e5; int q ,n ,x, y, val; int a, b, c, d; int main() { scanf("%d", &q); while (q--) { scanf("%d", &n); int left = -inf, right = inf, top = inf, bottom = -inf; bool flag = true; for (int i = 0; i < n; i++) { scanf("%d %d %d %d %d %d", &x, &y,&a,&...
C++
e86ffda4e59c87acafeb3bf0aa805a52
f9c10e32ffe15b254251c6f57b6c1591
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; cout << 0 << ' ' << 0 << endl; string s; cin >>s; if(n == 1){ cout << 1 << ' ' << 1 << ' ' << 1 << ' '<< 0 <<endl; return 0; ...
C++
574347ab83379e5b08618d2b275b0d96
3fd0a073d9eff2cd79dab69d33acb2b7
1,900
PASSED
//#include <bits/stdc++.h> #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <string> #include <cstdlib> #include <vector> #include <queue> #include <vector> #include <map> #include <set> typedef long long LL; #define rep(i,a,b) for(auto i=(a);i<=(b);++i) #define pe...
C++
574347ab83379e5b08618d2b275b0d96
dc093c7fafe9c3fcb5cb6759f259492d
1,900
PASSED
#include <iostream> using namespace std; typedef long long intl; pair<intl,intl> Pos(intl num) { intl x = 0, y = 0; intl b = min(intl(1e9),num); num-=b; x+=b; b = min(intl(1e9),num); num-=b; y+=b; b = min(intl(1e9),num); num-=b; x-=b; b = min(intl(1e9),num); num-=b; ...
C++
574347ab83379e5b08618d2b275b0d96
ea28ad074c2a4945f6b27a98f1c83a79
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; LL read(){ LL x=0,f=1; char ch=getchar(); while (!isdigit(ch)&&ch!='-') ch=getchar(); if (ch=='-') f=-1,ch=getchar(); while (isdigit(ch)) x=(x<<1)+(x<<3)+ch-48,ch=getchar(); return x*f; } int n; string ask(int x,int y){ printf("%d %d\n",x,...
C++
574347ab83379e5b08618d2b275b0d96
0a655f4b7606c7b2b142fd99ca2dad22
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define trace(x) cerr<<#x<<":"<<x<<'\n'; #define trace2(a,n) { cerr<<#a<<" = "; for(int i=0; i<n; ++i){ cerr << a[i] << ' '; } ; cerr <<'\n'; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); ll n; cin>>n; ll lo_x = 0; ll hi_...
C++
574347ab83379e5b08618d2b275b0d96
097e66a46f2f3ef16c88a822cb550884
1,900
PASSED
#include<bits/stdc++.h> using namespace std; char a[10]; bool in() { cin>>a; if(a[0]=='b') return 1; else return 0; } int main() { bool l,m,r; int n; int lx=0,mid=(1<<28),rx=(1<<29); cin>>n; if(n==1) { cout<<"0 0"<<endl; int mos=in(); cout<<"1 1 2 1"<<endl; return 0; } cout<<mid<<" 0"<<endl; m=in...
C++
574347ab83379e5b08618d2b275b0d96
ddadf5bdfadaef46ae45675c9c73377e
1,900
PASSED
#include<bits/stdc++.h> using namespace std; int n; char Input[10]; int main(){ cin>>n;int nn=max(n>>1,1); int xl=1,xr=1000000000; int yl=1,yr=1000000000; char bcolor; cout<<0<<" "<<0<<endl; cin>>Input; bcolor=Input[0]; for (int i=2;i<=nn;i++){ int mid=(xl+xr)>>1; cout<<mid<<" "<<0<<endl; cin>>Input; ...
C++
574347ab83379e5b08618d2b275b0d96
9dd03cd917308be877327b6d014ce576
1,900
PASSED
# include <stdio.h> # include <bits/stdc++.h> #define _USE_MATH_DEFINES_ #define ll long long #define ld long double #define Accepted 0 #define pb push_back #define mp make_pair #define sz(x) (int)(x.size()) #define every(x) x.begin(),x.end() #define F first #define S second #define For(i,x,y) for (ll i = x; i <= y;...
C++
574347ab83379e5b08618d2b275b0d96
4edaade02923a3d07ab2eb909b3b714d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define SET(x, a) memset(x, a, sizeof x); #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define pld pair<ld, ld> const ll MOD = 1000000007; const l...
C++
574347ab83379e5b08618d2b275b0d96
a16f21f90ffa6b4392e753516bf536a8
1,900
PASSED
#include<bits/stdc++.h> #define fast ios::sync_with_stdio(0);cin.tie(0); #define all(v) ((v.begin()),(v.end())) #define sz(v) ((int)(v.size())) #define forv(i, v) for(int i = 0; i < sz(v); ++i) #define forn(i,n) for(int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; typedef long do...
C++
574347ab83379e5b08618d2b275b0d96
1cb4a4c42b14b0d04cf6e5aebfe13035
1,900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, j, cek, lk[101], pr[101], res = 0; scanf("%d %d", &n, &m); memset(lk, 0, sizeof(lk)); memset(pr, 0, sizeof(pr)); for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) { if ((lk[i] == 0) || (pr[j] == 0)) { ...
C++
14fc3a7fef44a02791aee62838c4c8c8
d952a1c695c10d973d0d91acc174a4d5
1,000
PASSED
// Enjoy your stay. #include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i...
C++
14fc3a7fef44a02791aee62838c4c8c8
35d60ce330f18736a3b8400f62ae9899
1,000
PASSED
#include <cstdio> int main() { int n, m; std::scanf("%d%d", &n, &m); std::printf("%d\n", n + m - 1); for (int i = 1; i <= m; ++i) { std::printf("%d %d\n", 1, i); } for (int i = 2; i <= n; ++i) { std::printf("%d %d\n", i, m); } return 0; }
C++
14fc3a7fef44a02791aee62838c4c8c8
272e5d65bfe529ea2dc81f665698a4da
1,000
PASSED
#include <cstdio> int main() { int n, m; std::scanf("%d%d", &n, &m); std::printf("%d\n", n + m - 1); for (int i = 1; i <= m; ++i) { std::printf("1 %d\n", i); } for (int i = 2; i <= n; ++i) { std::printf("%d 1\n", i); } return 0; }
C++
14fc3a7fef44a02791aee62838c4c8c8
eef9cf062978e224db19d617674a6a7f
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define MAX 1000 int used1[MAX]; int used2[MAX]; multimap<int,int> ans; int main(){ int n,m; cin >> n >> m; int cnt = 0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(used1[i]==0 || used2[j] == 0){ used1[i] = 1; ...
C++
14fc3a7fef44a02791aee62838c4c8c8
6d190891cae484d6d817750f5a0450aa
1,000
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> using namespace std; typedef long long long64; class Partner { public: Partner(long64 boy, long64 girl): m_boy(boy), m_girl(girl), m_engaged(false){} Partner(const Partner& source) { m_boy = source.m_boy; m_girl = ...
C++
14fc3a7fef44a02791aee62838c4c8c8
3b873f8afcf70828583cea85a163763e
1,000
PASSED
// In the name of God #include <algorithm> #include <iostream> #include <complex> #include <cstdlib> #include <cassert> #include <sstream> #include <iomanip> #include <cstdio> #include <vector> #include <cmath> #include <queue> #include <stack> #include <set> #include <map> using namespace std; typedef long long ll;...
C++
14fc3a7fef44a02791aee62838c4c8c8
f2867d3a5d06e7352753bba8bae5f143
1,000
PASSED
#include <iostream> using namespace std; int main(){ int n,m; cin>>n>>m; cout<<m+n-1<<endl; for (int i = 1; i <= m; ++i) cout<<1<<" "<<i<<endl; if(n<m) for (int i = 2; i <= n; ++i) cout<<i<<" "<<i<<endl; else for (int i = 2; i <= n; ++i) cout<<i<<" "<<1<<endl; return 0; }
C++
14fc3a7fef44a02791aee62838c4c8c8
87f0ca172e83731f46b47d2f231d9cb4
1,000
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <string> #include <regex> #include <cmath> using namespace std; int main(int argc, char const *argv[]) { int n, m; cin >> n >> m; cout << m+n-1 << endl; for (int i = 0; i < m; ++i) { c...
C++
14fc3a7fef44a02791aee62838c4c8c8
0bc52e1c09aba3531db54899bfa70f45
1,000
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <numeric> #include <cctype> #include <tuple> #include <array> // BEGIN CUT H...
C++
14fc3a7fef44a02791aee62838c4c8c8
7228949657c4f1f3f73e88d466c0e224
1,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<int, LL> PIL; typedef pair<LL, int> PLI; typedef vector<int> VI; typedef vector<PII> VPII; typedef double DB; #define pb push_back #define mset(a, b) memset(a, b, sizeof a) #define al...
C++
d65e91dc274c6659cfdb50bc8b8020ba
dda42a6d774d2906bc1b6a5cbfca7def
2,200
PASSED
/* Program:196-C Algorithm:greedy Author:this_poet Time:2012-06-13 13:26 */ #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib> #include<map> #include<set> #include<string> #include<vector> #include<cctype> #include<climits> #include<queue> #include<stack> using n...
C++
d65e91dc274c6659cfdb50bc8b8020ba
808829168e7a0e2f71c596ce6e5fad67
2,200
PASSED
/* Program:196-C Algorithm:greedy Author:this_poet Time:2012-06-13 13:26 */ #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib> #include<map> #include<set> #include<string> #include<vector> #include<cctype> #include<climits> #include<queue> #include<stack> using n...
C++
d65e91dc274c6659cfdb50bc8b8020ba
feed36d34c95b8216b95de1bdf61432d
2,200
PASSED
#include<stdio.h> #include<algorithm> int n; typedef double dou; typedef struct{int f,t;}edge; int cmp(edge a,edge b){return a.f<b.f;} typedef struct{dou x,y,i;}ele; edge e[5012]; int f[5012],v[5012],s[5012],ans[5012],rans[5012]; ele d[5012]; ele z; dou eps=0.000000001; int cmpd(ele a,ele b){ return (a.y-z.y)/(a.x-z.x...
C++
d65e91dc274c6659cfdb50bc8b8020ba
a7a364a095f07c179ae56c4526b1679e
2,200
PASSED
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> #include <queue> #include <stack> #include <cmath> using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef long double ld; const int INF = 1000000000; const i...
C++
d65e91dc274c6659cfdb50bc8b8020ba
712c9da05bd996955016ca306af99173
2,200
PASSED
#include <bits/stdc++.h> #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define MOD 1000000007 #define pb push_back #define sq(x) ((x)*(x)) #define x first #define y second #define eps 1e-14 #define bpt(x) (__builtin_popcount(x)) #define bptl(x) (__builtin_popcountll(x)) #define bit(x, y) (((x)>>(...
C++
d65e91dc274c6659cfdb50bc8b8020ba
4d1a624731a2ab5bf1f73033be95f999
2,200
PASSED
#include <bits/stdc++.h> #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define MOD 1000000007 #define pb push_back #define sq(x) ((x)*(x)) #define x first #define y second #define eps 1e-14 #define bpt(x) (__builtin_popcount(x)) #define bptl(x) (__builtin_popcountll(x)) #define bit(x, y) (((x)>>(...
C++
d65e91dc274c6659cfdb50bc8b8020ba
cb7a4fa5ae83da650f98d2a5d3f27195
2,200
PASSED
#include <bits/stdc++.h> #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define mod 1000000007 #define pb push_back #define eps 1e-8 #define bpt(x) (__builtin_popcount(x)) #define bptl(x) (__builtin_popcountll(x)) #define bit(x, y) (((x)>>(y))&1) #define x first #define y second using namespace st...
C++
d65e91dc274c6659cfdb50bc8b8020ba
9dddf4107055918696968e1eb707e107
2,200
PASSED
#include <bits/stdc++.h> #define x first #define y second #define inf 0x3f3f3f3f #define mod 1000000007 #define pb push_back #define sq(x) ((x)*(x)) #define eps 1e-8 #define bpt(x) (__builtin_popcount(x)) #define bptl(x) (__builtin_popcountll(x)) #define bit(x, y) (((x)>>(y))&1) #define bclz(x) (__builtin_...
C++
d65e91dc274c6659cfdb50bc8b8020ba
8ff3eee4ddc626880274693c3bc0f619
2,200
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
C++
d65e91dc274c6659cfdb50bc8b8020ba
e0fe7cedb6dd9b6a0b895c67137d05e6
2,200
PASSED
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static boolean f(ArrayList<ArrayList<Integer>> tree, long[] h, long[] good, long[] bad, long[] sums, int v, boolean[] used) { if (used[v]) return true; used[v] = true; boolean resu...
Java
0369c070f4ac9aba4887bae32ad8b85b
97a0ba757dca204565c7d12d9c35c60e
1,800
PASSED
//package Codeforces.Round660Div2.C_UncleBogdanAndCountryHappiness; import java.util.*; public class C_UncleBogdanAndCountryHappiness { static class City { int id; long pop; long hi; long happy; long unhappy; long totalpop; boolean isVisited; Cit...
Java
0369c070f4ac9aba4887bae32ad8b85b
f305ce6295debb9795002c46ecc70c5c
1,800
PASSED
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class Main { class Node{ int pass; int p; int h; int i; Set<Node> ch; } void remParr(Node node, Node par){ node.ch.remove(par); for (Node ch : node.ch) { re...
Java
0369c070f4ac9aba4887bae32ad8b85b
9ff87a18dea725290cdccfabf37813f9
1,800
PASSED
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class Main { private int[] p; private int[] h; private List<List<Integer>> graph; static class Node { int h; int p; int w; int g; List<Node> children; } Node build(int u, ...
Java
0369c070f4ac9aba4887bae32ad8b85b
4717dbffefb4ac03257d3518e539ca55
1,800
PASSED
import java.io.*; import java.util.*; public class noob{ InputReader in; final long mod=1000000007; StringBuilder sb; public static void main(String[] args) throws java.lang.Exception{ new noob().run(); } void run() throws Exception { in=new InputReader(System.in); sb = n...
Java
0369c070f4ac9aba4887bae32ad8b85b
82eaa2e74d465ce80e9d41d063d0a838
1,800
PASSED
import java.util.Scanner; import java.util.ArrayList; public class Sample { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i = 0; i < t; ++i) { int n = input.nextInt(); int m = input.nextInt(); int population[] = new int[n]; for(int...
Java
0369c070f4ac9aba4887bae32ad8b85b
c15d8aafe9c562cd16da0037c21c2523
1,800
PASSED
import java.io.*; import java.sql.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class c { public static void print(String str,long val){ System.out.println(str+" "+val); } public long gcd(long a, long b) { i...
Java
0369c070f4ac9aba4887bae32ad8b85b
04d38b37c65ba6161eed7fe56f637247
1,800
PASSED
import java.util.*; import java.io.*; import java.lang.Math; public class C{ static List<Integer>[] adjList; static boolean[] visited; static int[] people; static int[] hIndex; static int[] cp; public static void main(String[] args) throws Exception{ FastScanner fs = new FastScanner(); int t = fs.nextInt(...
Java
0369c070f4ac9aba4887bae32ad8b85b
7e9221e5a56437a6114034072c1daacb
1,800
PASSED
import java.util.*; public class countryMood{ static int n, m; static List<List<Integer>> graph; static long[] pop, moods, commuters, good; static boolean possible = true; public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); w...
Java
0369c070f4ac9aba4887bae32ad8b85b
1246bf51a717df6e5e40086f4c36ddf9
1,800
PASSED
import java.io.*; import java.util.*; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
0369c070f4ac9aba4887bae32ad8b85b
aa0bea417c991d3874e1b73c34aa8192
1,800
PASSED
#include<bits/stdc++.h> #include<iostream> #include<vector> #include<set> #include<map> #include<queue> #define ll long long #define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define binary(x) std::string binary = std::bitset<25>(x).to_string(); //to binary #define inf 1000000007 #define mod 1...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
ea9c3b37db3694de2a88ac95e63c1f89
1,500
PASSED
#include <iostream> #include <stdio.h> #include <cmath> #include <math.h> using namespace std; const int maxN = 3e5 + 10; typedef long long int ll; ll n, x, y, d, one, zeo; bool a[maxN], kt, b[maxN]; char ch; ll ans; void input() { ios_base::sync_with_stdio(0); /* freopen("INPUT.inp", "r", stdin); freope...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
67a1b6358a739da677390f61377f18d3
1,500
PASSED
//**KISS** //**KEEP IT SHORT AND SIMPLE** #include <bits/stdc++.h> #define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #define INF 1000000000 #define REP(i,a,b) for (int i = a; i < b; i++) #define NL '\n' #define F first #defi...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
2331b4757820f4ff4c645e8be82b8125
1,500
PASSED
#include<bits/stdc++.h> #define lld long long int #define ld long double #define mod 1000000007 #define modd 998244353 #define all(v) v.begin(),v.end() #define rep(i,a,b) for(lld i=a;i<=b;i++) #define repr(i,a,b) for(lld i=a;i>=b;i--) #define pb push_back #define mp make_pair #define ios ios_base::sync_with_stdio(false...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
11fa5e9e33644f72fa59d1ad7eca7d85
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define sz 100009 #define pb push_back vector<int>v; int main() { unsigned long long int p=0,n,i,j, x,y,a,b,c,res; string s; cin>>n>>x>>y; a=b=c=0; cin>>s; j=0; for(i=0; i<n; i++) { if(s[i]=='1') { ...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
0aadafa3f2e8b7b439ab4845f8826605
1,500
PASSED
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n , x , y; cin >> n >> x >> y; string s; cin >> s; vector<pair<long long , long long >> v; long long ans = 0; long long bef = 0 , af = 0; for(int i = 0 ; i < s.siz...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
1f0ee2e5afdbabb34dc512f0e2339d77
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define mp make_pair ll memo[300005][3]; ll n; ll x,y; string str; int main(){ ios::sync_with_stdio(false); cin>>n>>x>>y; cin>>str; ll groups=0; if(str[0]=='0') groups++; for(ll i=1;i<n;i++) { if(str[i]=='0'&&str[i-1]=='1') g...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
7eca13e5f20e0e267a9c9f70f0f72382
1,500
PASSED
#include <iostream> #include <cmath> #include <string> #include <sstream> #include <queue> #include <stack> #include <ctime> #include <vector> #include <algorithm> #include <memory.h> #include <set> #include <map> #include <unordered_map> using namespace std; #define MOD 1000000007 typedef long long ll; int main() { #i...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
001a3ebf849e276900ce0770fec4bc80
1,500
PASSED
#include <iostream> #include <cmath> #include <string> #include <sstream> #include <queue> #include <stack> #include <ctime> #include <vector> #include <algorithm> #include <memory.h> #include <set> #include <map> #include <unordered_map> using namespace std; #define MOD 1000000007 typedef long long ll; int main() { #i...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
0941740ba2e7735ebb8a0b3562e01fc8
1,500
PASSED
/* No more worries, rest your head and go to sleep Maybe one day we'll wake up and this will all just be a dream. */ #include "bits/stdc++.h" using namespace std; #define rep(i,a,n) for(int i = a; i < n; i++) #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() #define fas...
C++
b267f69cc4af3e319fc59e3ccd8b1c9d
3b2954cf51a0f1d4a57f23f15e60f6cc
1,500
PASSED
#include<iostream> #include<queue> #include<map> #include<cassert> using namespace std; typedef long long ll; ll n, m; queue<pair<int, int>> q[200000 + 100]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { int a; cin >> a; q[a % m].push(make_pair(a, i)); } ll ans = 0; ll ruiseki = 0; queue<pa...
C++
4a7c2e32e29734476fa40bced7ddc4e8
7f420a0c314a08dfd0ca314da9c2184f
1,900
PASSED
#include <bits/stdc++.h> using i32 = int_fast32_t; using i64 = int_fast64_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using f64 = double; using f80 = long double; #define FOR(v, a, b) for(i64 v = (a); v < (b); ++v) #define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0, n) #defi...
C++
4a7c2e32e29734476fa40bced7ddc4e8
01e24a4eb64bd474ed55bf8434a0cbaa
1,900
PASSED
#include <bits/stdc++.h> using i32 = int_fast32_t; using i64 = int_fast64_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using f64 = double; using f80 = long double; #define FOR(v, a, b) for(i64 v = (a); v < (b); ++v) #define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0...
C++
4a7c2e32e29734476fa40bced7ddc4e8
e57f5c396853e3d8b7f70d9642ce7fee
1,900
PASSED
#include <bits/stdc++.h> using i32 = int_fast32_t; using i64 = int_fast64_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using f64 = double; using f80 = long double; #define FOR(v, a, b) for(i64 v = (a); v < (b); ++v) #define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0...
C++
4a7c2e32e29734476fa40bced7ddc4e8
811bf276814c877d1be80f9ebe6bed56
1,900
PASSED
#include <bits/stdc++.h> #define fr(i,n) for(int i=0;i<n;i++) #define frn(i,x,n) for(long long i=x;i<=n;i++) #define pb push_back #define ms(x) memset(x,-1,sizeof x) #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef vector<int> vi; typedef deque<int> di; set <int> s; int ...
C++
4a7c2e32e29734476fa40bced7ddc4e8
43eb47cb566c3c3d1b12b78be0644df7
1,900
PASSED
/* --┬-- | | --┬-- | | | |\ | | | | | | \ | | -----> | | | | \ | | | | | | \ | | | | --┴-- | \| | ...
C++
4a7c2e32e29734476fa40bced7ddc4e8
7b4a219eedb57fd9c8c2c7cac5d61f7b
1,900
PASSED
#include <bits/stdc++.h> #include <random> #define INF 1e9 #define EPS 1e-6 #define pb push_back #define pause system("pause"); #define exit exit(0) using namespace std; using ll = long long; using ull = unsigned long long; int n, m; int a[200005]; int cnt[200005]; vector<int> g[200005]; vector<int> g2; int x; void...
C++
4a7c2e32e29734476fa40bced7ddc4e8
50dfbf70d31944f5287eaff657ccf3df
1,900
PASSED
/** Programmer : Iman Mousaei Wrong/Time Limit/Bug/Incomplete **/ #include <bits/stdc++.h> #define iOS ios_base::sync_with_stdio(false); #define pb push_back #define ALL(x) (x).begin(), (x).end() #define CLR(x, a) memset(x, a, sizeof x) #define CP(x) cout<<"CP"<<x<<endl; #define S second #define F first #define DPT ...
C++
4a7c2e32e29734476fa40bced7ddc4e8
2faa4e08c79ef3bb5f735a03777a3d23
1,900
PASSED
#include <iostream> #include <vector> #include <queue> using namespace std; vector<int> v, f; vector<vector<int>> act; queue<int> q; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); int n, m; cin >> n >> m; v.resize(n); f.resize(m, 0); for (auto &x : v) { cin >> x; f[x % m]++; } i...
C++
4a7c2e32e29734476fa40bced7ddc4e8
5b8906137326725028f40e4f61526983
1,900
PASSED
#include <bits/stdc++.h> using namespace std; /* * JUST KEEP GOING */ #define endl '\n' #define ll long long #define all(v) ((v).begin()), ((v).end()) #define allr(v) ((v).rbegin()), ((v).rend()) #define sz(v) ((int)((v).size())) #define clr(v, d) memset(v, d, sizeof(v)) #define rep(i, v) for(int i=0;i<...
C++
4a7c2e32e29734476fa40bced7ddc4e8
3f2d85ad0104922ecf0fc2abb3f7dd58
1,900
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int,int> #define pll pair<ll,ll> #define pdd pair<ld,ld> #define ff first #define ss second #define pb push_back #define mp make_pair #define MAXINT ((~0) ^ (1 << 31)) #define MAXLL ((~0) ^ ((ll)1 << 63)) #define INF ((int)2e9) #defi...
C++
55fe63ed396d29abe9bfa4d316b7163e
48bcb5a754e7752183108202b9cc8980
2,300
PASSED
#include<iostream> #include<fstream> #include<cstdio> #include<cmath> #include<cstdlib> #include<iomanip> #include<ctime> #include<cstring> #include<climits> #include<string> #include<vector> #include<map> #include<queue> #include<set> #include<algorithm> #include<stack> #include<deque> #include<list> #include<vector> ...
C++
55fe63ed396d29abe9bfa4d316b7163e
9455d2117b9e4323a60f6dbe24498c6c
2,300
PASSED
#include<stdio.h> #include<algorithm> #define M 100100 #define N 100000 #include<vector> using namespace std; vector <int> vx[M],vy[M],vv[M*2]; struct pnt{ int x, y; pnt(int x=0, int y=0):x(x),y(y){} }p[M]; bool cmp(pnt a, pnt b){ if(a.x!=b.x)return a.x<b.x; return a.y<b.y; } int ans,n; void run(){ bool sus; ...
C++
55fe63ed396d29abe9bfa4d316b7163e
7056476da5cee40f3647d7809d218b5b
2,300
PASSED
#include <stdio.h> #include <algorithm> #include <vector> #define N 100100 using namespace std; vector <int> row[N], col[N], dig[N+N]; typedef pair <int, int> pii; pii p[N]; int main() { int n; // freopen ("d2.in", "r", stdin); scanf("%d", &n); for (int i=0; i<n; i++) { int j, k; scanf("%d %d", &j, &k); p[i...
C++
55fe63ed396d29abe9bfa4d316b7163e
79743326324e1ce66bb013686d4f1258
2,300
PASSED
#include <iostream> #include <cstdio> #include <map> #include <set> #include <cmath> #include <queue> #include <cctype> #include <string> #include <vector> #include <numeric> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; typedef long double ldb; typedef pair<int,...
C++
55fe63ed396d29abe9bfa4d316b7163e
90869674a9839e8f985d445ab2ea2236
2,300
PASSED
#include <stdio.h> #include <map> #include <math.h> #include <algorithm> #include <string> #include <queue> #include <vector> #include <string.h> using namespace std; #define M 100100 map<int, bool>mp[M]; vector<int> X[M], Y[M]; int x[M], y[M], gx[M], gy[M], n; int ans; void input(){ scanf("%d", &n); for(int i=0; i<...
C++
55fe63ed396d29abe9bfa4d316b7163e
5f9313722eb5914fbc2f7da4e5a08b5b
2,300
PASSED
#include <stdio.h> #include <map> #include <math.h> #include <algorithm> #include <string> #include <queue> #include <vector> #include <string.h> using namespace std; #define M 100100 map<int, bool>mp[M]; vector<int> X[M], Y[M]; int x[M], y[M], gx[M], gy[M], n; int ans; void input(){ scanf("%d", &n); for(int i=0; i<...
C++
55fe63ed396d29abe9bfa4d316b7163e
8b87b0f436a62fbaade67e2f943feabc
2,300
PASSED
#include <iostream> #include <cstdio> #include <map> #include <set> #include <cmath> #include <queue> #include <cctype> #include <string> #include <vector> #include <numeric> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; typedef long double ldb; typedef pair<int,...
C++
55fe63ed396d29abe9bfa4d316b7163e
3b4386e8030dfd870200cb4ae0cd0da6
2,300
PASSED
#include <iostream> #include <cstdio> #include <map> #include <set> #include <cmath> #include <queue> #include <cctype> #include <string> #include <vector> #include <numeric> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; typedef long double ldb; typedef pair<int,...
C++
55fe63ed396d29abe9bfa4d316b7163e
5492f3fd063e7d8e6c914db3c1c39043
2,300
PASSED
#include <stdio.h> #include <memory.h> #include <vector> #include <algorithm> using namespace std; #define M 100001 #define N 40 #define Min(a,b) (a<b?a:b) vector<int> X[M],Y[M],Z[2*M]; struct pnt{ int x,y; } p[M]; bool cmp(pnt a,pnt b) { if(a.x!=b.x) return a.x<b.x; return a.y<b.y; } int n,ans=0; int nx,ny,nz,mn,...
C++
55fe63ed396d29abe9bfa4d316b7163e
e4670b6504a65e97b53a238b344353de
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; ...
C++
edc54435b62e76287da94836ad3aa86b
7f8163abbb2fdf675427fac2b9aa46e2
1,900
PASSED