problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02836 | s812624994 | Accepted | s = input()
cnt = 0
for i in range(len(s)//2):
if s[i] != s[len(s)-1-i]:
cnt += 1
print(cnt) |
p02933 | s798547083 | Accepted | # 138a https://atcoder.jp/contests/abc138/tasks/abc138_a
# 入力
a = int(input())
s = input()
# 処理
if a < 2800 or a >= 5000:
answer = '制約値外です'
elif a >= 3200:
answer = s
elif a < 3200:
answer ='red'
# 出力
print(answer) |
p03657 | s566220809 | Accepted | a,b = map(int, input().split())
if a % 3 == 0 or b %3 == 0 or (a+b)%3 == 0:
print("Possible")
else:
print("Impossible") |
p03264 | s582204355 | Accepted | n=int(input());print(-(-n//2)*(n//2)) |
p02607 | s288449143 | Accepted | N = int(input())
A = [int(_) for _ in input().split()]
ans = 0
for i, a in enumerate(A):
if i % 2 == 0 and a % 2 == 1:
ans += 1
print(ans)
|
p03862 | s957037075 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
p = 0
for ai in a:
if p + ai > x:
d = p + ai - x
ans += d
p = ai - d
print(ans) |
p03971 | s803322807 | Accepted | N,A,B=map(int,input().split())
S=input()
pass_a=1
pass_b=1
for x in S:
if x=="a":
if pass_a<=A+B:
print("Yes")
pass_a+=1
else:
print("No")
elif x=="b":
if pass_a<=A+B and pass_b<=B:
print("Yes")
pass_a+=1
pass_b+=1
else:
print("No")
else:
print("No")
|
p02910 | s561515926 | Accepted | s = input()
ans = "Yes"
for i in range(len(s)):
if i % 2 == 0:
if s[i] == "L":
ans = "No"
else:
if s[i] == "R":
ans = "No"
print(ans) |
p03252 | s375616547 | Accepted | #!/usr/bin/env python
# coding: utf-8
# In[16]:
S = input()
T = input()
# In[20]:
mydict = {}
for i in range(len(S)):
if S[i] in mydict:
if T[i] != mydict[S[i]]:
ans = "No"
break
else:
mydict[S[i]] = T[i]
else:
a = list(mydict.values())
b = list(set(a))
... |
p03037 | s060204003 | Accepted | # n, m, l = map(int, input().split())
# list_n = list(map(int, input().split()))
# n = input()
# list = [input() for i in range(N)
# list = [[i for i in range(N)] for _ in range(M)]
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
list_LR = [list(map(int, input().split())) for i in range(M)]
... |
p02663 | s243081318 | Wrong Answer | h1,m1,h2,m2,k = map(int,input().split())
time = (h2 - h1) * 60 - (m2 - m1)
print(time - k) |
p02873 | s533589896 | Accepted | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
s=input()
n=len(s)
A=[0]*(n+1)
for i in range(n):
if s[i]=="<":
A[i+1]=A[i]+1
for i in range(n):
if s[n-i-1]==">":
A[n-i-1]=max(A[n-i-1],A[n-i]+1)
print(sum(A))
if __name__=='__main_... |
p03254 | s966693365 | Wrong Answer | import sys
n,x=map(int,input().split())
N=list(map(int,input().split()))
K=sorted(N,reverse=True)
if sum(K)<=x:
print(n)
sys.exit()
for i in range(1,n+1):
if sum(K)-K[0]<=x:
print(n-i)
sys.exit()
else:
K.pop(0) |
p02621 | s315638634 | Wrong Answer | a = 2
variable = input(a + a*a + a*a*a)
print(variable)
|
p03434 | s620048629 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print(sum(a[n-1::-2]) - sum(a[n-2::-2])) |
p02796 | s695377337 | Wrong Answer | N = int(input())
robot = [input().split() for i in range(N)]
le = [[int(i[0])-int(i[1]), int(i[0])+int(i[1])] for i in robot]
le.sort(key = lambda x:x[1])
ans = 0
floor = -10**5
for i in range(N):
if floor <= le[i][0]:
ans += 1
floor = le[i][1]
print(ans) |
p03623 | s744189199 | Accepted | x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
print('B')
else:
print('A') |
p02708 | s805902753 | Accepted | mod = 1000000007
def sum_(a, b):
return int((a+b)*(b-a+1)/2)
def main():
args = input().rstrip().split(' ')
N, K = int(args[0]), int(args[1])
Ans = 0
for i in range(K, N+2):
sum_b = sum_(0, i-1)
sum_u = sum_(N-i+1, N)
Ans += (sum_u-sum_b)+1
Ans = Ans % mod
... |
p02814 | s957813667 | Accepted | import sys
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
def lcm(a, b):
return (a // gcd(a,b)) * b
tx = 1
for a in A:
tx = lcm(tx, a)
B = []
for a in A:
B.append(tx // a)
for b in B:
if b % 2 == ... |
p02996 | s056415377 | Accepted | n =int(input())
ab = []
for i in range(n):
a,b = map(int,input().split())
ab.append([b,a])
ab.sort()
time = 0
ok = True
for i in range(n):
a = ab[i][1]
b = ab[i][0]
if time + a > b:
ok = False
break
time +=a
if ok :print('Yes')
else:print('No')
|
p02718 | s911502152 | Accepted | N,M=map(int,input().split())
A=list(map(int,input().split()))
k=0
l=0
for i in range(N):
k+=A[i]
for i in range(N):
if ((A[i]/k)>=(1/(4*M))):
l+=1
if l>=M:
print('Yes')
else:
print('No') |
p02953 | s200171460 | Accepted | def main():
_, *h=map(int, open(0).read().split())
x=h[-1]
for y in h[-2::-1]:
if x<y-1:
return 'No'
x=y-(x<y)
return 'Yes'
if __name__ == '__main__':
print(main()) |
p03817 | s544799666 | Accepted | x = int(input())
a = (x // 11) * 2
b = 2 if x % 11 > 6 else 0 if x % 11 == 0 else 1
print(a + b)
|
p02608 | s323180365 | Wrong Answer | import time
import itertools
N = int(input())
def function(x,y,z):
return pow(x,2) + pow(y,2) + pow(z,2) + (x * y) + (x * z ) + (y * z)
p = list(itertools.product(range(1,25),repeat=3))
a = []
for p_in in p:
a.append(function(p_in[0],p_in[1],p_in[2]))
for n in range(1,N + 1):
print(a.count(n))
|
p02820 | s268431401 | Accepted | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
su = 0
kinshi = ''
dashita = [''] * N
for i in range(len(T)):
s = T[i]
if i - K >= 0:
if s == dashita[i - K]:
continue
if s == 'r':
su += P
elif s == 's':
su += R
elif s == 'p':
su += S
dashita[i] = s
... |
p02689 | s757274703 | Wrong Answer | N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]
B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
if H[i[0]-1]>H[i[1]-1]:
B[i[0]-1]=1
elif H[i[0]-1]<H[i[1]-1]:
B[i[1]-1]=1
prin... |
p03163 | s305189309 | Accepted | N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
weight[i], value[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * (W + 1) for _ in range(N + 1)]
#%%
for i in range(1, N + 1):
for j in range(1, W + 1):
if weight[i] <= j:
d... |
p02696 | s084968615 | Wrong Answer | a,b,n = (int(x) for x in input().split())
print(n-(a-b)+1) |
p02727 | s863146919 | Accepted | X, Y, A, B, C = map(int, input().split())
p = sorted(sorted([int(x) for x in input().split()])[-X:] + sorted([int(x) for x in input().split()])[-Y:] + [int(x) for x in input().split()])
print(sum(p[-X-Y:])) |
p03136 | s383868687 | Accepted | n = int(input())
L = list(map(int,input().split()))
maxL = max(L)
sum = 0
flag = True
for l in L:
if l == maxL and flag:
flag = False
else:
sum += l
if maxL < sum:
print("Yes")
else:
print("No") |
p03239 | s211066509 | Wrong Answer | N, T = map(int, input().split())
List = []
List2 = []
min = float('inf')
for i in range(N):
M, B = map(int, input().split())
List.append([M,B])
M, B = 0, 0
for k in range(N):
if int(List[k][1]) <= T:
List2.append(List[k])
for n in range(len(List2)):
if List2[n][0] <= min:
min = Li... |
p03565 | s964529226 | Accepted | S = input()
T = input()
for i in range(len(S) - len(T),-1,-1):
for j in range(len(T)):
if S[j + i] != "?" and S[j + i] != T[j]:
break
else:
S = S.replace("?","a")
print(S[:i] + T + S[i + len(T):])
break
else:
print("UNRESTORABLE") |
p03544 | s630130840 | Wrong Answer | n=int(input())
l1=2
l2=1
for i in range(n-2):
if i%2==0:
l1=l1+l2
else:
l2=l1+l2
print(l1+l2) |
p04034 | s013736915 | Wrong Answer | n,m=map(int,input().split())
r=[0]*n
w=[1]*n
r[0]=1
w[0]=0
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if r[x] and w[x]==0:
r[x]=0
r[y]=1
elif r[x]:
w[x]-=1
r[y]=1
else:
w[x]-=1
w[y]+=1
print(sum(r))
|
p02768 | s009209854 | Accepted | n,a,b = map(int,input().split())
inf = 10**9 +7
ans = pow(2,n,inf)-1
def conbi(n,k):
if n-k < k:
k = n-k
x = 1
y = 1
for i in range(k):
x *= n-i
x = x%inf
y *= i+1
y = y%inf
ans = x* pow(y,inf-2,inf)%inf
return ans
ans -= conbi(n,a) + conbi(n,b)
ans = ans%inf
print(ans) |
p02755 | s966619062 | Wrong Answer | def main():
a, b = map(int, input().split())
tmp_8 = int(a / 0.08)
tmp_10 = int(b / 0.1)
check_10 = int(tmp_8*0.1)
check_8 = int(tmp_10*0.1)
if check_8 != check_10:
print(-1)
else:
print(tmp_8)
if __name__ == '__main__':
main()
|
p02646 | s677129185 | Wrong Answer | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if A - B == 0:
print('YES')
elif V <= W:
print('NO')
elif V == 0:
print('NO')
else:
print('YES' if abs(A-B)//abs(V-W) <= T else 'NO')
|
p03250 | s259937856 | Accepted | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
a,b,c = sorted(map(int,readline().split()))
print (10 * c + b + a)
|
p02909 | s012413347 | Accepted | import sys
input = sys.stdin.readline
weather = {"Sunny":"Cloudy", "Cloudy":"Rainy", "Rainy":"Sunny"}
print(weather[input().rstrip()])
|
p02761 | s330168207 | Accepted | N, M = map(int, input().split())
sc = []
for _ in range(M):
s, c = map(int, input().split())
sc.append((s - 1, str(c)))
ans = -1
for i in map(str, range(10 ** (N - 1) if N > 1 else 0, 10 ** N)):
for s, c in sc:
if i[s] != c:
break
else:
ans = i
break
print(ans) |
p02888 | s188649584 | Accepted | import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
for j in range(i+1,n):
index=bisect.bisect_left(l,l[i]+l[j])
ans+=index-j-1
print(ans) |
p02624 | s391557895 | Accepted | n = int(input())
sum_div = sum(range(1, n+1))
for i in range(2, n+1):
sum_div += sum(range(i, n+1, i))
print(sum_div) |
p02882 | s405583307 | Accepted | a,b,x = map(int,input().split())
import math
d = x/(a**2)
c = b-d
e = c*2
if e<=b:
f = (e**2+a**2)**(1/2)
g = (f**2+a**2-e**2)/(2*f*a)
print(math.degrees(math.acos(g)))
else:
e = 2*x/(a*b)
#print(e)
a = b
f = (e**2+a**2)**(1/2)
g = (f**2+a**2-e**2)/(2*f*a)
print(90-(math.degrees(m... |
p02642 | s913753992 | Accepted | from collections import Counter
N = int(input())
A = sorted(map(int, input().split()))
sifter = {i: True for i in range(1, A[N - 1] + 1)}
counter = Counter(A)
ans = 0
for A_i in A:
if sifter[A_i]:
if counter[A_i] == 1:
ans += 1
for i in range(A_i, A[N - 1] + 1, A_i):
sifter[i] = False
pr... |
p03077 | s288669696 | Accepted | import math
n=int(input())
l=[int(input()) for i in range(5)]
ans=math.ceil(n/min(l))+4
print(ans) |
p02743 | s149525597 | Accepted | a,b,c = map(int,input().split())
if c-a-b > 0 and 4 * a * b < (c-a-b) ** 2:
print("Yes")
else:
print("No") |
p03001 | s439978697 | Accepted | w,h,x,y = map(int,input().split())
area = w*h/2
if x == w/2 and y == h/2:
print(area, 1)
else:
print(area,0)
|
p02813 | s524179342 | Accepted | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
import itertools
N = int(readline())
P = tuple(map(int, readline().split()))
Q = tuple(map(int, readline().split()))
per = itertools.permutations(rang... |
p02783 | s701572117 | Accepted | import math
h,a = (int(x) for x in input().split())
print(math.ceil(h/a))
|
p02717 | s022587803 | Wrong Answer | x,y,z = map(int, input().split())
print(y,z,x) |
p03645 | s912765445 | Wrong Answer | from collections import deque
n,m=map(int,input().split())
tree=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
dist=[-1 for i in range(n)]
dist[0]=0
dq=deque()
dq.append(0)
while dq:
x=dq.popleft()
if x==n-1:
if dist[x]==2:
... |
p03137 | s187218843 | Accepted | import numpy as np
n,m = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
x = np.array(x)
diff = sorted(x[1:]-x[:-1])[::-1]
print(sum(diff[n-1:]))
|
p02957 | s809074662 | Wrong Answer | a, b = map(int, input().split())
if a % 2 != b % 2:
print('IMPOSSIBLE')
else:
print((a + b) / 2) |
p03059 | s287104642 | Wrong Answer | A, B, T = map(int, input().split())
tc = 0
n = 0
cnt = 0
if A > T:
pass
else:
while tc <= T:
n += B
cnt += 1
tc += cnt*A
print(n)
|
p02922 | s663289861 | Accepted | A, B = map(int, input().split())
ans = 0
now = 1
while True :
if now >= B :
break
now = now + A - 1
ans += 1
print(ans)
|
p02881 | s195284822 | Wrong Answer | from math import sqrt
n=int(input())
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
l=make_divisors(n)
if len(l)%2==0:
print((l... |
p03944 | s704613885 | Accepted | W,H,N = map(int, input().split())
minX = 0
maxX = W
minY = 0
maxY = H
for i in range(N):
x,y,a = map(int, input().split())
if a==1:
minX = max(minX,x)
elif a==2:
maxX = min(maxX,x)
elif a==3:
minY = max(minY,y)
elif a==4:
maxY = min(maxY,y)
#print(minX,maxX,minY,maxY)
if minX >= maxX or... |
p02754 | s283800190 | Accepted | N, A, B = map(lambda x: int(x), input().split(" "))
if A == 0:
print(0)
else:
count = N // (A+B)
result = count*A
if (N-(count*(A+B))) >= A:
result += A
else:
result += (N-(count*(A+B)))
print(result)
|
p02622 | s461515526 | Accepted | S = input()
T = input()
sum = 0
for i in range(len(S)):
if S[i-1] != T[i-1]:
sum = sum + 1
print(sum) |
p03862 | s254508361 | Wrong Answer | n, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(1, n):
if A[i-1]+A[i] <= x:
continue
eat = A[i-1]+A[i] - x
ans += eat
A[i] = A[i]-eat
print(ans) |
p03838 | s712497551 | Accepted | #coding:utf-8
x, y = map(int, input().split())
def func(a):
if a<0:
return 1e+10
else:
return a
ls = [func(y-x),func(y+x)+1,func(-y-x)+1,func(-y+x)+2]
print (min(ls)) |
p02766 | s907145967 | Accepted | N,K = map(int,input().split())
conv =""
def ten_to_K(N,K,conv):
if N // K == 0:
conv += str(N % K)
return conv
else:
N = N // K
conv += str(N % K)
return ten_to_K(N,K,conv)
ans = ten_to_K(N,K,conv)
print(len(ans))
|
p03785 | s265237406 | Wrong Answer | N, C, K = map(int, input().split())
T = [0]*N
cnt = 0
bus = 0
for i in range(N):
T[i] = int(input())
T.sort()
tmp = T[0]+K
for i in range(N):
if(T[i] <= tmp):
cnt += 1
if(cnt == C):
bus += 1
tmp = T[min(i+1, N-1)]+K
cnt = 0
else:
bus += 2
... |
p03836 | s612796903 | Wrong Answer | sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
for k in range(y):
print("U")
for k in range(x+1):
print("R")
for k in range(y+1):
print("D")
for k in range(x+1):
print("L")
print("U")
print("L")
for k in range(y+1):
print("U")
for k in range(x+1):
print("R")
for k in range(y+1):
print(... |
p02766 | s250891117 | Wrong Answer | n,k = map(int, input().split())
digits = 0
while n:
digits += 1
n//=10
print(digits) |
p03435 | s344564169 | Wrong Answer | # WIP
C11, C12, C13 = map(int, input().split())
C21, C22, C23 = map(int, input().split())
C31, C32, C33 = map(int, input().split())
# Strategy:
# 3(a1+a2+a3+b1+b2+b3) = Σ_i Σ_j C_i_j
# sum of all C_i,j must be a mltiple of 3
sum_C = C11 + C12 + C13 + C21 + C22 + C23 + C31 + C32 + C33
if sum_C % 3 == 0:
print('Ye... |
p02988 | s445921118 | Accepted | n = int(input())
p = [int(x) for x in input().split()]
x=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]:
x+=1
print(x)
|
p02708 | s758884920 | Accepted | N,K = map(int,input().split())
MOD = 10**9+7
res = 0
curmin,curmax = 0, N
mini,maxi = 1, N-1
for i in range(1,N+2):
if i == N+1:
# print(1)
res += 1
else:
if i >= K:
# print(curmin,curmax)
res = (res + curmax - curmin + 1) % MOD
curmin += mini
curmax += maxi
mini += 1
maxi -=... |
p03077 | s876105362 | Wrong Answer | temp_list = [int(input()) for _ in range(6)]
n = temp_list.pop(0)
print(5 + n // min(temp_list)) |
p03324 | s639920443 | Accepted | #n = int(input())
d,n = list(map(int,input().split()))
if n < 100:
print(n*(100**d))
else:
print((n+1)*(100**d)) |
p02793 | s878818881 | Accepted | from fractions import gcd
import sys
input = sys.stdin.readline
def lcm(a,b):
return a*b // gcd(a,b)
def main():
N = int(input())
A = list(map(int,input().split()))
M = 10**9+7
l = 1
for a in A:
l = lcm(l,a)
ans = 0
for a in A:
ans += l//a
print(ans%M)
if __name__ ==... |
p03309 | s892400620 | Accepted | N = int(input())
As = list(map(int, input().split()))
Bs = []
for i in range(N):
Bs.append(As[i]-i-1)
Bs.sort()
b = Bs[N//2]
ans = 0
for i in range(N):
ans += abs(Bs[i]-b)
print(ans)
|
p03282 | s538842091 | Accepted | s = input()
k = int(input())
one_counter = 0
for i in range(len(s)):
if s[i] != "1":
break
else:
one_counter += 1
if s[0] == "1":
if k <= one_counter:
res = s[0]
else:
res = s[one_counter]
else:
res = s[0]
print(res) |
p02578 | s567619457 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 0
maxA = A[0]
for i in range(1,N):
if A[i] > maxA:
maxA = A[i]
else:
ans = ans + maxA - A[i]
print(ans) |
p03986 | s417829211 | Accepted | X = input()
s_cnt = 0
ans = len(X)
for i in range(len(X)):
if(X[i] == "S"):
s_cnt += 1
else:
if(s_cnt > 0):
ans -= 2
s_cnt -= 1
print(ans) |
p03474 | s302842865 | Accepted | A, B = map(int, input().split())
S = input()
s = S.split("-")
ans = "Yes" if (A == len(s[0]) and B == len(s[1])) else "No"
print(ans)
|
p03607 | s699022723 | Accepted | # abc073_c.py
N = int(input())
A = [int(input()) for i in range(N)]
ans = set()
for i in A:
if i in ans:
ans.discard(i)
else:
ans.add(i)
print(len(ans)) |
p02701 | s596169052 | Accepted | def main():
n = int(input())
s = set([input() for _ in range(n)])
print(len(s))
if __name__=="__main__":
main() |
p02996 | s553014199 | Wrong Answer | n = int(input())
a = list(list(map(int, input().split())) for _ in range(n))
a.sort(key=lambda x: x[1])
ans = 0
for i in range(0, n - 1):
ans += a[i][0]
if ans > a[i][1]:
print("No")
exit()
print("Yes") |
p02817 | s348186179 | Accepted | S, T = input().split();print(T + S) |
p02742 | s852872063 | Accepted | H,W = [int(n) for n in input().split()]
if H < 2:
W = 1
if W < 2:
H = 1
print((H*W//2) if H*W%2==0 else ((H*W+1)//2)) |
p03408 | s189470657 | Accepted | N = int(input())
S = {}
for i in range(N):
s = input()
if s not in S:
S[s] = 1
continue
S[s] +=1
M = int(input())
T = {}
for i in range(M):
t = input()
if t not in T:
T[t] = 1
continue
T[t] += 1
ans = 0
for key in S.keys():
if key not in T:
ans ... |
p02641 | s360624856 | Accepted | x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
res = 10**9
for i in range(x-100, x+101):
if i in p:
continue
diff = abs(x-i)
if diff < res:
ans = i
res = diff
print(ans) |
p03219 | s547827497 | Accepted | x,y=map(int,input().split())
print(x+(y//2)) |
p02994 | s857275116 | Accepted | n, l = map(int, input().split())
taste = [l+i for i in range(n)]
tmp = float('inf')
sum = sum(taste)
for i in range(n):
if abs(taste[i]) < tmp:
tmp = abs(taste[i])
ans = sum - taste[i]
print(ans)
|
p03285 | s495713723 | Wrong Answer | n = int(input())
lst_4 = [x for x in range(4, 101, 4)]
lst_7 = [x for x in range(7, 101, 7)]
lst = []
for i in lst_4:
for j in lst_7:
lst.append(i + j)
ans = [x for x in lst if x <= 100]
print('Yes' if n in ans else 'No') |
p02744 | s917069100 | Accepted | def num_to_str(n):
return chr(97 + n)
def str_to_num(s):
return ord(s) - 97
def dfs(s,m,n,N,ans):
if n == N:
ans.append(s)
return
for i in range(m+2):
dfs(s+num_to_str(i),max(m,i),n+1,N,ans)
def main():
N = int(input())
ans = []
dfs('a',0,1,N,ans)
ans.sort()
... |
p03494 | s067017069 | Accepted | N = int(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
count += 1
print(count) |
p03359 | s573556783 | Accepted | A,B=map(int,input().split())
print(A if A<=B else A-1)
|
p02819 | s166436572 | Accepted | n = int(input())
m = n
if n in [2,3]:
print(n)
exit()
while True:
for i in range(2,int(m**0.5)+1):
if m %i == 0:
break
elif i > int(m**0.5)-1:
print(m)
exit()
m += 1 |
p03011 | s293337445 | Accepted | P,Q,R = map(int,input().split())
print(min(P+Q,min(Q+R,R+P))) |
p03219 | s312854190 | Accepted | # input
X, Y = map(int, input().split())
print(X + (Y // 2))
|
p03696 | s456884845 | Accepted | input();s=t=input()
while'()'in t:t=t.replace('()','')
c=t.count;print('('*c(')')+s+')'*c('(')) |
p03495 | s157611560 | Accepted | N, K = map(int, input().split())
*A, = map(int, input().split())
d = [0]*(N+1)
for a in A:
d[a] += 1
d.sort()
d.reverse()
print(sum(d[K:]))
|
p03944 | s436371707 | Accepted | w,h,n =map(int,input().split())
s =[list(map(int,input().split())) for _ in range(n)]
x =0;y =0;
for i in range(n):
if s[i][2] ==1:
if x < s[i][0]: x = s[i][0]
elif s[i][2] ==2:
if w > s[i][0]: w = s[i][0]
elif s[i][2] ==3:
if y < s[i][1]: y = s[i][1]
else:
if h > s[i][1]: h = s[i][1]
print((w-... |
p02866 | s993983959 | Wrong Answer | mod = 998244353
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
cnt = Counter(d)
if 0 not in cnt or cnt[0] != 1:
print(0)
exit()
cnt = sorted(cnt.items(), key=lambda x: x[0])
ans = 1
pre_k = 0
for i in range(1, len(cnt)):
if cnt[i][0] - pre_k != 1:
print(0)
... |
p02748 | s177764291 | Accepted | A, B, M= [int(i) for i in input().split(' ')]
AA = [int(i) for i in input().split(' ')]
BB = [int(i) for i in input().split(' ')]
XYC = []
for _ in range(M):
XYC.append([int(i) for i in input().split(' ')])
min_a , min_b = min(AA),min(BB)
min_ab = min_a + min_b
for x,y,c in XYC:
cost = AA[x-1] + BB[y-1] - c
... |
p03331 | s553551613 | Accepted | N=int(input())
print(min(sum(map(int,str(i)))+sum(map(int,str(N-i))) for i in range(1, N//2+1))) |
p03408 | s718194043 | Accepted | def solve():
from itertools import groupby as gb
n=int(input())
l=[(s,len(list(i))) for s,i in gb(sorted([input() for i in range(n)]))]
sl,vl=[list(a) for a in zip(*l)]
m=int(input())
lm=[(s,-len(list(i))) for s,i in gb(sorted([input() for i in range(m)]))]
slm,vlm=[list(a) for a in zip(*lm)]
for i in ... |
p03861 | s203116211 | Accepted | a,b,x=map(int,input().split())
bb=b//x
aa=a//x
ans=bb-aa
if a%x==0:
ans+=1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.