problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03319 | s287491406 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
pos = 0
for i in range(N):
if A[i] == 1:
pos = i
break
ans = 0
if i <= K:
ans += 1
if N > K:
ans += (N - K + K - 1)//(K - 1)
print(ans)
exit()
ans += (i - K + K - 1)//(K - 1)
ans += (N - i + 1 + K - 1)//(K - 1)
print(ans)
|
p03371 | s119167634 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 5000*(10**5)*2
for i in range(max(x, y)+1):
tmp_ans = i*2*c
if x > i:
tmp_ans += (x-i)*a
if y > i:
tmp_ans += (y-i)*b
ans = min(ans, tmp_ans)
print(ans)
|
p03250 | s425813031 | Accepted | abc = list(map(int,input().split()))
abc.sort(reverse=True) #降順
print(int(str(abc[0])+str(abc[1]))+abc[2])
|
p02683 | s409377383 | Wrong Answer | n,m,x=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(n)]
result=-1
for i in range(2**n):
t=[0]*m
money=0
for j in range(n):
if (i>>j)&1==0:
continue
money+=c[j][0]
for k in range(m):
t[k]+=c[j][k]
if all(xx>=x for xx in t):
if result==-1:
result=money
else:
result=min(result,money)
print(result) |
p02699 | s075551991 | Accepted | s, w = map(int, input().split())
if s<= w:
print("unsafe")
else:
print("safe") |
p03274 | s927045577 | Wrong Answer | N, K = map(int, input().split())
x = list(map(int, input().split()))
Min = 1e10
for i in range(N-K+1):
Min = min(Min, x[K+i-1]-x[i]+abs(x[i]))
print(Min) |
p02691 | s086929010 | Wrong Answer | n = int(input())
hlist = list(map(int, input().split()))
alist = list(range(1, n+1))
shlist = []
for height in hlist:
if height < n - 1:
shlist.append(height)
ans = 0
# The absolute difference of their attendee numbers is equal to the sum of their heights.
for i, h1 in enumerate(shlist):
for j, h2 in enumerate(shlist):
if abs(i-j) == h1+h2:
ans += 1
print(ans//2) |
p02717 | s331910524 | Wrong Answer | X,Y,Z = map(int,input().split())
print("Z X Y") |
p03360 | s074678944 | Accepted | import math
def main():
a,b,c = list(map(int,input().split()))
k = int(input())
if a<b:
if b<c:
print(a+b+c*pow(2,k))
else:
print(a+b*pow(2,k)+c)
else:
if a<c:
print(a+b+c*pow(2,k))
else:
print(a*pow(2,k)+b+c)
main()
|
p02696 | s945925182 | Accepted | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
a, b, n = map(int, input().split())
if n >= b-1:
print((a * (b-1)) // b - a * ((b-1) // b))
else:
print((a * n) // b - a * (n // b)) |
p02953 | s427956218 | Wrong Answer | import sys
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(1,n-1):
if h[i-1]<=h[i]<=h[i+1]:
pass
else:
h[i]-=1
if h[i-1]<=h[i]<=h[i+1]:
pass
else:
print("No")
sys.exit()
print("Yes") |
p02829 | s092746571 | Accepted | a = int(input())
b = int(input())
print(6-a-b) |
p04034 | s159260268 | Accepted | N, M = map(int, input().split())
cnt = [1 for _ in range(N)]
red = [True] + [False for _ in range(N - 1)]
for _ in range(M):
x, y = map(int, input().split())
x -= 1
y -= 1
cnt[x] -= 1
cnt[y] += 1
if red[x]:
red[y] = True
if cnt[x] == 0:
red[x] = False
print(sum(red))
|
p02547 | s704864381 | Wrong Answer | def solve():
n = int(input())
rolls = [list(map(int,input().split())) for i in range(n)]
for i in range(n-3):
if rolls[i][0]==rolls[i][1] and rolls[i+1][0]==rolls[i+1][1] and rolls[i+2][0]==rolls[i+2][1]:
return True
return False
print("Yes" if solve() else "No") |
p02576 | s121215313 | Wrong Answer | import math
n, x, t = map(int, input().split())
print(math.ceil(x/n)*t) |
p03711 | s417051766 | Accepted | x, y = map(int, input().split())
agroup = [1,3,5,7,8,10,12]
bgroup = [4,6,9,11]
if x in agroup and y in agroup:
print('Yes')
elif x in bgroup and y in bgroup:
print('Yes')
else:
print('No') |
p03471 | s316035589 | Wrong Answer | N, Y = map(int,input().split())
A = B = C = -1
for a in range(N+1):
for b in range(N+1-a):
c=N-a-b
if 10000*a+5000*b+1000*c==Y:
A = a
B = b
C = c
print(a, b, c) |
p02598 | s351490431 | Wrong Answer | n, k = map(int, input().split())
A = list(map(int, input().split()))
def check(x):
cnt = 0
for a in A:
if a % x == 0:
cnt += a//x-1
else:
cnt += a//x
return k < cnt
L = 1
R = 10**10
while L != R-1:
M = (L+R)//2
if check(M):
L = M
else:
R = M
print(R)
|
p02924 | s032992565 | Accepted | N = int(input())
print(N*(N-1)//2) |
p02775 | s323686619 | Accepted | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
just, less = 0, INF
for d in input()[::-1]:
d = int(d)
njust = min(just + d, less + d + 1)
nless = min(just + (10-d), less + (9-d))
just, less = njust, nless
print(min(just, less + 1))
resolve() |
p02795 | s767156821 | Wrong Answer | a = int(input())
b = int(input())
c = int(input())
print(c//max(a,b)) |
p02755 | s021729194 | Accepted | from math import floor
a, b = [int(i) for i in input().split()]
for i in range(1, 10**5):
if floor(i*0.08) == a and floor(i*0.1) == b:
print(i)
exit()
print(-1) |
p03719 | s260803760 | Accepted | n=list(map(int,input().split()))
if n[2]>=n[0] and n[2]<=n[1]:
print('Yes')
else:
print('No') |
p03136 | s056177338 | Accepted | n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
x=a[0]
y=sum(a[1:])
print('Yes' if x<y else 'No') |
p02843 | s519614071 | Wrong Answer |
x=int(input())
n = x//100
k = x %100
if n >= 21 :
print(1)
elif n*1 <= k <= n*5:
print(1)
else:
print(0) |
p03555 | s122923698 | Wrong Answer | S1 = input()
S2 = input()
if S1 == S2[::-1]:
print('Yes')
else:
print('No') |
p02777 | s930019552 | Accepted | import sys
INF = 1001001001
def resolve():
s, t = input().split()
a , b = map(int, input().split())
u = input()
if (s == u):
print(a - 1, b)
else:
print(a, b - 1)
return
if __name__ == "__main__":
resolve()
|
p02607 | s446205824 | Wrong Answer | N = int(input())
input_line = list(map(int, input().split(' ')))
ans = 0
for i in range(N):
if((i*input_line[i])%2 == 1):
ans += 1
print(ans)
|
p03087 | s696600615 | Accepted | #ABC 122 C - GeT AC 18:47
n, q = map(int, input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
l,r = map(int, input().split())
print(t[r-1] - t[l-1]) |
p03061 | s758330097 | Wrong Answer | import fractions
N=int(input())
A=list(map(int,input().split()))
A.append(A[0])
ans=0
l=[]
if N==2:
print(max(A))
exit()
for i in range(N):
val=fractions.gcd(A[i],A[i+1])
l.append(val)
print(l[2]) |
p02684 | s013569093 | Wrong Answer | N, K = map(int, input().split())
a = list(map(int, input().split()))
chk = [0] * N
start = -1
ido = [0]
chk[0] = 1
index = 0
cnt = 0
while True:
index = a[index] - 1
if chk[index] == 0:
chk[index] += 1
cnt += 1
ido.append(index)
else:
start = index
break
if cnt >= K:
print(a[ido[K]])
exit()
tmp = ido.index(start)
ido = ido[tmp:]
K -= tmp
print(ido[K % len(ido)] + 1) |
p02618 | s966081555 | Accepted | from random import randint
for i in range(365):
print(randint(1,26)) |
p03721 | s546556576 | Accepted | n, k = map(int, input().split())
ls = [[int(_) for _ in input().split()] for _ in range(n)]
ls.sort()
ln = 0
for i in range(n):
ln += ls[i][1]
if ln >= k:
print(ls[i][0])
break |
p02598 | s146286470 | Wrong Answer | from bisect import *
from heapq import *
import math
mod = 10**9+7
N, K = map(int, input().split())
A = list(map(int, input().split()))
ep = 0.0001
l = 0.0
r = 10**9+1
while l+ep < r:
x = (l+r)/2
k = 0
for a in A:
k += math.ceil(a/x)-1
if k > K:
break
if k <= K:
r = x
else:
l = x
print(math.ceil(l)) |
p03293 | s848198007 | Accepted | s = input()
t = input()
for i in range(len(s)):
if s[i:]+s[:i]==t:
print('Yes')
break
else:
print('No') |
p03013 | s960582725 | Wrong Answer | import sys
input = sys.stdin.readline
MOD = 1000000007
def main():
n, m = [int(i) for i in input().split()]
a = [int(input()) for _ in range(m)]
steps = [0] * (n + 1)
steps[0] = 1
for now in range(n):
for next_ in range(now + 1, min(now + 2, n) + 1):
if next_ not in a:
steps[next_] += steps[now] % MOD
print(steps[-1])
if __name__ == '__main__':
main()
|
p03565 | s122011483 | Accepted | s = input()
t = input()
result = ''
for i in range(len(s)-len(t),-1,-1):
mth = 1
for j in range(len(t)):
if s[i+j] != t[j]:
if s[i+j] == '?':
pass
else:
mth = 0
break
if mth == 1:
# print("i",i)
result = s[:i]+t+s[i+len(t):]
print(result.replace('?','a'))
exit(0)
print("UNRESTORABLE")
|
p02629 | s487464042 | Wrong Answer | N = int(input())
keta = 1
while (N-1)//26**keta >= 1:
keta += 1
for i in range(1, keta):
N -= 26**i
alph = 'abcdefghijklmnopqrstuvwxyz'
ans = []
ans.append(alph[(N%26)-1])
for i in range(1, keta):
num = (N-1)//(26**i)
if num ==0:
ans.append("a")
else:
ans.append(alph[(num%26)])
ans.reverse()
print("".join(ans)) |
p02859 | s522718671 | Accepted | N = int(input())
print(int((N * N * 3) / 3)) |
p02995 | s757763260 | Wrong Answer | import math
A,B,C,D = map(int, input().split())
m = math.floor(B / C) + math.floor(B / D) - math.floor(B / (C*D))
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (C*D))
print(B-A+1-(m-n))
|
p03433 | s720500197 | Accepted | print("YNeos"[int(input())%500>int(input())::2]) |
p03673 | s342280590 | Accepted | from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools
logging.basicConfig(level=logging.ERROR)
input = sys.stdin.readline
setrecursionlimit(1000000)
def main():
n = int(input())
a = list(map(int,input().split()))
ans = list(reversed([a[i] for i in range(1 if n%2==0 else 0,n,2)])) + [a[i] for i in range(0 if n%2==0 else 1,n,2)]
for i in ans:
print(i,end=' ')
print()
main() |
p02993 | s690292889 | Wrong Answer | import collections
S = input()
c = collections.Counter(S)
d = len(c)
if d == 4:
print("Good")
else:
print("Bad")
|
p02768 | s175572390 | Accepted | n, a, b = map(int, input().split())
MOD = 10 ** 9 + 7
def nCk(n, k):
num = 1
for i in range(n, n - k, -1):
num *= i
num %= MOD
tmp = 1
for i in range(1, k + 1):
tmp *= i
tmp %= MOD
num *= pow(tmp, MOD - 2, MOD)
return num
ans = pow(2, n, MOD) - 1
ans -= nCk(n, a)
ans -= nCk(n, b)
print(ans % MOD) |
p02696 | s436366376 | Accepted | import math
a, b, n = map(int, input().split())
x = min(b - 1, n)
ans = math.floor(a * x / b) - a * math.floor(x / b)
print(ans) |
p02760 | s017199937 | Accepted | a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[9:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2]) |
p02778 | s753393273 | Accepted | s = str(input())
for _ in range(len(s)):
print('x',end='') |
p02720 | s038992348 | Wrong Answer | k=int(input())
x=0
ans=0
for i in range(1,10**5):
if x==k:
break
ans+=1
l = [int(x) for x in list(str(i))]
y=0
for j in range(int(len(l))-1):
if l[j]==l[j+1] or l[j]==l[j+1]+1 or l[j]==l[j+1]-1:
y+=1
if y==int(len(l))-1:
x+=1
print(ans) |
p03086 | s280499539 | Accepted | s = input()
count = 0
for i in range(len(s)):
x = 0
for j in range(i,len(s)):
if(s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T'):
x += 1
else:
break
if(count < x):
count = x
print(count) |
p02705 | s171714979 | Accepted | pi = 6.28318530717958623200 / 2
print(pi * int(input()) * 2)
|
p03339 | s911514953 | Wrong Answer | N = int(input())
S = input()
num = [0 for _ in range(N)]
for i in range(1, N):
if S[i] == 'E':
num[0] += 1
for i in range(1, N):
if S[i-1] == 'W':
num[i] = num[i-1] + 1
if S[i] == 'E':
num[i] = num[i-1] + 1
print(min(num)) |
p02602 | s111576023 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(K, N):
print('Yes' if A[i] > A[i - K] else 'No') |
p02696 | s862530123 | Wrong Answer | a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
v = int(a*x/b)- a * int(x/b)
c += 1
if v > max_v:
max_v = v
c = 0
if c > 10000000:
break
print(v) |
p02701 | s129324135 | Accepted | n = int(input())
s = set()
for i in range(n):
s.add(input())
print(len(s)) |
p02633 | s669709084 | Wrong Answer | x=int(input())
import math
K=360/math.gcd(x,360)
print(K)
|
p02612 | s861120320 | Accepted | N = int(input())
if N/1000 == N//1000:
pay = N//1000 * 1000
else:
pay = (N//1000+1)*1000
print(pay-N) |
p03815 | s025530406 | Accepted | import math
x = int(input())
ans = x//11
ans2 = x%11
if x <= 6:
print(1)
elif x<=11:
print(2)
else:
if x%11 == 0:
print(ans*2)
else:
if ans2 > 6:
print(ans*2+2)
else:
print(ans*2+1)
|
p02744 | s733708500 | Wrong Answer | n = int(input())
alp = [chr(v) for v in range(ord("a"), ord("z") + 1)]
results = []
def f(i=0, j=0, s="a"):
if i == n - 1:
return results.append(s)
f(i + 1, j, s + alp[j])
f(i + 1, j + 1, s + alp[j + 1])
f()
print(len(results))
print(*results, sep="\n")
|
p03862 | s744305791 | Accepted | import collections
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
q = collections.deque()
if a[0] <= x:
q.append(a[0])
else:
ans += a[0]- x
q.append(x)
for i in range(1,n):
tmp = q[-1] + a[i]
if tmp <= x:
q.append(a[i])
else:
ans += tmp-x
q.append(x-q[-1])
q.popleft()
print(ans) |
p03657 | s256423525 | Wrong Answer | A, B = map(int, input().split())
if (A + B) % 3 == 0:
print('Possible')
else:
print('Impossible')
|
p04043 | s506013978 | Accepted | a,b,c = map(int,input().split())
A = [a,b,c]
B = [a,b,c]
A = A.count(5)
B = B.count(7)
if A == 2 and B == 1:
print("YES")
else:
print("NO") |
p02952 | s854620056 | Wrong Answer | n = input()
l = int(len(n))
ans = 0
if l == 1:
print(n)
elif l % 2 ==1:
ans += int(n) - 10**(l-1)+1
for i in range(1,l):
if i %2 ==1:
ans += 9*(10**(i-1))
else:
ans = ans
else:
for i in range(1,l):
if i %2 ==1:
ans += 9*(10**(i-1))
else:
ans = ans
print(ans) |
p02631 | s736662845 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(n):
b ^= a[i]
ans = []
for i in range(n):
ap = b ^ a[i]
ans.append(ap)
print(*list(set(ans)))
|
p03557 | s840862343 | Wrong Answer | import bisect
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for a in A:
b_ind = bisect.bisect(B, a)
for b in B[b_ind:]:
c_ind = bisect.bisect(C, b)
ans += (n-c_ind)
print(ans) |
p03001 | s042479562 | Wrong Answer | W, H, x, y = map(int, input().split())
S = W * H
sx = min(W-x, x-0) * H
sy = min(H-y, y-0) * W
sMM = max(sx, sy)
same = 0
if sx > sy:
if sx % W == 0 or W-x != x-0:
same = 1
if sy > sx:
if sy % H == 0 or H-y != y-0:
same = 1
if sx == sy:
same = 1
print(sMM, same) |
p02661 | s438134131 | Accepted | import numpy as np
(n,), *d = [[*map(int, i.split())] for i in open(0)]
a, b = np.median(d, axis=0)
if n%2:print(int(b - a + 1))
else:print(int(b*2 - a*2 + 1)) |
p02916 | s547135986 | Accepted | n = int(input())
an = list(map(int,input().split()))
bn = list(map(int,input().split()))
cn = list(map(int,input().split()))
sat = sum(bn)
for x in range(n-1):
if an[x+1] == an[x] + 1:
sat += cn[an[x]-1]
print(sat)
|
p02786 | s004312139 | Accepted | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys
INF = float('inf')
def solve(H: int):
return 1 if H == 1 else solve(H//2) * 2 + 1
def main():
sys.setrecursionlimit(10 ** 6)
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
H = int(next(tokens)) # type: int
print(f'{solve(H)}')
if __name__ == '__main__':
main()
|
p03103 | s792509862 | Accepted | N, M = map(int, input().split())
AB = [None] * N
for _ in range(N):
AB[_] = list(map(int, input().split()))
AB.sort()
cart = 0
price = 0
j = 0
for i in range(N):
if cart + AB[i][1] > M:
j = i
break
cart += AB[i][1]
price += AB[i][0] * AB[i][1]
price += (M - cart) * AB[j][0]
print(price)
|
p02793 | s006116454 | Accepted | import sys
from fractions import gcd
input = sys.stdin.readline
n = input()
arr = list(map(int, input().split()))
tmp = arr[0]
for i in arr:
tmp = tmp*i//gcd(tmp,i)
print(sum(tmp//a for a in arr) % (10**9+7)) |
p03632 | s921407950 | Accepted | A,B,C,D = map(int, input().split())
if (C > A and C > B) or (A > C and A >D):
time =0
else:
if A < C: # Bの方があとに押した場合
if B < D:
time = B-C
else:
time = D-C
else:
if B<D:
time = B-A
else:
time = D-A
print(time) |
p02576 | s250117167 | Wrong Answer | N, X, T = map(int, input().split())
a = N // X
min_T = T*(a+1)
print(min_T) |
p02724 | s602456328 | Wrong Answer | x=int(input())
happiness=0
if(x>500):
sum_amount=x//500
happiness+=sum_amount*1000
diff=x-happiness/2
z=int(diff/5)
happiness+=z*5
print(happiness)
elif(x<500):
k=int(x/5)
ans=k*5
print(ans)
elif(x==0):
print(x)
|
p03221 | s557551330 | Wrong Answer | from collections import defaultdict
import numpy as np
n, m = map(int, input().split())
list_ans = []
list_y = []
pre_p = -1
p_y = defaultdict(list)
for i in range(m):
p, y = map(int, input().split())
p_y[p].append(y)
for p in p_y.keys():
list_y = p_y[p]
list_num = np.argsort(list_y)
for num in list_num:
ans = str(p).zfill(6) + str(num + 1).zfill(6)
print(ans)
|
p03745 | s429460679 | Wrong Answer | n = int(input())
num_list = list(map(int, input().split()))
ans = 1
cnt_list = [0] * n
for i in range(1,n):
if num_list[i-1] > num_list[i]:
cnt_list[i] = -1
if num_list[i-1] < num_list[i]:
cnt_list[i] = 1
for i in range(1,n-1):
if cnt_list[i] == 1:
if cnt_list[i+1] == -1 or cnt_list[i-1] == -1:
ans+=1
print(ans) |
p02725 | s978022515 | Wrong Answer | k,n,*a=map(int,open(0).read().split())
a+=[k+a[0]]
print(min(y-x for x,y in zip(a,a[1:]))) |
p03986 | s902468794 | Accepted | x = input()
s, t = 0, 0
ols = 0
cnt = 0
for i in x:
if i == "S":
s += 1
else:
if s > 0:
cnt += 1
s -= 1
s = max(s,0)
print (len(x)-cnt*2) |
p03852 | s605062078 | Wrong Answer | import re;
s = input();
print("YES" if re.fullmatch(r'^(dream|dreamer|eraser|erase)*$', s) else "NO")
|
p03219 | s286394527 | Accepted | x,y=map(int,input().split())
print(x+y//2) |
p03219 | s100089629 | Accepted | a,b=list(map(int,input().split()))
print(a+int(b/2)) |
p03665 | s581178261 | Accepted | N, P = map(int, input().split())
A = list(map(int, input().split()))
even = 0
odd = 0
for i in range(N):
if A[i]%2==0:
even += 1
else:
odd += 1
if odd>=1:
ans = pow(2,even+odd-1)
elif P==0:
ans = pow(2,even)
else:
ans = 0
print(ans) |
p03778 | s422743263 | Accepted | w,a,b = map(int,input().split())
ans = 0
if a+w<b:
ans = b-(a+w)
elif b+w<a:
ans = a-(b+w)
print(ans) |
p03281 | s003677075 | Wrong Answer | N = int(input())
counter = 0
ans = 0
for i in range(1,N+1):
for j in range(1, N+1):
if N % j == 0:
counter += 1
if counter == 8:
ans += 1
print(ans)
|
p02835 | s690351047 | Accepted | a, b, c = map(int, input().split())
if a+b+c >= 22:
print('bust')
else:
print('win') |
p02996 | s974022968 | Accepted | N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
B=sorted(A,key=lambda x:x[1])
total=0
a=True
for i in range(N):
total+=B[i][0]
if total>B[i][1]:
print("No")
a=False
break
if a==True:
print("Yes")
|
p02660 | s737117044 | Accepted | n=int(input())
def sieve(x):
p=[2]
b=[1]*x
for i in range(2,x,2): b[i]=0
for i in range(3,x,2):
if b[i]:
p+=[i]
for j in range(2*i,x,i): b[j]=0
return p
def prime_factor(x):
d={}
for i in sieve(int(x**0.5)+1):
while x%i<1: x//=i; d[i]=d.get(i,0)+1
if x<2: break
if x>1: d[x]=1
return d
d=prime_factor(n)
a=0
for i in d.values():
t=c=0
while t+c<i: c+=1; t+=c
a+=c
print(a) |
p02612 | s725620983 | Accepted | n = int(input())
if n%1000 == 0:
print(0)
else:
print(1000-n%1000) |
p03220 | s419575178 | Accepted | n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
dic = []
for i in h:
b = abs(a - (t - i * 0.006))
dic.append(b)
print(dic.index(min(dic)) + 1) |
p03611 | s442033042 | Wrong Answer | import collections
n = int(input())
a = list(map(int,input().split()))
M = 0
c = collections.Counter(a)
for x in range(max(a)):
d = c[x] + c[x-1] + c[x+1]
if d > M:
M = d
print(M) |
p02948 | s763796050 | Wrong Answer | import heapq
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab.sort()
queue = []
flag = 0
heapq.heapify(queue)
ans = 0
for i in range(1,m+1):
for j in range(flag,n):
if ab[j][0] > i:
flag = j
break
heapq.heappush(queue,-ab[j][1])
if queue != []:
k = heapq.heappop(queue)
ans += k
print(-ans) |
p03778 | s732232693 | Accepted | w, a, b = map(int, input().split())
if b > a + w:
print(b - a - w)
elif a > b + w:
print(a - b - w)
else:
print(0) |
p02765 | s622030450 | Accepted | N, R = map(int, input().split())
if N < 10:
InnerRating = 100 * (10 - N)
print(InnerRating + R)
else:
print(R) |
p03696 | s137409601 | Accepted | N = int(input())
S = input()
ans = ''
lcount = 0
rcount = 0
now = 0
for i in range(N):
si = S[i]
if (lcount==0) and (si==')'):
rcount += 1
ans = '(' + ans + ')'
elif si == ')':
lcount -= 1
ans = ans + ')'
if (rcount>=1) and (si=='('):
rcount = 0
lcount = 1
ans = ans + '('
elif si == '(':
ans = ans + '('
lcount += 1
ans = ans + ')'*lcount
print(ans)
|
p03163 | s758351069 | Accepted | N, W = (int(x) for x in input().split())
dp = [0] * (W+1) # Maximum value of items we can carry at weight
for _ in range(N):
w, v = (int(x) for x in input().split())
for cur in range(W, w-1, -1):
dp[cur] = max(dp[cur-w]+v, dp[cur])
print(dp[W]) |
p03773 | s919574926 | Wrong Answer | n,r=map(int,input().split())
print((n+r)//24) |
p02705 | s377358171 | Wrong Answer | R=float(input())
print(R**2*3.141592)
|
p02838 | s160325450 | Wrong Answer | n=int(input())
a=list(map(int, input().split()))
sum=0
for i in range(60):
x=0
for j in a:
if j>>i&1:x+=1
sum+=x*(n-x)*(2**i)
print(int(sum%(1e9+7))) |
p02697 | s407300818 | Accepted | n,m=map(int,input().split())
if n%2==1:
[print(i+1,n-i) for i in range(m)]
else:
[print(i+1,n-i) if i<m/2 else print(i+1,n-i-1) for i in range(m)]
|
p02705 | s464821058 | Accepted | import sys
input = sys.stdin.readline
r = int(input())
import math
print(2*math.pi*r) |
p02657 | s971345958 | Accepted | a, b = map(int, input().split( ))
print(a*b) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.