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
#pragma GCC optimize(2) #pragma GCC optimize(3) #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #define ll long long using namespace std; const ll mod=998244353; int n,k,m,a[2000005],b[2000005],w[2000005],v[2000005]; int jc[2000005],inv[2000005],cnt[2000005],ma...
C++
b61ec1b0599c8be430b4424a08beacfb
6ef2cf0f1bc12b3a1a1d7100eba26d79
2,500
PASSED
#include<cstdio> #include<algorithm> using std::swap; #define maxn 1048576 #define max 600000 typedef long long ll; const int mod=998244353,g=3,ig=332748118; int r[maxn],cnt[300001],ans[600001],p0[maxn],p1[maxn]; int pow(int x,int p) { int res(1); while(p) { if(p&1) res=1ll*res*x%mod; x=1ll...
C++
b61ec1b0599c8be430b4424a08beacfb
fb70c528fafb8adc52d16f8a43f0db07
2,500
PASSED
// Etavioxy #include<cstdio> #include<cctype> #include<cstring> #include<algorithm> #include<cmath> #define il inline #define ll long long #define rep(i,s,t) for(register int i=(s);i<=(t);i++) #define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--) #define each(i,u) for(int i=head[u];i;i=bow[i].nxt) #define file(s) f...
C++
b61ec1b0599c8be430b4424a08beacfb
fb82a5175c18985815def4af463cf2fa
2,500
PASSED
#include<bits/stdc++.h> #define ll long long #define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i) #define _rep(i,x,y) for(int i=x,i##end=y;i>=i##end;--i) #define N 5000005 const int mod=998244353,G=3,_inv=mod+1>>1; int wn[N],rev[N],lim,invlim; inline int upd(const int x){return x+(x>>31&mod);} inline void reduce(i...
C++
b61ec1b0599c8be430b4424a08beacfb
306d3e2a2f7d34e9e6af4f2801e6b5ec
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 60; int a[maxn]; int n,m; double dp[maxn][maxn][maxn]; int main() { scanf("%d%d",&n,&m); for(int i=0;i<m;i++) scanf("%d",&a[i]); dp[0][0][0]=1.0; for(int i=0;i<=n;i++) for(int j=0;j<m;j++) for(int k=0;k<=n;k++) ...
C++
c2b3b577c2bcb3a2a8cb48700c637270
126179d0ed887246bae7a9097349e40e
2,200
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 60; int a[maxn]; int n,m; double dp[maxn][maxn][maxn]; int main() { scanf("%d%d",&n,&m); for(int i=0;i<m;i++) scanf("%d",&a[i]); dp[0][0][0]=1.0; for(int i=0;i<=n;i++) for(int j=0;j<m;j++) for(int k=0;k<=n;k++) ...
C++
c2b3b577c2bcb3a2a8cb48700c637270
a54c4c4d0aabfb601b6790fc168248b3
2,200
PASSED
#include <algorithm> #include <iostream> #include<stdio.h> #include<string.h> #include<queue> #include<cmath> #include<list> #include<set> #include<map> #include<vector> #define N 55 #define inf 100000000 #define mp make_pair #define pb push_back #define pii pair<int,int> #define X first #define Y second #define ll lon...
C++
c2b3b577c2bcb3a2a8cb48700c637270
81f2b4e2b0e20376b063b1686ad1d3b2
2,200
PASSED
// 1.cpp : Defines the entry point for the console application. // #include <vector> #include <map> #include <set> #include <queue> #include <stack> #include <iostream> #include <string> #include <algorithm> #include "stdio.h" #include "math.h" using namespace std; double Cnk(int n, int k) { double result = 1; fo...
C++
c2b3b577c2bcb3a2a8cb48700c637270
85c706a2fbe1c803979618d6f252ea69
2,200
PASSED
#include <bits/stdc++.h> #define DEBUG(...) fprintf(stderr,__VA_ARGS__) using std :: max; using std :: min; using std :: set; using std :: pair; using std :: make_pair; using std :: vector; using std :: queue; using std :: multiset; using std :: priority_queue; typedef long long LL; typedef pair<int,int> pii; stati...
C++
c2b3b577c2bcb3a2a8cb48700c637270
11a5d46037cdb1ae83169ce389253b33
2,200
PASSED
#include<cstdio> #include<algorithm> #include<cmath> using namespace std; #define For(i,__,___) for(int i=__;i<=___;i++) const int N=60; int n,m,a[N]; double f[N][N][N],c[N][N]; int main() { scanf("%d%d",&n,&m); c[0][0]=1; For(i,1,n) { c[i][0]=1; For(j,1,i)c[i][j]=c[i-1][j-1]+c[i-1][j]; } For(i,1,m)scanf("%d"...
C++
c2b3b577c2bcb3a2a8cb48700c637270
7d75fb97f56aeb906b702015127e081b
2,200
PASSED
/* * 028C.cpp * * Created on: Jun 10, 2013 * Author: Mostafa Saad */ #include<set> #include<map> #include<list> #include<iomanip> #include<cmath> #include<string> #include<vector> #include<queue> #include<stack> #include<complex> #include<sstream> #include<iostream> #include<fstream> #include<algorithm> #...
C++
c2b3b577c2bcb3a2a8cb48700c637270
883e6dbd5d06b2566dd479e825e19b32
2,200
PASSED
/* * 028C.cpp * * Created on: Jun 10, 2013 * Author: Mostafa Saad */ #include<set> #include<map> #include<list> #include<iomanip> #include<cmath> #include<string> #include<vector> #include<queue> #include<stack> #include<complex> #include<sstream> #include<iostream> #include<fstream> #include<algorithm> #...
C++
c2b3b577c2bcb3a2a8cb48700c637270
9e62cd5e000acca18dd6f76a5e33d0ec
2,200
PASSED
#include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <c...
C++
c2b3b577c2bcb3a2a8cb48700c637270
e53872f42180c945d5648756f76c1bb9
2,200
PASSED
#pragma GCC optimize ("O3") #include <bits/stdc++.h> #define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef long long ll; using namespace std; const int N = 55; int n , m , a[N]; ll C[N][N]; long double memo[N][N][N]; long double solve(int i , int rem , int mx) { if(i == m) retu...
C++
c2b3b577c2bcb3a2a8cb48700c637270
95ed620249ec8af40c88bfb4ac39bafc
2,200
PASSED
/* //hemel18681 * * * ******* * ******* * * * ** * * * * * ** * * * * * * * * * * * * ****** * ****** * * *******...
C++
ff9745ec5cc22c2ea50b6d789596f719
179087e825ebefa45ecf99ddce9b716a
1,700
PASSED
/* //hemel18681 * * * ******* * ******* * * * ** * * * * * ** * * * * * * * * * * * * ****** * ****** * * *******...
C++
ff9745ec5cc22c2ea50b6d789596f719
980a87a8f0a9fb6eaa74b9eaee57c5c0
1,700
PASSED
/* //hemel18681 * * * ******* * ******* * * * ** * * * * * ** * * * * * * * * * * * * ****** * ****** * * *******...
C++
ff9745ec5cc22c2ea50b6d789596f719
56b7b4cd48fcadb7f4bd9ae120411e25
1,700
PASSED
//hemel18681 #include<bits/stdc++.h> #define start_hemel int main() { #define end_hemel return 0; } #define ll long long #define ld double #define pi 2*acos(0.0) #define pb push_back #define mp make_pair #define vc vector #define line printf("\n") #define sc(a) scanf("%d",&a) #define sfl(a) scanf("%lld",&a) #define sf...
C++
ff9745ec5cc22c2ea50b6d789596f719
c6c5b2e77536e6a208fb5afadfce3a65
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0); redirect(); int _t; cin >> _t; for (...
C++
ff9745ec5cc22c2ea50b6d789596f719
acff0a0f851142709b336e2de65e7c86
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0); redirect(); int _t; cin >> _t; for (...
C++
ff9745ec5cc22c2ea50b6d789596f719
fc26d965a103c341e2d140443e664649
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) #define _IL __attribute__((always_inline)) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.t...
C++
ff9745ec5cc22c2ea50b6d789596f719
f88b150fd823e8311e06b3959a1b9953
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) #define _IL __attribute__((always_inline)) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.t...
C++
ff9745ec5cc22c2ea50b6d789596f719
f2e59135666888ffbe554e2a1bd2e174
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) #define _IL __attribute__((always_inline)) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.t...
C++
ff9745ec5cc22c2ea50b6d789596f719
7d9af2560ed63e59048ea5a1cbfc9dec
1,700
PASSED
#include <bits/stdc++.h> #define int long long #define unsigned unsigned long long #define bool char #define true char(1) #define false char(0) using namespace std; class text; void solve_t(); void redirect(); int32_t main() { ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0); redirect(); int _t; cin >> _t; for (...
C++
ff9745ec5cc22c2ea50b6d789596f719
d0f2c27319589ab6391f919578a5b35a
1,700
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 2e5 + 11; ll l[N], r[N]; struct Bridge{ int i; ll len; bool operator < (const Bridge &t)const{ // return len<t.len; return len==t.len ? i<t.i : len<t.len; } }b[N]; struct Seg{ ll x, y; int i; bo...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
3e2b5e278ba43122c65797415033d6ea
2,000
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 2e5 + 11; ll l[N], r[N]; struct Bridge{ int i; ll len; bool operator < (const Bridge &t)const{ return len==t.len ? i<t.i : len<t.len; } }b[N]; struct Seg{ ll x, y; int i; bool operator <(const Seg &t)co...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
335db429a52b39acc6881ea3b9ffacc3
2,000
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 2e5 + 11; ll l[N], r[N]; struct Bridge{ int i; ll len; bool operator < (const Bridge &t)const{ return len==t.len ? i<t.i : len<t.len; } }b[N]; struct Seg{ ll x, y; int i; bool operator <(const Seg &t)co...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
9a8ea1e7706293496df695e64641b043
2,000
PASSED
#include<iostream> #include<stdio.h> #include<vector> #include<set> #include<algorithm> using namespace std; struct cell { long long int num; long long int state; long long int ind; long long int other; }; cell a[1000001]; bool cmp (cell ex1, cell ex2) { if (ex1.num<ex2.num) return true; if ((ex1.num...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
abe1d49247260d042c624dfa3fc78370
2,000
PASSED
#include <stdio.h> #include <vector> #include <utility> #include <set> #include <algorithm> #include <map> #include <math.h> #define lli long long int #define pii pair<lli,lli> #define psi pair<pii,int> #define MAXN 400005 using namespace std; int n,m; pii num[MAXN]; pii aris[MAXN]; vector <psi> aux; lli res[MAXN]; i...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
07e7904e93fee2bbca036d3fc6694b55
2,000
PASSED
#include <stdio.h> #include <vector> #include <utility> #include <algorithm> #include <map> #include <math.h> #define lli long long int #define pii pair<lli,lli> #define psi pair<pii,int> #define MAXN 400005 using namespace std; int n,m; pii num[MAXN]; pii aris[MAXN]; vector <psi> aux; lli res[MAXN]; int pos[MAXN]; m...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
4991d4099f454e41603b7d1805fff8e2
2,000
PASSED
#include<stdio.h> #include<queue> #include<algorithm> using namespace std; #define ll long long #define smax 200005 struct P { ll start,end; int id; bool operator<(P a)const{return end>a.end;} }map[smax]; struct p { ll l; int id; }di[smax]; ll c[smax*3]; int ans[smax]; int cnt; priority_queue<P> q; ...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
e2f135ef56c23e4beaef6d4db475e704
2,000
PASSED
#include <iostream> #include <stdio.h> using namespace std; #include <algorithm> #include <set> #include <iterator> #define MAXN 200200 struct node{ long long l,r,p; }; bool cmp(node a,node b) { if(a.l>b.l) return true; if(a.l<b.l) return false; if(a.r>b.r) return true; return false; } struct P ...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
b79f2e903384d6f4e1dde4e1e0ca1789
2,000
PASSED
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; #define ll long long int main() { int n, m; ll l1, r1, l2, r2, a; set< pair<pair<ll, ll>, int> > gaps; set< pair<ll, int> > bridges; cin >> n >> m; cin >> l2 >> r2; for (int i = 1; i < n; i++) { l1 = l2, r...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
dcbacf279d0feb3b925e6e18c3dd82f3
2,000
PASSED
#include <iostream> #include <cstdio> #include <set> #include <algorithm> #include <vector> #define fori(i,l,r) for(long i=l;i<=r;i++) #define ford(i,l,r) for(long i=r;i>=l;i--) #define ll long long #define maxN 200005 #define mp make_pair #define fi first #define se second using namespace std; ll a[maxN],l[maxN],r[max...
C++
f7a34711e8a4faa9822d42ef54a0bfc1
6e39603bdac6a9a4b4cf06a53bd6de4c
2,000
PASSED
/* * Author : Echo * Email : 1666424499@qq.com * Description : * Created Time : 2017/9/13 16:05:22 * File Name : 912.cpp */ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <vector> #include <sta...
C++
34eb5063498e0849ecf231a0bd3dfc69
9b8442ade175ebb28c2fe225c86c9f86
1,800
PASSED
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; typedef long long LL; struct point { int d,s,e,c; }a[1000005]; LL s[1000005],e[1000...
C++
34eb5063498e0849ecf231a0bd3dfc69
7c2b3195551985f6935946e0e9947cb4
1,800
PASSED
#include<cstdio> #include<algorithm> using namespace std; #define GC getchar() inline void read(int&n) {int x=0,f=1;char ch=GC;while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=GC;}while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-'0',ch=GC;n=x*f;} const int N=1e5+5,M=1e6+5; int n,m,k; long long cost[N],a[M],b[M]; struct S{int d,f,t,c;...
C++
34eb5063498e0849ecf231a0bd3dfc69
909c52a0c3b6b2dda758d665d0dde7cc
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,k; cin>>n>>m>>k; int date,c1,c2,cost; vector<pair<int,int> > returnFlights[n+2]; vector<pair<int,int> > goFlights[n+2]; for(int i=0;i<m;i++){ cin>>date>>c1>>c2>>cost; if(c1==0){ returnFlights[c2].push_...
C++
34eb5063498e0849ecf231a0bd3dfc69
e7b34ca11f7500c9a8dcbaa8a97301d5
1,800
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <algorithm> #include <cmath> #include <ctime> #include <vector> #include <queue> #include <map> #include <stack> #include <set> using namespace std; typedef long long LL; typedef unsigned long long uLL; #define ms(a, ...
C++
34eb5063498e0849ecf231a0bd3dfc69
5f9246499950b56a150d3b421278412b
1,800
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cstring> /* D. Jury Meeting(TLE) */ using namespace std; typedef long long ll; #define inf (ll)1e17 #define maxn 2100005 struct node { ll day,from,to,cost; } a[maxn]; bool comp(node a, node b) { return a.day < b.day; }...
C++
34eb5063498e0849ecf231a0bd3dfc69
ab02d68b6e9b2bbf04c6fe40143b989d
1,800
PASSED
#include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<vector> #define D 1000005 #define N 100005 using namespace std; typedef __int64 ll; struct node{ int ci,co; node(){} node(int _ci,int _co){ci=_ci;co=_co;} }nod; vector<node> O[D],I[D]; vector<node>::iterator io,ii; int mino[N],mini...
C++
34eb5063498e0849ecf231a0bd3dfc69
b103df8bbec843dcd34fc8f3cf644689
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int n,m,k; # define mx 100101 ll inf,pre[3000102],suf[3000102]; ll tree[mx*4]; struct node{ int d,f,t; ll c; }ar[mx]; bool cmp(node a,node b) { if(a.d==b.d) return a.c<b.c; return a.d<b.d; } ll query(int node,int b,int e,int i,int j) { if(i>e...
C++
34eb5063498e0849ecf231a0bd3dfc69
5df795e55e6c48079746896fdceaef00
1,800
PASSED
// // main.cpp // D // // Created by vincent alek on 9/6/17. // Copyright © 2017 vincent alek. All rights reserved. // #include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; #define fir first #define sec second #define pb push_back typedef pair<int,long long> ii; long ...
C++
34eb5063498e0849ecf231a0bd3dfc69
2db47763ff8dfbb4d3b830fdbb595e4f
1,800
PASSED
/*input */ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef vector <int> vi; typedef vector<vi> vvi; typedef map<int,int> mii; typedef pair<int,int> pii; #define pb push_back #define INF 10000000000005 #define mp make_pair #define MOD 1000000007 #define F first #define S se...
C++
34eb5063498e0849ecf231a0bd3dfc69
c424b1188f67fc329b4170b60c17b344
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fr() front() class graph{ int u,n,height; vector<int>* adj; string* ar; public: int height_max; graph(); void addedge(string src, string dest); int srch(string s); int addnode(string s); void calc(int s,...
C++
16d4035b138137bbad247ccd5e560051
6a1d93a77e5bcc2c0b45c8411164b879
1,200
PASSED
#include<bits/stdc++.h> using namespace std; map<string,int> mp; int mx; int main(){ int n; cin >> n; for(int i = 0 ; i < n ; i++){ string n1 , s , n2; cin >> n1 >> s >> n2; transform(n1.begin(),n1.end(),n1.begin(),::tolower); transform(n2.begin(),n2.end(),n2.begin(),::tolower); mp[n1] = mp[n2]+1; mx = max(...
C++
16d4035b138137bbad247ccd5e560051
55174e447e6bc6e9f3b8a99c21b9c2ab
1,200
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <map> #include <queue> using namespace std; map<string, int> m; int k = 1; int g[1010][1010] = {0}; int vis[510] = {0}; struct node { int v,step; }; queue<node> q; int bfs(int start) { node s; s.v = start; s.step = 1; int res = ...
C++
16d4035b138137bbad247ccd5e560051
66d01a96cc5a97be04de92a52d18a335
1,200
PASSED
#include <iostream> #include <string> using namespace std; int stcmp(string s, string t){ if(s.size()!=t.size()) return 1; for(int i=0; i<s.size(); i++){ if(s[i]!=t[i]) return 1; } return 0; } int main() { int n; cin>>n; string s[n],h,t[n]; int r[n]; f...
C++
16d4035b138137bbad247ccd5e560051
b2d91272f34744e6fea0b4b16a0728d8
1,200
PASSED
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fore(i,n) for(int i = 0; i< n ; i++ ) #define lop(i,n) for(int i = 1 ; i<=n ; i++ ) #define ops(i,n) for(int i = n-1 ; i>=0 ; i-- ) #define forall( it,g ) for( typeof(g.begin()) it=g.begin();it!=g.end();it++ ) #define PI 3.141592653589793 #de...
C++
16d4035b138137bbad247ccd5e560051
95758830b4366c143e7e480596221d89
1,200
PASSED
#include<iostream> #include<algorithm> #include<math.h> using namespace std; string str1[300],str2,str3[300]; long n; string substr[300]; long num,submas[300]; int main(){ cin>>n; cin>>str1[0]>>str2>>str3[0]; for(long i=0;i<str3[0].length();i++){ if(str3[0][i]<'a'){ str3[0][i]+=('a'-'A')...
C++
16d4035b138137bbad247ccd5e560051
8b895caa19c4d9b79081dc7441d988db
1,200
PASSED
#include<iostream> #include<string> #include<vector> #include<stdio.h> #include<map> #include<utility> #include <algorithm> using namespace std; int n; string tolow(string s) { string str=""; for(int i=0;i<s.length();i++) { if(int(s[i])<96 && int(s[i])>60) str+=char(32+(int)(s[i])); else str+=s[i]; } re...
C++
16d4035b138137bbad247ccd5e560051
921a80260599efa1de8af8eb46c9b0ac
1,200
PASSED
#include <bits/stdc++.h> using namespace std; string s1,s2,wlashe; map<string,vector<string> >my; int n,i,now,maxi,j; void dfs(string s) { now++; vector<string>::iterator it2=my[s].begin(); for(it2 ; it2!=my[s].end() ; it2++) dfs(*it2); } int main() { cin>>n; for(i=0 ; i<n ; i++) { ...
C++
16d4035b138137bbad247ccd5e560051
36662bc431c8913c05cc91066272d7b5
1,200
PASSED
#include <iostream> #include <string> #include <map> using namespace std; string s1, s2, s3; map <string, int> dp; string f(string s){ int n = s.size(); for (int i = 0; i < n; i ++) if(17 <= (s[i] - '0') && (s[i] - '0') <= 42){ s[i] = char(s[i] + 32); } return s; } int n, mx; int main(){ cin >> n; for (int ...
C++
16d4035b138137bbad247ccd5e560051
e8b78f6deafc8e50182ff4b84d2b1b85
1,200
PASSED
#include <iostream> #include <string> #include <queue> using namespace std; string s1[222], s2, s3[222]; queue <int> q; int dp[222]; string f(string s){ int n = s.size(); for (int i = 0; i < n; i ++) if(17 <= (s[i] - '0') && (s[i] - '0') <= 42){ s[i] = char(s[i] + 32); } return s; } int n; int main(){ cin >>...
C++
16d4035b138137bbad247ccd5e560051
f17557a98b4eb986f8a04b361df25255
1,200
PASSED
import java.util.Arrays; import java.util.Scanner; public class AverageSuperheroGangPowerB { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int maxPerSuperHeroe = scanner.nextInt(); int totOperations = scanner.nextInt(...
Java
d6e44bd8ac03876cb03be0731f7dda3d
a5ff1f0c751864c30ef7dbb49f95123a
1,700
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class ProbB { public static int n, k, m; public static int[] arr; public static long[] prefixSum; public static void main(String[] args) throws IOException { BufferedRe...
Java
d6e44bd8ac03876cb03be0731f7dda3d
4d2cea39b2f11375c4d70845d2dad58b
1,700
PASSED
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class B1111 { public static void main(String[] args) throws IOException { // BufferedReader br = new BufferedReader(new FileReader("F:/books/input.txt")); Buffer...
Java
d6e44bd8ac03876cb03be0731f7dda3d
6f6aac390fbd2eda39c76cfcf94c4358
1,700
PASSED
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s1[]=br.readLine().split(" "); String s2[]=br.readLine().split(" "); i...
Java
d6e44bd8ac03876cb03be0731f7dda3d
0bc5c7737b3c7961c05f3ffe5809cabb
1,700
PASSED
import static java.lang.Math.*; import static java.lang.Math.min; import static java.util.Arrays.*; import java.util.*; public class B { public Object solve () { int N = sc.nextInt(), K = sc.nextInt(), M = sc.nextInt(); int [] A = sc.nextInts(); sort(A, Collections.reverseOrder()); double [] S = new double ...
Java
d6e44bd8ac03876cb03be0731f7dda3d
91f9bfa42c6075c79af3e68f0edfa2cc
1,700
PASSED
import static java.lang.Math.*; import static java.lang.Math.min; import static java.util.Arrays.*; import java.util.*; public class B { public Object solve () { int N = sc.nextInt(), K = sc.nextInt(), M = sc.nextInt(); int [] A = sc.nextInts(); sort(A, Collections.reverseOrder()); double [] S = new double ...
Java
d6e44bd8ac03876cb03be0731f7dda3d
b713e917779eeb18c8d35982cd06d9a4
1,700
PASSED
import java.io.IOException; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import ...
Java
d6e44bd8ac03876cb03be0731f7dda3d
63998021894c04cb1b7e7301c8366c45
1,700
PASSED
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=s...
Java
d6e44bd8ac03876cb03be0731f7dda3d
e6e9032dcb9481341133da1bb430fa88
1,700
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { Reader in = new Reader(); int n = in.nextInt(); long k = in.nextInt(); ...
Java
d6e44bd8ac03876cb03be0731f7dda3d
a76c418860da8121ad41c49f0ee63795
1,700
PASSED
import java.util.Arrays; import java.util.Scanner; public class TaskB { static class Solution { int n, k, m; int mx; long sum; double ans; int a[] = new int[100001]; int c[] = new int[1000001]; void input() { Scanner scanner = new Scanner(System...
Java
d6e44bd8ac03876cb03be0731f7dda3d
fc281f472c63021266b8d781d06e4d2e
1,700
PASSED
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; const int N = 1005; int a[N*N*2],b[N*N*2],f[N*N*2],v[N*N],xv[N*N],k,key[N*N*4],cover[N*N*4],res; __int64 ret; bool cmp(int x,int y){return a[x]<a[y];} bool cmp1(int x,int y){return xv[x]<xv[y];} void find(int le,int ri,int L,...
C++
de37d373a7b93b9380317ef3813761f6
b005a000861c19a3bc487110a386d5ec
2,700
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _SECURE_SCL 0 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include <iostream> #include <queue> #include <deque> #include <stack> #include <list> ...
C++
de37d373a7b93b9380317ef3813761f6
a95e07df588cf2bbdfd385b964d842e6
2,700
PASSED
/* * temp.cpp * * Created on: 2012-7-18 * Author: BSBandme */ #include <iostream> #include <fstream> #include <string.h> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <queue> #include <cassert> #include <iomanip> #include <math.h> #include <deque> #include <utility> #inc...
C++
de37d373a7b93b9380317ef3813761f6
1758dbbe3ef503f5784550279d2d7cde
2,700
PASSED
#include <cstdio> #include <algorithm> using namespace std; const int SHIFT = 100000000; const int INF = 1000000007; struct Node { const int pl, pr, pm; int a, b; Node *bl, *br; Node(int l, int r, int x): pl(l), pr(r), pm((l + r) / 2), a(x), b(x), bl(nullptr), br(nullptr) { } ~Node() { delet...
C++
de37d373a7b93b9380317ef3813761f6
ce170438015f37276845691f46188658
2,700
PASSED
#define LOCAL /** ` Micro Mezzo Macro Flation -- Overheated Economy ., Ver 0.1 **/ #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <numeric> #include <cstring> #include <cassert> #include <cstdio> #include <string> #include <vector> #inc...
C++
de37d373a7b93b9380317ef3813761f6
3119cd46652367cc788be4ed8d3caebb
2,700
PASSED
#define LOCAL /** ` Micro Mezzo Macro Flation -- Overheated Economy ., Ver 0.1 **/ #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <numeric> #include <cstring> #include <cassert> #include <cstdio> #include <string> #include <vector> #inc...
C++
de37d373a7b93b9380317ef3813761f6
78e4631b79961b326a17526088297473
2,700
PASSED
#include <cstdio> #include <algorithm> using namespace std; const int SHIFT = 100000000; const int INF = 1000000007; struct Node { const int pl, pr, pm; int a, b; Node *bl, *br; Node(int l, int r, int x): pl(l), pr(r), pm((l + r) / 2), a(x), b(x), bl(nullptr), br(nullptr) { } ~Node() { delet...
C++
de37d373a7b93b9380317ef3813761f6
09fba3f650b45e2b4c221d98f7b84dc6
2,700
PASSED
#include <cstdio> #include <algorithm> using namespace std; const int SHIFT = 100000000; const int INF = 1000000007; struct Node { const int pl, pr, pm; int a, b; Node *bl, *br; Node(int l, int r, int x): pl(l), pr(r), pm((l + r) / 2), a(x), b(x), bl(nullptr), br(nullptr) { } ~Node() { delet...
C++
de37d373a7b93b9380317ef3813761f6
de0600100b6d0b27fde6ed54053008f7
2,700
PASSED
/* Author: Zhouxing Shi Created on Dec5, 2014 */ #include <bits/stdc++.h> #define rep(i, a, b) for (int i = (a); i <= (b); ++i) #define drep(i, a, b) for (int i = (a); i >= (b); --i) #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define pb(x) push_back(x) #define mp(x, y) (make_pair(x, y)) #define clr(x)...
C++
de37d373a7b93b9380317ef3813761f6
8f467f2fc2371b7bd156822d31df2d27
2,700
PASSED
#include<iostream> #include<cstdio> #include<map> #include<cstring> #include<cmath> #include<vector> #include<algorithm> #include<set> #include<string> #include<queue> #define inf 100000005 #define M 200005 #define N 2100000 #define maxn 300005 #define eps 1e-10 #define zero(a) fabs(a)<eps #define Min(a,b) ((a)<(b)?(a)...
C++
de37d373a7b93b9380317ef3813761f6
c374b75c5836fa16d5c3516c37efa501
2,700
PASSED
""" // Author : snape_here - Susanta Mukherjee """ from __future__ import division, print_function import os,sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def ii(): return int(...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
3cab0882e5a0974e9fe711aff51968f2
2,000
PASSED
import sys a = b = 0 z = None def zeroQ(a, b): global z if z == None: print "?", a, b sys.stdout.flush() z = int(raw_input()) return z for i in range(29, -1, -1): #print "***", a, b print "?", (a | (1 << i)), b sys.stdout.flush() r1 = int(raw_input()) if r1 =...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
2e3ea411c75cfc1e4cc888f4aeee6d51
2,000
PASSED
from fractions import gcd from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor from itertools import * from fractions import Fraction import string import copy import random import bisect from decimal import * from collections import deque from sys import * digs = string.digits + string...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
a45da592c8fcf19a29c5d8c314cc56e4
2,000
PASSED
print "?", 0, 0 sign = input() curA = curB = 0 for i in xrange(29, -1, -1): c, d = curA ^ (1 << i), curB print "?", c, d s1 = input() c, d = curA, curB ^ (1 << i) print "?", c, d s2 = input() if s1 != s2: if s1 == -1: curA += (1 << i) curB += (1 << i) ...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
bf19edd10226152e9f62dad47cccb6ac
2,000
PASSED
from fractions import gcd from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor from itertools import * from fractions import Fraction import string import copy import random import bisect from decimal import * from collections import deque from sys import * digs = string.digits + string...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
0f96389e95f6a55ae310f2ae789c2f6c
2,000
PASSED
def ask(a, b): print("?", a, b, flush=True) return int(input()) <= 0 def solve(M): a, b = 0, 0 less = ask(0, 0) for i in range(M - 1, -1, -1): bit = 1 << i if less: if not ask(a | bit, b | bit): b |= bit less = ask(a, b) ...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
65631cfe7a23345c94ea547c94d37c2c
2,000
PASSED
'''input ''' def solve(): c,d = 0,0 print("?",c,d,flush=True) ans = int(input()) if ans==0: #both the numbers are equal num = 0 for i in range(29,-1,-1): c = 1<<i d = 0 print("?",c,d,flush=True) ans =int(input()) if ans ==-2: return if ans == -1: num+=(1<<i) print("!",num,num) ...
Python
7dc1137dd1f0c645cc7ec6dfdb92f5df
e8e278c4c177c820d10b4857892b2a8f
2,000
PASSED
fun main() { var without = -2 var with = -2 var a = 0 var b = 0 var bit = 1 shl 29 fun query(c: Int, d: Int): Int { println("? $c $d") return readLine()!!.toInt() } while (bit > 0) { if (without == -2) { without = query(a, b) } with = q...
Kotlin
7dc1137dd1f0c645cc7ec6dfdb92f5df
0637dcb49661625c2a046067e80caa05
2,000
PASSED
import kotlin.system.measureTimeMillis fun ask(a: Int, b: Int): Int { println("? %d %d".format(a, b)) System.out.flush() return readLine()!!.toInt() // val ra = 13455 // val rb = 13456 // val x = (a xor ra) - (b xor rb) // if (x > 0) return 1 // if (x < 0) return -1 // return 0 } fun answ...
Kotlin
7dc1137dd1f0c645cc7ec6dfdb92f5df
c63a60f6c3ae8b825795f361e4aa37f3
2,000
PASSED
// Problem : D. Ehab and another another xor problem // Contest : Codeforces Round #525 (Div. 2) // URL : https://codeforces.com/contest/1088/problem/D // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) import java.io.*; import java.util.*; public class a ...
Java
7dc1137dd1f0c645cc7ec6dfdb92f5df
4c42de655a93ee6e526e32fedf6bd105
2,000
PASSED
from collections import defaultdict n,m = list(map(int,input().split())) freq = [0 for i in range(n+1)] arr = [] f = 0 for i in range(m): u,v = list(map(int,input().split())) if f==0: temp = [u,v] f = 1 p = [u,v] p =set(p) arr.append(p) for i in temp: ans = [] for j in arr: ...
Python
60af9947ed99256a2820814f1bf1c6c6
98b6febd77e082a67c99c8086beb28dc
1,500
PASSED
n,m = map(int,input().split()) my_sets = {}; no_find,no_find1 = False,False a,b = map(int,input().split()); val = [a,b] my_sets.update({a:[b]}); my_sets.update({b:[a]}) for i in range(1,m): x,y = map(int,input().split()) if x not in my_sets.keys(): my_sets.update({x:[y]}) else: my_sets[x].ap...
Python
60af9947ed99256a2820814f1bf1c6c6
a50b0ce869b295d43bc715751f58a839
1,500
PASSED
n,m = map(int,input().split()) my_sets = {}; no_find,no_find1 = False,False for i in range(m): x,y = map(int,input().split()) if x not in my_sets.keys(): my_sets.update({x:[y]}) else: my_sets[x].append(y) if y not in my_sets.keys(): my_sets.update({y:[x]}) else: my_se...
Python
60af9947ed99256a2820814f1bf1c6c6
5c52b257a4fb7e90308bb7f0ea86ed96
1,500
PASSED
class Pair: def __init__(self,x,y): self._data =_data =[x,y] def __setitem__(self, key, value): self._data[key] = value def __getitem__(self,key): return self._data[key] def __len__(self): return len(_data) def __repr__(self): return '{'+str(self._data[0])+','+str(self._data[1])+'}' n,m = map(int,input(...
Python
60af9947ed99256a2820814f1bf1c6c6
04a48e62b372af46b4333e7eb25a5005
1,500
PASSED
n,m=list(map(int,input().split())) a=[] for i in range(m): a.append(list(map(int,input().split()))) b=[0]*m for i in range(m): if a[0][0] in a[i] or a[0][1] in a[i]: b[i]=1 if list(set(b))==[1]: print("YES") else: e=0 for i in range(2): b=[0]*m for j in range(m): ...
Python
60af9947ed99256a2820814f1bf1c6c6
d77b064294e8cbe6def6f8e48ed0c58c
1,500
PASSED
n,m=map(int,input().split()) a,b=map(int,input().split()) ans=1 l1=[] l2=[] for i in range(m-1): x,y=map(int,input().split()) if(x!=a and y!=a): l1.append(x) l1.append(y) if(x!=b and y!=b): l2.append(x) l2.append(y) #print(l1,l2) l3=[0]*300003 for i in range(len(l1)): ...
Python
60af9947ed99256a2820814f1bf1c6c6
a716587d97d8aa0bb70f422eac7014f8
1,500
PASSED
n,m=map(int,input().split()) l=[set() for i in range(n)] for i in range(m): a,b=map(int,input().split()) l[a-1].add(b-1) l[b-1].add(a-1) max1=0 max2=0 k1=0 k2=0 s=0 for i in range(n): if len(l[i])>max1: max1=len(l[i]) k1=i s+=len(l[i]) s=s//2 for i in range(n): t=len(l[i]) if...
Python
60af9947ed99256a2820814f1bf1c6c6
caf5abc1babf50d15b42197310027d17
1,500
PASSED
def get(list): for z in range(2): x=list[0][z] for i in range(m): if x not in list[i]: break else: return 0 for w in range(2): y=list[i][w] for j in range(m): ...
Python
60af9947ed99256a2820814f1bf1c6c6
1268e631e8d1145ca74b9756c004f6fc
1,500
PASSED
n, m = (int(x) for x in input().split(" ")) lala = {} first = [] second= [] x, y = (int(x) for x in input().split(" ")) lala[0] = set([x, y]) first.append(x not in lala[0]) second.append(y not in lala[0]) for i in range(1, m): lala[i] = set(int(x) for x in input().split(" ")) first.append(x not in lala[i]) ...
Python
60af9947ed99256a2820814f1bf1c6c6
6cdbaaf92f20a3d09472bbf1ef87bef8
1,500
PASSED
n, m = input().split(" ") n= int(n) m = int(m) lala = {} first = [] second= [] x, y = input().split(" ") x, y = int(x), int(y) lala[0] = set([x, y]) first.append(x not in lala[0]) second.append(y not in lala[0]) for i in range(1, m): a,b = input().split(" ") a, b = int(a), int(b) lala[i] = set([a, b]) f...
Python
60af9947ed99256a2820814f1bf1c6c6
80b1475420db74c973d012b8605ade3a
1,500
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; // Warning: Printing unwanted or ill-for...
Java
5de66fbb594bb317654366fd2290c4d3
4e5794545917aa3b0155273c89eda074
800
PASSED
import java.util.Scanner; public class train { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); String s = "";int c =0; while (t != 0) { s = in.next();c=0; int a = s.indexOf("1"); int b = s.lastI...
Java
5de66fbb594bb317654366fd2290c4d3
543a506b3c8cdc6c0c8166fc216adbe2
800
PASSED
import java.util.*; import java.math.*; public class test{ public static void main(String []a){ int size; Scanner obj = new Scanner(System.in); size=obj.nextInt(); String sd = obj.nextLine(); for(int i=0;i<size;i++){ int count0=0; Strin...
Java
5de66fbb594bb317654366fd2290c4d3
a847f4b4916f566408f7549a8085352f
800
PASSED
import java.io.*; import java.util.*; public class Main { static BufferedReader br ; public static void main(String[] args) throws Exception{ // write your code here input input = new input(); int tc= input.in(); while (tc-->0){ String s = input.sin(); ...
Java
5de66fbb594bb317654366fd2290c4d3
df50570c4437bf549590215db58e778b
800
PASSED
import java.util.Scanner; public class scratch_36 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int j=0;j<t;j++){ String n=sc.next(); int prev=0; int count=0; int g=n.indexOf('1'); ...
Java
5de66fbb594bb317654366fd2290c4d3
a399272073a430e7dde9bcd8b2d35def
800
PASSED
import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { String str = scanner.next(); int start = 0; while (start < str.length() && str.charAt(start) =...
Java
5de66fbb594bb317654366fd2290c4d3
dda9c6842a7ad787ecade749dd776dd6
800
PASSED