problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03721 | s513720997 | Accepted | def main():
M = 10 ** 5
N, K = list(map(int, input().split(' ')))
count = [0 for _ in range(M + 1)]
for _ in range(N):
a, b = list(map(int, input().split(' ')))
count[a] += b
ans = 0
while K > 0:
ans += 1
K -= count[ans]
print(ans)
if __name__ == '__main__':
main() |
p03545 | s259284757 | Accepted | from itertools import product
ABCD = input()
for op in product('+-',repeat=len(ABCD)-1):
n = int(ABCD[0])
for i in range(1,len(ABCD)):
if op[i-1] == '+':
n += int(ABCD[i])
else:
n -= int(ABCD[i])
if n == 7:
print(ABCD[0],end='')
for i in range(1,len(ABCD)):
print(op[i-1]+ABCD[i],end='')
print('=7')
break |
p02696 | s227181865 | Accepted | import math
A, B, N = [int(i) for i in input().split()]
x = min(B-1, N)
ans = math.floor((A*x)/B) - A*math.floor(x/B)
print(ans) |
p02972 | s090076269 | Accepted | import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())), dtype=int)
b = np.zeros(n, dtype=int)
for i in range(n-1, -1, -1):
m = sum(b[i::i+1]) % 2
b[i] = (a[i] + m) % 2
bsum =sum(b)
if bsum == 0:
print(bsum)
else:
ans = np.where(b>0)[0] + 1
ans = ans.astype('str')
print(bsum)
print(' '.join(ans)) |
p02789 | s212010923 | Accepted | n,m = map(int,input().split())
if n == m :
print("Yes")
else :
print("No") |
p02973 | s345098733 | Accepted | from bisect import bisect_left
from collections import deque
n = int(input())
a = [int(input()) for _ in range(n)]
q = deque([-1])
for x in a:
insert_pos = bisect_left(q, x) - 1
# bisect_left[0,len(lis)] == 以上の最小
# 手前は未満の最大[-1,len(lis))
if insert_pos == -1:
q.appendleft(x)
else:
q[insert_pos] = x
ret = len(q)
print(ret)
# 最小パス被覆
|
p02819 | s500898345 | Wrong Answer | X=int(input())
x=0
for j in range(X,10**5+1):
for i in range(j-1,0,-1):
if i==1:
print(j)
x=1
elif j%i==0:
break
if x==1:
break |
p03163 | s750010728 | Accepted | N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for sum_w in range(W + 1):
if sum_w - w[i] >= 0:
dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i])
dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
print(dp[N][W]) |
p02778 | s702054162 | Wrong Answer | print('*'*len(input())) |
p02639 | s434138422 | Accepted | x=list(map(int,input().split()))
for i in range(5):
if x[i]==0:
print(i+1) |
p03998 | s736578037 | Accepted | s = {x:list(input()) for x in 'abc'}
i = 'a'
while s[i]:
i = s[i].pop(0)
print(i.upper()) |
p02882 | s527832744 | Accepted | # D - Water Bottle
import math
a, b, x = map(int, input().split())
if (a**2)*b <= 2*x:
tan_Theta = 2*((a**2)*b-x)/a**3
else:
tan_Theta = (a*(b**2))/(2*x)
print(math.degrees(math.atan(tan_Theta))) |
p03698 | s663889226 | Accepted | s = input()
if (len(s)==len(set(s))):
print('yes')
else:
print('no')
|
p03286 | s422467982 | Wrong Answer | n=int(input())
s=0
k=0
ans=[]
while n!=0:
if k%2==0:
x=n%(2**(k+1))
if x==0:
ans.append('0')
else:
ans.append('1')
n-=x
else:
x=n%(2**(k+1))
if x==0:
ans.append('0')
else:
ans.append('1')
n+=x
k+=1
print(''.join(ans)[::-1]) |
p03293 | s673635251 | Wrong Answer | S = str(input())
T = str(input())
for i in range(len(S)):
if S[i] != T[-(i+1)]:
print("No")
break
else:
print("Yes") |
p02953 | s673979092 | Wrong Answer | n = int(input())
l = [int(x) for x in input().split()]
#print(l)
for i in range(1,n)[::-1]:
if l[i-1] - 1 == l[i]:
l[i] = l[i] + 1
else:
continue
print(l)
a = 0
for j in range(1, n):
if l[j-1] <= l[j]:
continue
else:
print('No')
break
else:
print('Yes')
|
p03644 | s566261703 | Wrong Answer | n = int(input())
li = [1,2,4,8,16,32,64]
for i in range(7):
if n < li[i]:
print(li[i-1])
break |
p02658 | s519650967 | Wrong Answer | N=int(input())
P=[list(map(int,input().split()))]
import numpy
Q=numpy.array(P)
result =numpy.prod(Q[0])
if result>10**18:
print(-1)
else:
print(result) |
p03252 | s264317416 | Accepted | from collections import defaultdict
s = input()
t = input()
n = len(s)
ms = defaultdict(str)
mt = defaultdict(str)
for i in range(n):
if ms[s[i]] == '':
ms[s[i]] = t[i]
if mt[t[i]] == '':
mt[t[i]] = s[i]
if ms[s[i]] != t[i] or mt[t[i]] != s[i]:
print("No")
exit()
print("Yes")
|
p02760 | s620231826 | Accepted | import numpy as np
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
a_ = np.array(a)
cond = np.full([3,3], False)
for i in b:
cond[np.where(a_==i)] = True
naname = np.array([[cond[0,0], cond[1,1], cond[2,2]], [cond[0,2], cond[1,1], cond[2,0]]])
if True in np.all(cond==True, axis=0):
print("Yes")
elif True in np.all(cond==True, axis=1):
print("Yes")
elif True in np.all(naname==True, axis=1):
print("Yes")
else:
print("No") |
p03219 | s523734177 | Wrong Answer | X, Y = map(int, input().split())
print(X+(Y/2)) |
p03339 | s249471441 | Accepted | n = int(input())
s = list(input())
l = [0]
r = [0]
l_cnt = 0
r_cnt = 0
for i in range(n-1):
if s[i] == 'W':
l_cnt += 1
if s[n-i-1] == 'E':
r_cnt += 1
l.append(l_cnt)
r.append(r_cnt)
print(min(l[i]+r[n-i-1] for i in range(n)))
|
p02554 | s137256063 | Accepted | N = int(input())
ans = (10**N % (10**9+7)) - (2 * 9**N % (10**9+7)) + (8**N % (10**9+7))
if ans < 0:
ans += 10**9 + 7
print(ans) |
p03012 | s513283210 | Accepted | N = int(input())
W = list(map(int, input().split()))
S1 = 0
S2 = 0
ans = []
for i in range(N-1):
S1 = sum(W[:i+1])
S2 = sum(W[i+1:])
ans.append(abs(S1-S2))
print(min(ans)) |
p02793 | s415736753 | Wrong Answer | from functools import reduce
def gcd(x, y):
if x < y:
x, y = y, x
while x % y != 0:
r = x % y
x = y
y = r
return y
def inv(x):
return pow(x, MOD-2, MOD)
def lcm(a, b):
return a * b // gcd(a, b)
def addmod(a, b):
return (a+b) % MOD
N = int(input())
a_list = list(map(int, input().split()))
MOD = 10 ** 9 + 7
l = reduce(lcm, a_list) % MOD
ans = reduce(addmod, (l//a for a in a_list))
print(ans) |
p03469 | s318231368 | Wrong Answer | S=list(map(str,input()))
S[3] = '8'
print(S) |
p03329 | s564727506 | Accepted | n = int(input())
m = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
dp = [10**6 for i in range(100001)]
for mi in m:
dp[mi] = 1
for i in range(1,100001):
for mi in m:
if i+mi <= 100000:
dp[i+mi] = min(dp[i+mi],dp[i]+1)
else:
break
print(dp[n])
|
p02924 | s534543756 | Wrong Answer | N=int(input())
print(int(N*(N-1)/2+0.5)) |
p03252 | s316647954 | Accepted | s = input()
t = input()
d = {}
use = set()
for si,ti in zip(s,t):
if(si in d):
if(ti != d[si]):
print('No')
exit()
else:
if(ti in use):
print('No')
exit()
d[si] = ti
use.add(ti)
print('Yes') |
p03456 | s900062982 | Wrong Answer | a, b = map(int, input().split())
x = len(str(b))
now = b + a * (10 ** x)
for i in range(200):
if i * i == now:
print("Yes")
quit()
print("No")
|
p02879 | s788723521 | Accepted | a, b = map(int,input().split())
if a > 9 or b > 9:
print("-1")
else:
print(a * b) |
p02724 | s946006406 | Accepted | def main(x):
res = 0
val, mod = divmod(x, 500)
res += val * 1000
val, mod = divmod(mod, 5)
res += val * 5
return int(res)
x = int(input())
print(main(x)) |
p03997 | s523141115 | Accepted | import sys
input = sys.stdin.readline
inputs = [int(input()) for i in range(3)]
ans = ((int(inputs[0]) + int(inputs[1]))*int(inputs[2]))/2
print(int(ans)) |
p03854 | s655103773 | Accepted | s = input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES") |
p02584 | s398996557 | Accepted | # import sys
# input = sys.stdin.readline
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))
x,k,d = mp()
x = abs(x)
if x - k*d >= 0:
print(x-k*d)
else:
u = x % d
l = abs(u - d)
if (k - x//d) % 2 == 0:
print(u)
else:
print(l)
|
p03284 | s789595800 | Accepted | n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
print(1) |
p02718 | s596212615 | Accepted | N,M = map(int,input().split())
A = [int(i) for i in input().split()]
cnt = 0
for a in sorted(A,reverse=True):
if (sum(A)/(4 * M)) <= a:
cnt +=1
if cnt == M:
print('Yes')
break
if cnt < M:
print('No') |
p02570 | s472153324 | Accepted | D,T,S=map(int,input().split())
if D/S<=T:
print("Yes")
else:
print("No") |
p02958 | s894583558 | Accepted | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
geta = lambda fn: map(fn, readline().split())
gete = lambda fn: fn(readline())
# sys.setrecursionlimit(10**5)
def main():
N = gete(int)
p = list(geta(int))
q = sorted(p)
cnt = 0
for pi, qi in zip(p,q):
if pi != qi:
cnt += 1
if cnt <= 2:
print('YES')
else:
print('NO')
if __name__ == "__main__":
main() |
p03605 | s355079868 | Wrong Answer |
def main():
n = int(input())
if n / 10 == 9 or n % 10 == 9:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
|
p02779 | s021033624 | Accepted | N = int(input())
A = list(map(int,input().split()))
d = dict()
for i in range(N):
d[A[i]]=0
for n in range(N):
if d[A[n]] == 1:
print("NO")
break
if n == N-1:
print("YES")
d[A[n]] = 1
|
p02663 | s740340677 | Accepted | H1,M1,H2,M2,K=map(int,input().split())
up=60*(H2-H1)+(M2-M1)
print(up-K) |
p03105 | s328739167 | Accepted | a, b, c = map(int, input().split())
print(min(c, b//a))
|
p03317 | s694135441 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
if N % (K-1) == 0:
ans = N // (K-1)
else:
ans = (N // (K-1)) + 1
if N == K:
ans -= 1
print(ans) |
p02576 | s818478198 | Accepted | n,x,t = map(int,input().split())
if n % x == 0:
print(n // x * t)
else:
print(n // x * t + t) |
p02658 | s706350714 | Accepted | n = int(input())
a = list(map(int, input().split()))
ch1 = 0
for i in a:
if(i == 0):
print(0)
ch1 = 1
break
if(not ch1):
ans = 1
ch2 = 0
for i in a:
ans*=i
if(ans > int(1e18)):
print(-1)
ch2 = 1
break
if(not ch2):
print(ans)
|
p03679 | s302302735 | Wrong Answer | x, a, b = map(int, input().split())
if a - b > 0:
print('delicious')
elif b - a <= x:
print('safe')
else:
print('dangerous')
|
p03799 | s548341576 | Accepted | N, M = map(int, input().split())
ans = 0
if 2 * N == M:
ans = (2 * N + M) // 4
elif 2 * N > M:
ans = M // 2
else:
ans = N
ans += (M - 2 * N) // 4
print(ans)
|
p03386 | s052533541 | Accepted | a, b, k = map(int, input().split())
ans = set()
for i in range(a, min(a+k, b+1)):
ans.add(i)
for i in range(max(a, b-k+1), b+1):
ans.add(i)
ans = sorted(ans)
for i in ans:
print(i) |
p03814 | s888271436 | Wrong Answer | s = input()
A = None
Z = None
for i in range (len(s)):
if s[i] == 'A':
A = i
if s[i] == 'Z':
Z = i
print(Z-A+1) |
p03103 | s800970634 | Accepted | import math
n, m = map(int, input().split())
ab = []
ans = 0
sum = 0
for _ in range(n):
ab.append(list(map(int, input().split())))
ab.sort()
for i in range(n):
if m - ans < ab[i][1]:
sum += (m-ans) * ab[i][0]
ans = m
break
else:
ans += ab[i][1]
sum += ab[i][0] * ab[i][1]
if ans == m:
break
print(sum)
|
p02939 | s930571692 | Accepted | import sys
input = sys.stdin.readline
def main():
ans = 0
S = input().rstrip('\n')
p = t = ''
for i in S:
p += i
if t != p:
ans += 1
p, t = '', p
print(ans)
if __name__ == '__main__':
main() |
p03087 | s927970312 | Wrong Answer | n,q = map(int,input().split())
s = input()
array = [0]*len(s)
for i in range(len(s)-1):
if( s[i-1:i+1] == "AC" ):
if( i == 0 ):
array[i] = 1
else:
array[i] = array[i-1] + 1
else:
if( i == 0 ):
array[i] = 0
else:
array[i] = array[i-1]
array[len(s)-1] = array[len(s)-2]
for i in range(q):
l,r = map(int,input().split())
l -= 1
r -= 1
ans = array[r] - array[l]
print(ans)
|
p02682 | s038389399 | Accepted | a,b,c,k = map(int,input().split())
if a >= k:
print(k)
elif (a+b) >= k:
print(a)
else:
print(a-(k-a-b)) |
p02787 | s538627928 | Accepted | INF = 10**12
H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i, (a, b) in enumerate(magics):
for j in range(H+1):
dp[i+1][j] = min(dp[i+1][j], dp[i][j])
dp[i+1][min(H, j+a)] = min(dp[i+1][min(H, j+a)], dp[i+1][j] + b)
print(dp[N][H]) |
p02880 | s903214889 | Wrong Answer | import math
N = int(input())
lis = list(range(1, 10))
start_idx = 0
found = False
while start_idx < len(lis)-1:
if found:
break
idx = start_idx
for idx in range(len(lis)):
if lis[start_idx] * lis[idx] == N:
found = True
start_idx += 1
if found:
print('Yes')
else:
print('No') |
p02765 | s647382882 | Accepted | n, r = map(int, input().split())
if n >= 10:
print(r)
else:
print(100*(10-n)+r) |
p03437 | s371102363 | Accepted | x,y = map(int,input().split())
if x%y==0:
print(-1)
else:
print(x) |
p02576 | s977900281 | Accepted | N,X,T=map(int,input().split())
if N%X==0:
ans=N//X*T
else:
ans=(N//X+1)*T
print(ans) |
p02939 | s970585727 | Accepted | s = input()
n = len(s)
bef = s[0]
key = 0
ans = 1
for i in range(1, n):
if key == i:
continue
if bef == s[i]:
if i == n-1:
continue
bef = s[i:i+2]
ans += 1
key = i+1
else:
bef = s[i]
ans += 1
print(ans) |
p02612 | s515525950 | Wrong Answer | i = int(input())
print(i % 1000)
|
p03827 | s069121619 | Wrong Answer | N=int(input())
S=input()
x=0
ans=[]
for i in S:
ans.append(x)
if i=="I":
x+=1
elif i=="D":
x-=1
print(max(ans)) |
p02661 | s796734609 | Accepted | N = int(input())
AB = []
for i in range(N):
AB.append(list(map(int,input().split())))
A = []
B = []
for i in range(N):
A.append(AB[i][0])
B.append(AB[i][1])
A.sort()
B.sort()
if N%2==0:
A1 = A[N//2-1]
A2 = A[N//2]
B1 = B[N//2-1]
B2 = B[N//2]
print((B1+B2)-(A1+A2)+1)
else:
A1 = A[N//2]
B1 = B[N//2]
print((B1-A1)+1) |
p02866 | s654039370 | Accepted | MOD = 998244353
n = int(input())
d_lst = list(map(int, input().split()))
if d_lst[0] != 0:
print(0)
exit()
max_d = max(d_lst)
lst = [0 for _ in range(max_d + 1)]
for d in d_lst:
lst[d] += 1
if lst[0] != 1:
print(0)
exit()
ans = 1
for i in range(max_d):
ans *= pow(lst[i], lst[i + 1], MOD)
ans %= MOD
print(ans) |
p03386 | s681417980 | Accepted | a,b,k = map(int, input().split())
left_n = a+k if a+k-1<=b else b+1
right_n = b-k+1 if b-k+1>=a else a
left = [i for i in range(a, left_n)]
right = [i for i in range(right_n, b+1)]
print(*sorted(set(left+right)), sep='\n') |
p02642 | s424462145 | Wrong Answer | lst=[]
c=0
flag=0
n = int(input())
str = input()
lst = str.split(' ')
#for i in range(0,n):
# lst[i] = int(lst[i])
lst.sort()
#print(lst)
for i in range(0,n):
flag=0
if i+1<n:
if int(lst[i+1])==int(lst[i]):
flag=1
for j in range(0,i):
if int(lst[i])%int(lst[j])==0:
flag=1
j=i
if flag==0:
c = c+1
print(c)
|
p03645 | s993451377 | Accepted | N, M = map(int, input().split())
a_set = set()
b_set = set()
for _ in range(M):
a, b = map(int, input().split())
if a == 1:
a_set.add(b)
if b == N:
b_set.add(a)
# print('a_set, b_set', a_set, b_set)
product = a_set & b_set
if len(product) != 0:
print('POSSIBLE')
else:
print('IMPOSSIBLE')
|
p02572 | s206413071 | Accepted | mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = 0
for i in a:
s -= i
s %= mod
ans += i * s
ans %= mod
print(ans) |
p02786 | s153544881 | Accepted | h = int(input())
checked = {}
def check_attack(h):
if h == 1:
checked[h] = 1
return 1
elif h in checked:
return checked[h]
else:
k = 1 + 2 * check_attack(h//2)
checked[h] = k
return k
print(check_attack(h))
|
p02596 | s405035649 | Accepted | import time
K=int(input())
mod=7%K
if 7%K==0:
print(1)
exit()
ans=1
now=time.time()
while 1:
ans+=1
mod=(mod*10+7)%K
if mod==0:
print(ans)
break
if time.time()-now>=1.8:
print(-1)
break
|
p02706 | s042128241 | Accepted | n,m = map(int,input().split())
a = map(int,input().split())
x = n-sum(a)
if x >= 0:
print(x)
else:
print(-1) |
p03759 | s641459750 | Wrong Answer | a, b, c = map(int, input().split())
if b - a == c - b:
print('Yes')
else:
print('No') |
p02818 | s435409263 | Accepted | A, B, K = [int(x) for x in input().split()]
if K <= A:
print(A - K, B)
else:
print(0, max(0, A + B - K)) |
p02665 | s779606395 | Accepted | n,*a = map(int,open(0).read().split())
pm = sum(a)
e = 1
te = 1
for i in a:
pm -= i
e = min((e-i)*2,pm)
te += e
if e < 0:
break
if e < 0:
print(-1)
else:
print(te)
|
p02601 | s987106894 | Accepted | A,B,C = map(int,input().split())
K = int(input())
ans = 0
while B<=A:
ans += 1
B *= 2
while C<=B:
ans += 1
C *= 2
print("Yes" if ans <= K else "No")
|
p02622 | s208814227 | Accepted | S=input()
T=input()
ans=0
for i in range(len(S)):
if S[i]!=T[i]:
ans+=1
print(ans) |
p03797 | s904312117 | Accepted | n, m = map(int, input().split())
if m>=2*n:
p = n+(m-2*n)//4
else:
p = m//2
print(p) |
p02971 | s143197615 | Accepted | import copy
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
a_max = max(a)
n_ = sum(x == a_max for x in a)
if n_ > 1:
a_max_2 = a_max
for _ in range(n):
print(a_max)
else:
#a_max_2=sorted(set(a))[-2]
b = copy.copy(a)
b.remove(a_max)
a_max_2 = max(b)
for i in a:
if i == a_max:
print(a_max_2)
else:
print(a_max) |
p02701 | s675729116 | Accepted | N = int(input())
S = set([input() for _ in range(N)])
print(len(S))
|
p03059 | s737498640 | Accepted | a,b,t=map(int, input().split())
print(b*((t//a))) |
p03379 | s149462982 | Accepted | n=int(input())
x=list(map(int,input().split()))
y=sorted(x)
L=y[n//2-1]
R=y[n//2]
for i in range(n):
if x[i]<=L:
print(R)
else:
print(L) |
p03835 | s806415359 | Accepted | K, S = map(int, input().split())
ans = 0
for x in range(K+1):
for y in range (K+1):
if 0 <= S - x- y <= K:
ans +=1
print(ans) |
p03285 | s687721222 | Accepted | N = int(input())
for f in range(0,26):
for s in range(0,15):
if (4*f)+(7*s)==N:
print('Yes')
break
elif (f==25) and (s==14):
print('No')
else:
continue
break |
p03548 | s970640512 | Wrong Answer | x,y,z = map(int, input().split())
print((x-1)//(y+z)) |
p03206 | s629894004 | Wrong Answer | s = int(input())
if s == 25:
print("Christmas")
elif s == 24:
print("Christmas Eve")
elif s == 23:
print("Christmas Eve Eve")
elif s == 22:
print("Chrsitmas Eve Eve Eve") |
p04030 | s682084941 | Wrong Answer | S = input ()
Z = ''.join(list(S))
Z = Z.replace('0B', '')
Z = Z.replace('1B', '')
Z = Z.replace('B', '')
print (Z) |
p03221 | s110953109 | Accepted | n,m=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(m)]
l2=sorted(l,key=lambda x:x[1])
d=dict()
for p,y in l2:
if not p in d.keys():
d[p]=dict()
d[p][y]=len(d[p])+1
for p,y in l:
print('{}'.format(p).zfill(6)+'{}'.format(d[p][y]).zfill(6))
|
p03377 | s039152411 | Accepted | a,b,x=map(int,input().split())
if a <= x <= a+b:
print("YES")
else:
print("NO") |
p02796 | s096176709 | Wrong Answer | N = int(input())
robos = []
for i in range(N):
x, l = map(int, input().split())
robos.append((x, l))
robos.sort()
kosuu = 0
maenomigi = -100000000000000000000000
for x, l in robos:
# ok
if maenomigi <= x - l:
maenomigi = x + l
kosuu += 1
print(kosuu)
|
p02814 | s956913519 | Wrong Answer | N,M=map(int,input().split())
a=input().split()
scm=[]
for x in range(1,M+1):
for _a in a:
p=x/int(_a)-0.5
if not(p > 0 and p%1==0):
break
else:
scm.append(x)
if len(scm)>1:
break
if len(scm)!=0:
d=abs(scm[0]-scm[1])
print(len(range(min(scm),M+1,d)))
else:
print(0) |
p02780 | s279415326 | Accepted | n,k=map(int,input().split())
p=[int(i)+1 for i in input().split()]
num=sum(p[:k])
ans=num
for i in range(n-k):
tmp=p[i+k]-p[i]
num+=tmp
if ans<num:
ans=num
print(ans/2)
|
p03745 | s084446575 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 1
u = False
d = False
for i in range(1, n):
if u:
if a[i] < a[i - 1]:
u = False
ans += 1
elif d:
if a[i] > a[i - 1]:
d = False
ans += 1
else:
if a[i] > a[i - 1]:
u = True
elif a[i] < a[i - 1]:
d = True
print(ans) |
p03657 | s725036549 | Wrong Answer | a,b=map(int,input().split())
print('Possible' if (a+b)%3==0 else 'Impossible') |
p04045 | s073321785 | Accepted | n, k = map(int, input().split())
d = set(map(int, input().split()))
ok = set(range(10))
ans = 0
for i in range(n, 100000):
ans = i
flag = False
while i != 0:
if i % 10 in d:
flag = True
break
i = i // 10
if not flag:
print(ans)
break
|
p03862 | s419879673 | Accepted | def solve():
n, x = map(int, input().split())
s = list(map(int, input().split()))
cnt, tmp, prv = 0, 0, 0
if s[0] > x:
cnt += s[0] - x
s[0] = x
for y in s:
if prv + y > x:
tmp = prv + y - x
cnt += tmp
prv = y - tmp
else:
prv = y
print(cnt)
solve()
|
p03680 | s683744178 | Accepted | N = int(input())
l = [(int(input())-1) for _ in range(N)]
flag = [0]*N
flag[0] = 1
flag[1] = 2
cnt = 0
cur_b = 0
while True:
cnt += 1
next_b = l[cur_b]
if flag[next_b] == 1:
print(-1)
break
elif flag[next_b] == 2:
print(cnt)
break
else:
flag[next_b] = 1
cur_b = next_b
else:print(-1)
|
p03282 | s100484195 | Wrong Answer | S = list(map(int,list(input())))
K = int(input())
if sum(S[:K]) == K:
print('1')
else:
for s in S:
if s == 1:
continue
else:
print(s)
break |
p03043 | s377432571 | Accepted | N, K = map(int, input().split())
ans = 0
def num(i):
j = 0
while i < K:
i *= 2
j += 1
return j
for i in range(1, N+1):
ans += float(1) / (N*2**num(i))
print(ans)
|
p02600 | s843361713 | Accepted | def main():
x = int(input())
print(10 - x // 200)
if __name__ == '__main__':
main()
|
p03284 | s521449196 | Accepted | n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
print(1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.