problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03556 | s531660839 | Accepted | N = int(input())
ans = -1*float('inf')
while N >= 1:
if (N**0.5)%2 == 1 or (N**0.5)%2 == 0:
ans = max(ans, N)
break
N -= 1
print(ans) |
p02972 | s702254173 | Accepted | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
N = int(input())
A = [No... |
p02729 | s394117263 | Accepted | from math import factorial
n, m = map(int, input().split())
c_n = factorial(n) / (factorial(2) * factorial(n - 2)) if n > 1 else 0
c_m = factorial(m) / (factorial(2) * factorial(m - 2)) if m > 1 else 0
ans = int(c_n) + int(c_m)
print(ans) |
p02924 | s844435276 | Wrong Answer | from math import floor
N = int(input())
if N%2 == 0:
ans = (1+N-1)*((N-1)//2) + floor((N-1)/2)
else:
ans = (1+N-1)*((N-1)//2)
print(ans) |
p02630 | s283318965 | Accepted | N=int(input())
A=list(map(int, input().split()))
Q=int(input())
B=[list(map(int, input().split())) for _ in range(Q)]
D={}
ma=0
for i in A:
ma+=i
if i not in D:
D[i]=1
else:
D[i]+=1
for b,c in B:
if b in D:
f=D[b]
if c in D:
t=D[c]
else:
t=0
D[c]=f+t
D[b]=0
... |
p04011 | s969543992 | Wrong Answer | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(n*x + max(k-n, 0)*y) |
p02577 | s072800598 | Accepted | s=int(input())
if s%9==0:
print("Yes")
else:
print("No") |
p02847 | s199573062 | Wrong Answer | S = input()
st = ['MON','TUE','WED','THU','FRI','SAT','SUN']
for i in range(7):
if S==st[i]:
print(i+1) |
p02547 | s604741737 | Wrong Answer | n = input()
x = 0
for i in range(int(n)):
a,b = input().split(" ")
if a == b:
x+=1
else: x = 0
if x==3:
print("Yes")
break
if x==0:
print("No") |
p03997 | s838321874 | Wrong Answer | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) |
p03605 | s705433873 | Accepted | n = (input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
print('Yes') if '9' in n else print('No') |
p03030 | s244301663 | Wrong Answer | N = int(input())
S = []
P = []
for i in range(N):
s,p = input().split()
S.append(s)
P.append(int(p))
Sset = sorted(list(set(S)))
dict1 = {}
for i in range(N):
dict1[P[i]] = S[i]
print(Sset)
for k in Sset:
U = [i for i, j in dict1.items() if j == k]
V = sorted(U,reverse=True)
for l in V:
... |
p03437 | s123510545 | Wrong Answer | x,y=map(int,input().split())
if x==y:
print(-1)
elif y==1:
print(-1)
else:
for i in range(1,10**10):
if x*i<=10**18:
break
elif x*i%y !=0:
print(x*i)
break
|
p03836 | s758973735 | Wrong Answer | def main():
sx, sy, tx, ty = map(int, input().split())
ans = solve(sx, sy, tx, ty)
print(ans)
def solve(sx, sy, tx, ty):
dx = tx - sx
dy = ty - sy
st = 'U' * dy + 'R' * dx
ts = 'D' * dy + 'L' * dy
rt1 = st + ts
rt2 = 'L' + 'U' + st + 'R' + 'D' + 'R' + 'D' + ts + 'L' + 'U'
ans =... |
p02572 | s351367323 | Wrong Answer | n = int( input() )
a = list( map(int , input().split() ) )
Sum = 0
for i in range(n):
for j in range(i,n):
Sum = Sum + i*j
print(Sum) |
p02911 | s588746458 | Accepted | import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readl... |
p03695 | s699714026 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
flag = [False]*8
t = 0
for i in a:
if i < 400: flag[0] = True
elif i < 800: flag[1] = True
elif i < 1200: flag[2] = True
elif i < 1600: flag[3] = True
elif i < 2000: flag[4] = True
elif i < 2400: flag[5] = True
elif i < 2800: flag[6] = True
elif i < ... |
p03665 | s262311513 | Accepted | N,P = list(map(int, input().split()))
a = list(map(int, input().split()))
num_odd = sum([i%2 == 1 for i in a])
num_even = N - num_odd
ce = 2 ** num_even
co = 2 ** (num_odd - 1)
if num_odd == 0:
co = P^1
print(co * ce) |
p03693 | s751363766 | Accepted | r, g, b = input().split()
ans = int(r + g + b)
print('YES') if ans % 4 == 0 else print('NO')
|
p02933 | s662729884 | Wrong Answer | S = int(input())
T = input()
if S <= 3200:
print("Red")
else:
print(T) |
p02831 | s427092515 | Wrong Answer | A,B=list(map(int,input().split()))
if(A>=B):
num=A
else:
num=B
i=2
while True:
ans=num*i
if(ans%A==0 and ans%B==0):
print(ans)
break
i+=1
|
p02627 | s947099722 | Accepted | a = input()
if a.islower():
print("a")
else:
print("A") |
p02995 | s093603764 | Accepted | a,b,c,d=map(int,input().split())
total=b-a+1
cdead=b//c-(a-1)//c
ddead=b//d-(a-1)//d
from fractions import gcd
def lcm(a,b):
x= a*b // gcd(a,b)
return x
z=lcm(c,d)
cddead=b//z-(a-1)//z
print(total-cdead-ddead+cddead) |
p02584 | s875863648 | Wrong Answer | inp = list(map(int,input().split(" ")))
location = inp[0]
times = inp[1]
distance = inp[2]
x = float(abs(location / distance))
if x >= times:
print(abs(location - (times*distance)))
elif (times - int(x))%2 == 0:
print(abs(location - abs(int(x)*distance)))
else:
print(abs(location - abs(int(x)*distance)-d... |
p02814 | s996488525 | Accepted | from fractions import gcd
from functools import reduce
def lcm(x, y):
g = gcd(x, y)
x //= g
y //= g
if x&y&1:
l = x*y*g
if l > 10**9:
return 0
return l
return 0
n, m = map(int, input().split())
A = list(map(lambda x: int(x)//2, input().split()))
k = reduce(lcm, A)
if k == 0:
print(0)
else... |
p04019 | s849821079 | Accepted | s = input()
f = True
if s.find("S") != -1 and s.find("N") == -1:
f = False
if s.find("S") == -1 and s.find("N") != -1:
f = False
if s.find("E") != -1 and s.find("W") == -1:
f = False
if s.find("E") == -1 and s.find("W") != -1:
f = False
print("Yes" if f else "No") |
p03001 | s550829513 | Accepted | import math
def main():
t = [int(t)for t in input().split()]
w,h,x,y = t[0],t[1],t[2],t[3]
print(w*h/2, 1 if w/2==x and h/2 ==y else 0)
if __name__ == "__main__":
main() |
p02690 | s451720243 | Wrong Answer | x = int(input())
k = 1
while True:
if k ** 5 - (k-1) ** 5 > x:
break
k += 1
print(k)
for a in range(k):
amari = x - a ** 5
for b in range(a+1):
if amari == b ** 5:
print(a, -b)
break
if amari == (-b) ** 5:
print(a, b)
break |
p02548 | s094860301 | Accepted | import math
N = int(input())
s = 0
for a in range(1, N+1):
s += (N-1)//a
print(s)
|
p03309 | s528765971 | Wrong Answer | import math
N = int(input())
A = list(map(int, input().split()))
# print(N, A)
for i in range(len(A)):
A[i] -= (i + 1)
# print(A)
average = math.ceil(sum(A) / len(A))
for i in range(len(A)):
A[i] = abs(A[i] - average)
sadness = sum(A)
print(sadness)
|
p02917 | s629486274 | Accepted | N=int(input())
B=list(map(int,input().split()))
A=[0]*(N+1)
a=B[-1]
A[N]=a
for i in range(N-2,-1,-1):
if B[i]<a:
A[i+1]=B[i]
A[i]=B[i]
a=B[i]
print(sum(A)) |
p02801 | s968260720 | Accepted | c = input()
print(chr(ord(c)+1)) |
p02607 | s043487330 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
c = 0
for i in range(0,n,2):
if a[i] % 2 == 1:
c += 1
print(c) |
p03711 | s007545886 | Accepted | A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
D,E = list(map(int,input().split()))
if D in A and E in A:
print("Yes")
exit()
elif D in B and E in B:
print("Yes")
exit()
elif D in C and E in C:
print("Yes")
exit()
print("No") |
p02833 | s791200787 | Accepted | def z(x):
fives = 0
for j in range(1, 60):
bs = 2 * 5 ** j
fives = fives + x // bs
return fives
x = int(input())
print(z(x) if x % 2 == 0 else 0) |
p02618 | s153351319 | Wrong Answer | def argmax(lst):
c = lst[0]
idx = 0
for i in range(len(lst)):
if c < lst[i]:
idx = i
c = lst[i]
return idx
D = int(input())
C = list(map(int, input().split()))
S = []
for i in range(D):
S.append(list(map(int, input().split())))
for i in S:
print(argmax(i)) |
p03693 | s166073073 | Wrong Answer | s = int(''.join(input().split()))
if s % 4:
print('No')
else:
print('Yes') |
p02628 | s643466299 | Accepted | NK = input().split()
Pn = input().split()
for i in range(int(NK[0])):
Pn[i] = int(Pn[i])
Pn.sort()
s = 0
for i in range(int(NK[1])):
s += Pn[i]
print(s) |
p02701 | s390967789 | Accepted | n = int(input())
s = [input() for _ in range(n)]
ans = [[] for _ in range(n)]
for i in range(n):
ans[i] = s[i]
ANS = set(ans)
print(len(ANS)) |
p02766 | s623391743 | Accepted | from math import log
n, k = map(int, input().split())
print(int(log(n, k))+1)
|
p03251 | s657093120 | Wrong Answer | N,M,X,Y = map(int,input().split())
li_x = list(map(int,input().split()))
li_y = list(map(int,input().split()))
li_x.append(X)
li_y.append(Y)
li_x = set(li_x)
li_y = set(li_y)
if max(li_x)>min(li_y):
print("War")
elif max(li_x)<min(li_y):
print("No war")
elif max(li_x)==min(li_y):
print("War") |
p02554 | s507671530 | Accepted | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
mod = 10 ** 9 + 7
ans = pow(10,N,mod)
ans -= 2 * pow(9,N,mod)
ans %=mod
ans += pow(8,N,mod)
print(ans%mod)
if __name__ == "__main__":
main()
|
p03719 | s137090571 | Accepted | a,b,c=map(int,input().split())
if c>=a and b>=c:
print('Yes')
else:
print('No') |
p02820 | s839593489 | Wrong Answer | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
table = { "r": p, "s": r, "p": s }
score = [0] * n
for i in range(n):
if i-k < 0:
score[i] = table[t[i]]
continue
if score[i-k] != table[t[i]]:
score[i] = table[t[i]]
print(sum(score))
|
p02786 | s416680064 | Accepted | def main():
H = int(input())
div = {2**i for i in range(40)}
ans = 0
from math import log2, ceil
if not(H in div):
for h in range(int(log2(H)) + 1):
ans += 2**h
print(ans)
else:
for h in range(int(log2(H)) + 1):
ans += 2**h
print(ans)
if ... |
p02777 | s132860568 | Accepted | S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
else:
B -= 1
print(A, B)
|
p03680 | s756113244 | Wrong Answer | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
k = 1
p = False
for i in range(n):
if a[k-1] == 2:
print(i+1)
p = True
k = a[k-1]
if not p:
print(-1)
|
p04029 | s921608847 | Accepted | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i... |
p03565 | s585024564 | Accepted | sdush = input()
t = input()
ans = []
for i in range(len(sdush)-len(t)+1):
for index,c in enumerate(t):
if c != sdush[i+index] and sdush[i+index] != '?':
break
if index+1 == len(t):
ans.append(sdush[:i]+t+sdush[i+1+index:])
result = "z"*50
for an in ans:
if result > an:
result = an
if resul... |
p02607 | s045769423 | Accepted | for i in range(1):
n=int(input())
l=list(map(int,input().split()))
c=0
for i in range(n):
if((i+1)%2!=0 and l[i]%2!=0):
c=c+1
print(c) |
p02829 | s342709129 | Accepted | a = int(input())
b = int(input())
print(6-a-b) |
p02900 | s378824094 | Accepted | A,B = map(int,input().split())
c = 1
t = int(max(A,B)**0.5)
for i in range(2,t+2):
k = 0
while(A % i == 0 and B % i == 0):
k = 1
A = A//i
B = B//i
c += k
for i in range(2,int(A**0.5)+2):
while(A % i == 0):
A = A//i
for i in range(2,int(B**0.5)+2):
while(B % i == 0)... |
p03408 | s196984201 | Accepted | N = int(input())
s = [input() for s in range(N)]
M = int(input())
t = [input() for t in range(M)]
ans = 0
for i in range(N):
tmp = s.count(s[i]) - t.count(s[i])
ans = max(ans,tmp)
print(ans) |
p02854 | s399316397 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
minA = 10 ** 9 + 7
for x in range(N):
slice_sumA = sum(A[:x])
remainA = sumA - slice_sumA
minA = min(minA, abs(slice_sumA - remainA))
print(minA)
|
p03161 | s683003823 | Wrong Answer | n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('Inf') for i in range(n)]
dp[0]=0
for i in range(n):
for j in range(1,k+1):
if i-j<0:
break
dp[i]= min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp)
print(dp[n-1]) |
p02695 | s367295827 | Accepted | n, m, q = map(int, input().split())
L = []
for i in range(q):
a,b,c,d = map(int, input().split())
a -= 1
b -= 1
L.append((d, c, a, b))
import itertools
ans = -1
for p in itertools.combinations_with_replacement(range(1, m+1), n):
#print(p)
temp = 0
for d, c, a, b in L:
if p[b]-p[a] =... |
p03799 | s009874461 | Accepted | N, M = map(int, input().split())
if N * 2 <= M:
print(N + (M - N * 2) // 4)
else:
print(M // 2)
|
p03386 | s975429065 | Accepted | def resolve():
A, B, K = map(int, input().split())
if 2*K > B-A+1:
for _ in range(B-A+1):
print(A+_)
else:
for i in range(K):
print(A+i)
for j in range(K):
print(B-K+j+1)
resolve() |
p03721 | s505058416 | Accepted | N,K = map(int,input().split())
l = []
for i in range(N):
l.append( list(map(int,input().split())) )
l.sort()
a = [0]
b = [0]
for i in range(N):
[x,y] = l[i]
a.append(x)
b.append(y)
cnt = 0
for i in range(1,N+1):
cnt += b[i]
if cnt >= K:
ans = a[i]
break
print(ans) |
p02714 | s714496235 | Accepted | n = int(input())
s = input()
count = {"R":0,"G":0,"B":0}
for c in s:
count[c] += 1
r,g,b = count.values()
ans = r*g*b
for i in range(1,(n-1)//2+1): #1から
for rgb in zip(s,s[i:],s[i*2:]): #rgbに連続した三つのリストの要素を入れ込む
if len(set(rgb)) == 3: #リストrgbをセットにまとめ、長さが
ans -=1
print(ans) |
p03659 | s876415482 | Accepted | def main():
card_num = int(input())
cards = list(map(int, input().split()))
answer = float("inf")
num_sum = [cards[0]] * card_num
for i in range(1, card_num):
num_sum[i] = num_sum[i - 1] + cards[i]
for i in range(card_num - 1):
answer = min(answer, abs(2 * num_sum[i] - num_sum[-1... |
p03672 | s712267068 | Accepted | def solve(s):
for size in range(len(s) // 2 - 1, 0, -1):
if s[:size] == s[size:2 * size]:
return 2 * size
return 0
_s = input()
print(solve(_s)) |
p03836 | s722953559 | Accepted | sx,sy,tx,ty = map(int,input().split())
ans = ''
ans += 'U'*(ty-sy)
ans += 'R'*(tx-sx)
ans += 'D'*(ty-sy)
ans += 'L'*(tx-sx)
ans += 'L'
ans += 'U'*(ty-sy+1)
ans += 'R'*(tx-sx+1)
ans += 'DR'
ans += 'D'*(ty-sy+1)
ans += 'L'*(tx-sx+1)
ans += 'U'
print(ans) |
p03854 | s743628039 | Accepted | S = input()
t1 = "dream"
t2 = "dreamer"
t3 = "erase"
t4 = "eraser"
while True:
if S[-5:] == t1 or S[-5:] == t3:
S = S[0:-5]
elif S[-6:] == t4:
S = S[0:-6]
elif S[-7:] == t2:
S = S[0:-7]
elif len(S) == 0:
print("YES")
break
else:
print("NO")
b... |
p02993 | s561333940 | Wrong Answer | s=list()
s=input()
result=0
for i in range(4):
if s[i]==s[i-1]:
result=1
if result==0:
print('Good')
else :
print('Bad')
|
p03254 | s501384156 | Wrong Answer | try:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a_ = sorted(a)
cnt = 0
for i in a_:
if i<=x:
cnt += 1
x = x-i
else:
break
print(cnt)
except EOFError:
pass |
p02711 | s975634068 | Accepted | n=input()
a=n.count("7")
if a==0:
print("No")
else:
print("Yes")
|
p02916 | s314740400 | Accepted | N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
ans=sum(B)
for s in range(N-1):
if A[s+1]==A[s]+1:
ans+=C[A[s]-1]
print(ans)
|
p02688 | s168277706 | Accepted | N, K = list(map(int, input().split()))
treated = set()
for i in range(K):
_ = input()
treated = treated | (set(list(map(int, input().split()))))
print(len([x for x in range(N) if not x+1 in treated])) |
p03324 | s381230706 | Accepted | from sys import stdin
input = stdin.readline
D, N = map(int, input().split())
ans = 100 ** D * N
if N == 100:
ans += 100 ** D
print(ans)
|
p03351 | s757881932 | Accepted | a,b,c,d=map(int,input().split())
print("Yes" if abs(c-a)<=d or abs(b-a)<=d and abs(c-b)<=d else "No") |
p03543 | s272173424 | Accepted | N = input()
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
print('Yes')
else:
print('No') |
p03971 | s309466057 | Accepted | N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for s in S:
if s == "c":
print("No")
elif s == "a":
if a < A + B:
print("Yes")
a += 1
else:
print("No")
else:
b += 1
if a < A + B and b <= B:
a += 1
... |
p03815 | s888286712 | Accepted | # coding: utf-8
# Your code here!
n=int(input())
cnt=n//11
cnt*=2
if 0<n%11<=6:
cnt+=1
elif n%11>6:
cnt+=2
print(cnt)
|
p03449 | s481970644 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = {}
ans = 0
for i in range(n):
ans = max(ans, sum(a[0:i+1]) + sum(b[i:]) )
# print("i=",i)
# print( "sum(a[0:i+1])",sum(a[0:i+1]) )
# print( "sum(b[i:])",sum(b[i:]) )
# print()
print(ans) |
p02854 | s288016652 | Accepted | import sys
N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
S = [0] * (N + 1)
s = sum(A)
for i in range(N):
S[i + 1] += S[i] + A[i]
mini = 10 ** 18
for i in range(1, N + 1):
mini = min(mini, abs(S[N] - 2 * S[i]))
print(mini)
|
p02705 | s707175423 | Accepted | r=int(input())
import math
print(2*math.pi*r) |
p02912 | s162886751 | Accepted | import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
A[i] = -A[i]
heapq.heapify(A)
for i in range(M):
minv = - heapq.heappop(A)
heapq.heappush(A, (minv//2)*(-1))
print(-sum(A)) |
p02952 | s270410752 | Accepted | N = str(input())
ans = 0
for i in range(1, int(N)+1):
if len(str(i)) % 2 == 1:
ans += 1
print(ans)
|
p02767 | s785402427 | Wrong Answer | import math
a=int(input())
s=list(map(int,input().split()))
p=sum(s)/a
psum=0
for i in s:
psum+=(i-p)**2
print(math.ceil(psum)) |
p02972 | s178967481 | Accepted | # D - Preparing Boxes
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in reversed(range(1, N + 1)):
x = 0
for j in range(i, N + 1, i):
x += ans[j - 1]
if x % 2 != A[i - 1]:
ans[i - 1] = 1
print(ans.count(1))
print(*[i for i in range(1, N + 1) if ans[i - 1] == 1]... |
p03293 | s467445724 | Wrong Answer | import itertools
S = list(input())
T = tuple(input())
flag = True
for s in itertools.permutations(S):
if s == T:
print('Yes')
flag = False
break
if flag:
print('No') |
p02629 | s893661435 | Accepted | def main():
num = int(input())
l = list('abcdefghijklmnopqrstuvwxyz')
name = []
ans = ''
while num > 0:
num = num - 1
name.append(l[num%26])
num = num // 26
name.reverse()
for i in name:
ans = ans + i
print(ans)
main() |
p03711 | s589756592 | Accepted | x=[1,3,5,7,8,10,12]
y=[4,6,9,11]
a,b=map(int,input().split())
if a==2 or b==2:
print('No')
elif a in x and b in x:
print('Yes')
elif a in y and b in y:
print('Yes')
else:
print('No')
|
p03624 | s564549205 | Accepted | # -*- coding: utf-8 -*-
S = list(str(input()))
chr_ord = 97
for i in range(26):
if chr(chr_ord + i) not in S:
print(chr(chr_ord + i))
exit()
print('None') |
p02754 | s416302719 | Accepted | n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)
|
p03657 | s750985901 | Wrong Answer | a,b=map(int,input().split())
s=a+b
if s%3==0:
print("Possible")
else:
print("Impossible") |
p02879 | s433019116 | Wrong Answer | a, b = map(int, input().split())
if a<=9 and b<9:
print(a*b)
else:
print(-1) |
p02597 | s556280427 | Accepted | N=int(input())
String=input().replace("W","1").replace("R","2")
c=[0]*N
for i in range (N):
c[i]=int(String[i])
s=sorted(c)
import bisect
a=bisect.bisect_right(s,1)
cnt=0
for j in range(N-a):
if c[j]==1:
cnt+=1
print(cnt) |
p02922 | s012930717 | Accepted | A, B = map(int,input().split())
puragu = 1
if B == 1:
print(0)
exit()
if A >= B:
print(1)
exit()
result = 0
while puragu < B:
puragu += A-1
result += 1
print(result)
|
p03548 | s080010349 | Accepted | x,y,z=map(int,input().split())
print((x-z)//(y+z)) |
p02996 | s861352202 | Accepted | N=int(input())
AB=[list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x:(x[1], x[0]))
s=0
ans="Yes"
for A, B in AB:
s+=A
if s>B:
ans="No"
break
print(ans) |
p03971 | s622756891 | Accepted | n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
if s[i]=='a' and cnt<A+B:
print('Yes')
cnt+=1
elif s[i]=='b' and cnt<A+B and cnt_b<B:
print('Yes')
cnt_b+=1
cnt+=1
else:
print('No') |
p03360 | s037024024 | Wrong Answer | a,b,c = map(int,input().split())
k = int(input())
note = max(a,b,c)
for i in range(k):
note *= 2
print(note) |
p03720 | s309101943 | Accepted | n,m = map(int,input().split())
l = [0]*n
for i in range(m):
a,b = map(int,input().split())
l[a-1] += 1
l[b-1] += 1
for i in l:
print(i)
|
p02645 | s812807907 | Accepted | S = str(input())
print(S[0:3])
|
p02700 | s536021636 | Accepted |
def main():
a, b, c, d = map(int, input().split())
while a >= 0 and c >= 0:
c -= b
if c <= 0:
print("Yes")
exit()
a -= d
if a <= 0:
print("No")
exit()
if __name__ == '__main__':
main()
|
p02602 | s861481420 | Accepted |
from collections import deque
N, K = map(int, input().split())
X = list(map(int, input().split()))
q = deque(X[:K])
for i in range(K, N):
u = q.popleft()
if u < X[i]:
print("Yes")
else:
print("No")
q.append(X[i])
|
p02701 | s407870016 | Accepted | N=int(input())
S=[input() for _ in range(N)]
#print(S[1][0])
uniqued=set(S)
print(len(uniqued)) |
p02576 | s727299074 | Wrong Answer | n,x,t=map(int,input().split())
if(n<=x):
print(t)
else:
if(x<t):
print((n*t)//x)
else:
while(n>x):
x*=2
t*=2
print(t) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.