problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02873 | s859090488 | Wrong Answer | a = input()
t = 0
ans = 0
f = a[0]
if f == '>':ans+=1
elif f == '<':t = 0
for i in a[1:]:
# print(f,i)
if f == '>' and i == '<':
t = 0
elif f == '<' and i == '>':
t += 1
ans +=t
if t != 1 : t = 0
else:
t += 1
ans+=t
f = i
# print(t,ans)
if f == '>':t=1
print(ans+(f == '<')) |
p03146 | s992862921 | Accepted | def collatz(n):
if n % 2 == 0:
return int(n/2)
else:
return 3 * n + 1
A = [int(input())]
i = 1
while True:
x = collatz(A[-1])
if x in A:
print(i + 1)
break
else:
A.append(x)
i += 1
|
p02572 | s756005627 | Accepted | n = int(input())
a = list(map(int,input().split()))
MOD = 10**9+7
array_sum = 0
for i in range(n):
array_sum += a[i]
array_sum %= MOD
ans = 0
for i in range(n):
array_sum -= a[i]
ans += array_sum * a[i]
ans %= MOD
print(ans) |
p02767 | s388667008 | Wrong Answer | N=int(input())
X=list(map(int,input().split()))
s=0
sum=0
for i in X:
sum+=i
sum=round(sum/len(X),0)
print(sum)
for i in X:
tmp=(i-sum)**2
s=s+tmp
print(s)
|
p03637 | s464495461 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
X = [0,0,0]
for i in range(len(A)):
if A[i]%4 == 0:
X[2] += 1
elif A[i]%2 == 0:
X[1] += 1
else:
X[0] += 1
if 2*X[2] + X[1] >= N:
print("Yes")
else:
print("No") |
p02639 | s311230010 | Accepted | n=list(map(int,input().split()))
p=sum(n)
f=15
ans=(f-p)
print(ans)
|
p02922 | s221736838 | Accepted | a, b = map(int, input().split())
ans = 0
tap = 1
while tap < b:
tap += a - 1
ans += 1
print(ans) |
p02659 | s822813910 | Wrong Answer | A, B=input().split()
B=float(B)
B="%.2f" % round(B, 2)
re=int(A)*float(B)
print (int(re//1)) |
p02888 | s651638530 | Accepted | import sys
import bisect
input = sys.stdin.readline
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
index = bisect.bisect_left(L, L[i] + L[j])
n = index - j - 1
ans += n
print(ans)
|
p03799 | s425010838 | Accepted | #import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions import gcd
#input=sys.stdin.readline
#import bisect
n,m=map(int,input().split())
if n>=m//2:
print(m//2)
else:
ans=n+(m-2*n)//4
print(ans) |
p02694 | s758222684 | Accepted | X = int(input())
year = 0
deposit = 100
while deposit < X:
deposit = deposit*101//100
year += 1
print(year) |
p02641 | s630895280 | Accepted | import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))
pN.sort()
diff = 0
if n == 0:
print(x)
else:
while(1):
if x-diff not in pN:
print(x-diff)
exit()
elif x+diff not in pN:
print(x+diff)
exit()
diff+=1 |
p02766 | s899976320 | Accepted | a, b = map(int, input().split())
def Base_10_to_n(X, n):
if (int(X/n)):
return Base_10_to_n(int(X/n), n)+str(X%n)
return str(X%n)
print(len(Base_10_to_n(a, b))) |
p03673 | s510437433 | Accepted | from collections import deque
n=int(input())
a=list(map(int,input().split()))
head=False
d = deque()
for i in range(n):
if head==True:
d.appendleft(a[i])
else:
d.append(a[i])
head = not head
if head==True:
d=list(d)
print(*d[::-1])
else:
print(*d) |
p02813 | s473573550 | Accepted | def fact(n):
ret=1
for i in range(2,n+1):
ret=ret*i
return ret
n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
cnt1=0
cnt2=0
checked1=[0]*(n+1)
checked2=[0]*(n+1)
for i in range(n):
checked1[arr1[i]]=1
checked2[arr2[i]]=1
cnt1+=(arr1[i]-1-sum(checked1[:arr1[i]]))*fact(n-i-1)
cnt2+=(arr2[i]-1-sum(checked2[:arr2[i]]))*fact(n-i-1)
print(abs(cnt1-cnt2)) |
p02963 | s139557200 | Wrong Answer | S = int(input())
from math import sqrt
rtS = sqrt(S)
u = 10 ** 9
ans = [0 for _ in range(6)]
ans[2] = u
ans[3] = 1
ans[4] = -S%u
ans[5] = S//u
print(*ans) |
p02996 | s374450590 | Wrong Answer | n = int(input())
ab = []
for _ in range(n):
a,b = map(int,input().split())
ab.append([a,b])
ab.sort(key=lambda x:x[1])
wrk = ab[0][0]
for i in range(n):
if wrk > ab[i][1]:
print('No')
exit()
wrk += ab[i][0]
print('Yes') |
p02618 | s466565557 | Accepted | import sys
import numpy as np
ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))
D = ri()
c = np.array(rl())
s = np.array([np.array(rl()) for _ in range(D)])
for lis in s:
tmp_list = lis ** 2 / c**0.01
max_idx = np.argmax(tmp_list)
print(max_idx + 1)
|
p03861 | s923210084 | Accepted | a,b,x=map(int,input().split())
a1=a//x
if a%x==0:
a1-=1
b1=b//x
print(b1-a1) |
p02861 | s243290094 | Accepted | import itertools
n = int(input())
pos = []
for _ in range(n):
x, y = map(int, input().split())
pos.append([x, y])
def dist(lst):
d = 0
for i in range(n-1):
lst1 = lst[i]
lst2 = lst[i+1]
d += ((lst1[0]-lst2[0])**2 + (lst1[1]-lst2[1])**2)**0.5
return d
d = 0
p_lst = list(itertools.permutations(pos, n))
for v in p_lst:
d += dist(v)
print(d / len(p_lst)) |
p02623 | s018238497 | Accepted | import itertools
def main():
n,m,k=map(int, input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
a = [0]+list(itertools.accumulate(a))
b = [0]+list(itertools.accumulate(b))
res = 0
j = m
best=0
for i in range(n+1):
if(a[i]>k):
break
while(b[j] > k-a[i]):
j-=1
res = max(res,i+j)
print(res)
if __name__ == '__main__':
main()
|
p02627 | s922098380 | Accepted | import sys
input = sys.stdin.readline
a = input()
if a.isupper():
print("A")
else:
print("a") |
p03821 | s511171567 | Wrong Answer | n = int(input())
a,b=[],[]
for i in range(n):
x,y = map(int,input().split())
a.append(x)
b.append(y)
print(a,b)
a=list(reversed(a))
b=list(reversed(b))
print(a,b)
OK=0
for i in range(n):
A=a[i]+OK
if A<b[i]:
ok=b[i]-A
elif A==b[i]:
continue
else:
ok=-(-A//b[i])*b[i]-A
OK+=ok
print(OK) |
p02784 | s006672531 | Accepted | h , n = map(int, input().split())
a = [int(i) for i in input().split()]
if sum(a) >= h:
print('Yes')
else:
print('No') |
p02548 | s740683438 | Accepted | n = int(input())
count = 0
for a in range(1,1000001):
b = a
while a*b < n:
if a == b:
count += 1
b += 1
else:
count += 2
b += 1
print(count) |
p02835 | s769136770 | Accepted | a,b,c = map(int,input().split())
if a+b+c>=22:
print("bust")
else:
print("win") |
p02963 | s322365854 | Accepted | import math
s = int(input())
x1 = math.ceil(math.sqrt(s))
y1 = 1
x2 = x1**2 - s
y2 = x1
x3 = 0
y3 = 0
print(x1, y1, x2, y2, x3, y3)
|
p02948 | s240324250 | Wrong Answer | def main():
import sys
from operator import itemgetter
input=sys.stdin.readline
n,m=map(int,input().split())
works=[list(map(int,input().split())) for i in range(n)]
works.sort(key=itemgetter(1,0),reverse=True)
j,money=0,0
for i in range(m):
while j<n and works[j][0]>m-i:
j+=1
if j!=n:
money+=works[j][1]
j+=1
else:
break
print(money)
if __name__=='__main__':
main()
|
p02657 | s862187645 | Accepted | a, b = map(int, input().split())
print(a*b)
|
p02859 | s632302537 | Wrong Answer | import math
a = int(input())
print(int((a * a * math.pi) / math.pi))
|
p03524 | s455274938 | Accepted | S = input()
C = [S.count('a'),S.count('b'),S.count('c')]
if len(S) == 1:
print('YES')
elif len(set(S)) == 1 or max(C)-min(C) > 1:
print('NO')
else:
print('YES') |
p03745 | s507089129 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
#%%
ans = 1
up = False
down = False
for n in range(N-1):
if A[n] < A[n+1]:
up = True
elif A[n] > A[n+1]:
down = True
if up == True and down == True:
ans += 1
up = False
down = False
|
p03345 | s164985078 | Wrong Answer | A, B, C, K = map(int, input().split())
print(A-B if K % 2 == 1 else B-A)
|
p02701 | s861247305 | Accepted | N = int(input())
S = []
for i in range(N):
s = input()
S.append(s)
print(len(set(S))) |
p03416 | s580294283 | Accepted | A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
a = str(i)
if all([a[i] == a[-i-1] for i in range(len(a))]):
ans += 1
print(ans) |
p02790 | s753877107 | Accepted | import sys
input = lambda: sys.stdin.readline().rstrip()
def solve():
a, b = map(int, input().split())
if a < b:
ans = str(a) * b
else:
ans = str(b) * a
print(ans)
if __name__ == '__main__':
solve()
|
p03774 | s253223325 | Accepted | n,m=[int(i) for i in input().split()]
ab_list=[]
for i in range(n):
a,b=[int(i) for i in input().split()]
ab_list.append([a,b])
cd_list=[]
for i in range(m):
c,d=[int(i) for i in input().split()]
cd_list.append([c,d])
for i in range(n):
len_list=[]
for j in range(m):
len=abs(ab_list[i][0]-cd_list[j][0])+abs(ab_list[i][1]-cd_list[j][1])
len_list.append(len)
print(len_list.index(min(len_list))+1)
|
p03862 | s090376358 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i, j in zip(range(N - 1), range(1, N)):
Asum = A[i] + A[j]
if Asum <= K:
continue
eat = Asum - K
d = min(eat, A[j])
A[j] -= d
eat -= d
ans += d
d = min(eat, A[i])
A[i] -= d
ans += d
print(ans) |
p03038 | s420827704 | Accepted | N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = []
for i in range(M):
b, c = map(int, input().split())
B.append([c, b])
B.sort(reverse=True)
i = 0
f = 0
for j in range(M):
while B[j][1]:
if A[i] < B[j][0]:
A[i] = B[j][0]
B[j][1] -= 1
i += 1
if i >= N:
f = 1
break
else:
f = 1
break
if f == 1:
break
print(sum(A)) |
p02789 | s886768508 | Wrong Answer | n,m = map(int, input().split())
if n == m:
print('AC')
else:
print('WA') |
p02897 | s277597048 | Accepted | n=int(input())
a=n-(n//2)
print(a/n)
|
p03544 | s570864122 | Wrong Answer | N = int(input())
L = [2, 1]
if N <= 2:
print(L[N-1])
else:
for i in range(N-1):
L.append(L[-1] + L[-2])
print(L[-1]) |
p02755 | s531092222 | Wrong Answer | import math
a, b = map(int, input().split())
for i in range(1, 101):
aa = math.floor(i*1.08)
bb = math.floor(i*1.1)
if aa - i == a and bb - i == b:
print(i)
exit()
print(-1) |
p03038 | s017931389 | Wrong Answer | import heapq
n,m = map(int,input().split())
ls = list(map(int,input().split()))
ls = list(map(lambda x:x*(-1),ls))
di = [list(map(int,input().split())) for _ in range(m)]
heapq.heapify(ls)
for i,j in di:
for k in range(i):
heapq.heappush(ls,j*(-1))
ls = list(ls)[n*(-1):]
print(sum(ls)) |
p03433 | s833899682 | Accepted | n = int(input())
a = int(input())
n = n % 500
if n % 500 == 0:
print('Yes')
else:
n = n % 500
if (n <= a):
print('Yes')
else:
print('No')
|
p03407 | s797613773 | Wrong Answer | A, B, C = map(int, input().split())
print('Yes' if A+B*2 >= C else 'No') |
p02693 | s236658590 | Wrong Answer | k =int(input())
a, b =map(int, input().split())
if a <= b/k*k:
print('OK')
else:
print('NG') |
p03680 | s806664626 | Accepted | import sys
readline = sys.stdin.readline
def main():
N = int(readline())
A = []
for _ in range(N):
A.append(int(readline())-1)
check = [0]*N
check[0] = 1
nxt = 0
ans = 1
while True:
nxt = A[nxt]
if check[nxt] == 1:
ans = -1
break
if nxt == 1:
break
check[nxt] = 1
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
p03001 | s974291330 | Wrong Answer | W, H, x, y = map(int, input().split())
print(W*H/2, end=' ')
print(1 if x == y and W ==H else 0) |
p02842 | s050624679 | Accepted | import math
N = int(input())
for i in range(1,50001):
if math.floor(i*1.08) == N:
print(i)
break
else:
print(":(") |
p02759 | s822027870 | Accepted | n = int(input())
print((int((int(n) / 2))) + (int((int(n) % 2))))
|
p02718 | s495675317 | Accepted | N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = []
a = sum(A)
for i in A:
if i >= a/(4*M):
B.append(i)
if len(B) >= M:
print('Yes')
else:
print('No') |
p03548 | s908111850 | Wrong Answer | X,Y,Z=map(int,input().split())
print(int((X-Z*(Y+1))/Y)) |
p02882 | s454386561 | Accepted | import math
a, b, x = map(int, input().split())
if a * a * b <= 2 * x:
ans = math.degrees(math.atan((2 * (b - (x / (a * a))) / a)))
print('{:.10f}'.format(ans))
else:
ans = math.degrees(math.atan((a * b * b) / (2 * x)))
print('{:.10f}'.format(ans)) |
p03796 | s277166182 | Accepted | n=int(input())
ans=1
for i in range(1,n+1):
ans=(ans*i)%(10**9+7)
print(ans) |
p03160 | s927026384 | Accepted | n=int(input())
h=list(map(int, input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
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[-1]) |
p03220 | s108954271 | Accepted | n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
def htemp(h):
return abs(a - ((t * 1000) - (h * 6)) / 1000)
ans = list(map(htemp, h))
ans1 = ans.index(min(ans)) + 1
print(ans1)
|
p02910 | s772457172 | Accepted | S = input()
tap_flag = True
for i in range(len(S)):
if (i+1) % 2 == 0:
if S[i] == "R":
tap_flag = False
break
elif (i+1) % 2 == 1:
if S[i] == "L":
tap_flag = False
break
if tap_flag == True:
print("Yes")
else:
print("No")
|
p03699 | s480716554 | Wrong Answer | n = int(input())
s = sorted([int(input()) for _ in range(n)])
ans = sum(s)
for v in s:
if ans%10!=0:
print(ans)
break
if v%10==0:
continue
ans -= v
else:
print(ans) |
p03711 | s874942999 | Accepted | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
x,y=MI()
if (x in a and y in a) or (x in b and y in b):
print("Yes")
else:
print("No")
main()
|
p02879 | s636417575 | Accepted | a,b =map(int,input().split())
if (a<10) and (b<10):
print(a*b)
else:
print(-1) |
p03286 | s806690983 | Wrong Answer | N = input()
ans = 'Yes'
if N.isdecimal():
ans = 'No'
N = int(N)
A = N % 4
B = N % 7
C = N % 11
if A == 0:
ans = 'Yes'
elif B == 0:
ans = 'Yes'
elif C == 0:
ans = 'Yes'
elif C == 4:
ans = 'Yes'
elif C == 7:
ans = 'Yes'
elif C == 8:
ans = 'Yes'
print(ans) |
p03416 | s071534027 | Accepted | A, B = map(int, input().split())
cnt = 0
for num in range(A, B+1):
num = list(str(num))
for i in range(len(num)//2):
if num[i] != num[len(num)-i-1]:
break
else:
cnt += 1
print(cnt)
|
p03211 | s816402510 | Accepted | x=list(input())
ans=5000
for i in range(len(x)-2):
ans=min(ans,int(abs(753-int(x[i]+x[i+1]+x[i+2]))))
print(ans) |
p04030 | s207112466 | Accepted | s = list(input())
lis = []
for i in s:
if i == 'B':
if len(lis) != 0:
lis.pop()
elif i == '0':
lis.append('0')
elif i == '1':
lis.append('1')
print(''.join(lis))
|
p03407 | s740296780 | Accepted | a,b,c = map(int,input().split())
if a+b >= c:
print("Yes")
else:
print("No") |
p02996 | s796546762 | Wrong Answer | from sys import stdin
from collections import deque
N=list(map(int,stdin.readline().strip().split()))[0]
t=0
data = [list(map(int,stdin.readline().rstrip().split())) for _ in range(N)]
data=sorted(data,key=lambda x:(x[1],x[0]))
d=deque(data)
final_task, final_time = d.pop()
while(len(d)!=0):
A,B=d.popleft()
if B<=t or t<final_time:
t+=A
else:
print("No")
exit()
t+=final_task
if t<=final_time:
print("Yes")
else:print("No") |
p02742 | s871196650 | Accepted | H,W=map(int,input().split())
if min(H,W)==1:
print(1)
elif W%2==0:
print(int((W/2)*H))
else:
if H%2==0:
print(int(((W-1)/2+1+(W-1)/2)*H/2))
else:
print(int(((W-1)/2+1+(W-1)/2)*(H-1)/2+(W-1)/2+1)) |
p02630 | s738762517 | Accepted | from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
c = Counter(a)
allsum = 0
for k,v in c.items():
allsum += k*v
ans = []
for i in range(q):
bi,ci = list(map(int,input().split()))
allsum += ci*c[bi] - bi*c[bi]
c[ci] = c[ci] + c[bi]
c[bi] = 0
ans.append(allsum)
for i in ans:
print(i) |
p02697 | s291561999 | Accepted | n,m=map(int,input().split())
for i in range(m):
print(i+1,n-i-((i>=m/2) & ~n)) |
p03351 | s677496599 | Wrong Answer | a,b,c,d = map(int,input().split())
d1 = a-b; d2 = c-b
if d1 < 0:
d1 = -d1
if d2 < 0:
d2 = -d2
if d1 <= d and d2 <= d:
print('Yes')
else:
print('No') |
p03254 | s864364818 | Accepted | n, x = map(int, input().split())
a = list(map(int, input().split()))
sort_a = sorted(a)
count = 0
if x > sum(a):
count-=1
for i in sort_a:
if x >= i:
count+=1
x-=i
else:
print(count)
exit()
print(count)
|
p03524 | s815802963 | Wrong Answer | s = input()
a = s.count("a")
b = s.count("b")
c = s.count("c")
k = (a > 0) + (b > 0) + (c > 0)
if k == 1:
print("NO")
exit()
if k == 2:
if len(s) == 2:
print("YES")
else:
print("NO")
exit()
minabc = sorted([a, b, c])[0]
a = max(0, a - minabc)
b = max(0, b - minabc)
c = max(0, c - minabc)
# print(a, b, c, k)
k = (a > 0) + (b > 0) + (c > 0)
if k == 1:
print("YES")
exit()
if k == 2:
if a + b + c == 2:
print("YES")
else:
print("NO") |
p02717 | s257617581 | Accepted | x, y, z = map(int, input().split())
print("{} {} {}".format(z, x, y)) |
p02608 | s651242017 | Accepted | N=int(input())
f=[0 for i in range(10001)]
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
tmp=x**2+y**2+z**2+x*y+y*z+z*x
if tmp >10000:
continue
f[tmp]+=1
for i in range(1,N+1):
print(f[i]) |
p02948 | s050489863 | Wrong Answer | N,M=map(int,input().split())
BA=[[0,0] for _ in range(N)]
for i in range(N):
BA[i][1],BA[i][0] = map(int,input().split())
BA.sort(reverse=True)
ans=0
d=0
for i in range(N):
if BA[i][1]<=M-d:
ans+=BA[i][0]
d+=1
if d==M:
break
print(ans) |
p02785 | s350861490 | Accepted | num = input().split(" ")
monster = int(num[0])
atk = int(num[1])
hpoints = list(input().split(" "))
hpoints_i = [int(i) for i in hpoints]
hpoints_i.sort(reverse=True)
result = sum(hpoints_i[atk:])
print(result)
|
p02618 | s779938643 | Accepted | D = int(input())
cs = list(map(int, input().split()))
ss = [list(map(int, input().split())) for _ in range(D)]
ts = []
for i in range(D):
t = 1
ts.append(t)
for t in ts:
print(t)
|
p02612 | s412218619 | Wrong Answer | n = int(input())
t1 = n%1000
t2 = (int(n/1000) + 1)*1000 - n
if t1 < t2:
print(t1)
else:
print(t2) |
p03723 | s240818906 | Accepted | def resolve():
A, B, C = map(int, input().split())
cnt = 0
while True:
if A%2 == 1 or B%2 == 1 or C%2 == 1:
break
elif A==B and B==C:
cnt = -1
break
Atmp = A
Btmp = B
Ctmp = C
A = (Btmp+Ctmp)/2
B = (Atmp+Ctmp)/2
C = (Atmp+Btmp)/2
cnt += 1
print(cnt)
resolve()
|
p03013 | s632235233 | Accepted | # ABC_129 C
def stairs(n, a):
dp = [0 for _ in range(n+1)]
dp[0] = 1
if 1 not in a:
dp[1] = 1
for i in range(2, n+1):
if i in a:
continue
dp[i] = dp[i-1] + dp[i-2]
result = dp[n] % 1000000007
print(result)
n, m = list(map(int, input().split()))
a = set(int(input()) for _ in range(m))
if __name__ == '__main__':
stairs(n, a) |
p03206 | s042545628 | Wrong Answer | d=int(input())
result='Christams'
n=25
while n>=22:
if n>d:
result+=' Eve'
n-=1
print(result) |
p03481 | s659179410 | Accepted | X, Y = map(int, input().split())
ans = 1
while True:
X *= 2
if X > Y:
print(ans)
exit()
ans += 1 |
p02835 | s412747353 | Accepted | #ABC147
a = list(map(int,input().split()))
print("bust" if sum(a)>=22 else "win") |
p03329 | s047617621 | Accepted | n = int(input())
# n < 100000
res = n
for i in range(n+1):
c = 0
t = i
while t > 0:
c += t % 6
t //= 6
t = n - i
while t > 0:
c += t % 9
t //= 9
if res > c:
res = c
print(res)
|
p02959 | s264885827 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] >= b[i]:
ans += b[i]
else:
val = b[i] - a[i]
if a[i+1] - val <= 0:
ans += a[i] + a[i+1]
else:
ans += b[i]
a[i+1] = a[i+1] - val
print(ans) |
p03665 | s261466707 | Accepted | from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over= reduce(mul,range(n,n-r,-1))
under = reduce(mul,range(1,r + 1))
return over // under
N,P = map(int,input().rstrip().split(" "))
A = list(map(int,input().rstrip().split(" ")))
ae = [0,0]
ans = 0
for i in range(N):
ae[A[i] % 2] += 1
for i in range(1,ae[1] + 1,2):
ans += cmb(ae[1] ,i)
ans *= 2 ** ae[0]
if P == 1:
print(ans)
else:
print(2 ** N - ans)
|
p02836 | s937500280 | Accepted | A = input()
import math
times = math.ceil(len(A)/2)
count = 0
for i in range(times):
if A[i] != A[len(A)-1-i]:
count += 1
print(count) |
p03994 | s724424565 | Accepted | s=input()
k=int(input())
ans=''
for c in s:
t=ord('z')-ord(c)+1
if t<26 and t<=k:
k-=t
ans+='a'
else:
ans+=c
if k>0:
ans=ans[:-1]+chr(ord('a')+(ord(ans[-1])-ord('a')+k)%26)
print(ans) |
p03041 | s735280423 | Accepted | N, K = (int(x) for x in input().split())
S = input()
S = S[:K-1] +S[K-1].lower() +S[K:]
print(S)
|
p02859 | s102447817 | Wrong Answer | a=21
print(a)
|
p02639 | s792292357 | Wrong Answer | x = [0] * 5
x = input().split()
x = [int(_) for _ in x]
print(x)
for i in range(5):
if x[i] == 0:
ans = i
print(ans+1)
break
|
p02835 | s687245432 | Wrong Answer | A1, A2, A3 = map(int, input().split())
if (A1 + A2 + A3) <= 21:
print("Win")
else:
print("bust")
|
p03457 | s545646030 | Accepted | N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
t[i+1], x[i+1], y[i+1] = map(int, input().split())
f = True
for i in range(N):
dt = t[i+1] - t[i]
dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
if dt < dist:
f = False
if dist%2 != dt%2:
f = False
print('Yes' if f else 'No') |
p03359 | s725151637 | Wrong Answer | a,b=map(int,input().split())
if a>b:
print(b)
else:
print(a) |
p03150 | s473076758 | Wrong Answer | s = input()
keyence = ["k", "e", "y", "e", "n", "c", "e"]
idx = 0
for i in range(len(s)):
if s[i] == keyence[idx]:
idx += 1
if idx == len(keyence):
print("YES")
exit()
print("NO")
|
p03605 | s033340246 | Accepted | N = input()
if N[0] == "9" or N[1] == "9":
print("Yes")
else:
print("No") |
p02718 | s113315603 | Accepted | n,m = map(int,input().split())
a = list(map(int,input().split()))
check = sum(a) /4/m
count = 0
for i in range(n):
if a[i] >= check:
count += 1
if count >= m:
print("Yes")
else:
print("No") |
p02718 | s400964089 | Accepted | n,m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= m else "No") |
p03067 | s630569388 | Wrong Answer | a,b,c = map(int, input().split())
if (b > a and b < c) or (b < a and b > c):
print('No')
else:
print('Yes')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.