problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03986
s635119190
Wrong Answer
x = input() x = x.replace("ST", "") ans = len(x) s = 0 t = 0 f = 1 for xi in x: if f and xi == "S": if f: s += 1 else: ans -= min(s, t) * 2 s = 1 t = 0 f = 1 if s and xi == "T": t += 1 f = 0 ans -= min(s, t) * 2 print(ans)
p02811
s625012355
Accepted
k,x=map(int,input().split()) if x<=500*k: print('Yes') else: print('No')
p03434
s049781010
Wrong Answer
N = int(input()) a = list(map(int,input().split())) Alice=0 Bob=0 for i in range(N): if i % 2 ==0: Alice+=a[i] else: Bob+=a[i] if Alice>Bob: print(Alice-Bob) else: print(Bob-Alice)
p03605
s731368602
Accepted
N = input() if '9' in N: print('Yes') else: print('No')
p02768
s161204903
Accepted
mod = 10**9 + 7 def cmb(n,r,mod): a=1 b=1 r = min(r,n-r) for i in range(r): a = a*(n-i)%mod b = b*(i+1)%mod return a*pow(b,mod-2,mod)%mod n,a,b = map(int,input().split()) count = 0 all = pow(2,n,mod) - 1 nCa = cmb(n,a,mod) nCb = cmb(n,b,mod) ans = all - (nCa + nCb) while (ans < 0): ans += mod print(ans)
p02646
s408142773
Accepted
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) dv = V - W dist = abs(B - A) if dv*T >= dist: print("YES") else: print("NO")
p03289
s137817269
Accepted
s = input() ans = True if s[0] == 'A' else False num = 0 for i in range(1, len(s)): if s[i] == 'C' and i != len(s) - 1 and i != 1: num += 1 elif ord(s[i]) <= ord('Z') and ord(s[i]) >= ord('A'): ans = False break if num != 1: ans = False print('AC' if ans else 'WA')
p03971
s642219181
Wrong Answer
count1 = 0 count2 = 0 N, A, B = map(int, input().split()) S = list(input()) for i in S: if i == "a" and A + B >= count1: print("Yes") count1 += 1 elif i == "b" and A + B >= count1 and B > count2: print("Yes") count1 += 1 count2 += 1 else : print("No")
p04031
s506276784
Wrong Answer
import math n = int(input()) arr = list(map(int,input().split())) add = sum(arr) x = math.ceil(add/n) ans = 0 for i in range(len(arr)): ans += ((x-arr[i])*(x-arr[i])) print(ans)
p03986
s509044487
Accepted
s_list = list(input()) seizon_t = 0 s_amari = 0 for char in s_list: if char == "T": if s_amari == 0: seizon_t += 1 else: s_amari -= 1 else: s_amari += 1 print(2*seizon_t)
p02759
s955531554
Accepted
N = int(input()) print((N+1)//2)
p02744
s942889280
Accepted
n=int(input()) def f(s): return len(set([s[i] for i in range(len(s))])) alphabet = [chr(i) for i in range(97, 97+26)] for i in range(1,n+1): if i==1: iso=["a"] else: iso_new=[] for s in iso: for j in range(f(s)+1): iso_new.append(s+alphabet[j]) iso = list(set(iso_new)) iso.sort() for s in iso: print(s)
p03211
s207903291
Accepted
def main(): S = str(input()) t = 0 diff = 0 near = 10000 for i in range(2, len(S)): t = int(S[i-2]) * 100 + int(S[i-1]) * 10 + int(S[i]) if 753 < t: diff = t - 753 else: diff = 753 - t if near > diff: near = diff print(near) main()
p02664
s670147515
Accepted
T=input().replace("?","D") print(T)
p02754
s950003311
Accepted
import math x = input().split() n = int(x[0]) a = int(x[1]) b = int(x[2]) z = 0 z = math.floor(n / (a+b)) * a amari = math.floor(n % (a+b)) if amari == 0: pass elif amari <= a: z += amari else: z += a print(z)
p02582
s981253505
Wrong Answer
RS = input() answer = 0 for i, j in enumerate(RS): if j == "R": answer += 1 elif (i == 2 and j == "S") or (i == 1 and j == "S"): continue else: answer = 0 print(answer)
p02756
s918799641
Wrong Answer
from collections import deque d=deque() s=input() d.append(s) Q=int(input()) for i in range(Q): r=input() if len(r.split()) == 3: T,F,C=r.split() else: T='1' if T == '1': s=d.pop() d.rotate(1) d.append(s) continue if T == '2': if F == '1': d.appendleft(C) if F == '2': d.append(C) print("".join(d))
p03760
s010883427
Accepted
O = input() E = input() x = len(E) ans = "" for i in range(len(O)-1): ans += O[i] ans += E[i] ans += O[len(O)-1] try: ans += E[len(O)-1] except IndexError: pass print(ans)
p03274
s460062169
Accepted
N,K=map(int,input().split()) x=list(map(int,input().split())) minus=[] plus=[] for i in range(N): if x[i]<0: minus.append(abs(x[i])) else: plus.append(x[i]) minus.append(0) plus.append(0) plus.sort() minus.sort() ans=int(1e9) for i in range(K+1): if 0<=i<len(plus) and 0<=K-i<len(minus): ans=min(ans,plus[i]+minus[K-i]+min(plus[i],minus[K-i])) print(ans)
p02801
s791995581
Accepted
C = input() alpha = [chr(ord('a') + i) for i in range(26)] N = alpha.index(C) print(alpha[N+1])
p02755
s637077866
Accepted
def main(): A, B = map(int, input().split()) x = int(A/0.08) y = int((A+1)/0.08) for i in range(x, y+1): if int(i*0.08) == A and int(i*0.1) == B: print(i) return print(-1) main()
p03627
s706444722
Accepted
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n = int(input()) a = list( map(int, input().split())) from collections import Counter c = Counter(a) ma1 = 0 ma2 = 0 for k,v in c.items(): if v < 2: continue if k > ma1: if v >= 4: ma2 = k ma1 = k continue else: ma2 = ma1 ma1 = k elif k > ma2: ma2 = k print(ma1*ma2)
p02570
s982429577
Wrong Answer
d,t,s=map(int,input().split()) if d//s>t: print("No") else: print("Yes")
p02994
s387102211
Accepted
N,L=map(int,input().split()) v=[L+i for i in range(N)] s=sum(v) ans=10**9 for i in range(N): if abs(s-(s-v[i]))<abs(s-ans): ans=s-v[i] print(ans)
p03109
s559274507
Wrong Answer
s=list(input()) if int(s[5])==1: print("TBD") elif int(s[6])>=5: print("TED") else: print("Heisei")
p03385
s789380752
Accepted
S = input() if "a" in S and "b" in S and "c" in S: print("Yes") else: print("No")
p03011
s998647498
Wrong Answer
p,q,r=map(int,input().split()) if p>=q and p>r: print(q+r) if q>=p and q>r: print(p+r) if r>=q and r>p: print(q+p) if r==p and p==q: print(p+q)
p03241
s202128322
Accepted
N, M = list(map(int, input().split())) s, r = divmod(M, N) ans = 1 for i in range(s, 0, -1): if M % i == 0: print(i) break
p02747
s512567775
Accepted
S = input() n = len(S) // 2 if 'hi' * n == S: print('Yes') else: print('No')
p02627
s153887688
Accepted
s = input() if s.isupper(): print('A') else: print('a')
p03284
s982666959
Accepted
print(eval(input().replace(*' %'))%2)
p03329
s087392511
Accepted
sixexp=[6**i for i in range(1,7)] nineexp=[9**i for i in range(1,6)] lis=[1]+sixexp+nineexp n=int(input()) dp=[1000000 for i in range (n+1)] dp[0]=0 for i in range(n): for j in lis: if i+j<=n: dp[i+j]=min(dp[i+j],dp[i]+1) print(dp[n])
p03605
s895711467
Accepted
print('Yes' if '9' in input() else 'No')
p03457
s418528279
Accepted
n=int(input()) data=[list(map(int,input().split())) for _ in range(n)] x_past=0 y_past=0 t_past=0 for t,x,y in data: if abs(x-x_past)+abs(y-y_past)>t-t_past: print("No") exit() if (abs(x-x_past)+abs(y-y_past))%2!=(t-t_past)%2: print("No") exit() x_past=x y_past=y t_past=t print("Yes")
p03001
s941684547
Wrong Answer
w,h,x,y=map(int,input().split()) if x==w or x==0: if y==h or y==0: print(0,"1") else: w2=int(w//2) h2=int(h//2) s1=h*w2 s2=w*h2 if s1>s2: print(s1,"0") elif s1==s2: print(s1,"1") else: print(s2,"0")
p03962
s273107193
Wrong Answer
a,b,c = sorted(list(map(int,input().split()))) if a == c: print("1") elif a == b | b == c: print("2") else: print("3")
p02729
s774160283
Accepted
N,M=(int(x) for x in input().split()) #N=int(input()) #A=list(map(int, input().split())) if N>=2: a=int(N*(N-1)/2) else: a=0 if M>=2: b=int(M*(M-1)/2) else: b=0 print(a+b)
p03556
s736227483
Accepted
n = int(input()) A = [int(x) for x in range(1,34000)] for i in range(33999): A[i] = A[i]**2 B = [i for i in A if i <= n] print(max(B))
p03037
s129241236
Accepted
k,m=map(int,input().split()) l=[0 for i in range(k+1)] for i in range(m): a,s=map(int,input().split()) l[a-1]+=1;l[s]-=1 ans=0 f=0 for j in range(k): l[j]+=f f=l[j] print(len([1 for i in l if i==m]))
p02995
s515903269
Accepted
a,b,c,d = map(int,input().split()) import math LCM=c * d //math.gcd(c, d) tmp1=b//c + b//d - b//LCM #1~bまで調べたとき、割り切れる数の個数 tmp2=(a-1)//c + (a-1)//d - (a-1)//LCM #1~a-1まで調べたとき、割り切れる数の個数 tmp=tmp1-tmp2 #a~bまで調べたとき、割り切れる数の個数 ans=(b-a+1)-tmp print(ans)
p03105
s816182320
Wrong Answer
A,B,K=map(int,input().split()) cnt=0 num=1 for i in range((min(A,B)),0,-1): if A%i==0 and B%i==0: cnt+=1 num=i if cnt==K: break print(num)
p03705
s092671329
Accepted
N,A,B=map(int,input().split()) print(max(0,B*(N-1)+A-(A*(N-1)+B)+1))
p03627
s371299018
Accepted
from collections import defaultdict N = int(input()) A = list(map(int,input().split())) A = sorted(A, reverse=True) d = defaultdict(int) for i in range(N): d[A[i]] += 1 d = sorted(d.items(), key=lambda x:x[1], reverse=True) d = sorted(d, key=lambda x:x[0], reverse=True) a = [] for key, val in d: if 2 <= val <= 3: a.append(key) elif val >= 4: a.append(key) a.append(key) if len(a) >= 2: print(a[0]*a[1]) exit() if len(a) < 2: print(0)
p02946
s272411747
Accepted
k,x=map(int,input().split()) import numpy as np #print(x-k+1,x+k-1+1) a=[str(ii) for ii in np.arange(x-k+1,x+k-1+1)] print(" ".join(a))
p02766
s184553037
Accepted
#!/usr/bin/env python3 n, k = map(int, open(0).read().split()) def Base_10_to_n(X, n): X_dumy = X out = '' while X_dumy>0: out = str(X_dumy%n)+out X_dumy = int(X_dumy/n) return out print(len(Base_10_to_n(n, k)))
p02606
s332858726
Accepted
l,r,d=map(int,input().split()) if l%d == 0: print((r//d)-(l//d)+1) else: print((r//d)-(l//d))
p02988
s712232939
Wrong Answer
n = int(input()) number = input().split(" ") ans = 0 for i in range(n-2): if number[i] >= number[i+1] and number[i+1] >= number[i+2]: ans += 1 elif number[i] <= number[i+1] and number[i+1] <= number[i+2]: ans += 1 else: pass print(ans)
p03251
s885543300
Accepted
inf = 10**15 mod = 10**9+7 n,m,x,y = map(int, input().split()) xlist = list(map(int, input().split())) ylist = list(map(int, input().split())) xmax = max(xlist) ymin = min(ylist) if xmax < ymin and xmax < y and ymin > x: print('No War') else: print('War')
p03219
s810435771
Wrong Answer
x,y=map(int,input().split()) print(x+(y/2))
p02724
s283323436
Wrong Answer
yen = int(input()) count = 0 while yen - 500 > 0: yen -= 500 count += 1000 while yen - 5 > 0: yen -= 5 count += 5 print(count)
p03438
s022925501
Wrong Answer
N = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) total1 = 0 total2 = 0 for i in range(N): if a[i]>b[i]: total1 += a[i]-b[i] else: total2 += b[i]-a[i] if total1 <=total2/2: print('Yes') else: print('No')
p03437
s247674520
Accepted
x, y = map(int, input().split()) if x % y == 0: print('-1') else: print(x)
p02823
s662390056
Accepted
N,A,B=map(int,input().split()) if (B-A)%2==0: print((B-A)//2) else: print(min(A-1,N-B)+1+(B-A-1)//2)
p02987
s366222538
Wrong Answer
a = input() for i in range (4): if a[0]==a[1] or a[0]==a[2] or a[0]==a[3] and a[1]==a[2] or a[1]==a[3] or a[2]==a[3]: print("Yes") else: print("No") break
p03854
s258399532
Accepted
import re s = input() ptn = re.compile(r'maerd|remaerd|resare|esare') tmp = s[::-1] while(True): res = re.match(ptn , tmp) if res is None: break tmp = tmp.replace(res.group(),'',1) if len(tmp) == 0: print('YES') else: print('NO')
p03835
s099563776
Accepted
k,s=map(int,input().split()) ans=0 for x in range(0,k+1): for y in range(0,k+1): z=s-x-y if 0<=z<=k: ans+=1 print(ans)
p03435
s237640348
Accepted
cmatrix = [] for i in range(3): cmatrix.append(list(map(int, input().split()))) if(cmatrix[0][0]+ cmatrix[1][1] == cmatrix[0][1]+ cmatrix[1][0] and \ cmatrix[0][1]+ cmatrix[1][2] == cmatrix[0][2]+ cmatrix[1][1] and \ cmatrix[1][0]+ cmatrix[2][1] == cmatrix[1][1]+ cmatrix[2][0] and \ cmatrix[1][1]+ cmatrix[2][2] == cmatrix[1][2]+ cmatrix[2][1]): print("Yes") else: print("No")
p02859
s590449838
Accepted
r=int(input()) print(r**2)
p03035
s397420068
Accepted
a,b=map(int,input().split()) if a>=13: print(b) elif a>=6: print(int(b/2)) else: print(0)
p02866
s625558257
Accepted
mod = 998244353 N = int(input()) D = list(map(int,input().split())) from collections import Counter if D[0] != 0 or 0 in D[1:]: print(0) else: dc1 = Counter(D[1:]) dc = [0 for i in range(max(D))] for k,v in dc1.items(): dc[k-1] = v ans = 1 for i in range(1,len(dc)): if dc[i] == 0: ans = 0 break ans = (ans*(dc[i-1]**dc[i]))%mod print(ans)
p02918
s114091596
Accepted
N,K=map(int,input().split()) S=list(input()) c,s=0,S[0] for n in S[1:]: if s==n: c+=1 s=n print(min(N-1,c+2*K))
p03449
s085114980
Accepted
N = int(input()) A = {} S = 0 MS = 0 for i in range(2): A[i] = list(map(int,input().split())) for i in range(N): S = 0 for j in range(i+1): S += A[0][j] for k in range(N-i): S += A[1][N-k-1] if S > MS: MS = S print (MS)
p02953
s105692210
Accepted
n = int(input()) h = list(map(int, input().split())) flag = True x = h[0] - 1 for i in range(1, n): if h[i] < x: flag = False break elif h[i] == x: pass else: x = h[i] - 1 if flag: print("Yes") else: print("No")
p03339
s340016549
Wrong Answer
N = int(input()) S = input() E = [0] * (N + 1) W = [0] * (N + 1) for i, s in enumerate(S): E[i + 1] = E[i] + (s == 'E') W[i + 1] = W[i] + (s == 'W') ans = N for i in range(1, N): L = W[i - 1] R = E[N] - E[i] ans = min(ans, L + R) print(ans)
p02797
s255879239
Accepted
N, K, S = map(int, input().split()) res = [] for x in range(K): res.append(S) q = N - K fix = round(1e9) if S != 1e9 else round(1e9 - 1) for _q in range(q): res.append(fix) print(' '.join(map(str, res)))
p02995
s858103643
Wrong Answer
import math A, B, C, D = map(int, input().split()) CD = int(C * D / math.gcd(C, D)) B_in_C = int(B/C) B_in_D = int(B/D) B_in_CD = int(B/(CD)) B_con = B - (B_in_C + B_in_D - B_in_CD) A = A-1 if A > 1 else A A_in_C = int(A/C) A_in_D = int(A/D) A_in_CD = int(A/(CD)) A_con = A - (A_in_C + A_in_D - A_in_CD) print(B_con - A_con)
p02783
s751901469
Accepted
H, A = map(int, input().split()) X = H//A print(X if H%A == 0 else X+1)
p03038
s437096912
Accepted
from collections import defaultdict n,m=map(int,input().split()) a=[int(i) for i in input().split()] a.sort() bc=defaultdict(int) for i in range(m): b,c=map(int,input().split()) bc[c]+=b i=0 newc=[0]*n for c,b in sorted(bc.items(),key=lambda x:x[0],reverse=True): for _ in range(b): if i==n: break newc[i]=c i+=1 ans=sum(a) for i in range(n): if newc[i]>a[i]: ans+=newc[i]-a[i] print(ans)
p04030
s293859497
Accepted
S = input() ans = "" flag = 0 for s in S[::-1]: if s == "B": flag += 1 continue if flag: flag -= 1 continue ans += s print(ans[::-1])
p03012
s975401290
Wrong Answer
n = int(input()) w = list(map(int, input().split())) sumW = sum(w) halfW = sumW//2 t = 0 for i in w: t += i if t >= halfW: break print(abs(sumW - 2*t))
p03261
s420442974
Accepted
import collections a = int(input()) words = [input() for i in range(a)] c = collections.Counter(words) key = len(c.keys()) tmp = 0 for i in range(len(words)-1): if len(words) == key: if words[i][-1] == words[i+1][0]: tmp += 1 else: tmp = 0 else: break if tmp == len(words)-1: print("Yes") else: print("No")
p02900
s299523449
Accepted
from fractions import gcd from math import sqrt def prime_factorize(n): result = [] for i in range(2, int(sqrt(n)) + 1): if n % i != 0: continue t = 0 while n % i == 0: n //= i t += 1 result.append((i, t)) if n == 1: break if n != 1: result.append((n, 1)) return result A, B = map(int, input().split()) print(len(prime_factorize(gcd(A, B))) + 1)
p02719
s773814791
Accepted
N,K = map(int,input().split()) print (min(N % K , K - N % K))
p02603
s026045946
Wrong Answer
N=int(input()) A=list(map(int,input().split())) G=1000 K=0 for i in range(N-1): if A[i+1]>A[i]: K=G//A[i] G=G % A[i] if A[i+1]<A[i]: G=G+A[i]*K K=0 G=G+A[N-1]*K print(G)
p02755
s865974763
Accepted
def main(): import sys import math input = sys.stdin.readline a,b=map(int,input().split()) if b>=10: for i in range(b*10,b*10+10): if a==math.floor(i*0.08): print(i) exit() print(-1) else: for i in range(b*10,b*10+10): if a==math.floor(i*0.08): print(i) exit() print(-1) if __name__=='__main__': main()
p03220
s404304272
Accepted
n=int(input()) t,a=map(int,input().split()) h=list(map(int,input().split())) ans=0 res=float('inf') for i in range(n): if abs(t-h[i]*float(0.006)-a)<res: res=abs(t-h[i]*float(0.006)-a) ans=i+1 print(ans)
p03624
s726074800
Wrong Answer
s=list(input()) s=list(set(s)) s.sort() import string l=string.ascii_lowercase ans="None" for i in range(len(s)): if s[i]!=l[i]: ans=l[i] break if len(s)==1 and s[0]=="a": ans="b" print(ans)
p02775
s309164033
Accepted
N = str(input()) L = len(N) ans = 0 dp = [[0,0] for _ in range(L)] s = list(map(int,N)) dp[0] = [s[0],11-s[0]] for i in range(1,L): n = s[i] dp[i][0] = min(dp[i-1][0]+n,dp[i-1][1]+n) dp[i][1] = min(dp[i-1][1]+9-n,dp[i-1][0]+11-n) print(min(dp[-1]))
p02783
s908967968
Wrong Answer
H,A=map(int,input().split()) B=0 C=0 for i in range(0,H): B=B+A if B<=H: C=C+1 print(C) break else: C=C+1
p02759
s072367423
Accepted
a=int(input()) ans=0 if a % 2 ==1: ans=round((a+1)/2) else: ans=round(a/2) print(ans)
p03161
s604033094
Accepted
import sys INF = sys.maxsize N, K = (int(x) for x in input().split()) heights = [int(x) for x in input().split()] memo = [INF] * N for i in range(N - 1, -1, -1): if i == N - 1: # ゴールからゴールの距離を0で初期化 memo[i] = 0 continue cost = INF for j in range(1, K + 1): # 範囲外 if i + j >= N: continue cost = min(cost, memo[i + j] + abs(heights[i] - heights[i + j])) memo[i] = cost print(memo[0])
p03659
s650450368
Accepted
N =int(input()) a =[int(i) for i in input().split()] j =a[0] k =0 for i in range(1,N): k += a[i] ans =abs(j-k) for x in range(1,N-1): j += a[x] k -= a[x] ans = min(ans,abs(j-k)) print(ans)
p02779
s195156184
Wrong Answer
N = int(input()) A = list(map(int, input().split())) flag = 0 for i in range(N-1): if A[i] != A[i+1]: flag = 0 else: flag = 1 if flag == 0: print('YES') else: print('NO')
p03611
s469912269
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 for i in range(N): tmp_ans = 0 for a in A: if a - 1 > i: continue elif a + 1 < i: break else: tmp_ans += 1 if tmp_ans > ans: ans = tmp_ans print(ans)
p03069
s296518762
Wrong Answer
N = int(input()) S = list(str(input())) count1,count2 = 0,0 j = 0 for i in range(N-1,-1,-1): if S[i] == "#": j = i break count1 = S[:j+1].count("#") for i in range(1,N): if S[i-1] == "#" and S[i] == ".": count2 += 1 S[i] = "#" print(min(count1,count2))
p04020
s768113808
Accepted
def main(): n = int(input()) bef = 0 ans = 0 for i in range(n): now = int(input()) ans += min(bef, now) now -= min(bef, now) ans += now//2 bef = now % 2 print(ans) if __name__ == "__main__": main()
p02989
s148016396
Accepted
N = int(input()) d = list(map(int, input().split())) d.sort() dv = N//2 print(d[dv] - d[dv-1])
p02598
s583914948
Accepted
import sys sys.setrecursionlimit(10**7) readline = sys.stdin.buffer.readline def readstr():return readline().rstrip().decode() def readstrs():return list(readline().decode().split()) def readint():return int(readline()) def readints():return list(map(int,readline().split())) def printrows(x):print('\n'.join(map(str,x))) def printline(x):print(' '.join(map(str,x))) n,k = readints() a = readints() l = 0 r = 10**10 while r-l>1: m = (l+r)//2 x = [(a[i]-1)//m for i in range(n)] if sum(x)<=k: r = m else: l = m print(r)
p03438
s232042702
Wrong Answer
n=int(input()) a=sorted(list(map(int,input().split()))) b=sorted(list(map(int,input().split()))) for i in range(n): if a[i]<=b[i]: x=b[i]-a[i] a[i]=a[i]+2*x b[i]=b[i]+x # print(a,b) for i in range(n): if a[i]>10**9 or b[i]>10**9: print('No') exit() if a[i]!=b[i]: print('No') exit() print('Yes')
p03282
s008982703
Wrong Answer
s = input() for i in s: if i == "1": continue else: print(i) exit()
p02624
s473238969
Wrong Answer
N = int(input()) ans = 0 for i in range(1, N + 1): start = i n = N // i end = i * n ans += n * (n + 1) // 2 print(ans)
p02817
s645773118
Wrong Answer
s, t = map(str, input().split()) print(s + t)
p03011
s032106565
Accepted
a = list(map(int, input().split())) a.sort() print(a[0]+a[1])
p03494
s301658746
Accepted
n=int(input()) a=[int(x) for x in input().split()] s=all([x%2==0 for x in a]) ans=0 while s: s=all([x%2==0 for x in a]) if s: ans+=1 for i in range(n): a[i]=a[i]//2 print(ans)
p02772
s583651661
Wrong Answer
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): N = int(readline()) A = list(map(int, readline().split())) def judge(): for x in A: if x % 2 == 0: if x % 3 != 0 or x % 5 != 0: return False return True if judge(): print("APPROVED") else: print("DENIED") if __name__ == '__main__': main()
p02646
s045803928
Wrong Answer
A, V =map(int, input().split()) B, W =map(int, input().split()) T=int(input()) d=abs(B-A) dv=V-W if dv<=0: print("NO") elif d%dv !=0 : print("NO") elif d/dv > T: print("NO") else: print("YES")
p02972
s283324498
Accepted
N = int(input()) *b, = map(int, input().split()) ans = [] for i in range(N)[::-1]: n = i+1 if b[i]: ans.append(n) for j in range(1, int(n**0.5)+1): if n%j==0: b[j-1] ^= 1 if j!=n//j: b[n//j-1] ^= 1 M = len(ans) print(M) if ans: print(*ans)
p03331
s251469896
Accepted
N = int(input()) ans = 1000000 for i in range(1, N+1): A = i B = N - i if A <= B: Asum = sum(map(int, str(A))) Bsum = sum(map(int, str(B))) if ans > (Asum + Bsum): ans = Asum + Bsum print(ans)
p02548
s511668456
Wrong Answer
def make_divisors(n): count = 0 for i in range(1, int(n**0.5)+1): if n % i == 0: count += 1 if i != n // i: count +=1 return count N = int(input()) S = [0 for i in range(N - 1)] for i in range(1, N): if(i == 1): S[i-1] = 1 else: div_count = make_divisors(i) S[i-1] = S[i-2] + div_count
p02682
s100092094
Accepted
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif a < k <= (a+b): print(a) else: num = k-a-b print(a-num)