problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02835
s218019677
Wrong Answer
a1, a2, a3 = map(int, input().split()) if 1 <= a1 <= 13 and 1 <= a2 <= 13 and 1 <= a3 <= 13: if a1 + a2 + a3 == 22: print('bust.') else: print('win.')
p03289
s887492140
Wrong Answer
import sys S=input() first=S[0] cnt=0 moji=[i for i in "abcdefghijklmnopqrstuvwxyz"] if first=="A": for i in range(2,len(S)-1): if S[i]=="C": cnt+=1 else: if (S[i] in moji)==False: print("WA") sys.exit() if cnt==1: print("AC") else: print("WA") else: print("WA")
p03293
s663641170
Wrong Answer
S = input() T = input() ans = 'No' for i in range(len(S)): print(S, T) if S == T: ans = 'Yes' break S = S[-1] + S[:-1] print(ans)
p02918
s843024811
Accepted
n,k = map(int,input().split()) S = input() s = list(S) ans = 0 for i in range(n-1): if s[i] == s[i+1]: ans += 1 ans += 2*k print(min(ans,n-1))
p03043
s685925082
Wrong Answer
from fractions import Fraction N , K = list(map(int,input().split())) denom_list = [] Z=0 def detame_keisan( N , K , i ): kijun = 10 score = i count = 0 while score < kijun: count += 1 score = ( score * 2 ) print(count) return N * (2 ** count) for i in range( 1,N+1 ): X = detame_keisan( N , K , i) denom_list.append( X ) for item in denom_list: Z += 1/item print( Z )
p02553
s457732849
Accepted
a, b, c, d = map(int, input().split()) ans = [a*c, a*d, b*c, b*d] print(max(ans))
p03109
s780741568
Accepted
y, m, d = input().split('/') t = int(y + m + d) if t <= 20190430: print('Heisei') else: print('TBD')
p02556
s071974224
Wrong Answer
n = int(input()) a = [] b = [] for i in range(n): x , y = map(int,input().split()); a.append(x + y) b.append(abs(x - y)) aa = max(a)-min(a) bb = max(b)-min(b) if aa >= bb: print(aa) else: print(bb)
p02783
s397636785
Accepted
h,a=map(int,input().split()) print(h//a if h%a==0 else h//a+1)
p02953
s159265857
Accepted
n = int(input()) h = [int(i) for i in input().split()] x = True c = 0 for i in range(n): if i > 0 and h[i - 1] - h[i] >= 2: x = False break elif i > 0 and h[i - 1] - h[i] == 1: c += 1 elif i > 0 and h[i] > h[i - 1] and c == 1: c = 0 if c == 2: x = False break if x: print("Yes") else: print("No")
p02947
s221873357
Accepted
m = {} ans = 0 n = int(input()) def C(x:int) -> 'conbination_nC2': return x*(x-1)/2 for i in range(n): s = input() new_str = ''.join(sorted(s)) if new_str in m.keys() : m[new_str] += 1 else : m[new_str] = int(1) for i in m: ans += C(m[i]) print(int(ans))
p02989
s829189682
Accepted
n = int(input()) d = [int(xi) for xi in input().split()] d = sorted(d) print(d[int(n/2)]-d[int(n/2)-1])
p03565
s926894876
Wrong Answer
Sp = input() T = input() if len(T) > len(Sp): print("UNRESTORABLE") exit() if T in Sp: print(Sp.replace("?", "a")) exit() oklist = [] for i in range(len(Sp) - len(T), -1, -1): for j in range(len(T)): if Sp[i + j] != "?" and Sp[i + j] != T[j]: break else: anspre = ["a" if Sp[k] == "?" else Sp[k] for k in range(i)] anssuf = ["a" if Sp[k] == "?" else Sp[k] for k in range(len(Sp) - j - i - 1)] oklist.append("".join(anspre) + T + "".join(anssuf)) if oklist: print(min(oklist)) else: print("UNRESTORABLE")
p02820
s136692088
Accepted
N,K=map(int,input().split()) R,S,P=map(int,input().split()) T=input() score=0 kekka=[] def Tensu(Aite): if Aite=="r": return P elif Aite=="s": return R else: return S for i in range(N): if i<K: score+=Tensu(T[i]) kekka.append(1) else: if T[i]!=T[i-K] or kekka[i-K]==0: score+=Tensu(T[i]) kekka.append(1) else: score+=0 kekka.append(0) print(score)
p03711
s406116657
Accepted
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] if (x in a and y in a) or (x in b and y in b) or (x in c and y in c): print("Yes") else: print("No")
p03359
s199493906
Accepted
a, b = map(int, input().split()) if a > b: print(a-1) else: print(a)
p02552
s462550684
Accepted
x= int(input()) if x == 0: print(1) else: print(0)
p03617
s608899655
Accepted
Q,H,S,D = map(int, input().split()) N = int(input()) if N % 2 == 0: print(min(Q*N*4,H*N*2,S*N,D*N//2)) else: N -= 1 print(min(Q*N*4,H*N*2,S*N,D*N//2) + min(Q*4,H*2,S))
p02700
s919029829
Wrong Answer
THP, TMP, AHP, AMP = map(int, input().split()) if TMP == AHP: print('Yes') else: while AHP > 0 and THP > 0: AHP = AHP - TMP THP = THP - AHP if AHP > THP: print('Yes') else: print('No')
p02582
s184266219
Wrong Answer
s = input() maxCount = 0 count = 0 for i in s: if(i == 'R'): count += 1 else: maxCount = max(count, maxCount) count = 0 print(maxCount)
p03455
s198647912
Accepted
a,b=map(int,input().split()) print('Odd' if (a*b)%2==1 else 'Even')
p03261
s496035807
Wrong Answer
# input N = int(input()) W = [input() for n in range(N)] # check before = W[0] for i in range(1, N): if W[i][0] != before[-1] or W[i] in W[:i]: print("No") exit(0) print("Yes")
p02613
s777436052
Accepted
N=int(input()) AC=0 WA=0 TLE=0 RE=0 for i in range(N): IN=input() if IN=='AC': AC+=1 if IN=='WA': WA+=1 if IN=='TLE': TLE+=1 if IN=='RE': RE+=1 print('AC x ',AC) print('WA x ',WA) print('TLE x ',TLE) print('RE x ',RE)
p03379
s328735569
Accepted
n = int(input()) X = list(map(int,input().split())) Y = sorted(X) left = Y[n//2-1] right = Y[n//2] for i in X: if i <= left: print(right) else: print(left)
p02933
s426296695
Accepted
a = int(input()) s = input() if a >= 3200: print(s) else: print("red")
p03548
s066032477
Accepted
x,y,z=map(int,input().split());print((x-z)//(y+z))
p02802
s595599629
Accepted
n, m = map(int, input().split()) ps = [(input().split()) for _ in range(m)] wa = [0] * (n + 1) ac = [0] * (n + 1) for p, s in ps: i = int(p) if s == "WA": if ac[i] != 1: wa[i] += 1 else: if ac[i] != 1: ac[i] = 1 print(sum(ac), sum(wa[i] * ac[i] for i in range(n + 1)))
p02607
s576927484
Accepted
#template def inputlist(): return [int(j) for j in input().split()] #template N = int(input()) a = inputlist() count = 0 for i in range(N): if i % 2 == 0 and a[i] % 2 == 1: count +=1 print(count)
p02712
s379170346
Wrong Answer
n = int(input()) s = 0 for i in range(n): if i % 3 != 0 and i % 5 != 0: s += i print(s)
p03293
s619136231
Accepted
S = input() T = input() for i in range(len(S)): S = S[-1] + S[:-1] if S == T: print('Yes') exit() print('No')
p03548
s629071969
Accepted
X, Y, Z = map(int, input().split()) print((X-Z)//(Y+Z))
p03433
s010558356
Accepted
import sys import math import bisect def solve(n, m): for i in range(m + 1): if i > n: break if (n - i) % 500 == 0: return True return False def main(): n = int(input()) m = int(input()) if solve(n, m): print('Yes') else: print('No') if __name__ == "__main__": main()
p03000
s477577517
Accepted
import itertools N, X = [int(_) for _ in input().split()] L = [int(_) for _ in input().split()] bounce_positions = list(itertools.accumulate([0]+L)) ans = sum(x <= X for x in bounce_positions) print(ans)
p03087
s992667573
Wrong Answer
# -*- coding: utf-8 -*- n, q = map(int,input().split()) s = input() tmp = [0 for _ in range(n)] for i in range(n - 1): if s[i] == 'A' and s[i + 1] == 'C': tmp[i] = 1 tmp[i + 1] = 3 print(tmp) for i in range(q): l, r = map(int,input().split()) ans = sum(tmp[l-1:r]) if tmp[l-1] == 3: ans -= 3 if tmp[r-1] == 1: ans -= 1 print(ans // 4)
p02556
s674778215
Accepted
import math n = int(input()) x = list(range(n)) y = list(range(n)) m = list(range(n)) l = list(range(n)) for i in range(n): x[i],y[i] = map(int,input().split()) m[i] = x[i] - y[i] l[i] = x[i] + y[i] m.sort() l.sort() res = max(m[n-1]-m[0], l[n-1]-l[0]) print(res)
p03073
s129520957
Accepted
s = input() s = list( map(int,s) ) ansa = 0 ansb = 0 a = 0 #01010101 b = 1 #10101010 for i in s: if i != a: ansa += 1 if i != b: ansb += 1 a = (a+1)%2 b = (b+1)%2 print(min(ansa,ansb))
p02571
s088784961
Accepted
s = input() t = input() ans = 10 ** 10 ls = len(s) lt = len(t) for i in range(ls - lt + 1): cnt = 0 for j in range(lt): if s[i + j] != t[j]: cnt += 1 ans = min(ans, cnt) print(ans)
p02790
s418729869
Wrong Answer
a,b = input().split() x = a * int(b) y = b * int(a) if int(x) <= int(y): print(x) else: print(y)
p02546
s991192866
Accepted
S = input() if S[-1]=='s': print(S+'es') else: print(S+'s')
p03289
s473055954
Wrong Answer
S=input() chk = [False, False, False] if S[0]=="A": chk[0]=True ind = 0 for i in range(2, len(S)): if S[i]=="C": chk[1]=True ind=i chk[2]=True for i in range(len(S)): if i==ind or i==0: continue if S[i].isupper(): chk[2]=False if chk[0] and chk[1] and chk[2]: print("AC") else: print("WA")
p02811
s671252020
Accepted
import sys input = sys.stdin.readline class AtCoder: def main(self): K, X = map(int, input().split()) if 500 * K >= X: print("Yes") else: print("No") # Run main if __name__ == '__main__': AtCoder().main()
p02691
s650143824
Accepted
# -*- coding: utf-8 -*- n = int(input()) a = list(map(int,input().split())) bucket_l = [0] * (2*n) bucket_r = [0] * (2*n) for i,v in enumerate(a): if v > n: continue if i-v >= 0: bucket_l[i-v]+=1 bucket_r[i+v]+=1 ret = 0 for i,j in zip(bucket_l,bucket_r): ret+=i*j print(ret)
p03087
s596181537
Accepted
n, q = map(int, input().split()) s = input() t = [0] * (n + 1) for i in range(n): m = 0 if s[i:i+2] == 'AC': m = 1 t[i + 1] = t[i] + m for _ in range(q): l, r = map(int, input().split()) print(t[r-1] - t[l-1])
p02780
s531847787
Wrong Answer
# -*- coding: utf-8 -*- def calc_expect(n): return (n+1) / 2 n, k = map(int, input().split()) p_list = list(map(int, input().split())) p_expect_list = list(map(calc_expect, p_list)) max_val = 0 res = [0] * len(p_expect_list) res[0] = p_expect_list[0] for i in range(len(res)-1): res[i+1] = res[i] + p_expect_list[i+1] for i in range(len(p_expect_list)-k): val = res[i+k]-res[i] if val > max_val: max_val = val print(max_val)
p03854
s293726381
Accepted
s = input()[::-1] x = ["dream", "dreamer", "erase", "eraser"] can = True i = 0 for a in range(4): x[a] = x[a][::-1] while(True): if(i == len(s)): break can2 = False for j in range (4): if(s[i:i+len(x[j])] == x[j]): can2 = True i += len(x[j]) if(can2 == False): can = False break print("YES" if can == True else "NO")
p02725
s570994252
Accepted
K, N = map(int, input().split()) A = list(map(int, input().split())) A += [A[0] + K] gap = max(y-x for x,y in zip(A, A[1:])) print(K - gap)
p02787
s019126546
Wrong Answer
h, n = map(int, input().split()) lis = [] wari = 0 dam = 0 mp = 0 use = 0 for l in range(n): a, b = map(int, input().split()) lis.append([a, b]) if wari < a / b : wari = a / b dam = a mp = b use = (h // dam) * mp h = h % dam if h != 0: for l in range(n): if h <= lis[l][0] and mp >= lis[l][1]: mp = lis[l][1] else: mp = 0 print(use + mp)
p02701
s342087756
Accepted
N = int(input()) s = set() for i in range(N): s.add(input()) print(len(s))
p02597
s570063981
Wrong Answer
n = int(input()) c = input() W_all = c.count("W") R_all = c.count("R") W_0 = c[0 : 0].count("W") R_0 = c[0 : n].count("R") tmp = n W = W_0 R = R_0 for i in range(n): #print(W, R) if c[i] == "W": W += 1 R = R elif c[i] == "R": W = W R -= 1 if tmp >= max([W ,R]): tmp = max([W, R]) print(tmp)
p03261
s952026061
Accepted
n = int(input()) w = list(input() for i in range(n)) s = True for i in range(len(w)-1): if w[i][-1]!=w[i+1][0]: s = False break ws = set(w) if s and len(ws)==len(w): print("Yes") else: print("No")
p02696
s273994394
Accepted
A,B,N=map(int,input().split()) if N>=B: N=B-1 print(int(A*N/B)-(A*int(N/B))) exit() else: print(int(A*N/B)) exit()
p02838
s875468766
Wrong Answer
import sys from collections import deque import itertools def input(): return sys.stdin.readline().rstrip() def main(): N = int(input()) A =list(map(int,input().split())) if __name__ == "__main__": main()
p03730
s954127411
Wrong Answer
a, b, c = map(int, input().split()) if a % b == 0 and c != 0: print('No') else: print('Yes')
p02578
s627935865
Accepted
N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(N): if i == 0: tmp = A[i] else: if tmp > A[i]: ans += (tmp - A[i]) else: tmp = A[i] print(ans)
p03220
s709469349
Accepted
N,T,A,*H=map(int,open(0).read().split());v=[] for i in H: v.append(abs(A-T+i*0.006)) print(v.index(min(v))+1)
p03761
s644777970
Accepted
N = int(input()) al = [chr(ord('a') + i) for i in range(26)] out = dict(zip(al,[100]*26)) # print(out) for i in range(N): S = list(input()) dam = dict(zip(al,[0]*26)) for T in S: dam[T] += 1 #辞書Tに+1 for key in out.keys(): out[key] = min(out[key], dam[key]) # print(dam) outS = "" for key in out.keys(): # print(key) outS += key*out[key] print(outS)
p02859
s965177031
Accepted
r = int(input()) print(r*r)
p02795
s972490946
Accepted
h=int(input()) w=int(input()) n=int(input()) mx=max(h,w) if n%mx==0: print(n//mx) else: print(n//mx+1)
p02780
s587753702
Wrong Answer
n, k = map(int, input().split()) List = list(map(int, input().split())) score = [] max = 0 index = 0 res = 0 a = n - k + 1 b = k - 1 for i in range(a): for j in range(b): score.append(List[i+j]) pre = sum(score) if max < pre: max = pre index = i pre = 0 else: pre = 0 score.clear() for i in range(index, index+k): res += 1 + 0.5 * (List[i]-1) print(res)
p02791
s603779676
Accepted
N = int(input()) P = list(map(int,input().split())) mi = P[0] cnt = 1 for i in range(1,N): if P[i] <= mi: mi = P[i] cnt += 1 print(cnt)
p03103
s608232405
Wrong Answer
N, M = map(int,input().split()) A = [] for i in range(N): a,b = map(int,input().split()) A.append([a,b]) A.sort() print(A) nokori = M yen = 0 mise = 0 while nokori > 0: if A[mise][1] >= nokori: #i番目の店で何本買えるか yen += A[mise][0]*nokori break else: yen += A[mise][0]*A[mise][1] nokori -= A[mise][1] mise += 1 print(yen)
p02993
s958092422
Accepted
s = list(input()) ans = "Good" for i in range(3): if s[i] == s[i+1]: ans = "Bad" break print(ans)
p03041
s179454337
Wrong Answer
import math N,K = map(int,input().split()) print(sum([(1/N)*(0.5)**math.ceil(math.log2(math.ceil(K/i))) if i<K else 1/N for i in range(1,N+1)]))
p02727
s043566491
Wrong Answer
x, y, a, b, c = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) l = p[:x] + q[:y] + r l.sort(reverse=True) print(sum(l[:x+y]))
p03095
s679515386
Accepted
from collections import Counter def resolve(): MOD = 10 ** 9 + 7 N = int(input()) S = input() CNT = Counter(S) ans = 1 for v in CNT.values(): ans *= v + 1 ans %= MOD print(ans - 1) if __name__ == "__main__": resolve()
p03994
s691096285
Wrong Answer
S = input().strip() K = int(input()) ans = "" for i, s in enumerate(S): if i == len(S) - 1: if ord(s) + K <= ord("z"): ans += chr(ord(s) + K) else: ans += chr(ord("a") + (ord(s) + K - ord("z") - 1) % 26) break if ord("z") + 1 - ord(s) <= K: ans += "a" K -= (ord("z") + 1 - ord(s)) else: ans += s print(ans)
p02714
s120484642
Accepted
def d_rgb_triplets(): N = int(input()) S = input() total = S.count('R') * S.count('G') * S.count('B') sub = 0 for i in range(N): for j in range(i + 1, N): k = 2 * j - i # j-i = k-j を満たす k if j < k < N and S[i] != S[j] and S[i] != S[k] and S[j] != S[k]: sub += 1 return total - sub print(d_rgb_triplets())
p02555
s094993708
Accepted
import sys N = int(input()) mod = pow(10, 9)+7 if N < 3: print(0) sys.exit() ans = 1 for j in range(2, N//3+1): r = j-1 n = N-j*3+r bunshi = 1 bunbo = 1 for i in range(r): bunshi = (bunshi*(n-i)) % mod bunbo = (bunbo*(i+1)) % mod ans = (ans+(bunshi*pow(bunbo, -1, mod))) % mod print(ans)
p02688
s020476437
Accepted
ninzu, syurui = map(int, input().split()) shoji = [ 0 for _ in range(ninzu) ] for _ in range(syurui): num = int(input()) if num == 1: man = int(input()) shoji[man-1] += 1 else: mans = map(int, input().split()) for man in mans: shoji[man-1] += 1 ans = 0 for sman in shoji: if sman == 0: ans += 1 print(ans)
p03862
s480627304
Accepted
N, x = map(int,input().split()) A = list(map(int, input().split())) ans = 0 for i in range(0, N-1): if A[i] + A[i+1] > x: t = A[i+1] + A[i] - x if A[i+1] < t: A[i+1] = 0 else: A[i+1] -= t ans += t print(ans)
p03219
s007536267
Wrong Answer
x,y=map(int,input().split()) print((x+y)//2)
p02608
s173841372
Accepted
N = int(input()) C = {i:0 for i in range(1,N+1)} for x in range(1,142): for y in range(1,142): for z in range(1,142): a = (x+y)**2+(y+z)**2+(z+x)**2 if a%2==0 and a//2<=N: C[a//2] += 1 for i in range(1,N+1): print(C[i])
p03146
s475744562
Accepted
s=int(input()) C=set() C.add(s) Cl=[s] m=0 def f(x): if x%2==0: return int(x/2) else: return 3*x+1 while(1): m+=1 x=f(Cl[m-1]) if x in C: break Cl+=[x] C.add(x) print(m+1)
p02766
s424560635
Accepted
N,K = map(int, input().split()) count = 0 while N>0: N = N//K count = count + 1 print(count)
p02571
s672244398
Wrong Answer
s = input() t = input() slen = len(s) tlen = len(t) ans = 10000 temp = 0 for start in range(0,slen-tlen): for i in range(0,tlen): if t[i] != s[start+i]: temp += 1 ans = min(ans,temp) temp = 0 print(ans)
p03221
s076561681
Accepted
n, m = map(int, input().split()) cnt = [[] for _ in range(n + 1)] for i in range(m): p, y = map(int, input().split()) cnt[p].append((y, i)) buf = [None] * m for p, l in enumerate(cnt): if not l: continue l.sort() for j, (y, i) in enumerate(l): buf[i] = '{:06d}{:06d}'.format(p, j + 1) print('\n'.join(buf))
p02676
s290631952
Wrong Answer
k,s=open(0) k=int(k) print(s[:k]+'...'*(len(s)>k))
p03854
s972702772
Wrong Answer
# C - 白昼夢 S = input() S2 = S W_L = ["dream","dreamer","erase","eraser"] while True: for w in W_L: if S2.endswith(w): S2 = S2[:-(len(w))] if len(S2)<=7 or not S2.endswith(w): break if S2 ==''or S2 in W_L: print('YES') else: print('NO')
p03131
s096134804
Accepted
K,A,B = map(int,input().split()) if K < A+1 or B <= A+2: print(K+1) exit(0) K -= A - 1 ans = A p,q = divmod(K,2) ans += (B-A) * p + q print(ans)
p03860
s859743965
Wrong Answer
x="AtCoder"+input().capitalize()+"Contest" print(x) print("A"+x[8]+"C")
p03061
s420305188
Wrong Answer
n = input() x = input().split() for i in range(0 , int(n)): x[i] = int(x[i]) min = min(x) for i in range(min, 1 , -1): tmp = 0 for ii in x: if int(ii) % i == 0: tmp += 1 if tmp >= int(n) - 1: print(i) break
p03345
s432928767
Wrong Answer
import math A, B, C, K = map(int, input().split()) end = int(math.log2(10**18)) for _ in range(end+1): A, B, C = B+C, A+C, A+B if abs(A-B) > 10**18: print("Unfair") exit() print(A-B)
p03282
s804474408
Accepted
S = input() K = int(input()) ans = '1' k = 0 for s in S: if s == '1': k += 1 if k >= K: ans = '1' break else: ans = s break print(ans)
p02879
s141437468
Accepted
import sys row = sys.stdin.readline def read_ints(row): return list(map(int, row().split())) A,B = read_ints(row) if A > 9 or B > 9: print(-1) else: print(A*B)
p03448
s341427372
Wrong Answer
# -*- coding: utf-8 -*- A = int(input()) B = int(input()) C = int(input()) X = int(input()) count = 0 for i in range(1, A + 1): for j in range(1, B + 1): for k in range(1, C + 1): if 500 * i + 100 * j + 50 * k == X: count += 1 print(count)
p02880
s341518031
Wrong Answer
n = int(input()) for i in range(1,10): for j in range(1,10): if(i*j==n): print("YES") exit() print("NO")
p02583
s779283678
Wrong Answer
a=int(input()) b=list(map(int,input().split())) c=0 for i in range(a): for k in range(a): for h in range(a): if b[i]+b[k]>=b[h]: c=c+1 print(c)
p03105
s413576804
Accepted
def favorite_sound(a, b, c): return c if b//a > c else b//a def main(): a, b, c = map(int, input().split()) print(favorite_sound(a, b, c)) if __name__ == '__main__': main()
p02696
s413772426
Accepted
a, b, n = map(int, input().split()) ref = min(b - 1, n) ans = a*ref//b - a*(ref//b) print(ans)
p03042
s974792750
Accepted
s = input() s_a = int(s[:2]) s_b = int(s[2:]) if s_a >= 1 and s_a <=12 and s_b >= 1 and s_b <=12: ans = "AMBIGUOUS" elif (s_a > 12 or s_a == 0) and s_b >= 1 and s_b <=12: ans = "YYMM" elif (s_b > 12 or s_b == 0) and s_a >= 1 and s_a <=12: ans = "MMYY" else: ans = "NA" print(ans)
p02705
s134095930
Accepted
import math r = int(input()) ans = math.pi * 2 * r print(ans)
p03262
s561748770
Wrong Answer
N,X=map(int,input().strip().split()) x=list(map(int,input().strip().split())) x.sort() d=[] for n in range(1,N): d.append(x[n]-x[n-1]) def gcd(a,b): x=max(a,b) y=min(a,b) tmp=x%y if tmp==0: return y else: return gcd(y,tmp) if len(d)==0: print(abs(x[0]-X)) else: D=d[0] for i in range(1,len(d)): D=gcd(D,d[i]) print(D)
p02772
s731929187
Accepted
N = int(input()) A = list(map(int, input().split())) n = 0 for i in range(N): if A[i]%2 == 0: if A[i]%3 != 0 and A[i]%5 != 0: n = 1 if n == 0: print('APPROVED') elif n == 1: print('DENIED')
p03625
s983489411
Accepted
def find_max_rectangle(pair): """ Args: pair (list): reversely sorted Returns: area (int) """ if len(pair) >= 2: M = pair[0] second_max = pair[1] return M * second_max else: return 0 n = int(input()) L = list(map(int, input().split())) L.sort() pair = [] prev = None while L: popped = L.pop() if prev == popped: pair.append(prev) prev = None else: prev = popped print(find_max_rectangle(pair))
p03107
s028467394
Accepted
s = input() print( 2*min( s.count('1'), s.count('0')))
p03386
s100196752
Accepted
a,b,k=map(int,input().split()) lst=[] for i in range(a,min(a+k, b)): lst.append(i) print(i) for j in range(max(a, b-k+1),b+1): if j not in lst: print(j)
p03680
s636959899
Wrong Answer
n=int(input()) a=[] for i in range(n): a.append(int(input())) total=1 i=a[0]-1 while True: if a[i]==2: print(total+1) break elif total>n: print("-1") break else: i=a[i]-1 total+=1
p03997
s137200464
Accepted
a = int(input()) b = int(input()) h = int(input()) print( int((a+b)*h/2) )
p02631
s676797944
Wrong Answer
N = int(input()) a = list(map(int, input().split())) result = [0] for i in range(N - 1): aij = a[i] ^ a[i + 1] result.append(result[i] ^ aij) print(" ".join(map(str, result)))
p02724
s267048706
Accepted
x = int(input()) happy = 0 if x // 500 > 0: happy += 1000 * (x // 500) x %= 500 if x // 5 > 0: happy += 5 * (x // 5) print(happy)