problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03721 | s000469386 | Wrong Answer | N, K = map(int, input().split())
li = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
print(li)
cnt = 0
for a, b in li:
cnt += b
if cnt >= K:
print(a)
break |
p02916 | s614272951 | Wrong Answer | n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
ans=b[a[0]-1]
for i in range(1,n):
ans+=b[a[i]-1]
if a[i-1]+1 == a[i]:
ans+=c[i-1]
print(ans) |
p04033 | s967960450 | Wrong Answer | def test(a, b):
if a > 0:
return 'Positive'
if a <= 0 and b >= 0:
return 'Zero'
else:
if (b - a + 1) % 2 == 0:
return 'Positive'
else:
return 'Negative' |
p03001 | s157290586 | Accepted | W,H,x,y=map(int,input().split())
if W/2==x and H/2==y:
lst=[W*H/2,1]
else:
lst=[W*H/2,0]
print(*lst) |
p02748 | s608048060 | Wrong Answer | a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
lists = [list(map(int,input().split())) for i in range(m)]
a.sort()
b.sort()
Min = min(a) + min(b)
for x,y,c in lists:
Min = min(Min,a[x-1] + b[y-1] - c)
print(Min)
|
p02796 | s876054209 | Accepted | import sys
if __name__ == "__main__":
N = int(input())
X = []
for _ in range(N):
x, l = [int(x) for x in input().split(" ")]
X.append((x - l, x + l))
X.sort(key=lambda x: x[1])
count = 0
max_high = -sys.maxsize
for low, high in X:
if max_high <= low:
c... |
p03759 | s520765771 | Accepted | a,b,c = map(int,input().split())
print('YES' if b-a == c-b else 'NO') |
p03699 | s362902959 | Accepted | N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
total = sum(S)
if total%10 != 0:
print(total)
exit()
else:
for i in S:
if i %10 != 0:
print(total-i)
exit()
print(0) |
p02933 | s514565575 | Accepted | a = int(input())
if a<3200:
print("red")
else:
print(input()) |
p03680 | s288366780 | Wrong Answer | N = int(input())
L = []
light = [0]*N
light[0] = 1
cnt = []
for i in range(N):
a = int(input())
L.append(a)
for i in range(N):
if light[i] == 1:
if light[i] != light[L[i]-1]:
light[i], light[L[i]-1] = 0, 1
cnt.append(i)
if light[1] == 1:
print(len(set(cnt)))
... |
p02859 | s594566619 | Wrong Answer | def calc_r(r):
return r * r |
p02640 | s901142920 | Accepted | x,y=map(int,input().split())
if x==1 and x*4>=y and y%2==0 and x*2<=y:
print('Yes')
elif x*4>= y and y%2==0 and x*2<=y:
print('Yes')
else:
print('No') |
p02681 | s875533554 | Accepted | S=input()
T=input()
if len(T)-len(S)==1 and S==T[:-1]:
print('Yes')
else:
print('No') |
p03241 | s210594150 | 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,m=map(int,input().split... |
p02705 | s174042105 | Accepted | import math
R = int(input())
print(2*math.pi*R)
|
p02755 | s519336093 | Wrong Answer | from math import ceil
from math import floor
a,b = map(int,input().split())
l1 = ceil((a-0.50001)/0.08)
r1 = floor((a+0.5)/0.08)
l2 = ceil((b-0.50001)/0.1)
r2 = floor((b+0.5)/0.1)
l3 = max(l1,l2)
r3 = min(r2,r1)
if(l3<=r3):
print(l3)
else:
print(-1)
|
p03073 | s244177764 | Accepted | s = input()
z_g = 0
z_k = 0
o_g = 0
o_k = 0
for i in range(len(s)):
if i % 2 == 0:
if s[i] == "0":
z_g += 1
else:
o_g += 1
else:
if s[i] == "0":
z_k += 1
else:
o_k += 1
if (z_g + o_k) > (z_k + o_g):
print(z_k + o_g)
else:
... |
p03416 | s691002638 | Wrong Answer | a, b = map(int, input().split())
count = 0
for kk in range(a, b):
if str(kk)[0] == str(kk)[4] and str(kk)[1] == str(kk)[3]:
count += 1
print(count) |
p02697 | s333492773 | Accepted | [n,m] = list(map(int,input().split(" ")))
if m%2 == 0:
t = int(m/2)
for i in range (t):
print(i+1,2*t-i)
for i in range (t):
print(2*t+1+i,4*t+1-i)
else:
t = int(m/2)+1
for i in range (t):
print(i+1,2*t-i)
for i in range (t-1):
print(2*t+1+i,4*t-1-i)
|
p02743 | s977113810 | Accepted | a,b,c = map(int, input().split())
ans = a**2 + b**2 + c**2 - 2*(a*b + b*c + a*c)
if(c-a-b < 0):
print('No')
exit()
if(ans > 0):
print('Yes')
else:
print('No') |
p02695 | s528306630 | Wrong Answer | import numpy as np
import itertools
n,m,q = map(int, input().split())
l = [list(map(int,input().split())) for _ in range(q)]
a,b,c,d = zip(*l)
temp = np.arange(1,m+1)
A = list(itertools.combinations(temp,n))
ans=0
for L in A:
ans_temp = 0
for j in range(q):
if L[b[j]-1]-L[a[j]-1]==c[j]:
ans_temp += d[... |
p02873 | s676368474 | Accepted | s = input()
cnt = 0
ans = 0
tmp = 0
check = 0
for x in s:
cnt += 1
if x == '<':
if check != cnt - 1:
ans -= tmp * (cnt - check - 1)
tmp = 0
tmp += 1
ans += tmp
check = cnt
else:
tmp -= 1
ans += tmp
if tmp < 0:
ans +... |
p04031 | s798709073 | Wrong Answer | s=input()
for i in range(1,len(s),1):
if s[i]==s[i-1]:
print(str(i)+" "+str(i+1))
exit()
try:
if s[i-1]==s[i+1]:
print(str(i)+" "+str(i+2))
exit()
except:
pass
print(str(-1)+" "+str(-1)) |
p03986 | s865054102 | Accepted | from collections import deque
X = input()
n = len(X) # even
stack = deque([])
for char in X:
if char == 'S':
stack.append(char)
elif char == 'T' and len(stack) == 0:
stack.append('T')
elif char == 'T' and stack[-1] == 'S':
stack.pop()
elif char == 'T' and stack[-1] == 'T':
stack.append('T')
print(len(st... |
p02879 | s173399270 | Accepted | a, b = map(int,input().split())
if a <= 9 and b <= 9:
print(a*b)
else:
print(-1) |
p03836 | s894334417 | Accepted | sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
print('R' * dx + 'U' * dy + 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U' + 'U' * dy + 'R' * dx + 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R')
|
p03475 | s630395317 | Accepted | n = int(input())
csf = [list(map(int, input().split())) for _ in range(n - 1)]
for i in range(n):
t = 0
for j in range(i, n - 1):
if t < csf[j][1]:
t = csf[j][1]
else:
if t % csf[j][2] != 0:
t = (t // csf[j][2] + 1) * csf[j][2]
t += csf[j][0]
... |
p03437 | s078836388 | Accepted | x,y=map(int,input().split())
if x%y==0:
print(-1)
else:
i=2
while True:
if x*i%y!=0:
print(x*i)
break
else:
i=i+1 |
p03821 | s270570692 | Accepted | N=int(input())
AB=[list(map(int,input().split())) for i in range(N)][::-1]
count=0
for i in range(N):
AB[i][0]+=count
if AB[i][0]%AB[i][1]!=0:
count+=AB[i][1]-(AB[i][0]%AB[i][1])
print(count) |
p03013 | s815196558 | Accepted | import sys
N,M=map(int,input().split())
dp=[1]*N
listA=[]
for i in range(M):
a=int(input())
listA+=[a]
dp[a-1]=0
for i in range(1,M):
if listA[i]==listA[i-1]:
print(0)
sys.exit()
setA=set(listA)
if (1 not in setA) and (2 not in setA) and N!=1:
dp[1]=2
for i in range(2,N):
if i+1 not in setA:
... |
p02641 | s941254341 | Accepted | x, n = list(map(int, input().split()))
p_list = list(map(int, input().split()))
candidates= {}
for i in range(203):
a = x-101+i
candidates[a] = abs(x-a)
for p in p_list:
del candidates[p]
min_diff = None
ans = []
for k, v in sorted(candidates.items(), key=lambda x:x[1]):
if min_diff is None:
... |
p02608 | s184022731 | Accepted | n = int(input())
ans = [0]*(n+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
ni = x**2 + y**2 + z**2 + x*y + y*z + z*x
if ni <= n:
ans[ni] += 1
for i in range(1, n+1):
print(ans[i])
|
p02989 | s205868509 | Wrong Answer | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題:https://atcoder.jp/contests/abc126/tasks/abc132_b
n = int(input())
d = list(map(int, input().strip().split()))
for i in range(n):
for j in range(i):
if d[j] > d[j+1]:
tmp = d[j]
d[j] = d[j+1]
d[j+1] = tmp
res = d[n//2... |
p03086 | s564246739 | Wrong Answer | S = input()
ans = 0
ans_lis = [0]
for i in range(len(S)):
if S[i] in "ACGT":
ans = ans + 1
else:
ans_lis.append(ans)
ans = 0
ans_lis.append(ans)
print(max(ans_lis)) |
p03494 | s311109075 | Wrong Answer | nn = int(input())
dd = list(map(int,input().split()))
nof_op = 0
finish = 1
while True:
for ind in range(nn):
if (dd[ind] % 2) == 1:
finish = 1
break
else:
dd[ind] = dd[ind] / 2
if finish == 1:
break
else:
nof_op += 1
print(nof_op) |
p03360 | s842028073 | Accepted | a,b,c = map(int,input().split())
k = int(input())
tmp = max(a,b,c)
for i in range(k):
tmp *= 2
ans = a + b + c + tmp - max(a,b,c)
print(ans) |
p02773 | s721455125 | Wrong Answer | #coding:utf-8
n = int(input())
dic = {}
for _ in range(n):
key = input()
if key in dic:
dic[key] += 1
else:
dic[key] = 1
max_key = max(dic)
max_v = dic[max_key]
li = []
for key in dic:
if max_v == dic[key]:
li.append(key)
li.sort()
for v in li:
print(v) |
p03250 | s172545287 | Accepted | def main():
abc = list(map(int, input().split()))
abc.sort(reverse=True)
ans = int(str(abc[0]) + str(abc[1])) + abc[2]
print(ans)
if __name__ == "__main__":
main()
|
p02848 | s991212034 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(input())
s=input()
al = list(chr(ord('A') + i) for i in range(26))
l=[]
for j in s:
l.append(al[(al.index(j)+n)%26])
print(''.join(l))
resolve() |
p03433 | s351702980 | Accepted | n = int(input())
a = int(input())
print('Yes' if (n % 500) <= a else 'No') |
p03309 | s371685055 | Accepted | n = int(input())
a = list(map(int,input().split()))
l = [a[i]-i-1 for i in range(n)] # ai - iのリスト
b = sorted(l)[n//2] # bは中央値になる
ans = 0
for i in range(n):
ans += abs(l[i]-b)
print(ans) |
p03387 | s871248164 | Accepted | a,b,c = map(int,input().split())
d = max(a,b,c)
p = (d-a)+(d-b)+(d-c)
if p % 2 != 0:
p += 3
print(p // 2) |
p03437 | s437367630 | Accepted | x, y = map(int, input().split())
if x==y or x%y==0:
print(-1)
else:
for i in range(2, 10**9):
if (x*i)%y!=0:
print(x*i)
import sys
sys.exit()
print(-1) |
p03417 | s575132076 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def main():
n, m = map(int, input().split())
if n == 1 and m == 1: ans = 0
elif m == 1: ans = n - 2
elif n == 1: ans = m - 2
else: ans = (m - 2) * (n - 2)
print(ans)
if __name__ == "__main__":
main()
|
p02988 | s629121553 | Accepted | n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1, n-1):
if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
count += 1
print(count)
|
p02797 | s545969298 | Accepted | #import collections
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
a, b = map(int, input().split())
A.append(a)
B.append(b)'''
#import copy
#import numpy as np
n, k, s = map(int, input().split())
ans = [s+1 if s != 10**9 else 1... |
p03323 | s529514754 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
A, B = map(int, input().split())
print('Yay!'if A <= 8 and B <= 8 else ':(')
if __name__ == "__main__":
main()
|
p03160 | s989178969 | Accepted |
N = int(input())
h = list(map(int,input().split()))
DP = [10**9]*N
DP[0] = 0
DP[1] = abs(h[1]-h[0])
for i in range(2,N):
DP[i] = min(DP[i],DP[i-2]+abs(h[i]-h[i-2]))
DP[i] = min(DP[i],DP[i-1]+abs(h[i]-h[i-1]))
print(DP[-1]) |
p02548 | s278610505 | Accepted | N=int(input())
ans=0
for b in range(1,N):
ans+=(N-1)//b
print(ans) |
p03494 | s958881694 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt = 100000
for i in a:
j = 0
k = i
while k % 2 == 0:
j += 1
k /= 2
cnt = min(cnt, j)
print(cnt)
|
p02677 | s737226085 | Wrong Answer | import math
a,b,h,m = [int(x) for x in input().split(' ')]
rad_hour = math.pi * 2 * (h/12)
rad_min = math.pi * 2 * (m/60)
rad = max(rad_hour, rad_min) - min(rad_hour, rad_min)
x = (math.pow(a,2) + math.pow(b,2) - (2*a*b*math.cos(2*math.pi - rad)))
print(math.sqrt(x)) |
p02988 | s875357967 | Accepted | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
ans += 1
print(ans)
|
p02690 | s454865840 | Accepted | X = int(input())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
Y = make_divisors(X)
for i in Y:
for j in range(-1000,1000):
A = j
... |
p03796 | s009949166 | Accepted | N = int(input())
ans = 1
for i in range(1,N+1):
ans = ((ans%(1000000007)) * i) % 1000000007
print(ans) |
p03103 | s245892754 | Accepted | import sys
N, M = map(int, input().split())
AB = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(N)]
AB.sort()
res = 0
for a, b in AB:
if M > b:
M -= b
res += a * b
else:
res += a * M
break
print(res)
|
p03328 | s821042425 | Accepted | a, b = map(int, input().split())
for n in range(999):
if n*(n+1)/2 - a == (n+1)*(n+2)/2 - b:
print(int(n*(n+1)/2 - a))
|
p03324 | s734961346 | Wrong Answer | from math import floor
D, N = map(int, input().split())
print((N-floor((N-1)/99))*100**D)
|
p03827 | s286683646 | Wrong Answer | n = int(input())
s = list(input())
x = 0
ans = []
for i in s:
if i == 'I':
x += 1
if i == 'D':
x -= 1
ans.append(x)
print(max(ans)) |
p03803 | s063776957 | Accepted | def main():
alice, bob = map(int, input().split())
answer = ""
if alice == bob:
answer = "Draw"
elif alice == 1 or (alice > bob and not bob == 1):
answer = "Alice"
else:
answer = "Bob"
print(answer)
if __name__ == '__main__':
main()
|
p02767 | s482173643 | Accepted | n = int(input())
x = list(map(int, input().split()))
ave = sum(x)/n
p = round(ave)
res = 0
for i in x:
res += (i -p )**2
print(res) |
p02910 | s391636519 | Accepted | S= str(input())
S=list(S)
for i in range(len(S)):
if i%2==0:
if S[i] not in ('R','U','D'):
print('No')
exit()
if i%2!=0:
if S[i] not in ('L','U','D'):
print('No')
exit()
print('Yes')
|
p02683 | s153169308 | Wrong Answer | import sys
N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]
for i in range(1<<N): #Bit All Search
l=[0]*(M+1)
for j in range(N):
if((i>>j)&1)==1:
l=[l[k]+A[j][k] for k in range(M+1)]
for k in range(M):
if l[k+1]<X:bre... |
p03427 | s768186560 | Accepted | N = int(input())
a = 0
b = 0
while N > 0:
if N < 10:
c = N
break
if N % 10 != 9:
b = 1
N //= 10
a += 1
if b == 1:
c -= 1
ans = c + a * 9
print(ans)
|
p02771 | s528428553 | Accepted | a,b,c = map(int,input().split())
if a == b and b == c and c == a:
print('No')
elif a != b and b != c and c != a:
print('No')
else:
print('Yes')
|
p02787 | s581784945 | Accepted | n,m=map(int, input().split())
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
if i>0:
dp[i]=min(dp[i-a]+b for a,b in s)
print(min(dp[n:]))
|
p02556 | s624018223 | Wrong Answer | n = int(input())
l=[]
for i in range(n):
l.append(list(map(int,list(input().split()))))
l.sort()
m = sorted(l,key = lambda y:y[1])
x,y=0,0
for i in range(1,n):
p = abs(l[i][0]-l[0][0])+abs(l[i][1]-l[0][0])
if p>x:
x=p
q = abs(m[i][0]-m[0][0])+abs(m[i][1]-m[0][0])
if q>y:
y=q
print(max(x,y)) ... |
p02690 | s720024513 | Accepted | x=int(input())
f=0
for i in range(1000):
for j in range(-1000,1000):
if (i**5-j**5)==x:
print(i,j)
f=1
if f==1:
break
|
p02696 | s466821478 | Wrong Answer | A,B,N = map(int,input().split(" "))
max_floor = 0
for x in range(N+1):
floor_x = int(A*x/B) -A*int(x/B)
if max_floor < floor_x:
max_floor = floor_x
print(floor_x)
|
p03624 | s071502373 | Wrong Answer | S=input()
L=("a","b","c","d","e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z")
for l in L:
if S.count(l)>0:
pass
else:
print(l)
else:
print("None") |
p03627 | s816731022 | Wrong Answer | n=int(input())
a=list(map(int, input().split()))
from collections import Counter
c=Counter(a)
ans_1=0
ans_2=0
for key in c:
if c[key]>=4 and key>ans_1:
ans_1,ans_2=key,key
elif c[key]>=4 and key>ans_2:
ans_2=key
elif c[key]>=2 and key>ans_2:
ans_1,ans_2=key,ans_1
print(ans_1*ans_2... |
p03000 | s633767480 | Accepted | N,X=map(int,input().split())
L=list(map(int,input().split()))
cum,count=0,1
for l in L:
cum+=l
if cum<=X:count+=1
print(count) |
p02994 | s334291522 | Accepted | N, L = map(int, input().split())
t = sorted(list(range(L, L+N)), key=abs)
print(sum(t[1:])) |
p03623 | s201942745 | Accepted | x, a, b = map(int, input().split())
da = abs(x-a)
db = abs(x-b)
print("A" if da < db else "B") |
p03696 | s122391245 | Wrong Answer | from itertools import accumulate
N = int(input())
S = input()
SS = [1 if S[i]=='(' else -1 for i in range(N)]
SSS = list(accumulate(SS))
m = -min(SSS)
M = max(SSS)
print('('*m+S+')'*(M-m))
|
p02693 | s373747772 | Accepted | k=int(input())
a,b=map(int,input().split())
i=1
while k*i<=b:
if a<=k*i:
print('OK')
exit(0)
i+=1
print('NG')
|
p02718 | s896391166 | Accepted | val1 = input().split()
val2 = input().split()
total = 0
for votes in val2:
total += int(votes)
thres = total * 1/4 / int(val1[1])
i = 0
for votes in val2:
if int(votes) >= thres:
i += 1
if i >= int(val1[1]):
print("Yes")
else:
print("No")
|
p02711 | s828220464 | Accepted | N=input()
if N[0]=='7' or N[1]=='7' or N[2]=="7":
print("Yes")
else:
print("No")
|
p03720 | s287160069 | Wrong Answer | N, M = map(int, input().split())
ans = 0
#最後にNoneを消す。あとはsetで重複を消す。
roads_memo = [[None] for i in range(N)]
for _ in range(M):
ai, bi = map(int, input().split())
roads_memo[ai-1].append(bi)
roads_memo[bi-1].append(ai)
for memo in roads_memo:
del memo[0]
memo = set(memo)
print(len(memo))
|
p02707 | s114024173 | Accepted | N = int(input())
A = list(map(int,input().split()))
buka = [0] * N
for i in A:
buka[i-1] += 1
for j in range(N):
print(buka[j]) |
p02603 | s089597814 | Accepted | def main():
n = int(input())
a = list(map(int, input().split()))
money = 1000
have = 0
for i in range(len(a)-1):
if a[i] < a[i+1]:
have += money // a[i]
money -= a[i] * (money // a[i])
elif a[i] > a[i+1]:
money += a[i] * have
have ... |
p02681 | s635410240 | Wrong Answer | s = input()
t = input()
if s == t[:-1]:
print('yes')
else:
print('no')
|
p03161 | s828059991 | Accepted | n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [1000000000 for i in range(n)]
dp[0] = 0
for i in range(n):
for j in range(k+1):
if i+j<n:
dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])
print(dp[n-1]) |
p03815 | s935180779 | Wrong Answer | x = int(input())
c = 2 * (x // 11)
if x - 11 * (x // 11) > 5:
c += 2
else:
c += 1
print(c)
|
p03639 | s050587557 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
num_four = 0
num_two = 0
num_odd = 0
for i in range(N):
if A[i] % 4 == 0:
num_four += 1
elif A[i] % 2 == 0:
num_two += 1
else:
num_odd += 1
# print(num_four, num_two, num_odd)
v = num_four * 3
if num_two in [2, 3]:
v += num_... |
p02785 | s550061068 | Accepted | n, k = map(int, input().split())
h = list(map(int, input().split()))
monster = sorted(h, reverse=True)
surviver = monster[k:len(monster)]
print(sum(surviver)) |
p02996 | s790078430 | Wrong Answer | n = int(input())
time=0
alist=[]
ans='Yes'
for i in range(n):
a,b=map(int, input().split())
alist.append([a,b-a])
if b<a:
ans='No'
alist.sort(key=lambda x: x[1])
time=0
for i in range(n):
if time>alist[i][1]:
ans='No'
time+=alist[i][0]
print(ans) |
p03795 | s884041172 | Wrong Answer | import math
N = int(input())
print(math.factorial(N) % (10**9+7)) |
p02754 | s684631501 | Wrong Answer | a,b,c = map(int,input().split())
l= []
while(len(l)<=a):
for _ in range(b):
l.append(1)
for _ in range(c):
l.append(0)
print(l[:8].count(1)) |
p02600 | s279558641 | Accepted | import sys
readline = sys.stdin.readline
X = int(readline())
limit = 600
rank = 8
for i in range(8):
if X < limit:
print(rank)
break
limit += 200
rank -= 1 |
p03711 | s544467597 | Accepted | x, y = map(int, input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
if (x in l1 and y in l1) or (x in l2 and y in l2):
print('Yes')
else:
print('No') |
p02854 | s145470978 | Accepted | n = int(input())
a = list(map(int, input().split())) # 横入力
x = [0]
aaa = 0
for i in range(n):
aaa += a[i]
x.append(aaa)
aa = sum(a)
y = [aa]
for i in range(n):
aa -= a[i]
y.append(aa)
ans = 202020202020
for i in range(n+1):
ans = min(ans, abs(x[i] - y[i]))
print(ans) |
p03774 | s648242455 | Wrong Answer | n,m = list(map(int,input().strip().split()))
# 2次元配列
student = []
for i in range(n):
array = list(map(int, input().strip().split()))
student.append(array)
cp = []
for i in range(m):
array = list(map(int, input().strip().split()))
cp.append(array)
result = [0] * n
for i in range(n):
dis_min = 10**8
... |
p02963 | s780435884 | Accepted | def main():
S = int(input())
x1, y1 = (0, 0)
x2, y2 = (10**9, 1)
x3 = (x2 - S%x2)%x2
y3 = (S+x3)//x2
print(x1, y1, x2, y2, x3, y3)
if __name__ == "__main__":
main() |
p03817 | s456255511 | Wrong Answer | x = int(input())
c = x // 11
m = x % 11
cnt = 2 * (c + 1)
if m == 0:
cnt -= 2
elif m < 6:
cnt -= 1
print(cnt)
|
p03544 | s360421663 | Accepted | N=int(input())
L=[2,1]
ans=0
for i in range(N):
ans=L[i]+L[i+1]
L.append(ans)
print(L[N]) |
p02916 | s591355255 | Accepted | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
cnt = 0
for i in range(N):
cnt += B[A[i]-1]
if i > 0 and ( A[i-1] + 1 ) == A[i]:
cnt += C[A[i-1]-1]
print(cnt) |
p03817 | s965619693 | Accepted | x = int(input())
if x <= 6:
print(1)
exit()
a = x // 11
sum = 11 * a
i = 2 * a
if sum < x:
if x - sum > 6:
i += 1
i += 1
print(i) |
p03061 | s783478055 | Wrong Answer | import fractions
num = int(input())
numarray = [int(i) for i in input().split(" ")]
num_gcd_max = 1
result_f = numarray[:] + [0]
result_t = [0] + numarray[:]
for i in range(num):
result_f[num-i-1] = fractions.gcd(result_f[num-i], result_t[num-i])
result_t[i+1] = fractions.gcd(result_t[i], result_t[i+1])
gcd_r... |
p03994 | s401713115 | Accepted | s = list(input())
k = int(input())
for i, c in enumerate(s):
t = (ord("z") - ord(c) + 1) % 26
if k >= t:
s[i] = "a"
k -= t
t = k % 26
s[-1] = chr(ord(s[-1]) + t)
print("".join(s)) |
p04045 | s695599306 | Accepted | n, k = map(int, input().split())
d = set(input().split())
for i in range(n, 10*n):
for c in str(i):
if c in d:
break
else:
print(i)
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.