problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03986 | s187224745 | Wrong Answer | import sys
X = list(sys.stdin.readline().strip())
N = len(X)
def solve2():
trailing = 0
i = N-1
while i >= 0 and X[i] == 'S':
trailing += 1
i -= 1
return trailing * 2
print(solve2()) |
p02675 | s017843804 | Accepted | N = int(input())
Nmod = N % 10
if Nmod == 3:
print('bon')
elif Nmod <= 1 or Nmod == 6 or Nmod == 8:
print('pon')
else:
print('hon') |
p02791 | s571543198 | Wrong Answer | N = int(input())
P = list(map(int,input().split()))
mi = 10*7
b = [0]*N
for i in range(N):
if mi > P[i]:
b[i] += 1
mi=P[i]
print(sum(b))
|
p02707 | s625692243 | Accepted | n = int(input())
a =list(map(int, input().split()))
l =[0] * (n+1)
for i in range(0,n-1):
l[a[i]] +=1
for i in range(1,n+1):
print(l[i])
|
p03377 | s007144112 | Accepted | a,b,x = map(int,input().split())
if a <= x and (a + b) >= x:
print("YES")
else:
print("NO") |
p03162 | s792483068 | Wrong Answer | N = int(input())
a = []*N
for _ in range(N):
a.append(list(map(int,input().split())))
dp = [[0,0]]*(N+1)
m = max(a[0])
j = a[0].index(m)
dp[0][0] = m
dp[0][1] = j
for i in range(1,N):
prev = dp[i-1][1]
m = 0
for j in range(3):
if j!=prev:
m = max(a[i][j],m)
j = a[i].index(m)
dp[i][0] = dp[i-1][0] + m
dp[i][1] = j
print(dp[N-1][0]) |
p03038 | s356133951 | Accepted | N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=[list(map(int,input().split())) for _ in range(M)]
B.sort(key=lambda x:-x[1])
i,j=0,0
while i<=N-1:
for l in range(B[j][0]):
if A[i]>=B[j][1]:
print(sum(A))
exit()
A[i]=B[j][1]
i+=1
if i==N:
print(sum(A))
exit()
j+=1
if j==M:
print(sum(A))
exit()
print(sum(A)) |
p03281 | s157844094 | Accepted | import math
def yakusuu(a):
x=[]
b=math.ceil(math.sqrt(a))
for i in range(1,b+1):
if a%i==0:
x.append((i,int(a/i)))
return(x)
N=int(input())
oddlist=[i for i in range(1,N+1,2)]
ans=[]
for i in oddlist:
x=yakusuu(i)
if len(x)==4:
ans.append(i)
print(len(ans)) |
p03261 | s725974666 | Accepted | n = int(input())
w = [input()]
for i in range(n-1):
tmp = input()
if w[i][-1] == tmp[0]:
flg = tmp in w
if flg == False:
w.append(tmp)
else:
print('No')
exit()
else:
print('No')
exit()
print('Yes') |
p02747 | s839939512 | Accepted | import math
s = input()
n = math.ceil(len(s)/2)
hitachi = ""
for i in range(n):
hitachi += "hi"
if hitachi in s:
print("Yes")
else:
print("No") |
p03221 | s066771543 | Wrong Answer | N, M = map(int, input().split())
PY = []
for _ in range(M):
PY.append(tuple(map(int, input().split())))
PY.sort(key=lambda x:x[1])
#print(PY)
prefecture=[[] for _ in range(N)]
for el in PY:
p, y = el
prefecture[p-1].append(y)
#print(prefecture)
for j, p in enumerate(prefecture):
for i, city in enumerate(p):
print(str(j+1).zfill(6) + str(i+1).zfill(6)) |
p02713 | s988790927 | Accepted | import math
K = int(input())
CACHE = {}
def gcd_with_memo(i, j):
if j > i:
i, j = j, i
key = str(i) + ":" + str(j)
if CACHE.get(key):
return CACHE[key]
else:
CACHE[key] = math.gcd(i, j)
return CACHE[key]
total = 0
r = range(1, K + 1)
for i in r:
for j in r:
for k in r:
total += gcd_with_memo(gcd_with_memo(i, j), k)
print(total) |
p02603 | s653780327 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A.append(0)
money = 1000
kabu = 0
for i in range(N):
if A[i] <= A[i+1]:
kabu = money//A[i]
money -= kabu*A[i]
else:
money += kabu*A[i]
kabu = 0
print(money) |
p02547 | s126399967 | Accepted | # import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")
def getlist():
return list(map(int, input().split()))
def inverse(N, mod):
return (pow(N, mod - 2, mod))
def main():
N = int(input())
L = []
for i in range(N):
D1, D2 = getlist()
if D1 == D2:
L.append(1)
else:
L.append(0)
for i in range(N - 2):
if L[i] + L[i + 1] + L[i + 2] == 3:
print("Yes")
return
print("No")
if __name__ == '__main__':
main() |
p02860 | s226733296 | Wrong Answer | print('Yes') |
p02862 | s302361982 | Wrong Answer | X, Y = map(int,input().split())
if (2*X-Y)/3 % 3 != 0 or (2*Y-X)/3 % 3 != 0:
print(0)
exit()
n = int((2*Y-X)/3)
m = int((2*X-Y)/3)
mod = 10**9+7
def comb(n, r, mod):
x=y=1
for i in range(r):
x *= n; y *= r
x %= mod; y %= mod
n -= 1; r -= 1
return x * pow(y, mod - 2, mod) % mod
print(comb(n+m, n, mod)) |
p02760 | s487421470 | Wrong Answer | A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
for i in range(3):
for j in range(3):
if A[i][j] in b:
A[i][j] = 0
for i in range(3):
if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
print('Yes')
break
else:
print('No')
break |
p04045 | s606087754 | Accepted | n, k = map(int,input().split())
d = set(map(int,input().split()))
for i in range(n, 100000):
for j in str(i):
if int(j) in d:break
else:
print(i)
exit() |
p02873 | s878660964 | Accepted | s=input()
n=len(s)+1
a,b=[0]*n,[0]*n
temp=0
for i,val in enumerate(s):
if val=="<": temp+=1
else: temp=0
a[i+1]=temp
temp=0
for i,val in enumerate(s[::-1]):
if val==">": temp+=1
else: temp=0
b[n-i-2]=temp
ans=0
for i,j in zip(a,b): ans+=max(i,j)
print(ans) |
p03416 | s243873551 | Wrong Answer | def is_kaibun(n):
ns = [int(v) for v in str(n)]
i = 0
j = len(ns) - 1
while i < j:
if ns[i] != ns[j]:
return False
i += 1
j -= 1
return True
A, B = map(int, input().split())
count = 0
for i in range(A, B):
if is_kaibun(i):
count += 1
print(count)
|
p03852 | s215691292 | Accepted | import sys
input = sys.stdin.readline().strip
c=list(input().strip())
b=["a","i","u","e","o"]
flg=True
for i in c:
if i not in b:
flg=False
print("vowel" if flg else "consonant")
|
p03103 | s943147223 | Accepted | import numpy as np
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(n)]
ab = np.array(ab)
ab = sorted(ab, key = lambda x: x[0])
ch = m+0
ans = 0
ax = 0
while ch > 0:
t_ab = ab[ax]
if t_ab[1] <= ch:
num = t_ab[1]
else:
num = ch
ans += t_ab[0]*num
ax += 1
ch -= num
print(ans) |
p03086 | s027526703 | Wrong Answer | import re
S = input()
num = len(S)
S = re.sub('[^A|^C|^G|^T]+', ' ', S).split(' ')
print(len(max(S)))
|
p02601 | s167648691 | Accepted | a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while b <= a:
cnt += 1
b *= 2
while c <= b:
cnt += 1
c *= 2
if cnt <= k:
print('Yes')
else:
print('No')
|
p02640 | s782693277 | Wrong Answer | X, Y = map(int, input().split())
for turu in range(1, X + 1, 1):
kame = X - turu
legs = kame * 4 + turu * 2
if legs == Y:
print("Yes")
break
else:
print("No") |
p04011 | s643307064 | Accepted | import sys
def I(): return int(sys.stdin.readline().rstrip())
N,K,X,Y = I(),I(),I(),I()
print(min(K,N)*X + (max(K,N)-K)*Y)
|
p02630 | s838142943 | Accepted | def main():
n = int(input())
a = list(map(int, input().split()))
x = int(input())
bc = [list(map(int, input().split())) for _ in [0]*x]
ans = [0]*100001
for i in a:
ans[i] += 1
ans2 = sum(a)
for b, c in bc:
ans2 += (c-b)*ans[b]
ans[c] += ans[b]
ans[b] = 0
print(ans2)
main()
|
p03803 | s494018965 | Wrong Answer | A,B=map(int,input().split())
if A>B:
print('Alice')
elif A==B:
print('Draw')
else:
print('Bob')
|
p03962 | s674108550 | Wrong Answer | a, b, c = map(int, input().split())
if a == b == c:
print(1)
elif a != b != c:
print(3)
else:
print(2) |
p02744 | s442448812 | Accepted | N = int(input())
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def norm(n, prev_list):
out_list = []
for line in prev_list:
for i in range(len(set(line))+1):
new_line = line + alphabet[i]
out_list.append(new_line)
return out_list
init_line = ['a']
for _ in range(N-1):
init_line = norm(1, init_line)
for line in init_line:
print(line) |
p02697 | s325889931 | Accepted | n,m=map(int,input().split())
oddflag=True
for i in range(1,m+1):
mid=(1+n)//2
if oddflag:
oddflag = False
print(i//2 + 1 , n - i//2)
else:
oddflag = True
print(mid + i//2, mid - i//2)
|
p03672 | s326889065 | Wrong Answer | s = input()
n = len(s)
for i in range(n-1, 1, -1):
if i % 2 == 0:
if s[:i//2] == s[i//2:i]:
print(i)
|
p03986 | s280961869 | Accepted | x = input() #sys.stdin.readlineは最後が改行
n = len(x)
tama = 0
cnt = 0
for i in range(n):
if x[i] =='S':
tama+=1
elif x[i] =='T' and tama>0:
cnt += 2
tama-=1
print(n-cnt) |
p03345 | s598562984 | Accepted | A, B, C, K = map(int, input().split())
if K % 2 == 1:
print(B-A)
elif K % 2 == 0:
print(A-B)
else:
print('Unfair') |
p02923 | s407382207 | Accepted | n=int(input())
h=list(map(int,input().split()))
tmp = 0
ans = 0
for i in range(n-1):
if(h[i]-h[i+1]>=0):
tmp += 1
ans = max(ans, tmp)
#print(ans)
else:
tmp = 0
#print(ans)
print(ans) |
p02600 | s694651892 | Accepted | x = int(input())
print(10 - x // 200) |
p02817 | s591606943 | Wrong Answer | A, B = input().split()
print(B, A) |
p03160 | s315766971 | Wrong Answer | N = int(input())
H = list(map(int, input().split()))
dp = []
for i, h in enumerate(H) :
if (i==0) :
dp.append(0)
continue
if (i==1) :
dp.append(abs(H[0]-H[1]))
continue
one = abs(dp[i-2] + (H[i]-H[i-1]))
two = abs(H[i]-H[i-2])
if (one < two):
dp.append(dp[i-1] + one)
else :
dp.append(dp[i-2] + two)
print(dp[-1]) |
p03543 | s333539701 | Wrong Answer | a, b, c, d=input()
print('Yes' if a==b==c else 'No') |
p03472 | s197579397 | Wrong Answer | n, h = map(int, input().split())
l = []
for i in range(n):
l.append(list(map(int,input().split())))
l = sorted(l, reverse=True, key=lambda x: x[1])
l = sorted(l, reverse=True, key=lambda x: x[0])
c = 0
for i in range(1, n):
if l[i][1] > l[0][0]:
h -= l[i][1]
c += 1
if h <= 0:
print(c)
exit()
while h > l[0][1]:
h -= l[0][0]
c += 1
print(c+1)
|
p02771 | s906118188 | Accepted | a,b,c = [int(x) for x in input().split()]
if (a==b and c!= a) or (a==c and a!=b) or (b == c and a!=b):print('Yes')
else:print('No') |
p02959 | s297292096 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, mod = 0, 0
for i in range(N):
if mod > A[i]:
ans += A[i]
A[i] = 0
else:
ans += mod
A[i] -= mod
mod = 0
if B[i] > A[i]:
ans += A[i]
mod = B[i] - A[i]
else:
ans += B[i]
mod = 0
ans += min(mod, A[i])
print(ans)
|
p02866 | s627427437 | Wrong Answer | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
d = list(map(int, input().split()))
M = 998244353
from collections import Counter
c = Counter(d)
if d[0]!=0 or c[0]>=2:
ans = 0
else:
m = max(c.keys())
ans = 1
for i in range(1,m+1):
if i not in c:
ans = 0
break
ans *= pow(c[i-1], c[i], M)
print(ans) |
p03136 | s155057349 | Wrong Answer | n = int(input())
m = input()
m = m.split()
a = int(max(m))
l = map((lambda x: int(x)), m)
b = int(sum(l))
if a >= b - a:
print("No")
else:
print("Yes") |
p03592 | s055247525 | Accepted | n,m,K=map(int,input().split());print("YNeos"[all(k*(m-l)-K+l*(n-k)for k in range(n+1)for l in range(m+1))::2]) |
p02713 | s583161889 | Wrong Answer | import math
k = int(input())
dp = [0 for _ in range(300)]
dp[1] = 1
for i in range(2,300):
x = 2
y = 0
for j in range(1,i):
y += math.gcd(j,i)
for j in range(1,i):
for l in range(1,i):
y += math.gcd(j,l)
dp[i] = x+y+dp[i-1]
print(dp[200]) |
p02881 | s595474210 | Accepted | n=int(input())
x,y=(1,1)
m=10**12+1
for i in range(1, int(n**0.5)+1):
x+=1
if n%x==0: y=n//x
if n==x*y and m>x+y-2:
m=x+y-2
if m==10**12+1:
m=n-1
print(m)
|
p02702 | s305633070 | Accepted | S = input()[::-1]
dp = [0]*2019
dp[0] = 1
tmp = 0
for i in range(len(S)):
tmp += int(S[i])*pow(10, i, 2019)
tmp %= 2019
dp[tmp] += 1
ans = 0
for i in dp:
if i >= 2:
ans += i*(i-1)//2
print(ans)
|
p03416 | s592511395 | Accepted | a,b=input().split()
count=0
for i in range(int(a),int(b)+1):
if str(i)==str(i)[::-1]:
count+=1
print(count) |
p02783 | s959522581 | Wrong Answer | N = list(map(int, input().split()))
print(N[0]//N[1] +1) |
p02873 | s874712614 | Accepted | S = input()
lst = [1 if S[0]=='<' else -1]
for i in range(1, len(S)):
if S[i] == S[i - 1]:
lst[-1] += 1 if S[i]=='<' else -1
else:
lst.append(-1 if S[i]=='>' else 1)
ans = [0]
for i in range(len(lst)):
if lst[i] > 0:
ans += list(range(1,lst[i]+1))
else:
ans[-1] = max(ans[-1], -lst[i])
ans += list(range(-lst[i]-1,-1, -1))
print(sum(ans))
|
p03944 | s623694130 | Wrong Answer | w, h, n = map(int,input().split())
a_1 = 0
a_2 = w
a_3 = 0
a_4 = h
for i in range(n):
x, y, a = map(int,input().split())
if a == 1:
a_1 = max(a_1,x)
elif a == 2:
a_2 = min(a_2,x)
elif a == 3:
a_3 = max(a_3,y)
else:
a_4 = min(a_4,y)
if a_1 < a_2:
if a_3 < a_4:
print((a_2-a_1)*(a_4-a_3))
else:
print(0)
|
p03043 | s211035820 | Wrong Answer | n,k=map(int,input().split())
kakuritu=0
for i in range(1,n+1):
if i>=k:
kakuritu+=1/n
else:
kaisu=k//i
count=0
while kaisu>1:
kaisu=kaisu/2
count+=1
kakuritu+=0.5**count/n
print(kakuritu)
|
p03262 | s239175893 | Wrong Answer | import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
print(math.gcd(abs(min(x)-X),abs(max(x)-X))) |
p03317 | s033642188 | Wrong Answer | import math
n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
def get_1_index(a):
for i,j in enumerate(a):
if j==1:
return i
index=get_1_index(a)
mae=index
usiro=n-index-1
print(math.ceil(mae/(k-1))+math.ceil(usiro/(k-1))) |
p02792 | s476355973 | Accepted | n = int(input())
c = [[0 for _ in range(10)] for __ in range(10)]
for i in range(1, n+1):
str_i = str(i)
head = int(str_i[0])
tail = int(str_i[-1])
c[head][tail] += 1
cnt = 0
for i in range(10):
for j in range(10):
cnt += c[i][j] * c[j][i]
print(cnt) |
p03264 | s983004378 | Accepted | k = int(input())
e = k // 2
o = k - e
print(e * o) |
p02773 | s641244022 | Wrong Answer | n = int(input())
s = {}
i = 0
while n > i:
s_tmp = input()
if s.get(s_tmp):
s[s_tmp] += 1
else:
s.setdefault(s_tmp, 1)
i += 1
max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]
for i in max_k_list:
print(i) |
p02832 | s464799389 | Accepted | N = int(input())
l = list(map(int,input().split()))
a = 1
n = 0
for i in range(N):
if l[i]==a:
a = a+1
else:
n += 1
if a==1:
print("-1")
else:
print(n) |
p03478 | s481960308 | Accepted | n, a, b = map(int, input().split())
result = 0
for i in range(1, n + 1):
number = i
sum_of_digits = 0
while number > 0:
sum_of_digits += (number % 10)
number //= 10
if a <= sum_of_digits <= b:
result += i
print(result) |
p03854 | s791882215 | Accepted | s = input()
s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')
if s == '':
print('YES')
else:
print('NO')
|
p02916 | s734981470 | Accepted | _ = input()
a = [int(e) for e in input().split(" ")]
b = [int(e) for e in input().split(" ")]
c = [int(e) for e in input().split(" ")]
res = 0
for i,j in enumerate(a):
res += b[j-1]
if i != 0 and j - a[i-1] == 1:
res += c[j-2]
print(res) |
p03679 | s933047797 | Accepted | x, a, b=map(int, input().split())
if b-a<=0:
print("delicious")
elif x-(b-a)>=0:
print("safe")
else:
print("dangerous") |
p02683 | s212167537 | Wrong Answer | import numpy as np
n,m,x = map(int, input().split())
#A = np.zeros((n, m))
CA = np.zeros((n,m+1))
for i in range(n):
CA[i]=list(map(int, input().split()))
# C[i],A[i]=T[0],T[1:]
#print(A,C)
min_cost = 9999999999999999
for i in range(2**n):
T = np.zeros((m+1))
for j in range(n):
if i&(2**j) > 0:
T += CA[j]
if all(T[1:] >= x):
min_cost = min(min_cost,T[0])
print(min_cost) |
p03672 | s551349135 | Accepted | S = input()
L = len(S)
ans = None
for i in range(1,L):
if (L - i) % 2 != 0:
continue
ns = S[:-i]
h = (L - i) // 2
m = ns[:h] + ns[:h]
if ns == m:
ans = ns
break
print(len(ans))
|
p03386 | s008493675 | Accepted | from itertools import chain
import sys
A, B, K = map(int, input().split())
diff = B - A
if diff == 0:
print(A)
sys.exit()
if K > diff:
K = diff
ans = [x for x in chain(range(A, A + K), range(B - K + 1, B + 1))]
ans = sorted(list(set(ans)))
print('\n'.join(map(str, ans))) |
p02707 | s477204476 | Accepted | N=int(input())
A=list(map(int,input().split()))
P=[0]*N
for i in range(N-1):
P[A[i]-1]+=1
for i in range(N):
print(P[i])
|
p03796 | s443138501 | Wrong Answer | import math
N = int(input())
d = math.factorial(N) |
p02768 | s739234183 | Wrong Answer | n,a,b=map(int,input().split())
a=max(a,b)
b=min(a,b)
MOD = pow(10,9) + 7
X=1
Y=1
for i in range(1,a+1):
X=X*(n+1-i)%MOD
Y=Y*i%MOD
if i==b:
b_Y=Y
a_Y=Y
def calc(X,Y,MOD):
return X*pow(Y,MOD-2,MOD)
ans=pow(2,n,MOD)%MOD-1-calc(X,a_Y,MOD)-calc(X,b_Y,MOD)
print(ans%MOD)
|
p03061 | s800810545 | Accepted | """
累積GCD
"""
import sys
sys.setrecursionlimit(10**6)
n = int(input())
A = list(map(int, input().split()))
from math import gcd
L = [0] * n
R = [0] * n
for i in range(n-1):
L[i+1] = gcd(L[i], A[i])
for i in range(n-1, 0, -1):
R[i-1] = gcd(R[i], A[i])
ans = 0
for i in range(n):
ans = max(ans, gcd(L[i], R[i]))
print(ans)
|
p03592 | s023494213 | Accepted | N,M,K=list(map(int, input().split()))
def sea():
for i in range(M+1):
for j in range(N+1):
if N*i+M*j-2*i*j == K:
return 'Yes'
return 'No'
print(sea()) |
p02627 | s250202055 | Accepted | a = input()
b = a.islower()
if b == True:
print("a")
else:
print("A") |
p02861 | s465372515 | Accepted | from itertools import permutations
import math
n = int(input())
x = []
y = []
for i in range(n):
xi, yi = map(int, input().split(' '))
x.append(xi)
y.append(yi)
l = [i for i in range(n)]
route = list(permutations(l))
length = 0
for ls in route:
for i in range(n-1):
length += math.sqrt((x[ls[i+1]]-x[ls[i]])**2+(y[ls[i+1]]-y[ls[i]])**2)
ans = length/math.factorial(n)
print(ans) |
p03408 | s840171090 | Accepted | from collections import defaultdict
counter = defaultdict(int)
for _ in range(int(input())):
counter[input()] += 1
for _ in range(int(input())):
counter[input()] -= 1
print(max(0, max(counter.values())))
|
p02555 | s730595999 | Accepted | # -*- coding: utf-8 -*-
import numpy as np
S=int(input())
MOD=10**9+7
D=[0]*(S+1)
D[0]=1
L=0
for i in range(3,S+1):
L+=D[i-3]
D[i]=L
D[i]%=MOD
ans=D[S]
print(int(ans)) |
p03485 | s927259489 | Accepted | a, b = map(int, input().split())
res = (a + b + 2 - 1) // 2
print(res)
|
p03077 | s735758446 | Accepted | from math import ceil
n, a, b, c, d, e = [int(input()) for _ in range(6)]
neck = min(a, b, c, d, e)
ans = ceil(n / neck) + 4
print(int(ans)) |
p03327 | s407014343 | Accepted | print('ABC' if int(input()) <= 999 else 'ABD') |
p02760 | s450660038 | Accepted | import numpy as np
A = np.array([list(map(int, input().split())) for i in range(3)])
N = int(input())
for i in range(N):
bingo_num = int(input())
A = np.where(A == bingo_num, 0, A)
if (0 in np.sum(A, axis=1)
or 0 in np.sum(A, axis=0)
or np.sum(np.diag(A)) == 0
or A[0, 2]+A[1, 1]+A[2, 0] == 0):
print("Yes")
else:
print("No") |
p02819 | s324172886 | Accepted | x=int(input())
import math
def is_prime(n):
if n<=1:
return False
for i in range(2,int(math.sqrt(n) + 1)):
if n%i == 0:
return False
return True
for i in range(x,2*x+1):
if is_prime(i):
print(i)
exit() |
p03474 | s232958428 | Accepted | A, B = map(int, input().split())
S = input()
print("Yes" if S[A] == "-" and S.count("-") == 1 else "No") |
p02882 | s423040081 | Accepted | import sys
import math
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
a, b, x = map(int, input().split())
s = a * (x / pow(a, 2))
if (a * b) // 2 >= s:
l = s * 2 / b
res = math.degrees(math.atan(b / l))
print(res)
else:
l = (a * b - s) * 2 / a
res = math.degrees(math.atan(l / a))
print(res)
if __name__ == '__main__':
resolve()
|
p02594 | s387501246 | Wrong Answer | X = int(input())
if X>=30:
print('yes')
else:
print('No') |
p03309 | s051855235 | Accepted | import numpy as np
n = int(input())
a = list(map(int, input().split()))
a = np.array(a)
a -= np.array(range(1,n+1))
b = np.median(a)
ans = int(np.sum(abs(a-b)))
print(ans) |
p02802 | s424173597 | Accepted | n, m = map(int,input().split())
ps = list(list(map(str,input().split())) for _ in range(m))
check = [True] * (n+1)
wa = [0] * (n+1)
wa_ans = 0
for i in range(m):
if ps[i][1] == 'AC' and check[int(ps[i][0])]:
check[int(ps[i][0])] = False
wa_ans += wa[int(ps[i][0])]
if ps[i][1] == 'WA':
wa[int(ps[i][0])] += 1
ans = 0
for i in check:
if not i:
ans += 1
print(ans,wa_ans) |
p03293 | s331170004 | Accepted | s = list(input())
t = list(input())
ans = "No"
for i in range(len(s)):
s0 = s[0]
s.remove(s0)
s.append(s0)
if s == t:
ans = "Yes"
break
print(ans)
|
p02631 | s862501669 | Accepted | def main():
N = int(input())
A = list(map(int, input().split()))
scarf_0 = 0
for a in A[1:]:
scarf_0 ^= a
scarf_all = scarf_0 ^ A[0]
ans = [scarf_all^a for a in A]
print(*ans, sep=" ")
if __name__ == "__main__":
main() |
p02838 | s414678509 | Accepted | n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for keta in range(61):
now = 0
for x in a:
if x & (1 << keta):
now += 1
ans += (now*(n-now))*2**keta
ans %= mod
print(ans)
|
p03720 | s507856982 | Accepted | n, m = map(int, input().split())
l = []
for i in range(m):
a, b = map(int, input().split())
l.append(a)
l.append(b)
for i in range(1, n + 1):
print(l.count(i)) |
p03544 | s998745797 | Wrong Answer | s= int(input())
L0 = 2
L1 = 1
L = 0
if s ==1:
print(L)
else:
for i in range(2,s+1):
L = L0 + L1
L0 = L1
L1 = L
print(L) |
p02633 | s325581009 | Wrong Answer | n=int(input())
l=360//n
print(l) |
p03407 | s455333033 | Wrong Answer | a,b,c=map(int,input().split())
if a+b>c:
print('Yes')
else:
print('No') |
p03261 | s626326166 | Wrong Answer | def main():
n = int(input())
word_lst = [""] * n
previous_word = input()
ok = True
for i in range(1,n):
now_word = input()
if not (now_word[0] == previous_word[-1]):
ok = False
break
word_lst.append(now_word)
previous_word = now_word
if len(word_lst) != len(set(word_lst)):
ok = False
print("Yes" if ok else "No")
if __name__ == '__main__':
main()
|
p02730 | s102401838 | Accepted | S = list(input())
N = len(S)
S_mae = S[:int((N-1)/2)]
S_usi = S[int((N+1)/2):]
if S_mae == S_mae[::-1] and S_usi == S_usi[::-1] and S == S[::-1]:
print("Yes")
else:
print("No") |
p04012 | s464803737 | Accepted | w = list(input())
ans = "Yes"
for i in w:
cnt = 0
for j in w:
if i == j:
cnt += 1
if cnt%2 == 1:
ans = "No"
break
print(ans) |
p03545 | s099931135 | Accepted | s = input()
l = len(s)
ans = 0
for i in range(2**(l-1)):
e = ""
for j in range(l):
if ((i >> j) & 1):
e += s[j] + "+"
else:
e += s[j] + "-"
if eval(e[:-1]) == 7:
print(e[:-1]+'=7')
break |
p02705 | s586151031 | Accepted | r = int(input())
print(r* 2 * 3.1415) |
p03371 | s840388734 | Accepted | a, b, c, x, y = map(int, input().split())
if x>=y:
print(min(a*x+b*y, c*x*2, c*y*2+a*(x-y)))
elif x<y:
print(min(a*x+b*y, c*y*2, c*x*2+b*(y-x))) |
p02935 | s437357557 | Accepted | n = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, n):
ans = (ans + v[i]) / 2
print(ans) |
p03627 | s129410019 | Wrong Answer | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
d = Counter(A)
tmp = []
for k, v in d.items():
if v >= 2:
tmp.append(k)
if len(tmp) >= 2:
print(tmp[-1]*tmp[-2])
else:
print(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.