problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02700 | s926841864 | Wrong Answer | a,b,c,d=map(int,input().split())
print("No" if a//d - (c//b -1) < 0 else "Yes" if c%b==0 else "No") |
p02760 | s884899744 | Accepted | import numpy as np
A = np.array([list(map(int, input().split())) for i in range(3)])
N = int(input())
for i in range(N):
bingo_num = int(input())
A = np.where(A == bingo_num, 0, A)
if (0 in np.sum(A, axis=1)
or 0 in np.sum(A, axis=0)
or np.sum(np.diag(A)) == 0
or A[0, 2]+A[1, 1]+A[2, 0] == 0):
print("Yes")
else:
print("No") |
p04044 | s373515239 | Wrong Answer | N, L = map(int, input().split())
S = []
for i in range(N):
S.append(input())
S.sort
print(''.join(S))
|
p02717 | s644537102 | Accepted | x,y,z = map(int,input().split())
print(z,x,y) |
p02759 | s386443555 | Wrong Answer | num = input()
num = int(num)
print(int(num/2)) |
p03163 | s127765739 | Wrong Answer | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1)
for i in range(N):
w, v = map(int, input().split())
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(dp)
print(int(dp.max()))
|
p03131 | s244010083 | Accepted | k,a,b=map(int,input().split())
if a+1>=b:
print(k+1)
exit()
c=k-a+1
if c%2==0:
print(max(k+1,a+(c//2)*(b-a)))
else:
print(max(k+1,(c//2)*(b-a)+a+1)) |
p03103 | s287960649 | Wrong Answer | N ,M = (map(int , input().split()))
e_dict = {}
for i in range(N):
A ,B = (map(int , input().split()))
e_dict[A] = B
e_dict_sorted = sorted(e_dict.items(), key=lambda x:x[0])
honsuu = 0
kane = 0
for i in e_dict_sorted:
honsuu += i[1]
kane += i[0]*i[1]
if honsuu >= M:
break
hiku = honsuu - M
ans = kane - (hiku*i[0])
print(ans) |
p02693 | s125983678 | Wrong Answer | import numpy as np
a = int(input())
b,c=map(int,input().split())
d = np.arange(7, 995, 7)
f = np.arange(b,c)
d_set=set(d)
f_set=set(f)
#dとfに共通するものを抽出
g_set=d_set&f_set
#結果をlistに変換
g=list(g_set)
if len(g) == 0:
print('NG')
else:
print('OK') |
p02951 | s401866147 | Accepted | def resolve():
a,b,c=map(int,input().split())
print(max(0,c-max(0,a-b)))
resolve() |
p03836 | s976817960 | Accepted | a,b,c,d=map(int,input().split())
x=c-a
y=d-b
ans1=x*"R"+y*"U"
ans2=x*"L"+y*"D"
ans3="D"+(1+x)*"R"+(1+y)*"U"+"L"
ans4="U"+(1+x)*"L"+(1+y)*"D"+"R"
ans=ans1+ans2+ans3+ans4
print(ans) |
p02621 | s054852003 | Accepted | a=int(input())
print(a+a*a+a*a*a) |
p03137 | s266970679 | Wrong Answer | n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
if n >= m or m == 1:
print(0)
else:
move = sorted([x[i] - x[i - 1] for i in range(1, m)])
ans = sum(move[:-n + 1])
print(ans)
|
p03073 | s208425112 | Wrong Answer | import sys
S = "10010010"
S_list = list(S)
l = len(S)
if len(S) % 2 == 0:
ideal1 = list('01' * int(l / 2))
ideal2 = list('10' * int(l / 2))
else:
ideal1 = list('01' * (l // 2) + '0')
ideal2 = list('10' * (l // 2) + '1')
ans = 0
ans1 = 0
for base,compe1 in zip(S_list,ideal1):
if base != compe1:
ans = ans + 1
for base,compe2 in zip(S_list,ideal2):
if base != compe2:
ans1 = ans1 + 1
print(min(ans,ans1))
|
p02546 | s003128042 | Accepted | S = input()
if S[-1] == "s":
print(S + "es")
else:
print(S + "s") |
p03680 | s291811882 | Accepted | def li():
return list(map(int, input().split()))
def mi():
return map(int, input().split())
def ii():
return int(input())
def lim(N):
return [int(input()) for i in range(N)]
N = ii()
a = lim(N)
current = 1
result = 1
for i in range(N):
if a[current - 1] == 2:
print(result)
break
else:
current = a[current - 1]
result += 1
else:
print(-1) |
p03760 | s358950113 | Accepted | a = list(input())
b = list(input())
c = []
for i in range(len(b)):
c.append(a[i])
c.append(b[i])
if len(a) > len(b):
c.append(a[-1])
print(''.join(c))
|
p03433 | s138169377 | Accepted | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
A = int(readline())
x = N % 500
if x <= A:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
p02988 | s702314990 | Accepted | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
if sorted([p[i - 1], p[i], p[i + 1]])[1] == p[i]:
ans += 1
print(ans)
|
p02795 | s178983550 | Accepted | import sys
input = sys.stdin.readline
def main():
H = int(input())
W = int(input())
N = int(input())
q, r, = divmod(N, max(H, W))
ans = q
ans += 1 if r > 0 else 0
print(ans)
if __name__ == "__main__":
main()
|
p02700 | s082027215 | Wrong Answer | N = [int(e) for e in input().split()]
if(N[2]%N[1] !=0):
ans = N[2]//N[1]+1
else:
ans = N[2]//N[1]
for i in range(0,ans):
N[0] -= N[3]
if(N[0] <= 0):
print('No')
break
else:
print('Yes') |
p02861 | s503028053 | Accepted | import itertools
import math
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
pairs = list(itertools.permutations(A, N))
ans = 0
for p in pairs:
x1, y1 = p[0]
for i in range(1, N):
x2, y2 = p[i]
ans += math.hypot(x1-x2, y1-y2)
x1, y1 = x2, y2
ans /= len(pairs)
print(ans)
|
p02629 | s705691109 | Wrong Answer | N = int(input())
alphabet = ['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']
name = ''
while N != 0:
name += alphabet[(N-1) % 26]
if N == 26:
break
N //= 26
print(name[::-1]) |
p02995 | s009226366 | Wrong Answer | A,B,C,D=map(int,input().split())
#a,bの最大公約数
def gcd(a, b):
while b:
a, b = b, a % b
return a
#a,bの最小公倍数
def lcm(a, b):
return a * b // gcd (a, b)
lcm_=lcm(C,D)
answer=B-A+1-(B//C-A//C)-(B//D-A//D)+(B//lcm_-A//lcm_)
if A%C==0:
answer-=1
if A%D==0:
answer-=1
print(answer)
|
p03073 | s864309286 | Accepted | S = list(input())
N = len(S)
P = [str(i%2) for i in range(N)]
Q = [str((i+1)%2) for i in range(N)]
PC = 0
QC = 0
for i in range(N):
if P[i] != S[i]:
PC += 1
else:
QC += 1
print(min(PC,QC))
|
p02695 | s289031993 | Accepted | import itertools
N,M,Q=map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
A=[]
ans=[]
for i in itertools.combinations_with_replacement(list(range(1,M+1)), N):
A.append(i)
# print(A)
for i in A:
ans_=0
for j in abcd:
if i[j[1]-1] - i[j[0]-1] == j[2]:
ans_+=j[3]
ans.append(ans_)
print(max(ans)) |
p02711 | s525137541 | Accepted | N = input()
if '7' in N:
print ('Yes')
else:
print ('No') |
p03327 | s052625917 | Wrong Answer | contest_num = int(input())
if contest_num >= 1999:
result_str = 'The contest has not been held'
elif contest_num < 1000:
result_str = 'ABC'
elif contest_num >= 1000:
result_str = 'ABD'
print("result_str")
|
p02854 | s183599198 | Wrong Answer | n = int(input())
l = list(map(int,input().split()))
from itertools import accumulate
tot=sum(l)
ans=10**9+7
for i in list(accumulate(l)):
if i <= tot//2:
ans=min(ans, abs(tot-(i*2)))
for i in list(accumulate(l[::-1])):
if i <= tot//2:
ans=min(ans, abs(tot--(i*2)))
print(ans)
|
p03095 | s928282505 | Accepted | N=int(input())
S=input()
count=1
for char in set(S):
count*=S.count(char)+1
print((count-1)%(10**9+7)) |
p04019 | s851400595 | Accepted | s=input()
ans="Yes"
cn=s.count("N")
cs=s.count("S")
ce=s.count("E")
cw=s.count("W")
if cn==0 and cs!=0:
ans="No"
elif cn!=0 and cs==0:
ans="No"
elif cw==0 and ce!=0:
ans="No"
elif cw!=0 and ce==0:
ans="No"
print(ans) |
p04029 | s623583535 | Accepted | import sys
import numpy as np
# N 子供の数入力
n = int(input())
child = np.arange(1, n + 1)
print(child.sum()) |
p03289 | s873470750 | Wrong Answer | import copy
s=list(input())
if s[0]=='A' and 'C' in s[2:len(s)] :
t=copy.copy(s)
s.remove('A')
s.remove('C')
result=''.join(s)
if len(s)==len(t)-2 and result.islower()==True:
print('AC')
else:
print('WA')
else:
print('WA')
|
p03103 | s989522181 | Accepted | n, m = [int(i) for i in input().split()]
v = []
for i in range(n):
a, b = [int(i) for i in input().split()]
v.append((a, b))
ans = 0
for a, b in sorted(v):
if m > b:
ans += a * b
m -= b
else:
ans += a * m
break
print(ans)
|
p02790 | s683251623 | Wrong Answer | # -*- coding: utf-8 -*-
a,b = list(map(int, input().split()))
print(max(str(a)*b, str(b)*a)) |
p02785 | s430750521 | Accepted | N, K=input().split()
hp=input().split()
j = sorted([int(x) for x in hp])
print(sum([j[x] for x in range(int(N) - int(K))])) if int(K) < int(N) else print(0) |
p02645 | s292651462 | Accepted | s = input()
print(s[:3]) |
p03627 | s426514678 | Accepted | N = int(input())
List = list(map(int,input().split()))
List = sorted(List)[::-1]
L = 0
S = 0
temp = 0
for i in range(N-1):
if List[i] == List[i+1]:
L = List[i]
temp =i+1
break
for i in range(temp+1,N-1):
if List[i] == List[i+1]:
S = List[i]
break
print(L*S) |
p02918 | s445657596 | Accepted | n, k = map(int, input().split())
s = input()
happy = 0
rl = 0
before = s[0]
if before == 'R' and s[1] == 'R':
happy += 1
for i in range(1, n):
if before == 'R' and s[i] == 'L':
rl += 1
if s[i] == 'L' and s[i-1] == 'L':
happy += 1
if i < n-1:
if s[i] == 'R' and s[i+1] == 'R':
happy += 1
before = s[i]
if rl < k:
print(n-1)
else:
print(happy + k*2) |
p02778 | s128079423 | Accepted | S=input()
print('x'*len(S)) |
p03456 | s748344827 | Wrong Answer | a,b = map(str, input().split())
c = int(a+b)
flag = False
for i in range(1000):
if i**2 == c:
flag = True
exit(0)
if flag:
print("Yes")
else:
print("No") |
p02727 | s548042582 | Accepted | x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
c_apple = p[0:x] + q[0:y]
c_apple.sort()
for i in range(len(r)):
if c_apple[i] < r[i]:
c_apple[i] = r[i]
else:
break
print(sum(c_apple)) |
p02775 | s323985234 | Accepted | N=input()
N=N[::-1]+"0"
ans=0
up=0
for i,n in enumerate(N):
d=int(n)+up
if d>5 or (d==5 and i<len(N)-1 and int(N[i+1])>=5):
ans+=(10-d)
up=1
else:
ans+=d
up=0
print(ans) |
p02706 | s128017270 | Wrong Answer | N, M = map(int, input().split())
A = list(map(int, input().split()))
print(N - sum(A)) |
p03000 | s262081080 | Wrong Answer | n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
cnt=0
for i in range(n):
if x<d:
break
cnt+=1
d+=l[i]
print(cnt) |
p02773 | s682024781 | Accepted | import collections
n=int(input())
a=[]
for i in range(n):
s=input()
a.append(s)
b=collections.Counter(a)
mx=max(b.values())
ans=[]
for word,counts in b.items():
if counts==mx:
ans.append(word)
ans=sorted(ans)
for i in ans:
print(i)
|
p03038 | s233575976 | Wrong Answer | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [list(map(int, input().split())) for _ in range(m)]
a.sort
c = sorted(b, key=lambda x: x[1])
d = []
for i in range(m):
d.extend([c[i][1]]*c[i][0])
for i in range(min(n, len(d))):
if a[i] < d[-i]:
a[i] = d[-i]
print(sum(a)) |
p03309 | s683430752 | Accepted | N = int(input())
A = map(int, input().split())
x = sorted(a - i - 1 for i, a in enumerate(A))
mid = x[N//2] if N % 2 else (x[N//2] + x[N//2-1]) // 2
ans = sum(abs(xi - mid) for xi in x)
print(ans)
|
p02912 | s042781533 | Accepted | # 「毎回最大のやつ取れない限り無理じゃね...?」 <- それできます。優先度付きキューならね
import heapq
from functools import reduce
n, m = map(int, input().split())
arr = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(arr)
for i in range(m):
t = -1 * heapq.heappop(arr)
heapq.heappush(arr, -1 * (t // 2))
print(-1 * reduce(lambda a, b: a + b, arr))
|
p03017 | s568136574 | Accepted | n, a, b, c, d = map(int, input().split())
s = input()
if "##" in s[a - 1:max(c, d)]:
print("No")
exit()
elif c > d and not "..." in s[b - 2:d + 1]:
print("No")
exit()
print("Yes") |
p02917 | s918087401 | Accepted | import math
import collections
import itertools
def resolve():
N=int(input())
B=list(map(int,input().split()))
cnt=B[0]
for i in range(N-2):
if(B[i]<=B[i+1]):
cnt+=B[i]
else:
cnt+=B[i+1]
cnt+=B[N-2]
print(cnt)
resolve()
|
p03352 | s333728879 | Wrong Answer | x=int(input())
l=[1]
for i in range(2,int(x**0.5)+1):
j=1
while i**(j+1)<=x:
j+=1
l.append(i**j)
print(l)
print(max(l)) |
p02982 | s231962600 | Accepted | import numpy as np
from itertools import combinations
N, D = map(int, input().split())
X = np.zeros([N, D], dtype=int)
ans = []
def judge_int(array):
return np.sqrt((array**2).sum()).is_integer()
for i in range(N):
X[i] = np.array(list(map(int, input().split())))
for i, j in list(combinations(range(0, N), 2)):
ans.append(judge_int(X[i] - X[j]))
print(sum(ans)) |
p03472 | s242400376 | Wrong Answer | n, h = map(int, input().split())
AB = [(list(map(int, input().split()))) for _ in range(n)]
A = []
B = []
for a, b in AB:
A.append(a)
B.append(b)
sum_B = sum(B)
ans = len(B)
if sum_B >= h:
print(ans)
else:
max_A = max(A)
h -= sum_B
ans += h // max_A
print(ans) |
p02791 | s904750179 | Accepted | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
n=int(input())
p=lmp()
ans=0
m=2*n
for i in range(n):
if p[i]<=m:
ans+=1
m=p[i]
print(ans) |
p02900 | s174049596 | Wrong Answer | import fractions
a, b = map(int, input().split())
common_num = fractions.gcd(a, b)
ans = 1
for i in range(2,int(common_num**0.5)+2):
if common_num % i == 0:
ans += 1
while common_num % i == 0:
common_num //= i
print(ans) |
p02717 | s068396145 | Accepted | a,b,c=input().split()
print(c,a,b) |
p02725 | s488895116 | Accepted | import heapq
k, n = map(int, input().split())
a = [int(x) for x in input().split()]
qa = []
heapq.heapify(qa)
for x in range(len(a) - 1):
heapq.heappush(qa, abs(a[x] - a[x + 1]))
heapq.heappush(qa, k - a[-1] + a[0])
dis = 0
for x in range(len(qa) - 1):
dis += heapq.heappop(qa)
print(dis)
|
p03328 | s237356440 | Accepted | a,b=map(int,input().split())
n=0
for i in range(1,(b-a)+1):
n+=i
print(n-b) |
p03161 | s853774128 | Accepted | N,K=map(int,input().split())
h=list(map(int,input().split()))
cost=[0,abs(h[1]-h[0])]
for i in range(2,N):
cand=10**10
for j in range(K):
if j==i:
break
cand=min(cand,cost[i-j-1]+abs(h[i]-h[i-j-1]))
cost.append(cand)
print(cost[-1])
|
p03387 | s456043978 | Wrong Answer | n = sorted((map(int,input().split())))
ans = 0
while 1:
ans += 1
if n[2]-n[0] > 1:
n[0] += 2
else:
n[0] += 1
n[1] += 1
n = sorted(n)
if n[0]==n[1] and n[1]==n[2]:
break
print(ans)
|
p02676 | s457936444 | Accepted | k=int(input())
s=input()
if len(s)<=k:
print(s)
else:
print(s[:k]+"...") |
p02725 | s773376168 | Wrong Answer | l = input().split(" ")
j = input().split(" ")
k = int(l[0])
n = int(l[1])
x = 0
for i in range(n-1):
d = int(j[i+1]) - int(j[i])
x = max(x,d)
dt = k - int(x)
print(dt)
|
p04005 | s228635333 | Accepted | cubic= list(map(int, input().split()))
cubic.sort()
if cubic[2] % 2 == 0:
print(0)
else:
print(cubic[0]*cubic[1]) |
p04030 | s287735843 | Accepted | S = list(input())
ans = ""
for s in S:
if s == "B":
ans = ans[:len(ans) - 1]
else:
ans += s
print(ans) |
p03994 | s155956363 | Accepted | alphabet = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
S = [alphabet.index(x) for x in s]
K = int(input())
tmp = K
i = 0
while i < len(S) and tmp > 0:
if S[i] != 0 and 26-S[i] <= tmp:
tmp -= 26-S[i]
S[i] = 0
i += 1
if tmp > 0:
S[-1] = (S[-1]+tmp)%26
print("".join([alphabet[x] for x in S]))
|
p03030 | s726673306 | Accepted | from operator import itemgetter
n = int(input())
a = []
for i in range(n):
s, p = input().split()
a.append((i + 1, s, -int(p)))
a.sort(key=itemgetter(1, 2))
for i, _, _ in a:
print(i)
|
p02900 | s285065337 | Wrong Answer | import math
import fractions
def divisors(n):
s = set()
for x in range(2, math.ceil(n ** 0.5) + 1):
while n % x == 0:
s.add(x)
n //= x
return s
a, b = map(int, input().split())
print(len(divisors(fractions.gcd(a, b))) + 1)
|
p03861 | s318479044 | Accepted | a,b,x=map(int,input().split())
print(b//x-(a-1)//x) |
p03419 | s483297784 | Accepted | N,M=map(int, input().split())
ans=0
if min(N,M)==1:
if max(N,M)==1:
print(1)
exit()
print(max(0,max(N,M)-2))
exit()
ans=(N-2)*(M-2)
print(ans)
|
p02923 | s768723652 | Wrong Answer | n=int(input())
hl=list(map(int,input().split()))
count=0
temp_count=0
for i in range(n-1):
if hl[i]>=hl[i+1]:
temp_count+=1
else:
if count<temp_count:
count=temp_count
temp_count=0
if count<temp_count:
count=temp_count
print(count) |
p03679 | s760922013 | Wrong Answer | a,b,c=list(map(int,input().split()))
if a-b>0:
print('delicious')
elif -b+c<=a:
print('safe')
else:
print('dangerous') |
p02714 | s984785606 | Wrong Answer | N=int(input())
S=input()
import collections
c=collections.Counter(list(S))
c=list(c.values())
rgb=1
for i in range(len(c)):
rgb*=c[i]
cnt=0
for i in range(N):
for j in range(i+1,N):
k=j+j-i
if k>=N:
break
if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
cnt+=1
print(rgb-cnt)
|
p02742 | s388566425 | Accepted | if __name__ == "__main__":
h, w = map(int, input().split())
if h == 1 or w == 1:
print(1)
elif h % 2 == 0 or w % 2 == 0:
print(h * w // 2)
else:
print((h*w+1) // 2)
|
p03408 | s392352912 | Accepted | import collections
N = int(input())
a = []
b = []
for i in range(N):
s = input()
a.append(s)
M = int(input())
for i in range(M):
t = input()
b.append(t)
a1 = collections.Counter(a)
a2 = a1.most_common()
ans = 0
for i in range(len(a1)):
total = a2[i][1] - b.count(a2[i][0])
if total > ans:
ans = total
else:
continue
print(ans) |
p03479 | s568049957 | Accepted | ans = 1
x,y = [int(x) for x in input().split()]
while True:
if x*(2**ans) > y:
break
ans += 1
print(ans) |
p03785 | s791119649 | Accepted | N, C, K = list(map(int, input().split()))
T = []
for i in range(N):
T.append(int(input()))
bus = []
departure=0
T.sort()
for passenger in T:
if bus == []:
bus.append(passenger)
elif passenger <= bus[0]+K and len(bus)<=(C-1):
bus.append(passenger)
else:
bus.clear()
departure+=1
bus.append(passenger)
if bus != []:
print(departure + 1)
else:
print(departure) |
p02899 | s411080895 | Wrong Answer | n = int(input())
a_list = list(map(int, input().split()))
res = sorted(range(n), key=lambda k: a_list[k])
print(list(map(lambda x: x+1, res))) |
p03637 | s669086142 | Wrong Answer | import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
lll = list()
for i in range(len(A)):
if A[i]%4 == 0:
l.append(A[i])
if A[i]%2 == 0:
ll.append(A[i])
if A[i]%2 != 0:
lll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = N/2
b = A.count(0)
if a <= four and b == 0:
print("Yes")
elif a-two <= four:
print("Yes")
else:
print("No") |
p02730 | s427039481 | Wrong Answer | s = input()
if len(s) / 2 == 0:
print("No")
exit()
def check(i):
if len(i) / 2 != 0:
i2 = i[len(i) // 2 + 1:len(i)]
else:
i2 = i[len(i) // 2:len(i)]
if i[0:len(i) // 2] == i2[::-1] or len(i2) == 1:
return(True)
return(False)
s2 = s[0:(len(s) - 1) // 2]
s3 = s[(len(s) - 1) // 2 + 1:len(s)]
if check(s) == True and check(s2) == True and check(s3) == True:
print("Yes")
else:
print("No")
|
p02953 | s022348976 | Accepted | n = int(input())
H = list(map(int, input().split()))
i = -1
for _ in range(n - 1):
if H[i - 1] - H[i] > 1:
ans = "No"
print(ans)
exit()
elif H[i - 1] - H[i] == 1:
H[i - 1] -= 1
i -= 1
ans = "Yes"
print(ans)
|
p03607 | s194369887 | Wrong Answer | n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
sa = list(set(a))
for i in range(len(sa)):
if a.count(sa[i]) % 2 == 1:
ans += a.count(sa[i])
print(ans) |
p03838 | s118209622 | Accepted | x,y=map(int, input().split())
if x<=y:
if abs(x)<=abs(y):
ans=min(y-x, y-(-x)+1)
else:
ans=min(y-x, 1+abs(-y-x))
else:
#xの方が大きい
ans=1+abs(abs(x)-abs(y))
if x*y>0:
ans+=1
print(ans)
|
p02923 | s264267447 | Wrong Answer | import math
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7
sys.setrecursionlimit(1000010)
N = ni()
H = nl()
current = 0
ans = 0
for i in range(1,N):
if H[i-1] >= H[i]:
current +=1
else:
if current > ans:
ans = current
currrent = 0
if current > ans:
ans = current
print(ans)
|
p03109 | s807501393 | Accepted | S=input()
if int(S[5:7])<=4:
print('Heisei')
else:
print('TBD') |
p02675 | s871143532 | Accepted | s = input()
c = s[-1]
if c == '3':
print('bon')
elif c in ['0','1','6','8']:
print('pon')
else:
print('hon') |
p03075 | s012468193 | Accepted | import itertools
Antennas = []
for i in range(5):
Antennas.append(int(input()))
K = int(input())
combi = list(itertools.combinations(Antennas, 2))
flag = True
for c in combi:
if abs(c[0]-c[1]) > K:
flag = False
if flag:
print('Yay!')
else :
print(':(') |
p03637 | s902588667 | Accepted | n,*aa = map(int, open(0).read().split())
odd = sum([a%2 for a in aa])
quad = sum([a%4==0 for a in aa])
if odd <= quad or (odd == quad + 1 and odd+quad == len(aa)):
print('Yes')
else:
print('No') |
p03548 | s374612943 | Accepted | x,y,z=map(int,input().split())
print((x-z)//(y+z)) |
p02646 | s900426356 | Accepted | a, v = list(map(int, input().strip().split()))
b, w = list(map(int, input().strip().split()))
t = int(input())
if a == b: print("YES")
else:
if w >= v: print("NO")
else:
tt = abs(a-b)/(v-w)
if tt <= t: print("YES")
else: print("NO") |
p03254 | s376708395 | Wrong Answer | import sys
input=sys.stdin.readline
from bisect import bisect_right
import itertools
N,X= map(int,input().split())
A=list(map(int,input().split()))
A.sort()
Acum = list(itertools.accumulate(A))
print(Acum)
answer = bisect_right(Acum,X)
if answer == N:
if Acum[-1] < X:
answer -= 1
print(answer)
|
p03012 | s990948483 | Accepted | n=int(input())
w=list(map(int,input().split()))
ans=float('inf')
for i in range(1,len(w)):
sabun=abs(sum(w[:i])-sum(w[i:]))
ans=min(ans,sabun)
print(ans) |
p02811 | s220009849 | Wrong Answer | a,b=map(int,input().split())
if a*500 > b:
print('Yes')
else:
print('No') |
p02882 | s350895779 | Wrong Answer | import math
a, b, x = map(int, input().split())
if a**2*b/2 >= 2*x:
c = (2*x)/(a*b)
print(math.degrees(math.atan2(b, c)))
else:
d = 2*(b-x/(a**2))
print(math.degrees(math.atan2(d, a))) |
p02607 | s482535834 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
ans = 0
for i, a in enumerate(A):
if (i + a) % 2 == 1:
ans += 1
print(ans) |
p02687 | s311712344 | Accepted | S = input()
if S == "ABC":
print("ARC")
else:
print("ABC") |
p03433 | s812614903 | Wrong Answer | N = int(input())
A = int(input())
n=N%500
s=False
for i in range(1,A+1):
if n==i:
s=True
break
if s:
print('Yes')
else:
print('No')
|
p03011 | s724304327 | Accepted | p,q,r=map(int,input().split())
print(min(p+q,p+r,q+r)) |
p02797 | s116119370 | Accepted | n, k, s = map(int, input().split())
if k == n:
print(" ".join([str(s) for _ in range(n)]))
exit()
arr = []
for i in range(1, n + 1):
if i <= k:
arr.append(s)
else:
arr.append(8 ** 9 + 14499) # テキトー
print(" ".join(list(map(str, arr))))
|
p03637 | s467116402 | Wrong Answer | n = int(input())
a = map(int, input().split())
count2 = 0
count4multiple = 0
for i in a:
if i == 2:
count2 += 1
elif i % 4 == 0:
count4multiple += 1
if n-1 <= count4multiple * 2 + max(0, count2 - 1):
print("Yes")
else:
print("No")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.