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("omit-frame-pointer") #pragma GCC optimize("unroll-loops") #include <iostream> #include <cstdio> #include <algorithm> #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <map> #include <vector> #include <cstring> #include <iomanip> #include <set> #include <sstream>...
C++
19c32b8c1d3db5ab10aca271135aa9b8
c8ef9f811d2702fca4707bc8be466f83
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; int A[40]; int B[40]; memset(A,0,sizeof(A)); memset(B,0,sizeof(B)); int c=1023; int d=0; char a; cin>>n; int kz; int ...
C++
19c32b8c1d3db5ab10aca271135aa9b8
09eb579b7e160fbfc3ef1a41d66b46a1
1,600
PASSED
#include<cstdio> #include<iostream> int ans1,ans2=1023; int n,x; char c; int main(){ scanf("%d",&n); while(n--){ while(c=getchar(),c=='\n'||c==' '); scanf("%d",&x); if(c=='&')ans1&=x,ans2&=x; if(c=='|')ans1|=x,ans2|=x; if(c=='^')ans1^=x,ans2^=x; } printf("3\n& %d\n^ %d\n| %d\n",1023&ans1|ans2,ans1&(1023...
C++
19c32b8c1d3db5ab10aca271135aa9b8
b4011e87761cea96d080e789815c43c6
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define sz size() #define x first #define y second #define mp make_pair #define mpp(a,b,c) make_pair(make_pair(a,b),c) #define pb push_back #define all(v) v.begin(),v.end() #define EPS 1e-9 #define MOD 1000000007 #define MAX 500005 typedef pair<int,int> pii; typedef long lo...
C++
19c32b8c1d3db5ab10aca271135aa9b8
16bf8209061872d8f3fc645b5296223d
1,600
PASSED
//CF 443 Problem C //10.27 16:16 #include "iostream" #include "cstdio" #include "vector" #include "bitset" #include "map" using namespace std; char c[10] = " ^|&"; int main(){ int n; scanf("%d", &n); int a = 0, b = 1023; for(int i = 1; i <= n; i ++){ char s[2]; int now; sca...
C++
19c32b8c1d3db5ab10aca271135aa9b8
507bffad2fa0edc591a19c97b2cde5c9
1,600
PASSED
#include<iostream> #include<stdio.h> #include<string> #include<string.h> using namespace std; int ans[15]; void judge(int k,char ch){ int index=9; while(k){ if(ans[index]==-1){ if(ch=='&'){ if(!(k&1)) ans[index]=0; } else if(ch=='|'){ if(k&1) ans[index]=1; } else if(ch=='^'){ if(k&1) ans[...
C++
19c32b8c1d3db5ab10aca271135aa9b8
ab4ca044955830d6f527703efb34b101
1,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef int I; typedef double D; typedef long long int LL; typedef long double LD; typedef complex<D> CPX; typedef pair<I,I> PII; typedef pair<LL,LL> PLL; typedef pair<D,LL> PDLL; typedef pair<D,I> PDI; typedef vector<I> VI; typedef vector<LL> VLL; typedef vector<D> VD; t...
C++
19c32b8c1d3db5ab10aca271135aa9b8
47986f69bbd5b7b29361882845870819
1,600
PASSED
//#include <bits/stdc++.h> //* #include <unordered_map> #include <unordered_set> #include <functional> //greater #include <algorithm> //sort #include <iostream> #include <utility> //pair #include <sstream> #include <cstring> //memset #include <cstdio> #include <string> #include <vector> #include <cctype> //isaplha, tol...
C++
19c32b8c1d3db5ab10aca271135aa9b8
e3f7acf078f5d1fd758461b0b143494c
1,600
PASSED
//#include <bits/stdc++.h> //* #include <unordered_map> #include <unordered_set> #include <functional> //greater #include <algorithm> //sort #include <iostream> #include <utility> //pair #include <sstream> #include <cstring> //memset #include <cstdio> #include <string> #include <vector> #include <cctype> //isaplha, tol...
C++
19c32b8c1d3db5ab10aca271135aa9b8
e262f8add7d5db3895ae19382fdbe416
1,600
PASSED
#include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; char ops; int num, tr = 1023, fa = 0, a, b; for(int i = 0; i < n; ++i){ cin >> ops >> num; if(ops == '&'){ fa &= num; tr &...
C++
19c32b8c1d3db5ab10aca271135aa9b8
f364557ee7eb283f63bb10f537428d25
1,600
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<map> #include<queue> using namespace std; #define int long long typedef long long ll; int qpow(int aa,int qq) { int ans=1; while(qq>0) { if(qq%2==0) { qq=qq/2; aa=aa*aa; } else { qq=qq-...
C++
54e9c6f24c430c5124d840b5a65a1bc4
4fd6e89fbde41eae7b72dab8da7c6502
1,500
PASSED
#include<iostream> #include<vector> #include<cstring> #include<algorithm> #include<map> #include<cstdio> #include<queue> using namespace std; typedef long long ll; ll a[100005]; ll qpow(ll a,ll n) { ll ans=1; while(n) { if(n&1) ans=(ll)(ans*a); a=(ll)a*a; n>>=1; } return ans; } ll abs1(ll x) { if(x>0) return...
C++
54e9c6f24c430c5124d840b5a65a1bc4
5bae8cab5e65b6bbb337c850c36635cc
1,500
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int qpow(int base,int power) { int result=1; while(power>0) { if(power%2==0) { power=power/2; base=base*base; } else { power=power-1; result=result*base; power=...
C++
54e9c6f24c430c5124d840b5a65a1bc4
adc913d12252de41ad33be025e3c9696
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int Ull; typedef pair<int ,int> PII; template <typename T> inline T read() { char c=getchar(); T x=0,f=1; while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar()...
C++
54e9c6f24c430c5124d840b5a65a1bc4
6abe81efdf5737414e7ace908562a174
1,500
PASSED
// Code by Prateek Mishra IIT2018199, IIIT Allahabad. /*Input Format: */ #include "bits/stdc++.h" using namespace std; #define eb emplace_back #define fi first #define se second #define ll long long #define ull unsigned long long #define mp make_pair #define MOD 1000000007 #define FastIO ios_base::sync_with_stdio(f...
C++
54e9c6f24c430c5124d840b5a65a1bc4
b8b713f77f7f68f402a5fe9fcfa052f9
1,500
PASSED
// Code by Prateek Mishra IIT2018199, IIIT Allahabad. /*Input Format: */ #include "bits/stdc++.h" using namespace std; #define eb emplace_back #define fi first #define se second #define ll long long #define ull unsigned long long #define mp make_pair ...
C++
54e9c6f24c430c5124d840b5a65a1bc4
e28bc73e0d12108fffbb6a8f65a0bca7
1,500
PASSED
// Code by Prateek Mishra IIT2018199, IIIT Allahabad. /*Input Format: */ #include "bits/stdc++.h" using namespace std; #define eb emplace_back #define fi first #define se second #define ll long long #define ull unsigned long long #define mp make_pair #define MOD 1000000007 #define FastIO ios_base::sync_with_stdio(f...
C++
54e9c6f24c430c5124d840b5a65a1bc4
af9376c4b256f8c13783ed23427feb5c
1,500
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> #define inf 1e15 using namespace std; typedef long long ll; ll mpow(ll a,ll b) { ll ans1=1; while(b) { if(b&1) ans1=ans1*a; a=a*a; b=b/2; } if(a==0) return 0; else return ans1; } int main() { ll n; ll mp[100005]; cin>>n; ll ans=0;...
C++
54e9c6f24c430c5124d840b5a65a1bc4
2791bd1cb626c1571555f08267d1af67
1,500
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> #define inf 1e15 using namespace std; typedef long long ll; ll mpow(ll a,ll b) { ll ans1=1; while(b) { if(b&1) ans1=ans1*a; a=a*a; b=b/2; } if(a==0) return 0; else return ans1; } int main() { ll n; ll mp[100005]; cin>>n; ll ans=0;...
C++
54e9c6f24c430c5124d840b5a65a1bc4
d60b294783a60335724ae705abf377e3
1,500
PASSED
#include <iostream> #include <cstring> #include <string> #include <vector> #include <map> #include <cmath> #include <cstdio> #include <algorithm> #define int long long #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int maxn=1e6+5; int a[maxn]; int qmi(int a,int k) { int an...
C++
54e9c6f24c430c5124d840b5a65a1bc4
81707b2341bf4746e42a3576315815e3
1,500
PASSED
#include "bits/stdc++.h" using namespace std; #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } ...
C++
1522d9845b4ea1a903d4c81644797983
1c8877e73dfa29dcba7413863e7f326a
1,800
PASSED
///In the name of GOD #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MXN = 1e3 + 10; ll n, m, l, r, t, a = 1; ll A[MXN]; vector<pair<ll, ll>> vec; vector<ll> Ans; bool mark[MXN]; int main(){ ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0; i < m; i...
C++
1522d9845b4ea1a903d4c81644797983
844810de647bcdd6f2729b4f456e2d27
1,800
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; const int N = 10005; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n; cin >> n; int m; cin >> m; vector<pair<int,int>> s,us; for(int i=0;i<m;i++) { int t,l,r; cin >> t >>...
C++
1522d9845b4ea1a903d4c81644797983
d39df43a3fb53d6ba87ea262cfc387a4
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define io ios::sync_with_stdio(false) #define pb push_back #define pqueue priority_queue #define fi first #define se second #define ls rt<<1 #define rs rt<<1|1 #define mid (l+r)/2 #define sz(x) (int)(x).size() #define dbg(x) cout<<#x<<"---"<<x<<endl #define mst(x,a) memse...
C++
1522d9845b4ea1a903d4c81644797983
62d7af1220662dc0f9af0dc887eaa2a1
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define io ios::sync_with_stdio(false) #define pb push_back #define pqueue priority_queue #define fi first #define se second #define ls rt<<1 #define rs rt<<1|1 #define mid (l+r)/2 #define sz(x) (int)(x).size() #define dbg(x) cout<<#x<<"---"<<x<<endl #define mst(x,a) memse...
C++
1522d9845b4ea1a903d4c81644797983
64a11b6992b6e776dfe03876e72fcc9d
1,800
PASSED
/* ||| ******* * ******* ******* ******* ||| ||| * * * * * * * ||| ||| * * * * * * * ||| ||| * * * * ...
C++
1522d9845b4ea1a903d4c81644797983
df44d8cc18a4967d701bcf1225f396ea
1,800
PASSED
/* ||| ******* * ******* ******* ******* ||| ||| * * * * * * * ||| ||| * * * * * * * ||| ||| * * * * ...
C++
1522d9845b4ea1a903d4c81644797983
a60fe781907f286ae68f04d220351d7e
1,800
PASSED
/* ||| ******* * ******* ******* ******* ||| ||| * * * * * * * ||| ||| * * * * * * * ||| ||| * * * * ...
C++
1522d9845b4ea1a903d4c81644797983
970c3a71a9666c3fabeb4d9082739f09
1,800
PASSED
#include<bits/stdc++.h> #define fi first #define se second using namespace std; typedef pair<int,int>Ipair; const int Base=(int)1e5; vector<Ipair>srt[2]; int n,m; int a[1005]; vector<int>pp,po; bool ForSort(Ipair a,Ipair b) { if (a.fi!=b.fi) return a.fi<b.fi; else return a.se<b.se; } int main() { ios_base::sync_wi...
C++
1522d9845b4ea1a903d4c81644797983
ab3ce1c3c99cfeac0e847ab0c07e550c
1,800
PASSED
#include<bits/stdc++.h> #define fi first #define se second using namespace std; typedef pair<int,int>Ipair; const int Base=(int)1e5; vector<Ipair>srt[2]; int n,m; int a[1005]; vector<int>pp,po; bool ForSort(Ipair a,Ipair b) { if (a.fi!=b.fi) return a.fi<b.fi; else return a.se<b.se; } int main() { ios_base::sync_wi...
C++
1522d9845b4ea1a903d4c81644797983
7bc01d9197d3b8b8e35b370b679a5d4c
1,800
PASSED
from bisect import bisect_left, bisect_right class Result: def __init__(self, index, value): self.index = index self.value = value class BinarySearch: def __init__(self): pass @staticmethod def greater_than(num: int, func, size: int = 1): """Searches for smallest eleme...
Python
bf60899aa2bd7350c805437d0fee1583
1e327c3c2df59ac803edccf18c165046
1,600
PASSED
import bisect n,m,ta,tb,k=map(int,input().split()) la=list(map(int,input().split())) lb=list(map(int,input().split())) la.sort() lb.sort() laa=[i+ta for i in la] lbb=[i+tb for i in lb] mx=-1 lol=0 if(k>=n or k>=m): lol=1 else: for i in range(0,k+1): a=laa[i] ind=bisect.bisect_right(lb,a) ...
Python
bf60899aa2bd7350c805437d0fee1583
aa9bac1cac78b3da523d29767a070599
1,600
PASSED
n,m,ta,tb,k = map(int,input().split()) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] res = -1 j = 0 if k < len(A): for i in range(k+1): if i < len(A): t = A[i] + ta while j < len(B) and B[j] < t: j += 1 togo = k - i ...
Python
bf60899aa2bd7350c805437d0fee1583
13d75fa3f325a4655562994ac8deb102
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int ans; int main () { int n; scanf("%d", &n); if(n == 1) { scanf("%d", &ans); if(ans == 1) puts("YES"); else puts("NO"); return 0; } int cnt = 0; for(int i = 1;i <= n; ++i) { scanf("%d", &ans); if(ans == 0) ++cnt; } if(cnt == 1) puts...
C++
7db0b870177e7d7b01da083e21ba35f5
132c232312e2a86ede2d022ed1db2b4f
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int i, j, n, c = 0; cin >> n; for(i = 0; i < n; i++){ scanf("%d", &j); if(j == 0) c++; } if(n == 1){ if(j) printf("YES\n"); else printf("NO\n"); } else{ if(...
C++
7db0b870177e7d7b01da083e21ba35f5
d4a5a2fd45d5f7c780d0e954cbbfa65d
1,000
PASSED
#include <iostream> using namespace std; int main() { int n,k,t=0,y=0; cin>>n; y=n; while(y--){ cin>>k; if(k==1) t++; } //cout<<t<<n; if(n==1 && k==1) cout<<"YES\n"; else if(n>1 && t == n-1)cout<<"YES\n"; else cout<<"NO\n"; return 0; }
C++
7db0b870177e7d7b01da083e21ba35f5
0b2dd7d36afa1b510bf6fbf34d01b18f
1,000
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<cmath> #include<algorithm> #include<queue> using namespace std; int main() { int n, a; scanf("%d", &n); if (n==1) { scanf("%d", &a); if (a==1) { printf("YES\n"); } else printf("NO\n"); } else { int...
C++
7db0b870177e7d7b01da083e21ba35f5
c02e391a7f3fa8519ee7f3fdc80f0444
1,000
PASSED
#include<iostream> #include<vector> using namespace std; int n,t; vector<int> v; int main() { int count = 0; cin >> n; if (n == 1) { cin >> t; if(t==1) cout << "YES"; else cout << "NO"; } else { for (int i = 0; i < n; i++) { cin >> t; v.push_back(t); } for (int i = 0; i < v.size(); i++) { i...
C++
7db0b870177e7d7b01da083e21ba35f5
8590b5c8b3c17aca1d95438ceab36ef4
1,000
PASSED
#include<iostream> #include<stdlib.h> #include<conio.h> #include<math.h> using namespace std; int main() { setlocale(LC_ALL,"rus"); int n; cin>>n; int k; int l=0,m=0; int i=0; while(n>i) { cin>>k; if (k==0) { l++; } else if (k==1) { m++; } i++; } // cout<<m<<" "<<i; if (n==1 && k==1) { ...
C++
7db0b870177e7d7b01da083e21ba35f5
fe712ecf5e6197d00d860ac2f4908a37
1,000
PASSED
#include<iostream> using namespace std; #include<vector> int main() { int x, n, t = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> x, t += x; } cout << ((n == 1) ? ((t == 1) ? "YES" : "NO") : (t == n - 1) ? "YES" : "NO"); return 0; }
C++
7db0b870177e7d7b01da083e21ba35f5
ac884fae02d66a86c8b4cd9767d1fe9f
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int n,x,sum; int main(){ scanf("%d",&n); if(n==1){ scanf("%d",&x); if(x==0)printf("NO"); else printf("YES"); return 0; } for(int i=0;i<n;i++){ scanf("%d",&x); if(x==0) sum++; } if(sum==1)prin...
C++
7db0b870177e7d7b01da083e21ba35f5
d674c9a7ae27c496657cf0cb369ce848
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define SC scanf #define PR printf #define pb push_back #define mp make_pair #define SZ(v) ((int)(v).size()) #define rep(i,n) for(int i=0;i<(n);i++) #define ll long long typedef pair<int,int> pii; typedef pair<pii,int> ppi; typedef pair<int,pii> pip; typedef pair<pii,pii> pp...
C++
7db0b870177e7d7b01da083e21ba35f5
7d533c89bca59bd4666b91e5c93d5db2
1,000
PASSED
#pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC once %:pragma GCC optimize("Ofast") %:pragma GCC optimize("inline") %:pragma GCC optimize("-fgcse") %:pragma GCC optimize("-fgcse-lm") %:pragma GCC optimize("-fipa-sra") %:pragma GCC optimize("-ftree-pre") %:pragma GCC optimize("-ftree-vrp") %:pragma GCC optim...
C++
7db0b870177e7d7b01da083e21ba35f5
d8c658e0fdde07efc402598f3de6e6de
1,000
PASSED
#include<cstdio> #include<algorithm> #define fi first #define se second #define mp std::make_pair typedef long long ll; typedef std::pair<ll,ll> pll; const int N=300005; int n,m,top;pll a[N];ll k,b; double slope(pll a,pll b){return 1.0*(a.se-b.se)/(a.fi-b.fi);} ll calc(pll x){return k*x.fi+b+x.se;} int main(){ scanf("...
C++
9e333fd8d678f5e38e92722452452a69
a002c7f3e205745ada6fd2035ba1f83a
2,700
PASSED
#include<bits/stdc++.h> using namespace std; const double eps = 1e-9; const int maxn = 1023000; struct Point { long long x, y; Point(){} Point(long long _x, long long _y) { x = _x, y = _y; } Point operator -(const Point &b)const ...
C++
9e333fd8d678f5e38e92722452452a69
6868093c14e6f97ce69cb83a994b1b75
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define reg register typedef long long ll; #define eps 1e-6 #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++) static char buf[100000],*p1=buf,*p2=buf; inline int read(void){ reg char ch=getchar(); reg int res=0; while(ch<'0'||'9'<ch)ch=g...
C++
9e333fd8d678f5e38e92722452452a69
3a3457a965b8b29ec56502e8b3d90ca8
2,700
PASSED
#include<bits/stdc++.h> using namespace std; const double eps = 1e-9; const int maxn = 1023000; struct Point { long long x, y; Point(){} Point(long long _x, long long _y) { x = _x, y = _y; } Point operator -(const Point &b)const ...
C++
9e333fd8d678f5e38e92722452452a69
a2556cf9d67af4941baafb996faf440d
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long void read(int &x) { x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f; for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f; } void print(int x) { if(x<0) putchar('-'),x=-x; if(!x) return ;print(x/10...
C++
9e333fd8d678f5e38e92722452452a69
88a5b8ee1bb2a1d0a93ad664aefe796f
2,700
PASSED
//https://codeforces.com/contest/1137/problem/E #include<iostream> #include<cstdio> #include<cstring> #define maxn 300000 #include<algorithm> using namespace std; typedef long long ll; typedef long double db; inline void qread(int& x) { x=0; int sign=1; char c=getchar(); while(c<'0'||c>'9') { if(c=='-') sign=-1;...
C++
9e333fd8d678f5e38e92722452452a69
85f9512958c1177d543de2bb86f7ca03
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int N=300005; pair <ll,ll> s[N]; int top=0;ll add=0,mul=0; void pop(){ while (top>1) if (s[top].second*mul+s[top].first>=s[top-1].second*mul+s[top-1].first) --top; else break; } double cross(pair<ll,ll> a,pair<ll,ll> b,pair<ll,ll> c){ double...
C++
9e333fd8d678f5e38e92722452452a69
372fe871cfa7598d906ae7d533a80e8d
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define reg register typedef long long ll; #define eps 1e-6 //#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++) static char buf[100000],*p1=buf,*p2=buf; inline int read(void){ reg char ch=getchar(); reg int res=0; while(ch<'0'||'9'<ch)ch...
C++
9e333fd8d678f5e38e92722452452a69
45207665ff853aaa4e5285d70bf060f8
2,700
PASSED
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int N=3e5+2; typedef long long ll; typedef long double db; ll st[N],zb[N],k,b,cd,y; int tp,m,c,x; inline void read(int &x) { c=getchar(); while ((c<48)||(c>57)) c=getchar(); x=c^48;c=getchar(); while ((c>=48)&&(c<=57)) { x=x*1...
C++
9e333fd8d678f5e38e92722452452a69
2c41f55fe4e564fdbc83e34bf3eefb61
2,700
PASSED
#include <iostream> #include <cstdio> #include <array> #include <deque> using namespace std; using ll = long long; #define tl(X) static_cast<ll>(X) const ll INF = 1e18; ll divf(ll n, ll d) { if(d < 0) n*=-1, d*=-1; if(n < 0) return -((-n+d-1)/d); return n/d; } using i2 = array<ll, 2>; struct L { public: ll ...
C++
9e333fd8d678f5e38e92722452452a69
3acd5bc98330cc5041843edaaeb56457
2,700
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> #include <climi...
C++
877ee29229b72d37a70c693ff504b5da
d6acc3d7aae137f4e6e9964b56da519a
2,600
PASSED
#define _CRT_SECURE_NO_DEPRECATE #include <ctime> #include <float.h> #include <algorithm> #include <string> #include <vector> #include <queue> #include <iostream> #include <cmath> #include <sstream> #include <map> #include <set> #include <cstring> #include <cstdio> using namespace std; #define pb push_back #define inf ...
C++
877ee29229b72d37a70c693ff504b5da
e09fa9d37c0d4d93fc9ce480a17c0249
2,600
PASSED
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> typedef long long ll; typedef long double ld; using namespace std; const int MAXN...
C++
877ee29229b72d37a70c693ff504b5da
e67baf37c8d9f66cb7b1869776b92581
2,600
PASSED
#include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define RI(X) scanf("%d", &(X)) #define RII(X, Y) scanf("%d%d", &(X), &(Y)) #define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y...
C++
877ee29229b72d37a70c693ff504b5da
33343632dca2d3fe7984ef4a4450b7a0
2,600
PASSED
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <deque> #include <list> #include <iterator> #include <functional> #include <sstream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <c...
C++
877ee29229b72d37a70c693ff504b5da
454708ce0e42a4c992eabbaf93f1e820
2,600
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <stdio.h> #include <map> using namespace std; int n, m; vector < int > ptr, used, od; vector < vector < pair <int, int> > > g; vector < pair <int, int> > answer; void euler_cycle(int v) { while( ptr[v] < g[v].size...
C++
877ee29229b72d37a70c693ff504b5da
bd802af72454d343092de3fc406438fc
2,600
PASSED
#include <algorithm> #include <string> #include <vector> #include <queue> #include <iostream> #include <cmath> #include <sstream> #include <map> #include <set> #include <numeric> #include <memory.h> #include <cstdio> #include <assert.h> using namespace std; #define pb push_back #define INF 1011111111 #define FOR(i, a...
C++
877ee29229b72d37a70c693ff504b5da
fb9435303c0a2c052f9b14c78e11fb8f
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #if defined(ILIKEGENTOO) void E(){}template<class A,class...B>void E(A _,B...$){cerr<<' '<<_;E($...);} #define E($...) E(#$,'=',$,'\n') #else #define E($...) ; #endif #define all(x) begin(x), end(x) int n, m; typedef tuple<int, int, int> Edge; vector<Edge> edges; struct ...
C++
877ee29229b72d37a70c693ff504b5da
acd458dffbc8b0115e09e36c3b8631ae
2,600
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 100010 #define M 800010 int n, m, h[N], p[M], n1[M], ee, st[N * 4], top, d[N], b[N], tot; bool vis[M]; void ae(int x, int y){ p[ee] = y; n1[ee] = h[x]; h[x] = ee ++; } void dfs(int u){ for(;~h[u];h[u] = n1...
C++
877ee29229b72d37a70c693ff504b5da
52c335a6839d610e7b5869d006ba0aa4
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define pb push_back #define f(i,x,y) for(int i = x; i<y; i++ ) #define FORV(it,A) for(vector<int>::iterator it = A.begin(); it!= A.end(); it++) #define FORS(it,A) for(set<int>::iterator it = A....
C++
877ee29229b72d37a70c693ff504b5da
296ba2d13c084ada0598a382e5f29f42
2,600
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum; scanf("%d",&n); for(int i=0;i<n;i++){ int a,b; scanf("%d%d",&a,&b); if(a==b)continue; if(a>b)sum++; else sum--; } if(sum>0)printf("Mishka"); else if(sum<0)printf("Chris"); else printf(...
C++
76ecde4a445bbafec3cda1fc421e6d42
b327218448c21a1a8d309d1be085a0dc
800
PASSED
#include<iostream> using namespace std; int n,a[105],b[105],m,s; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]>>b[i]; if(a[i]<b[i])s++; if(a[i]>b[i])m++; } if(s==m)cout<<"Friendship is magic!^^"; if(s>m)cout<<"Chris"; if(s<m)cout<<"Mishka"; return 0; }
C++
76ecde4a445bbafec3cda1fc421e6d42
5a6e57f0af2c5a1461ecc64115162065
800
PASSED
#include <iostream> using namespace std; int main() { int n,a,b,score=0; cin>>n; for (int i=1; i<=n; i++) { cin>>a>>b; if (a>b) score++; if (a<b) score--; } if (score>0) cout<<"Mishka"; if (score<0) cout<<"Chris"; if (score==0) cout<<"Friendship is magic!^^"; ...
C++
76ecde4a445bbafec3cda1fc421e6d42
38dd3ae82f02fd763c4eb5d18861d3e6
800
PASSED
#include<iostream> using namespace std; int main() { int n,a,b,cnt=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a>>b; if(a>b) { cnt++; } else if(a<b) { cnt--; } } if (cnt>0) { cout<<"Mishka"; } else if(cnt<0) { cout<<"Chris"; } else ...
C++
76ecde4a445bbafec3cda1fc421e6d42
ff08af68ad143f35b76f26f9c58934ac
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,a,b,ans1=0,ans2=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b; a>b?ans1++:a<b?ans2++:ans1=ans1; } ans1>ans2?puts("Mishka"):ans1<ans2?puts("Chris"):puts("Friendship is magic!^^"); return 0; }
C++
76ecde4a445bbafec3cda1fc421e6d42
e099810492fec0424e92e860f920e9a8
800
PASSED
/*如果Mishka是这场游戏的胜利者,仅输出一行"Mishka"(不含引号)。 如果Chris是这场游戏的胜利者,仅输出一行"Chris"(不含引号)。 如果这场游戏是平局,仅输出一行"Friendship is magic!^^"(不含引号)。*/ #include <iostream> using namespace std; int main(){ short n; short m=0,c=0; cin>>n; short ms,cs; for(short i=0;i<n;i++){ cin>>ms>>cs; if(ms>cs)m+=1; ...
C++
76ecde4a445bbafec3cda1fc421e6d42
5213e91d9bc012bc17fccc25a7493411
800
PASSED
#include<bits/stdc++.h> using namespace std; int a,b,c,d,n,m; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>m>>c; if(m>c){ a++; } if(m<c){ b++; } if(m=c){ a++; b++; } } if(a==b){ cout<<"Friendship is magic!^^"<<endl; return 0; } if(a<b){ cout<<"Chris"<<endl; return 0; } if(a...
C++
76ecde4a445bbafec3cda1fc421e6d42
ed0ca3613bb7d751ea93752ecd3a81c6
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m,c,ms=0,cs=0; cin>>n; for(int i=1;i<=n;i++) { cin>>m>>c; if(m>c) { ms++; } if(m<c) { cs++; } } if(ms>cs){ cout<<"Mishka"; return 0; } if(ms==cs) { cout<<"Friendship is magic!^^"; return 0; } i...
C++
76ecde4a445bbafec3cda1fc421e6d42
4265777c71da0a6d2b6b7befd2005aed
800
PASSED
#include <iostream> #include <cstdio> using namespace std; int main() { int n; cin >> n; int cntm=0,cntc=0; while(n--) { int m,c; cin >> m >> c; if(m>c) cntm++; else if(m<c) cntc++; else continue; } if(cntm>cntc) cout << "Mishka" << endl; else if(cntm<cntc) cout << "Chris" << endl; else cout << "Frie...
C++
76ecde4a445bbafec3cda1fc421e6d42
73ba259731cc5a7cb8a64e8e24de936e
800
PASSED
#include<bits/stdc++.h> using namespace std; int n,ans1=0,ans2=0; int main() { scanf("%d",&n); int x1,x2; for (int i=1;i<=n;i++) { scanf("%d%d",&x1,&x2); if (x1>x2) ans1++; if (x2>x1) ans2++; } if (ans1>ans2) printf("Mishka"); if (ans1==ans2) printf("Friendship is magic!^^"); if (ans1<ans2) printf("Chris"...
C++
76ecde4a445bbafec3cda1fc421e6d42
9cc2c5b600c74781cde1614903f71fd6
800
PASSED
use std::cmp::Ordering::{Equal, Greater}; use std::fmt::Debug; use std::io::stdin; use std::str::FromStr; const EPS: f64 = 1e-9; fn read_line() -> String { let mut buf = String::new(); stdin().read_line(&mut buf).expect("Failed to read a line"); buf } fn read_vector<T>() -> Vec<T> where T: FromStr, ...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
0a49cfb5a0ed117dcb07b41f0e1c26b2
1,200
PASSED
struct Scan { buffer: std::collections::VecDeque<String> } impl Scan { fn new() -> Scan { Scan { buffer: std::collections::VecDeque::new() } } fn next<T: std::str::FromStr>(&mut self)-> T { loop { if let Some(token) = self.buffer.pop_front() { break token.pa...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
b16f14c444a2c9dd6a0b26148e7f2fca
1,200
PASSED
use std::io; use std::io::Stdin; use std::str::FromStr; fn read_line(stdin : &Stdin, line : &mut String) { match stdin.read_line(line) { Ok(_) => return, Err(msg) => panic!("Could not read line! Message: {}.", msg), } } fn parse_t<T : FromStr>(s : &str) -> T { match s.trim().parse() { ...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
f8f8fd7f028eb8f2bc93db2e414c308c
1,200
PASSED
fn solve() { let (n, l): (usize, u32) = { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); let mut ws = buf.split_whitespace(); let n = ws.next().unwrap().parse().unwrap(); let l = ws.next().unwrap().parse().unwrap(); (n, l) }; let m...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
da1299fb756dd8008fc96fdf9c83c238
1,200
PASSED
use std::io; fn read_line() -> String { let mut input_line = String::new(); io::stdin().read_line(&mut input_line).unwrap(); return String::from(input_line.trim()); } fn read_line_vec() -> Vec<u64> { return read_line().split(' ') .map(|s| s.parse().unwrap()) .collect(); } fn read_lin...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
b43c741e0188f543629d16d9030f5960
1,200
PASSED
fn main() { let v: Vec<i32> = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim() .split(" ") .map(|s| s.parse::<i32>().unwrap()) .collect() }; let (n, l) = (v[0], v[1]); let mut v: Vec<i32> = { l...
Rust
d79166497eb61d81fdfa4ef80ec1c8e8
5216143ae1353994fa64a41b0402a39a
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,i; long int l; long int d,p; cin>>n>>l; long int a[n]; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); p = (a[0]>=l-a[n-1]) ? 2*a[0] : 2*(l-a[n-1]); for(i=0;i<n-1;i++) { d=a[i+1]-a[i]; if(d>p) p=d; } long int k = p/2; cout<<k; if (p%2==1) ...
C++
d79166497eb61d81fdfa4ef80ec1c8e8
c8821d19c5d6a9d599e4c26cbd333657
1,200
PASSED
#include <stdio.h> #include <algorithm> using namespace std; int n,i,a[100500],rez,l; int main() { scanf("%d%d",&n,&l); for (i = 0; i < n; i++) scanf("%d",&a[i]); sort(a,a+n); rez = 2*max(a[0],l-a[n-1]); for (i = 0; i < n-1; i++) rez = max(rez, a[i+1]-a[i]); printf("%.10f\n",rez/...
C++
d79166497eb61d81fdfa4ef80ec1c8e8
1b208dc6ab57880bb0fe17372d73b390
1,200
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { int n, l, r; cin >> n >> l; int p[n]; for (int i = 0; i < n; i++) cin >> p[i]; sort(p, p + n); r = max(p[0], l - p[n - 1]) * 2; for (int i = 0; i < n - 1; i++) r = max(r, p[i + 1] - p[i]); cou...
C++
d79166497eb61d81fdfa4ef80ec1c8e8
8ee5092f294769a131e89530872b0074
1,200
PASSED
#include <iostream> #include <string> #include <vector> #include <sstream> #include <algorithm> #include <cmath> #define ull unsigned long long int #define ll long long int using namespace std; int main() {int n; ll l; scanf("%d%I64d",&n,&l); ll *a= new ll[n]; for(int i=0;i<n;i++) { cin>>a[i]; } sort(a,a+n); ll b=...
C++
d79166497eb61d81fdfa4ef80ec1c8e8
05661c0e658e3617aa981ab99005f57a
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,m,k,p=0; cin>>n>>m>>k; int arr[m+1]; for(int i=0;i<=m;++i)cin>>arr[i]; for(int i=0;i<m;++i){ int pp=n,temp=0,t=1; while(pp--){ if(((arr[m] ^ arr[i]) & t) >0)temp++; t <<= 1; } ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
18f94c7bdae24e556735bdaa62801550
1,100
PASSED
#include <iostream> using namespace std; int main() { int a[1000]; int n, m, k; cin >> n >> m >> k; for (int i = 0; i < m + 1; i++) cin >> a[i]; int friends = 0; for (int i = 0; i < m; i++) { int t = 0; for (int j = 0; j < n; j++) if (((a[i] >> j) & 1)...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
bbf37ba600e185a1ec9f2f00fb7a6bd3
1,100
PASSED
#include <iostream> #include<cmath> using namespace std; int main() { int n, m, k; int friends=0; cin>>n>>m>>k; int a [1001]; for (int i=0; i<m+1; i++) cin>>a[i]; for (int j =0; j<m; j++){ int t=0; for (int s=0; s<n; s++) if ( ((a[j]>>s)&1) != ((a[m]>>s)&1)) t++; if (t<=k) ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
7cd209d4b68256f330b022d75f89f114
1,100
PASSED
#include <bits/stdc++.h> using namespace std; void bin(int x,int arr[][20],int i) { int j=0; while(x) { if(x%2!=0) arr[i][j]=1; j++; x/=2; } return; } int main() { int n,m,k,x,c=0; cin>>n>>m>>k; int d2[m+1][20]={ }; ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
cd064f9386c4a922818e4a4ca4b00954
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,m,k,x,c=0; cin>>n>>m>>k; int d2[m+1][20]={ }; for(int i=0;i<m;i++) { cin>>x; int j=0; while(x) { if(x%2!=0) d2[i][j]=1; j++; x/=2; } } ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
d89c1a297b0d4e7ef36472d07df5e0f6
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m,k; cin>>n>>m>>k; int count=0; bitset<32> arr[m+10]; for(int i=0;i<m+1;i++) { int x; cin>>x; arr[i]=x; } for(int i=0;i<m;i++) { int k_diff=0; for(int j=0;j<32;j++) { ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
48c342c30ca33a5a387eec185879cf37
1,100
PASSED
// Sample code to perform I/O: #include <bits/stdc++.h> using namespace std; int main() { short int n, m, k; cin>>n>>m>>k; vector<long long int>v; long long int x; long long int f; long long int A, B; short int count = 0; for(int i =0; i <=m; i++){ cin>>x; v.push_back(x); } f = v[m]; for(in...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
83799a5d75582e065eff38dbd2638057
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; int main() { ll n,m,k; cin>>n>>m>>k; vector<ll>x,y,z; for(ll i=0;i<=m;i++) { ll c; cin>>c; x.push_back(c); } ll t=x[x.size()-1]; ll c=0; for(ll i=0;i<x.size()-1;i++) { ll r=0; ll s=t; ll e=x[i]; for(int j=0;j<n;j++) { ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
b60beeb802528d0208a01f887901c1b8
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,m,k,i,j; cin>>n>>m>>k; int a[m+1],count=0,ans=0,temp; for(i=0; i<m+1; i++) cin>>a[i]; for(i=0; i<m; i++) { temp = a[i]^a[m]; count=0; while(temp>0) { if(temp%2) count++; temp /= 2; } if(count<=k) ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
14762c19ff898172abfac6af926366d6
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,m,k,i,j; cin>>n>>m>>k; int x,bin[m+1][20]={0},count=0,ans=0; for(i=0; i<m+1; i++) { cin>>x; j=0; while(x>0) { bin[i][j] = x%2; x /= 2; j++; } } for(i=0; i<m; i++) { count=0; for(j=0; j<20; j++) { ...
C++
5ebb0ee239d68ea33d9dac2d0bdd5f4e
310df31d5a089192b3e69e441089740d
1,100
PASSED
#include<bits/stdc++.h> #define MOD 1000000007 #define ll long long int #define deb(x) cerr<<#x<<" "<<x<<endl; using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin>>s; vector<vector<int>> seq; vector<int> a,b; int n = s.length(); for(int i=0;i<n;i++){ bool ...
C++
37b34461876af7f2e845417268b55ffa
cb435d70dda074dabeb8946b9c1a2198
1,600
PASSED
#include<bits/stdc++.h> #define MOD 1000000007 #define ll long long int #define deb(x) cerr<<#x<<" "<<x<<endl; using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin>>s; vector<vector<int>> seq; vector<int> a,b; int n = s.length(); for(int i=0;i<n;i++){ bool ...
C++
37b34461876af7f2e845417268b55ffa
ba95e5e3f3f5e54e220d971eb7c26350
1,600
PASSED
#include<bits/stdc++.h> #define MOD 1000000007 #define ll long long int #define deb(x) cerr<<#x<<" "<<x<<endl; using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin>>s; vector<vector<int>> seq; vector<int> a,b; int n = s.length(); for(int i=0;i<n;i++){ bool ...
C++
37b34461876af7f2e845417268b55ffa
4ca16fe92a9dd559e517a05efdcd3a0d
1,600
PASSED
#include <vector> #include <stack> #include <iostream> #include <unordered_map> #include <unordered_set> #include <map> #include <iomanip> #include <set> #include <functional> #include <fstream> #include <algorithm> #include <cassert> #include <cmath> #include <string> #include <sstream> #include <queue> #include <bits...
C++
37b34461876af7f2e845417268b55ffa
a4a0dfebcc9d53e61a406ab7b989642f
1,600
PASSED
#include<cstdio> #include<cstring> #include<vector> const int N=2e5+3; int n,p[2][N],f[N],k;char a[N]; std::vector<int>ans[N]; int Find(int k,int*p){return p[k]==k?k:p[k]=Find(p[k],p);} int main(){ scanf("%s",a+1),n=strlen(a+1); p[0][n+1]=p[1][n+1]=n+1; for(int i=n;i;i--){ p[0][i]=a[i]=='0'?p[0][i+1]:i; p[1][i...
C++
37b34461876af7f2e845417268b55ffa
d747c35a4ddb90a777f42c87649ffb5c
1,600
PASSED
#include<vector> #include<string.h> #include<iostream> #include<queue> using namespace std; vector<int> a[200001]; queue<int> q1,q2; int main(){ int q=0,t; string s; cin>>s; for(int i=0;i<s.size();i++){ if(s[i]=='1'){ if(q2.empty()){ cout<<"-1";return 0; } t=q2.front();q2.pop(); a[t].push_back(i+1...
C++
37b34461876af7f2e845417268b55ffa
0d3643dc3e4c5b5291ced2668efece19
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 1.01E6; vector <int> ans[MAXN]; char C[MAXN]; int A[MAXN]; int B[MAXN]; int n, top1, top2; int main(void) { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> (C + 1), n = strlen(C + 1); for (int i = 1;i <= n; ++i) { if (C[i] == '0') { if ...
C++
37b34461876af7f2e845417268b55ffa
fd1d74008ad379d9ff768cbf1d0cc19f
1,600
PASSED