problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02759 | s477510219 | Accepted | import math
N = int(input())
print(math.ceil(N / 2)) |
p03478 | s716793574 | Accepted | n, a, b = map(int, input().split())
c = 0
for i in range(1, n+1):
t = sum(list(map(int, str(i))))
if a<=t<=b: c += i
print(c) |
p02795 | s890581575 | Wrong Answer | H=int(input())
W=int(input())
N=int(input())
T=max(H,W)
print(N//T+1) |
p03481 | s700379042 | Accepted | x,y = map(int, input().split())
cnt = 0
for i in range(100000):
if x > y:
break
cnt += 1
x *= 2
print(cnt) |
p02957 | s533444598 | Accepted | a,b = map(int,input().split())
if (a+b)%2==0:
print((a+b)//2)
else:
print("IMPOSSIBLE") |
p02989 | s343354374 | Accepted | n = int(input())
d_list = [int(x) for x in input().split()]
d_list.sort()
n >>= 1
ans = d_list[n] - d_list[n - 1]
print(ans) |
p03328 | s505575487 | Accepted | a, b = map(int, input().split())
x = b - a
tmp = 0
for i in range(1, x):
tmp += i
print(tmp - a) |
p02664 | s242633392 | Accepted | t = list(input())
for i in range(len(t)):
if t[i] == '?':
t[i] = 'D'
print(''.join(t)) |
p02939 | s075127294 | Wrong Answer | S = list(input())
ans = 1
r = 1
s = 0
while r <= len(S)-1: #貪欲に
if S[r] != S[r-1] or s == 1:
ans += 1
r += 1
s = 0
else:
ans += 1
r += 2
s = 1
print(ans) |
p03239 | s767221424 | Accepted | N, T = map(int,input().split())
list1 = [list(map(int,input().split())) for i in range(N)]
list2 = [x[0] for x in list1 if x[1]<=T ]
if len(list2)==0:
print("TLE")
else :
print(min(list2)) |
p02622 | s334661468 | Wrong Answer | S = input()
T = input()
num = 0
for i in range(len(T)):
if (S[i] != T[i]):
S[i] == T[i]
num += 1
print(num) |
p02835 | s929954612 | Accepted | print('bust' if sum(map(int, input().split())) > 21 else 'win')
|
p04031 | s151249099 | Wrong Answer | n=int(input())
a=[int(i) for i in input().split()]
print(round(sum(a)/n)) |
p03011 | s189407174 | Accepted | l = list(map(int, input().split()))
l = sorted(l)
d = l[0] + l[1]
print(d) |
p02708 | s079345498 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
n, k = map(int,input().split())
result = 0
for i in range(k, n+2):
min = (i-1) * (1+(i-2)*0.5)
max = (n * i) - min
result += (max-min+1)
return int(result)
if __name__ == '__main__':
print(main()) |
p02881 | s461323094 | Wrong Answer | import math
n = int(input())
ans_l,ans_r=0,0
root = math.floor(math.sqrt(n))
for i in range(10**5):
if n%root == 0:
ans_l,ans_r = root,n//root
break
else:
root -= 1
print(ans_l-1 + ans_r-1) |
p02753 | s067673979 | Accepted | s=input()
S=list(s)
t=set(S)
if len(t)==1:
print('No')
else:
print('Yes') |
p03338 | s527816502 | Accepted | def main():
import collections
n = int(input())
s = list(input())
cnt_s = []
for i in range(n):
cnt_l = collections.Counter(s[:i])
cnt_r = collections.Counter(s[i:])
cnt = 0
for key in dict(collections.Counter(cnt_l)):
if key in dict(collections.Counter(cnt_r)):
cnt += 1
cnt_s.append(cnt)
print(max(cnt_s))
if __name__ == '__main__':
main() |
p03059 | s625934365 | Wrong Answer | a, b, t = (int(i) for i in input().split())
print(b * ((t+0.5)//a)) |
p03380 | s747540370 | Wrong Answer | n = int(input())
a = [int(s) for s in input().split()]
combn = max(a)
ar = [abs(num-combn/2) for num in a]
combr = int(combn/2 - min(ar))
print(' '.join(map(str,[combn,combr]))) |
p02630 | s200136506 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
b[i], c[i] = map(int, input().split())
for num, rep in zip(b, c):
if num not in a: continue
else:
a = [rep if ele == num else ele for ele in a]
print(sum(a)) |
p03803 | s282310439 | Accepted | ab=[int(i) for i in input().split()]
for i in range(2):
if ab[i]==1:
ab[i]+=13
print("Alice" if ab[0]>ab[1] else "Draw" if ab[0]==ab[1] else "Bob")
|
p02971 | s183246466 | Accepted | def resolve():
N = int(input())
A = [int(input()) for _ in range(N)]
sortedA = sorted(A)
for a in A:
if a == sortedA[-1]:
print(sortedA[-2])
else:
print(sortedA[-1])
if '__main__' == __name__:
resolve() |
p03327 | s766508678 | Accepted | N = int(input())
if N < 1000:
print("ABC")
else:
print("ABD")
|
p03698 | s535137203 | Wrong Answer | S = input()
count = len(S)
a = 0
for i in range(count):
if S[i] in S[i+1:]:
print(S[i+1:])
a = a+1
else:
pass
if a>0:
print("no")
else:
print("yes")
|
p03042 | s322242873 | Accepted | S = list(input())
x = int("".join(S[0:2]))
y = int("".join(S[2:4]))
if 1 <= x <= 12:
if 1 <= y <= 12:
print("AMBIGUOUS")
else:
print("MMYY")
else:
if 1 <= y <= 12:
print("YYMM")
else:
print("NA")
pass
|
p02983 | s800196571 | Wrong Answer | L, R = map(int, input().split())
if R - L > 2019:
print(0)
else:
l = []
for i in range(L, R + 1):
for j in range(i, R + 1):
l.append(i * j % 2019)
print(min(l)) |
p03069 | s761966554 | Accepted | n=int(input())
s=input()
black=s.count("#")
white=s.count(".")
b=0
w=0
ans=float('inf')
for i in range(n):
if s[i]=="#":
b+=1
elif s[i]==".":
w+=1
right_change=white-w
now=b+right_change
# print(now)
ans=min(ans,now)
print(min(ans,black,white))
|
p02911 | s747593762 | Wrong Answer | import sys
input = sys.stdin.readline
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
points = [K - Q] * N
for i in A:
points[i - 1] += 1
for p in points:
if p > 0:
print("Yes")
else:
print("No")
print(points) |
p02983 | s492993903 | Wrong Answer | l,r=map(int,input().split())
if r%2019<=l%2019:print(0)
else:print(l*(l+1)%2019) |
p03071 | s717819348 | Accepted | #ABC124
a,b = map(int,input().split())
print(max(a+b,a+(a-1),b+(b-1))) |
p02646 | s337950520 | Accepted | a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a<=b:
if a+v*t>=b+w*t:
print('YES')
else:
print('NO')
else:
if a-v*t<=b-w*t:
print('YES')
else:
print('NO') |
p03221 | s877272809 | Accepted | import bisect
n,m = map(int,input().split())
Q = []
P = [[] for _ in range(n)]
for i in range(m):
p,y = map(int,input().split())
Q.append([p,y])
P[p-1].append(y)
P_1 = [sorted(l) for l in P]
for p,y in Q:
a = str(p).zfill(6)
b = str(bisect.bisect(P_1[p-1], y)).zfill(6)
print(a+b) |
p03455 | s050965953 | Wrong Answer | # 1<=a,b<=10000
# a,bは整数
#number = input('整数を入力してね > ')
#print (number)
a, b = map(int, input('整数を入力してね > ').split())
#print(a, b)
c = a * b
#print(c)
d=c%2
if d==0:
print('Even')
if d==1:
print('Odd') |
p02761 | s524492259 | Wrong Answer | N, M=map(int, input().split())
S=[list(map(int, input().split())) for i in range(M)]
num=["a"]*N
ans=True
for s in S:
if (num[s[0]-1]!="a") and (num[s[0]-1]!=s[1]):
ans=False
break
else:
num[s[0]-1]=s[1]
if num[0]==0:
ans=False
if ans:
for i in range(N):
if num[i]=="a":
print(1, end="")
else:
print(num[i], end="")
else:
print(-1)
|
p02623 | s434455870 | Wrong Answer | alen,blen,k = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))
max = 0
for acount in range(0,alen):
bcount = 0
asum = sum(alist[:acount])
while asum + sum(blist[:bcount+1]) < k and bcount <= blen:
bcount += 1
if acount + bcount > max and asum + sum(blist[:bcount])<=k:
max = acount + bcount
print(max)
|
p03087 | s565577239 | Wrong Answer | n,q = map(int,input().split())
s = input()
li = [0]*n
for i in range(1,n):
if s[i-1] == "A" and s[i] == "C":
li[i] += 1
from itertools import accumulate
lin = [0]+list(accumulate(li))
print(lin)
for _ in range(q):
l,r = map(int,input().split())
print(lin[r]-lin[l]) |
p03416 | s158787203 | Accepted | x = []
for i in range(10):
for j in range(10):
for k in range(10):
tmp = i*10001 + j*1010 + k*100
x.append(tmp)
x.sort()
a,b = map(int, input().split())
ret = sum((a<= z and z <= b) for z in x)
print(ret)
|
p03696 | s411669021 | Accepted | n = int(input())
s = input()
l, r, c = 0, 0, 0
for a in s:
if a == '(':
c += 1
elif c:
c -= 1
else:
l += 1
r = c
print("("*l + s + ")"*r)
|
p02924 | s199205062 | Accepted | N=int(input())
ans=(1+(N-1))*(N-1)//2
print(ans) |
p03386 | s269278485 | Accepted | a, b, k = map(int, input().split())
s1 = [i for i in range(a, a+k) if i<=b]
s2 = [i for i in range(b-k+1, b+1) if i>=a]
s = list(set(s1+s2))
s.sort()
for i in s:
print(i) |
p03241 | s028836537 | Accepted | from bisect import bisect_right
def divisor(n):
ass = []
for i in range(1,int(n**0.5)+1):
if n%i == 0:
ass.append(i)
if i**2 == n:
continue
ass.append(n//i)
ass.sort()
return ass
N,M = map(int,input().split())
a = M//N
li = divisor(M)
x = bisect_right(li,a)
print(li[x-1])
|
p04011 | s619220741 | Wrong Answer | n = int(input())
k = int(input())
x = int(input())
y = int(input())
fee1 = k * x
fee2 = y * (n - k)
if k > n :
print(fee1)
else:
print(fee1 + fee2) |
p03327 | s158614048 | Accepted | if int(input())>999:
print("ABD")
else:
print("ABC")
|
p03137 | s801279049 | Accepted | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N >= M:
print(0)
else:
X.sort()
D = []
for i in range(M-1):
D.append(X[i+1]-X[i])
D.sort()
print(sum(D[0:M-N])) |
p03017 | s531735703 | Wrong Answer | N,A,B,C,D = map(int,input().split())
S = input()
A_start = True
if C < D:
space1 = S[A:D+1]
if ('##' in space1) != True:
print('Yes')
else:
print('No')
else:
space1 = S[A:C+1]
space2 = S[B-1:D+1]
if ('##' in space1) != True and ('...' in space2) == True:
print('Yes')
else:
print('No') |
p03380 | s123035809 | Accepted | n = int(input())
a = sorted(list(map(int, input().split())))
m = a[-1]
r = sorted(a[:-1], key = lambda x: abs((m-x)-x))[0]
print(m, r) |
p03944 | s224359205 | Accepted | W,H,N = map(int,input().split())
dl = (0,0)
ur = (W,H)
for i in range(N):
x,y,a = map(int,input().split())
if a==1:
dl = (max(dl[0],x),dl[1])
elif a==2:
ur = (min(ur[0],x),ur[1])
elif a==3:
dl = (dl[0],max(dl[1],y))
else:
ur = (ur[0],min(ur[1],y))
print(max((ur[0]-dl[0]),0)*max((ur[1]-dl[1]),0))
|
p02597 | s622580289 | Accepted | n = int(input())
s = input()
count_r = 0
for i in range(n):
if s[i] == "R":
count_r += 1
ans = 0
for i in range(count_r):
if s[i] == "W":
ans += 1
print(ans)
|
p03986 | s735470092 | Accepted | from collections import deque
X = input()
N = len(X)
S = "S"
T = "T"
stack = deque("")
for i,str in enumerate(X):
if str == S:
stack.append(str)
elif str == T:
if len(stack) == 0:
stack.append(str)
elif stack[-1] == T:
stack.append(str)
elif stack[-1] == S:
stack.pop()
print(len(stack)) |
p03456 | s023267519 | Accepted | import math
b,c=map(str,input().split())
d=math.sqrt(int(b+c))
if float.is_integer(d):
print("Yes")
else:
print("No") |
p03380 | s823494839 | Wrong Answer | from bisect import bisect_left
n = int(input())
a_list = sorted([int(x) for x in input().split()])
base = a_list[-1] // 2
i = bisect_left(a_list, base)
if i > 0:
i -= 1
ans = [a_list[-1], a_list[i], abs(a_list[i] - base)]
for i in range(i + 1, n):
temp = abs(a_list[i] - base)
if temp >= ans[2]:
break
ans[1] = a_list[i]
ans[2] = temp
print(ans[0], ans[1]) |
p03951 | s168130907 | Wrong Answer | n = int(input())
s = input()
t = input()
cnt = 0
if s == t:
print(n)
exit()
for i in range(n):
if s[::-(i+1)] == t[i]:
cnt += 1
else:
break
print(n + n-cnt)
|
p03030 | s208786629 | Accepted | N,que=int(input()),[]
for i in range(N):
s,p=list(input().split())
que.append((s,-int(p),i+1))
que.sort()
for x in que:
print(x[-1]) |
p02594 | s623114151 | Accepted | n=int(input())
if n<30:
print('No')
else:
print("Yes") |
p02881 | s788521166 | Wrong Answer | m=int(input())
pf={}
for i in range(2,int(m**0.5)+1):
while m%i==0:
pf[i]=pf.get(i,0)+1
m//=i
if m>1:pf[m]=1
a=1
b=1
pf=sorted(pf.items(), reverse=True)
#print(pf)
for k,v in pf:
for i in range(v):
if a<=b:
a*=k
else:
b*=k
print(a+b-2)
|
p02696 | s807332776 | Accepted | a,b,n=map(int,input().split())
ans=-float("inf")
i=0
while True:
x=b*i-1
i+=1
if x>n:
ans=max(int((a*n)/b)-a*int(n/b), ans)
print(ans)
break
if ans<int((a*x)/b)-a*int(x/b):
ans=int((a*x)/b)-a*int(x/b)
else:
print(ans)
break |
p03317 | s798349986 | Accepted | import math as m
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(m.ceil((n-1)/(k-1))) |
p02831 | s777206847 | Wrong Answer | a,b=map(int,input().split())
import fractions as f
print(a*b/f.gcd(a,b))
|
p03338 | s663221677 | Accepted | n=int(input())
s=list(input())
ans=0
for i in range(1,n+1):
left_set=set(s[:i])
right_set=set(s[i:])
ans=max(ans,(len(left_set & right_set)))
print(ans) |
p03785 | s655071137 | Wrong Answer | import bisect
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
t_limit = []
for i in range(n):
t_limit.append(t[i] + k)
cnt = 0
ans_l = []
for i in t_limit:
ans_l.append(bisect.bisect_left(t, i))
print(len(set(ans_l))) |
p03795 | s722997706 | Wrong Answer | n = int(input())
x = (10**9 + 7)
k=1
for i in range(1,n+1):
k = k * i
if k <x:
print(k)
else:
print(k % x) |
p03251 | s573800418 | Accepted | #!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-OneDimensionalWorldsTale.py
#
n, y, x, y = map(int, input().split())
x_under = [int(i) for i in input().split()]
y_under = [int(i) for i in input().split()]
max_x_under = max(x_under)
min_y_under = min(y_under)
for z in range(x+1, y+1):
if max_x_under < z <= min_y_under:
print("No War")
exit()
print("War")
|
p02771 | s871228172 | Accepted | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
A, B, C = list(map(int, sys.stdin.buffer.readline().split()))
ok = len(set([A, B, C])) == 2
if ok:
print('Yes')
else:
print('No')
|
p03612 | s042256227 | Accepted | n=int(input())
p=list(map(int,input().split()))
count=0
jugh=0
for i in range(n):
if p[i]==i+1:
if jugh!=1:
jugh=1
count+=1
else:
jugh=0
else:
jugh=0
print(count) |
p02748 | s381111664 | Accepted | a,b,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ret = 2**60
for _ in range(m):
x,y,c = map(int,input().split())
x -= 1
y -= 1
ret = min(ret, A[x]+B[y]-c)
print( min(ret, min(A)+min(B)) )
|
p02817 | s147269408 | Wrong Answer | a=input().split()
print(a[0]+a[1]) |
p03386 | s875404088 | Wrong Answer | # coding:utf-8
a, b, k = map(int, input().split())
for i in range(a, min(a + k, b)):
print(i)
for i in range(max(b - k + 1, a + k), b + 1):
print(i)
|
p03387 | s056500130 | Accepted | a, b, c = map(int, input().split())
a, b, c = sorted([a, b, c])
dif_a = c-a
dif_b = c-b
result = dif_b
dif_a -= dif_b
if dif_a%2==0:
result += dif_a//2
else:
result -= (-dif_a)//2 - 1
print(result) |
p02947 | s215936138 | Accepted | N = int(input())
S = [input() for _ in range(N)]
for i in range(N):
S[i] = "".join(sorted(S[i]))
ans = {}
for i in range(N):
if S[i] in ans:
ans[S[i]] += 1
else:
ans[S[i]] = 1
cnt = 0
for a in ans:
cnt += ans[a] * (ans[a] - 1) // 2
print(cnt) |
p03150 | s674561220 | Accepted | s=input()
n="keyence"
res=False
if s[:8]==n or s[-7:]==n:
res=True
else:
for i in range(7):
if s[:i+1]+s[i-6:]==n:
res=True
break
x="YES" if res else "NO"
print(x)
|
p03711 | s913283252 | Accepted | x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
if ((x in a) and (y in a)) or ((x in b) and (y in b)):
print('Yes')
else:
print('No') |
p03474 | s371750676 | Accepted | a, b = map(int, input().split())
s = input()
if s[a] == "-" and s[:a].isdigit() and s[b+1:].isdigit():
print("Yes")
else:
print("No")
|
p03220 | s197375093 | Wrong Answer | n = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 100000
aa = 0
for i in range(n):
if ans >= abs((T-0.006*H[i])-A):
ans = abs((T-0.006*H[i])-A)
aa = i
print(i+1) |
p03698 | s931919612 | Accepted | import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
def main():
S = input()
if len(S) == len(set(S)):
print('yes')
else:
print('no')
if __name__ == '__main__':
main()
|
p02702 | s084663171 | Accepted | p=d=2019
z=[0]*p
for i,j in enumerate(input()[::-1]):
d=d+int(j)*pow(10,i,p)
z[d%p]+=1
r=z[0]
for i in z:
r+=i*(i-1)//2
print(r) |
p02795 | s096621812 | Wrong Answer | H = int(input())
W = int(input())
N = int(input())
upper = H if H >= W else W
print((N // upper) + 1) |
p02879 | s018107128 | Accepted | a, b = map(int, input().split())
if (a >= 1) and (a <= 9) and (b >= 1) and (b <= 9):
print(a * b)
else:
print(-1)
|
p02911 | s613927132 | Wrong Answer | n, k, q = map(int, input().split())
a = [int(input())for i in range(q)]
res = 0
for i in range(1, q+1):
if k - q + a.count(i) > 0:
res += 1
print(res) |
p02713 | s880259325 | Wrong Answer | import math
import itertools
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
K = int(input())
GCD = 0
iterator = itertools.combinations_with_replacement(list(range(1, K+1)), 3)
for (a, b, c) in iterator:
GCD += gcd(a, b, c)
print(GCD)
|
p02684 | s508742786 | Accepted | import sys
N,K = map(int,input().split())
tele = list(map(int,input().split()))
k = 1
flag = [0]*N
goal = tele[0]
miti = [1]
while (flag[goal-1])!=1:
k += 1
miti.append(goal)
flag[goal-1] = 1
goal = tele[goal-1]
if k == K:
print(goal)
sys.exit()
a = miti.index(goal)
loop = k-a
ans = miti[(K-a)%loop+a]
print(ans) |
p02678 | s585608724 | Accepted | from collections import deque
n,m = map(int, input().split())
r = [[] for _ in range(n+1)]
ans = [0]*(n+1)
for i in range(m):
a,b = map(int, input().split())
r[a].append(b)
r[b].append(a)
q = deque([1])
while q:
fr = q.popleft()
for i in r[fr]:
if ans[i] != 0:
continue
ans[i] = fr
q.append(i)
print("Yes")
for i in ans[2:]:
print(i) |
p03160 | s568468057 | Accepted | n = int(input())
l = [int(x) for x in input().split()]
dp = [float('inf')] * n
dp[0] = 0
for i in range(n):
for j in (i+1, i+2):
if j < n:
dp[j] = min(dp[j], dp[i]+abs(l[i]-l[j]))
print(dp[n-1]) |
p03261 | s278500659 | Accepted | import sys
input=sys.stdin.readline
n = int(input())
lis = []
lis.append(input()[:-1])
ans = 0
for i in range(n-1):
word = input()[:-1]
if word in lis:
ans += 1
if word[0] != lis[-1][-1]:
ans += 2
lis.append(word)
if ans == 0:
print("Yes")
else:
print("No") |
p03419 | s707627717 | Accepted | n, m = map(int, input().split())
if n > 2 and m > 2:
ans = (n-2)*(m-2)
elif n == 2 or m == 2:
ans = 0
elif n == 1 and m == 1:
ans = 1
elif n == 1:
ans = m - 2
elif m == 1:
ans = n - 2
print(ans) |
p03043 | s921482617 | Accepted | N, K = [int(i) for i in input().split()]
total = 0
win = 0
p = 0.0
for n in range(1, N+1):
t = n
c = 0
while t < K:
c += 1
t *= 2
p += 0.5**c * 1/N
print(p) |
p03324 | s965985278 | Accepted | A,N=map(int, input().split())
if N<100:
print(N*100**A)
else:
print(101*100**A) |
p03324 | s366764358 | Wrong Answer | d, n = map(int, input().split())
print(n*100**d) |
p03309 | s245025331 | Wrong Answer |
n = int(input())
a = list(map(int, input().split()))
mean = 0
for i in range(n):
mean += a[i] - (i + 1)
b = mean // n
ans = 0
for i in range(n):
ans += abs(a[i] - (b + i + 1))
print(ans) |
p04020 | s484249156 | Wrong Answer | n = int(input())
c = 0
b = 0
for _ in range(n):
a = int(input())
if a == 0:
b = 0
continue
c += a // 2
b = a % 2
print(c) |
p02717 | s624902822 | Accepted | a,b,c = map(int,input().split())
print(c,a,b)
|
p02866 | s812691660 | Accepted | import sys
from collections import Counter
N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
C = Counter(D)
mod = 998244353
if D[0] != 0 or C[0] != 1:
print(0)
exit()
res = 1
for i in range(1, max(D) + 1):
if i not in C:
print(0)
exit()
res *= (C[i - 1] ** C[i]) % mod
print(res % mod)
|
p03017 | s111783709 | Accepted | n,a,b,c,d=map(int,input().split())
s=input()
if "##" in s[a-1:max(c,d)]:print("No")
elif c>d and "..." not in s[b-2:d+1]:print("No")
else:print("Yes") |
p02917 | s750641105 | Wrong Answer | n = int(input())
b = list(map(int, input().split()))
ans = b[-1]
p = b[-1]
for i in range(n - 2)[::-1]:
p = min(p, b[i])
ans += p
print(ans + p)
|
p02676 | s401402223 | Accepted | K=int(input())
S=str(input())
if K>=len(S):
print(S)
else:
print(S[0:K]+"...") |
p03645 | s330811311 | Accepted | n,m = map(int,input().split())
s = set()
t = set()
for i in range(m):
a,b = map(int,input().split())
if a == 1 and b != n:
s.add(b)
if a != 1 and b == n:
t.add(a)
if len(s&t) > 0:
print('POSSIBLE')
else:
print('IMPOSSIBLE') |
p02608 | s597097872 | Accepted | from itertools import combinations, combinations_with_replacement
from math import sqrt
n = int(input())
ans = [0] * (n + 1)
for x, y, z in combinations_with_replacement(range(1, int(sqrt(n))), 3):
i = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
if i <= n:
if x == y == z:
ans[i] += 1
elif all([(s != t) for s, t in combinations([x, y, z], 2)]):
ans[i] += 6
else:
ans[i] += 3
for i in range(1, n + 1):
print(ans[i])
|
p03385 | s273999659 | Accepted | print("YNeos"[set(input())!=set("abc")::2]) |
p03352 | s690456452 | Wrong Answer | X = int(input())
ans = 0
for i in range(1,X+1):
for j in range(2,X+1):
if i**j <= X:
ans = max(ans,i**j)
else:
break
print(ans)
|
p03680 | s738019082 | Wrong Answer | #1
import sys
n = int(input())
a = []
for i in range(n):
j = int(input())
a.append(j)
point = a[0]
cnt = 1
for i in range(n):
point = a[point-1]
cnt +=1
if point == 2:
print(cnt)
sys.exit()
print("-1") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.