problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02718 | s975070313 | Wrong Answer | n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
print("YNeos"[sum([sum(a)/(4*m)>=a[i] for i in range(m)])==m::2])
|
p03286 | s669081971 | Accepted | n=int(input())
ans=""
if n==0:print(0);exit()
while n!=0:
ans +=str(n%2)
n=-(n//2)
print(ans[::-1]) |
p03565 | s136970712 | Accepted | SD=list(input())
T=list(input())
for i in reversed(range(len(SD)-len(T)+1)):
#print(SD[i:i+len(T)])
for j in range(len(T)):
if SD[i+j]!="?" and SD[i+j]!=T[j]:
break
else:
for j in range(len(T)):
if SD[i+j]=="?":
SD[i+j]=T[j]
for j in range(len(SD)):
if SD[j]=="?":
SD[j]="a"
print("".join(SD))
break
else:
print("UNRESTORABLE") |
p03485 | s147658010 | Accepted | import math
a,b = map(int,input().split())
x = (a + b)/2
print(math.ceil(x)) |
p03696 | s484142310 | Accepted | n = int(input())
s = input()
ss = s
while ss.count('()'):
ss = ss.replace('()', '')
left, right = ss.count('('), ss.count(')')
print('(' * right + s + ')' * left) |
p02989 | s584955875 | Accepted | N = int(input())
d = sorted(map(int, input().split()))
length = len(d)
print(
0 if length % 2 == 1 else d[length//2] - d[length//2 - 1]
)
|
p02842 | s362769039 | Wrong Answer | n = int(input())
dic = {}
for i in range(1,50000):
dic[int(i * 1.08)] = i
print(dic)
if n in dic:
print(dic[n])
else:
print(':(') |
p02583 | s530835612 | Accepted | N = int(input())
L = sorted([int(x) for x in input().split()])
ans = 0
for i in range(N):
for j in range(i+1, N):
for k in range(j+1, N):
if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
continue
if L[k] < L[i] + L[j]:
ans += 1
print(ans)
|
p02577 | s959270985 | Accepted | N = input()
ans = 0
for n in N:
ans = (ans + int(n)) % 9
if ans == 0:
print("Yes")
else:
print("No") |
p02971 | s278448168 | Accepted | N=int(input())
A=[0]*N; B=[0]*N;
for i in range(N):
A[i]=int(input())
B[i]=A[i]
B.sort(reverse=True)
for j in range(N):
if A[j]==B[0] :
print(B[1])
else :
print(B[0]) |
p03284 | s331866350 | Accepted | n, k = [int(x) for x in input().split()]
if n % k == 0:
print(0)
else:
print(1) |
p02971 | s482199193 | Accepted | import heapq
n = int(input())
list_score = []
for i in range(n):
list_score.append(int(input()))
list_ans = list_score.copy()
list_ans.sort()
for i in range(n):
a = list_score[i]
if a == list_ans[-1]:
print(list_ans[-2])
else:
print(list_ans[-1]) |
p02970 | s775739755 | Accepted | import math
n,d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x)) |
p02603 | s079188578 | Accepted | N = int(input())
A = list(map(int,input().split()))
CurrentMoney = 1000
for i in range(N - 1):
Stocks = 0
if A[i] < A[i+1]:
Stocks = CurrentMoney // A[i]
CurrentMoney += (A[i + 1] - A[i]) * Stocks
print(CurrentMoney) |
p02777 | s663466942 | Accepted | st = [s for s in input().split()]
ab = [int(s) for s in input().split()]
u = input()
if u == st[0]:
print(int(ab[0]-1),int(ab[1]))
else:
print(int(ab[0]),int(ab[1]-1))
|
p03657 | s076052216 | Wrong Answer | a,b=map(int,input().split())
c=a+b
if a%3==0 or b&3==0 or c%3==0:
print("Possible")
else:
print("Impossibele") |
p02833 | s221075782 | Wrong Answer | n = int(input())
if n % 2 == 1: print(0)
else:
ans = 0
n /= 2
while n:
ans += n / 5
n /= 5
print(ans) |
p03605 | s754325189 | Wrong Answer | nStr = input()
if nStr[0] == 9 or nStr[1] == 9:
print("Yes")
else:
print("No")
|
p03627 | s593165443 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
dic = {}
cnt = 0
for x in A:
if x not in dic.keys():
dic[x] = 1
else:
dic[x] += 1
dic = sorted(dic.items(), reverse=True)
ans = 0
for i in range(len(dic)):
if dic[i][1] >= 2:
if cnt == 1:
ans = t*dic[i][0]
break
if cnt == 0:
t = dic[i][0]
cnt = 1
print(ans) |
p02951 | s630191690 | Wrong Answer | A,B,C=map(int,input().split())
diff = A-B
if diff-C >= 0:
print(diff-C)
else:
print(C-diff) |
p02802 | s789245618 | Accepted | N,M=map(int,input().split())
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
p,S=input().split()
p=int(p)
if S=='WA' and AC[p]==0:
WA[p]+=1
if S=='AC' and AC[p]==0:
AC[p]+=1
#結局正解できなかった場合はWA=0になる
for j in range(N+1):
WA[j] = WA[j]*AC[j]
print(sum(AC),sum(WA)) |
p03633 | s023722286 | Wrong Answer | def gcd(a, b):
if(a == 0):
return b
return gcd(b % a, a)
def lcm(a, b):
return (a * b) / gcd(a, b)
t = int(input())
ans = 1
while(t != 0):
t -= 1
n = int(input())
if(ans < 1000000000000000000):
ans = lcm(ans, n)
if(ans > 1000000000000000000):
ans = 1000000000000000000
print(int(ans))
|
p02935 | s581623747 | Accepted | n = int(input())
v = list(map(int, input().split()))
while len(v) > 1:
v = sorted(v)
v1 = v.pop(0)
v2 = v.pop(0)
v.append((v1+v2)/2)
print(v[0])
|
p02982 | s869877967 | Wrong Answer | def dist(p1,p2):
r=0
for a,b in zip(p1,p2):
r+=(a-b)**2
return r
def isSqrt(n):
i=1
while i*i<n:
i+=1
return i==n
N,D = map(int,input().split())
P=[list(map(int,input().split())) for _ in range(N)]
ans=0
for i in range(N):
for j in range(i):
d = dist(P[i],P[j])
if isSqrt(d):
ans+=1
print(ans)
|
p02879 | s942655048 | Accepted | a,b = map(int, input().split())
if a>9 or b>9:
print('-1')
else:
print(a*b)
|
p02621 | s373291731 | Accepted | a = int(input())
print(a + a**2 + a**3) |
p03264 | s740819628 | Accepted | k = int(input())
if k % 2 != 0:
print((k//2)* ((k//2)+1))
else:
print((k//2)**2) |
p02661 | s980545250 | Wrong Answer | N = int(input())
A = [0] * (N + 1)
B = [0] * (N + 1)
count = 0
for i in range(1, N + 1):
A[i], B[i] = map(int, input().split())
if N % 2 == 1:
centerA = A[(N + 1) // 2]
centerB = B[(N + 1) // 2]
else:
centerA = (A[N // 2] + A[N // 2 + 1]) / 2
centerB = (B[N // 2] + B[N // 2 + 1]) / 2
#print(centerA, centerB)
if N % 2 == 1:
count = centerB - centerA + 1
else:
count = (centerB - centerA) * 2 + 1
print(int(count)) |
p03380 | s810251184 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
a1 = max(a)
half = a1/2
a2 = 0
for t in a:
if abs(a2-half) > abs(t-half):
a2 = t
print('{} {}'.format(a1, a2)) |
p03625 | s823938878 | Wrong Answer | from collections import Counter
a = input()
a_list = list(map(int, input().split()))
# 要素数の数え上げと取り出し
num_counter = Counter(a_list)
num_keys = sorted(num_counter.keys(), reverse=True)
big = 0
small = 0
for i in num_keys:
x = num_counter[i]
if x >= 4:
if big == 0:
big = small = i
elif big != 0 and small == 0:
small = i
elif x == 3 or x == 2:
if big == 0:
big = i
elif big != 0 and small == 0:
small = i
if big != 0 and small != 0:
break
print(big, small, big * small) |
p03555 | s234477136 | Accepted | a = input()
b = input()
if a[::-1]==b:
print('YES')
else:
print('NO') |
p02612 | s549132428 | Accepted | # Payment
N = int(input())
print((10000 - N) % 1000) |
p02711 | s453746735 | Accepted | N=str(input())
a=list(N)
if '7' in a:
print('Yes')
else:
print('No') |
p02713 | s853616807 | Wrong Answer | k = int(input())
ans = 0
def by8(n,ans):
n = n-1
if n > 1:
ans += (n*7)
ans = by8(n,ans)
elif n == 1:
ans += (n*7)
return(ans)
ans = 0
ans = by8(k,ans)
ans += k
print(ans)
|
p04012 | s673648385 | Accepted | import sys
from collections import Counter
w = list(input())
C = Counter(w)
for k, v in C.items():
if v % 2 == 1:
print('No')
sys.exit()
print('Yes') |
p03556 | s282437570 | Wrong Answer | import math
n = int(input())
print(int(math.floor(n**0.5))) |
p02796 | s226923588 | Accepted | N = int(input())
robots = []
for i in range(N):
x, l = map(int, input().split())
robots.append([x-l, x+l])
robots.sort(key=lambda x: x[1])
count = 0
max_arm = -float("inf")
for robo in robots:
if robo[0] < max_arm:
count += 1
else:
max_arm = robo[1]
print(N - count) |
p02630 | s317582148 | Wrong Answer | s=set()
l = [0] * ( 10 ** 5 + 1 )
N = int(input())
A = list(map(int, input().split()))
for i in range(len(A)):
l[A[i]] += 1
s.add(A[i])
Q = int(input())
for i in range(Q):
B, C = map(int, input().split())
l[C] += l[B]
s.add(C)
s.discard(B)
sum=0
for i in s:
sum += i * l[i]
|
p03673 | s922449544 | Accepted | n = int(input())
a = list(map(int,input().split()))
ar = list(reversed(a))
b = []
c = []
if len(a)%2 == 0:
for i in range(len(a)//2):
b.append(ar[i*2])
c.append(a[i*2])
else:
for i in range(-(-(len(a))//2)):
if i == len(a)//2:
b.append(ar[(i*2)])
else:
b.append(ar[i*2])
c.append(a[(i*2)+1])
print(' '.join(map(str, b+c)))
|
p03730 | s911565879 | Wrong Answer | a,b,c = map(int,input().split())
cnt = 0
for i in range(1,b+1):
if a*i % b == c:
cnt += 1
if cnt == 1:
print("YES")
else:
print("NO") |
p03796 | s711523994 | Accepted | n = int(input())
ret = 1
for i in range(n):
ret = (ret * (i + 1)) % 1000000007
print(ret) |
p02881 | s472217984 | Accepted | N = int(input())
ans = 10**12
for a in range(0,int(N**0.5)):
a += 1
if N%a == 0:
b = N//a
ans = min(ans,a+b-2)
print(ans) |
p03160 | s094709591 | Wrong Answer | N=int(input())
h=list(map(int,input().split()))
dp=[0]*(N)
for i in range(1,N):
if i==1:
dp[i]=abs(h[i]-h[i-1])
else:
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp) |
p04043 | s069440725 | Accepted | arr = list(map(int, input().split()))
arr.sort()
if (arr[0] == 5) and (arr[1] == 5) and (arr[2] == 7):
print("YES")
else:
print("NO") |
p02690 | s819278772 | Wrong Answer | x = int(input())
for a in range(-120,121):
for b in range(-120,121):
if a**5 - b**5 == x:
print(a,b)
break
|
p03637 | s602621491 | Accepted | #069_C
n = int(input())
a = list(map(int, input().split()))
mod1, mod2, mod4 = [0] * 3
for ai in a:
if ai % 4 == 0:
mod4 += 1
elif ai % 2 == 0:
mod2 +=1
else:
mod1 +=1
if mod2 == 0:
print('No' if mod1 > mod4 + 1 else 'Yes')
else:
print('No' if mod1 > mod4 else 'Yes') |
p02554 | s863985119 | Accepted | MOD=10**9+7
N=int(input())
ans=1
nine=1
eight=1
for i in range(N):
ans*=10
ans%=MOD
nine*=9
nine%=MOD
eight*=8
eight%=MOD
nine*=2
nine%=MOD
ans-=nine
ans%=MOD
ans+=eight
ans%=MOD
print(ans) |
p03069 | s425391294 | Accepted | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count('.')
cnt = cnt_w
for si in s:
if si == '#':
cnt_b += 1
else:
cnt_w -= 1
cnt = min(cnt, cnt_b+cnt_w)
print(cnt)
if __name__ == '__main__':
main() |
p02577 | s353462005 | Accepted | import sys
readline=sys.stdin.readline
N=readline().rstrip()
sums = 0
for i in range(len(N)):
sums += int(N[i])
sums %= 9
if sums % 9 == 0:
print("Yes")
else:
print("No")
|
p03487 | s066497323 | Accepted | N = int(input())
A = list(map(int,input().split()))
C = {}
cnt = 0
for i in range(N):
a = A[i]
if a>N:
cnt += 1
else:
if a not in C:
C[a]=0
C[a] += 1
for a in C:
if a>C[a]:
cnt += C[a]
elif a<C[a]:
cnt += C[a]-a
print(cnt) |
p02627 | s377008172 | Accepted | s=input()
if s.islower():
print('a')
else:
print('A') |
p03136 | s314760885 | Wrong Answer | N = int(input())
point = list(map(int,input().split()))
if max(point)<sum(point):
print("Yes")
else:
print("No") |
p03241 | s685163184 | Accepted | N,M = map(int,input().split())
MAX = int(M**(1/2))
ans = 0
for i in range(MAX,0,-1):
if M % i == 0:
j = M // i
if j >= N:
ans = max(ans,i)
if i >= N:
ans = max(ans,j)
print(ans) |
p03852 | s102908655 | Wrong Answer | print('vowel' if input() in ['aeiou'] else 'consonant')
|
p03131 | s616383300 | Accepted | K,A,B=map(int,input().split())
c=1
if A+2<B:
if K<=A:
print(1+K)
else:
K-=A-1
c+=A-1
# print(c)
if K%2:
K-=1
c+=1
c+=K//2*(B-A)
print(c)
else:
print(1+K)
|
p02687 | s969899499 | Wrong Answer | S = str(input())
if S == "ABC":
print("ARC")
else:
print("ARC") |
p02603 | s699540655 | Accepted | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
read = sys.stdin.buffer.read
n, *A = map(int, read().split())
now = 1000
for i in range(n-1):
if A[i+1] > A[i]:
now += (A[i+1] - A[i])*(now // A[i])
print(now) |
p03624 | s683613541 | Wrong Answer | str = input()
list = list(str)
abc = ['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']
i = 0
while abc[i] in str:
if i < 25:
i += 1
else:
break
if i < 26:
print(abc[i])
else:
print("None")
print(i) |
p04034 | s597920943 | Accepted | N, K = map(int, input().split())
r = [False for _ in range(N+1)]
b = [1 for _ in range(N+1)]
r[1] = True
r_cnt = 1
for _ in range(K):
x, y = map(int, input().split())
b[x] -= 1
b[y] += 1
if r[x]:
if b[x] == 0:
r[x] = False
r_cnt -= 1
if not r[y]:
r[y] = True
r_cnt += 1
print(r_cnt) |
p03071 | s558669103 | Wrong Answer | a,b=[int(i) for i in input().split()]
if a==b:
print(a**2)
else:
print(max(a,b)*max(a-1,b-1)) |
p02676 | s080709561 | Wrong Answer |
N = int(input())
S = input()
strLen = len(S)
if strLen <= N :
print(S)
else :
result = S[0 : N]
index = 0
while index < (strLen - N):
index = index + 1
result += '.'
print(result) |
p03592 | s289581935 | Accepted | N,M,K = map(int,input().split())
ans = 'No'
flag = False
for x in range(M+1):
if flag:
break
for y in range(N+1):
if (N-y)*x+(M-x)*y == K:
ans = 'Yes'
flag = True
break
print(ans) |
p02641 | s911992463 | Wrong Answer | import numpy as np
X, N = map(int, input().split())
if N > 0:
l1=list(map(int,input().split()))
else:
l1=[]
ans = X
l2 = np.array([i for i in range(1,11)])
l3 = set(l1) ^ set(l2)
for item in l3:
# print("item",item)
# print("X-item",(X - item)**2)
# print("X-ans",(X - ans)**2)
if ((X - item) ** 2) == ((X - ans) ** 2):
if item < ans:
ans = item
elif ((X - item) ** 2) < ((X - ans) ** 2):
ans = item
print(ans) |
p02760 | s939503627 | 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
for kumi in all:
for i in range(3):
chk = 0
if kumi[i] in b:
chk += 1
if chk == 3:
print("Yes")
break
if chk == 3:
break
if chk != 3:
print("No") |
p04012 | s573597428 | Accepted | from collections import Counter
c = Counter(input())
for x in c:
if c[x] % 2 == 1:
print("No")
exit()
print("Yes") |
p03760 | s848603660 | Accepted | O = list(input())
E = list(input())+[""]
o = len(O)
x =[]
for i in range(o):
ans = O[i] + E[i]
x.append(ans)
print("".join(x)) |
p03360 | s215422082 | Accepted | nList = sorted(list(map(int,input().split())),reverse=True)
k = int(input())
print(nList[0]*2**k+(nList[1]+nList[2]))
|
p02900 | s869591646 | Accepted | def division(n):
if n < 2:
return [1]
prime_factors = [1]
for i in range(2,int(n**0.5)+1):
while n % i == 0:
prime_factors.append(i)
n //= i
if n > 1:
prime_factors.append(n)
return prime_factors
a,b = map(int,input().split())
da = set(division(a))
db = set(division(b))
cnt = 0
for i in da:
if i in db:
cnt += 1
print(cnt) |
p03435 | s724179309 | 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')
|
p03219 | s557684481 | Accepted | X,Y=map(int,input().split())
print(X+(Y//2)) |
p03160 | s981964565 | Accepted | n=int(input())
a=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]))
if i==1:
continue
dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]))
print(dp[-1]) |
p02684 | s894941220 | Wrong Answer | n, k = map(int, input().split())
a = [int(x)-1 for x in input().split()]
visited = [0] * n
visit_list = [0]
visit = 0
while True:
visit_list.append(a[visit])
visit = a[visit]
if visited[visit] == 1:
break
visited[a[visit]] = 1
print(visit_list[k%len(visit_list)]+1) |
p03565 | s130001869 | Wrong Answer | s = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
for j in range(len(t)):
if s[i+j] != t[j] and s[i+j] != "?":
break
else:
print(s[:i]+t+s[i+j+1:])
l.append(s[:i]+t+s[i+j+1:])
if len(l) == 0:
print("UNRESTORABLE")
exit()
l.sort()
print(l[0].replace("?", "a")) |
p02553 | s824453161 | Wrong Answer | a,b,c,d = map(int, input().split())
if b*d>0: print(b*d)
else:
if b<0:
print(max(a,b)*min(c,d))
elif d<0:
print(min(a,b)*max(c,d))
else:
print(min(a,b)*min(c,d)) |
p02879 | s232092973 | Wrong Answer | A,B=map(int,input().split())
if 1<A<10 and 1<B<10:
print(A*B)
else:
print(-1) |
p02912 | s155039680 | Accepted | import heapq
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)
for i in range(m):
largest = -heapq.heappop(a)
largest = largest // 2
heapq.heappush(a, -largest)
print(-sum(a)) |
p02784 | s814125292 | Accepted | H, N = map(int, input().split())
A = list(map(int, input().split()))
if H > sum(sorted(A, reverse=True)[:N]):
print('No')
else:
print('Yes') |
p02582 | s152851361 | Wrong Answer | s = input()
print(s.count("R"))
|
p03835 | s295062642 | Accepted | K,S = map(int,input().split())
ans = 0
for k in range(K+1):
ans += max(0, min(S - k, K) - max(0, S - k - K) + 1)
print(ans) |
p02951 | s244912831 | Accepted | a, b, c = map(int, input().split())
if b + c > a:
print(b+c-a)
else:
print(0) |
p03557 | s889530229 | Accepted | import bisect
N = int(input())
Alist = sorted(list(map(int, input().split())))
Blist = sorted(list(map(int, input().split())))
Clist = sorted(list(map(int, input().split())))
ans = 0
for B in Blist:
Aindex = bisect.bisect_left(Alist, B)
Cindex = bisect.bisect_right(Clist, B)
# print(B, Aindex, N-Cindex)
ans += Aindex * (N - Cindex)
print(ans)
|
p03331 | s229744392 | Accepted | def split_sum(n):
ans = 0
while n:
ans += n % 10
n //= 10
return ans
N = int(input())
ans = float('inf')
for A in range(1, N):
B = N - A
if A > B:
break
ans = min(ans, split_sum(A) + split_sum(B))
print(ans)
|
p02866 | s534639230 | Accepted | from collections import Counter
def solve():
N = int(input())
D = list(map(int, input().split()))
mod = 998244353
if D[0] != 0:
print(0)
return
cnt = Counter(D)
if cnt[0] > 1:
print(0)
return
res = 1
for i in range(1, max(D)+1):
if cnt[i-1] == 1:
continue
res *= cnt[i-1]**cnt[i] %mod
res %= mod
print(res)
solve() |
p02713 | s415310831 | Wrong Answer | K=int(input())
import math
if K==1:
print(1)
exit()
elif K==2:
print(8)
exit()
else:
t=0
for i in range(1,K-1):
for j in range(i+1,K):
for k in range(j+1,K+1):
a=math.gcd(i,j)
b=math.gcd(a,k)
t+=b
tw=0
for i in range(1,K):
for j in range(i+1,K+1):
a=math.gcd(i,j)
tw+=a
on=0
for i in range(1,K+1):
on+=i
print(t*6+tw*6+on) |
p02918 | s569591763 | Accepted | import sys
import numpy as np
import heapq
def input():
return sys.stdin.readline()[:-1]
def solve():
N, K = map(int, input().split())
S = input()
cnt = 2*K
for i in range(N-1):
if S[i] == S[i + 1]:
cnt += 1
print(min(N-1, cnt))
if __name__ == "__main__":
solve()
|
p03659 | s996938203 | Wrong Answer | N=int(input())
L=list(map(int,input().split()))
M=[float("inf")]*(N+10)
M[0]=0
for i in range(1,N+1):
M[i]=M[i-1]+L[i-1]
ans=float("inf")
for i in range(N+1):
X=M[i]
Y=M[N]-M[i]
ans=min(ans,abs(X-Y))
print(ans) |
p02820 | s402451285 | Accepted | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
ans=0
prev=['']*k
for i in range(n):
if t[i]!=prev[i%k]:
prev[i%k]=t[i]
if t[i]=='r':
ans+=p
elif t[i]=='p':
ans+=s
elif t[i]=='s':
ans+=r
else:
prev[i%k]=''
print(ans)
|
p03695 | s449985349 | Wrong Answer | # ABC 064: C – Colorful Leaderboard
N = int(input())
a = [int(i) for i in input().split()]
colors = [0] * 8
for rate in a:
if rate < 3200:
colors[rate // 400] += 1
a_min = len([i for i in colors if i > 0]) if sum(colors) != 0 else 1
print(a_min, a_min + len([j for j in a if j >= 3200])) |
p02879 | s328563762 | Wrong Answer | a,b = map(int,input().split())
print(a*b) |
p03427 | s811950234 | Wrong Answer | N = int(input())
S = str(N)
if(len(S) == 1): print(S); exit(0)
for i in range(len(S)):
if(int(S[i]) != 9):
print(int(S[0]) - 1 + (len(S) - 1) * 9)
exit(0)
print(len(S) * 9) |
p03106 | s860183181 | Wrong Answer | import math
a,b,k = map(int,input().split())
g = math.gcd(a,b)
c = 0
i = 1
for i in range(g,1,-1) :
if g%i == 0 :
c+=1
if c==k :
break
print(i)
|
p02705 | s034179812 | Wrong Answer | R = int(input())
print (2*(3.141592653589793238)*R*R) |
p02766 | s087562467 | Accepted | N, K = map(int, input().split())
cnt = 1
while(True):
if N // (K**cnt) < 1:
break
cnt += 1
print(cnt) |
p02801 | s665247463 | Accepted | a = input()
print(chr(ord(a)+1))
|
p03721 | s800049949 | Accepted | n, k = map(int, input().split())
list_score = [ list(map(int,input().split(" "))) for i in range(n)]
list_score.sort(key=lambda x:x[0])
cnt = 0
ans = -1
for i in range(n):
cnt += list_score[i][1]
if cnt >= k:
ans = list_score[i][0]
break
print(ans)
|
p03077 | s111282728 | Accepted | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()
def main():
n=II()
A=[II() for _ in range(5)]
print(5+(n-1)//min(A))
if __name__ == "__main__":
main()
|
p03627 | s071413173 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
a.sort()
import collections
c = collections.Counter(a).most_common()
c.reverse()
first=0
second=0
for tmp in c:
if tmp[1] >=4 and first*second==0:
first=tmp[0]
second=tmp[0]
break
if tmp[1] >=2:
if first==0:
first=tmp[0]
else:
second=tmp[0]
break
print(first*second) |
p02959 | s958049849 | Accepted | import sys
n = int(sys.stdin.readline().rstrip())
*a, = map(int, sys.stdin.readline().split())
*b, = map(int, sys.stdin.readline().split())
def main():
tot = 0
for i in range(n):
tot += min(b[i], a[i])
b[i] = max(0, b[i] - a[i])
tot += min(b[i], a[i+1])
a[i+1] = max(0, a[i+1] - b[i])
print(tot)
if __name__ == '__main__':
main() |
p03797 | s328000729 | Wrong Answer | n,m=map(int,input().split())
if 2*n>=m:
print(n)
else:
res = n #元の状態で作れる総数
tmp = m-2*n #残り
res += tmp//4
print(res) |
p03012 | s430172507 | Wrong Answer | N=int(input())
W=list(map(int,input().split()))
SUM=sum(W)
REST=0
MIN=100000
for i in range(N):
REST=REST+W[i-1]
SUM=SUM-REST
if MIN >abs(SUM-REST):
MIN=abs(SUM-REST)
print(MIN)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.