problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03071 | s848749200 | Accepted | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
a, b = map(int, input().split())
ans = 0
for i in range(2):
if (a > b):
ans += a
a -= 1
else:
ans += b
b -= 1
print(ans)
|
p03543 | s752192598 | Accepted | a,b,c,d=input()
print(['No','Yes'][a==b==c or b==c==d]) |
p03011 | s068280393 | Accepted | from sys import stdin
def main():
#入力
readline=stdin.readline
p,q,r=map(int,readline().split())
print(min(p+q,q+r,r+p))
if __name__=="__main__":
main() |
p03252 | s620924216 | Wrong Answer | s = input()
t = input()
from collections import Counter
sc = Counter(s)
tc = Counter(t)
if set(sc.values()) == set(tc.values()):
print('Yes')
else:
print('No') |
p03469 | s074012914 | Accepted | S = input()
print("2018"+S[4:]) |
p02993 | s692972453 | Accepted | s = input()
if [s[i]==s[i+1] for i in range(3)]==[False for i in range(3)]:
print('Good')
else:
print('Bad') |
p03548 | s620768206 | Wrong Answer | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
x,y,z = iim()
print((x-2*z)//(z+y))
|
p03745 | s268258402 | Accepted | n = int(input())
a_l = list(map(int,input().split()))
num = 1
flag = -1 # -1:initial, 0:increasing, 1:decreasing
for i in range(1,n):
if a_l[i] > a_l[i-1]:
new_flag = 0
elif a_l[i] < a_l[i-1]:
new_flag = 1
else:
continue
if new_flag != flag:
if flag == -1:
flag = new_flag
else:
flag = -1
num += 1
print(max(num,1))
|
p03673 | s514863712 | Wrong Answer | n=int(input())
a=list(map(str,input().split()))
b=list()
cnt=0
for i in a:
if cnt==0:
b.append(i)
cnt=1
else:
b.insert(0,i)
cnt=0
#L=[str(a) for a in b]
b=" ".join(b)
print(b)
|
p03243 | s595348589 | Accepted | def actual(n):
is_zorome = lambda num: len(set(str(num))) == 1
for i in range(100, 1000):
if i >= n and is_zorome(i):
return i
n = int(input())
print(actual(n)) |
p03607 | s742225456 | Accepted | from collections import Counter
n = int(input())
l = [int(input()) for _ in range(n)]
a = Counter(l).values()
print(sum(i%2 for i in a)) |
p02631 | s991608189 | Wrong Answer | N = int(input())
AS = list(map(int, input().split()))
print(*AS, sep=" ")
|
p03721 | s207090537 | Wrong Answer | N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
s = 0
for a, b in AB:
s += b
if s >= K:
ans = a
break
print(ans)
|
p02814 | s078040332 | Accepted | from math import gcd
from functools import reduce
n,m=map(int,input().split())
lst=list(map(lambda x : int(x)//2,input().split()))
divi=0
x=lst[0]
while x%2==0:
x//=2
divi+=1
for i in range(1,n):
divi2=0
x=lst[i]
while x%2==0:
x//=2
divi2+=1
if divi!=divi2 :
print(0)
exit()
work=reduce(lambda x,y: x*y//gcd(x,y),lst)
print((m//work+1)//2) |
p03162 | s439648565 | Wrong Answer | # coding:utf-8
N = int(input())
act = []
for i in range(N):
act.append([int(x) for x in input().split()])
dp = [[0 for x in range(3)] for y in range(N+1)]
for i in range(0, N):
for j in range(3):
for k in range(3):
if j != k:
dp[i+1][j] = max(dp[i+1][k], dp[i][j] + act[i][k])
m = 0
for i in range(3):
m = max(m, dp[N][i])
print(m) |
p02766 | s371879804 | Accepted | N, K = map(int, input().split())
keta = 0
while (N > 0):
N = N // K
keta += 1
print(keta) |
p03211 | s454530132 | Wrong Answer | s = input().strip()
min_diff = 1000000
for i in range(len(s) - 2):
num = int(s[i: i+3])
print(num)
diff = abs(753 - num)
min_diff = min(diff, min_diff)
print(min_diff)
|
p03327 | s941137611 | Accepted | n=int(input())
x=n-999 if n>999 else n
if n>999:
print("ABD")
else:
print("ABC")
|
p02829 | s171107408 | Wrong Answer | import sys
row = sys.stdin.readline
def read_int(row):
return int(row().rstrip())
A,B= [read_int(row) for i in range(2)]
print((set({1,2,3}) - set({1,2})).pop()) |
p03163 | s506659047 | Wrong Answer | if __name__ == "__main__":
N, W = map(int, input().split())
dp = [0] * (W+1)
for i in range(N):
weight, value = map(int, input().split())
# for w in range((W - weight)+1):
for w in range((W - weight), -1, -1):
dp[w + weight] = max(dp[w + weight], dp[w] + value)
# dp = new_dp
print(dp)
print(dp[-1])
"""
6 15
6 5
5 6
6 4
6 6
3 5
7 2
3 8
3 30
4 50
2 60
""" |
p02748 | s364154091 | Wrong Answer | A, B, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ab = []
for i in range(min(A,B)):
ab.append([a[i], b[i]])
ab.sort(key=lambda x: x[0])
ans = 10**5+1
for i in range(m):
x, y, c = map(int, input().split())
if m <= min(A, B):
ans = min(ans, a[x-1] + b[y-1] - c, ab[i][0] + ab[i][1])
else:
ans = min(ans, a[x-1] + b[y-1] - c)
print(ans) |
p04019 | s504574782 | Wrong Answer | s = input()
N = s.count('N')
S = s.count('S')
E = s.count('E')
W = s.count('W')
if (N >= 1 and S >= 1) or (E >= 1 and W >= 1):
print('Yes')
else:
print('No')
|
p02570 | s462013350 | Wrong Answer | d, t, s = [int(x) for x in input().split()]
time = d / s
time = int(time)
if time <= t:
print("Yes")
else:
print("No") |
p02646 | s958071884 | Accepted | import sys
input=lambda: sys.stdin.readline().rstrip()
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if t*(v-w)>=abs(a-b):
print("YES")
else:
print("NO") |
p02640 | s991034911 | Accepted | # B
X,Y=map(int,input().split())
if Y<2*X or 4*X<Y:
print("No")
else:
if (Y-2*X)%2!=0 or (4*X-Y)%2!=0:
print("No")
else:
print("Yes") |
p03633 | s938570698 | Accepted | import math
import functools
def lcm(x,y):
return (x*y)//math.gcd(x,y)
n = int(input())
t = [int(input()) for i in range(n)]
a = functools.reduce(math.gcd,t)
print(functools.reduce(lcm,t)) |
p02922 | s378628080 | Accepted | import math
A, B = map(int, input().split())
print(1+math.ceil((B-A)/(A-1))) |
p03000 | s085412999 | Accepted | n,x=map(int,input().split())
l=list(map(int,input().split()))
ans=0
k=0
for i in range(n):
k+=l[i]
if k<=x:
ans+=1
print(ans+1) |
p02707 | s058564229 | Accepted | n = int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)
for i in range(n):
print(c[i+1]) |
p03433 | s034161677 | Wrong Answer | a=int(input())
b=int(input())
if (int(b/100))%5==0:
if b%500<=a:
print("Yes")
else:
print("No")
else:
print("No") |
p02971 | s498795526 | Wrong Answer | import copy
n = int(input())
lis = []
for _ in range(n):
lis.append(int(input()))
slis = sorted(copy.deepcopy(lis), reverse=True)
m = max(lis)
s = sorted(set(slis), reverse=True)
s.remove(m)
if s:
sm = max(s)
else:
sm = m
for i in range(n):
if lis[i] != m:
print(m)
else:
print(sm)
|
p02995 | s563584749 | Accepted | import math
A, B, C, D = map(int, input().split())
def not_multiple_of_c_and_d(x: int, c: int, d: int):
lcm_cd = c * d // math.gcd(c, d)
c_no_baisu = x // c
d_no_baisu = x // d
cd_no_baisu = x // lcm_cd
return x - (c_no_baisu + d_no_baisu - cd_no_baisu)
ans = not_multiple_of_c_and_d(B, C, D) - not_multiple_of_c_and_d(A-1, C, D)
print(ans)
|
p02660 | s927426557 | Wrong Answer | import math
n = int(input())
res = 0
if n <= 1:
print(res)
else:
max_num = math.ceil(math.sqrt(n + 1))
org_n = n
for z in range(2, max_num + 1):
if n == 1 or z >= math.ceil(math.sqrt(n)):
res += 1
break
if n % z == 0:
res += 1
n = n // z
if n == z:
break
print(res) |
p02792 | s624038911 | Accepted | N = int(input())
m = dict()
for i in range(1, N + 1):
n = str(i)
s = n[0]
t = n[-1]
if t == 0:
continue
k = (s, t)
if k in m:
m[k] += 1
else:
m[k] = 1
ans = 0
for k, v in m.items():
s, t = k
if s == t:
ans += v ** 2
else:
if (t, s) in m:
ans += v * m[(t, s)]
print(ans) |
p02727 | s934376704 | Accepted | import heapq
from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
r.sort()
if A < X:
p += r[-(X - A):]
r = r[:-(X - A)]
A = X
if B < Y:
q += r[-(Y - B):]
r = r[:-(Y - B)]
B = Y
p.sort()
q.sort()
pq = deque(heapq.merge(p[A - X:], q[B - Y:]))
while r and pq[0] < r[-1]:
pq.popleft()
pq.append(r.pop())
print(sum(pq))
|
p03254 | s920611402 | Accepted | #! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
N, x, *A = map(int, read().split())
A = sorted(A)
cnt = 0
for a in A[:-1]:
if x >= a:
cnt += 1
x -= a
if x == A[-1]:
cnt += 1
print(cnt)
|
p03351 | s629210269 | Wrong Answer | a,b,c,d=map(int,input().split())
A=sorted([abs(a-b),abs(b-c),abs(c-a)])
print('Yes' if A[1]<=d else 'No')
|
p03487 | s679904002 | 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()))
from collections import Counter
c = Counter(a)
ans = 0
for k,v in c.items():
if k>v:
ans += v
elif k<v:
ans += (v-k)
print(ans) |
p03161 | s454191412 | Wrong Answer | N,K = map(int,input().split())
h = list(map(int,input().split()))
cost = [0]
for i in range(2,N+1):
print(i)
cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost) |
p03836 | s450410835 | Accepted | sx,sy,tx,ty = map(int,input().split())
going1 = ''
returning1 = ''
going2 = ''
returning2 = ''
a = tx - sx
b = ty - sy
going1 ='U' * b + 'R' * a
returning1 = 'D' * b + 'L' * a
going2 = 'L' + 'U' * (b + 1) + 'R' * (a + 1) + 'D'
returning2 = 'R' + 'D' * (b + 1) + 'L' * (a + 1) + 'U'
print(going1 + returning1 + going2 + returning2)
|
p02554 | s785248120 | Accepted | n = int(input())
# not 0, but 9 == not 9, but 0
#2 * (9 ** n - 8 ** n)
# not 0,9
#8 ** n
# ans = all - (not 0, but 9 + not 9, but 0) - not 0,9
print((10**n - 2 * (9 ** n - 8 ** n) - 8 ** n) % (10**9 + 7))
|
p02838 | s146551558 | Accepted | #import sys
#input = sys.stdin.readline
M = 10**9+7
n = int(input())
l = list(map(int,input().split()))
o = [0]*61
z = [0]*61
for i in l:
a = bin(i)[2:]
j = 0
while(j < len(a)):
if a[j] == "1":
o[len(a)-j-1] += 1
j += 1
cnt = 0
b = 1
for j in range(len(o)):
cnt = (cnt+(o[j]*(n-o[j])*b)%M)%M
b *= 2
print(cnt)
|
p02765 | s088750909 | Wrong Answer | a,b=map(int,input().split())
c=0
if a >=10:
print(b)
else:
c = 100 * (10-a)
print(c) |
p03632 | s179511159 | Accepted | a, b, c, d = map(int, input().split())
if b <= c or d <= a:
ans = 0
elif a < c and c < b and b < d:
ans = abs(b-c)
elif c < a and a < d and d < b:
ans = abs(d-a)
elif a <= c and d <= b:
ans = abs(d-c)
else:
ans = b-a
print(ans) |
p02602 | s709150774 | Accepted | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,k = na()
a = na()
for i in range(k,n):
print('Yes' if a[i] > a[i-k] else 'No') |
p03478 | s070581965 | Wrong Answer | n, a, b = map( int, input().split() )
sum = 0
count = 1
while count <= n:
c_tth = int(count/10000)
c_th = int(count/1000 - c_tth*10000)
c_hun = int(count/100 - c_tth*10000 - c_th*1000)
c_ten = int(count/10 - c_tth*10000 - c_th*1000 - c_hun*100)
c_o = int(count - c_tth*10000 - c_th*1000 - c_hun*100 - c_ten*10)
c_check = c_tth + c_th + c_hun + c_ten + c_o
if a <= c_check and b >= c_check:
sum += count
count += 1
print("{}".format(sum)) |
p02689 | s617139792 | Accepted | n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
d = {num for num in range(1, n + 1)}
for i in range(m):
if h[ab[i][0] - 1] > h[ab[i][1] - 1]:
d.discard(ab[i][1])
elif h[ab[i][0] - 1] < h[ab[i][1] - 1]:
d.discard(ab[i][0])
elif h[ab[i][0] - 1] == h[ab[i][1] - 1]:
d.discard(ab[i][1])
d.discard(ab[i][0])
print(len(d)) |
p03324 | s725691389 | Accepted | d,n=map(int,input().split())
minus=n//100
print((n+minus)*(100**d)) |
p03557 | s572018318 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
import bisect
ans = 0
for i in range(N):
b = B[i]
x = bisect.bisect_left(A,b)
y = bisect.bisect_right(C,b)
if y == 0:
break
ans += x*y
print(ans) |
p02555 | s592183097 | Accepted | import sys
sys.setrecursionlimit(1000000)
import bisect
import math
import collections
import heapq
cache = {}
M = 10**9 + 7
def solve(S):
if S < 3:
return 0
if S < 6:
return 1
if S in cache:
return cache[S]
ans = 1
for remaining in range(S - 3, 2, -1):
ans += solve(remaining)
ans %= M
cache[S] = ans
return ans
if __name__ == "__main__":
S = int(input())
print(solve(S))
|
p02953 | s413778806 | Wrong Answer | import sys
stdin = sys.stdin
from itertools import accumulate
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
h = na()
f = h[0]
b = False
for hi in h[1:]:
if hi >= f:
f = hi
continue
elif hi == f - 1 and not b:
f = hi
else:
print("No")
quit()
if hi == f:
b = True
print("Yes") |
p02843 | s024745739 | Wrong Answer | x = int(input())
a = x // 100
b = x - a * 100
c=[1,2,3,4,5]
f=False
while b >= 5:
b = b - 5
a -= 1
if b == 0:
f=True
if a>1:
print(1)
else:
print(0) |
p02630 | s442236936 | Accepted | import sys
from collections import Counter
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
ans = sum(A)
counter = Counter(A)
for _ in range(Q):
b, c = map(int, input().split())
ans -= counter[b] * b
ans += counter[b] * c
counter[c] += counter[b]
counter[b] = 0
print(ans)
if __name__ == "__main__":
main()
|
p02933 | s218003696 | Accepted | def makelist(n, m):
return [[0 for i in range(m)] for j in range(n)]
a = int(input())
s = input()
if a < 3200:
print("red")
else:
print(s)
|
p02689 | s314517690 | Accepted | N,M = map(int,input().split())
Peaks = list(map(int,input().split()))
ans =[1]*N
for i in range(M):
a,b = map(int,input().split())
a=a-1
b=b-1
if Peaks[a]>Peaks[b]:
ans[b]=0
elif Peaks[a]<Peaks[b]:
ans[a]=0
else:
ans[a]=0
ans[b]=0
print(sum(ans))
|
p03379 | s850448042 | Wrong Answer | # input
N = int(input())
X = list(map(int, input().split()))
# check
center = N // 2 - 1
for ind in range(N):
if ind == 0:
target = X[1:]
elif ind == N - 1:
target = X[:ind]
else:
target = X[:ind] + X[ind + 1:]
print(target[center]) |
p03639 | s836235557 | Wrong Answer | n = int(input())
cnt2 = 0
cnt4 = 0
A = list(map(int, input().split()))
for a in A:
if a % 4 == 0:
cnt4 += 1
elif a % 2 == 0:
cnt2 += 1
if 2*cnt4 < (n - cnt2 // 2 - cnt4):
print("No")
else:
print("Yes")
|
p02792 | s555641485 | Accepted | import math
from collections import defaultdict
N = int(input())
rr = defaultdict(lambda: 0)
for i in range(1, N + 1):
x = int(i / (10 ** int(math.log10(i))))
y = i % 10
rr[(x, y)] += 1
r = 0
for u in range(1, 10):
for l in range(1, 10):
r += rr[(u, l)] * rr[(l, u)]
print(r)
|
p02607 | s135907766 | Accepted | # 幅優先探索(行きがけ)
import collections
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
N = I()
Aarray = LI()
cnt = 0
for i in range(N):
if i % 2 == 0 and Aarray[i] % 2 != 0:
cnt += 1
print(cnt)
if __name__ == '__main__':
main()
|
p02900 | s128744996 | Accepted | import math
def prime_factorize(n):
ret = []
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
cnt = 0
while n % i == 0:
cnt += 1
n = n // i
ret.append([i, cnt])
if n != 1:
ret.append([n, 1])
if len(ret) == 0:
ret.append([n, 1])
return ret
def main():
A, B = [int(x) for x in input().split(" ")]
g = math.gcd(A, B)
pg = prime_factorize(g)
if pg[0][0] == 1:
print(1)
else:
print(len(pg) + 1)
main() |
p03385 | s973321780 | Wrong Answer | import math
a=input()
a=sorted(a)
print("Yes" if a=="abs" else "No")
|
p04029 | s919321755 | Accepted | import os, sys, re, math
N = int(input())
ret = 0
for i in range(N+1):
ret += i
print(ret) |
p04044 | s123556419 | Accepted | # 2020/04/24
# AtCoder Beginner Contest 042 - B
# Input
n, l = map(int,input().split())
s = list()
for i in range(n):
s.append(input())
s.sort()
# Output
print(''.join(s))
|
p02910 | s346071535 | Wrong Answer | k = ['R','U','D']
g = ['L','U','D']
s = input()
for i in range(len(s)):
if i == 'U' or i == 'D':
continue
else:
if i%2 == 0:
if i != 'L':
print("No")
exit()
else:
if i != 'R':
print("No")
exit()
print("Yes") |
p03243 | s415656204 | Accepted | n = int(input())
for i in range(1,10):
if int(n)>int(str(i)*3):
continue
print(str(i)*3)
break |
p02983 | s840515821 | Accepted | import sys
L, R = map(int, input().split())
if R-L >= 2019:
print('0')
sys.exit()
L = L % 2019
R = R % 2019
if L > R:
print('0')
mmin = 2019
for i in range(L, R):
for j in range(i+1, R+1):
mmin = min(mmin, (i*j)%2019)
print(mmin) |
p03427 | s078371741 | Accepted | n = list(map(int, input()))
l = [sum(n)]
for i in range(1, len(n)):
n[-i] = 9
n[-i-1] -= 1
l.append(sum(n))
print(max(l)) |
p03137 | s446969577 | Wrong Answer | n, m = map(int, input().split())
x = list(map(int, input().split()))
del x[m:]
x.sort()
d = []
for i in range(len(x) - 1):
d.append(x[i+1] - x[i])
d.sort()
del d[:(m-n)]
print(sum(d))
|
p02600 | s320606805 | Accepted | n=int(input())
if n<600:
print(8)
elif n<800:
print(7)
elif n<1000:
print(6)
elif n<1200:
print(5)
elif n<1400:
print(4)
elif n<1600:
print(3)
elif n<1800:
print(2)
else:
print(1)
|
p02748 | s887791327 | Wrong Answer | A,B,M=map(int,input().split())
vecA=list(map(int,input().split()))
vecB=list(map(int,input().split()))
matX=[input().split() for k in range(M)]
price = 10**6
for i in range(0,M):
pricecom = int(vecA[int(matX[i][0]) -1]) + int(vecB[int(matX[i][1]) -1]) - int(matX[i][2])
if pricecom<= price:
price=pricecom
else:
pass
print(price) |
p03774 | s397447137 | Accepted | n,m = map(int,input().split())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]
def d(s,p):
return abs(s[0]-p[0]) + abs(s[1] - p[1])
for std in stds:
ans = (-1, float('inf'))
for i, pnt in enumerate(points):
dst = d(std,pnt)
if dst < ans[1]:
ans = (i, dst)
print(ans[0]+1)
|
p03779 | s866902189 | Accepted | X = int(input())
ok = 10**9 # 解が存在する値
ng = 0 # 解が存在しない値
def bisearch(function, ok, ng):
while abs(ok-ng) > 1:
mid = (ok + ng)//2
if function(mid):
ok = mid
else:
ng = mid
return ok
def check(mid):
return mid*(mid+1)/2 >= X
print(bisearch(check, ok, ng)) |
p03379 | s392146572 | Wrong Answer | import bisect
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X.copy())
for x in X:
print(Y[N//2-1] if bisect.bisect(Y, x) >= N//2 else Y[N//2])
|
p03472 | s878211694 | Accepted | n,h=map(int,input().split())
ab=[]
ans=0
for i in range(n):
aa,bb=map(int,input().split())
ab.append([aa,bb])
ab.sort(key=lambda x: x[0],reverse=True)
katana=ab[0][0]
ab.sort(key=lambda x: x[1],reverse=True)
cnt=0
# print(ab)
for a,b in ab:
if b>katana:
cnt+=1
for i in range(cnt):
if h<=0:break
h-=ab[i][1]
ans+=1
if h>0:
ans+=(h-1)//katana+1
print(ans)
|
p02759 | s625873095 | Accepted | import math
if __name__ == "__main__":
N = int(input())
ret = math .floor(N / 2)
if N % 2 == 1:
ret = ret + 1
print(ret)
|
p02723 | s067664520 | Wrong Answer | string = str(input())
def test(string):
string.split()
if string[2] == string[3] and string[4] == string[5]:
return "Yes"
else:
return "No" |
p02664 | s507620929 | Accepted | s=input()
l=[i for i in s]
for i in range(len(s)):
if(s[i]=='?'):
l[i]='D'
for i in l:
print(i,end="")
print()
|
p03680 | s521808478 | Accepted | n = int(input())
a = []
for i in range(n):
a.append(int(input()) - 1)
visited = [False] * n
f = 0
visited[f] = True
cnt = 0
while True:
cnt += 1
t = a[f]
if t == 1:
flg = True
break
if visited[t]:
flg = False
break
visited[t] = True
f = t
print(cnt) if flg else print(-1) |
p02924 | s206899849 | Accepted | N=int(input())
print(N*(N-1)//2) |
p03011 | s227905528 | Accepted | P, Q, R = map(int, input().split())
a = P + Q
b = Q + R
c = P + R
l = [a, b, c]
print(min(l))
|
p02835 | s626502934 | Accepted | A = list(map(int, input().split()))
print("bust" if sum(A)>=22 else "win") |
p02823 | s832729409 | Wrong Answer | N, A, B =map(int,input().split())
d = abs(B-A)
ans = 0
if d % 2 == 0:
ans = int(d / 2)
else:
if N - B >= A - 1:
ans = B - 1
else:
ans = N - A
print(ans)
|
p02880 | s126332143 | Wrong Answer | n = int(input())
t = False
for i in range(1,10):
for j in range(1, 10):
if n == i*j:
t = True
quit()
if t:
print('Yes')
else:
print('No') |
p02787 | s632793825 | Wrong Answer | h,n,*t=map(int,open(0).read().split())
d=[0]+[10**18]*h
print(d)
print(*[iter(t)])
for a,b in zip(*[iter(t)]*2):
for j in range(h+1):
k=j-a
if k<0:k=0
c=d[k]+b
if c<d[j]:d[j]=c
print(d[h]) |
p03251 | s107707399 | Accepted | n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
if max(X) < y and max(X) < min(Y) and min(Y) > x:
print("No War")
else:
print("War") |
p02768 | s102302063 | Accepted | import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1
def fur(n,r):
p,q = 1,1
for i in range(r):
p = p*(n-i)%mod
q = q*(i+1)%mod
return p * pow(q,mod-2,mod) % mod
print((ans - fur(n, a) - fur(n, b)) % mod) |
p04030 | s992471016 | Accepted | S = str(input())
ans = []
for i in range(len(S)):
if S[i] == "B":
if ans == []:
continue
else:
ans = ans[:-1]
else:
ans.append(S[i])
#print(ans)
#print(ans)
for i in range(len(ans)):
print(ans[i], end = "") |
p03481 | s862217291 | Wrong Answer | X, Y = map(int, input().split())
twoLine = [X*(2 ** i) for i in range(61)]
# 2分探索で調べる
left = -1
right = len(twoLine)
while right - left > 1:
middle = (right + left) // 2
if twoLine[middle] > Y:
right = middle
else:
left = middle
print(middle) |
p02873 | s803481404 | Wrong Answer | S = list(input())
left = [0]*(len(S)+1)
right = [0]*(len(S)+1)
for i in range(len(S)):
if S[i] == '<':
left[i+1] += 1+left[i]
for i in range(len(S)-1,-1,-1):
if S[i] == '>':
right[i] = right[i+1]+1
ans = [0]*(len(S)+1)
for i in range(len(S)+1):
ans[i] = max(left[i],right[i])
print(sum(ans)+1) #+1 |
p03386 | s019735806 | Accepted | a, b, k = [int(i) for i in input().split()]
lim_1 = min(a + k, b)
lim_2 = max(b - k + 1, a)
ans = set(list(range(a, lim_1)) + list(range(lim_2, b + 1)))
for n in ans:
print(n)
|
p02630 | s116397815 | Wrong Answer | import collections
N = int(input())
A = list(map(int, input().split()))
indices = collections.defaultdict(list)
for i, a in enumerate(A):
indices[a].append(i)
Q = int(input())
for _ in range(Q):
B, C = map(int, input().split())
print(B, C)
for i in indices[B]:
indices[C].append(i)
A[i] = C
print(sum(A)) |
p02811 | s802812791 | Accepted | K,X=map(int,input().split())
if X<=500*K:
print('Yes')
else:
print('No') |
p03944 | s496670744 | Wrong Answer | W,H,N=map(int,input().split())
x=[0]*N
y=[0]*N
a=[0]*N
H_min=0
H_max=H
W_min=0
W_max=W
for i in range(N):
x[i],y[i],a[i] = map(int,input().split())
if a[i]==1:
W_min=x[i]
elif a[i]==2:
W_max=x[i]
elif a[i]==3:
H_min=y[i]
else:
H_max=y[i]
height = max(0,H_max-H_min)
width = max(0,W_max-W_min)
print(height*width) |
p02820 | s044619248 | Wrong Answer | n,k = map(int, input().split())
r, s, p =map(int,input().split())
t = list(input())
wins = []
cnt = 0
minus = 0
for out in t:
if out == "r":
wins.append(p)
elif out == "s":
wins.append(r)
else:
wins.append(s)
if cnt > k - 1:
if wins[cnt] == wins[cnt-k]:
wins[cnt] = 0
cnt = cnt + 1
print(sum(wins)) |
p04044 | s381204393 | Accepted | def main():
n, l = map(int, input().split())
ss = [list(input()) for _ in range(n)]
for i in range(l-1, -1, -1):
ss = sorted(ss, key=lambda x: x[i])
ans = ''
for i in range(n):
for j in range(l):
ans += ss[i][j]
print(ans)
if __name__ == "__main__":
main()
|
p02717 | s010857093 | Wrong Answer | a,b,c=map(int,input().split())
print(b,a,c) |
p02570 | s681433725 | Accepted | D,T,S = map(int,input().split())
print("Yes" if D/S<=T else "No") |
p02642 | s642206071 | Accepted | N = int(input())
A = list(map(int, input().split()))
MAX = 10 ** 6
A.sort()
s = set()
ans = N
for i in range(N):
a = A[i]
if a in s:
ans -= 1
continue
if i < N - 1 and A[i + 1] == a:
ans -= 1
n = MAX // a
for i in range(1, n + 1):
s.add(a * i)
print(ans) |
p02661 | s632341218 | Accepted | from statistics import median
n = int(input())
a = [None] * n
b = [None] * n
for i in range(n):
a[i], b[i] = map(int, input().split())
if n % 2 == 1:
print(abs(median(b) - median(a)) + 1)
else:
print(int(abs(median(b) - median(a)) * 2) + 1)
|
p03239 | s255205485 | Wrong Answer | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
n, t = rm()
min_ = inf
for _ in range(n):
a, b = rm()
if b <= t:
min_ = min(min_, a)
print(min_)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.