problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03617
s963963898
Accepted
#A - Ice Tea Store Q,H,S,D = map(int,input().split()) N = int(input()) Q1,H1 = 4*Q,2*H S = min(Q1,H1,S) if 2*S>D: cnt_2 = N//2 cnt_1 = N%2 pay = D*cnt_2 + S*cnt_1 else: pay = N * S print(pay)
p03861
s424575819
Accepted
def main(): a, b, x = map(int, input().split()) if a == 0: left = 0 else: left = (a-1)//x + 1 if b == 0: right = 1 else: right = b//x + 1 print(right - left) if __name__ == "__main__": main()
p02683
s231753531
Wrong Answer
n, m, x = map(int, input().split()) li = [list(map(int, input().split())) for _ in range(n)] X = [x for i in range(m)] ans = 10**10 f = 0 for b in range(2**n): skils = [0]*m tmp = 0 for i in range(n): if b&(1<<i): for j in range(m): skils[j] += li[i][j+1] tmp += li[i][0] if skils>=X: ans = min(ans, tmp) f+=1 if f==0: print(-1) exit() print(ans)
p03485
s639668314
Accepted
import math def main(): a, b = map(int, input().split()) print(math.ceil((a + b)/2)) main()
p03607
s042415735
Accepted
n = int(input()) a = [int(input()) for i in range(n)] d = {} for i in range(n): if a[i] not in d: d[a[i]] = 0 else: del d[a[i]] print(len(d))
p03309
s795113441
Wrong Answer
import numpy as np n = int(input()) hikumono = n * (n-1)//2 A = np.array(list(map(int, input().split()))) B = np.array([i+1 for i in range(n)]) C=A-B heikin1 = C.sum()//n heikin2 = heikin1 + 1 ans1 = abs(C-heikin1).sum() ans2 = abs(C-heikin2).sum() print(min(ans1, ans2))
p03860
s965205095
Wrong Answer
s= str(input()) print('A' + s[0] +'C')
p02553
s933372522
Accepted
a, b, c, d = map(int, input().split()) m = -999999999999999999 ac = a * c if ac >= m: m = ac ad = a * d if ad >= m: m = ad bc = b * c if bc >= m: m = bc bd = b * d if bd >= m: m = bd print(m)
p03067
s469430376
Accepted
a,b,c = map(int,input().split()) if a < c < b or b < c < a: print("Yes") else: print("No")
p03679
s365530285
Accepted
with open(0) as f: X, A, B = map(int, f.read().split()) if B-A <= 0: ans = 'delicious' if 0 < B-A <= X: ans = 'safe' if B-A > X: ans = 'dangerous' print(ans)
p03624
s649524009
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math def main(): S = list(input()) for abc in 'abcdefghijklmnopqrstuvwxyz': if not abc in set(S): print(abc) exit(0) print('None') if __name__ == "__main__": main()
p03284
s939572529
Accepted
N,K = map(int,input().split()) print(0 if N%K == 0 else 1)
p03625
s700543613
Accepted
import collections N = int(input()) A_s = list(map(int, input().split())) CNT_A = collections.Counter(A_s).most_common() sorted_A = sorted(CNT_A, reverse=True) verticle = [] ans = 0 for i in range(len(CNT_A)): key = sorted_A[i][0] value = sorted_A[i][1] if (value > 1): verticle.append(key) if (len(verticle) == 1 and value > 3): ans = key * key break elif (len(verticle) >= 2): ans = verticle[0] * verticle[1] break print(ans)
p02789
s966215309
Accepted
a = [] a = list(map(int, input().split())) m = a.pop() n = a.pop() if m == n: print("Yes") else: print("No")
p02922
s133701067
Accepted
A, B = map(int, input().split()) for i in range(0, 21): if i*A - (i-1) >= B: print(i) break
p02923
s380097633
Accepted
N = int(input()) H = list(map(int,input().split())) ans = 0 maxi = 0 for i in range(N-1): if H[i] >= H[i+1]: ans += 1 else: ans = 0 maxi = max(ans, maxi) print(maxi)
p02621
s396500326
Wrong Answer
a = 2 ans = int(a + a ** 2 + a ** 3) print(ans)
p03387
s288434356
Accepted
n = list(map(int, input().split())) n.sort() cnt = 0 if (n[1]-n[0])%2 != 0: if (n[0]%2==0 and n[2]%2==0) or (n[0]%2!=0 and n[2]%2!=0): cnt += 1 n[0] += 1 n[2] += 1 elif (n[1]%2==0 and n[2]%2==0) or (n[1]%2!=0 and n[2]%2!=0): cnt += 1 n[1] += 1 n[2] += 1 n.sort() if (n[1]-n[0])%2 ==0: cnt += (n[1]-n[0])//2 n[0] = n[1] print(cnt+n[2]-n[1])
p02675
s461603076
Accepted
from copy import copy, deepcopy from collections import Counter from math import sqrt, floor, factorial from itertools import permutations, combinations, combinations_with_replacement from operator import mul from functools import reduce import bisect MOD = 10**9 + 7 INF = float('inf') N = int(input()) A = {2, 4, 5, 7, 9} if N % 10 in A: print("hon") elif N % 10 == 3: print("bon") else: print("pon")
p02554
s734763180
Accepted
INF = 10 ** 9 + 7 N = int(input()) a = 10**N b = 9**N c = 8**N ans = a -(b + b - c) ans = ans%INF print(ans)
p02982
s386075605
Accepted
import itertools N,D=map(int,input().split()) zahyo=[] def is_integer_num(n): if isinstance(n, int): return True if isinstance(n, float): return n.is_integer() return False for _ in range(N): x=list(map(int,input().split())) zahyo.append(x) cnt=0 for y in itertools.combinations(zahyo,2): kyori=[(i-j)**2 for i,j in zip(y[0],y[1])] soukyori=(sum(kyori))**(1/2) if is_integer_num(soukyori): cnt+=1 print(cnt)
p03338
s845500633
Accepted
n=int(input()) s=input() ans=0 for i in range(n): s1=s[:i] s2=s[i:] ans=max(ans,len(set(s1)&set(s2))) print(ans)
p03387
s227619059
Accepted
A, B, C = map(int, input().split()) A, B, C = sorted([A, B, C]) count = 0 count += C - B q, r = divmod(C - (A + (C - B)), 2) if r == 0: count += q else: count += q + 2 print(count)
p02995
s032856332
Accepted
from math import gcd def lcm(x, y): return (x * y)//gcd(x, y) a,b,c,d = map(int,input().split()) cd = lcm(c,d) ab = b-a+1 print(ab-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//cd-(a-1)//cd))
p03077
s817459710
Accepted
import math N = int(input()) A = [int(input()) for _ in range(5)] print(4+math.ceil(N/min(A)))
p03095
s922215238
Wrong Answer
import math import collections import fractions import itertools import functools import operator import bisect def lowmod(a, b, mod): a -= b if a >= mod: a -= mod return a def solve(): n = int(input()) s = input() c = collections.Counter(s) mod = 10*9+7 ans = 1 for i in c: ans *= (c[i]+1) ans %= mod ans = (ans-1+mod) % mod print(ans) return 0 if __name__ == "__main__": solve()
p02792
s846518526
Wrong Answer
import itertools N = int(input()) num_list = list(map(str, range(1, N))) combi_list = [i for i in zip(num_list,num_list)] combi_list_2 = [i for i in itertools.permutations(num_list,2)] ab = 0 for i in combi_list: if (i[0][-1] == i[1][0]) & (i[0][0] == i[1][-1]): ab += 1 for i in combi_list_2: if (i[0][-1] == i[1][0]) & (i[0][0] == i[1][-1]): ab += 1 print(ab)
p02963
s520743006
Wrong Answer
import numpy as np def solve(s): h = int(np.sqrt(s)) if h**2 < s: h += 1 d = h**2 - s if d == 0: x, y = 0, 0 else: x, y = 1, d return " ".join(map(str, [0,0,x,d,d,y])) s = int(input()) print(solve(s))
p02553
s844990479
Wrong Answer
a,b,c,d = map(int,input().split()) print(max(a*c,b*d,a*d))
p03545
s005601879
Accepted
abcd = input() int_abcd = list(map(int, abcd)) for i in range(1 << 3): op = ['-'] * 3 + ['=7'] sum_abcd = int_abcd[0] for j in range(3): if (i >> j) & 1: op[2 - j] = '+' sum_abcd += (-1)**(((i >> j) & 1) + 1) * int_abcd[3 - j] if sum_abcd == 7: break for num, pm in zip(abcd, op): print(num, pm, sep='', end='')
p03951
s471579036
Wrong Answer
import sys N = int(input()) s = list(input()) t = list(input()) if s == t: print(N) sys.exit() s.reverse() c = 0 for i in range(N): if t[i] == s[i]: c += 1 else: break print(2*N-c)
p03711
s058548852
Wrong Answer
x,y=map(int,input().split()) print("Yes" if (x!=2 and y!=2) and ((x%2==0 and y%2==0) or (x%2!=0 and y%2!=0)) else "No")
p02607
s357810688
Accepted
n=int(input()) a_list=[int(i) for i in input().split()] count=0 for i in range(n): if (i+1)%2!=0 and a_list[i]%2!=0: count+=1 print(count)
p03345
s912188341
Wrong Answer
a,b,c,k = map(int,input().split()) count = 0 while count == k: a1 = a b1 = b c1 = c a = b1 + c1 b = a1 + c1 c = a1 + b1 count += 1 if abs(a-b) >= 10**8: print('Unfair') else: print(a-b)
p02951
s990181104
Accepted
a, b, c = map(int, input().split()) print(max(c - (a-b), 0))
p03086
s902328706
Accepted
S = list(input()) c = 0 ans = 0 for i in S: if i=='A' or i=='C' or i=='G' or i=='T': c += 1 if ans < c: ans = c else: c = 0 print(ans)
p02621
s360926686
Wrong Answer
a = int(input("Enter a number: \n")) print(a + (a**2) + (a**3))
p03379
s600308065
Accepted
n=int(input()) x=[int(i) for i in input().split()] xx=sorted(x) a=xx[n//2-1] b=xx[n//2] for i in range(n): if x[i]<=a: print(b) else: print(a)
p03281
s054346001
Accepted
n = int(input()) lis = [x for x in range(1, n+1, 2)] ans = 0 for a in lis: lis2 = [] for b in range(1, a+1): if a % b == 0: lis2.append(b) if len(lis2) == 8: ans += 1 print(ans)
p03252
s602267440
Accepted
from collections import Counter s, t = input(), input() dict = {} for si, ti in zip(s, t): if ti not in dict: dict[ti] = si elif dict[ti] != si: print('No') break else: cnt = Counter(dict.values()) bool = all(cnt[i] <= 1 for i in cnt) print('Yes' if bool else 'No')
p02765
s887905669
Accepted
# -*- coding: utf-8 -*- import sys input = sys.stdin.readline def main(): n, r = map(int, input().split()) if n <= 10: # r = x - (100 * (10 - n)) print(r + 100 * (10 - n)) else: print(r) if __name__ == '__main__': main()
p02719
s823240828
Accepted
N, K = map(int, input().split()) n = N//K m1 = N-K*n m2 = abs(N-K*(n+1)) ans = min(m1, m2) print(ans)
p03001
s043701371
Wrong Answer
w,h,x,y=map(int,input().split()) ma=w*h/2 H=h//2 W=w//2 if H==x and W==y: boo=1 else: boo=0 print(ma,boo)
p02723
s097179610
Accepted
S=input() if S[2]==S[3] and S[4]==S[5]: print('Yes') else: print('No')
p03274
s624272998
Accepted
def main(): # editorial読んだ. N, K = map(int, input().split(" ")) coordinates = list(map(int, input().split(" "))) result = 10 ** 9 + 7 for i in range(N - K + 1): result = min(result, abs(coordinates[i + K - 1] - coordinates[i]) + abs(coordinates[i]), abs(coordinates[i + K - 1] - coordinates[i]) + abs(coordinates[i + K - 1])) print(result) if __name__ == '__main__': main()
p03011
s738932882
Accepted
import itertools import math import fractions import functools import copy p,q,r = map(int, input().split()) print(p+q+r-max(p,q,r))
p02603
s378487341
Accepted
n = int(input()) A = list(map(int,input().split())) flag = 0 ans = 1000 cnt = 0 for i in range(n-1): if flag == 0 and A[i] < A[i+1]: cnt += ans//A[i] ans %= A[i] flag = 1 elif flag == 1 and A[i] > A[i+1]: ans += cnt*A[i] cnt = 0 flag = 0 print(ans + cnt*A[n-1])
p02911
s660911748
Wrong Answer
import sys input = sys.stdin.readline n, k, q = [int(w) for w in input().split()] score = [0] * n for i in range(q): a = int(input()) score[a - 1] += 1 for s in score: cond = k - q + a > 0 print("Yes" if cond else "No")
p03761
s846159948
Accepted
from collections import Counter n = int(input()) s = Counter(input()) for _ in range(n - 1): s &= Counter(input()) print(''.join(sorted(s.elements())))
p03821
s718838291
Accepted
N = int(input()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A += [a] B += [b] ans = 0 for i in range(N-1, -1, -1): if (A[i] + ans) % B[i] == 0: continue ans += (B[i] - (A[i] + ans) % B[i]) print(ans)
p03711
s846709095
Accepted
x, y = map(int, input().split()) group = [0]*13 group[2] = 1 # 1グループ for i in (4,6,9,11): # 2グループ group[i] = 2 print("Yes" if group[x] == group[y] else "No")
p03773
s253956521
Accepted
a,b = map(int, input().split()) print((a+b)%24)
p03317
s787991202
Accepted
import math n,k=map(int,input().split()) a=list(map(int,input().split())) x=a.index(1) print(math.ceil((n-1)/(k-1)))
p02582
s575330506
Wrong Answer
elem = input() single = elem.count("R") double = elem.count("RR") triple = elem.count("RRR") if triple == 1: print(3) elif double == 1: print(2) else: if single == 1: print(1) else: print(0)
p02814
s734247792
Wrong Answer
#!/usr/bin/env python3 from fractions import gcd n, m = map(int, input().split()) a = list(map(lambda x: int(x) // 2, input().split())) lcm = 1 for x in a: lcm = lcm // gcd(lcm, x) * x if lcm > m: print(0) exit() m //= 2 ans = (m + lcm - 1) // lcm print(ans)
p02718
s264212352
Wrong Answer
n,m = map(int,input().split()) A = list(map(int,input().split())) pop = sum(A) / (m*4) i = 0 p = A[i] k = 0 for p in A : if p >= pop : k += 1 if p < pop : break if k >= m : print('Yes') else : print('No')
p03435
s062537844
Accepted
a=list(map(int,open(0).read().split())) print('Yes' if a[0]-a[1]==a[3]-a[4]==a[6]-a[7] and a[1]-a[2]==a[4]-a[5]==a[7]-a[8] and a[0]-a[3]==a[1]-a[4]==a[2]-a[5] and a[3]-a[6]==a[4]-a[7]==a[5]-a[8] else 'No')
p02677
s302782126
Wrong Answer
import math a,b,h,m = map(int,input().split()) hangle = float((h/12)*360) hangle += (m/60)*30 mangle = float((m/60)*360) if hangle > 180: hangle = hangle-180 if mangle > 180: mangle = mangle-180 angle = abs(hangle-mangle) rad = math.radians(angle) ans = float(math.sqrt(a*a + b*b - float(2*a*b*math.cos(rad)))) print(ans)
p03761
s983171878
Accepted
n = int(input()) S = [str(input()) for _ in range(n)] from collections import defaultdict dic = defaultdict(int) for s in list(S[0]): dic[s] += 1 for s in S[1:]: tmp = defaultdict(int) for i in list(s): tmp[i] += 1 for j in dic.keys(): dic[j] = min(dic[j], tmp[j]) ans = [] for d in dic.keys(): num = dic[d] ans += [d]*num ans.sort() print(''.join(ans))
p03474
s240004339
Accepted
A, B = map(int, input().split()) S = input() ans = "Yes" if len(S) != A+B+1: ans = "No" for i, s in enumerate(S): if i == A: if s != '-': ans = "No" else: if not '0' <= s <= '9': ans = "No" print(ans)
p03408
s300336297
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): from collections import Counter N = int(readline()) blue = Counter() red = Counter() for _ in range(N): s = input() blue[s] += 1 M = int(readline()) for _ in range(M): s = input() red[s] += 1 ans = 0 for key in blue.keys(): score = blue[key] - red[key] ans = max(ans, score) print(ans) if __name__ == '__main__': main()
p02577
s105408561
Accepted
n=input() n=str(n) Sum=0 for i in range(len(n)): Sum=Sum+int(n[i]) if Sum%9==0: print("Yes") else: print("No")
p03338
s282474660
Wrong Answer
N=int(input()) S=input() ans=0 for i in range(N-1): A=set(S[:i+1]) B=S[i:] cnt=0 for j in A: if (j in B): cnt+=1 ans=max(ans,cnt) print(ans)
p03419
s014502516
Wrong Answer
import math import collections import fractions import itertools def solve(): n, m = map(int, input().split()) if n == 1 and m == 1: print(1) elif n == 1 and m != 1: print(m-2) else: print((n-2)*(m-2)) return 0 if __name__ == "__main__": solve()
p02608
s465724178
Wrong Answer
N = int(input()) list=[0]*N for x in range(1,N+1): if x * x+2*x+3 > N: break for y in range(1,N+1): if x * x + y * y + x * y+x+y+1 > N: break for z in range(1, N + 1): val=x * x + y * y + z * z + x * y + y * z + z * x if val >= N: break list[val - 1] += 1 for i in range(N): print("{}".format(list[i]))
p03250
s138515216
Accepted
l = [0, 0, 0] l[0], l[1], l[2] = map(int, input().split()) l.sort() print(l[2]*10+l[1]+l[0])
p02730
s230632185
Wrong Answer
S = list(input()) N = len(S) def cal(a,b): for i in range((b-a+1)//2): if S[a+i] != S[b-i]: return 1 break else: return 0 if cal(0,N-3//2) == 0 and cal(N+1//2,N-1) == 0 and cal(0,N-1) == 0: print("Yes") else: print("No")
p02819
s875580254
Wrong Answer
# 21 import sympyが最速だが、Atcoderには無い import math x = int(input()) #エラトステネスの篩 n = [i for i in range(2,int(math.sqrt(x))+1)] for i in n: for j in n: if j % i == 0 and j/i !=1: n.remove(j) while x > 0: x +=1 for i in n: if x % i == 0: break else: print(x) break
p03017
s142411174
Accepted
n, a, b, c, d = map(int, input().split()) s = input() ans = 'Yes' if '##' in s[a-1:max(c,d)]: ans = 'No' else: if c > d and '...' not in s[b-2:d+1]: ans = 'No' print(ans)
p03778
s521611792
Accepted
W, a, b = map(int, input().split()) ans = max(0, b-(a+W), a-(b+W)) print(ans)
p03345
s729023169
Accepted
from sys import stdin import math a,b,c,k = [int(x) for x in stdin.readline().strip().split()] print(((-1)**k) * (a - b))
p02952
s251792498
Accepted
n = int(input()) cnt = 0 for i in (range(1, n + 1)): if len(str(i)) % 2 == 1: cnt += 1 print(cnt)
p03136
s353290965
Accepted
N = int(input()) edge = list(map(int,input().split())) if max(edge) < sum(edge)-max(edge): print("Yes") else: print("No")
p02946
s565922064
Accepted
k,x = map(int,input().split()) c = [] for i in range(2*k-1): c.append(x-(k-1-i)) print(" ".join(map(str,c)))
p04031
s714928916
Accepted
n=int(input()) A=list(map(int,input().split())) ans=float("INF") for i in range(-100,101): ans_=sum((a-i)**2 for a in A) ans=min(ans,ans_) print(ans)
p03075
s411189619
Accepted
import itertools a = [] for i in range(5): a.append(int(input())) k = int(input()) flag = True for v in itertools.combinations(a, 2): if v[1] - v[0] > k: flag = False if flag: print("Yay!") else: print(":(")
p02658
s664918612
Wrong Answer
n = int(input()) ls= list(map(int, input().split())) ans = 1 for i in ls: ans=i*ans if(ans<10**18): ans=-1 break print(ans)
p03264
s639212894
Accepted
n = int(input()) if n%2 == 0: print((n//2)**2) elif n > n//2*2: print(n//2*(n//2+1)) else: print(n//2*(n//2-1))
p03854
s952486759
Wrong Answer
S = input() while True : if S[0:5] == "dream": S = S.replace("dream","") elif S[0:6] == "eraser": S = S.replace("eraser","") elif S[0:7] == "dreamer": S = S.replace("dreamer","") elif S[0:5] == "erase": S = S.replace("erase","") elif len(S) == 0: print("YES") break else: print("NO") break
p02819
s348641131
Wrong Answer
n = int(input()) m = n while True: for i in range(2,int(m**0.5)+1): if m %i == 0: break elif i > int(m**0.5)-1: print(m) exit() m += 1
p02622
s515684132
Wrong Answer
S = list(input()) T = list(input()) print(S, T) c = 0 for i in range(len(S)): if S[i] != T[i]: c += 1 print(c)
p02570
s501520557
Accepted
d,t,s=map(int, input().split()) if d/s<=t: print("Yes") else: print("No")
p02713
s566429633
Wrong Answer
import math sum=0 num=int(input()) for a in range(num): for b in range(num): for c in range(num): d=math.gcd(a,b) e=math.gcd(c,d) sum=sum+e print(sum)
p02993
s909896923
Accepted
s = str(input()) if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]: print('Bad') else: print('Good')
p03011
s440112122
Wrong Answer
P,Q,R=map(int,input().split()) count=300 for i in [P,Q,R]: for j in [P,Q,R]: if i==j: count=count else: if i+j<=count: count=i+j print(count)
p04019
s854477775
Wrong Answer
from collections import Counter s = input() c = Counter(s) if len(c) == 4: print("Yes") elif len(c) % 2 == 1: print("No") else: li = list(c.keys()) if ("S" in li and "N" in li) or ("W" in li and "E" in li): print("Yes") else: print("NO")
p02597
s223859715
Accepted
def resolve(): n = int(input()) c = input() ans = 0 l = -1 r = n while True: l += 1 r -= 1 while l < n and c[l] == "R": l += 1 while r >= 0 and c[r] == "W": r -= 1 if l > r: break ans += 1 print(ans) if __name__ == '__main__': resolve()
p02933
s484085438
Accepted
a = int(input()) s = input() if a >= 3200: print(s) else: print('red')
p02664
s205900483
Wrong Answer
S = input() ns = "" for i in S: if i == '?': ns += 'D' else: ns += 'P' print(ns)
p02690
s006004592
Wrong Answer
x = int(input()) y = int(pow(x, 1/5)) A = [i**5 for i in range(y+1)] B = [i**5 for i in range(y+1)] for i in range(len(A)): for j in range(len(B)): if ( A[i] + B[j] ) == x: exit(print(i, j)) elif ( A[i] - B[j] ) == x: exit(print(i, -j))
p03067
s123719203
Wrong Answer
a,b,c=map(int,input().split()) if a<c<b or c<b<a: print("Yes") else: print("No")
p03126
s896374780
Accepted
n, m = map(int, input().split()) z = [0]*(m+1) for i in range(n): l= list(map(int, input().split())) for j in range(1, l[0]+1): z[l[j]] +=1 cnt = 0 for i in z: if i == n: cnt += 1 print(cnt)
p03211
s682289148
Wrong Answer
s = input() m = 1000000 for i in range(len(s)-3): x = int(s[i:i+3]) m = min(m,abs(x-753)) print(m)
p03838
s022552580
Accepted
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 def f(x,y): if y-x<0: return inf else: return y-x x,y=map(int,input().split()) mans=min(f(x,y),f(-x,y)+1,f(x,-y)+1,f(-x,-y)+2) print(mans)
p02772
s167169110
Accepted
n=int(input()) a=list(map(int,input().split())) count=0 for i in range(0,n): if a[i]%2==0: if a[i]%3==0 or a[i]%5==0: count=count+1 else: count=count+1 if count==n: print("APPROVED") else: print("DENIED")
p03360
s779488890
Accepted
a = list(map(int, input().split())) k = int(input()) b = a.index(max(a)) ans = 0 for i in range(3): if (i == b): ans += a[i] * (2 ** k) else: ans += a[i] print(ans)
p03815
s586622725
Accepted
x=int(input()) if x%11>6: ans=(x//11)*2+2 elif x%11==0: ans=(x//11)*2 else: ans=(x//11)*2+1 print(ans)
p03474
s462749594
Accepted
a, b = map(int, input().split()) s = input() ans = True for i in range(a + b + 1): if s[a] != "-": ans = False break else: if i == a: pass else: for j in range(10): if s[i] == str(j): break else: ans = False if ans: print("Yes") else: print("No")
p03030
s253263030
Accepted
n = int(input()) data = {} for i in range(n): s,p = map(str,input().split()) p = int(p) if s in data: data[s].append((p,i+1)) else: data[s] = [(p,i+1)] D = sorted(data.items()) for i in range(len(D)): P = D[i][1] P.sort() while P: print(P.pop()[1])
p02578
s922253483
Accepted
from sys import stdin input = stdin.readline n = int(input()) a = list(map(int,input().split())) ma = -1 res = 0 for i in a: res += max(ma - i,0) ma = max(ma,i) print(res)