problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03037 | s146068094 | Accepted | n,m=map(int,input().split())
L=[]
R=[]
for i in range(m):
l,r=map(int,input().split())
L.append(l)
R.append(r)
a=max(L)
b=min(R)
li=[i for i in range(a,b+1)]
print(len(li))
|
p02688 | s129079830 | Accepted | import collections
N,K=map(int,input().split())
a=[]
d=[]
while K>0:
K=K-1
d.append(int(input()))
b=list(map(int,input().split()))
a.extend(b)
e=collections.Counter(a)
print(N-len(e)) |
p03146 | s857006098 | Accepted |
import numpy as np
import sys
input = sys.stdin.readline
s = int(input())
if s == 1 :
n = 2
elif s == 2:
n = 1
else:
n = 3
ans = 1
while s != 4:
if s%2 == 0 :
s = s/2
else:
s = 3*s + 1
ans+=1
print(ans+n)
|
p03162 | s387154417 | Accepted | N = int(input())
dp = [0,0,0]
for _ in range(N):
a, b, c = map(int, input().split())
ndp = [0,0,0]
ndp[0] = max(dp[1], dp[2]) + a
ndp[1] = max(dp[0], dp[2]) + b
ndp[2] = max(dp[0], dp[1]) + c
dp = ndp
print(max(dp))
|
p03612 | s162830277 | Accepted | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
if p[-1] == n:
ans += 1
print(ans)
|
p03836 | s738288864 | Wrong Answer | sx,sy,tx,ty = map(int,input().split())
ans = 'R'*(tx-sx)+'U'*(ty-sy) + 'L'*(tx-sx) +'D'*(ty-sy) + 'D' + 'R'*(tx-sx+1) + 'U'*(ty-tx+1)+ 'L' + 'U' + 'L'*(tx-sx+1) + 'D'*(ty-tx+1) + 'R'
print(ans) |
p02601 | s272244655 | Wrong Answer | A, B, C = map(int, input().split())
K = int(input())
cnt = 0
while A > B and cnt <= K:
B = B*2
cnt += 1
if cnt >= K and B > C:
print("No")
else:
while B > C and cnt < K:
C = C*2
cnt += 1
if C > B:
print("Yes")
else:
print("No")
|
p02982 | s635809144 | Accepted | def dist(x, y):
d = 0.0
for i in range(len(x)):
d += (x[i] - y[i]) ** 2
return d ** 0.5
n, d = map(int, input().split())
x = []
for i in range(n):
x.append(tuple(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i + 1, n):
d = dist(x[i], x[j])
if abs(d -... |
p02835 | s306730508 | Wrong Answer | a_n = list(map(int, input().split()))
if sum(a_n) >= 22:
print("win")
else:
print("bust")
|
p02743 | s578934927 | Accepted | import sys
readline = sys.stdin.buffer.readline
import math
from decimal import *
a,b,c = map(int,readline().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No") |
p03386 | s521789995 | Accepted | A, B, K = map(int, input().split())
ans = set([_ for _ in range(A, min(A + K, B+1))])
ans |= set([_ for _ in range(B, max(A, B-K), -1)])
for num in sorted(list(ans)):
print(num)
|
p03861 | s298890064 | Accepted | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
a, b, x = map(int, readline().split())
ans = b//x - (a-1)//x
print(ans)
if __name__ == '__main__':
main() |
p02784 | s876009653 | Wrong Answer | H, _ = map(int, input().split())
if sum(map(int, input().split())) > H:
print('Yes')
else:
print('No') |
p03419 | s486079167 | Wrong Answer | N,M=map(int, input().split())
ans=0
if min(N,M)==1:
print(max(N,M)-2)
exit()
for h in range(N):
for w in range(M):
count=0
if 1<=h<N-1 and 1<=w<M-1:
count+=9
else:
count+=4
if count%2==1:
ans+=1
print(ans)
|
p02640 | s274149366 | Accepted | X,Y=map(int,input().split())
if Y % 2 != 0:
print('No')
elif (Y//2 -X >=0 and 2*X-Y//2>=0):
print('Yes')
else:
print('No') |
p02761 | s718043664 | Accepted | N,M = map(int,input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
dic = {}
if sc == [] and N == 1:
print(0)
exit()
if sc == [[1,0]] and N == 1:
print(0)
exit()
for k in sc:
if k[0] in dic:
if dic[k[0]] != k[1]:
print(-1)
exit()
else:
dic[k[0]] = k[1]
ans = 0
if 1 in... |
p03854 | s588278885 | Accepted | def main():
s = input()
w = ["dream", "dreamer", "erase", "eraser"]
last = len(s)
for _ in range(len(s)):
if last < 1:
break
for ww in w:
if s[last - len(ww):] == ww:
s = s[:last - len(ww)]
last -= len(ww)
print("YES" if last < ... |
p03274 | s612596048 | Accepted | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**18
for i in range(N-K+1):
if x[i]<x[i+K-1]<0:
ans = min(ans, -x[i])
elif 0<x[i]<x[i+K-1]:
ans = min(ans, x[i+K-1])
else:
ans = min(ans, -2*x[i]+x[i+K-1], -x[i]+2*x[i... |
p02861 | s220515885 | Accepted | import itertools
import math
N=int(input())
z=[]
for _ in range(N):
z.append(list(map(int,input().split())))
sum=0
for per in itertools.permutations(list(range(N))):
for i in range(N-1):
sum+=math.sqrt((z[per[i]][0]-z[per[i+1]][0])**2+(z[per[i]][1]-z[per[i+1]][1])**2)
ans=sum/math.factorial(N)
print(ans... |
p03456 | s511978623 | Accepted | A, B = input().split()
X = int(A + B)
ans = "No"
for i in range(1000):
if (i * i) == X:
ans = "Yes"
print(ans)
|
p03062 | s587205218 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort()
minus, plus = [], []
for x in a:
if x < 0:
minus.append(x)
else:
plus.append(x)
tmp = sum([abs(x) for x in a])
if len(minus) % 2 == 0:
print(tmp)
else:
if plus == [] or abs(minus[-1]) < plus[0]:
print(tmp + minus[-... |
p03136 | s212375137 | Wrong Answer |
n = int(input())
l = list(map(int,input().split()))
l.sort()
"""
print(l)
print(sum(l) - l[-1])
print(l[-1])
"""
if (sum(l) - l[-1]) < l[-1]:
print("Yes")
else:
print("No")
|
p03352 | s909573367 | Accepted | X = int(input())
S = set([1])
for i in range(2,X):
b = 2
while(i**b<=X):
S.add(i**b)
b += 1
ans = max(S)
print(ans) |
p03486 | s947370399 | Accepted | import math
a=input()
b=input()
c=sorted(a)
d=sorted(b,reverse=True)
print("Yes" if c<d else "No")
|
p02547 | s161146354 | Accepted | N = int(input())
i = 0
res = False
for _ in range(N):
a, b = map(int,input().split())
if a == b:
i += 1
else:
i = 0
if i >= 3:
res = True
print("Yes" if res else "No") |
p02994 | s475641011 | Wrong Answer | N, L = map(int, input().split())
tastes = [ L+x for x in range(N) ]
if 0 in tastes:
print(sum(tastes))
if L<0:
absmin = max(tastes)
print(sum(tastes)-absmin)
elif L>0:
absmin = min(tastes)
print(sum(tastes)-absmin) |
p03455 | s021103027 | Wrong Answer | a, b = map(int, input('整数を入力してね > ').split())
#print(a,b)
answer = a * b
print(answer)
if answer % 2==0:
print('Even')
else:
print('Odd') |
p03109 | s822329108 | Accepted | # https://atcoder.jp/contests/abc119/tasks/abc119_a
y, m, d = map(int, input().split('/'))
if y > 2019:
print('TBD')
elif m >= 5:
print('TBD')
else:
print('Heisei')
|
p03001 | s219866936 | Wrong Answer | w,h,x,y = map(int,input().split())
if x == int(w/2) and y == int(h/2):
print(w*h/2,1)
else:
print(w*h/2,0) |
p03416 | s520421280 | Wrong Answer | a,b=map(int,input().split())
cnt=0
for l in range(a,b):
l_i=list(str(l))
if l_i[0]==l_i[-1] and l_i[1]==l_i[-2]:
cnt+=1
print(cnt)
|
p02848 | s203982403 | Accepted | N = int(input())
S = input()
char = ''
for i in range(len(S)):
char += chr((ord(S[i]) + N - 65) % 26 + 65)
print(char)
|
p02691 | s939195029 | Accepted | N = int(input())
no = [i for i in range(N)]
A = list(map(int, input().split()))
no_minus_height = {}
#no_plus_height = {}
total = 0
for i in range(N-1,-1,-1):
no_plus_height = no[i]+A[i]
try:
total += no_minus_height[no_plus_height]
except:
pass
try:
no_minus_height[no[i]-A... |
p02820 | s478947057 | Wrong Answer | N,K = [int(i) for i in input().rstrip().split(' ')]
R,S,P = [int(i) for i in input().rstrip().split(' ')]
r = 0
T = input()
te = ["p","r","s"]
point = {"p":P,"r":R,"s":S}
Play = []
for i,t in enumerate(T):
best = te[te.index(t)-1]
if Play[i-K] != best if i >= K else True:
Play += [best]
r += poi... |
p02691 | s584271007 | Accepted | n,*l=map(int,open(0).read().split())
from collections import*
d=defaultdict(int)
a=0
for i in range(n): d[i+l[i]]+=1; a+=d[i-l[i]]*(i>l[i])
print(a) |
p03745 | s080139080 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 1
x = 0
for i in range(n-1):
if a[i] < a[i+1]:
if x == -1:
ans += 1
x = 0
elif x == 0:
x = 1
elif a[i] > a[i+1]:
if x == 1:
ans += 1
x = 0
elif x == 0:
... |
p03639 | s030118072 | Accepted | N = int(input())
A = list(map(int,input().split()))
cnt_1 = 0
cnt_2 = 0
cnt_4 = 0
for i in range(N):
if A[i] % 2 == 0:
if A[i] % 4 == 0:
cnt_4 += 1
else:
cnt_2 += 1
else:
cnt_1 += 1
#print(cnt_1,cnt_2,cnt_4)
if cnt_2 == 0:
if cnt_1 <= cnt_4 + 1:
print("Yes")
else:
print("No")
else:
if cnt_1 <= cnt_... |
p02681 | s110580704 | Accepted | s = input()
t = input()
if s == t[0:-1]:
print("Yes")
else:
print("No")
|
p03075 | s332159812 | Wrong Answer | import sys
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
antena = [a,b,c,d,e]
for i in range(len(antena)):
for j in range(i+1,len(antena)):
if antena[j]-antena[i]<k:
state = 1
else:
state = 0
break
if sta... |
p03145 | s429689172 | Accepted | a,b,c = map(int,input().split())
print(a*b//2) |
p02747 | s291328752 | Accepted | S = input()
HI = ['hi','hihi','hihihi','hihihihi','hihihihihi',]
if S in HI:
print('Yes')
else:
print('No') |
p02689 | s745000934 | Accepted | n,m=map(int,input().split())
h=list(map(int,input().split()))
x=[1]*n
for i in range(m):
a,b=map(int,input().split())
if h[a-1]>=h[b-1]:
x[b-1]=0
if h[a-1]<=h[b-1]:
x[a-1]=0
print(sum(x)) |
p03328 | s895437737 | Accepted | a,b=map(int, input().split())
print(sum([x for x in range(b-a)])-a) |
p03286 | s259220708 | Wrong Answer | N = int(input())
s = ''
s2 = ''
while N != 0:
if N % 2 == 0:
s += '0'
N //= (-2)
if N % 2 == -1 or N % 2 == 1:
s += '1'
N //= (-2)
N += 1
s2 = s[::1]
print(s2)
|
p03131 | s297814391 | Accepted | k,a,b=map(int,input().split())
if k<=a: print(1+k)
else:
print(max(1+k, b+(k-a-1)//2*(b-a) + (k-a-1)%2))
|
p02730 | s821942244 | Wrong Answer | s = input()
n = len(s)
a, b = (n-1)//2, ((n+3)//2)+1
if s[0:a] == ''.join(reversed(s[0:a])) and s[b:] == ''.join(reversed(s[b:])):
print("Yes")
else:
print("No") |
p03162 | s014433747 | Wrong Answer | n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
dp = [[0 for i in range(3)] for j in range(n)]
dp[0] = [max(li[0])]*3
#print(dp)
for i in range(n-1):
for j in range(3):
for k in range(3):
if j == k: #同じことを2日連続はできない
continue
dp[i+1][k] = max(d... |
p02829 | s018737943 | Wrong Answer | a = int(input())
b = int(input())
if a!=1 or b!=1:
print(1)
elif a!=2 or b!=2:
print(2)
else:
print(3)
|
p02714 | s573832926 | Wrong Answer | import itertools
N = int(input())
S = input()
r = len(list(filter(lambda x: x == "R", S)))
g = len(list(filter(lambda x: x == "G", S)))
b = len(list(filter(lambda x: x == "B", S)))
# print("r:{}, g:{}, b:{}".format(r, g, b))
ans = r * g * b
RGB = itertools.permutations(["R", "G", "B"], 3)
for i in range(1, N):
... |
p03146 | s794004554 | Accepted | s=int(input())
def calc(n):
if n % 2 == 0:
return n / 2
else:
return 3*n +1
ans = []
ans.append(s)
for i in range(1000001):
if calc(ans[i]) in ans:
print(len(ans) +1)
exit()
else:
ans.append(int(calc(ans[i]))) |
p03323 | s527862578 | Accepted | A,B=map(int,input().split(' '))
if A<=8 and B <= 8:
print('Yay!')
else:
print(':(') |
p02664 | s518107789 | Accepted | def main():
T = input()
print(T.replace('?', 'D'))
if __name__ == "__main__":
main()
|
p02847 | s095109284 | Accepted | S = input()
if S == 'SUN':
print(7)
elif S == 'MON':
print(6)
elif S == 'TUE':
print(5)
elif S == 'WED':
print(4)
elif S == 'THU':
print(3)
elif S == 'FRI':
print(2)
elif S == 'SAT':
print(1)
|
p03860 | s369845362 | Wrong Answer | def iroha():
string = input()
Capital = string[0]
print("A" + Capital + "C")
if __name__ == "__main__":
iroha()
|
p02732 | s418412801 | Accepted | N = int(input())
nums = list(map(int, input().split()))
al = 0
part = {}
for i in range(N):
if nums[i] in part:
al += part[nums[i]]
part[nums[i]] += 1
else:
part[nums[i]] = 1
for i in range(N):
print(al - part[nums[i]] + 1)
|
p03778 | s981558030 | Wrong Answer | w,a,b = map(int,input().split())
print(b-(a+w)) |
p02756 | s210313583 | Wrong Answer | s = [input()]
q = int(input())
for _ in range(q):
i = input().split()
if int(i[0]) == 1:
s = s[::-1]
elif int(i[0]) == 2:
if int(i[1]) == 1:
s.insert(0, i[2])
elif int(i[1]) == 2:
s.append(i[2])
print(''.join(s)) |
p03131 | s915742112 | Accepted | K,a,b = map(int,input().split())
count = 1
if (b-a) <= 2:
count += K
else:
K -= (a-1)
count += (a-1)
if K >= 2:
count += K//2 * (b-a)
if K % 2 ==1:
count += 1
else:
count += 1
print(count)
|
p02688 | s393204706 | Accepted | from collections import Counter
N, K = map(int, input().split())
xd=[]
for i in range(K):
d = int(input())
x = list(map(int, input().split()))
xd.extend(x)
xd= Counter(xd)
print(N-len(xd))
|
p02608 | s023730818 | Accepted | N=int(input())
r=[0]*N
from itertools import product
for x,y,z in product(range(1,100),repeat=3):
p=x*x+y*y+z*z+x*y+y*z+z*x
if 0<p<=N:
r[p-1]+=1
print(*r,sep='\n') |
p03251 | s289602626 | Accepted | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collection... |
p03417 | s270646598 | Wrong Answer | n,m=map(int,input().split())
if n==1 or m==1 and n!=m:
print(n*m-2)
elif n==1 and m==1:
print(0)
else:
print((n-2)*(m-2)) |
p02683 | s628855857 | Wrong Answer | import itertools
import numpy as np
n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l = sorted(l)
l = np.array(l)
ans = np.sum(l, 0)[0]
ans_s = np.sum(l, 0)
if np.any(ans_s[1:] < x):
print(-1)
exit()
count = 0
for i in range(1, m + 1):
for j in itertools.combinati... |
p03323 | s417444860 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def main():
a, b = map(int, input().split())
if a <= 8 and b <= 8: print("Yay!")
else: print(":(")
if __name__ == "__main__":
main()
|
p02862 | s307129007 | Accepted |
def comb(n, r, mod=10 ** 9 + 7):
n1 = n + 1
r = min(n, n - r)
numer = denom = 1
for i in range(1, r + 1):
numer = numer * (n1 - i) % mod
denom = denom * i % mod
return numer * pow(denom, mod - 2, mod) % mod
x, y = map(int, input().split())
if (x+y) % 3 != 0:
print(0)
exit(... |
p03293 | s674312797 | Wrong Answer | #AtCorder Begginer Contest 103 - String Rotation
S=input()
T=input()
flg=0
for i in range(len(T)):
T=T[-1]+T[:-1]
if S == T:
print("YES")
break
else:
print("NO")
|
p02761 | s565100819 | Wrong Answer | N, M = map(int, input().split())
digits = [-1 for _ in range(N+1)]
for __ in range(M):
digit, num = map(int, input().split())
if digit == 1 and num == 0:
print(-1)
exit()
elif digits[digit] != -1 and num != digits[digit]:
print(-1)
else:
digits[digit] = num
answer = 0
for i in range(1, N+1):
i... |
p02719 | s880920995 | Accepted | N,K = map(int,input().split())
a = N % K
if K - a < a:
print(K-a)
else:
print(a) |
p03387 | s153950098 | Wrong Answer | a,b,c=map(int,input().split())
print((max(a,b,c)*3-(a+b+c))//2)
|
p02665 | s750971354 | Wrong Answer | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = map(int, read().split())
INF = 1 << 30
bound = [0] * (N + 1)
bound[0] = 1
ok = True
for n in range(1, N + 1):
bound[n] = min(INF, (bound[n - 1] - A[n - 1]) * 2)
if bound[n] < A[n]:
... |
p03379 | s948053824 | Wrong Answer | N = int(input())
X = list(map(int, input().split()))
for i in range(N):
if i>N/2:
print(X[N//2])
else:
print(X[N//2-1]) |
p02766 | s234962354 | Accepted | n,k = list(map(int,input().split()))
count = 1
while True:
if n < k ** count:
break
else:
count += 1
print(count) |
p03860 | s664329209 | Accepted | s = input().split()[1]
print('A'+s[0]+'C') |
p03695 | s418313447 | Accepted | import collections as c
input();a=c.Counter(i//400 for i in [*map(int,input().split())])
b,c=len(set([i for i in a.keys()if i<8])),sum([j for i,j in a.items()if i>=8])
print([b,1][b==0],b+c) |
p03407 | s833988601 | Accepted | a, b, c = map(int, input().split())
print('Yes' if c <=a+b else 'No') |
p03359 | s350590365 | Accepted | a,b=map(int,input().split())
print(a-(b<a)) |
p03745 | s190731385 | Wrong Answer | n = int(input())
L = list(map(int, input().split()))
cnt = 1
L2 = [''] * (n - 1)
for i in range(n - 1):
L2[i] = L[i + 1] - L[i]
j = 0
flag = 1
for j in range(n - 1):
if flag == 1:
prev = L2[j]
flag = 0
else:
if L2[j] * prev < 0:
prev = L2[j]
cnt += 1
... |
p03416 | s072432197 | Accepted | #ABC090-B
a,b = map(int,input().split())
def kaibun(n):
flg = True
for i in range(len(str(n))//2):
if str(n)[i] != str(n)[-1-i]:
flg = False
break
if flg:
return True
else:
return False
cnt = 0
for i in range(a,b+1):
if kaibun(i):
... |
p03285 | s816623519 | Wrong Answer | a = int(input())
b = a % 28
c = b % 7
d = c % 4
if c % 4 ==0:
print('Yes')
exit()
elif d % 7 ==0:
print('Yes')
exit()
print('No') |
p02701 | s543183678 | Accepted | n = int(input())
a = [input() for _ in range(n)]
a.sort()
cnt = 1
for i in range(1, n):
if a[i-1] != a[i]:
cnt += 1
print(cnt) |
p03107 | s512833082 | Accepted | S=input()
stack=[]
count=0
for s in S:
if not stack:
stack.append(s)
elif stack[-1]!=s:
stack.pop()
count+=2
else:
stack.append(s)
print(count) |
p02802 | s038031825 | Accepted | N,M = list(map(int,input().split()))
ac = [0]*N
wa = [0]*N
for i in range(M):
p,s = list(map(str,input().split()))
p = int(p)
if s == 'AC':
ac[p - 1] = 1
elif s == 'WA':
if ac[p - 1] == 0:
wa[p - 1] += 1
for i in range(N):
if ac[i] == 0:
wa[i] = 0
print(sum(ac),su... |
p02646 | s300492429 | Accepted | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
if a != b:
print('NO')
else:
print('YES')
else:
if abs(a - b) <= abs(v - w) * t:
print('YES')
else:
print('NO')
|
p02835 | s169842145 | Accepted | # input
A1, A2, A3 = map(int, input().split())
if sum([A1, A2, A3]) >= 22:
print("bust")
else:
print("win") |
p02595 | s293218855 | Wrong Answer | import sys
a = []
for l in sys.stdin:
a.append(l)
N,D = a[0].split(' ')
N = int(N)
D = int(D)
D = D*D
x = []
y = []
count = 0
dist = 0.0
for i in range(1,N):
x, y = a[i].split(' ')
x = int(x)
y = int(y)
dist = x*x+y*y
if dist <= D:
count = count + 1
print(count) |
p03565 | s802934522 | Accepted | import re
def solve(s, t):
s = s.replace('?', '.')
ls, lt = len(s), len(t)
if(ls < lt):
return 'UNRESTORABLE'
ans = []
for i in range(ls - lt + 1):
result = re.match(s[i:i + lt], t)
if result is None:
continue
ans.append((s[:i] + t + s[i + lt:]).replace... |
p03719 | s078917659 | Wrong Answer | def check(A,B,C):
if A < C and C < B:
return Yes
return No |
p03359 | s716507296 | Accepted | a,b = map(int,input().split())
print( a-1 if a>b else a)
|
p03795 | s493424005 | Accepted | N = int(input())
x = N * 800
# //は切り捨ての除算
# 例えば、5//2の時は求まる2となる。5/2の時の商のみ。
y = N // 15 * 200
print(x - y)
|
p02718 | s488906771 | Wrong Answer | N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = sum(x >= (sum(A) // (4 * M)) for x in A)
print('Yes' if ans >= M > 0 else 'No')
|
p03457 | s434262144 | Accepted | n = int(input())
prev_t, prev_x, prev_y = 0, 0, 0
for _ in range(n):
t, x, y = map(int, input().split())
if (abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and
(abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2):
prev_t, prev_x, prev_y = t, x, y
continue
else:
prin... |
p02642 | s174433096 | Accepted | N = int(input())
A_list = list(map(int, input().split()))
M = 10**6+1
cnt = [0 for _ in range(M)]
for i in A_list:
if cnt[i] != 0:
cnt[i] = 2
continue
for j in range(i, M, i): cnt[j] += 1
ans = 0
for k in A_list:
if cnt[k] == 1: ans += 1
print(ans) |
p02952 | s272724172 | Accepted | X = input()
def solve(X):
if X == '0':
return 0
if len(X) % 2 == 0:
ans = 0
y = len(X)
while (y > 1):
if y % 2 == 0:
ans += 9 * 10**(y-2)
y -= 2
return ans
else:
ans = int(X) - 10**(len(X)-1) + 1
return ans + s... |
p03250 | s894958175 | Wrong Answer | A,B,C=sorted(input().split())
print(int(A+B)+int(C)) |
p02600 | s830604578 | Wrong Answer | x = int(input())
if x >= 1800:
print(1)
elif x >= 1600:
print(2)
elif x >= 1600:
print(2)
elif x >= 1400:
print(3)
elif x >= 1200:
print(4)
elif x >= 1000:
print(5)
elif x >= 800:
print(6)
elif x >= 600:
print(7)
elif x >= 800:
print(8)
|
p03017 | s800675619 | Accepted | n, a, b, c, d = map(int, input().split())
s = ['S'] + list(input())
for i in range(a, max(c, d)):
if s[i] == '#' and s[i-1] == '#':
print('No')
exit()
if c < d:
print('Yes')
else:
for i in range(b, d+1):
if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
print('Yes')
... |
p02697 | s736250583 | Accepted | N, M = map(int, input().split())
if M % 2 == 0:
m = (2 * M + 1) // 2 + 1
else:
m = (2 * M + 1) // 2
i = 1
while i <= m // 2:
print(i, m - i + 1)
i += 1
j = 1
while j <= (2 * M + 1 - m) // 2:
print(m + j, (2 * M + 1) - j + 1)
j += 1
|
p02946 | s211470326 | Accepted | import sys
k, x = map(int, sys.stdin.readline().split())
def main():
l = max(-10 ** 6, x - (k - 1))
r = min(10 ** 6, x + (k - 1))
return range(l, r + 1)
if __name__ == '__main__':
ans = main()
print(*ans, sep =' ') |
p03745 | s972551681 | Wrong Answer | N = int(input())
A = [int(_) for _ in input().split()]
flag=0
count=1
for j in range(0,N-1):
if A[j]>A[j+1] and flag==1:
count+=1
flag=0
elif A[j]>A[j+1] and flag==0:
flag=-1
elif A[j]<A[j+1] and flag==-1:
count+=1
flag=0
elif A[j]<A[j+1] and flag==0:
... |
p03803 | s590448669 | Accepted | a, b = map(int, input().split())
if a == b:
print("Draw")
elif a == 1:
print("Alice")
elif b == 1:
print("Bob")
elif a > b:
print("Alice")
else:
print("Bob") |
p03351 | s485129368 | Wrong Answer | a, b, c, d = map(int, input().split())
if (abs(a - b) <= d and abs(b - c) <= d) or abs(a - c) < d:
print('Yes')
else:
print('No') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.