problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03774
s137180155
Accepted
import numpy as np,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M = LI() ab = np.array([LI() for _ in range(N)]) cd = np.array([LI() for _ in range(M)]) for x in ab: print(np.argmin(np.sum(np.abs(cd-x),axis=1))+1)
p02677
s860744999
Accepted
import math length_hour, length_min, hour, minute = map(int, input().split(' ')) total_min = hour * 60 + minute hx = math.sin((total_min / (12 * 60)) * (2 * math.pi)) * length_hour hy = math.cos((total_min / (12 * 60)) * (2 * math.pi)) * length_hour mx = math.sin((minute / 60) * (2 * math.pi)) * length_min my = math.cos((minute / 60) * (2 * math.pi)) * length_min distance = math.sqrt((hx - mx) ** 2 + (hy - my) ** 2) print(f"{distance}")
p03681
s674818648
Accepted
import math n,m = map(int,input().split()) diff = abs(n-m) count1 = 1 count2 = 1 a = 1 if diff >= 2: print(0) elif diff == 1: ans = math.factorial(max(n,m)) print(ans*(ans//max(n,m))%(10**9+7)) else: ans = math.factorial(n) print(ans*ans*2%(10**9+7))
p02773
s914832431
Accepted
n = int(input()) L = list(input() for _ in range(n)) D = dict.fromkeys(set(L),0) for l in L: D[l] += 1 m = max(D.values()) SD = sorted(D.items(), key=lambda x:x[0]) for k, v in SD: if v == m: print(k)
p02584
s286504636
Wrong Answer
m,K,D = input().split() m = int(m) K = int(K) D = int(D) min = 0; if m < 0: m * -1 a = (m - m % D) / D if a > K: min = m - D*K else: K -= (m - m % D) / D if K % 2 == 0: min = m % D else: min = (m % D - D) * -1 print(min)
p02665
s022012628
Wrong Answer
n = int(input()) a = list(map(int, input().split())) if a[0] != 0: print(-1); exit() s = [0] * (n+2) for i in range(n+1)[::-1]: s[i] = s[i+1]+a[i] x = 1 ans = 0 for i in range(n+1): ans += x x -= a[i] if (x <= 0 and i != n) or x < 0: print(-1); exit() if x == s[i]: continue if x*2 > s[i+1]: x = s[i+1] else: x *= 2 print(ans)
p02993
s856962002
Wrong Answer
S = input() if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]: print("bad") else: print("good")
p02783
s943423830
Accepted
H,A = map(int,input().split()) if(H%A > 0): print(H//A+1) else: print(H//A)
p02860
s508572646
Wrong Answer
N=int(input()) S=input() if N%2==0 and all(a==b for a,v in zip(S,S[N:])): print("Yes") else: print("No")
p03797
s513141206
Accepted
n, m = map(int, input().split()) if n*2 < m: c = m - (n*2) ans = int(c/4) + n else: ans = int(m/2) print(ans)
p02623
s630005480
Accepted
N, M, K = map(int, input().split()) A = [0] + [int(i) for i in input().split()] B = [0] + [int(i) for i in input().split()] N += 1 M += 1 for i in range(1, N) : A[i] += A[i - 1] for i in range(1, M) : B[i] += B[i - 1] ret = 0 a = N - 1 b = 0 while b < M : while a >= 0 and A[a] + B[b] > K : a -= 1 if a >= 0 and A[a] + B[b] <= K : ret = max(ret, a + b) b += 1 print(ret)
p03285
s372033363
Accepted
n = int(input()) res = "No" for cake in range(0, int(n/4) + 1): for dornut in range(0, int(n/7) + 1): if 4 * cake + 7 * dornut == n: res = "Yes" break else: continue break print(res)
p03241
s700126876
Accepted
N, M = (int(i) for i in input().split()) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort(reverse=True) return divisors div = make_divisors(M) for d in div: if int(M/d) >= N: print(d) break
p03377
s041934171
Accepted
A,B,X = map(int,input().split()) print('YES' if A <= X <= A+B else 'NO')
p02848
s387276658
Wrong Answer
n=int(input()) s=input() hiee="" ans="" for i in range(len(s)): hiee=ord(s[i]) if (hiee+n >90): print("0") hiee-=24 ans+=chr(hiee+n) print(ans)
p02690
s007764866
Accepted
x = int(input()) root = int(x**(0.2)) flag = 0 for i in range(root - 400, root + 400): for j in range(-100, root + 400): if i!=j: if x%(i-j) == 0: if i**5-j**5 == x: print(i, j) flag = 1 break if flag: break
p02571
s624272220
Accepted
s = list(input()) t = list(input()) ls, lt = len(s), len(t) ans = lt 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, lt - cnt) print(ans)
p03352
s589273388
Accepted
x = int(input()) bekis = [1] for i in range(2,35): for j in range(2,15): v = i**j if v > x: break bekis.append(v) bekis.sort() print(bekis[-1])
p03377
s306476728
Wrong Answer
a,b,c=input().split() a=int(a) b=int(b) c=int(c) if a+b<c: print("NO") if a>c: print("NO") else: print("YES")
p02993
s719426504
Accepted
n = list(map(int, list(input()))) i = -1 ans = "Good" for i1 in n: if i == i1: ans = "Bad" break else: i = i1 + 0 print(ans)
p02624
s766991933
Wrong Answer
n=int(input()) s=0 for i in range(1,1+n): s+=i/2*(n//i)*(n//i+1) print(s)
p02791
s769023215
Wrong Answer
n = int(input()) p = list(map(int, input().split())) answer = 0 m = 0 for i in range(n): if i == 0: answer += 1 m = p[i] elif p[i] <= m: answer += 1 min = p[i] print(answer)
p02935
s207733030
Accepted
n = int(input()) v = list(map(float, input().split())) ans = v[:] for i in range(n - 1): ans = sorted(ans) s = (ans[0] + ans[1]) / 2 ans.pop(0) ans[0] = s print(ans[0])
p03779
s647538398
Accepted
import math X = int(input()) ruto = math.ceil(math.sqrt(2*X))+1 kari = ruto**2+ruto ans=1 for i in range(ruto-1, 0, -1): if i**2+i < 2*X: ans = i+1 break kari = i**2+i print(ans)
p03545
s212457106
Accepted
a = list(input()) op = ['-'] * 3 for i in range(2**3): ans = int(a[0]) for j in range(3): if 1 & (i>>j): ans += int(a[3-j]) op[2-j] = '+' else: ans -= int(a[3-j]) op[2-j] = '-' if ans == 7: break print(a[0] + op[0] + a[1] + op[1] + a[2] + op[2] +a[3] + "=7")
p03105
s633374495
Wrong Answer
#!/usr/bin/env python3
p03206
s452585096
Accepted
D = int(input()) if D == 25: print('Christmas') elif D == 24: print('Christmas Eve') elif D == 23: print('Christmas Eve Eve') elif D == 22: print('Christmas Eve Eve Eve')
p02958
s361757278
Accepted
N = int(input()) P = list(map(int,input().split())) if all(a<b for a,b in zip(P,P[1:])): print('YES') exit() for i in range(N-1): for j in range(i+1, N): P[i],P[j] = P[j],P[i] if all(a<b for a,b in zip(P,P[1:])): print('YES') exit() P[i],P[j] = P[j],P[i] print('NO')
p03699
s082464586
Accepted
def resolve(): N=int(input()) S=sorted([int(input()) for i in range(N)]) total=sum(S) if total%10!=0: print(total) else: for i in range(N): if S[i]%10!=0: print(total-S[i]) break elif i==N-1:print(0) resolve()
p02598
s103943287
Accepted
N, K = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] def judge(x): k = 0 for a in A: v = a // x if a % x == 0: v -= 1 k += v return k <= K low = 1 high = max(A) A.sort() while low < high - 1: mid = (low + high) // 2 if judge(mid): high = mid else: low = mid if judge(low): print(low) else: print(high)
p02793
s151932437
Wrong Answer
import fractions n = int(input()) a = list(map(int, input().split())) lgm = a[0] for i in range(1, n): lgm = lgm * a[i] // fractions.gcd(lgm, a[i]) mod = 10**9 + 7 ans = 0 for i in range(n): ans += (lgm // a[i]) % mod print(ans)
p03565
s498283385
Accepted
sd = input() t = input() anss = [] for tpos in range(len(sd) - len(t) + 1): check = True for i in range(len(t)): if t[i] != sd[(i + tpos)] and sd[(i + tpos)] != '?': check = False break if check == True: cand = sd[:tpos] + t + sd[(tpos + len(t)):] anss.append(cand.replace('?', 'a')) if len(anss) == 0: print('UNRESTORABLE') else: print(sorted(anss)[0])
p02948
s298001572
Accepted
import heapq N,M = map(int,input().split()) AB = [list(map(int,input().split())) for _ in range (N)] AB.sort() ans = 0 q = [] heapq.heapify(q) idx = 0 for i in range(1,M+1): while idx<N and AB[idx][0]<=i: heapq.heappush(q, -AB[idx][1]) idx += 1 if q: p = -heapq.heappop(q) ans += p print(ans)
p03317
s328866473
Wrong Answer
import math def read_ints(): return[int(i) for i in input().split()] def main(): n, k = read_ints() print(math.ceil(n / k)) if __name__ == '__main__': main()
p02765
s354150013
Accepted
n,r=map(int, input().split()) if n < 10: print(r + 100 * (10-n)) else: print(r)
p02546
s998068615
Accepted
w = input() if w.endswith('s'): w = w + "es" print(w) elif not(w.endswith('s')): w = w + "s" print(w)
p02923
s088418757
Wrong Answer
def main(): n,*h=map(int,open(0).read().split()) search=[i for i,j in enumerate(h) if j==max(h)] ans=0 for p in search: count=0 while(p+1<n): if h[p]>=h[p+1]: count+=1 p+=1 else: break ans=max(ans,count) print(ans) if __name__=="__main__": main()
p02814
s211662922
Accepted
import statistics from fractions import * import math def cntTwo(n): i = 0 while n % 2 == 0: i += 1 n //= 2 return i lcm = lambda a, b: a * b // gcd(a, b) n,m = map(int,input().split()) l = set(map(int,input().split())) l = list(l) l = [i//2 for i in l] lc = 1 gc =1 two = cntTwo(l[0]) for i in l: if cntTwo(i)!=two: print(0) exit() lc = lc*i//gcd(lc,i) print((m//lc +1)//2)
p03469
s136756233
Accepted
s = input() print(s[:3] + "8" + s[4:])
p02688
s667890773
Accepted
N, K = map(int, input().split()) okashi_map = {} for num in range(N): okashi_map[num+1] = 0 for _ in range(K): okashi = input() sunuke_list = list(map(int, input().split())) for sunuke in sunuke_list: okashi_map[sunuke] += 1 find_keys = [k for k, v in okashi_map.items() if v == 0] print(len(find_keys))
p02879
s358435767
Accepted
a,b = map(int,input().split()) if a>=10 or b>=10: print(-1) else: print(a*b)
p02836
s171135464
Accepted
s = input() count = 0 for i in range(len(s) // 2): if s[i] != s[-i -1]: count += 1 print(count)
p02640
s580005301
Accepted
a = list(input().split(" ")) animal = int(a[0]) foot = int(a[1]) saisyo = 2 * animal saidai = 4 * animal if (foot % 2 == 0) and (saisyo <= foot <= saidai): print("Yes") else: print("No")
p02689
s739217319
Wrong Answer
import sys import math n, m = map(int, input().split()) h = list(map(int, input().split())) ma = [0] * n for i in range(m): a, b = map(int, input().split()) ma[a - 1] = max(ma[a-1],h[b - 1]) ma[b - 1] = max(ma[b-1] ,h[a - 1]) cnt = 0 print(ma) print(h) for i in range(n): if h[i] > ma[i]: cnt += 1 print(cnt)
p03013
s059454822
Accepted
import itertools,sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M = LI() a = set([I() for _ in range(M)]) dp = [0]*(N+1) #1_indexed dp[0] = 1 dp[1] = 0 if 1 in a else 1 for i in range(2,N+1): if i in a: dp[i] = 0 continue dp[i] = (dp[i-1]+dp[i-2])%(10**9+7) print(dp[-1])
p02552
s371861667
Wrong Answer
a=input() if a==1: a=0 else: a=1 print(a)
p02814
s496038698
Accepted
import fractions N, M = map(int, input().split()) a_array = list(map(int, input().split())) Q = 2 ** 35 two_count = fractions.gcd(a_array[0], Q) lcm = 1 for a in a_array: aa = a // 2 if two_count != fractions.gcd(a, Q): print(0) exit() lcm = int(aa * lcm) // fractions.gcd(aa, lcm) if lcm > M: print(0) exit() # ans = ((M//lcm)+1) // 2 ans = (M-lcm) // (2*lcm) + 1 print(int(ans))
p02785
s285314891
Accepted
N, K = map(int, input().split()) H = list(map(int, input().split())) H = sorted(H, reverse=True) del H[:K] if H: total = sum(H) else: total = 0 print(total)
p03796
s100495409
Accepted
# https://atcoder.jp/contests/abc055/tasks/abc055_b N = int(input()) MOD = 10**9 + 7 power = 1 for i in range(1, N+1): power *= i power = power % MOD print(power)
p03261
s501329540
Accepted
def main(): N = int(input()) words = [input()] ans = True for _ in range(N - 1): s = input() if words[-1][-1] != s[0] or s in words: ans = False else: words.append(s) if ans is True: print('Yes') else: print('No') if __name__ == '__main__': main()
p02660
s076872691
Wrong Answer
n = int(input()) def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] c = 0 for z in make_divisors(n)[1:]: if n % z == 0: n /= z c += 1 print(c)
p03161
s859497833
Accepted
N, K = map(int, input().split()) H = list(map(int, input().split())) dp = [1000000000] * N dp[0] = 0 for i in range(N): for k in range(1, K+1): if i+k >= N: break dp[i+k] = min(dp[i+k], dp[i] + abs(H[i] - H[i+k])) print(dp[N-1])
p03150
s562559782
Accepted
import re S=input() if re.fullmatch(r"[a-z]*keyence",S)==None and re.fullmatch(r"k[a-z]*eyence",S)==None and re.fullmatch(r"ke[a-z]*yence",S)==None and re.fullmatch(r"key[a-z]*ence",S)==None and re.fullmatch(r"keye[a-z]*nce",S)==None and re.fullmatch(r"keyen[a-z]*ce",S)==None and re.fullmatch(r"keyenc[a-z]*e",S)==None and re.fullmatch(r"keyence[a-z]*",S)==None: print("NO") else: print("YES")
p03210
s199124303
Accepted
X = int(input()) if X < 9 and X > 1 and X % 2 == 1: print("YES") else: print("NO")
p02699
s020413610
Accepted
S,W = map(int,input().split()) if S <= W: print("unsafe") else: print("safe")
p03861
s367564038
Wrong Answer
import math (a,b,x)=map(int, input().split(" ")) print(math.floor(b/x)-math.ceil(a/x)+1)
p02910
s581185067
Accepted
S=list(input()) ki=[] gu=[] for i in range(len(S)): if i%2==0: ki.append(S[i]) else: gu.append(S[i]) if ("L" not in ki) and ("R" not in gu): print("Yes") else: print("No")
p03605
s154548949
Accepted
N=input() if N.count("9")>0 : print("Yes") else : print("No")
p03324
s736429378
Wrong Answer
D, N = map(int, input().split()) print(100**D*N)
p03324
s915799047
Wrong Answer
D,N=map(int,input().split()) if D==0: print(N) elif D==1: print(100*N) else: print(10000*N)
p03679
s951165436
Wrong Answer
X, A, B = map(int, input().split()) if B <= A: print("delicious") elif A < B < X: print("safe") else: print("dangerous")
p02835
s369042560
Accepted
A1, A2, A3 = map(int, input().split()) if A1 + A2 + A3 >= 22: print("bust") else: print("win")
p03607
s508725681
Wrong Answer
n=int(input()) a = [input() for _ in range(n)] a.sort() count = 0 i=0 while i<n-1: j=i+1 ex=1 while j<n: if a[j]==a[i]: ex=1-ex j+=1 else: i=j+1 count+=ex break print(count+1)
p03038
s060319039
Accepted
N, M = map(int,input().split()) A = sorted(list(map(int,input().split()))) D = [list(map(int,input().split())) for k in range(M)] D = sorted(D, key = lambda x: -x[1]) D.append([10**9+1,-1]) t = 0 ans = 0 for k in range(N): if A[k] < D[t][1]: ans += D[t][1] D[t][0] -= 1 if D[t][0] == 0: t += 1 else: ans += A[k] print(ans)
p03637
s433290151
Accepted
from numpy import log def f(k): c=0 while k % 2 == 0: k //= 2 c+=1 if c==2: break return c def g(k): return f(int(k)) n=int(input()) a=list(map(g,input().split())) ct0=a.count(0) ct1=a.count(1) ct2=a.count(2) if ct0 <= ct2 or (ct0 == ct2 + 1 and ct1==0): print("Yes") else: print("No")
p02681
s447886525
Wrong Answer
s = input(); t = input(); ls = len(s); lt = len(t); if(ls == (lt - 1)): print("Yes"); else: print("No");
p03274
s352836175
Accepted
n, k = map(int, input().split()) x = list(map(int, input().split())) ans = 10**9 for i in range(n - k + 1): cand = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i])) ans = min(ans, cand) print(ans)
p03556
s773809567
Wrong Answer
import math print(int(math.sqrt(int(input()))))
p03838
s613427357
Accepted
x, y = map(int, input().split()) cnt = abs(abs(x) - abs(y)) if x * y < 0: cnt += 1 elif x > y: cnt += 2 if x == 0 or y == 0: cnt -= 1 print(cnt)
p02576
s295434036
Accepted
def ceil(a, b): return -(-a//b) n,x,t = map(int,input().split()) print(ceil(n, x)*t)
p03693
s527335358
Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = float('inf') def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return [float(x) for x in input().split()] def LSS(): return input().split() def resolve(): r, g, b = LI() if (r * 100 + g * 10 + b) % 4 == 0: print('YES') else: print('NO') if __name__ == '__main__': resolve()
p02717
s046872060
Accepted
X,Y,Z=[int(x) for x in input().split()] (X,Y)=(Y,X) (X,Z)=(Z,X) print(X,Y,Z)
p03605
s907126693
Wrong Answer
n = int(input()) if n / 10 == 9 or n % 10 == 9: print('Yes') else: print('No')
p03779
s272808909
Accepted
N = int(input()) for i in range(1,10**9): if (N <= i*(i+1)/2): break print(i)
p03345
s961428975
Wrong Answer
A = list(map(int,input().split())) fr = 0 for i in range(A[3]): if abs(A[0]-A[1]) > 10**18: print('Unfair') fr += 1 break else: A[0] = A[1] + A[2] A[1] = A[0] + A[2] A[2] = A[0] + A[1] if fr == 0: print(A[0]-A[1])
p03639
s793027127
Wrong Answer
#!/usr/bin/env python3 N = int(input()) A = list(map(int, input().split())) count2 = 0 count4 = 0 for a in A: if a % 4 == 0: count4 += 1 elif a % 2 == 0: count2 += 1 if count2 % 2 == 1: count2 -= 1 if count4*3 + count2 >= N: print('Yes') else: print('No')
p03042
s848770382
Accepted
def main(): S = str(input()) front = int(S[0:2]) latter = int(S[2:4]) if front < 13 and latter < 13 and (front > 0 and latter > 0): print('AMBIGUOUS') elif front < 13 and latter < 100 and front > 0: print('MMYY') elif front < 100 and latter < 13 and latter > 0: print('YYMM') else: print('NA') main()
p02571
s261022580
Accepted
S = input() T = input() ans = len(T) for i in range(len(S) - len(T) + 1): temp = 0 for j in range(len(T)): if S[i+j] != T[j]: temp += 1 if ans > temp: ans = temp print(ans)
p03617
s789329999
Accepted
q, h, s, d = map(int, input().split()) n = int(input()) s = min(4 * q, 2 * h, s) d = min(2 * s, d) ans = (n // 2) * d + (n % 2) * s print(ans)
p02900
s130585466
Wrong Answer
def pf(n): a = [] N = n for i in range(2, int(pow(N,0.5)//1+2)): if n%i==0: count=0 while n%i==0: count+=1 n//=i a.append(count) if n!=1: a.append(1) if a==[]: a.append(1) return a import fractions A,B=map(int,input().split()) c=fractions.gcd(A,B) ans=len(pf(c)) print(ans+(1 if ans>1 else 0))
p02899
s067652297
Accepted
N = int(input()) A = list(map(int, input().split())) ans_list = list(range(1,N+1)) ans_dict = dict(zip(A, ans_list)) for i in ans_dict: print(ans_dict[i], end=" ")
p03250
s384612357
Accepted
a,b,c=map(int,input().split()) x=max(a,b,c) print(x*9+a+b+c)
p02687
s228934795
Accepted
s = input() if s == "ABC": print("ARC") else: print("ABC")
p03239
s385647141
Accepted
N,T = map(int,input().split()) ans = 1001 for i in range(N): c,t = map(int,input().split()) if t <= T: ans = min(ans,c) print('TLE' if ans == 1001 else ans)
p03799
s445557384
Accepted
s,c = list(map(int,input().split())) if 2*s >= c: print(c//2) else: suma = s c -= 2*s suma += c//4 print(suma)
p02708
s150769307
Accepted
N,K = list(map(int,input().split())) ans = 0 for i in range(K,N+2): ans += ((((N*2)-i+1)*i//2) - ((i-1)*i//2) +1) print(ans%(10**9+7))
p02726
s503332549
Wrong Answer
N,X,Y=map(int,input().split()) def count(k): count=0 for i in range(1,N): for j in range(i+1,N+1): if min(abs(j-i),abs(X-i)+abs(Y-j)+1)==k: count+=1 if count >= 4: break return count for k in range(1,N): print(count(k))
p02939
s424994974
Accepted
s = input() prev = "" current = "" cnt = 0 for i in s: current += i if current!=prev: cnt+=1 prev = current current = "" print(cnt)
p03261
s054352154
Accepted
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n = ii() wl = [input()] rule = True for i in range(1,n): s = input() if s in wl or s[0] != wl[-1][-1]: rule = False wl.append(s) if rule: print('Yes') else: print('No')
p03494
s417167436
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 while True: for i in range(len(a)): if not a[i]%2==0: print(ans) exit() else: a[i] = a[i]//2 ans += 1
p02948
s232294367
Accepted
import heapq n, m = map(int, input().split()) ab = sorted([ list(map(int, input().split())) for _ in range(n) ], reverse=True) que = [] ans = 0 for i in range(1, m+1): while ab and ab[-1][0] <= i: t = ab.pop() heapq.heappush(que, -t[1]) if que: ans -= heapq.heappop(que) print(ans)
p03062
s891084638
Accepted
N = int(input()) A = list(map(int, input().split())) num_minus = sum([1 if v < 0 else 0 for v in A]) sum_abs = sum([abs(v) for v in A]) min_abs = min([abs(v) for v in A]) print(sum_abs if num_minus % 2 == 0 else sum_abs - min_abs * 2)
p03043
s230220489
Accepted
import math def main(): N, K = map(int, input().split()) prob = 0 for i in range(1, N+1): if K / i <= 1: prob += 1 else: coin = math.ceil(math.log2(K / i)) prob += 0.5 ** coin print(prob / N) if __name__ == '__main__': main()
p02994
s651024411
Accepted
N, L = map(int, input().split()) curr_min = float('inf') curr_sum = 0 for i in range(1, N + 1): curr_flavour = L + i - 1 curr_sum += curr_flavour if curr_min >= 0: curr_min = min(curr_min, curr_flavour) else: curr_min = max(curr_min, curr_flavour) print(curr_sum - curr_min)
p03210
s375596642
Accepted
X=int(input()) if X==3 or X==5 or X==7: print('YES') else: print('NO')
p03774
s939503182
Wrong Answer
n, m = map(int, input().split()) a, b = [0] * n, [0] * n c, d = [0] * m, [0] * m for i in range(n): a[i], b[i] = map(int, input().split()) for i in range(m): c[i], d[i] = map(int, input().split()) ans = [0] * n for i in range(n): min = 10 * 20 for j in range(m): dis = abs(a[i] - c[j]) + abs(b[i] - d[j]) if min > dis: min = dis ans[i] = j + 1 print(ans[i])
p03077
s057760493
Accepted
import math n = int(input()) a = [int(input()) for i in range(5)] print(math.ceil(n/min(a))+4)
p03943
s848799719
Accepted
abc=sorted(list(map(int,input().split()))) if abc[0]+abc[1]==abc[2]: print("Yes") else: print("No")
p03219
s171541615
Accepted
x, y = list(map(int, input().split())) print(x + y//2)
p02607
s969683948
Wrong Answer
n = int(input()) line = [int(x) for x in input().split()] count = 0 for i in range(1, n, 2): if line[i] % 2 != 0: count += 1 print(count)