problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02761 | s160320128 | Wrong Answer | import collections
n,m = map(int,raw_input().split(' '))
operations = [map(int, raw_input().split(' ')) for _ in range(m)]
def f(operations, n):
res = [-1] * n
for s,c in operations:
s -=1
if res[s] == -1:
res[s] = c
elif res[s] != c:
return (False, res)
for i in range(len(res)):
if res[i] == -1:
res[i] = 0 if (i or n == 1) else 1
if res[0] == 0 and n:
return (False, res)
return (True, res)
f,r = f(operations, n)
print ''.join(map(str,r)) if f else -1 |
p02630 | s419243031 | Accepted | N = int(input())
A = [int(x) for x in input().split()]
freq = [0 for i in range(10**5+1)]
for x in A:
freq[x] += 1
ans = sum(A)
for q in range(int(input())):
B, C = map(int,input().split())
ans -= B*freq[B]
ans += C*freq[B]
freq[C] += freq[B]
freq[B] = 0
print(ans) |
p03637 | s066617836 | Accepted | n = int(input())
a = list(map(int, input().split()))
num_2 = 0
num_4 = 0
for i in a:
if i % 4 == 0:
num_4 += 1
elif i % 2 == 0:
num_2 += 1
x = num_4 * 2
if num_4 >= n // 2:
print("Yes")
elif num_2 >= n - x:
print("Yes")
else:
print("No") |
p03041 | s839087596 | Accepted | def main():
num = list(map(int,input().split()))
s=input()
print(s[0:num[1]-1]+s[num[1]-1].lower()+s[num[1]:num[0]])
main() |
p03632 | s514382523 | Wrong Answer | a,b,c,d = map(int,input().split())
if b<=c:
print(0)
elif a<=c and c<=b<=d:
print(b-c)
elif a<c and d<b:
print(d-c)
elif c<a:
print(min(d-a,b-a))
else:
print(0)
|
p03475 | s217004412 | Wrong Answer | N = int(input())
CSF = []
for _ in range(N-1):
CSF.append(list(map(int,input().split())))
for i in range(N-1):
ans = 0
for j in range(i,N-1):
C,S,F = CSF[j]
if ans < S:
ans = S+C
else:
ans += ans%F+C
pass
print(ans)
print(0) |
p02753 | s703786062 | Accepted | S = list(map(str, input()))
if S[0] == S[1] and S[1] ==S[2] and S[2] == S[0]:
print("No")
else:
print("Yes") |
p02705 | s078634713 | Accepted | import math
print(int(input())*2*math.pi)
|
p02699 | s004991805 | Wrong Answer | S,W= map(int, input().split())
if S <= W*2:
print("unsafe")
else:
print("safe")
|
p02918 | s742698904 | Accepted | import copy
n, k = map(int,input().split())
s = ['R'] + list(input()) + ['L']
cnt = 0
for i in range(1,n+1):
if s[i] == 'L' and s[i-1] == 'L':
cnt += 1
if s[i] == 'R' and s[i+1] == 'R':
cnt += 1
# print(cnt)
while k > 0 and cnt < n-1:
if n- 1 - cnt > 1:
cnt += 2
elif n- 1 - cnt > 0:
cnt += 1
k -= 1
print(cnt)
|
p02553 | s425468669 | Accepted | nums = input().split(' ')
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
d = int(nums[3])
multi = []
multi.append(a * c)
multi.append(a * d)
multi.append(b * c)
multi.append(b * d)
ans = - 10 ** 18
for i in range(4):
if multi[i] > ans:
ans = multi[i]
print(ans) |
p03479 | s653744993 | Accepted | # coding: utf-8
# https://atcoder.jp/contests/abc083/tasks/arc088_a
# 17:19-
def main():
X, Y = map(int, input().split())
ans = 0
x = X
while True:
if x > Y:
return ans
ans += 1
x *= 2
print(main())
|
p02832 | s811719617 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
c = 0
for i in range(n):
if a[i] != i+1-c:
c += 1
if c < n:
print(str(c))
else:
print(-1) |
p03241 | s571426466 | Accepted | 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)
divisors.sort()
return divisors
n, m = map(int, input().split())
div = make_divisors(m)
ans = 0
for d in div:
if d * n <= m:
ans = max(ans, d)
print(ans)
|
p03038 | s817461403 | Accepted | n,m=[int(x) for x in input().rstrip().split()]
A=[int(x) for x in input().rstrip().split()]
now=[]
bc=[]
for i in range(m):
BC=[int(x) for x in input().rstrip().split()]
bc.append(BC)
bc=sorted(bc,key=lambda x:x[1],reverse=True)
A.sort(reverse=True)
d=[]
for b,c in bc:
d.extend([c]*b)
if n<=len(d):
break
A+=d
A.sort(reverse=True)
print(sum(A[:n]))
|
p02598 | s643748147 | Accepted | from math import ceil
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
left = 0
right = max(a)
while right - left > 1:
length = (right + left) // 2
totcut = 0
for i in range(n):
totcut += ceil(a[i]/length) - 1
if totcut > k:
left = length
break
else:
right = length
print(right)
|
p03471 | s020274754 | Wrong Answer | def otoshidama():
N, Y = map(int,input().split())
for i in range(N):
for j in range(N - i):
if Y == 1000*i + 5000*j + 10000*(N - j - i):
print(N - j - i, j, i)
return
print(-1,-1,-1)
return
otoshidama()
|
p03221 | s145856269 | Accepted | n, m = map(int, input().split())
a = []
for i in range(m):
#[0] = 県
#[1] = 誕生年
#[2] = 市番号
a.append(list(map(int, input().split())))
a[i].append(i)
#県、誕生年ごとにソート
a.sort(key=lambda x:(x[0], x[1]))
p = 0
num = 1
for v in a:
if not v[0] == p:
p = v[0]
num = 1
_id = str(v[0]).zfill(6) + str(num).zfill(6)
num += 1
v.append(_id)
a.sort(key=lambda x:x[2])
for v in a:
print(v[3]) |
p02754 | s130789291 | Accepted | n, a, b = map(int, input().split())
ans = n//(a+b)*a
tmp = min(n%(a+b), a)
print(ans + tmp) |
p02972 | s806110559 | Wrong Answer | import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
a = rl()
ans=[]
for i in range(n,0, -1):
sum_=0
iter_=2
while i*iter_<=n:
sum_+=a[i*iter_-1]
iter_+=1
if sum_%2!=a[i-1]:
ans.append(i)
print(len(ans))
if ans:
print(*ans) |
p02693 | s762454661 | Wrong Answer | A = int(input())
B, C = map(int,input().split())
flag = 1
for i in range(B, C):
if i % A == 0:
flag = 0
print("OK")
break
if flag==1:
print("NG")
|
p03261 | s128668519 | Accepted | n = int(input())
w_list = [input() for _ in range(n)]
for i in range(1, n):
if w_list[i - 1][-1] != w_list[i][0] or w_list[i] in w_list[:i]:
print("No")
exit()
print("Yes") |
p02790 | s149462141 | Wrong Answer | import numpy as np
a,b = map(int,input().split())
if (a*10^b) > (b*10^a):
print(np.ceil(a * (10^b + 10^(b-1) + 10^(b-2) + 10^(b-3) + 10^(b-4) + 10^(b-5) + 10^(b-6) + 10^(b-7) + 10^(b-8) + 10^(b-9))))
else:
print(np.ceil(b * (10^a + 10^(a-1) + 10^(a-2) + 10^(a-3) + 10^(a-4) + 10^(a-5) + 10^(a-6) + 10^(a-7) + 10^(a-8) + 10^(a-9)))) |
p02630 | s544036955 | Wrong Answer | from collections import Counter
n = int(input())
a_L = list(map(int,input().split()))
q = int(input())
L = dict(Counter(a_L))
all_sum = sum(a_L)
ans_L = []
for i in range(q):
b,c = map(int,input().split())
try:
diff = (c-b) * L[b]
all_sum = all_sum+diff
L[c] += L[b]
except:
pass
ans_L.append(all_sum+1)
for i in ans_L:
print(i) |
p03449 | s276812520 | Wrong Answer | # 初期入力
import sys
input = sys.stdin.readline
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
count =[0]*N
if N ==1:
count[0] =A1[0] +A2[0]
else:
for i in range(1,N-1):
count[i] =sum(A1[:i+1]) +sum(A2[i:])
print(max(count)) |
p03962 | s659287602 | Accepted | Array= list(input().split())
print(len(set(Array))) |
p03037 | s441472130 | Accepted | #!/usr/bin/env python3
def main():
n, m = map(int, input().split())
range_list = [list(map(int, input().split())) for _ in range(m)]
min_list = [x[0] for x in range_list]
max_list = [x[1] for x in range_list]
min_id = max(min_list)
max_id = min(max_list)
answer = max_id - min_id + 1
answer = max(answer, 0)
print(answer)
if __name__ == '__main__':
main()
|
p02687 | s235729691 | Accepted | def readinput():
s=input()
return s
def main(s):
if s=='ABC':
return 'ARC'
elif s=='ARC':
return 'ABC'
ans=''
return ans
if __name__=='__main__':
s=readinput()
ans=main(s)
print(ans)
|
p02724 | s645626864 | Accepted | x = int(input())
a = x//500
b = (x%500)//5
print(a*1000+b*5) |
p03069 | s173733861 | Accepted | n=int(input())
s=input()
w=[0]*(n+1)
b=[0]*(n+1)
for i in range(1,n+1):
w[i]=w[i-1]+1 if s[i-1]=="#" else w[i-1]
b[-i-1]=b[-i]+1 if s[-i]=="." else b[-i]
print(min([x+y for x,y in zip(w,b)])) |
p03254 | s382667433 | Accepted | N, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
a.sort()
for idx, v in enumerate(a):
if v <= x:
x -= v
if idx == N - 1:
if x == 0:
count += 1
else:
count +=1
print(count)
|
p03001 | s339780590 | Accepted | W,H,x,y = map(int,input().split())
scale = W*H/2
div = 0
if x==W/2 and y==H/2:
div = 1
print(scale,div) |
p03012 | s995565785 | Accepted | import sys
input = sys.stdin.readline
def main():
N = int(input())
W = list(map(int, input().split()))
S1 = 0
S2 = sum(W)
ans = 10 ** 18
for i in range(N - 1):
S1 += W[i]
S2 -= W[i]
diff = abs(S1 - S2)
ans = min(ans, diff)
print(ans)
if __name__ == "__main__":
main()
|
p02847 | s838702876 | Accepted | S = input()
if S == "SUN":
print(7)
elif S == "MON":
print(6)
elif S == "TUE":
print(5)
elif S == "WED":
print(4)
elif S == "THU":
print(3)
elif S == "FRI":
print(2)
elif S == "SAT":
print(1) |
p02664 | s236143829 | Accepted | t = list(input())
for i in range(len(t)):
if t[i] == "?":
t[i] = "D"
print("".join(t)) |
p03360 | s329590521 | Accepted | A, B, C = map(int, input().split())
K = int(input())
aux=max(A, B, C)
ans=(A+B+C)-aux
for _ in range(K):
aux+=aux
print(aux+ans) |
p02820 | s395206015 | Wrong Answer | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
hand = {"r" : p, "s" : r, "p" : s}
ans = 0
for i in range(n-k):
temp= i-k
if temp >=0 and t[i]==t[temp]:
t[i]=""
else:
ans+=hand[t[i]]
print(ans) |
p03796 | s618940028 | Wrong Answer | N = int(input())
power = 1
m = 10**9+7
for i in range(N):
power = power*(i+1)
poewr = power % m
print(power) |
p02795 | s576355186 | Accepted | import math
H=int(input())
W=int(input())
N=int(input())
print(math.ceil(N/max(H,W))) |
p02696 | s744782890 | Accepted | from sys import stdin
import sys
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
# N, M = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
x=min(B-1,N)
ans = int((A*x)/B)-A*int(x/B)
print(ans)
# if N >= B: |
p03852 | s872176686 | Accepted | c = input()
if c == "a" or c == "e" or c == "i" or c == "o" or c == "u":
print("vowel")
else:
print("consonant") |
p03730 | s294196283 | Accepted | A, B, C = map(int, input().split())
#kA%Bの数列になる
#AをBで割ったあまりはB-1以下になる
#(k+B)A%B = (kA+BA)%B = kA%B + BA%B = kA%B
for i in range(1, B+1):
if A*i%B == C:
print('YES')
exit()
print('NO')
|
p02600 | s099454093 | Wrong Answer | X=int(input())
for i in range(8):
a=400+(8-i)*200
if a<=X<=a+199:
print(i)
break |
p04011 | s935634000 | Wrong Answer | n,k,x,y = [int(input()) for i in range(4)]
print(x*k + y*(n-k))
|
p02607 | s387780553 | Wrong Answer |
N = int(input())
AAA = [int(i) for i in input().split()]
cnt = 0
for i in range(N):
if i % 2 == 1 and AAA[i] % 2 == 1:
cnt += 1
print(cnt) |
p02831 | s757026720 | Wrong Answer | import math
import numpy as np
A,B = list(map(int,input().split()))
if A == 1:
print(B)
exit()
if B == 0:
print(A)
exit()
C = A*B
D = []
for i in range(1,int(math.sqrt(C))):
if A % i == 0 and B % i == 0:
A = A // i
B = B // i
D.append(i)
C = A*B
p = np.prod(D)
if p != 0:
C = C*p
print(C) |
p03419 | s334207313 | Accepted | #!/usr/bin/env python3
def main():
(N, M) = map(int, input().split())
if N >= M:
(N, M) = (M, N)
if N == 1:
if M == 1:
print(1)
else:
print(M-2)
else:
print((N-2) * (M-2))
main()
|
p02570 | s381682353 | Wrong Answer | def main():
D, T, S = map(int, input().split())
if float(S) < float(D) /float(S) :
print("No")
else:
print("Yes")
#N = int(input())
#A = [int(s) for s in input().split()]
#
main()
|
p02730 | s551461996 | Accepted | S = str(input())
N = len(S)
if S == S[::-1] and S[:(N-1)//2] == S[(N-1)//2-1::-1] and S[(N+3)//2-1:N] == S[-1:(N+3)//2-2:-1]:
print("Yes")
else:
print("No") |
p02612 | s036342958 | Wrong Answer | n=int(input())
ans=n%1000
print(1000-ans) |
p03243 | s707492439 | Wrong Answer | N=int(input())
for i in range(N,999):
if i%111==0:
print(i)
break |
p03289 | s864698148 | Accepted | import sys
S = input()
if S[0] != "A":
print("WA")
sys.exit()
if S[1].isupper() or S[-1].isupper():
print("WA")
sys.exit()
T = S[2:len(S)-1]
if list(T).count("C") == 0 or list(T).count("C") > 1:
print("WA")
sys.exit()
for i in range(len(T)):
if T[i].isupper() and T[i] != "C":
print("WA")
sys.exit()
print("AC") |
p03380 | s252620429 | Accepted | def solve():
N = int(input())
A = [-float('inf')]+list(map(int, input().split()))
A.sort()
ans = [A[-1]]
n = A[-1]//2
for i in range(1,N+1):
if A[i]>n or i==N-1:
if A[i]-n>n-A[i-1]:
ans.append(A[i-1])
else:
ans.append(A[i])
break
return ans
print(*solve()) |
p02719 | s794470203 | Wrong Answer | import math
N,K = map(int, input().split())
print(min(abs(N-K*int(N/K)),abs(N-K*math.ceil(N/K)),min(abs(N-(1+K*int(N/K))),abs(N-K*(1+math.ceil(N/K))),N))) |
p03730 | s033782745 | Wrong Answer | a,b,c = map(int,input().split(' '))
i = 1
ans = 'No'
while i < b:
if (i*a)%b == c:
ans = 'Yes'
break
i += 1
print(ans) |
p03696 | s580089276 | Accepted | n = int(input())
array = list(input())
ret = []
count = 0
for str in array:
if str == "(":
count += 1
if str == ")":
count -= 1
if count < 0:
for i in range(-count):
ret.insert(0, "(")
count = 0
ret.append(str)
for i in range(count):
ret.append(")")
print(''.join(ret))
|
p02767 | s414900709 | Accepted | import math
N = int(input())
x = list(map(int,input().split()))
minimum = math.inf
for i in range(101):
stamina = 0
for j in range(N):
stamina += (x[j]-i)**2
minimum = min(minimum,stamina)
print(minimum) |
p02683 | s887469792 | Wrong Answer | # ABC 167 C
N,M,X = map(int,input().split())
C =[]
for m in range(N):
C.append([int(i) for i in input().split()])
C.sort(key=lambda x:x[0])
from itertools import combinations
import numpy as np
ans = 10**5 +1
for m in range(1,N+1):
P=list(combinations(C,m))
print(P)
tmp =np.sum(P,axis=1)
for t in tmp:
if min(t[1:])>=X and ans > t[0]:
ans = t[0]
if min(t[1:])<X:
print(-1)
else:
print(ans) |
p02688 | s143781013 | Wrong Answer | n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
a = input()
b = set(list(map(int, input().split())))
c = b | c
num = list(num -c)
L=[str(a) for a in num]
L=" ".join(L)
print(L) |
p02910 | s547833090 | Accepted | s=input()
n=len(s)
k=['R','U','D']
g=['L','U','D']
for i in range(n):
if (i+1)%2!=0 and s[i] not in k:
print('No')
exit()
elif (i+1)%2==0 and s[i] not in g:
print('No')
exit()
print('Yes')
|
p03035 | s386473705 | Accepted | a, b = [int(x) for x in input().split()]
if a >= 13:
print(b)
elif a <= 12 and a >= 6:
print(b // 2)
else:
print(0) |
p03986 | s857426998 | Accepted | S = input()
k = 0
l = len(S)
for i in S:
if i == 'S':
k += 1
else:
if k > 0:
k -= 1
l -= 2
print(l) |
p03817 | s531344912 | Wrong Answer | # -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
def solve():
# n, m = [int(x) for x in input().split()]
n = int(input())
if n == 6:
print(1)
else:
print(ceil(n / 5.5))
t = 1
# t = int(input())
for case in range(1,t+1):
ans = solve()
"""
R s
S p
P r
"""
|
p03681 | s269316060 | Accepted | import math
n,m=map(int,input().split())
mod=10**9+7
ans=0
if abs(n-m)>=2:
print("0")
elif abs(n-m)==1:
print(math.factorial(n)*math.factorial(m)%mod)
else:
print((math.factorial(n)*math.factorial(m)*2)%mod)
|
p03163 | s783315942 | Accepted | import numpy as np
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
a,b=map(int,input().split())
w+=[a]
v+=[b]
DP=np.zeros(W+1,dtype=int)
for i in range(N):
DP[w[i]:]=np.maximum(DP[:-w[i]]+v[i],DP[w[i]:])
print(max(DP)) |
p02546 | s657552078 | Wrong Answer | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
s = input()
if len(s) == 1:
if s[0] == 's':
print('es')
else:
print(s+'s')
else:
if s[-1] == 's':
r = s + 'es'
print(r)
else:
r = s + 's'
print(r)
if __name__ == '__main__':
main() |
p02859 | s258147115 | Accepted |
r=int(input())
print(r**2) |
p02923 | s578165635 | Wrong Answer | n=int(input())
h=list(map(int,input().split()))
count=0
ma=0
for i in range(1,n):
if h[i]<=h[i-1]:
count+=1
elif count>ma:
ma=count
count=0
if count>ma:
ma=count
print(ma) |
p02706 | s901477236 | Accepted | #import numpy as np
#import math
#from decimal import *
#from numba import njit
#@njit
def main():
N,M = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
if s > N:
print(-1)
else:
print(N-s)
main()
|
p02693 | s117047194 | Accepted | n = int(input())
a,b= map(int, input().split())
i = 0
while (i <= 1000):
i += n
if i >= a:
break
print("OK") if i<=b else print("NG") |
p03639 | s013958881 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
a0 = len([i for i in range(N) if a[i] % 2 != 0])
if len([i for i in range(N) if a[i] % 2 == 0 and a[i] != 4]) > 0:
a0 += 1
a2 = len([i for i in range(N) if a[i] % 4 == 0])
if a0 <= a2 + 1:
print('Yes')
else:
print('No')
|
p03612 | s594236131 | Accepted | n = int(input())
*p, = map(int, input().split())
p = p+[-1]
ans = 0
for i in range(n):
if p[i] == (i+1):
ans += 1
p[i], p[i+1] = p[i+1], p[i]
print(ans)
|
p02947 | s962094102 | Wrong Answer | from collections import Counter
N = int(input())
S =[]
for i in range(N):
S.append(str(input()))
B =[]
for i in S:
S1 =list(Counter(i).items())
#S1 =sorted(S1, reverse = False)
B.append(S1)
cnt = 0
for i in range(N-1):
for j in range(i+1,N):
if B[i] == B[j]:
cnt += 1
print(cnt) |
p02633 | s515659518 | Accepted | import math
x = int(input())
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if x == 1:
print(int(360 / x))
elif x == 45:
print(int(360 / x))
elif x == 90:
print(int(360 / x))
else:
z = lcm(x, 360)
print(int(z / x))
|
p02860 | s863832377 | Wrong Answer | N = int(input())
S = input()
if (N % 2 == 0):
c = int(N / 2)
n = 0
for x in range(c):
if S[x] == S[x + c]:
n += 1
if n == c:
print('YES')
else:
print('NO')
else:
print('NO') |
p02601 | s200532665 | Wrong Answer | A,B,C = map(int,input().split())
K = int(input())
for num in range(K):
if (A >= B) :
B = 2*B
elif B >= C:
C = 2*C
else:
A = A *2
if A<B and B < C and A < C:
print("Yes")
else:
print("No") |
p03814 | s000174139 | Accepted | s = input()
counter_A = 0
counter_Z = 0
for i in s:
if i == 'A':
break
else:
counter_A += 1
for i in s[::-1]:
if i == 'Z':
break
else:
counter_Z += 1
print(len(s) - counter_A - counter_Z)
|
p02664 | s645516445 | Accepted | s = input()
for i in range(len(s)):
if s[i] == "?":
print("D",end="")
else:
print(s[i],end="") |
p03795 | s135482376 | Accepted | a = int(input())
print(a*800-(a//15)*200)
|
p03360 | s083162293 | Accepted | def main():
a, b, c = map(int, input().split())
k = int(input())
print(max(a, b, c)*(2**k-1)+a+b+c)
if __name__ == "__main__":
main() |
p03416 | s758798918 | Accepted | A, B = map(int, input().split())
ans = 0
for i in range(A,B+1):
s = str(i)
N = len(s)-1
l = (len(s) // 2) + 1
for j in range(l):
if s[j] == s[N-j]:
continue
else:
break
else:
ans += 1
print(ans)
|
p03038 | s180915382 | Wrong Answer | import heapq
n, m = map(int, input().split())
list_score = list(map(int, input().split()))
list_kard = [list(map(int, input().split(" "))) for i in range(m)]
list_kard.sort(key=lambda x: x[1], reverse=True)
heapq.heapify(list_score)
for i in range(m):
k = list_kard[i]
for _ in range(k[0]):
if list_score[0] < k[1]:
heapq.heappop(list_score)
heapq.heappush(list_score, k[1])
else:
print(sum(list_score))
exit() |
p03485 | s955185956 | Wrong Answer | a,b = map(int,input().split())
x = a+b
if (x % 2 == 0):
print(x/2)
else:
print(x/2 + 1)
|
p02882 | s700832595 | Accepted | import math
a,b,x = map(int,input().split())
ans = 0
sw = 2*x/(a**3)
sw_c = abs(math.atan(sw))
ans = abs(math.atan(2/a*(b-x/(a**2))))
ans_1 = abs(math.atan(a*b**2/(2*x)))
if(ans < sw_c):
print(math.degrees(ans))
else:
print(math.degrees(ans_1))
'''
print("------")
print(math.degrees(ans))
print(math.degrees(sw_c))
print(math.degrees(ans_1))
''' |
p02726 | s890191709 | Accepted | n,x,y = map(int,input().split())
k = [0]*(n-1) #k-1に対応
for i in range(1,n):
for j in range(i+1,n+1):
s = min(abs(j-i),abs(j-y)+abs(i-x)+1)
k[s-1] += 1
for i in k:
print(i) |
p02847 | s622164877 | Wrong Answer | L = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
n = L.index(input())
print( L[(n+1)%7] ) |
p02700 | s614200022 | Wrong Answer | th,ta,ah,aa = map(int,input().split())
at = ah / ta
tt = th / aa
if at >= tt:
print("No")
elif at <= tt:
print("Yes")
|
p03548 | s604313046 | Accepted | x,y,z=map(int,input().split())
x-=z
print((x-x%(y+z))//(y+z)) |
p02724 | s392500683 | Accepted | X=int(input())
a=X//500
b=X%500
c=b//5
print(a*1000+c*5) |
p02696 | s055395430 | Wrong Answer |
A,B,N=map(int,input().split())
def func(t):
return int(t)
syo=N//B
amari=N%B
if syo==0:
x=amari
print(func(A*x/B)-A*func(x/B))
else:
x1=syo*B-1
x2=N
ans1=func(A*x1/B)-A*func(x1/B)
ans2=func(A*x2/B)-A*func(x2/B)
print(max(ans1,ans2)) |
p02684 | s159712516 | Wrong Answer | N, K = map(int, input().split())
A = list(map(lambda x:int(x) - 1, input().split()))
already = [False for i in range(N)]
already[0] = True
tel = [0]
while True:
tmp = A[tel[-1]]
tel.append(tmp)
if already[tmp]:
tel.pop()
break
already[tmp] = True
for i in range(len(tel)):
if tel[i] == tmp:
s = i
break
ans = (K - s) % (len(tel) - s)
print(tel[ans + s] + 1)
|
p03910 | s185421380 | Accepted | import math
N=int(input())
p=math.sqrt(N*2-0.25)-0.5
q=int(p)+1
M=q*(q+1)//2
L=M-N#must0or+
for i in range(1,q+1):
if i != L:
print(i) |
p03387 | s865790019 | Accepted | a = list(map(int, input().split()))
a.sort()
d = a[2] * 2 - a[0] - a[1]
if d % 2 == 1:
d += 4
print(d//2) |
p04029 | s501819978 | Wrong Answer | x = int(input())
print((x+1)*x/2) |
p03379 | s289540675 | Wrong Answer | n = int(input())
X = list(map(int,input().split()))
h = int(n/2)
for i in range(1,n+1):
if i <= h:
print(X[h])
else:
print(X[h-1])
|
p03624 | s312906385 | Wrong Answer | import string
S = list(map(str, input()))
s = sorted(set(S))
alphabet = string.ascii_lowercase
if len(s) == len(alphabet):
print("None")
else:
for i in range(len(s)):
if s[i] != alphabet[i]:
print(alphabet[i])
break
|
p02959 | s698292320 | Accepted | N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
ans = 0
for i in range(N):
d = min(A[i], B[i])
ans += d
A[i] -= d
B[i] -= d
d = min(A[i+1], B[i])
ans += d
A[i+1] -= d
print(ans)
|
p02951 | s584219143 | Accepted | A, B, C = map(int, input().split())
num = C-(A-B)
print(num if num > 0 else '0') |
p02952 | s348544565 | Accepted | n = int(input())
cnt = 0
for i in range(1, n+1):
if len(str(i)) % 2 == 1:
cnt += 1
print(cnt)
|
p02553 | s280379089 | Accepted | a,b,c,d=map(int,input().split())
result=[a*c,a*d,b*c,b*d]
print(max(result))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.