problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02676
s775632026
Accepted
n = int(input()) s = input() if (len(s) <= n): print(s) else: print(s[:n] + '...')
p03038
s563490712
Accepted
n, m = map(int, input().split()) A = list(map(int, input().split())) BC = [list(map(int, input().split())) for _ in range(m)] A.sort() BC.sort(key=lambda x:x[1], reverse=True) pos = 0 for b, c in BC: end = (pos + b) if pos + b <= n else n for i in range(pos, end): if A[i] < c: A[i] = c else: break pos = i + 1 if pos >= n: break print(sum(A))
p03617
s431955494
Accepted
q, h, s, d = map(int, input().split()) h = min(q + q, h) s = min(h + h, s) d = min(s + s, d) n = int(input()) print(n // 2 * d + n % 2 * s)
p02681
s715613053
Accepted
s=input() t=input() if t[:-1]==s: print('Yes') else: print('No')
p03632
s012290933
Wrong Answer
a,b,c,d =map(int,input().split()) if b<=c: print(0) elif b>c and b<=d: print(b-c) else: print(d-c)
p03607
s360938184
Wrong Answer
# -*- coding: utf-8 -*- ## Library import sys from fractions import gcd import math from math import ceil,floor import collections from collections import Counter import itertools ## input # n=int(input()) # A,B,C,D=map(int, input().split()) # string = input() # yoko = list(map(int, input().split())) # tate = [int(input()) for _ in range(N)] # N, M = map(int,input().split()) # P = [list(map(int,input().split())) for i in range(M)] N = int(input()) A = [int(input()) for _ in range(N)] C = collections.Counter(A) ans = 0 for i in range(1,N+1): if C[i] % 2 == 1: ans += 1 print(ans)
p03339
s979109839
Accepted
n = int(input()) s = input() from collections import defaultdict l = defaultdict(int) r = defaultdict(int) for si in s: r[si] += 1 r[s[0]] -= 1 ans = l['W'] + r['E'] for i in range(1, n): l[s[i-1]] += 1 r[s[i]] -= 1 #print(l['W'] , r['E']) ans = min(ans, l['W'] + r['E']) print(ans)
p03545
s832030038
Accepted
import math import sys from collections import deque a=input() for i in range(8): c=int(a[0]) l=[a[0]] for j in range(3): if i>>j & 1: c+=int(a[j+1]) l+=["+",a[j+1]] else: c-=int(a[j+1]) l+=["-",a[j+1]] if c==7: for i in l: print(i,end="") print("=7") sys.exit()
p02607
s143909441
Accepted
n=int(input()) a=list(map(int,input().split())) ans=0 for i in range(0,len(a)): if i%2==0 and a[i]%2==1: ans+=1 print(ans)
p02780
s524703189
Accepted
N, K = map(int, input().split()) lis_p = map(int, input().split()) def calc_exp(x): return (int(x) + 1)/2 lis_exp = list(map(calc_exp, lis_p)) dp= sum(lis_exp[0:K]) cumKsum = sum(lis_exp[0:K]) for i in range(1, N-K+1): cumKsum = cumKsum - lis_exp[i-1] + lis_exp[i+K-1] dp = max(cumKsum, dp) print(dp)
p02618
s742540030
Accepted
D = int(input()) C = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(D)] tL = [] for i in range(D): tL.append(S[i].index(max(S[i])) + 1) for t in tL: print(t)
p02694
s023102079
Wrong Answer
x=int(input()) a=100 b=0 while 1: if a>=x: print(b) break b+=1 a=a+int(a/100)
p02744
s811764831
Wrong Answer
import sys sys.setrecursionlimit(10 ** 7) ans = [] def solve(pre, n, s): if len(s) == n: ans.append(s) return for i in range(pre+2): solve(i, n, s + chr(ord("a") + i)) def main(): n = int(input()) solve(0, n, "a") ans.sort() for s in ans: print(s) if __name__ == "__main__": main()
p02677
s493708247
Accepted
import math A, B, H, M = map(int, input().split()) h = H % 12 m = M % 60 rh = (h/12+M/60*1/12)*2*math.pi rm = (m/60)*2*math.pi r = min(rh - rm, 2*math.pi - (rh - rm)) c = A**2 + B**2 - 2*A*B*math.cos(r) print(math.sqrt(c))
p03657
s835413856
Accepted
a,b=map(int,input().split()) if (a%3==0 or b%3==0 or (a+b)%3==0) and a+b>2: print("Possible") else: print("Impossible")
p03862
s821997564
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) ret =0 if a[0]>x: ret+=a[0]-x a[0]-=x for i in range(1,n): if a[i-1]+a[i]>x: ret+=a[i-1]+a[i]-x a[i]-=a[i-1]+a[i]-x print(ret)
p03286
s884776747
Accepted
N = int(input()) NN = N b = '' i = 0 if N == 0: b = '0' else: while (NN!=0): bi = abs(NN)%2 b=str(bi)+b NN = (NN-bi*(-1)**i)//2 i+=1 print(b)
p03544
s605083534
Wrong Answer
n = int(input()) l = 2 a = [2] for i in range(1, n+1): if i == 1: a.append(1) else: l = sum(a) a.pop(0) a.append(l) print(l)
p04011
s053062114
Accepted
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(k*x+(n-k)*y) else: print(n*x)
p02847
s236194166
Wrong Answer
s = input() l = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'] for i in l: if i == s: print(l.index(i) + 1)
p03699
s044505695
Wrong Answer
n,*L = map(int,open(0).read().split()) sum1 = sum(L) L.sort() if sum1%10 != 0: print(sum1) exit() else: i = 0 while sum1%10==0: sum1 -= L[i] if sum1 == 0: print(0) exit() i +=1 print(sum1)
p03254
s575844755
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) cnt = 0 a.sort() for i in a: if a.index(i) == n - 1: if i == x: cnt += 1 elif i <= x: x -= i cnt += 1 else: break print(cnt)
p02785
s639340532
Accepted
N, K = map(int, input().split(' ')) H_ls = list(map(int, input().split(' '))) H_ls.sort(reverse=True) print(sum(H_ls[K:]))
p02729
s358914575
Accepted
N,M=map(int, input().split()) def cal(x): return x*(x-1)//2 print(cal(N)+cal(M))
p02862
s258568380
Accepted
import sys X, Y = map(int, input().split()) MOD = 1000000007 if (2*X-Y)%3!=0: print(0) sys.exit() A = int((2*X-Y)/3) B = int(X-2*A) if A<0 or B<0: print(0) sys.exit() ans = 1 inv = 1 for i in range(B): ans = ans * (A+B-i) %MOD inv = inv * (i+1) %MOD ans = ans * pow(inv, MOD-2, MOD) %MOD print(ans)
p03592
s714901940
Wrong Answer
D = [int(_) for _ in input().split()] def solve(D): N = D[0] M = D[1] K = D[2] for l in range(N): for k in range(M): if M * k + N *l - 2 * k * l == K: return "Yes" return "No" print(solve(D))
p03951
s626354423
Wrong Answer
n=int(input()) s=input() t=input() ans=0 for i in range(n): if s[i:] == t[:n-i]: ans = n-i if ans == 0: print(2*n) else: print(2*n-ans)
p02772
s351062073
Wrong Answer
N = int(input()) A = list(map(int,input().split())) count = 0 odd = 0 for n in A: count += 1 if (n % 2) == 0: count += 1 if (n % 3) == 0 or (n % 5) == 0: odd += 1 else: print("DENIED") exit() if count == len(A): print("DENIED") else: print("APPROVED")
p02753
s681012758
Accepted
S = input() print('Yes') if 'A' in S and 'B' in S else print('No')
p02767
s726868035
Wrong Answer
#!/usr/bin/env python3 ## -*- python -*- import sys n = int(input()) x = [] for c in input().split(): x.append(int(c)) print(x) a = sys.maxsize for i in range(min(x), max(x)): c = 0 for j in x: c = c + (j-i) * (j-i) a = min([a, c]) print(a)
p03076
s384724476
Wrong Answer
import math count = 0 amari = 9 for i in range(5): n = int(input()) if n%10 == 0: count += n else: count += math.ceil(n/10)*10 amari = min(amari,n%10) print(count + amari - 10)
p02899
s359555012
Accepted
N=int(input()) A=list(map(int,input().split())) L=[None]*N for id,x in enumerate(A): L[x-1] = id+1 str_L=map(str,L) print(' '.join(str_L))
p02923
s299469409
Accepted
from collections import deque N = int(input()) H = deque(map(int, input().split())) ans = 0 n = 0 tmp = H.popleft() while H: nxt = H.popleft() if tmp >= nxt: n += 1 ans = max(ans, n) else: n = 0 tmp = nxt print(ans)
p02761
s568014221
Accepted
N, M = map(int,input().split()) s = [] c = [] for i in range(M): S, C = map(int,input().split()) s.append(S) c.append(C) for i in range(10 ** (N + 1)): Str = str(i) if len(Str) == N and all([Str[s[j] - 1] == str(c[j]) for j in range(M)]): print(Str) exit() print(-1)
p03698
s812031151
Accepted
S = list(input()) ans =set(S) a = len(S) b = len(ans) if a == b: print("yes") else: print("no")
p02823
s899678223
Wrong Answer
n,a,b = list(map(int,input().split())) if (abs(a-b) % 2) == 0: ans = abs(a-b)//2 else: ans = min(n-min(a,b),max(a,b)-1) print(ans)
p02866
s360097461
Accepted
from collections import defaultdict n = int(input()) lis = list(map(int, input().split())) mod = 998244353 if lis[0] != 0: print(0) exit() d = defaultdict(int) for i in lis: d[i] += 1 if d[0] != 1: print(0) exit() ans = 1 for i in range(1, max(lis)+1): if i not in d: print(0) exit() ans = ans * (d[i-1]**d[i]) % mod print(ans)
p02947
s773461442
Accepted
from collections import Counter from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under n = int(input()) anas = [''.join(sorted(input())) for _ in range(n)] c = Counter(anas) cnt = 0 for v in c.values(): if v < 2: continue else: cnt += cmb(v, 2) print(cnt)
p02627
s436942053
Accepted
c = input() #l = input().split(" ") #l = list(map(int,l)) a = [chr(ord("a")+i) for i in range(26)] if c in a: print("a") else: print("A")
p02880
s449804128
Accepted
n=int(input()) k=[i*j for i in range(1,10) for j in range(1,10)] if n in k: print('Yes') else: print('No')
p03327
s033210779
Accepted
def main(): n = int(input()) if n >= 1000: print('ABD') else: print('ABC') if __name__ == "__main__": main()
p03221
s958869432
Accepted
n,m=map(int,input().split()) pref=[[] for _ in range(n)] ans=[] for i in range(m): p,y=map(int,input().split()) pref[p-1].append((i,p,y)) for i in range(n): pref[i].sort(key=lambda x: x[2]) for j,t in enumerate(pref[i]): k,q,z=t s='0'*(6-len(str(q)))+str(q)+'0'*(6-len(str(j+1)))+str(j+1) ans.append((k,s)) ans.sort(key=lambda x: x[0]) for g,h in ans: print(h)
p03761
s060090076
Wrong Answer
from collections import Counter n = int(input()) S = [] for i in range(n): s=input() S.append(s) if i==0: res=Counter(list(s)) else: c=Counter(list(s)) for key in res.keys(): if key in c.keys(): res[key] = min(res[key], c[key]) else: res[key] = 0 print(res) for key in sorted(res.keys()): if res[key]>0: print(key*res[key],end='') print('')
p02597
s976844496
Wrong Answer
a=int(input()) b=input() c=int(a/2) d=0 e=a-1 i=0 while True: if b[i]=='W': for j in range(0,e+1)[::-1]: if b[j]=='R': d=d+1 e=j-1 break i=i+1 if i+1>=e: break print(d)
p02754
s590517405
Accepted
from collections import defaultdict from collections import deque from string import ascii_uppercase import sys, bisect, math, heapq stdin = sys.stdin read_int = lambda : list(map(int,stdin.readline().split())) read_str = lambda : stdin.readline().rstrip() N, A, B = read_int() def solve(): ans = (N // (A + B)) * A r = (N % (A + B)) ans += r if r < A else A return ans if __name__ == "__main__": print(solve())
p02645
s835259778
Accepted
print(input()[:3])
p03803
s295784778
Accepted
a,b = map(int,input().split()) li = [2,3,4,5,6,7,8,9,10,11,12,13,1] a1 = li.index(a) b1 = li.index(b) if a1 > b1: print('Alice') elif a1 == b1: print('Draw') else: print('Bob')
p02881
s322188777
Wrong Answer
n = int(input()) from math import sqrt root = int(sqrt(n)) print(root) for i in range(root,n+1): if n%i == 0: ans = i+(n/i)-2 break print(int(ans))
p02711
s262962103
Accepted
n = list(str(input())) if "7" in n: print("Yes") else: print("No")
p03545
s560790590
Accepted
A,B,C,D = map(int, input()) ans = list(str(A)) for b in [-B,B]: for c in [-C,C]: for d in [-D,D]: if sum([A,b,c,d]) == 7: ans += ["+" + str(x) if x>=0 else str(x) for x in [b,c,d]] break else: continue break else: continue break for i in ans: print(i, end = "") print("=7")
p02829
s883407292
Wrong Answer
a=set([input() for _ in range(2)]) ans={'1','2','3'} print(ans-a)
p03379
s131550214
Accepted
import sys read = sys.stdin.buffer.read n,*x = list(map(int, read().split())) x_sort = sorted(x) mean_left = x_sort[n//2-1] mean_right = x_sort[n//2] for i in range(n): if x[i] <= mean_left: print(mean_right) elif x[i] >= mean_right: print(mean_left)
p02789
s953087944
Accepted
N, M = map(int, input().split()) print("Yes" if N==M else "No")
p03324
s367761285
Accepted
D, N = map(int, input().split()) if N == 100: N += 1 print(100**D * N)
p03815
s304198974
Wrong Answer
n = int(raw_input()) c = 2 * (n / 11) n%= 11 if n >=6: c+=2 elif n < 6: if n: c+=1 print c
p03417
s136639960
Accepted
H,W=list(map(int,input().split())) H=H-2 W=W-2 if H < 0: H=1 if W < 0: W=1 ans=H*W print(ans)
p02583
s449862181
Wrong Answer
import bisect import collections n=int(input()) l=sorted(list(map(int,input().split()))) ma=l[-1] d=collections.Counter(l) ans=0 for i in range(1,ma-2): for j in range(i+1,ma-1): c=i+j for k in range(j+1,c): ans+=d[i]*d[j]*d[k] print(ans)
p03910
s399780628
Accepted
n = int(input()) p = [0]*(n+1) flag = 0 if n==1: print(1) exit() for i in range(1,n+1): p[i] = i + p[i-1] if p[i] > n: flag = i break r = p[flag] -n for i in range(1,flag+1): if i!=r: print(i) else: continue
p02963
s000885911
Wrong Answer
MOD = 10 ** 9 s = int(input()) x = MOD - (s % MOD) y = (s + MOD - 1) // MOD print(0, 0, MOD, 1, x, y)
p03607
s803328705
Accepted
A = set() for _ in range(int(input())): i = int(input()) if i in A: A.remove(i) else: A.add(i) print(len(A))
p03281
s313873882
Accepted
import sys input = sys.stdin.readline N = int(input()) if N < 105 : print(0) elif N >= 105 and N<135 : print(1) elif N>= 135 and N<165 : print(2) elif N>=165 and N<189 : print(3) elif N>=189 and N<195 : print(4) else : print(5)
p03612
s863628603
Wrong Answer
def main(): N = int(input()) in_p_list = list(map(int, input().split())) p_list = [1+i-p for i,p in enumerate(in_p_list)] cnt = 1 if p_list[0] == 0 else 0 for i in range(1,N): v = p_list[i] if p_list[i-1] == 0: continue if v != 0: continue cnt += 1 print(cnt) if __name__ == "__main__": main()
p03059
s029328023
Accepted
a,b,c=map(int,input().split()) d=(c//a)*b print(d)
p03827
s620112150
Wrong Answer
n=input();s=input();print(s.count('I')-s.count('D')+1)
p03433
s856632487
Wrong Answer
n =int(input()) a = int(input()) m = n / 500 if n % 500 == 0: print("Yes") elif m <= a: print("Yes") else: print("No")
p03433
s351337081
Wrong Answer
N = input() A = input() n = int(N) a = int(A) x = n % 500 if x > a: print("Yes") elif x == a: print("Yes") else: print("No")
p02790
s826942601
Accepted
a, b = map(int, input().split()) print(str(min(a, b))*max(a,b))
p03208
s556597030
Accepted
import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() nas = lambda: stdin.readline().split() n, k = na() h = [ni() for i in range(n)] h.sort() ans = min([h[i + k - 1] - h[i] for i in range(n - k + 1)]) print(ans)
p02597
s413916369
Wrong Answer
n=int(input()) c=input() f=False wb=wc=0 rb=rc=0 for i in range(n): if c[i]=="R": rc += 1 else: wc += 1 for i in range(n): if c[i]=="W": f=True else: rc-=1 if f: if c[i]=="R": rb+=1 rc-=1 else: wb+=1 wc-=1 if wb==rc: print(wb) exit() print(rb)
p03011
s615396535
Wrong Answer
try: n=list(map(int, input().strip().split())) lis1=[] for i in range(0,len(n)): for a in range(0,len(n)): z=(int(n[a])+int(n[i])) lis1.append(z) set1=set((lis1)) lis1=list((set1)) minscore='9999999999' for i in range(0,len(lis1)): if float(minscore)>float(lis1[i]): minscore=lis1[i] print(minscore) except: print('')
p02766
s738690309
Accepted
n,k=map(int,input().split()) import math a=math.log(n,k) b=math.ceil(a) if a==b: print(b+1) else: print(b)
p03030
s259037886
Accepted
n=int(input()) sp=[] for i in range(n): s,p=input().split() sp.append([s,int(p),i+1]) sp.sort(key=lambda sp:(sp[0],-sp[1])) for i in sp:print(i[2])
p04031
s694278780
Wrong Answer
n = int(input()) a = list(map(int, input().split())) common = int(sum(a) / n + 0.5) cost = 0 for i in range(n): cost += (a[i] - common) ** 2 print(cost)
p03814
s553686896
Accepted
import numpy as np import sys readline = sys.stdin.buffer.readline #K,S=map(int, readline().split()) #S=list(readline()) S=input() #print(S) i=S.index('A') #print(i) S1 = S[::-1] j=(S1.index('Z')) j=len(S)-j #print(S1) #print(j) #print(len(S)-j) print(j-i)
p03730
s005935697
Accepted
import sys a,b,c=map(int,input().split()) i=1 l=[] while True: aa=a*i%b if aa in l: break l.append(aa) i+=1 if aa!=0 and c%aa==0: print('YES') sys.exit() print('NO')
p02939
s868351288
Accepted
S=input() i=1 buf=S[0] count=1 while i<=len(S)-1: if buf==S[i]: i=i+2 if i<=len(S): count = count + 1 buf="" else: count=count+1 buf=S[i] i=i+1 print(count)
p03220
s662641215
Wrong Answer
n = int(input()) t, a = map(int, input().split()) h = [int(i) for i in input().split()] min = max(h) ans = [] for i, j in enumerate(h): ans.append([abs(int(t - (j * 0.006)) - a),i+1]) print(sorted(ans)[0][1])
p02571
s864482137
Wrong Answer
S = input() T = input() ans = len(S) for i in range(len(T)): for j in range(i, len(S)): if T[i] == S[j]: c = 1 for k in range(0, min(len(S)-j-1,len(T)-i-1)): if T[i+1+k] == S[j+1+k]: c += 1 tmp = len(T) - c ans = min(ans, tmp) print(ans)
p02572
s548734225
Accepted
n = int(input()) li_a = list(map(int, input().split())) answer = 0 su = sum(li_a) mo = (10 ** 9) + 7 for idx, a in enumerate(li_a): su = su - a answer += (a * su) print(answer % mo)
p02881
s195782865
Accepted
n = int(input()) import math result = [] for a in range(1, int(math.sqrt(n) // 1) + 1): if n % a == 0: b = n // a result.append([a, b]) best_count = float("inf") for a_b in result: score = a_b[0] + a_b[1] - 2 if best_count > score: best_count = score print(best_count)
p03075
s283554156
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) if (e - a) > k: print(':(') else: print('Yay!')
p02639
s918251592
Wrong Answer
a, b, c, d, e = map(int, input().split()) ln = [a,b,c,d,e] for i,j in enumerate(ln): if j == 0: print(i) break
p02707
s294566031
Wrong Answer
import collections n=int(input()) a=list(map(int,input().split())) b=list(collections.Counter(a).values()) for i in b: print(i)
p02578
s637471572
Wrong Answer
N = int(input()) A = list(map(int,input().split())) K = 0 for i in range(0,N-1): if A[i+1]-A[i]<0: K += A[i+1]-A[i] else: K += 0 print(K)
p03145
s408606048
Wrong Answer
a, b, c = input().split() x = [a, b, c] x = sorted(x) print(int((int(x[0])*int(x[1]))/2))
p02754
s758896638
Accepted
N,A,B = map(int,input().split()) ans = 0 ans += (N//(A+B)) * A i = min((N % (A+B)),A) if i >= 0: ans += i print(ans)
p03695
s425598558
Accepted
n = int(input()) a = list(map(int,input().split())) t = [0] * 8 p = 0 for i in range(n): if a[i] < 3200: t[a[i] // 400] = 1 else: p += 1 x = t.count(1) amax = p+x if x == 0: amin = 1 else: amin = x print(amin,amax)
p03285
s993454244
Accepted
n=int(input()) for i in range(26): for j in range(100//7+1): if 4*i+7*j==n: print('Yes') import sys sys.exit() print('No')
p03289
s764637085
Accepted
s = input() if s[0] == 'A' and s[2:-1].count('C') == 1 and all([ord('a') <= ord(c) <= ord('z') for c in s.replace('A', '').replace('C', '')]): print('AC') else: print('WA')
p02547
s312770512
Accepted
N = int(input()) xy = [map(int,input().split()) for _ in range(N)] x,y = [list(i) for i in zip(*xy)] ans = 0 flag = False for i in range(N): if x[i] == y[i]: ans +=1 elif ans >= 3: flag = True ans = 0 else: ans = 0 if ans >= 3 or flag ==True: print("Yes") else: print("No")
p02613
s530802319
Wrong Answer
AC,WA,TLE,RE=0,0,0,0 for T in range(int(input())): S=input() if S=="AC":AC+=1 elif S=="WA":WA+=1 elif S=="TLE":TLE+=1 else:RE+=1 print("AC x", AC) print("WA x", WA) print("TLE x", TLE) print("RE x", RE)
p04030
s469421130
Wrong Answer
s=input() n=len(s) ans=[] for i in range(n-1): if s[i]!="B" and s[i+1]!="B": ans.append(s[i]) if s[-1]!="B": ans.append(s[-1]) print("".join(ans))
p02578
s623614349
Accepted
n=int(input()) a=list(map(int, input().split())) fumidai=fumidau=0 try: for i in range(len(a)): kijun=a[i] if kijun>a[i+1]: fumidau=kijun-a[i+1] fumidai+=fumidau a[i+1]=a[i+1]+fumidau except: pass print(fumidai)
p03448
s114782036
Accepted
s = [int(input()) for i in range(4)] x=0 a=0 b=0 c=0 for i in range(s[0]+1): for i in range(s[1]+1): for i in range(s[2]+1): if 500*a+100*b+50*c == s[3]: x=x+1 c=c+1 b=b+1 c=0 a=a+1 b=0 c=0 print(x)
p03611
s298395603
Wrong Answer
N = int(input()) A = list(map(int,input().split())) cnt = 0 for X in range(min(A),max(A)): transient = A.count(X-1) + A.count(X) + A.count(X+1) if transient > cnt: cnt = transient print(cnt)
p03639
s992431864
Wrong Answer
def ord(n): if n % 2 == 1: return 0 elif n % 4 == 0: return 2 else: return 1 n = int(input()) a = list(map(lambda x:ord(int(x)),input().split())) zero = a.count(0) two = a.count(2) if two>=zero: print("Yes") else: print("No")
p02658
s222287410
Accepted
a = int(input()) b = list(map(int,input().split())) r=1 if 0 in b: r=0 else: for i in b: r*=i if r>10**18: r=-1 break print(r)
p02665
s083468958
Accepted
import math N=int(input()) listA = list(map(int, input().strip().split())) saisyou=listA[N] saidai=listA[N] i=N-1 k=0 count=1 kiroku = 1 listsum=0 while k<=N: listsum=listsum+listA[k] k=k+1 while i>=0: saisyou = math.ceil(saisyou/2)+listA[i] i=i-1 if(saisyou != 1):print(-1) #print(saisyou) if(saisyou == 1): i=0 while i<N: listsum=listsum-listA[i] kiroku = min(2*(kiroku-listA[i]),listsum) count = count+kiroku i=i+1 print(count)
p02677
s541374111
Wrong Answer
import math A, B, H, M = map(int, input().split(" ")) # print(A, B, H, M) # 角度を求める. angle_a = 30 * H + 0.5 * M angle_b = M * 1.0 if angle_a == angle_b: angle = 0 elif angle_b > angle_a: angle = angle_b - angle_a else: angle = angle_a - angle_b # angle = abs(angle_a - amgle_b) # print(angle) # S = A * B * math.sin(math.radians(angle)) print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(angle))))
p02935
s394115721
Wrong Answer
# ABC 138 C N =int(input()) V = sorted([int(i) for i in input().split()]) ans = 0 for i,v in enumerate(V): if i<2: ans +=v/(2**(N-1)) else: ans += v/(2**(i-1)) print(ans)