problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02688 | s428401355 | Wrong Answer | n,k=map(int,input().split())
l=[]
count=0
for _ in range(k):
d=int(input())
a=list(map(int,input().split()))
l+=a
for i in range(1,n+1):
if i in l:
count+=1
print(count) |
p02676 | s154614926 | Accepted | K = int(input())
S = input()
if len(S) <= K:
ans = S
else:
ans = S[0:K] + '...'
print(ans) |
p03680 | s422850652 | Accepted | N = int(input())
A = {}
for i in range(N):
A[i+1] = int(input())
B = [-1 for i in range(N+1)]
B[1] = 0
i = 1
while 1:
j = A[i]
if j == 2:
print(B[i] + 1)
break
elif B[j] != -1:
print(-1)
break
else:
B[j] = B[i] + 1
i = j |
p02996 | s565332268 | Accepted | N = int(input())
T = []
for i in range(N):
T.append(tuple(map(int, input().split())))
T = sorted(T, key=lambda x:x[1])
t = 0
for a, b in T:
t += a
if t > b:
print("No")
quit()
print("Yes") |
p03495 | s719261433 | Wrong Answer | from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if n<=k:
print(0)
else:
c = Counter(a)
cv = sorted(c.values())
ans+=sum(cv[:k-1])
print(ans) |
p02711 | s721639865 | Accepted | N=int(input())
a=N//100
b=(N%100)//10
c=(N%100)%10
if a==7 or b==7 or c==7:
print('Yes')
else:
print('No') |
p03695 | s433170909 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
a = sorted([i//400 for i in a])
min = 0
max = 0
flag = -1
for i in range(n):
if a[i] >= 8:
max += 1
elif flag != a[i]:
min += 1
max += 1
flag = a[i]
print(min,max) |
p02675 | s873601814 | Accepted | N = int(input())
A = [2, 4 , 5, 7, 9]
B = [0, 1, 6, 8]
C = [3]
if N%10 in A:
print("hon")
if N%10 in B:
print("pon")
if N%10 in C:
print("bon")
|
p03556 | s217809687 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
i = 1
while i ** 2 <= N:
i += 1
if i ** 2 > N:
print((i - 1) ** 2)
sys.exit()
|
p03815 | s951440528 | Accepted | #!/usr/bin/env python3
n = int(input())
if (n % 11) == 0: print((n // 11)*2)
elif n % 11 <= 6: print((n // 11)*2 + 1)
else: print((n // 11)*2 + 2) |
p02641 | s000401768 | Accepted | x,y=map(int,input().strip().split())
nums = list(map(int, input().strip().split()))
ans=0
if y==0:
print(x)
elif x not in nums:
print(x)
else:
for i in range(0,102):
if i not in nums:
if abs(x-i)<abs(x-ans):
ans=i
print(ans) |
p03711 | s940029530 | Wrong Answer | x,y=map(int,input().split())
A=[1,3,5,7,10,12]
B=[4,6,9,11]
C=[2]
print("Yes" if x in A and y in A else "Yes" if x in B and y in B else "Yes" if x in C and y in C else "No") |
p03994 | s804984630 | Accepted | s = list(input())
K = int(input())
def plus(c,i):
return chr((ord(c)-ord('a')+i)%26+ord('a'))
# 上から順に回るなら回す
for i,ss in enumerate(s):
want = (ord('z') + 1 - ord(ss))%26
if K >= want:
s[i] = plus(s[i],want)
K = K - want
K = K % 26
if K >= 1:
s[-1] = plus(s[-1],K)
print("".join(s)) |
p03075 | s598632053 | Accepted | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
from itertools import permutations, combinations,combinations_with_replacement,product
ls = [a,b,c,d,e]
comb = list(combinations(ls,2))
flag=0
for i in range(10):
sa = abs(comb[i][1] - comb[i][0])
if sa > k:
... |
p02578 | s193462719 | Accepted | # coding: utf-8
# Your code here!
n = int(input())
a = list(map(int,input().split(" ")))
dai = 0
for i in range(1,n):
if a[i] < a[i-1]:
dai += a[i-1] - a[i]
a[i] = a[i-1]
print(dai) |
p02744 | s911305149 | Wrong Answer | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n=int(input())
al=[chr(ord('a') + i) for i in range(15)]
def dfs(c,i):
if i==n:
print(c)
return
for k in range(ord(c[-1])-ord('a')+2):
dfs(c+al[k],i+1)
dfs("a",1) |
p02786 | s122091899 | Accepted | h = int(input())
ans = 1
total = 2
while total<=h:
ans += total
total = total * 2
print(ans) |
p02576 | s382940311 | Accepted | kk = list(map(int, input().split()))
a = kk[0] - (kk[0] % kk[1])
b = a / kk[1]
if (kk[0] % kk[1]) == 0:
answer = b * kk[2]
else:
answer = (b + 1) * kk[2]
print(int(answer)) |
p03803 | s044277817 | Accepted | A, B = map(int, input().split())
ans = ["Alice", "Bob", "Draw"]
if A == 1:
A = 14
if B == 1:
B = 14
if A > B:
print(ans[0])
elif A == B:
print(ans[2])
else:
print(ans[1])
|
p03107 | s106076498 | Wrong Answer | s=input()
a=0
b=0
for i in range(len(s)):
if s[i]=="1":
a+=1
else:
b+=1
print(min(a,b)*2)
print(a,b) |
p03994 | s634386510 | Accepted | S=input()
K=int(input())
c2i=lambda c: ord(c)-ord("a")
i2c=lambda i: chr(i+ord("a"))
A=list(map(c2i, S))
for i in range(len(A)):
if A[i] and 26-A[i]<=K:
K-=26-A[i]
A[i]=0
A[-1]+=K
A[-1]%=26
print("".join(map(i2c,A))) |
p02702 | s410494473 | Accepted | s = input()
l = list(s)
n = len(s)
dp = [0] * 2019
dp[0] = 1
x = 0
for i in range(n):
x = ((int(l.pop()) * pow(10, i, 2019)) + x) % 2019
dp[x] += 1
answer = 0
for i in range(2019):
answer += dp[i] * (dp[i] - 1) / 2
print(int(answer)) |
p03251 | s268251705 | Accepted | N,M,X,Y = map(int, input().split())
x = list(set(map(int, input().split())))
y = list(set(map(int, input().split())))
x.sort(), y.sort()
Z = min(y)
fl = True
for i in range(N):
if x[i] < Z and (X<Z<=Y):
continue
else:
fl = False
print('No War') if fl else print('War')
|
p03013 | s997832348 | Accepted | N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
dp[1] = 1
else:
dp[1] = 0
for i in range(2, N + 1):
if i in a:
continue
dp[i] = dp[i - 1] + dp[i - 2]
dp[i] %= INF
print(dp[N])
|
p02602 | s782100169 | Wrong Answer | import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
prod = [math.log(a[0])]*(n+1)
for i in range(n):
prod[i+1] = prod[i] + math.log(a[i])
for i in range(k+1,n+1):
if prod[i] - prod[i-k] > prod[i-1] - prod[i-1-k]:
print('Yes')
else:
print('No') |
p02814 | s384164628 | Wrong Answer | def gcd(n,m):
n,m=sorted([n,m])
while(m%n!=0):
n,m=m%n,n
return n
def lcm(n,m):
return n*m//gcd(n,m)
n,m=map(int,input().split())
l=list(map(int,input().split()))
t=l[0]//2
for i in l[1:]:
t=lcm(t,i//2)
print(-(-(m//t)//2)) |
p03745 | s136701962 | Accepted | N = int(input())
A = list(map(int,input().split()))
G = 0
Z = 0
ans = 1
for i in range(N-1):
if A[i+1] > A[i]:
G += 1
elif A[i+1] < A[i]:
Z += 1
if G != 0 and Z != 0:
ans += 1
G = 0
Z = 0
print(ans)
|
p02947 | s536180644 | Accepted | import numpy as np
def Speed_Anag_Count(String):
count = {}
for i in String:
i = sorted(i)
i = str(''.join(i))
if count.get(i) is None:
count[i] = 0
count[i] += 1
return count
N = int(input())
S = [str(input()) for _ in range(N)]
count = Speed_Anag_Count(... |
p02713 | s299208929 | Accepted | import math
n = int(input())
ans = 0
t = [math.gcd(i, j) for i in range(1, n+1) for j in range(1, n+1)]
for i in t:
for j in range(1, n+1):
ans += math.gcd(i, j)
print(ans)
|
p02748 | s236312581 | Wrong Answer | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
x_input, y_input, c_input = map(int, input().split())
kingaku.append(a[x_input-1]+b[y_input-1]+c_input)
kingaku.append(min(a)+min(b))
print(min(kingaku)) |
p02595 | s122359816 | Accepted | n,d=map(int,input().split());print(sum([d**2>=a**2+b**2 for a,b in [list(map(int,input().split())) for _ in range(n)]])) |
p03448 | s727071207 | Accepted | a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
res += 1
print(res)
|
p02726 | s483308598 | Accepted | n, x, y = map(int, input().split())
x -= 1
y -= 1
dists = [0] * (n-1)
for i in range(n):
for j in range(i+1, n):
d = min(
abs(j-i),
abs(i-x) + abs(y-j) + 1,
abs(i-y) + abs(x-j) + 1
)
dists[d-1] += 1
print(*dists, sep='\n') |
p03131 | s029604608 | Accepted | K,A,B=map(int,input().split())
if A<B:
if K+2<A:
print(K+1)
else:
T=K-(A-1)
if T%2==0:
ans=A+(T//2)*(B-A)
print(max(ans,K+1))
else:
ans=A+(T//2)*(B-A)
print(max(ans+1,K+1))
else:
print(K+1) |
p03087 | s234542669 | Wrong Answer | n, q = map(int, input().split())
s = input().rstrip()
pos = []
for i in range(n - 1):
if s[i] == 'A' and s[i + 1] == 'C':
pos.append(i)
print(pos)
for i in range(q):
l, r = map(int, input().split())
l -= 1
r -= 1
ans = 0
for j in range(len(pos)):
if l <= pos[j] <= r - 1:
... |
p03285 | s113418323 | Accepted | n = int(input())
for i in range(50):
for j in range(50):
if 4*i + 7*j == n:
print("Yes")
exit()
print("No") |
p02711 | s315090205 | Accepted | def main():
n = list(input())
if "7" in n:
print("Yes")
else:
print("No")
return
if __name__== "__main__":
main() |
p04033 | s500149234 | Wrong Answer | a, b= map(int, input().split())
if (a<0)and(b<0):
print('Negative')
elif (a>0)and(b>0):
print('Positive')
elif (a==0)or(b==0):
print('Zero')
else:
print('Zero') |
p02756 | s751188255 | Wrong Answer | s=input()
q=int(input())
a=[list(map(str,input().split())) for i in range(q)]
ans=[]
ans.append(s)
for i in range(q):
if len(a[i])==1:
ans.insert(0,ans[-1])
ans.append(ans[1])
ans.pop(1)
ans.pop(-2)
else:
if a[i][1]=='1':
ans.insert(0,a[i][2])
else:
ans.append(a[i][2])
print(... |
p03487 | s216572779 | Accepted | from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
d[i] += 1
ans = 0
for v, c in d.items():
if v > c:
ans += c
elif v < c:
ans += c - v
print(ans) |
p02948 | s548994526 | Accepted | import sys
input = sys.stdin.readline
from collections import *
from heapq import *
N, M = map(int, input().split())
d = defaultdict(list)
for _ in range(N):
A, B = map(int, input().split())
d[A].append(B)
pq = []
ans = 0
for i in range(M, -1, -1):
for v in d[M-i]:
heappush(pq, -v)
if l... |
p03377 | s037999659 | Accepted | a,b,x=map(int,input().split())
if a <= x <= a+b:
print('YES')
else:
print('NO')
|
p02993 | s147404933 | Wrong Answer | def main():
N = list(input())
if len(N) == len(set(N)):
print("Good")
else:
print("Bad")
if __name__ == '__main__':
main()
|
p03379 | s541585625 | Wrong Answer | N=int(input())
X=list(map(int, input().split()))
X.sort()
for i in range(N):
if i < N//2:
print(X[ N//2 ])
else:
print(X[N//2-1])
|
p03548 | s630877040 | Accepted | x,y,z=map(int,input().split())
print(len(range(z+y,x-z+1,z+y))) |
p02608 | s786706180 | Accepted | import math
def f(x, y, z):
return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)
n = int(input())
fs = [0] * n
lim = math.floor(math.sqrt(n))
rng = range(1, lim)
for x in rng:
for y in rng:
for z in rng:
v = f(x, y, z)
if v <= n:
fs[v - 1] += 1
for i in range(n):
print(fs[i]) |
p03435 | s108888523 | Accepted | c=[list(map(int,input().split())) for _ in range(3)]
ans = "Yes"
for i in range(2):
if c[i+1][1]-c[i+1][0] != c[0][1]-c[0][0]:
ans = "No"
if c[i+1][2]-c[i+1][1] != c[0][2]-c[0][1]:
ans = "No"
for j in range(2):
if c[1][i+1]-c[0][i+1] != c[1][0]-c[0][0]:
ans = "No"
if c[2][i+1]-... |
p02983 | s844784903 | Accepted | from itertools import combinations
# input
L, R = map(int, input().split())
# check
mod0 = [n for n in range(0, R + 1, 2019) if L <= n]
if not mod0:
target_num = list(range(L, R + 1))
nC2 = list(combinations(target_num, 2))
mods_ans = [(i * j) % 2019 for i, j in nC2]
print(min(mods_ans))
else:
pr... |
p03323 | s033688513 | Wrong Answer | A,B = map(int,input().split())
if A > 8 or B > 8:
print(":)")
else:
print("Yay!") |
p03862 | s002250358 | Accepted | n,x = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = 0
for i in a:
s = max(0, t+i-x) # 一つ前の値の差分を含めて、xとの差分を取得し、比較
t = i - s
ans += s
print(ans) |
p03721 | s082442801 | Accepted | def main():
n, k = map(int, input().split())
a, b = [0 for i in range(n)], [0 for i in range(n)]
for i in range(n):
a[i], b[i] = [int(x) for x in input().split()]
ans = solve(n, k, a, b)
print(ans)
def solve(n, k, a, b):
ab = [[a[i], b[i]] for i in range(n)]
ab.sort(key = lambda x:... |
p02836 | s328188048 | Accepted | s = input()
t = s[::-1]
cnt = 0
for i in range(len(s)):
if s[i] != t[i]:
cnt += 1
print(cnt // 2) |
p02606 | s083036947 | Wrong Answer | l,r,d = map(int,input().split())
print( (1 + r - l) // d ) |
p03323 | s763566443 | Accepted | a, b = map(int, input().split())
if a > 8 or b > 8:
print(":(")
else:
print("Yay!")
|
p03659 | s698886414 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
asum = sum(a)
aave = asum // 2
s1 = 0
s2 = 0
i = 0
if N != 2:
while s1 <= aave and i < N:
s2 = s1
s1 += a[i]
i += 1
if i == N:
print(min(abs(s[0: N - 2] - s[N - 1]), abs(s[0] - s[1: N - 1])))
exit()
print(min(... |
p02711 | s404450112 | Accepted | import sys
# sys.stdin = open('input.txt')
n = input()
if n.__contains__('7'):
print('Yes')
else:
print('No') |
p02910 | s832225754 | Accepted | def i():
return int(input())
def i2():
return map(int,input().split())
def s():
return str(input())
def l():
return list(input())
def intl():
return list(int(k) for k in input().split())
s = s()
for i in range(len(s)):
if i%2 == 0 and s[i] not in ["R","U","D"]:
print("No")
exit()
elif i%2 == 1 and s[i] not ... |
p02623 | s638384170 | 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)
|
p03607 | s047069999 | Accepted | # solution
import io
data = int(input())
array = set()
for _ in range(data):
ai = int(input())
if ai in array:
array.remove(ai)
else:
array.add(ai)
print(len(array)) |
p02725 | s199309671 | Accepted | import numpy as np
K,N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = []
maxdist = 0
for i in range(N-1):
B.append(A[i+1]-A[i])
if B[-1]>maxdist:
maxdist = B[-1]
if A[0]+K-A[-1]>maxdist:
maxdist = A[0]+K-A[-1]
print(K - maxdist)
|
p02578 | s478687725 | Accepted | import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
return map(int,input().split())
def ii():
return int(input())
sys.setrecursionlimit(10**9)
N = ii()
A = [i for i in mips()]
ans = 0
for i in range(... |
p02621 | s352326597 | Wrong Answer | from sys import stdin
input = stdin.readline
s = int(input())
N=s+s*s+s*s*s
print (type(N), N)
|
p03860 | s017134562 | Accepted | s = input()
print('A{}C'.format(s[8])) |
p02689 | s399772121 | Accepted | from collections import defaultdict as dd
d = dd(list)
n, m = map(int, input().split())
h = list(map(int, input().split()))
for i in range(m):
a, b = map(int, input().split())
d[a].append(b)
d[b].append(a)
ans = []
for i in range(n):
flg = True
for nb in d[i+1]:
if h[i] <= h[nb-1]:
... |
p02701 | s101355059 | Accepted | import collections
n = int(input())
l = []
for i in range(n):
l.append(input())
c = collections.Counter(l)
print(len(c)) |
p03012 | s259997160 | Wrong Answer | N = int(input())
W = list(map(int, input().split()))
half = sum(W) / 2
first_half = 0
for i in range(N):
first_half += W[i]
mid_index = i
if first_half >= half:
break
second_half = sum(W[i+1:])
print(abs(first_half - second_half)) |
p03696 | s262410274 | Wrong Answer | n = int(input())
s = input().replace("()", "X").replace("(", "(S").split("S")
ans = ""
for q in s:
ans += q.count(")") * "(" + q
ans += ")" * len(ans[ans.rfind(")") + 1:])
print(ans.replace("X", "()")) |
p03659 | s108101070 | Wrong Answer | n = int(input())
lst1 = list(map(int,input().split()))
s = sum(lst1)
abs_ = 10**9
now = 0
i = 0
while True:
now += lst1[i]
if i >= n-1:
break
else:
abs_ = min(abs_,abs(now-(s-now)))
i += 1
print(abs_)
|
p03645 | s272648144 | Accepted | N,M=map(int,input().split())
A=[[] for _ in range(N+1)]
for _ in range(M):
a,b=map(int,input().split())
A[a].append(b)
ans=False
for i in A[1]:
if i==N:
ans=True
break
for j in A[i]:
if j==N:
ans=True
break
print("POSSIBLE" if ans else "IMPOSSIBLE" )
|
p02801 | s747551872 | Wrong Answer | print(chr(ord(input("input:")) + 1)) |
p02996 | s434113870 | Accepted | n=int(input())
l=[]
for i in range(n):
a,b=map(int,input().split())
l.append([b,a])
l.sort()
time=0
cnt=0
for i in range(n):
time+=l[i][1]
if time>l[i][0]:
print("No")
break
else:
cnt+=1
if cnt==n:
print("Yes") |
p02597 | s700519221 | Accepted | n = int(input())
c = str(input())
a, b = 0, 0
a = c.count('R')
ans = max(a, b)
for i in range(n):
if c[i] == 'R':
a -= 1
else:
b += 1
ans = min(ans, max(a, b))
print(ans)
|
p03331 | s737882375 | Wrong Answer | N=list(input())
ans=0
for x in N:
x=int(x)
if x%2==1:
ans+=1
ans+=(x//2)*2
print(ans) |
p03548 | s118968551 | Accepted | X, Y, Z = map(int, input().split())
for i in range(100000):
if X / (i* Y + (i + 1) * Z) >= 1:
pass
else:
print(i - 1)
break |
p02615 | s971953178 | Accepted | n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
ans=0
for i in range(1,n):
ans+=a[i//2]
print(ans) |
p03075 | s130301198 | Wrong Answer | l=[]
f=0
for i in range(5):
z=int(input())
l.append(z)
k=int(input())
for i in range(4):
for j in range(1,5):
if l[j]-l[i]>=k:
f=1
break
if f==1:
print(":(")
else:
print("Yay!")
|
p03160 | s423661503 | Wrong Answer | n = int(input())
h = list(map(int,input().split()))
dp = [10**4] * (n+1)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]))
print(dp)
print(dp[n-1]) |
p02556 | s298288926 | Accepted | n = int(input())
a, b = [], []
for _ in range(n):
x, y = map(int, input().split())
a.append(x+y)
b.append(x-y)
a.sort()
b.sort()
ans = max(a[-1]-a[0], b[-1]-b[0])
print(ans) |
p02724 | s688471736 | Accepted | n = int(input())
a = n//500
b = (n%500)//5
print(a*1000 + b*5) |
p02786 | s169898625 | Accepted | h = int(input())
def attack(a):
if a >1:
return 2 * attack(a//2) +1
elif a == 1:
return 1
print(attack(h)) |
p02786 | s495104125 | Accepted | import math
h = int(input())
atk = 0
enemy = 1
while True:
if h > 1:
h = math.floor(int(h/2))
atk += enemy
enemy *= 2
elif h == 1:
atk += enemy
break
print(atk)
|
p03380 | s071508046 | Wrong Answer | from bisect import bisect_right
n = int(input())
A = sorted(list(map(int, input().split())))
p = A[-1]
i = bisect_right(A[:-1], p/2)
q = A[i] if abs(A[i-1]-p/2) <= abs(A[i]-p/2) else A[i]
print(p, q) |
p02881 | s586173872 | Wrong Answer | n = int(input())
ans = 10**12
for k in range(1,n+1//2):
if n%k == 0 :
m = n//k + k - 2
if ans > m:
ans = m
print(m) |
p02791 | s519981451 | Accepted | n = int(input())
an = [int(i) for i in input().split()]
lowe, min_an_sub = 0, an[0]
an_sub = []
for i in range(0, n):
an_sub.append(an[i])
min_an_sub = min(min_an_sub, an[i])
if an_sub[i] <= min_an_sub:
lowe += 1
print(lowe) |
p03317 | s546835137 | Wrong Answer | n,k=map(int,input().split())
a=list(map(int,input().split()))
z=a.index(1)
L= -(-z//(k-1))
R=-(-(n-z-1)//(k-1))
print(L+R)
|
p02684 | s689580573 | Wrong Answer | #N=int(input())
N,K = map(int,input().split())
#N=int(input())
A = list(map(int,input().split()))
#S=str(input())
now=1
root=[1]
for i in range(N):
now=A[now-1]
if now in root:
index=root.index(now)
num=len(root[index:])
root=root[index:]
break
else:
root.append(now)... |
p03274 | s985299367 | Wrong Answer | N, K = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9 + 7
for i in range(N - K + 1):
print(i)
print(x[i],x[i+K-1])
if ans > abs(x[i]) + abs(x[i+K-1]) :
ans = x[K-1+i] - x[i] + min( abs(x[K-1+i]) , abs(x[i]) )
print(ans)
|
p03319 | s706725463 | Accepted | import math
n, k = map(int,input().split())
dat = list(map(int, input().split()))
i = dat.index(1) + 1 # 1 origin で i 個目に 1 がある
reached = k # 最初の1歩はkマス塗れる
# a: 残りはk-1マス塗れるので、残っている分を塗る(k<nなのでマイナスは考えない)
a = math.ceil((n - reached) / (k - 1))
print(1 + a) |
p03605 | s506492722 | Accepted | str = input().split()
n = str[0]
if n[0] == "9" or n[1] == "9": print("Yes")
else: print("No") |
p03067 | s100943131 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
a, b,c = map(int, input().split())
if a<=c<=b:
print('Yes')
elif a>=c>=b:
print('Yes')
else:
print('No')
|
p04045 | s969784382 | Accepted | s = input().split(" ")
n = int(s[0])
numbers = [ i for i in input() if i != " "]
for i in range(n, 100001):
found = False
snum = str(i)
for num in numbers:
if num in snum:
found = True
break
if found == False:
print(i)
break |
p03061 | s757587856 | Accepted | import math
from collections import deque
N = int(input())
A = list(map(int,input().split()))
M = 0
L = deque([0])
R = deque([0])
for i in range(1,N+1):
L.append(math.gcd(L[-1],A[i-1]))
R.appendleft(math.gcd(R[0],A[N-i]))
for j in range(N):
m = math.gcd(L[j],R[j+1])
M = max(M,m)
print(M) |
p02724 | s797964177 | Accepted | intInput = int(input())
a, b, c, d, e, f = 500, 100, 50, 10, 5, 1
sumResult = 0
num500 = intInput // 500
mod500 = intInput % 500
sumResult += num500 * 1000
num5 = mod500 // 5
sumResult += num5 * 5
print(sumResult)
|
p04019 | s144283692 | Accepted | s=input()
ans=[0]*4
check='NWSE'
for i in range(len(s)):
for j in range(len(check)):
if s[i]==check[j]:
ans[j]=1
if (ans[0]+ans[2])%2==0 and (ans[1]+ans[3])%2==0:
print('Yes')
else:
print('No') |
p02814 | s969247627 | Wrong Answer | import fractions
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
a_array = list(map(int,input().split()))
lcm = 1
for a in a_array:
a = a / 2
lcm = a * lcm / fractions.gcd(a,lcm)
# print(lcm)
for a in a_array:
p = lcm / (a / 2)
if p % 2 == 0:
print(0)
exit()
m_ma... |
p03852 | s964048125 | Accepted | C=str(input())
print("vowel" if C=="a" or C=="e" or C=="i" or C=="o" or C=="u" else "consonant") |
p03284 | s949168922 | Accepted | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
N,K=map(int,input().split())
... |
p03131 | s701979524 | Accepted | K,A,B=map(int,input().split())
ans = K+1
if (K - (A-1)) %2==0:
ans=max(ans,((K-(A-1))//2)*(B-A)+A)
else:
ans=max(ans,((K-(A-1))//2)*(B-A)+A+1)
print(ans) |
p02823 | s432873718 | Accepted | n,a,b = map(int,input().split())
if abs(a-b)%2 == 0:
print(abs(a-b)//2)
else:
print(min(2*n-a-b+1,a+b-1)//2) |
p02694 | s912824042 | Accepted | import math
def actual(x):
amount = 100
count = 0
while True:
amount *= 1.01
amount = math.floor(amount)
count += 1
if amount >= x:
return count
x = int(input())
print(actual(x))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.