problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02597 | s207023987 | Accepted | N = int(input())
C = list(input())
RC = C.count("R")
WC = C.count("W")
print(C[:RC].count("W")) |
p02994 | s553445728 | Wrong Answer | import math
N,L = map(int,input().split())
r = []
total=0
ap=0
max = -100100100100
for i in range(1,N+1):
r.append(L+i-1)
for i in range(N):
for j in range(N):
if j != i:
total+=r[j]
if max < total:
ap = total
total=0
print(ap) |
p03469 | s581095831 | Accepted | S = input()
print(S.replace("2017", "2018")) |
p03730 | s485054698 | Accepted | a, b, c = map(int, input().split())
for i in range(b):
if i * a % b == c:
print("YES")
exit()
print("NO") |
p03379 | s480915773 | Accepted | import copy
N = int(input())
X = [int(i) for i in input().split()]
Y = copy.deepcopy(X)
Y = sorted(Y, key= lambda x: -x)
c = int(N/2)
for i in range(N):
a = X[i]
if a >= Y[c-1]:
print(Y[c])
else:
print(Y[c-1]) |
p03545 | s409310757 | Wrong Answer | S=input()
N=len(S)
A=[int(i) for i in S]
D=["+" for i in range(N-1)]
output=S[0]
for i in range(2**N):
C=A
B=D
for j in range(N-1):
if ((i>>j)&1):
C[j+1]= -1*int(str(S[j+1]))
B[j]= "-"
else:
C[j+1]= int(str(S[j+1]))
B[j]= "+"
print(C,B,sum(C))
if sum(C) ==7:
for i in range(1,N):
output += B[i-1] + str(S[i])
print(output+"=7")
break
|
p03836 | s663959223 | Accepted | sx, sy, tx, ty = map(int, input().split())
res = []
for i in range(abs(ty - sy)):
res.append("U")
for i in range(abs(tx - sx)):
res.append("R")
for i in range(abs(sy - ty)):
res.append("D")
for i in range(abs(tx - sx) + 1):
res.append("L")
for i in range(abs(ty - sy) + 1):
res.append("U")
for i in range(abs(tx - sx) + 1):
res.append("R")
res.append("D")
res.append("R")
for i in range(abs(ty - sy) + 1):
res.append("D")
for i in range(abs(tx - sx) + 1):
res.append("L")
res.append("U")
print("".join(res)) |
p02755 | s002733579 | Wrong Answer | import math
A, B = map(float, input().split())
lowerA = math.ceil(A/0.08)
upperA = math.floor((A+1)/0.08)
lowerB = math.ceil(B/0.1)
upperB = math.floor((B+1)/0.1)
answer = -1
for i in range(lowerA, upperA):
if (lowerB <= i) and (i <= upperB):
answer = i
break
print(answer)
|
p04030 | s049573162 | Accepted | stack =[]
s = input()
for i in s:
if i != "B":
stack.append(i)
else:
if stack:
stack.pop()
print("".join(stack)) |
p03487 | s007677654 | Accepted | n = int(input())
a = list(map(int,input().split()))
from collections import Counter
z = Counter(a)
i,j,temp = (0,0,0)
for tu in z.items():
i,j = tu
if i>j:
temp+=j
elif i<j:
temp+=j-i
else:
continue
print(temp) |
p03243 | s669902166 | Accepted | n = int(input())
print(-(-n//111)*111)
|
p02694 | s745839250 | Wrong Answer | x = int(input())
money = 100
year = 0
while True:
money = money + money*0.01
money = money // 1
year += 1
if money >= x:
print(year)
exit() |
p02971 | s710339445 | Wrong Answer | if __name__ == "__main__":
inNum = int(input())
intArr = []
while(inNum > 0):
tempNum =int(input())
intArr.append(tempNum)
inNum = inNum-1
intArr
sortArr = intArr
sortArr.sort()
for x in intArr:
if(not x == sortArr[-1]):
print(sortArr[-1])
if(x == sortArr[-1]):
print(sortArr[-2]) |
p02677 | s741937557 | Wrong Answer | import math
[a, b, h, m] = [int(x) for x in input().split(" ")]
short = ((h) * 60 + m) / (12 * 60) * 360
long = (m) / (60) * 360
theta = abs(long - short)
inte = math.cos(math.radians(theta))
print(math.sqrt(a ** 2 + b ** 2 + 2*a * b * inte)) |
p03035 | s546835975 | Wrong Answer | A, B = map(int, input().split())
if (A<=5):
print(0)
elif(A>6 and A<=12):
print(int(B/2))
else:
print(B) |
p02713 | s607660553 | Wrong Answer | from math import gcd
k = int(input())
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for t in range(1, k + 1):
ans += gcd(gcd(i, j), k)
print(ans) |
p02642 | s887066336 | Accepted | import collections
n,cc = int(raw_input()), collections.Counter(map(int,raw_input().split()))
m,s = max(cc.keys()),{ai:True for ai in cc}
for a in cc:
c = a if cc[a] > 1 else 2 * a
while(c <= m):
if a in s: s[c] = False
c += a
count = 0
for v in s.values():
if v: count +=1
print count |
p03624 | s973852361 | Wrong Answer | S = input()
alp = list('abcdefghijklmnopqrstuvwxyz')
print(alp)
for i in range(len(S)):
if S[i] in alp:
alp.remove(S[i])
if len(alp) == 0:
print('None')
else:
print(alp[0]) |
p02729 | s837800253 | Accepted | n,m=map(int, input().split())
r = 0
if n>=2:
r += n*(n-1)//2
if m>=2:
r += m*(m-1)//2
print(r) |
p03317 | s910152355 | Accepted | import math
N,K=map(int,input().split())
print(math.ceil((N-1)/(K-1))) |
p03485 | s623817536 | Accepted | import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2)) |
p04020 | s561719067 | Wrong Answer | def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]
def main():
N = Z()
A = [Z() for _ in range(N)]
output = 0
for i in range(N-1):
x = min(A[i], A[i+1])
output += x
A[i] -= x
A[i+1] -= x
output += A[i]//2
A[i] %= 2
output += A[N-1]//2
print(output)
return
if __name__ == '__main__':
main()
|
p02848 | s809414688 | Wrong Answer | N = int(input())
S = list(input())
result = ''
for i in range(0,len(S)):
num = ord(S[i])
new = chr(num+N)
result += new
print(result) |
p03387 | s317213080 | Wrong Answer | a = list(map(int, input().split()))
n = []
for i in range(len(a)):
if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
a.sort()
ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
N = 3 - sum(n) - 1 #奇数のインデックス
ans = 0
if a[N] != max(a):
while a[N] < max(a):
a[N] += 2
ans += 1
a.sort()
ans += (a[1] - a[0]) // 2 + a[2] - a[1]
else:
a.sort()
ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans) |
p02861 | s822257782 | Accepted | from math import factorial, sqrt
def dist(x1, y1, x2, y2):
return sqrt((x1 - x2)**2 + (y1 - y2)**2)
N = int(input())
x, y = [0]*N, [0]*N
for i in range(N):
x[i], y[i] = map(int, input().split())
ans = 0
count = (N-1) * factorial(N) / (N * (N-1) / 2)
for i in range(N-1):
for j in range(i+1, N):
ans += dist(x[i], y[i], x[j], y[j]) * count
ans = ans / factorial(N)
print(ans)
|
p03387 | s718967697 | Accepted | l = list(map(int, input().split()))
l.sort()
c = l[-1]
a = l[0]
b = l[1]
if (a + b) % 2 == 0:
print((2 * c - (a + b))//2)
else:
print((2*(c+1)-(a+b+1))//2 + 1) |
p02873 | s509466853 | Accepted | 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,-1,-1):
if S[i] == ">":
ary[i] = max(ary[i], ary[i+1] + 1)
print(sum(ary)) |
p02854 | s867587410 | Accepted | N = int(input())
A = list(map(int, input().split()))
s = sum(A)
l = 0
for i in range(N):
l += A[i]
if l>= s/2:
ans = min([abs(l-A[i]-sum(A[i:])),abs(l-sum(A[i+1:]))])
print(round(ans))
break
|
p02714 | s247714055 | Wrong Answer | N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")
for i in range(0,N-1):
for j in range(i+1,N):
k=2*j-i
if k >=N:
break
if S[i]!=S[j] and S[j]!=S[k]:
ans-=1
print(ans) |
p03109 | s036308341 | Wrong Answer | S = input()
S = int(S.replace("/",""))
if S < 20190430:
print("Heisei")
else:
print("TBD") |
p02946 | s392854112 | Accepted | K, X = map(int, input().split())
print(*[x for x in range (X-K+1, X+K)]) |
p03071 | s793732981 | Accepted | A, B = map(int,input().split())
X = 0
if A > B:
X = A
A -= 1
if A > B:
X += A
print(X)
else:
X += B
print(X)
else:
X = B
B -= 1
if A > B:
X += A
print(X)
else:
X += B
print(X)
|
p02842 | s232843359 | Accepted | import math
N = int(input())
X = math.ceil(N / 1.08)
if (math.floor(X * 1.08) == N):
print(X)
exit()
print(':(')
|
p02957 | s618682850 | Wrong Answer | A, B = map(int, input().split())
print((A+B)//2) if (A-B)%2 !=0 else print("IMPOSSIBLE") |
p03030 | s801229474 | Accepted | n = int(input())
lst = []
for i in range(n):
s, p = input().split()
p = int(p)
lst.append((s, p, i+1))
lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
print(num)
|
p02775 | s348554763 | Wrong Answer | N=input()
S=int(N)
count = 0
for i in range(len(N)):
if int(N[i])>=6:
count+=10-int(N[i])+1
else:
count+=int(N[i])
print(count) |
p03486 | s974441221 | Wrong Answer | S = list(input())
T = list(input())
S = [ord(s) for s in S]
T = [ord(s) for s in T]
S.sort()
T.sort(reverse=True)
LS = len(S)
LT = len(T)
ok = False
for i in range(min(LS,LT)):
s = S[i]
t = T[i]
if s < t:
ok = True
break
elif s == t:
continue
elif t < s:
ok = False
break
if ok:
print('Yes')
else:
print('No') |
p02618 | s401067797 | Wrong Answer | D = int(input())
C = list(map(int ,input().split()))
S = [list(map(int, input().split())) for i in range(D)]
sumc = sum(C)
last = [0 for i in range(26)]
for i in range(D):
ans = 0
m = 0
t = 0
for k in range(26):
last[t-1] = i+1
ans += S[i][t-1]
for j in range(26):
ans -= C[j]*(i+1 - last[j])
if ans > m:
m = ans
t = k + 1
print(t) |
p02663 | s700979709 | Accepted | #a,b,c=map(int,input().split())
#d=list(map(int,input().split()))
#n=int(input())
#d,x=map(int,input().split())
#a=[int(input()) for i in range(n)]
h1,m1,h2,m2,k=map(int,input().split())
t1=h1*60+m1
t2=h2*60+m2
print(t2-t1-k) |
p03419 | s260629309 | Wrong Answer | H, W =[int(i) for i in input().split()]
print(max(H-2, 0)*max(W-2, 0)) |
p02900 | s217350743 | Accepted | import math
a,b = map(int,input().split())
x = math.gcd(a,b)
s = [1]
for i in range(2,int(math.sqrt(x)+1)):
if x%i == 0:
while x%i == 0:
x //= i
s.append(i)
if x != 1:
s.append(x)
l = len(s)
print(l) |
p02847 | s677635723 | Wrong Answer | days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
s = raw_input()
for j in range(len(days)):
if days[j] == s: #raw_inpu
break
d =0
while(days[j] != 'SUN'):
j += 1
j %= len(days)
d += 1
print d |
p02888 | s407149537 | Accepted | N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
import bisect
for a in range(N):
for b in range(a):
A=L[a]
B=L[b]
c=bisect.bisect_left(L, A+B)
ans+=c-a-1
print(ans) |
p02608 | s641372842 | Accepted | n = int(input())
ans = [0 for a in range(10050)]
for i in range(1,105):
for j in range(1,105):
for k in range(1,105):
v = i*i+j*j+k*k+i*j+j*k+k*i;
if v<10050:
ans[v]+=1
for i in range(n):
print(ans[i+1]) |
p03000 | s886353336 | Wrong Answer | n, x = map(int, input().split())
l = list(map(int,input().split()))
total = 0
ans = 0
for i in range( len( l )):
total += l[ i ]
if total > x:
ans = i
break
print( i + 1 ) |
p03284 | s718633208 | Wrong Answer | N,K = map(int,input().split())
if K % N == 0:
print(int(0))
else:
print(int(1)) |
p03329 | s054429657 | Accepted | import sys
sys.setrecursionlimit(10**7)
N = int(input())
memo = [-1]*(N+1)
def rec(n):
if n == 0:
return 0
if memo[n] != -1:
return memo[n]
res = n
m = 1
while m <= n:
res = min(res,rec(n-m)+1)
m *= 6
m = 1
while m <= n:
res = min(res,rec(n-m)+1)
m *= 9
memo[n] = res
return memo[n]
print(rec(N)) |
p03861 | s577328317 | Accepted | a, b, x = map(int, input().split())
# 0~a-1でいくつあるか
if a == 0:
count_a = 0
else:
count_a = (a-1) // x + 1
# 0~bでいくつあるか
count_b = b // x + 1
print(count_b - count_a)
|
p02689 | s260579183 | Wrong Answer | nm=input().split()
h=input().split()
ans=set(range(int(nm[0])))
for i in range(int(nm[1])):
ab=input().split()
a=int(ab[0])-1
b=int(ab[1])-1
if(h[a]>=h[b]):
ans.discard(b)
if(h[b]>=h[a]):
ans.discard(a)
print(len(ans))
|
p03345 | s536890703 | Accepted | a,b,c,k = (map(int, input().split()))
if a-b>10**18:
print("Unfair")
elif k%2==0:
print(a-b)
else:
print(b-a) |
p04012 | s324787344 | Accepted | import collections
w = list(input())
c = collections.Counter(w)
for i in c.values():
if (i % 2 == 1):
print("No")
exit()
print("Yes") |
p02628 | s269968123 | Accepted | N, K = map(int, input().split())
P = sorted(list(map(int, input().split())))
print(sum(P[:K])) |
p03448 | s528796539 | Wrong Answer | A,B,C,X = [int(input()) for i in range(4)]
sum(100*a + 50*b + 10*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1))
print(sum) |
p02924 | s233419671 | Accepted | N = int(input())
print((N*(N-1))//2) |
p02881 | s715513902 | Wrong Answer | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
n = int(input())
for a in range(1,10**6+1):
if n%a==0:
b=n//a
ans=a+b-2
print(ans)
if __name__=="__main__":
main() |
p02754 | s706970930 | Wrong Answer | n,a,b = map(int,input().split())
if a!=0:
if n<a+b:
print(a)
else:
res = n - (a+b)
num = (res+1)//2
print(a+num)
else:
print(0) |
p03705 | s253052977 | Accepted | n,a,b=map(int,input().split())
mn=(n-1)*a+b
mx=(n-1)*b+a
print(max(mx-mn+1,0)) |
p03243 | s327839789 | Accepted | n = int(input())
for i in range(1,10):
if (i-1)*111 < n <= i*111:
print(i*111)
break |
p03469 | s060582520 | Wrong Answer | S = list(input())
S[3] = "8"
print(S[0:]) |
p03076 | s563142324 | Accepted | l=[input() for _ in range(5)]
i=0
m=9
for s in l:
s=int(s[-1])
if s==0:
i+=1
continue
m=min(m,s)
a=0
for s in l:
a+=(int(s)+9)//10*10
print(a if i==len(l) else a-10+m)
|
p03475 | s508076867 | Accepted | n=int(input())
csf=[list(map(int,input().split())) for _ in range(n-1)]
ans_list=[]
for i in range(n):
now=0
for g in range(i,n-1):
c,s,f=csf[g]
if now<=s:
now=s
if now%f==0:
now+=c
else:
now+=(f-now%f)+c
ans_list.append(now)
for l in range(n):
print(ans_list[l])
|
p02630 | s820890191 | Accepted | # coding: utf-8
import sys
from collections import defaultdict, Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
"""
dicで各要素の数を保持
"""
N = ir()
A = lr()
Q = ir()
counter = Counter(A)
dic = defaultdict(int)
for k, v in counter.items():
dic[k] = v
total = sum(A)
answer = []
for _ in range(Q):
b, c = lr()
num = dic[b]
total -= num * b
total += c * num
dic[b] = 0
dic[c] += num
answer.append(total)
print('\n'.join(map(str, answer)))
|
p02912 | s042845334 | Accepted | import heapq
n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
a[i] *= -1
heapq.heapify(a)
for i in range(m) :
at = -1*(-1*heapq.heappop(a)//2)
heapq.heappush(a, at)
print(sum(a)*-1) |
p02795 | s412569904 | Wrong Answer | h=int(input())
w=int(input())
n=int(input())
ans=0
cnt=0
while cnt < ans:
if h<w:
cnt+=w
w-=1
ans+=1
else:
cnt+=h
h-=1
ans+=1
print(ans) |
p03011 | s630492794 | Accepted | #!/usr/bin/env python3
p, q, r = map(int, input().split())
print(min(p+q, q+r, r+p)) |
p03360 | s912319500 | Wrong Answer | numeros = [int(x) for x in input().split()]
k = int(input())
index_maior = 0
maior = 0
for index, value in enumerate(numeros):
if value > maior:
maior = value
index_maior = index
numeros[index_maior] = numeros[index_maior] * 2 * k
print(sum(numeros))
|
p02552 | s457944638 | Accepted | print('0' if input()=='1' else '1') |
p03059 | s048190754 | Accepted | def INT():
return int(input())
def MI():
return map(int, input().split())
def LI():
return list(map(int, input().split()))
A, B, T = MI()
print(B * int((T + 0.5) // A)) |
p02982 | s284789800 | Wrong Answer | import math
n,d=map(int,input().split())
x=[]
for i in range(n):
x.append(list(map(int,input().split())))
cnt=0
for i in range(n-1):
for j in range(i+1,n):
d=0
for k in range(d):
d+=(x[i][k]-x[j][k])**2
if int(math.sqrt(d))**2==d:
cnt+=1
print(cnt) |
p03339 | s395731743 | Accepted | n = int(input())
s = input()
ans = [0]*(n+1)
for i in range(n):
if s[i] == 'E':
ans[i+1] = ans[i] + 1
else:
ans[i+1] = ans[i]
print(min(i-ans[i]+ans[n]-ans[i+1] for i in range(n))) |
p02912 | s398271800 | Wrong Answer | n,m=map(int,input().split())
a=list(map(int,input().split()))
import bisect
a.sort
for i in range(m):
b=a.pop()
b//=2
index=bisect.bisect_left(a,b)
a.insert(index,b)
print(sum(a))
|
p03109 | s518385656 | Accepted | S = list(input())
y = 1000*int(S[0])+100*int(S[1])+10*int(S[2])+int(S[3])
m = 10*int(S[5])+int(S[6])
d = 10*int(S[8])+int(S[9])
if y < 2019 :
print("Heisei")
elif y == 2019 and m <= 4 :
print("Heisei")
else :
print("TBD")
|
p03416 | s342529711 | Accepted | a,b, = map(int,input().split())
ans = 0
for i in range(a,b+1):
stri = str(i)
if stri[0] == stri[-1] and stri[1] == stri[-2]:
ans += 1
print(ans) |
p03544 | s992420942 | Accepted | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 01:22:46 2020
@author: shinba
"""
L = [2,1]
for i in range(85):
L.append(L[-2]+L[-1])
print(L[int(input())])
|
p03471 | s514642569 | Wrong Answer | N, Y = map(int, input().split())
cond = 0
for a in range(N):
for b in range(N):
res = Y-10000*a-5000*b
if res < 0:
continue
s,t = divmod(res,1000)
if (0 <= s) and (a+b+s == N) and (t == 0):
cond = 1
break
if cond:
break
if cond:
print(a,b,s)
else:
print('-1 -1 -1') |
p03711 | s265482728 | Accepted | x,y = map(int,input().split())
g1=[1,3,5,7,8,10,12]
g2=[4,6,9,11]
g3=[2]
if x in g1 and y in g1:
print('Yes')
elif x in g2 and y in g2 :
print('Yes')
elif x in g3 and y in g3 :
print('Yes')
else:
print('No')
|
p02744 | s335265128 | Wrong Answer | import math
import queue
n = int(input())
q = queue.Queue()
q.put("a")
while True:
c = q.get()
if len(c) > n:
break
if len(c) == n:
print(c)
nx = c[-1]
if nx != "a":
q.put(c + chr(ord(nx) - 1))
q.put(c + nx)
q.put(c + chr(ord(nx) + 1))
|
p03013 | s790557168 | Wrong Answer | n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[0]*(n+1)
dp[0]=1
for i in range(m):
dp[a[i]]=-1
for i in range(1,n+1):
if dp[i]==-1:continue
if dp[i-1]!=-1:
dp[i]+=dp[i-1]
if i>1 and dp[i-2]!=-1:
dp[i]+=dp[i-2]
print(dp[-1]) |
p02900 | s744249687 | Accepted | def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
a, b = map(int, input().split())
print(len(set(prime_factorize(a)) & set(prime_factorize(b))) + 1) |
p03243 | s511538925 | Accepted | N = int(input())
print(((N+110)//111)*111)
|
p02700 | s328035829 | Accepted | a,b,c,d=map(int,input().split())
x=a//d
if a%d!=0:
x+=1
y=c//b
if c%b!=0:
y+=1
if x<y:
print("No")
else:
print("Yes") |
p02578 | s371191495 | Wrong Answer | n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
if l[i]>l[i+1]:
d=d+abs(l[i+1]-l[i])
i=i+1
r=i
for b in range(r,n):
d=d+(u-l[b])
print(d)
|
p03821 | s635356215 | Accepted | import bisect,copy,heapq,string
from collections import *
from math import *
from itertools import *
import sys
def input() : return sys.stdin.readline().strip()
def INT() : return int(input())
def MAP() : return map(int,input().split())
def LIST() : return list(MAP())
n = INT()
a = [LIST() for i in range(n)]
ans = 0
for x in a[::-1]:
if ( x[0] + ans ) % x[1] != 0:
ans += x[1] - ( x[0] + ans ) % x[1]
print(ans) |
p03012 | s827485786 | Wrong Answer | n = int(input())
w = list(map(int, input().split()))
t = round(sum(w)/2)
x = 0
y = 0
for i in w:
if x < t:
x += i
else:
y += i
print(abs(x-y)) |
p02624 | s253642508 | Wrong Answer | n = int(input())
res = 0
for i in range(1, n+1):
x = n//i
res += i*x*(x+1)/2
print(res) |
p02598 | s419194465 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
# 二分探索の為のKey関数
def f(m):
cut=0
for aa in a:
cut+=(aa-1)//m
if cut > k:
return False
return True
l,r=0,10**9
while r-l>1:
m=(l+r)//2
if f(m):
r=m
else:
l=m
print(r)
|
p03208 | s199202192 | Accepted | n,k = map(int,input().split())
h = [int(input()) for _ in range(n)]
h.sort()
ans = float('inf')
for i in range(n-k+1):
ans = min(ans,(h[i+k-1] - h[i]))
print(ans) |
p02767 | s875200582 | Wrong Answer | n = int(input())
r = list(map(int, input().split()))
o = (max(r) + min(r)) // 2
old = None
for x in range(o//2, max(r)):
t = sum([(i - x) ** 2 for i in r])
if not old:
old = t
continue
if t < old:
old = t
print(old) |
p02700 | s211031685 | Accepted | A, B, C, D = map(int, input().split())
for i in range(999999):
C -= B
if C <= 0:
print('Yes')
break
A -= D
if A <= 0:
print('No')
break |
p02785 | s252555461 | Accepted | h, k = map(int, input().split())
h = sorted(map(int, input().split()), reverse=True)
n = sum(h[k:])
print(n) |
p03494 | s420103626 | Accepted | import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans)) |
p02712 | s043403779 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)
def inpl():
return list(map(int, input().split()))
N = int(input())
ans = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
continue
ans += i
print(ans)
|
p03486 | s009634584 | Accepted | s = input()
t = input()
s_list = sorted(list(s))
t_list = sorted(list(t),reverse=True)
s_hoge = ''.join(s_list)
t_hoge = ''.join(t_list)
if s_hoge < t_hoge:
print('Yes')
else:
print('No') |
p02622 | s841038592 | Accepted | s = input()
t = input()
ans = 0
if s == t:
print(ans)
else:
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
|
p02909 | s575217980 | Accepted | A = ['Sunny','Cloudy','Rainy']
S = input()
for i in range(3):
if A[i] == S:
ans = A[(i+1)%3]
print(ans) |
p02789 | s902700144 | Accepted | args = input().split(' ')
N = int(args[0])
M = int(args[1])
isAccepted = (N == M)
print("Yes" if isAccepted else "No") |
p02860 | s028366331 | Wrong Answer | n = int(input())
s = input()
if s[:n] == s[n:]:
print('Yes')
else:
print('No') |
p02959 | s768120399 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(n):
if b[i] <= a[i]:
c = c + b[i]
else:
d = min(b[i]-a[i],a[i+1])
c = c + a[i] + d
a[i+1] = a[i+1] -d
print(c) |
p03105 | s046997324 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
def main():
A, B, C = in_nn()
ans = min(B // A, C)
print(ans)
if __name__ == '__main__':
main()
|
p03103 | s895379750 | Wrong Answer | n, m = map(int, input().split())
stores = [tuple(map(int, input().split())) for _ in range(n)]
dict_stores = dict(stores)
sorted_dict = sorted(dict_stores.items(), key=lambda x: x[0])
total = 0
ans = 0
for cost, number in sorted_dict:
total += number
if total >= m:
diff = m - (total - number)
ans += cost * diff
break
else:
ans += cost * number
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.