problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03774
|
s667820341
|
Accepted
|
n, m = map(int, input().split())
sd = []
cp = []
for i in range(n):
sd.append([int(j) for j in input().split()])
for i in range(m):
cp.append([int(j) for j in input().split()])
dist = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
for j in range(m):
dist[i][j] = abs(sd[i][0] - cp[j][0]) + abs(sd[i][1] - cp[j][1])
for i in range(n):
print(dist[i].index(min(dist[i]))+1)
|
p02705
|
s654355228
|
Accepted
|
import math
R=int(input())
print(R*2*math.pi)
|
p02923
|
s139862310
|
Accepted
|
N = int(input())
H = list(map(int, input().split()))
res = []
cnt = 0
for i in range(N-1):
if H[i+1] <= H[i]:
cnt += 1
if i == N - 2:
res.append(cnt)
else:
res.append(cnt)
cnt = 0
if res == []:
print(0)
else:
print(max(res))
|
p03665
|
s439117587
|
Wrong Answer
|
n, p, *a = map(int, open(0).read().split())
if n == 1:
if a[0] % 2 == 1 and p == 1:
print(1)
elif a[0] % 2 == 0 and p == 0:
print(2)
else:
print(0)
else:
print(2**(n -1))
|
p03607
|
s066507688
|
Wrong Answer
|
N = int(input())
ans = [int(input()) for i in range(N)]
ans.sort()
total = 0
tmp = 1
for i in range(N-1):
if ans[i] == ans[i+1]:
tmp += 1
else:
if tmp %2 == 1:
total += 1
tmp = 1
print(total)
|
p02621
|
s541506143
|
Wrong Answer
|
a = int(input())
b = a + a^2 + a^3
print(int(b))
|
p02732
|
s622438972
|
Accepted
|
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
d[x] += 1
s = 0
for k,v in d.items():
s += v * (v-1) // 2
for x in a:
c = d[x] - 1
print(s - c)
|
p02777
|
s700684621
|
Accepted
|
S, T = input().split()
A, B = map(int,input().split())
U = input()
if S == U :
a = A - 1
b = B
else :
a = A
b = B - 1
print(a, b)
|
p02922
|
s169569316
|
Accepted
|
#入力 A:使う1個当たりのタップの口数 B:最終的にここまで増やす差し込み口の数
A, B = list(map(int,input().split()))
#タップの必要数をans, 差し込み口の数をsocとする
ans = 0
soc = 1
#差し込み口はタップを使うと増えるが一つ使うと必ず1つ差し込み口を消費する。
while soc < B:
soc -= 1
ans += 1
soc += A
#結果
print(ans)
|
p03719
|
s049141246
|
Accepted
|
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
def main():
A, B, C = map(int, input().split())
print('Yes') if A <= C <= B else print('No')
if __name__ == '__main__':
main()
|
p02727
|
s602846584
|
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(' ')))
eat = sorted(p, reverse=True)[:X]
eat[len(eat):] = sorted(q, reverse=True)[:Y]
eat[len(eat):] = R
eat.sort(reverse=True)
print(sum(eat[:X+Y]))
|
p03611
|
s417677762
|
Accepted
|
c = [0]*100002
input()
for x in map(int, input().split()):
c[x] += 1
c[x+1] += 1
c[x+2] += 1
print(max(c))
|
p03759
|
s756402826
|
Wrong Answer
|
a, b, c = map(int, input().split())
if b - a == c - b :
print("Yes")
else:
print("No")
|
p02802
|
s263782455
|
Wrong Answer
|
# -*- coding: utf-8 -*-
import sys
N,M = map( int, input().split() )
list_str_P_S = [input().split() for i in range(M)]
#-----
count_AC=0
count_WA=0
check_question_no=[]
for L in list_str_P_S:
str_number = L[0]
result = L[1]
if ( str_number in check_question_no ):
continue
else:
if result == "WA":
count_WA += 1
elif result == "AC":
count_AC += 1
check_question_no.append(str_number)
print(count_AC,count_WA)
|
p03852
|
s878473062
|
Accepted
|
c = input()
print("vowel" if c in "aioueo" else "consonant")
|
p03611
|
s823550131
|
Accepted
|
import collections
n = int(input())
line = list(map(int,input().split()))
box = []
for i in line:
box.append(i)
box.append(i-1)
box.append(i+1)
newbox = collections.Counter(box)
answer = max(newbox.values())
print(answer)
|
p02633
|
s928431815
|
Wrong Answer
|
# -*- coding: utf-8 -*-
## Library
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
## input
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split())
# P = [list(map(int,input().split())) for i in range(M)]
X=int(input())
# X x ans = 360
# ans = 360/X
if X*360//math.gcd(X,360) == 360:
print(360//X)
else:
print(X*360)
|
p02553
|
s381812581
|
Wrong Answer
|
import sys
input = sys.stdin.readline
a,b,c,d = map(int,input().split())
if a >= 0 and c >= 0:
print(b*d)
elif a >= 0 and c < 0 and d >= 0:
print(b*d)
elif a >= 0 and c < 0 and d < 0:
print(a*d)
elif a < 0 and c < 0:
print(a*c)
elif a < 0 and b >= 0 and c >=0:
print(b*d)
elif a < 0 and b < 0 and c >= 0:
print(b * c)
|
p03862
|
s857451142
|
Accepted
|
N, x = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0
if a[0] > x:
ans += a[0] - x
a[0] = x
for i in range(1, N):
if a[i] + a[i - 1] > x:
ans += a[i] - (x - a[i - 1])
a[i] = x - a[i - 1]
print(ans)
|
p02552
|
s579545655
|
Accepted
|
print("0") if input()=="1" else print("1")
|
p03469
|
s695988867
|
Accepted
|
s = input()
ans = '2018' + s[4:]
print(ans)
|
p02681
|
s604288059
|
Accepted
|
S = input()
T = input()
if S == T[:-1]:
print('Yes')
else:
print('No')
|
p02918
|
s634562023
|
Accepted
|
n, k = map(int, input().split())
L=list(input())
cnt=0
if L[0]=='R' and L[1]=='R':
cnt+=1
for i in range(1,n-1):
if L[i]=='R' and L[i+1]=='R':
cnt+=1
if L[i]=='L' and L[i-1]=='L':
cnt+=1
if L[n-1]=='L' and L[n-2]=='L':
cnt+=1
print(min(cnt+2*k,n-1))
|
p02615
|
s327821526
|
Accepted
|
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
from queue import deque
q = deque([a[0]])
ans = 0
for num in a[1:]:
ans += q.popleft()
q.append(num)
q.append(num)
print(ans)
|
p02600
|
s478543621
|
Accepted
|
x = int(input())
if x >= 400 and x < 600:
print(8)
elif x >= 600 and x < 800:
print(7)
elif x >= 800 and x < 1000:
print(6)
elif x >= 1000 and x < 1200:
print(5)
elif x >= 1200 and x < 1400:
print(4)
elif x >= 1400 and x < 1600:
print(3)
elif x >= 1600 and x < 1800:
print(2)
elif x >= 1800 and x < 2000:
print(1)
|
p03352
|
s904986684
|
Accepted
|
from math import sqrt
X=int(input())
ans=0
for i in range(1,int(sqrt(X))+1):
now=i
b=2
while i!=1 and X>=i**b:
now=i**b
b+=1
ans=max(ans, now)
print(ans)
|
p03161
|
s337950668
|
Accepted
|
from sys import stdout, stdin, maxsize
n, k = map(int, stdin.readline().split())
ls = list(map(int, stdin.readline().split()))
dp = [maxsize] * (n + 1)
dp[1] = 0
if n == 1:
print(0)
else:
dp[2] = abs(ls[1] - ls[0])
for i in range(3, n + 1):
j = 1
while j <= k and i - j >= 0:
dp[i] = min(dp[i - j] + abs(ls[i - 1] - ls[i - 1 - j]), dp[i])
j += 1
print(dp[n])
|
p02755
|
s132185040
|
Wrong Answer
|
a, b = map(int, input().split())
# for i in range(1, 1010):
# if a == int(i*0.08) and b == int(i*0.1):
# print(i)
# break
# else:
# print(-1)
# O(1)の回答
if int(b*10*0.08) > a:
print(-1)
elif int((b*10+9)*0.08) < a:
print(-1)
elif a % 2 == 0:
print(int(a/0.08))
else:
print(int(a/0.08)+1)
|
p03309
|
s956843374
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
A[i] = A[i] - i + 1
A.sort()
b = A[N // 2]
ans = 0
for a in A:
ans += abs(a - b)
print(ans)
|
p03774
|
s479356233
|
Wrong Answer
|
n, m = map(int, input().split())
ss = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(m)]
INF = 10 ** 8 * 2
for s in ss:
dist = INF
c_point = 0
a, b = s
for i, v in enumerate(p):
c, d = v
manhattan = abs(a - c) + abs(b - d)
if manhattan < dist:
c_point = i + 1
dist = manhattan
print(c_point)
|
p03136
|
s942028962
|
Wrong Answer
|
N = int(input())
L = list(map(int, input().split()))
lmax = max(L)
suml = 0
for i in L:
if i != lmax:
suml += i
if lmax < suml:
print('Yes')
exit()
print('No')
|
p02817
|
s101460387
|
Accepted
|
s, t = input().split()
print(t + s)
|
p02659
|
s394910906
|
Wrong Answer
|
import math
import numpy as np
def main():
a = list( map( float, input().split()))
#print(format(a[0], '.20f'))
a1 = int(a[0])
a2 = int(round(a[1],3)*100)
#print(format(a[1], '.20f'))
#print(format(a2, '.20f'))
s = a1*a2/100
#print(format(s, '.20f'))
print(math.floor(s))
if __name__ == '__main__':
main()
|
p03317
|
s275169647
|
Accepted
|
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=1
n=n-k
while(n>0):
n=n-(k-1)
count+=1
print(count)
|
p03672
|
s510271452
|
Wrong Answer
|
def main():
from collections import deque
s = deque(list(input()))
while deque:
t = s.pop()
if len(s)%2 != 0:
continue
l = list(s)
if l == l[::-1]:
print(len(l))
return 0
if __name__ == '__main__':
main()
|
p04045
|
s021336984
|
Accepted
|
N, K = map(int, input().split())
d = list(map(str, input().split()))
like = [ str(i) for i in range(10)]
like = list(set(like) ^ set(d))
Ans = 0
while( Ans == 0):
if set(list(str(N))) <= set(like):
print(N)
Ans +=1
exit()
N += 1
|
p03000
|
s996200472
|
Accepted
|
N,L=map(int,input().split())
A=list(map(int,input().split()))
hane=1
count=0
for i in range(N):
count+=A[i]
hane+=1
if count==L:
break
elif count>L:
hane-=1
break
print(hane)
|
p03042
|
s173979440
|
Accepted
|
S = input()
ahead = S[0:2]
post = S[2:]
if (ahead == '00' or int(ahead) > 12):
a_judge = True
else:
a_judge = False
if (post == '00' or int(post) > 12):
p_judge = True
else:
p_judge = False
if (a_judge and p_judge):
ans = 'NA'
elif (a_judge):
ans = 'YYMM'
elif (p_judge):
ans = 'MMYY'
else:
ans = 'AMBIGUOUS'
print(ans)
|
p02766
|
s137110346
|
Accepted
|
N ,K = map(int, input().split())
count = 0
for i in range(10**9):
if N == 0:
break
N = N//K
count += 1
print(count)
|
p03433
|
s420672730
|
Accepted
|
n = int(input())
a = int(input())
n %= 500
if n <= a: print('Yes')
else: print('No')
|
p02639
|
s409187319
|
Accepted
|
s = list(map(int, input().split()))
b = s.index(0)
print(b + 1)
|
p03986
|
s007743033
|
Accepted
|
#coding:utf-8
X = input()
ans = 0
cnt = 0
for x in X:
if x=="S":
cnt+=1
else:
if (cnt>0):
cnt-=1
ans+=1
print (len(X)-2*ans)
|
p02597
|
s247281178
|
Wrong Answer
|
import sys
import numpy as np
N=int(input())
data = input()
num = len(data)
list_data = list(data)
R_num = list_data.count('R')
W_num = num-R_num
if(R_num==0 or W_num==0):
print('0')
sys.exit()
count = 0
flag=0
while(count<=N//2):
list_R = [i for i, x in enumerate(list_data) if x == 'R']
last_R = list_R[-1]
first_W = list_data.index('W')
if last_R-first_W==1:
break
else:
list_data[last_R]='W'
list_data[first_W]='R'
count +=1
print(count+1)
|
p02720
|
s491250993
|
Wrong Answer
|
k = int(input())
count = 0
for i in range(100000):
num = i + 1
k_list = []
for k_i in str(num):
k_list.append(int(k_i))
for j, ele in enumerate(k_list):
if j == 0:
continue
if abs(k_list[j - 1] - k_list[j]) > 1:
break
else:
count += 1
if count == k:
print(num)
break
|
p03696
|
s364848079
|
Accepted
|
n = int(input())
s = input()
cnt_l, cnt_r = 0, 0
for x in s:
if x == "(":
cnt_l += 1
elif cnt_l > 0:
cnt_l -= 1
else:
cnt_r += 1
print(cnt_r * "(" + s + cnt_l * ")")
|
p03161
|
s267768377
|
Accepted
|
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*(N)
dp[1]=abs(h[0]-h[1])
for i in range(2,N):
dp[i]=min(dp[j]+abs(h[j]-h[i]) for j in range(max(0,i-K),i))
print(dp[N-1])
|
p03067
|
s255682085
|
Accepted
|
a = list(map(int,input().split()))
if min(a) != a[2] and max(a) != a[2]:
print("Yes")
else:
print("No")
|
p03836
|
s239088909
|
Accepted
|
#!/usr/bin/env python3
s_x, s_y, t_x, t_y = map(int, input().split())
ans = ""
ans += "R" * (t_x - s_x) + "U" * (t_y - s_y)
ans += "L" * (t_x - s_x) + "D" * (t_y - s_y)
ans += "D" + "R" * (t_x - s_x + 1) + "U" * (t_y - s_y + 1) + "L"
ans += "U" + "L" * (t_x - s_x + 1) + "D" * (t_y - s_y + 1) + "R"
print(ans)
|
p03243
|
s372910297
|
Accepted
|
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
A = [111*i for i in range(1,10)]
for i in range(9):
if N <= A[i]:
print(A[i])
break
|
p02553
|
s098558729
|
Accepted
|
l = list(map(int,input().split()))
mx = float('-inf')
for i in range(2):
for j in range(2,4):
mx = max(mx,l[i]*l[j])
print(mx)
|
p02923
|
s599656381
|
Accepted
|
n=int(input())
h=list(map(int,input().split()))
step=[]
for i in range(n-1):
if h[i]<h[i+1]:
step.append(0)
else:
step.append(1)
a=[i for i, x in enumerate(step) if x==0]
ans=[]
for i in range(len(a)):
if i==0:
d=a[0]
ans.append(d)
else:
b=a[i]-a[i-1]
ans.append(b)
if not a:
print(n-1)
else:
ans.append((n-1)-a[-1])
print(max(ans)-1)
|
p03759
|
s009216016
|
Wrong Answer
|
a, b, c = map(int, input().split())
if (b-a) == (c-b):
print('YES')
else:
print('No')
|
p02633
|
s689673245
|
Accepted
|
X = int(input())
for i in range(1, 1000000):
if (X * i) % 360 == 0:
print(i)
exit()
|
p03804
|
s106332867
|
Wrong Answer
|
from itertools import product
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i, j in product(range(n - m + 1), repeat=2):
print(i,j)
if all(a[i + k][j:] == b[k] for k in range(m)):
print('Yes')
break
else:
print('No')
|
p03243
|
s041956637
|
Accepted
|
A=input()
for i in range(int(A),1000):
if len(set(str(i)))==1:
print(i)
exit()
|
p02639
|
s963546921
|
Accepted
|
a = list(map(int , input().split()))
for i in a:
if i == 0:
ans = a.index(i)+1
break
print(ans)
|
p02584
|
s905423426
|
Accepted
|
x,k,d=map(int,input().split())
x=abs(x)
if x>k*d:
print(x-k*d)
else:
p=x//d
if p%2==k%2:
print(x-p*d)
else:
print(abs(x-(p+1)*d))
|
p03457
|
s048448429
|
Wrong Answer
|
A = []
N = int(input())
for _ in range(N):
t,x,y = map(int,input().split())
A.append(t-x-y)
for i in range(1,N):
if A[i]%2!=A[i-1]%2:
print('No')
exit()
print('Yes')
|
p03761
|
s210031178
|
Accepted
|
from collections import Counter
n = int(input())
L = [Counter(str(input())) for _ in range(n)]
C = sorted(L[0])
ans = ''
for k in C:
m = L[0][k]
for i in range(n):
m = min(m, L[i][k])
ans += k * m
print(ans)
|
p02594
|
s382034817
|
Accepted
|
N = int(input())
if N >=30:
print('Yes')
else :
print('No')
|
p02939
|
s768035102
|
Accepted
|
S=input()
N=len(S)
cnt=0
pre=""
last=""
for str in S:
str = pre +str
if str==last:
pre += str
else:
cnt +=1
last=str
pre=""
print(cnt)
|
p03289
|
s105399013
|
Wrong Answer
|
s=input()
if s[0]=="A":
if s[2:-1].count("C")==1:
if s.count("A")==1 and s.count("C")==1:
print("AC")
else:
print("WA")
else:
print("WA")
else:
print("WA")
|
p02780
|
s851619170
|
Wrong Answer
|
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = 0
Elist = []
for p in P[0:3]:
plist = list(range(1, p+1))
Elist.append(sum(plist) / len(plist))
E = sum(Elist)
oldE = E
count = 2
for p in P[3:]:
count += 1
plist = list(range(1, p+1))
Elist.append(sum(plist) / len(plist))
E -= Elist[count - 3]
E += Elist[count]
if oldE <= E:
oldE = E
print(E)
|
p03329
|
s374674587
|
Wrong Answer
|
n = int(input())
import math
ans = float('inf')
def calc(x,cnt):
if x<6:
global ans
ans = min(ans,x+cnt)
else:
calc(x-6**int(math.log(x,6)),cnt+1)
calc(x-9**int(math.log(x,9)),cnt+1)
calc(n,0)
print(ans)
|
p03730
|
s510067892
|
Accepted
|
a , b , c =map(int,input().split())
p = [i for i in range(1,a)]
k = c
while True:
k = (k + b) % a
if k == 0:
print("YES")
exit()
elif p.count(k) == 0:
print("NO")
exit()
elif p.count(k) == 1:
p.remove(k)
|
p02572
|
s112769528
|
Wrong Answer
|
import numpy as np
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
A_cum = np.array(A, np.int64).cumsum()
ans = 0
for i in range(N):
ans += (A_cum[-1] - A_cum[i]) * A[i]
ans %= mod
print(ans)
|
p03339
|
s018380495
|
Accepted
|
n = int(input())
s = input()
to_east = 0
to_west = s.count('E', 1)
ans = to_east+to_west
for i in range(1, n):
if s[i-1]=='W':
to_east += 1
if s[i]=='E':
to_west -= 1
ans = to_east+to_west if ans>to_east+to_west else ans
print(ans)
|
p03821
|
s734936288
|
Accepted
|
n=int(input())
a=[]
b=[]
for i in range(n):
na,nb=map(int,input().split())
a.append(na)
b.append(nb)
ans=0
num=0
for i in range(n):
num1=(num+a[-i-1])%b[-1-i]
if num1!=0:
num+=b[-1-i]-num1
ans+=b[-1-i]-num1
print(ans)
|
p03163
|
s399989957
|
Wrong Answer
|
import numpy as np
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
a,b=map(int,input().split())
w+=[a]
v+=[b]
DP=np.zeros(W+1,dtype=int)
print(DP)
for i in range(N):
DP[w[i]:]=np.maximum(DP[:-w[i]]+v[i],DP[w[i]:])
print(DP)
|
p03817
|
s601617298
|
Accepted
|
n = int(input())
res = n // 11
res *= 2
n %= 11
if n == 0:
pass
elif n < 7:
res += 1
else:
res += 2
print(res)
|
p03000
|
s797235545
|
Accepted
|
n,x = map(int,input().split())
l = list(map(int,input().split()))
lis = [0]
for i in range(n):
lis.append(lis[i]+l[i])
print(sum(1 for li in lis if li <= x ))
|
p02615
|
s705805288
|
Accepted
|
# Contest No.: ABC173
# Problem No.: D
# Solver: JEMINI
# Date: 20200705
import sys
import heapq
def main():
n = int(input())
nums = list(map(int, sys.stdin.readline().split()))
nums.sort()
ans = 0
# initial
temp = nums.pop()
ans += temp
n -= 2
for i in range(n // 2):
ans += nums[-i - 1] * 2
if n % 2:
ans += nums[-(n // 2) - 1]
print(ans)
return
if __name__ == "__main__":
main()
|
p03011
|
s347535655
|
Accepted
|
p, q, r = map(int, input().split())
print(min(p+q,q+r,r+p))
|
p02707
|
s138719360
|
Wrong Answer
|
n = int(input())
boss_list = list(map(int, input().split(" ")))
boss_list = sorted(boss_list)
for i in range(n):
boss_num = boss_list.count(i + 1)
boss_list = boss_list[:boss_num]
if i == 0:
boss_num -= 1
print(boss_num)
|
p03487
|
s142930522
|
Accepted
|
from collections import Counter
N = int(input())
cntr = Counter(list(map(int, input().split())))
ans = 0
for k, v in cntr.items():
if k > v:
ans += v
else:
ans += v - k
print(ans)
|
p03632
|
s024922323
|
Accepted
|
a, b, c, d = map(int, input().split())
if b <= c or d <= a:
print(0)
elif a <= c and d <= b:
print(d - c)
elif c <= a and b <= d:
print(b - a)
elif a <= c:
print(b - c)
else:
print(d - a)
|
p03607
|
s901331597
|
Accepted
|
import collections
import sys
input = sys.stdin.readline
def main():
N = int(input())
a_list = list([int(input()) for _ in range(N)])
a_freq = collections.Counter(a_list)
print(len([freq for freq in a_freq.values() if freq % 2 == 1]))
if __name__ == '__main__':
main()
|
p03377
|
s281482723
|
Accepted
|
a, b, x = map(int, input().split())
if 0 <= x - a <= b:
print('YES')
else:
print('NO')
|
p03433
|
s865002936
|
Accepted
|
def main():
n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')
main()
|
p02787
|
s854263748
|
Accepted
|
def main():
import sys
input = sys.stdin.readline
INF = 1 << 30
H, N = map(int, input().split())
dp = [INF] * (H + 1)
dp[0] = 0
for _ in range(N):
A, B = map(int, input().split())
for j in range(H):
nj = min(H, j + A)
dp[nj] = min(dp[nj], dp[j] + B)
print(dp[H])
if __name__ == '__main__':
main()
|
p02742
|
s147912112
|
Wrong Answer
|
import math
a,b=map(int, input().split())
if a==1 and b==1:
print(1)
elif a*b%2 == 0:
print(int(a*b/2))
elif a*b%2 == 1:
print(int(math.floor(a*b/2+1)))
|
p02660
|
s524627473
|
Wrong Answer
|
n = int(input())
ans = 0
d = 0
for i in range(2,int(n**0.5//1 + 3)):
c = 0
if n % i == 0:
d == 1
while n % i == 0:
n //= i
c += 1
j = 1
cou = 0
while c> 0:
cou += 1
c -= j
j += 1
ans += cou
if d == 0 and n != 1:
ans = 1
print(ans)
|
p02570
|
s668179109
|
Accepted
|
d,t,s = map(int,input().split())
if d <= t*s : print("Yes")
else: print("No")
|
p03557
|
s685719575
|
Wrong Answer
|
import bisect
n = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
for i in range(n):
b = B[i]
a = bisect.bisect_left(A, b)
c = n-bisect.bisect_right(C, b)
print(a, b, c)
ans += a*c
print(ans)
|
p03474
|
s341752297
|
Wrong Answer
|
import re
A, B = map(int, input().split())
S = [s for s in list(input()) if s != '-']
print("Yes") if len(S) == A + B else print("No")
|
p03475
|
s423060039
|
Accepted
|
import copy
n = int(input())
c = [list(map(int, input().split())) for i in range(n-1)]
for i in range(n):
t = 0
for j in range(i, n-1):
if t < c[j][1]:
t = c[j][1]
elif t%c[j][2] == 0:
pass
else:
t += c[j][2] - t%c[j][2]
t += c[j][0]
print(t)
|
p02570
|
s783464229
|
Wrong Answer
|
d , t , s = map(int,input().split())
if d/s >= t:
print("No")
else:
print("Yes")
|
p03284
|
s463985837
|
Wrong Answer
|
n, k = map(int, input().split())
print(n%k)
|
p03612
|
s012241240
|
Accepted
|
n=int(input())
a=list(map(int,input().split()))
i=0
ans=0
while i<n:
if a[i]==i+1:
i+=1
ans+=1
i+=1
print(ans)
|
p03493
|
s482964089
|
Wrong Answer
|
s = input()
count = 0
for i in range(3):
if s==1:
count= count + 1
|
p02910
|
s995585961
|
Accepted
|
s=input()
flag=True
for i in range(len(s)):
if i%2==0 and s[i]=='L':
flag=False
break
if i%2==1 and s[i]=='R':
flag=False
break
if flag:
print("Yes")
else:
print("No")
|
p03162
|
s306374112
|
Accepted
|
n = int(input())
abc = []
dp = [[0 for i in range(3)]for j in range(n)]
for i in range(n):
abc.append(list(map(int,input().split())))
dp[0] = abc[0]
for i in range(1,n):
for j in range(3):
for k in range(3):
if j != k :
dp[i][k] = max(dp[i][k],dp[i-1][j]+abc[i][k])
print(max(dp[-1]))
|
p03243
|
s743432594
|
Accepted
|
n = int(input())
for i in range(1000):
n_str = str(n)
if n_str[0] == n_str[1] == n_str[2]:
break
n += 1
print(n_str)
|
p02897
|
s533463790
|
Wrong Answer
|
n=int(input())
a=float(n//2)+1.0
print(a/float(n))
|
p03075
|
s596686717
|
Accepted
|
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if k >= e-a:
print('Yay!')
else:
print(':(')
|
p03633
|
s006202073
|
Accepted
|
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
def lcm(a, b):
return abs(a*b)//gcd(a, b)
n = int(input())
ans = int(input())
for i in range(1, n):
t = int(input())
ans = lcm(ans, t)
print (ans)
|
p03796
|
s387565842
|
Accepted
|
import math
N=input()
N=int(N)
print(math.factorial(N)%((10**9)+7))
|
p02556
|
s658304007
|
Accepted
|
import sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from collections import defaultdict
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,OrderedDict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map(int, sys.stdin.readline().split()))
n = I()
A,B = [],[]
for i in range(n):
a,b = neo()
A += [a+b]
B += [a-b]
A.sort()
B.sort()
Ans = max(A[-1]-A[0],B[-1]-B[0])
print(Ans)
|
p02577
|
s589503315
|
Wrong Answer
|
n = int(input())
if (n//9):
print("Yes")
else:
print("No")
|
p02982
|
s660167581
|
Accepted
|
n,d=map(int,input().split())
a=[[0]*d for ii in range(n)]
for ii in range(n):
a[ii][:]=map(int,input().split())
r=0
for ii in range(n):
for jj in range(n):
if ii!=jj:
d2=0
for kk in range(d):
d2+=(a[ii][kk]-a[jj][kk])**2
d2=d2**0.5
#print(d2)
if int(d2)==d2:
r+=1
print(r//2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.