problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03105 | s093974123 | Accepted | a,b,c= map(int,input().split())
if b//a >= c:
print(c)
else:
print(b//a) |
p03037 | s822118520 | Accepted | n,m = map(int,input().split())
min = 1
max = n
for i in range(m):
l,r = map(int,input().split())
if min<l: min=l
if max>r: max=r
if min>max:
print(0)
else:
print(max-min+1)
|
p03160 | s400639253 | Accepted | input()
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)-1):
dp[i+1] = min(dp[i+1], dp[i] + abs(a[i+1] - a[i]))
if i < len(a)-2:
dp[i+2] = dp[i] + abs(a[i+2] - a[i])
print(dp[-1]) |
p02754 | s959092667 | Wrong Answer | import math
n, a, b = map(int,input().split())
try:
ans = math.ceil(n / (a + b) * a)
except Exception as e:
ans = 0
print(ans) |
p02697 | s316814852 | Accepted | N, M = map(int, input().split())
f = [False]*N
l = 0
r = N+1
for i in range(M):
l += 1
r -= 1
while True:
if N % 2 == 0:
if r-l == N//2:
r -= 1
continue
if f[min(r-l, N-(r-l))]:
r -= 1
continue
break
f[min(r-l, N-(r-l))] = True
print(l, r) |
p02597 | s669921084 | Accepted | N=int(input())
c=input()
count=0
if 'WR' in c:
x=c.count('R')
y=c.count('R',0,x)
count=x-y
print(count) |
p02959 | s571762232 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sb = sum(b)
for i in range(n):
for j in range(i, i+2):
t = a[j] - b[i]
if t >= 0:
a[j] = t
b[i] = 0
else:
a[j] = 0
b[i] = abs(t)
print(sb if sb - sum(b) == 0 else sb - sum(b)) |
p02760 | s315174620 | Wrong Answer | A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
b.append(int(input()))
yoko = A
tate = [[], [], []]
for row in A:
for i in range(3):
tate[i].append(row[i])
naname = [[A[0][0], A[1][1], A[2][2]]]
all = yoko + tate + naname
chk = 0
for kumi in all:
for i in range(3):
if kumi[0] in b:
chk += 1
if chk == 3:
print("Yes")
break
if chk != 3:
print("No") |
p02818 | s534211406 | Wrong Answer | A, B, K = map(int, input().split())
A_after = 0
B_after = 0
if A - K >= 0:
A_after = A - K
elif A + B - K >= 0:
B_after = B - (K - A)
print(A_after, B_after) |
p02700 | s451936667 | Accepted | a,b,c,d=map(int,input().split())
co,coo=0,0
while a>0:
a=a-d
co+=1
while c>0:
c-=b
coo+=1
print("No" if coo>co else "Yes") |
p02765 | s476577656 | Wrong Answer | n,k=map(int,input().split())
print(k+100*(10-k) if n<10 else k) |
p03659 | s053255359 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
N = int(input())
A = list(map(int, input().split()))
A_sum = sum(A)
tmp = 0
result = []
for a in A:
tmp += a
result.append(abs(A_sum - tmp * 2))
print(min(result[:-1]))
if __name__ == "__main__":
main()
|
p03479 | s899227771 | Accepted | def resolve():
X,Y=map(int,input().split())
cnt=0
while X<=Y:
X=X*2
cnt+=1
print(cnt)
resolve() |
p02910 | s992996821 | Accepted | def f():
s = input()
for i in range(len(s)):
if i%2 == 1:
if s[i] == "L" or s[i] == "U" or s[i] == "D":
continue
else:
return "No"
else:
if s[i] == "R" or s[i] == "U" or s[i] == "D":
continue
else:
return "No"
return "Yes"
print(f()) |
p03309 | s976471635 | Accepted | n = int(input())
g = map(int, input().split())
a = [v-(i+1) for i,v in enumerate(g)]
a.sort()
b = a[len(a)//2]
print(sum(map(lambda x:abs(x-b), a)))
|
p03075 | s128995915 | Wrong Answer | l = [int(input()) for _ in [0] * 6]
#print(l)
k=l.pop()
#print(l)
#print(k)
for i in range(5):
for j in range(5):
if abs(l[j] - l[i]) > k:
print(':(')
break
break
else:
print('Yay!') |
p02754 | s505225721 | Wrong Answer | N,B,R = input().split()
N = int(N)
B = int(B)
R = int(R)
X = B + R
Z = N // X
Y = N % X
if B == 0:
print(0)
elif X == N:
print(B)
elif X < N:
if Y < B:
print(B*Z + Y)
elif Y == B:
print(B*Z + B)
elif Y > B:
print(B*Z + B)
|
p03274 | s635145673 | Accepted | def resolve():
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = float('inf')
for i in range(n-(k-1)):
if abs(x[i] - x[i+(k-1)]) == (abs(x[i]) + abs(x[i+(k-1)])):
v = abs(x[i] - x[i + (k - 1)]) + min(abs(x[i]), abs(x[i + (k - 1)]))
ans = min(ans, v)
else:
v = max(abs(x[i]), abs(x[i + (k - 1)]))
ans = min(ans, v)
print(ans)
resolve() |
p03030 | s044771910 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
SR = []
for i in range(1,N+1):
s, r = input().split()
SR.append((s,-int(r),i))
SR.sort(key=lambda x: (x[0],x[1]))
for ans in SR:
print(ans[2]) |
p03433 | s280784100 | Wrong Answer | n = int(input())
a = int(input())
if n%500 <= a:
print('Yse')
else:
print('No') |
p03037 | s721054783 | Accepted | def mapt(fn, *args):
return tuple(map(fn, *args))
def Input():
return mapt(int, input().split(" "))
def main():
n, m = Input()
max_l = 0
min_r = 1e6
for i in range(m):
l, r = Input()
max_l = max(max_l, l)
min_r = min(min_r, r)
ans = min_r - max_l + 1
ans = max(ans, 0)
print(ans)
main() |
p03548 | s558909220 | Wrong Answer | X,Y,Z = map(int, input().split())
print(X // (Y+Z)) |
p03457 | s739176418 | Accepted | import sys
N = int(input())
d = [list(map(int,input().split())) for l in range(N)]
d.insert(0,[0,0,0])
#print(N)
#print(d)
def get_length(l1,l2):
return abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])
for cnt in range(N):
length = get_length(d[cnt],d[cnt+1])
time = abs(d[cnt][0]-d[cnt+1][0])
if length <= time and abs(time - length) % 2 == 0:
pass
else:
print("No")
sys.exit(0)
print("Yes") |
p03438 | s961874402 | Accepted | N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
sum1 = 0
sum2 = 0
for i in range(N):
if a[i] > b[i]:
sum1 += a[i] - b[i]
else:
sum2 += (b[i] - a[i])//2
if sum1 <= sum2:
print('Yes')
else:
print('No') |
p02702 | s082842196 | Accepted | S = input()
N = len(S)
A = [int(S[i]) for i in range(N)]
A = A[::-1]
MOD = 2019
p10 = [1] * N
for i in range(1, N):
p10[i] = (p10[i - 1] * 10) % MOD
for i in range(N):
A[i] = (A[i] * p10[i]) % MOD
cumsum = [A[0]] * N
for i in range(1, N):
cumsum[i] = (cumsum[i - 1] + A[i]) % MOD
cnt = [0] * MOD
cnt[0] = 1
for i in range(N):
cnt[cumsum[i]] += 1
ans = 0
for i in range(MOD):
ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)
|
p03804 | s704066081 | Accepted | N,M=map(int,input().split())
A=[[""]*N for i in range(N)]
B=[[""]*M for i in range(M)]
for y in range(N):
A[y]=list(input())
for y in range(M):
B[y]=list(input())
exist=False
for ly in range(N):
for lx in range(N):
if ly+M-1>=N or lx+M-1>=N:
continue
match=True
for y in range(M):
for x in range(M):
if A[ly+y][lx+x]!=B[y][x]:
match=False
if match==True:
exist=True
print("Yes" if exist==True else "No")
|
p03448 | s449162526 | Accepted | a, b, c, x = map(int, [input() for i in range(4)])
cnt = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i + 100*j + 50*k == x:
cnt += 1
print(cnt) |
p03077 | s857525688 | Accepted | import math
S=[int(input()) for i in range(6)]
ans=math.ceil(S[0]/min(S[1:]))+4
print (ans) |
p02623 | s990786808 | Accepted | n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
asum = [0]*(n+1)
bsum = [0]*(m+1)
for i in range(n):
asum[i+1] = a[i] + asum[i]
for j in range(m):
bsum[j+1] = b[j] + bsum[j]
j = m
res = 0
for i in range(n+1):
if asum[i] > k:
break
while asum[i] + bsum[j] > k:
j-=1
res = max(res,i+j)
print(res)
|
p02861 | s042707217 | Accepted | n=int(input())
a=[]
ans=0
for _ in range(n):
x,y=map(int,input().split())
for i,j in a:
ans+=((i-x)**2+(j-y)**2)**.5
a.append((x,y))
print(ans*2/n) |
p03043 | s956460355 | Accepted | n,k=map(int,input().split())
ret=0
for i in range(1,n+1):
tmp=1/n
now=i
while now<k:
now*=2
tmp/=2
ret+=tmp
print(ret) |
p02747 | s391703254 | Accepted | S = str(input())
if S in [ "hi"*x for x in range(1,6) ]:
print("Yes")
else:
print("No") |
p04019 | s818396359 | Accepted | S = str(input())
vertical,side = ['N', 'S'], ['W', 'E']
ans1,ans2 = 0,0
for l in vertical:
if l in S:
ans1 += 1
for l in side:
if l in S:
ans2 += 1
if ans1 >= 2 and ans2 >= 2:
print('Yes')
elif ans1 >= 2 and ans2 == 0:
print('Yes')
elif ans1 == 0 and ans2 >= 2:
print('Yes')
else:
print('No') |
p03352 | s000831540 | Accepted | import bisect
x = int(input())
s = {1}
for a in range(2, 1000):
for b in range(2, 11):
c = a ** b
if c > 1000:
break
s.add(c)
s = sorted(s, reverse=True)
for a in s:
if a <= x:
print(a)
exit(0)
|
p03105 | s109083113 | Accepted | def resolve():
a,b,c=map(int, input().split())
print(min(c,b//a))
resolve() |
p02639 | s936558523 | Accepted | x = list(input().split())
for i in range(len(x)):
if x[i] == '0':
print(i+1) |
p03836 | s772175846 | Accepted | sx,sy,tx,ty=map(int,input().split())
s='U'*(ty-sy)
s+='R'*(tx-sx)
s+='D'*(ty-sy)
s+='L'*(tx-sx+1)
s+='U'*(ty-sy+1)
s+='R'*(tx-sx+1)
s+='DR'
s+='D'*(ty-sy+1)
s+='L'*(tx-sx+1)
s+='U'
print(s) |
p02848 | s237165845 | Accepted | n = int(input())
s = input()
def ROTN(tmp, n):
tmp = ord(tmp) + n
if tmp > 0x5a:
tmp -= 26
return chr(tmp)
ans = []
for i in range(len(s)):
tmp = s[i]
ans.append(ROTN(tmp, n))
for i in range(len(ans)):
print(ans[i], end="") |
p04043 | s184317641 | Accepted |
T = [int(_) for _ in input().split()]
x = sorted(T)
if x[0] == 5 and x[1] == 5 and x[2] == 7:
print("YES")
else:
print("NO") |
p03252 | s758078394 | Accepted | import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()
def main():
S = list(input())
T = list(input())
memo = defaultdict(lambda: defaultdict(str))
for s, t in zip(S, T):
for key, (a, b) in {'s': (s, t), 't': (t, s)}.items():
if memo[key][a] and memo[key][a] != b:
print('No')
exit()
else:
memo[key][a] = b
print('Yes')
if __name__ == '__main__':
main()
|
p03471 | s272924969 | Wrong Answer | import sys
N, Y = map(int, input().split())
if 10000 * N < Y:
print(-1, -1, -1)
for x in range(N, -1, -1):
for y in range(N-x, -1, -1):
for z in range(N-x-y, -1, -1):
if (10000*x)+(5000*y)+(1000*z) == Y:
print(x, y, x)
sys.exit()
print(-1, -1, -1) |
p02607 | s168125278 | Wrong Answer | # -*- coding: utf-8 -*-
import math
N = int(input())
# print(N)
ai = input().split(' ')
# print(ai)
num = 0
for i in range(math.floor(N/2)):
if int(ai[i]) % 2 == 1:
num += 1
print(num) |
p03163 | s388653619 | Accepted | n,w=map(int,input().split())
P=[]
for _ in range(n):
iw,iv=map(int,input().split())
P.append([iw,iv])
INF=float('inf')
dp=[[0 for i in range(w+1)] for j in range(n+1)]
for i in range(1,n+1):
for j in range(1,w+1):
if j-P[i-1][0]>=0:
dp[i][j]=max(dp[i-1][j],dp[i-1][j-P[i-1][0]]+P[i-1][1])
else:
dp[i][j]=dp[i-1][j]
print(dp[n][w]) |
p03479 | s196685168 | Accepted | x,y = map(int,input().split())
count = 0
while x <= y:
x = 2*x
count += 1
print(count)
|
p03160 | s631473317 | Accepted | a=int(input())
b=list(map(int,input().split()))
dp=[0]
dp.append(abs(b[0]-b[1]))
for i in range(2,len(b)):
h1=abs(b[i]-b[i-1])+dp[i-1]
h2=abs(b[i-2]-b[i])+dp[i-2]
dp.append(min(h1,h2))
print(dp[a-1])
|
p03087 | s182629216 | Accepted | N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
count[i]+=count[i-1]
if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
l,r=map(int,input().split())
print(count[r-1]-count[l-1]) |
p03059 | s194156194 | Accepted | A, B, T = map(int, input().split())
print(B*int((T+0.5)/A)) |
p02935 | s477049595 | Accepted | n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = (l[0]+l[1])/2
for i in range(2,n):
ans = (ans+l[i])/2
print(ans) |
p04020 | s106001075 | Accepted | N = int(input())
A = [int(input()) for _ in range(N)]
res = 0
n = 0
for a in A:
if a == 0:
res += n // 2
n = 0
n += a
res += n // 2
print(res)
|
p03611 | s831765558 | Accepted | N=int(input())
c=[0]*100002
a=list(map(int,input().split()))
for i in a:
c[i]+=1
if(i-1>=0):
c[i-1]+=1
c[i+1]+=1
print(max(c)) |
p03438 | s084581907 | Accepted | n = int(input())
a = map(int, input().split())
b = map(int, input().split())
d = 0
c = 0
for x, y in zip(a, b):
if x < y:
d += (y - x) // 2
else:
c += x - y
print('Yes' if d >= c else 'No')
|
p03607 | s605912948 | Accepted | N = int(input())
inputSet = set()
for i in range(N):
a = input()
try:
inputSet.remove(a)
except KeyError:
inputSet.add(a)
print (len(inputSet)) |
p03030 | s351948789 | Accepted | n = int(input())
spi = []
for i in range(n):
s,p = input().split()
p = 100-int(p)
spi.append([s,p,i+1])
spi.sort()
for x in spi:print(x[-1]) |
p03274 | s930339795 | Wrong Answer | n,k = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
if len(x) == 1:
print(abs(x[0]))
else:
ans = 10 ** 10
for i in range(n-k):
tmp = min(abs(x[i]), abs(x[i+k-1]))
ans = min(ans,tmp+abs(x[i+k-1]-x[i]))
print(ans)
|
p02606 | s190461419 | Accepted | import math
L,R,d=map(int,input().split())
ans=0
for i in range(L,R+1):
if i%d==0:
ans+=1
print(ans) |
p02606 | s584690897 | Accepted | l, r, d = map(int, input().split())
a = (l-1) // d
b = r // d
print(b-a) |
p03854 | s033243313 | Accepted | import re
sin = input()
match = re.match(r"^(dream|dreamer|erase|eraser)+$",sin)
print("YES" if match else "NO") |
p02982 | s406941719 | Wrong Answer | import math
n, d = map(int, input().split())
x = []
ans = [i**2 for i in range(1, 40)]
for i in range(n):
tmp = list(map(int, input().split()))
x.append(tmp)
cnt = 0
sum_t = 0
for i in range(n):
for j in range(i+1, n):
sum_t = 0
for k in range(d):
sum_t += (x[i][k]-x[j][k])**2
if sum_t in ans:
cnt += 1
print(cnt)
|
p02678 | s041132527 | Accepted | import queue
n, m = map(int, input().split())
link = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
link[a - 1].append(b - 1)
link[b - 1].append(a - 1)
mark = [-1 for i in range(n)]
q = queue.Queue()
q.put(0)
while not q.empty():
i = q.get()
for j in link[i]:
if j != 0 and mark[j] == -1:
mark[j] = i
q.put(j)
flag = True
for i in range(1, n):
if mark[i] == -1:
flag = False
if flag:
print("Yes")
for i in range(1, n):
print(mark[i] + 1)
else:
print("No") |
p02862 | s845582060 | Wrong Answer | from math import factorial
x,y = map(int,input().split())
n = (x+y)/3
sa = abs(x-y)
c = (n-sa)//2
try:
a = factorial(n) / factorial(r) / factorial(n - r)
print(a%(10**9+7))
except:
print(0) |
p03861 | s627429327 | Accepted | a,b,x=map(int,input().split())
cnt=0
#for i in range(a,b+1):
# if i%x==0: cnt+=1
#print(cnt)
cnt1=b//x
cnt2=(a-1)//x
print(cnt1-cnt2) |
p03785 | s542896437 | Accepted | N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
# print(T)
bus = 1
org = T[0]
_count = 0
for t in T:
if t - org <= K and _count < C:
_count += 1
# print('1- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))
else:
bus += 1
org = t
_count = 1
# print('2- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))
print(bus) |
p03951 | s692518360 | Wrong Answer | #26 A - Prefix and Suffix
N = int(input())
s = list(input())
t = list(input())
s_rev = list(reversed(s))
cnt = N
for i in range(1,N+1):
# s の部分文字列を後ろから取り出す
tgt = list(reversed(s_rev[:i]))
if tgt == t[:i]:
cnt -= 1
if s == t:
print(N)
else:
ans = s[:cnt] + t
print(len(ans)) |
p03293 | s199757756 | Wrong Answer | import collections
S = input()
T = input()
print("Yes" if collections.Counter(S) == collections.Counter(T) else "No") |
p02939 | s571598710 | Wrong Answer | import collections
s = list(input())
counter_s = collections.Counter(s)
len_keys = len(counter_s.keys())
list_values = counter_s.values()
total = sum(list_values)
print(total - len_keys)
|
p03281 | s189257272 | Accepted | def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
n = int(input())
print(len(list(filter(lambda x: len(make_divisors(x)) == 8, range(1, n + 1,2)))))
|
p02725 | s115096099 | Accepted | K, N = map(int, input().split())
A = list(map(int, input().split()))
m = K + A[0] - A[N-1]
for i in range(N-1):
d = A[i+1] - A[i]
m = max([d, m])
print(K-m)
|
p03387 | s887014003 | Wrong Answer | l = sorted(map(int,input().split()))[::-1]
a = l[0]
b = l[1]
c = l[2]
s = 0
s += a-b
c += (a-b)
if (a-c)%2==0:
s += (a-c)//2
else:
s += (a-c-1)//2+1
print(s) |
p02933 | s905221708 | Accepted | a = int(input())
s = input()
if a >= 3200:
print(s)
else:
print("red") |
p02918 | s450527526 | Wrong Answer | n, k = [int(i) for i in input().split()]
s = list(input())
c, cnt = 0, 0
cnt = 0
if s[0] == 'L':
cnt += 1
if s[-1] == 'R':
cnt += 1
for i in range(n-1):
if s[i] == 'R' and s[i+1] == 'L':
c += 1
if c > 0:
if c - k >= 0:
c -= k
else:
c = 0
cnt = 1
print(n - 2*c - cnt) |
p02694 | s671181925 | Accepted |
x=int(input())
s=100
from itertools import count
for c in count(0):
if s >= x:
print(c)
exit()
s = int(s * 1.01) |
p03339 | s874727242 | Wrong Answer | N = int(input())
S = input()
W = [0]
E = [0]
for i in range(N):
s = S[i]
if s == "W":
W.append(W[-1] + 1)
E.append(E[-1])
else:
W.append(W[-1])
E.append(E[-1] + 1)
ans = float("inf")
for i in range(1, N):
ans = min(ans, W[i-1] + (E[-1] - E[i-1]))
print(ans) |
p03013 | s547293135 | Accepted | n, m = map(int, input().split())
a = {int(input()) for _ in range(m)}
s = [1]*(n+1)
if 1 in a:
s[1] = 0
for i in range(n-1):
if i+2 in a:
s[i+2] = 0
continue
s[i+2] = (s[i+1] + s[i]) % (10**9+7)
print(s[-1]) |
p02783 | s020725552 | Accepted | h, a = map(int, input().split())
cnt = 0
while h > 0:
cnt += 1
h = h - a
print(cnt)
|
p02683 | s683708922 | Accepted | n, m, x = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
ans = float('inf')
for i in range(2**n):
count = [0]*(m+1)
for j in range(n):
if (i >> j) & 1:
for k in range(m+1):
count[k] += lst[j][k]
judge = True
for j in range(1, m+1):
if count[j] < x:
judge = False
break
if judge:
ans = min(ans, count[0])
if ans == float('inf'):
print(-1)
else:
print(ans) |
p03821 | s242823060 | Wrong Answer | #67 A - Multiple Array
N = int(input())
A, B = [],[]
for _ in range(N):
a,b= map(int,input().split())
A.append(a); B.append(b)
A = list(reversed(A))
B = list(reversed(B))
c = 0
for a,b in zip(A,B):
if b == 1:
continue
# 前に押されたボタンの回数分足される
a += c
# c 回ボタンを押せば Ai は Bi の倍数になる
c += b-(a%b)
print(c) |
p02900 | s683634330 | Accepted | import fractions
def prime_divs(n):
divs = {}
for i in range(2, int(n**.5)+1):
while n % i == 0:
if i not in divs:
divs[i] = 0
divs[i] += 1
n //= i
if n != 1:
if n not in divs:
divs[n] = 0
divs[n] += 1
return divs
A, B = map(int, input().split())
print(len(prime_divs(fractions.gcd(A, B))) + 1) |
p02829 | s148365200 | Accepted | A = input()
B = input()
print(6-int(A)-int(B)) |
p02973 | s439609894 | Wrong Answer | import bisect
n = int(input())
a = [int(input()) for _ in range(n)]
b = [a[-1]]
for i in range(n - 2, -1, -1):
if b[-1] <= a[i]:
b.append(a[i])
else:
b[bisect.bisect_left(b, a[i])] = a[i]
print(len(b)) |
p03485 | s701166782 | Accepted | import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2)) |
p03339 | s681702351 | Accepted | n = int(input())
s = str(input())
left = s[0]
ans = 10**6
left = {}
left.setdefault('W',0)
left.setdefault('E',0)
right = {}
right.setdefault('E',0)
right.setdefault('W',0)
for i in range(n):
right[s[i]] += 1
ans = 10**6
for i in range(n):
right[s[i]] -= 1
ans = min(ans,left['W']+right['E'])
#print(left,right)
left[s[i]] += 1
print(ans)
|
p03012 | s760503158 | Accepted | N = int(input())
W = [i for i in map(int,input().split())]
res = 10**9
for i in range(N):
L1 = W[0:i]
L2 = W[i:N]
if res > abs(sum(L1)-sum(L2)):
res = abs(sum(L1)-sum(L2))
print(res) |
p02693 | s457547914 | Accepted | k = int(input())
a, b = (int(x) for x in input().split())
if b % k <= b - a:
print("OK")
else:
print("NG")
|
p02899 | s177518361 | Accepted | N=int(input())
A=list(map(int,input().split()))
ans=[0]*N
for i in range(N):
ans[A[i]-1]=i+1
print(*ans) |
p02881 | s866803180 | Accepted | import math
N = int(input())
x = int(math.sqrt(N))
for i in range(x,0,-1):
if N % i == 0:
y = N // i
#print(y,i)
ans = (i-1) + (y-1)
break
print(ans) |
p03011 | s098195715 | Accepted | a, b, c = map(int, input().split())
d = a+b
e = a+c
f = b+c
print(min(d,e,f)) |
p03796 | s838213796 | Accepted | import numpy as np
N = int(input())
MOD = 10**9 + 7
tmp = 1
for i in range(1, N+1):
tmp *= i
if tmp>=MOD:
tmp %= MOD
print(tmp) |
p03012 | s989394486 | Accepted | n = int(input())
w = list(map(int, input().split()))
ans = float('inf')
for t in range(1, n):
s1 = sum(w[:t])
s2 = sum(w[t:])
ans = min(abs(s1-s2), ans)
print(ans)
|
p03711 | s945585026 | Accepted | l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
x, y = map(int, input().split())
if x in l1 and y in l1:
print('Yes')
elif x in l2 and y in l2:
print('Yes')
elif x in l3 and y in l3:
print('Yes')
else:
print('No') |
p02597 | s694333776 | Wrong Answer | C = list(input())
C_ = sorted(C)
wr = rw = 0
for i in range(len(C_)):
if C[i] != C_[i]:
if C[i] == 'R' and C_[i] == 'W':
rw += 1
else:
wr += 1
print(max(wr, rw))
|
p03345 | s009334296 | Wrong Answer | # import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
# c.append(i)
e1,e2,e3 ,e4= map(int,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
if e4%2==0:
print(-(e1-e4))
elif e4%2==1:
print(e1-e2)
elif abs(e1-e2)>=10**18:
print("Unfair") |
p04030 | s297441003 | Accepted | S = input()
ans = []
for c in S:
if c == "B":
if ans:
ans.pop()
else:
ans.append(c)
print("".join(ans))
|
p03548 | s871338722 | Accepted | a,b,c = map(int, input().split())
print((a-c) // (b+c)) |
p03319 | s981270865 | Accepted | import math
n, k = map(int, input().split())
A = list(map(int, input().split()))
A_min = min(A)
N = n-len([i for i in A if i == A_min])
print(math.ceil(N/(k-1))) |
p03433 | s040072075 | Wrong Answer | n = int(input())
a = int(input())
print(n)
mod = n % 500
if mod < a:
print("Yes")
else:
print("No") |
p03645 | s187935642 | Accepted | import sys
sys.setrecursionlimit(200010)
def input():
return sys.stdin.readline()[:-1]
def main():
N, M = list(map(int,input().split()))
G = [set([]) for k in range(N)]
for i in range(M):
A, B = set(map(int,input().split()))
G[A-1].add(B-1)
G[B-1].add(A-1)
for e in G[0]:
if e in G[N-1]:
print("POSSIBLE")
exit(0)
print("IMPOSSIBLE")
if __name__ == '__main__':
main()
|
p03760 | s890140656 | Accepted | o = list(input())
e = list(input()) + [" "]
for x, y in zip(o, e): print(x + y, end="") |
p02778 | s287381612 | Accepted | line = ''
for _ in input():
line += 'x'
print(line) |
p02694 | s638259310 | Accepted | x = int(input())
a = 100
for i in range(1, 3770):
a *= 1.01
a = int(a)
if a >= x:
print(i)
exit() |
p03797 | s171147439 | Wrong Answer | def main():
s_shaped_piece, c_shaped_piece = map(int, input().split())
print((2 * s_shaped_piece + c_shaped_piece) // 4)
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.