problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02601 | s060942140 | Accepted | a, b, c = map(int, input().split())
k = int(input())
left = k
while a >= b:
left -= 1
b *= 2
while b >= c:
left -= 1
c *= 2
if left >= 0:
print("Yes")
else:
print("No")
|
p03243 | s483897502 | Accepted | n = int(input())
for i in range(1000):
if n % 111 == 0:
print(n)
exit()
n += 1 |
p03220 | s323743674 | Accepted | def INT():
return int(input())
def MI():
return map(int, input().split())
def LI():
return list(map(int, input().split()))
N = INT()
T, A = MI()
H = list(map(lambda x : T - 0.006 * int(x), input().split()))
for i in range(N):
H[i] = abs(H[i] - A)
ans = H.index(min(H)) + 1
print(ans) |
p02744 | s009264276 | Accepted | N = int(input())
def fac(N):
if N == 1:
return [['a']]
li = []
for x in fac(N-1):
n = len(set(x))
for i in range(n+1):
li.append(x+[chr(97+i)])
return li
for x in fac(N):
print(''.join(x)) |
p03994 | s788912396 | Accepted | s = input()
k = int(input())
n = len(s)
for i in range(n):
num = ord(s[i])
if num == 97 or 123-num > k:
continue
k -= (123-num)
s = s[:i] + 'a' + s[i+1:]
if k > 0:
t = k%26
s = s[:n-1] + chr(ord(s[n-1])+t)
print(s) |
p03407 | s208498273 | Wrong Answer | A, B, C = map(int, input().split())
print('Yes' if 2*(A+B) >= C else 'No')
|
p02682 | s122779351 | Wrong Answer | import sys
a, b, c, d = map(int, sys.stdin.readline().split())
if a+b <= d:
print(a-d+a+b)
else:
print(a)
|
p02993 | s226207699 | Wrong Answer | S=input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
print("Bad")
else:
print("Yes") |
p03699 | s928643915 | Accepted | n = int(input())
S = [int(input()) for i in range(n)]
ans = sum(S)
sort_S = sorted(S)
if ans % 10 != 0:
print(ans)
exit()
else:
for s in sort_S:
if s % 10 != 0:
ans -= s
print(ans)
exit()
print(0) |
p02881 | s075660677 | Accepted | def Divisors(n):
L=[]
k=1
while k*k <= n:
if n%k== 0:
L.append(k)
k+=1
return L
N=int(input())
T=Divisors(N)
M=10**20
for a in T:
M=min(M,a+(N//a)-2)
print(M)
|
p02801 | s535030563 | Accepted | a = str(input())
b = ord(a)
print(chr(b+1)) |
p02772 | s762002178 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
s = "APPRPVED"
for i in A:
if i % 2 == 0:
if i % 3 != 0 and i % 5 != 0:
s = "DENIED"
print(s)
|
p04011 | s109461573 | Accepted | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
print(N*X)
else:
print(K*X+(N-K)*Y)
|
p02755 | s849938746 | Accepted | import math
A,B = map(int,input().split())
ans = 0
while 1:
C = math.floor(ans*0.08)
D = math.floor(ans*0.1)
if C == A and D == B:
print(ans)
break
if C > A or D > B:
print(-1)
break
ans += 1
|
p03385 | s441230065 | Accepted | S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
print('No')
else:
print('Yes') |
p03472 | s864164029 | Accepted | n,h=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]
attack=max(AB)[0]
AB=sorted(AB, reverse=True, key=lambda x:x[1])
cnt=0
for i,j in AB:
if j>=attack:
h -=j
cnt +=1
if h<=0:print(cnt);exit()
print(cnt+h//attack if h%attack==0 else cnt+h//attack+1) |
p03323 | s738835078 | Wrong Answer | a,b = map(int,input().split())
if a < 8 and b < 8:
print('Yey!')
else:
print(':(') |
p02687 | s420598625 | Accepted | S = str(input())
if S[1] == 'B':
print ('ARC')
else:
print ('ABC') |
p02633 | s867112534 | Accepted | x=int(input())
t=0
i=1
while True:
t+=x
t%=360
if t==0:
print(i)
break
i+=1 |
p03434 | s580496155 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
Alice = 0
Bob = 0
for i in range(n):
if i % 2 == 0:
Alice += a[i]
else:
Bob += a[i]
print(Alice-Bob) |
p03679 | s517482651 | Accepted | def resolve():
x, a, b = map(int, input().split())
ans = str()
if a >= b:
ans = "delicious"
elif a+x >= b:
ans = "safe"
elif a+x < b:
ans = "dangerous"
print(ans)
resolve() |
p02797 | s976132276 | Wrong Answer | n, k, s = map(int, input().split())
Ans = [s]*k
for i in range(n-k):
Ans.append(s+1)
L=[str(a) for a in Ans]
L=" ".join(L)
print(L) |
p02631 | s701723333 | Accepted | n = int(input())
m = list(map(int,input().split()))
k = 0
for i in m:
k ^= i
l = []
for i in m:
l.append(k ^ i)
print(*l) |
p03795 | s195221300 | Accepted | import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18
n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#n,m = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
ans = 800*n - (n//15)*200
print(ans)
|
p02694 | s003579794 | Accepted | x = int(input())
ans = 0;
now = 100
while now < x:
now *= 101
now //= 100
ans += 1
print(ans) |
p03000 | s797804509 | Wrong Answer | N, X = map(int, input().split(' '))
L = list(map(int, input().split(' ')))
D = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
D[i] = D[i-1] + L[i-1]
if D[i] > X:
break
print(i) |
p02972 | s841824855 | Accepted | N = int(input())
a = list(map(int, input().split()))
b = []
arr = [-1] * N
for i in range(N, 0, -1):
s = 0
j = i * 2
while j <= N:
s += arr[j - 1]
j += i
if s % 2 != a[i - 1]:
arr[i - 1] = 1
b.append(i)
else:
arr[i - 1] = 0
print(len(b))
print(*b)
|
p02897 | s314121862 | Accepted | N = int(input())
if N%2==1:
print((N+1)/2/N)
else:
print(0.5) |
p03035 | s904976559 | Wrong Answer | o,cost = map(int,input().split())
if o > 12:
cost = cost
elif o >= 6:
cost = cost / 2
else:
cost = 0
|
p02713 | s246914942 | Accepted | import math
k = int(input())
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
x = math.gcd(a, b)
for c in range(1, k+1):
ans += math.gcd(x, c)
print(ans)
|
p03352 | s728951506 | Wrong Answer | from math import *
n=int(input())
s=sqrt(n)
s=int(s)
print(s**2) |
p02801 | s880874257 | Accepted | print(chr(ord(input())+1))
|
p02731 | s896465778 | Wrong Answer | import decimal
L=int(input())
x = L/3
decimal.getcontext().prec = 6
x = decimal.Decimal(L / 3)
V=decimal.Decimal(x*x*x)
print("{:.12f}".format(V)) |
p03323 | s536932328 | Accepted | A,B=map(int,input().split())
print("Yay!" if A<9 and B<9 else ":(") |
p03371 | s092412890 | Wrong Answer | a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+y*max(0,b-c))
ans.append(c*y+x*max(0,a-c))
print(min(ans))
|
p03485 | s657676484 | Accepted | a, b = map(int, input().split())
ans = (a+b+1)//2
print(ans)
|
p02645 | s879678034 | Wrong Answer | S=input()
print(S[:2]) |
p03371 | s627389225 | Wrong Answer | A,B,C,X,Y = map(int,input().split())
mini=float("inf")
for a in range(0,X+1):
c_num = 2*(X-a)
b_num = Y- (X-a)
if b_num>=0:
P= A*a + B*b_num + C*c_num
#print(a,b_num,c_num,P)
mini=min(mini,P)
print(mini) |
p02780 | s790384837 | Accepted |
ex = []
for i in range(1001):
e = 0
j = i
while j != 0:
e += j / i
j-=1
ex.append(e)
n, k = map(int, input().split())
p = list(map(int, input().split()))
total = 0
mx = 0
for i in range(n):
if i < k:
total += ex[p[i]]
else:
total = total + ex[p[i]] - ex[p[i-k]]
if mx < total:
mx = total
print(mx) |
p03352 | s583146138 | Accepted | import sys
import math
input = sys.stdin.readline
MOD = 1000000007
X = int(input())
sa = 100000
res = 0
if X == 1:
print(1)
else:
for i in range(2,X):
a = int(math.log(X,i)+0.00000004)
if (sa > (X - (i**a))) & ( a != 1):
sa = X - (i**a)
res = i**a
print(res)
|
p03672 | s651056328 | Accepted | S = str(input())
S = S[:-2]
for _ in range(len(S)//2):
if S[:len(S)//2] == S[len(S)//2:]:
print(len(S))
break
else:
S = S[:-2] |
p03556 | s426358377 | Accepted | N=int(input())
print((int(N**0.5))**2) |
p02713 | s621790899 | Accepted | import math
K = int(input())
ans = 0
for A in range(1, K+1):
for B in range(1, K+1):
AB = math.gcd(A, B)
for C in range(1, K+1):
ans += math.gcd(AB, C)
print(ans) |
p02832 | s042210174 | Accepted | import sys
N = int(input())
A = list(map(int, input().split()))
find = 1
for i in range(N):
if A[i] == find:
find += 1
print(-1 if find == 1 else len(A) - find + 1) |
p02993 | s056794496 | Wrong Answer | def main():
a=input()
ca=a[0]
for c in a[1:]:
if ca == c:
print('Bad')
return
ca = c
print('Good')
main()
|
p02755 | s945769174 | Wrong Answer | from math import floor, ceil
A, B = map(int, input().split())
minx1 = A/0.08
maxx1 = (A+1)/0.08
minx2 = B/0.1
maxx2 = (B+1)/0.1
rangeMin = max(minx1, minx2)
rangeMax = min(maxx1, maxx2)
if rangeMax < rangeMin:
print(-1)
else:
print(floor(rangeMin+1)) |
p02618 | s801987229 | Accepted | D=int(input())
C=list(map(int,input().split()))
S=list(map(list,zip(*[map(int,input().split()) for i in range(D)])))
s=[sum(l) for l in S]
print(*[s.index(max(s))+1]*D,sep='\n') |
p03481 | s639192477 | Accepted | # Problem C - Multiple Gift
# input
X, Y = map(int, input().split())
# initialization
ans = 0
# count
while X<=Y:
X *= 2
ans += 1
# output
print(ans)
|
p03767 | s436927764 | Accepted | N=int(input())
*A,=map(int,input().split())
A.sort()
print(sum(A[N::2])) |
p03759 | s724939615 | Accepted | a, b, c = map(int, input().split())
print("YES" if b - a == c - b else "NO")
|
p03449 | s268646006 | Accepted | # 右に(N-1)回移動、下に1回移動
# 合計値は上の段は下に降りるまでの累積和、下の段は降りてからの累積和
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
cum1, cum2 = [0]*(N+1), [0]*(N+1)
for i in range(N):
cum1[i+1] = cum1[i] + A1[i]
cum2[i+1] = cum2[i] + A2[i]
print(max([cum1[i+1] + cum2[-1] - cum2[i] for i in range(N)])) |
p02972 | s569890345 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = [-1] * n
for i in range(n, 0, -1):
cnt = sum(b[j - 1] for j in range(i + i, n, i))
b[i - 1] = int(a[i - 1] != cnt % 2)
print(sum(b))
if sum(b) > 0:
print(*[i + 1 for i in range(n) if b[i] == 1])
|
p02854 | s823427907 | Accepted | import numpy as np
N = int(input())
A = [0] + list(map(int, input().split()))
cumsum = np.cumsum(A)
ans = float("inf")
for i in range(1, N):
left = cumsum[i]
right = cumsum[-1] - cumsum[i]
tmp = abs(right - left)
if tmp < ans:
ans = tmp
print(ans)
|
p03012 | s315414901 | Accepted | n = int(input())
w = list(map(int, input().split()))
a = []
x = 0
for i in range(n):
x += w[i]
a.append(x)
b = []
for j in range(n):
b.append(abs(2 * a[j] - a[n - 1]))
print(min(b)) |
p02819 | s143651030 | Wrong Answer | x = int(input())
for i in range(10^5):
n = 2
while x % n != 0 and n <= x**0.5 + 2:
n += 1
if n < x**0.5 + 2:
x += 1
else:
print(x)
break
|
p02647 | s022856826 | Accepted | import itertools
N, K = map(int,input().split())
A = list(map(int,input().split()))
K = min(41,K)
#A = [0] * N
for k in range(K):
imos = [0] * (N+1)
for n in range(N):
a = n - A[n]
b = n + A[n]
a = max(0,a)
b = min(N-1,b)
imos[a] += 1
imos[b+1] -= 1
csum = list(itertools.accumulate(imos))
A = csum[:-1]
A = [str(a) for a in A]
print (' '.join(A))
|
p02779 | s432254972 | Accepted | n=int(input())
ls=list(map(int,input().split()))
m=len(ls)
print("YES" if len(set(ls))==m else "NO") |
p03862 | s481630211 | Accepted | f=lambda:map(int,input().split())
N,X=f()
*A,=f()
A=[0]+A
c=0
for i in range(N):
c+=max(0,A[i]+A[i+1]-X)
A[i+1]=min(A[i+1],X-A[i])
print(c) |
p03061 | s523045443 | Accepted | import math
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]
gcd = []
gcd.append(fromright[1])
for i in range(1, n-1):
gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])
print(max(gcd))
|
p02724 | s988259519 | Wrong Answer | n = int(input())
total = 0
total += (n//500)
n %= 500#合計枚数を減らす
total += (n//5)*5#5円玉に交換する
print(total) |
p04034 | s499439548 | Accepted | #!/usr/bin/env python3
n, m = map(int, input().split())
L = [1]*n
R = [1] + [0]*~-n
for _ in range(m):
x, y = map(int, input().split())
x -= 1;y -= 1
if R[x]:R[y] = 1
L[x] -= 1;L[y] += 1
R[x] *= (L[x] > 0)
print(sum(R)) |
p03637 | s635474942 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
num = len(a)
four = 0
two = 0
one = 0
for i in range(num):
if a[i]%4 == 0:
four += 1
elif a[i]%2 == 0 and a[i]%4 != 0:
two += 1
elif a[i]%2 != 0:
one += 1
if four + 1 >= two//2 + one:
print('Yes')
else:
print('No') |
p03146 | s641063843 | Accepted | s = int(input())
A = [s]
m = 2
while True:
n = A[-1]
if n % 2 == 0:
f = n // 2
else:
f = n * 3 + 1
if f in A:
break
else:
A.append(f)
m += 1
#print(A)
print(m) |
p03042 | s254562748 | Wrong Answer | s = input()
s1 = int(s[0:2])
s2 = int(s[2:4])
s1m = False
s1y = False
s2m = False
s2y = False
if s1 <= 12 and s1 >= 1:
s1y = True
s1m = True
elif s1 > 12 :
s1y = True
if s2 <= 12 and s2 >= 1:
s2y = True
s2m = True
elif s2 > 12 :
s2y = True
if s1y and s2y and s1m and s2m:
print("AMBIGUOUS")
elif s1y and s2m :
print("YYMM")
elif s2y and s1m :
print("MMYY")
else :
print("NA")
|
p02748 | s323509386 | Wrong Answer | S=input()
if(S=="hi"):
print("Yes")
elif(S=="hihi"):
print("Yes")
elif(S=="hihihi"):
print("Yes")
elif(S=="hihihihi"):
print("Yes")
elif(S=="hihihihihi"):
print("Yes")
elif(S=="hihihihihihi"):
print("Yes")
elif(S=="hihihihihihihi"):
print("Yes")
else:
print("No") |
p04031 | s770567614 | Accepted | n = int(input())
*a, = map(int, input().split())
ans = float("inf")
for i in range(-100, 101):
t = 0
for _a in a:
t += (i-_a)**2
ans = min(ans, t)
print(ans)
|
p03416 | s418055430 | Accepted | a, b = map(int, input().split())
count = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
count += 1
print(count)
|
p03673 | s361748057 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
b = [0]*n
k = 0
for i in range(n-1, -1, -2):
b[k] = a[i]
k += 1
for i in range(n%2, n, 2):
b[k] = a[i]
k += 1
print(*b) |
p02888 | s564745099 | Accepted | n=int(input())
llist=list(map(int,input().split()))
llist.sort()
counter=0
for i in range(2,n):
now=i+1
tmpcounter=0
for j in range(1,i):
while now <= n:
if llist[j-1] + llist[i-1] > llist[now-1]:
tmpcounter += 1
now += 1
else:
break
counter += tmpcounter
print(counter)
|
p03145 | s761199406 | Accepted | c,a,b=map(int,input().split())
print(int(c*a/2)) |
p02613 | s636205731 | Accepted | #abc173
n = int(input())
ln ={'AC': 0,'WA': 0,'TLE': 0,'RE': 0} #ln[0] = AC, 1= WA, 2 =TLE, 3 =RE
for i in range(n):
s = input()
ln[s] += 1
for i,j in ln.items():
print(i +' x ' + str(j))
|
p02744 | s090414470 | Accepted | n = int(input())
a = ord('a')
def dfs(s, m):
# print("dfs", s, chr(m))
if len(s) == n:
print(s)
else:
for i in range(m + 1 - a):
dfs(s + chr(a + i), m + 1 if i == m - a else m)
dfs("", a) |
p02797 | s117417048 | Accepted | def main():
N, K, S = (int(_) for _ in input().split())
output = []
for _ in range(K):
output.append(S)
if S == 10 ** 9: a = S - 1
else:
a = S + 1
for _ in range(N - K):
output.append(a)
print(*output)
return
if __name__ == '__main__':
main() |
p03387 | s222359080 | Wrong Answer | # -*- coding: utf-8 -*-
A,B,C = map(int, input().split())
s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
M += 1
elif M % 2 != 0 and s % 2 == 0:
M += 1
ans = (3 * M - s) / 2
print(ans)
|
p03062 | s308536393 | Accepted | n = int(input())
lst = list(map(int, input().split()))
mcnt = 0
for i in range(n):
if lst[i] < 0:
mcnt += 1
if 0 in lst or mcnt % 2 == 0:
print(sum(list(map(abs, lst))))
exit()
m = min(lst, key=abs)
print(sum(list(map(abs, lst))) - 2 * abs(m)) |
p03862 | s000112583 | Accepted | n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n):
if a[i]+a[i-1]>x:
t=a[i]+a[i-1]-x
if a[i]>=t:
a[i]-=t
else:
a[i]=0
cnt+=t
print(cnt) |
p02842 | s415867641 | Accepted | n = int(input())
for x in range(n + 1):
if x * 108 // 100 == n:
print(x)
break
else:
print(':(') |
p03433 | s247576013 | Accepted | N = int(input())
A = int(input())
N = N % 500
if N <= A:
print('Yes')
else:
print('No')
|
p02910 | s041351981 | Wrong Answer | s=input()
if (s[::2]=='L') or (s[1::2]=='R'):
print('No')
else:
print('Yes') |
p03474 | s087680723 | Wrong Answer | a, b = map(int, input().split())
s = input()
flg = True
for i in range(a):
if s[i] == '-':
flg = False
if s[a] != '-':
flg = False
for i in range(a + 2, b):
if s[i] == '-':
flg = False
if flg:
print("Yes")
else:
print("No") |
p02707 | s059441648 | Accepted | from typing import List, Dict
def main(N: int, A: List[int]):
bosses: Dict[int, List[int]] = {}
for i, boss in enumerate(A, start=2):
if boss not in bosses:
bosses[boss] = [i]
else:
bosses[boss].append(i)
for worker in range(1, N + 1):
if worker not in bosses:
print(0)
else:
print(len(bosses[worker]))
if __name__ == "__main__":
N = int(input())
A = list(map(int, (input().split())))
main(N, A) |
p03137 | s889840499 | Wrong Answer | N,M=map(int,input().split())
*X,=map(int,input().split())
X.sort()
count=[0]*(M-1)
i=1
while i<M:
count[i-1]=X[i]-X[i-1]
i+=1
count.sort()
print(sum(count[:M-N])) |
p03086 | s256614568 | Wrong Answer | # ABC122 B - ATCoder
S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
if S[i] not in AC:
N.append(i)
else:
count+=1
if count == len(S):
print(count)
exit()
M = N[0]
for j in range(len(N)-1):
M = max( N[j+1] - N[j],M)
print(M)
|
p04005 | s270803518 | Wrong Answer | import sys
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
print(0)
sys.exit()
s=max(a,b,c)
t=a*b*c/s
ans=int(t)
print(ans) |
p02916 | s707803180 | Accepted | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
ans += B[A[i]-1]
if i < N-1 and A[i+1] == A[i] + 1:
ans += C[A[i]-1]
print(ans)
|
p02570 | s495096108 | Accepted | d,t,s = map(int, input().split())
print('Yes' if t*s >= d else 'No') |
p02627 | s945360025 | Accepted | a = input()
if a == a.upper():
print('A')
else:
print('a')
|
p02789 | s294659019 | Accepted | N, M = map(int, input().split())
if N == M:
print("Yes")
else:
print("No") |
p03617 | s439580045 | Accepted | Q, H, S, D = map(int,input().split())
N = int(input())
print((N//2)*min(8*Q,4*H,2*S,D)+(N%2)*min(4*Q,2*H,S))
|
p03611 | s908083237 | Wrong Answer | n = int(input())
a = list(map(int,input().strip().split()))
import collections
c = collections.Counter(a)
_max = 0
for i in range(max(a)):
_sum = c[i-1] + c[i] + c[i+1]
if _max < _sum:
_max = _sum
print(_max) |
p02723 | s511605343 | Accepted | s = input()
if s[2] == s[3] and s[4] ==s[5]:
print("Yes")
else:
print("No") |
p02694 | s925611035 | Wrong Answer | x = int(input())
m = 100
y = 0
while (m<x):
m *= 1.01
y += 1
print(y)
|
p03474 | s308406479 | Accepted | A,B=map(int,input().split())
S=input()
if S.count('-')==1 and S[A]=='-':
print("Yes")
else:
print("No")
|
p02756 | s445806515 | Accepted | s=input()
n=int(input())
head=[]
end=[]
rev = False
for i in range(n):
q = list(map(str,input().split()))
if q[0]=='1':
head,end = end, head
rev = not rev
elif q[0]=='2':
if q[1]=='1':
head.append(q[2])
else:
end.append(q[2])
head.reverse()
if rev:
ans = list(s)
ans.reverse()
else:
ans = list(s)
print("".join(head+ans+end)) |
p02797 | s489304248 | Accepted | # coding: utf-8
N, K, S = map(int, input().split())
L = []
for i in range(N):
if i < K:
L.append(S)
else:
L.append(99999989)
print(*L) |
p03038 | s297221416 | Accepted | N,M=map(int,input().split())
*A,=map(int,input().split())
BC=[list(map(int,input().split()))[::-1]for _ in range(M)]
BC=sorted(BC)[::-1]
L=[0]
for c,b in BC:
L+=[c]*b
if len(L)-1>N:
break
ans=sorted(A+L)[::-1]
print(sum(ans[:N])) |
p03693 | s980293471 | Wrong Answer | r, g, b = list(map(int,input().split()))
if (r+g+b)%4==0:
print("YES")
else:
print("NO") |
p02994 | s574260388 | Accepted | n, l = map(int, input().split())
a = sorted([l + i for i in range(n)], key=abs)
print(sum(a[1:]))
|
p03131 | s197952290 | Wrong Answer | k,a,b=map(int, input().split())
#aaaabできる。cが…
if a+3<=b and k>=a+1:
#
if a%2==0 and k%2==0:
print(b+1)
if a%2==0 and not k%2==0:
print(2 * b+a)
if not a%2==0 and k%2==0:
print(a+1)
if not a%2==0 and not k%2==0:
print(2 * b+a) |
p02773 | s687261192 | Wrong Answer | import sys
import collections
N = int(input())
strs = []
for _ in range(N):
s = input()
strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
if v != maxv and maxv != -1:
break
ans.append(k)
maxv = v
for a in sorted(ans, reverse=True):
print(a) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.