problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03592 | s997366339 | Wrong Answer | import sys
n, m, k = map(int, input().split())
for i in range(n+1):
for j in range(m+1):
if i*(n-j)+(m-i)*j == k:
print('Yes')
sys.exit()
print('No')
|
p02743 | s507766505 | Accepted | a,b,c=map(int,input().split())
if (4*a*b)<(c-a-b)**2 and c-a-b>0: print('Yes')
else: print('No') |
p02761 | s594894142 | Accepted | N, M = map(int, input().split())
if N > 1:
number = [1] + [0] * (N-1)
else:
number = [0]
SC = {}
for _ in range(M):
s, c = map(int, input().split())
if SC.get(s, c) != c:
print(-1)
exit()
if N >= 2 and (s == 1 and c == 0):
print(-1)
exit()
number[s-1] = c
SC[s... |
p02880 | s222646835 | Wrong Answer | N=int(input())
resurt=''
for i in range(1,10):
if N%i ==0 and N//i<=9:
result='Yes'
else:
result='No'
print(result)
|
p02832 | s331418000 | Accepted | n=int(input())
*a,=map(int,input().split())
l=1
cnt=0
if 1 in a:
for i in a:
if i==l:
cnt+=1
l+=1
print(n-cnt)
else:
print(-1)
|
p02677 | s041331548 | Accepted | import math as m
A,B,H,M=list(map(int,input().split()))
print(m.sqrt(A**2+B**2-2*A*B*m.cos(m.radians(30*H-11*M/2)))) |
p03632 | s343898233 | Wrong Answer | a, b, c, d = map(int, input().split())
print(max(max(b, d) - min(a, c), 0)) |
p03679 | s454832680 | Accepted | x, a, b = map(int, input().split())
if a >= b:
print("delicious")
elif a + x >= b:
print("safe")
elif a + x < b:
print("dangerous")
|
p03161 | s533725262 | Accepted | n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**9] * n
dp[0] = 0
for i in range(1,n):
for j in range(max(0,i-k),i):
dp[i] = min(dp[j] + abs(h[i] - h[j]), dp[i])
print(dp[-1]) |
p02633 | s677353022 | Accepted | import math
def main():
x = int(input())
print(360 // math.gcd(360, x))
main()
|
p03131 | s636153966 | Wrong Answer | k, a, b = map(int, input().split())
if a >= b-1:
print(k+1)
else:
if k <= a:
print(k+1)
else:
if k-a % 2 == 1:
print((k-a)//2*(b-a)+a)
else:
print((k-a)//2*(b-a)+a+1)
|
p04043 | s692869256 | Wrong Answer | a = list(map(int, input().split()))
print("Yes" if a[0]== a[2] == 5 and a[1] == 7 else "No") |
p04034 | s386654208 | Wrong Answer | N,M = map(int,input().split())
lisN = [0] + [1]*N
ansSet = set([1])
for _ in range(M):
# print(ansSet,lisN)
x,y = map(int,input().split())
if x in ansSet:
ansSet.add(y)
lisN[x] -= 1
lisN[y] += 1
for i,v in enumerate(lisN):
if v == 0:
ansSet.discard(i)
print(len(ansSet... |
p03338 | s019430824 | Accepted | import collections
N = int(input())
S = input()
ans=0
for i in range(1, N):
s = S[:i]
t = S[i:]
# print(s, t)
s1 = set(s)
t1 = set(t)
# print(s1, t1)
c = collections.Counter(s1&t1)
ans = max(ans, len(c))
print(ans) |
p02742 | s617154403 | Accepted | H, W = map(int, input().split())
if H == 1 or W == 1:
print("1")
elif H * W % 2 == 0:
print(H * W // 2)
else:
print(H * W // 2 + 1) |
p02718 | s934757442 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def main():
n, m = map(int, input().split())
A = list(map(int, input().split()))
num = 0
s = sum(A)
for a in A:
if a >= s / (m * 4):
num += 1
if num >= m:
print("Yes")
else:
print("No")
if __... |
p03760 | s571223222 | Accepted | odd = input()
even = input()
for i in range(len(even)):
print(odd[i] + even[i], end = "")
print((odd[-1] if len(odd) - len(even) else ""))
|
p03478 | s329055702 | Wrong Answer | n,a,b = map(int, input().split())
sum = 0
for i in range(10):
for j in range(10):
if 10*i+j <= n and a<=i+j and i+j<=b :
sum += 10*i + j
print(sum) |
p02658 | s201800879 | Wrong Answer | a = 1
N = int(input())
s = list(map(int, input().split()))
if 0 in s :
print(0)
else :
for i in range(N) :
if a>10E+17 :
print(-1)
break
else :
a = a*s[i]
if a>10E+17 :
print("-1")
else :
print(a)
|
p03814 | s717222874 | Wrong Answer | a = input("")
a_num = a.index("A")
for i in range(len(a)-1,-1,-1):
if a[i]=="Z":
z_num = i+1
break
print("num:" + str(len(a[a_num:z_num])) + \
"text:" + a[a_num:z_num]) |
p02582 | s778262738 | Accepted | s = input()
ans = 0
t = 0
for c in s:
if c == "R":
t += 1
else:
ans = max(ans, t)
t = 0
ans = max(ans, t)
print(ans)
|
p03284 | s814047348 | Accepted | n,k=map(int,input().split())
if n>1:
if n%k==0:
print("0")
else:print("1")
if n==1:
print("0")
|
p03221 | s327850505 | Wrong Answer | N,M=map(int,input().split())
P=[[x] for x in range(N)]
for _ in range(M):
p,y=map(int,input().split())
P[p-1].append(y)
code=[]
for i in range(N):
temp=sorted(P[i][1:])
for j in range(len(temp)):
code.append(str(i+1).zfill(6)+str(j+1).zfill(6))
code.sort()
for c in code:
print(c) |
p02897 | s184012158 | Accepted | n = float(input())
even_num = n // 2;
num = n - even_num
print(num/n)
|
p03545 | s103575800 | Wrong Answer | X = list(map(int,list(input())))
for i in range(2**3+1):
ans =[]
for j in range(3):
d = X[j+1]*(-1)**((i >>j)&1)
ans.append(d)
if sum(ans) == 7:
print(X[0],end="")
for i,a in enumerate(ans):
if a>=0 and i>0:
print("+",end="")
print(a,end="")
print("=7")
exit() |
p02873 | s334402991 | Wrong Answer | S=input()
N = len(S) + 1
ary = [0] * N
for i in range(N-1):
if S[i] == "<":
ary[i+1] = ary[i] + 1
for i in range(N-2,0,-1):
if S[i] == ">":
ary[i] = max(ary[i], ary[i+1] + 1)
print(sum(ary)) |
p03284 | s532946835 | Wrong Answer | N,K=map(int,input().split())
print(N%K) |
p03160 | s213473728 | Accepted | N = int(input())
h = list(map(int,input().split()))
dp = [0] * (N + 1)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1]) |
p02953 | s446362403 | Accepted | def resolve():
n = int(input())
h = list(map(int, input().split()))
flag = 0
for i in range(n-1):
if h[i] == h[i+1]:
continue
else:
h[i+1] -= 1
if h[i] <= h[i+1]:
continue
else:
print("No")
ex... |
p03360 | s438450644 | Accepted | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [... |
p02780 | s988478317 | Accepted | n, k = map(int, input().split())
ps = list(map(int, input().split()))
cur = 0
for i in range(k):
cur += ps[i] + 1
mx = cur
for i in range(n-k):
j = i+k
cur += -ps[i] + ps[j]
mx = max(mx, cur)
print(mx / 2)
|
p03720 | s610349538 | Accepted | N,M=map(int,input().split())
graph=[[] for _ in range(N)]
for _ in range(M):
a,b=map(int,input().split())
a-=1
b-=1
graph[a].append(b)
graph[b].append(a)
for i in range(N):
print(len(graph[i])) |
p02676 | s673780006 | Accepted | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]
def solve():
K = IS(int)
S = IS(str)
... |
p02922 | s966164878 | Wrong Answer | A, B = [int(i) for i in input().split()]
result = 1
require_socket = B - A
if B == 1:
print(0)
else:
result += require_socket // A
if (require_socket / A).is_integer() is False:
result += 1
print(result) |
p03759 | s727486299 | Wrong Answer | S_list = list(map(int,input().split()))
if S_list[1] - S_list[0] == S_list[2] - S_list[1]:
result = "YES"
else:
result = "No"
print(result)
|
p02971 | s861272658 | Accepted | N = int(input())
A = [int(input()) for _ in range(N)]
sort_A = sorted(A, reverse=True)
max_value = sort_A[0]
second_value = sort_A[1]
ans = []
for a in A:
if a < max_value:
ans.append(max_value)
elif a == max_value:
ans.append(second_value)
print(*ans, sep='\n')
|
p03861 | s103856390 | Accepted | a, b, x = map(int,input().split())
a_divmod = divmod(a, x)
if a_divmod[1] != 0:
print(b//x - a_divmod[0])
else:
print(b//x - a_divmod[0] + 1) |
p03836 | s310283619 | Wrong Answer | sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
for k in range(y):
print("u")
for k in range(x+1):
print("r")
for k in range(y+1):
print("d")
for k in range(x+1):
print("l")
print("u")
print("l")
for k in range(y+1):
print("u")
for k in range(x+1):
print("r")
for k in range(y+1):
print(... |
p02659 | s005904298 | Wrong Answer | import math
val = list(input().split())
ans = float(val[0]) * float(val[1])
print(int(ans)) |
p02546 | s230531987 | Wrong Answer | s = input()
if s[-1] == "s":
print(s+"s")
else:
print(s+"es") |
p02659 | s732220105 | Wrong Answer | N,M = map(float,input().split())
import math
from decimal import *
print(math.floor(Decimal(N*M))) |
p03705 | s000514521 | Accepted | N,A,B=map(int,input().split())
if A>B:
print(0)
elif N==1 and A!=B:
print(0)
else:
print((N-2)*(B-A)+1) |
p03274 | s406860180 | Accepted | n,k = map(int,input().split())
x = list(map(int,input().split()))
times = []
for i in range(n-k+1):
tl =abs(x[i])
tr = abs(x[i+k-1])
tw = abs(x[i]-x[i+k-1])
times.append(min(tl,tr)+tw)
print(min(times)) |
p02922 | s774117131 | Accepted | a, b = map(int, input().split())
for i in range(20):
if a*i-(i-1) >= b:
print(i)
break |
p02613 | s832534321 | Accepted | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = str(input())
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s == 'TLE':
tle += 1
else:
re += 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re)) |
p03659 | s238086758 | Accepted | import sys
input = sys.stdin.readline
def main():
N = int(input())
a = list(map(int, input().split()))
S = [0] * N
S[0] = a[0]
for i in range(N - 1):
S[i + 1] = S[i] + a[i + 1]
ans = float("inf")
for i in range(N - 1):
x = S[i]
y = S[-1] - x
cost = abs(x ... |
p02777 | s261977358 | Wrong Answer | s,t=input().split()
a,b=map(int,input().split())
u=input()
if len(u)==len(s):
print(a-1, b)
else:
print(a, b-1)
|
p02640 | s387560921 | Accepted | n, m = map(int, input().split())
if m % 2 == 0 and n * 2 <= m <= n * 4:
print("Yes")
else:
print("No") |
p02793 | s992988823 | Accepted | from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
ans=0
for x in a:
ans+=lcm//x
print(ans%mod) |
p03131 | s894853951 | Wrong Answer | K, A, B = map(int, input().split())
if(B-A <= 2):
print(K+1)
else:
m = max(0, K-(A-1)//2)*(B-A)+(K+1)-2*max(0, K-(A-1)//2)
print(m) |
p03001 | s984577365 | Accepted | w, h, x, y = list(map(int, input().split()))
flag = 0
if x * 2 == w and y * 2 == h:
flag = 1
print(w * h / 2, flag) |
p03475 | s660261449 | Accepted | import sys
readline = sys.stdin.readline
import math
def main():
N = int(readline())
CSF = [list(map(int, readline().rstrip().split())) for _ in range(N-1)]
for i in range(N):
t = 0
for c, s, f in CSF[i:]:
m = (t - s) / f
m = max(math.ceil(m), 0)
t =... |
p02708 | s442553732 | Accepted | # D - Sum of Large Numbers
n, k = map(int, input().split())
modulus = 10 ** 9 + 7
s = 0
# m個選ぶ
for m in range(k, n + 2):
s += (m * (n - m + 1) + 1) % modulus # 最小から最大までの個数
print(s % modulus)
|
p03475 | s846271182 | Accepted | n = int(input())
c = []
s = []
f = []
for _ in range(n-1):
ci, si, fi = map(int, input().split())
c.append(ci)
s.append(si)
f.append(fi)
for i in range(n):
t = 0
for j in range(i, n-1):
if (t < s[j]):
t = s[j]
elif (t % f[j] == 0):
pass
else:
t = t + f[j] ... |
p02618 | s580863196 | Accepted | d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
cand=0
for j in range(26):
if s[i][cand]<s[i][j]:
cand=j
print(cand+1) |
p03077 | s226203001 | Accepted | import math
n = int(input())
a = []
for i in range(5):
a.append(int(input()))
mi = min(a)
ans = 5
ans += math.ceil((n-mi)/mi)
print(ans) |
p03438 | s931145850 | Accepted | import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_A = sum(A)
sum_B = sum(B)
cnt1 = sum_B - sum_A
cnt2 = 0
for a, b in zip(A, B):
# if a > b:
# cnt2 += a - b
if a < b:
cnt2 += math.ceil((b - a) / 2)
if cnt1 >= cnt2:
print("Yes")
else:
... |
p02645 | s874116504 | Accepted | print(input()[:3]) |
p03416 | s214302585 | Accepted | a, b = map(int, input().split())
l = [str(i) for i in range(a,b+1)]
ans = 0
for i in l:
if i[0] == i[4]:
if i[1] == i[3]:
ans += 1
print(ans)
|
p02701 | s144765327 | Accepted | N = int(input())
Ss = [input() for _ in range(N)]
set_s = set(Ss)
print(len(set_s))
|
p02802 | s826620611 | Wrong Answer | n,m=map(int,input().split())
l=list(input().split() for i in range(m))
l=[[int(i[0]),i[1]] for i in l]
count=[[i+1,0,0,1] for i in range(n)]
ans=0
pen=0
for i in l:
for j in count:
if i[0]==j[0]:
if j[3]==1:
if i[1]=='WA':
pen+=1
else:
ans+=1
j[3]*=0
print(an... |
p03721 | s849046048 | Accepted | N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A = sorted(A,key=lambda x:x[0])
cnt = 0
i = 0
while K>cnt:
cnt += A[i][1]
i += 1
print(A[i-1][0]) |
p03150 | s998108300 | Accepted | s = input()
n = len(s)
for i in range(n):
for j in range(i, n + 1):
if s[:i] + s[j:] == 'keyence':
print('YES')
exit(0)
print('NO') |
p03359 | s238856595 | Accepted | a, b = map(int, input().split())
if a <= b:
print(a)
else:
print(a-1) |
p03457 | s028376400 | Accepted | 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()))
n = ii()
flag = True
for i in range(n):
t,x,y = iim()
if x+y > t or t%2 != (x+y)%2:
flag = Fal... |
p02571 | s479793181 | Accepted | S = input()
T = input()
MIS = len(S)
for TS in range(0,len(S)-len(T)+1):
LS = S[TS:TS+len(T)]
Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T)))
MIS = min(MIS,Count)
print(MIS) |
p02683 | s126069773 | Accepted | N, M, X = map(int,input().split())
C = list()
A = list()
for i in range(N):
temp = list(map(int,input().split()))
C.append(temp[0])
A.append(temp[1:])
MAX = 100000000000
def func(cost,a,i):
if min(a) >= X:
return cost
elif i == N:
return MAX
total_A = [x+y for (x,y) in zip(a,A[i])]
return min(func... |
p02731 | s083517148 | Accepted | L=int(input())
x=L/3
v=x**3
print(v) |
p03377 | s774308374 | Accepted | A, B, X = map(int, input().split())
print('YES' if A <= X <= (A+B) else 'NO') |
p02678 | s398216244 | Accepted | from collections import deque
n,m = map(int,input().split())
graph = [[] for _ in range(n+1)]
for i in range(m):
a,b = map(int,input().split())
graph[a].append(b)
graph[b].append(a)
ans = [-1 for _ in range(n+1)]
ans[1] = 0
q = deque()
q.append(1)
while q:
x = q.popleft()
for y in graph[x]:
... |
p03041 | s415338176 | Accepted | n, k = map(int, input().split())
s = input()
s = s[ :k -1] + chr(ord(s[k - 1]) - ord("A") + ord("a")) + s[k:]
print(s) |
p02647 | s635529149 | Accepted | n,k=[int(j)for j in input().split()]
a=[int(j)for j in input().split()]
if n<=k:
print(*[n]*n)
exit()
import copy
for _ in range(k):
table=[0]*n
for i in range(n):
table[max(i-a[i],0)]+=1
if i+a[i]+1<n:
table[i+a[i]+1]-=1
for i in range(1,n):
table[i]+=table[i-1]
... |
p03250 | s763128423 | Wrong Answer | A,B,C = input().split()
m = max(eval(A+B+"+"+C),eval(A+"+"+B+C))
print(m)
|
p03437 | s360438501 | Wrong Answer | X, Y = map(int, input().split())
if Y % X == 0:
print(-1)
exit(0)
i = 2
while X * i <=10 ** 18:
if X * i % Y != 0:
print(X * i)
exit(0)
print(-1) |
p02718 | s094698776 | Wrong Answer | import math
N,M = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
l_sum = sum(l)
d = (1/(4*M))*l_sum
d = int(d)
cnt = 0
for i in range(N):
if l[i] > d:
cnt += 1
else:
break
if cnt >= M:
print("Yes")
else:
print("No") |
p02861 | s682067049 | Wrong Answer | import itertools
import math
N = int(input())
ll = list()
for n in range(N):
l = list(map(int, input().split()))
ll.append(l)
p = list()
for i in range(N):
p.append(i)
p = itertools.permutations(p)
total = 0
for i in p:
for s in i:
if s == len(i) - 2:
total += math.sqrt((ll[s + 1][0... |
p02729 | s847641794 | Accepted | a,b = map(int,input().split())
ans = int((a*(a-1))/2+(b*(b-1)/2))
print(ans) |
p02647 | s531432330 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
def imos(n,a):
imos_l=[0 for i in range(n)]
for i in range(n):
x=i
x_left=max(x-a[i],0)
x_right=min(x+a[i],n-1)
imos_l[x_left]+=1
if (x_right+1)!=n:
imos_l[x_right+1]-=1
b=[0]
for i in range(1,n+1):
b.append(imos_l[i... |
p02645 | s044902112 | Accepted | S = input()
print(S[:3])
|
p03695 | s833768611 | Accepted | N = int(input())
A = list(map(int,input().split()))
L = []
H = []
for i in range(N):
a = A[i]//400
if a > 7:
H.append(a)
else:
L.append(a)
if len(L) != 0:
print(str(len(set(L)))+" "+str(len(set(L))+len(H)))
else:
print("1 "+str(len(H))) |
p03281 | s914655999 | Wrong Answer | print(3) |
p02792 | s335678021 | Accepted | N=int(input())
#print#(N)
D={}
for i in range(1,N+1):
I=str(i)
if (I[-1],I[0]) not in D:
D[(I[-1],I[0])]=1
else:
D[(I[-1],I[0])]+=1
#print(D)
ans=0
for j in range(1,N+1):
J=str(j)
if (J[0],J[-1]) in D:
ans+=D[(J[0],J[-1])]
print(ans) |
p02963 | s633813501 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
def solve():
S = int(rl())
x1, y1 = 0, 0
x2, y2 = 1000000000, 1
x3 = (x2 - S % x2) % x2
y3 = (S + x3) // x2
print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))
if __name__ == '__main__':
solve()
|
p02831 | s867252256 | Accepted | import math
A, B = map(int, input().split())
# 最小公倍数
g = int(A * B / math.gcd(A, B))
print(g) |
p03612 | s561492620 | Accepted | n = int(input())
p = list(map(int, input().split()))
index = 0
cnt = 0
while index < n:
if p[index] == index + 1:
cnt += 1
index += 2
else:
index += 1
print(cnt)
|
p02765 | s285894924 | Wrong Answer | a,b = map(int,input().split())
if a >= 10:
print(b)
else :
print(b + a*100) |
p03994 | s656342270 | Wrong Answer | def main():
s = list(input())
k = int(input())
for i in range(len(s)-1):
mod = 26-(ord(s[i])-97)%26
if k >= mod:
k -= mod
s[i] = 'a'
if k == 0:
break
if k > 0:
mod = ((ord(s[-1])-97)+k)%26
s[-1] = chr(mod+97)
print(''.... |
p02797 | s610612264 | Wrong Answer | n, k, s = map(int, input().split())
a = [10**10] * n
for i in range(k):
a[i] = s
print (*a) |
p03910 | s090125526 | Accepted | n = int(input())
total = 0
for i in range(1, n+1):
total += i
if total >= n:
for j in range(1, i+1):
if j != total-n:
print(j)
exit()
|
p02790 | s437100780 | Accepted | a,b = map(int,input().split())
ans = ""
k = min(a,b)
l = max(a,b)
for i in range(l):
ans += str(k)
print(ans) |
p02720 | s120882884 | Wrong Answer | from collections import deque
K = int(input())
que = deque()
que.extend([i for i in range(1,10)])
for k in range(K-2):
out = que.popleft()
div = out%10
if div==0:
que.extend([out*10,out*10+1])
elif out%10==9:
que.extend([out*10+8,out*10+9])
else:
que.extend([out*10-1+div,out... |
p03345 | s387875797 | Wrong Answer | def invr():
return(map(int, input().split()))
A, B, C, K = invr()
a = B + C
b = A + C
c = A + B
res = a - b
if K == 0:
res = A - B
if abs(res) > 1000000000000000000:
print("Unfair")
else:
print(res)
|
p03208 | s213844545 | Accepted | n, k = map(int, input().split())
apple = []
orange = []
for _ in range(n):
apple.append(int(input()))
a = sorted(apple)
for i in range(n - k):
b = - a[i] + a[i + k -1]
c = a[-i-1] - a[-(i + k)]
if b != 0 or c != 0:
orange.append(min(b, c))
else:
orange.append(0)
break
print(m... |
p03160 | s713127231 | Accepted | N = int(input())
h_list = list(map(int, input().split()))
dp = [0] * N # DPテーブルの作成
dp[1] = abs(h_list[1] - h_list[0])
if N>= 3:
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h_list[i]-h_list[i-1]), dp[i-2]+abs(h_list[i]-h_list[i-2]))
print(dp[N-1]) |
p02623 | s974786411 | Accepted | n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
#total = 0
books = 0
#i = 0
A,B = [0],[0]
for i in range(n):
A.append(A[i]+a[i])
for j in range(m):
B.append(B[j]+b[j])
l = m
for i in range(n+1):
if A[i]>k:
break
while B[l]>k-A[i]:
... |
p02660 | s610069855 | Accepted | import math
n = int(input())
def pF(n):
fList = []
while (n%2 == 0):
fList.append(2)
n = n//2
x = int(math.sqrt(n))
for i in range(3,x+1,2):
while (n%i == 0):
fList.append(i)
n = n//i
if n>2:
fList.append(n)
return set(fList)
pSet = pF(n)
ans = 0
for p in pSet:
i = 1
while (n%(p**i)==0):
... |
p02924 | s930170841 | Accepted | n = int(input())
print(n*(n-1)//2) |
p03759 | s315562418 | Accepted | a, b, c =map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
p02693 | s114690291 | Accepted | K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
if i%K==0:
print("OK")
break
else:
print("NG") |
p02621 | s566224004 | Accepted | a = int(input())
print(a + a **2 + a ** 3) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.