problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03951 | s514335242 | Accepted | N = int(input())
s = input()
t = input()
for i in range(N):
if s[i:] == t[:N-i]:
break
else:
i += 1
print(N + i)
|
p03261 | s113541435 | Wrong Answer | N = int(input())
A = [input() for _ in range(N)]
pre = A[0]
for a in A[1:]:
if A.count(pre) >= 2:
print("No")
exit()
if pre[-1] == a[0]:
pre = a
print("Yes") |
p03795 | s825790724 | Wrong Answer | n = int(input())
bonus = n % 15
bonus = (n - bonus) / 15
print((n * 800) - (bonus * 200)) |
p02719 | s847818163 | Wrong Answer | a,b= map(int, input().split())
min = 100000000000000000000
if a== 0:
print(a)
elif a <= b:
while min > abs(a-b):
min = abs(a-b)
a =abs(a-b)
elif a > b:
a = a%b
while min > abs(a-b):
min = abs(a-b)
a =abs(a-b)
print(min) |
p02720 | s760926622 | Accepted | from collections import deque
k = int(input())
LL = [i for i in range(1, 10)]
LL = deque(LL)
for j in range(k):
num = LL.popleft()
amari = num % 10
kouho = [amari - 1, amari, amari + 1]
for nn in kouho:
if nn >= 0 and nn < 10:
LL.append(10 * num + nn)
print(num)
|
p03220 | s228955712 | Wrong Answer | N = input()
T, A = map(int, input().split())
print(T)
temperatures = list(map(int, input().split()))
r = 50000000000000
results = ''
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
ondo_sa = A - avg_temp
if r > abs(ondo_sa):
r = ondo_sa
results = inde... |
p04020 | s287310196 | Accepted | #! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
N, *A = map(int, read().split())
cnt = 0
acc = 0
for a in A:
if a != 0:
acc += a
els... |
p03633 | s282812573 | Wrong Answer | def gcd(a, b):
if(a == 0):
return b
return gcd(b % a, a)
def lcm(a, b):
return (a * b) / gcd(a, b)
t = int(input())
ans = 1
while(t != 0):
t -= 1
n = int(input())
if(ans < 1000000000000000000000):
ans = lcm(ans, n)
print(int(ans))
|
p02694 | s539655559 | Accepted | def N():
return int(input())
def L():
return list(map(int,input().split()))
def NL(n):
return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7
#import numpy
y = 100
x = N()
cnt = 0
while(1):
cnt += 1
y = (y*101)//100
#print(y)
if y >= x:
print(cnt)
break
|
p02784 | s821740024 | Accepted | h, n = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
if sum_a < h:
print('No')
else:
print('Yes')
|
p03778 | s233614328 | Wrong Answer | w,a,b = map(int,input().split())
#print(w,a,b)
if a+w == b:
print(w)
elif a+w < b:
print(b-(a+w))
elif a+w > b:
print(0)
elif a == b:
print(0) |
p03478 | s481232088 | Accepted | N, A, B = map(int, input().split())
OutPut = 0
for i in range(1,N+1):
moji = str(i) #文字列
leng = len(moji) #文字長
S = 0
for j in range(leng):
S += int(moji[j])
if S >= A and S <= B:
OutPut += i
print(OutPut) |
p02818 | s005613397 | Accepted | a, b, k = map(int, input().split())
a -= k
if a < 0:
if b + a > 0:
print(0, b+a)
else:
print(0, 0)
else:
print(a, b) |
p03639 | s164899113 | Wrong Answer | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
a4 = len(a[a % 4 == 0])
a2n = len(a[a % 2 != 0])
a2 = len(a[a % 2 == 0])
print("Yes" if (a4 + 1 + a2 % 2) >= a2n+1 else "No")
|
p03456 | s163280269 | Accepted | a, b = input().split()
n = int(a+b)
if (n**0.5).is_integer():
print('Yes')
else:
print('No')
|
p03478 | s065024840 | Wrong Answer | N,a,b = map(int, input().split())
ans = 0
for i in range(1,N+1):
m = int(i/1000)
n = int((i%1000)/100)
j = int((i%100)/10)
k = i%10
sum = m + n + j + k
if a <= sum <= b:
ans = ans + i
print(ans) |
p02795 | s273473041 | Wrong Answer | h = int(input())
w = int(input())
n = int(input())
if h>w:
nBig = h
else:
nBig = w
ans = int(n/nBig)+1
print(ans) |
p02959 | s545942265 | Accepted | n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
counter = 0
for i in range(n):
d = min(A[i], B[i])
A[i] -= d
B[i] -= d
counter += d
d = min(A[i+1], B[i])
A[i+1] -= d
B[i] -= d
counter += d
print(counter) |
p02957 | s371845990 | Accepted | # Problem A - Harmony
# input
A, B = map(int, input().split())
# initialization
K = A + B
# check
if K%2==0:
K = K // 2
print(K)
else:
print("IMPOSSIBLE")
|
p02971 | s768846781 | Accepted | import sys
n = int(input())
ls = [int(input()) for _ in range(n)]
mx = max(ls)
c = ls.count(mx)
new = ls[:]
new.remove(mx)
nx = max(new)
if c > 1:
for _ in range(n):
print(mx)
sys.exit()
for i in ls:
if i == mx:
print(nx)
else:
print(mx)
|
p02838 | s922047707 | Accepted | import numpy as np
mod = 10**9 + 7
N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
for n in range(len(bin(max(A)))):
n_1 = np.count_nonzero((A >> n)&1)
n_0 = N - n_1
ans += ((2 ** n)*n_1*n_0) % mod
print(ans%mod) |
p03951 | s959994639 | Accepted | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(input())
S = input()
T = input()
ans = N*2
for i in range(N):
s = S[i:]
t = T[:N-i]
if s == t:
ans -= N-i
break
... |
p03555 | s609725718 | Accepted | a=list(input())
b=list(input())
if a==b[::-1]:
print("YES")
else:
print("NO") |
p02838 | s194908009 | Accepted | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
dp = [0] * 61
for i in range(60, -1, -1):
for v in a:
dp[i] += v >> i & 1
t = 0
for i in range(61):
t += dp[i] * (n - dp... |
p02859 | s974291678 | Wrong Answer | r = int(input())
circle1 = r*r
circle2 = 1*1
a = circle1 / circle2
print(a)
|
p02947 | s857258676 | Accepted | N=int(input())
dic={}
ans=0
for i in range(N):
s=input()
t=sorted(s)
word="".join(t)
if word in dic:
dic[word]+=1
else:
dic[word]=1
for i in dic:
ans+=dic[i]*(dic[i]-1)//2
print(ans) |
p03493 | s018148753 | Accepted | print(input().count("1")) |
p02779 | s078479151 | Accepted | n = int(input())
a = list(map(int, input().split()))
sa = set(a)
if len(a) == len(sa):
print("YES")
else:
print("NO") |
p02753 | s173782526 | Accepted | def Main(S):
return "Yes" if 'A' in S and 'B' in S else "No"
def main():
S = str(input())
print(Main(S))
if __name__ == '__main__':
main() |
p03241 | s477181843 | Accepted | n, m = map(int, input().split())
factors = [1, m]
sqrt = round(m ** 0.5 + 0.5)
for i in range(2, sqrt + 1):
if not m % i:
factors.append(i)
factors.append(m // i)
factors = sorted(factors)
def search(l):
for i in l:
if i >= n:
return m // i
print(search(factors)) |
p02640 | s486827295 | Wrong Answer | x, y = map(int, input().split())
n = (4*x - y)/2
m = (y - 2*x)/2
if n > 0 and m > 0:
if n == int(n) and m == int(m):
print("Yes")
else:
print("No")
else:
print("No")
|
p03035 | s782736463 | Accepted | numerosStr = input().split(" ")
numero=[]
for j in numerosStr:
numero.append(int(j))
if numero[0] >= 13:
print(numero[1])
elif numero[0] >= 6 and numero[0] <=12:
print(int(numero[1]/2))
elif numero[0]<=5:
print(0) |
p03644 | s945510081 | Accepted | N,a=int(input()),1
while a*2<=N:a*=2
print(a) |
p03086 | s808471489 | Wrong Answer | S = str(input())
sam = ['A','C','G','T']
count = 0
for i in range(len(S)):
if i == 0 and S[i] in sam:
count+=1
elif i > 0:
if count == 0 and S[i] in sam:
count+=1
elif S[i] in sam and S[i-1] in sam:
count+=1
print(count)
|
p02677 | s036632702 | Accepted | #C
import math
a,b,h,m = map(int,input().split())
#時間t(hour)
t = h + m/60
#a,bの角度
a_theta = t * 30
b_theta = (t * 360) % 360
theta = abs(a_theta - b_theta)
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(theta)))
print(c) |
p03319 | s579658335 | Wrong Answer | N,K = map(int,input().split())
A = list(map(int,input().split()))
one = A.index(1)
i = one
ans = None
if one == 0 or one == N-1:
ans = -(-(N-1) // (K-1))
else:
left = -(-i // (K-1))
right = -(-(N - i - 1 - (i % (K-1)))//(K-1))
ans = left + right
print(ans)
|
p03548 | s018999645 | Wrong Answer | x,y,z = map(int,input().split())
num = x//(y+z)
mod = x%(y+z)
if 0<=mod<=z:num-=1
print(num) |
p02922 | s716897215 | Wrong Answer | a, b = map(int,input().split())
ans = 1
outlet = 4
while outlet < b:
outlet += a - 1
ans += 1
print(ans) |
p02622 | s461304877 | Wrong Answer | fv = [[0 for i in range(2)] for j in range (26)]
for i in range (2):
for c in input():
fv[ord(c)-ord('a')][i] += 1
ans = 0
for i in range(26):
ans += fv[i][0]-fv[i][1] if fv[i][0] > fv[i][1] else 0
print(ans) |
p03239 | s504486997 | Accepted | n, t = map(int, input().split())
# 経路の最小コスト
a = 10**19
for _ in range(n):
c, tt = map(int, input().split())
if t >= tt:
a = min(c, a)
# 対象経路がない
if a == 10**19:
print('TLE')
else:
print(a)
|
p02612 | s441971111 | Accepted | S = int(input())
pay = 1000
while S > pay:
pay += 1000
else:
print(pay - S) |
p02777 | s231057025 | Wrong Answer | s,t=input().split()
a,b=map(int,input().split())
u=input()
if u=="red":
print(a-1,b)
else:
print(a,b-1) |
p02923 | s299209501 | Accepted | N = int(input())
H = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, N):
if H[i - 1] >= H[i]:
cnt += 1
ans = max(ans, cnt)
else:
cnt = 0
print(ans)
|
p04045 | s912877299 | Wrong Answer | N, K = map(int, input().split())
D = input().split()
n = 1
i = 0
while i < 1:
Ans = str(N * n)
n += 1
i = 1
for ans in Ans:
if ans in D:
i = 0
print(Ans) |
p03637 | s653431717 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A = [a%4 for a in A]
m = A.count(0)
P = 3+2*(m-1) if m>0 else 0
n = A.count(2)
Q = n-1 if n>0 else 0
print("Yes" if P+Q>=N else "No") |
p02995 | s794586675 | Accepted | import fractions
a, b, c, d = map(int, input().split())
a -= 1
lcm = c//fractions.gcd(c, d)*d
cnt = b//c + b//d - b//lcm - (a//c + a//d - a//lcm)
print(b-a-cnt) |
p02598 | s325554416 | Accepted | import math
n, k = map(int, input().split())
A = list(map(int, input().split()))
max_len = max(A)
def f(x):
ans = 0
for a in A:
cut_num = math.ceil(a / x) - 1
#print(a, cut_num, a / x)
ans += cut_num
if ans <= k:
return True
else:
return False
left = 0.001
right... |
p03673 | s763634689 | Wrong Answer | n = int(input())
l = list(map(int,input().split()))
a = []
if n % 2 == 0:
a = l[::-2]+l[0::2]
else:
a = l[::-2]+l[1::2]
print(a) |
p03699 | s298883364 | Accepted | import numpy as np
N = int(input())
ARR = []
for i in range(N):
ARR.append(int(input()))
def calculate(n,arr):
arr = sorted(arr)
arr = np.array(arr)
total = np.sum(arr)
indexes = np.where(arr % 10 != 0)
if total % 10 != 0:
print(total)
return
if indexes[0].__len__() ... |
p02602 | s756223047 | Wrong Answer | n, k = map(int, input().split())
a = list(map(int, input().split()))
hyoten = 1
mae = 1
for i in range(n-k+1):
mae = hyoten
hyoten = 1
for j in range(i, i+k):
hyoten *= a[j]
if mae == 1:
continue
else:
if hyoten > mae:
print("Yes")
else:
print... |
p03386 | s603344230 | Accepted | def resolve():
a, b, k = map(int, input().split())
if a+k-1 >= b-k+1:
for i in range(a, b+1):
print(i)
else:
for i in range(a, a+k):
print(i)
for i in range(b-k+1, b+1):
print(i)
resolve() |
p03012 | s750186175 | Accepted | n = int(input())
w = list(map(int, input().split()))
sum_w = []
sum = 0
for i in range(n):
sum += w[i]
sum_w.append(sum)
diff = sum
for i in range(n):
if diff < abs(sum - 2*sum_w[i]):
break
else:
diff = abs(sum - 2*sum_w[i])
print(diff) |
p03161 | s517542954 | Accepted | N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
def cost(n, m):
return abs(h[n] - h[m])
dp[0] = 0
for i in range(N):
for j in range(1, K + 1):
if (i + j) <= N -1:
dp[i + j] = min(dp[i + j], dp[i] + cost(i, i + j))
print(dp[-1]) |
p02714 | s139370659 | Accepted | N = int(input())
S = list(input())
arr_R = []
arr_G = []
arr_B = []
for idx,s in enumerate(S):
if s=="R":
arr_R.append(idx+1)
elif s=="G":
arr_G.append(idx+1)
else:
arr_B.append(idx+1)
ans = len(arr_R)*len(arr_G)*len(arr_B)
omit = 0
for i in range(N):
for j in range(i+1,N):
k = 2*j-i
if k... |
p02933 | s375241248 | Accepted | a=int(input())
s=str(input())
if a>=3200:
print(s)
else:
print('red')
|
p03067 | s756439126 | Wrong Answer | *s, t = map(int, input().split())
s.sort()
for i in range(s[0],s[1]):
if i == t:
print("Yes")
print("No") |
p02982 | s197509779 | Accepted | import math
n, d = map(int, input().split())
x = []
cnt = 0
for i in range(n):
x.append(list(map(int, input().split())))
for i in range(n):
for j in range(i+1, n):
l = sum((x[i][k]-x[j][k])**2 for k in range(d))
if math.sqrt(l).is_integer():
cnt += 1
print(cnt) |
p03323 | s898208572 | Wrong Answer | a,b = map(int,input().split())
if a > 9 or b > 9:
print(':(')
else:
print('Yay!') |
p03433 | s403264445 | Wrong Answer | n = int(input())
a = int(input())
while n > 500:
n -= 500
if n <= a:
print('Yes')
else:
print('No') |
p02760 | s299813744 | 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
c = [[a[0][0], a[1][1], a[2][2]], [a[0][2], a[1][1], a[2][0]]]
print("Yes" if any(i.count(0) == 3 for i in a) or any(i.count(0)... |
p02866 | s598703840 | Wrong Answer | mod = 998244353
n = int(input())
d = list(map(int, input().split()))
d.sort()
if d[0] != 0:
print(0)
exit(0)
max_d = max(d)
cnt = [0] * (max_d + 1)
for num in d:
cnt[num] += 1
if cnt[0] > 1:
print(0)
exit(0)
ans = 1
for i in range(1, len(cnt)):
ans *= pow(cnt[i - 1], cnt[i], mod)
print(an... |
p03986 | s689336767 | Accepted | X = input()
ans = len(X)
sc = 0
for x in X:
if x == "S":
sc += 1
elif sc > 0:
sc -= 1
ans -= 2
print(ans)
|
p02860 | s416165186 | Accepted | N = int(input())
S = input()
if N % 2 == 1:
print('No')
else:
if S[:N//2] == S[N//2:]:
print('Yes')
else:
print('No') |
p02912 | s081144634 | Accepted | N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
from heapq import heappop,heappush,heapify
heapify(A)
for _ in range(M):
a=heappop(A)*(-1)
a//=2
heappush(A,a*(-1))
print(sum(A)*(-1)) |
p03494 | s161583589 | Accepted | 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) |
p02820 | s745251020 | Wrong Answer | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = []
for l in list(input()):
if l=='r':
t.append(p)
if l=='s':
t.append(r)
if l=='p':
t.append(s)
for i in range(k,n):
if t[i-k]==t[i]:
t[i]=0
print(sum(t))
|
p02571 | s935479470 | Accepted | s=list(input())
t=list(input())
ans=[]
for i in range(len(s)-len(t)+1):
ct=0
for j in range(len(t)):
if s[i+j]!=t[j]:
ct+=1
ans.append(ct)
print(min(ans)) |
p02792 | s117064750 | Accepted | ns = input()
N=int(ns)
C = [[ 0 for _ in range(10)] for _ in range(10)]
for i in range(N+1):
si = str(i)
s = int(si[0])
e = int(si[-1])
C[s][e] += 1
ans = 0
for i in range(1,10):
for j in range(1,10):
# print(i,j,C[i][j])
ans += (C[i][j] * C[j][i])
print(ans)
|
p03219 | s248992853 | Accepted | a,b=map(int, input().split())
print(int(a+b/2)) |
p02584 | s041274007 | Accepted | x,k,d=map(int,input().split())
X=abs(x)
print(X-k*d if X>k*d else abs(X%d-(k-X//d)%2*d)) |
p03705 | s377351118 | Accepted | import sys
input = sys.stdin.readline
N, A, B = map(int, input().split())
print(max(0, (N - 1) * B + A - ((N - 1) * A + B) + 1)) |
p02783 | s462036594 | Accepted | import math
H,A=map(int, input().split())
print(math.ceil(H/A)) |
p02747 | s675003854 | Accepted | S = input()
ANS = ['hi', 'hihi', 'hihihi', 'hihihihi', 'hihihihihi']
if S in ANS:
print('Yes')
else:
print('No')
|
p03555 | s020858154 | Wrong Answer | #答えは合ってるがWAにならない
C1 = input()
C2 = input()
C = list(C1)
D = list(C2)
D.reverse()
if C == D:
print("Yes")
else:
print("No") |
p02608 | s611709313 | Wrong Answer | n = int(input())
for i in range(1, n + 1):
cnt = 0
for x in range(1, 33):
for y in range(1, 33):
for z in range(1, 33):
#if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
if (x+y+z)**2 - (x*y + y*z + z*x) == i:
cnt += 1
print(cn... |
p03206 | s561781288 | Accepted | print("Christmas"+" Eve"*(25-int(input()))) |
p02972 | s241551349 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b=[0]*n
for i in range(n-1,-1,-1):
if not sum(b[i:n:i+1]) %2 and a[i]==1:
b[i] = 1
print(sum(b))
print(" ".join([str(i) for i in b if i== 1]))
|
p02640 | s170742699 | Accepted | import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().s... |
p03493 | s003988839 | Wrong Answer | print(input().count('0')) |
p03455 | s473319299 | Accepted | print("EOvdedn"[eval(input().replace(" ","*"))%2::2]) |
p02793 | s691875059 | Wrong Answer |
def gcd(a, b):
while b:
a, b = b, a % b
return a
def main():
mod = 10**9 +7
n = int(input())
ls = list(map(int,input().split()))
t = 1
for a in ls:
t = gcd(t,a)
ans = 0
for a in ls:
ans = (ans + t//a) % mod
print(ans)
if __name__ == '__main__':
main() |
p02717 | s821620104 | Accepted | X, Y, Z = map(int, input().split())
print("{} {} {}".format(Z, X, Y))
|
p02707 | s081283579 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N = int(input())
A = [int(x) for x in input().split()]
cnt = [0] * N
for i in range(N-1):
cnt[A[i]-1] += 1
for i in range(N):
print(cnt[i]) |
p03836 | s234758190 | Accepted | a,b,c,d=map(int,input().split())
A=""
for i in range(c-a):
A=A+"R"
for i in range(d-b):
A=A+"U"
for i in range(c-a):
A=A+"L"
for i in range(d-b+1):
A=A+"D"
for i in range(c-a+1):
A=A+"R"
for i in range(d-b+1):
A=A+"U"
A=A+"LU"
for i in range(c-a+1):
A=A+"L"
for i in range(d-b+1):
A=A+"D"
A=A+"R"
print(A... |
p03705 | s163527526 | Accepted | import sys
input = sys.stdin.readline
def read():
N, A, B = map(int, input().strip().split())
return N, A, B
def solve(N, A, B):
low = (N-1) * A + B - 1
high = A + (N-1) * B
return max(high - low, 0)
if __name__ == '__main__':
inputs = read()
outputs = solve(*inputs)
if outputs is ... |
p02552 | s748513312 | Accepted | x=int(input())
if x ==0:
print(1)
if x ==1:
print(0) |
p02603 | s797831878 | Accepted | n = int(input())
a = list(map(int, input().split()))
dp = [0]*n
dp[0] = 1000
for i in range(1, n):
dp[i] = dp[i-1]
for j in range(i):
s = dp[j] // a[j]
m = dp[j] + (a[i] - a[j]) * s
dp[i] = max(dp[i], m)
print(dp[n-1]) |
p03137 | s022078305 | Wrong Answer | n,m = map(int,input().split())
x = [int(i) for i in input().split()]
x.sort()
memo = []
for i in range(m-1):
memo.append(x[i+1]-x[i])
memo.sort()
print(sum(memo[:m-n])) |
p04044 | s003786112 | Accepted | n,l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
print("".join(s))
|
p02866 | s026982368 | Wrong Answer | import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
n=int(input())
D=[int(_) for _ in input().split()]
dc=Counter(D)
dci=list(dc.items())
dci.sort()
mod,ans=998244353,1
if D[0]!=0:
print(0)
sys.exit()
for i,dcii in enu... |
p02631 | s751281659 | Wrong Answer | N = int(input())
A = [int(i) for i in input().split()]
B = [i for i in A]
while len(set(B)) != 1:
B = [B[i] ^ B[(i+1)%N] for i in range(N)]
print(" ".join(map(str, [A[i]^B[i] for i in range(N)]))) |
p03478 | s028257084 | Wrong Answer | n,a,b=map(int,input().split())
count=0
for i in range(n+1):
if a<=sum(map(int,str(i)))<=b:
count+=1
print(count) |
p02900 | s602374143 | Accepted |
from collections import defaultdict
def prime_factor(n):
d = defaultdict(int)
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
d[i] += 1
n //= i
if n != 1:
d[n] += 1
return d
A, B = map(int, input().split())
prime_a = pri... |
p02761 | s831571064 | Accepted | n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
i = str(i)
if len(i) != n:
continue
for [x, y] in lst:
if i[x-1] != str(y):
break
else:
print(i)
exit()
print(-1)
|
p03495 | s428100931 | Wrong Answer | import collections
N,K = map(int,input().split())
N_List = list(map(int,input().split()))
Chou_List = collections.Counter(N_List)
if len(Chou_List) <= K:
print(0)
else:
Chou_List = list(Chou_List.values())
print(sum(Chou_List[K:]))
|
p02583 | s869556861 | Accepted | import itertools
N = int(input())
L = list(map(int, input().split()))
count =0
for v in itertools.combinations(L, 3):
a=v[0]
b=v[1]
c=v[2]
if a+b> c and b+c >a and c+a>b:
if a!=b and b!=c and c!=a:
count+=1
print(count) |
p03633 | s310358973 | Accepted | import math
def lcm(x,y):
return (x*y)//math.gcd(x,y)
n=int(input())
t=[int(input()) for i in range(n)]
LCM=t[0]
for i in range(1,n):
LCM=lcm(LCM,t[i])
print(LCM) |
p03625 | s912547862 | Accepted | import collections
_, *a = map(int, open(0).read().split())
c=collections.Counter(a)
tmp=[]
for k,v in c.items():
if v>3:
tmp.append(k)
if v>1:
tmp.append(k)
tmp.sort()
print(tmp[-1]*tmp[-2] if len(tmp) >1 else 0) |
p02607 | s579894162 | Accepted | in_1 = input()
in_2 = input()
N = int(in_1)
a = in_2.split()
cnt = 0
for i, x in enumerate(a):
if i % 2 == 0 and int(x) % 2 == 1:
cnt += 1
print(cnt)
|
p02555 | s751144761 | Accepted | s=int(input())
dp=[0]*2005
dp[0]=1
dp[3]=1
dp[4]=1
dp[5]=1
mod=1e9+7
for i in range(6,2004):
dp[i]=dp[i-1]+dp[i-3]
dp[i]%=mod
print(int(dp[s])) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.