problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02923 | s778620196 | Accepted | n=int(input())
l = list(map(int,input().split()))
max=0
a=0
for i in range(n-1):
if l[i+1]<=l[i]:
a+=1
if a>=max:
max=a
elif l[i+1]>l[i]:
if a>=max:
max=a
a=0
print(max) |
p03360 | s785743402 | Accepted | #!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a,b,c = map(int,input().split())
k = int(input())
print((2**k-1)*max([a,b,c])+sum([a,b,c])) |
p02601 | s788924624 | Accepted | a,b,c = map(int, input().split())
k = int(input())
while not (a<b and b<c):
if a>=b :
b*=2
k-=1
if b>=c :
c*=2
k-=1
if(k<0):
print("No")
else:
print("Yes") |
p03705 | s923959468 | Accepted | N,A,B = map(int,input().split())
mi = A*(N-1)+B
ma = A+B*(N-1)
if (N == 1 and A != B)or ma-mi < 0:
print(0)
else:
print(ma-mi+1) |
p03778 | s758428889 | Wrong Answer | W, a, b = map(int, input().split())
ans = min(abs(b - (a+W)), abs(a - (b+W)))
if a == b:
ans = 0
print(ans)
|
p03557 | s641677161 | Accepted | import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
x = bisect.bisect_left(A, B[i])
y = N-bisect.bisect_right(C, B[i])
ans += x*y
print(ans) |
p03799 | s266718563 | Wrong Answer | N, M = map(int, input().split())
if 2 * N >= M:
print(N)
else:
d = M - 2 * N
d //= 4
print(N + d)
|
p02922 | s146322159 | Wrong Answer | a,b = map(int,input().split())
ans = 0
while b > 0:
b-=a
ans+=1
if b<=0:break
b+=1
print(ans) |
p03804 | s061668921 | Wrong Answer | import sys
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for i in range(N - M):
if i >= M:
break
matched = True
for j in range(N - M):
if A[i][j:j+M] == B[i][j:j+M]:
continue
else:
matched = False
break
if matched:
print('Yes')
sys.exit()
print('No') |
p03696 | s342946967 | Wrong Answer | from collections import deque
n = int(input())
s = input()
A = deque([])
for i in range(n):
if s[i]=='(':
A.append(s[i])
elif s[i]==')':
if len(A)!=0 and A[-1]=='(':
A.append(s[i])
elif len(A)==0 or A[-1]==')':
A.appendleft("(")
A.append(")")
cou = -1
for i in range(len(A)):
if A[i]==')':
cou = i
amari = len(A)-(cou+1)
#print(amari)
for j in range(amari):
A.append(")")
print("".join(A)) |
p03210 | s606171422 | Accepted | X=int(input())
if X==3 or X==5 or X==7:
print("YES")
else:
print("NO") |
p03160 | s555300018 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
dp = [0] * (N+10)
dp[2] = A[1] - A[0]
for i in range(2,N):
Ai = abs(A[i] - A[i-1])
Ai2 = abs(A[i] - A[i-2])
dp[i+1] = min(dp[i]+Ai,dp[i-1]+Ai2)
print(dp[N]) |
p02988 | s828362658 | Wrong Answer | N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N-2):
if P[i] > P[i+1] and P[i+1] > P[i+2]:
ans += 1
print(ans) |
p03605 | s171740711 | Accepted | N = input()
if N[0] == '9' or N[1] == '9':
print('Yes')
else:
print('No')
|
p03035 | s287616661 | Wrong Answer | A, B = input().split()
if int(A) >= 13:
print(B)
elif int(A) >=5:
print(int(B)/2)
else:
print(0) |
p03319 | s864827762 | Accepted | n, k = map(int, input().split())
A =list(map(int, input().split()))
ans = 0
while n > 0:
if ans == 0:
n -= k
else:
n -= (k-1)
ans += 1
print(ans)
|
p03059 | s925832185 | Accepted | a, b, t = map(int, input().split())
tt = 0
x = 0
while True:
tt += a
if tt > t + 0.5:
break
x += b
print(x) |
p03435 | s844693189 | Wrong Answer | C=[list(map(int,input().split())) for _ in range(3)]
ans='Yes'
if C[0][0]-C[1][0]!=C[0][1]-C[1][1]!=C[0][2]-C[1][2]:
ans='No'
elif C[1][0]-C[2][0]!=C[1][1]-C[2][1]!=C[1][2]-C[2][2]:
ans='No'
elif C[0][0]-C[0][1]!=C[1][0]-C[1][1]!=C[2][0]-C[2][1]:
ans='No'
elif C[0][1]-C[0][2]!=C[1][1]-C[1][2]!=C[2][1]-C[2][2]:
ans='No'
print(ans) |
p02996 | s522639728 | Accepted | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
N = ini()
tasks = []
for i in range(N):
a, b = inm()
tasks.append((b, a))
tasks.sort()
def solve():
t = 0
for b, a in tasks:
if t + a > b:
return False
t += a
return True
print("Yes" if solve() else "No")
|
p03417 | s730925519 | Accepted | def main():
n, m = map(int, input().split())
if n == m == 1:
r = 1
elif n == 1:
r = m - 2
elif m == 1:
r = n - 2
else:
r = (n - 2) * (m - 2)
print(r)
if __name__ == '__main__':
main() |
p03696 | s543543297 | Accepted | n = int(input())
s = list(input())
stack = []
for i in range(n):
if s[i] == "(":
stack.append("(")
elif len(stack) == 0 or stack[-1] == ")":
stack.append(")")
else:
stack.pop()
stack = sorted(stack, reverse=True)
idx = 0
while idx < len(stack):
if stack[idx] == "(":
break
else:
print("(", end="")
idx+=1
for ch in s:
print(ch, end="")
for i in range(idx, len(stack)):
print(")", end="")
|
p03221 | s034189843 | Accepted | import sys
input = sys.stdin.buffer.readline
N, M = map(int,input().split())
town = [[] for _ in range(N)]
ans = [0] * M
for i in range(M):
a, b = map(int,input().split())
town[a-1].append((b,i))
for i in range(N):
town[i].sort()
for k in range(len(town[i])):
index = town[i][k][1]
t = town[i][k][0]
ans[index] = str(i+1).zfill(6) + str(k+1).zfill(6)
for i in ans:
print(i)
|
p02988 | s502545860 | Wrong Answer | n=int(input())
p=list(map(int,input().split()))
c=0
for i in range(1,n-1):
a,b,c=p[i-1],p[i],p[i+1]
if b>min(a,b) and b<max(a,b):
c+=1
print(c) |
p03262 | s774949193 | Accepted | import numpy as np
from fractions import gcd
from functools import reduce
N, x = map(int, input().split())
X = np.array(list(map(int, input().split())) + [x], dtype=np.int32)
X.sort()
X -= X[0]
print(reduce(gcd, X)) |
p03286 | s474757250 | Wrong Answer | n=int(input())
ans=""
while n!=0:
ans=str(n%(2))+ans
n=-(n//(2))
print(ans)
|
p02747 | s824660293 | Wrong Answer | print("YNeos"[input()[:2]!="hi"::2]) |
p03557 | s842967440 | Accepted | import math , sys, bisect
N = int( input() )
A = sorted( list( map( int, input().split() ) ) )
B = sorted( list( map( int, input().split() ) ) )
C = sorted( list( map( int, input().split() ) ) )
Bc = []
for i in range(N):
X = B[i]
count = bisect.bisect_left( A , X )
Bc.append( count )
#print(A, B, C)
#print(Bc)
s = 0
Ec = [0]
for i in range(N):
s += Bc[i]
Ec.append(s)
#print(Ec)
ans = 0
for i in range(N):
X = C[i]
ind = bisect.bisect_left( B , X )
ans += Ec[ind]
#print(ind)
print(ans) |
p03062 | s506621304 | Accepted | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())), dtype='int64')
am = a[np.where(a<=0)]
a2 = np.array(list(map(abs, a)), dtype='int64')
ans = sum(a2)
if len(am) % 2 == 1:
m = np.amin(a2)
ans -= 2 * m
print(ans) |
p03759 | s666619735 | Accepted | a, b, c = map(lambda x: int(x), input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
p02572 | s690722949 | Wrong Answer | n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
s=sum(A)
ans=0
for a in A:
ans += a*(s-a)
print((ans/2)%mod) |
p03331 | s384698265 | Accepted | n=int(input())
ans=float('inf')
for i in range(1,n//2+1):
tmp=0
a=i
b=n-i
while a>0:
tmp+=a%10
a//=10
while b>0:
tmp+=b%10
b//=10
ans=min(ans,tmp)
print(ans) |
p02681 | s595516683 | Wrong Answer | s,t=input(),input()
if len(t)-len(s)==1:print("Yes")
else:print("No") |
p03548 | s940679715 | Accepted | X, Y, Z = map(int, input().split())
print((X - Z) // (Y + Z)) |
p02546 | s189657419 | Accepted | word = list(input())
if word[-1] == "s":
word.append("es")
ans = "".join(word)
else:
word.append("s")
ans = "".join(word)
print(ans) |
p03274 | s675477957 | Wrong Answer | N,K = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = abs(X[0]-X[-1])
for i in range(N-K+1):
Xdis = min(abs(X[i])+abs(X[i+K-1]-X[i]),abs(X[i+K-1])+abs(X[i]-X[i+K-1]))
#print('Xdis = ' + str(Xdis) + ' X[i] = ' + str(X[i]) + ' X[i+K] = ' + str(X[i+K-1]))
ans = min(ans,Xdis)
print(ans) |
p02873 | s181538632 | Accepted | s=input()
ans=0
a=[0]
for i in s:
if i=='<':
if a[-1]>=0:a[-1]+=1
else:a+=[1]
else:
if a[-1]<0:a[-1]-=1
else:a+=[-1]
n=len(a)
for i in range(n//2):
i*=2
j=i+1
if a[i]<abs(a[j]):
x=abs(a[j])
y=a[i]-1
else:
x=abs(a[j])-1
y=a[i]
ans+=x*(x+1)//2+y*(y+1)//2
ans+=n%2*a[-1]*(a[-1]+1)//2
print(ans) |
p02664 | s540320227 | Accepted | A=input().replace("?","D")
print(A) |
p03627 | s771071353 | Wrong Answer | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = sorted([(k,v) for k,v in C.items() if v>=2], key = lambda x:-x[0])[:2]
if len(ans)<2:
print(0)
else:
print(ans[0][0]*ans[1][0]) |
p02994 | s851296569 | Accepted | n,l=map(int,input().split())
left=l
right=l+n-1
apple=[i for i in range(left,right+1)]
if left<=0<=right:
print(sum(apple))
elif left<0 and right<0:
print(sum(apple)-right)
elif 0<left and 0<right:
print(sum(apple)-left)
|
p02646 | s006783621 | Accepted | #!/usr/bin/env python3
def judge(a, v, b, w, t):
return abs(b - a) <= t * (v - w)
def main():
a, v = (int(z) for z in input().split())
b, w = (int(z) for z in input().split())
t = int(input())
if judge(a, v, b, w, t):
print("YES")
else:
print("NO")
if __name__ == '__main__':
main() |
p02797 | s912800610 | Wrong Answer | n, k, s = map(int, input().split())
l = []
for i in range(k):
l.append(str(s))
for j in range(n-k):
l.append(str(s+10**9))
print(" ".join(l)) |
p03146 | s909984070 | Wrong Answer | N = int(input())
if N == 1 or N == 2:
print(3)
else:
m = 0
while N > 1:
if N % 2 == 0:
N = N // 2
else:
N = 3 * N + 1
m += 1
print(m+2)
|
p02744 | s164528081 | Wrong Answer | def dfs(s):
if len(s)>n:
return
t.append(s)
for c in 'abcdefghij':
if ord(c)-ord(s[-1])<=1:
dfs(s+c)
n=int(input())
if n==1:
print('a')
exit(0)
t=[]
ans=[]
dfs('a')
for tt in t:
if len(tt)==n:
ans.append(tt)
ans.sort()
print(*ans,sep='\n') |
p03457 | s756641635 | Accepted | N = int(input())
ans = True
for _ in range(N):
t, x, y = map(int, input().split())
if t < x + y:
ans = False
if t % 2 != (x + y) % 2:
ans = False
if ans:
print('Yes')
else:
print('No') |
p03719 | s085479317 | Wrong Answer | a, b, c = map(int,input().split())
print("YES" if a <= c and c <= b else "NO" ) |
p02783 | s532712028 | Wrong Answer | H, A = map(int, input().split())
print(int(H/A)+1)
|
p02796 | s537007959 | Wrong Answer | N = int(input())
S = []
for _ in range(N):
D = list(map(int, input().split()))
S.append(D)
min_list=[]
for i in range(N):
min_list.append([S[i][0],S[i][1],S[i][0] + S[i][1]])
min_list.sort(key=lambda x:x[2])
ans=0
current_min = -10*10
for i in range(N):
if min_list[i][0] - min_list[i][1] >= current_min:
ans+=1
current_min = min_list[i][2]
print(ans) |
p02835 | s404859100 | Wrong Answer | A = list(map(int, input().split()))
if sum(A) > 22:
print('bust')
elif sum(A) > 0 and sum(A) <= 21:
print('win')
else:
print('error') |
p03323 | s634231421 | Accepted | a,b = map(int,input().split())
if a>8 or b>8:
print(":(")
else:
print("Yay!") |
p02594 | s906174833 | Wrong Answer | X = int(input())
if X >= 30:
print ('Yes')
else:
print('NO')
|
p03472 | s709929477 | Accepted | N,H=map(int,input().split())
B=[]
A=0
for _ in range(N):
a,b = map(int,input().split())
A = max(A,a)
B.append(b)
B = sorted(B, reverse=True) + [0]
i = 0
while B[i] >= A:
i += 1
B = B[:i]
ans = 0
for i in range(len(B)):
H -= B[i]
ans += 1
if H <= 0:
print(ans)
exit()
print(ans + (H -1)//A + 1)
|
p02879 | s436361653 | Accepted | #!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
A, B = map(int, readline().split())
if (A <= 9) & (B <= 9):
print(A * B)
else:
print(-1)
if __name__ == '__main__':
main()
|
p02820 | s523885752 | Wrong Answer | n,k = map(int,input().split())
R,S,P =map(int,input().split())
T = list(input())
value= {'r':P,'s':R,'p':S}
ans = 0
pre = ''
#k個ごとのグループで考える
for i in range(k):
num = i
while num<n:
if pre == T[num]:#同じ手だったら負けかあいこ.つまり0点カウント
pre = ''
else:
pre = T[num]
ans += value[pre]
num += k
print(ans)
|
p03835 | s844511759 | Accepted | k,s = map(int, input().split())
count = 0
for x in range(k+1):
for y in range(x, k+1):
z=s-x-y
if y <= z <= k:
if x==y and y==z:
count += 1
elif x==y or y==z or z==x:
count += 3
else:
count += 6
print(count)
print("\n")
|
p02596 | s002001078 | Accepted | import sys
sys.setrecursionlimit(10**6)
def main(input, print):
K = int(input())
x = 7 % K
for i in range(1, K+1):
if x == 0:
print(i)
return
x = (x*10+7) % K
print(-1)
if __name__ == '__main__':
main(sys.stdin.readline, print)
|
p02607 | s328329834 | Accepted | N = int(input())
*A, = map(int, input().split())
ans = 0
for i, a in enumerate(A, 1):
if i % 2 == 1 and a % 2 == 1: ans += 1
print(ans) |
p02727 | s306340078 | Accepted | x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())),reverse=True)[:x]
green = sorted(list(map(int,input().split())),reverse=True)[:y]
white = sorted(list(map(int,input().split())),reverse=True)
l = sorted(red+green+white,reverse=True)[:x+y]
print(sum(l))
|
p03000 | s332518332 | Accepted | numList1 = list(map(int, input().split()))
numList2 = list(map(int, input().split()))
add = 0
result = 1
cood = []
for i in range(0, len(numList2)):
add += numList2[i]
cood.append(add)
for i in cood:
if i <= numList1[1]:
result += 1
else:
continue
print(result) |
p03836 | s273866690 | Accepted | sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
print('U'*y+'R'*x+'D'*y+'L'*(x+1)+'U'*(y+1)+'R'*(x+1)+'DR'+'D'*(y+1)+'L'*(x+1)+'U')
|
p02594 | s084588710 | Accepted | #!/usr/bin/python3
# -*- coding: utf-8 -*-
x = int(input())
if x >= 30:
print("Yes")
else:
print("No") |
p04033 | s004547681 | Accepted | a,b = map(int, input().split())
if 0<a:
print("Positive")
elif a<=0<=b:
print("Zero")
else:
if (abs(a)-abs(b)) %2 ==1:
print("Positive")
else:
print("Negative")
|
p02963 | s126545196 | Accepted | s = int(input())
if s<=10**9:
print(0,0,0,1,s,0)
exit()
bx=10**9
by=1
ay=int(s/(10**9))
while True:
ax = ay*bx-s
if ax >= 0 and ax <= 10**9:
break
else:
ay+=1
print(0,0,bx,by,ax,ay) |
p03607 | s903744810 | Accepted | import sys
N = int(input())
A = set()
for i in sys.stdin:
A ^= {i}
print(len(A)) |
p03146 | s822662547 | Accepted | s=int(input())
cnt = 1
S = [s]
while(1):
cnt += 1
if s % 2 == 0:
s //= 2
else:
s = 3*s + 1
if s in S:
print(cnt)
break
S.append(s)
|
p02963 | s520707819 | Accepted | from math import ceil
S=int(input())
y=ceil(S/(10**9))
x=10**9*y-S
print(0,0,10**9,1,x,y) |
p04020 | s139875322 | Wrong Answer | import sys
n = int(sys.stdin.readline())
ans = 0
pr_a = -100
for i in range(n):
a = int(sys.stdin.readline())
if a>=2:
ans += a//2
a %= 2
if pr_a>0 and a>0:
t = min(pr_a, a)
ans += t
a -= t
pr_a = a
print(ans) |
p03665 | s281187910 | Wrong Answer | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = 0
even = 0
for ai in A:
if ai % 2 == 0:
even += 1
else:
odd += 1
ans = (2 ** even) * ((2 ** odd) // 2)
print(ans) |
p02994 | s756543254 | Wrong Answer | n,l=map(int,input().split())
s=0
list=[]
for i in range(1,n+1):
s+=i
list.append(abs(l+i-1))
sum=n*(l-i)+s
m=list.index(min(list))
print(sum-l-m) |
p02959 | s487917445 | Accepted | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
kill_cnt = 0
for i in range(N):
if B[i] >= A[i]:
kill_cnt += A[i]+min(A[i+1],B[i]-A[i])
A[i+1] = max(A[i+1]-(B[i]-A[i]),0)
else:
kill_cnt += B[i]
print(kill_cnt)
|
p02768 | s509488290 | Accepted | n,a,b=map(int,input().split())
mod=10**9+7
ans=pow(2, n, mod) - 1
def comb(n, r):
p, q = 1, 1
for i in range(r):
p = p*(n-i) % mod
q = q*(r-i) % mod
#print(p,q)
return p * pow(q, mod-2, mod)%mod
print((ans- comb(n, a) - comb(n, b)) % mod)
|
p02832 | s864168271 | Accepted | N = int(input())
A = list(map(int,input().split()))
now = 0
for a in A:
if now+1 == a:
now = a
if now == 0:
print(-1)
else:
print(N-now) |
p03252 | s349077730 | Accepted | s = input()
t = input()
s_map = [[] for i in range(26)]
t_map = [[] for i in range(26)]
n = len(s)
for i in range(n):
si = ord(s[i]) - ord("a")
ti = ord(t[i]) - ord("a")
s_map[si].append(i)
t_map[ti].append(i)
s_map = sorted(s_map)
t_map = sorted(t_map)
if s_map == t_map:
print("Yes")
else:
print("No")
# print(s_map)
# print(t_map) |
p02615 | s695434252 | Accepted | N=int(input())
A=list(map(int,input().split()))
A.sort()
count=1
ans=A[-1]
id=N-2
while count!=N-1:
if count+2<=N-1:
ans+=2*A[id]
count+=2
id-=1
else:
ans+=A[id]
count+=1
print(ans)
|
p02987 | s305193569 | Accepted | print("Yes") if len(set(list(input()))) == 2 else print("No") |
p03721 | s802099753 | Wrong Answer | N, K = map(int, input().split())
A = [0 for _ in range(N)]
B = [0 for _ in range(N)]
s = 0
for i in range(N):
a, b = map(int, input().split())
A[i] = a
s += b
B[i] = s
ans = 0
for i in range(N):
a = A[i]
b = B[i]
if b < K:
continue
else:
ans = a
break
print(ans)
|
p02598 | s359274510 | Wrong Answer | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
from math import ceil
def main(N, K, A):
def cut_times(longest):
return sum(a // longest for a in A)
under = 0
r = 10**9
for i in range(100):
m = (under + r) / 2
if cut_times(m) > K: under = m
else: r = m
print(ceil(r - 10**-10))
if __name__ == '__main__':
input = sys.stdin.readline
N, K = map(int, input().split())
*A, = map(int, input().split())
main(N, K, A)
|
p02987 | s908235946 | Wrong Answer | S=input()
if S[0]==S[1] and S[2]==S[3] and not S[1]==S[2]:
print('Yes')
else:
print('No') |
p03478 | s380625541 | Accepted | N,A,B=map(int,input().split())
E = 0
def ans(N):
K = str(N)
T = list(map(int,K))
return (sum(T))
S = list(range(N+1))
for i in S:
num = ans(S[i])
if num >= A and num <= B:
E += S[i]
print(E) |
p03612 | s175995478 | Accepted | n = int(input())
list_P = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if list_P[i] == i+1:
a = list_P[i]
b = list_P[i+1]
list_P[i] = b
list_P[i+1] = a
ans += 1
if list_P[n-1] == n:
ans += 1
print(ans) |
p02833 | s667841444 | Accepted | N = int(input())
if N % 2 == 1:
ans = 0
else:
div2 = N // 2
n = N // 2
k = 1
while n // 2**k > 0:
div2 += n // 2**k
k += 1
div5 = 0
n = N // 2
k = 1
while n // 5**k > 0:
div5 += n // 5**k
k += 1
ans = min(div2, div5)
print(ans) |
p02948 | s164413723 | Wrong Answer | N, M = map(int, input().split())
AB = []
for _ in range(N):
a, b = map(int, input().split())
AB.append((a, b))
AB.sort(key=lambda x: x[1], reverse=True)
AB.sort(key=lambda x: x[0])
# print(AB)
day = 0
ans = 0
for a, b in AB:
if day < a and a <= M:
# print(a, b)
ans += b
day = a
print(ans) |
p03493 | s880958868 | Accepted | print(input().count("1")) |
p03494 | s540016484 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 0
b = []
while True:
b[:] = map(lambda i: i%2, a)
if sum(b) == 0:
ans += 1
a[:] = map(lambda i: i//2, a)
else:
break
print(ans) |
p03479 | s616519813 | Accepted | X, Y = map(int,input().split())
arr = []
arr.append(X)
while arr[-1] * 2 <= Y:
arr.append(arr[-1] * 2)
print(len(arr)) |
p04033 | s954018684 | Accepted | a, b = map(int, input().split())
if a*b < 1:
ans = "Zero"
elif a > 0:
ans = "Positive"
else:
ans = "Positive" if (b-a+1) % 2 == 0 else "Negative"
print(ans)
|
p03814 | s078418046 | Accepted | #-------------
s = input()
#-------------
N = len(s)
A = []
Z = []
for i in range(N):
if s[i] == "A":
A.append(i)
if s[i] == "Z":
Z.append(i)
min_A = min(A)
max_Z = max(Z)
print(max_Z-min_A+1) |
p03854 | s361345396 | Accepted | import sys
S = input()
while len(S)>5:
if S[-7:] == "dreamer":
S = S[:-7]
elif S[-6:] == "eraser":
S = S[:-6]
elif S[-5:] == "dream" or S[-5:] == "erase":
S = S[:-5]
else:
print("NO")
sys.exit()
print("YES") |
p02817 | s375833333 | Accepted | s = input().split()
print(''.join(reversed(s)))
|
p03639 | s637927781 | Accepted | n=int(input())
a=list(map(int,input().split()))
cnt2,cnt4=0,0
for i in range(n):
if a[i]%4==0:
cnt4+=1
elif a[i]%2==0:
cnt2+=1
if cnt4*2+cnt2>=n or cnt4*2+1>=n:
print("Yes")
else:
print("No") |
p03037 | s118729742 | Accepted | N, M = map(int, input().split())
left, right = map(int, input().split())
for _ in range(M-1):
c_left, c_right = map(int, input().split())
if c_left > left:
left = c_left
if c_right < right:
right = c_right
if right >= left:
print(right-left+1)
else:
print(0) |
p02755 | s776710776 | Accepted | a,b=map(int,input().split())
for i in range(1, 1009):
if int(i*0.08) == a and int(i*0.1) == b:
print(i)
exit()
print(-1) |
p02631 | s618407250 | Accepted | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
a = nl()
e = 0
for x in a:
e ^= x
b = [e^x for x in a]
print(*b)
return
solve()
|
p03495 | s384556700 | Accepted | # -*- coding: utf-8 -*-
import sys
from collections import Counter
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())
A=list(map(int,input().split()))
c=Counter(A)
m=c.most_common()[::-1]
ans=0
for _,n in m[:-K]:
ans+=n
print(ans)
if __name__ == '__main__':
main()
|
p02658 | s979396847 | Accepted | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
if __name__ == "__main__":
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
for i in range(n):
if a[i] == 0:
print(0)
sys.exit()
ans *= a[i]
if ans>10**18:
print(-1)
sys.exit()
print(ans)
|
p03109 | s567503386 | Accepted | s = input()
n = int(s[5:7])
if n<=4:
print('Heisei')
else:
print('TBD') |
p02995 | s611383970 | Accepted | #!/usr/bin/env python3
def gcd(x, y):
if x<y: x, y = y, x
while y: x, y = y, x%y
return x
def lcm(x, y):
return x * y // gcd(x, y)
a, b, c, d = map(int, input().split())
a -= 1
e = lcm(c, d)
print(b-a -b//c-b//d+b//e + a//c+a//d-a//e)
|
p03951 | s273379166 | Wrong Answer | n = int(input())
s = input()
t = input()
ans = s+t
for i in range(n):
if s[i] == t[0]:
if s[i:] == t[:n-i]:
ans = s[:i]+t
print(len(ans)) |
p02801 | s014110424 | Accepted | a = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
b = input()
for i in range(26):
if b == a[i]:
print(a[i+1]) |
p04005 | s480031205 | Accepted | #from statistics import mean, median,variance,stdev
a,b,c=map(int, input().split())
x=min(a,b,c)
z=max(a,b,c)
if a==x and b==z:
y=c
if a==x and c==z:
y=b
if b==x and a==z:
y=c
if b==x and c==z:
y=a
if c==x and a==z:
y=b
if c==x and b==z:
y=a
print(0 if z%2==0 else x*y) |
p03077 | s011449214 | Accepted |
def solve(N,T):
import math
ans = 0
for i in range(len(T)):
ans = max(ans, math.ceil(N/T[i]))
ans += 4
print(ans)
def main():
N = int(input())
T = [int(input()) for _ in range(5)]
solve(N, T)
if __name__ == "__main__":
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.