problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p04020
s202335746
Wrong Answer
n = int(input()) al = [int(input()) for _ in range(n)] if n == 1: print(al[0] // 2 * 2) exit() ans = 0 for i in range(n-1): rest = ((al[i] + al[i+1]) // 2) * 2 ans += rest for j in range(2): if al[i+j] >= rest: al[i+j] -= rest break else: rest -= al[i+j] al[i+j] = 0 print(ans//2)
p03524
s890374317
Wrong Answer
S = input() from collections import Counter Sc = Counter(list(S)) m = Sc.most_common()[0][1] try: if m <= sum([t[1] for t in Sc.most_common()[1:]]): print("YES") else: print("NO") except: print("NO")
p03543
s479826977
Accepted
a,b,c,d = input() print('Yes' if a==b==c or b==c==d else 'No')
p03625
s013185913
Accepted
n=int(input()) a=list(map(int,input().split())) from collections import Counter d=Counter(a) f=True tt=0 ans=0 for i ,j in sorted(d.items(),reverse=True): if j==1: continue elif j>=4 and f: print(i*i) exit() else: f=False ans=tt*i tt=i if ans>0: break print(ans)
p02897
s116539029
Wrong Answer
n = int(input()) if n % 2 == 0: print(1/2) else: pro = int(n/2) print(pro/n)
p02802
s829374973
Accepted
n,m = map(int, input().split()) num = [0]*n flag = [False]*n for _ in range(m): p,s = input().split() p = int(p)-1 if flag[p]: continue else: if s == "AC": flag[p] = True else: num[p] += 1 for i in range(n): if flag[i] == False: num[i] = 0 print(flag.count(True),sum(num))
p02640
s762806599
Accepted
X,Y=map(int,input().split()) ans="No" for x in range(0,101): for y in range(0,101): if (x+y)==X and (2*x+4*y)==Y: ans="Yes" break if ans=="Yes": break print(ans)
p02718
s100914951
Accepted
def readInts(): return list(map(int, input().split())) n, m = readInts() a = readInts() s = sum(a) cnt = 0 for i in range(n): if a[i]*4*m >=s: cnt +=1 if cnt >= m: print("Yes") else: print("No")
p02582
s329039656
Accepted
s = input() if s.count('RRR') == 1: print(3) elif s.count('RR') == 1: print(2) elif s.count('R'): print(1) else: print(0)
p03438
s805279604
Accepted
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) As = list(mapint()) Bs = list(mapint()) ap = 0 bp = 0 for a, b in zip(As, Bs): if a>b: ap += a-b else: bp += (b-a)//2 if ap>bp: print('No') else: print('Yes')
p03351
s191827110
Wrong Answer
a,b,c,d = map(int,input().split()) 1 <= a,b,c,d <= 100 if abs(a-b) <= d and abs(b-c) <= d or abs(a-c) <= 100: result = ("Yes") else: result = ("No") print(result)
p03495
s910837617
Wrong Answer
n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for ai in a: if ai in d: d[ai] += 1 else: d[ai] = 1 l = [d[key] for key in d] l.sort() if len(l) < k: print(0) else: print(n - sum(l[:k]))
p02918
s016535030
Wrong Answer
N, K = map(int, input().split()) S = input() happy = 0 for i in range(N-1): if S[i] == S[i+1]: happy += 1 m = -1 for i in range(1, N-1): if S[i] == 'R' and S[i+1] == 'L': m += 1 m = max(m, 0) if K <= m: happy += 2*K else: happy += 2*m if S[0] != S[N-1]: happy += 1 print(happy)
p02584
s927314412
Wrong Answer
X,K,D = map(int, input().split()) ans = 0 if K%2 == 0: ans = abs(X-(D*2)) print(ans) exit() else: ans = abs(X-D) print(ans) exit()
p02663
s316571912
Wrong Answer
T = input() t = T.count("?") num =[] for i in range(0,t+1): st = T.replace("?" , "D", i) for n in range(0,t+1): ste = st.replace("?","P",n) for q in range(0,t+1): stes = ste.replace("?","D",q) num.append(stes) print(num) s = stes.count("DD") f = stes.count("PD") ans = s + f print(ans)
p03062
s683766542
Wrong Answer
n = int(input()) a = list(map(int, input().split(' '))) ans = 0 for i in range(n-1): if a[i]<0 and -a[i] >= a[i+1]: a[i]=-a[i] a[i+1]=-a[i+1] ans += a[i] ans += a[n-1] print(ans)
p03778
s993222735
Accepted
W,a,b=map(int,input().split()) if b>a: if b-(a+W)<=0: print(0) exit() print(b-(a+W)) else: if a-(b+W)<=0: print(0) exit() print(a-(b+W))
p02690
s713547242
Accepted
X = int(input()) for a in range(-201,201): for b in range(-201,201): if a**5 - b**5 == X: print(a,b) quit()
p03075
s865128628
Accepted
lis=[] for i in range(5): lis.append(int(input())) k=int(input()) if k<lis[4]-lis[0]: print(":(") else: print('Yay!')
p03475
s118393269
Accepted
n = int(input()) stat = [] for i in range(n - 1): c, s, f = map(int, input().split()) stat.append([c, s, f]) ans = [] for i in range(n - 1): temp = stat[i][1] for j in range(i, n - 1): c, s, f = map(int, stat[j]) temp = max(s, temp) while temp % f != 0: temp += 1 temp += c ans.append(temp) for i in ans: print(i) print(0)
p03565
s736676292
Wrong Answer
s=list(input()) t=list(input()) ans='U' for i in range(len(s)-len(t),-1,-1): if s[i]==t[0]: cnt=1 for j in range(1,len(t)): if s[i+j]==t[j] or s[i+j]=='?': cnt+=1 if cnt==len(t): s[i:i+len(t)]=t u='' for k in s: u+=k u=u.replace('?','a') print(u) exit() print('UNRESTORABLE')
p03665
s411534269
Wrong Answer
N,P = map(int,input().split()) A = list(map(int,input().split())) ans = 0 for i in range(N): if A[i]%2 != 0: print(2**(N-1)) exit() print(2**N)
p02583
s497958137
Wrong Answer
n = int(input()) l = list(map(int,input().split())) c = 0 for i in range(n-2): for j in range(i,n-1): for k in range(j,n): if l[i] != l[j] and l[j] != l[k] and l[i] != l[k] and l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[j]+l[k]>l[i]: c+=1 print(i,j,k,c) print(c)
p02862
s399473964
Wrong Answer
x,y=map(int,input().split()) mod=10**9+7 def nCr_mod(n,r,mod): x=1 y=1 for i in range(r): x=(x*(n-i)) % mod y=(y*(i+1)) % mod return (x * pow(y, mod - 2, mod)) % mod if x*y%3!=0: print(0) else: m=(2*x-y)//3 n=(2*y-x)//3 if m<0 or n<0: print(0) else: print(nCr_mod(m+n,n,mod))
p02993
s318173228
Accepted
s=input() ans='Good' if s[0]==s[1]: ans='Bad' elif s[1]==s[2]: ans='Bad' elif s[2]==s[3]: ans='Bad' print(ans)
p02847
s356280555
Wrong Answer
a=input("") if(a=="SUN"): print(7) elif(a=="MON"): print(6) elif(a=="TUE"): print(5) elif(a=="WEN"): print(4) elif(a=="THU"): print(3) elif(a=="FRI"): print(2) else: print(1)
p03543
s045238045
Accepted
n = input() if n[1] == n[2] and (n[0] == n[1] or n[2] == n[3]): print('Yes') else: print('No')
p03281
s100241360
Wrong Answer
def hantei(n): root_n = int(n**0.5 +0.5) if root_n**2 == n: return 0 total = 0 for i in range(1,root_n): if n % i == 0: total += 2 return total n = int(input()) total = 0 for i in range(1,n+1,2): if hantei(i) == 8: print(i) total += 1 print(total)
p03274
s252504460
Wrong Answer
n,k = [int(x) for x in input().split()] x = [int(x) for x in input().split()] if len(x) == 1: print(abs(x[0])) else: ans = 10 ** 15 for i in range(n-k): tmp = min(abs(x[i]), abs(x[i+k-1])) ans = min(ans,tmp+abs(x[i+k-1]-x[i])) print(ans)
p02639
s081834525
Accepted
a= list(map(int,input().split())) ans=0 for i in range(5): if a[i]==0: ans=i+1 print(ans)
p02784
s348930015
Accepted
h,n = map(int, input().split()) a = list(map(int, input().split())) if h<=sum(a): print('Yes') else: print('No')
p03994
s907679446
Accepted
s = list(input()) k = int(input()) z = ord("z") a = ord("a") for i in range(len(s)-1): if s[i] == "a": continue if z - ord(s[i]) + 1 <= k: k -= z - ord(s[i]) + 1 s[i] = "a" if k > 0: k = k%26 x = z - ord(s[-1]) +1 if k >= x: k -= z - ord(s[-1]) + 1 s[-1] = chr(a + k) else: s[-1] = chr(ord(s[-1])+k) print("".join(s))
p02707
s345448755
Accepted
n = int(input()) lst = [int(i) for i in input().split()] ans = [0] * n for i in range(n-1): number = lst[i] ans[number - 1] += 1 for i in ans: print(i)
p02582
s261381964
Wrong Answer
i = 0 j = 0 w = "" for s in input(): j += 1 if s == "R" and (w == s or w == ""): i += 1 elif s == "R" and w != s: i += 1 if s == "S" and i > 0 and j == 2: i -= 1 w = s print(i)
p02923
s913269403
Accepted
N = int(input()) H = [int(x) for x in input().split()] m = 0 count = 0 for i in range(N-1): if H[i] >= H[i+1]: count += 1 else: count = 0 if count > m: m = count print(m)
p02823
s210325435
Accepted
n,a,b = map(int, input().split()) if a%2==b%2: print((b-a)//2) exit() print(min(a-1,n-b) +1+ (b-a-1)//2)
p03038
s885351325
Accepted
import math N, M = map(int, input().split()) from collections import* c = Counter(map(int, input().split())) for _ in range(M): B, C = map(int, input().split()) c[C] = c[C] + B if C in c else B c = sorted(c.items(), reverse=True) s = 0 for i in c: s += i[0] * min(i[1],N) N -= min(i[1],N) print(s)
p02681
s253977101
Wrong Answer
import sys print("Enter ID") str_1 = input() str_2 = input() if not str_2.startswith(str_1,0): print("No") sys.exit() if len(str_1) + 1 != len(str_2): print("No") sys.exit() print("Yes")
p03835
s832409191
Accepted
a,b=map(int,input().split()) ans=0 for i in range(a+1): for j in range(a+1): if 0<=(b-i-j)<=a: ans+=1 print(ans)
p02947
s590093579
Wrong Answer
N = int(input()) s = {} for _ in range(N): a = "".join(sorted(input())) if a not in s: s[a] = 0 else: s[a] += 1 ans = 0 for v in s.values(): ans += v if v > 1: ans += 1 print(ans)
p02553
s608276860
Accepted
#Python Template from sys import stdin, stdout def main(): a, b, c, d = [int(i) for i in stdin.readline().split()] ans = max(a*c, a*d, b*c, b*d) print(ans) main()
p03665
s257609174
Wrong Answer
N,P = map(int,input().split()) A = list(map(int,input().split())) n0=0 n1=0 for i in range(N): if A[i]%2==0: n0 += 1 n1 = N-n0 if P==1 and n1==0: print(0) elif P==0 and n0==0 and n1==1: print(0) else: print(2**(n1-1)*2**n0)
p02743
s663065760
Wrong Answer
import sys import math import bisect def main(): a, b, c = map(int, input().split()) if 4 * a * b < (c - a - b) ** 2: print('Yes') else: print('No') if __name__ == "__main__": main()
p03331
s550978263
Accepted
#!/usr/bin/env python import math n = int(input()) m = math.log10(n) if int(m) == m: print(10) exit() ans = sum(map(int, list(str(n)))) print(ans)
p03617
s844688684
Wrong Answer
a,b,c,d=map(int,input().split()) n=int(input()) if n == 1: print(min(a*4,b*2,c)) elif n%2 == 0: print(min(a*4*n,b*2*n,c*n,d*n//2)) else: print(min(a*4*n,b*2*n,c*n,d*n//2+min(a*4,b*2,c)))
p03136
s058065871
Wrong Answer
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) if 2*L[0] > sum(L): print('Yes') else: print('No')
p03254
s094880476
Accepted
N, x = map(int, input().split()) a_li = list(map(int, input().split())) a_li.sort() ans = 0 for a in a_li : if x >= a : ans += 1 x -= a else : x = 0 break if x != 0 : ans -= 1 print(max(0, ans))
p02731
s616739487
Wrong Answer
L = float(input()) a = round(((L / 3) * 10)) / 10 b = round(((L / 3) * 10)) / 10 c = round(((L / 3) * 10)) / 10 #a += round(L - (a + b + c)) L = round(L - (a+b+c),2) a += L print(float(a*b*c))
p02702
s690545708
Accepted
from collections import defaultdict def resolve(): s = input() cnt = defaultdict(int) cnt[0] += 1 tmp = 0 for i, c in enumerate(s[::-1]): c = int(c) tmp = (tmp + c * pow(10, i, 2019)) % 2019 cnt[tmp] += 1 ans = sum(c * (c - 1) // 2 for c in cnt.values()) print(ans) resolve()
p03494
s676342199
Wrong Answer
def f(n): return n%2 n=int(input()) L = list(map(int, input().split())) x=0 if f(L[0])==1 or f(L[1])==1 or f(L[2])==1 else format(min(L), 'b')[::-1].find('1')-1;print(x)
p02814
s794614090
Wrong Answer
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=map(int,input().split()) lcm = 1 for i in a: lcm = lcm * i // gcd (lcm,i) for i in a: if (lcm/a)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
p03433
s017821007
Wrong Answer
N = int(input()) A = int(input()) amari = N % 500 if amari <= A: print("YES") else: print("NO")
p03309
s564983387
Wrong Answer
import math N = int(input()) A = list(map(int, input().split())) # print(N, A) for i in range(len(A)): A[i] -= (i + 1) # print(A) _A = map(abs, A) _A = list(A) average = math.ceil(sum(_A) / len(_A)) for i in range(len(A)): A[i] = abs(A[i] - average) sadness = sum(A) print(sadness)
p03495
s362974514
Accepted
import collections N,K = map(int,input().split()) A = list(map(int,input().split())) values,counts = zip(*collections.Counter(A).most_common()) ans = 0 B = counts[K:] for i in B: ans += i print(ans)
p02946
s788306698
Accepted
k,x = map(int,input().split()) li = list(range(x - (k-1),x + (k))) print(*li)
p03815
s237003813
Accepted
x = int(input()) - 1 s = x // 11 a = x % 11 print(s*2+2) if a > 5 else print(s*2+1)
p02780
s556070663
Wrong Answer
n, k = map(int, input().split()) p = list(map(int, input().split())) prev = sum(p[1:k]) ind = 0 for i in range(1, n - k + 1): nex = prev - p[i-1] + p[i+k-1] if prev < nex: prev = nex ind = i total = 0 for i in range(ind, ind + k): total += (p[i] * 0.5 + 0.5) print(total)
p02594
s074977917
Accepted
x = int(input()) if x >= 30: print("Yes") else: print("No")
p02705
s310291802
Accepted
#=input() R=int(input()) #,=map(int,input().split()) #list(map(int,input().split())) print(R*2*3.141592653589793238)
p02594
s805090719
Accepted
X = int(input()) if X >= 30: print('Yes') else: print('No')
p02862
s924022428
Accepted
x,y = map(int,input().split()) if (2*x - y) % 3 != 0 or (2*y-x) % 3 != 0 or 2 * min(x,y) < max(x,y): print(0) exit() mod = 10**9 + 7 n = (x+y) // 3 a = (max(x,y)*2 - min(x,y)) // 3 fact = [1] finv = [1] for i in range(1, n+1): fact += [(fact[i-1] * i) % mod] finv += [pow(fact[i], mod-2, mod)] print((fact[n]*finv[a]*finv[n-a]) % mod)
p03524
s905983695
Wrong Answer
S = list(input()) T = list(set(S)) n = len(T) m = len(S) if m == 1: ans = 'YES' elif n ==1: ans = 'NO' elif n == 2: ans = 'NO' else: a = S.count(T[0]) b = S.count(T[1]) c = S.count(T[2]) A = [a,b,c] A.sort() if A[2]-A[1]-A[0]<=1: ans = 'YES' else: ans = 'NO' print(ans)
p03126
s868908282
Wrong Answer
N,M=map(int,input().split()) KA=[] for i in range(N): KA.append(list(map(int,input().split()))) A=[] for i in range(N): for j in range(1,len(KA[i])): A.append(KA[i][j]) a=0 for i in range(M): if A.count(i)==N: a+=1 print(a)
p03239
s322619503
Wrong Answer
line = input() X, Y = [int(n) for n in line.split()] route_cost = [] for _ in range(X): line = input() key, cost = [int(n) for n in line.split()] route_cost.append([cost, key]) route_cost.sort(key=lambda x: x[0]) if route_cost[0][0] > Y: value = "TLE" else: value = route_cost[0][1] print(value)
p03387
s230074243
Accepted
A,B,C = map(int,input().split()) m = [A,B,C] m = sorted(m) if (m[2]-m[0])%2 == (m[2]-m[1])%2: print(m[2]-(m[0]+m[1])//2) else: print(m[2]-(m[0]+m[1])//2 + 1)
p03804
s987771277
Wrong Answer
N,M=map(int, input().split()) A = [input() for i in range(N)] B = [input() for i in range(M)] ans = "No" for i in range(N-M+1): for j in range(N-M+1): t = True for k in range(M): if B[k] != A[i+k][j:j+M]: t = False if t: ans = "Yes" print(ans)
p02683
s682237734
Accepted
import itertools import numpy as np N, M, X = map(int, input().split()) items = np.array([list(map(int, input().split())) for _ in range(N)]) min_v = 10**18 for n in range(1, N+1): for c in itertools.combinations(range(N), n): tmp = np.sum(items[[c]], axis=0) c = tmp[0] a = tmp[1:] if M == np.count_nonzero(a >= X): min_v = min(min_v, c) if min_v == 10**18: print(-1) else: print(min_v)
p03720
s293595362
Accepted
#!/usr/bin/env python3 N, M = map(int, input().split()) a = [] for i in range(M): b, c = map(int, input().split()) a.append(b) a.append(c) for i in range(N): print(a.count(i + 1))
p02801
s756703334
Wrong Answer
C = input() r = chr(ord(C)) print(r)
p03555
s302323207
Accepted
c1 = list(input()) c2 = list(input()) c1.reverse() if c1 == c2: print('YES') else: print('NO')
p03495
s134468646
Accepted
# -*- coding: utf-8 -*- import collections N, K=map(int,input().split()) A=list(map(int,input().split())) C=collections.Counter(A) KEY=list(C.keys()) count=0 if len(KEY)>K: D=len(KEY)-K L=C.most_common()[::-1] for ii in range(D): count+=L[ii][1] print(count)
p02811
s450425841
Accepted
K,X = map(int,input().split()) if 500*K >=X: print('Yes') else: print('No')
p02761
s007388912
Accepted
n,m=map(int, input().split()) alist=[list(map(int, input().split())) for i in range(m)] ans=-1 for i in range(999,-1,-1): if len(str(i))==n: x=True stri=str(i) for j in range(m): if stri[alist[j][0]-1]!=str(alist[j][1]): x=False if x: ans=i print(ans)
p03043
s763827341
Wrong Answer
n,k=map(int,input().split());result=0 for i in range(1,n+1): t=i count=0 while t <= k: t*=2 count+=1 result+=1/n*(1/2)**count print(result)
p03076
s245927251
Accepted
from itertools import permutations a2e = [int(input()) for i in range(5)] perm = list(permutations(list(range(5)))) m = 643 t = 0 for i in perm: for j in range(5): t += a2e[i[j]] if t % 10 != 0 and j < 4: wait = 10 - (t % 10) t += wait if m > t: m = t t = 0 print(m)
p03557
s290756466
Accepted
import bisect N = int(input()) A = sorted(list(map(int,input().split()))) B = sorted(list(map(int,input().split()))) C = sorted(list(map(int,input().split()))) count = 0 for i in range(N): b = B[i] cind = bisect.bisect_right(C,b) aind = bisect.bisect_left(A,b) count+=(N-cind)*aind print(count)
p03107
s929594814
Accepted
s = input() stk = [] ret = 0 for i in range(len(s)): if len(stk) == 0: stk.append(s[i]) elif stk[-1] == '0': if s[i] == '1': stk.pop(-1) ret += 2 else: stk.append('0') else: if s[i] == '0': stk.pop(-1) ret += 2 else: stk.append('1') print(ret)
p03986
s707902539
Accepted
x = input() count_s = 0 ans = 0 for i in range(len(x)): if x[i] == 'S': count_s += 1 if x[i] == 'T': if count_s == 0: ans += 1 else: count_s -= 1 ans += count_s print(ans)
p03285
s762581143
Wrong Answer
n = int(input()) cnt = 0 for i in range(30): for j in range(20): if n == 4 * i + 7 * j: print("Yes") break else: print("No")
p02838
s780333346
Accepted
n = int(input()) a_list = list(map(int, input().split())) mod = 10 ** 9 + 7 ans = 0 for i in range(60): k = sum(a >> i & 1 for a in a_list) ans += (k * (n - k) % mod) * ((1 << i) % mod) % mod print (ans % mod)
p04029
s295916757
Accepted
N=int(input()) a=int(N*(N+1)/2) print(a)
p03329
s036972253
Wrong Answer
N=int(input());t=[0]+[N]*N for i in range(2,N+1): x,a,b=t[i-1],6,9 while a<=i:x=min(x,t[i-a],t[i-b]if b<=i else N);a*=6;b*=9 t[i]=x+1 print(t[N])
p02683
s643634512
Wrong Answer
import sys input=lambda: sys.stdin.readline().rstrip() n,m,x=map(int,input().split()) A=[[int(i) for i in input().split()] for _ in range(n)] ans=float("inf") for i in range(2**n): B=[0]*(m+1) for j in range(n): if i&(1<<j): for k in range(m+1): B[k]+=A[j][k] if min(B[1:])>=x: ans=min(ans,B[0]) print(ans)
p03146
s374648054
Accepted
import copy a = [int(input())] t = [] i = 1 def f(n): if n % 2 == 0: return int(n / 2) else: return int(3 * n + 1) while True: a.append(f(a[i - 1])) t = copy.copy(a) t = [j for j, x in enumerate(t, 1) if t.count(x) > 1] if 0 < len(t): print(t[1]) break i += 1
p02989
s037299699
Accepted
import sys input = sys.stdin.readline def main(): N = int(input()) d = list(map(int, input().split())) d.sort() center_left = N//2 - 1 center_right = N//2 ans = d[center_right] - d[center_left] print(ans) main()
p02971
s900208887
Wrong Answer
n = int(input()) a = [] for i in range(n): a.append(int(input())) s = sorted(a) for j,k in enumerate(a): print(s[-2]) if j == n else print(s[-1])
p03086
s878543966
Accepted
s = input() a = [-1] b = 0 for n in range(len(s)): if s[n] != "A" and s[n] != "C" and s[n] != "G" and s[n] != "T": a.append(n) a.append(len(s)) for n in range(len(a)-1): b = max(b, a[n+1]-a[n]-1) print(b)
p02917
s664063956
Accepted
n = int(input()) b_l = list(map(int, input().split())) a_l = [0] * n a_l[0] = b_l[0] a_l[-1] = b_l[-1] for i in range(1, n-1): a_l[i] = min(b_l[i],b_l[i-1]) print(sum(a_l))
p03211
s290184259
Wrong Answer
s = input() ans = 1000000 for i in range(len(s) - 3): ans = min(ans , abs(int(s[i : i + 3]) - 753)) print(ans)
p02924
s485511879
Accepted
n=int(input()) print(int(n*(n-1)//2))
p02946
s486025336
Wrong Answer
k, x = map(int, input().split()) ans = [] for i in range((k//2) + 2): a = x + i ans.append(a) b = x - i ans.append(b) ans = sorted(set(ans)) ans = map(str, ans) print(' '.join(ans))
p02578
s455158288
Wrong Answer
from typing import List def step(n: int, a: List[int])-> int: result = 0 dai = 0 for i in range(1,n): sub = a[i-1] + dai - a[i] print(sub) if sub > 0: dai = sub result += sub continue dai = 0 return result if __name__ == "__main__": n = int(input()) a = list(map(int, input().split())) print(step(n, a))
p03479
s460299295
Wrong Answer
import math [x,y] = [int(i) for i in input().split()] div = y / x ls = [] for i in range(100): ls.append(2 ** i) if int(div) in ls: print(math.ceil(math.log(div,2))+1) else: print(math.ceil(math.log(div,2)))
p02882
s374701997
Accepted
import math a,b,x = [int(i) for i in input().split(" ")] S = a**2*b # 満タンの場合 if S==x: theta = math.pi/2 # 半分以下の場合(水平に近い状態でこぼれる) elif S/2 < x: theta = math.atan(a**3/(2*(S-x))) # 半分以上の場合(垂直に近い状態でこぼれる) else: theta = math.atan(2*x/(a*b**2)) print(90-math.degrees(theta))
p03274
s992996739
Accepted
N,K=map(int,input().split()) x=list(map(int,input().split())) al=[] for i in range(N-K+1): if x[i]*x[i+K-1]<0: al.append(max(abs(x[i]),abs(x[i+K-1]))+2*min(abs(x[i]),abs(x[i+K-1]))) elif x[i]>=0: al.append(x[i+K-1]) else: al.append(abs(x[i])) print(min(al))
p03719
s557188620
Accepted
a, b, c = map(int, input().split()) if c >= a and c <= b: print("Yes") else: print("No")
p02657
s352762624
Accepted
import sys def log(s): # print("| " + str(s), file=sys.stderr) pass def output(x): print(x, flush=True) def input_ints(): return list(map(int, input().split())) def main(): f = input_ints() print(f[0] * f[1]) main()
p02873
s915761411
Accepted
S = input() N = len(S) a = [0] * (N + 1) for i in range(N): if S[i] == '<': a[i + 1] = a[i] + 1 for i in range(N - 1, -1, -1): if S[i] == '>' and a[i] <= a[i+1]: a[i] = a[i+1] + 1 print(sum(a))
p03627
s011780335
Accepted
import collections a = int(input()) ar = list(map(int,input().split(" "))) br = collections.Counter(ar) cr = [] for k,v in br.items(): if v >= 4: cr.append(k) cr.append(k) elif v >= 2: cr.append(k) cr = sorted(cr,reverse=True) if len(cr) < 2: print(0) else: print(cr[0] * cr[1])
p04043
s976443243
Accepted
def actual(A, B, C): if (A, B, C) in [(5, 5, 7), (5, 7, 5), (7, 5, 5)]: return 'YES' return 'NO' A, B, C = map(int, input().split()) print(actual(A, B, C))