problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03695 | s181931642 | Accepted | def main():
n = int(input())
a = list(map(int, input().split()))
l = set()
free = 0
for aa in a:
if aa // 400 >= 8:
free += 1
else:
l.add(aa // 400)
print(max(1,len(l)), len(l) + free)
if __name__ == '__main__':
main() |
p02696 | s974044987 | Accepted | A,B,N = map(int,input().split())
def floor(x):
return x//1
if N >= B-1:
x = B-1
elif N < B-1:
x = N
print(int(floor(A*x/B)-A*floor(x/B))) |
p03854 | s514710921 | Accepted | s = input()
words = ['eraser', 'erase', 'dreamer', 'dream']
for w in words:
s = s.replace(w, '')
print('NO' if s else 'YES')
|
p02787 | s188677888 | Accepted | (h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[0]*20002
for i in range(h):dp[i]=min(dp[i-a]+b for a,b in c)
print(dp[h-1]) |
p03309 | s475955303 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
b = sorted([x-i-1 for x,i in zip(a,range(n))])
print(sum([x-b[n//2] for x in b])) |
p02633 | s625364525 | Wrong Answer | X = int(input())
if X > 90:
X = 180 - X
total = 1
while ((X * total) % 360 != 0):
total += 1
print(total) |
p03779 | s259271841 | Accepted | X = int(input())
now = 0
time = 0
for i in range(1,10**5):
now += i
time += 1
if now >= X:
break
print(time) |
p02713 | s999541989 | Accepted | def gcd2(a,b):
x, y = max(a, b), min(a, b)
if x % y == 0:
return y
else:
while x % y != 0:
x, y = y, x % y
return y
K = int(input())
s = [gcd2(a, b) for a in range(1, K+1) for b in range(a+1, K+1)]
t = [2 * gcd2(a, b) for a in range(1, K+1) for b in s]
n = [gcd2(a, b) for a in range(1, K+1) for b in range(1, K+1)]
print(sum(t)+sum(n))
|
p02547 | s171961778 | Wrong Answer | def solution():
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
cnt = 0
for i in range(N):
if cnt >= 3:
return 'Yes'
if x[i] == y[i]:
cnt += 1
else:
cnt = 0
return 'No'
print (solution()) |
p02723 | s706116467 | Wrong Answer | s=input()
t=str("coffee")
x=1
for i in range(3,6):
if s[i]!=t[i]:
x=0
print("No")
break
if x==1:
print("Yes")
|
p02689 | s087827620 | Wrong Answer | n,m = map(int,input().split())
h = set(map(int,input().split()))
H = h
count = 0
for i in range(m):
a,b = map(int,input().split())
if a < b:
h.discard(a)
elif a > b:
h.discard(b)
print(len(h)) |
p03371 | s561262945 | Wrong Answer | a,b,c,x,y = map(int,input().split())
p = 0
if x > y:
p += (x - y) * a
x = y
if x < y:
p += (y - x) * b
y = x
if x > 0:
n = x * 2 * c
m = x * a + y * b
p += min(n,m)
print(p) |
p02922 | s184351949 | Accepted | a, b = map(int, input().split())
print(1 + -(-(b - a) // (a - 1))) |
p03659 | s576743338 | Accepted | n = int(input())
a = list(map(int,input().split()))
a2 = [a[0]]
for i in range(n-1):
a2.append(a2[i]+a[i+1])
ans = []
if n == 2:
print(abs(a[0]-a[1]))
exit()
for i in range(n-1):
tmp = abs(a2[-1] - 2*a2[i])
ans.append(tmp)
print(min(ans)) |
p02547 | s649312214 | Wrong Answer | n = int(input().strip())
count = 0
for i in range(n):
a,b = map(int,input().strip().split())
if a == b and count == 3:
print('Yes')
elif a == b:
count += 1
else:
count = 0
print('No')
|
p02958 | s367376465 | Wrong Answer | def main():
n = int(input())
ps = list(map(int, input().split()))
ps_sort = sorted(ps)
Count = 0
for i, j in zip(ps, ps_sort):
if i != j:
Count += 1
if Count == 2 or Count == 0:
print('YES')
else:
print('No')
if __name__ == "__main__":
main()
|
p03815 | s137700536 | Accepted | x = int(input())
ans = 0
if x % 11 == 0:
ans = (x // 11) * 2
elif x % 11 <= 6:
ans = ((x // 11) * 2) + 1
else:
ans = ((x // 11) * 2) + 2
print(ans)
|
p03105 | s136924842 | Accepted | a, b, c = map(int, input().split())
print(min(b//a, c))
|
p02718 | s669151883 | Accepted | import math
def I(): return(list(map(int,input().split())))
n,m=I()
a=I()
t=math.ceil((1/(4*m))*sum(a))
c=0
for i in a:
if i>=t:c+=1
print(["No","Yes"][c>=m])
|
p03632 | s392063451 | Accepted | a,b,c,d = list(map(int,input().strip().split()))
if a <= c and d <= b:
print(d-c)
elif a <= c and b >= c:
print(b-c)
elif a >=c and b <=d:
print(b-a)
elif a >=c and d >= a:
print(d-a)
else:
print(0) |
p03852 | s291517910 | Accepted | c = input()
list01 = ['a', 'e', 'i', 'o', 'u']
if c in list01:
print('vowel')
else:
print('consonant') |
p02712 | s923841717 | Accepted | #! /usr/bin/env python
# -*- coding: utf-8 -*-
def main():
num = int(input())
sum = 0
for i in range(num):
if not (i+1) % 3 == 0 and not (i+1) % 5 == 0:
sum += (i+1)
print (sum)
if __name__ == '__main__':
main()
|
p03555 | s732531991 | Wrong Answer | C123=list(input())
C456=list(reversed(input()))
if C123 == C456:
print('YES')
else:
print('No') |
p03211 | s731731819 | Accepted | N = input()
ans = 1000
for i in range(0,len(N)-2):
ans = min(ans,abs(753-int(N[i:i+3])))
print(ans) |
p03264 | s277103800 | Accepted | k = int(input())
print((k//2) * -(-k//2)) |
p02779 | s639308505 | Accepted | import collections
n = int(input())
A = [int(i) for i in input().split()]
ans = collections.Counter(A)
ans = list(ans)
if len(ans)==n:
print('YES')
else:
print('NO') |
p02761 | s623873610 | Accepted | N, M = map(int, input().split())
S_C = []
for _ in range(M):
s, c = map(int, input().split())
S_C.append([s, c])
if N == 1:
r = range(0, 10)
elif N == 2:
r = range(10, 100)
else:
r = range(100, 1000)
for i in r:
str_i = str(i)
flag = True
for s, c in S_C:
if str_i[s - 1] != str(c):
flag = False
break
if flag:
print(i)
quit(0)
print(-1)
|
p03804 | s458416584 | Accepted | N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
b = any(all(A[i+k][j+l]==B[k][l] for k in range(M) for l in range(M)) for i in range(N-M+1) for j in range(N-M+1))
print("YNeos"[not b::2]) |
p03324 | s550648377 | Accepted | # -*- coding: utf-8 -*-
# 標準入力を取得
D, N = list(map(int, input().split()))
# 求解処理
ans = (N + (N // 100)) * 100**D
# 結果出力
print(ans)
|
p03042 | s773883162 | Wrong Answer | S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)
if front > 12 or front == 0:
if 1 < back <= 12 :
print("YYMM")
else:
print("NA")
elif front <= 12 and front == 0:
if back <= 12 or back > 1:
print("AMBIGUOUS")
else:
print("MMYY") |
p02843 | s475386301 | Accepted | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
x = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
n = x // 100
mod = x % 100
print(0 if 5 * n < mod else 1)
|
p02701 | s757316755 | Wrong Answer | import sys;
class Main:
s = set([i.strip() for i in sys.stdin.readlines()]);
print(len(s));
|
p03038 | s799671950 | Accepted | n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
d = [list(map(int, input().split())) for _ in range(m)]
d.sort(key=lambda x:(-x[1]))
e = []
for b,c in d:
e += [c]*b
if len(e) >= n:
break
e = sorted(e)[::-1]
ans = 0
j = 0
for i in range(n):
if j < len(e):
if a[i] >= e[j]:
ans += a[i]
else:
ans += e[j]
j += 1
else:
ans += a[i]
print(ans)
|
p02760 | s336783904 | Accepted | card = []
for i in range(3):
card += list(map(int, input().split()))
N = int(input())
bingo = [(1, 2, 3), (4, 5, 6), (7, 8, 9), (1, 4, 7), (2, 5, 8), (3, 6, 9), (1, 5, 9), (3, 5, 7)]
for i in range(N):
n = int(input())
if n in card:
card[card.index(n)] = "hit"
#print(card)
ans = "No"
for patt in bingo:
if card[patt[0]-1] == card[patt[1]-1] == card[patt[2]-1] == "hit":
ans = "Yes"
break
print(ans) |
p03723 | s825917279 | Accepted | a, b, c = map(int, input().split())
if a == b == c:
ans = 0
else:
ans = 1 << 31
for x in [a - b, b - c, c - a]:
if x != 0:
tmp = 0
while x % 2 == 0:
tmp += 1
x >>= 1
ans = min(tmp, ans)
if a == b == c and b % 2 == 0:
print(-1)
else:
print(ans) |
p03796 | s956293225 | Accepted | import math
n = int(input())
a = math.factorial(n)
print(a%(10**9+7)) |
p03632 | s237287541 | Wrong Answer | a,b,c,d=map(int,input().split())
e=max(a,b)
f=min(c,d)
if e<f:
print(f-e)
else:
print(0) |
p02693 | s812823008 | Wrong Answer | k = int(input())
a,b = map(int,input().split())
if k < b-a+1:
print("NG")
else:
print("OK") |
p02838 | s558428358 | Accepted | n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*60
for i in range(n):
b = format(a[i], '060b')
for j in range(len(b)):
if b[j] == "1":
c1_list[j] += 1
count = 0
for i in range(60):
count = (count + c1_list[i]*(n-c1_list[i])*2**(59-i)) % 1000000007
print(count) |
p03387 | s130454556 | Accepted | def main():
A, B, C = sorted(map(int, input().split()))
print((2 * C - A - B) // 2 + 2 if (2 * C - A - B) % 2 else
(2 * C - A - B) // 2)
return
main()
|
p03042 | s045978597 | Wrong Answer | S = str(input())
year = int(S[0] + S[1])
month = int(S[2] + S[3])
if year <= 12 and year >= 1 and month >= 1 and month <= 12:
print('AMBIGUOUS')
elif year >= 1 and year <= 99 and month >= 1 and month <= 12:
print('YYMM')
elif year >= 12 and year <= 12 and month >= 1 and month <= 99:
print('MMYY')
else:
print('NA') |
p02594 | s787882823 | Wrong Answer | x = int(input('X'))
if x >= 30:
print('Yes')
else:
print('No') |
p03485 | s636003847 | Accepted | a, b = map(int, input().split())
ans = 0 - -(a + b)//2
print(ans) |
p02601 | s123618724 | Wrong Answer | a,b,c = map(int, input().split())
k = int(input())
t = 0
if(a>=b):
while(a>=b):
b = 2*b
t +=1
if(b>=c):
while(b>=c):
c = 2*c
t +=1
if(t<=k):
print("Yes")
else:
print("NO") |
p02621 | s492862912 | Accepted | a = int(input())
print(a + a * a + a * a * a) |
p03673 | s149285383 | Accepted | #!/usr/bin/env python3
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque([a[0]])
for i in range(1, n):
if i % 2 == 1:
b.append(a[i])
else:
b.appendleft(a[i])
if (n - 1) % 2 == 1:
[print(ans, end = " ") for ans in list(b)[::-1]]
else:
[print(ans, end = " ") for ans in list(b)] |
p03386 | s826403698 | Accepted | a, b, k = map(int, input().strip().split())
result = set()
for small in range(a, min(a + k, b + 1)):
result.add(small)
for large in range(max(a, b - k + 1), b + 1):
result.add(large)
result = sorted(list(result))
for r in result:
print(r)
|
p03745 | s220030754 | Wrong Answer | n = int(input())
l = [int(x) for x in input().split()]
diff = 0
subs = []
tmp = [l[0]]
for i in range(len(l)-1):
# print(diff)
a,b = l[i], l[i+1]
d = a-b
if diff == 0 or d == 0 or (diff < 0 and d < 0) or (diff > 0 and d > 0):
tmp.append(b)
diff = d
continue
diff = 0
subs.append(tmp)
tmp = [b]
subs.append(tmp)
print(len(subs)) |
p02971 | s325252403 | Wrong Answer | def main():
N = int(input())
A = [int(input()) for _ in range(N)]
max_A = max(A)
max_A_2 = 1
if len(set(A)) == 1:
max_A_2 = max_A
else:
for a in A:
if max_A_2 < a and a != max_A:
max_A_2 = a
for a in A:
if a != max_A:
print(max_A)
else:
print(max_A_2)
if __name__ == '__main__':
main()
|
p02606 | s558754779 | Wrong Answer | L, R, d = map(int, input().split())
if L==1:
print(R)
else:
ans = R//d - L//d
print(ans) |
p03696 | s929822861 | Accepted | n = int(input())
s = list(input())
ans = ""
l = 0
for i in range(n):
ans += s[i]
if s[i] == ")":
if l == 0:
ans = "(" + ans
else:
l -= 1
else:
l += 1
ans += (")"*l)
print(ans)
|
p04044 | s751929756 | Accepted | def solve():
N, L = [int(i) for i in input().split()]
S = []
for _ in range(N):
S.append(input())
print(''.join(sorted(S)))
if __name__ == "__main__":
solve() |
p02916 | s267642527 | Accepted | N=int(input())
d=[[int(s) for s in input().split()] for i in range(3)]
ans=0
for i in range(N):
ans+=d[1][d[0][i]-1]
if i<=N-2 and d[0][i+1]-d[0][i]==1:
ans+=d[2][d[0][i]-1]
print(ans) |
p03145 | s853103217 | Accepted | a,b,c = map(int,input().split())
print(a*b//2) |
p03672 | s043126888 | Accepted | S = list(input())
for x in range(len(S) - 2):
if len(S) % 2 != 0 or x == 0:
S.pop(-1)
continue
i = len(S) // 2
if S[:i] * 2 == S:
break
else: S.pop(-1)
print(len(S)) |
p03910 | s283325515 | Accepted | N = int(input())
l = 0
r = N
s = (r * (r + 1)) // 2
while r - l > 1:
m = (r + l) // 2
x = (m * (m + 1)) // 2
if x >= N:
r = m
s = x
else:
l = m
for i in range(1,r+1):
if i != s - N:
print(i) |
p02842 | s122716993 | Wrong Answer | n = int(input())
for i in range(n):
if int(i * 1.08) == n:
print(int(i))
exit()
print(":(") |
p03555 | s161275157 | Wrong Answer | s1 = input()
s2 = input()
if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
print("Yes")
else:
print("No") |
p03835 | s714314452 | Accepted | k,s=map(int,input().split())
ans=0
for i in range(0,k+1):
for j in range(0,k+1):
if 0 <= s-i-j <= k:
ans += 1
print(ans) |
p02916 | s275685456 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = sum(b)
for i in range(n-1):
if a[i]+1 == a[i+1]:
ans += c[a[i]-1]
print(ans) |
p02953 | s422563369 | Wrong Answer | N = int(input())
H = [int(i) for i in input().split()]
for i in range(N-1):
if(H[i] > H[i+1]):
if(H[i] == H[i+1] + 1):
H[i] -= 1
else:
print("No")
exit()
for i in range(N-1):
if(H[i] > H[i+1]):
print("No")
exit()
print("Yes") |
p02717 | s051825513 | Wrong Answer | lst = map(int, input().split())
print(' '.join(map(str, sorted(lst)))) |
p02996 | s691067136 | Accepted | N = input()
A = [0]*N
B = [0]*N
for i in range(N):
A[i], B[i] = map(int, raw_input().split())
AB = zip(B, A)
AB.sort()
x = 10**9
for b, a in AB[::-1]:
x = min(x, b)-a
print "Yes" if x>=0 else "No"
|
p02785 | s301557596 | Accepted | n, k = map(int, input().split())
hps = list(map(int, input().split()))
hps = sorted(hps,reverse=True)
hps = hps[k:]
hpsum = int(sum(hps))
print(hpsum) |
p03274 | s135758798 | Accepted | n,k=map(int,input().split())
a=[int(i) for i in input().split()]
res=100000000000000000000
for i in range(n-k+1):
l=a[i]
r=a[i+k-1]
if l<=0<=r:
res=min(res,(-l+r)*2-max(-l,r))
elif r<0:
res=min(res,-l)
else:
res=min(res,r)
print(res)
|
p03695 | s097317489 | Accepted | #8 C - Colorful Leaderboard
N = int(input())
a = list(map(int,input().split()))
seen = [False]*8
cnt = 0
cnt_3200 = 0
for i in a:
i = i//400
if i >= 8:
cnt_3200 += 1
elif (seen[i] == False):
cnt += 1
seen[i] = True
if cnt == 0:
print(1,cnt_3200)
else:
print(cnt,cnt+cnt_3200) |
p03030 | s988832888 | Wrong Answer | N = int(input())
rest_dict = {}
city_list = []
for i in range(N):
city, score = input().split()
if city not in city_list:
city_list.append(city)
rest_dict[city] = [[score, i]]
else:
rest_dict[city].append([score, i])
coty_list = sorted(city_list)
for city in city_list:
rest_list = rest_dict[city]
rest_list = sorted(rest_list)
for rest in rest_list:
print(rest[1]) |
p03815 | s695762415 | Wrong Answer | x=int(input())
q,r = divmod(x,11)
if r <= 6:a = 1
else:a = 2
print(2*q+a) |
p03220 | s349082889 | Accepted | N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
l=[]
for i in range(N):
l.append(abs(T-H[i]*0.006-A))
print(l.index(min(l))+1) |
p03478 | s902378454 | Wrong Answer | N, A, B = map(int,input().split())
count = 0
for i in range(N+1):
i100 = i // 100
i10 = (i - i100*100) // 10
i1 = (i - i100*100 - i10*10) // 1
isum = i100 + i10 + i1
if A <= isum <= B:
count += i
print(count)
|
p03284 | s071076176 | Wrong Answer | N, K = map(int, input().split())
a = N // K
res = N - a * K
print(res)
|
p02693 | s680568848 | Accepted | k = int(input())
a,b = map(int,input().split())
ans = b // k * k
#print(ans)
if ans >= a:
print("OK")
else:
print("NG")
|
p02594 | s227179461 | Accepted | print("Yes" if int(input()) >= 30 else "No") |
p02861 | s390415739 | Wrong Answer | import math
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
x[i],y[i]=map(int,input().split())
ans_sum=0
for i in range(N):
for j in range(N):
if i!=j:
ans_sum+=math.sqrt((x[j]-x[i])**2+(y[j]-y[i])**2)**0.5
print(ans_sum/N) |
p02854 | s406262261 | Wrong Answer | n = int(input())
l = list(map(int,input().split()))
from itertools import accumulate
cum=list(accumulate(l))
tot=sum(l)
ans=10**9+7
for i in cum:
ans=min(ans, abs(tot-i*2))
print(ans) |
p02972 | s263001877 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))[0]
print("1\n1" if a==1 else "0") |
p03479 | s884728061 | Accepted | x,y=map(int,input().split())
print(len(bin(y//x))-2) |
p03524 | s471806593 | Accepted | from collections import Counter
S = input()
counter = Counter(S)
ca, cb, cc = counter['a'], counter['b'], counter['c']
cabc = [ca, cb, cc]
if max(cabc) - min(cabc) <= 1:
print('YES')
else:
print('NO') |
p03607 | s140911024 | Accepted | from collections import Counter
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
for count in Counter(A).items():
if count[1] % 2 != 0:
ans += 1
print(ans)
|
p02987 | s354373759 | Accepted | def main():
s = sorted(input())
print("Yes" if s[0] == s[1] and s[2] == s[3] and s[0] != s[3] else "No")
if __name__ == "__main__":
main()
|
p02744 | s371115950 | Accepted | alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字
n = int(input())
ans = []
def solve(now,i):
if len(now) == n:
ans.append(now)
return
for j in range(i+1):
solve(now+alpha_small_[j],max(i,j+1))
solve("a",1)
for x in sorted(ans):
print(x) |
p03419 | s473103384 | Accepted | n,m=map(int,input().split())
if n==1 and m==1:
print(1)
elif n==1 or m==1:
print(n*m-2)
else:
print((m-2)*(n-2))
|
p03331 | s127596778 | Wrong Answer | n = int(input())
a = 0
b = 0
ans = 1000000000
for i in range(1, n-1):
a = n - i
b = n - a
a = list(map(int,str(a)))
b = list(map(int,str(b)))
if sum(a) + sum(b) <= ans:
ans = sum(a) + sum(b)
print(ans)
|
p02832 | s868897603 | Wrong Answer | N = int(input())
nums = [int(s) for s in input().split()]
min_breaks = -1
count_num = 1
for i in range(N):
if nums[i] == count_num:
if min_breaks == -1:
min_breaks = 0
min_breaks += ((i+1) - count_num)
count_num+=1
print(min_breaks) |
p03637 | s822648634 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
d = {1 : 0, 2 : 0, 4 : 0}
for i in a:
if i % 4 == 0:
d[4] += 1
elif i % 2 == 0:
d[2] += 1
else:
d[1] += 1
if d[1] <= d[4]:
print("Yes")
elif d[1] - d[4] == 1 and d[2] == 0:
print("Yes")
else:
print("No") |
p02689 | s278416297 | Wrong Answer | N, M = map(int, input().split())
H = list(map(int, input().split()))
A, B = [], []
for i in range(M):
a, b = map(int, input().split())
if H[a-1] < H[b-1]:
H[a-1] = H[b-1]
else:
H[b-1] = H[a-1]
print(len(set(H)))
|
p03637 | s206572437 | Wrong Answer | n = int(input())
l=list(map(int ,input().split()))
four=0
two=0
one=0
for i in range(n):
if l[i]%2==0:
if l[i]==2:
two+=1
else:
four+=1
elif l[i]==1:
one+=1
if one>=1:
if n/2>=four>=one/2:
print('Yes')
else:
print('No')
elif two==1:
if n/2>=four:
print('Yes')
else:
print('No')
elif four+two>=n/2:
print('Yes')
else:
print('No') |
p03327 | s349919090 | Accepted | n = int(input())
if n<1000:
print('ABC')
else:
print('ABD') |
p02631 | s946685640 | Accepted | N = int(input())
A = list(map(int, input().split()))
cnt = A[0]
for i in A[1:]:
cnt ^= i
lst = []
for i in A:
lst.append(i^cnt)
print(*lst) |
p03624 | s363182904 | Accepted | S = input()
alphabet = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for c in alphabet:
if c not in S:
ans = c
break
print(ans)
|
p02731 | s453859370 | Accepted | L=int(input())
print(pow(L/3,3)) |
p03289 | s930256864 | Wrong Answer | S = input()
ans = "AC"
if S[0] == "A":
pass
else:
ans = "WA"
if S[2] == "C" and S[-2] == "C":
ans = "WA"
elif S[2] == "C" or S[-2] == "C":
pass
else:
ans = "WA"
print(ans )
|
p02726 | s188360406 | Accepted | n,x,y=map(int, input().split())
ans=[0]*(n-1)
for i in range(1,n):
for j in range(i+1,n+1):
d1=abs(x-i)+abs(y-j)+1
d2=j-i
ans[min(d1,d2)-1]+=1
for i in range(n-1):
print(ans[i])
|
p02860 | s972318842 | Accepted | n = int(input())
s = input()
if n%2:
print('No')
else:
n //= 2
if s[:n]==s[n:]:
print('Yes')
else:
print('No')
|
p03705 | s329813872 | Accepted | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
N, A, B = inm()
def solve():
if A > B:
return 0
if N == 1:
return 0 if A != B else 1
a = A * (N - 1) + B
b = B * (N - 1) + A
return b - a + 1
print(solve())
|
p03474 | s384234351 | Accepted | a,b=map(int,input().split())
s=input()
n=[str(i)for i in range(10)]
for i in range(a + b + 1):
if(i==a and s[i]!='-')or(i!=a and s[i]not in n):
print('No');exit()
print('Yes') |
p02970 | s588831321 | Accepted | a,b=input().split()
a=int(a)
b=int(b)
if a%(b*2+1)==0:
print(a//(b*2+1))
else:
print(a//(b*2+1)+1) |
p03061 | s752522808 | Accepted | from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
fgcd, ftmp = [], a[0]
for i in a:
ftmp = gcd(ftmp,i)
fgcd.append(ftmp)
bgcd, btmp = [], a[-1]
for i in a[::-1]:
btmp = gcd(btmp, i)
bgcd.append(btmp)
bgcd=bgcd[::-1]
egcd = [bgcd[1]] + [0] * (n - 2) + [fgcd[n - 2]]
for i in range(1, n - 1):
egcd[i] = gcd(fgcd[i - 1], bgcd[i + 1])
print(max(egcd))
|
p02765 | s591969273 | Accepted | n,r = map(int,input().split())
if n < 10:
h = 100*(10-n)
print(r+h)
else:
print(r)
|
p02866 | s795113990 | Accepted | N=int(input())
import collections
l=list(map(int,input().split()))
cnt=collections.Counter(l)
if cnt[0] > 1 or l[0] != 0:
print(0)
exit()
ans=1
mod=998244353
for i in range(1,max(cnt)):
ans*=pow(cnt[i],cnt[i+1],mod)
ans%=mod
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.