problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p04043 | s554414034 | Accepted | A, B, C = map(int, input().split())
count_5 = 0
count_7 = 0
if A == 5:
count_5 += 1
elif A == 7:
count_7 += 1
if B == 5:
count_5 += 1
elif B == 7:
count_7 += 1
if C == 5:
count_5 += 1
elif C == 7:
count_7 += 1
if count_5 == 2 and count_7 == 1:
print("YES")
else:
print("NO")
|
p03761 | s829521730 | Wrong Answer | n = int(input())
S_List = [input() for _ in range(n)]
S = [ [X[j] for j in range(len(X))] for X in S_List]
common = []
common = S[0].copy()
for s in S:
for c in common:
if c in s:
s.remove(c)
else:
common.remove(c)
common.sort()
ans = ""
for c in common:
ans += c
print(ans)
|
p02953 | s835165289 | Accepted | import math
import os
import random
import re
import sys
def check_non_decreasing_squares(n: int, a: list):
p = a[0]
for i in range(1, n):
if a[i] > p:
p = a[i]
if p - a[i] == 1 or p - a[i] == 0:
continue
print("No")
exit(0)
print("Yes")
if __name__ == '__main__':
n = int(input())
a = list(map(int, input().rstrip().split()))
check_non_decreasing_squares(n, a) |
p03681 | s379200338 | Wrong Answer | from math import factorial
n, m = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
ans = 0
diff = abs(n - m)
if diff == 0:
ans = (factorial(n) * 2) * 2 % mod
elif diff == 1:
ans = factorial(n) * factorial(m) % mod
print(ans)
|
p02790 | s275082605 | Accepted | a,b = map(str,input().split())
a1 = a*int(b)
b1 = b*int(a)
print(min(a1,b1)) |
p02897 | s766192072 | Accepted | N = int(input())
if N % 2 == 0:
print(0.5)
else:
print((N+1)/(2*N)) |
p02682 | s171221964 | Wrong Answer | a,b,c,k=map(int,input().split())
if int(a) >= int(k):
print(int(a))
elif int(a + b) >= int(k):
print(int(a))
else:
print(int(a - (k-a-b))) |
p03730 | s056197593 | Accepted | a,b,c = map(int,input().split())
ans = 'NO'
for i in range(1,b+1):
if (a*i)%b == c:
ans = 'YES'
break
print(ans) |
p03037 | s544271588 | Accepted | n,m = map(int,input().split())
A = [list(map(int,input().split())) for i in range(m)]
ma = 0
mi = float("INF")
for i in range(0,m):
ma = max(ma,A[i][0])
mi = min(mi,A[i][1])
ans = mi-ma+1
if ans >0:
print(ans)
else :
print(0) |
p03220 | s365989202 | Accepted | N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
num = 0
dif = 10000000
for n in range(N):
C = T-H[n]*0.006
if dif > abs(A-C):
dif = abs(A-C)
num = n+1
print(num) |
p03274 | s331916459 | Accepted | import bisect
N, K = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
ans = []
bisect.insort_left(xs, 0)
for l in range(len(xs)):
if l+K < len(xs):
xl = xs[l]
xr = xs[l+K]
elif l-K > -1:
xl = xs[l-K]
xr = xs[l]
else:
continue
tmp1 = abs(xl) + abs(xr-xl)
tmp2 = abs(xr) + abs(xr-xl)
ans.append(min(tmp1, tmp2))
print(min(ans))
|
p03150 | s357805789 | Accepted | s = input()
key = "keyence"
l = len(key)
if s[:l] == key or s[-l:] == key:
print("YES")
exit()
for i in range(l):
if s[:i] == key[:i] and s[-(l-i):] == key[-(l-i):]:
print("YES")
exit()
else:
print("NO") |
p03285 | s753723632 | Accepted | n = int(input())
a = [1,2,3,5,6,9,10,13,17]
if n in a:
print('No')
else:
print('Yes') |
p02996 | s173141097 | Accepted | N = int(input())
data = []
for _ in range(N):
A, B = map(int, input().split())
data.append([B, A])
data.sort()
prefix_cost = []
current_cost = 0
for i in range(N):
current_cost += data[i][1]
prefix_cost.append(current_cost)
for i in range(N):
if not prefix_cost[i] <= data[i][0]:
print('No')
exit()
print('Yes')
|
p02732 | s783045021 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * N
for a in A:
cnt[a - 1] += 1
combination = [0] * N
for a in A:
combination[a - 1] = cnt[a - 1] * (cnt[a - 1] - 1) // 2
total = sum(combination)
for a in A:
c = combination[a - 1]
b = cnt[a - 1]
ans = total - c + c * (b - 2) // b
print(ans)
|
p03359 | s906375592 | Accepted | a,b = map(int,input().split())
print(a if a<=b else a-1) |
p02922 | s629072140 | Accepted | x = list(map(int, input().split()))
count = 0
a = 0
while a+1 < x[1]:
a += (x[0]-1)
count += 1
print(count) |
p03471 | s035961475 | Wrong Answer | def resolve():
N, Y = map(int, input().split())
if Y % 1000 != 0 or Y > 10000 * N:
print("-1 -1 -1")
return
b10k = Y // 10000
Y -= b10k * 10000
b5k = Y // 5000
Y -= b5k * 5000
bk = Y // 1000
print("-1 -1 -1") if b10k + b5k + bk > N else print(b10k, b5k, bk)
if __name__ == "__main__":
resolve() |
p02801 | s522392007 | Accepted | print('abcdefghijklmnopqrstuvwxyz'['abcdefghijklmnopqrstuvwxyz'.index(input())+1]) |
p02689 | s299771684 | Wrong Answer | n,m = map(int, input().split())
h = [0]
h.extend([int(i) for i in input().split()])
bld = [0]*(n+1)
for i in range(m):
a,b = map(int, input().split())
if h[a]>h[b]:
bld[b] += 1
elif h[a]<h[b]:
bld[a] += 1
print(bld.count(0)-1) |
p02879 | s092729820 | Accepted | a = list(map(int,input().split()))
print(a[0]*a[1] if a[0] <= 9 and a[1] <= 9 else -1) |
p03087 | s472193241 | Accepted | N,Q=map(int,input().split())
S=input()
AC=[0]*N
cnt=0
for i in range(N-1):
if S[i]+S[i+1]=='AC':
AC[i]=cnt
cnt+=1
AC[i+1]=cnt
else:
AC[i],AC[i+1]=cnt,cnt
for _ in range(Q):
l,r=map(int,input().split())
print(AC[r-1]-AC[l-1]) |
p02676 | s965275591 | Accepted | def main():
num = int(K)
if num >= len(S):
print(S)
else:
print(S[:num]+'...')
K = int(input())
S = input()
main()
|
p03329 | s421200445 | Wrong Answer | n = int(input())
ans = n
for i in range(1, n+1):
j = n-i
a = j
p = 0
while a>0:
p += a%6
a = a//6
b = i
q = 0
while b>0:
q += b%9
b = b//9
ans = min(ans, p+q)
print(ans) |
p02963 | s322518858 | Accepted | s = int(input())
ans, num = [0, 0, 10 ** 9, 1], 10 ** 9
if s % num == 0:
ans += [0, s // num]
elif s % num != 0:
ans += [num - s % num, s // num + 1]
print(*ans)
|
p03861 | s517992754 | Accepted | a,b,x=map(int,input().split())
temp1=(b//x)+1
if 0<=a-1:
temp2=((a-1)//x)+1
else:
temp2=0
print(temp1-temp2)
|
p03243 | s563713781 | Accepted | n = int(input())
while True:
if n%111 == 0:
print(n)
break
n += 1 |
p03698 | s110866230 | Wrong Answer | s=input()
for x in s:
if s.count(x)==1:
print("yes")
break
else:
print("no") |
p02727 | s910066533 | Wrong Answer | X, Y, A, B, C = map(int, input().split())
Ap = list(map(int, input().split()))
Bq = list(map(int, input().split()))
Cr = list(map(int, input().split()))
Ap.sort()
Bq.sort()
print(Ap[A-X:] + Bq[B-Y:] + Cr)
print(sum(sorted(Ap[A-X:] + Bq[B-Y:] + Cr)[C:])) |
p03693 | s517519458 | Wrong Answer | x,y,z = map(int,input().split())
y %= 4
if y == 0:
if z % 4 ==0:
print("YES")
exit()
if y == 1:
if z % 4 == 2:
print("Yes")
exit()
if y == 2:
if z % 4 == 0:
print("Yes")
exit()
if y == 3:
if z % 4 == 2:
print("Yes")
exit()
print("No") |
p02629 | s645561268 | Accepted | n = int(input())
a = 26
keta = 1
nn = 0
while n > 0:
if n > a:
keta += 1
n -= a
a *= 26
else:
nn = n - 1
n -= a
#nnを桁数をketaとして26進法で表す
l = []
for i in range(keta):
amari = nn % 26
nn = nn // 26
l.append(amari)
revl = []
for i in range(len(l)-1,-1,-1):
revl.append(l[i]+97)
ansl = []
for i in revl:
ansl.append(chr(i))
print("".join(ansl))
|
p03434 | s503372790 | Wrong Answer | n = int(input())
a_char = input().split(" ")
a_char.sort(reverse=True)
fugo=1
sum = 0
for i in range(0, n):
sum += (int(a_char[i]) * fugo)
fugo = fugo * -1
print(sum) |
p02681 | s788360997 | Accepted | original = input()
new = input()
num = len(original)
ans = "Yes"
for i in range(num):
if original[i] != new[i]:
ans = "No"
break
print(ans) |
p02994 | s936522644 | Accepted | n, l = map(int, input().split())
a = []
for i in range(l, n + l):
a.append(i)
if a[0] > 0:
b = a.pop(0)
elif a[n - 1] < 0:
b = a.pop(n - 1)
else:
for j in range(n):
if a[j] == 0:
b = a.pop(j)
break
print(sum(a)) |
p02576 | s432930895 | Accepted | n,x,t = map(int,input().split())
if n%x == 0:
print(n//x*t)
else:
print((n//x+1)*t) |
p02729 | s198999121 | Wrong Answer | import math
a=0
b=3
answer = 0
#偶数2
if a != 0:
answer += math.factorial(a) / (math.factorial(a - 2)*2)
#奇数2
if b != 0:
answer += math.factorial(b) / (math.factorial(b - 2)*2)
print(int(answer)) |
p03274 | s125032411 | Accepted | N,K=map(int,input().split())
x=list(map(int,input().split()))
ans=0
j=0
for i in range(N):
if i==K-1:
ans=min(abs(x[K-1]-x[0])+abs(x[K-1]),abs(x[K-1]-x[0])+abs(x[0]))
elif i>=K:
bns=min(abs(x[i]-x[i-K+1])+abs(x[i]),abs(x[i]-x[i-K+1])+abs(x[i-K+1]))
ans=min(ans,bns)
print(ans) |
p03481 | s148286802 | Accepted | X,Y = map(int,input().split())
count = 0
A = X
while(A<=Y):
count+=1
A *= 2
print(count) |
p03657 | s890157008 | Wrong Answer | line = input().split(' ')
if (int(line[0])+int(line[1]))%3 == 0:
print("Possible")
else:
print("Impossible") |
p02951 | s480426990 | Accepted | a,b,c = map(int,input().split())
if a-b>=c:
print(0)
else:
print(c-(a-b)) |
p02879 | s720719744 | Accepted | import sys
input = sys.stdin.readline
A, B = map(int, input().split())
if A < 10 and B < 10:
print(A*B)
else:
print(-1) |
p02946 | s145565420 | Accepted | K, X = map(int, input().split())
List=[]
i=X-K+1
while i<=X+K-1:
if i < -1000000 or i>1000000:
pass
else:
List.append(i)
i+=1
print(*List)
|
p02771 | s997090527 | Wrong Answer | a,b,c = map(int,input().split())
if a == b and b == c:
print("No")
elif a != b and b != c:
print("No")
else:
print("Yes")
|
p03475 | s070696269 | Accepted | import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
N = I()
CSF = [tuple(MI()) for i_ in range(N-1)]
for i in range(N):
time = 0
for j in range(i,N-1):
c,s,f = CSF[j]
if time < s:
time = s
else:
time = s+f*((time-s+f-1)//f)
time += c
print(time)
|
p02957 | s386293584 | Accepted | a,b=[int(x) for x in input().split()]
k=(a+b)//2
if (a+b)%2==0:
print(k)
else:
print("IMPOSSIBLE") |
p03457 | s764927164 | Accepted | N = int(input())
t = [0 for _ in range(N + 10)]
x = [0 for _ in range(N + 10)]
y = [0 for _ in range(N + 10)]
res = 'Yes'
for i in range(N):
t[i], x[i], y[i] = map(int, input().split(' '))
for i in range(N):
if abs(x[i]) + abs(y[i]) <= t[i] and (abs(x[i]) + abs(y[i])) % 2 == t[i] % 2:
x[i + 1] -= x[i]
y[i + 1] -= y[i]
t[i + 1] -= t[i]
else:
res = 'No'
break
print(res) |
p02912 | s726604623 | Accepted | import heapq
n,m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)
while m > 0:
x = heapq.heappop(A)*(-1)
x //= 2
A.append(-x)
m -= 1
print(abs(sum(list(A)))) |
p03438 | s988336893 | Accepted | n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = 0
for i in range(n):
ai = a[i]
bi = b[i]
if ai < bi:
c += (bi-ai)//2
else:
c -= (ai-bi)
print('Yes' if c >= 0 else 'No')
|
p04012 | s702061147 | Accepted | N=input()
for i in range(len(N)):
if N.count(N[i])%2==0:
if i==len(N)-1:
print("Yes")
continue
else:
print("No")
break |
p02708 | s939760944 | Wrong Answer | if __name__ == '__main__':
a,b= map(int,input().split())
maxnum =0
minnum =0
for i in range(0,b):
minnum+=i
for i in range(0,b):
maxnum+=(a-i)
ans = maxnum-minnum
ans = int(ans*(ans+1)/2)
print(ans)
|
p02546 | s764190367 | Wrong Answer | S = str(input())
if S.endswith('s'):
S += "es"
else:
S += "s" |
p02756 | s512855056 | Accepted | S = input()
Q = int(input())
from collections import deque
ans = deque()
for s in S:
ans.append(s)
rev = False
for _ in range(Q):
q = input().split()
if q[0] == "1":
rev = not rev
else:
is_right = (q[1] =="2") ^ rev
if is_right:
for s in q[2]:
ans.append(s)
else:
for s in q[2]:
ans.appendleft(s)
if rev:
ans.reverse()
print("".join(ans)) |
p02615 | s933935389 | Accepted | N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
B = A[::-1]
C = N-1
ans = 0
if N%2 == 0:
ans += B[0]
for i in range(N//2-1):
ans += 2*B[i+1]
else:
ans += B[0]
ans += B[N//2]
for i in range(N//2-1):
ans += 2*B[i+1]
print(ans) |
p03160 | s063016096 | Accepted | n = int(input())
h = list(map(int, input().split()))
dp = [-1] * n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1]) |
p02702 | s398597568 | Accepted | p = 2019
s = list(map(int, list(input())))[::-1]
sum = 0
cnt = [0] * p
cnt[0] = 1
n = len(s)
for i in range(n):
d = s[i] * pow(10, i, p)
sum = (sum + d) % p
cnt[sum] += 1
ans = 0
for i in range(p):
ans += cnt[i] * (cnt[i]-1) // 2
print(ans)
|
p02677 | s139638342 | Wrong Answer | from math import pi
from math import cos
from math import sqrt
a, b, h, m = map(int, input().split())
h *= 5
dist = abs(h - m)
ang = 2 * pi / 60 * dist + m / 60 * pi / 6
res = sqrt(a**2 + b**2 - 2 * a * b * cos(ang))
print(res)
|
p02602 | s424959717 | Accepted | # C - Marks
def marks(n, k, a):
results = []
for i in range(n - k):
if a[i] < a[i + k]:
results.append("Yes")
else:
results.append("No")
return results
if __name__ == "__main__":
n, k = map(int, input().split())
a = list(map(int, input().split()))
results = marks(n, k, a)
for i in results:
print(i)
|
p03860 | s609578867 | Accepted | A, s, C = input().split()
A = A[0]
s = s[0]
C = C[0]
print(A + s + C) |
p02817 | s920224643 | Wrong Answer | s, t = input().split()
print(s,t,sep='') |
p03448 | s362639645 | Accepted | A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if ((500*i)+(100*j)+(50*k))==X:
count+=1
print(count) |
p03206 | s141952309 | Wrong Answer | D = int(input())
print("Christmas"+"Eve"*(25-D)) |
p03448 | s088528551 | Wrong Answer | a = int(input())
b= int(input())
c = int(input())
x = int(input())
pattern = 0
for i in range(a+1):
if x-500*i==0:
pattern+=1
for j in range(b+1):
if x-500*i-100*j==0:
pattern+=1
for k in range(c+1):
if x-500*i-100*j-50*k==0:
pattern+=1
print(pattern) |
p02639 | s706757775 | Wrong Answer | a=[]
a=input().split()
for i in range(0,4):
if a[i]=='0':
print(i)
else:
pass
|
p03730 | s998800837 | Accepted | import fractions
A, B, C = map(int, input().split())
gcd = fractions.gcd(A, B)
if gcd == 1 and C != 0 or gcd != 1 and fractions.gcd(gcd, C) != 1:
print('YES')
else:
print('NO') |
p03137 | s015786677 | Wrong Answer | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))
def main():
n, m = nm()
X = nl()
if n >= m:
print(0)
else:
X = sorted(X)
D = [X[i + 1] - X[i] for i in range(m - 1)]
D = sorted(D)
print(sum(D[:-n + 1]))
if __name__ == '__main__':
main()
|
p03073 | s281145313 | Accepted | S=input()
d0=0
d1=0
for i in range(len(S)):
d0+=int(S[i])!=i%2
d1+=int(S[i])!=(i+1)%2
print(min(d0,d1)) |
p02640 | s366374048 | Accepted | import sys
X,Y = map(int, input().split())
for i in range(X+1):
for j in range(X+1):
if (((2*i) + (4*j)) == Y) or (((2*j) + (4*i)) == Y):
if (i+j == X):
print("Yes")
sys.exit()
print("No")
|
p03163 | s802830716 | Wrong Answer | n, W = map(int, input().split())
dp = [[float('inf') for _ in range(W+1)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
w, v = map(int, input().split())
for j in range(W+1):
dp[i+1][j] = dp[i][j]
if j-w >= 0:
dp[i+1][j] = min(dp[i][j], v+dp[i][j-w])
ans = 0
for val in dp[-1]:
if val == float('inf'): continue
else: ans = max(ans, val)
print(ans)
|
p02923 | s664768970 | Accepted | n = int(input())
arr = list(map(int, input().split()))
res, i = 0, 0
while i < n:
j = i
while j < n-1 and arr[j]>=arr[j+1]:
j += 1
res = max(res, j-i)
i = j+1
print(res)
|
p02786 | s958338016 | Accepted | h = int(input())
T = [[h,1]]
s = 0
l = 10**6 + 3
A = [0] * l
A[1] = 1
for i in range(2, l):
A[i] = 1 + A[i//2] * 2
a = 0
while s < len(T):
if T[s][0] >= l:
T.append([T[s][0]//2, T[s][1]*2])
a += T[s][1]
T[s] = [0,0]
s += 1
# print(T)
for i in range(len(T)):
a += A[T[i][0]] * T[i][1]
print(a)
|
p03001 | s169869072 | Accepted | w,h,x,y=map(int,input().split())
if x==w/2 and y==h/2:
print("{} {}".format(w*h/2,1))
else:
print("{} {}".format(w*h/2,0))
|
p02847 | s982942326 | Wrong Answer | S = input('Day of the week')
print()
if S== 'SUN':
print(7)
if S == 'MON':
print(6)
if S == 'TUE':
print(5)
if S == 'WED':
print(4)
if S == 'THU':
print(3)
if S == 'FRI':
print(2)
if S == 'SAT':
print(1)
|
p02723 | s853481421 | Wrong Answer | s = input()
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
judge = 'Yes'
break
judge = 'No'
print(judge)
|
p02743 | s625835671 | Accepted | #https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
# -*- coding: utf-8 -*-
import math
from decimal import *
a,b,c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No") |
p03419 | s569784357 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,m=map(int, input().split())
if n==1 and m==1:
ans=1
# n,m=1,1を除外してるからどっちか1だったら他方の-2でok
elif m==1 or n==1:
ans=max(n,m)-2
else:
ans=(n-2)*(m-2)
print(ans)
resolve() |
p03323 | s764744584 | Accepted | A,B = map(int,input().split())
print('Yay!' if A<=8 and B<=8 else ':(') |
p03493 | s390058568 | Accepted | s = input()
counter = 0
if s[0] == "1":
counter += 1
if s[1] == "1":
counter += 1
if s[2] == "1":
counter += 1
print(counter)
|
p02971 | s122953177 | Accepted | N = int(input())
li = []
for i in range(N):
s = int(input())
li.append(s)
new = sorted(li, reverse=True)
s = max(li)
for index, i in enumerate(li):
if s == li[index]:
print(new[1])
else:
print(new[0]) |
p02618 | s633807983 | Accepted | import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
s = list(map(int, input().split()))
print(1+s.index(max(s))) |
p03327 | s885200462 | Wrong Answer | n=int(input())
if n < 1000:
print("ABC"+str(n).zfill(3))
else:
print("ABD"+str(n-999).zfill(3))
|
p02983 | s254334965 | Wrong Answer | L,R = map(int, input().split())
dif = 2019 if R-L+1 > 2019 else R-L+1
ans = [0]*dif
index = 0
for i in range(L, L+dif):
ans[index] = i%2019
index += 1
ans.sort()
print(ans[0]*ans[1]) |
p02707 | s965902290 | Accepted | import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n = ii()
a = li()
b = [0]*(n+10)
for i in range(n-1):
b[a[i]-1]+=1
for i in range(n):
print(b[i]) |
p03289 | s527235844 | Accepted | S = input()
ans = "WA"
if S[0] != "A":
print(ans)
else:
if S[2:len(S) - 1].count("C") != 1:
print(ans)
else:
s = S.index("C")
SS = S[1:s] + S[s + 1:]
if SS.islower() == False:
print(ans)
else:
print("AC")
|
p02765 | s576778738 | Wrong Answer | n,r=map(int,input().split())
if n<10:
r-=100*(10-n)
print(r) |
p02622 | s535109443 | Wrong Answer | a = input()
b = input()
c = len(a)
d = list(a)
e = list(b)
count = 0
for i in range(c):
if d[i] == e[i]:
count += 1
print(count) |
p03474 | s874948384 | Wrong Answer | a,b = map(int,input().split())
s = input()
if len(s) == a + b + 1:
if s[a] == "-":
s = s.replace("-","")
if s.isdecimal():
print("Yes")
else:
print("No")
else:
print("No")
else:
print("No") |
p02584 | s390913944 | Accepted | X, K, D = map(int, input().split())
ans = None
if K*D <= abs(X):
print(abs(X)-abs(K*D))
else:
times0 = abs(X) // D
X = abs(X) - times0 * D
K -= times0
if K % 2 == 0:
print(X)
else:
print(abs(X-D)) |
p02970 | s964489445 | Accepted | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N, D = map(int, readline().split())
x = 2 * D + 1
print((N + x - 1) // x)
if __name__ == '__main__':
main()
|
p02695 | s923697913 | Accepted | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
num_list = [list(map(int, input().split())) for _ in range(Q)]
m_range = list(range(1, M+1))
max_point = 0
for array in combinations_with_replacement(m_range, N):
point = 0
for (a, b, c, d) in num_list:
if array[b-1] - array[a-1] == c:
point += d
max_point = max(max_point, point)
print(max_point) |
p02699 | s096050024 | Wrong Answer | S, W = map(int, input().split())
if S >= W:
print("unsafe")
else:
print("safe") |
p03243 | s416172818 | Wrong Answer | n = input()
ans = []
for c in n:
c = int(c)
if c == 0:
continue
num = c * 111
if num >= int(n):
ans.append(num)
print(min(ans))
|
p02701 | s460794174 | Accepted | N = int(input())
S = []
for _ in range(N):
S.append(input())
print(len(set(S))) |
p02640 | s400343297 | Wrong Answer | x,y = map(int,input().split())
c = x * 2
for _ in range(x):
if c == y:
print("Yes")
quit()
elif c > y:
print("No")
quit()
c += 2
print("No") |
p03067 | s334352334 | Accepted | a,b,c=map(int,input().split())
print("Yes" if a<c<b or b<c<a else "No") |
p02759 | s538621463 | Accepted | n=int(input())
print(n//2+n%2) |
p02720 | s686679434 | Wrong Answer | k = int(input())
lis = []
while len(lis) <= k:
test = 1
if test < 10:
lis.append(test)
else:
for i in range(len(str(test)) - 1):
truf = True
if not abs(str(test)[i] - str(test)[i+1]) <= 1:
truf = False
break
if truf:
lis.append(test)
print(lis[k])
|
p03011 | s491559659 | Accepted | A = list(map(int,input().split()))
A.sort()
print(A[0]+A[1]) |
p02624 | s492951011 | Wrong Answer | N = int(input())
c = (N+1)//2
ans = 0
for i in range(1,N-c+1):
ans += i*(1+N//i)*(N//i)/2
ans += N*c -(c+1)*c/2
print(int(ans)) |
p02597 | s870675097 | Accepted | #!/usr/bin/env python3
n = int(input())
s = input()
l = 0
r = n - 1
cnt = 0
while l < r:
if s[l] == "R":
l += 1
elif s[r] == "W":
r -= 1
else:
cnt += 1
l += 1
r -= 1
print(cnt)
|
p03623 | s684423253 | Wrong Answer | x,a,b = map(int,input().split())
if abs(a-x) > abs(b-x):
print("A")
else:
print("B")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.