problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02659 | s981826047 | Accepted | a,b = map(str, input().split())
a = int(a)
b = int(b[0]+b[2:])
print(int(a*b)//100) |
p02718 | s706848594 | Accepted | N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
for i in range(M):
if A[i] < sum(A) / (4*M):
print('No')
exit()
print('Yes') |
p02802 | s657685232 | Accepted | n,m=map(int,input().split())
wa_check=[0 for _ in range(n+1)]
ac_check=[0 for _ in range(n+1)]
for i in range(m):
p,s=input().split()
p=int(p)
if(ac_check[p]==0):
if(s=='AC'):
ac_check[p]=1
else:
wa_check[p]+=1
wa_ans=[wa_check[i] for i in range(n+1) if ac_check[i]!=0]
print(sum(ac_check),sum(wa_ans))
|
p02606 | s620139671 | Accepted | L, R, d = [int(x) for x in input().split(" ")]
count = 0
for i in range(L, R+1):
if i % d == 0:
count += 1
print(count) |
p03557 | s603515256 | Wrong Answer | import sys
from bisect import bisect
n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
b = list(map(int, sys.stdin.buffer.readline().split()))
c = list(map(int, sys.stdin.buffer.readline().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in a:
for j in range(bisect(b, i), n):
ans += n - bisect(c, j)
print(ans) |
p02831 | s512890622 | Accepted | A, B = map(int, input().split())
min = min(A, B)
max = max(A, B)
cnt = 1
while True:
if max * cnt % min == 0:
print(max * cnt)
exit()
cnt += 1
|
p03779 | s920690123 | Accepted | #ABC056-C
x = int(input())
#2次方程式を解く
t = int((-1+(1+8*x)**0.5)//2)
if t * (t+1) // 2 >= x:
print(t)
else:
print(t+1) |
p02754 | s618735344 | Wrong Answer | N, A, B = map(int, input().split())
a = N // (A + B)
if N % (A+B) != 0:
a_cnt = ( a * A ) + ( N % (A+B) )
else:
a_cnt = a * A
print(a_cnt) |
p02859 | s193493132 | Accepted | r=int(input())
print(int(r**2)) |
p02848 | s959502074 | Wrong Answer | n=int(input())
s=input()
ans=""
for i in range(len(s)):
tmp=ord(s[i])+2
if tmp>90:
tmp-=26
ans+=chr(tmp)
print(ans) |
p03076 | s902118605 | Accepted | a=[int(input()) for i in range(5)]
result=0
ans=0
x=10
for i in a:
if i%10!=0:
result+=(i//10+1)*10
else:
result+=i
for i in a:
if i%10!=0:
ans=i%10
if ans<x:
x=ans
print(result+x-10)
|
p02775 | s965215593 | Accepted | n = [0] + list(map(int, input())) + [0]
n = n[::-1]
#print(n)
b0 = [0]*len(n)
b1 = [0]*len(n)
b1[0] = 1
for i in range(1, len(n)):
num = n[i]
b0[i] = min(b0[i-1]+num, b1[i-1]+num+1)
b1[i] = min(b0[i-1]+10-num, b1[i-1]+10-(num+1))
print(min(b0[-1], b1[-1]))
#print(b0[-1], b1[-1]) |
p03210 | s002298921 | Wrong Answer | a=int,input()
if a==7 or 5 or 3:
print('YES')
else:
print('NO') |
p03962 | s748318467 | Accepted | a=input().split()
print(len(set(a))) |
p02725 | s157328211 | Accepted | import sys
input = sys.stdin.readline
def main():
k, n = map(int, input().rstrip().split())
a = [int(_) for _ in input().rstrip().split()]
dist = [(a[i] - a[i - 1]) % k for i in range(n)]
print(k - max(dist))
if __name__ == "__main__":
main()
|
p03721 | s561481017 | Accepted | N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A.sort()
sums=0
for i in range(N):
sums+=A[i][1]
if sums>=K:
print(A[i][0])
break |
p02623 | s100878282 | 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()))
count = 0
for i in range(N + M):
if len(A) == 0:
book = B[0]
B.popleft()
elif len(B) == 0:
book = A[0]
A.popleft()
else:
if A[0] <= B[0]:
book = A[0]
A.popleft()
else:
book = B[0]
B.popleft()
if K >= book:
count += 1
K -= book
else:
break
print(count) |
p03719 | s813861313 | Accepted | a,b,c=map(int, input().split())
if a<=c<=b:
print("Yes")
else:
print("No") |
p03821 | s921605613 | Accepted | n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab=ab[::-1]
#print(ab)
ans=0
for a,b in ab:
if (a+ans)%b!=0:
ans+=b-(a+ans)%b
print(ans) |
p03324 | s535240088 | Accepted | d, n = map(int, input().split())
if n == 100:
print(101*100**d)
else:
print(100**d*n)
|
p03645 | s317411072 | Accepted | n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
l = [[] for i in range(n)]
ab.sort()
for i in range(m):
x = ab[i]
l[x[0]-1].append(x[1]-1)
l[x[1]-1].append(x[0]-1)
for i in l[0]:
if n-1 in l[i]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
p02773 | s224359667 | Wrong Answer | import collections
n=int(input())
data=[""]*n
for i in range(n):
data[i]=input()
count=collections.Counter(data)
num=max(count.values())
for v,k in count.items():
if k==num:
print(v) |
p02582 | s995456813 | Accepted | s = input()
ans = 0
if s.count("R") == 3:
print(3)
elif s.count("R") == 2:
if s[0] == s[1] or s[1] == s[2]:
print(2)
else:
print(1)
elif s.count("R") == 1:
print(1)
else:
print(0) |
p03681 | s564354226 | Accepted | def factorial(n):
fact = 1
for i in range(2, n+1):
fact = fact * i % (10**9+7)
return fact
N, M = map(int, input().split())
MOD = 10**9+7
if N == M:
print(2*factorial(N)**2 % MOD)
elif abs(N-M) == 1:
print(factorial(min(N, M))**2 * max(N, M) % MOD)
else:
print(0) |
p02676 | s327972578 | Accepted | k = int(input())
s = input()
if len(s) <= k:
print(s)
else:
print(s[:k] + '...') |
p03645 | s247880038 | Accepted | n,m = map(int,input().split())
l = [-1] + [[] for i in range(n)]
for i in range(m):
a,b = map(int,input().split())
l[a].append(b)
l[b].append(a)
for mid in l[1]:
if n in l[mid]:
print('POSSIBLE')
exit()
print('IMPOSSIBLE') |
p02684 | s808583316 | Accepted | n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]
x = True
y = [1, 1] + [0]*(n-1)
while x:
c.append(a[c[-1]])
y[c[-1]] += 1
if y[c[-1]] == 2:
x = False
t = c.index(c[-1])
if k <= t:
ans = c[k]
else:
ans = c[t + ((k-t) % (len(c)-1-t))]
print(ans) |
p03910 | s089310185 | Accepted | N = int(input())
s = set()
ans = 0
for i in range(1, N + 1):
ans += i
s.add(i)
if ans >= N:
break
if ans > N:
s.remove(ans - N)
for n in s:
print(n) |
p03035 | s118961375 | Accepted | a,b=map(int,input().split())
if a>=13:
print(b)
elif a<=12 and a>=6:
print(int(b/2))
else:
print(0)
|
p03012 | s644112351 | Accepted | N = int(input())
W = list(map(int, input().split()))
S = []
s = 0
for i in range(N):
s += W[i]
S.append(s)
print(min([abs(S[N-1] - 2 * S[i]) for i in range(N)])) |
p02681 | s308248351 | Accepted | n = input()
s = input()
if n == s[:-1] and len(n) == len(s)-1:
print('Yes')
else :
print('No') |
p03317 | s266003007 | Accepted | import math
import itertools
#n = int(input())
#n, d = list(input().split())
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
point = 0
i = 0
while N > point:
i+=1
if i==1:
point+=K
else:
point+=(K-1)
print(i)
|
p02843 | s247459568 | Accepted | X = int(input())
err = 0
while X >= 0:
X -= 100
err += 5
#print(X, err)
if 0 <= X <= err:
print('1')
break
else:
print('0')
|
p02917 | s570749317 | Accepted | n = int(input())
b = list(map(int, input().split()))
ans = b[0]
for i in range(1,n-1):
if b[i-1] <= b[i]:
ans += b[i-1]
else:
ans += b[i]
print(ans+b[-1])
|
p02754 | s917668223 | Accepted | n,a,b=map(int,input().split())
# x=n//(a+b)
# y=n%(a+b)
# print(a*x+min(y,a))
if a==0:
print(0)
else:
x=n//(a+b)
y=n%(a+b)
print(a*x+min(y,a)) |
p02598 | s944408717 | Accepted | from math import ceil
def check(A, K, L):
i = 0
for a in A:
i += ceil(a/L)-1
if i > K:
return False
return True
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
l = 0
r = A[0]
while l + 1 < r:
m = (l+r)//2
if check(A, K, m):
r = m
else:
l = m
print(r) |
p02911 | s714761987 | Accepted | N, K, Q = (int(x) for x in input().split())
A = [int(input()) for i in range(Q)]
ans = [K-Q for i in range(N)]
for a in A:
ans[a-1] += 1
for b in ans:
if b > 0:
print("Yes")
else:
print("No")
|
p03767 | s814918229 | Accepted | n=int(input())
a=list(map(int,input().split()))
a.sort()
sum=0
for i in range(n):
sum+=a[n+i*2]
print(sum)
|
p03239 | s446217835 | Accepted | def main():
N, T = map(int, input().split())
ans = 1001
for _ in range(N):
c, t = map(int, input().split())
if t <= T:
ans = min(c, ans)
if ans == 1001:
print("TLE")
else:
print(ans)
if __name__ == "__main__":
main()
|
p03328 | s336440371 | Accepted | A,B=map(int,input().split())
N=B-A
X=N*(N+1)//2
print(X-B) |
p02766 | s786563164 | Wrong Answer | import math
n, k = map(int, input().split())
print(math.ceil(math.log(n, k)))
|
p03061 | s482368962 | Wrong Answer | import math
N=int(input())
A=list(map(int,input().split()))
a=math.gcd(A[0],A[1])
b=A[0]
c=A[1]
for i in range(2,N):
a=math.gcd(a,A[i])
b=max(a,math.gcd(b,A[i]))
c=max(a,math.gcd(c,A[i]))
print(max(a,b,c)) |
p03069 | s047922892 | Accepted | import sys
input = sys.stdin.readline
import sys
sys.setrecursionlimit(10**7)
def main():
n=int(input())
s=input()
sw,sb=[0],[0]
w,b=0,0
for si in s:
if si=='#':
b+=1
else:
w+=1
sw.append(w)
sb.append(b)
ans=n
for i in range(n+1):
ans=min(ans,sw[n]-sw[i]+sb[i])
print(ans)
if __name__=='__main__':
main()
|
p02583 | s762367303 | Accepted | n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
x, y, z = sorted([l[i], l[j], l[k]])
if x + y > z and x != y and y != z:
ans += 1
print(ans) |
p03061 | s529591293 | Accepted | import math
n = int(input())
a = list(map(int,input().split()))
ar = a[::-1]
l = [0]
r = []
tmp1 = 0
tmp2 = 0
for i in range(n-1):
tmp1 = math.gcd(tmp1, a[i])
l.append(tmp1)
tmp2 = math.gcd(tmp2, ar[i])
r.append(tmp2)
r.reverse()
r.append(0)
ans = 1
for i in range(n):
ans = max(ans, math.gcd(l[i], r[i]))
print(ans) |
p03071 | s004065085 | Accepted | A,B=map(int,input().split())
if A==B:
print(A+A)
else:
print(max(A,B)*2-1) |
p02631 | s594594967 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = a[0]
for v in a[1:]:
b ^= v
for v in a:
print(v ^ b)
print(*map(lambda x: x ^ b, a))
|
p03457 | s186105596 | Accepted | N = int(input())
currentTime = 0
current = [0, 0]
for i in range(N):
timeStamp = list(map(int, input().split()))
reqLen = abs(timeStamp[1] - current[0]) + abs(timeStamp[2] - current[1])
timeLen = timeStamp[0] - currentTime
if reqLen > timeLen:
print("No")
exit()
if reqLen % 2 != timeLen % 2:
print("No")
exit()
currentTime = timeStamp[0]
current = timeStamp[1:]
print("Yes")
|
p03994 | s005974905 | Wrong Answer | s=list(input())
k=int(input())
cnt=0
for i in range(len(s)):
num_al=ord(s[i])
a_=123-num_al
if k==0:break
if a_<=k:
k-=a_
s[i]='a'
elif a_>k and i<len(s)-1:continue
else:
s[i]=chr(num_al+k)
k=0
print(''.join(s)) |
p02724 | s928575152 | Wrong Answer | X = int(input())
a, mod = divmod(X, 500)
b = mod % 5
print(a * 1000 + b * 5)
|
p02947 | s137062274 | Accepted | from collections import Counter
n = int(input())
ans = []
cnt = 0
for i in range(n):
s = input()
l = list(s)
l.sort()
ans.append("".join(l))
c = Counter(ans)
for i in c.values():
cnt += i*(i-1)//2
print(cnt) |
p03377 | s395593260 | Wrong Answer | a,b,x = map(int,input().split())
if a<x and b>x:
print("Yes")
else:
print("No") |
p03211 | s787428438 | Accepted | def solve():
N = input()
target = 753
ans = 1000
for i in range(len(N)-2):
ans = min(ans, abs(753-int(N[i:i+3])))
print(ans)
if __name__ == '__main__':
solve() |
p02982 | s637640411 | Wrong Answer | n,d = map(int,input().split())
try:
a = [list(map(int,input().split())) for j in range(0,n)]
except EOFError:
pass
c = 0
r = 0
for i in range(0,n-1):
for j in range(i+1,n):
for k in range(0,d):
c+=(a[i][k]-a[j][k])**2
ans = c**(1/2)
if isinstance(ans,int) == True:
r += 1
print(r) |
p02645 | s543541237 | Accepted | S = input()
print(S[:3])
|
p02720 | s626278307 | Accepted |
def makeLunLun(num):
lunlunNums = []
m = num % 10 -1
z = m + 1
p = m + 2
if m >= 0:
lunlunNums.append(num * 10 + m)
lunlunNums.append(num * 10 + z)
if p <= 9:
lunlunNums.append(num * 10 + p)
return lunlunNums
K=int(input())
queue = [1,2,3,4,5,6,7,8,9]
i=0
while K > len(queue):
lunluns = makeLunLun(queue[i])
queue += lunluns
i += 1
print(queue[K-1]) |
p03435 | s358860431 | Accepted | c = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
for j in range(1, 3):
if (c[i][0] - c[j][0]) != (c[i][1] - c[j][1]) or (c[i][2] - c[j][2]) != (c[i][1] - c[j][1]) or (c[i][2] - c[j][2]) != (c[i][0] - c[j][0]):
print('No')
exit()
print('Yes') |
p02702 | s572359859 | Accepted | # multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
ti1 = (ln +(int(line[-1*i])*d))%2019
counts[ti1] += 1
ln = ti1
d *= 10
d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
total += counts[i]*(counts[i] - 1)/2
print(int(total)) |
p03262 | s603100190 | Accepted | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
n, X = map(int, input().split())
x = list(map(int, input().split()))
a = abs(x[0] - X)
for i in x[1:]:
a = gcd(a, abs(i - X))
print(a) |
p03997 | s848526079 | Accepted | # 入力
a = int(input())
b = int(input())
h = int(input())
# 処理
area = (a + b) * h // 2
# 出力
print(area) |
p03645 | s371962553 | Wrong Answer | N, M = map(int, input().split())
ab=[]
for _ in range(M):
ab.append(tuple(map(int, input().split())))
#print(ab)
from_1=set([el[1] for el in ab if el[0]==1])
from_N=set([el[0] for el in ab if el[1]==N])
#print(from_1, from_N)
if from_1 & from_N:
print('POSSIBLE')
else:
print('IMPOSSILBE')
|
p02598 | s465477582 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
# にぶたん: 答えをx以下にできるか?
ok, ng = 10 ** 9 + 1, 0
while abs(ok - ng) > 1:
x = (ok + ng) // 2
cnt = 0
for a in A:
if a <= x:
continue
cnt += a // x
if cnt > K:
ng = x
break
else:
ok = x
print(ok)
|
p03254 | s298623985 | Accepted | #S= str(input())
#T= str(input())
N,X = map(int,input().split())
#N = int(input())
A = list(map(int,input().split()))
c=0
while X>=min(A):
if len(A)==1:
if X==A[0]:
c+=1
print(c)
exit()
else:
print(c)
exit()
if X>=min(A):
X-=min(A)
A.remove(min(A))
c+=1
print(c)
|
p02742 | s313112769 | Accepted | def main():
H, W = map(int, input().split())
if H == 1 or W == 1:
print(1)
return
ans = 0
ans += ((W + 1) // 2) * ((H + 1) // 2)
ans += (W // 2) * (H // 2)
print(ans)
if __name__ == '__main__':
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
|
p03162 | s628421095 | Accepted | import sys
input = sys.stdin.readline
n = int(input())
abc = [[int(i) for i in input().split()] for j in range(n)]
def happy(n, abc):
da, db, dc = 0, 0, 0
for a, b, c in abc:
na = max(db, dc) + a
nb = max(da, dc) + b
nc = max(da, db) + c
da, db, dc = na, nb, nc
return max(da, db, dc)
print(happy(n, abc)) |
p03286 | s350228094 | Accepted | n = int(input())
s = []
i = 1
m = (n%2)
s.append(n%2)
while 1:
if m == n:
break
if n%(2**(i+1)) == m or n%(2**(i+1))-2**(i+1) == m:
s.append(0)
else:
s.append(1)
m += (-2)**i
i += 1
print(''.join(map(str, s[::-1])))
|
p02900 | s450032400 | Accepted | import fractions
A, B = map(int, input().split())
x = fractions.gcd(A, B)
C = []
def cal(i):
for j in range(2, int(-(-i**0.5//1))+1):
while True:
if i%j == 0:
i //= j
C.append(j)
else:
break
if i != 1:
C.append(i)
return set(C)
print(1+len(cal(x))) |
p03433 | s808202208 | Accepted | N = int(input())
A = int(input())
print('Yes' if N%500 <= A else 'No')
|
p02819 | s623616608 | Accepted | import math
X = int(input())
c = 0
N = True
while N:
for i in range(2,math.ceil((X+c)**.5)+1):
if (X+c)%i == 0:
c += 1
break
else:
N = False
print(X+c if X>2 else 2) |
p03146 | s897188044 | Wrong Answer | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def fanc(n):
if n % 2 == 0:
res = n // 2
else:
res = 3 * n + 1
return res
s = int(readline())
n = fanc(s)
i = 2
while n > 4:
n = fanc(n)
i += 1
print(i+3)
|
p02879 | s001318997 | Wrong Answer | a, b = map(int, input().split())
print(a*b) |
p02576 | s473268165 | Accepted | N, X, T = map(int, input().split())
print((N + (X-1)) // X * T)
|
p03042 | s869138723 | Accepted | s=str(input())
a,b=int(s[:2]),int(s[2:])
f,g= 1<=a and a<=12, 1<=b and b<=12
if f and g:
print("AMBIGUOUS")
elif f:
print("MMYY")
elif g:
print("YYMM")
else:
print("NA") |
p02818 | s941134377 | Accepted | A,B,K=(map(int,input().split()))
if A<=K:
B=B-K+A
A=0
if B<0:
B=0
else:
A=A-K
print(A,B)
|
p02690 | s309684695 | Wrong Answer | import math
x = int(input())
xx = int(x ** (1/5))
for i in range(-xx, xx + 1):
a5 = i ** 5
b5 = a5 - x
if b5 > 0:
if b5 == int(b5 ** (1/5)):
print(i, b5)
break
else:
if (-1*b5) == int((-1*b5) ** (1/5)):
print(i, b5)
break |
p02793 | s650926965 | Wrong Answer | from functools import reduce
from fractions import gcd
import numpy as np
MOD = 10**9+7
def lcm_base(x, y):
return x * (y // gcd(x, y))
def main():
N = int(input())
a = [int(i) for i in input().split()]
A = np.array(a)
lcm = reduce(lcm_base, A, 1)
B = lcm // A
print(np.sum(B) % MOD)
if __name__ == "__main__":
main()
|
p02688 | s911038277 | Accepted | N, K = map(int, input().split())
x = [0] * (N+1)
for i in range(K):
d = int(input())
if d > 0:
a = list(map(int, input().split()))
for v in a:
x[v] += 1
# print(a)
c = 0
for i in range(1, N+1, 1):
if x[i] == 0:
c += 1
print(c) |
p03000 | s352099154 | Wrong Answer |
n,x = map(int,input().split())
l = list(map(int,input().split()))
a = [0]
for i in range(n):
a.append(a[i] + l[i])
#print(a)
for j in range(len(a)):
if a[j] <= x:
pass
else:
print(j)
break
|
p03345 | s840673244 | Accepted | A, B, C, K = map(int, input().split())
ans = A-B if K % 2 == 0 else B-A
print(ans) |
p02707 | s046204820 | Wrong Answer | in1 = int(input())
A = list(map(int, input().split()))
for i in range(1, in1):
print(A.count(i)) |
p03673 | s232249201 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = [-1] * (n + 2)
mid = n // 2
left = mid - 1
right = mid + 1
b[mid] = a[0]
for i in range(1, n):
if not i % 2 == n % 2:
b[left] = a[i]
left -= 1
else:
b[right] = a[i]
right += 1
for i in b:
if i < 0:
continue
print(i, end=" ") |
p03478 | s580940604 | Wrong Answer | N, A, B=map(int, input().split())
ans=0
for i in range(1, N+1):
s=str(i)
x=0
for j in s:
x+=int(j)
if A<=x<=B:
ans+=1
print(ans) |
p02743 | s130942784 | Accepted | from decimal import *
a, b, c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
|
p03986 | s019419972 | Wrong Answer | X = str(input())
count= 0
count2 = 0
Nagasa = len(X)
for i in range (0, len(X)):
if 2*count2 == Nagasa:
print(2*count)
exit()
if X[i] == 'T':
count+=1
count2+=1
if X[i] == 'S':
count-=1
print(0) |
p03797 | s532585521 | Accepted | N,M=map(int,input().split())
#Sをすべて使うとき必要なCの数は2N
if M<2*N:
print(M//2)
else:
ans=N#現時点で作ったScc
m=M-2*N#残りのc
#Sccを1こ作るのにcは4つ必要
ans+=m//4
print(ans) |
p02607 | s158380511 | Accepted | N = int(input().strip())
a = [int(v) for v in input().strip().split(" ")]
num = 0
for i in range(N):
if (i+1) % 2 != 0 and a[i] % 2 != 0:
num += 1
print(num) |
p02793 | s436190096 | Wrong Answer | import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
n = input()
arr = np.array(list(map(int, input().split())))
def lcm(a):
from fractions import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
lcm_v = lcm(arr)
div_arr = lcm_v / arr
print(int(div_arr.sum()) % (10**9 + 7)) |
p02683 | s234994997 | Accepted | N, M, X = map(int, input().split())
BOOKS = [tuple(map(int, input().split())) for _ in range(N)]
INF = 10 ** 8
ans = INF
for selection in range(1 << N):
price = 0
values = [0] * M
for i in range(N):
if selection & (1 << i):
x = BOOKS[i]
price += x[0]
for j in range(M):
values[j] += x[j+1]
if all(v >= X for v in values):
ans = min(ans, price)
if ans == INF:
print(-1)
else:
print(ans) |
p02688 | s317411522 | Wrong Answer | N,K = map(int,input().split())
S = [0 for i in range(N)]
for i in range(K):
d = int(input())
A = list(map(int,input().split()))
for j in range(d):
S[j-1]+=1
ans = 0
for i in range(N):
if S[i]==0:
ans+=1
print(ans) |
p02584 | s400338629 | Wrong Answer | x,k,d = map(int,input().split())
if x>=k*d:
print(x-k*d)
else:
temp = x//d
if temp%2==k%2:
min_ = temp
max_ = temp+2
else:
min_ = temp-1
max_ = temp+1
if max_ > k:
max_ = min_
#print(min_,max_)
ans = min(abs(x-d*min_),abs(x-d*max_))
print(ans) |
p03624 | s862677582 | Accepted | #071_B
s=input()
c='a'
while c<='z':
if c not in s:
print(c)
exit()
c=chr(ord(c)+1)
print('None') |
p02657 | s429045135 | Wrong Answer | A,B=(int(x) for x in input().split())
A*B |
p03494 | s393366903 | Wrong Answer | n = int(input())
x = list(map(int,input().split()))
count = 0
temp = 0
for i in range(len(x)):
temp += x[i]
while temp%2==0:
temp = 0
for i in range(len(x)):
x[i] = int(x[i] / 2)
temp += x[i]
count+=1
print(count)
|
p03328 | s570302469 | Wrong Answer | a, b = map(int, input().split())
print(((a-b)*(a-b)-(a+b))/2) |
p02606 | s282938065 | Accepted | N, M, d = map(int, input().split())
cnt = 0
for i in range(N, M + 1):
if i % d == 0: cnt += 1
print(cnt)
|
p03785 | s616372297 | Wrong Answer | N,C,K = map(int,input().split())
T = sorted([int(input()) for _ in range(N)])
ans = 0
count = 0
time = 0
for i in range(N):
if T[i] > time + K:
ans += 1
count = 0
if count == 0:
time = T[i]
count += 1
if count == C:
ans += 1
count = 0
if count > 0:
ans += 1
print(ans) |
p03286 | s879016463 | Accepted | n=int(input())
x=""
while n!=0:
x=str(n%2)+x
n=-(n//2)
print(0 if x=="" else x) |
p02726 | s900490493 | Wrong Answer | N, X, Y = map(int, input().split(" "))
k = 0
while k < X:
print(N-k)
k += 1
nodes = [i for i in range(1, N+1)]
del nodes[(X+Y)//2-1]
k += 1
while k < N:
print(len(nodes)-k)
k += 1 |
p02732 | s082661836 | Accepted | n = int(input())
A = list(map(int, input().split()))
C = {}
for a in A:
if a in C:
C[a] += 1
else:
C[a] = 1
s = int(sum(c * (c - 1) / 2 for c in C.values()))
for a in A:
print(int(s - C[a] + 1))
|
p02684 | s087102162 | Accepted | n, k = map(int, input().strip().split())
L = list(map(int, input().strip().split()))
L = [v - 1 for v in L]
seen = set()
cur = 0
untillBackToIntersec = 0
while cur not in seen:
seen.add(cur)
untillBackToIntersec += 1
cur = L[cur]
intersec = cur
cur = 0
beforeLoop = 0
while cur != intersec:
cur = L[cur]
beforeLoop += 1
if k<=beforeLoop:
proceed=k
else:
loopSize = untillBackToIntersec - beforeLoop
proceed=(k - beforeLoop) % (loopSize) + beforeLoop
ans = 0
for _ in range(proceed):
ans = L[ans]
print(ans + 1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.