source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<stdio.h> #include<iostream> #include<sstream> #include<queue> #include<math.h> #include<stdlib.h> #include<stack> #include<string.h> #include<string> #include<map> #include<algorithm> #include<time.h> #include<set> #include<vector> #include <numeric> using namespace std; #define _2d(a,row,col,type) type**a=ne...
C++
3c066bad8ee6298b318bf0f4521c7c45
17344670a4b32155a4ac765b65d9d176
1,000
PASSED
#include<stdio.h> #include<string.h> #include<algorithm> #include<queue> using namespace std; const int maxn=1e5+10; int n; long long v[maxn],t[maxn],sum[maxn]; struct node{ int pos; long long num; friend bool operator < (const node &a,const node &b) { return a.num>b.num; } }; priority_queue<node> qu; int main(...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
857f873ea0bc748da298c8477e4995ed
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+5; long long n, v[maxn], t[maxn]; long long ans[maxn]; priority_queue<long long, vector<long long>, greater<long long> > Q; int main () { cin >> n; for (int i = 1; i <= n; ++i) cin >> v[i]; for (int i = 1; i <= n; ++i) cin ...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
532c83a7cdcc9632f7026b5953f54285
1,600
PASSED
#pragma warning(disable:4996) #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; int n, a[maxn], b[maxn], bit[maxn]; ll sum[maxn], ans[maxn]; void Update(int i, int x) { while (i <= n) { bit[i] += x; i += i & -i; } ...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
091705063f43fd4b8fa6e3ac926cd1e8
1,600
PASSED
#pragma warning(disable:4996) #include <iostream> #include <queue> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; int n, a[maxn]; priority_queue<ll, vector<ll>, greater<ll> > q; int main() { while (scanf("%d", &n) != EOF) { while (!q...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
53b023031c42c62daac4a7c4dd9765cb
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define eb emplace_back #define fff ff #define sss ss.ff #define ttt ss.ss #define INF (1 << 30) #define LLF (1ll << 60) #define PRIME (1000000007) #define FASTIO std::ios::sync_with_stdio(false) typedef long long l...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
1dc2959e5caf043f5b056e8bb25fa1d2
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main() {long long n,i,j,l,op; long long x[100001]; long long y[100001]; cin>>n; for(i=0;i<n;i++)cin>>x[i]; for(i=0;i<n;i++)cin>>y[i]; for(i=1;i<n;i++){x[i]=x[i]+y[i-1];y[i]=y[i]+y[i-1];} sort(x,x+n); j=0;l=0; for(i=0;i<n;i++){ op=0; l++; while((y[i]>=x[j...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
d48b87c2520e87c314243159352ebd84
1,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll a[100001]; ll T[100001]; int main(int argc, char const *argv[]){ int n, v; scanf("%d", &n); for(int i = 0; i < n; ++i) scanf("%d", &a[i]); T[0] = 0; for(int i = 0; i < n; ++i) { scanf("%d", &v); T[i+1] = T[i] + v; a[i] += T[i]; } mult...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
786a3c44b209880ae57e4ca9c10f16ed
1,600
PASSED
#include<iostream> #include<stdio.h> #include<cmath> #include<queue> #include<algorithm> #include<cstring> using namespace std; long long cnt,a[100005],t,ans=0,sum[100005]={0},tmp,v[100005]; int main() { long long n,i,j; while(~scanf("%I64d",&n)) { memset(sum,0,sizeof(sum)); memset(a,0,size...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
31f3a94fe66eab97aee461641f5da3bb
1,600
PASSED
/** In the name of Allah, the Most Gracious, the Most Merciful. **/ #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 5; ll ara[N], tem[N], sum[N], cnt[N], rem[N], ans[N]; int main() { #ifdef _OFFLINE_ freopen("E.txt", "r", stdin); #endif ///...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
6029454d5326592db869831694f9124a
1,600
PASSED
#include<bits/stdc++.h> #include<math.h> using namespace std; /* **************** */ #define fast ios_base::sync_with_stdio(false);cin.tie(NULL) #define mod 1000000007 #define add(a, b) (a%mod)+(b%mod)%mod #define mul(a, b) (a%mod)*(b%mod)%mod #define pb push_back #define all(a) a.begin(),a.end() #define zero(a) memse...
C++
e3bc82acf70071b0e6d20a5b4fccbfba
d079a23b84a04bd16aed44a17b3215c1
1,600
PASSED
#include <iostream> #include <algorithm> #include <cmath> using namespace std; int main() { int sum=0; double a1[5], a2[5], hs, hu, a[]={500,1000,1500,2000,2500}; for(int i=0; i<5; i++) cin>>a1[i]; for(int i=0; i<5; i++) cin>>a2[i]; cin >> hs >> hu; for(int i=0; i<5; i++) ...
C++
636a30a2b0038ee1731325a5fc2df73a
f66c50cb71f8f88e3b47c3c32258da25
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int m1=0,m2=0,m3=0,m4=0,m5=0; cin>>m1>>m2>>m3>>m4>>m5; int w1=0,w2=0,w3=0,w4=0,w5=0; cin>>w1>>w2>>w3>>w4>>w5; int hs=0,hu=0; cin>>hs>>hu; double ans=0; ans=ans+max(0.3*500 ,(double)((1-(double)m1/250)*500 -50*w1)); ans=ans+...
C++
636a30a2b0038ee1731325a5fc2df73a
344f26cfa49305c1a8bd1b3fcfe2aa29
1,000
PASSED
#include<iostream> using namespace std; int main() { double m[6], w[6], a,b,c,f=0; for(int a=1;a<=5;a++) cin >> m[a]; for(int a=1;a<=5;a++) cin >> w[a]; for(int a=1;a<=5;a++) f+=max(0.3*a*500,(1-m[a]/250)*a*500 - 50*w[a]); cin>>a>>b; f+=a*100; f-=b*50; cout<<f; }
C++
636a30a2b0038ee1731325a5fc2df73a
2a7380799359f3c3f69bb203a0dc1201
1,000
PASSED
/* *********************************************** Author :caowushang Created Time :2015/8/31 11:57:11 TASK :�½�.cpp LANG :C++ ************************************************ */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <queue> #includ...
C++
636a30a2b0038ee1731325a5fc2df73a
e803d1ffce7f0fb99fa9d3d30ab0cffe
1,000
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> using namespace std; int m[5]; int maxx[5]={500,1000,1500,2000,2500}; int w[5]; int hs,hu; int main() { for(int i=0;i<5;i++) scanf("%d",&m[i]); for(int i=0;i<5;i++) scanf("%d",&w[i]); scanf("%d%d"...
C++
636a30a2b0038ee1731325a5fc2df73a
cb71ac3c94165bc3f3eb428c4d99c264
1,000
PASSED
/*************************************************************************\ ********* ****** .** ** *** .***** * * * ** * .** | ) ********* ******** .****** ** ***** * * * ** * .** | ) ********* * * ...
C++
636a30a2b0038ee1731325a5fc2df73a
e2f69793d9738ee9288d49703067d9bf
1,000
PASSED
// Bismillahirrahmanir Rahim //NAMOMIZARAHID #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #define s1(a) scanf("%d",&a) #define s1n(n) scanf("%d",&n) #define sl1(a) scanf("%I64d",&a) #define sl1n(n) scanf("%I64d",&n) #define s2(a,b) scanf("%d%d",&a,&b) #define sl2(a,b) scan...
C++
636a30a2b0038ee1731325a5fc2df73a
c23b866b28c20e6cad12e92fe238d578
1,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef vector <int> VI; typedef pair <int,int> PII; typedef long long ll; typedef unsigned long long ull; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); float a[5], w, tp = 0, hs, hu; for(int i = 0; i < 5; i++){ cin >...
C++
636a30a2b0038ee1731325a5fc2df73a
5e3ac42c7c0ffcc9f1164c470606c1aa
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define onlylove "My Sky" #define mysky "TT" #define X first #define Y second #define sz(A) int(A.size()) #define mpair make_pair #define LL(x) (x << 1) #define RR(x) ((x << 1) | 1 ) #define sqr(x) ((x)*(x)) #define Rep(i , n) for(int i = 0 , _a = n ; i < _a ; i++) #defin...
C++
636a30a2b0038ee1731325a5fc2df73a
bb3fa9a0d83918fe54748891354499da
1,000
PASSED
#include<iostream> #include<stdio.h> #include<string> #include<cmath> #include<vector> #include<iomanip> #include<sstream> #include<algorithm> #include<stack> #include<set> #include<queue> #include<map> #define all(s) ((s).begin()),((s).end()) typedef long long ll; typedef unsigned long long ull; const ull maxi=1e9+1; ...
C++
636a30a2b0038ee1731325a5fc2df73a
ebe0a64d2e48ef6902c4d04cbed7ebb1
1,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define F first #define S second #define ll long long #define ull unsigned long long #define ld long double //#define endl '\n' #define TIME 1.0*...
C++
adc43f273dd9b3f1c58b052a34732a50
8ad7f97f174ad9a79c34fc231f8ce293
1,600
PASSED
#include <bits/stdc++.h> #include <vector> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; #define int long long #define ll long long #define pb push_back #define pp pop_back #define pii pair<ll,ll> #define vi vector<ll> ...
C++
adc43f273dd9b3f1c58b052a34732a50
08d08a31d7a43b6f312ce40bbd129b48
1,600
PASSED
/****************************************************************************** рассвет. *******************************************************************************/ #include <bits/stdc++.h> typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; #define rapgame ios_base::sync_w...
C++
adc43f273dd9b3f1c58b052a34732a50
42f912b5511102aeb4f274c934899b93
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(lli i = (lli)(a); i < (lli)(b);i++) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define pb push_back #define mp make_pair #define ff first #define ss second #define sz(v) (v).size()...
C++
adc43f273dd9b3f1c58b052a34732a50
483d19d772a60abf88250c0cc53c9ad4
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(lli i = (lli)(a); i < (lli)(b);i++) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define pb push_back #define mp make_pair #define ff first #define ss second #define sz(v) (v).size()...
C++
adc43f273dd9b3f1c58b052a34732a50
5a2ff1eb9c16bc09108abd3a12c4a46d
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(lli i = (lli)(a); i < (lli)(b);i++) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define pb push_back #define mp make_pair #define ff first #define ss second #define sz(v) (v).size()...
C++
adc43f273dd9b3f1c58b052a34732a50
fb48bf483d13bb7f182916ec80f3503e
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define FOR(i, x, n) for(int i = x; i < n; i++) #define FOD(i, n, x) for (int i = n - 1; i >= x; i--) #define pb push_back #define ll ...
C++
adc43f273dd9b3f1c58b052a34732a50
118ed2ec2caa9ab1e5f322f714231cbe
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define FOR(i, x, n) for(int i = x; i < n; i++) #define FOD(i, n, x) for (int i = n - 1; i >= x; i--) #define pb push_back #define ll ...
C++
adc43f273dd9b3f1c58b052a34732a50
717fec05b1b4253701c9123f43dfbacd
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define FOR(i, x, n) for(int i = x; i < n; i++) #define FOD(i, n, x) for (int i = n - 1; i >= x; i--) #define pb push_back #define ll ...
C++
adc43f273dd9b3f1c58b052a34732a50
a599d2ac7f99d9abced9ae52ac0641bf
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int main() { string s; int k,i,c=0; long long res1=0LL; vector<int> v; cin>>k>>s; for(i=0;s[i];i++) { if(s[i]=='0') c++; else {v.push_back(c);res1+=(((c*1LL*((1LL*c)+1))/2)*1LL);c=0;} } res1+=(((c*1LL*((c*1LL)+1))/2)*1LL); ...
C++
adc43f273dd9b3f1c58b052a34732a50
62a86397e3ec252fd64ca390161d1b3c
1,600
PASSED
n =input() arr = map(int,raw_input().split()) b=[0]*10000 for i in arr: b[i]+=1 m = max(arr) ans=[] for i in range(10000): if i<m and b[i]!=0: ans.append(i) b[i]-=1 ans.append(m) for i in range(10000,-1,-1): if i<m and b[i]!=0: ans.append(i) b[i]-=1 print len(ans) for i in an...
Python
5c63f91eb955cb6c3172cb7c8f78976c
4f008967f2b46b33ed92ffaefc8ca6c1
1,100
PASSED
from collections import deque if __name__ == '__main__': n = int(raw_input()) cards = map(int, raw_input().split()) sortc = sorted(cards) result = deque() for el in reversed(sortc): if len(result) == 0 or result[-1] != el: result.append(el) elif result[0] != el: ...
Python
5c63f91eb955cb6c3172cb7c8f78976c
d34f843ca579a5a6ce45226aeecfff93
1,100
PASSED
m = raw_input() b = list(map(int, raw_input().split())) c = set(b) c2 = set(c) d =set() for x in b: if x in c2: c2.remove(x) else: d.add(x) c=sorted(list(c)) d=sorted(list(d), reverse=True) if len(d)>0: if c[-1] == d[0]: del c[-1] print len(c)+len(d) for x in c: ...
Python
5c63f91eb955cb6c3172cb7c8f78976c
bbaeee67b049b9b62282ccaf6461bfe9
1,100
PASSED
N=input() Data=[int(a) for a in raw_input().split(' ')] Data.sort() Result=[] Result.append(Data[-1]) i=len(Data)-2 while i>=0: if(Result[-1]!=Data[i]): Result.append(Data[i]) elif Result[0]!=Data[i]: Result.insert(0,Data[i]) i-=1 print len(Result) print ' '.join([str(a) for a in Result])
Python
5c63f91eb955cb6c3172cb7c8f78976c
e960ff9e323a404c2d80ce82da8f4fd5
1,100
PASSED
m = int(raw_input()) s = raw_input().split() l = [int(x) for x in s] count = [0] * (5001) max_num = max(l) for i in range(m): count [l[i]] += 1 for i in range(max_num + 1): if i == max_num: count[i] = 1 else: count[i] = min(count[i], 2) print sum(count) s = "" for i in range(5001): if count[i] > 0: if s == ""...
Python
5c63f91eb955cb6c3172cb7c8f78976c
6ace88e2a703e6d08be65bedd6bd2dbe
1,100
PASSED
n = int(raw_input()) line = raw_input().split(" ") nbs = {} uniques = [] highest = 0 for i in range(0, 5001): nbs[i] = 0 for i in range(0, n): k = int(line[i]) if(nbs[k] == 0): nbs[k] = 1 uniques.append(k) elif(nbs[k] == 1): nbs[k] = 2 uniques.sort() #find highest highest =...
Python
5c63f91eb955cb6c3172cb7c8f78976c
37354e5576b3fd55ec7d0b31006881c6
1,100
PASSED
#AV Drift King m=int(raw_input()) mar=map(int,raw_input().split(" ")) freqar=[0 for i in range(5001)] for i in mar: freqar[i]+=1 anslen=0 stair=[] j=-1 for i in range(1,5001): if freqar[i]>0: anslen+=1 stair.append(i); freqar[i]-=1 j=i for i in range(j-1,0,-1): if freqar[i]>0: anslen+=1 stair.append(i) ...
Python
5c63f91eb955cb6c3172cb7c8f78976c
e4f72c39df9f528fec027eb01179fd49
1,100
PASSED
M = int(raw_input()) kaarten = map(int, raw_input().split()) kaarten.sort() stair = [kaarten.pop(-1)] index = len(kaarten) - 1 vorigDown = stair[0] vorigUp = stair[0] while index >= 0: if kaarten[index] != vorigDown: vorigDown = kaarten[index] stair.append(kaarten.pop(index)) index -= 1 ...
Python
5c63f91eb955cb6c3172cb7c8f78976c
7f2bbe8198100b3dc09919916b1c8480
1,100
PASSED
#http://codeforces.com/problemset/problem/381/B from heapq import heappush, heappop, heapify from collections import deque def stairs(): m = long(raw_input().strip()) cards = map(int, raw_input().strip().split()) l = len(cards) cards = [-c for c in cards] heapify(cards) seq = deque() mx = -1...
Python
5c63f91eb955cb6c3172cb7c8f78976c
667eed06896dc8c6af526348010cd07a
1,100
PASSED
import sys, math def rs(): return sys.stdin.readline().strip() def ri(): return int(sys.stdin.readline().strip()) def ras(): return list(sys.stdin.readline().strip()) def rai(): return map(int,sys.stdin.readline().strip().split()) def solve(): pass def main(): n = ri() arr = sorted(rai()) ...
Python
5c63f91eb955cb6c3172cb7c8f78976c
567424f66366da48c26cff150276a015
1,100
PASSED
#include <stdio.h> int main() { int n; scanf("%d",&n); if(n%2==0) { int i,j=1,k,a[n]; for(i=1;i<=n;i+=2) { a[j]=i+1; a[j+1]=i; j+=2; } for(k=1;k<=n;k++) { printf("%d ",a[k]); ...
C
204ba74195a384c59fb1357bdd71e16c
8de797fd10f5eef2f1b97fea40c96b22
800
PASSED
#include<stdio.h> #include<math.h> #include<stdlib.h> long long int cmpp( const void * a,const void *b ){ return ( *(long long int *)a-*(long long int*)b); } char cmp(const void * a,const void *b){ return (*(char*)a-*(char*)b); } int main(void) { long long int test, i, j,flag = 0,n, o1 = 0, o2 = 0, x, m,...
C
204ba74195a384c59fb1357bdd71e16c
28bb567ecbc53ad3f56a5f225a43dcd6
800
PASSED
#include <stdio.h> #include<string.h> #include<math.h> int main(void){ // Your code here! int test,n,c,o,d,e,r,i,fflag=0,flag=0,index,sum,m,l,j,z,b,k,count=0,a; scanf("%d",&n); if(n%2==1){ printf("-1"); }else{ //printf("%d %d %d %d",a,b,c,d); for(i=2;i<=n;i+=2){...
C
204ba74195a384c59fb1357bdd71e16c
ac1d44e9789ce8ed7606f13a69220884
800
PASSED
#include<stdio.h> int main() { int n,p=0,q=0,i,j; scanf("%d",&n); int b[n],a[n]; if(n%2!=0) printf("-1"); else { for(int i=1;i<=n;i++) { if(i%2==0) a[p++]=i; else b[q++]=i; } for(i=0,j=0;i<p,j<q;i++,j++) { printf(" %d %d",a[i],b[j]); } } }
C
204ba74195a384c59fb1357bdd71e16c
8b585330966ce4a4bbc0247f8180b9b4
800
PASSED
#include <stdio.h> #include <stdlib.h> int main() { int t; scanf("%d",&t); int a[t]; if(t==1||t%2!=0){ printf("-1"); } else if(t%2==0){ for(int i=1;i<t;i+=2){ a[i]=i+1; a[i+1]=i; } for(int j=1;j<=t;j++){ printf("%d ",a[j]); }} ...
C
204ba74195a384c59fb1357bdd71e16c
e036f10ab3819d2012268c86843708f5
800
PASSED
#include<stdio.h> int main() { int n,i; scanf("%d",&n); if(n%2!=0){ printf("-1"); } else{ for(i=n;i>=1;i--){ printf("%d ",i); } } return 0; }
C
204ba74195a384c59fb1357bdd71e16c
c54085d5a98008da25874db36f2ad905
800
PASSED
#include <stdio.h> int main() { long long int i,c=0,e=0,f=0,d=0,k=0,g=0,n,sum=0,s,MaiorAB; scanf("%lld",&n); if(n%2==1){ printf("-1"); } else if(n%2==0){ for(i=2;i<=n;i=i+2){ printf("%lld %lld ",i,i-1); }} return 0; }
C
204ba74195a384c59fb1357bdd71e16c
5c89fe887ac6dd1829b041f459199b9e
800
PASSED
#include<stdio.h> int main() { int n,i; scanf("%d",&n); if(n%2==1) printf("-1"); else if(n%2==0) { for(i=n;i>0;i--) { printf("%d ",i); } } /*else { for(i=n-1;i>=n/2;i--) {printf("%d ",i);} printf("%d ",n); for(i=n/2-1;i>0;i--) {printf("%d ",i);} } */ }
C
204ba74195a384c59fb1357bdd71e16c
39ebd1fd2468dd7f712b814003a559d4
800
PASSED
#include <stdio.h> #include <string.h> int main() { int n; scanf("%d",&n); if(n%2==1) { printf("-1\n"); } else{ int i; int b=n; for(i=1;i<=n;i++) { printf("%d ",b); b--; } } }
C
204ba74195a384c59fb1357bdd71e16c
06b264d5db7c9557768fe26ac63797d5
800
PASSED
#include <stdio.h> int main() { int n, i; scanf("%d", &n); if (n % 2 != 0) { printf("-1\n"); return 0; } for (i = 2; i <= n; i += 2) printf("%d %d ", i, i - 1); printf("\n"); return 0; }
C
204ba74195a384c59fb1357bdd71e16c
4f679ad85ac135da3141184ec21b18b7
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int rows, cols; cin>>rows>>cols; char** flag = new char*[rows]; for (int m = 0 ; m < rows; m++){ flag[m] = new char[cols]; for (int n = 0; n < cols; n++) cin >> flag[m][n]; } char first_row_squa...
C++
80d3da5aba371f4d572ea928025c5bbd
f9fcff1cf3d3b1d7a4463adfd64f568c
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int rows, cols; cin>>rows>>cols; char** flag = new char*[rows]; for (int m = 0 ; m < rows; m++){ flag[m] = new char[cols]; for (int n = 0; n < cols; n++) cin >> flag[m][n]; } char first_row_squa...
C++
80d3da5aba371f4d572ea928025c5bbd
f3b003c4802b92f662bf060d1920dac0
800
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int x, y; cin>>x>>y; bool b = true; char z ; vector <char> h; char ** arr= new char*[x] ; for(int i=0 ; i< x ; i++) { arr[i]=new char [y]; for(int j = 0 ; j < y ; j++ ) { cin >> a...
C++
80d3da5aba371f4d572ea928025c5bbd
f989834ba0c650063ba7f6c6d7902364
800
PASSED
#include <iostream> using namespace std; int main() { int lines,chars; cin >> lines >> chars; string colour; int arr[lines+1]; bool check = true; for (int i=0;i<lines;i++) { cin >> colour; for (int i=0;i<chars;i++) { if (colour[i]!=colour[0]) {...
C++
80d3da5aba371f4d572ea928025c5bbd
4edffe3583a619b10e01c3251eee0ce3
800
PASSED
#include <iostream> using namespace std; int main() { int lines,chars; cin >> lines >> chars; string colour; int arr[lines+1]; bool check = true; for (int i=0;i<lines;i++) { cin >> colour; for (int i=0;i<chars;i++) { if (colour[i]!=colour[0]) {...
C++
80d3da5aba371f4d572ea928025c5bbd
de7faf02bd0d1060b41ecb88a4d16809
800
PASSED
# include <iostream> # include <algorithm> # include <string> # include <stdio.h> //ssssssss using namespace std; int main() { string s; int N,M,i,j,k; char c=' '; bool flag=true; cin>>N>>M; while(N--) { cin>>s; if(s[0]==c) {flag=false; break;} for(j=1;j<M;j++) if(s[j]!=s[0]) {flag=false; break;} if(!...
C++
80d3da5aba371f4d572ea928025c5bbd
0ec3a5eabddee7cdfb9e2224779aca2e
800
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { int x , y ; cin >> x >> y ; string kh [x]; for ( int i=0; i<x ; i++) { cin >>kh[i]; } for ( int j=0 ; j<x ; j++) { string a = kh[j]; for ( int i=0 ; i<(y-1) ; i++){ if ( a[i]!=a[i...
C++
80d3da5aba371f4d572ea928025c5bbd
15a93991c8337b4b946f4bdcfb9f9522
800
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { int x , y ; cin >> x >> y ; string kh [x]; for ( int i=0; i<x ; i++) { cin >>kh[i]; } for ( int j=0 ; j<x ; j++) { string a = kh[j]; for ( int i=0 ; i<(y-1) ; i++){ if ( a[i]!=a[i...
C++
80d3da5aba371f4d572ea928025c5bbd
59d3304a975362d91f970a07928ce970
800
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { int x , y ; cin >> x >> y ; string kh [x]; for ( int i=0; i<x ; i++) { cin >>kh[i]; } for ( int j=0 ; j<x ; j++) { string a = kh[j]; for ( int i=0 ; i<(y-1) ; i++){ if ( a[i]!=a[i...
C++
80d3da5aba371f4d572ea928025c5bbd
0ce9e2123893148e3564fff548bb63e4
800
PASSED
#include <bits/stdc++.h> #include <string> using namespace std; typedef long long int ll; int main() { int n,m,c=0; cin >> n >>m; string s[n]; //ll arr[n]; //stringstream ss; // bool check=false; for (ll i=0;i<n;i++) cin >> s[i]; for (ll i =0;i<n;i++) { for (ll j=0;j<(...
C++
80d3da5aba371f4d572ea928025c5bbd
2ee7ef9128bf587c90526ab657bf3a06
800
PASSED
#include <bits/stdc++.h> using namespace std; const int sz=4e3+10, inf=1e9; int s, t; struct re { int to, cap; }; vector <int> sv[sz]; vector <re> edges; void add_edge(int u, int v, int cap) { sv[u].push_back(edges.size()); edges.push_back({v, cap}); sv[v].push_back(edges.size()); edges.push_back({u...
C++
855e234e98c09ba3260954b264b3a915
0614486259feeef19151eb65f7cd5b8c
2,500
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <set> #include <algorithm> #define MAXN 2050 #define INF (1<<28) using namespace std; int n1, n2, m, cnt, dgr[MAXN<<2], s, t, level[MAXN<<2], q[MAXN<<4], ans; int key[MAXN<<1][MAXN<<1], len[MAXN<<2]; set <int> S; struct node{ int v, c...
C++
855e234e98c09ba3260954b264b3a915
cdef6aba8aba89b55a5dbd1f7a5a9884
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll oo = 1e18; const int N = 20005, E = 300006; vector<int> g[N]; int ne; struct Edge{ int from, to; ll cap; } edge[E]; int lvl[N], vis[N], pass, source, target, px[N]; ll run(int s, ll minE){ if(s == target) return minE; ll ...
C++
855e234e98c09ba3260954b264b3a915
bd3b5ca61c7000360206b0f4019007bd
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll oo = 1e18; const int N = 20005, E = 300006; vector<int> g[N]; int ne; struct Edge{ int from, to; ll cap; } edge[E]; int lvl[N], vis[N], pass, source, target, px[N]; ll run(int s, ll minE){ if(s == target) return minE; ll ...
C++
855e234e98c09ba3260954b264b3a915
0e7cd33e2b74970a792e84b77c69e6c6
2,500
PASSED
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1); #define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++) #define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_...
C++
855e234e98c09ba3260954b264b3a915
0504f52cbf6173dc4afa4b78c78fa13b
2,500
PASSED
#include <cstdio> #include <algorithm> #include <vector> int res[4002][4002]; int SRC,SNK; int flow=0; std::vector<std::pair<int,int> > elist; std::vector<int> edges[4002]; int deg1[2000]; int deg2[2000]; bool vis[4002]; bool dfs(int node){ if(node==SNK) return true; if(vis[node]) return false; vis[node]=tru...
C++
855e234e98c09ba3260954b264b3a915
c10f995339c19c84587dc32f254f3bbc
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define LL long long #define LD long double #define SC(t,x) static_cast<t>(x) #define AR(t) vector < t > #define PII pair < int, int > #define PLL pair < LL, LL > #define PIL pair < int, LL > #define PLI pair < LL, int > #define MP make_pair #define PB push_back #define PF...
C++
855e234e98c09ba3260954b264b3a915
cd30a1974c6d7c4c60ddd85889edaa63
2,500
PASSED
#include<iostream> #include<algorithm> #include<set> #include<vector> #include<queue> #include<cmath> #include<cstring> #include<cstdio> #include<ctime> #include<map> #include<stack> #include<string> #define eps 1e-6 #define inf 0x3f3f3f3f #define INF 1e18 #define PI acos(-1.0) #define mem(a,x) memset(a,x,sizeof(a)) us...
C++
855e234e98c09ba3260954b264b3a915
32346ef6018d856464cda1c862c0680e
2,500
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <vector> using namespace std; #define MAXPoint 4010 #define MAXEdge 80010 #define INF 0x3f3f3f3f int head[MAXPoint],to[MAXEdge],nxt[MAXEdge],val[MAXEdge],tot=1,n1,n2,m,S,T,dis[MAXPoint],deg[MAXPoint],t1,t2; vector<int>ansl[MAXPoint]; inl...
C++
855e234e98c09ba3260954b264b3a915
25b40c7698f5f17aff22784ca0964411
2,500
PASSED
#include<bits/stdc++.h> using namespace std; template <typename T> void chmin(T &x,const T &y) { if(x>y)x=y; } #define rep(i,l,r) for(int i=l;i<=r;++i) const int N=4000+5,M=2000+N+5,inf=1e9; struct Edge { int to,f,*nf; }; Edge qa[M*2],*t[N],*nt[N]; int cnt[N]; struct Edge0 { int x,y,f; Edge *dy; }; Edge0 edge0[M];...
C++
855e234e98c09ba3260954b264b3a915
a9215965012f08e138879092c450dc7f
2,500
PASSED
a,b,c,d=list(map(int,input().split())) print((a/b)/(1-(1-(a/b))*(1-(c/d))))
Python
7b932b2d3ab65a353b18d81cf533a54e
bfe1a027fe00a570cda1e07ea006e7bd
1,300
PASSED
# 0.5*0.5+0.25*0.25+... = y+y^2+y^3+... (y=0.25) = y/1-y = .25/.75 # p=a/b,q=c/d,p'=1-p,q'=1-q # pq'+p^2qq'+p^3q^2q'+... = pq'(1+pq+p^2q^2+...)=pq'/1-pq = a(d-c)/c(b-a) a, b, c, d = map(int, input().split()) p = a / b q = c / d print(p / (p + q - p * q))
Python
7b932b2d3ab65a353b18d81cf533a54e
441443bcfcd65d80113d7c3cf069d1c2
1,300
PASSED
a,b,c,d = map(int, input().split(' ')) print(a / b / (1 - ((1 - a / b) * (1 - c / d))))
Python
7b932b2d3ab65a353b18d81cf533a54e
59ca5401d37cf993b1d094543c010790
1,300
PASSED
a,b,c,d = list(map(int,input().split())) p = a/b q = (1-a/b)*(1-c/d) print(p/(1-q))
Python
7b932b2d3ab65a353b18d81cf533a54e
6af361e2534fc19064570f574173e37d
1,300
PASSED
a,b,c,d = map(int, input().split()) s=a/b h=(1-c/d) v=(1-a/b) rez=s/(1-(h*v)) print(rez)
Python
7b932b2d3ab65a353b18d81cf533a54e
cf266eebf9af35e53c78ff0959118e72
1,300
PASSED
a,b,c,d=map(int,input().split()) print(a*d/(a*d+b*c-a*c))
Python
7b932b2d3ab65a353b18d81cf533a54e
78dc0c703ebc6952aad5b730b1714a33
1,300
PASSED
a,b,c,d=map(int,input().split()) print(round((a*d)/(a*d+b*c-a*c),9))
Python
7b932b2d3ab65a353b18d81cf533a54e
fe4399796cfd5ebc364e8a1aa1895c87
1,300
PASSED
a,b,c,d = map(int,input().split()) p = a/b q = c/d wining_prob = p*(1/(p+q-p*q)) print('{:0.12f}'.format(wining_prob))
Python
7b932b2d3ab65a353b18d81cf533a54e
ba479e64a92f868c26402fb5b86f4013
1,300
PASSED
a,b,c,d = map(int, input().split()) denominator = (1-((1-(a/b))*(1-(c/d)))) res = (a/b) * (1/denominator) print(res)
Python
7b932b2d3ab65a353b18d81cf533a54e
575c1fc75363465c84c71030d08edd9e
1,300
PASSED
a,b,c,d=map(int,input().split()) ans=(a/b)/(1-(1-a/b)*(1-c/d)) print(ans)
Python
7b932b2d3ab65a353b18d81cf533a54e
802761df9a732b86400d5ec517f01c32
1,300
PASSED
#include<cstdio> #include<iostream> #include<cstdlib> #include<cstring> using namespace std; bool a[10000]; int main(){ char c; int x, mx = 0; memset(a, 0, sizeof(a)); while(1){ scanf("%d", &x); a[x] = 1; if(mx < x) mx = x; if(scanf("%c", &c) <= 0) break; } for(int i = 1; i <= mx;){ int start =...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
d65660a653aee87b6538731d2e475e5a
1,300
PASSED
#include<cstdio> #include<iostream> #include<cstring> #include<string> #include<cstdlib> using namespace std; char str[10000]; bool a[1001]; int main(){ scanf("%s", str); memset(a, 0, sizeof(a)); char *tmp; tmp = strtok(str, ","); while(tmp != NULL){ int num = atoi(tmp); a[num] = true; tmp = strtok(NULL, ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
498fb0232f9ae3d5a91c2fe6e33c133b
1,300
PASSED
#include <cstdio> using namespace std; bool b[1002] = {false}; int main () { for (;;) { int x; char c; scanf("%d%c", &x, &c); b[x] = true; if (c != ',') break; } int beg = 0; bool first = true; while (beg < 1001) { if (!b[beg]) ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
ba470a0577140d93947d713dfaa57a88
1,300
PASSED
#include "fstream" #include "iostream" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <conio.h> #include <algorithm> #include <vector> typedef long long ll; using namespace std; main() { int n=0,a[101]={},t; char c; bool h=true; while(true) { ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
38d5e5d3487617c700abbc072b659d64
1,300
PASSED
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int a[100010],t,i,j; int b[100010]; while(~scanf("%d",&a[0])) { getchar(); int n = 1; while(~scanf("%d",&a[n])) { n++; getchar(); } for(i=0;i<n;i++) { ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
2d6cdd3a223d7612a0b696f4b28adcf9
1,300
PASSED
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> #include <stack> using namespace std; int n,a[1001],b[1001],t,tb,ff; int main() { while(scanf("%d",&a[0])!=EOF) { ff=0; t=1; tb=0; getchar(); while(scanf("%d",&a[t])!=EOF) { ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
d66c6eefc87b283cdbb2d7092a01496a
1,300
PASSED
#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int visited[5000]; int main() { #define int long long vector <pair<int,int> > ans; string s; cin>>s; int i=0; int q=0; int k=1; while (i<s.size()) { if (s[i]!=',') { ...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
ee76668a0597a31fa5b7b2e542e02616
1,300
PASSED
#include <algorithm> #include <iostream> #include <stdio.h> #include <cstdlib> #include <cstring> #include <math.h> #include <vector> #include <bits/stdc++.h> #define pb push_back #define lli long long int #define st string #define sc scanf #define pr printf #define cl clear #define vlli vector < lli > #define vs vect...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
9b6061944db817cb95521166de4cc015
1,300
PASSED
#include <iostream> #include <sstream> #include <string> #include <cstring> using namespace std; bool c[1001]; string s; void init(){ s = ',' + s; istringstream iss(s); char comma; int tmp; memset(c, false, sizeof(c)); while (iss >> comma){ iss >> tmp; c[tmp] = true; } } void solve(){ int i, j; bo...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
71c93d85e459aaf1e86409e36e171027
1,300
PASSED
#include <iostream> #include <cmath> #include <cstdio> #include <vector> #include <set> #include <map> #include <iomanip> #include <algorithm> using namespace std; #define mp make_pair #define pb push_back #define F first #define S second #define inf 10e8 #define MAX 100000000 #define ll long long #define ull unsigne...
C++
3969ba3e3eb55a896663d2c5a5bc4a84
cfea8e69a3ff300c12471d12995f4d39
1,300
PASSED
#include <bits/stdc++.h> const int MX = 100005 ; const int IMX = (1 << 30 ); using namespace std; int n, m, a[MX]; char wut[12]; int main(){ scanf("%d %d", &n, &m); for(int i=0;i<n;i++){ scanf("%s", wut); if(wut[0] == '?') a[i] = IMX; else a[i] = atoi(wut); } for(int i = 0 ; i < m ; i ++){ int pr...
C++
d42e599073345659188ffea3b2cdd4c7
bd21be3fbd545c3bfbd355bb93990ef9
2,200
PASSED
//Toxic #include<iostream> #include<string> #include<algorithm> #include<vector> #include<set> using namespace std; const int INF = 1e9 + 4 + 1e6; const int MAXN = 3e5 + 20; int n, k, vec[MAXN]; bool fail; vector<int> sec; set<int> st; void process(int ind){ st.clear(); for (int i = 1; i < sec.size(); i++) if ...
C++
d42e599073345659188ffea3b2cdd4c7
1698d0d9d2f3f82f30a8d7b9860380e3
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i, l, r) for (int i = l; i<r;i++) #define dec(i, l, r) for (int i = l; i>=r;i--) #define vi vector<int> #define all(v) v.begin(),v.end() #define pb(c) push_back(c) #define vii vector<pair<int,int>> #define ii pair<int,int> #define max(a, b) (((a)<(b))?b:a) #def...
C++
d42e599073345659188ffea3b2cdd4c7
387b2f02dae220dc944f0e42c57f4845
2,200
PASSED
// run: $exec < input #include <iostream> #include <string> long long const maxn = 100007; long long const inf = 1000000001; long long a[maxn]; long long n, k; bool inrange(long long x) { return -inf < x && x < inf; } int main() { std::cin >> n >> k; for (long long i = 0; i < n; i++) { std::string s; std::ci...
C++
d42e599073345659188ffea3b2cdd4c7
7a39328f3e90c8bc69a02cfd2bcd5e49
2,200
PASSED
/** * Copyright (c) 2015 Authors. All rights reserved. * * FileName: 518E.cpp * Author: Beiyu Li <sysulby@gmail.com> * Date: 2015-05-01 */ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define For(i,s,t) for (int i = (s); i <= (t); ++i) #define foreach(i,c) for (_...
C++
d42e599073345659188ffea3b2cdd4c7
f74f84d20ec721f1f713a79498c461d9
2,200
PASSED
#include<iostream> #include<cstring> #include<vector> #include<string> #include<cstdio> #include<iomanip> #include<algorithm> #define P(x,y) make_pair(x,y) using namespace std; const int MX=(1<<20); int to_number(string str){ int ret=0 , st=0; if(str[0]=='-') st=1; for(int j=st;j<str.length();j++) r...
C++
d42e599073345659188ffea3b2cdd4c7
ed20429f73b7945955c40ec01129e374
2,200
PASSED
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <cstring> #include <climits> #include <map> using namespace std; const int mycount = 100015; char s[mycount* 20]; int a[mycount]; int n, m; void input() { scanf("%d %d", &n, &m); gets(s); gets(s); in...
C++
d42e599073345659188ffea3b2cdd4c7
2780b15e007730938de3b319240a6825
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define IOS ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) inline int in(){int32_t x ; scanf("%d",&x) ; return x ;} inline long long lin(){long long x ; scanf("%lld",&x) ; return x;} const int maxn = 1e5 + 10; const int inf = 1e18 ; vector<pair<int...
C++
d42e599073345659188ffea3b2cdd4c7
ffc4a591c826bba708b0bcf0b0dbe5c8
2,200
PASSED
#include <cstdio> #include <algorithm> #define N 100005 #define INF (1 << 30) #define fi(a, b, c) for(int a = (b); a < (c); a++) using namespace std; int n, m, a[N]; char buf[12]; int main(){ scanf("%d %d", &n, &m); fi(i, 0, n){ scanf("%s", buf); if(buf[0] == '?') a[i] = INF; else a[i] = atoi(buf); } fi(i...
C++
d42e599073345659188ffea3b2cdd4c7
cfe3c2cdce7b21bad84fe7162c2d14ae
2,200
PASSED