problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03693
s053258087
Wrong Answer
r, g, b, = map(int, input().split()) if (r * 100 + g *10 + b) % 4 == 0: print('Yes') else: print('No')
p03637
s559824901
Wrong Answer
n = int(input()) l=list(map(int ,input().split())) four=0 two=0 one=0 for i in range(n): if l[i]%2==0: if l[i]==2: two+=1 else: four+=1 elif l[i]==1: one+=1 odd=n-(four+two+one) if four>=n//2: print('Yes') elif two>=2: if n==two: print("Yes") elif (n-(four+two))/2<=four: print("Yes") else: print("No") else: print("No")
p03387
s061809739
Accepted
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int): x = 3 * max([A, B, C]) - A - B - C print(x // 2 + x % 2 * 2) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() A = int(next(tokens)) # type: int B = int(next(tokens)) # type: int C = int(next(tokens)) # type: int solve(A, B, C) if __name__ == '__main__': main()
p03109
s822967729
Accepted
print('Heisei' if int(input()[5:7]) <= 4 else 'TBD')
p02660
s665881104
Wrong Answer
N=int(input()) nn=N import math i=2 ans=0 count1=0 count2=1 while math.sqrt(N)>=i: if nn%i==0: nn//=i count1+=1 if count1//count2>0: ans+=1 count2+=1 count1=0 else: i+=1 count1=0 count2=1 if ans==0 and N>=2: ans+=1 print(ans)
p02912
s338750731
Wrong Answer
N, M = map(int,input().split()) A = list(map(int,input().split())) A.sort() import bisect cnt = 0 if N == 1: print(int(A[0]/(2**M))) exit() else: while cnt < M: A[-1] /= 2 if A[-1] < A[-2]: a = A[-1] del A[-1] bisect.insort_left(A, a) cnt += 1 ans = 0 for i in range(N): ans += int(A[i]) print(ans)
p03997
s719705682
Accepted
a = int(input()) b = int(input()) c = int(input()) print((a+b)*c//2)
p03449
s539855827
Accepted
n = int(input()) A = [list(map(int, input().split())) for _ in range(2)] ans = -1 for i in range(n): ans = max(ans, sum(A[0][0:i+1])+sum(A[1][i:])) print(ans)
p03380
s278192113
Wrong Answer
n = int(input()) A = map(int, input().split()) A = sorted(A) maxa = max(A) if abs(maxa//2 - A[n//2-1]) <= abs(maxa//2 - A[n//2]): print(maxa, A[n//2-1]) else: print(maxa, A[n//2])
p02772
s133441150
Accepted
N = int(input()) A = [int(i) for i in input().split() if int(i) % 2 == 0] t = 0 for x in A: if x % 3 != 0 and x % 5 != 0: t += 1 if t == 0: print('APPROVED') else: print('DENIED')
p03696
s452233199
Accepted
n = int(input()) s = input() c = 0 scount = 0 for i, si in enumerate(list(s)): if si == '(': c += 1 else: c -= 1 if c < 0: scount += 1 c = 0 s = '('*scount + s s = s + ')'*c print(s)
p03449
s150736353
Accepted
n = int(input()) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) ans = 0 for i in range(n): c = sum(a1[:i+1]) + sum(a2[i:]) ans = max(ans, c) print(ans)
p02924
s906032700
Wrong Answer
n = int(input()) ans = int((n-1)*(n-2)/2) print(ans)
p03799
s493708498
Accepted
s,c = map(int,input().split()) if c//2 <= s: print(c//2) else: ans = s ans += (c-2*s)//4 print(ans)
p03861
s501353313
Wrong Answer
# -*- coding : utf-8 -*- a,b,x = map(int, input().split()) A = a // x B = b // x if a % x != 0: print(b-a) else: print( b-a + 1)
p03035
s341322633
Accepted
a, b = map(int, input().split()) if a >= 13: print(b) elif 6 <= a and a <= 12: print(int(b/2)) else: print('0')
p03773
s600389685
Accepted
a = list(map(int, input().split())) print(sum(a)%24)
p03632
s065503018
Accepted
# Alice: a to b # Bob: c to d a,b,c,d = map(int, input().split()) if b <= c or d <= a: print(0) elif (c<= a<b <=d): print(b-a) elif (a<= c<d <=b): print(d-c) elif (a <= c < b <= d): print(b-c) elif (c <= a < d <= b): print(d-a) else: print(None)
p03219
s660710464
Accepted
X,Y = map(int,input().split()) print(X+Y//2)
p02706
s216191855
Accepted
n,m=map(int, raw_input().split()) arr=map(int, raw_input().split()) s=sum(arr) if s>n: print -1 else: print n-s
p02696
s367633676
Accepted
A, B, N = map(int, input().split()) x = min(N, B-1) ans = (A*x)//B - A*(x//B) print(ans)
p02866
s612701440
Wrong Answer
from collections import Counter N = int(input()) D = list(map(int, input().split())) c = Counter(D) mod = 998244353 L = list(set(D[:])) L.sort(reverse=True) if (D[0] != 0): print(0) exit() elif (c[0] > 1): print(0) exit() if (N == 1): print(1) exit() ans = 1 for i in L: if (i == 1): ans *= 1 break if (c[i - 1] == 0 and i != 1): print(0) exit() else: ans *= c[i - 1] ** c[i] print(ans)
p02780
s590727644
Accepted
N, K = map(int, input().split()) p = [int(a) for a in input().split()] B = [0]*(N-K+1) B[0] = sum(p[0:K]) for i in range(1, N-K+1): B[i] = B[i-1] - p[i-1] + p[i+K-1] max_ind = B.index(max(B)) ep = 0 for i in range(K): ep += (p[max_ind+i]*(p[max_ind+i]+1))/(2*p[max_ind+i]) print(ep)
p03986
s329542638
Accepted
L=0 R=0 X=list(input()) A=len(X) for i in range(A): if X[i]=="S": R=R+1 elif X[i]=="T": if R!=0: L=L+1 R=R-1 print(A-2*L)
p02768
s717789419
Accepted
MOD = 10 ** 9 + 7 n, a, b = list(map(int, input().split())) ans = 0 total = pow(2, n, MOD) def comb(n, k): bunshi = 1 bunbo = 1 for i in range(k): bunshi *= n - i bunbo *= i+1 bunshi %= MOD bunbo %= MOD return (bunshi * pow(bunbo, MOD-2, MOD)) % MOD ans = total - (comb(n, a) + comb(n, b)) - 1 print(ans % MOD)
p03487
s111582276
Accepted
n = int(input()) alst = list(map(int, input().split())) cnt = [0 for _ in range(n)] for a in alst: if a > n: continue cnt[a - 1] += 1 rem = 0 for i, num in enumerate(cnt, start = 1): if num >= i: rem += i print(n - rem)
p02909
s169589490
Accepted
S=input() if S=="Sunny": print("Cloudy") elif S=="Cloudy": print("Rainy") else: print("Sunny")
p03359
s847466616
Accepted
A,B = map(int,input().split()) if A > B: print(A-1) else: print(A)
p03854
s627356491
Accepted
s = input() s1 = s.replace("eraser", 'xxx') s2 = s1.replace("erase", 'xxx') s3 = s2.replace("dreamer", 'xxx') s4 = s3.replace("dream", 'xxx') s5 = s4.strip('x') if (s5 == ''): print('YES') else: print('NO')
p03565
s410716046
Accepted
s=input() t=input() n=len(s) m=len(t) ans='UNRESTORABLE' a=[] for i in range(n-m+1): if s[i]==t[0] or s[i]=='?': for j in range(m): if s[i+j]!=t[j] and s[i+j]!='?': break else: an=list(s[:i]+t+s[i+j+1:]) for k in range(n): if an[k]=='?': an[k]='a' an=''.join(an) a.append(an) if len(a): print(min(a)) else:print(ans)
p03254
s450780785
Accepted
from bisect import bisect_left n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() a_cs = [0] * (n + 1) for i in range(n): a_cs[i + 1] = a_cs[i] + a[i] idx = bisect_left(a_cs, x) if idx == n + 1: ans = n - 1 elif a_cs[idx] > x: ans = idx - 1 else: ans = idx print(ans)
p02988
s299485900
Accepted
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(1, n-1): if (p[i - 1] < p[i]) and (p[i] < p[i + 1]): cnt += 1 elif (p[i - 1] > p[i]) and (p[i] > p[i + 1]): cnt += 1 print(cnt)
p03767
s363897721
Accepted
N = int(input()) A = sorted(list(map(int,input().split()))) cnt = 0 cur = 0 for i in range(3*N-1,-1,-2): a,b = A[i],A[i-1] cnt += b cur += 1 if cur==i-1:break print(cnt)
p02756
s104460564
Accepted
string = input() kai = int(input()) data = [input().split(' ') for i in range(kai)] key = 0 #0 start former = [] latter = [] for i in range(kai): if(data[i][0] == '1'): key = (key + 1) % 2 elif((int(data[i][1]) + key) % 2 == 1): former.append(data[i][2]) else: latter.append(data[i][2]) string = ''.join(former[::-1]) + string + ''.join(latter) if(key == 0): print(string) else: print(string[::-1])
p02987
s330961792
Wrong Answer
import sys a1=sys.stdin.readline() t=a1.isupper() a2=list(a1) b=[ord(x) for x in a2] b.sort() if len(a2)==4 and t==True: if b[0]==b[1] and b[2]==b[3] and b[0]!=b[3] and b[1]!=b[2]: print("Yes") else: print("No") else: print("Error")
p03131
s501625643
Wrong Answer
K,A,B=map(int,input().split()) bis=1 if K==1: bis+=1 elif A>=B-1 or K-A+1<=0: bis+=K else: if int((K-(A-1)))%2==0: bis=A+(B-A)*(K-(A-1))//2 else: bis=A+(B-A)*(K-(A-1))//2+1 print(bis)
p02700
s962612576
Accepted
# B a, b, c, d = map(int, input().split()) while True: c = c - b if c <= 0: print('Yes') break a = a - d if a <= 0: print('No') break
p03745
s224972185
Wrong Answer
n=int(input()) a=list(map(int,input().split())) ans=1 temp=0 cnt=0 for i in range(1,n): cnt=cnt+1 if a[i-1]<a[i] and temp==0: temp=1 elif a[i-1]>a[i] and temp==0: temp=2 elif a[i-1]>a[i] and temp==1: temp=2 if cnt>1: ans=ans+1 cnt=0 elif a[i-1]<a[i] and temp==2: temp=1 if cnt>1: ans=ans+1 cnt=0 print(ans)
p02689
s743293478
Accepted
#!/usr/bin/python3 # -*- coding: utf-8 -*- n, m = map(int, input().split()) h_list = list(map(int, input().split())) ten_list = [1] * n for i in range(0, m): a, b = map(int, input().split()) if h_list[a - 1] <= h_list[b - 1]: ten_list[a - 1] = 0 if h_list[a - 1] >= h_list[b - 1]: ten_list[b - 1] = 0 print(sum(ten_list))
p02584
s492113116
Accepted
# -*- coding: utf-8 -*- X,K,D=map(int,input().split()) X=abs(X) ii=int(X/D) if K<=ii: X-=K*D else: X-=ii*D if (K-ii)%2==1: X-=D print(abs(X))
p02601
s760079776
Accepted
A, B, C = map(int, input().split()) K = int(input()) for i in range(K): for ii in range(K - i): iii = K - i - ii a = A * (2 ** i) b = B * (2 ** ii) c = C * (2 ** iii) if a < b < c: print('Yes') exit(0) print('No')
p02723
s337773705
Accepted
s = list(input()) if (s[2] == s[3]) and (s[4] == s[5]): print("Yes") else: print("No")
p02744
s357560537
Accepted
#!python3 import sys sys.setrecursionlimit(200000) # input N = int(input()) l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] def solve(s, m): if len(s) == N: print(s) else: for i in range(m + 1): solve(s + l[i], max(i + 1, m)) def main(): solve("a", 1) if __name__ == "__main__": main()
p02924
s724314634
Wrong Answer
n = int(input()) ans = int((n-1)*n*0.5) print(ans)
p02817
s962576039
Accepted
s, t = map(str, input().split()) print(t + s)
p02553
s003669401
Accepted
a, b, c, d = map(int, input().split()) x = max(a * c, a * d) y = max(b * c, b * d) z = max(x, y) print(z)
p02755
s907964144
Accepted
from math import floor A, B = map(int, input().split()) tax_A = 0.08 tax_B = 0.1 i = 1 A_list = [] while(floor(i*tax_A)<=A): if floor(i*tax_A)==A: A_list.append(i) i += 1 i = 1 B_list = [] while(floor(i*tax_B)<=B): if floor(i*tax_B)==B: B_list.append(i) i += 1 if max(min(A_list), min(B_list)) in A_list and max(min(A_list), min(B_list)) in B_list: print(max(min(A_list), min(B_list))) else: print(-1)
p02993
s701396770
Accepted
#!/usr/bin/env python3 def main(): S = input() if S[0] == S[1]: print('Bad') elif S[1] == S[2]: print('Bad') elif S[2] == S[3]: print('Bad') else: print('Good') if __name__ == '__main__': main()
p03860
s341356976
Accepted
atcoder,s,contest = map(str,input().split()) print(atcoder[0]+s[0]+contest[0])
p02811
s969801282
Wrong Answer
(K, X) = list(map(int, input().split())) if (K * 500) >= K: print("Yes") else: print("No")
p03645
s298951364
Wrong Answer
def check(): N,M = map(int, input().split()) hune = sorted([list(map(int, input().split())) for _ in range(M)], key=lambda x:x[0]) for a,b in hune: if a == 1: for c,d in hune: if c == b and d == N: print('POSSIBLE') return if a == 2: break print('POSSIBLE') check()
p02622
s270627377
Wrong Answer
s=input() t=input() ans=0 for i in range(len(s)): if s[i]==t[i]: ans+=1 print(ans)
p02995
s843855017
Wrong Answer
a, b, c, d = map(int, input().split()) if a != 0: xc = int((a-1)/c) yc = int(b/c) xd = int((a-1)/d) yd = int(b/d) xcd = int((a - 1) / (c * d)) ycd = int(b / (c * d)) else: xc = int((a)/c) yc = int(b/c) xd = int((a)/d) yd = int(b/d) xcd = int((a) / (c * d)) ycd = int(b / (c * d)) print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))
p02618
s673079672
Wrong Answer
for t in range(1,27): print(t)
p02755
s860266004
Wrong Answer
a , b = map(int, input().split()) for i in range(1 , 10100) : a1 = int(i*0.08) b1 = int(i*0.10) if a1 == a and b1 == b : print(i) else : print(-1)
p03095
s056472283
Accepted
import collections N=int(input()) S=list(input()) l=[] c=collections.Counter(S) num=1 p=10**9+7 values=list(c.values()) #aのCollectionのvalue値のリスト(n_1こ、n_2こ…) key=list(c.keys()) #先のvalue値に相当する要素のリスト(要素1,要素2,…) for i in range(len(key)): l.append([key[i],values[i]])#lは[要素i,n_i]の情報を詰めたmatrix #print(l) for i in range(len(l)): num=num*(l[i][1]+1) print((num-1)%p)
p02603
s797720871
Accepted
def main(): N = int(input()) A = list(map(int, input().split())) b, h, s, = 0, 0, 1000 for a in A: n_b, n_h = b % a, h + (b // a) if s // a == n_h: n_b = max(n_b, s % a) if s // a > n_h: n_h = s // a n_b = s % a s = max(s, b + h * a) b, h = n_b, n_h return s print(main())
p03323
s942720680
Accepted
a, b = list(map(int, input().split())) if a <= 8 and b <= 8: print("Yay!") else: print(":(")
p03282
s221076883
Accepted
import re S=str(input()) k=int(input()) if set(S)=={'1'}: print(1) else: x=re.search(r'[2-9]',S).start() if S[0]=='1': if k<=x: print(S[0]) else: print(S[x]) else: print(S[0])
p02882
s134103019
Accepted
import math a,b,x = map(int,input().split()) if x <= b*a*a*1/2: dum = 2*x/(a*b) ans = 90-(math.degrees(math.atan(dum/b))) else: x -= b*a*a*1/2 dum = b-(x*2/(a*a)) ans = math.degrees(math.atan(dum / a)) print(ans)
p02621
s293714530
Accepted
a=int(input()) print(a+a**2+a**3)
p03471
s852412994
Accepted
N,Y=map(int,input().split()) for i in range(N+1): for j in range(N+1-i): k=N-i-j if 10000*i+5000*j+1000*k==Y: print(i,j,k) exit() print(-1,-1,-1)
p03479
s777714654
Wrong Answer
import math X, Y = map(int, input().split()) YdX = Y/X math.log(YdX, 2) print(int(math.log(YdX, 2))+1)
p03438
s327731119
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) cnt=0 margin=0 for i in range(n): x=a[i] y=b[i] if x>y: cnt+=x-y elif x<y: margin+=(y-x)//2 print('Yes' if margin>=cnt else 'No')
p02743
s592943133
Wrong Answer
a, b, c = map(int, input().split()) if a ** 0.5 + b ** 0.5 < c ** 0.5: print('Yes') else: print('No')
p03478
s546111829
Wrong Answer
def DigitsSUM(Num): sumN = 0 while Num > 0: sumN += Num % 10 Num/=10 return int(sumN) N,A,B = input().split() LowerLimit=int(A) UpperLimit=int(B) num = int(N) sumary = [] counter = 0 for i in range(1,num+1): sumN = DigitsSUM(i) if LowerLimit <= sumN and sumN <= UpperLimit+1: print(i, sumN) counter+=int(i) print(counter)
p02631
s174820376
Accepted
N = int(input()) a = list(map(int,input().split())) ans = 0 for i in range (N): ans = ans ^ a[i] for i in range (N): print(ans ^ a[i])
p02613
s632060803
Accepted
n = int(input()) s = [""]*n for i in range(n): s[i] = input() ac,wa,tle,re = 0,0,0,0 for i in range(n): if s[i] == "AC": ac += 1 elif s[i] == "WA": wa += 1 elif s[i] == "TLE": tle += 1 else: re += 1 print("AC x %d\nWA x %d\nTLE x %d\nRE x %d" % (ac,wa,tle,re))
p03673
s822953704
Wrong Answer
n = int(input()) a = list(map(int, input().split())) s = [] for i in range(n): if i%2==1: s.insert(0,' ') s.insert(0, a[i]) else: s.append(a[i]) s.append(' ') s.pop(-1) print(s) s = ''.join(map(str,s)) print(s)
p02607
s378556621
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if i % 2 == 0 and a[i] % 2 != 0: ans += 1 print(ans)
p02598
s191871579
Accepted
n, k = map(int, input().split()) a = list(map(int, input().split())) l = 0 r = max(a) while r - l > 1: cnt = 0 mid = (r + l) // 2 for i in range(n): d = (a[i] // mid) + (a[i] % mid != 0) - 1 cnt += d if cnt <= k: r = mid else: l = mid print(r)
p03456
s244864402
Accepted
a, b = input().split() N = int(a+b) for n in range(N): if n*n == N: print("Yes") break else: print("No")
p02993
s655534222
Accepted
S = list(input()) if S[0] == S[1]: print("Bad") elif S[1] == S[2]: print("Bad") elif S[2] == S[3]: print("Bad") else: print("Good")
p02918
s722491754
Accepted
n,k = map(int,input().split()) s = input() s += 'x' l = list() cnt = 1 for i in range(1,n+1): if s[i]!=s[i-1]: l.append(cnt) cnt = 1 else: cnt += 1 m = min(2*k+1, len(l)) ans = sum(l[0:m]) - 1 for j in range(m,len(l)): ans += l[j] - 1 print(ans)
p03434
s309777438
Accepted
N = int(input()) a = sorted(list(map(int, input().split())), reverse=True) A = 0 B = 0 for i in range(0, N, 2): A += a[i] for i in range(1, N, 2): B += a[i] print(A - B)
p02775
s674002471
Accepted
N = list(map(int,list(input()))) ans = 0 skfl = 0 nf = 0 for i in range(1, len(N) + 1): if i != len(N): if N[-(i+1)] >= 5: nf = 1 if N[-i] + skfl + nf > 5: ans += 10 - N[-i] - skfl skfl = 1 else: ans += N[-i] + skfl skfl = 0 nf = 0 print(ans+skfl)
p02548
s303563453
Accepted
N = int(input()) count = 0 for i in range(1,N): if i*2>=N: break j = N//i if i*j == N: j -= 1 count += j count += N-i print(count)
p03838
s741594078
Wrong Answer
x, y = map(int, input().split()) if x*y < 0: print(abs(abs(x)-abs(y))+1) else: if x < y: print(y-x) else: print(x-y+2)
p03971
s299614951
Wrong Answer
i = list(map(int,input().split())) person = i[1] + i[2] B = i[2] rank = input() passp = 0 bp = 0 for i,r in enumerate(rank): if r == "a" and passp < person: print("Yes") passp += 1 elif r == "b": bp += 1 if passp < person and bp <=B: print("Yes") passp += 1 else: print("No")
p02862
s725444175
Accepted
def modinv(a,m): return pow(a,m-2,m) x,y = map(int,input().split()) if (x+y)%3 != 0 or 2*y-x < 0 or 2*x-y < 0: print(0) else: a = (2*y-x)//3 b = (2*x-y)//3 ans = 1 mod = 10**9+7 for i in range(1,a+1): ans = ans*(i+b)*modinv(i,mod)%mod print(ans)
p03998
s280600935
Accepted
sa = input() sb = input() sc = input() next = "a" while True: if next == "a": if sa == "": break next = sa[0] sa = sa[1:] elif next == "b": if sb == "": break next = sb[0] sb = sb[1:] else: if sc == "": break next = sc[0] sc = sc[1:] if next == "a": print("A") elif next == "b": print("B") else: print("C")
p02613
s986478316
Accepted
N = int(input()) data = [input() for x in range(N)] keys_list = ['AC','WA','TLE','RE'] check_list = {'AC':0,'WA':0,'TLE':0,'RE':0} for x in data: check_list[x] = check_list[x] + 1 for x in keys_list: print('{} x {}'.format(x,check_list[x]))
p02813
s125188710
Wrong Answer
import itertools N = int(input()) L1 = tuple(map(int,input().split())) a = 0 L2 = tuple(map(int,input().split())) b = 0 L = [i for i in range(1,N+1)] Base = list(itertools.permutations(L)) print(Base) for i in range(len(Base)): if Base[i] == L1: a = i+1 for i in range(len(Base)): if Base[i] == L2: b = i+1 print(abs(a-b))
p03419
s034478754
Accepted
n, m = map(int, input().split()) if n == 1 and m == 1: ans = 1 elif n == 1: ans = m - 2 elif m == 1: ans = n - 2 else: ans = (n - 2) * (m - 2) print(ans)
p02835
s834697080
Accepted
a = sum(list(map(int,input().split()))) print("bust") if a >= 22 else print("win")
p03565
s716484208
Accepted
import re S,T=open(0) S=S.replace('?','.') T=T[:-1] s=len(S) t=len(T) for i in range(s-t,-1,-1): if re.match(S[i:i+t],T):print((S[:i]+T+S[i+t:]).replace('.','a'));exit() print('UNRESTORABLE')
p03262
s574454287
Accepted
import numpy as np from fractions import gcd n, x = map(int, input().split()) X = np.array(list(map(int, input().split()))) X = np.abs(X - x) X = np.sort(X) ans = X[0] for i in range(1,n): ans = gcd(ans, X[i]) print(ans)
p02743
s209010317
Wrong Answer
a, b, c = map(int, input().split()) if a ** 0.5 + b ** 0.5 < c ** 0.5: ans = "Yes" else: ans = "No" print(ans)
p02773
s540387963
Accepted
n = int(input()) s = [] for i in range(n): s.append(input()) dic = {} for x in s: if x in dic.keys(): dic[x] += 1 else: dic[x] = 1 max_v = max(dic.values()) a = [] for k, v in dic.items(): if v == max_v: a.append(k) ans = sorted(a) for a in ans: print(a)
p02597
s056486226
Accepted
N = int(input()) c = list(input()) from collections import Counter dic = Counter(c) left = c[:dic["R"]] print(left.count("W"))
p03038
s449936527
Wrong Answer
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline from bisect import bisect_left n, m = map(int, input().split()) a = list( map(int, input().split())) a.sort() bc = [tuple(map(int,input().split())) for i in range(m)] bc = sorted(bc, reverse=True, key=lambda x: x[1]) i = 0 c_card = [] for b, c in bc: c_card.extend([c]*b) if len(c_card)+b >= n: break ans = 0 for i in range(n): if i >= len(c_card): ans += a[i] else: ans += max(a[i], c_card[i]) print(ans)
p03495
s023918149
Accepted
from collections import Counter def solve(): N, K = map(int, input().split()) A = list(map(int, input().split())) counter = Counter(A) sorted_cnter = sorted(list(counter.items()), key=lambda x: x[1]) will_rewrite = sorted_cnter[:-K] ans = 0 for t in will_rewrite: ans += t[1] print(ans) if __name__ == '__main__': solve()
p03673
s398439701
Accepted
from collections import deque def resolve(): n = int(input()) a = list(map(int, input().split())) d = deque() for i in range(n): if i % 2 == 0: d.append(a[i]) else: d.appendleft(a[i]) while len(d) > 0: if n % 2 == 0: print(d.popleft(), end=' ') else: print(d.pop(), end=' ') print('') return if __name__ == "__main__": resolve()
p02787
s975360566
Accepted
h,n,*L=map(int,open(0).read().split()) dp=[0]*(h+10100) for i in range(1,h+1):dp[i]=min(dp[i-a]+b for a,b in zip(*[iter(L)]*2)) print(dp[h])
p02613
s350144482
Wrong Answer
c = int(input()) j = [0]*4 for i in range(c): i = input() if i == "AC": j[0] += 1 elif i == "WA": j[1] += 1 elif i == "TLE": j[2] += 1 else: j[3] += 1 print("AC x "+ str(j[0])) print("WA × "+ str(j[1])) print("TLE × "+ str(j[2])) print("RE × "+ str(j[3]))
p02688
s095723052
Wrong Answer
#!/usr/bin/env python3 # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): N, K = list(map(int, input().split())) ans = [0] * N for i in range(K-1): d = int(input()) A = list(map(int, input().split())) for j in A: ans[j-1] += 1 a = 0 for i in ans: if i==0: a += 1 print(a) return if __name__ == '__main__': main()
p03435
s928262224
Accepted
a=input().split() b=input().split() c=input().split() lista=[int(d) for d in a] listb=[int(e) for e in b] listc=[int(f) for f in c] b1=lista[0] b2=lista[1] b3=lista[2] a2=listb[0]-b1 a3=listc[0]-b1 if a2+b2==listb[1] and a2+b3==listb[2] and a3+b2==listc[1] and a3+b3==listc[2]: print('Yes') else: print('No')
p02646
s675388505
Wrong Answer
a, v = map(int, input().split()) b, w = map(int, input().split()) t = int(input()) if abs((a-b)) + abs(v-w)*t >= 0: print('Yes') else: print('No')
p02765
s557880929
Accepted
n, r = map(int, input().split()) if n >= 10: print(r) else: print(r + 100 * (10 - n))
p03317
s728848156
Wrong Answer
import sys import math N, K = list(map(int, input().split())) A = list(map(int, input().split())) if N == K: print(1) sys.exit() for i in range(N): if A[i] == 1: print(math.ceil(i/(K-1)) + math.ceil((N-i-1)/(K-1))) break