problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03719 | s872081971 | Wrong Answer | a, b, c = map(str, input().split())
if a <= c and c <= b:
print('Yes')
else:
print('No') |
p02696 | s653648141 | Wrong Answer | from math import floor
a, b, n = map(int, input().split())
ans = 0
for i in range(min(5, n)):
score = floor(a*(n-i)/b) - a*floor((n-i)/b)
ans = max(score, ans)
print(ans) |
p02744 | s413692087 | Accepted | import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n=int(input())
s="abcdefghijklmn"
li=[[] for _ in range(10)]
li[0]=[["a",0]]
for i in range(1,10):
for t,val in li[i-1]:
for j in range(val+2):
li[i].append([t+s[j],max(val,j)])
for t,_ in li[n-1]:
print(t)
if __name__ == "__main__":
main()
|
p02600 | s455107392 | Accepted | x = int(input())
ans = 1
ls=[x for x in range(400,2000,200)]
for i in range(len(ls)-1):
if ls[i] <= x < ls[i+1]:
ans = 8-i
break
print(ans) |
p02843 | s944499677 | Wrong Answer | def main():
x = int(input())
for i in range(x + 1):
if 0 <= x - 100 * i < 5 * i:
print(1)
exit()
else:
print(0)
if __name__ == "__main__":
main()
|
p03035 | s064038450 | Wrong Answer | a, b = map(int, input().split())
if a <= 5:
print(0)
elif a <= 12:
print(b/2)
else:
print(b) |
p03000 | s294816676 | Accepted | n, x = (int(i) for i in input().split())
list_l = [int(j) for j in input().split()]
tmp = 0
count = 0
for i in range(0, n + 1):
if i == 0:
pass
else:
tmp += list_l[i - 1]
if tmp > x:
break
count += 1
print(count) |
p03076 | s771359975 | Accepted | str_menu,int_menu,fir_digi,ans=[str(input()) for i in range(5)],[],[],0
for i in range (5):
fir_digi.append(int(str_menu[i][-1]))
int_menu.append(int(str_menu[i]))
while min(fir_digi)==0:
fir_digi[fir_digi.index(0)]=10
for i in range (5):
if i!=fir_digi.index(min(fir_digi)):
if fir_digi[i]!=10:
int_menu[i]=int(int_menu[i]/10)*10+10
ans=ans+int_menu[i]
print(ans) |
p02732 | s132085129 | Accepted | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
s = 0
d = defaultdict(int)
for e in A:
d[e] += 1
k = len(set(d))
for v in d.values():
s += v*(v-1)//2
for e in A:
if d[e] > 1:
res = s - (d[e]-1)
print(res)
else:
print(s)
|
p02773 | s111079508 | Accepted | n = int(input())
s = [input() for _ in range(n)]
import collections
c0 = collections.Counter(s)
c1 = c0.most_common()
max = c1[0][1]
l = []
for x, i in c0.items():
if i == max:
l.append(x)
ans = sorted(l)
for i in ans:
print(i) |
p02714 | s917216181 | Wrong Answer | from itertools import combinations
n = int(input())
s = input()
count = 0
list1 = []
list = []
list2= []
for i in range(1, len(s)+1):
list.append(i)
for c in combinations(list, 3):
list1.append(c)
for item in list1:
if (item[1]-item[0]) != (item[2]-item[1]):
list2.append(item)
for k in list2:
if s[k[0] - 1] != s[k[1] - 1] and s[k[0] - 1] != s[k[2] - 1] and s[k[1] - 1] != s[k[2] - 1]:
count = count + 1
print(count) |
p02659 | s252443173 | Accepted | import math
from decimal import Decimal
A, B = input().split()
A = int(A)
B = Decimal(B)
C = A * B
ans = math.floor(C)
print(ans)
|
p03419 | s710987404 | Wrong Answer | n,m=map(int,input().split())
if n==1 and m==1:
print(0)
elif n==1:
print(m-2)
elif m==1:
print(n-2)
else:
print(n*m-(2*n+2*m-4)) |
p03836 | s554468909 | Accepted | from sys import stdin
def main():
#入力
readline=stdin.readline
sx,sy,tx,ty=map(int,readline().split())
ans=""
u=ty-sy
v=tx-sx
a=u*"U"
b=v*"R"
c=u*"D"
d=v*"L"
ans+=a+b+c+d
ans+="L"+a+"U"+b+"R"+"D"
ans+="R"+c+"D"+d+"L"+"U"
print(ans)
if __name__=="__main__":
main() |
p02971 | s961273339 | Accepted | N = int(input())
b = 0
c = 0
first = 0
A = []
for i in range(N):
a = int(input())
if b < a:
ind = i
b = a
A.append(a)
for j in range(N):
if j==ind:
continue
if c < A[j]:
sind = j
c = A[j]
for k in range(N):
if k==ind:
print(c)
else:
print(b)
|
p02664 | s519631756 | Wrong Answer | T=input()
T=list(T)
for i in range(len(T)):
j=int(i)
if T[j]=='?':
T[j]='D'
"".join(T)
print(T)
|
p03262 | s299865360 | Accepted | import fractions
n,x = map(int,input().split())
s = set(map(int,input().split()))
s.add(x)
l = list(s)
l.sort()
for i in range(len(l)-1):
if i == 0:
y = l[1]-l[0]
else:
y = fractions.gcd(l[i+1]-l[i],y)
print(y) |
p02879 | s258523676 | Wrong Answer | a1=input()
a2=[i for i in a1.split()]
x,y=float(a2[0]),float(a2[1])
v,v1=x.is_integer(),y.is_integer()
if 1<=(x and y)<=20 and v==v1==True:
if 1<=(x and y)<=9:
print(int(x*y))
else:
print('-1') |
p02552 | s687009914 | Accepted | x=input()
if(x=="0"):
print(1)
else:
print(0) |
p02690 | s616212457 | Accepted | X=int(input())
for i in range(-500,500):
for j in range(-500,500):
if i**5-j**5==X:
print(i,j)
exit()
|
p02811 | s656647256 | Accepted | k, x = map(int, input().split())
if 500*k >= x:
print("Yes")
else:
print ("No") |
p02861 | s446196463 | Wrong Answer | import numpy as np
import math
N = int(input())
X=[]
for i in range(N):
X.append(list(map(int, input().split())))
X = np.array(X)
gokei = 0
for i in range(N):
for j in range(i+1, N):
gokei += np.linalg.norm(X[i]-X[j])
print(gokei)
if N == 2:
A = 2
else:
A = math.factorial(N-2)*4
print(gokei*A/math.factorial(N)) |
p02631 | s734133533 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
ans ^= a
#print(ans)
for a in A:
print(ans^a) |
p02935 | s694475599 | Accepted | n=int(input())
v=list(map(int,input().split()))
ans=0
while len(v) != 1:
a=min(v)
v.remove(a)
b=min(v)
v.remove(b)
ans=(a+b)/2
v.append(ans)
print(ans) |
p03071 | s772014105 | Accepted | A,B = map(int, input().split())
print(max(A,B)+ max(max(A,B)-1,min(A,B))) |
p03208 | s008351473 | Accepted | n, k =map(int, input().split())
h = []
for i in range(n):
h.append(int(input()))
h.sort()
ans = 10000000000000000
#print(h)
for i in range(n-k+1):
if h[i+(k-1)] - h[i] <= ans:
ans = h[i+(k-1)] - h[i]
print(ans) |
p02910 | s815843217 | Accepted | s = input()
a = ['R', 'U', 'D']
b = ['L', 'U', 'D']
def judge():
for i in range(len(s)):
if i%2==0 and s[i] not in a:
return False
if i%2==1 and s[i] not in b:
return False
return True
if judge():
print('Yes')
else:
print('No') |
p02939 | s090560588 | Wrong Answer | s = input()
i = 0
lst = []
for j in range(1,len(s)+1):
if not(s[i:j] in lst):
lst.append(s[i:j])
i = j
print(len(lst)) |
p02767 | s641284606 | Accepted | import math
def calcEnergy(goal, curr):
return (curr - goal) * (curr - goal)
n = int(input())
x = list(map(int, input().split()))
xs = x.copy()
xl = x.copy()
av = (int(sum(x)/n))
for i in range(n):
xs[i] = calcEnergy(av, xs[i])
xl[i] = calcEnergy(av + 1, xl[i])
small = sum(xs)
large = sum(xl)
if(small < large):
print(small)
else:
print(large) |
p03073 | s872867136 | Wrong Answer | s1 = list(input())
s2 = s1
n = len(s1)
c = 0
d = 0
for i in range(n-1):
if s1[i]==s1[i+1]:
s1[i+1] = abs(1-int(s1[i]))
c += 1
"""
print("=====================")
for i in range(n-1,0,-1):
print(s2)
if s2[i] == s2[i-1]:
s2[i-1] = abs(1-int(s2[i]))
d += 1
"""
print(c)
"""
else:
print(2,d)
""" |
p02829 | s600055302 | Wrong Answer | A = int(input())
B = int(input())
if (A + B == 3):
print(3)
elif (A + B == 4):
print(2)
else:
print(3) |
p02772 | s256457137 | Accepted | n=int(input())
a=list(map(int,input().split()))
for i in range(n):
if a[i]%2==1:
pass
else:
if a[i]%3==0 or a[i]%5==0:
pass
else:
print("DENIED")
exit()
print("APPROVED") |
p04030 | s892005158 | Accepted | s=list(input())
ans=str()
for i in s:
if i=="0":
ans+="0"
elif i=="1":
ans+="1"
elif i=="B":
ans=ans[:-1]
print(ans) |
p03827 | s336624614 | Accepted | n = int(input())
s = input()
x = 0
ans = 0
for s in s:
if s == 'I':
x += 1
else:
x -= 1
ans = max(x, ans)
print(ans) |
p02699 | s011884765 | Wrong Answer | s = input().split()
print("safe" if s[0] > s[1] else "unsafe") |
p03017 | s322912733 | Accepted | N,A,B,C,D=map(int,input().split())
S=input()
if "##" in S[A-1:max(C,D)] or ("..." not in S[B-2:min(C,D)+1] and C>D):
print("No")
else:
print("Yes") |
p02678 | s025704180 | Accepted | n, m = map(int, input().split())
ab=[list(map(int,input().split())) for _ in range(m)]
ans = [-1 for _ in range(n)]
ans[0] = 0
tree=[[]for _ in range(n)]
for a,b in ab:
tree[a-1].append(b-1)
tree[b-1].append(a-1)
visited={0}
q=[0]
for i in q:
for j in tree[i]:
if ans[j] < 0:
q.append(j)
ans[j]=i+1
print("Yes")
for i in ans[1:]:
print(i) |
p03289 | s587890322 | Accepted | S = list(input())
if S[0] != "A":
print("WA")
elif S[2:-1].count("C") != 1:
print("WA")
elif sum([s.islower() for s in S])+2 != len(S):
print("WA")
else:
print("AC") |
p03607 | s937125324 | Wrong Answer | N = int(input())
count = 0
num = set([])
for i in range(N):
tmp = int(input())
if tmp not in num:
num.add(tmp)
else:
count += 1
print(len(num) - count) |
p02813 | s159762375 | Accepted | N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
import itertools
for i,A in enumerate(itertools.permutations( [i for i in range(1,N+1)] )):
if A==P:
a=i+1
if A==Q:
b=i+1
print(abs(b-a)) |
p03037 | s787290176 | Accepted | N, M = map(int, input().split())
c = [0 for i in range(N+1)]
for x in range(M):
L, R = map(int, input().split())
c[L-1] += 1
c[R] -= 1
r = 0
t = 0
for x in c[:-1]:
t += x
if t == M:
r += 1
print(r)
|
p03360 | s150999567 | Wrong Answer | a,b,c = map(int,input().split())
k = int(input())
d = max(a,b,c)
print(d*2*k+a+b+c-d)
|
p02993 | s171914680 | Accepted | s = input()
res = "Good"
for i in range(1,len(s),1):
if s[i-1] == s[i]:
res = "Bad"
print(res) |
p03387 | s256125761 | Accepted | A = [int(i) for i in input().split()]
A.sort()
s,m,l = A
count = 0
ls = l-s
lm = l-m
count += ls//2
count += lm//2
if ls%2 == 0 and lm%2 == 0:
print(count)
exit()
elif ls%2 == 1 and lm%2 == 1:
count += 1
print(count)
else:
count += 2
print(count)
|
p02963 | s756892451 | Accepted | s = int(input())
x1 = 10**9
y1 = 1
x2 = (10**9 - s%10**9)%10**9
y2 = (s+x2) // 10**9
print(0, 0, x1, y1, x2, y2) |
p03448 | s929381958 | Wrong Answer | A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for i in range(min(X//500,A)):
for j in range(min(X//100,B)):
for k in range(min(X//50,C)):
if X-500*i-100*j-50*k==0:
ans+=1
print(ans) |
p03254 | s402630213 | Accepted | n,x = map(int, input().split())
a = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
x -= a[i]
if (x < 0):
print(i)
break
else:
if (x != 0):
print(n - 1)
else:
print(n) |
p03994 | s870969233 | Accepted | S = input()
K = int(input())
alp = '0bcdefghijklmnopqrstuvwxyza'
alp_dict = {s:i for i,s in enumerate(alp)}
cnt = 0
ans = ''
for i,s in enumerate(S):
if cnt + (26-alp_dict[s]) <= K:
cnt += (26-alp_dict[s])
ans += 'a'
else:
ans += s
if (K-cnt)%26==0:
print(ans)
else:
rest = (K-cnt)%26
print(ans[:-1]+alp[(alp_dict[ans[-1]]+rest)%26]) |
p03012 | s886492388 | Accepted | N = int(input())
W = list(map(int, input().split()))
diff = []
s_1 = 0
s_2 = sum(W)
for i in range(N):
s_1 += W[i]
s_2 -= W[i]
diff.append(abs(s_1 - s_2))
print(min(diff)) |
p03627 | s342799166 | Accepted | import bisect,copy,heapq,itertools,string
from collections import *
from math 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 = sorted(LIST(), reverse=True)
h = 0
w = 0
reg = n-1
for i in range(n-1):
if a[i] == a[i+1]:
h = a[i]
reg = i
break
for i in range(reg+2, n-1):
if a[i] == a[i+1]:
w = a[i]
break
print(h*w) |
p03487 | s136325686 | Accepted | import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
ans = 0
for i in c:
if i<=c[i]: ans += c[i]-i
else: ans += c[i]
print(ans) |
p03323 | s152594735 | Accepted | a,b = map(int,input().split())
if a <= 8 and b <= 8:
print("Yay!")
else:
print(":(") |
p02899 | s493488477 | Accepted | N = int(input())
A = list(map(int, input().split()))
l = [0]*N
for i in range(N):
l[A[i]-1] = str(i+1)
ans = ''
for i in range(N):
ans += (l[i] + ' ')
print(ans) |
p02923 | s603124087 | Accepted | n = int(input())
h = list(map(int,input().split()))
x = -1
s = ""
for i in h:
if x>=i:
s+="1"
else:
s+="0"
x=i
print(max([len(s) for s in s.split("0")])) |
p03852 | s472147259 | Accepted | a=input()
b=["a","i","u","e","o"]
if a in b:
print("vowel")
else:
print("consonant") |
p02727 | s385945024 | Accepted | import sys
input = sys.stdin.readline
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort(reverse = True)
t = []
for _ in range(X): t.append(p.pop())
for _ in range(Y): t.append(q.pop())
t.sort()
for i in range(min(C, X + Y)):
if t[i] < r[i]: t[i] = r[i]
print(sum(t)) |
p03417 | s276822738 | Wrong Answer | n,m = map(int,input().split())
if n==1 or m==1:
print(max(max(m,n)-2,0))
else:
n = n-2
m = m-2
print(n*m) |
p03943 | s434057176 | Accepted | # 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている
# キャンディーを2人に分ける際、個数が等しくなるか判定
# 入力
a, b, c = map(int, input().split())
# 処理
if a == b + c or b == a + c or c == a + b:
print("Yes")
else:
print("No")
|
p03073 | s909791522 | Wrong Answer | s=input()
ans1,ans2=0,0
for i in range(0,len(s)-1,2):
if s[i]!="1":
ans1+=1
if s[i+1]!="0":
ans1+=1
for i in range(0,len(s)-1,2):
if s[i]!="0":
ans2+=1
if s[i+1]!="1":
ans2+=1
print(min(ans1,ans2))
|
p02658 | s168354680 | Accepted | n = int(input())
m = 1000000000000000000
num_list = [ int(v) for v in input().split() ]
ans = 1
s = 0
if 0 in num_list:
ans = 0
for i in num_list:
ans *= i
if ans > m:
s = 1
break
if s == 0:
print(ans)
else:
print(-1) |
p04029 | s188155574 | Accepted | n=int(input())
i=0
while n > 0:
i+=n
n-=1
print(i) |
p03695 | s675250556 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
t = [0] * 9
for i in range(n):
if a[i] < 3200:
t[a[i] // 400] += 1
else:
t[8] += 1
z = t.pop(8)
p = t.count(0)
amax = min(8,8-p+z)
if p == 8:
amin = 1
else:
amin = 8 - p
print(amin,amax) |
p03327 | s655411689 | Accepted | n=int(input())
if n<1000:
print("ABC")
else:
print("ABD")
|
p03254 | s139579298 | Wrong Answer | N, x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
cnt = 0
for a in al:
x -= a
if x < 0:
break
cnt += 1
if x != 0 and cnt >= 1:
print(cnt-1)
else:
print(cnt)
|
p02859 | s102700932 | Wrong Answer | r = int(input())
s = r*r*3.14
b = s / 3.14
print(int(b)) |
p02657 | s101453999 | Wrong Answer | a, b = map(int,input().split())
print(a+b) |
p02553 | s454965217 | Wrong Answer | a, b, c, d = map(int,input().split())
if (b > 0 and d > 0):
print(b * d)
elif (b < 0 and c > 0):
print(b * c)
elif (a > 0 and d < 0):
print(a * d)
else:
print(a * c) |
p02833 | s720176778 | Wrong Answer | from math import log2
N = int(input())
ans = 0
if(N % 2 == 0 and N != 0):
for i in range(int(log2(N))):
ans += (N // 5 ** (i+1)) // 2
print(ans)
elif(N % 2 == 1):
print(0)
else:
print(1) |
p03438 | s165074215 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(a)>sum(b):
print("No")
else:
ca = 0
cb = 0
for i in range(n):
if a[i]>b[i]:
cb += a[i]-b[i]
else:
ca += (b[i]-a[i]+1)//2
cb += (b[i]-a[i])%2
if (sum(b)-sum(a)-ca)*2 == sum(b)-sum(a)-cb:
print("Yes")
else:
print("No") |
p02993 | s111238702 | Wrong Answer | a = input()
for i in range(3):
if a[i] == a[i+1]:
print("Bad")
break
print("Good") |
p03785 | s172070428 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
n,c,k=mp()
t=sorted([int(input()) for i in range(n)])
count=1
f=t[0]
ans=1
for i in range(1,n):
count+=1
d=t[i]-f
if d>k or count>c:
ans+=1
count=1
f=t[i]
print(ans) |
p03479 | s022327632 | Accepted | #!/usr/bin/env python3
X, Y = map(int, input().split())
count = 0
num = X
while True:
if not X <= num <= Y:
break
num *= 2
count += 1
print(count)
|
p02881 | s697013315 | Accepted | n = int(input())
ans = n-1
for i in range(2,10**6+1):
if(n%i == 0):
ans = min(ans, i + n//i - 2)
print(ans) |
p02597 | s781164021 | Accepted | n = int(input())
clist = input()
rs = clist.count("R")
ws = clist.count("W")
sort_rs = rs - clist[0:rs].count("R")
ans = rs
if ws < ans:
ans = ws
if sort_rs < ans:
ans = sort_rs
print(ans) |
p03109 | s738623326 | Wrong Answer | S = input()
year = int(S[0:4])
mon = int(S[5:7])
day = int(S[8:])
print(year,mon,day)
if year <= 2019 and 1 <= mon <= 4 and 1 <= day <= 30:
print("Heisei")
else:
print("TBD") |
p03659 | s418815197 | Wrong Answer | N,*A = map(int, open(0).read().split())
S = sum(A)
k = 0
m = 10**18
for i,a in enumerate(A):
if i == N - 1: break
k += a
d = abs(S - 2*k)
if d < m:
m = d
else:
break
print(m) |
p02695 | s566380970 | Accepted | from itertools import*
n,m,q,*L=map(int,open(0).read().split())
print(max(sum(d*(x[b-1]-x[a-1]==c)for a,b,c,d in zip(*[iter(L)]*4))for x in combinations_with_replacement(range(m),n))) |
p02583 | s756766588 | Wrong Answer | N = input()
lst = list(map(int,input().split()))
cnt = 0
for i in range(len(lst)):
for j in range(len(lst)):
for k in range(len(lst)):
if lst[k]+lst[j] > lst[i]:
if lst[k] != lst[j] != lst[i]:
cnt += 1
print(cnt) |
p03986 | s332567902 | Accepted | X = list(str(input()))
n = len(X)
s = []
for x in X:
if x == 'S':
s.append(x)
if x == 'T':
if s:
if s[-1] == 'S':
s.pop()
else:
s.append(x)
else:
s.append(x)
print(len(s))
|
p02842 | s119357756 | Wrong Answer | n=int(input())
num=round(n/1.08)
check=int(num*1.08)
if check==n:
print(num)
else:
print(':(') |
p03077 | s166462503 | Wrong Answer | n=int(input())
min1=11**15
for i in range(5):
a=int(input())
min1=min(min1,a)
print((n//min1+1)+4) |
p03455 | s874088309 | Accepted | a, b = map(int, input().split())
if (a*b)%2==0:
print('Even')
else:
print('Odd') |
p02694 | s892513611 | Wrong Answer | x=int (input())
i=0
c=100
d=100
while x >= d:
c=c+((c*0.01)//1)
d=d+c
i=i+1
print(i) |
p02912 | s906290695 | Accepted | N, M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())), reverse=True)
b = []
b.append(A.pop(0)//2)
for i in range(1,M):
if A == []:
b.append(b.pop(0)//2)
else:
if A[0] > b[0]:
b.append(A.pop(0)//2)
else:
b.append(b.pop(0)//2)
print(sum(A)+sum(b)) |
p02897 | s548768866 | Accepted | n = int(input())
odds_cnt = (n+1)//2
print(odds_cnt/n) |
p03289 | s436149833 | Accepted | s = input()
if s[0] == "A":
if s[2:-1].count("C") == 1:
if s[1:].replace("C","").islower():
print("AC")
exit()
print("WA") |
p02696 | s842984959 | Accepted | A,B,N = map(int, input().split())
x = min(B-1,N)
ans = (A*x)//B
print(ans) |
p02792 | s645318843 | Accepted | n = int(input())
ans = 0
cnt = [[0] * 9 for i in range(9)]
for i in range(1, n + 1):
if i % 10 == 0:
continue
a = str(i)[0]
b = str(i)[-1]
cnt[int(a) - 1][int(b) - 1] += 1
for i in range(9):
for j in range(9):
ans += cnt[i][j] * cnt[j][i]
print(ans) |
p03673 | s778072544 | Accepted | N = int(input())
a = list(map(int,input().split()))
b = [-1] *N
for i in range((N+1)//2):
b[i] = str(a[N-1-i*2])
for i in range(N //2):
b[i+((N+1)//2)] = str(a[N%2 + 2*i])
print(" ".join(b)) |
p03095 | s503411988 | Accepted | from collections import Counter
n = int(input())
s = list(map(str, input().rstrip()))
c = Counter(s)
dp = 1
for x in c.values():
dp = dp * (x + 1)
dp = (dp - 1) % (10 ** 9 + 7)
print(dp) |
p02642 | s942368876 | Accepted | n = int(input())
A = sorted(list(map(int, input().split())))
M = 10**6 + 1
L = [0]*M
for a in A:
L[a] += 1
if L[a] == 1:
# k>=2として k*aは全て不適
for i in range(2*a, M, a):
L[i] += 2
# flagの数が答え
print(L.count(1)) |
p02606 | s262348896 | Accepted | l,r,n=map(int,input().split())
c=0
for i in range(l,r+1):
if i%n==0:
c+=1
print(c) |
p02630 | s290102371 | Accepted | from collections import Counter
N = int(input())
A = [int(x) for x in input().split()]
d = Counter(A)
Q = int(input())
def sum_from_counter(d):
return sum(map(lambda k: k * d[k], d))
s = sum(map(lambda k: k * d[k], d))
for i in range(Q):
B, C = [int(x) for x in input().split()]
d[C] = d.get(C, 0) + d[B]
s += (C - B) * d[B]
d[B] = 0
print(s) |
p03385 | s730279749 | Accepted | s=input()
a=s.count('a')
b=s.count('b')
c=s.count('c')
if (a==1 and b==1 and c==1):
print("Yes")
else:
print("No")
|
p02778 | s985717950 | Accepted | S = input()
print("x"*len(S)) |
p02578 | s206090149 | Wrong Answer | N = int(input())
A = input().split()
# print(A)
A_list = list(map(float, A))
sa = 0
for i in range(N-1):
# print(i)
if A_list[i] > A_list[i+1]:
sa += A_list[i] - A_list[i+1]
A_list[i+1] = A_list[i]
print(sa)
|
p02775 | s091404308 | Accepted |
N = input()
lim = len(N)
dp = [[0, 0] for _ in range(lim + 1)]
dp[0][1] = 1
for i in range(lim):
n = int(N[i])
dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n)
dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - n - 1)
print(dp[-1][0])
|
p02789 | s855973239 | Wrong Answer | N,M = map(int, input().strip().split(' '))
print('Yes' if M <= N else 'No') |
p03103 | s159248613 | Accepted | x, y= map(int, input().split())
s=[list(map(int,list(input().split()))) for i in range(x)]
k= list(s)
k.sort()
a=0
t=0
for i in range(x):
if y-a>=k[i][1]:
t=t+k[i][0]*k[i][1]
a=a+k[i][1]
else:
t=t+((y-a)*k[i][0])
a=y
print(t) |
p02963 | s983379538 | Wrong Answer | import math
S = int(input())
a = int(math.sqrt(S))+1
b = S//a+1
diff = a* b - S
if diff > 0:
print(0,0,a,diff,1,b)
if diff > 10**9:
exit(1)
elif diff < 0:
exit(1)
else:
print(0,0,a,0,0,b) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.