problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03456 | s437107324 | Accepted | from math import sqrt
a, b = map(int, input().split())
i = 1
while i <= b:
i *= 10
a *= 10
X = a + b
if int(sqrt(X)) ** 2 == X:
print("Yes")
else:
print("No") |
p03475 | s255778673 | Accepted | n = int(input())
C = []
S = []
F = []
for _ in range(n-1):
c,s,f = map(int, input().split())
C.append(c)
S.append(s)
F.append(f)
for i in range(n-2):
ans = C[i]+S[i]
for j in range(i+1, n-1):
if S[j] >= ans:
ans += (S[j]-ans) + C[j]
else:
if (ans-S[j])%F[j] == 0: ans += C[j]
else: ans += F[j] - (ans-S[j])%F[j] + C[j]
print(ans)
print(C[-1]+S[-1])
print(0) |
p03493 | s323486456 | Accepted | print(input().count('1')) |
p03472 | s510806817 | Wrong Answer | import sys
input = sys.stdin.readline
N,H=map(int,input().split())
A=[]
B=[]
for _ in range(N):
a,b=map(int,input().split())
A.append(a)
B.append(b)
amax=max(A)
#print(amax)
b=[]
for i in range(N):
if B[i]>=amax:
b.append(B[i])
b.sort()
#print(b)
cnt=0
while b:
if H>0:
H-=b.pop()
cnt+=1
if H<=0:
#print(cnt)
exit()
cnt+=-(-H//amax)
print(cnt)
|
p02615 | s488874455 | Accepted | import copy
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
count = 0
for i in range(len(a)-1):
count += a[(i+1)//2]
print(count) |
p02900 | s481658812 | Accepted | def gcd(a,b):
while b:
a,b=b,a%b
return a
a,b=map(int,input().split())
g=gcd(a,b)
c=1
for i in range(2,10**6+1):
if g%i==0:
c+=1
while g%i==0:
g//=i
if g!=1:
c+=1
print(c) |
p03145 | s806540604 | Wrong Answer | abc = input()
abc_ls = abc.split()
a = int(abc_ls[0])
b = int(abc_ls[1])
print( a * b / 2 ) |
p03633 | s708959537 | Wrong Answer | from fractions import gcd
n=int(input())
ans=int(input())
for i in range(1,n):
t=int(input())
ans=ans*t/gcd(ans,t)
print(ans) |
p03037 | s573662599 | Accepted | n, m = map(int,input().split())
l = [0]*m
r = [0]*m
for i in range(m):
l1,r1 = map(int,input().split())
l[i] = l1
r[i] = r1
print(max(min(r) - max(l) + 1, 0)) |
p02993 | s079706067 | Wrong Answer | s = list(input())
s = sorted(s)
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
print('Good')
else:
print('Bad') |
p02811 | s142235143 | Accepted | a = list(map(int, input().split()))
if(a[0] * 500 >= a[1]):
print("Yes")
else:
print("No") |
p03803 | s888969573 | Wrong Answer | # 入力
A, B = map(int, input().split())
# 出力
if 1 <= A and B <= 13:
if A == B:
print('Draw')
elif A != 1 and A > B:
print('Alice')
elif B != 1 and B > A:
print('Bob')
elif A == 1:
print('Alice')
elif B == 1:
print('Bob') |
p03494 | s155412535 | Accepted | N = int(input())
As = [int(i) for i in input().split()]
ans = 0
while all([a % 2 == 0 for a in As]):
As = [a // 2 for a in As]
ans += 1
print(ans)
|
p03043 | s981384920 | Accepted | import math
from decimal import Decimal
N, K = map(int, input().split())
win = 0
for i in range(1, N+1):
if K - i < 1:
win += 1
continue
win += (1/2)**(math.ceil(math.log2(K/i)))
#print((math.ceil(math.log2(K/i))))
print('{:.10g}'.format(Decimal(win/N)))
|
p03672 | s144896549 | Accepted | S = input()
leng = len(S)
ans = 1
for i in range(leng-1, 0, -1):
if S[:(i // 2)] == S[i // 2:i]:
ans = max(i, ans)
print(ans)
|
p03345 | s458289957 | Accepted | A,B,C,K = map(int,input().split())
ans = int((A-B)*((-1)**K))
print(ans if abs(ans)< 1e18 else "Unfair")
|
p03043 | s796256209 | Accepted | import math
tmp = 0
big_dice = 0
a,b = map(int, input().split())
log2_b = math.log2(b)
if a > b:
c = b
big_dice = (a - b) / a
else:
c = a
for i in range(1, c + 1):
log2_i = math.log2(i)
n = math.ceil(log2_b - log2_i)
tmp = tmp + 0.5**n
print(tmp / a + big_dice) |
p03773 | s997057911 | Wrong Answer | a,b = map(int,input().split())
if (a+b) >24:
print(a+b - 24)
else:
print(a+b) |
p02601 | s223089097 | Wrong Answer | A, B, C = input().split(" ")
K = int(input())
A, B, C = int(A), int(B), int(C)
for i in range(K):
if A > B:
B = B*2
elif B > C:
C = C*2
if B > A and C > B:
print("Yes")
else:
print("No") |
p03073 | s846578333 | Accepted | import math
import sys
def makestr(i):
if (i % 2 == 0):
return '0'
else:
return '1'
s = input()
candicate1 = ''
candicate2 = ''
for i in range(len(s)):
candicate1 += makestr(i)
candicate2 += makestr(i + 1)
ans1 = 0
ans2 = 0
for i in range(len(s)):
if (candicate1[i] != s[i]):
ans1 += 1
else:
ans2 += 1
print(min(ans1,ans2)) |
p03377 | s995636973 | Wrong Answer | A,B,X = map(int,input().split())
if A<=X<=A+B:
print("Yes")
else:
print("No") |
p02744 | s073419607 | Accepted | from collections import deque
N = int(input())
d = {i:[] for i in range(1, N+1)}
q = deque([(1, "a")])
while q:
pos, s = q.popleft()
if pos == N+1:
break
d[pos].append(s)
size = len(set(s))
for i in range(size+1):
q.append((pos+1, s+chr(97+i)))
for i in d[N]:
print(i) |
p03317 | s144952968 | Accepted | n, k = map(int, input().split())
a = list(map(int, input().split()))
fi = 0
for i in range(n):
if a[i] == 1:
fi = i
break
if (n - 1) % (k - 1) == 0:
print((n - 1) // (k - 1))
else:
print((n - 1) // (k - 1) + 1)
|
p03836 | s332246718 | Accepted | sx, sy, tx, ty = map(int, input().split())
dx, dy = tx - sx, ty - sy
print('R' * dx + 'U' * dy + 'L' * dx + 'D' * dy, end='')
print('D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L', end='')
print('U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R')
|
p04029 | s500874857 | Wrong Answer | n=int(input())
print(n*(n+1)/2) |
p03146 | s336967143 | Accepted | S = int(input())
_set = set()
_set.add(S)
_ = 10**7
cnt = 1
before_num = S
for n in range(_):
cnt += 1
_ = before_num
if _%2==0:
this_num = _/2
else:
this_num = 3*_+1
_set.add(this_num)
if len(_set) < cnt:
ans = cnt
break
before_num = this_num
print(ans) |
p02640 | s421058621 | Accepted | def resolve():
x, y = map(int, input().split())
if y > 4*x:
print('No')
return
if y < 2*x:
print('No')
return
if y % 2 == 0:
print('Yes')
return
print('No')
return
resolve() |
p02727 | s144936602 | Wrong Answer | x,y,a,b,c = map(int,input().split())
print(sum(sorted(sorted(list(map(int,input().split())))[-x:] + list(map(int,input().split()))[-y:] + list(map(int,input().split())))[-x-y:])) |
p02971 | s303889361 | Wrong Answer | N = int(input())
A = []
for i in range(N):
A.append(int(input()))
B = A.copy()
B.sort()
B.reverse()
print(B)
print(A)
for i in range(0,N):
if A[i] == B[0]:
print(B[1])
else:
print(B[0])
|
p03474 | s184628019 | Wrong Answer | a, b = map(int, input().split())
s = input()
if a+b+1 >= 0 and a+b+1 <= 9:
if "-" in s[a] and s.count("-") ==1:
print("Yes")
else:
print("No")
else:
print("No") |
p02723 | s394771084 | Accepted | S = input()
if S[2] == S[3] :
if S[4] == S[5] :
print("Yes")
else :
print("No")
else :
print("No") |
p03633 | s388848091 | Accepted | import fractions
n = int(input())
p = 1
for i in range(n) :
t = int(input())
p = p*t//fractions.gcd(p,t)
print(p) |
p03659 | s023031548 | Accepted | n=int(input())
A=list(map(int,input().split()))
ans=10**20
sumA=sum(A)
x=0
for i in range(n-1):
x+=A[i]
ans=min(ans,abs(sumA-x*2))
print(ans) |
p03449 | s428323206 | Wrong Answer | n = int(input())
a = []
for _ in range(2):
a.append(list(map(int, input().split(" "))))
res = 0
for i in range(n):
res += a[0][i]
if i + 1 == n:
res += a[1][i]
break
sum_row_1 = sum(a[0][i + 1:n])
sum_row_2 = sum(a[1][i + 1:n])
if sum_row_1 <= sum_row_2:
res += sum(a[1][i:n])
break
print(res)
|
p03774 | s055012594 | Wrong Answer | N,M = map(int,input().split())
place = [list(map(int,input().split())) for _ in range(N)]
check = [list(map(int,input().split())) for _ in range(M)]
for x,y in place:
tmp = 10**9
for i in range(M):
dis = ((x-check[i][0])**2 + (y-check[i][1])**2)**(1/2)
if tmp > dis:
tmp = dis
ans = i+1
print(ans) |
p02995 | s700582447 | Accepted | from math import floor
from fractions import gcd
A, B, C, D = map(int,input().split())
lcm = (C*D) // gcd(C,D)
bc = B // C
bd = B // D
bcd = B // lcm
ac = (A-1) // C
ad = (A-1) // D
acd = (A-1) // lcm
ans = B-bc-bd+bcd-(A-1-ac-ad+acd)
print(ans) |
p02910 | s624171923 | Wrong Answer | s = input()
howmany = len(s)
judge = "Yes"
for x in range(howmany):
if x % 2 == 0:
if s[x] != "L" and s[x] != "U" and s[x] != "D":
judge = "No"
break
else:
if s[x] != "R" and s[x] != "U" and s[x] != "D":
judge = "No"
break
print(judge)
|
p02688 | s360078523 | Wrong Answer | n,k=map(int,input().split())
for i in range(k):
d=int(input())
a=set(int(i) for i in input().split())
print(n-len(set(a)))
|
p02612 | s992581052 | Accepted | #!/usr/bin/env python3
def main():
N = int(input())
if N%1000 == 0:
ans = 0
else:
ans = 1000 - N % 1000
print(ans)
if __name__ == "__main__":
main()
|
p02859 | s634320362 | Accepted | print(int(input())**2) |
p02911 | s675376682 | Wrong Answer | n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
dat = dict(zip(range(1, n+1), [k]*n))
cnt = 0
for i in range(1, n+1):
for j in a:
if i != j:
dat[i] -= 1
for k in range(1, n+1):
if dat[k] <= 0:
print('No')
else:
print('yes')
|
p02724 | s547393764 | Accepted | total = int(input())
a = (total // 500 * 1000)
b = (total % 500) // 5 *5
print(a+b)
|
p03220 | s934983809 | Accepted | n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
temp = 100000
index = 0
for i in range(n):
c = t - listh[i] * 0.006
diff = abs(c-a)
if temp > diff:
temp = diff
index = i+1
print(index)
|
p03043 | s743356492 | Wrong Answer | import math
n,k=map(int,input().split())
kari=1
ctr=0
while kari<=k:
kari*=2
ctr+=1
num=0
acc=0
p=0
for i in range(ctr+1):
if 10/(2**i)<n:
num=math.ceil(n-(10/(2**i)))
pro=num-acc
acc=num
p+=(pro/n)*(1/2)**i
print(p) |
p02784 | s294544273 | Wrong Answer | a,b = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
if b<2:
print("No")
exit()
if sum(L) >= a:
print("Yes")
else:
print("No") |
p04034 | s090856328 | Accepted | N,M=map(int,input().split())
num=[1]*N
ex=[0]*N
ex[0]=1
P=[]
ans=1
for i in range(M):
x,y=map(int,input().split())
num[x-1]-=1
num[y-1]+=1
if ex[x-1]==1 and ex[y-1]==0:
ex[y-1]=1
if num[x-1]==0:
ex[x-1]=0
print(sum(ex)) |
p02578 | s066547951 | Accepted | n = int(input())
a = list(map(int, input().split()))
k = 0
m = a[0]
for i in range(1, n):
if m > a[i]:
k += m-a[i]
else:
m = a[i]
print(k) |
p03284 | s779940987 | Accepted | N,K=map(int,input().split())
if N%K==0:
print(0)
else:
print(1) |
p03264 | s079209738 | Wrong Answer | n=int(input())
print((n//2)*(n+1)//2) |
p03494 | s785551975 | Accepted | input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a/2 for a in A]
count += 1
print(count) |
p03803 | s575971335 | Wrong Answer | A,B=map(int,input().split())
if A==B: print('Draw')
else: print('Alice' if (A > B or (A==1 and B==13)) else 'Bob') |
p03069 | s352251351 | Accepted | n=int(input())
s=input()
w_num=0
b_num=0
w_l=[0]
b_l=[0]
for i in s:
if i=='.':
w_num+=1
else:
b_num+=1
w_l.append(w_num)
b_l.append(b_num)
ans=10**5
for i in range(n+1):
ans=min(ans,b_l[i]+(w_num-w_l[i]))
print(ans) |
p03035 | s391364062 | Accepted | a,b=map(int,input().split())
if a>=13:
print(b)
elif 6<=a<=12:
print(b//2)
else:
print(0) |
p03838 | s974810120 | Accepted | x, y = map(int, input().split())
if y*x < 0:
ans = abs(x + y) + 1
elif y*x == 0:
if x < y:
ans = y - x
else:
ans = x - y + 1
else:
if x < y:
ans = y - x
else:
ans = x - y + 2
print(ans) |
p02552 | s042676049 | Accepted | x = int(input())
if x == 1:
print(0)
else:
print(1) |
p02753 | s113472938 | Wrong Answer | import sys
a = sys.argv
if a == "aaa" and a == "bbb":
print("No")
else:
print("Yes")
|
p03544 | s079733774 | Wrong Answer | n=int(input())
a=2
b=1
c=3
i=0
while i<n:
d=a
e=b
a=b
b=c
c=a+b+c
i=i+1
print(a) |
p03076 | s661701190 | Wrong Answer | A=[]
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
count=0
rem=10
for t in A:
if t%10==0:
count+=t
else:
count+=(((t//10)+1)*10)
if t%10<10:
rem=t%10
print(count-10+rem) |
p03417 | s945138965 | Wrong Answer | n, m = map(int, input().split())
if n == m == 1:
print(0)
elif min(n, m) == 1:
print(max(n,m)-2)
elif min(n,m) == 2:
print(0)
else:
print((n-2) * (m-2))
|
p03327 | s729201001 | Wrong Answer | n = int(input())
if n <= 9:
print("ABC00"+str(n))
elif n <= 99:
print("ABC0"+str(n))
elif n <= 999:
print("ABC"+str(n))
elif n <= 1008:
print("ABD00"+str(n-999))
elif n <= 1098:
print("ABD0"+str(n-999))
else:
print("ABD"+str(n-999)) |
p02647 | s702717740 | Accepted | N,K = map(int,input().split())
A = list(map(int,input().split()))
def s(n,a):
b = [0]*n
for i in range(n):
l = max(0,i-a[i])
r = min(n-1,i+a[i])
b[l] += 1
if r < n - 1:
b[r+1] -= 1
for i in range(n-1):
b[i+1] += b[i]
return b
for i in range(min(41,K)):
A = s(N,A)
print(*A)
|
p02823 | s302792910 | Accepted | n,a,b = map(int, input().split())
def F(n,a,b):
#ab間にある要素の数が偶数
if (b-a)%2==0:
return (b-a)//2
#左端で止まる
tmp = []
#左側からみて
x = (a-1)+(b-1)+1
tmp.append(x//2)
#右側からみて
x = (n-a)+(n-b)+1
tmp.append(x//2)
return min(tmp)
print(F(n,a,b)) |
p04043 | s238915270 | Wrong Answer | ABC = input().split()
print('YES' if ABC.count('5') == 2 and ABC.count('7') == 1 else 'N0') |
p02785 | s328897545 | Wrong Answer | N, K = map(int,input().split())
H = list(map(int,input().split()))
H.reverse()
cnt = 0
print(sum(H[K:])) |
p02847 | s790114635 | Accepted | s = input()
days = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(len(days)):
if days[i] == s:
print(7 - i) |
p03795 | s730471783 | Accepted | N = int(input())
print(N * 800 - (N // 15) * 200) |
p03998 | s419682168 | Wrong Answer | dic_s = {x:input() for x in 'abc'}
dic_i = {x:i for x,i in zip('abc',[0,0,0])}
dic_max = {x:len(dic_s[x]) for x in 'abc'}
nt = 'a'
while True:
if dic_max[nt] == dic_i[nt]:
break
else:
nt = dic_s[nt][dic_i[nt]]
dic_i[nt] += 1
print(nt.upper()) |
p03910 | s100932688 | Wrong Answer | # https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_b
n = int(input())
i = 1
while i * (i + 1) // 2 <= n:
i += 1
ans = []
while n > 0 and i > 0:
if n >= i:
n -= i
ans.append(i)
i -= 1
for a in ans:
print(a)
|
p02939 | s317295778 | Accepted | S = input()
cnt = 1
now = S[0]
tmp = ""
for s in S[1:]:
tmp += s
if now != tmp:
cnt += 1
now = tmp
tmp = ""
print(cnt)
|
p03408 | s167397146 | Accepted | from collections import Counter
N = int(input())
s_counter = Counter()
for _ in range(N):
s = input()
s_counter[s] += 1
M = int(input())
t_counter = Counter()
for _ in range(M):
t = input()
t_counter[t] += 1
max_profit = 0
for key in s_counter.keys():
max_profit = max([max_profit, s_counter[key] - t_counter[key]])
print(max_profit) |
p02683 | s605772590 | Accepted | from itertools import combinations
import numpy as np
n,m,x = map(int, input().split())
q = [np.array(list(map(int, input().split()))) for _ in range(n)]
L=[]
for i in range(1,n+1):
for j in list(combinations(q,i)):
S = np.sum(j, axis=0)
if all([k >= x for k in S[1:]]):
L.append(S[0])
if len(L) >0:
print(min(L))
else:
print(-1)
|
p02684 | s774354532 | Accepted | import numpy as np
N, K = (int(i) for i in input().split())
A = [int(i) - 1 for i in input().split()]
N = len(A)
def get_keys_from_value(d, val):
return [k for k, v in d.items() if v == val][0]
now = 0
lis = []
p = {}
for i in range(N):
now = A[now]
if now in p:
break
p[now] = i
lis.append(now)
if K < i:
print(lis[K-1] + 1)
else:
print(lis[(K-i-1) % (i - p[now]) + p[now]] + 1)
|
p04045 | s392401321 | Accepted | N, K = map(int, input().split())
D = set(input().split())
n = N
while True:
d = set(list(str(n)))
check = D & d
if len(check) == 0:
break
n += 1
print(n)
|
p02760 | s564114844 | Accepted | a = []
for i in range(3):
a.append(list(map(int,input().split())))
for i in range(int(input())):
b = int(input())
for j in range(3):
for k in range(3):
if a[j][k] == b:
a[j][k] = 0
def bingo():
for i in range(3):
if sum(a[i]) == 0 or a[0][i] + a[1][i] + a[2][i] == 0:
return 'Yes'
if a[0][0] + a[1][1] + a[2][2] == 0 or a[0][2] + a[1][1] + a[2][0] == 0:
return 'Yes'
return 'No'
print(bingo()) |
p02681 | s820440606 | Accepted | def c167(x):
if x[1][:-1] == x[0]: return "Yes"
else: return "No"
if __name__=="__main__":
input1 = input()
input2 = input()
input3 = [input1,input2]
print(c167(input3))
|
p03838 | s054528322 | Wrong Answer | x, y = map(int, input().split())
if 0 <= x and x <= y:
print(y-x)
elif x < 0 and 0 <= y:
if abs(x) <= y:
print(1 + y - abs(x))
else:
print(-y-x+1)
elif x < y and y < 0:
print(y-x)
elif 0 <= y and y <= x:
print(1-y+x+1)
elif y < 0 and 0 <= x:
if abs(y) <= x:
print(1+y+x)
else:
print(-y-x+1)
elif y < x and x < 0:
print(1-y+x+1) |
p03719 | s979315871 | Accepted | a,b,c = map(int,input().split())
print("Yes" if a <= c <= b else "No") |
p03817 | s119082440 | Accepted | def main():
x = int(input())
answer = (x // 11) * 2
if 1 <= x % 11 <= 6:
answer += 1
elif 7 <= x % 11:
answer += 2
print(answer)
if __name__ == '__main__':
main()
|
p03243 | s145098900 | Wrong Answer | n = list(input())
n.sort(reverse=True)
print(int(n[0]+n[0]+n[0])) |
p03331 | s524646751 | Wrong Answer | n=int(input())
m=0
for x in range(1,n//2+1):
y=n-x
x,y=list(str(x)),list(str(y))
z=sum(list(map(int,x)))+sum(list(map(int,y)))
m=min(m,z)
print(m) |
p03699 | s333017220 | Accepted | N = int(input())
ls = []
for i in range(N):
ls.append(int(input()))
sum1 = sum(ls)
ls.sort()
ans = 0
if sum1 % 10 != 0:
ans = sum1
else:
for i in range(N):
if (sum1-ls[i]) % 10 != 0:
ans = sum1-ls[i]
break
print(ans) |
p03434 | s323052946 | Accepted | N = int(input())
Z = list(map(int, input().split()))
Z.sort(reverse=True)
A = sum([Z[i] if i % 2 == 0 else 0 for i in range(N)])
B = sum([Z[i] if i % 2 == 1 else 0 for i in range(N)])
print(A-B) |
p03627 | s931272648 | Accepted | N = int(input())
A = list(map(int,input().split()))
d = dict()
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
M = 0
N = 0
for x in d.items():
if x[1] >= 4 and x[0] > M:
M = x[0]
N = x[0]
elif x[1] >= 2 and x[0] > M:
N = M
M = x[0]
elif x[1] >= 2 and x[0] > N:
N = x[0]
print(M*N)
|
p02683 | s774071830 | Wrong Answer | N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for _ in range(N)]
print(CA)
max_=10**16
ans=max_
for bit in range(2**N):
check=[0]*M
ans_=0
for i in range(N):
if bit>>i&1:
ans_+=CA[i][0]
for j in range(M):
check[j]+=CA[i][j+1]
if all([k>=X for k in check]):
ans=min(ans,ans_)
print(ans if ans!=max_ else -1)
|
p02570 | s007773700 | Accepted | d,t,s = map(int, input().split())
if d/s <= t:
print("Yes")
else:
print("No") |
p03779 | s692731443 | Accepted | x = int(input())
for i in range(10**6):
if i*(i+1)//2 >= x:
print(i)
exit()
|
p03106 | s924706797 | Wrong Answer | a,b,k = map(int,input().split())
ans = []
for i in range(1,101):
if a % i == 0 and b % i == 0:
ans.append(i)
print(ans[k-1]) |
p02842 | s493082343 | Accepted | N=int(input())
for i in range(1,N+1):
if i*108//100 == N:
print(i)
break
else:
print(":(") |
p03861 | s172110884 | Accepted | a, b, x = map(int, input().split())
if a % x == 0:
if b % x == 0:
print(b // x - a // x + 1)
else:
print(b // x - a // x + 1)
else:
if b % x == 0:
print(b // x - a // x)
else:
print(b // x - a // x) |
p03910 | s934115310 | Wrong Answer | # https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_b
n = int(input())
i = 1
while i * (i + 1) // 2 <= n:
i += 1
ans = []
while n:
if n >= i:
n -= i
ans.append(i)
i -= 1
for a in ans:
print(a) |
p03137 | s200813195 | Accepted | n,m = map(int,input().split())
a = sorted(list(map(int,input().split())))
dst = [0]*(m-1)
for i in range(m-1):
dst[i] = abs(a[i+1]-a[i])
dst.sort(reverse=True)
print(sum(dst[n-1::])) |
p03861 | s359896348 | Wrong Answer | a, b, x = map(int, input().split())
count = 0
if a % x == 0:
print((b-a)//x + 1)
else:
print((b-a)//x) |
p02621 | s411616672 | Accepted | a = int(input())
print(a+a**2+a**3)
|
p03457 | s463341106 | Accepted | N, *T = map(int, open(0).read().split())
d_t, d_x, d_y = 0, 0, 0
for t, x, y in zip(T[::3], T[1::3], T[2::3]):
dist = abs(d_x - x) + abs(d_y - y)
if t - d_t - dist < 0 or (t - d_t - dist) % 2:
print("No")
break
d_t, d_x, d_y = t, x, y
else:
print("Yes")
|
p03730 | s850203166 | Wrong Answer | a, b, c = map(int, input().split())
ans = ''
if a % b == 0:
if c == 0:
ans = 'YES'
else:
ans = 'NO'
else:
k = a % b
for x in range(c+1):
if (k * x) % b == c:
ans = 'YES'
break
else:
ans = 'NO'
print(ans)
|
p02601 | s813096603 | Accepted | A, B, C = [int(n) for n in input().split()]
K = int(input())
ans = 'No'
for i in range(K+1):
for j in range(K+1):
if A < B<<i < C<<j and i+j<=K:
ans = 'Yes'
break
print(ans)
|
p03607 | s758979815 | Accepted | from collections import *
N = int(input())
C = Counter([int(input()) for n in range(N)])
A = [1 for v in C.values() if v%2==1]
print(sum(A)) |
p03672 | s498931914 | Wrong Answer | #!/usr/bin/env python3
import sys
def solve(S: str):
for i in reversed(range(1, len(S) // 2)):
if S[:i] == S[i:2 * i]:
print(2 * i)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
S = next(tokens) # type: str
solve(S)
if __name__ == '__main__':
main()
|
p02555 | s521440898 | Accepted | def resolve():
base = 10**9+7
S = int(input())
dp = [0] * (S+1)
dp[0] = 1
for i in range(3, S+1):
dp[i] = dp[i-1] + dp[i-3]
# print(dp)
print(dp[S]%base)
if __name__ == "__main__":
resolve() |
p02618 | s673504504 | Wrong Answer | import numpy as np
D = int(input())
c = np.array(list(map(int, input().split())))
s = [list(map(int, input().split())) for _ in range(D)]
last_d = np.array([0]*len(c))
ans = 0
for i in range(D):
cc = c*(last_d+i+1)
max_c = max(cc)
index = np.argmax(cc)
print(index + 1)
last_d[index] = -(i+1)
ans += s[i][index]
cc[index] = 0
for j in cc:
ans -= j
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.