problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03479
s441349031
Accepted
A, B = map(int, input().split()) a = [] a.append(A) while max(a)<B: a.append(max(a)*2) if max(a)>B: a.remove(max(a)) print(len(a))
p03076
s194967394
Accepted
tList = [] for i in range(5): tList.append(list(str(input()))) dList = [] for i in range(len(tList)): tmp = 10 - int(tList[i][-1]) if tmp == 10: dList.append(0) else: dList.append(tmp) result = 0 for i in range(len(tList)): result += int(''.join(tList[i]))+dList[i] print(result - sorted(dList,reverse = True)[0])
p03860
s440300895
Wrong Answer
A, s, C = input().split() print(A+s[0]+C)
p03672
s560784150
Accepted
s = input() n = -1 if len(s) % 2 == 0: n = -2 while len(s) > abs(n): hanbun = len(s[:n])//2 if s[:hanbun] == s[hanbun:n]: print(len(s[:n])) break n -= 2
p03592
s757603856
Accepted
# B - fLIP N, M, K = map(int, input().split()) for i in range(N + 1): for j in range(M + 1): black = M * i + N * j - i * j * 2 if black == K: print('Yes') exit() print('No')
p03106
s057489202
Accepted
A, B, K = map(int, input().split()) lista, aux, aux1 =[], max(A, B), min(A, B) for i in range(1, aux1+1): if((aux%i) == 0 and (aux1%i) == 0): lista.append(i) lista.sort(reverse=True) if(len(lista)==1): print(lista[0]) else: ans = lista[K-1] print(ans)
p03076
s156830913
Wrong Answer
a = [list(map(int, input().split())) for _ in range(5)] mod = 9 ans = 0 for i in range(5): modi = (a[i][0]%10) if modi != 0: mod = min(mod, modi) ref = (0 - -a[i][0]//10)*10 ans += ref mod = 10 - mod ans = ans - mod print(ans)
p03417
s498469031
Wrong Answer
N, M = map(int,input().split()) if N>1 and M>1: print(N*M-(N*2 + (M-2)*2)) else: print(N*M-2)
p02973
s781674047
Wrong Answer
import bisect def main(): n = int(input()) ans = 0 b = 10**9 + 1 for _ in range(n): a = int(input()) if b >= a: b = a ans += 1 print(ans) if __name__ == "__main__": main()
p03286
s011581167
Wrong Answer
#!/usr/bin/python3 # -*- coding:utf-8 -*- def main(): n = int(input()) s = 0 ans = [] for i in range(30): if (n - s) % (2**(i+1)) == 0: ans.append('0') else: ans.append('1') s += ((-2) ** i) if s == n: break print(''.join(ans[::-1])) if __name__=='__main__': main()
p02958
s320074021
Accepted
N = int(input()) p = list(map(int,input().split())) res = sorted(p) cnt = 0 for i in range(N): if p[i] != res[i]: cnt += 1 if(cnt <= 2): print('YES') else: print('NO')
p02777
s739930646
Accepted
S, T = input().split() A, B = map(int, input().split()) U = input() if S == U: A -= 1 else: B -= 1 print(A, B)
p02744
s076643147
Accepted
import string N = int(input()) alph = string.ascii_lowercase ans = [] A = [0] def search(): if len(A) == N: ans.append(tuple(A)) return mx = max(A) for i in range(mx + 2): A.append(i) search() A.pop() return search() for a in ans: print(''.join(alph[i] for i in a))
p02900
s327824838
Accepted
# D - Disjoint Set of Common Divisors import fractions A, B = map(int, input().split()) C = fractions.gcd(A, B) primes = [] i = 2 while i * i <= C: while C % i == 0: C //= i primes.append(i) i += 1 if C > 1: primes.append(C) print(len(set(primes)) + 1)
p03309
s696597247
Accepted
n = int(input()) a = list(map(int, input().split())) na = [0]*n for i in range(n): na[i] = a[i]-(i+1) na.sort() med = n//2-1 med1 = med+1 ans = 0 ans1 = 0 for i in range(n): ans += abs(na[i]-na[med]) ans1 += abs(na[i]-na[med1]) print(min(ans, ans1))
p02742
s947815730
Accepted
h,w = map(int,input().split()) hw = h*w if(h == 1 or w == 1): ans = 1 elif(hw%2==1): ans = (int)(hw/2)+1 else: ans = (int)(hw/2) print(ans)
p03862
s115183018
Accepted
f=lambda:map(int,input().split()) n,x=f() l=f() t=a=0 for i in l: t=min(i,x-t) a+=i-t print(a)
p02714
s331730000
Wrong Answer
n=int(input()) S=input() dictR=[] dictG=[] dictB=[] for i in range(len(S)): if S[i]=="R": dictR.append(i) elif S[i]=="G": dictG.append(i) else: dictB.append(i) sum=len(dictR)*len(dictG)*len(dictB) for i in dictR: for j in dictG: for k in dictB: if j-i==k-j: sum-=1 print(sum)
p02786
s804330534
Accepted
h = int(input()) i = 0 while 2**i <= h: i += 1 print(2**i-1)
p02793
s074763096
Accepted
import fractions N = int(input()) A = [int(i) for i in input().split()] mod = 10**9 + 7 lcm = 1 for a in A: lcm = lcm*a//fractions.gcd(lcm, a) # print(lcm) ans = 0 for a in A: ans += lcm//a print(ans % mod)
p02797
s395069109
Accepted
N, K, S = map(int, input().split()) print(*([S] * K + [S+1 if S!=10**9 else 1] * (N-K)))
p03556
s857863722
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) i = 1 while i ** 2 < N: i += 1 if i ** 2 > N: print((i - 1) ** 2) sys.exit()
p03815
s748617012
Accepted
from math import ceil x = int(input()) m = x//11 r = x%11 if 0 < r <= 6: print(2*m+1) elif r == 0: print(2*m) else: print(2*m+2)
p02621
s106810333
Accepted
#!/usr/bin/env python3 a = int(input()) print(a+a**2+a**3)
p02916
s514019360
Accepted
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) x = sum(b) for i in range(0,n-1): if a[i+1]-a[i]==1: x+=c[a[i]-1] print(x)
p02639
s665938835
Accepted
l = list(map(int,input().split())) for i in range(len(l)): if 0 == l[i]: print(i+1)
p03994
s873390612
Wrong Answer
s = input() ints = [ord(i) - ord('a') for i in s] K = int(input()) n = len(s) i = 0 while i < n: if 25 - ints[i] + 1<= K: K -= 25 - ints[i] + 1 ints[i] = 0 i += 1 K %= 26 ints[-1] = (ints[-1] + K) % 26 s_ = '' for i in ints: s_ += chr(i + ord('a')) print(s_)
p02842
s583661494
Accepted
n = int(input()) for x in range(int(n / 1.1), n + 1): if int(x * 1.08) == n: print(x) exit(0) print(':(')
p03456
s818736882
Wrong Answer
a,b=map(int,input().split()) for i in range(1,120): if i**2==100*a+b: print("Yes") break else: print("No")
p03284
s244032569
Wrong Answer
N,K = map(int,input().split()) print(N % K)
p03379
s800246207
Wrong Answer
N = int(input()) A = list(map(int,input().split())) for i in range(1,N + 1): if i < N//2 + 1: print(A[N//2]) else: print(A[N//2 -1])
p02712
s687141774
Accepted
N = int(input()) sum = 0 for i in range(1, N + 1): if i % 3 == 0 or i % 5 == 0: continue else: sum += i print(sum)
p03592
s022339691
Accepted
N,M,K = map(int,input().split()) for i in range(N+1): for j in range(M+1): if i*(M-j) + j*(N-i) == K: print('Yes') exit() print('No')
p02897
s929478108
Wrong Answer
import sys from bisect import * sys.setrecursionlimit(100000000) input = lambda: sys.stdin.readline().rstrip() N = int(input()) odd, even = 0, 0 for i in range(1, N + 1): if i % 2 == 0: even += 1 else: odd += 1 print('{:.2f}'.format(odd / (even + odd)))
p03962
s134682943
Accepted
l = list(map(int, input().split())) s = set(l) print(len(s))
p03126
s445210564
Accepted
n, m = map(int, input().split()) t = [] g = 0 if n == 1: print(len(input().split()) - 1) exit() for i in range(n): t.append(input().split()) for i in sorted(t, reverse = True)[0][1:]: c = 0 for j in sorted(t, reverse = True)[1:]: if j[1:].count(i) == 1: c += 1 if c == n - 1: g += 1 print(g)
p02556
s459643742
Wrong Answer
from itertools import combinations from operator import itemgetter n = int(input()) XY = [tuple(int(x) for x in input().split()) for _ in range(n)] X = sorted(XY, key=itemgetter(0)) Y = sorted(XY, key=itemgetter(1)) def dist(a, b): return abs(a[0] - b[0]) + abs(a[1] - b[1]) ans = 0 if n < 3000: for a, b in combinations(XY, 2): ans = max(ans, dist(a, b)) else: A = X[:750] + X[-750:] + Y[:750] + Y[-750:] for a, b in combinations(A, 2): ans = max(ans, dist(a, b)) print(ans)
p03069
s941904319
Wrong Answer
n=int(input()) S=[0 if i=='.' else 1 for i in input()] if sum(S)==0 or sum(S)==n: print(0) exit() start=0 for i in range(n): if S[i]==1: start=i break S=S[start:] ans=0 for s in S: if s==0: ans+=1 if len(S)-ans>=0: print(min(ans, len(S)-ans)) else: print(ans)
p02791
s825174320
Accepted
if __name__ == '__main__': n = int(input()) A = list(map(int,input().split())) cnt = 1 minnum = A[0] for i in range(1,n): if A[i] < minnum: cnt += 1 minnum = A[i] print(cnt)
p03449
s646205582
Accepted
N = int(input()) A = [list(map(int, input().split())) for _ in range(2)] ans = 0 for i in range(N): total = sum(A[0][0:i + 1]) + sum(A[1][i:N + 1]) if total > ans: ans = total print(ans)
p02663
s312007797
Accepted
a,b,c,d,e = map(int,input().split()) p = a * 60 + b q = c * 60 + d r = q - p print(r - e)
p04033
s538965684
Wrong Answer
a, b = map(int,input().split()) num = (b-a)+1 if a > 0: print("a_Positive") elif b < 0 and num%2==0: print("b_Positive") elif b < 0 and num%2!=0: print("Negative") elif a <= 0 and b >= 0: print("Zero")
p03821
s608583561
Wrong Answer
n = int(input()) ab = [map(int, input().split()) for _ in range(n)] a, b = [list(i) for i in zip(*ab)] a.reverse() b.reverse() ans = 0 num = 0 ruisekiwa = 0 for j in range(n): a[j] += ruisekiwa syou = a[j]//b[j] if b[j] == 1: num = 0 else: num = b[j]*(syou+1) - a[j] ruisekiwa += num ans += num print(ans)
p03360
s415246455
Wrong Answer
a = [int(i) for i in input().split()] k = int(input()) mx = max(a) sm = (sum(a)-mx) + mx*(2*k) print(sm)
p02793
s678288289
Accepted
from fractions import gcd n=int(input()) a=list(map(int,input().split())) lcm = a[0] for i in range(1,n): lcm = lcm*a[i] // gcd(lcm,a[i]) mod=pow(10,9)+7 lcm%=mod ans=0 for x in a: ans+=pow(x,mod-2,mod) ans%=mod print(ans*lcm%mod)
p02787
s857118718
Accepted
H ,N = [int(i) for i in input().split()] AB = [] for _ in range(N): AB.append([int(i) for i in input().split(' ')]) MAX = 0 for a, b in AB: MAX = a if MAX < a else MAX DP = [10**10] * (H+MAX) DP[0] = 0 for i in range(H): for a,b in AB: if DP[i] != 10**10: DP[i+a] = min(DP[i+a],DP[i] + b) print(min(DP[H:]))
p02888
s788004691
Wrong Answer
n=int(input()) a1=list(map(int,input().split())) r=0 import numpy as np for ii in range(len(a1)-2): for jj in np.arange(ii+1,len(a1)-1): for kk in np.arange(jj+1,len(a1)): if a1[ii]+a1[jj]<=a1[kk]: break r+=1 print(r)
p03639
s850038707
Wrong Answer
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) four = sum(A % 4 == 0) # 4で割りきれる数 two = sum(np.logical_and(A % 2 == 0, A % 4 != 0)) # 4で割り切れないが、2で割りきれる数 # print(four, two) # Nからtwo//2を引く。そこからの残り//2よりfourが大きければOK # print((N - two // 2) // 2) # print(four) if (N - two // 2) // 2 <= four: print("Yes") else: print("No")
p03745
s488168532
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 1 c = 0 for i in range(1, n): if a[i] > a[i-1]: c1 = 1 elif a[i] < a[i-1]: c1 = -1 else: c1 = 0 if c != c1 and c != 0: ans += 1 c = 0 continue c = c1 print(ans)
p02675
s410227473
Wrong Answer
import numpy as np n = int(input()) n = np.mod(n, 10) if n == 2 or 4 or 5 or 7 or 9: print('hon') elif n == 0 or 1 or 6 or 8: print('pon') else: print('bon')
p03095
s026746778
Accepted
n = int(input()) s = input() MOD = 10 ** 9 + 7 from collections import Counter c = Counter(list(s)) res = 1 for v in c.values(): res *= v + 1 res %= MOD print(res - 1)
p02917
s516364543
Accepted
n = int(input()) b = list(map(int, input().split())) ans = [0]*n ans[0] = b[0] for i in range(1, n-1): ans[i] = min(b[i-1], b[i]) ans[n-1] = b[n-2] print(sum(ans))
p03861
s989560347
Wrong Answer
a,b,x = map(int,input().split()) m = 0 if b % x == 0: m += 1 c = b - a print(m + c // x)
p02583
s284280985
Accepted
n = int(input()) l = list(map(int,input().split())) c = 0 f = 0 s = 0 t = 0 for i in range(n): for j in range(i, n): for k in range(j,n): if l[i] != l[j] and l[j] != l[k] and l[k] != l[i] and l[i] < l[j] +l[k] and l[j] < l[i]+l[k] and l[k] < l[i]+l[j]: c+=1 print(c)
p03644
s048829810
Accepted
n = int(input()) A = [int(x) for x in range(1,n+1)] B = [0]*n for i in range(n): while A[i] % 2 == 0: A[i] = A[i]//2 B[i] += 1 ind = B.index(max(B)) tmp = [int(x) for x in range(1,n+1)] print(tmp[ind])
p03146
s351756018
Accepted
s=int(input()) target=[s] i=0 while True: if target[i]%2==0: tmp=target[i]/2 else: tmp=3*target[i]+1 if tmp in target: i+=1 break else: target.append(tmp) i+=1 print(i+1)
p02854
s662734437
Accepted
N = int(input()) A = list(map(int, input().split())) S = [0]*(N+1) S[0] = 0 diff = float("INF") idx = -1 m = sum(A)/2 for i in range(N): S[i+1] = S[i] + A[i] if abs(m - S[i+1]) < diff: diff = abs(m - S[i+1]) idx = i+1 lsum = S[idx] rsum = S[N]-S[idx] print(abs(lsum-rsum))
p03548
s127700655
Accepted
x,y,z=map(int,input().split()) print((x-z)//(y+z))
p03162
s131256340
Accepted
N = int(input()) ans = [[0]*3 for _ in range(N)] ans[0] = list(map(int, input().split())) for i in range(1, N): a, b, c = map(int, input().split()) ans[i][0] = max(ans[i-1][1]+a, ans[i-1][2]+a) ans[i][1] = max(ans[i-1][2]+b, ans[i-1][0]+b) ans[i][2] = max(ans[i-1][0]+c, ans[i-1][1]+c) print(max(ans[N-1]))
p02744
s336546087
Accepted
N = int(input()) def dfs(s, mx): if len(s) == N: print(s) else: for c in range(ord('a'), ord(mx)+1): if chr(c) == mx: mx = chr(c+1) dfs(s+chr(c), mx) dfs("", 'a')
p03494
s293618174
Accepted
N = int(input()) A = list(map(int, input().split())) res = 10 ** 9 for a in A: if a % 2 == 1: print(0) exit() tmp = 0 while a % 2 == 0: tmp += 1 a //= 2 res = min(res, tmp) print(res)
p02760
s484020695
Accepted
row1 = map(int, input().split()) row2 = map(int, input().split()) row3 = map(int, input().split()) row = list(row1) + list(row2) + list(row3) bs = [int(input()) for i in range(int(input()))] comb = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6], ] for lst in comb: if len([1 for num in lst if row[num] in bs]) == 3: print('Yes') exit() print('No')
p03827
s928836385
Accepted
def myAnswer(N:int,S:list) -> int: ans = 0 x = 0 for i in S: if(i == "I"): x +=1 elif(i == "D"): x -= 1 ans = max(ans,x) return ans def modelAnswer(): tmp=1 def main(): N = int(input()) S = list(input()) print(myAnswer(N,S[:])) if __name__ == '__main__': main()
p03804
s451717400
Accepted
n,m=map(int,input().split()) a=[list(input()) for _ in range(n)] b=[list(input()) for _ in range(m)] r=n-m+1 print('Yes' if any([all([a[x//r+y//m][x%r+y%m]==b[y//m][y%m] for y in range(m**2)]) for x in range(r**2)]) else 'No')
p02596
s211471171
Accepted
k=int(input()) n=0 a=0 ss=0 if k==7: print(1) elif k%2==0: print(-1) elif k%5==0: print(-1) else: while a==0: n+=1 ss=10*(ss%k)+7 if ss%k==0: a=1 if a==1: print(n) else: print(-1)
p02676
s172113986
Wrong Answer
K=int(input()) S=input() if len(S)<=K: print(S) else: print(S+"...")
p02958
s905414252
Accepted
n = int(input()) p = list(map(int, input().split())) q = list(range(1, n + 1)) cnt = 0 for i in range(n): if p[i] == q[i]: cnt += 1 print("YES" if cnt >= n - 2 else "NO")
p03073
s540245542
Accepted
import sys INPUT = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10 ** 9) def main(): S = INPUT() N = len(S) s = ["", ""] for i in range(N): for j in range(2): s[j] += str((i + j)%2) cnt = [0, 0] for i in range(N): for j in range(2): if s[j][i] != S[i]: cnt[j] += 1 print(cnt[0] if cnt[0] < cnt[1] else cnt[1]) if __name__ == '__main__': main()
p03795
s427267397
Wrong Answer
n = int(input()) x = n * 800 y = (n // 15) * 150 print(x - y)
p02946
s679449653
Accepted
K, X = map(int, input().split()) print(*list(range(X - K + 1, X + K)))
p02813
s381090829
Accepted
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) ans = sorted([i for i in permutations(range(1, n + 1))]) print(abs(ans.index(p) - ans.index(q)))
p02618
s985502871
Wrong Answer
import random def main(): d = int(input()) for _ in range(d): input() for i in range(d): print(random.randint(1,27)) if __name__ == '__main__': main()
p03705
s985511232
Accepted
N, A, B = map(int, input().split()) if A > B or (N == 1 and A < B): print(0) exit() if N == 1 and A == B: print(1) exit() mx = A+B+B*(N-2) mn = A+B+A*(N-2) print(mx-mn+1)
p02639
s692942148
Accepted
# -*- coding:utf-8 -*- def solve(): Xs = list(map(int, input().split())) for i, x in enumerate(Xs): if x == 0: print(i+1) return if __name__ == "__main__": solve()
p02546
s757131458
Accepted
import numpy as np #inp = list(map(int, input().split()) inp = list(input()) if inp[-1] == "s": inp.append("es") else : inp.append("s") for i in range(len(inp)): print(inp[i], end ="")
p03284
s437212315
Wrong Answer
n,k = map(int, input().split()) print(n%k)
p03778
s594022044
Wrong Answer
a, W, b = map(int,input().split()) print(min(abs(a-b),abs(a+W-b)))
p02802
s177077161
Accepted
n,m=map(int, input().split()) al=[] for i in range(m): a=list(map(str, input().split())) al.append(a) l_all=[[] for i in range(n)] for i in range(m): l_all[int(al[i][0])-1].append(al[i][1]) ac=0 pn=0 for j in range(n): if l_all[j].count('AC')!=0: pn+=l_all[j].index('AC') ac+=1 print('{} {}'.format(ac,pn))
p02570
s553737505
Accepted
d,t,s= map(int,input().split()) if d>s*t: print("No") else: print("Yes")
p02647
s289406994
Accepted
n,k,*a=map(int,open(0).read().split()) r=range(n) while k: k-=1;b=[0]*n*3 for i in r:t=a[i];b[max(0,i-t)]+=1;b[i-~t]-=1 for i in r:b[i+1]+=b[i] a=b[:n] if min(a)==n:break print(*a)
p03637
s070687497
Accepted
import math n = int(input()) a = list(map(int, input().split())) c2 = 0 c4 = 0 for i in a: if i%4==0: c4+=1 elif i%2==0: c2+=1 if c2 == len(a): print('Yes') elif c2 >= 2: if c4 >= (math.ceil((len(a)-c2)/2)): print('Yes') else: print('No') elif c4 >=(len(a)//2): print('Yes') else: print('No')
p02714
s568860043
Accepted
N = int(input()) N -= 1 S = str(input()) count = S.count('R') * S.count('G') * S.count('B') for i in range(N): for j in range(i,N+1): k = 2*j - i if k > N: pass elif S[i] == S[j] or S[i] == S[k] or S[j] == S[k]: pass else: count -= 1 print(count)
p02646
s630364642
Wrong Answer
a, v = map(int, input().split()) b, w = map(int, input().split()) T = int(input()) loc = abs(a - b) if v <= w: print('No') exit() if loc % v == 0: print('Yes') exit() for i in range(T): loc += w if loc % v == 0: print('Yes') exit() print('No')
p03665
s209971774
Accepted
n,p = [int(x) for x in input().split()] a = [int(x) for x in input().split()] a_odd = [x for x in a if x % 2 == 1] if len(a_odd) == 0: if p == 0: print(2 ** n) else: print(0) else: print(2 ** (n-1))
p02993
s217806403
Wrong Answer
S=list(input()) count=0 for i in range(2): if S[i]==S[i+1]: count=1 if count==1: print('Bad') else: print('Good')
p02726
s237496063
Wrong Answer
import numpy as np import scipy.sparse N,X,Y = (int(x) for x in input().split()) lil = scipy.sparse.lil_matrix((N, N)) for i in range(N-1): lil[i, i+1] = 1 lil[X-1, Y-1] = 1 lil2 = scipy.sparse.csgraph.dijkstra(lil) for i in range(1,N): print(np.count_nonzero(lil2 == i))
p03673
s455350313
Accepted
n=int(input()) a=list(map(int,input().split())) if len(a)%2==0: b=a[::-2]+a[::2] else: b=a[::-2] + a[1::2] print(' '.join(list(map(str,b))))
p03062
s020118184
Accepted
from sys import stdin def main(): #入力 readline=stdin.readline N=int(readline()) A=list(map(int,readline().split())) S=0 min_number=10**9 minus_count=0 for i in range(N): if A[i]<0: minus_count+=1 a=abs(A[i]) S+=a min_number=min(min_number,a) S=S if minus_count%2==0 else S-2*min_number print(S) if __name__=="__main__": main()
p03785
s051125154
Accepted
import bisect import math n, c, k = list(map(int, input().split())) t = [0] * n for i in range(n): t[i] = int(input()) t.sort() bus_count = 0 pre_index = 0 index = 0 while index < n: #indexを乗せるバスが発車する時間 leave = t[index] + k count = 0 bus_count += 1 while index < n and count < c and leave >= t[index]: count += 1 index += 1 print(bus_count)
p03681
s114551291
Wrong Answer
def factorial(x, mod=10**9+7): # x! # 階乗 # ex) factorial(5) = 120 tmp = 1 for i in range(1, x+1): tmp = (tmp * i) % mod return tmp N ,M = map(int, input().split()) mod = 1000000007 if N==M: print((2*factorial(N)**2) % mod ) elif abs(N-M==1): print((factorial(N)*factorial(M))%mod) else: print(0)
p02601
s615669034
Wrong Answer
a,b,c=map(int,input().split()) k=int(input()) c=0 while a>=b: b*=2 c+=1 while b>=c: c*=2 c+=1 if c<=k: print('Yes') else:print('No')
p02713
s462289094
Wrong Answer
from math import gcd sum = 0 K = int(input()) for k in range(1,K+1): for j in range(1,K+1): t = gcd(k,j) for i in range(1,K+1): sum += gcd(t,i+1) print(sum)
p03693
s009881950
Accepted
r, g, b = input().split() number = int(r+g+b) if number % 4 ==0: print('YES') else: print('NO')
p03043
s641086990
Accepted
# coding: utf-8 import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() dice = np.arange(1, N+1, dtype=np.int32) need = np.zeros(N, np.int32) for i in range(20): target = dice < K need[target] += 1 dice[target] <<= 1 #2倍 power = (.5) ** need answer = power.sum() / N print(answer) # 58
p03994
s703784775
Accepted
S = list(input()) k = int(input()) alp = list('abcdefghijklmnopqrstuvwxyz') s2a = {alp[i]: 26-i for i in range(26)} s2a['a'] = 0 for i in range(len(S)): s = S[i] if s2a[s] <= k: k -= s2a[s] S[i] = 'a' k %= 26 idx = alp.index(S[-1]) S[-1] = alp[k+idx] print(*S, sep='')
p03289
s496077448
Accepted
s=input() ans=0 if s[0]!='A': print("WA") exit() for i in range(1,int(len(s))): if s[i].isupper(): if i==1 or i==int(len(s))-1 or s[i]!='C': print("WA") exit() ans+=1 if ans !=1: print("WA") exit() print("AC")
p02630
s845123461
Accepted
from collections import defaultdict n = int(input()) a_list = list(map(int,input().split())) q = int(input()) d = defaultdict(lambda: 0) ans = sum(a_list) for i in a_list: d[i] += 1 ans = sum(a_list) for i in range(q): a,b = map(int,input().split()) ans = ans + b*d[a] - a*d[a] d[b] += d[a] d[a] -= d[a] print(ans)
p02767
s100919636
Wrong Answer
n = int(input()) x = list(map(int,input().split())) S = sum(x) Ave = sum(x) // n m = 10**6 score = 0 count = 0 for p in range(Ave-100,Ave+101): for i in range(n): score += (x[i]-p)**2 if score < m: m = score score = 0 print(m,p)
p02881
s092619350
Accepted
from math import sqrt n=int(input()) ans=n+1 for i in range(1,int(sqrt(n))+1): if n%i==0: ans = i+n//i print(ans-2)
p03126
s840673287
Wrong Answer
n,m = map(int, input().split()) seq = [] for _ in range(m): seq.append(0) for i in range(n): liked = list(map(int, input().split())) for j in range(liked[0]): liked[j+1] += 1 seq.count(n)