problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03327 | s817376171 | Accepted | line = int(input())
if line > 999:
print("ABD")
else:
print("ABC") |
p03035 | s830164288 | Accepted | a, b = map(int, input().split())
if a >= 13:
print(b)
elif 6 <= a <= 12:
print(b // 2)
else:
print(0)
|
p04005 | s196910983 | Wrong Answer | def main():
ABC = list(map(int,input().split()))
if ABC[0]%2 == 0 or ABC[1]%2 == 0 or ABC[2]%2 == 0:
print(0)
else:
tmp = [0,0,0]
cube = ABC[0]*ABC[1]*ABC[2]
for i in range(3):
base = cube/ABC[i]
tmp[i] = abs((ABC[i]//2*base)-((ABC[i]-ABC[i]//2)*base))
print(int(min(tmp)))
if __name__ == '__main__':
main() |
p02742 | s291748410 | Wrong Answer | H,W = map(int, input().split())
if H*W%2 == 0:
print(H*W/2)
else:
print(H*W//2+1)
|
p02684 | s563388761 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
ans_list = []
end = 0
stpos = 0
for i in range(K):
ans = A[ans] - 1
ans_list.append(ans)
if len(set(ans_list)) != i+1:
end = i - 1
stpos = ans_list.index(ans)
break
if i == K:
print(ans)
exit()
print(ans_list[stpos:end+1][(K-(stpos+1)) % (end-stpos+1)]+1)
|
p02859 | s608033980 | Accepted | print(int(input())**2) |
p02897 | s858884807 | Accepted | import math
N = int(input())
print(math.ceil(N/2)/N) |
p02924 | s721891757 | Wrong Answer | N = int(input())-1
print((1+N)*(N/2)) |
p03131 | s030594880 | Accepted | import sys
import math
input = sys.stdin.readline
k, a, b = map(int, input().split())
if b > a and k + 1 > a:
ans = max(k + 1, (b - a) * math.floor((k + 1 - a) / 2) + (k + 1 - a) % 2 + a)
else:
ans = k + 1
print(ans)
|
p02657 | s131960000 | Accepted | a, b = map(int, input().split())
print(a*b)
|
p02708 | s079681050 | Accepted | n,k=map(int,input().split())
res=(n+2)*(n+1)**2/2+n+1-(n+1)*(n+2)*(2*n+3)/6
re=(n+1)*k*(k-1)/2+k-1-k*(k-1)*(2*k-1)/6
res=(res-re)%(10**9+7)
print(int(res)) |
p03721 | s598493792 | Accepted | L=lambda:list(map(int,input().split()))
n,k=L()
for a,b in sorted([L() for _ in range(n)]):
k-=b
if k<=0:print(a);exit() |
p02584 | s737376588 | Accepted | x,k,d=map(int,input().split())
x=x if x>0 else -x
print(x-k*d if k<=x//d else (d-x%d if (k-x//d)%2 else x%d))
|
p03632 | s562545190 | Accepted | a,b,c,d= map(int, input().split())
alice=[0]*(b-a+1)
bob=[0]*(d-c+1)
ct=0
for i in range (a,b+1):
alice[ct]=i
ct+=1
ct=0
for i in range (c,d+1):
bob[ct]=i
ct+=1
ans=len(set(alice)&set(bob))
if ans==0:
print(ans)
else:
print(ans-1) |
p03408 | s735682675 | Wrong Answer | N_1 = int(input())
A = [str(input()) for i in range(N_1)]
N_2 = int(input())
B = [str(input()) for i in range(N_2)]
C = A+B
D = list(set(C))
E=[]
for i in range(len(D)):
NN = A.count(D[i]) - B.count(D[i])
E.append(NN)
print(max(E)) |
p02628 | s018698126 | Accepted | N,K = map(int,input().split())
a = input().split()
a = [int(i) for i in a]
la = sorted(a)
print(sum(la[:K])) |
p03633 | s459356944 | Wrong Answer | nu = int(input())
lis = []
ans = 0
for i in range(nu):
t = int(input())
lis.append(t)
lis.sort()
print(lis)
for i in range(10*18):
tes = lis[-1] * (i+1)
for f in lis:
if tes % f == 0:
ans = 1
else:
ans = -1
break
if ans == 1:
break
print(tes)
|
p02842 | s562531023 | Accepted | import math
N = int(input())
nuki = math.ceil(N/1.08)
print(nuki if math.floor(nuki*1.08) == N else ':(')
|
p02924 | s208344282 | Accepted | N = int(input())
modsum = ((1+(N-1))*(N-1))//2
print(modsum) |
p03419 | s173167347 | Accepted | n,m = map(int, input().split())
if n == m== 1:
print(1)
elif n == 1 or m == 1:
print(max(n,m)-2)
else:
print((n-2)*(m-2)) |
p02726 | s793097793 | Accepted | def z(x,y):
if x > y:
return(x-y)
else:
return(y-x)
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
A = [0] * N
for i in range(N):
for j in range(i+1,N):
a = min(j-i,z(i,X) + 1 + z(j,Y))
A[a] += 1
for i in range(N-1):
print(A[i+1]) |
p03345 | s225711740 | Accepted | a,b,c,k = map(int,input().split())
if k%2 == 0 and a-b <= 10**18:
print(a-b)
elif k%2 != 0 and a-b <= 10**18:
print(b-a)
"""
else:
print("Unfair")
""" |
p03730 | s838646713 | Accepted | a,b,c = map(int, input().split())
ans = "NO"
for i in range(b):
if a * i % b == c:
ans = "YES"
break
print(ans) |
p03160 | s635891124 | Accepted | from math import inf
n = int(input())
h = list(map(int, input().split()))
costs = [inf]*n
costs[0] = 0
for i in range(n):
for j in (i+1, i+2):
if j < n:
costs[j] = min(costs[j], costs[i]+abs(h[i]-h[j]))
print(costs[-1]) |
p02707 | s920269928 | Wrong Answer | import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
print(c)
for i in range(N):
print(c[i+1]) |
p02688 | s174007614 | Accepted | import itertools
N, K = map(int, input().split())
d = []
A = []
for i in range(K):
d.append(int(input()))
A.append(list(map(int,input().split())))
A = list(itertools.chain.from_iterable(A))
A = list(set(A))
kotae = N - len(A)
print(kotae) |
p03352 | s596837969 | Accepted | x = int(input())
ans = 1
cnt = 1
for i in range(1,x):
cnt = i
for j in range(9):
cnt *= i
if cnt > x:
break
if cnt > ans:
ans = cnt
print(ans) |
p03644 | s924966983 | Accepted | n = int(input())
if n == 1:
print(1)
elif n <= 3:
print(2)
elif n <= 7:
print(4)
elif n <= 15:
print(8)
elif n <= 31:
print(16)
elif n <= 63:
print(32)
else:
print(64) |
p02729 | s122956754 | Accepted | from operator import mul
from functools import reduce
N, M = map(int, input().split())
Nans = 0
Mans = 0
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1,r + 1))
return over // under
if N == 0 or N == 1:
Nans = 0
else:
Nans = cmb(N, 2)
if M == 0 or M == 1:
Mans = 0
else:
Mans = cmb(M, 2)
print(Nans + Mans) |
p03086 | s867257545 | Accepted | S = list(input())
cnt = 0
res = 0
for s in S:
if s == 'A' or s == 'T' or s == 'C' or s == 'G':
cnt += 1
res = max(cnt, res)
else:
cnt = 0
print(res)
|
p02731 | s226817014 | Accepted | N = int(input())
ans = (N/3)**3
print(ans) |
p03126 | s245571835 | Wrong Answer | n, m = map(int,input().split())
ans = set(list(range(1, m+1)))
for i in range(n):
k, *a = map(int, input().split())
ans &= set(a)
print(ans) |
p02645 | s971056203 | Accepted | s = input()
print(s[0:3]) |
p03437 | s326069598 | Accepted | x,y = map(int, input().split())
if x%y==0:
print(-1)
else:
print(x) |
p02995 | s524332789 | Accepted | def euclid(a, b):
if b == 0:
return a
else:
return euclid(b, a%b)
A,B,C,D=map(int,input().split())
if A%C==0:
k=A//C
else:
k=(A//C)+1
if B%C==0:
t=B//C
else:
t=(B//C)
n=t-k+1
if A%D==0:
a=A//D
else:
a=(A//D)+1
b=B//D
m=b-a+1
mi=(C*D)//euclid(C, D)
if A%(C*D)==0:
c=A//mi
else:
c=(A//mi)+1
d=(B//mi)
r=d-c+1
s=n+m-r
print(B-A+1-s) |
p02772 | s655053794 | Wrong Answer | a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a):
if b[i]%2==0:
if b[i]%3==0 or b[i]%5==0:
c=c+1
if c==a:
print("APPROVED")
else:
print("DENIED") |
p02918 | s687346440 | Accepted | import sys
#input = sys.stdin.buffer.readline
def main():
N,K = map(int,input().split())
s = str(input())
count = 0
change = 0
for i in range(N-1):
if s[i+1] == s[i]:
count += 1
else:
change += 1
if change//2 >= K:
print(count+2*K)
else:
print(N-1)
if __name__ == "__main__":
main() |
p02760 | s413294888 | Accepted | # B - Bingo
def is_winnable(player: int) -> bool:
winnable_conditions = \
{0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100}
return any(player & condition == condition for condition in winnable_conditions)
def main():
*ANB, = map(int, open(0).read().split())
A, B = ANB[:9], set(ANB[10:])
player = 0b000000000
for i, a in enumerate(A):
if a in B:
player |= 1 << i
print("Yes" if is_winnable(player) else "No")
if __name__ == "__main__":
main()
|
p03625 | s965317192 | Accepted | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
ans = [0]*2
t = 0
for i in sorted(count.items(), reverse=True):
if i[1] >= 4:
if t == 0:
ans[0],ans[1] = i[0],i[0]
t = 2
elif t == 1:
ans[t] = i[0]
t += 1
elif i[1] >= 2:
ans[t] = i[0]
t += 1
if t == 2: break
print(ans[0]*ans[1]) |
p03797 | s680877029 | Accepted | N,M=map(int,input().split())
ans=0
if 2*N<=M:
ans+=N
M-=2*N
else:
ans+=(M//2)
M-=(M//2)*2
ans+=(M//4)
print(ans) |
p02759 | s349870796 | Accepted | import math
n = int(input())
print(math.ceil(n/2)) |
p02646 | s581092152 | Accepted | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
max_A = A + V*T
min_A = A - V*T
max_B = B + W*T
min_B = B - W*T
if max_A >= max_B and min_A <= min_B:
print("YES")
else:
print("NO") |
p03286 | s548972048 | Accepted | n=int(input())
s=""
while n!=0:
s+=str(abs(n%(-2)))
n=(n-n%2)//(-2)
print(s[::-1] if s else 0)
|
p02778 | s956771747 | Accepted | print('x' * len(input())) |
p03962 | s152639555 | Accepted |
a = list(map(int,input().split()))
a = set(a)
a = list(a)
print(len(a))
|
p03012 | s723473522 | Wrong Answer | N = int(input())
W = list(map(int, input().split()))
S1 = sum([w for w in W if w < N])
S2 = sum([w for w in W if w >= N])
print(abs(S1 - S2)) |
p03624 | s936132888 | Accepted | S = list(input())
lst = [chr(i) for i in range(97, 97+26)]
res = sorted(list(set(lst) - set(S)))
if res == []:
print("None")
else:
print(res[0])
|
p02647 | s151510838 | Wrong Answer | n,k=map(int,input().split())
a=list(map(int,input().split()))
import copy
temp=[0]*n
tu=0
td=0
for j in range(k):
for i in range(n):
td=max(i+1-a[i],1)
tu=min(i+1+a[i],n)
for m in range(td-1,tu):
temp[m]=temp[m]+1
a=copy.copy(temp)
L=[str(t) for t in a]
L=" ".join(L)
print(L) |
p03720 | s329587199 | Wrong Answer | # abc061_b.py
N, M = map(int,input().split())
ab = []
for i in range(M):
a,b = map(int,input().split())
ab.append(a)
ab.append(b)
ab.sort()
pre = 0
cnt = 0
for i in ab:
if pre == i:
cnt += 1
else:
if pre != 0:
cnt += 1
print(cnt)
cnt = 0
pre = i
cnt += 1
print(cnt) |
p02690 | s036097345 | Wrong Answer | x = int(input())
a = x - 1
for i in range(0, a + 1):
if pow(i, 5) == a:
print(str(i) + " " + "-1")
|
p03438 | s025359760 | Accepted | import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0
z = 0
for i in range(n):
x += b[i]-a[i]
y += max(a[i]-b[i], 0)
z += max(math.ceil((b[i]-a[i])/2), 0)
# print(x, y)
if x - y < 0 or x - z < 0:
print('No')
else:
print('Yes')
|
p04045 | s425861130 | Accepted | n, k = list(map(int, input().split()))
d = list(input().split())
ans = n
find = False
while find == False:
p = str(ans)
find = True
for i in range(len(p)):
if p[i] in d:
find = False
break
if find == False:
ans += 1
print(ans)
|
p03317 | s617782199 | Wrong Answer | n,k=map(int,input().split())
k-=1
r=list(map(int,input().split()))
a=r.index(1)
b=n-a-1
print((a+k-1)//k+(b+k-1)//k) |
p02777 | s955963392 | Wrong Answer | s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
print(a-1,b)
elif t==u:
print(b-1,a) |
p02777 | s151349226 | Accepted | def main():
s, t = list(input().split())
a, b = list(map(int, input().split()))
u = input()
if u == s:
a -= 1
else:
b -= 1
print(a, b)
if __name__ == '__main__':
main()
|
p02723 | s821113071 | Accepted | a = list(input())
if a[2] == a[3] and a[4] == a[5]:
print("Yes")
else:
print("No") |
p03385 | s033753094 | Accepted | import sys
input = sys.stdin.readline
S = list(input().strip())
count = 0
for i in range(3):
if S[i%3] != S[(i+1)%3]:
count += 1
if count == 3:
print("Yes")
else:
print("No") |
p02691 | s700851990 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
i_plus_A = Counter([i + A[i] for i in range(N)])
i_minus_A = [i - A[i] for i in range(N)]
print(sum(i_plus_A[x] for x in i_minus_A)) |
p03679 | s348491964 | Accepted | x,a,b = map(int, input().split())
if b - a <=0:
print("delicious")
elif b-a <= x:
print("safe")
else:
print("dangerous") |
p02597 | s421689566 | Accepted | n = int(input())
c = input()
print(c[:c.count("R")].count("W")) |
p03673 | s052114061 | Wrong Answer | from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque()
if n % 2 == 0:
for i in range(n):
if i % 2 != 0: # 偶数なら前
b.appendleft(a[i])
else:
b.append(a[i])
else:
for j in range(n):
if j % 2 == 0: # 偶数なら後ろ
b.appendleft(a[j])
else:
b.append(a[j]) |
p02594 | s573129867 | Wrong Answer | n = int(input())
if n<29:
print("No")
else:
print("Yes") |
p03487 | s060496223 | Wrong Answer | from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
hashmap = defaultdict(int)
for a in A:
hashmap[a]+=1
ans = 0
for k, v in hashmap.items():
ans+=min(v,k-v)
print(ans)
|
p03723 | s030587358 | Accepted | A,B,C = map(int,input().split())
cou = 0
if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
print("0")
exit()
while(cou < 10**6):
cou += 1
a = A
b = B
c = C
A = b/2 + c/2
B = a/2 + c/2
C = a/2 + b/2
if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
print(str(cou))
exit()
else:
pass
print("-1") |
p03417 | s359346407 | Wrong Answer | n,m=map(int,input().split())
print(n*m-(2*n+2*m-4)) |
p02948 | s694437240 | Wrong Answer | import heapq
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])
x = 0
res = 0
hq = []
heapq.heapify(hq)
for i in range(M):
for j in range(x, N):
if AB[j][0] > i+1:
x = j
break
heapq.heappush(hq, AB[j][1]*-1)
if hq:
res += heapq.heappop(hq)*-1
print(res)
|
p03994 | s711646468 | Wrong Answer | s = input()
K = int(input())
for i in range(len(s)-1):
z2a = ord('z') + 1 - ord(s[i])
if z2a <= K:
s = s[:i] + 'a' + s[i+1:]
K -= z2a
print(s[:len(s)-1] + chr(((ord(s[len(s)-1]) - ord('a')) + K % 26) % 26 + ord('a'))) |
p03821 | s818197888 | Accepted | N = int(input())
AB = [[int(hoge) for hoge in input().split()] for j in range(N)]
ans = 0
for a,b in reversed(AB):
a += ans
ans += -a % b
print(ans) |
p02813 | s267878462 | Wrong Answer | from itertools import permutations
n = int(input())
p_list = list(map(int,input().split()))
q_list = list(map(int,input().split()))
dum_list = [i for i in range(1,n+1)]
count = 0
ans = 0
for i in permutations(dum_list,n):
count += 1
if p_list == list(i):
ans += count
elif q_list == list(i):
ans -= count
print(abs(ans)) |
p02829 | s132351773 | Accepted | A = int(input())
B = int(input())
if abs(A - B) == 2:
print('2')
elif A + B == 3:
print('3')
else:
print('1')
|
p02556 | s471282585 | Wrong Answer | N = int(input())
for i in range(N):
x, y = map(int, input().split())
if i==0:
x1, y1, x2, y2, x3, y3, x4, y4 = x, y, x, y, x, y, x, y
else:
if x<x1 and y<y1:
x1, y1 = x, y
elif x<x2 and y>y2:
x2, y2 = x, y
elif x>x3 and y>y3:
x3, y3 = x, y
elif x>x4 and y<y4:
x4, y4 = x, y
print(max(abs(x1-x3)+abs(y1-y3),abs(x2-x4)+abs(y2-y4)))
|
p03719 | s485867851 | Wrong Answer | A, B, C = map(int, input().split())
if A <= B <= C:
print('Yes')
else:
print('No') |
p03145 | s294746035 | Accepted | ab, bc, ca = map(int, input().split())
print(ab * bc // 2) |
p03087 | s065613592 | Wrong Answer | N,Q = map(int,input().split())
S = input()
c = [0]
count = 0
for i in range(N-1):
if S[i] == "A" and S[i+1] == "C":
count += 1
c.append(count)
print(c)
for i in range(Q):
l,r = map(int,input().split())
print(c[r-1]-c[l-1]) |
p02571 | s208439233 | Accepted | S = input()
T = input()
min_val = len(S)
for i in range(0,len(S)-len(T)+1):
count = 0
for j in range(i, i+len(T)):
if S[j] == T[j-i]:
count += 1
min_val = min(min_val, len(T)-count)
print(min_val) |
p03639 | s169590783 | Accepted | n = int(input())
A = list(map(int, input().split()))
d2 = 0
d4 = 0
for i in range(n):
if A[i]%2==0 and A[i]%4!=0:
d2 += 1
elif A[i]%4==0:
d4 += 1
n -= int(d2/2)*2
if n-1-d4<=d4:
print('Yes')
else:
print('No') |
p03250 | s212596296 | Accepted | x=list(map(int,input().split()))
x.sort()
print(x[-1]*10+x[-2]+x[-3]) |
p03815 | s949102665 | Wrong Answer | x=int(input())
d=-(-x//11)
r=x%11
if r<=6:
print(2*d-1)
else:
print(2*d) |
p03543 | s071785677 | Wrong Answer | a,b,c,d=input()
print("Yes" if a==b==c else "No") |
p03657 | s050263051 | 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')
|
p03493 | s381966548 | Wrong Answer | import sys
l = list(map(int, input().split()))
loop = 0
while (1):
for i in l:
if (i % (2 * (loop + 1)) != 0):
print(loop)
sys.exit(0)
loop = loop + 1
|
p02790 | s098419024 | Wrong Answer | a,b = map(int, input().split())
str_a = [a] * b
str_b = [b] * a
if str_a > str_b:
print(*str_b)
else:
print(*str_a) |
p02603 | s959166708 | Accepted | from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
n=int(input())
a=lnii()+[0]
money=1000
kabu=0
for i in range(n):
if a[i]<a[i+1]:
t_kabu=money//a[i]
kabu+=t_kabu
money-=t_kabu*a[i]
elif a[i]>a[i+1]:
money+=kabu*a[i]
kabu=0
print(money) |
p02582 | s736692235 | Wrong Answer | S = input()
ans = 0
count = 0
for i in S:
if i == "R":
count += 1
if count >= 3:
ans = 3
elif count >= 1 :
if S[1] == "S":
ans = 1
else:
ans = 2
else:
ans = 0
print(ans) |
p02729 | s444996206 | Wrong Answer | import math
import sys
n, m = map(int, input().split())
def combinations_count(n, r):
C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
return C
if n <= 1 and m >= 2:
print(combinations_count(m, 2))
sys.exit()
elif n >= 2 and m <= 1:
print(combinations_count(n, 2))
sys.exit()
elif n == m == 1:
print(1)
sys.exit()
elif n == m == 0:
print(0)
sys.exit()
else:
print(combinations_count(n, 2) + combinations_count(m, 2)) |
p03475 | s790037679 | Wrong Answer | n=int(input())
CSF=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
time=0
for j in range(i,n-1):
c,s,f=CSF[j]
if time<s:time +=s-time
if time%f==0:time +=c
else:time +=c+(time%f)
print(time)
print(0) |
p02860 | s215849112 | Accepted | n = int(input())
s = input()
flag = True
if n % 2 != 0:
flag = False
else:
for i in range(n // 2):
if s[i] != s[(n // 2) + i]:
flag = False
break
if flag:
print('Yes')
else:
print('No') |
p02881 | s676809411 | Wrong Answer | import math
N = int(input())
result = N
for i in range(1, int(math.sqrt(N))+3):
if N % i == 0:
result = min(result, i - 1 + N//i + 1)
print(result-2)
|
p03419 | s261476350 | Wrong Answer | N,M=map(int, input().split())
ans=0
if min(N,M)==1:
print(max(0,max(N,M)-2))
exit()
ans=(N-2)*(M-2)
print(ans)
|
p02702 | s893415491 | Wrong Answer | S = input()
ans = 0
nd = 1
mod1 = 0
listmod = [0]*2019
for i in S[::-1]:
mod1 = (int(i)*nd + mod1)%2019
listmod[mod1] += 1
nd = (nd*10)%2019
for i in range(2019):
n = listmod[i]
if(n>0):
ans += ((n-1)*n)//2
print(ans) |
p02947 | s979188711 | Accepted | from collections import defaultdict
def main():
N = int(input())
d = defaultdict(int)
s = 0
for i in range(N):
d["".join(sorted(input()))] += 1
for k in d.keys():
s += d[k]*(d[k]-1)/2
print(int(s))
if __name__ == '__main__':
main() |
p02859 | s491613700 | Accepted | r = int(input())
print(r ** 2) |
p02713 | s706176393 | Accepted | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
import copy
import itertools
n = int(readline())
lst1 = [i for i in range(1,n+1)]
lst2 = copy.deepcopy(lst1)
lst3 = copy.deepcopy(lst1)
def gcd(a,b):
if b == 0:
return a
else:
return gcd(b,a%b)
def lcm(a,b):
return (a//gcd(a,b)*b)
ans = 0
for i,j,k in itertools.product(lst1,lst2,lst3):
ans += gcd(i,gcd(j,k))
print(ans) |
p03387 | s161106477 | Wrong Answer | a,b,c=map(int,input().split())
a,b,c=max(a,b,c),a+b+c,min(a,b,c)
b-=a+c
print(a-b+(b-c+1)//2) |
p04033 | s127822456 | Accepted | a,b = map(int,input().split())
if a<=0 and b>=0:
print("Zero")
elif a>0 and b>0:
print("Positive")
elif a<0 and b<0:
t = b-a
if t%2==0:
print("Negative")
else:
print("Positive") |
p03962 | s423874364 | Accepted | colors = list(map(int, input().split()))
kinds = len(set(colors))
print(kinds) |
p03109 | s088711125 | Accepted | y, m, d = map(int, input().split("/"))
print("TBD" if y >= 2019 and m >= 5 and d >= 1 else "Heisei") |
p02761 | s781302438 | Accepted | from collections import defaultdict
N,M = map(int,input().split())
SCs = [list(map(int,input().split())) for _ in range(M) ]
if N == 1:
bottom = 0
else:
bottom = 10 ** (N -1)
top = 10 ** (N)
ans = -1
for i in range(bottom,top):
str_i = str(i)
flag =True #条件を満たしていればTrue
for q in SCs:
s,c = q
if int(str_i[s - 1]) != c:
flag = False
if flag:
ans = i
break
print(ans)
|
p02571 | s502472174 | Accepted | s = input()
t = input()
ans = 10 ** 10
for i in range(len(s) - len(t) + 1):
cnt = 0
for j in range(len(t)):
if t[j] != s[i + j]:
cnt += 1
ans = min(cnt, ans)
print(ans)
|
p02618 | s612927461 | Accepted | from random import *
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
cand=0
for j in range(26):
if s[i][cand]<s[i][j]:
cand=j
print(randrange(1,26)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.