problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03767
|
s854127112
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(a[n:2*n]))
|
p02714
|
s033843075
|
Accepted
|
n = int(input())
s = input()
freq = {'R': 0, 'G': 0, 'B': 0}
for x in s:
freq[x] += 1
ans = freq['R'] * freq['G'] * freq['B']
for i in range(n-2):
for j in range(i+1, n-1):
k = j + (j-i)
if k < n and s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans)
|
p02729
|
s599541803
|
Wrong Answer
|
N, M = map(int, input().split())
print(N*(N-1)+M*(M-1))
|
p02603
|
s500247943
|
Wrong Answer
|
N = int(input())
A = list(map(int, input().split()))
n_money = 1000
n_stock = 0
for i in range(N-1):
if A[i+1] > A[i]:
# buy
n_stock = n_money // A[i]
n_money = n_money - n_stock * A[i]
else:
# sell
n_money += n_stock * A[i]
n_stock = 0
n_money += n_stock * A[N-1]
print(n_money)
|
p03860
|
s675749090
|
Accepted
|
a,b,c=input().split()
print(a[0]+b[0]+c[0])
|
p02663
|
s680839223
|
Wrong Answer
|
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007
h1, m1, h2, m2, k = map(int, input().split())
minute = ((h2 * 60) + m2) - (h1 * 60) + m1
print(minute - k)
|
p03803
|
s488954982
|
Accepted
|
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
a, b = rm()
if b == 1:
b = 14
if a == 1:
a = 14
if a < b:
print('Bob')
elif a > b:
print('Alice')
else:
print('Draw')
|
p03408
|
s831745036
|
Wrong Answer
|
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
max = 0
for ss in s:
if s.count(ss) -t.count(ss) > 0:
max = s.count(ss) - t.count(ss)
print(max)
|
p03556
|
s536006205
|
Accepted
|
N=int(input())
i = 0
while N>=i*i :
i+=1
print((i-1)*(i-1))
|
p02935
|
s765555753
|
Accepted
|
n =int(input())
V = list(map(int,input().split()))
V.sort()
ans = V[0]
for i in range(1,n):
ans = (ans+V[i])/2
print(ans)
|
p02983
|
s764655691
|
Wrong Answer
|
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn:
l = l % 2019
print (l * (l + 1))
else:
print (0)
|
p03469
|
s071617039
|
Wrong Answer
|
import datetime
S = input()
S = datetime.datetime.strptime(S, '%Y/%m/%d')
a = int(S.year)
if a != 2018:
S = S.replace(2018)
S = S.date
print(S)
|
p02683
|
s275495290
|
Accepted
|
n, m, X = map(int, input().split())
ans = 10**9
price = []
a = []
for _ in range(n):
c = [int(x) for x in input().split()]
price.append(c[0])
a.append(c[1:])
for i in range(1 << n):
l = [0]*m
tmp = 0
for j in range(n):
if (i >> j) & 1:
tmp += price[j]
for x in range(m):
l[x] += a[j][x]
if all(x >= X for x in l):
ans = min(ans, tmp)
print(-1 if ans == 10**9 else ans)
|
p03261
|
s818449825
|
Wrong Answer
|
n=int(input())
li=[]
for i in range(n):
if i==0:
li.append(input())
else:
s=input()
if s not in li and li[-1][-1]==s[0]:
continue
else:
print("No")
exit()
print("Yes")
|
p03860
|
s643170399
|
Wrong Answer
|
S = input().split(" ")
print([i[0] for i in S])
|
p03073
|
s038196943
|
Wrong Answer
|
S = list(input())
L = len(S)
def change():
global moji
if moji == "1":
moij = "0"
else:
moji = "1"
# case 1
count_1 = 0
moji = "1"
for c in range(L):
if moji == S[c]:
pass
else:
count_1 += 1
change()
# case 2
count_2 = 0
moji = "0"
for c in range(L):
if moji == S[c]:
pass
else:
count_2 += 1
change()
if count_1 < count_2:
print(count_1)
else:
print(count_2)
|
p03951
|
s323717792
|
Wrong Answer
|
N = int(input())
s = input()
t = input()
if s == t:
print(N)
exit(0)
tr = t[::-1]
match = 0
for i in reversed(range(0, N)):
if s[i] == tr[i]:
match += 1
else:
break
print(N*2-match)
|
p03252
|
s913408861
|
Wrong Answer
|
s=input()
t=input()
n=len(s)
f=0
a=[[] for i in range(26)]
for i in range(n):
if s[i]!=t[i]:
if len(a[ord(s[i])-97])==0:
a[ord(s[i])-97].append(t[i])
else:
if a[ord(s[i])-97][0]!=t[i]:
f=1
x=[a[i][0] for i in range(26) if len(a[i])==1]
if len(x)!=len(set(x)):
f=1
print("Yes" if f==0 else "No")
|
p03386
|
s320959537
|
Wrong Answer
|
A,B,K=map(int, input().split())
if B-A<2*K:
for i in range(A,B+1):
print(i)
else:
for i in range(K):
print(A+i)
for i in range(K):
print(B-K+i)
|
p03994
|
s121699193
|
Accepted
|
s = input()
k = int(input())
ans = []
for c in s[:-1]:
to_a = (ord('z')-ord(c)+1) % 26
if k < to_a:
ans.append(c)
else:
k -= to_a
ans.append('a')
else:
c = s[-1]
x = ord(c)-ord('a')
y = (k+x) % 26
ans.append(chr(ord('a')+y))
print(''.join(ans))
|
p03282
|
s895023707
|
Accepted
|
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s = readline().rstrip().decode()
k = int(read())
for ss in s:
ss = int(ss)
if ss > 1:
print(ss)
break
else:
if k > 1:
k -= 1
else:
print(ss)
break
|
p03220
|
s395194726
|
Accepted
|
n = int(input())
t, a = map(int, input().split())
lst = [ abs((t - i * 0.006)-a) for i in list(map(int, input().split()))]
print(lst.index(min(lst)) + 1)
|
p03387
|
s252433631
|
Accepted
|
num = sorted(list(map(int,input().split())))
ans = num[2]-num[1]
num[0] += num[2]-num[1]
num[1] += num[2]-num[1]
while num[0]<num[1]:
ans += 1
num[0] += 2
if num[0] != num[1]:
ans += 1
print(ans)
|
p02640
|
s948798829
|
Wrong Answer
|
X, Y = map(int, input().split())
bird_only = 2 * X
r = (Y-bird_only) / 2
if r <= X:
print('Yes')
else:
print('No')
|
p03565
|
s483583225
|
Accepted
|
s=input()
t=input()
for i in range(len(t)-1,len(s))[::-1]:
if s[i]==t[-1] or s[i]=="?":
if all(s[i-j]==t[-1-j] or s[i-j]=="?" for j in range(len(t))):
s=s.replace("?","a")
print(s[:i-len(t)+1]+t+s[i+1:])
exit()
print("UNRESTORABLE")
|
p02811
|
s282438047
|
Accepted
|
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
K, X = MAP()
print("Yes" if K*500-X>=0 else "No")
|
p02772
|
s741222250
|
Accepted
|
n = int(input())
aa = list(map(int, input().split(' ')))
result = 'APPROVED'
for a in aa:
if a % 2 == 0:
if a % 3 != 0 and a % 5 != 0:
result = 'DENIED'
break
print(result)
|
p02555
|
s086796430
|
Accepted
|
s=int(input())
mod=10**9+7
dp=[0]*2001
for i in range(3,2001):
dp[i]+=1
for j in range(i-3,-1,-1):
dp[i]+=dp[j]
dp[i]%=mod
print(dp[s])
|
p03705
|
s298378877
|
Wrong Answer
|
n,a,b=map(int,input().split())
if a==b:
print(1)
elif n==1:
print(0)
elif n==2:
print(2)
else:
print((b-a)*(n-2)+1)
|
p03565
|
s354427030
|
Accepted
|
def main():
s = input()
t = input()
s = s.replace('?','.')
import re
for i in range(len(s)-len(t),-1,-1):
if re.match(s[i:i+len(t)],t):
s = s.replace('.','a')
print(s[:i]+t+s[i+len(t):])
return 0
print('UNRESTORABLE')
if __name__ == '__main__':
main()
|
p03455
|
s456048481
|
Accepted
|
a, b = map(int, input().split())
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd")
|
p02835
|
s448891255
|
Accepted
|
a,b,c = map(int, input().split())
if a+b+c >= 22:
print("bust")
else:
print("win")
|
p02708
|
s889157917
|
Wrong Answer
|
N,K=map(int,input().split())
M=N+1
L=K-1
print(M*(M*M+5)/6 + L*(L*L*2+L*3-5-M*(L+1)*3)/6%(10**9+7))
|
p03073
|
s236887414
|
Accepted
|
s = input()
so=""
se=""
for i in range(1, len(s), 2):
so += s[i]
for i in range(0, len(s), 2):
se += s[i]
print(len(s) - max(so.count("1") + se.count("0"), so.count("0") + se.count("1")))
|
p02713
|
s629729903
|
Accepted
|
K = int(input())
ans = 0
def gcd(a, b):
if a > b:
a, b = b, a
if a == 0:
return b
else:
return gcd(a, b % a)
for c in range(1, K+1):
for b in range(1, K+1):
for a in range(1, K+1):
ans += gcd(gcd(a, b), c)
print(ans)
|
p03680
|
s191017174
|
Accepted
|
N = int(input())
a = [int(input()) for _ in range(N)]
next = 0
for i in range(1, N):
if a[next] == 2:
print(i)
exit()
next = a[next]-1
print(-1)
|
p03623
|
s325236535
|
Wrong Answer
|
x,a,b = map(int,input().split())
print('AB'[abs(a-x)<abs(b-x)::2])
|
p04005
|
s976994729
|
Accepted
|
a,b,c=map(int,input().split())
mina=0
minb=0
minc=0
if a%2==1:
mina=b*c
else:
mina=0
if b%2==1:
minb=c*a
else:
minb=0
if c%2==1:
minc=a*b
else:
minc=0
print(min(mina,minb,minc))
|
p02787
|
s174261315
|
Accepted
|
import sys
input = sys.stdin.readline
h,n = map(int,input().split())
mg = [list(map(int,input().split())) for i in range(n)]
DP = [[10**18 for i in range(h+1)] for j in range(n+1)]
for i in range(n+1):
DP[i][0] = 0
for i in range(1,n+1):
for j in range(1,h+1):
DP[i][j] = min(DP[i][j],DP[i-1][j])
DP[i][j] = min(DP[i][j],DP[i][max(0,j-mg[i-1][0])]+mg[i-1][1])
print(DP[-1][-1])
|
p02601
|
s515924370
|
Accepted
|
input_ = input()
a = int(input_.split(' ')[0])
b = int(input_.split(' ')[1])
c = int(input_.split(' ')[2])
k = int(input())
count = 0
ans = "No"
while count < k:
if a >= b:
b *= 2
count += 1
elif b >= c:
c *= 2
count += 1
if a < b and b < c:
ans = "Yes"
break
print(ans)
|
p03087
|
s344234173
|
Accepted
|
N, Q = map(int , input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
l, r = map(int, input().split())
print(t[r-1] - t[l-1])
|
p02677
|
s864227553
|
Wrong Answer
|
a,b,h,m = map(int,input().split())
import math
h_pi = h * 0.0833333333* math.pi +m * (-math.pi*0.0069444444444) + math.pi/4
m_pi = math.pi/2 - m*60*math.pi
if h_pi - m_pi <= math.pi :
theta = h_pi - m_pi
else :
theta = 2 * math.pi - (h_pi - m_pi)
ans = a**2 + b**2 -2 * a * b * math.cos(theta)
print(math.sqrt(ans))
print(h_pi)
|
p02555
|
s561505936
|
Wrong Answer
|
from scipy.special import comb
S = int(input())
if S == 1 or S == 2:
print(0)
n = S//3
ans = 0
for i in range(n):
a = S-3*i
b = i+1
ans += comb(a, b, exact=True)
print(ans%((10**9)+7))
|
p03162
|
s613584776
|
Accepted
|
def resolve():
n = int(input())
dp = [[0]*3 for _ in range(n+1)]
for i in range(1, n+1):
nums = list(map(int, input().split()))
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], nums[j] + dp[i-1][k])
print(max(dp[-1]))
resolve()
|
p03338
|
s259491386
|
Accepted
|
N=int(input())
S=input()
ans=0
for i in range(1,N):
T1=S[:i]
T2=S[i:]
sub=0
L=set(T1)
for t in set(T2):
if t in L:
sub+=1
ans=max(ans, sub)
print(ans)
|
p03013
|
s175449829
|
Wrong Answer
|
n,m=map(int,input().split())
lst=[int(input()) for i in range(m)]
DP=[0]*(n+1)
temp=0
DP[0]=1
for i in range(1, n+1):
if i==1:
DP[i]=1
elif i in lst:
DP[i]=0
else:
DP[i]=DP[i-1]+DP[i-2]
print(DP[n]%1000000007)
|
p02713
|
s214610104
|
Accepted
|
from fractions import gcd
K = int(input())
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
|
p02594
|
s754377786
|
Accepted
|
X=int(input())
if X>=30:
print("Yes")
else:
print("No")
|
p02707
|
s116370181
|
Wrong Answer
|
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1):
ans[a[i]-1] += 1
for i in range(n-1):
print(ans[i])
|
p02552
|
s124042116
|
Accepted
|
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
def main():
x = int(input())
if x == 0:
res = 1
else:
res = 0
print(res)
main()
|
p02879
|
s151428729
|
Wrong Answer
|
a,b=map(int,input().split())
ans=-1
if a<10 and b<10:
print(a*b)
|
p03778
|
s538473962
|
Wrong Answer
|
w, a, b = [int(x) for x in input().split()]
print(min(abs(a + w - b), abs(b + w - a)))
|
p03371
|
s175216437
|
Accepted
|
# ABC95_C
a,b,c,x,y = map(int,input().split())
ans = 0
if c * 2 > a + b:
ans += a * x + b * y
else:
if x > y:
ans += c * 2 * y
if a > c * 2:
ans += (x - y) * c * 2
else:
ans += (x - y) * a
else:
ans += c * 2 * x
if b > c * 2:
ans += (y - x) * c * 2
else:
ans += (y - x) * b
print(ans)
|
p03745
|
s523692359
|
Wrong Answer
|
n=int(input())
lis=list(map(int,input().split()))
ans=1
if n<=2:
ans=1
else:
bb=lis.pop(0)
b=lis.pop(0)
f=False
for i in lis:
if n<=2:
break
if f:
f^=1
elif (bb>b and b<i) or (bb<b and b>i):
ans+=1
f^=1
bb=b
b=i
print(ans)
|
p02754
|
s682242151
|
Wrong Answer
|
N, A, B = map(int, input().split())
ans = (N//(A+B)) * A
if(N % (A+B) <= A):
ans += (N % (A+B))
print(ans)
|
p02682
|
s316802227
|
Wrong Answer
|
import itertools
import sys
sys.setrecursionlimit(10**7)
input = lambda: sys.stdin.readline().strip()
def main():
A,B,C,K = map(int,input().split())
abc = [A,B,C]
ans = 0
a = A
b = (K-a) if (K-a)>=0 and (K-a)<B else B
c = K-A-B
print(a-c)
main()
|
p03329
|
s112765655
|
Accepted
|
n = int(input())
dp = [0]
for i in range(1, n+1):
now = []
k = 1
while i >= k:
now.append(dp[i-k]+1)
k *= 6
k = 1
while i >= k:
now.append(dp[i-k]+1)
k *= 9
dp.append(min(now))
print(dp[-1])
|
p02793
|
s994911286
|
Accepted
|
import sys
from fractions import gcd
input = sys.stdin.readline
def mod_inverse(n, mod=10**9+7):
return pow(n, mod-2, mod)
def lcm(a, b):
return a * b // gcd(a, b)
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
ans = 0
inv_sum = 0
l = A[0]
for a in A:
l = lcm(l, a)
inv_sum = (inv_sum + mod_inverse(a)) % mod
print(l * inv_sum % mod)
|
p02777
|
s823184802
|
Wrong Answer
|
input_str = input().split()
input_int = list(map(int, input().split()))
input_line = input()
input_dict = {}
input_dict[input_str[0]] = input_int[0]
input_dict[input_str[1]] = input_int[1]
input_dict[input_line] = input_dict[input_line] - 1
for i in input_dict:
print(input_dict[i],end=' ')
|
p02924
|
s730699801
|
Accepted
|
N=int(input())
print(N*(N-1)//2)
|
p03478
|
s942492719
|
Accepted
|
N,A,B = map(int,input().split())
t = 0
for i in range(N+1):
if A <= sum([int(x) for x in str(i)]) <= B:
t += i
print(t)
|
p04033
|
s374655110
|
Wrong Answer
|
a, b = map(int, input().split())
if a <= 0 and b >= 0:
print(0)
elif a > 0:
print("Positive")
else:
if (b-a+1) % 2 == 0:
print("Positive")
else:
print("Negative")
|
p02768
|
s874702843
|
Wrong Answer
|
def fermat_binom(n,k,p):
if k > n:
return 0
num = 1
for i in range(n,n-k,-1):
num = (num*i)%p
denom = 1
for i in range(1,k+1):
denom = (denom*i)%p
return (num * pow(denom,p-2,p))%p
if __name__ == '__main__':
n, a, b = map(int, input().split())
mod = 1000000007
k = pow(2, n, mod)
k1 = fermat_binom(n, a, mod)
k2 = fermat_binom(n, b, mod)
r = (k1+k2)%mod
print(max(k-r-1, 0))
|
p02553
|
s823031675
|
Accepted
|
a,b,c,d=map(int,input().split())
x=max(a*c,a*d,b*c,b*d)
if (b<0 and 0<c) or (d<0 and 0<a):
print(x)
else:
print(max(x,0))
|
p02552
|
s473929813
|
Accepted
|
N = int(input())
if N==0:
print("1")
else:
print("0")
|
p03472
|
s129967644
|
Accepted
|
import math
n,h=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(reverse=True)
k=ab[0][0]
ab.sort(reverse=True,key=lambda x:x[1])
ans=0
while h>0:
if ans==n:
break
if k<=ab[ans][1]:
h-=ab[ans][1]
ans+=1
else:
break
if h<=0:
print(ans)
else:
print(ans+math.ceil(h/k))
|
p02577
|
s317618666
|
Accepted
|
N = list(map(int, input().split()))
n_sum = 0
for n in N:
n_sum += n
if n_sum % 9 == 0:
print('Yes')
else:
print('No')
|
p03416
|
s545741321
|
Wrong Answer
|
A,B = map(int, input().split())
count = 0
for i in range(A,B+1):
k = str(i)
karray = list(map(int, k))
if karray == karray.reverse:
count += 1
print(count)
|
p02947
|
s483469596
|
Wrong Answer
|
from collections import defaultdict
d=defaultdict(int)
n,*s=open(0).read().split()
for i in s:d["".join(sorted(list(i)))]+=1
print(max(d.values()))
|
p02576
|
s426345286
|
Wrong Answer
|
n,x,t = map(int, input().split())
ans = n / x
ans = round(ans)
ans = ans * t
if ans == 0:
ans = t
print(ans)
|
p02748
|
s582154369
|
Accepted
|
A, B, M = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
r = min(a) + min(b)
for i in range(M):
x, y, c = [int(x) for x in input().split(' ')]
r = min(r, a[x-1] + b[y-1] - c)
print(r)
|
p02615
|
s128467955
|
Accepted
|
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0]
if n%2 == 0:
ans += sum(A[1:n//2])*2
else:
ans += sum(A[1:n//2])*2 + A[n//2]
print(ans)
|
p02552
|
s328623931
|
Accepted
|
n = int(input())
print(n^1)
|
p02725
|
s961467534
|
Accepted
|
def main():
length, num = map(int, input().split())
a = list(map(int, input().split()))
max_dis = 0
first_h = a[0]
prev_h = a[0]
for h in a[1:]:
dis = h - prev_h
max_dis = max(max_dis, dis)
prev_h = h
dis = (length - prev_h) + first_h
max_dis = max(max_dis, dis)
print(length - max_dis)
if __name__ == "__main__":
main()
|
p02693
|
s837391766
|
Accepted
|
K = int(input())
A,B = map(int,input().split())
judge=False
for x in range(A,B+1):
if x%K==0:
judge=True
break
if judge==True:
print("OK")
else:
print("NG")
|
p03665
|
s715018408
|
Accepted
|
N,P = map(int, input().split())
A = list(map(int, input().split()))
x = y = 0
for i in range (N):
if A[i]%2 == 0:
x += 1
else:
y += 1
if P%2 == 0:
print(2**N if y == 0 else 2**(N-1))
else:
print(0 if y == 0 else 2**(N-1))
|
p02546
|
s579922104
|
Wrong Answer
|
s = input()
if s[-1] == s:
print(s+"es")
else:
print(s+"s")
|
p03282
|
s887996987
|
Wrong Answer
|
s = input()
k = int(input())
flag = 0
for i in s:
if i == "1":
continue
else:
print(i)
flag = 1
break
if flag == 0:
print("1")
|
p02933
|
s709928147
|
Accepted
|
A = int(input())
S = input()
if A < 3200:
print("red")
else:
print(S)
|
p03208
|
s237433700
|
Accepted
|
N,K = map(int,input().split())
tree = sorted([int(input())for i in range(N)])
d = 10**18
for i in range(N-K+1):
d = min(d,tree[i+K-1]-tree[i])
print(d)
|
p02695
|
s791139351
|
Accepted
|
from itertools import combinations_with_replacement as combi
n, m, q = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(q)]
def points(A, queries):
score = 0
for query in queries:
a, b, c, d = query
if A[b-1] - A[a-1] == c:
score += query[3]
return score
score = 0
for iter in combi([i for i in range(1, m+1)], n):
score = max(points(sorted(iter), queries), score)
print(score)
|
p03282
|
s461441186
|
Accepted
|
def main():
S = input()
K = int(input())
one_seq = sum([int(c) for c in S[:min([K, len(S)])]])
if one_seq == min([K, len(S)]):
print(1)
else:
for c in S:
if c != '1':
print(c)
return
if __name__ == '__main__':
main()
|
p02665
|
s962488228
|
Accepted
|
import sys
N = int(input())
A = list(map(int,input().split()))
B = []
tmp = 1
for i in range(N+1):
B.append(tmp)
tmp -= A[i]
if tmp < 0:
print(-1)
sys.exit()
tmp *= 2
for i in range(N, 0, -1):
A[i-1] += A[i]
ans = 0
for i in range(N+1):
ans += min(B[i], A[i])
print(ans)
|
p03145
|
s387198570
|
Accepted
|
a,b,c = map(int,input().split())
print(a*b//2)
|
p02912
|
s227508723
|
Accepted
|
from heapq import *
n, m = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x:x * (-1), a))
heapify(a)
for i in range(m):
temp_num = heappop(a) * (-1)
heappush(a,(-1) * (temp_num //2))
print(-sum(a))
|
p02693
|
s814322695
|
Wrong Answer
|
K = int(input())
A, B = map(int,input().split())
C = A % K
if B - A >= K - 1:
print('OK')
elif C + B - A >= K:
print('OK')
else:
print('NG')
|
p02795
|
s928032196
|
Wrong Answer
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N//H != 0:print(N//H + 1)
else: print(N//H)
else:
if N//W != 0:print(N//W + 1)
else: print(N//W)
|
p02767
|
s179773900
|
Accepted
|
number = int(input())
coordinates = list(map(int, input().split()))
coordinates.sort()
coordinates.reverse()
#print(coordinates)
list = []
for i in range(coordinates[0]+1):
total=0
for j in range(number):
total += (coordinates[j]-i)**2
list.insert(0, total)
list.sort()
print(list[0])
|
p02797
|
s813220953
|
Accepted
|
n,k,s= map(int, input().split())
ans=[s]*k
if s<=100:
zeros=[10**9]*(n-k)
else:
zeros=[s-1]*(n-k)
ans.extend(zeros)
print(*ans)
|
p02743
|
s938672592
|
Accepted
|
from decimal import Decimal
a, b, c = map(Decimal, input().split())
if a.sqrt() + b.sqrt() < c.sqrt():
print("Yes")
else:
print("No")
|
p03210
|
s588360129
|
Wrong Answer
|
x = int(input())
if x == 7 or x == 5 or x == 3:
print('Yes')
else:
print('No')
|
p03103
|
s034738579
|
Accepted
|
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
ans=0
for i in range(n):
if ab[i][1]<m:
ans+=ab[i][0]*ab[i][1]
m-=ab[i][1]
elif ab[i][1]>=m:
ans+=ab[i][0]*m
break
print(ans)
|
p03835
|
s271939209
|
Accepted
|
k,s = list(map(int, input().split()))
cnt=0
for i in range(k+1):
for j in range(k+1):
if s>=i+j>=s-k:
cnt+=1
print(cnt)
|
p02691
|
s494320333
|
Accepted
|
import collections
def solve(k, r):
count = {}
ans = 0
for i, n in enumerate(r):
target = i-n
ans += count.get(target, 0)
count[i+n] = count.get(i+n, 0)+1
return ans
k = int(input())
r = list(map(int, input().split()))
print(solve(k, r))
|
p02660
|
s712381844
|
Accepted
|
n=int(input())
import math
s=round(math.sqrt(n))+1
i=2
c1=0
c2=1
ans=0
while i<=s:
if n%i==0:
n//=i
c1+=1
if c1==c2:
c1=0
c2+=1
ans+=1
else:
c2=1
i+=1
c1=0
if n>s:
ans+=1
print(ans)
|
p03131
|
s561981247
|
Wrong Answer
|
K, A, B = map(int, input().split())
if (B - A) <= 2:
print(K)
elif K <= A:
print(K)
else:
M = K - A + 1
ans = A + M // 2 * (B - A) + M % 2
print(ans)
|
p02988
|
s988166119
|
Accepted
|
#abc132_b.py
def is_center(A,i):
if (A[i-1]<A[i] and A[i]<A[i+1]) or (A[i-1]>A[i] and A[i]>A[i+1]):
return True
return False
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(1,N-1):
if is_center(A,i):
cnt+= 1
print(cnt)
|
p03720
|
s803917725
|
Wrong Answer
|
from collections import Counter
from operator import itemgetter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(M):
a, b = map(int, input().split())
my_count[a] += 1
my_count[b] += 1
my_count = sorted(my_count.items())
for i in my_count:
print(i[1])
|
p02647
|
s152313304
|
Wrong Answer
|
n, k = map(int, input().split())
A = list(map(int, input().split()))
A2 = [0] * n
A3 = [n] * n
if k > n:
print(*A3)
else:
for l in range(41):
for j in range(n):
if A[j] == n:
A2[j] =n
else:
for i in range(n):
if A[i] >= abs(i-j):
A2[j] += 1
A = A2
A2 = [0] * n
if A == [n]*n:
break
print(*A)
|
p02859
|
s599927561
|
Wrong Answer
|
r = float(input())
re1 = 1 * 1 * 3.14
re = r * r * 3.14
print(int(re/re1))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.