problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03324 | s135758952 | Accepted | D,N=map(int,input().split());print(100**D*[N,101][N>99]) |
p02759 | s256425204 | Accepted | import math
n = int(input())
m = math.ceil(n/2)
print(m)
|
p02910 | s230526082 | Accepted | s = input()
for i, s_i in enumerate(s):
index = i + 1
if index % 2 == 0:
if s_i in 'LUD':
continue
else:
print('No')
break
else:
if s_i in 'RUD':
continue
else:
print('No')
break
else:
print('Yes') |
p03359 | s933274149 | Wrong Answer |
a,b = map(int,input().split())
a_list = [i for i in range(1,a+1)]
b_list = [i for i in range(1,b+1)]
a_len = len(a_list)
b_len = len(b_list)
if a_len <= b_len:
print(a_len)
elif a_len == b_len:
print(a_len)
elif a_len>=b_len:
ans = a_len-b_len
print(ans) |
p02756 | s297851688 | Accepted | from collections import deque
S = input()
S = deque(S)
Q = int(input())
flipped = False
for _ in range(Q):
q = input().split()
if q[0] == '1':
flipped = not flipped
elif (q[1] == '1') == flipped:
S.append(q[2])
else:
S.appendleft(q[2])
print(''.join(reversed(S)) if flipped else... |
p03493 | s370215480 | Accepted | val = input()
vals = list(val)
sum=0
for v in vals:
sum += int(v)
print(sum) |
p03607 | s013902107 | Wrong Answer | n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
ans=[]
prev_a=a.pop()
num=1
for i in range(n-1):
current_a = a.pop()
if prev_a == current_a:
num+=1
else:
if num%2!=0:
ans.append(current_a)
if len(a)==0:
ans.append(current_a)
num=1
pre... |
p03779 | s229778304 | Accepted | X = int(input())
a = 0
b = 1
while a < X:
a += b
b += 1
print(b-1) |
p04020 | s554845877 | Wrong Answer | n = int(input())
ai = [int(input()) for i in range(n)]
ans = 0
nokori = 0
for i in range(1,n):
ans += ai[i] // 2
if ai[i] % 2 == 1:
if ai[i-1] == 1:
ans += 1
else:
ai[i] = 1
print(ans) |
p03448 | s999924023 | Accepted | a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i*500 + j*100 + k*50 == x:
cnt += 1
print(cnt) |
p02723 | s185893000 | Accepted | S = input()
if S[2] == S[3] and S[4] == S[5]:
print('Yes')
else:
print('No') |
p02767 | s163419966 | Accepted | n = int(input())
x = list(map(int, input().split()))
hpmin = (100 ** 2) * 100
for p in range(1, 101):
hp = 0
for j in range(n):
hp += (x[j] - p) ** 2
if hp < hpmin:
hpmin = hp
print(hpmin) |
p03455 | s498939015 | Accepted | a, b = map(int, input().split())
if (a*b) % 2 == 0:
print("Even")
else:
print("Odd") |
p02618 | s608697413 | Accepted | d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
lastd = [0] * 26
for i in range(d):
ans = 0
tmp = 0
for j in range(26):
if tmp < s[i][j] + (i - lastd[j] + 1) * c[j]:
tmp = s[i][j] + (i - lastd[j] + 1) * c[j]
ans = ... |
p02779 | s836484728 | Accepted | N = map(int, input())
A = list(map(int ,input().split(' ')))
print('YES') if len(set(A))==len(A) else print('NO') |
p03000 | s645540507 | Accepted | n, x = map(int, input().split())
l = list(map(int, input().split()))
cnt = 1
position = 0
for i in range(n):
position += l[i]
if position <= x:
cnt += 1
else:
break
print(cnt) |
p03495 | s139631089 | Wrong Answer | from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
aa = Counter(a)
ans = 0
if len(aa) > k:
value = sorted(aa.values())
ans = sum(value[:k-len(aa)-1])
print(ans) |
p03293 | s220693532 | Wrong Answer | s = sorted(list(input()))
t = sorted(list(input()))
if s == t:
print("Yes")
else:
print("No") |
p02732 | s763436616 | Accepted | N = int(input())
A = list(map(int,input().split()))
box = [0]*(N+1)
for i in range(N) :
box[A[i]] += 1
x = list(map(lambda x: x*(x-1)//2 , box))
ans = sum(x)
for j in range(N) :
print(ans-(box[A[j]] - 1))
|
p03827 | s280309966 | Wrong Answer | S=input()
max_v =0
v =0
for i in S:
if i=="I":
v+=1
if v>max_v:
max_v=v
else:
v-=1
|
p03417 | s232465795 | Accepted | n, m = map(int, input().split())
if n == m == 1:
print(1)
elif n == 1 or m == 1:
print(max(n, m)-2)
else:
print((m-2)*(n-2)) |
p02880 | s125194316 | Wrong Answer | integer = int(input())
for i in range(9):
for j in range(9):
if (i + 1) * (j + 1) == integer:
print('Yes')
break
else:
print('No') |
p02719 | s967271728 | Accepted | a,b= map(int, input().split())
min = 1000000000000000000000000000000
if a <= b:
while min > abs(a-b):
min = abs(a-b)
a =abs(a-b)
else :
a = a%b
while min > abs(a-b):
min = abs(a-b)
a = abs(a-b)
print(min) |
p02988 | s902838518 | Accepted | n = int(input())
p = list(map(int, input().split()))
a = 0
for i in range(1, n-1):
if (p[i-1] < p[i] < p[i+1]) or (p[i+1] < p[i] < p[i-1]):
a += 1
print(a)
|
p02663 | s500569368 | Accepted | from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache #use @... |
p02714 | s280098508 | Accepted | # D - RGB Triplets
from collections import defaultdict
def main():
_, S = open(0).read().split()
indices, doubled_indices = defaultdict(list), defaultdict(set)
for i, c in enumerate(S):
indices[c].append(i)
doubled_indices[c].add(2 * i)
cnt = S.count("R") * S.count("G") * S.count("B")
... |
p03548 | s600963300 | Accepted | x,y,z=map(int,input().split())
i=(x-(y+2*z))//(y+z)
print(i+1) |
p02633 | s827575819 | Accepted | a = int(input())
k = 0
t = 1
count = 0
while t == 1 :
k = k + a
count = count + 1
if k % 360 == 0 :
break
print(count) |
p02759 | s303205873 | Wrong Answer | N = int(input())
num = N/2
if N%2==0:
print(num)
else:
print(round(num+0.5))
|
p03860 | s416622644 | Accepted | s=input().split()[1][0]
print("A"+s+"C") |
p02792 | s905529585 | Accepted | # -*- coding: utf-8 -*-
import numpy as np
def pair(N):
b=int(N)%10
a=int(N)
k=a//10
while k!=0:
a=k%10
k=k//10
return a,b
N=int(input())
P=np.zeros((10,10),dtype=np.int32)
ans=0
for i in range(1,N+1,1):
a,b=pair(i)
P[a][b]+=1
for i in range(1,10,1):
for j in range(1,10,... |
p03146 | s433081258 | Wrong Answer | import sys
s=int(input())
dp=[0]*1000001
dp[1]=s
cnt=1
for i in range(1000001):
if s%2==1:
s=3*s+1
else:
s//=2
cnt+=1
if dp[s]==1:
print(cnt)
sys.exit()
else:
dp[s]=1 |
p02548 | s179879942 | Accepted | n = int(input())
a, b, c = 0, 0, 0
cnt = 0
for a in range(1, n):
b = n // a
if a*b == n:
cnt += b - 1
else:
cnt += b
print(cnt)
|
p02911 | s288147571 | Accepted | N, K, Q = map(int,input().split())
A = [0] * N
for i in range(Q):
a = int(input())
A[a-1] += 1
print('\n'.join(['No' if K-Q+e <= 0 else 'Yes' for e in A])) |
p03835 | s769676442 | Accepted | k, s = map(int, input().split())
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s - x - y
if 0 <= z <= k:
ans += 1
print(ans) |
p02813 | s282107082 | Accepted | import math
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
pp = sorted(p)
qq = sorted(q)
x = 0
y = 0
l = 1
m = 1
for i in p[:n-1]:
x += math.factorial(n-l)*pp.index(i)
l += 1
pp.remove(i)
del p[0]
for j in q[:n]:
y += math.factorial(n-m)*qq.index(j)
... |
p03632 | s096972244 | Wrong Answer | A,B,C,D=map(int,input().split())
if C<=A and B<=D:
print(B-A)
elif C<=A and D<=B:
print(D-A)
elif B-C>=0 and B<=D:
print(B-C)
elif B-C>=0 and B>=D:
print(D-C)
elif C>B:
print(0) |
p02696 | s751514578 | Accepted | def resolve():
import math
a, b, n = map(int, input().split())
if b<= n:
x = b-1
else:
x = n
print(math.floor(a*x/b) - a*math.floor(x/b))
resolve() |
p03011 | s235919165 | Wrong Answer | import heapq
pqr = list(map(int,input().split()))
sum(heapq.nlargest(2,pqr)) |
p02996 | s974027638 | Accepted | # https://atcoder.jp/contests/abc131/tasks/abc131_d
n=int(input())
ab=sorted([tuple(map(int,input().split())) for _ in range(n)],key=lambda x: x[1])
time=0
for a,b in ab:
if time+a>b:
print('No')
exit()
time+=a
else:
print('Yes') |
p02633 | s593952693 | Wrong Answer | x =int(input())
print(360/x) |
p03804 | s607046410 | Accepted | def check(s,t):
for i in range(s,s+M):
for j in range(t,t+M):
if A[i][j] != B[i-s][j-t]:
return False
return True
N,M = map(int,input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N-M+1):
for j in range(N-M+1):
... |
p03612 | s623676131 | Accepted | N=int(input())
pn=list(map(int,input().split()))
check=[0]*N
for i in range(0,N):
if pn[i]!=(i+1):
check[i]=1 #ok
i=0
count=0
while i<N-1:
if check[i]==0:#if ng
pn[i],pn[i+1]=pn[i+1],pn[i]
count+=1
check[i],check[i+1]=1,1
i+=1
pass
if check[i]==0:count+=1
print(count)
|
p02820 | s052196731 | Wrong Answer | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
win = {"r":"p","s":"r","p":"s"}
point = {"r":r,"s":s,"p":p}
ans = []
sum = 0
for i in range(k):
ans.append(win[t[i]])
sum+=point[win[t[i]]]
for i in range(k,n):
if win[t[i]] == ans[i - k]:
ans.append(t[i])
else... |
p02621 | s499693245 | Wrong Answer | import sys
input = sys.stdin.readline()
print(input) |
p03319 | s073165357 | Wrong Answer | n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = n//k + (n%k)
print(ans) |
p03252 | s468508469 | Wrong Answer | from collections import Counter
S = input()
T = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
S_counter = Counter(S)
T_counter = Counter(T)
flag = True
for i in alphabet:
S_cnt = S_counter[i]
T_cnt = T_counter[i]
if S_cnt != T_cnt and S_cnt != 0 and T_cnt != 0:
flag = False
print('Yes' if fl... |
p02946 | s555298194 | Accepted | K, X = map(int, input().split())
print(*[i for i in range(X-K+1, X+K)]) |
p02792 | s731612503 | Accepted | import numpy as np
n = int(input())
a = 10
b = 0
x = np.zeros((10, 10, ))
for i in range(1,n+1):
while (i // a != 0):
a = a * 10
c = (i * 10) // a
d = i % 10
x[c][d] += 1
for i in range(0,10):
for j in range(0,10):
b += int(x[i][j] * x[j][i])
print(b) |
p02708 | s207835644 | Accepted | n, k = map(int, input().split())
ans = 0
for i in range(k,n+2):
su = (n+n-i+1)*i//2-i*(i-1)//2+1
ans += su
print(int(ans%(10**9+7))) |
p02783 | s973838645 | Accepted | a = 0
li = input().split()
li = [int(i) for i in li]
while 0 < li[0]:
a += 1
li[0] -= li[1]
print(a) |
p02623 | s639248429 | Accepted | from bisect import bisect_right
from numpy import cumsum
n, m, k = map(int, input().split())
alst = list(map(int, input().split()))
blst = list(map(int, input().split()))
a_cum = cumsum(alst)
b_cum = cumsum(blst)
ans = bisect_right(b_cum, k)
for i, num in enumerate(a_cum, start = 1):
if num > k:
break
... |
p03161 | s078786990 | Accepted | import sys
import numpy as np
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = np.zeros(N, dtype=int)
h = np.array(h)
for i in range(1, N):
start = max(0, i-K)
dp[i] = min(dp[start:i] + np.abs(h[start:i]-h[i]))
print(dp[N-1]) |
p03481 | s835743545 | Accepted | import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
x, y = map(int, input().split()) # 入力が複数
ans = 0
while x <= y:
x *= 2
ans += 1
print(ans) |
p02838 | s070350526 | Wrong Answer | import numpy as np
N=int(input())
M=10**9+7
A=[int(x) for x in input().split()]
A=np.array(A)
ans=0
for i in range(60):
#one=sum([a>>i&1 for a in A])
one=np.sum(A>>i&1)
zero=N-one
ans+=(one*zero)*pow(2,i)
ans%=M
#print(one,zero)
print(ans) |
p02727 | s244230258 | Wrong Answer | x,y,a,b,c=map(int,input().split())
red=sorted(list(map(int,input().split())),reverse=True)
green=sorted(list(map(int,input().split())),reverse=True)
white=sorted(list(map(int,input().split())),reverse=True)
eat_list=sorted(red[:x]+green[:y])
for i in range(min(len(eat_list),len(white))):
if eat_list[i]<white[i]:
... |
p02836 | s113545689 | Wrong Answer | R=0
S=input()
c=len(S)
for i in range(c//2+1):
if S[i]!=S[c-i-1]:
R=R+1
print(R) |
p03371 | s174684047 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 10 ** 18
for i in range(0, 2 * max(X, Y) + 1, 2):
tmpx = X - (i // 2)
if tmpx <= 0:
tmpx = 0
tmpy = Y - (i // 2)
if tmpy <= 0:
tmpy = 0
ans = min(ans, (i * C) + (tmpx * A) + (tmpy * B))
print(ans) |
p02694 | s313826126 | Accepted | x=int(input())
c=100
time=0
while c<x:
c+=c//100
time+=1
print(time)
|
p02576 | s442794907 | Wrong Answer | list = list(map(int,input().split( )))
if list[0] % list[1] == 0:
time = list[2]*list[0]/list[1]
else :
time = list[2]*(list[0]/list[1]+1)
print (time) |
p03814 | s201186313 | Wrong Answer | s=input()
for i in range(len(s)):
if s[i]=="A":
x=i#"A"のインデックス番号
break
for i in range(len(s)):
if s[-i]=="Z":
y=len(s)-i#"Z"のインデックス番号
break
ans=y-x+1
print(ans) |
p02657 | s006068641 | Accepted | a,b = map(int,input().split())
print(a*b) |
p02756 | s718209287 | Accepted | s=input()
q=int(input())
order=1
header=''
footer=''
for _ in range(q):
tmp=input()
if tmp=='1':
order*=-1
else:
t, f, c=tmp.split()
if (int(f)*order)%3==1:
header=c+header
else:
footer=footer+c
s=header+s+footer
print(s) if order==1 else print(s[::-1]) |
p02645 | s605833468 | Accepted | dazy = input()
print(dazy[:3]) |
p03386 | s525112527 | Accepted | a,b,k=map(int,input().split())
r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):print(i) |
p02618 | s778913922 | Accepted | import numpy as np
D = int(input())
c = np.array( list(map(int, input().split())) )
#
s = [[] for i in range(D)]
for i in range(D):
s[i] = np.array( list(map(int, input().split())) )
#
v = 0
cc = np.array( [0]*26 )
last = np.array( [-1]*26 )
for d in range(D):
cc += c
av = s[d] - sum( cc ) + cc
m = max(av)
... |
p02608 | s865715635 | Accepted | n=int(input())+1
table0=[0]*10001
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
r=x*x+y*y+z*z+x*y+y*z+x*z
if r<n:
table0[r]+=1
for i in range(1,n):
print(table0[i]) |
p03625 | s085226754 | Wrong Answer | num = int(input())
arr = {}
for i in input().split(" "):
i = int(i)
if arr.get(i, False):
arr[i] += 1
else:
arr[i] = 1
arr = dict(sorted(arr.items(), key=lambda d: d[0], reverse=True))
side = []
for key in arr:
if arr[key] >= 2:
side.append((key, arr[key]))
if len(side) >= 2:
if side[0][1] >= 4:
print... |
p03803 | s781683825 | Accepted | #A
a, b = map(int, input().split())
l = [i for i in range(2, 14)] + [1]
if l.index(a) < l.index(b):
print('Bob')
elif l.index(a) == l.index(b):
print('Draw')
else:
print('Alice') |
p02765 | s662956140 | Wrong Answer | n,*a=map(int,open(0).read().split());k=10**9+7
c=(1<<n)%k-1
for l in a:
X=Y=j=Z=1;d=k-2
for i in range(l):X=X*(n-i)%k
while j<=l:Y=Y*j%k;j+=1
while d>0:Z=Z*Y%k if d&1==1 else Z;Y=Y*Y%k;d>>=1
c-=X*Z%k
print(c%k) |
p02695 | s412857472 | Wrong Answer | #import collections
# c = collections.Counter()
#import itertools as it
#import math
#import numpy as np
#import sys
#sys.exit()
# = input()
#k = int(input())
n,m,q = map(int, input().split())
'''
# = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n)]
'''
#n,m = map(int, in... |
p03665 | s049561087 | Accepted | def n_pow(a, n):
if n <= 0:
return 0
return pow(a, n)
def main():
bags, remainder = map(int, input().split())
biscuits = list(map(int, input().split()))
count = [0, 0]
for b in biscuits:
count[b % 2] += 1
if remainder == 1 and count[1] == 0:
print(0)
elif count[... |
p02922 | s481369622 | Wrong Answer | a, b = map( int, input().split())
i = 0
while True:
i += 1
if ( a - 1 ) * i + 1 >= b:
break
print( i ) |
p04012 | s132575699 | Accepted | w = input()
w_set = set(w)
for i in w_set:
if w.count(i) % 2 == 1:
print("No")
break
else:
print("Yes") |
p03645 | s300382214 | Wrong Answer | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
if m == 1:
print("IMPOSSIBLE")
else:
root = [[] for i in range(n)]
for a, b in ab:
root[a-1].append(b-1)
flag = False
for i in range(len(root)):
for j in root[i]:
if n-1 in root[j]:
flag ... |
p03472 | s358587695 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n, h = map(int, input().split())
a = [0]* n
b = [0]* n
for i in range(n):
a[i], b[i] = map(int, input().split())
amax = max(a)
ans = 0
b.sort(reverse=True)
for attack in b:
if attack < amax: break
h -= attack
ans += 1
if h <=... |
p03071 | s741802002 | Accepted | l=input().rstrip().lstrip().split(" ")
print(max(int(l[0]), int(l[1])) + max(min(int(l[0]), int(l[1])), max(int(l[0]), int(l[1])) - 1)) |
p02730 | s285692020 | Accepted | # https://atcoder.jp/contests/abc159/tasks/abc159_b
S = input()
N = len(S)
S_2 = S[: int((N - 1) / 2)]
S_3 = S[int(((N + 3) / 2)) - 1: ]
if S == S[:: -1] and S_2 == S_2[:: -1] and S_3 == S_3[:: -1]:
print('Yes')
else:
print('No')
|
p03076 | s938754816 | Wrong Answer | m=[]
cnt=0
for i in range(5):
x=int(input())
m.append(x)
m10=[i % 10 for i in m if i %10 >=1]
if m10:
t=min(m10)
for i in m:
if i %10==0:
cnt += i
else:
cnt += ((i//10)+1)*10
print(cnt-10+t)
else:
print(0) |
p02623 | s856439860 | Wrong Answer | from collections import deque
N,M,K = map(int,input().split())
A = deque(map(int,input().split()))
B = deque(map(int,input().split()))
ans = 0
time = 0
while len(A) > 0 or len(B) > 0:
if len(A) == 0:
time += B.popleft()
elif len(B) == 0:
time += A.popleft()
elif A[0] < B[0]:
time +=... |
p03408 | s108809259 | Accepted | import sys
input = sys.stdin.readline
MOD = 1000000007
N = int(input())
num = [0]*(200)
S = {}
cnt = 0
for i in range(N):
x = input()[:-1]
if x not in S:
S[x] = cnt
num[cnt] = 1
cnt+=1
else:
num[S[x]]+=1
M = int(input())
for i in range(M):
x = input()[:-1]
if x ... |
p02917 | s721509894 | Accepted | N = int(input())
B = list(map(int, input().split()))
ans = B[0] + B[N - 2]
for i in range(1, N - 1):
ans += min(B[i - 1], B[i])
print(ans)
|
p03672 | s673463184 | Wrong Answer | s = open(0).readlines()[0]
if len(s)%2:
s = s[:-1]
else:
s = s[:-2]
while s[:len(s)//2] != s[len(s)//2:]:
s = s[:-2]
print(len(s)) |
p02793 | s802585877 | Accepted | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N = int(input())
A = list(map(int, input().split()))
l = A[0]
mod = 10**9+7
ans = 0
for i in range(1, N):
l = lcm(l, A[i])
for i in range(N):
ans += l // A[i]
print(ans % mod)
|
p03163 | s140876498 | Accepted | import sys
input = sys.stdin.readline
n, W = map(int, input().split())
dp = [[0 for i in range(W + 1)] for j in range(n + 1)]
wv = [[int(x) for x in input().split()] for _ in range(n)]
for i in range(n):
for j in range(W + 1):
if j - wv[i][0] >= 0:
dp[i + 1][j] = max(dp[i][j - wv[i][0]] + wv[i... |
p03221 | s001830963 | Accepted | n,m = map(int,input().split())
py = [list(map(int,input().split())) for i in range(m)]
c = [0]*n
sort_py = sorted(py,key=lambda x:x[1])
ans = dict()
for p,y in sort_py:
c[p-1] += 1
ans[p,y] = str(p).zfill(6)+str(c[p-1]).zfill(6)
for p,y in py:
print(ans[p,y]) |
p03109 | s605039689 | Accepted | s=input()
month=int(s[5:7])
if month <= 4:
print('Heisei')
else:
print('TBD') |
p02640 | s528303988 | Accepted | import sys
X,Y=(int(x) for x in input().split())
#print(X,Y)
if Y%2==1:
print('No')
sys.exit()
if Y<2*X:
print('No')
sys.exit()
check=int((Y-2*X)/2)
#print(check)
if check<=X:
print('Yes')
else:
print('No') |
p03387 | s264621880 | Accepted | n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
a,b = divmod(dummy,2)
if b == 0:
print(a)
else:
print(a+2) |
p02612 | s874746733 | Accepted | n = int(input())
if n % 1000 == 0:
print(0)
else:
print(1000 - (n % 1000)) |
p03282 | s144324925 | Accepted | s = input()
k = int(input())
ichi = 0
for i in s:
if int(i) == 1:
ichi = ichi +1
else:
break
if ichi >= k:
print(1)
else:
print(s[ichi])
|
p02601 | s088790033 | Accepted | a, b, c = map(int, input().split())
k = int(input())
ans = False
for x in range(k + 1):
for y in range(k - x + 1):
for z in range(k - x - y + 1):
if a * (2 ** x) < b * (2 ** y) < c * (2 ** z):
ans = True
break
print('Yes') if ans else print('No')
|
p03329 | s111659780 | Accepted | import sys
sys.setrecursionlimit(10**9)
n=int(input())
maxn=110000
memo=[-1 for i in range(maxn)]
def rec(n):
if n==0:
return 0
if memo[n]!=-1:
return memo[n]
res=n
i=1
while i<=n:
res=min(res,rec(n-i)+1)
i*=6
j=1
while j<=n:
res=min(res,rec(n-j)+1)
... |
p02767 | s213172710 | Accepted | n = int(input())
x = sorted(list(map(int,input().split())))
li = []
cost = 0
for i in range(x[0],x[-1]+1,1):
cost = 0
for b in x:
cost += (b-i)**2
li.append(cost)
print(min(li))
|
p02935 | s388322116 | Accepted | N = int(input())
V = list(map(int, input().split()))
V.sort()
ans = V[0]
for i in range(1, N):
ans = (ans+V[i])/2
print(ans)
|
p03796 | s229185415 | Accepted | n=int(input())
ans=1
for i in range(n):
ans*=i+1
ans=ans%1000000007
print(ans)
|
p03778 | s265120335 | Accepted | w,a,b = map(int,input().split())
print((a+w<b)*(b-a-w) or (b+w<a)*(a-b-w) or 0) |
p02759 | s897893778 | Accepted | n=int(input())
print((n-1)//2+1) |
p03076 | s186120238 | Accepted | import sys
from math import ceil
from itertools import permutations
def input(): return sys.stdin.readline().strip()
def main():
T = [int(input()) for _ in range(5)]
ans = 10**10
for way in list(permutations(T, 5)):
time = 0
for i in range(4):
time += ceil(way[i] / 10) * 10
... |
p02879 | s185441644 | Accepted | a,b=map(int,input().split())
if a>9 or b>9:
print(-1)
else:
print(a*b) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.