problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02918 | s597471534 | Wrong Answer | n,k = map(int, raw_input().split())
s = raw_input()
cd = 0
d = None
for l in s:
if d != l:
cd +=1
d = l
score = 0
for u,v in zip(s,s[1:]):
if u == v:
score +=1
if cd > 2:
score += (cd - 2) * 2
cd = 2
if cd == 2:
score +=1
print score |
p03416 | s377731724 | Accepted | a,b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
s = str(i)
g = s[::-1]
if (s == g): cnt += 1
print(cnt) |
p03437 | s470274392 | Accepted | x,y = map(int,input().split())
if x % y == 0:
print(-1)
else:
print(x) |
p02818 | s780788406 | Accepted | A, B, K = map(int, input().split())
taka,aoki = 0, 0
taka = max(0,A-K)
aoki = max(0,B + min(0,A-K))
print(taka,aoki)
|
p03951 | s905565190 | Wrong Answer | N = int(input())
S = input()
T = input()
ans = S+T
for i in range(1,N+1):
#print(S[-i:],T[:i])
if S[-i:] == T[:i]:
ans = S + T[i:]
print(ans) |
p03035 | s731562736 | Accepted | A,B=map(int,input().split())
if A>=13:
print(B)
elif 6<=A<=12:
print(B//2)
else:
print(0)
|
p02631 | s068509671 | Accepted | N = int(input())
a = list(map(int, input().split()))
xor_total = 0
for sunuke in a:
xor_total = xor_total ^ sunuke
for i in range(N):
print(xor_total ^ a[i]) |
p02793 | s918687042 | Accepted | from fractions import gcd
def calc_lcm(x, y):
return (x * y) // gcd(x, y)
n = int(input())
a = list(map(int, input().split(' ')))
lcm = a[0]
for i in range(1, n):
lcm = calc_lcm(lcm, a[i])
s = 0
for i in range(n):
s += lcm // a[i]
ans = s % 1000000007
print(ans)
|
p03041 | s930211781 | Accepted | N, K = map(int, input().split())
S = list(input())
S[K-1] = chr(ord(S[K-1]) + 32)
print("".join(S))
|
p03001 | s205071283 | Accepted | W, H, x, y = map(int, input().split())
if x == W/2 and y == H/2:
area = (W*H)/2
print(area, 1)
else:
area = (W*H)/2
print(area, 0)
|
p02797 | s903484556 | Accepted | N, K, S = map(int, input().split())
if S == 10**9:
A = [S]*K + [1]*(N-K)
else:
A = [S]*K + [S+1]*(N-K)
print(' '.join(map(str, A))) |
p02843 | s813592922 | Accepted | x = int(input())
for i in range(1,20):
if i*100<=x<=i*105:
print(1)
break
else:
if x>=2000:
print(1)
else:
print(0) |
p02748 | s301690599 | Accepted | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = []
for _ in range(M):
xyc.append(tuple(map(int, input().split())))
m = min(a) + min(b)
for ticket in xyc:
x, y, c = ticket
temp = a[x - 1] + b[y - 1] - c
m = min(temp, m)
print(m) |
p02720 | s230836863 | Accepted | from collections import deque
K = int(input())
queue = deque([i for i in range(1,10)])
while K != 0:
if K <= len(queue):
print(queue[K-1])
exit(0)
K -= 1
num = queue.popleft()
o = int(str(num)[-1])
for n in [o-1, o, o+1]:
if n == -1 or n == 10: continue
queue.append( int(str(num)+str(n)) ) |
p03087 | s161541233 | Accepted | import sys
import math
def input():
return sys.stdin.readline().rstrip()
def main():
N, Q = map(int, input().split())
S = list(input())
t = [0] * N
count =0
for i in range(1,N):
if S[i-1]=="A" and S[i] =="C":
count +=1
t[i] =count
for j in range(Q):
l, r = map(int,input().split())
print(t[r-1]-t[l-1])
if __name__ == "__main__":
main() |
p02742 | s135255747 | Wrong Answer | h,w = map(int,input().split())
x = h//2 if h%2==0 else h//2+1
y = w//2 if w%2==0 else w//2+1
print(x*y+(h-x)*(w-y)) |
p02939 | s584089960 | Accepted | S = input()
res = 0
tmp = ""
last = ""
for s in S:
tmp += s
if tmp == last:
continue
last = tmp
tmp = ""
res += 1
print(res) |
p02552 | s725518484 | Accepted | x = int(input())
if x==0:
print(1)
elif x==1:
print(0) |
p02771 | s646587759 | Accepted | # -*- coding: utf-8 -*-
from fractions import gcd
from math import ceil,floor
import collections
# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# list = list(map(int, input().split()))
A,B,C=map(int, input().split())
ans = "No"
if A==B and A!=C:
ans = "Yes"
if A==C and A!=B:
ans = "Yes"
if B==C and A!=B:
ans = "Yes"
print(ans)
|
p02661 | s619474149 | Accepted | n = int(input())
A,B = [],[]
for i in range(n):
a,b = map(int,input().split())
A.append(a)
B.append(b)
A.sort()
B.sort()
if n%2==1:
x = A[n//2]
y = B[n//2]
else:
x = A[n//2 - 1]+A[n//2]
y = B[n//2 - 1]+B[n//2]
print(y-x+1) |
p03456 | s058999799 | Accepted | a,b = map(str, input().split())
c = int(a+b)
line = [i**2 for i in range(1,321)]
if c in line:
print('Yes')
else:
print('No') |
p02613 | s673697373 | Accepted | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
tmp = input()
if tmp == "AC":
ac += 1
elif tmp == "WA":
wa += 1
elif tmp == "TLE":
tle += 1
else:
re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re)) |
p02627 | s683252770 | Accepted | word = input()
if word.isupper() == True:
print("A")
else:
print("a") |
p02683 | s692698041 | Wrong Answer | import numpy as np
N, M, X = list(map(int, input().split()))
array = np.array([list(map(int, input().split())) for _ in range(N)])
min_C = np.inf
conbi = None
m = 2**N
for i in range(m):
tmp = []
for _ in range(N):
tmp.append(i%2)
i //= 2
sum_array = np.sum(array[np.where(tmp)], axis=0)
#print(tmp)
if np.all(sum_array>=X):
if sum_array[0] < min_C:
min_C = sum_array[0]
conbi = tmp
if conbi is None:
print(-1)
else:
print(min_C) |
p02629 | s676648877 | Wrong Answer | def main():
n = int(input())
num = n
name = []
cap = [chr(i) for i in range(97, 97+26)]
cap.insert(0, 'z')
del cap[-1]
if n == 26:
return 'z'
while n >= 27:
last = n % 26
n = n // 26
name.insert(0, cap[last])
last = (n % 26) - 1
name.insert(0, cap[last])
ans = "".join(name)
return ans
print(main()) |
p02917 | s980619770 | Accepted | N = int(input())
B = list(map(int,input().split()))
import copy
A = copy.deepcopy(B)
for i in range(1,N-1):
if B[i-1]<B[i]:
A[i] = B[i-1]
A.append(B[-1])
print(sum(A)) |
p03472 | s867232738 | Accepted | import math
N,H=map(int,input().split())
sword=[list(map(int,input().split())) for _ in range(N)]
throw=0
smash=0
cnt=0
sword.sort(key=lambda x:x[0],reverse=True)
smashmax=sword[0][0]
sword.sort(key=lambda x:x[1],reverse=True)
for i in range(N):
if (smashmax<=sword[i][1])and(throw<H):
throw=throw+sword[i][1]
cnt=cnt+1
if throw>=H:
print(cnt)
else:
print(cnt+math.ceil((H-throw)/smashmax))
|
p03103 | s348959185 | Wrong Answer | N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A,key=lambda x:x[0])
s=0 #本数
t=0 #値段
for i in range(N):
s+=A[i][1]
if M>s:
t+=A[i][0]*A[i][1]
else:
over=s-M
t+=A[i][0]*A[i][1]-A[i][0]*over
print(t) |
p02946 | s556550697 | Accepted | import numpy as np
p,q= input().split()
a,b =(int(p), int(q))
list_np = np.arange(-1000000, 1000000,1)
ans_list = []
for i in range(a):
ans_list.append(b + i)
ans_list.append(b - i)
ans_list.pop(0)
ans_list.sort()
ans=''
for i in range(a*2 -1):
if i < a * 2 -1 :
ans += str(ans_list[i])
ans +=' '
else:
ans +=str(ans_list[i])
break
print(ans) |
p02689 | s024889736 | Accepted | N, M = map(int, input().split()) # "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7
H = list( map(int, input().split()) ) # 1 2 3 4 5 ...
AB=[]
for m in range(M):
a,b = map(int, input().split()) # "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7
AB.append([a-1,b-1])
X=[0]*N
for a,b in AB:
X[a] = max(X[a], H[b])
X[b] = max(X[b], H[a])
ans=0
for i in range(N):
if H[i] > X[i]: ans += 1
print(ans)
|
p02970 | s923994716 | Accepted | N,D=map(int,input().split())
a=N//(2*D+1)
if N%(2*D+1)==0:
print(a)
else:
print(a+1) |
p02711 | s334415157 | Accepted | n=input()
if "7" in n :
print("Yes")
else:
print("No") |
p02880 | s899340696 | Accepted |
import sys
n = int(input())
for i in range(1 ,10):
if n % i == 0:
tmp = n / i
if tmp < 10:
print('Yes')
sys.exit()
print('No') |
p02547 | s196474642 | Wrong Answer | n = int(input())
c, d = [], []
for i in range(n):
a, b = [int(i) for i in input().split()]
c.append(a)
d.append(b)
count = 1
for i in range(1, n):
if c[i-1] == c[i] and d[i-1] == d[i]:
count += 1
else:
count = 1
if count == 3:
break
if count == 3:
print('Yes')
else:
print('No')
|
p03289 | s667805139 | Accepted | S = input()
flag1 = False
if S[0] == "A":
S=S.replace("A","",1)
if "C" in S[1:-1]:
S = S.replace("C", "", 1)
if S.islower():
print("AC")
else:
print("WA")
else:
print("WA")
else:
print("WA") |
p03852 | s583030320 | Accepted | k = input()
vowels = set("aeiou")
vowels.add(k)
if len(vowels) == 6:
print("consonant")
else:
print("vowel") |
p03627 | s589177877 | Accepted | import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
A = [0,0]
for i in adic:
if adic[i] > 1:
A.append(i)
if adic[i] > 3:
A.append(i)
sortedA = sorted(A)
print(sortedA[-1]*sortedA[-2]) |
p03695 | s084223282 | Accepted | #!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
color = [0]*8
over_3200 = 0
for i in range(n):
if a[i] < 3200:
color[a[i] // 400] = 1
else: over_3200 += 1
if sum(color) == 0:
print(1,over_3200)
else:
print(sum(color),sum(color)+over_3200) |
p04019 | s304223427 | Accepted | S=input()
ans="No"
n=0
w=0
e=0
s=0
tate=0
yoko=0
for str in S:
if str=="N":
n +=1
elif str=="E":
e +=1
elif str=="S":
s +=1
else:
w +=1
if (n>0 and s>0) or (n==0 and s==0):
tate=True
if (e>0 and w>0) or (e==0 and w==0):
yoko=True
if tate and yoko:
ans="Yes"
print(ans) |
p03107 | s384310252 | Accepted | s=input();print(min(s.count("1"),s.count("0"))*2) |
p04045 | s511884595 | Accepted | import sys
readline = sys.stdin.buffer.readline
n,k = map(int,readline().split())
lst1 = list(readline().rstrip().decode('utf-8').split())
i = n
while True:
flag = 0
for j in lst1:
if j in str(i):
i += 1
flag = 1
break
if not flag:
print(i)
break |
p03695 | s716837377 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(8)]
over = 0
for i in range(n):
if a[i] >= 3200:
over += 1
else:
ans[a[i]//400] = 1
print(str(max(1, sum(ans))) + " " + str(sum(ans)+over))
|
p03379 | s588337615 | Accepted | n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
m = (y[len(y)//2]+y[len(y)//2-1])/2
for i in range(len(x)):
if x[i] > m:
print(y[len(y)//2-1])
else:
print(y[len(y)//2])
|
p02594 | s065368054 | Accepted | print('Yes' if int(input())>=30 else 'No') |
p02838 | s745147992 | Accepted | n=int(input())
a=list(map(int,input().split()))
keta=[0]*61
for i in range(n):
for j in range(61):
if (a[i]>>j)&1==1:
keta[j]+=1
ans=0
for i in range(61):
ans+=((2**i)*(n-keta[i])*keta[i])%(10**9+7)
print(ans%(10**9+7))
|
p02647 | s334192859 | Accepted | import numpy as np
from numba import jit
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a,np.int64)
@jit
def imo(a):
imos=np.zeros(n+1,np.int64)
for i in range(n):
imos[max(0,i-a[i])]+=1
imos[min(n,i+a[i]+1)]-=1
immo=np.zeros(n+1,np.int64)
immo=np.cumsum(imos)
return immo[:n]
for _ in range(min(k,41)):
a=imo(a)
print(*a)
|
p02829 | s406684640 | Wrong Answer | A = int(input())
B = int(input())
print(5 - A - B)
|
p02577 | s264411857 | Accepted | s = input()
sum=0
for i in s:
sum+=int(i)
if sum%9==0:
print("Yes")
else:
print("No") |
p03206 | s226621098 | Accepted | d = int(input())
if d == 25:
print("Christmas")
elif d == 24:
print("Christmas Eve")
elif d == 23:
print("Christmas Eve Eve")
else:
print("Christmas Eve Eve Eve") |
p03281 | s562871076 | Accepted | N=int(input())
ans=0
for i in range(1,N+1):
tmp=0
if i%2!=0:
for j in range(1,i+1):
if i%j==0:
tmp+=1
if tmp==8:
ans+=1
print(ans)
|
p02882 | s341530512 | Accepted | import math
a, b, x = map(int, input().split())
s = x / a
if s >= (a * b) / 2:
y, x = 2*(a*b - s) / a, a
else:
y, x = b, 2*s / b
print(math.degrees(math.atan2(y, x))) |
p03385 | s877027835 | Wrong Answer | """
author : halo2halo
date : 24, Jan, 2020
"""
import sys
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8')
print('Yes' if set('abc') == set(S) else 'No')
|
p03329 | s410769213 | Wrong Answer | N = int(input())
from math import log
max6 = int(log(N, 6))
max9 = int(log(N, 9))
dp = [10**18]*(N+1)
dp[0] = 0
for i in range(1, N+1):
dp[i] = min(dp[i-1]+1, dp[i])
for j in range(max6+1):
if 6**j>i:
break
dp[i] = min(dp[i-6**j]+1, dp[i])
for k in range(max9+1):
if 9**k>i:
break
dp[i] = min(dp[i-9**k]+1, dp[i])
print(dp[-1]) |
p03705 | s828302570 | Accepted | n,a,b=map(int,input().split())
if a>b:
print(0)
elif n==1 and a!=b:
print(0)
elif n<=2:
print(1)
else:
print((b-a)*(n-2)+1) |
p03854 | s356284170 | Accepted | # ABC 049 C
S = str(input())
ans = 'YES'
while len(S)>0:
if S[-5:] == 'dream':
S = S[:-5]
elif S[-5:] == 'erase':
S = S[:-5]
elif S[-6:] == 'eraser':
S = S[:-6]
elif S[-7:] == 'dreamer':
S = S[:-7]
else:
ans = 'NO'
break
print(ans)
|
p02720 | s503523977 | Accepted | import queue
K = int(input())
q = queue.Queue()
q.put(1)
q.put(2)
q.put(3)
q.put(4)
q.put(5)
q.put(6)
q.put(7)
q.put(8)
q.put(9)
x=0
while K>0:
x = q.get()
if x%10 != 0:
q.put(10*x+x%10-1)
q.put(10*x+x%10)
if x%10 !=9:
q.put(10*x+x%10+1)
K-=1
print(x)
|
p02987 | s972526529 | Accepted | s = input()
for i in s:
if s.count(i) != 2:
print("No")
exit()
print("Yes")
|
p02717 | s161795324 | Accepted | a, b, c = map(int, input().split())
tmp = a
a = b
b = tmp
tmp = a
a = c
c = tmp
print(str(a)+" "+str(b)+" "+str(c)) |
p03478 | s482817557 | Accepted | N, A, B = [int(i) for i in input().split()]
result = 0
for i in range(N+1):
digitsum = sum(list(map(int, str(i))))
if A <= digitsum <= B:
result = result + i
print(result) |
p04030 | s843600242 | Accepted | S = list(input())
l=[]
for i in S:
if i == "B":
if len(l)==0:
continue
else:
l.pop()
else:
l.append(i)
print(*l, sep="") |
p03971 | s187618776 | Accepted | n,a,b=map(int,input().split())
s=input()
passed=0
rank_b=1
for i in range(n):
if s[i]=="a":
if passed<a+b:
print("Yes")
passed+=1
else:
print("No")
elif s[i]=="b":
if passed<a+b and rank_b<=b:
print("Yes")
rank_b+=1
passed+=1
else:
print("No")
else:
print("No") |
p02785 | s271995884 | Wrong Answer | N, K = map(int, input().split())
monsterList = [int(x) for x in input().split()]
atackTimes = 0
monsterList.sort()
for hp in monsterList[:-K]:
atackTimes += hp
print(atackTimes) |
p03377 | s326536316 | Accepted | a,b,x = map(int,input().split())
if a <= x <= a+b:
print('YES')
else:
print('NO')
|
p03495 | s199803114 | Wrong Answer | N,K = map(int,input().split())
A = list(map(int,input().split()))
l = set(A)
d = list(set(A))[-(len(l)-K):]
res = 0
for i in d:
res += A.count(i)
print(res) |
p03338 | s730986078 | Accepted | n = int(input())
s = input()
ans = 0
for i in range(1, n):
x = set(s[:i])
y = set(s[i:])
cnt = 0
for j in x:
if j in y: cnt += 1
if ans < cnt: ans = cnt
print(ans) |
p02922 | s629960259 | Accepted | A, B = map(int, input().split())
ans = int((B - 1) / (A - 1)) + 1
if (B - 1) % (A - 1) == 0:
ans -= 1
print(ans) |
p02756 | s176555173 | Accepted | from collections import deque
S = input()
Q = int(input())
head = 1
d = deque([S])
for _ in range(Q):
q = input().split()
if q[0]=='1':
head = head*-1
else:
if q[1]=='1':
h = head*1
else:
h = head*-1
if h==1:
d.appendleft(q[2])
else:
d.append(q[2])
ans = "".join(list(d))
if head == -1:
ans = ans[::-1]
print(ans) |
p03679 | s455955925 | Accepted | X, A, B = map(int, input().split())
print("delicious" if B <= A else "safe" if B <= (A + X) else "dangerous") |
p02717 | s526039434 | Accepted | x, y, z = map(int, input().split())
print(z, x, y) |
p02784 | s347697320 | Accepted | h, n = map(int, input().split())
a = list(map(int, input().split()))
print('Yes' if sum(a)>=h else 'No')
|
p02595 | s100678909 | Accepted | n,d = map(int,input().split())
a=[]
b=[]
cnt = 0
for i in range(n):
c, e = map(int,input().split())
if c**2+e**2<=d**2:
cnt += 1
print("{}".format(cnt)) |
p03495 | s366717980 | Accepted | from collections import Counter
N, K = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
c = Counter(a).most_common()
if K > len(c):
print(0)
exit()
for i in range(K):
sum += c[i][1]
print(len(a) - sum)
|
p02792 | s956778539 | Accepted | n = int(input())
grid = [[0 for i in range(10)] for j in range(10)]
for i in range(1,n+1):
s = str(i)
a,b = int(s[0]), i % 10
grid[a][b] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += grid[i][j] * grid[j][i]
print(ans) |
p02953 | s272860539 | Accepted | N = int(input())
H = list(map(int, input().split()))
H = H[::-1]
ans = 'Yes'
for i in range(N-1):
if H[i+1] - H[i]> 1:
ans = 'No'
break
elif H[i+1] - H[i]> 0:
H[i+1] = H[i]
print(ans) |
p03485 | s862082621 | Accepted | a, b = map(int, input().split())
if (a+b)%2!=0:
print((a+b)//2+1)
else:
print((a+b)//2) |
p02796 | s302202407 | Wrong Answer | n = int(input())
wk =[]
for i in range(n):
wk.append(list(map(int,input().split())))
xl = sorted(wk, key=lambda x:x[0])
xx = []
ll = []
cnt = 0
for i in range(n):
x,l = xl[i][0],xl[i][1]
if i == 0 or xx[cnt-1] + ll[cnt-1] -1 < x - l +1:
xx.append(x)
ll.append(l)
cnt +=1
print(len(xx)) |
p02792 | s144947075 | Accepted | N = int(input())
d = [[0]*10 for i in range(10)]
for n in range(1,N+1):
s = str(n)
d[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += d[i][j] * d[j][i]
print(ans) |
p02627 | s652779123 | Accepted | a = input()
if a.isupper():
print('A')
else:
print('a')
|
p03448 | s996623479 | Wrong Answer | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i * 50 + j * 100 + k * 500 == x:
ans += 1
print(ans) |
p02600 | s791550801 | Accepted | def kyuu(N):
for i in range(8):
if N >= 1800 - 200 * i:
return (i + 1)
break
X = int(input())
print(kyuu(X)) |
p02829 | s380793467 | Accepted | A = int(input())
B = int(input())
print(6 - A - B) |
p03011 | s380211703 | Accepted | print(sum(sorted(map(int,input().split()))[:2])) |
p03767 | s052290013 | Wrong Answer | N = int(input())
a = sorted(map(int,input().split()))
print(sum(a[N:2*N])) |
p02988 | s812929585 | Accepted | n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(1, n - 1):
if P[i - 1] < P[i] < P[i + 1] or P[i - 1] > P[i] > P[i + 1]:
count += 1
print(count)
|
p02860 | s212330421 | Wrong Answer | n = int(input())
S = input()
if n%2 == 0:
p = n//2
print(S[:p],S[p:])
if S[:p] == S[p:]:
print("Yes")
else:
print("No")
else:
print("No") |
p03427 | s973547822 | Accepted | n=input()
if n[1:]=='9'*(len(n)-1): print(9*(len(n)-1)+int(n[0]))
else: print(9*(len(n)-1)+int(n[0])-1) |
p02700 | s991382238 | Accepted | a, b, c, d = map(int, input().split())
m = 0
for i in range(200):
c -= b
if c <= 0:
m = 1
break
a -= d
if a <= 0:
m = 2
break
print("Yes" if m == 1 else "No") |
p03131 | s797926172 | Accepted | k, a, b = map(int, input().split())
n = 1
m = 0
n += a - 1
k -= a - 1
if a + 1 < b:
n += (b - a) * (k // 2) + k % 2
else:
n += k
print(n) |
p02727 | s277975644 | Accepted | X, Y, A, B, C = map(int, input().split(' '))
A_list = list(map(int, input().split(' ')))
B_list = list(map(int, input().split(' ')))
C_list = list(map(int, input().split(' ')))
A_list.sort(reverse=True)
B_list.sort(reverse=True)
C_list.sort(reverse=True)
A_list = A_list[:X]
B_list = B_list[:Y]
all_list = []
all_list.extend(A_list)
all_list.extend(B_list)
all_list.extend(C_list)
all_list.sort(reverse=True)
res = 0
for i in range(X+Y):
res += all_list[i]
print(res)
|
p03625 | s897441304 | Wrong Answer | import sys
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
box = []
acnt =dict(Counter(a))
acnt = sorted(acnt.items(), key=lambda x:x[0],reverse=True)
#print(acnt)
a_val =[acnt[x][1] for x in range(len(acnt))]
a_key = [acnt[y][0] for y in range(len(acnt))]
#print(a_key,a_val)
for i in range(len(a_val)):
if a_val[i] >= 4:
print(a_key[i]**2)
sys.exit()
elif 2 <= a_val[i]:
box.append(a_key[i])
#print(box)
if len(box) == 2:
print(box[0]*box[1])
sys.exit()
print(0)
|
p03994 | s892066981 | Accepted | #!/usr/bin/env python3
s = input()
k = int(input())
n = len(s)
ans = []
# kを減らしていく。もし、aまで戻せるならaまで進めてk をその分減らす。
for i in range(n):
if s[i] == "a":
ans.append("a")
elif 123 - ord(s[i]) <= k:
ans.append("a")
k -= 123 - ord(s[i])
else:
ans.append(s[i])
# print(k)
k %= 26 # 26で割ったあまりに落とす
ans[-1] = chr((ord(ans[-1]) + k - 97) % 26 + 97)
print("".join(ans))
|
p03386 | s656361589 | Wrong Answer | A,B,K = map(int,input().split())
C = [i for i in range(A,B+1)]
N = len(C)
L = set(C[N-K:]+C[:K])
for l in L:
print(l) |
p03665 | s760527782 | Accepted | n, p = map(int, input().split())
A = list(map(int, input().split()))
o = 0
for a in A:
if a % 2:
o += 1
e = n - o
if o == 0 and p == 1:
print(0)
else:
print(2**e * 2**max(0, o - 1)) |
p03281 | s189152456 | Accepted | N = int(input())
def divisors(n):
re = 0
for i in range(1,int(n**0.5)+1):
if n % i == 0:
if n == i**2:
re += 1
else:
re += 2
return re
ans = 0
for i in range(1,N+1,2):
if divisors(i) == 8:
ans += 1
print(ans) |
p02924 | s809066845 | Accepted | from decimal import Decimal
n = int(input())
print(int(Decimal((n-1)/2)*Decimal(n)))
|
p03485 | s472534256 | Accepted | import sys
input = sys.stdin.readline
a,b=map(int,input().split())
print(-(-(a+b)//2))
|
p03797 | s122835684 | Accepted | n, m = map(int, input().split())
if n >= m:
ans = m//2
else:
ans = n + (m-2*n)//4
print(ans) |
p03281 | s108402598 | Accepted | n=int(input())
ans=0
for i in range(1,n+1):
cnt=0
if i%2 == 1:
for j in range(1,i+1):
if i%j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans) |
p03338 | s257904686 | Accepted | n = int(input())
s = input()
ans = 0
for i in range(1,n-1):
mae = set(s[:i])
ato = set(s[i:])
cnt = mae & ato
ans = max(ans,len(cnt))
print(ans) |
p02714 | s641808701 | Accepted | n = int(input())
s = input()
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
ans = r_cnt * g_cnt * b_cnt
for i in range(n):
for d in range(n):
j = i + d
k = j + d
if k >= n:break
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
ans -= 1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.