s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s074621360
p03967
u937642029
1574266506
Python
PyPy3 (2.4.0)
py
Runtime Error
186
38636
1427
from collections import Counter,defaultdict,deque import sys import bisect import math import itertools import queue import copy from scipy import linalg import scipy import numpy as np from heapq import heappop, heappush input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): # n=1 return int(input()) def inpm(): # x=1,y=2 return map(int,input().split()) def inpl(): # a=[1,2,3,4,5,...,n] return list(map(int, input().split())) def inpls(): # a=['1','2','3',...,'n'] return list(input().split()) def inplm(n): # x=[] 複数行 return list(int(input()) for _ in range(n)) def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] return sorted([list(map(int, input().split())) for _ in range(n)]) def sortx(x,n,k): if k == 0:x.sort(key=lambda y:y[1,n]) else:x.sort(reversed=True, key=lambda y:y[1,n]) def main(): s = input() NG = 1 NP = 0 did = ["g"] point = 0 for i in range(1,len(s)): if s[i] == "g": if NP + 1 <= NG: did.append("p") NP += 1 point += 1 else: did.append("g") NG += 1 else: if NP + 1 <= NG: did.append("p") NP += 1 else: did.append("g") NG += 1 point -= 1 print(point) if __name__ == "__main__": main()
s026348230
p03967
u937642029
1574266483
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38256
1425
from collections import Counter,defaultdict,deque import sys import bisect import math from itertools import queue import copy from scipy import linalg import scipy import numpy as np from heapq import heappop, heappush input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): # n=1 return int(input()) def inpm(): # x=1,y=2 return map(int,input().split()) def inpl(): # a=[1,2,3,4,5,...,n] return list(map(int, input().split())) def inpls(): # a=['1','2','3',...,'n'] return list(input().split()) def inplm(n): # x=[] 複数行 return list(int(input()) for _ in range(n)) def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] return sorted([list(map(int, input().split())) for _ in range(n)]) def sortx(x,n,k): if k == 0:x.sort(key=lambda y:y[1,n]) else:x.sort(reversed=True, key=lambda y:y[1,n]) def main(): s = input() NG = 1 NP = 0 did = ["g"] point = 0 for i in range(1,len(s)): if s[i] == "g": if NP + 1 <= NG: did.append("p") NP += 1 point += 1 else: did.append("g") NG += 1 else: if NP + 1 <= NG: did.append("p") NP += 1 else: did.append("g") NG += 1 point -= 1 print(point) if __name__ == "__main__": main()
s579977945
p03967
u937642029
1574266311
Python
PyPy3 (2.4.0)
py
Runtime Error
190
39020
1808
from collections import Counter,defaultdict,deque import sys import bisect import math from itertools import permutations,combinations import string import queue import copy import numpy as np from heapq import heappop, heappush # input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): # n=1 return int(input()) def inpm(): # x=1,y=2 return map(int,input().split()) def inpl(): # a=[1,2,3,4,5,...,n] return list(map(int, input().split())) def inpls(): # a=['1','2','3',...,'n'] return list(input().split()) def inplm(n): # x=[] 複数行 return list(int(input()) for _ in range(n)) def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] return sorted([list(map(int, input().split())) for _ in range(n)]) def sortx(x,n,k): if k == 0:x.sort(key=lambda y:y[1,n]) else:x.sort(reversed=True, key=lambda y:y[1,n]) def graph(): n=inp() g=[[] for _ in range(n)] for i in range(n): a=inp() a-=1 g[i].append(a) g[a].append(i) return n,g def graphm(): n,m=inpm() g=[[] for _ in range(n)] for _ in range(m): a,b,w=inpm() a-=1 b-=1 g[a].append((b,w)) g[b].append((a,w)) return n,m,g def main():#gpg s = input() NG = 1 NP = 0 did = ["g"] point = 0 for i in range(1,len(s)): if s[i] == "g": if NP + 1 <= NG: did.append("p") NP += 1 point += 1 else: did.append("g") NG += 1 else: if NP + 1 <= NG: did.append("p") NP += 1 else: did.append("g") NG += 1 point -= 1 print(point) if __name__ == "__main__": main()
s732351832
p03967
u937642029
1574266261
Python
PyPy3 (2.4.0)
py
Runtime Error
183
39148
1870
from collections import Counter,defaultdict,deque import sys import bisect import math from itertools import permutations,combinations import string import queue import copy from scipy import linalg import scipy import numpy as np from heapq import heappop, heappush # input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): # n=1 return int(input()) def inpm(): # x=1,y=2 return map(int,input().split()) def inpl(): # a=[1,2,3,4,5,...,n] return list(map(int, input().split())) def inpls(): # a=['1','2','3',...,'n'] return list(input().split()) def inplm(n): # x=[] 複数行 return list(int(input()) for _ in range(n)) def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] return sorted([list(map(int, input().split())) for _ in range(n)]) def sortx(x,n,k): if k == 0:x.sort(key=lambda y:y[1,n]) else:x.sort(reversed=True, key=lambda y:y[1,n]) def graph(): n=inp() g=[[] for _ in range(n)] for i in range(n): a=inp() a-=1 g[i].append(a) g[a].append(i) return n,g def graphm(): n,m=inpm() g=[[] for _ in range(n)] for _ in range(m): a,b,w=inpm() a-=1 b-=1 g[a].append((b,w)) g[b].append((a,w)) return n,m,g def main():#gpg s = input() NG = 1 NP = 0 did = ["g"] point = 0 for i in range(1,len(s)): if s[i] == "g": if NP + 1 <= NG: did.append("p") NP += 1 point += 1 else: did.append("g") NG += 1 else: if NP + 1 <= NG: did.append("p") NP += 1 else: did.append("g") NG += 1 point -= 1 print(''.join(did)) print(point) if __name__ == "__main__": main()
s357656903
p03967
u798818115
1569443281
Python
Python (3.4.3)
py
Runtime Error
2103
136288
342
# coding: utf-8 # Your code here! s=list(input()) count=0 for i in range(len(s)):#偶数ならグー 奇数ならパーになる if s[i]=='g': s[i]=0 else: s[i]=1 print(s) if i&1^s[i]==1 and i&1==1: count+=1 elif i&1^s[i]==1 and s[i]&1==1: count-=1 else: pass print(count)
s874084118
p03967
u009348313
1569254325
Python
PyPy3 (2.4.0)
py
Runtime Error
288
44528
312
S = input() def dfs(p,a): if p == len(S): return 0 if a > 0 and S[p] == 'g': return max(1+dfs(p+1,a-1),dfs(p+1,a+1)) elif a > 0 and S[p] == 'p': return max(dfs(p+1,a-1),-1+dfs(p+1,a+1)) elif a == 0 and S[p] == 'g': return dfs(p+1,a+1) else: return -1+dfs(p+1,a+1) print(dfs(0,0))
s581876328
p03967
u767664985
1566550655
Python
Python (3.4.3)
py
Runtime Error
17
2940
255
s = input() g_cnt, p_cnt = 0, 0 ans = 0 for si in s: if si = "g": if p_cnt < g_cnt: p_cnt += 1 ans += 1 else: g_cnt += 1 ans -= 1 else: g_cnt += 1 ans += 1 print(ans)
s561936363
p03967
u095756391
1558843148
Python
Python (3.4.3)
py
Runtime Error
17
3316
256
s = input() subsg = [] subsp = [] sg = 0 sp = 0 ans = 0 for i in range(N): if s[i] == 'g': sg += 1 else: sp += 1 subsg.append(sg) subsp.append(sp) for i in range(N): if subsp <= subsg: ans += 1 print(ans)
s143370658
p03967
u450339194
1554612707
Python
Python (3.4.3)
py
Runtime Error
2327
1788348
534
import sys sys.setrecursionlimit(200000) S = input() def hoge(s, p_count): if len(s) == 1: if s[0] == 'g': if p_count > 0: return 1 return 0 else: if p_count > 0: return 0 return -1 p_score = -len(S)-1 if p_count > 0: p_score = hoge(s[1:], p_count-1) g_score = hoge(s[1:], p_count+1) if s[0] == 'g': return max(p_score+1, g_score) else: return max(p_score, g_score-1) print(hoge(S, 0))
s704206397
p03967
u371763408
1554377137
Python
Python (3.4.3)
py
Runtime Error
17
2940
205
s=input() gu=0 pa=0 win=0 fot t in s: if t=='g': if gu>pa: pa+=1 win+=1 else: gu+=1 else: if gu>pa: pa+=1 else: win-=1 gu+=1 print(win)
s267749007
p03967
u118642796
1553796657
Python
Python (3.4.3)
py
Runtime Error
18
3188
139
S = input() ans = 0 for i in range(S): if i%2 == 0 and S[i] == "g": ans += 1 elif i%2 == 1 and S[i] == "p": ans -= 1 print(ans)
s899546959
p03967
u543954314
1553557046
Python
Python (3.4.3)
py
Runtime Error
17
3188
36
s = input() print(n//2-s.count("p"))
s746093023
p03967
u543954314
1553556639
Python
Python (3.4.3)
py
Runtime Error
17
3188
150
s = input() m = "gp"*(len(s)//2+1) g = 0 for i in range(s): if s[i] == m[i]: continue elif s[i] == "p": g -= 1 else: g += 1 print(g)
s349000291
p03967
u923279197
1553179162
Python
PyPy3 (2.4.0)
py
Runtime Error
177
39536
91
s = input() n = len(s) a = 0 for t in s: if t == 'p': a += 1 print(n//2 - b)
s899152909
p03968
u941407962
1578540070
Python
PyPy3 (2.4.0)
py
Runtime Error
193
38512
1056
from collections import defaultdict N, = map(int, input().split()) dd = defaultdict(int) ss = [] for _ in range(N): a, b, c, d = map(int, input().split()) dd[(a,b,c,d)] += 1 dd[(b,c,d,a)] += 1 dd[(c,d,a,b)] += 1 dd[(d,a,b,c)] += 1 ss.append((a,b,c,d)) def icr(x): a, b, c, d = x for faf in [(b,c,d,a), (c,d,a,b), (d,a,b,c), (a,b,c,d)]: dd[faf] += 1 def dcr(x): a, b, c, d = x for faf in [(b,c,d,a), (c,d,a,b), (d,a,b,c), (a,b,c,d)]: dd[faf] -= 1 def f(ff, gg): a,b,c,d=ff e, h, g, f = gg tl = [(a,e,f,b), (b,f,g,c), (c,g,h,d), (d,h,e,a)] r = 1 for cp in tl: r *= dd[cp] dcr(cp) for cp in tl: icr(cp) return r r = 0 for i in range(N): a,b,c,d = ss[i] ff = (a,b,c,d) dcr(ff) for j in range(I+1, N): if i == j: continue x, y, z, w = ss[j] sl = [(x,y,z,w), (y,z,w,x), (z,w,x,y), (w,x,y,z)] for s in sl: dcr(s) r += f(ff,s) icr(s) icr(ff) print(r//3)
s810793994
p03968
u102461423
1563005685
Python
PyPy3 (2.4.0)
py
Runtime Error
1036
62424
1565
import sys input = sys.stdin.readline from collections import defaultdict, Counter import itertools mask = (1 << 10) - 1 symmetry = dict() decode = dict() counter = defaultdict(int) def encode(a,b,c,d): t = 1 << 40 for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]: u = x + (y << 10) + (z << 20) + (w << 30) if t > u: t = u return t N = int(input()) tiles = [] for _ in range(N): a,b,c,d = map(int,input().split()) t = encode(a,b,c,d) tiles.append(t) counter[t] += 1 if a == b == c == d: symmetry[t] = 4 elif a == c and b == d: symmetry[t] = 2 else: symmetry[t] = 1 decode[t] = (a,b,c,d) P = [(1,n,n*(n-1),n*(n-1)*(n-2),n*(n-1)*(n-2)*(n-3)) for n in range(N+1)] P += [(0,0,0,0,0)] * (N+1) # 負数代入対策 power = [[n ** e for e in range(5)] for n in range(5)] answer = 0 for bottom, top in itertools.combinations(tiles,2): counter[bottom] -= 1 counter[top] -= 1 a,b,c,d = decode[bottom] e,f,g,h = decode[top] for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]: # a,b,c,d # x,w,z,y tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]] need = Counter(tiles) x = 1 for tile, cnt in need.items(): x *= P[counter[tile]][cnt] # 残っている個数、必要枚数 x *= power[symmetry[tile]][cnt] answer += x counter[bottom] += 1 counter[top] += 1 # 上下を固定した分 answer //= 3 print(answer)
s195579262
p03968
u102461423
1563005642
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38768
1556
import sys input = sys.stdin.readline from collections import defaultdict import itertools mask = (1 << 10) - 1 symmetry = dict() decode = dict() counter = defaultdict(int) def encode(a,b,c,d): t = 1 << 40 for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]: u = x + (y << 10) + (z << 20) + (w << 30) if t > u: t = u return t N = int(input()) tiles = [] for _ in range(N): a,b,c,d = map(int,input().split()) t = encode(a,b,c,d) tiles.append(t) counter[t] += 1 if a == b == c == d: symmetry[t] = 4 elif a == c and b == d: symmetry[t] = 2 else: symmetry[t] = 1 decode[t] = (a,b,c,d) P = [(1,n,n*(n-1),n*(n-1)*(n-2),n*(n-1)*(n-2)*(n-3)) for n in range(N+1)] P += [(0,0,0,0,0)] * (N+1) # 負数代入対策 power = [[n ** e for e in range(5)] for n in range(5)] answer = 0 for bottom, top in itertools.combinations(tiles,2): counter[bottom] -= 1 counter[top] -= 1 a,b,c,d = decode[bottom] e,f,g,h = decode[top] for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]: # a,b,c,d # x,w,z,y tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]] need = Counter(tiles) x = 1 for tile, cnt in need.items(): x *= P[counter[tile]][cnt] # 残っている個数、必要枚数 x *= power[symmetry[tile]][cnt] answer += x counter[bottom] += 1 counter[top] += 1 # 上下を固定した分 answer //= 3 print(answer)
s419893273
p03970
u468972478
1598106076
Python
Python (3.8.2)
py
Runtime Error
25
8996
99
n = input() a = 0 a = "CODEFESTIVAL2016" for i, j in zip(n, a): if i != j: a += 1 print(a)
s057141437
p03970
u446371873
1594786459
Python
Python (3.8.2)
py
Runtime Error
21
9060
98
S = input() T = 'CODEFESTIVAL2016' ans = 0 for _ in range(16): ans += S[i] != T[i] print(ans)
s959827452
p03970
u350093546
1592854275
Python
PyPy3 (7.3.0)
py
Runtime Error
546
92952
101
s=int(input()) t='CODEFESTIVAL2016' ans=0 for i in range(16): if s[i]!=t[i]: ans+=1 print(ans)
s024076730
p03970
u350093546
1592854235
Python
PyPy3 (7.3.0)
py
Runtime Error
100
68768
94
s=int(input()) t='CODEFESTIVAL2016' ans=0 for i in range(16): if s!=t: ans+=1 print(ans)
s646767418
p03970
u295120316
1591908752
Python
Python (3.4.3)
py
Runtime Error
18
3060
373
n,a,b=map(int,input().split()) s=input() cnta=0 cntb=0 for i in range(n): if s[i]=="a": if cnta+cntb<a+b: print("Yes") cnta+=1 else: print("No") elif s[i]=="b": if cntb<b and cnta+cntb<a+b: print("Yes") cntb+=1 else: print("No") else: print("No")
s064418938
p03970
u227085629
1590610619
Python
Python (3.4.3)
py
Runtime Error
18
2940
99
s = input() a = 'CODEFESTIVAL2016' b = 0 for i in range(16): if a[i] != b[i]: b += 1 print(b)
s846093840
p03970
u006738234
1589510780
Python
Python (3.4.3)
py
Runtime Error
19
3064
493
N, A, B = (int(x) for x in input().split()) x = input() y = list(x) count_a = 0 count_b = 0 for i in range(0, N): if (y[i] == "a"): if(count_a + count_b < (A + B)): print("Yes") count_a += 1 else: print("No") elif(y[i] == "b"): if(count_a + count_b < (A + B) and count_b < B): print("Yes") count_b += 1 else: print("No") elif(y[i] == "c"): print("No")
s000773842
p03970
u425762225
1588090324
Python
PyPy3 (2.4.0)
py
Runtime Error
178
38768
332
N, A, B = map(int,input().split()) S = input() a_counter = 0 b_counter = 0 for i in range(N): s = S[0] if s == "a" and a_counter + b_counter <=A+B: a_counter += 1 print("Yes") elif s == "b" and b_counter <= B and a_counter + b_counter <=A+B: b_counter += 1 print("Yes") else: print("No") S = S[1:]
s094997853
p03970
u174404613
1587583035
Python
Python (3.4.3)
py
Runtime Error
17
2940
90
s="CODEFESTIVAL2016" t=input() ans=0 for c1,c2 in zip(s,t): if c1!=c2 : ns+=1 print(ans)
s051682864
p03970
u545644875
1587245204
Python
Python (3.4.3)
py
Runtime Error
18
3064
413
x = list(map(int, input().split())) s = list(input()) y = len(s) for i in (0,y - 1): if s[i] == "c": print("NO") elif s[i] == "b": if i < x[1] + x[2] and i < x[2]: print("YES") else: print("NO") else: if i < x[1] + x[2]: print("YES") else: print("NO")
s344838884
p03970
u263933075
1586222432
Python
Python (3.4.3)
py
Runtime Error
17
2940
417
s=input() ans=0 if s[0]=='C': ans+=1 if s[1]='O': ans+=1 if s[2]='D': ans+=1 if s[3]='E': ans+=1 if s[4]='F': ans+=1 if s[5]='E': ans+=1 if s[6]='S': ans+=1 if s[7]='T': ans+=1 if s[8]='I': ans+=1 if s[9]='V': ans+=1 if s[10]='A': ans+=1 if s[11]='L': ans+=1 if s[12]='2': ans+=1 if s[13]='0': ans+=1 if s[14]='1': ans+=1 if s[15]='6': ans+=1 print(ans)
s970750196
p03970
u691018832
1585661522
Python
Python (3.4.3)
py
Runtime Error
20
3060
109
s = input() ans = 'CODEFESTIVAL2016' cnt = 0 for i in range(n): if s[i] != ans[i]: cnt += 1 print(cnt)
s624077071
p03970
u691018832
1585661462
Python
Python (3.4.3)
py
Runtime Error
17
2940
111
s = input() ans = 'CODEFESTIVAL2016' cnt = 0 for i in range(n): if s[i] = != ans[i]: cnt += 1 print(cnt)
s131810783
p03970
u577914737
1577986896
Python
Python (3.4.3)
py
Runtime Error
17
2940
154
a = 'CODEFESTIVAL2016' b = input() lista = list(a) listb = list(b) count = 0 for i in range(len(lista)): if lista[i]!=listb[i]: count++ print(count)
s858033000
p03970
u577914737
1577986888
Python
Python (3.4.3)
py
Runtime Error
17
2940
154
a = 'CODEFESTIVAL2016' b = input() lista = list(a) listb = list(b) count = 0 for i in range(len(lista)): if lista[i]!=listb[i]: count++ print(count)
s213272625
p03970
u296150111
1574742550
Python
Python (3.4.3)
py
Runtime Error
17
2940
96
s=input() ans="CODEFESTIVAL2016" ans=0 for i in range(16): if s[i]!=ans[i]: ans+=1 print(ans)
s450894608
p03970
u094191970
1574211307
Python
Python (3.4.3)
py
Runtime Error
17
2940
105
s=input() a='CODEFESTIVAL2016' cnt=0 for i in range(len(s)): if s[i]!=a[i]: cnt+=1 print(ans)
s995795741
p03970
u556589653
1571772224
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38384
106
S = input() K = "CODEFESTIVAL2016" sum = 0 for i in range(len(S)): if S[i] != K[i] sum += 1 print(sum)
s976012046
p03970
u871596687
1569091316
Python
Python (3.4.3)
py
Runtime Error
17
2940
127
S = list(input()) C = list(CODEFESTIVAL2016) cnt = 0 for i in range(len(C)): if S[i] != C[i]: cnt += 1 print(cnt)
s185309686
p03970
u727801592
1567569917
Python
Python (3.4.3)
py
Runtime Error
17
3188
407
import sys input = sys.stdin.readline W,H=map(int,input().split()) p=sorted(int(input()) for i in range(W)) q=sorted(int(input()) for i in range(H)) ans=sum(p)*(H+1)+sum(q)*(W+1) for i in range(W+H): if p[len(p)-1]>=q[len(q)-1]: ans-=p[len(p)-1]*len(q) p.pop() if p==[]: print(ans) exit() else: ans-=q[len(q)-1]*len(p) q.pop() if q==[]: print(ans) exit()
s786471518
p03970
u223646582
1561768798
Python
Python (3.4.3)
py
Runtime Error
17
2940
105
S1=input() S2='CODEFESTIVAL2016' ans=0 for i in len(S1): if S1[i]!=S2[i]: ans+=1 print(ans)
s680454318
p03970
u223646582
1561768746
Python
Python (3.4.3)
py
Runtime Error
18
2940
104
S1=input() S2='CODEFESTIVAL2016' ans=0 for i in len(S): if S1[i]!=S2[i]: ans+=1 print(ans)
s706674441
p03970
u331464808
1555692301
Python
Python (3.4.3)
py
Runtime Error
17
2940
96
s= input() ss ="CODEFESTIVAL2016" t = 1 for i in range(ss): if s[i]!=ss[i]: t +=1 print(t)
s095969028
p03970
u331464808
1555692262
Python
Python (3.4.3)
py
Runtime Error
17
2940
95
s= input() ss ="CODEFESTIVAL2016" t = 1 for i in range(s): if s[i]==ss[i]: t +=1 print(t)
s529161376
p03970
u331464808
1555692210
Python
Python (3.4.3)
py
Runtime Error
17
2940
99
s= input() ss =‘CODEFESTIVAL2016’ t = 1 for i in range(s): if s[i]==ss[i]: t +=1 print(t)
s299405319
p03970
u913110564
1550205005
Python
Python (3.4.3)
py
Runtime Error
17
2940
101
a=input() ans="CODEFESTIVAL2016" diff=0 for i in range(16): if a[i]!=ans[i]: diff++ print(diff)
s211162287
p03970
u595893956
1547534090
Python
Python (3.4.3)
py
Runtime Error
17
2940
99
s=input() t="CODEFESTIVAL2016" ret=0 for i range(s.len()): if s[i] != t[i]: ret+=1 print(ret)
s658452811
p03970
u089032001
1546312422
Python
Python (3.4.3)
py
Runtime Error
17
2940
102
S = input() ans = "CODEFESTIVAL2016" a = 0 for i in range(S): if S[i] != ans[i]: a += 1 print(a)
s168439318
p03970
u177398299
1537204838
Python
Python (3.4.3)
py
Runtime Error
17
2940
96
x, y = map(int, input().split()) print(sum(a != b for a, b in zip(input(), 'CODEFESTIVAL2016')))
s250202172
p03970
u898651494
1536943826
Python
Python (3.4.3)
py
Runtime Error
17
2940
2320
#include <iostream> #include <fstream> #include <cmath> #include <cstdlib> #include <ctime> #include <algorithm> #include <numeric> #include <functional> #include <string> #include <vector> #include <bitset> #include <map> #include <set> #include <stack> #include <queue> #include <deque> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define REP(i,n) for(int i = 0; i < int(n); i++) #define REREP(i,n) for(int i = int(n - 1); i >= 0; i--) #define FOR(i, m, n) for(int i = int(m);i < int(n);i++) #define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--) #define ALL(obj) (obj).begin(),(obj).end() #define VI vector<int> #define VVI vector<vector<int>> #define VVVI vector<vector<vector<int>>> #define VD vector<double> #define VVD vector<vector<double>> #define VVVD vector<vector<vector<double>>> #define VL vector<ll> #define VVL vector<vector<ll>> #define VVVL vector<vector<vector<ll>>> #define VB vector<bool> #define VVB vector<vector<bool>> #define VVVB vector<vector<vector<bool>>> #define VS vector<string> #define VVS vector<vector<string>> #define VVVS vector<vector<vector<string>>> #define PII pair<int,int> #define PDD pair<double,double> #define PLL pair<ll,ll> #define VPII vector<pair<int,int>> #define VVPII vector<vector<pair<int,int>>> #define VVVPII vector<vector<vector<pair<int,int>>>> #define VPLL vector<pair<ll,ll>> #define VVPLL vector<vector<pair<ll,ll>>> #define VVVPLL vector<vector<vector<pair<ll,ll>>>> const ll MOD = (ll)1e9 + 7; // 998244353 const ll HINF = (ll)1e18; const ll LINF = (ll)1e9; const long double PI = 3.1415926535897932384626433; void YN(bool flag) { cout << ((flag) ? "YES" : "NO") << endl; } void Yn(bool flag) { cout << ((flag) ? "Yes" : "No") << endl; } void yn(bool flag) { cout << ((flag) ? "yes" : "no") << endl; } int main() { string s; cin >> s; int ans = 0; if (s[0] != 'C')ans++; if (s[1] != 'O')ans++; if (s[2] != 'D')ans++; if (s[3] != 'E')ans++; if (s[4] != 'F')ans++; if (s[5] != 'E')ans++; if (s[6] != 'S')ans++; if (s[7] != 'T')ans++; if (s[8] != 'I')ans++; if (s[9] != 'V')ans++; if (s[10] != 'A')ans++; if (s[11] != 'L')ans++; if (s[12] != '2')ans++; if (s[13] != '0')ans++; if (s[14] != '1')ans++; if (s[15] != '6')ans++; cout << ans << endl; return 0; }
s382011332
p03970
u005260772
1533932741
Python
Python (2.7.6)
py
Runtime Error
10
2568
110
s1 = 'CODEFESTIVAL2016' print s2 ans = 0 for i in range(len(s1)): ans += [0, 1][s1[i] != s2[i]] print ans
s319510918
p03970
u108808596
1533085626
Python
Python (2.7.6)
py
Runtime Error
10
2568
96
s=raw_input() t='CODEFESTIVAL2016' c=0 for i in range(16); if s[i] != t[i]: c += 1 print c
s058536471
p03970
u109256064
1531246587
Python
Python (2.7.6)
py
Runtime Error
10
2568
114
a = "REMEMBER TO PUT AC/WA ONLY" b = raw_input() r = 0 for i in xrange(len(a)): if a[i] != b[i]: r += 1 print r
s002054899
p03970
u030726788
1521574655
Python
Python (3.4.3)
py
Runtime Error
17
3064
92
s=input() co="CODEFESTIVAL2016" cou=0 for i in range(s): if(s[i]!=co[i]):cou+=1 print(cou)
s967219678
p03970
u729133443
1520914004
Python
Python (3.4.3)
py
Runtime Error
24
3700
86
import difflib;print(difflib.SequenceMatcher(None,'CODEFESTIVAL2016',input())*100//16)
s721647352
p03970
u563710899
1477889100
Python
Python (2.7.6)
py
Runtime Error
17
2696
485
W,H=map(int,raw_input().split()) p=[input() for i in range(W)] q=[input() for i in range(H)] p.sort(reverse=True) q.sort(reverse=True) cost=0 del_H=0 del_W=0 len_p=W len_q=H while len_p>0 and len_q>0: if p[0]>q[0]: del_W+=1 cost+=p[0]*(del_H+1) del p[0] len_p-=1 else: del_H+=1 cost+=q[0]*(del_W+1) del q[0] len_q-=1 if len_p==0: cost+=sum(q)*(W+1) else: cost+=sum(p)*(H+1) print cost
s519520825
p03970
u967641647
1476475855
Python
Python (2.7.6)
py
Runtime Error
16
2568
471
NAB = map(int, raw_input().split()) N = NAB[0] A = NAB[1] B = NAB[2] S = raw_input() passed_student = 0 for n in range(0, N): if(A+B > passed_student): if(S[n] == 'a'): print 'Yes' passed_student = passed_student + 1 elif(S[n] == 'b'): if(B >= n): print 'Yes' passed_student = passed_student + 1 else: print 'No' else: print 'No' else: print 'No'
s808335427
p03970
u582243208
1476310775
Python
Python (3.4.3)
py
Runtime Error
24
3188
257
n,a,b=map(int,input().split()) s=input() for i in s: if a+b>0: if i=="a": a-=1 print("Yes") continue elif i=="b" and b>0: b-=1 print("Yes") continue print("No")
s744535339
p03970
u582243208
1476309338
Python
Python (3.4.3)
py
Runtime Error
23
2940
169
s=list(input()) v=list("CODEFESTIVAL2016") cnt=0 for i in range(16): if s[i]!=v[i]: cnt+=1 print(cnt)
s979680875
p03970
u582243208
1476309159
Python
Python (3.4.3)
py
Runtime Error
22
3064
129
s=input() v="CODEFESTIVAL2016" cnt=0 for i in range(16): if s[i]!=v[i]: cnt+=1 print(cnt)
s209080911
p03970
u610929383
1476214919
Python
Python (2.7.6)
py
Runtime Error
21
2692
245
import os import sys import ipdb def dump(x): print >> sys.stderr, "{0}".format(x) S = raw_input() correct = "CODEFESTIVAL2016" false_count = 0 for i, s in enumerate(S): if s != correct[i]: false_count += 1 print(false_count)
s132053010
p03970
u552668967
1476209296
Python
Python (2.7.6)
py
Runtime Error
17
2696
147
from sys import stdin a = 'CODEFESTIVAL2016' l = len(a) b = stdin.readline().strip() ans = 0 for i in xrange(l): if a[l]!=b[l]: ans+=1 print ans
s450751632
p03970
u108617242
1476195450
Python
Python (3.4.3)
py
Runtime Error
23
3064
289
nums = input().split() N = int(nums[0]) A = int(nums[1]) B = int(nums[2]) S = input() count = 0 bcount = 0 for x in S: if x == 'a' and A+B > count: count += 1 print("Yes") elif x == 'b' and A+B > count and bcount < B : count += 1 bcount += 1 print("Yes") else : print("No")
s062591317
p03970
u133129810
1476148636
Python
Python (3.4.3)
py
Runtime Error
23
3064
103
str = "CODEFESTIVAL2016" s =input() cnt = 0 for i in range(16): if s[i]!=str[i]: cnt++ print(cnt)
s263081883
p03970
u953834432
1476132048
Python
Python (3.4.3)
py
Runtime Error
22
3064
181
a = "CODEFESTIVAL2016" b = raw_input() count = 0 c = zip(a, b) for w in c: for i,j in w: if i == j: continue else: count +=1 print(count)
s350414745
p03970
u079701009
1476126370
Python
Python (2.7.6)
py
Runtime Error
15
2568
432
w, h = map(int, raw_input().split()) p = [] q = [] for i in xrange(w): p.append(int(raw_input())) for i in xrange(h): q.append(int(raw_input())) wl = w hl = h cost = 0 p.sort() q.sort() p.append(10 ** 8) q.append(10 ** 8) pc = 0 qc = 0 while(wl + hl - pc - qc> 0): if p[pc] < q[qc]: cost += (hl - qc + 1) * p[pc] pc += 1 else: cost += (wl - pc + 1) * q[qc] qc += 1 print cost
s263570945
p03970
u657357805
1476125093
Python
Python (3.4.3)
py
Runtime Error
23
3064
266
N=int(input()) a=[0]*N for i in range(N): a[i]=int(input()) minimum=1 count=0 for i in a: if(minimum<i): if i%minimum: count+= i//minimum else : count+= (i//minimum-1) else: minimum=max(minimum,i+1) print(count)
s749771719
p03970
u851897760
1476124560
Python
Python (3.4.3)
py
Runtime Error
24
3064
466
l = input().split() s = input() n = int(l[0]) a = int(l[1]) b = int(l[2]) count = 0 countt = 0 for i in s: if i == 'a': if count < a+b: count = count + 1 print('Yes') else: print('No') if i == 'b': if (count < a+b) and (countt < b): count = count + 1 countt = countt + 1 print('Yes') else: print('No') if i == 'c': print('No')
s009016277
p03970
u548479166
1476122187
Python
PyPy2 (5.6.0)
py
Runtime Error
38
8816
359
n,a,b=map(int,raw_input().split()) ab=a+b s=list(raw_input()) p=0 r=[] ro=0 for i in range(n): if s[i]=="a" and p<ab: r.append("Yes") p+=1 elif s[i]=="b" and p<ab and ro<b: ro+=1 p+=1 r.append("Yes") elif s[i]=="c": r.append("No") else: r.append("No") for i in range(n): print(r[i])
s156532182
p03970
u406648710
1476122063
Python
Python (2.7.6)
py
Runtime Error
17
2696
1299
neighbor = lambda c, w, h: filter( lambda b: 0 <= b[0] <= w and 0 <= b[1] <= h, [ (c[0]-1, c[1]), (c[0]+1, c[1]), (c[0], c[1]-1), (c[0], c[1]+1) ] ) t = raw_input() W, H = map(int, t.split(' ')) p, q = [], [] for i in xrange(W): p.append(int(raw_input())) for j in xrange(H): q.append(int(raw_input())) has = [[False for i in xrange(H+1)] for j in xrange(W+1)] has[0][0] = True Next = [(1, 0), (0, 1)] cost = 0 for i in xrange(W*H+W+H): Min = 100000005 choose = None Next.sort(key=lambda a: min(p[a[0]-1] if a[0] > 0 else 100000005, q[a[1]-1] if a[1] > 0 else 100000005)) choose = Next[-1] Min = min(p[choose[0]-1] if choose[0] > 0 else 100000005, q[choose[1]-1] if choose[1] > 0 else 100000005) # for each in Next: # if each[0] > 0: # if p[each[0]-1] < Min: # choose = each # Min = p[each[0]-1] # if each[1] > 0: # if q[each[1]-1] < Min: # choose = each # Min = q[each[1]-1] has[choose[0]][choose[1]] = True Next = Next[:-1] cost += Min for every in neighbor(choose, W, H): # print every if not has[every[0]][every[1]] and every not in Next: Next.append(every) print cost
s350353346
p03970
u098968285
1476121524
Python
Python (3.4.3)
py
Runtime Error
22
3064
253
# def makelist(n, m): # return [[0 for i in range(m)] for j in range(n)] # n = int(input()) # a, b = map(int, input().split()) # s = input() rei = "CODEFESTIVAL2016" s = input() ans = 0 for i in range(s): if rei[i] != s[i]: ans += 1 print(ans)
s876338359
p03970
u279903174
1476120888
Python
Python (2.7.6)
py
Runtime Error
16
2692
447
args = list(map(lambda x: int(x), raw_input().split())) N = args[0] A = args[1] B = args[2] s = input() a = 0 b = 0 for i in range(0, len(s)): if s[i] == 'a': if a + b < A + B: a = a + 1 print('Yes') else: print('No') elif s[i] == 'b': if a + b < A + B and b < B: b = b + 1 print('Yes') else: print('No') else: print('No')
s401313722
p03970
u077337864
1476119999
Python
Python (3.4.3)
py
Runtime Error
22
3064
354
N, A, B = map(int, input().split()) S = input() passed = [] for i in range(N): if S[i] == 'c': print('No') elif S[i] == 'a': if len(passed) <= A+B: print('Yes') passed.append('a') else: print('No') else: if len(passed) <= A+B and passed.count('b') <= B: print('Yes') passed.append('b') else: print('No')
s527838628
p03970
u501661505
1476119245
Python
Python (2.7.6)
py
Runtime Error
16
2568
102
dst = 'CODEFESTIVAL2016' src = raw_input() print sum(1 for i in range(len(dst))) if dst[i] != src[i] )
s774803548
p03970
u930698267
1476119210
Python
Python (2.7.6)
py
Runtime Error
16
2568
162
correct_str = "CODEFESTIVAL2016" wrong_str = raw_input() count = 0 for i in range(16): if wrong_str[i] != correct_str[i]: count count += 1 print str(count)
s486638301
p03970
u835464975
1476119127
Python
Python (2.7.6)
py
Runtime Error
16
2568
183
# -*- coding: utf-8 -*- correct = 'CODEFESTIVAL2016' wrong = str(raw_input()) sum = 0 for index in xrange(0, len(wrong)): if correct[i] != wrong[i]: sum += 1 print sum
s798357255
p03970
u729300713
1476119121
Python
Python (2.7.6)
py
Runtime Error
16
2572
132
s = raw_input() c = "CODEFESTIVAL2016" ans = 0 for i in range(len(c)): if s[i] != c[[i]: ans += 1 print ans
s978021569
p03970
u102438343
1476119116
Python
Python (2.7.6)
py
Runtime Error
16
2572
128
S = raw_input() answer = 0 model = "CODEFESTIVAL2016" for x range(15): if S[x] != model[x]: answer += 1 print answer
s133563686
p03970
u592453979
1476119019
Python
Python (2.7.6)
py
Runtime Error
16
2568
119
s = raw_input() orig = 'CODEFESTIVAL2016' result = 0 for i in len(s): if orig[i] != s: result += 1 print result
s004841133
p03970
u147510705
1476118980
Python
Python (2.7.6)
py
Runtime Error
16
2568
118
# get a string s = raw_input() n = 0 for i, c in enumerate('CODEFESTIVAL2016'): if s[i] != c: n++ print n
s398623147
p03970
u471797506
1476118857
Python
Python (2.7.6)
py
Runtime Error
16
2572
106
S = raw_input() T = "CODEFESTIVAL2016" ans = 0 for i in xrange(S): if S[i] != T[i]: ans += 1 print ans
s392437293
p03971
u629540524
1600888313
Python
PyPy3 (7.3.0)
py
Runtime Error
92
74568
286
n,x,y=map(int,input().split()) s= input() c=0 d=x+y f= False for i in range(n): if s[i]=="A": if c<d: f=True elif s[i]=="B": if c<d and c<=b: f=True if f: print("YES") c+=1 else: print("NO") f=False
s942591766
p03971
u680851063
1599187118
Python
Python (3.8.2)
py
Runtime Error
23
9060
11
5 2 2 ccccc
s891718196
p03971
u456579619
1599009415
Python
Python (3.8.2)
py
Runtime Error
24
8876
405
N, A, B = map(int, input().split()) S = input() ok_count = 0 ok_fcount = 0 for i in range(N): if S[i] == 'a': if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif S[i] == 'b': if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s313406791
p03971
u456579619
1599009262
Python
Python (3.8.2)
py
Runtime Error
25
9976
408
N, A, B = map(int, input().split()) S = list(input()) ok_count = 0 ok_fcount = 0 for i in range(N): if S[i] == a: if ok_count < A+B-1: print('Yes') ok_count +=1 else: print('No') elif S[i] == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s665593372
p03971
u456579619
1599009218
Python
Python (3.8.2)
py
Runtime Error
27
8832
407
N, A, B = map(int, input().split()) S = list(input()) ok_count = 0 ok_fcount = 0 for i in range(N): if S[i] == a: if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif S[i] == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s728627039
p03971
u456579619
1599009175
Python
Python (3.8.2)
py
Runtime Error
29
8972
413
N, A, B = map(int, input().split()) S = list(input().split) ok_count = 0 ok_fcount = 0 for i in range(N): if S[i] == a: if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif S[i] == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s360685109
p03971
u456579619
1599009070
Python
Python (3.8.2)
py
Runtime Error
25
8792
394
N, A, B = map(int, input().split()) S = list(input()) ok_count = 0 ok_fcount = 0 for s in S: if s == a: if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif s == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s810698451
p03971
u456579619
1599008951
Python
Python (3.8.2)
py
Runtime Error
20
8932
400
N, A, B = map(int, input().split()) S = list(input().split) ok_count = 0 ok_fcount = 0 for s in S: if s == a: if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif s == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s765274585
p03971
u456579619
1599008741
Python
Python (3.8.2)
py
Runtime Error
24
8828
402
N, A, B = map(int, input().split()) S = input() ok_count = 0 ok_fcount = 0 for s in S: if s == a: if ok_count < A+B-1 print('Yes') ok_count +=1 else: print('No') elif s == b: if ok_count <= A+B-1 and ok_fcount < B-1: print('Yes') ok_count+=1 ok_fcount+=1 else: print('No') else: print('No')
s024156933
p03971
u208120643
1597854085
Python
Python (3.8.2)
py
Runtime Error
120
27312
416
"""Boot-camp-for-Beginners_Easy003_B_Qualification-simulator_19-August-2020.py""" import numpy as np import sys N, A, B = map(int, input().split()) S = str(input()) for i in range(len(N)): if(S[i] == "c"): print("No") else: if(i >= A+B): print("No") else: if(S[i] == "b" and i < B): print("No") else: print("Yes")
s430749050
p03971
u683530136
1597632075
Python
Python (3.8.2)
py
Runtime Error
31
9032
581
# input 参加人数n, 予選通過人数a, 予選通過人数b n, a, b = map(int, input().split()) # input 参加者情報s s = input().split() counter = 0 count_b = 0 for i in s: counter += 1 # cの場合はNo if i == "c": print("No") # aの場合、counter <= A+BであればYes if counter < (a+b): print("Yes") else: print("No") # bの場合、counter <= A+B かつ count_b < B であれば"Yes" if counter < (a+b) && count_b < b: print("Yes") count_b += 1 else: print("No")
s777154586
p03971
u430336181
1596686271
Python
Python (3.8.2)
py
Runtime Error
20
9216
203
N = int(input()) X = list(map(int, input().split())) HP = [] for p in range(1, 101, 1): P = [p] * len(X) delta = sum([(i - j) ** 2 for (i, j) in zip(X, P)]) HP.append(delta) print(min(HP))
s344673379
p03971
u333404917
1595647250
Python
Python (3.8.2)
py
Runtime Error
27
9988
440
n, a, b = map(int, input().split()) s = list(input()) result = [] cnt = 0 cnt_b = 0 limit = a + b for student in s: if student == c: result.append("No") elif (student == "a") & (cnt < limit): result.append("Yes") cnt += 1 elif (student == "b") & (cnt < limit) & (cnt_b < b): result.append("Yes") cnt += 1 cnt_b += 1 else: result.append("No") print("\n".join(result))
s754105756
p03971
u830881690
1595634510
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
86504
413
n,a,b=map(int, input().split()) s=list(input()) num=0 qual=[] s_b=[i for i,x in enumerate(s) if x=='b'] for i in range(n): if num<a+b: if s[i]=='c': qual.append('No') elif s[i]=='a': num+=1 qual.append('Yes') else: if s_b.index(i)<b: num+=1 qual.append('Yes') else: qual.append('No') else: qual.append('No') print(qual, split='\n')
s385955635
p03971
u830881690
1595631362
Python
Python (3.8.2)
py
Runtime Error
22
9232
350
n,a,b=map(int, input().split()) s=input() num=0 s_b=[i for i,x in s if x=='b'] for i in range(n): if s[i]=='c': print('No') elif s[i]=='a': if i <=(a+b): num+=1 print('Yes') else: print('No') else: if s_b.index(i)<=b: num+=1 print('Yes') else: print('No') if num==a+b: break
s861623794
p03971
u830881690
1595631187
Python
Python (3.8.2)
py
Runtime Error
25
9916
356
n,a,b=map(int, input().split()) s=list(input()) num=0 s_b=[i for i,x in s if x=='b'] for i in range(n): if s[i]=='c': print('No') elif s[i]=='a': if i <=(a+b): num+=1 print('Yes') else: print('No') else: if s_b.index(i)<=b: num+=1 print('Yes') else: print('No') if num==a+b: break
s329996903
p03971
u830881690
1595630828
Python
Python (3.8.2)
py
Runtime Error
25
9304
369
n,a,b=map(int, input().split()) s=list(map(input().split())) num=0 s_b=[i for i,x in s if x=='b'] for i in range(n): if s[i]=='c': print('No') elif s[i]=='a': if i <=(a+b): num+=1 print('Yes') else: print('No') else: if s_b.index(i)<=b: num+=1 print('Yes') else: print('No') if num==a+b: break
s105652080
p03971
u188305619
1595126251
Python
Python (3.8.2)
py
Runtime Error
30
9088
351
N, A, B = map(int,input().split()) S = input() S = "a"*10000 yosen = 0 yosen_b = 1 for i in range(N): if S[i] == "a" and yosen < (A + B): print("Yes") yosen += 1 elif S[i] == "b" and yosen < (A + B) and yosen_b <= B: print("Yes") yosen += 1 yosen_b += 1 else: print("No")
s505781095
p03971
u266014018
1595044378
Python
Python (3.8.2)
py
Runtime Error
23
8824
613
#include<bits/stdc++.h> #define rep(i, n) for (int i=0; i < n; i++) typedef long long ll; using namespace std; int main() { int n, a, b; cin >> n >> a >> b; int total = a + b; string s; cin >> s; int cnt = 0, cntb = 0; rep(i,n){ string ans = "Yes"; if (s[i] == 'c') { ans = "No"; } else if (s[i] == 'a') { if (cnt < a+b) cnt++; else ans = "No"; } else { cntb++; if (cnt < a+b && cntb <= b) cnt++; else ans = "No"; } cout << ans << endl; } }
s835199905
p03971
u266014018
1595044336
Python
Python (3.8.2)
py
Runtime Error
19
8988
614
#include<bits/stdc++.h> #define rep(i, n) for (int i=0; i < n; i++) typedef long long ll; using namespace std; int main() { int n, a, b; cin >> n >> a >> b; int total = a + b; string s; cin >> s; int cnt = 0, cntb = 0; rep(i,n){ string ans = "Yes"; if (s[i] == 'c') { ans = "No"; } else if (s[i] == 'a') { if (cnt < a+b) cnt++; else ans = "No"; } else { cntb++; if (cnt < a+b and cntb <= b) cnt++; else ans = "No"; } cout << ans << endl; } }
s848913933
p03971
u091051505
1593826264
Python
Python (3.8.2)
py
Runtime Error
24
9108
402
n, A, B = map(int, input().split()) a, b = 0 s = input() for i in range(n): s_i = s[i] if s_i == 'a': if (a + b) < (A + B): a += 1 print('Yes') else: print('No') elif s_i == 'b': if ((a + b) < (A + B)) & (b < B): b += 1 print('Yes') else: print('No') else: print('No')
s750976530
p03971
u091051505
1593826115
Python
Python (3.8.2)
py
Runtime Error
20
8904
334
n, A, B = map(int, input().split()) a, b = 0 s = input() for i in range(n): s_i = s[i] if s_i == 'a': if (a + b) < (A + B): a += 1 print('Yes') else: print('No') elif s_i == 'b': if ((a + b) < (A + B)) & (b < B): b += 1 print('Yes') else: print('No') else: print('No')