problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02881
s069905041
Accepted
import math N = int(input()) ans = list() for i in range(int(math.sqrt(N))): i += 1 if N % i ==0: j = N//i ans.append(i + j -2) else: pass print(min(ans))
p03804
s092740614
Accepted
N,M=map(int, input().split()) A = [input() for i in range(N)] B = [input() for i in range(M)] flag=0 for i in range(N-M+1): for j in range(N-M+1): for k in range(M): if A[i+k][j:j+M]!=B[k]: break #print(i,j,k,' ',A[i+k][j:j+M],' ',B[k]) else: flag=1 print('Yes' if flag==1 else 'No')
p02900
s084983081
Accepted
import math ab = [int(i) for i in input().split()] ab = math.gcd(ab[0], ab[1]) dic = {} n = 2 while n**2 <= ab: if ab % n: n += 1 else: ab //= n dic[n] = dic.get(n,0) + 1 if 1 < ab: dic[ab] = dic.get(ab,0) + 1 print(len(dic) + 1)
p03633
s553309327
Accepted
import sys import fractions from functools import reduce # N 時計の数 n = int(input()) # Ti 各時計が1周する秒数 t = [int(input()) for i in range(n)] # 最小公倍数を求める def lcm_base(a, b): return (a * b) // fractions.gcd(a, b) def lcm(*num_list): return reduce(lcm_base, num_list, 1) print(lcm(*t))
p03862
s437767998
Accepted
def EatCandy(a, b, x): if a + b <= x: pass else: if a <= x: b = x - a else: b = 0 a = x return (a, b) def solve(): N, x = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] st = sum(A) for i in range(N - 1): ...
p03862
s209149306
Accepted
def LI(): return list(map(int,input().split())) N,x = LI() a = LI() ans = 0 for i in range(N-1): if a[i]+a[i+1]>x: if a[i]>x: ans += a[i+1] a[i+1] = 0 ans += a[i]-x else: ans += a[i+1]-(x-a[i]) a[i+1] = x-a[i] print(ans)
p03611
s757876963
Accepted
# Problem C - Together # input N = int(input()) a_nums = list(map(int, input().split())) # initialization nums = [0]*(10**5 + 1) max_count = 0 # count for a in a_nums: nums[a] += 1 # max count for i in range(10**5 + 1): if i==0 or i==10**5: continue tmp_count = nums[i-1] + nums[i] + nums[i+1] ...
p02802
s478196101
Accepted
N,M=map(int,input().split()) ac=[0]*(N+1) wa=[0]*(N+1) for i in range(M): p,s=input().split() if ac[int(p)]==1: continue if s=='AC': ac[int(p)]=1 elif s=='WA': wa[int(p)]+=1 ac_ans,wa_ans=0,0 for a,w in zip(ac,wa): if a==0: continue ac_ans+=a wa_ans+=w print...
p02615
s989310951
Accepted
n = int(input()) a = list(map(int, input().split(" "))) a = sorted(a)[::-1] if n % 2: ans = a[0] + 2 * sum(a[1:(n//2)]) + a[n//2] else: ans = a[0] + 2 * sum(a[1:(n//2)]) print(ans)
p03543
s914321224
Wrong Answer
n = input() if n[1:].count(n[0]) >= 3 or n[:2].count(n[3]) >= 3: print("Yes") exit() else: print("No")
p03319
s532511576
Accepted
import math n, k = map(int, input().split()) A = list(map(int, input().split())) A_min = min(A) N = n-len([i for i in A if i == A_min]) print(math.ceil(N/(k-1)))
p02917
s681420750
Accepted
N = int(input()) bbb = list(map(int, input().split())) aaa = [] for i in range(1, N - 1): a = min(bbb[i - 1], bbb[i]) aaa.append(a) print(sum(aaa) + bbb[0] + bbb[-1])
p03206
s194719257
Accepted
import sys import math import bisect def main(): n = int(input()) ans = [] ans.append('Christmas') for i in range(25 - n): ans.append('Eve') print(' '.join(ans)) if __name__ == "__main__": main()
p03679
s404068575
Wrong Answer
x,a,b = map(int, input().split()) if b <= a: print('delicious') elif b < a <= b+x : print('safe') else: print('dangerous')
p02793
s457272342
Accepted
def gcd(m, n): r = m % n return gcd(n, r) if r else n def lcm(m, n): return m//gcd(m, n)*n MOD = 10**9+7 n = int(input()) a = list(map(int, input().split())) l = a[0] for x in a: l = lcm(x, l) ans = 0 for x in a: ans += l*pow(x, MOD-2, MOD)%MOD print(ans%MOD)
p02748
s798716370
Accepted
A, B, M = [int(x) for x in input().split()] A_price_list = [int(x) for x in input().split()] B_price_list = [int(x) for x in input().split()] discount_list = [] for i in range(M): x, y, c = [int(x) for x in input().split()] discount_list.append([x-1, y-1, c]) amount = min(A_price_list) + min(B_price_list) ...
p02847
s470916997
Accepted
N = input() if N == "SAT": print("1") elif N == "SUN": print("7") elif N == "MON": print("6") elif N == "TUE": print("5") elif N == "WED": print("4") elif N == "THU": print("3") else: print("2")
p02553
s129848580
Accepted
dd=input("").split(" ") a=int(dd[0]) b=int(dd[1]) c=int(dd[2]) d=int(dd[3]) s=max(a*c,b*c,a*d,b*d) print(s)
p03986
s596043083
Wrong Answer
X = input() N = len(X) cnt_h = 0 for i in range(N): if X[i] == "S": cnt_h = i break cnt_f = N for i in range(N - 1, cnt_h, -1): if X[i] == "T": cnt_f = i + 1 break ans = 0 for i in range(cnt_h, cnt_f): if X[i] == "S": ans += 1 else: ans -= 1 print(abs(ans)...
p03437
s232920999
Accepted
def resolve(): X, Y = map(int, input().split()) print("-1" if X%Y == 0 else X*(Y-1)) resolve()
p03548
s593377912
Accepted
def main(): import sys #input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations #from itertools import accumulate, product, permutations from math import floor, ceil #mo...
p03210
s850846502
Wrong Answer
x=input() if x=='7' and x=='5' and x=='3': print('YES') else: print('NO')
p02912
s793065505
Wrong Answer
import heapq n, m = map(int, input().split()) a = list(map(int, input().split())) ans = sum(a[min(n, m):]) a = a[:min(n, m)] if len(a) == 1 and n == 1: print(a[0]//2**m) elif len(a) == 1: print(a[0]//2**m+ans) else: a = [x*(-1) for x in a] heapq.heapify(a) for i in range(m): c = (heapq.hea...
p02958
s767936373
Wrong Answer
N=int(input()) P=list(map(int,input().split())) count=0 if P[0]!=1: count=count+1 elif P[N-1]!=N: count=count+1 for i in range(N-1): if P[i]+1!=P[i+1]: count=count+1 if count<5: print('YES') else: print('NO')
p03352
s493284620
Accepted
x,l=int(input()),[0]*1001;l[1]=1 for i in range(2,int(x**0.5)+1): if l[i]==0:j=i*i while 1: if j>x:break else:l[j]=1;j*=i for i in range(x,-1,-1): if l[i]==1:print(i);break
p02647
s305258471
Wrong Answer
N, K = map(int,input().split()) A = list(map(int,input().split())) import math K = min(K, int(math.log(N))+2) for k in range(K): light = [0] * (N+1) for i in range(N): start = max(0,i-A[i]) end = min(N-1, i+A[i]) light[start] += 1 light[end+1] -= 1 for i in range(1,N): light[i] += light[i-1] ...
p02912
s339637991
Wrong Answer
N,M = map(int,input().split()) A = [i for i in map(int,input().split())] A.sort() import bisect for i in range(M): A[-1] //= 2 A.insert(bisect.bisect(A,A[-1]),A[-1]) A.pop() print(sum(A))
p02628
s712391483
Accepted
n, k = map(int, input().split()) p1 = list(map(int, input().split())) p2 = sorted(p1) p3 = sum(p2[:k]) print(p3)
p02689
s119880305
Wrong Answer
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, readline().split()) H = [0] + list(map(int, readline().split())) A = [0]*(N+1) m = map(int, read().split()) for a,b in zip(m,m): for _ in range(2): A[a] = max(A[a], H[b]) a,b = b,a...
p03680
s231530912
Accepted
N = int(input()) a = {} for i in range(N): a[i + 1] = int(input()) i = 1 cnt = 0 while True: next_i = a[i] cnt += 1 if next_i < 1: print(-1) break elif next_i == 2: print(cnt) break a[i] = 0 i = next_i
p03338
s936531383
Wrong Answer
N = int(input()) S = list(input()) print(S) ans = [] ans.append(len(set(S))) for i in range(N): if i == 0: pass elif S[i] == S[i-1]: pass else: S_f = S[:i+1] S_b = S[i+1:] F = set(S_b) B = set(S_f) ans.append(len(F&B)) print(max(ans))
p02570
s001937595
Accepted
D,T,S = map(int,input().split()) if D/S <= T: print('Yes') else: print('No')
p03469
s193424481
Wrong Answer
s = input() print("2018" + s[:4])
p02732
s541582845
Wrong Answer
N = int(input()) A = list(map(int,input().split())) num = [0 for i in range(N)] ans = [] for i in A: num[i-1]+=1 sums = 0 print(num) for i in A: num[i-1]-=1 for j in range(N): if num[j] > 1: sums += 1/2*num[j]*(num[j]-1) ans.append(int(sums)) sums = 0 num[i-1]+=1 print(ans)
p02645
s460224671
Wrong Answer
x = input() print(x[:4])
p03162
s315460869
Accepted
n = int(input()) ABC = [tuple(map(int, input().split())) for i in range(n)] A = [a for a, b, c in ABC] B = [b for a, b, c in ABC] C = [c for a, b, c in ABC] DP = [[0 for j in range(3)] for i in range(n+1)] for i in range(1, n+1): DP[i][0] = max(DP[i-1][1], DP[i-1][2])+A[i-1] DP[i][1] = max(DP[i-1][2], DP[i-1][0...
p03386
s955972708
Accepted
A, B, K = map(int, input().split()) l = range(A, B+1) a = [n for n in l[:K]] b = [n for n in l[-K:]] for n in sorted(set(a + b)): print(n)
p02848
s768710971
Accepted
N = int(input()) S = [c for c in input()] for idx, alphabet in enumerate(S): code = ord(alphabet) + N if code > ord('Z'): code = ord('A') + (code - ord('Z') - 1) S[idx] = chr(code) print(''.join(S))
p04005
s115930619
Wrong Answer
import collections import sys import numpy as np sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop MOD = 10**9+7 import itertools import math a,b,c = map(int,input().split()) max_block = a*b*c max_edge = max(a,b,c) min_edge = min(a,b,c) middle_edge = (a+b+c) - max_edge - min_edge...
p02793
s248563720
Wrong Answer
import sys input = sys.stdin.readline N=int(input()) a = list(map(int, input().split())) import fractions ans = a[0] for i in range(1, N): ans = ans * a[i] // fractions.gcd(ans, a[i]) x=0 for i in a: x+=(i//ans)%(10**9+7) print(x)
p02780
s492538059
Accepted
n,k = map(int,input().split()) p = list(map(int,input().split())) wrk = sum(p[:k]) ans = wrk for i in range(1,n-k+1): wrk-=p[i-1] wrk+=p[i+k-1] ans = max(ans,wrk) print(0.5+(0.5*ans)+(k-1)*0.5)
p02659
s874488652
Accepted
import math from decimal import Decimal A,B = input().split() C = Decimal(B) print(math.floor(int(A)*C))
p03767
s091007540
Wrong Answer
n=int(input()) a=list(map(int,input().split())) a.sort() ans=0 del a[-n:] for i in range(n): ans+=a[-1-i] print(ans)
p03377
s132839600
Accepted
A, B, X = map(int, input().split()) if X >= A and X <= A+B: print("YES") else: print("NO")
p03328
s925214027
Wrong Answer
def fu(n): if n<0: return (n*(-1)) return n a,b = map(int,input().split()) l = [fu(a-sum(range(1,i+1))) for i in range(1,1000)] print(min(l))
p02772
s135218168
Accepted
N = int(input()) A = [int(i) for i in input().split()] ans = True for a in A: if a % 2 == 0: if not(a % 3 == 0 or a % 5 == 0): ans = False break print('APPROVED' if ans else 'DENIED')
p03254
s910071423
Accepted
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() if sum(a) == x: print(N) else: i = 0 candy = 0 while candy <= x and i <= N - 1: candy += a[i] i += 1 print(i - 1)
p03106
s029666425
Accepted
import sys INPUT = lambda: sys.stdin.readline().rstrip() MAP = lambda: map(int, INPUT().split()) sys.setrecursionlimit(10 ** 9) def main(): A, B, K = MAP() cnt = 0 for i in range(A-1, -1, -1): if A%(i+1) == 0 and B%(i+1) == 0: cnt += 1 if cnt == K: print(i+1) sys...
p04011
s360983306
Accepted
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) ans = 0 for i in range(N): if i+1 <= K: ans += X else: ans += Y print(ans)
p02897
s664024403
Wrong Answer
n = int(input()) if n % 2 == 0: print(n/2) else: non_odd = (n-1)//2 odd = non_odd + 1 print(odd/n)
p02723
s226729869
Accepted
S = input() print('Yes' if S[2] == S[3] and S[4] == S[5] else 'No')
p03208
s806043614
Wrong Answer
N,K = map(int,input().split()) h = [int(input()) for _ in range(N)] h.sort() ans = 1e10 for i in range(N-K+1): tmp = h[i:i+K] print(tmp) ans = min(ans,max(tmp)-min(tmp)) print(ans)
p02664
s148223826
Accepted
print(input().replace("?","D"))
p03761
s739115244
Accepted
from collections import Counter alph = 'abcdefghijklmnopqrstuvwxyz' n = int(input()) S = [input() for _ in range(n)] cntS = [None] * n for i in range(n): cntS[i] = Counter(S[i]) ans = [] for c in alph: ans += [c * min(cntS[i][c] for i in range(n))] print(''.join(ans))
p03637
s574970624
Accepted
n=int(input()) a=list(map(int,input().split())) cnt1=0 cnt2=0 cnt4=0 for i in a: if i%2==1: cnt1+=1 elif i%4!=0: cnt2+=1 elif i%4==0: cnt4+=1 if cnt2==0: if cnt1<=cnt4+1: print('Yes') else: print('No') else: if cnt1<=cnt4: print('Yes') else: print('No')
p03371
s384517252
Accepted
def main(): A, B, C, X, Y = list(map(int, input().split(' '))) p1 = A * X + B * Y p2 = 2 * C * X + B * max([0, Y - X]) p3 = 2 * C * Y + A * max([0, X - Y]) p4 = 2 * C * max([X, Y]) print(min([p1, p2, p3, p4])) if __name__ == '__main__': main()
p02718
s618906121
Wrong Answer
n,m=map(int,input().split()) a=[int(ss) for ss in input().split()] a=sorted(a,reverse=True) r="Yes" for ii in range(m): if a[ii]<1/(4*m): r="No" break print(r)
p03387
s553006673
Accepted
import sys input = sys.stdin.readline def main(): ans = 0 A, B, C = map(int, input().split()) ma, mi = max(A,B,C), min(A,B,C) if ma*3%2 != (A+B+C)%2: ma += 1 ans = (ma*3-(A+B+C))//2 + (ma*3-(A+B+C))%2 print(ans) if __name__ == '__main__': main()
p03723
s325768218
Wrong Answer
x, y, z = map(int,input().split()) a =[x] b =[y] c =[z] if a[0] == b[0] == c[0]: print('-1') exit() for i in range(10): if a[i] % 2 == 0 and b[i] % 2 == 0 and c[i] % 2 == 0: a.append((b[i] + c[i]) // 2) b.append((a[i] + c[i]) // 2) c.append((b[i] + a[i]) // 2) else: ...
p02743
s520993813
Wrong Answer
import math a, b, c = map(int, input().split()) root_ab = int(math.sqrt(a*10**10)) + int(math.sqrt(b*10**10)) root_c = int(math.sqrt(c*10**10)) if root_ab < root_c: print('Yes') else: print('No')
p02948
s084899997
Accepted
import heapq n, m = map(int, input().split()) ab = sorted([list(map(int, input().split())) for _ in range(n)], reverse=True) c = [] ans = 0 for i in range(m): while len(ab) != 0 and ab[-1][0] <= i+1: _, b = ab.pop() heapq.heappush(c, -b) if c: ans += -heapq.heappop(c) print(ans)
p03759
s963767320
Accepted
a,b,c=map(int,input().split()) if b-a==c-b: print("YES") else: print("NO")
p03250
s496999112
Accepted
a,b,c=sorted(map(int,input().split())) print(c*10+b+a)
p02712
s680794257
Accepted
N = int(input()) ans = 0 for n in range(0, N + 1): if n % 3 == 0 or n % 5 == 0: pass else: ans += n print(ans)
p02970
s637692803
Accepted
import math N, D = map(int, input().split()) print(math.ceil(N/(2*D+1)))
p03042
s325202898
Accepted
s = input() if int(s[:2]) >= 1 and int(s[:2]) <= 12 and int(s[2:]) >= 1 and int(s[2:]) <= 12: print('AMBIGUOUS') elif int(s[:2]) >= 1 and int(s[:2]) <= 12: print('MMYY') elif int(s[2:]) >= 1 and int(s[2:]) <= 12: print('YYMM') else: print('NA')
p03289
s450132608
Accepted
S = input() check = False if S[0] == "A" and "C" in S[2:-1]: i = list(S).index("C") T = S[1:i] + S[i+1:] if T == T.lower(): check = True print("AC" if check else "WA")
p02879
s622284800
Accepted
a,b = map(int, input().split()) if(1<=a<=9 and 1<=b<=9): print(a*b) else: print(-1)
p03043
s393743971
Accepted
import math N, K = map(int, input().split()) ans = 0 for r in range(1, min(K, N+1)): x = math.ceil( math.log2(K/r)) ans += pow(0.5, x) / N # print(x, pow(0.5, x) / N) if K <= N: ans += (N - K + 1) / N print(ans)
p03338
s194466280
Accepted
n = int(input()) s = input() list_intersection = [] for i in range(1, n + 1): a = set(s[:i]) b = set(s[i:]) intersection_a_b = a.intersection(b) list_intersection.append(len(intersection_a_b)) print(max(list_intersection))
p03457
s359224319
Wrong Answer
N = int(input()) Sorted = [list(map(int, input().split())) for _ in range(N)] Sorted.insert(0, [0, 0, 0]) for i in range(N): if abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2]) > Sorted[i+1][0] - Sorted[i][0]: print("No") break elif abs(Sorted[i+1][1] - Sorted[i][1]) == 0 and abs(Sor...
p03479
s957751419
Accepted
x, y = map(int,input().split()) ans = 0 while x <= y: ans += 1 x *= 2 print(ans)
p02935
s765556154
Accepted
N=input() V=list(map(int,input().split())) V=sorted(V) for i,v in enumerate(V): if i==0: ave=v else: ave=(ave+v)/2 print(ave)
p03986
s450539097
Wrong Answer
S = input() a = S.count('S') b = S.count('T') c = 0 for s in S: if s == 'T': c += 1 else: break d = 0 for s in S[::-1]: if s == 'S': d += 1 else: break c + d + abs(a-d - (b-c))
p03711
s037489090
Accepted
g1 = [1,3,5,7,8,10,12] g2 = [4,6,9,11] g3 = [2] x,y = map(int, input().split()) print('Yes' if (x in g1 and y in g1) or (x in g2 and y in g2) or (x in g3 and y in g3) else 'No')
p03721
s830041311
Wrong Answer
from collections import defaultdict n,k = map(int, input().split()) ans = 0 al = [] d = defaultdict(int) for i in range(n): a,b = map(int, input().split()) al.append(a) d[a] = b al.sort() for i in al: if k > d[i]: k -= d[i] else: print(i) break
p03994
s900452921
Accepted
def resolve(): def decode(x): return ord(x) - 97 def encode(x): return chr(x + 97) S = list(map(decode, input())) K = int(input()) for i in range(len(S) - 1): if S[i] == 0: continue if 26 - S[i] <= K: K -= 26 - S[i] S[i] = 0 ...
p02576
s706641716
Wrong Answer
if __name__ == "__main__": n, x, t = map(int, input().split()) ans = t * (n + x - 1) / x ans = int(ans) print(ans)
p02701
s695185553
Accepted
import sys input = sys.stdin.readline N = int(input()) S = set() for _ in range(N): s = input().strip() S.add(s) print(len(S))
p03557
s996682807
Accepted
# C - Snuke Festival import bisect N = int(input()) A = list(int(x) for x in input().split()) B = list(int(x) for x in input().split()) C = list(int(x) for x in input().split()) B.sort() C.sort() BC = [] for i in range(N): BC.append((N - bisect.bisect_right(C, B[i]))) BC = BC[::-1] BC2 = [0] * (N+1) for i in r...
p03435
s566045958
Wrong Answer
C=[[*map(int,input().split())] for _ in range(3)] ans=0 for i in range(3): for j in range(3): tgt=C[i][j] found=False for ii in range(i+1): for jj in range(j+1): a=C[ii][j] b=C[i][jj] if a+b==tgt: ans+=1 ...
p02897
s580501254
Wrong Answer
n = int(input()) if n//2 == 0: t=(n//2)/n else: t=(n//2+1)/n print('{:.10f}'.format(t))
p03327
s304027855
Accepted
n = int(input()) if n < 1000: print("ABC") else: print("ABD")
p04012
s897863143
Accepted
import collections w = list(input()) wc = collections.Counter(w) num = 0 for i, x in enumerate(wc): if(wc[x]%2==0): num += 1 if(num==len(wc)): print('Yes') else: print('No')
p02629
s347988612
Accepted
N = int(input()) string = "" while N > 0: N, remainder = divmod(N - 1, 26) string = chr(97 + remainder) + string print(string)
p02601
s286920558
Wrong Answer
A, B, C = map(int, input().split()) K = int(input()) Ak = 0 for i in range(K): if A > B: B = B * 2 Ak = i else: break if K - Ak > 0: for j in range(K - Ak): if B > C: C = C * 2 else: print("No") exit() if A < B and B < C: print("Yes") else: pri...
p03696
s370681642
Wrong Answer
#!/usr/bin/env python3 from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right from itertools import accumulate def main(): N = int(input()) T = input() S = [] for s in T: if s == '(': S.append(1) else: S.append(...
p03548
s077181714
Wrong Answer
x,y,z=map(int,input().split()) print(x//(y+z))
p03076
s915637594
Accepted
s = [input() for i in range(5)] x10 = int(0) sum = int(0) a = [] for i in range(5): if int(s[i]) % 10 == 0: x10 = x10 + 1 else: a.append(int(s[i]) % 10) sum = sum + ((int(s[i]) - 1) // 10 + 1) * 10 b = [int(s) for s in a] if x10 == 5: print(sum) else: print(sum - 10 + min(b))
p03131
s651673406
Accepted
k, a, b = map(int, input().split()) bis = 1 if b - a <= 2: bis += k else: while k != 0: if bis >= a and k >= 2: bis += b - a k -= 2 else: bis += 1 k -= 1 print(bis)
p02952
s740061613
Accepted
import math N = int(input()) keta = int(math.log10(N)+1) count = 0 for i in range(1,keta+1): if i % 2 == 1: if i == 1: if keta == 1: count += N else: count += 9 elif i != keta: count += int('8'+'9'*(i-1)) + 1 else: ...
p03817
s179061846
Accepted
x = int(input()) div,mod = divmod(x,11) ans = div*2 if mod>6: ans +=2 elif mod>0: ans +=1 print(ans)
p03286
s766523697
Accepted
n=int(input()); b='' while n: b=str(n%2)+b; n=-(n//2) print(b if b else 0)
p02779
s713599589
Accepted
n = int(input()) a = list(map(int, input().split())) seta = set(a) if len(a)==len(seta): print("YES") else: print("NO")
p02814
s692806785
Accepted
from fractions import gcd from math import ceil n,m=map(int,input().split()) a=list(map(int,input().split())) c=len(bin(a[0]))-bin(a[0]).rfind("1") for i in range(1,n): if c!=len(bin(a[i]))-bin(a[i]).rfind("1"): print(0) exit() g=a[0] for i in range(n-1): g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,...
p03623
s633123030
Accepted
x, a, b = (int(x) for x in input().split()) if abs(a-x) < abs(b-x): print("A") else: print("B")
p02578
s230747538
Accepted
N = input() AL = list(map(int,input().split())) Amax = 0 FD = 0 for Ai in AL: # print('FD=%d' % FD) if Amax > Ai: # print('1') FD = FD + (Amax - Ai) elif Amax < Ai: # print('2') Amax = Ai print(FD)
p02660
s453604134
Accepted
n=int(input()) ans=0 for i in range(2,1000010): power=0 j=1 if(n%i==0): while(n%i==0): power+=1 n=(n//i) while(power>=j): power-=j j+=1 ans+=1 if(n>1): ans+=1 print(ans)
p03803
s258612952
Wrong Answer
a,b=map(int,input().split()) a=(a%13+11)%13 b=(b%13+11)%13 if a<b: print("Alice") elif a==b: print("Draw") else: print("Bob")
p02615
s986108007
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) res = 0 res += A.pop(0) count = 1 for i in range(N): for _ in range(2): if count < N - 1: res += A[i] count += 1 print(res)