problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03997 | s112654166 | Wrong Answer | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) |
p02917 | s595043133 | Wrong Answer | n = int(input())
b = list(map(int,input().split()))
ans = b[0]
for i in range(n-2):
ans = ans + min(b[i],b[i+1])
if b[n-2] >= b[n-3]:
ans = ans + b[n-2]
elif b[n-2] < b[n-3]:
ans = ans + b[n-3]
print(ans) |
p02618 | s872422305 | Wrong Answer | D,*CS = map(int, open(0).read().split())
C = CS[:26]
S = [CS[26*i:26*(i+1)] for i in range(1, D+1)]
def imax(xs):
m = -1
i = 0
for j, x in enumerate(xs):
if x > m:
i = j
m = x
return i
for d in range(D):
i = imax(S[d])
print(i)
|
p02989 | s849048487 | Accepted | N = int(input())
d = [int(i) for i in input().split()]
d.sort()
#print(d)
a = d[N//2 - 1]
b = d[N//2]
#print(a,b)
print(len(range(a+1,b+1))) |
p02861 | s836762732 | Accepted | n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
import itertools
import math
path = 0
for ptn in itertools.permutations(range(n)):
for i, j in zip(ptn, ptn[1:]):
path += ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5
ans = path / (math.factorial(n))
print(ans) |
p03617 | s401098231 | Accepted | q, h, s, d = map(int, input().split())
n = int(input())
ans = 0
s = min(s, 2*min(h, 2*q))
if s*2 <= d:
ans = s*n
elif s*2 > d:
ans = n//2*d + n%2*s
print(ans) |
p02608 | s221248975 | Accepted | N=int(input())
count=[0]*(N+1)
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
n=x*x+y*y+z*z+x*y+y*z+z*x
if(n<=N):
count[n]+=1
for i in range(1,N+1):
print(count[i]) |
p02594 | s690072514 | Accepted | def yana(boo):
if boo:
print("Yes")
else:
print("No")
yana(int(input())>=30) |
p03659 | s452783002 | Accepted | N = int(input())
a = list(map(int,input().split()))
s = sum(a)
su = a[0]
ar = s - su
ans = abs(su-ar)
for i in range(1,N-1):
su += a[i]
ar = s - su
if ans > abs(su-ar):
ans = abs(su-ar)
print(ans) |
p02725 | s179467310 | Accepted | k, n = map(int, input().split())
List = list(map(int, input().split()))
L2 = []
for i in range(n-1):
L2.append(List[i+1] - List[i])
L2.append(k - List[-1] + List[0])
print(k - max(L2)) |
p02743 | s123220302 | Wrong Answer | from decimal import *
getcontext().prec = 100
a, b, c = map(int, input().split())
l = Decimal(a).sqrt() + Decimal(b).sqrt()
r = Decimal(c).sqrt()
if l < r:
print("Yes")
else:
print("No") |
p02760 | s867144225 | Accepted | a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
for i in range(n):
b = int(input())
for j in range(3):
for k in range(3):
if a[j][k] == b:
a[j][k] = 0
cross = 0
ucross = 0
for j in range(3):
if sum(a[j][:]) == 0 or sum([row[j] for row in a]) == 0:
print("Yes")
exit()
cross += a[j][j]
ucross += a[2-j][j]
if cross == 0 or ucross == 0:
print("Yes")
exit()
print("No") |
p03059 | s299020689 | Accepted | a,b,t = map(int, input().split())
ans = int((t+0.5)//a)*b
print(ans) |
p03407 | s858336299 | Accepted | a, b,c = map(int, input().split())
if a+b >=c:
print('Yes', flush=True)
else:
print('No', flush=True)
|
p03131 | s883275102 | Accepted | import sys
input = sys.stdin.readline
K, A, B = map(int, input().split())
if A >= B:
print(K + 1)
exit(0)
if K <= A:
print(K + 1)
exit(0)
print(max(K + 1, ((K - A + 1) // 2) * (B - A) + A * (((K - A + 1) // 2) > 0) + (((K - A + 1) % 2)))) |
p03136 | s121730003 | Wrong Answer | N=int(input())
A=sorted(map(int,input().split()))
ans=0
for i in range(N-1):
ans+=A[i]
if ans<A[N-1]:
print("No")
else:
print("Yes") |
p02947 | s780232086 | Accepted | import collections as c
n = int(input())
s = []
ans = 0
for i in range(n):
t = list(input())
t.sort()
t = str(t)
s.append(t)
s = c.Counter(s)
for i in s.values():
ans += i*(i-1)//2
print(ans) |
p03103 | s435816332 | Wrong Answer | import heapq
N, M = map(int, input().split())
L = []
for i in range(N):
a, b = map(int, input().split())
L.append((a, b))
heapq.heapify(L)
# heapq.heapify(sorted(L, key=lambda x: x[0]))
print(L)
drink = 0
yen = 0
while drink < M:
a, b = heapq.heappop(L)
if drink + b <= M:
yen += a * b
drink += b
else:
yen += a * (M - drink)
break
print(yen)
|
p02601 | s403379029 | Wrong Answer | A, B, C = input().split()
A, B, C = [int(A), int(B), int(C)]
K = int(input())
for i in range(K):
if(B > C or A > C):
C = C * 2
elif(A > B):
B = B * 2
else:
C = C * 2
if(C > B > A):
print("Yes")
else:
print("No")
|
p03797 | s445547259 | Accepted | s, c = map(int, input().split())
ans = 0
ans += min(s,c//2)
res = c-min(s,c//2)*2
ans += res//4
print(ans) |
p03998 | s921667470 | Wrong Answer | A = input()
B = input()
C = input()
ABC = {"a":A, "b":B, "c":C}
ABC_H = {"a":"A", "b":"B", "c":"C"}
ind = A[0]
while True:
if len(ABC[ind]) == 0:
print(ABC_H[ind])
break
ind = ABC[ind][0]
ABC[ind] = ABC[ind][1:]
|
p02731 | s199884291 | Accepted | #!/usr/bin/env python3
import sys
def solve(L: int):
x = L / 3
print(x**3)
return
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
L = int(next(tokens)) # type: int
solve(L)
if __name__ == '__main__':
main()
|
p02795 | s882168846 | Accepted | import sys
input = sys.stdin.readline
def main():
H = int(input())
W = int(input())
N = int(input())
print(min(-((-N) // H),-((-N) // W)))
if __name__ == '__main__':
main()
|
p02790 | s495331240 | Accepted | a,b = map(int,input().split())
if a < b:
print("{}".format(a)*b)
else:
print("{}".format(b)*a)
|
p03386 | s109285755 | Accepted | A,B,K=map(int,input().split())
for i in range(A,min(B+1,A+K)):
print(i)
for i in range(max(B-K+1,A+K),B+1):
print(i)
|
p03821 | s606750152 | Wrong Answer | n = int(input())
ab = [map(int, input().split()) for _ in range(n)]
a, b = [list(i) for i in zip(*ab)]
a.reverse()
b.reverse()
ans = 0
num = 0
ruisekiwa = 0
for j in range(n):
a[j] += ruisekiwa
syou = a[j]//b[j]
if a[j] == 0:
num = 0
elif b[j] == 1:
num = 0
elif a[j] == b[j]:
num = 0
else:
num = b[j]*(syou+1) - a[j]
ruisekiwa += num
ans += num
print(ans) |
p03632 | s321730270 | Accepted | A,B,C,D=map(int,input().split())
s=min(B,D)-max(A,C)
if s<0:
print(0)
else:
print(s) |
p03131 | s704000114 | Wrong Answer | k, a, b = map(int, input().split())
if k > a+1 and a < b:
print(max((k-a-1) // 2 * (b-a) + b + (k-a-1) % 2, k+1))
else:
print(k+1) |
p03773 | s277408403 | Accepted | A, B = map(int, input().split())
print(A+B if A+B<24 else A+B-24) |
p03696 | s360396417 | Accepted | N = int(input())
S = input()
s = list(S)
cr = 0
cl = 0
for i in s:
if i == "(":
cr += 1
else:
if cr > 0:
cr -= 1
else :
cl += 1
print("("*cl+S+")"*cr) |
p02553 | s562929857 | Wrong Answer | a, b, c, d = map(int, input().split())
if b <= 0 and d <= 0:
print(c * a)
elif b > 0 and d > 0:
print(b * d)
elif b < 0 and d > 0:
if c > 0:
print(c * b)
else:
print(a * c)
elif b > 0 and d < 0:
if a > 0:
print(a * d)
else:
print(a * c)
else:
print(b * d)
|
p02958 | s150555823 | Accepted | def main():
N = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(N-1):
if p[i]!=i+1:
count += 1
if count >= 3:
print("NO")
else:
print("YES")
if __name__=="__main__":
main() |
p03434 | s310114182 | Accepted | n = int(input())
A = list(map(int, input().split()))
Alice = 0
Bob = 0
A = list(sorted(A, reverse=True))
while True:
if A != []:
Alice += A.pop(0)
else:
break
if A != []:
Bob += A.pop(0)
else:
break
print(Alice-Bob)
|
p03437 | s432959899 | Accepted | n,m = map(int, input().split())
if n % m == 0:
print(-1)
else:
print(n*(m+1)) |
p02972 | s297751625 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
a.insert(0,-1)
for i in range(N,0,-1):
k=2
temp=a[i]
while i*k<=N:
if a[i*k]==1:
temp = (temp+1)%2
k+=1
a[i] = temp
M=0
b=[]
for i in range(1,N+1):
if a[i]==1:
M+=1
b.append(i)
print(M)
[print(x) for x in b] |
p02622 | s893230652 | Wrong Answer | s = input()
t = input()
a = 0
for i in range(len(s)):
if s[i] == t[i]:
a += 1
print(a) |
p03241 | s944012991 | Accepted | import sys
readline = sys.stdin.readline
N,M = map(int,readline().split())
# Mの約数Pのうち、M // P >= Nとなるものの最大値
ans = 0
for i in range(1,int(M ** 0.5) + 1):
if M % i == 0:
p = M // i
if i >= N:
if ans < p:
ans = p
if p >= N:
if ans < i:
ans = i
print(ans)
|
p03136 | s078792836 | Wrong Answer | import numpy as np
N = int(input())
L = list(map(int, input().split()))
maxL = np.argmax(L)
L.pop(maxL)
if maxL < sum(L):
print('Yes')
else:
print('No') |
p02783 | s158140457 | Accepted | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def solve(inp):
import math
(H, A) = map(int, inp.readline().strip().split(' '))
r = math.ceil(H / A)
return r
def main():
import sys
result = solve(sys.stdin)
if result is not None and result != '':
print(result)
if __name__ == '__main__':
main()
|
p02947 | s126299289 | Accepted | n=int(input())
a=set()
b=[]
import collections
for i in range(n):
s=input()
s=sorted(s)
a.add("".join(s))
b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans) |
p03698 | s853501687 | Wrong Answer | s = input()
n = len(s)
flg=False
for i in range(n-1):
if(s[i] == s[i+1]):
flg=True
break
if flg:
print("yes")
else:
print("no") |
p02730 | s155318809 | Wrong Answer | def main():
S = input()
N = len(S)
P = S[:(N-1)//2]
Q = S[(N+3)//2 - 1:]
if (P[:len(P)//2] == P[len(P)//2 + 1:]) and (Q[:len(Q)//2] == Q[len(Q)//2 + 1:]):
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
p03479 | s185142280 | Accepted | X, Y = map(int, input().split())
A = []
a = X
while 1:
A.append(a)
if a*2 > Y:
break
a *= 2
print(len(A))
|
p03103 | s551610660 | Accepted | N, M = map(int, input().split())
S = []
for i in range(N):
a, b = map(int, input().split())
S.append([a, b])
S.sort(key=lambda x: x[0])
price = 0
count = 0
for s in S:
if count + s[1] < M:
price += s[0] * s[1]
count += s[1]
else:
price += s[0] * (M - count)
break
print(price) |
p02952 | s710633270 | Wrong Answer | n = int(input())
ans = 0
if n < 10:
ans += n
else:
ans += 9
if n < 10000:
ans += max(0, n-1000)
else:
ans += 900
if n < 1000000:
ans += max(0, n-100000)
print(ans) |
p03250 | s123089792 | Wrong Answer | a, b, c = map(int, input().split())
print(max(a*10+b+c, a+b*10+c), a+b+c*10) |
p04045 | s607552953 | Accepted | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
d = set(map(int, input().split()))
for x in range(N, 10 ** 6):
f = 1
for y in str(x):
if int(y) in d:
f = 0
break
if f:
print(x)
exit(0) |
p03565 | s634833683 | Wrong Answer | s,t=input(),input()
for i in range(len(s)-len(t)+1):
judge = True
for j in range(len(t)):
if not (s[i+j]==t[j] or s[i+j]=='?'):
judge = False
if not judge:
break
else:
r=['a' if i=='?' else i for i in s[:i]]
print(''.join(r)+t)
exit()
print('UNRESTORABLE') |
p03994 | s188095081 | Accepted | s = [ord(i) for i in input()]
k = int(input())
for i in range(len(s)):
if s[i] == 97: continue
if 123 - s[i] <= k:
k -= 123 - s[i]
s[i] = 97
if k == 0:
break
if k != 0:
s[-1] = s[-1] + k % 26
print("".join([chr(i) for i in s])) |
p03001 | s852541544 | Accepted | w, h, x, y = map(int, input().split())
center = (w/2, h/2)
ans2 = 1 if (x, y)==center else 0
ans1 = w*h/2
print(ans1, ans2) |
p03612 | s172500215 | Accepted | N = int(input())
P = list(map(int, input().split()))
cnt = 0
t = 'o' if P[0] == 1 else 'x'
j = 0 if t == 'o' else 1
L = []
for i, p in enumerate(P):
s = 'o' if p == (i + 1) else 'x'
if s == t:
cnt += 1
else:
L.append(cnt)
cnt = 1
t = s
L.append(cnt)
ans = 0
for i, n in enumerate(L):
if i % 2 == j:
ans += (n + 2 - 1) // 2
print(ans)
|
p02768 | s562909160 | Wrong Answer | n,a,b=list(map(int,input().split()))
import math
mod=10**9+7
x=math.factorial(n)//(math.factorial(n-a)*math.factorial(a))
y=math.factorial(n)//(math.factorial(n-b)*math.factorial(b))
def power(n,a,p):
res=1
while n>0:
if n%2:
res=(res*a)%p
n-=1
else:
a=(a*a)%p
n/=2
return res
print((power(2,n,mod)-1-x-y)%mod) |
p03997 | s972545236 | Accepted | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
|
p03720 | s661618922 | Accepted | n,m=map(int,input().split())
al=[]
bl=[]
for i in range(m):
a,b=map(int,input().split())
al.append(a)
bl.append(b)
for i in range(1,n+1):
print(al.count(i)+bl.count(i))
|
p02916 | s270071374 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
count = 0
for i in range(n):
if(i != 0):
if(a[i] - a[i - 1] == 1):
count += b[a[i] - 1] + c[a[i - 1] - 1]
else:
count += b[a[i] - 1]
else:
count += b[a[i] - 1]
print(count)
|
p02972 | s582107751 | Accepted | import sys
n, *a = map(int, sys.stdin.read().split())
a = [None] + a
def main():
res = [0] * (n + 1)
chosen = []
for i in range(n, 0, -1):
tmp = sum(res[i*2:n+1:i]) & 1
if tmp ^ a[i]:
res[i] = 1
chosen.append(i)
if chosen:
m = len(chosen)
return [m], chosen[::-1]
else:
return [[0]]
if __name__ == '__main__':
ans = main()
for a in ans:
print(*a, sep=' ') |
p03474 | s872837697 | Accepted | a,b = map(int,input().split())
S = input()
flag = 0
k = [str(i) for i in range(10)]
for i in range(len(S)):
if i == a:
if S[i] == "-":
continue
else:
flag += 1
print("No")
break
else:
if S[i] in k:
continue
else:
flag += 1
print("No")
break
if flag == 0:
print("Yes") |
p02755 | s954523240 | Accepted | import math
a, b = map(int, input().split(' '))
cnt = -1
for i in range(1, 1001):
hachi = math.floor(i * 0.08)
ju = math.floor(i * 0.1)
if hachi == a and ju == b:
cnt = i
break
print(cnt)
|
p03150 | s955516394 | Accepted | s = input()
n = len(s) - 7
for i in range(7):
if s[:i] + s[i+n:] == 'keyence':
print("YES")
exit()
print("NO") |
p03250 | s906528157 | Wrong Answer | A, B, C = input().split()
ans1 = int(A+B) + int(C)
ans2 = int(A) + int(B+C)
print(max(ans1, ans2)) |
p03779 | s262051625 | Wrong Answer | n = int(input())
ng =0
ok=n
while abs(ok-ng)>1:
mid=(ok+ng)//2
if mid*(1+mid)//2>=n:
ok=mid
else:
ng = mid
if ok*(1+ok)//2 != n:
ok+=1
print(ok)
|
p03774 | s465344306 | Accepted | n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
cd=[list(map(int,input().split())) for _ in range(m)]
ans=[]
for i in range(n):
MIN=10**10
index=0
for g in range(m):
if MIN>abs(ab[i][0]-cd[g][0])+abs(ab[i][1]-cd[g][1]):
MIN=abs(ab[i][0]-cd[g][0])+abs(ab[i][1]-cd[g][1])
index=g+1
ans.append(index)
for i in range(n):
print(ans[i]) |
p02546 | s770945909 | Wrong Answer | s = input()
if s[-1]=="s":
print(s+"es")
else:
print(s) |
p02629 | s781375403 | Accepted | from bisect import bisect_left
n = int(input())
lis = [0]*13
for i in range(1,13):
lis[i] = 26**i + lis[i-1]
#print(lis)
num = bisect_left(lis,n)
n -= lis[num-1]
n -= 1
ans = ''
for i in range(num):
i = num-i-1
ans += chr(n//(26**i) +97)
n %= 26**i
print(ans) |
p02831 | s008309000 | Accepted | import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2) |
p04044 | s902330643 | Accepted | n, l = map(int, input().split())
a = [input() for _ in range(n)]
a.sort()
print("".join(a)) |
p03774 | s761395651 | Accepted | n,m = map(int,input().split())
ab = [0]*n
cd = [0]*m
for i in range(n):
ab[i] = input().split()
for i in range(m):
cd[i] = input().split()
for i in range(n):
tmp = []
for j in range(m):
tmp.append(abs (int(ab[i][0]) - int(cd[j][0])) + abs(int(ab[i][1]) - int(cd[j][1])))
x = min(tmp)
ans = tmp.index(x)
print(ans+1) |
p02717 | s027625655 | Accepted | x, y, z = map(int, input().split())
print(z, x, y) |
p03262 | s655134741 | Accepted | #starting from X is equivalent to go to x1-X,x2-X,... starting from 0.
#donc x1-X est multiple de D, x2-X l'est aussi...donc gcd des xi-X.
import fractions
from functools import reduce
N,X = map(int,input().split())
L = [abs(i-X) for i in map(int,input().split())]
def gcd_list(numbers):
return reduce(fractions.gcd,numbers)
print(gcd_list(L)) |
p03417 | s557906455 | Accepted | n,m = map(int,input().split())
if (n == 2 and m != 1) or (m == 2 and n != 1):
print(0)
elif n ==1 and m != 1:
print(m-2)
elif m == 1 and n != 1:
print(n-2)
elif n == 1 and m == 1:
print(1)
else:
print(n*m-(n+m-2)*2)
|
p03767 | s232369526 | Accepted | n=int(input())
print(sum(sorted(list(map(int,input().split())),reverse=True)[1:2*n:2])) |
p03799 | s055766388 | Accepted | import sys
N, M = map(int, sys.stdin.readline().strip().split())
if N >= M // 2:
print(M // 2)
else:
ans = N
r = M - N*2
ans += r // 4
print(ans) |
p02818 | s477833884 | Accepted | A, B, K = map(int, input().split())
e = min([K, A])
a = A - e
e = min([K-e, B])
b = B - e
print(a, b) |
p03852 | s334672445 | Accepted | s = input()
if s in ["a", "i", "u", "e", "o"]: print("vowel")
else: print("consonant") |
p02900 | s623832402 | Accepted | from fractions import gcd
def prime_factorize(n):
factor = []
for i in range(2, int(n**0.5)+1):
while n % i == 0:
n //= i
factor.append(i)
if n != 1:
factor.append(n)
return factor
A, B = map(int, input().split())
N = gcd(A, B)
l = set(prime_factorize(N))
print(len(l)+1) |
p02836 | s313638976 | Wrong Answer | import math
s = input()
left = s[:len(s) // 2]
right = s[-math.floor(len(s) / 2):]
ct = 0
for i in range(len(left)):
if left[i] != right[i]: ct += 1
print(ct)
|
p03095 | s620070229 | Accepted | from collections import Counter
MOD = 10 ** 9 + 7
input()
S = input()
ans = 1
for v in Counter(S).values():
ans *= v + 1
ans %= MOD
print(ans - 1)
|
p02771 | s903901073 | Wrong Answer | A,B,C=input().split()
if(A==B):
if not(B==C):
print("Yes")
elif(A==C):
if not(A==B):
print("Yes")
elif(C==B):
if not(C==A):
print("Yes")
else:
print("No") |
p03077 | s037325812 | Accepted | N = int(input())
ABCDE = [int(input()) for _ in range(5)]
tmp = min(ABCDE)
ans = (N + tmp - 1) // tmp + 4
print (ans) |
p02729 | s225694490 | Accepted | n,m=map(int,input().split())
print((n+m)*(n+m-1)//2-n*m)
|
p04044 | s773017986 | Accepted | n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print("".join(s))
|
p02548 | s178529103 | Accepted | n=int(input())-1;print(sum(n//-~i for i in range(n))) |
p03086 | s254051928 | Accepted | import sys
input = sys.stdin.readline
def main():
t = 'ATGC'
ans = 0
S = input()
temp = 0
for s in S:
if s in t:
temp += 1
else:
ans = max(ans, temp)
temp = 0
print(ans)
if __name__ == '__main__':
main() |
p02583 | s939570750 | Accepted | import itertools
x = int(input())
count = 0
c=list(map(int, input().split()))
c_list = list(itertools.combinations_with_replacement(c, 3))
for i in range(len(c_list)):
if c_list[i][0] != c_list[i][1] and c_list[i][1]!= c_list[i][2] and c_list[i][2] != c_list[i][0]:
if c_list[i][0] + c_list[i][1] > c_list[i][2] and c_list[i][1] + c_list[i][2] > c_list[i][0] and c_list[i][0] + c_list[i][2] > c_list[i][1]:
count += 1
print(count) |
p02838 | s279880328 | Wrong Answer | import sys
stdin = sys.stdin
mod = 1000000007
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
n = ni()
a = na()
ans = 0
for i in range(61):
z, o = [0] * 2
for j in range(n):
if a[j] & (1 << i):
o += 1
else:
z += 1
ans += z * o * (2 ** i)
print(ans) |
p02842 | s967759045 | Wrong Answer | n = int(input())
x = round(n / 1.08)
d = int(x * 1.08)
if n == d:
print(x)
else:
print(":(") |
p02724 | s104608936 | Wrong Answer | # 計算
X = 1000000000
uresisa_500yen = (X // 500) * 1000
mod = (X % 500)
uresisa_5yen = (mod // 5) * 5
uresisa_total = uresisa_500yen + uresisa_5yen
print(uresisa_total) |
p02661 | s603859546 | Accepted | n=int(input())
a,b=[],[]
for _ in range(n):
a_,b_=map(int,input().split())
a.append(a_)
b.append(b_)
a.sort()
b.sort()
if n%2:
print(b[n//2]-a[n//2]+1)
else:
lower=(a[n//2]+a[n//2-1])/2
upper=(b[n//2]+b[n//2-1])/2
print(int(upper*2-(lower*2-1))) |
p03799 | s936198503 | Wrong Answer | [n,m] = [int(i) for i in input().split()]
if n * 2 >= m:
print(n)
else:
ans = n
m -= n * 2
ans += m//4
print(ans)
|
p03254 | s087801606 | Accepted | n,x = map(int,input().split())
a = list(map(int,input().split()))
if sum(a) == x:
print(n)
elif sum(a) < x:
print(n - 1)
else:
ans = 0
a.sort()
for i in range(n):
if a[i] > x:
break
else:
x -= a[i]
ans += 1
print(ans) |
p03986 | s530121769 | Accepted | def main():
X = input()
cs, ct = 0, 0
for x in X:
if x == 'T':
if cs == 0:
ct += 1
else:
cs -= 1
else:
cs += 1
print(ct * 2)
if __name__ == '__main__':
main()
|
p02756 | s601092647 | Accepted | s = input()
Q = int(input())
rev_count = 0
sbf=''
saf=''
for i in range(Q):
que = input()
if que[0] == '1':
rev_count +=1
elif que[0] == '2':
if (rev_count + int(que[2]))%2 == 0:
saf = saf + que[4]
else:
sbf = que[4] + sbf
print(sbf+s+saf if rev_count %2 == 0 else (sbf+s+saf)[-1::-1])
|
p02958 | s528484459 | Accepted | N=int(input())
p=list(map(int,input().split()))
z=0
for i in range(N):
if p[i]!=i+1:
z+=1
if z<=2:
print("YES")
else:
print("NO") |
p03862 | s936336561 | Wrong Answer | def candy():
boxNum, x = [int(i) for i in input().split()]
ain = input()
alist = ain.split(' ')
s = 0
for i in range(0, boxNum-1):
if int(alist[i+1]) + int(alist[i]) > x:
s = s + (int(alist[i+1]) + int(alist[i]) - x)
alist[i+1] = x - int(alist[i])
print(s)
candy() |
p03030 | s098795448 | Accepted | n=int(input())
R=[list(input().split()) + [i+1] for i in range(n)]
R.sort(key=lambda x: (x[0],-int(x[1])))
for r in R:
print(r[2]) |
p03672 | s461694263 | Wrong Answer | def main():
s = list(input())
if len(s) % 2 == 0:
del s[-1]
del s[-1]
half_len = len(s) // 2
for i in range(0, half_len, 2):
if s[:half_len-(i//2)] == s[half_len-(i//2):]:
break
else:
del s[-2:]
print(len(s))
if __name__ == '__main__':
main() |
p03035 | s222672601 | Wrong Answer | from collections import Counter
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))
a,b=input_list()
ans=0
if b>12:
ans=a
if 13>b and b>5:
ans=a//2
print(ans) |
p04043 | s391931820 | Accepted | length = list(map(int, input().split()))
judge = {0:5,1:7,2:5}
for i in range(len(judge)):
for j in range(len(length)):
if length[j] == judge[i]:
length.pop(j)
break
else:
if j == len(length)-1:
print('NO')
exit()
print('YES') |
p02753 | s071121444 | Accepted | # -*- coding: utf-8 -*-
# Input of 3 stations
stations = input() # i.e. ABA
def needBus(s):
'''<str> s: 3 stations'''
if ((s[0] != s[1]) or (s[1] != s[2])):
return 'Yes'
else:
return 'No'
# Output
print(needBus(stations))
|
p03427 | s510008293 | Accepted | n = int(input())
n_str = str(n)
ans = int(n_str[0])
if n_str[1:].count('9') != len(n_str) - 1:
ans -= 1
ans += int(len(n_str[1:])) * 9
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.