problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03282 | s137542603 | Accepted | s = input()
k = int(input())
for i, c in enumerate(s):
if int(c)>1:
if k<i+1:
print(1)
else:
print(int(c))
break
else:
print(1) |
p02623 | s533036608 | Accepted | N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] > K - a[i]:
j -= 1
ans = max(ans, i + j)
print(ans)
|
p02754 | s650658426 | Accepted | f = [int(i) for i in input().split()]
n = f[0]
a = f[1]
b = f[2]
m = n // (a+b)
tmp = m * a
mod = n%(a+b)
print(tmp+min(mod,a)) |
p02951 | s676544378 | Wrong Answer | a,b,c=map(int,input().split())
print(c+b-a) |
p02663 | s243295848 | Accepted | def solve():
H1,M1,H2,M2,K = map(int,input().split())
M1 += H1 * 60
M2 += H2 * 60
print(M2-M1-K)
if __name__ == '__main__':
solve() |
p02681 | s826554104 | Wrong Answer | S = input()
T = input()
if S in T:
print("Yes")
else:
print("No")
|
p03285 | s267803175 | Wrong Answer | n=int(input())
for i in range((n//4)+1):
for j in range((n//7)+1):
if n==4*i+7*j:
print('Yes')
else:
print('No')
|
p02971 | s674140604 | Accepted | n=int(input())
v=[]
for i in range(n):
p=int(input())
v.append(p)
vec=sorted(v)
for i in range(n):
if v[i]==vec[n-1]:
print(vec[n-2])
else:
print(vec[n-1]) |
p03319 | s118495039 | Accepted | N,K=map(int,input().split())
A=list(map(int,input().split()))
ans=-(-(N-1)//(K-1))
print(ans) |
p02755 | s927109413 | Accepted | a,b=map(int,input().split())
for i in range(10*b,15*b):
if int(i*0.08)==a and int(i*0.1)==b:
print(i)
exit()
print(-1) |
p03627 | s732788301 | Wrong Answer | N=int(input())
import collections
A=list(map(int,input().split()))
table=collections.defaultdict(int)
for x in A:
table[x]+=1
table=list(table.items())
table=[x[0] for x in table if x[1]>1]
table.append(0)
table.append(0)
table.sort(reverse=True)
print(table[0]*table[1])
|
p02765 | s863381297 | Wrong Answer | n,r = map(int,input().split())
print(r-(100*(10-n)))
|
p03261 | s104402787 | Wrong Answer | n = int(input())
words = []
last = ''
ans = 'Yes'
for i in range(n):
inp = input()
if inp in words or last != inp[-1]:
ans = 'No'
break
words.append(inp)
last = inp[-1]
print(ans) |
p02836 | s428492582 | Accepted | S=input()
hug=0
for i in range(len(S)//2):
if S[i]!=S[len(S)-i-1]:
hug+=1
print(hug)
|
p03835 | s786213690 | Accepted | k,s=map(int,input().split())
ans=0
for i in range(k+1):
if s-i>=0:
for j in range(min(s-i+1,k+1)):
if s-i-j<=k and s-i-j>=0:
ans+=1
print(ans)
|
p02618 | s836320571 | Accepted | dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
r=3
for i in range(dur):
t=0
s=list(map(int,input().split()))
m=-1<<64
for j in range(26):
alt=s[j]+r*c[j]*(i+1-d[j])+sum([-r*c[k]*(i+1-d[k]) for k in range(26)])
if alt>m:
m=alt
t=j
print(t+1)
d[t]=i+1
|
p02647 | s354875068 | Accepted | n,k = map(int,input().split())
a = list(map(int,input().split()))
for _ in range(k):
r = [0]*(n+1)
for i in range(n):
r[max(i-a[i],0)] += 1
r[min(i+a[i]+1,n)] -= 1
for i in range(n-1):
r[i+1] += r[i]
a = r
if a.count(n)==n:
break
print(*a[:-1])
|
p03657 | s307139745 | Accepted | A,B=map(int,input().split())
cookie=[A,B,A+B]
for i in range(3):
cookie[i]%=3
if 0 in cookie:
print("Possible")
else:
print("Impossible") |
p03720 | s298010573 | Accepted | """
author : halo2halo
date : 30, Jan, 2020
"""
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = map(int, readline().split())
L = [0] * N
for _ in range(M):
a, b = map(int, readline().split())
L[a - 1] += 1
L[b - 1] += 1
for i in L:
print(i)
|
p03994 | s152312608 | Accepted | s=list(input())
K=int(input())
i=0
while i<len(s):
if i==len(s)-1:
s[i]=chr(97+(ord(s[i])-97+K)%26)
break
if K<abs(123-ord(s[i]))%26:
i+=1
elif K>=abs(123-ord(s[i]))%26:
sub=abs(123-ord(s[i]))%26
s[i]="a"
K-=sub
i+=1
print("".join(s)) |
p02835 | s848292557 | Wrong Answer | a1, a2, a3 = map(int, input().split())
if a2+a2+a3 >= 22:
print('bust')
else:
print('win') |
p02790 | s572765602 | Accepted | a=list(map(lambda x:x,input().split()))
if(a[1]>a[0]):
print(a[0]*int(a[1]))
else:
print(a[1]*int(a[0])) |
p02947 | s796130697 | Accepted | N = int(input())
from collections import Counter
S = [''.join(sorted(input().rstrip())) for _ in range(N)]
ans = 0
for i in Counter(S).values():
ans += i*(i-1)//2
print(ans) |
p03695 | s775102954 | Accepted | n = int(input())
lst1 = list(map(int,input().split()))
lst2 = [0]*9
for i in range(n):
for j in range(8):
if lst1[i] < 400*(j+1):
lst2[j] += 1
break
if lst1[i] >= 3200:
lst2[8] += 1
ans = 0
for i in range(8):
if lst2[i]:
ans += 1
print(max(1,ans))
print(ans+lst2[8])
|
p03284 | s506191700 | Accepted | N,K=map(int,input().split())
if N%K==0:
print(0)
else:
print(1)
|
p02785 | s545605414 | Accepted | n, k = map(int, input().split())
a = sorted(map(int, input().split()))
print(sum(a[0 : max(0, n - k)]))
|
p03131 | s045325898 | Wrong Answer | k,a,b = map(int,input().split())
if b - a <= 1 or a >= k:
print(k+1)
else:
k -= a - 1
ans = a
ans += (b - a)*(k//2)
if k/2 % 2 == 0:
ans += 1
print(ans) |
p03285 | s747261065 | Wrong Answer | def resolve():
n = int(input())
if n % 4 == 0 or n % 7 == 0 or n % 11 == 0 or (n % 11) % 4 == 0 or (n % 11) % 7 == 0:
print("Yes")
else:
print("No")
resolve() |
p03485 | s913985707 | Accepted | def resolve(x,y):
if (x+y)%2 == 1:
return (x+y+1)//2
else:
return (x+y)//2
a,b=map(int,input().split())
print(resolve(a,b)) |
p02988 | s083755327 | Wrong Answer | permutation_number = int(input())
permutation_value = list(map(int, input().split()))
condition_permutation = 0
for i in range(permutation_number - 1):
if permutation_value[i - 1] < permutation_value[i] < permutation_value[i + 1] or permutation_value[i - 1] > permutation_value[i] > permutation_value[i + 1]:
condition_permutation += 1
print(condition_permutation) |
p02832 | s419214812 | Accepted | # ABC148D
n = int(input())
a = list(map(int, input().split()))
if 1 not in a:
print(-1)
else:
count = 0
find = 1
for i in a:
if i == find:
find += 1
else:
count += 1
print(count)
|
p02571 | s987711150 | Accepted | s=input()
t=input()
ans=len(t)
cnt=0
for _ in range(len(s)):
if _+len(t)>len(s):
break
mj=s[_:_+len(t)]
for i in range(len(t)):
if mj[i]!=t[i]:
cnt += 1
if ans>cnt:
ans=cnt
cnt=0
print(ans) |
p03000 | s531785403 | Accepted | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
n,x = map(int, input().split())
l = list(map(int, input().split()))
temp = []
temp.append(0)
last = 0
for i in range(n):
temp.append(last+l[i])
last += l[i]
ans = 0
for i in range(n+1):
if temp[i] <= x:
ans += 1
print(ans)
|
p02724 | s650598832 | Accepted | X = int(input())
amari = X % 500
print((X // 500)*1000 + (amari // 5 *5)) |
p03163 | s176334463 | Accepted | n,w=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(n)]
dp=[[0]*(w+1) for _ in range(n+1)]
for i in range(n):
for j in range(w+1):
if j>=wv[i][0]:
dp[i+1][j]=max(dp[i][j],dp[i][j-wv[i][0]]+wv[i][1])
else:
dp[i+1][j]=dp[i][j]
print(dp[-1][-1]) |
p02989 | s101067588 | Accepted | n=int(input())-1
l=list(map(int,input().split()))
l.sort()
m=n//2
if l[m]==l[m+1]:
print(0)
else:
print(l[m+1]-l[m]) |
p02973 | s118089633 | Wrong Answer | import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
n=int(input())
m=10**10
ans=0
for i in range(n):
a=int(input())
if a<=m:
m=a
ans+=1
print(ans) |
p02818 | s098755010 | Accepted | a, b, k =map(int, input().split())
if k <= a:
a = a-k
b = b
elif a+b <= k:
a = 0
b = 0
else:
b = a+b-k
a = 0
print(a, b)
|
p02835 | s108867371 | Wrong Answer | print("bust" if sum(list(map(int, input().split()))) > 22 else "win") |
p02711 | s129511939 | Wrong Answer | n = input()
for i in n:
if i == 7:
print("Yes")
quit()
print("No") |
p02720 | s664411055 | Accepted | import queue
N = int(input())
q = queue.Queue()
for i in range(1, 10):
q.put(i)
ans = 0
for i in range(N):
ans = q.get()
m = ans % 10
if ans % 10 != 0:
q.put(ans * 10 + m - 1)
q.put(ans * 10 + m)
if ans % 10 != 9:
q.put(ans * 10 + m + 1)
print(ans) |
p02833 | s751263988 | Wrong Answer | n=int(input())
if n%2==1:
print(0)
else:
c=0
x=5
while x<=n:
c+=n//x
x*=5
print(c) |
p03407 | s068270528 | Accepted | a,b,c = map(int,input().split())
if a + b >= c:
print("Yes")
else:
print("No") |
p03345 | s875198249 | Accepted | A,B, C, K = map(int,input().split())
if K%2==0:
print(A-B)
else:
print(B-A) |
p03761 | s845310641 | Accepted | from collections import Counter
n=int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
ans=Counter(input())
for _ in range(n-1):
temp=Counter(input())
for char in alpha:
ans[char]=min(ans[char],temp[char])
for char in alpha:
for _ in range(ans[char]):
print(char,end='') |
p02959 | s868729232 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
total=0
for i in range(N):
if A[i]-B[i]>=0:
total+=B[i]
elif A[i]-B[i]<0:
total+=A[i]
if A[i+1]-B[i]+A[i]>=0:
total+=B[i]-A[i]
A[i+1]-=B[i]-A[i]
else:
total+=A[i+1]
A[i+1]=0
print(total)
|
p03437 | s516957933 | Accepted | X, Y = map(int, input().split())
ans = -1
for i in range(10**8):
Z = X*(i+2)
if Z%Y != 0 and Z <= 10**18:
ans = Z
break
if Z > 10**18:
break
print(ans) |
p03779 | s250020068 | Wrong Answer | x = int(input())
#h, w = list(map(int, input().split()))
#((n+1)*n)//2 >= x
# (n+1)*n = 2*x
n = 1
a = ((n+1)*n)//2
while a < x:
a = ((n+1)*n)//2
n += 1
print(n-1)
|
p02553 | s592116274 | Wrong Answer | n = list(map(int, input().split()))
print(n[1]*n[3]) |
p02731 | s456886193 | Accepted | l = int(input(""))
a = 0.001
b = l - 2 * a
V = 0
V_vec = [0,0]
for i in range(l*999):
if V < a * a * b :
V = a * a * b
V_vec = [a,b]
a += 0.001
b = l - 2 * a
print(V) |
p02678 | s299189937 | Accepted | from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
graph[a-1].append(b-1)
graph[b-1].append(a-1)
queue = deque([0])
ans = [-1]*n
ans[0] = 0
while len(queue)>0:
node = queue.popleft()
for c_node in graph[node]:
if ans[c_node]>=0:
continue
ans[c_node] = node+1
queue.append(c_node)
print('Yes')
for i in ans[1:]:
print(i) |
p02952 | s885716747 | Accepted | def f(n):
keta = 0
while n:
keta += 1
n //= 10
return keta % 2 == 1
N = int(input())
ans = 0
for i in range(1, N+1):
if f(i):
ans += 1
print(ans)
|
p03331 | s268441380 | Wrong Answer | n = int(input())
a,b, sA, sB, result= 1, 0,0,0,0
soma = []
while a<=n:
b=n-a
for i in str(a):
sA+=int(i)
for j in str(b):
sB+=int(j)
soma.append(sA+sB)
a=a+1
for k in str(min(soma)):
result += int(k)
print(result)
|
p03427 | s612672297 | Accepted | N = int(input())
D = [int(n) for n in str(N)]
ans = D[0] - 1 + 9 * (len(D) - 1)
ans = max(ans, sum(D))
print(ans) |
p02753 | s745565790 | Wrong Answer | s=input()
print("YNeos"[s != len(s) * s[0]::2]) |
p03408 | s501248447 | Wrong Answer | n=int(input())
blue=[input() for _ in range(n)]
bset = set(blue)
m=int(input())
red=[input() for _ in range(m)]
print(max([blue.count(b) - red.count(b) for b in bset]))
|
p03210 | s039917018 | Wrong Answer | X = int(input())
ans = 'YES' if X == 3 or X == 5 or X == 7 else 'No'
print(ans) |
p02623 | s435954364 | Accepted | def resolve():
import numpy as np
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = np.insert(np.cumsum(A), 0, 0)
B = np.insert(np.cumsum(B), 0, 0)
ans = 0
j = M
for i in range(N + 1):
if A[i] > K:
break
while A[i] + B[j] > K:
j -= 1
ans = max(ans, i + j)
print(ans)
resolve()
|
p02973 | s491575697 | Accepted | import sys
input = sys.stdin.readline
import bisect
from collections import deque
def main():
N = int(input())
use = deque([int(input())])
for _ in range(N-1):
num = int(input())
index = bisect.bisect_left(use,num)
if index == 0:
use.appendleft(num)
else:
use[index-1] = num
print(len(use))
if __name__ == "__main__":
main()
|
p02678 | s705035235 | Accepted | from collections import deque
n, m, *AB = map(int, open(0).read().split())
graph = [[] for _ in range(n)]
for a, b in zip(AB[::2], AB[1::2]):
graph[a-1].append(b-1)
graph[b-1].append(a-1)
d = [0] * n
queue = deque([0])
while queue:
current_node = queue.popleft()
for next_node in graph[current_node]:
if d[next_node] == 0:
d[next_node] = current_node+1
queue.append(next_node)
print('Yes')
print(*d[1:], sep='\n') |
p02708 | s818870779 | Accepted | n, k = map(int, input().split())
mod = 10 ** 9 + 7
a = [i for i in range(n + 1)]
b = [0] * (n + 1)
c = [0] * (n + 1)
for i in range(1, n + 1):
b[i] = b[i - 1] + a[i]
a.reverse()
c[0] = a[0]
for i in range(1, n + 1):
c[i] = c[i - 1] + a[i]
ans = 0
for i in range(n + 1):
if i + 1 >= k:
ans += (c[i] - b[i] + 1)
ans %= mod
print(ans) |
p03371 | s865165525 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 0
if a+b>2*c:
if x>y:
ans = min(c*2*x,c*y*2+(x-y)*a)
else:
ans = min(c*2*y,c*x*2+(y-x)*b)
else:
ans = a*x + b*y
print(ans) |
p02933 | s885512974 | Accepted | a=int(input())
s=input()
if a>=3200:
print(s)
else:
print("red") |
p03262 | s266619385 | Accepted | from math import gcd
n,start = map(int,input().split())
x_ls = list(map(int, input().split()))
diff_ls = [0] * n
for i in range(n):
diff_ls[i] = abs(start-x_ls[i])
ans = diff_ls[0]
for i in range(1,n):
ans = gcd(ans,diff_ls[i])
print(ans) |
p03612 | s550594545 | Accepted | n=int(input())
a=list(map(lambda x:int(x)-1,input().split()))
cnt=0
lis=set()
for i in range(n-1):
if i in lis:
continue
if a[i]==i and a[i+1]==i+1:
cnt+=1
lis.add(i+1)
elif a[i]==i:
cnt+=1
if n-1 not in lis and a[n-1]==n-1:
cnt+=1
print(cnt) |
p03038 | s683713533 | Wrong Answer | import bisect
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
for i in range(M):
B,C = map(int,input().split())
D = bisect.bisect_left(A,C)
if D <= B:
A[:D] = [C]*D
else:
A[:B] = [C]*B
print(sum(A)) |
p02570 | s291066705 | Accepted | d, t, s = map(int, input().split())
print('Yes') if d/s <= t else print('No') |
p03778 | s812017057 | Wrong Answer | W, a, b = map(int, input().split())
if a + W < b:
print(b - (a + W))
elif a - W <= b or b <= a + W:
print('0')
else:
print(a - (b + W)) |
p02987 | s845588987 | Accepted | lst=list(str(input()))
temp=[]
for i in range(4):
if lst[i] not in temp:
temp.append(lst[i])
if len(temp)!=2:
print("No")
else:
if lst.count(temp[0])==2 and lst.count(lst[1])==2:
print("Yes")
else:
print("No") |
p03001 | s786308054 | Wrong Answer | W, H, x, y = map(int, input().split())
area = W * H / 2
div = 0
if W // 2 == x and H // 2 == y:
div = 1
print(area, div)
|
p03433 | s567222676 | Accepted | n = int(input())
a = int(input())
if (n%500) <= a:
print('Yes')
else:
print('No')
|
p03471 | s952602912 | Wrong Answer | n, y = map(int, input().split())
for i in range(n):
for j in range(n):
k = y-(i*10000 + j*5000)
if k >= 0:
k = k // 1000
if i + j + k == n:
print(i, j, k)
exit()
print(-1, -1, -1)
|
p02946 | s927421450 | Wrong Answer | K,X = map(int,input().split())
num = []
num.append(X)
for i in range(X,X+K-1):
num.append(X-(i-X+1))
num.append(i+1)
num.sort()
[print(x,end='') for x in num] |
p02571 | s013193541 | Wrong Answer | S=str(input())
T=str(input())
def longestSubstringFinder(string1, string2):
answer = ""
len1, len2 = len(string1), len(string2)
for i in range(len1):
match = ""
for j in range(len2):
if (i + j < len1 and string1[i + j] == string2[j]):
match += string2[j]
else:
if (len(match) > len(answer)): answer = match
match = ""
return answer
print (len(T)-len(longestSubstringFinder(S,T))) |
p02995 | s487923281 | Wrong Answer | from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int(C*D / gcd(C, D))
nA = A - (int(A/C) + int(A/D) - int(A/lcm))
nB = B - (int(B/C) + int(B/D) - int(B/lcm))
print(nB - nA) |
p02665 | s489060775 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
leaf = []
miki = []
under = 1
for i, a in enumerate(A):
can = 2 ** i
if a > can or under == 0:
print(-1)
exit()
miki.append(under - a)
under = miki[-1] * 2
ans = 0
child = 0
for i in reversed(range(N + 1)):
child = min(child, miki[i]) + A[i]
ans += child
print(ans) |
p03105 | s594211289 | Accepted | a, b, c = map(int, input().split())
print(min((b//a), c)) |
p03645 | s369580424 | Accepted | n, m = map(int, input().split())
s = [0 for i in range(n)]
e = [0 for i in range(n)]
for i in range(m):
x, y = map(int, input().split())
if x == 1:
s[y] = 1
elif y == n:
e[x] = 1
flag = False
for i in range(n):
if s[i] == 1 and e[i] == 1:
flag = True
break
if flag:
print("POSSIBLE")
else:
print("IMPOSSIBLE") |
p03854 | s928504121 | Wrong Answer | S = list(input())
S.reverse()
S = ''.join(S)
st = ['maerd','remeard','esare','resare']
ans = 'YES'
while S != '':
if S[0:5] in st:
S = S[5:]
elif S[0:4] in st:
S = S[4:]
elif S[0:6] in st:
S = S[6:]
else:
ans = 'NO'
break
print(ans) |
p02658 | s696548458 | Wrong Answer | N = int(input())
mylist = (input().split(" "))
result = 1
for i in range(N):
result *= int(mylist[i])
if result > 10 ** 18:
result = -1
break
else:
continue
print(result) |
p02705 | s980878550 | Accepted | a = int(input())
A=10000
pi=0
for L in range(1,A):
if L%2==0:
B=-1
else:
B=1
pi+=(4/(2*L-1))*B
answer = 2*pi*a
print(answer) |
p03220 | s481772308 | Wrong Answer | #ABC-113-B
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = -1
ans_diff = 10**19
for i in range(N):
tempe = (T-H[i]*0.006)
if ans_diff > A - tempe:
ans_diff = A - tempe
ans = i
print(ans+1) |
p03478 | s785467741 | Accepted | n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
istr = map(int, list(str(i)))
if a <= sum(istr) <= b:
ans = ans + i
print(ans) |
p02963 | s330703312 | Accepted | #!/usr/bin/python3
# -*- coding:utf-8 -*-
def main():
s = int(input())
remain = - s % (10**9) % (10**9)
quotient = (s + remain) // (10**9)
print(0, 0, 1, 10**9, quotient, remain)
if __name__=='__main__':
main()
|
p04045 | s129021065 | Accepted | import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy
#N=int(input())
N,K=map(int,input().split())
D=list(map(int,input().split()))
for i in range(N,100000):
t=set(map(int,list(str(i))))
temp=D+list(t)
temp2=set(temp)
if len(temp)==len(temp2):
#print(temp)
#print(temp2)
print(i)
exit()
|
p03435 | s450048428 | Accepted | c = [list(map(int,input().split())) for _ in range(3)]
ans = 'Yes'
if not c[0][1] - c[0][0] == c[1][1] - c[1][0] == c[2][1] - c[2][0]:
ans = 'No'
if not c[0][2] - c[0][1] == c[1][2] - c[1][1] == c[2][2] - c[2][1]:
ans = 'No'
print(ans)
|
p02801 | s097530838 | Accepted | c= input()
print(chr(ord(c)+1)) |
p03730 | s480040411 | Accepted | a,b,c = map(int, input().split())
for num in range(a,10**5,a):
if num%b==c:
print("YES")
exit()
print("NO") |
p02682 | s713924969 | Accepted | def main():
A,B,C,K = map(int, input().split())
sum = 0
if K > A:
sum += 1 * A
elif K <= A:
sum += 1 * K
if K > A + B:
sum += -1 * (K - (A + B))
print(sum)
main() |
p04031 | s547983398 | Accepted | N = int(input())
A = list(map(int,input().split()))
costs = []
for i in range(101):
cost = 0
for j in range(N):
cost += (A[j]-i)**2
costs.append(cost)
cost = 0
for j in range(N):
cost += (A[j]+i)**2
costs.append(cost)
print(min(costs)) |
p02724 | s501334273 | Wrong Answer | x=int(input())
u=0##初期
## x=500*a+50*b+c d=50*b+c
a=x//500
d=x%500
b=d%5
print(a*1000+b*5) |
p03457 | s216881624 | Accepted | N=int(input())
Ki=[list(map(int,input().split())) for i in range(N)]
f=False
for i in Ki:
t,x,y=i
s=x+y
if (t%2==0 and s%2!=0) or (t%2!=0 and s%2==0) or t<s:
f=True
break
if f:
print('No')
else:
print('Yes') |
p02820 | s604088702 | Wrong Answer | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
l=[0]*n #得点の列
for i in range(n):
if t[i]=="r":
l[i]=p
elif t[i]=="s":
l[i]=r
else:
l[i]=s
res=0
for i in range(n):
if i>k-1 and l[i-k]==l[i]:
l[i]=0
res+=l[i]
print(res) |
p02957 | s902920033 | Accepted | a = list(map(int,input().split()))
A = a[0]
B = a[1]
if (A+B) % 2 == 0:
print((A+B)//2)
else:
print('IMPOSSIBLE')
|
p03705 | s001984221 | Wrong Answer | n,a,b=map(int,input().split())
if n==1 and a!=b:
print(0)
exit()
mi=(n-1)*a+b
ma=(n-1)*b+a
print(ma-mi+1) |
p03163 | s738662285 | Accepted | N, W, *t = map( int, open( 0 ).read().split() )
d = [[ 0 for _ in range( W + 1 ) ] for _ in range( N + 1 ) ]
ans = 0
i = 0
for w, v in zip( *[ iter( t )] * 2 ):
for j in range( 1, W + 1 ):
d[ i + 1 ][ j ] = d[ i ][ j ]
if j - w >= 0:
d[ i + 1 ][ j ] = max( d[ i ][ j - w ] + v, d[ i ][ j ] )
i += 1
print( d[N][W]) |
p02911 | s094784366 | Accepted | N, K, Q = map(int, input().split())
answered = [0] * N
passed = 0
for i in range(Q):
who = int(input())
answered[who-1] += 1
for point in answered:
if point > Q - K:
print('Yes')
else:
print('No')
|
p03544 | s061454137 | Accepted | a, b = 2, 1
for i in range(int(input())-1):
a, b = b, a+b
print(b)
|
p03555 | s712686943 | Accepted | a=input()
b=input()
if a==b[::-1]:
print("YES")
else:
print("NO") |
p02766 | s039817770 | Wrong Answer | import math
def main():
strA = input()
listA = strA.split(" ")
N = int(listA[0])
K = int(listA[1])
x = N
y = 0
while(1):
x = x/K
y = y + 1
if(x < K):
if K - x > 0:
y = y + 1
break
print(y)
if __name__ == '__main__':
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.