problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02697 | s016342083 | Wrong Answer | n,m=map(int,input().split())
for i in range (1,m+1):
a=i
b=n-i
print (a,b)
|
p02705 | s595146673 | Accepted | import math
R = int(input())
print(math.pi*2*R) |
p02748 | s288999398 | Accepted |
N_A, N_B, N_M = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
B = list(map(int,input().split(" ")))
M = [list(map(int,input().split(" "))) for i in range(N_M)]
candidates = [min(A)+min(B),]
for m in M:
#print(A[m[0]-1] + B[m[1]-1] - m[2])
candidates.append(A[m[0]-1] + B[m[1]-1] - m[2])
print(min(candidates)) |
p03544 | s589279864 | Wrong Answer | N = int(input())
if N == 1:
print(1)
exit()
L = [0]*(N+1)
for i in range(2, N+1):
L[i] = L[i-1] + L[i-2]
print(L[N])
|
p02833 | s548750669 | Accepted | N = int(input())
if N % 2 > 0 or N < 10:
print(0)
exit()
else:
#S = str(N)[::-1]
ans = 0
N = N // 10
for i in range(50):
ans += N
N = N // 5
print(ans) |
p03035 | s579562077 | Accepted | a,b = map(int,input().split())
if a >= 13:
print(b)
elif 6 <= a <= 12:
print(b//2)
else:
print(0) |
p02554 | s934566763 | Accepted | n=int(input())
print((10**n-9**n-9**n+8**n)%(10**9+7)) |
p03030 | s773416555 | Wrong Answer | N = int(input())
sp_list = []
sorted_list = []
for i in range(N):
S,P = map(str, input().split(' '))
sorted_list.append([S,P])
sp_list.append(S + ' ' + P)
sorted_list = sorted(sorted_list, key=lambda x:(x[1]), reverse=True)
sorted_list = sorted(sorted_list, key=lambda x:(x[0]))
for i in range(N):
count=1
for j in range(N):
if sp_list[i] == sorted_list[j][0]+' '+sorted_list[j][1]:
print(count)
break
count+=1
|
p02918 | s873144848 | Wrong Answer | n, k = map(int, input().split())
s = input()
if n == 1:
print(0)
exit()
two = 0
pre = s[0]
cont = 1
ans = 0
for c in s[1:]:
if c != pre:
if c == s[0]:
two += 1
ans += cont - 1
cont = 1
pre = c
else:
cont += 1
ans += cont - 1
if s[0] != s[1]:
ans += 1
print(ans + 2 * min(k, two)) |
p03836 | s608877495 | Wrong Answer | sx,sy,tx,ty = map(int,input().rstrip().split(" "))
dx = tx - sx
dy = ty-sy
ans = ""
ans += "R"*dx + "U" * dy
ans += "L" * dx + "D" * dy
ans += "D" + "R" * (dx + 1) + "U" * (dy + 1)
ans += "U" + "L" * (dx + 1) + "D" * (dy + 1)
print(ans) |
p02866 | s902520980 | Accepted | N=int(input())
D=list(map(int,input().split()))
MOD=998244353
goal=-1
tree=[0]*(N)
ans=1
for i in range(N):
a=D[i]
goal=max(a,goal)
tree[a]+=1
if tree[0]==1 and D[0]==0:
for i in range(1,goal+1):
ans*=pow(tree[i-1],tree[i],MOD)
ans%=MOD
print(ans)
else:
print(0) |
p02918 | s156819008 | Accepted | N, K = map(int, input().split())
S = input()
segs = []
prev = "x"
for c in S:
if c != prev:
segs.append([c])
else:
segs[-1].append(c)
prev = c
ans = sum(len(seg) - 1 for seg in segs)
print(min(ans + 2 * K, N - 1))
|
p03910 | s242710590 | Wrong Answer | n = int(input())
sum_i = 0
for i in range(n):
i += 1
# 足しても大丈夫なとき
if n - (sum_i + i) >= i:
sum_i += i
print(i)
else:
print(n - sum_i)
break |
p03012 | s803222838 | Accepted | n=int(input())
w=list(map(int,input().split()))
m=max(w)
for _ in range(n):
m=min(m,abs(sum(w[:_])-sum(w[_:])))
print(m) |
p02848 | s429006236 | Accepted | n=int(input())
s=input()
ans=''
for t in s:
ord_t=ord(t)
ord_t+=n
if(ord_t>ord('Z')):
ord_t-=26
ans+=chr(ord_t)
print(ans) |
p03387 | s704482332 | Accepted | a, b, c = map(int, input().split())
res1 = a+b+c
res2 = max(a, b, c)*3
if (res2-res1)%2==0:
print((res2-res1)//2)
else:
res3 = (max(a, b, c)+1)*3
print((res3-res1)//2) |
p02681 | s069751905 | Wrong Answer | A = input()
B = input()
C = B[:len(B)-2]
if A == C:
D = "Yes"
else:
D = "No"
print(D) |
p02665 | s336597506 | Wrong Answer | n= int(input())
a = list(map(int, input().split()))
#print(a)
if a[0] != 0:
print(-1)
exit(0)
b=1
count=1
asum =sum(a)
alim = asum
for i in range(n-1):
if a[i+1] > 2*b:
print(-1)
exit(0)
else:
alim = alim - a[i+1]
b= min(2*b-a[i+1], alim)
count += b
print(count+ asum) |
p02802 | s247297514 | Wrong Answer | N, M = map(int, input().split())
p = []
S = []
for _ in range(M):
n, s = input().split()
p.append(int(n))
S.append(s)
wa = 0
ac = 0
ac_list = []
for i, s in enumerate(S):
if p[i] not in ac_list:
if s == "WA":
wa += 1
else:
ac += 1
ac_list.append(p[i])
print(ac, wa) |
p02627 | s947385310 | Accepted | a=input()
if a==a.upper():
print("A")
else:
print("a") |
p03067 | s975253933 | Wrong Answer | a,b,c = map(int,input().split())
if a <= c <= b:
print("Yes")
else:
print("No") |
p03286 | s720021504 | Accepted | N = int(input())
if N == 0:
print("0")
else:
ans = []
p = 1
while 2**(p-1) <= abs(N):
if N%(2**p) > 0:
ans.append("1")
N -= (-2)**(p-1)
else:
ans.append("0")
p += 1
print("".join(ans[::-1]))
|
p02947 | s744319937 | Accepted | N = int(input())
s = []
for i in range(N):
s.append(sorted(input()))
s.sort()
ans = 0
tmp = 1
for i in range(N-1):
if s[i] == s[i + 1]:
tmp += 1
else:
ans += tmp * (tmp-1) // 2
tmp = 1
ans += tmp * (tmp-1) // 2
print(ans) |
p03673 | s978895623 | Accepted |
N = int(input())
A = list(map(int, input().split()))
B = [0] * N
if N % 2 == 0:
for i in range(N):
if i % 2 == 0:
B[N//2+i//2] = A[i]
else:
B[N//2-(i//2+1)] = A[i]
else:
for i in range(N):
if i % 2 == 1:
B[N//2+(i//2+1)] = A[i]
else:
B[N//2-(i//2)] = A[i]
print(*B) |
p03069 | s006670236 | Accepted | _ = input()
S = input().lstrip('.').rstrip('#')
n = len(S)
x = 0
y = S.count('.')
c = min(n-y, y)
for i in range(n):
if S[i] == '#':
x += 1
else:
y -= 1
c = min(c, x+y)
print(c) |
p02939 | s864878130 | Accepted | s = input()
if(len(s) <= 2):
print(len(set(list(s))))
exit()
dp = [0 for _ in range(len(s)+1)]
dp[0] = 0
dp[1] = 1
dp[2] = len(set(list(s[:2])))
for i in range(3,len(s)+1):
if(s[i-1] != s[i-2]):dp[i] = dp[i-1] + 1
else:dp[i] = dp[i-3] + 2
print(dp[-1]) |
p02811 | s469945699 | Wrong Answer | a,b=map(int,input().split( ))
sum=a*500
if sum>=b:
print("Yes")
else:
print("NO")
exit() |
p03437 | s556780853 | Accepted | x, y = map(int, input().split())
if x % y == 0:
print(-1)
else:
print(x) |
p03417 | s440011256 | Accepted | n,m=map(int,input().split())
if n*m==1 :
ans=1
elif n==1 or m==1 :
ans=max(n,m)-2
else:
ans=(m-2)*(n-2)
print(ans) |
p02678 | s704768670 | Accepted | from collections import deque
n,m = map(int,input().split())
tuna = [[] for i in range(n+1)]
ans = [0 for i in range(n+1)]
for _ in range(m):
a,b = map(int,input().split())
tuna[a].append(b)
tuna[b].append(a)
q = deque()
q.append(1)
while q:
now = q.popleft()
saki = tuna[now]
for i in saki:
if ans[i] == 0:
q.append(i)
ans[i] = now
print("Yes")
for i in range(2,n+1):
print(ans[i]) |
p02831 | s511229361 | Accepted | a, b = map(int, input().split())
if a < b:
a, b = b, a
A = a
B = b
while a % b != 0:
a, b = b, a % b
print((A*B)//b)
|
p03962 | s359025018 | Accepted | abc=list(map(int , input().split()))
count=0
for i in range(0,len(abc)-1):
abc.sort()
if(abc[i] != abc[i+1]):
count+=1
print(count+1) |
p03206 | s807307833 | Wrong Answer | D = int(input())
A = ["Chrinstmas"]
for i in range(25 - D):
A.append("Eve")
S = ''.join(A)
print(S) |
p02621 | s424313884 | Accepted | def main():
import sys
def input():
return sys.stdin.readline()[:-1]
a=int(input())
print(a+a**2+a**3)
if __name__ == '__main__':
main()
|
p02987 | s628782040 | Accepted | a, b, c, d = input()
if (a == b and c == d and a != c) or (a == c and b == d and a != b) or (a == d and b == c and a != b):
print("Yes")
else:
print("No") |
p02995 | s695913142 | Accepted | import math
def lcm(x, y): # 最小公倍数
return (x * y) // math.gcd(x, y)
a, b, c, d = map(int, input().split())
lcm_cd = lcm(c, d)
under_b = b - b//c - b//d + b//lcm_cd
over_a = (a-1) - (a-1)//c - (a-1)//d + (a-1)//lcm_cd
print(under_b - over_a) |
p03012 | s185704907 | Wrong Answer | N = int(input())
W = [int(weight) for weight in input().split()]
sum_w = sum(W)
left_sum = 0
min = 10000
min_index = 0
for i in range(len(W)):
left_sum += W[i]
if abs(2*left_sum - sum_w) < min:
min = abs(2*left_sum - sum_w)
min_index = i
print(min_index)
|
p02912 | s721665459 | Wrong Answer | from math import floor
def main():
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
A.sort(reverse=True)
print(A)
while M > 0:
for i in range(0, N):
if A[i] > 2 and M > 0:
A[i] = floor(A[i] / 2)
M -= 1
print(A)
print(sum(A))
if __name__ == '__main__':
main() |
p03778 | s588577174 | Wrong Answer | w, a, b = map(int, input().split())
if a < b < a + w and a - w < b < a:
print(0)
elif not a < b < a + w:
print(b - a - w)
elif not a - w < b < a:
print(a - b - w) |
p03286 | s184025603 | Accepted | #!/usr/bin/env python
n = int(input())
if n == 0:
print(0)
exit()
ans = ''
while abs(n) > 0:
r = n%2
ans = str(r) + ans
if r == 1:
n -= 1
n //= (-2)
print(ans)
|
p02848 | s966416459 | Wrong Answer | n = int(input());
s = input();
ans = []
for i in s:
num = ord(i) + n;
#正規化
num = num - ord("a")
num = num % 26
print(num)
ans.append(chr(num + ord("a")))
new = ""
for j in ans:
new += j
print(new) |
p03624 | s162694212 | Wrong Answer | s = input()
s = sorted(s)
s = set(s)
alpha = 'a'
flg = 0
for i in range(1,26):
if (alpha not in s):
flg = 1
break
else : alpha = chr(ord(alpha)+1)
if (flg): print(alpha)
else: print("None")
|
p02939 | s432587090 | Accepted | S=input()
ans = 0
prev = ''
temp = ''
for c in S:
temp += c
if temp != prev:
ans += 1
prev = temp
temp = ''
print(ans)
|
p02924 | s599507509 | Accepted | n = int(input()) - 1
print(n*(n+1)//2) |
p03013 | s894172272 | Wrong Answer | N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
A = set(A)
mod = 1000000007
dp = [0] * (N + 1)
if len(dp) <= 2:
print(1)
dp[-1] = 1
dp[-2] = 1 if N - 1 not in A else 0
for i in range(N-2, -1, -1):
if i not in A:
dp[i] = dp[i+1] + dp[i+2]
print(dp[0] % mod)
|
p02777 | s284772924 | Wrong Answer | import sys
input = sys.stdin.readline
def resolve():
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()
if S == U:
A -= 1
print(str(A) + ' ' + str(B))
return
B -= 1
print(str(A) + ' ' + str(B))
resolve()
|
p02707 | s874060111 | Accepted | from collections import Counter
N = int(input())
d = Counter(map(int, input().split()))
for i in range(1, N+1):
print(d[i])
|
p02911 | s803577101 | Accepted | N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
S = [0]*N
for i in A:
S[i-1] += 1
for i in range(N):
if Q-S[i] < K:
print("Yes")
else:
print("No")
|
p02784 | s936221463 | Accepted | H, N = map(int, input().split())
A = map(int, input().split())
if sum(A) >= H:
print("Yes")
else:
print("No")
|
p03799 | s345599360 | Wrong Answer | N,M = map(int, input().split())
# N : Sの数
# M : Cの数
if M <= 2*N: #Cの数が少ない
print(N)
else:
cnt = N
M -= 2*N
print(cnt+M//4) |
p03548 | s213712767 | Accepted | X, Y, Z = map(int, input().split())
print((X - Z) // (Y + Z)) |
p02711 | s327968103 | Wrong Answer | from random import random
print(['Yes', 'No'][random() < 0.5]) |
p02761 | s574200048 | Accepted | f = True
n,m=map(int,input().split())
number = [-1 for i in range(n)]
for i in range(m):
s,c=list(map(int,input().split()))
s -= 1
if s == 0 and c == 0 and n > 1:
f = False
elif number[s] == -1 or number[s] == c:
number[s] = c
else:
f = False
if not f:
print(-1)
elif n == 1:
if number[0] == -1:
print(0)
else:
print(number[0])
else:
if number[0] == -1:
number[0] = 1
for i in range(1,n):
if number[i] == -1:
number[i] = 0
print(''.join(map(str,number))) |
p03624 | s972610969 | Accepted | str = input()
alpha = [chr(i) for i in range(ord('a'), ord('z')+1)]
ans = "None"
for id in alpha:
if id not in str:
ans = id
break
print(ans) |
p03377 | s580121620 | Accepted | a,b,x=map(int,input().split())
if a>x or (a+b)<x:
print('NO')
else:
print('YES')
|
p03625 | s954087047 | Accepted | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
dic = Counter(a)
l = []
for i, j in dic.items():
if j >= 4:
l.append(i)
l.append(i)
elif j >= 2:
l.append(i)
if len(l) < 2:
print(0)
else:
l.sort()
print(l[-1] * l[-2]) |
p03481 | s773155875 | Accepted | X, Y = map(int, input().split())
twoLine = [2 ** (i) for i in range(61)]
for i in range(len(twoLine)):
if X * twoLine[i] > Y:
print(i)
exit()
|
p02922 | s739715572 | Accepted | import math
A, B = map(int, input().split())
print(math.ceil((B - A) / (A - 1)) + 1) |
p02744 | s217309901 | Accepted | k = "a",
for _ in range(int(input()) - 1):
k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n') |
p03328 | s235000952 | Accepted | a,b=map(int,input().split())
A=[]
c=1
for i in range(2,1001):
A.append(c)
c+=i
d=b-a
print(A[d-2]-a) |
p03338 | s537952423 | Wrong Answer | import sys
import math
import bisect
def solve(s):
n = len(s)
max_val = 0
for i in range(1, n):
s1 = set(list(s[0:i]))
s2 = set(list(s[i:]))
val = len(s1 ^ s2)
max_val = max(max_val, val)
return max_val
def main():
n = int(input())
s = input()
print(solve(s))
if __name__ == "__main__":
main()
|
p03012 | s503838593 | Accepted | n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
total = 0
ans = 1000
for i in range(n):
total += w[i]
ans = min(ans, abs(sum_w - 2 * total))
print(ans)
|
p03059 | s814906058 | Accepted | a,b,t = map(int,input().split())
x = 0
for i in range(100):
if a * i <= t: x = i
print(x * b) |
p03457 | s044032512 | Accepted | n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
t,x,y = map(int, input().split())
if abs(t-temp)>=abs(x-xtemp)+abs(y-ytemp) and (x-xtemp+y-ytemp-(t-temp))%2==0:
count=count+1
temp=t
xtemp=x
ytemp=y
if count==n:
print("Yes")
else:
print("No") |
p03328 | s516062708 | Wrong Answer | a, b = map(int, input().split())
height_a = 0
height_b = 0
for i in range(999):
height_a += i
if a < height_a:
break
for i in range(999):
height_b += i
if b < height_b:
break
print(height_b - b) |
p02935 | s896347559 | Wrong Answer | n = int(input())
arr = list(map(int, input().split()))
for _ in range(n - 1):
arr.sort()
new_v = (arr[0] + arr[1]) / 2
del arr[0:2]
arr.append(new_v)
print(int(arr[0]))
|
p03815 | s123508699 | Wrong Answer | def main():
x=int(input())
s=2*(x//11)+1
print(s if 0<x%11<6 else s+1)
main() |
p02866 | s107220660 | Accepted | # https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_b
# まず、本当に木を構築するモノではないだろう
from collections import Counter
n = int(input())
nums = [int(i) for i in input().split()]
mod = 998244353
MAX = max(nums)
c = Counter(nums)
if nums[0] != 0 or nums.count(0) != 1:
ans = 0
else:
ans = 1
for i in range(1, MAX + 1):
ans = ans * pow(c.get(i - 1, 0), c.get(i, 0), mod) % mod
ans %= mod
print(ans) |
p02642 | s965212432 | Accepted | from collections import Counter
N = int(input())
A = sorted(map(int, input().split()), reverse=False)
m = max(A)+1
c = Counter(A)
s = list(set(A))
dp = [True] * m
for x in list(set(A)):
t = x * 2
while t < m:
dp[t] = False
t += x
ans = 0
for a in A:
if c[a] == 1 and dp[a]:
ans += 1
print(ans)
|
p04029 | s655191819 | Wrong Answer | N = int(input())
S = N*(N+1)/2
print(S)
|
p03795 | s142338640 | Wrong Answer | n = int(input())
if n >= n % 15 == 0:
x = n * 800
y = 200 * n / 15
answer = x - y
print(answer)
else:
answer = n * 800
print(answer) |
p03760 | s015232776 | Accepted | o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="") |
p02657 | s321066456 | Accepted | (a,b) = map(int,input().split())
print(a*b) |
p02622 | s934755849 | Accepted | S = input()
T = input()
cnt = 0
for s, t in zip(S, T):
if s != t:
cnt += 1
print(cnt)
|
p03251 | s659830598 | Accepted | n, m, X, Y = map(int, input().split())
x = max(list(map(int, input().split())))
y = min(list(map(int, input().split())))
if x >= y or X >= y or X >= Y or Y <= x:
ans = "War"
else:
ans = "No War"
print(ans) |
p02623 | s590134927 | Wrong Answer | n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
for s in range(n+m):
if i>k:
if a[0]>=b[0]:
i = i + a[0]
del a[0]
else:
i = i + b[0]
del a[0]
elif i==k:
print(s+1)
else:
print(s) |
p02663 | s754626105 | Accepted | H1,M1,H2,M2,K=map(int,input().split())
print((H2-H1)*60+(M2-M1)-K) |
p02727 | s632864364 | Accepted | #!/usr/bin/env python3
def main():
x, y, a, b, c = map(int, input().split())
p = map(int, input().split())
q = map(int, input().split())
r = map(int, input().split())
p = list(reversed(sorted(p)))[:x]
q = list(reversed(sorted(q)))[:y]
pq = sorted(p + q)
r = list(reversed(sorted(r)))
for i in range(min(len(pq), len(r))):
pq[i] = max(pq[i], r[i])
print(sum(pq))
if __name__ == "__main__":
main()
|
p03696 | s023786266 | Accepted | N = int(input())
S = input()
ans = S
cnt = 0
now = ""
for s in S:
now = s
if s == "(":
cnt += 1
elif s == ")":
cnt -= 1
if cnt == -1:
ans = "(" + ans
cnt = 0
if cnt > 0:
ans = ans + ")"*cnt
print(ans) |
p03861 | s425853335 | Wrong Answer | (a,b,x) = map(int,input().split())
if a==0:
print(int(b/x)+1)
else:
print(int(b/x)-int((a-1)/x)) |
p03723 | s455580505 | Wrong Answer | a, b, c = map(int, input().split())
if a == b == c:
print(-1)
exit()
cnt = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
cnt += 1
print(cnt)
|
p03698 | s730937742 | Accepted | s=list(input())
l=len(s)
a=len(set(s))
if a==l:
print('yes')
else:
print('no') |
p02784 | s228310341 | Accepted | h,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
if h - sum(a) <= 0:
print("Yes")
else:
print("No") |
p02646 | s962982455 | Wrong Answer | A,V = [int(v) for v in input().split()]
B,W = [int(v) for v in input().split()]
T = int(input())
A += int(1e9)
B += int(1e9)
if V * T + A >= W * T + B:
print("YES")
else:
print("NO")
|
p03827 | s706972660 | Accepted | N = int(input())
S = input()
li = [0]
x = 0
for i in range(N):
if S[i] == "I":
x += 1
else:
x -= 1
li.append(x)
print(max(li))
|
p03759 | s086232138 | Accepted | a, b, c = list(map(int, input().split()))
if b - a == c - b:
print('YES')
else:
print('NO') |
p02900 | s190830183 | Accepted | a,b = map(int,input().split())
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
print(len(set(prime_factorize(a))&set(prime_factorize(b)))+1) |
p02793 | s219266235 | Wrong Answer | from fractions import gcd
def lcm(x, y):
return x * y // gcd(x, y)
n = int(input())
A = list(map(int, input().split()))
lcmall = A[0]
for a in A:
lcmall = lcm(a, lcmall)
if lcmall == 1:
break
A.insert(0, 1)
A.insert(0, 1)
A.append(1)
A.append(1)
ans = 0
R = int(1e9) + 7
for i in range(2,n+2):
ans += A[i-2]*A[i-1]*A[i]*A[i+1]*A[i+2] // lcmall**5
if ans > R:
ans = ans % R
print(ans) |
p02860 | s310615975 | Accepted | N = int(input())
S = input()
if N % 2 !=0:
print("No")
elif S[0:int(N/2)] == S[int(N / 2):N]:
print("Yes")
else:
print("No") |
p02897 | s543283293 | Accepted | #!/usr/bin/env python3
# https://atcoder.jp/contests/abc142/tasks/abc142_a
n = int(input())
print(((n + 1) // 2) / n)
|
p02584 | s007523649 | Accepted | x, k, d = map(int, input().split())
if x < 0:
x = -x
if x >= k * d:
print(x - k * d)
else:
if (x // d) % 2 == 1:
if k % 2 == 1:
print(x % d)
else:
print(d - x % d)
else:
if k % 2 == 1:
print(d - x % d)
else:
print(x % d) |
p03017 | s672950893 | Accepted | n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a-1:c] or '##' in s[b-1:d]:
print('No')
else:
if d<c and '...' not in s[b-2:d+1]:
print('No')
else:
print('Yes')
|
p03962 | s701729080 | Accepted | lis = list(map(int, input().split()))
unique_list = []
for i in range(len(lis)):
if lis[i] in lis[:i] + lis[i+1:] and lis[i] in unique_list:
continue
unique_list.append(lis[i])
print(len(unique_list)) |
p02731 | s147966598 | Accepted | L = int(input())
a = float(L/3)
print(a**3) |
p02689 | s968783734 | Wrong Answer | N, K = map(int, input().split())
H = input().split()
H2 = [0] * N
for i in range(K):
a, b = map(int, input().split())
if H[a-1] > H[b-1]:
H2[b-1] = 1
elif H[a-1] < H[b-1]:
H2[a-1] = 1
elif H[a-1] == H[b-1]:
H2[b-1] = 1
H2[a-1] = 1
count = 0
for i in H2:
if i == 1:
count+=1
print(count) |
p02761 | s707669876 | Accepted | import sys
n,m=map(int,input().split())
number=[0]*n
for i in range(m):
s,c=map(int,input().split())
if s==1 and c==0 and n!=1:
print(-1)
sys.exit()
if number[s-1]==0:
number[s-1]=c
elif number[s-1]==c:
continue
else:
print(-1)
sys.exit()
if number[0]==0 and n!=1:
number[0]=1
answer=''
for i in range(len(number)):
answer+=str(number[i])
print(int(answer)) |
p02719 | s115886554 | Wrong Answer | n, k = list(map(int, input().split(' ')))
result = 0
if k < n:
result = n % k
elif n < k:
result = min(n, k-n)
print(result) |
p02787 | s150822285 | Wrong Answer | h, n = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
max_a = max(a)[0]
dp = [float('inf') for i in range(h + max_a + 1)]
dp[0] = 0
for i in range(1, h+max_a + 1):
dp[i] = min(dp[i-x]+y for x,y in a)
print(dp[h]) |
p03852 | s492968769 | Accepted | c = str(input())
vowels = ['a','e','i','o','u']
if c in vowels:
answer = 'vowel'
else:
answer = 'consonant'
print(answer) |
p04033 | s254403103 | Accepted | n,m=map(int,input().split())
if ((n<0 and m>0) or n==0 or m==0):
print("Zero")
if (n>0 and m>0):
print('Positive')
if (m<0):
if ((m-n)%2==0):
print("Negative")
else:
print("Positive") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.