problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03456 | s015622076 | Wrong Answer | # B - 1 21
a,b = map(int,input().split())
x = a*len(str(b))+b
ans = 'No'
for y in range(1000):
if x==y*y:
ans = 'Yes'
break
print(ans) |
p03478 | s382992656 | Accepted | n,a,b =map(int,input().split())
def f(x):
sum = 0
for i in str(x):
sum += int(i)
return sum
data = []
for i in range(1,n+1):
if a <= f(i) <= b:
data.append(i)
print(sum(data)) |
p02775 | s277375672 | Accepted | a = list(map(int,list(input())))[::-1]
a.append(0)
ans = 0
for i in range(len(a)):
if a[i] >= 6 or (a[i] == 5 and a[i+1] >= 5):
a[i] = 10-a[i]
a[i+1] += 1
print(sum(a)) |
p02687 | s553722264 | Accepted | s = input()
if s == 'ABC':
print('ARC')
else:
print('ABC') |
p02640 | s975048328 | Accepted | x, y = map(int, input().split())
flag = True
for animal in range(1, x + 1):
if y == animal * 4 + (x - animal) * 2 or y == animal * 2 + (x - animal) * 4:
print ("Yes")
flag = False
break
if flag:
print("No")
|
p02700 | s815240974 | Accepted | a, b, c, d = map(int, input().split())
while True:
c -= b
if c <= 0:
print('Yes')
exit()
a -= d
if a <= 0:
print('No')
exit()
|
p02719 | s604938918 | Accepted | N, K = map(int,input().split())
while True:
if N%K == 0:
print(0)
break
else:
N=N%K
N = min(N,abs(N-K))
print(N)
break |
p04020 | s485577175 | Accepted | N = int(input())
A = [int(input()) for _ in range(N)]
A.append(0)
ans = 0
for i in range(N):
ans += A[i]//2
if A[i]&1 and A[i+1]:
A[i+1] -= 1
ans += 1
print(ans) |
p02613 | s026556126 | Accepted | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
N = int(input())
C = defaultdict(int)
for _ in range(N):
s = input().strip("\n")
C[s] += 1
P = ["AC", "WA", "TLE", "RE"]
for p in P:
print(p + " x " + str(C[p]))
return 0
if __name__ == "__main__":
solve() |
p02759 | s552805192 | Accepted | N = int(input())
if N % 2 == 0:
print(N // 2)
else:
print((N + 1) // 2) |
p02640 | s815427183 | Wrong Answer | x, y = map(int, input().split())
a = y - 2*x
if a > x:
print("No")
elif a < 0:
print("No")
elif a % 2 == 0:
print("Yes") |
p02694 | s536584192 | Accepted | import sys
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
n,=I()
x=100
i=0
while x<n:
i+=1
temp=x*0.01
x+=mt.floor(temp)
print(i) |
p03745 | s341206806 | Wrong Answer | N=int(input())
count=1
size=1
p=list(map(int,input().split()))
q=[p[0]]
for i in range (1,N):
if p[i]!=p[i-1]:
q.append(p[i])
size+=1
j=0
while True:
if j>=size-2:
break
while (q[j]-q[j+1])*(q[j+1]-q[j+2])>=0:
if j>=size-3:
break
j+=1
count+=1
j+=2
print(count) |
p03137 | s981833533 | Accepted | N, M = map(int, input().split())
X = sorted(list(map(int,input().split())))
diff = [0]*(M-1)
for i in range(M-1):
diff[i] = X[i+1] - X[i]
diff = sorted(diff)
print(sum(diff[0:max(M-N, 0)])) |
p02602 | s737620694 | Accepted |
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N-K):
if A[i] < A[i+K]:
print ("Yes")
else:
print ("No")
|
p03038 | s138257182 | Accepted | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]
# Cについて大きい順にソート
BC.sort(key=lambda x: x[1], reverse=True)
temp = []
for i in range(M):
# CiをBi個追加
temp += [BC[i][1]] * BC[i][0]
if len(temp) > N:
break
A += temp
A.sort(reverse=True)
print(sum(A[:N]))
|
p02843 | s650400852 | Accepted | X = int(input())
count = 1
while True:
if 100*count <= X <= 105*count:
print(1)
exit()
elif X < 100*count:
print(0)
exit()
count += 1 |
p03471 | s534057807 | Accepted | n, y = map(int,input().split())
y = y//1000
for i in range(n+1):
for j in range (n+1-i):
k = n - i - j
if 10*i + 5* j + 1 * k == y:
print(str(i) +' '+str(j)+' '+str(k))
exit()
print('-1 -1 -1') |
p03474 | s133112359 | Accepted | a,b=map(int,input().split())
s=list(input())
if s.count('-')==1 and len(s)==a+b+1 and s[a]=='-':
print('Yes')
else:
print('No') |
p03479 | s340807013 | Wrong Answer | import math
X, Y = map(int, input().split())
print(int(math.log2(Y//X))+1) |
p03427 | s791698187 | Accepted | def main():
N = input()
t = 0
l = []
for i in N:
t += int(i)
l.append(t)
n = len(N)
for i, v in enumerate(N):
if int(v) > 0:
t = max(l[i] - 1 + 9*(n - i - 1), t)
return t
print(main())
|
p03804 | s237774170 | Accepted | n, m = map(int, input().split())
a = []
b = []
for i in range(n):
a.append(list(input()))
for i in range(m):
b.append(list(input()))
def ext(x, y):
global a
res = [[0 for _ in range(m)] for __ in range(m)]
for i in range(m):
for j in range(m):
res[i][j] = a[i+x][j+y]
return res
ans = "No"
for i in range(0, n - m + 1):
for j in range(0, n - m + 1):
if (ext(i, j) == b):
ans = "Yes"
print(ans)
|
p02555 | s111268184 | Wrong Answer | from math import comb
mod = 10**9 + 7
s = 1729
ans = 0
n = 1
while s - 2*n - 1 >= 0:
ans += comb(s-2*n-1, n-1)
ans %= mod
n += 1
print(ans) |
p02820 | s667327054 | Wrong Answer | n,k=map(int,input().split())
r,s,p = map(int,input().split())
t=input()
def score(c):
if c=="r":
return p
elif c=="s":
return r
else:
return s
ans = 0
for i in range(n):
if i < k:
ans+=score(t[i])
else:
if t[i] == t[i-k]:
if i >= 2*k and t[i]==t[i-2*k]:
ans+=score(t[i])
else:
ans+=score(t[i])
print(ans)
|
p03971 | s343613199 | Accepted | N, A, B = map(int, input().split())
S = list(input())
answer = 0
b_list = 0
for idx, moji in enumerate(S):
if moji == "a" and answer < A + B:
answer += 1
print("Yes")
continue
elif moji == "b":
b_list += 1
if answer < A + B and b_list <= B:
answer += 1
print("Yes")
continue
print("No")
|
p03127 | s984073322 | Accepted | # import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math
import sys
# import numpy as np
ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n = int(input())
a = list(map(int,ipti().split()))
ans = a[0]
for i in range(1, n):
ans = gcd(ans, a[i])
print(ans)
if __name__ == '__main__':
main() |
p02935 | s016211779 | Wrong Answer | N = int(input())
Vs = list(map(int, input().split()))
Vs.sort()
print(Vs)
initialGousei = (Vs[0] + Vs[1]) / 2
for i in range(2, N):
initialGousei = (initialGousei + Vs[i]) / 2
print(initialGousei)
|
p03385 | s027351726 | Wrong Answer | print("Yes" if len(input())==3 else "No") |
p03625 | s860712882 | Wrong Answer | import collections
n=int(input())
a=list(map(int,input().split()))
b=list(collections.Counter(a).items())
lst=[]
for i in range(len(b)):
if b[i][1]>1:
lst.append(int(b[i][0]))
if len(lst)<2:
print(0)
else:
lst.sort(reverse=True)
print(lst[0]*lst[1]) |
p03163 | s631767019 | Wrong Answer | n,W=map(int,input().split())
lst=[[0,0]]
for i in range(n):
w,v=map(int,input().split())
lst.append([w,v])
nap=[]
for i in range(n+1):
nap.append([0]*(W+1))
for i in range(1,n+1):
for j in range(1,W+1):
if lst[i][0]<=j:
nap[i][j]=max(nap[i-1][j],nap[i-1][j-lst[i-1][0]]+lst[i-1][1])
else:
nap[i][j]=nap[i-1][j]
print(nap[n][W])
|
p03000 | s571081170 | Accepted | n,x=map(int,input().split())
li=list(map(int,input().split()))
s=[0]
a=0
for i in li:
a+=i
s.append(a)
l=[i for i in s if i<=x]
print(len(l)) |
p03799 | s751778426 | Accepted | N,M=map(int,input().split());print((min(2*N,M)+M)//4)
|
p02784 | s892108893 | Accepted | h,n = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) >= h:
print('Yes')
else:
print('No') |
p02705 | s066710497 | Accepted | R = int(input())
print(2*R*3.14)
|
p03821 | s448832033 | Accepted | n = int(input())
ab = [map(int, input().split()) for _ in range(n)]
a, b = [list(i) for i in zip(*ab)]
a.reverse()
b.reverse()
ans = 0
for j in range(n):
a[j] += ans
if a[j] % b[j] != 0:
ans += b[j] -(a[j] % b[j])
print(ans) |
p02924 | s859455684 | Accepted | N = int(input())
ans = N*(N-1)//2
print(ans) |
p03071 | s336238100 | Accepted | A,B = map(int,input().split())
if A >= B:
if A-1 >= B:
print(A*2-1)
else:
print(A+B)
else:
if B-1 >= A:
print(B*2-1)
else:
print(A+B) |
p02618 | s939059080 | Accepted | import random
for i in range(365):
print(random.randrange(1,27)) |
p02993 | s143835844 | Accepted | S = list(input())
for i in range(len(S)-1):
if S[i] == S[i+1]:
print('Bad')
break
else:
print('Good') |
p02552 | s206605500 | Accepted | x=int(input())
if x==0:
print(1)
else:
print(0) |
p03000 | s012827244 | Accepted | import bisect
from itertools import accumulate
N, X = map(int, input().split())
L = list(map(int, input().split()))
Lsum = list(accumulate(L))
ind = bisect.bisect_right(Lsum, X)
print(ind+1)
|
p02747 | s006052705 | Wrong Answer | a=input()
ans="No"
for i in range(1,len(a)):
if a[i-1]+a[i]=="hi":
ans="Yes"
else:
ans="No"
break
print(ans) |
p02583 | s384516292 | Accepted | count=0
n=int(input())
l=list(map(int,input().split()))
if n==1 or n==2:
print(0)
else:
for i in range(n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
if l[i]!=l[j] and l[j]!=l[k] and l[i]!=l[k] and abs(l[i]-l[j])<l[k]<l[i]+l[j]:
count+=1
print(count) |
p03387 | s786790236 | Accepted | a,b,c = map(int,(input().split()))
ans = 0
if a%2 + b%2 + c%2 == 1:
if a%2 == 0:
a += 1
if b%2 == 0:
b += 1
if c%2 == 0:
c += 1
ans += 1
if a%2 + b%2 + c%2 == 2:
if a%2 == 1:
a += 1
if b%2 == 1:
b += 1
if c%2 == 1:
c += 1
ans += 1
A = max(a,b,c) -a
B = max(a,b,c)- b
C = max(a,b,c) -c
print(ans+(A+B+C)//2) |
p03693 | s958977998 | Accepted | rgb = int("".join(input().split()))
print("YES" if rgb % 4 == 0 else "NO")
|
p03086 | s491254358 | Wrong Answer | acgt = ['A', 'T', 'G', 'C']
word = input()
res = 0
count = 0
for s in word:
if s in acgt:
count += 1
elif res < count:
res = count
print(res)
|
p02724 | s059782387 | Wrong Answer | a = int(input())
b = a/500
c = b%500
d = c/5
print(b+d) |
p02939 | s182461761 | Accepted | s = input()
n = len(s)
pre = s[0]
now = ''
cnt = 1
for i in range(1,n):
if pre != now + s[i]:
pre = now + s[i]
now = ''
cnt += 1
else:
now = now + s[i]
print(cnt)
|
p03627 | s142242343 | Accepted | N = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
e = []
for k,v in C.items():
if v >= 2: e.append(k)
if v >= 4: e.append(k)
e.sort(reverse=True)
if len(e) >= 2:
print(e[0]*e[1])
else:
print(0) |
p03803 | s324574231 | Wrong Answer | a, b = map(int, input().split())
if a < b:
ans = 'Bob'
elif a == b:
ans = 'Draw'
else:
ans = 'Alice'
print(ans)
|
p02612 | s807766791 | Accepted | money = int(input())
output = 0
if money <= 1000:
output = 1000 - money
elif money % 1000 == 0:
output = 0
else:
output = 1000 - (money % 1000)
print(output) |
p02612 | s477040521 | Accepted | n= int(input())
if n%1000==0:
print(0)
else:
print(1000-n%1000) |
p02548 | s531479165 | Accepted | n = int(input())
ans = 0
for i in range(1,int(n**0.5)+1):
x = n // i - 1 if n % i == 0 else n // i
x -= i-1
ans += x * 2
if i * i < n:
ans -= 1
print(ans) |
p02761 | s713973481 | Accepted | nm = list(map(int, input().split()))
sc = []
for _ in range(nm[1]):
sc.append(list(map(int, input().split())))
for i in range(1000):
i = str(i)
if len(i) == nm[0]:
for j in sc:
if int(i[j[0]-1]) == j[1]:
continue
else:
break
else:
print(int(i))
exit()
print(-1) |
p03730 | s321779543 | Accepted | ## coding: UTF-8
from fractions import gcd
s = input().split()
t = [int(p) for p in s]
#print(t)
A = t[0]
B = t[1]
C = t[2]
#print(A)
#print(B)
Gcd = gcd(A, B)
#print(Gcd)
#print(C)
if(C % Gcd == 0):
print("YES")
else:
print("NO") |
p03565 | s548726977 | Accepted | S = input()
T = input()
def match(k):
flag = True
for i in range(len(T)):
if S[i+k] != T[i] and S[i+k]!="?":
flag = False
break
return flag
flag = False
for k in reversed(range(len(S)-len(T)+1)):
# print(k)
if match(k):
S = S[:k] + T + S[k+len(T):]
flag = True
break
if flag:
ans = S.replace("?","a")
if not flag:
ans = "UNRESTORABLE"
print(ans)
|
p03136 | s848462971 | Wrong Answer | n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in l[:len(l) - 1]:
cnt += 1
if cnt > l[len(l) - 1]:
print("Yes")
else:
print("No") |
p02570 | s497007117 | Accepted | D,T,S = list(map(int, input().split()))
if S*T >= D:
print("Yes")
else:
print("No") |
p02720 | s427177790 | Accepted | from collections import deque
def main():
k = int(input())
q = deque(range(1, 10))
for _ in range(k):
x = q.popleft()
y = x * 10 + x % 10
if x % 10 > 0:
q.append(y - 1)
q.append(y)
if x % 10 < 9:
q.append(y + 1)
print(x)
if __name__ == '__main__':
main() |
p02576 | s150957613 | Accepted | n, x, t = map(int, input().split())
import math
print(t*math.ceil(n/x)) |
p03745 | s350635112 | Accepted | N = int(input())
A = list(map(int, input().split()))
k = 1
x = y = 0
c = A[0]
for i in A[1:]:
if c < i:
x = 1
elif c > i:
y = 1
if x == 1 and y == 1:
k += 1
x = y = 0
c = i
print(k) |
p02696 | s382435309 | Accepted | A,B,N = map(int,input().split())
if N >= (B-1):
x = B -1
else:
x = N
print((A * x // B) - A * (x//B))
|
p02594 | s710669689 | Wrong Answer | X = int(input())
if X <= 30:
print("NO")
else:
print("YES") |
p04034 | s676387244 | Accepted | N,M = map(int, input().split())
dp = [1] * N
red = [False] * N
red[0] = True
for i in range(M):
xi,yi = map(int, input().split())
xi-=1
yi-=1
dp[yi] += 1
red[yi] = red[yi] or red[xi]
dp[xi] -= 1
if dp[xi] == 0:
red[xi] = False
ans = sum(red)
print(ans) |
p03835 | s371132069 | Accepted | k,s = map(int, input().split())
ans = 0
for x in range(k+1):
for y in range(k+1):
if 0<=s-x-y and s-x-y <=k:
ans+=1
print(ans) |
p03457 | s288922895 | Accepted | #!/usr/bin/env python3
import math
n = int(input())
txy = [map(int, input().split()) for _ in range(n)]
t, x, y = [list(i) for i in zip(*txy)]
gt = 0
gx = 0
gy = 0
for i in range(n):
wt = t[i] -gt
ww = abs(x[i] - gx) + abs(y[i] - gy)
if (wt < ww) or ((wt - ww) % 2 == 1):
print("No")
break
gt = t[i]
gx = x[i]
gy = y[i]
else:
print("Yes") |
p03243 | s136277068 | Accepted | n = int(input())
for i in range(1, 10):
ans = i * 111
if ans >= n:
print(ans)
break
|
p03059 | s441648837 | Accepted | from sys import stdin, setrecursionlimit
def main():
input = stdin.buffer.readline
a, b, t = map(int, input().split())
print((t // a) * b)
if __name__ == "__main__":
setrecursionlimit(10000)
main()
|
p02987 | s056892090 | Accepted | s=sorted(input())
print('Yes'if(s[::2]==s[1::2]!=s[::-2])else'No') |
p02693 | s379944910 | Wrong Answer | k = int(input())
a, b = map(int, input().split())
c = a % k
for i in range(a, b+1):
if i % k == 0:
print('OK')
break
else:
print('NG')
break |
p02882 | s599558277 | Accepted | import sys
from math import atan, degrees
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
a, b, x = map(int, readline().split())
if x > a * a * b / 2:
ans = atan(2 * (a * a * b - x) / (a ** 3))
else:
ans = atan(a * b * b / (2 * x))
print(degrees(ans))
return
if __name__ == '__main__':
main()
|
p03481 | s243686939 | Accepted | x,y=map(int,input().split())
count=0
while x<=y:
x*=2
count+=1
print(count) |
p03435 | s950329208 | Accepted | c=[list(map(int,input().split())) for i in range(3)]
x=c[0][2]-c[0][1]
y=c[0][1]-c[0][0]
for i in range(1,3):
if c[i][1]-c[i][0]!=y:
print("No")
break
if c[i][2]-c[i][1]!=x:
print("No")
break
else:
print("Yes")
|
p03284 | s722082479 | Accepted | N,K=map(int,input().split())
if N%K==0 :
print(0)
else :
print(1) |
p03319 | s724525035 | Wrong Answer | import math
n,k=map(int, input().split())
an = list(map(int, input().split()))
min_place = an.index(min(an))
left = math.ceil((min_place)/(k-1))
if (min_place+1)<k:
min_place2 = k
else:
min_place2 = min_place
right = math.ceil((n-min_place2-1)/(k-1))
Ans = left + right
if Ans==0:
Ans += 1
print(Ans) |
p03281 | s496869833 | Wrong Answer | N = int(input())
if N >= 105:
print(1)
else:
print(0) |
p03471 | s298615390 | Accepted | N,Y = map(int,input().split())
for i in range(N+1):
for j in range(N+1):
m = Y - (10000*i+j*5000)
if m >= 0 and (i+j+m//1000) == N:
print(i,j,m//1000)
exit()
print(-1,-1,-1) |
p02861 | s778300489 | Accepted | N = int(input())
X = []
Y = []
sum=0
#距離の和を計算
for _ in range(N):
x,y=map(int,input().split())
for i, [x_,y_] in enumerate(zip(X,Y)):
sum+=((x-x_)**2+(y-y_)**2)**(0.5)
X.append(x)
Y.append(y)
print(sum*2/N) |
p02829 | s728996426 | Wrong Answer | def wtf(x):
twos = 0
fives = 0
for j in range(1, 60):
bs = 2 ** j
twos = twos + x // bs
bs = 2 * 5 ** j
fives = fives + x // bs
return min(twos, fives)
x = int(input())
print(wtf(x) if x % 2 == 0 else 0) |
p02553 | s940210898 | Wrong Answer | a,b,c,d=map(int,input().split())
if a<=0 and b<=0 and c<=0 and d<=0:
print(a*c)
elif a>=0 and b>=0 and c>=0 and d>=0:
print(b*d)
else:
print(b*d) |
p03767 | s001412520 | Accepted | n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
ans = 0
for i in range(n):
ans += a[2 * i + 1]
print(ans) |
p03331 | s824463093 | Accepted | N=int(input())
M=10**9
for i in range(1,N//2+1):
a=list(str(i))
b=list(str(N-i))
#print(a,b)
k=0
for q in range(len(a)):
k+=int(a[q])
for p in range(len(b)):
k+=int(b[p])
M=min(M,k)
print(M) |
p03145 | s773517543 | Wrong Answer | a,b,c=map(int,input().split())
print((a+b+c)/2)
|
p02793 | s988819029 | Wrong Answer | from fractions import gcd
def invmod(j):
return pow(j, MOD - 2, MOD)
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
l = 1
ans = 0
for i in range(N):
g = gcd(l, A[i])
multip = A[i] * invmod(g)
l *= multip
ans *= multip
ans += l * invmod(A[i])
if ans >= MOD:
ans -= MOD
print(ans % MOD)
|
p03438 | s507507387 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pdiff = 0
ndiff = []
for i, j in zip(a, b):
if i-j>0:
pdiff += i-j
elif i-j<0:
ndiff.append(j-i)
while ndiff:
tmp = ndiff.pop()
pdiff -= tmp//2
if pdiff<=0:
print('Yes')
else:
print('No') |
p03799 | s109715405 | Accepted | N, M = map(int, input().split())
if (2 * N > M):
print(M // 2)
exit()
elif (2 * N == M):
print(M // 2)
exit()
else:
# 2 * N< M のときはMに余裕があるときはcを2つ使ってSを作成する
# Mこのうちk個使ってSを作成
# Mが奇数or偶数で分ける
if (M % 2 == 0):
k = M // 2 - N
else:
k = (M // 2) - N - 1
print(min(((M - k) // 2), (N + (k // 2))))
|
p02744 | s880660731 | Wrong Answer | N = int(input())
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
ans = []
original = []
for i in range(N):
original.append("a")
usechr = original[:]
for chr in range(N):
usechr = original[:]
ans.append("".join(usechr[:-chr-1] + alphabet[:chr+1]))
ans.sort()
for a in ans:
print(a)
|
p02842 | s464685495 | Accepted | import math
N = int(input())
X = N / 1.08
floor = math.ceil(N/1.08)
ceil = math.ceil((N+1)/1.08)
for i in range(floor,ceil):
print(i)
break
else:
print(":(") |
p02596 | s735640349 | Accepted | K = int(input())
ans = -1
if K%2 == 0:
pass
elif K%5 == 0:
pass
else:
num = 7
ans = 0
while True:
ans += 1
if num % K == 0:
break
else:
num = (num * 10 + 7)%K
print(ans) |
p02546 | s637403593 | Accepted | def resolve():
S = input()
if S[-1] =='s':
print(S+'es')
else:
print(S+'s')
resolve() |
p02775 | s122412400 | Wrong Answer | n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
if k[i]<=5:
ans+=k[i]
else:
ans+=10-k[i]
k[i+1]+=1
print(ans) |
p03475 | s137698591 | Wrong Answer | n = int(input())
lst1 = [list(map(int,input().split())) for i in range(n-1)]
ans = []
for i in range(n-1):
res = 0
for j in range(i,n-1):
if res < lst1[j][1]:
res = lst1[j][1]
else:
res += (res-lst1[j][1])%lst1[j][2] #駅を経つまでの時間を加算
res += lst1[j][0]
ans.append(res)
ans.append(0)
for i in ans:
print(i) |
p03673 | s184441522 | Accepted | n = int(input())
a = list(map(int, input().split()))
odd = [a[i] for i in range(n) if i % 2 == 0]
even = [a[i] for i in range(n) if i % 2 == 1]
if n % 2 == 1:
b = odd[::-1]
b.extend(even)
else:
b = even[::-1]
b.extend(odd)
print(*b)
|
p02854 | s488602705 | Accepted | n = int(input())
a = list(map(int, input().split()))
t = sum(a)
b = 0
for i in range(n):
b += a[i]
tmp = abs(2*b-t)
ans = tmp if i==0 else min(ans, tmp)
print(ans) |
p03012 | s646863052 | Accepted | n = int(input())
w = list(map(int, input().split()))
a = sum(w)
b = 0
ans = float("inf")
for i in range(n):
a -= w[i]
b += w[i]
ans = min(ans, abs(a-b))
print(ans) |
p02771 | s614284949 | Wrong Answer | A = list(map(int, input().split()))
if A[0] == A[1] == A[2] or A[0] != A[1] and A[0] != A[2]:
print("No")
else:
print("Yes")
|
p02829 | s628802370 | Wrong Answer | a = int(input())
b = int(input())
if (a == 1 and b == 2) or (a == 2 and b == 2):
print(3)
elif (a == 1 and b == 3) or (a == 3 and b == 1):
print(2)
else:
print(1) |
p02995 | s011178084 | Wrong Answer | import fractions
a,b,c,d = map(int, input().split())
#print(a,b,c,d)
total = b-a+1
#print(total)
lcm = c*d / fractions.gcd(c,d)
x = (b//c) + (b//d) - (b//lcm)
y = ((a-1)//c) + ((a-1)//d) - ((a-1)//lcm)
#print(x,y)
print(total - (x - y))
|
p02801 | s740508658 | Wrong Answer | a = input()
b = chr(ord(a))
print(b) |
p03632 | s936826870 | Accepted | A,B,C,D = map(int,input().split())
if max(A,C) <= min(B,D):
print(abs(max(A,C)-min(B,D)))
else:
print(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.