problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02684
|
s892844785
|
Accepted
|
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = []
ord = [-1] * (n+1)
v = 1
c = 1
l = 0
while ord[v] == -1:
ord[v] = len(s)
s.append(v)
v = a[v-1]
c = len(s) - ord[v]
l = ord[v]
if l > k:
print(s[k])
else:
k -= l
k %= c
print(s[l+k])
|
p02793
|
s521337183
|
Accepted
|
from fractions import gcd
#from math import gcd
def lcm(m, n): return m * n // gcd(m, n)
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
mulab = 1
for i in range(n):
mulab = lcm(mulab, a[i])
mulab %= MOD
ans = 0
for i in range(n):
#フェルマーの小定理
ans = ans + mulab * pow(a[i], MOD-2, MOD)
ans %= MOD
print(ans)
|
p03971
|
s097732064
|
Wrong Answer
|
N, A, B = map(int, input().split())
S = input()
domestic = 0
abroad = 0
for i in range(N):
if S[i] == 'a':
if domestic+abroad < A+B:
print('Yes')
domestic += 1
else:
print('No')
elif S[i] == 'b':
if domestic+abroad < A+B and abroad <= B:
print('Yes')
abroad += 1
else:
print('No')
else:
print('No')
|
p02658
|
s831740080
|
Wrong Answer
|
N = int(input())
a = list(map(int,input().split()))
total = 1
k = 10**18
for i in range(len(a)):
if a[i] == 0:
total = 0
break
total *= a[i]
if total > k:
total =-1
break
print(total)
|
p03219
|
s173505270
|
Accepted
|
x, y = map(int, input().split())
print(x+y//2)
|
p03623
|
s170059957
|
Accepted
|
x,a,b = map(int,input().split())
if abs(x-a)>abs(x-b):
print("B")
else:
print("A")
|
p02989
|
s326447029
|
Wrong Answer
|
import sys
n, *d = map(int, sys.stdin.read().split())
def main():
d.sort()
h = n // 2
l = d[h-1]; r = d[h]
return r - (l + 1) - 1
if __name__ == '__main__':
ans = main()
print(ans)
|
p02640
|
s808180784
|
Accepted
|
X ,Y = map(int ,input().split())
if X*2 <= Y <= X*4 and Y % 2 == 0:
print("Yes")
else:
print("No")
|
p04044
|
s014569858
|
Accepted
|
n, l = map(int, input().split())
strList = []
for _ in range(0, n):
strList.append(input())
strList.sort()
ans = ""
for i in range(0, n):
ans += strList[i]
print(ans)
|
p03681
|
s825398306
|
Wrong Answer
|
n,m=map(int,input().split())
if n==m:
temp=1
for i in range(1,n+1):
temp=(temp*i)%(10**9+7)
print((2*((temp*temp)%(10**9+7)))%(10**9+7))
elif abs(n-m)==1:
temp1=1
temp2=1
for i in range(1,n+1):
temp1=(temp1*(i%(10**9+7)))%(10**9+7)
for j in range(1,n+1):
temp2=(temp2*(j%(10**9+7)))%(10**9+7)
print(temp1+temp2)
else:
print(0)
|
p03351
|
s487723865
|
Wrong Answer
|
a , b , c, d= map ( int, input ().split())
if a-c <= d or a-b <= d:
print("Yes")
elif b-c <= d:
print("Yes")
else:
print("No")
|
p02621
|
s143914098
|
Accepted
|
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
a = ii()
print(a+a**2+a**3)
|
p02792
|
s692595030
|
Wrong Answer
|
t = int(input())
b=0
c=0
count = 0
while b < t:
b += 1
while c < b:
c += 1
d = b/(10**len(str(b)))
h = c % 10
e = c/(10**len(str(c)))
g = b % 10
if d == h and e == g:
count += 1
print(count)
|
p02924
|
s214801745
|
Accepted
|
N = int(input())
print(N*(N-1)//2)
|
p03448
|
s073888355
|
Accepted
|
#Coins
A=int(input())
B=int(input())
C=int(input())
X=int(input())
i=0
#j=0 ここに入れるとだめ
ans=0
while i <=A:
X_aftera=X-500*i
if X_aftera<0:
break
j=0
while j<=B:
X_afterb=X_aftera-100*j
if X_afterb<0:
break
if X_afterb//50<=C:
ans +=1
j+=1
i+=1
print(ans)
|
p02996
|
s034108456
|
Accepted
|
n=int(input())
list=[list(map(int,input().split())) for _ in range(n)]
list1=sorted(list, key=lambda x:x[1])
t=0
for i in range(n):
t+=list1[i][0]
if not t<=list1[i][1]:
print("No")
break
else:
print("Yes")
|
p03472
|
s414091246
|
Wrong Answer
|
n, h = list(map(int, input().split()))
wield = 0
bs = []
for i in range(n):
a, b = list(map(int, input().split()))
if a > wield:
wield = a
bs.append(b)
throw = 0
throwCnt = 0
for i in range(n):
if bs[i] > wield:
throw += bs[i]
throwCnt += 1
print(max((h-throw+wield-1)//wield + throwCnt, 1))
|
p02789
|
s240729553
|
Accepted
|
N,M=[int(i) for i in input().split()]
print("Yes") if N==M else print("No")
|
p03077
|
s185922313
|
Wrong Answer
|
N = int(input())
ABCDE = []
for i in range(5):
ABCDE.append(int(input()))
start_time = 0
arrived_time = N//ABCDE[0] + 1
for i in range(4):
if ABCDE[i] <= ABCDE[i+1]:
arrived_time += 1
else:
num_left = N - (N//ABCDE[i]) * ABCDE[i+1]
arrived_time += num_left//ABCDE[i+1]+1
print(arrived_time)
|
p03796
|
s568385196
|
Wrong Answer
|
INF = 1000000007
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
res = 0
mod = a % INF
while b > 0:
if b == 1:
res += mod
if res > INF:
res -= INF
mod <<= 1
if mod > INF:
mod -= INF
b >>= 1
return res
N = int(input())
ans = 1
for i in range(1, N + 1):
ans = modmulti(ans, i)
print(ans)
|
p03309
|
s025013032
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
B = [A[i]-i-1 for i in range(N)]
B.sort()
b = B[N//2]
print(sum([abs(A[i]-i-b-1) for i in range(N)]))
|
p02601
|
s767831241
|
Wrong Answer
|
a = list(map(int, input().split()))
k = int(input())
count = 0
while a[1] <= a[0]:
a[1] = a[1]*2
count += 1
while a[2] <= a[1]:
a[2] = a[2]*2
count += 1
if count > k:
print('no')
else:
print('yes')
|
p03471
|
s754124938
|
Accepted
|
N,Y= map(int,input().split())
for a in range(N+1):
for b in range(N-a+1):
c = N-a-b
if (10000*a+5000*b+1000*c ==Y):
print('{} {} {}'.format(a,b,c))
exit()
print('-1 -1 -1')
|
p03699
|
s346987694
|
Accepted
|
n=int(input())
l=[int(input()) for i in range(n)]
lis=[i for i in l if i%10!=0]
sum_l=sum(l)
if sum_l%10!=0:
print(sum_l)
else:
if len(lis)==0:
print(0)
else:
print(sum_l-min(lis))
|
p02578
|
s965302213
|
Wrong Answer
|
n=int(input())
a_list=list(map(int,input().split()))
b_list=[]
for i in range(n-1):
d=a_list[i]-a_list[i+1]
if(d>=0):
b_list.append(d)
a_list[i+1]+=d
ans=sum(b_list)
print(b_list)
print(ans)
|
p03607
|
s834132813
|
Wrong Answer
|
n=int(input())
d={}
for i in range(n):
A=int(input())
if A not in d:
d[A]=1
elif d[A]==1:
d[A]==0
else:
d[A]=1
print(sum(d.values()))
|
p04043
|
s744749052
|
Accepted
|
X = list(map(int,input().split()))
X.sort()
print('YES' if X==[5,5,7] else 'NO')
|
p03211
|
s726961800
|
Accepted
|
s = input()
num = []
for i in range(len(s)-2):
x = int(s[i:i+3])
n = abs(753 - x)
num.append(n)
print(min(num))
|
p02935
|
s639280598
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
A.sort()
while len(A)>=2:
X = (A[0]+A[1])/2
A.pop(0)
A.pop(0)
A.append(X)
A.sort()
else:
print(A[0])
|
p02711
|
s759796588
|
Wrong Answer
|
N = str(input())
if N in ['7']:
print("Yes")
else:
print("No")
|
p02973
|
s123655550
|
Accepted
|
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np
import bisect
from collections import deque
def main():
n=int(input())
A=[int(input()) for _ in range(n)]
Q=deque([A[0]])
for i in range(1,n):
if A[i]<=Q[0]:
Q.appendleft(A[i])
else:
ix=bisect.bisect_left(Q,A[i])
Q[ix-1]=A[i]
print(len(Q))
if __name__ == "__main__":
main()
|
p02987
|
s610922892
|
Accepted
|
s = input()
d = {}
for i in range(4):
if s[i] in d:
d[s[i]] += 1
else:
d[s[i]] = 1
if d[s[0]] == d[s[1]] == d[s[2]] == d[s[3]] == 2:
print("Yes")
else:
print("No")
|
p02596
|
s074532409
|
Accepted
|
n=int(input())
if n%2==0:
print(-1)
else:
c=1
k=7
while 1:
if k%n==0:
break
if c>n:
c=-1
break
k=(k%n)*10+7
c+=1
#print(k)
print(c)
|
p02663
|
s609751552
|
Wrong Answer
|
H1, M1, H2, M2, K = map(int,input().split())
if H1 == 0:
H1 = 24
if H2 == 0:
H2 = 24
if H2 <= H1:
print(0)
time2m = H2 * 60 + M2
time1m = H1 * 60 + M1
study_time = time2m - K - time1m
if study_time <= 0:
print(0)
else:
print(study_time)
|
p03077
|
s037154913
|
Wrong Answer
|
n=int(input())
x=[int(input()) for i in range(5)]
bottle_neck=10**15+10
bottle_neck_index=0
for i in range(5):
if bottle_neck>x[i]:
bottle_neck_index=i
bottle_neck=x[i]
if n<=bottle_neck:
ans=0
else:
ans=n//bottle_neck
ans=ans+5
print(ans)
|
p03471
|
s595729566
|
Accepted
|
n,yen=map(int,input().split())
yen//=1000
for x in range(n+1):
for y in range(n-x+1):
z=n-x-y
cur_yen=x*10+y*5+z*1
if cur_yen == yen:
print(x,y,z)
exit()
print(-1,-1,-1)
|
p02795
|
s900378520
|
Accepted
|
H = int(input())
W = int(input())
N = int(input())
if H < W:
count = N // W
rate = N / W
if count < rate:
count += 1
print(count)
else:
count = N // H
rate = N / H
if count < rate:
count += 1
print(count)
|
p02659
|
s663511555
|
Wrong Answer
|
a,b = input().strip().split()
a,b = [int(a), float(b)]
c = a*b;
d = int(c)
print(d)
|
p02570
|
s456258729
|
Accepted
|
D,T,S = map(int,input().split())
if S*T >= D:
print('Yes')
else:
print('No')
|
p02597
|
s836847282
|
Wrong Answer
|
N = int(input())
c = input()
print(min(c.count("W"), c.count("R"), c[:c.count("W")].count("W")))
|
p03360
|
s744500031
|
Accepted
|
lst = sorted(list(map(int, input().split())), reverse=True)
k = int(input())
print(lst[0] * (2 ** k) + sum(lst[1:]))
|
p03543
|
s525034891
|
Wrong Answer
|
# 4桁の数字で3つ以上連続するか判定
N = input()
if N[0] == N[1] and (N[0] == N[2] and N[0] == N[3]):
print("Yes")
elif N[0] == N[1] and (N[0] == N[2] or N[0] == N[3]):
print("Yes")
else:
print("No")
|
p03838
|
s885139495
|
Wrong Answer
|
x, y = list(map(int, input().split()))
if x == 0:
print(abs(y))
elif y == 0:
print(abs(x))
else:
dif = abs(abs(x)-abs(y))
if (x > 0 and y > 0) or (x < 0 and y < 0):
if x < y:
print(dif)
else:
print(dif + 2)
else:
print(dif + 1)
|
p03723
|
s704566867
|
Wrong Answer
|
import sys
A, B, C = map(int, input().split())
count = 0
while True:
a = B//2 + C//2
b = C//2 + A//2
c = A//2 + B//2
count += 1
if (A == B and B == C) or (A % 4 == 0 and B % 4 == 0 and C % 4 == 0):
print('-1')
sys.exit()
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
break
A = a
B = b
C = c
print(count)
|
p03073
|
s239417975
|
Accepted
|
import numpy as np
s = np.array(list(map(int, input())))
a01 = np.tile([0,1], len(s)//2)
a10 = np.tile([1,0], len(s)//2)
if len(s)%2 != 0:
a01 = np.append(a01, 0)
a10 = np.append(a10, 1)
ans01 = np.abs(s -a01)
ans10 = np.abs(s -a10)
if sum(ans01) >= sum(ans10):
print(sum(ans10))
else:
print(sum(ans01))
|
p02755
|
s014252191
|
Wrong Answer
|
import math
A, B = map(int, input().split())
X = A / 0.08
Y = B / 0.1
if X > Y:
Z = X * 0.2
if Y + Z == X:
print(X)
else:
print(-1)
else:
Z = Y * 0.2
if X + Z == Y:
print(Y)
else:
print(-1)
|
p03860
|
s515456375
|
Wrong Answer
|
s=input()
print("A" + s[0] + "C")
|
p03681
|
s375541921
|
Wrong Answer
|
import math
n, m = map(int, input().split())
N = math.factorial(n)
M = math.factorial(m)
INF = 10**9 + 7
if abs(n-m) == 1:
print(N*M%INF)
else:
print(2*N*M%INF)
|
p03386
|
s364373735
|
Accepted
|
a,b,k=map(int,input().split())
for i in range(k):
if a+i<=b:
print(a+i)
for j in range(k,0,-1):
if b-j>=a+k-1:
print(b-j+1)
|
p02765
|
s661446684
|
Wrong Answer
|
N,R= map(int,input().split())
if N > 9:
print(R)
else:
print(R-100*(10-N))
|
p02848
|
s816264924
|
Wrong Answer
|
N=int(input())
S=input()
print(S[N:]+S[:N])
|
p02831
|
s393980586
|
Accepted
|
a,b=sorted(map(int,input().split()))
# 最大公約数
def gcd(a, b):
if b==0:
return a
else:
r = a%b
return gcd(b,r)
print(int(a*b/gcd(a,b)))
|
p03827
|
s518941106
|
Wrong Answer
|
c,t=open(0)
a=[0]
for i in t:a+=a[-1]+1-2*(i=='D'),
print(max(a))
|
p03338
|
s250684978
|
Wrong Answer
|
n = int(input())
s = input()
v = [0] * n
for c in range(ord('a'), ord('z') + 1):
p = -1
for i in range(n):
if s[i] == c:
if p >= 0:
v[i] -= 1
v[p] += 1
p = i
ans = 0
vsum = 0
for i in v:
vsum += i
ans = max(ans, vsum)
print(ans)
|
p03105
|
s505678486
|
Accepted
|
A,B,C = map(int,input().split())
print(min(B//A,C))
|
p02547
|
s185273622
|
Wrong Answer
|
def solution():
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
cnt = 0
flg = 0
for i in range(N):
if x[i] == y[i]:
if flg+1 == i:
cnt += 1
flg = i
else:
cnt = 0
if cnt >= 3:
return 'Yes'
return 'No'
print (solution())
|
p03835
|
s739739375
|
Accepted
|
k,s =map(int,input().split())
cnt=0
for x in range(0,k+1):
for y in range(0,k+1):
z=s-x-y
if 0<=z<=k:
cnt+=1
print(cnt)
|
p03012
|
s600743696
|
Accepted
|
n = int(input())
w = list(map(int,input().split()))
s = 0
x = []
for i in range(n):
s = abs(sum(w[:i])-sum(w[i:]))
x.append(s)
print(min(x))
|
p04029
|
s236430783
|
Accepted
|
n=int(input())
print(n*(n+1)//2)
|
p03986
|
s480580623
|
Accepted
|
X = input()
val = len(X)
sum = 0
for i in X:
if i == "S":
sum += 1
else:
if sum > 0:
val -= 2
sum -= 1
print(val)
|
p03095
|
s207615555
|
Accepted
|
# A - Colorful Subsequence
from collections import defaultdict as dd
n=int(input())
s=input()
mod=10**9+7
ans=1
c=dd(int)
for ss in s:
c[ord(ss)-97]+=1
for i in range(26):
ans*=c[i]+1
ans%=mod
print((ans+mod-1)%mod)
|
p03485
|
s224402340
|
Accepted
|
print(-(-sum(map(int,input().split()))//2))
|
p04031
|
s710832965
|
Wrong Answer
|
n = int(input())
a = [int(_) for _ in input().split()]
ans = 1000000000
for i in range(-100, 100):
val = 0
for j in a:
val += (i-j)**2
ans = min(ans, val)
print(ans)
|
p03449
|
s128620922
|
Accepted
|
def resolve():
n = int(input())
l = [list(map(int,input().split())) for i in range(2)]
count = 0
for i in range(n):
tmp = 0
c = -1
for j in range(0, i+1):
tmp += l[0][j]
c += 1
tmp += l[1][c]
c += 1
for k in range(c, n):
tmp += l[1][k]
count = max(tmp, count)
print(count)
if __name__ == '__main__':
resolve()
|
p02553
|
s621441848
|
Accepted
|
a,b,c,d=map(int,input().split())
temp=[]
temp.append(a*c)
temp.append(a*d)
temp.append(b*c)
temp.append(b*d)
print(max(temp))
|
p04029
|
s493603194
|
Wrong Answer
|
x = int(input("あめ"))
def main(x):
y = 0
for i in range(x+1):
y = y + i
return y
print(main(x))
|
p03544
|
s098660957
|
Wrong Answer
|
N = int(input())
L1 = 2
L2 = 1
L3 = 3
if N == 1:
print(L1)
elif N == 2:
print(L2)
else:
for i in range(N-2):
L1 = L3
L3 += L2
L2 = L1
print(L3)
|
p02645
|
s550787083
|
Accepted
|
S = input()
print(S[:3])
|
p02628
|
s990733119
|
Accepted
|
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_sort = sorted(p)
ans = 0
cnt = 0
for _ in p_sort:
ans += _
cnt += 1
if cnt >= k:
break
print(ans)
|
p03109
|
s854299140
|
Wrong Answer
|
import datetime
s = input()
dt = datetime.datetime.strptime(s, '%Y/%m/%d')
if dt.year >= 2019 and dt.month >= 4 and 1 <= dt.day >= 30:
print('Heisei')
else:
print('TBD')
|
p02633
|
s870035413
|
Wrong Answer
|
x=input()
print(int(360/int(x)))
|
p02909
|
s129060693
|
Accepted
|
s=input()
d={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
print(d[s])
|
p02818
|
s199830709
|
Accepted
|
a,b,k=map(int,input().split())
if a>=k:
a-=k
elif a+b>=k:
b-=k-a
a=0
else:
a=0
b=0
print('{} {}'.format(a,b))
|
p03761
|
s865411034
|
Wrong Answer
|
alp=list('qawsedrftgyhujikoplmnbvcxz')
alp.sort()
cnt=[]
for i in range(int(input())):
tmp=[0 for _ in range(26)]
for s in list(input()):
tmp[alp.index(s)]+=1
cnt.append(tmp)
m=57
ans=''
for i in range(26):
for j in range(len(cnt)):
m=min(m,cnt[j][i])
ans+=alp[i]*m
print(ans)
|
p03137
|
s709470914
|
Wrong Answer
|
n,m=map(int,input().split())
x=sorted(map(int,input().split()))
a=list()
for i in range(m-1):
a.append(x[i+1]-x[i])
print(x[-1]-x[0]-sum(sorted(a)[-n+1:]))
|
p02730
|
s893024965
|
Accepted
|
##B
S = str(input())
N = int(len(S))
##print(N)
S1 = S[0:(N-1)//2]
N1 = len(S1)
S2 = S[(N+3)//2-1:N]
N2 = len(S2)
if S1 == S2:
if S1 == S1[::-1]:
if S2 == S2[::-1]:
print("Yes")
else:
print("No")
|
p03797
|
s670319281
|
Accepted
|
n, m = map(int, input().split())
ans = 0
if m - 2*n > 0:
ans += n
m -= 2*n
ans += m//4
else:
ans += m//2
print(ans)
|
p03127
|
s288265362
|
Accepted
|
import sys
from functools import lru_cache
def input(): return sys.stdin.readline().rstrip()
@lru_cache(maxsize=None)
def gcd(m, n):
if n == 0:
return m
else:
return gcd(n, m % n)
def main():
_ = int(input())
A = tuple(map(int, input().split()))
ans = A[0]
for a in A[1:]:
ans = gcd(ans, a)
print(ans)
if __name__ == '__main__':
main()
|
p03997
|
s403720846
|
Accepted
|
a = int(input())
b = int(input())
h = int(input())
v = ((a+b)*h)/2
print(int(v))
|
p03779
|
s448895372
|
Accepted
|
x = int(input())
i = 1
while True:
if (i+1)*i//2 >= x:
print(i)
break
i += 1
|
p02665
|
s110499642
|
Accepted
|
N=int(input())
A=list(map(int,input().split()))
ans=0
tree=1
node=sum(A)
flag=0
for i in A:
ans+=i
node-=i
if i>tree:
ans=-1
break
tree-=i
if tree<node:
ans+=tree
else:
ans+=node
tree=2*tree
print(ans)
|
p03672
|
s980938308
|
Accepted
|
s=input()
ans=len(s)
while True:
ans-=2
s=s[:ans]
if s[:ans//2]==s[ans//2:]:
print(ans)
break
|
p02754
|
s552755236
|
Wrong Answer
|
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]
n,a,b = map(int,input().split())
d,m = divmod(n,a+b)
print(d*a+m if m<a else d*a+m-b)
|
p03360
|
s016579605
|
Accepted
|
A, B, C = sorted(map(int, input().split()))
K = int(input())
print(A + B + C * 2 ** K)
|
p03759
|
s860426698
|
Accepted
|
a,b,c=map(int, input().split())
if b-a==c-b:
print('YES')
else:
print('NO')
|
p03284
|
s406359378
|
Accepted
|
n,k = map(int,input().split())
if n%k == 0:
print(0)
else:
print(1)
|
p02747
|
s553443102
|
Accepted
|
S = input()
if S == "hi" * (len(S) // 2):
print("Yes")
else:
print("No")
|
p03730
|
s024572675
|
Accepted
|
import sys
A, B, C = map(int, input().split())
for i in range(100):
if C == (A*i%B):
print("YES")
sys.exit()
print("NO")
|
p02663
|
s488696061
|
Accepted
|
h1, m1, h2, m2, k = map(int, input().split())
print((h2 * 60 + m2) - (h1 * 60 + m1) - k)
|
p02948
|
s542209724
|
Accepted
|
#python3
from heapq import heappop
from heapq import heappush
def main():
n, m = map(int, input().split())
works = [[] for _ in range(m)]
for _ in range(n):
a, b = map(int, input().split())
if a > m:
continue
works[m-a].append(b)
s = 0
h = []
for i in reversed(range(m)):
for b in works[i]:
heappush(h, -b)
if len(h) != 0:
s += -heappop(h)
print(s)
main()
|
p03449
|
s692576182
|
Wrong Answer
|
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
ans = 0
for i in range(n):
print(a2[i:n])
ans =max(sum(a1[0:i+1])+sum(a2[i:n]),ans)
print(ans)
|
p02768
|
s180759201
|
Wrong Answer
|
from math import factorial
M = 10**9 + 7
n, a, b = map(int, input().split())
r = pow(2, n, M) - 1
c = 1
for i in range(b):
c = c * (n - i) % M
if i + 1 == a:
a = b
r -= c * pow(factorial(a), M - 2, M)
print(r % M)
|
p03109
|
s714443794
|
Wrong Answer
|
s=input()
x=s.replace('/','')
y=int(x)
if 20190430 > y:
print('Heisei')
else:
print('TBD')
|
p03345
|
s187378387
|
Wrong Answer
|
A, B, C, K = map(int, input().split(' '))
if K==0:
print((A-B))
elif K == 1:
print((B-A))
elif K%2 == 0:
print((B-A))
else:
print((A-B))
|
p03455
|
s921178381
|
Accepted
|
a,b=map(int,input().split())
def evenodd(a,b):
if a*b%2==1:
return "Odd"
else:
return"Even"
print(evenodd(a,b))
|
p02726
|
s257502320
|
Wrong Answer
|
import numpy as np
|
p03161
|
s542128797
|
Accepted
|
# B - Frog 2
def main():
N, K, *H = map(int, open(0).read().split())
H = [0] + H + [0] * K
dp = [1 << 30] * (N + K + 1)
dp[1] = 0
for i, a in enumerate(H[1:N + 1], 1):
for j, b in enumerate(H[i + 1:i + K + 1], i + 1):
dp[j] = min(dp[j], dp[i] + abs(a - b))
print(dp[N])
if __name__ == "__main__":
main()
|
p02775
|
s842290623
|
Wrong Answer
|
N = input()
L = len(N)
ans = 0
t = 0
for i in range(L-1,-1,-1):
n = int(N[i])+t
if n <= 5:
ans += n
t = 0
else:
t = 1
ans += 10-n
if n == 10:
ans += 1
print(ans)
|
p03127
|
s306504880
|
Accepted
|
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(math.gcd, numbers)
N = int(input())
L = list(map(int,input().split()))
print(gcd_list(L))
|
p02687
|
s438085424
|
Wrong Answer
|
import sys
lines = sys.stdin.readline()
X = str(lines)
if X =='ABC':
print('ARC')
else:
print('ABC')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.