problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p04033 | s606597950 | Accepted | a,b = map(int,input().split())
if a * b <= 0:
print("Zero")
elif a > 0:
print("Positive")
else:
if (b - a) % 2 == 0:
print("Negative")
else:
print("Positive") |
p02548 | s645233031 | Accepted | #!/usr/bin/env python3
import sys
def main():
from math import sqrt
input = sys.stdin.readline
n = int(input())
m = int(sqrt(n)) + 1
ans = 0
for i in range(1, n + 1):
j = n // i
if n % i == 0:
j -= 1
ans += j
print(ans)
if __name__ == '__main__':
main()
|
p03474 | s643504608 | Accepted | import re
A, B = map(int,input().split())
S = input()
p = f"\d{{{A}}}-\d{{{B}}}"
pattern = re.compile(p)
if pattern.fullmatch(S):
print('Yes')
else:
print('No') |
p03633 | s761710717 | Accepted | import sys
import fractions
def input(): return sys.stdin.readline().strip()
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]
def main():
N = Z()
T = [Z() for _ in range(N)]
ans = T[0]
for i in range(1, N):
g = fractions.gcd(ans, T[i])
ans *= T[i]
ans //= g
print(ans)
return
if __name__ == '__main__':
main()
|
p03543 | s914290530 | Wrong Answer | N=input();print('Yes')if set(N[:3])==1or set(N[1:])==1else print('No') |
p03251 | s070544137 | Accepted | N,M,X,Y = map(int,input().split())
lx = list(map(int,input().split()))
lx.append(X)
ly = list(map(int,input().split()))
ly.append(Y)
if max(lx) < min(ly):
print('No War')
else:
print('War')
|
p02640 | s570004044 | Accepted | wa, num = map(int, input().split())
kame = (num / 2) - wa
turu = wa - kame
if (kame >= 0 and turu >= 0) and (wa == kame + turu) and (num == 2 * turu + 4 * kame) and (
kame.is_integer() and turu.is_integer()):
print('Yes')
else:
print('No')
|
p02618 | s245122660 | Accepted | d = int(input())
c = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for j in range(d)]
#t = [int(input()) for i in range(d)]
for i in range(d):
print(1)
|
p03544 | s918189797 | Wrong Answer | n = int(input())
print(int(((1 + 5**(1/2)) / 2)**(n) + ((1 - 5**(1/2)) / 2)**(n))) |
p02719 | s584777299 | Wrong Answer | n,k=map(int, input().split())
val=n%k
num=abs(n-k)
if num==0:
print(0)
else:
val1=min(num%k,k%num)
print(min(val,val1)) |
p02687 | s498234090 | Accepted | s=input()
if s=="ABC":
print("ARC")
else:
print("ABC")
|
p02783 | s401650297 | Accepted | import math
h, a = map(int, input().split())
print(math.ceil(h/a))
|
p02645 | s362067919 | Accepted | S = input()
print(S[:3]) |
p03838 | s626033966 | Wrong Answer | x, y = map(int, input().split())
if x >= 0:
if y >= 0:
if x <= y:
ans = y - x
else:
ans = x - y + 2
else:
ans = abs(x + y) + 1
else:
if y <= 0:
if x <= y:
ans = y - x
else:
ans = x - y + 2
else:
ans = abs(x + y) + 1
print(ans) |
p02957 | s715429098 | Accepted | a, b = map(int, input().split())
if abs(a-b)%2 == 1:
print('IMPOSSIBLE')
else:
print((a+b)//2) |
p02862 | s434723474 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9+7
X,Y = map(int,readline().split())
if X > Y:
X,Y = Y,X
Z = X+Y
if Z % 3 == 0 and X <= Y <= 2*X:
N = Z//3
r = (N-(Y-X)) // 2
else:
print(0)
sys.exit()
f = [1]*(N+1)
for i in range(1,N+1):
f[i] = i * f[i-1] % mod
a = pow(f[r],mod-2,mod)
b = pow(f[N-r],mod-2,mod)
ans = f[N] * a * b % mod
print(ans)
|
p02578 | s242029254 | Accepted | n=int(input())
a=list(map(int, input().split()))
l=a[0]
sm=0
for h in a:
if(h<l):
sm+=(l-h)
elif(h>l):
l=h
print(sm) |
p02987 | s054921719 | Wrong Answer | S = input()
for i in range(3):
if S[i] == S[i+1]:
print("Bad")
break
else:
print("Good") |
p03427 | s387955410 | Accepted | N = input()
def digsum(n):
total = 0
while n > 0:
total += n%10
n /= 10
n = int(n)
return total
if len(N)==1:
print(N)
exit()
if N[1:].count('9') == len(N)-1:
print(digsum(int(N)))
exit()
ans = int(str(int(N[0])-1) + '9'*(len(N)-1))
print(digsum(ans)) |
p02682 | s700132475 | Accepted | #B
A,B,C,K=map(int,input().split())
if K<=A:
Sum=K
elif K<=A+B:
Sum=A
else:
Sum=A-(K-A-B)
print(Sum) |
p03627 | s175564330 | Wrong Answer | import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def Main():
n = I()
a = list(IL())
sa = set(a)
stick = []
for rep in sa:
if 2<=a.count(rep): stick.append(rep)
if len(stick)<2: print(0)
else:
stick.sort()
print(stick[-1]*stick[-2])
return
if __name__=='__main__':
Main() |
p02725 | s733724752 | Accepted | k,n=list(map(int,input().split()))
A=list(map(int,input().split()))
l=[]
for i in range(n-1):
l.append(A[i+1]-A[i])
l.append(k-A[-1]+A[0])
print(sum(l)-max(l)) |
p03317 | s644084026 | Wrong Answer | NK = list(map(int,input().split()))
A = list(map(int,input().split()))
N = NK[0]
K = NK[1]
# print(N)
# print(K)
# print(A)
min_index = A.index(min(A))
# print(min_index)
leftLength = min_index
rightLength = N - 1 - leftLength
# print(leftLength)
# print(rightLength)
delta = K - 1
# print(delta)
count = 0
leftTimes = leftLength // delta
remain = leftLength % delta
if remain > 0:
leftTimes = leftTimes + 1
rightLength = rightLength - remain
rightTimes = rightLength // delta
remain = rightLength % delta
if remain > 0:
rightTimes = rightTimes + 1
count = leftTimes + rightTimes
print(count)
|
p02836 | s371082949 | Wrong Answer | input_line = input()
N = input_line[::-1]
count = 0
for i in range(len(input_line)):
if input_line[i] != N[i]:
count += 1
print(count) |
p02731 | s202686220 | Wrong Answer | import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline
L=int(input())
V=0
for x in np.arange(0,L+0.1,0.1):
for y in np.arange(0,L+0.1-x,0.1):
z = L-x-y
V = max(V, x*y*z)
print(V)
|
p02676 | s236402338 | Accepted |
K = int(input())
S = input()
if len(S) <= K:
print(S)
else:
print(S[: K] + "...")
|
p03329 | s496095833 | Accepted | N = int(input())
def digit(x, base):
if x == 0:
return 0
return digit(x // base, base) + x % base
def calc(six, nine):
return digit(six, 6) + digit(nine, 9)
ans = 10**18
for six in range(N + 1):
ans = min(ans, calc(six, N - six))
print(ans) |
p02947 | s574284943 | Wrong Answer | def main():
N = int(input())
dict = {}
for i in range(N):
s = "".join(sorted(input()))
if s in dict:
dict[s] = dict[s] * 2
else:
dict[s] = 1
result = 0
l = list(dict.keys())
for j in l:
result += int(dict[j])
print(result - len(l))
if __name__ == '__main__':
main() |
p02861 | s326184364 | Accepted | from math import sqrt
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
result = 0
for i in range(n):
for j in range(n):
if i != j:
result += sqrt((xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)
print(result/n) |
p03061 | s107491474 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
if N==2: print(max(A));exit()
from math import gcd
L = {}
R = {}
L[0] = A[0]
R[N-1] = A[-1]
ans = 0
for i in range(1,N):
L[i] = gcd(L[i-1],A[i])
R[N-i-1] = gcd(R[N-i],A[N-i-1])
for i in range(2,N):
ans = max(ans,gcd(L[i-2],R[i]))
ans = max(ans,R[1])
ans = max(ans,L[N-1])
print(ans) |
p03035 | s131172700 | Accepted | A,B=map(int, input().split())
if A <= 5:
print(0)
elif A <= 12:
print(B//2)
else:
print(B) |
p02627 | s569664287 | Accepted | x = input()
if x.isupper():
print('A')
else:
print('a') |
p02633 | s351143955 | Wrong Answer | k = list(map(int,input().split()))
print(int(360//k[0])) |
p03327 | s833731450 | Wrong Answer | import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if __name__ == '__main__':
a = [int(i) for i in input().split()]
if a[0] >999:
print("ABD"+str(a[0]-999))
else:
print("ABC"+str(a[0]))
|
p02546 | s321901703 | Accepted | s=input()
if s[-1]=="s":
print(s+"es")
else:
print(s+"s") |
p03796 | s026770171 | Accepted | N = int(input())
power = 1
for i in range(1, N+1):
power = power * i % (10 ** 9 + 7)
print(power)
|
p03251 | s377471457 | Accepted | n, m, x, y = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
if max(max(p), x) < min(min(q), y):
print("No War")
else:
print("War") |
p04011 | s011244590 | Wrong Answer | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print((k * x) + ((n - k) * y)) |
p03815 | s612499654 | Accepted | x=int(input())
q=x//11
r=x%11
if r==0:
print(2*q)
elif 0<r<=6:
print(2*q+1)
else:
print(2*q+2) |
p03679 | s680837607 | Wrong Answer | def main():
x, a, b = map(int, input().split())
if a > b:
print("delicious")
elif b - a <= x:
print("safe")
else:
print("dangerous")
if __name__ == '__main__':
main()
|
p03471 | s164603656 | Accepted | n, m = map(int, input().split())
answer = -1, -1, -1
for x in range(n+1):
for y in range(n-x+1):
z = n - x - y
if x * 10000 + y * 5000 + z * 1000 == m:
answer = (x, y, z)
break
else:
continue
print(*answer)
|
p02899 | s366106551 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
ans=[None]*N
for i in range(N):
ans[i]=A.index(i+1)+1
print(ans)
|
p02576 | s660477428 | Wrong Answer | N,X,T=list(map(int,input().split()))
S=N//X
print(S*T+T) |
p03339 | s682910390 | Accepted | N=int(input())
S=input()
L=[0]*N
R=[0]*N
Lcnt=0
Rcnt=0
for i in range(1,N):
if(S[i-1]=='W'):
Lcnt+=1
L[i]=Lcnt
for i in reversed(range(0,N-1)):
if(S[i+1]=='E'):
Rcnt+=1
R[i]=Rcnt
ans=10e+9
for i in range(N):
ans=min(ans,(L[i]+R[i]))
print(ans) |
p02792 | s824461712 | Wrong Answer | n = int(input())
ans = 0
a = [[[] for i in range(10)] for j in range(10)]
for i in range(n):
a[int(str(i)[0])][int(str(i)[-1])].append(i)
for i in range(1, 10):
for j in range(1, 10):
ans += len(a[i][j]) * len(a[j][i])
print(ans) |
p03659 | s580232951 | Accepted | n=int(input())
c=list(map(int, input().split()))
s = sum(c)
l = []
x = 0
y = s
for i in c[:n-1]:
x += i
y -= i
l += [abs(x-y)]
print(min(l)) |
p03861 | s919668496 | Wrong Answer | a,b,x = map(int,input().split())
if x>b:
print(0)
else:
if b%x==0:
tmp = 1
else:
tmp = 0
print((b-a)//x+tmp) |
p03103 | s290941317 | Accepted | n, m = map(int, input().split())
ab = sorted([tuple(map(int, input().split())) for _ in range(n)])
i = 0 # 今何本かったか
price = 0 # 合計いくらか
for a, b in ab:
price += a * min(b, m-i)
i += min(b, m-i)
if i == m:
print(price)
exit() |
p03086 | s646884533 | Wrong Answer | import re
S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(ans[0]) |
p03951 | s335543778 | Wrong Answer | n = int(input())
s = input()
t = input()
for i in range(n, -1, -1):
ans = [""] * (n + n - i)
ans[:n] = list(s)
ans[-n:] = list(t)
if ans[:n] == list(s):
break
print(*ans, sep="")
|
p02766 | s605118667 | Wrong Answer | n, k = map(int, input().split())
i = 1
while k ** i < n:
i += 1
print(i+1) |
p03767 | s348172771 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
print(sum(a[1:2*n:2])) |
p02615 | s817367546 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 0
a.sort()
for i in range(1, n):
ans += a[n - i // 2 - 1]
print(ans) |
p02947 | s046959770 | Accepted | n = int(input())
dic = {}
for i in range(n):
s = ''.join(sorted(list(input())))
if not s in dic:
dic[s] = 1
else:
dic[s] += 1
res = 0
for v in dic.values():
if v >= 2:
res += v*(v-1)
print(res//2) |
p03211 | s425038327 | Accepted | s = input()
a = []
for i in range(3,len(s)+1):
a.append(s[i-3:i])
min = 1000
for i in a:
if min > abs(753 - int(i)):
min = abs(753 - int(i))
print(min)
|
p02607 | s088008817 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
if (i + 1) % 2 == 1:
if a[i] % 2 == 1:
ans += 1
print(ans)
|
p03680 | s796590869 | Accepted | n, *a = map(int, open(0))
done = [0] * n
b = 1
cnt = 0
while not done[b - 1]:
if b == 2:
print(cnt)
exit()
done[b - 1] = 1
b = a[b - 1]
cnt += 1
print(-1) |
p03774 | s260361866 | Wrong Answer | n, m = map(int, input().split())
p = [list(map(int, input().split())) for i in range(n + m)]
for a, b in p[:n]:
x = [abs(a - c) + abs(b - d) for c, d in p[n:]]
print(x.index(min(x)) + 1) |
p02793 | s725000698 | Accepted | import sys
from fractions import gcd
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
res = 0
for x in a:
l = x * l // gcd(x, l)
l %= mod
for x in a:
res += l * pow(x, mod - 2, mod)
res %= mod
print(res)
|
p03329 | s092701945 | Accepted | L = [1]
n = int(input())
x = 6
y = 9
while x <= n:
L.append(x)
x *= 6
while y <= n:
L.append(y)
y *= 9
L.sort()
dp = [float("Inf")]*(n+1)
dp[0] = 0
for i in range(n+1):
for j in L:
if i+j <= n:
dp[i+j] = min(dp[i+j],dp[i]+1)
else:
break
print(dp[n]) |
p02718 | s915673373 | Wrong Answer | n,m = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
M = round(sum(arr)/(2*m))
cnt = 0
for i in range(n):
if arr[i] >= M:
cnt+=1
if cnt == m or cnt > m:
print('Yes')
else:
print('No')
|
p02796 | s162228051 | Wrong Answer | N = int(input())
# X, L = [], []
A = []
for i in range(N):
x, l = map(int, input().split())
# X.append(x)
# L.append(l)
A.append((x - l, x + l))
A.sort()
ans = 0
x = -10e50
for i in range(N):
l, r = A[i]
if x <= l:
ans += 1
x = r-1
print(ans)
# 選べるロボットの中で最もX+Lが小さいもの
|
p03665 | s100501050 | Accepted | n,p=map(int,input().split())
A=[int(a)%2 for a in input().split()]
odd=sum(A)
if odd==0:
if p==1:print(0)
else:print(2**n)
else:print(2**(n-1)) |
p02547 | s629175165 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n=int(input().rstrip())
cnt=0
tmp=0
for i in range(n):
a,b=map(int,input().split())
if a==b:
tmp+=1
else:
cnt=max(cnt,tmp)
tmp=0
cnt=max(cnt,tmp)
if cnt>=3:
print("Yes")
else:print("No") |
p02900 | s186160780 | Accepted | from fractions import gcd
a, b = map(int, input().split())
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
print(len(set(prime_factorize(gcd(a, b)))) + 1) |
p03659 | s928988573 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
ans = 9999
x = 0
Sum = 0
for i in range(n):
Sum += a[i]
for i in range(n):
x += a[i]
y = Sum - a[i]
if i+1 < n:
ans = min(ans, abs(x-y))
print(abs(ans))
|
p02843 | s393216526 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
x = int(input())
def cond(x):
q, r = x // 100, x % 100
q5, r5 = r // 5, r % 5
if r5 == 0:
return q >= q5
else:
return q >= q5 + 1
if cond(x):
print(1)
else:
print(0)
|
p02621 | s532068062 | Wrong Answer | #!/usr/bin/env python3
def main():
a = int(input())
print(a+a^2+a^3)
if __name__ == '__main__':
main() |
p03069 | s883984220 | Accepted | n=int(input())
s=input()
a=[0]
for i in s:
if i==".":a+=[a[-1]+1]
else:a+=[a[-1]]
w=s.count(".")
print(min(i-a[i]+w-a[i] for i in range(n+1))) |
p03131 | s002570656 | Accepted | K, A, B = map(int, input().split())
if B - A <= 2 or A + 1 > K:
print(K + 1)
exit()
K -= A - 1
res = A
res += (B - A) * (K // 2)
if K % 2 == 1:
res += 1
print(res)
|
p03627 | s607385656 | Wrong Answer | import sys
import collections
n = int(input())
a = collections.Counter(list(map(int, sys.stdin.readline().split())))
chk = []
for i in a:
if a[i] >= 2:
chk.append([i, a[i]])
if len(chk) < 1:
print(0)
else:
if chk[0][1] >= 4:
print(chk[-1][0]*chk[-1][0])
exit()
print(chk[-1][0]*chk[-2][0])
|
p03804 | s732940835 | Wrong Answer | n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
x=0
for i in range(n-m):
for j in range(n-m):
for k in range(m):
if a[i][j]==b[k][0]:
for l in range(m):
if a[i][j+l]==b[k][l]:x+=1
if x==m:print('Yes')
else:print('No') |
p03474 | s434415030 | Wrong Answer | a,b = map(int,input().split())
s = list(input())
if "-" not in s:
print("No")
elif a==len(s[:s.index("-")]) and b==len(s[s.index("-")+1:]):
print("Yes")
else:print("No") |
p03605 | s250312824 | Wrong Answer | N = str(input())
if "9" == N[0] or "9" == N[1]:
print( "YES" )
else:
print( "NO" ) |
p02705 | s355102670 | Accepted | input_line = int(input())
result = 2 * input_line * 3.14
print(result) |
p02618 | s960114777 | Accepted | D = int(input())
C = list(map(int, input().split()))
# S = [[1st day], [2nd day], ..., [D-th day]]
S = []
for i in range(D):
Si = list(map(int, input().split()))
S.append(Si)
I = 26
last = [0]*I
score = S[1]
contest = score.index(max(score))
last = [x+1 for x in last]
last[contest] = 0
print(contest + 1)
for day in range(1, D):
score = [(last[i]*C[i])*I+S[day][i] for i in range(I)]
contest = score.index(max(score))
last = [x+1 for x in last]
last[contest] = 0
print(contest + 1)
|
p03254 | s958320857 | Accepted | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
for aa in a:
x -= aa
if x < 0:
print(res)
exit()
res += 1
if x == 0:
print(N)
else:
print(N - 1) |
p03796 | s314191684 | Accepted | n = int(input())
p = 1
mod = 10**9 + 7
for i in range(1,n+1):
p *= i
p %= mod
print(p) |
p02957 | s557100919 | Accepted | a,b=map(int,input().split())
x=(a+b)/2
if x.is_integer():
print(int(x))
else:
print("IMPOSSIBLE") |
p02658 | s294704891 | Accepted | N = int(input())
A_list = list(map(int,input().split()))
output = 1
flug = 0
if 0 in A_list:
print(0)
flug = 1
if flug != 1:
for i in range(N):
output *= A_list[i]
if (output > 10 ** 18):
print(-1)
flug = 1
break
if(flug != 1):
print(output) |
p02922 | s008415404 | Accepted | A,B = map(int,input().split())
print(1-(A-B)//(A-1)) |
p03261 | s484429452 | Accepted | # https://atcoder.jp/contests/abc109/tasks/abc109_b
n = int(input())
words = []
for _ in range(n):
words.append(input())
pre = words[0]
done = set([pre])
for i in range(1, n):
w = words[i]
if pre[-1] == w[0] and w not in done:
pre = w
done.add(w)
else:
print('No')
break
else:
print('Yes') |
p02753 | s082856026 | Wrong Answer | if __name__== '__main__':
s = input('>>')
if s[0] == 'A' and s[1] == 'A' and s[2] == 'A':
print('Yes')
elif s[0] == 'B' and s[1] == 'B' and s[2] == 'B':
print('Yes')
else:
print('No')
|
p02988 | s064236080 | Accepted | n = int(input())
num = list(map(int, input().split()))
count = 0
for i in range(1,n-1):
num1 = num[i-1:i+2]
num2 = sorted(num1)
if num2[1]==num1[1]: count += 1
print(count) |
p02700 | s759451301 | Accepted | #coding UTf-8
a,b,c,d = (int(x) for x in input().split())
while True:
c=c-b;
if c<=0:
print("Yes")
break;
a=a-d;
if a<=0:
print("No")
break; |
p02717 | s362436095 | Wrong Answer | x,y,z=map(int,input().split())
temp=x
y=x
x=temp
temp2=z
z=x
x=temp2
print(x,y,z) |
p02948 | s711735657 | Accepted | from collections import defaultdict
from heapq import heappush, heappop, merge
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
day = defaultdict(list)
for a, b in ab:
day[a].append(b)
work, ans = [], 0
for i in range(1, m + 1):
for j in day[i]:
heappush(work, -j)
if len(work) > 0:
ans -= heappop(work)
print(ans)
|
p03408 | s052980580 | Accepted | import collections
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]
s_counter = collections.Counter(s)
t_counter = collections.Counter(t)
ans = 0
for i in s_counter:
ans = max(ans, s_counter[i] - t_counter[i])
print(ans) |
p02789 | s165496793 | Accepted | N, M = map(int, input().split())
if N == M:
print('Yes')
else:
print('No') |
p03359 | s855077248 | Accepted | a,b=map(int,input().split())
if a>b:
print(a-1)
else:
print(a)
|
p02780 | s244881424 | Wrong Answer | N, K = map(int, input().split())
p = list(map(int, input().split()))
s = 0
for j in range(K):
s += p[j]
x = s
for k in range(N - K):
t = s - p[k] + p[K + k]
if s <= t:
x = t
else:
pass
s = t
print((x + K) / 2) |
p02624 | s534756180 | Accepted | n=int(input())
print(sum(map(lambda x:n//x*(n//x+1)//2*x,range(1,n+1)))) |
p03487 | s718491121 | Accepted | from collections import Counter
n = int(input())
dic = Counter(list(map(int,input().split())))
ans = 0
for k,v in dic.items():
if k > v:
ans += v
elif k < v:
ans += v-k
else:
pass
print(ans) |
p03345 | s604981560 | Accepted | import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
A, B, C, K = ri_()
print(A - B if K % 2 == 0 else B - A) |
p03730 | s708108556 | Wrong Answer | a,b,c = map(int,input().split())
ans = 'No'
for i in range(b):
if (a*i)%b == c:
ans = 'Yes'
break
print(ans) |
p03160 | s600224380 | Accepted | N = int(input())
[*h] = map(int, input().split())
dp = [float('inf') for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1]) |
p03219 | s678553569 | Accepted | a, b = (int(i) for i in input().split())
print(b//2+a) |
p03251 | s061230373 | Accepted | N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1] >= y[0]:
print("War")
else:
print("No War") |
p02719 | s493725339 | Accepted | N,K=list(map(int,input(' ').split(' ')))
print(min(N%K,(-N)%K)) |
p02640 | s085326496 | Accepted | x,y=(map(int,input().split()))
import sys
for a in range(x+1):
if 2*a+4*(x-a)==y:
print('Yes')
sys.exit()
print('No') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.