problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02683 | s261789883 | Accepted | N,M,X = map(int, input().split())
def python_list_add(in1, in2):
return [a + b for a, b in zip(in1, in2)]
A = []
for i in range(N):
A.append(list(map(int, input().split())))
m = 1e9
for i in range(2 ** N):
total = [0] * (M+1)
for j in range(N):
if((i >> j) & 1):
total = python_list_add(total, A[j])
if(a... |
p03221 | s275567046 | Wrong Answer | n, m = map(int, input().split())
name = []
city = []
prefecture = [1] * n
for i in range(m):
a = list(map(int, input().split())) + [i+1]
city.append(a)
name.append("{}{}".format("0" * (6 - len(str(a[0]))), a[0]))
city_1 = sorted(city, key=lambda x: x[0])
city_sorted = sorted(city, key=lambda x: x[1])
x = 1... |
p03076 | s876000380 | Accepted | import math
a=[]
first=[]
for i in range(5):
temp=str(input())
a.append(temp)
first.append(int(temp[-1]))
nin=0
nva=9
for i in range(5):
if first[i]!=0 and first[i]<nva:
nin=i
nva=first[i]
ans=0
for i in range(5):
if i!=nin:
temmp=int(a[i])
temmp=math.ceil((temmp-0.... |
p03543 | s734237451 | Wrong Answer | n = list(input())
if len(set(n))==1:
print('Yes')
elif n[0]==n[1] and n[1]==n[2]:
print('Yes')
elif n[1]==n[2] and n[1]==n[2]:
print('Yes')
else:
print('No') |
p02910 | s486590563 | Accepted | S = list(input())
S_odd = S[0::2]
S_even= S[1::2]
o = set(S_odd).issubset(set(["R","U", "D"]))
e = set(S_even).issubset(set(["L","U", "D"]))
if o + e == 2:
print("Yes")
else:
print("No") |
p02576 | s904591709 | Accepted | N, X, T = map(int, input().split())
print((N + X - 1) // X * T)
|
p03438 | s657952149 | Accepted | import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum_a = sum(a)
sum_b = sum(b)
num_b = 0
num_a = 0
for i in range(n):
if a[i] > b[i]:
num_b += a[i] - b[i]
else:
num_a += math.ceil((b[i]-a[i])/2)
if sum_b-sum_a >= num_b and sum_b-sum_a >= num... |
p02881 | s405124896 | Wrong Answer | import itertools
from operator import mul
n = int(input())
k = n
ans = n - 1
prime = []
while k != 1:
for i in range(2,int(k**0.5)+1):
if k % i == 0:
prime.append(i)
k /= i
break
else:
prime.append(int(k))
k = 1
div = list(itertools.accumulate(prime... |
p02777 | s636382909 | Accepted | S,T = list(map(str,input().split()))
A,B = list(map(int,input().split()))
U = input()
if S == U:
A = A - 1
else:
B = B - 1
print(A,' ',B,sep='') |
p02700 | s928418765 | Accepted |
def main():
import sys
A,B,C,D=map(int,input().split())
for i in range(100):
A=A-D
C=C-B
if C<=0:
print("Yes")
sys.exit()
elif A<=0:
print("No")
sys.exit()
if __name__ == '__main__':
main() |
p03998 | s955049249 | Accepted | l=[]
ind=["a","b","c"]
for i in range(3):
l.append([i for i in input()])
next=l[0][0]
now=0
while True:
if not l[now]:
print(ind[now].upper())
break
next=l[now][0]
l[now].pop(0)
now=ind.index(next) |
p03067 | s349214508 | Accepted | def LI():
return list(map(int, input().split()))
A, B, C = LI()
if A < C < B or B < C < A:
ans = "Yes"
else:
ans = "No"
print(ans)
|
p02838 | s813369430 | Accepted | N = int(input())
A = list(map(int,input().split()))
ans = 0
mod = 10**9+7
c = [0]*62
for i in range(N):
a = format(A[i],'b')
a = a[::-1]
for j in range(len(a)):
if a[j] == '1':
c[j] += 1
k = 1
for i in range(len(c)):
p = c[i]*(N-c[i])
ans += k*(p % mod) % mod
k = k*2 % mod
... |
p02951 | s391225068 | Accepted | a,b,c = map(int,input().split())
if((a-b) <= c):
print(c-(a-b))
else:
print(0)
|
p03817 | s607607082 | Accepted | N=int(input())
turn=N//11*2
if N%11>6:
print(turn+2)
elif N%11>0:
print(turn+1)
else:
print(turn) |
p02658 | s751861433 | Accepted | if __name__ == "__main__":
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 1
for i in range(N):
ans *= A[i]
if ans > 10**18:
print(-1)
break
else:
print(ans)
|
p02584 | s295385360 | Accepted | X, K, D = map(int, input().split())
if X - K * D >= 0:
print(abs(X - K * D))
elif X + K * D <= 0:
print(abs(X + K * D))
else:
i = (D * K - X) // (2 * D)
print(min( abs(X - D * K + 2 * i * D), abs(X - D * K + 2 * (i+1) * D) )) |
p02554 | s278288493 | Accepted | N = int(input())
MOD = 1000000000 + 7
def power_func(a, n, p):
bi = str(format(n,"b"))#2進表現に
res = 1
for i in range(len(bi)):
res = (res*res) % p
if bi[i] == "1":
res = (res*a) % p
return res
print(str((power_func(10, N, MOD) - 2 * power_func(9, N, MOD) + power_func(8, N, MOD... |
p02817 | s958390644 | Accepted | a, b = list(map(str, input().split()))
my_result = b + a
print(str(my_result)) |
p03592 | s808309664 | Accepted | # coding: utf-8
n, m, k = map(int,input().split())
flg=False
for i in range(n+1):
for j in range(m+1):
if i*m + (n-i)*j - i*j == k:
flg=True
if flg:
print("Yes")
else:
print("No") |
p02705 | s926829851 | Accepted | import numpy as np
pi=np.pi
R=int(input())
print(2*pi*R) |
p02783 | s286902946 | Accepted | L = input().split()
H, A = int(L[0]), int(L[1])
t = 0
while H > 0:
H -= A
t += 1
print(str(t)) |
p02688 | s865680846 | Wrong Answer | n,k=map(int,input().split())
d=[]
l=[]
for i in range(k):
d=int(input())
l.append(map(int,input().split()))
x=set(l)
x=list(x)
print(n-len(x)) |
p02761 | s480357331 | Accepted | n,m=map(int,input().split())
li=[0]*n
for i in range(m):
si,ci=map(int,input().split())
if li[si-1] != 0 and li[si-1] !=ci:
print(-1)
exit(0)
if si==1 and ci==0:
if n>1:
print(-1)
exit(0)
li[si-1]=ci
if n>1 and li[0]==0:
li[0]=1
for i in range(n):
... |
p03821 | s166946648 | Accepted | ans=0
c=[list(map(int,input().split())) for _ in range(int(input()))]
for a,b in c[::-1]:
if (a+ans)%b:
ans+=(-a-ans)%b
print(ans) |
p03219 | s401082230 | Accepted | X,Y = map(int,input().split())
print(int(X+Y/2)) |
p03264 | s660319405 | Accepted | K = int(input())
if K%2==0:
print((K//2)**2)
else:
print(-(-K//2)*(K//2)) |
p03327 | s913670249 | Accepted | N = int(input())
if N <= 999:
print('ABC')
else:
print('ABD') |
p03605 | s630023537 | Wrong Answer | N=str(input())
if N[0]=='9' or N[1]=='9':
print('Yes')
else:
print('NO') |
p02724 | s887219523 | Accepted | a = int(input())
sen = a // 500
go = (a % 500) // 5
print('{}'.format(sen*1000+go*5)) |
p02786 | s039920973 | Wrong Answer | H = input()
import math
print(2**(math.ceil(int(H)/2)+1)-1) |
p03317 | s268733497 | Accepted | import math
N, K = map(int, input().split())
print(math.ceil((N-1)/(K-1))) |
p03821 | s462381612 | Accepted | N=int(input())
A=[]
B=[]
for i in range(N):
AB=list(map(int,input().split()))
A.append(AB[0])
B.append(AB[1])
ans=0
for i in range(N-1,-1,-1):
A[i]+=ans
A[i]%=B[i]
if A[i]!=0:
ans+=B[i]-A[i]
print(ans) |
p03815 | s044406931 | Accepted | n = int(input())
ans = (n // 11) * 2
rem = n % 11
if rem > 0 :
if rem <= 6:
ans += 1
else:
ans += 2
print(ans)
|
p03163 | s431565867 | Accepted | import sys
input = sys.stdin.readline
N, W = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
w, v = B[i]
for j in range(W+1):
if j-w >= 0:
dp[i+1][j] = max(dp[i][j], dp[i][j-w]+v)
else:
... |
p03944 | s390403194 | Accepted | W,H,N=map(int,input().split())
l,r,b,t=0,W,0,H
for _ in range(N):
x,y,a=map(int,input().split())
if a==1:
l=max(l,x)
elif a==2:
r=min(r,x)
elif a==3:
b=max(b,y)
else:
t=min(t,y)
if l<r and b<t:
print((r-l)*(t-b))
else:
print(0) |
p03745 | s153039137 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt = 1
mono = 0
for i in range(1, n):
d = a[i] - a[i - 1]
if d * mono < 0:
cnt += 1
mono = 0
elif d != 0:
mono = d
print(cnt) |
p02594 | s516328984 | Accepted | o = int(input())
if 30 <= o:
print("Yes")
else:
print("No")
|
p03698 | s629125576 | Accepted | # -*- coding: utf-8 -*-
s = list(str(input()))
"""
tmp = [s[0]]
flag = True
for i in s:
if i in tmp:
flag = False
else:
tmp.append(i)
if flag:
print("yes")
else:
print("no")
"""
if len(s) == len(set(s)):
print("yes")
else:
print("no") |
p03471 | s529126690 | Accepted | a,b=map(int,input().split())
t=b/1000
List=[-1,-1,-1]
for l in range(a+1):
if (t-9*l-a)%4==0 and a-l-(t-9*l-a)/4>=0 and t-9*l-a>=0:
s=int((t-9*l-a)/4)
List=[l,s,a-l-s]
break
print(*List)
|
p03282 | s597453831 | Wrong Answer | s = list(map(int, input()))
k = int(input())
res = 1
for i in range(len(s)):
if s[i] != 1:
res = s[i]
break
print(res)
|
p03380 | s289301458 | Accepted | # coding: utf-8
from math import ceil
from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = A[-1]
ans = ceil(a / 2)
b = float("inf")
for i in range(N-1):
if abs(b - ans) > abs(A[i] - ans):
b = A[i]
print(a, b) |
p02897 | s427618072 | Accepted | n = int(input())
c = 0
for i in range(1,n+1):
if i % 2 != 0:
c += 1
print(c/n)
|
p03524 | s518641018 | Accepted | S = input()
Slst = [S.count('a'), S.count('b'), S.count('c')]
Slst.sort(reverse=True)
x = (len(S)-1) // 3
y = (len(S)-1) % 3
if y == 0:
lst = [x+1, x, x]
elif y == 1:
lst = [x + 1, x+1, x]
else:
lst = [x+1, x+1, x+1]
if lst == Slst:
print('YES')
else:
print('NO') |
p02792 | s206638080 | Accepted | N = int(input())
can_list = [[0 for _ in range(10)] for _ in range(10)]
str_list = list(map(str, range(1, N+1)))
for n in range(N):
idx = str(n + 1)[0] + str(n + 1)[-1]
can_list[int(idx[0])][int(idx[1])] += 1
res = 0
for i in range(10):
for j in range(10):
res += can_list[i][j] * can_list[j][i]
... |
p02725 | s947137462 | Accepted | K, N = map(int, input().split())
A = list(map(int, input().split()))
dif_max = 0
for i in range(N):
if i == 0:
dif = A[0] + (K - A[-1])
else:
dif = abs(A[i] - A[i-1])
if dif > dif_max:
dif_max = dif
print(K - dif_max) |
p02951 | s217857805 | Wrong Answer | a, b, c = (int(n) for n in input().split())
print(c - (a - b)) |
p03160 | s782612608 | Accepted | # DP practice
# https://atcoder.jp/contests/dp/tasks/dp_a
# 入力方法としてはこれが手軽
N = int(input())
h = list(map(int, input().split()))
dp = list()
# N = 0, 1 の時の処理も必要。だが省く
dp.append(0)
dp.append(dp[0] + abs(h[1] - h[0]))
for i in range(2, N):
dp.append(min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1])))
pri... |
p02771 | s519690803 | Wrong Answer | #155 a
a,b,c=map(int,input().split())
if a==b==c:
print("No")
else:
print("Yes") |
p03695 | s781880519 | Accepted | n = int(input())
a = list(map(int, input().split()))
s = set()
cnt = 0
for i in a:
if i >= 3200:
cnt += 1
else:
s.add(i // 400)
print(max(1, len(s)), len(s) + cnt) |
p02676 | s286100439 | Accepted | break_line = int(input())
word = input()
if len(word) <= break_line:
print(word)
else:
print('{}...'.format(word[:break_line])) |
p02570 | s869352079 | Accepted | D, T, S = map(int, input().split())
if D/S <= T:
print("Yes")
else:
print("No") |
p03220 | s967195960 | Accepted | n=int(input())
t,a=map(int,input().split())
hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mn=abs(a-(t-hl[0]*0.006))
temp=[]
for i in range(n):
mn=min(mn,abs(a-(t-hl[i]*0.006)))
temp.append(abs(a-(t-hl[i]*0.006)))
print(temp.index(mn)+1)
|
p02754 | s316717757 | Accepted | n,a,b=map(int,input().split())
if a==0:
print(0)
exit()
elif b==0:
print(n)
exit()
s=a+b
cnt=n//s
r=n%s
ans=cnt*a+min(a,r)
print(ans)
|
p03241 | s574036069 | Accepted | import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r
def factorize(n):
res = []
for i in range(1, floor(sqrt(n)) + 1):
if not n % i:
res.append(i)
res.append(n // i)
return sorted(res)
n, m = map(int, sys.stdin.readline().split())
def main():
... |
p03836 | s991713258 | Accepted | sx, sy, tx, ty = map(int, input().split())
ans = ''
ans += 'R' * (tx - sx)
ans += 'U' * (ty - sy)
ans += 'L' * (tx - sx)
ans += 'D' * (ty - sy)
ans += 'L'
ans += 'U' * (ty - sy + 1)
ans += 'R' * (tx - sx + 1)
ans += 'D'
ans += 'R'
ans += 'D' * (ty - sy + 1)
ans += 'L' * (tx - sx + 1)
ans += 'U'
print(ans) |
p02691 | s219283145 | Accepted | n = int(input())
mp = list(map(int,input().split()))
#Ai + i
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
j=i+1
a = mp[i]+i
if(a<=n):
cnt[a] += 1
b = j-mp[j]
if(b<0):
continue
ans += cnt[b]
print(ans) |
p02640 | s862677795 | Wrong Answer | N, M = map(int,input().split())
crain = (4 * N - M) / 2
if crain.is_integer() and crain > 0:
print("Yes")
else:
print("No") |
p03075 | s672549764 | Accepted | a,_,_,_,e,k=[int(input()) for i in range(6)]
print(":(" if e-a>k else "Yay!") |
p03071 | s250515299 | Wrong Answer | a,b=map(int,input().split())
if a!=b:
s=max(a,b)
print(s*(s-1))
else:
print(a**2)
|
p02755 | s601864684 | Accepted | I = 1009
a,b = map(int,input().split());flag=0
for i in range(1,I):
x = (i*8)//100;y=(i*10)//100
if(x==a and y==b):
print(i)
flag=1
break
if(flag==0):
print(-1) |
p03817 | s587902457 | Accepted | x = int(input())
ans = x//11*2
if x%11 == 0:
pass
elif x%11 <= 6:
ans += 1
else:
ans += 2
print(ans) |
p03030 | s914390779 | Accepted | n=int(input())
s = [input().split() for i in range(n)]
c=0
for x in s:
c+=1
x.append(c)
x[1]=str(100-int(x[1])).zfill(3)
s.sort(key=lambda x:(x[0],x[1]))
for x in s:
print(x[2]) |
p03555 | s549255232 | Accepted | c = [input() for _ in range(2)]
tmp = c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]
print("YES" if tmp else "NO") |
p03076 | s787021925 | Wrong Answer | A = []
ans = 0
for _ in range(5):
a = int(input())
if a % 10 == 0: ans += a
else: A.append(a)
A.sort(key = lambda x:x%10)
for i in range(1, len(A)+1):
if A[-i] != A[0]:ans += 10 - (A[-i]%10) + A[-i]
else: ans += A[-i]
print(ans) |
p03719 | s063847160 | Accepted | a, b, c = map(int, input().split())
if c >= a and c <= b:
print("Yes")
else:
print("No") |
p02726 | s029820437 | Accepted | n,x,y=map(int,input().split())
l=[0 for i in range(n-1)]
#print(l)
length=0
for i in range(1,n):
for j in range(i+1,n+1):
length=min(abs(j-i)-1,abs(y-j)+abs(x-i),abs(y-j)+abs(x-i))
#print(i,j,length)
l[length]+=1
for i in l:
print(i) |
p03730 | s071127273 | Wrong Answer | A, B, C = map(int, input().split())
for i in range(1, 1000):
if B*i%A==0:
count=1
else:
count=0
print("No" if count==0 else "Yes") |
p03698 | s537477499 | Accepted | s = list(input())
ss = set(s)
if len(s) == len(ss):
print('yes')
else:
print('no') |
p03449 | s435685176 | Accepted | n=int(input())
candy=[list(map(int,input().split())) for i in range(2)]
ans=candy[0][0]+sum(candy[1])
t=ans
for i in range(n-1):
t+=candy[0][i+1]
t-=candy[1][i]
if t>ans:
ans=t
print(ans) |
p02947 | s473163328 | Wrong Answer | N = int(input())
s = []
count=0
for i in range(N):
a = list(input())
a.sort()
s.append(a)
while True:
if len(s) == 0:
break
count += s.count(s[0])
s=[i for i in s if i != s[0]]
print(count) |
p03565 | s666088844 | Accepted | S = input()[::-1]
T = input()[::-1]
n = len(S);m = len(T)
a = []
for i in range(0, n - m + 1):
f = 1
s = S[i:i+m]
for j in range(m):
if s[j] not in ["?",T[j]]:
f = 0
break
if f:
a = S[:i] + T + S[i+m:]
break
if a:
print(a.replace('?','a')[::-1])
else:... |
p02583 | s827731027 | Accepted | N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
for j in range(i + 1, N):
for k in range(j + 1, N):
if L[i] == L[j] or L[j] == L[k]:
pass
elif L[i] + L[j] > L[k]:
ans += 1
print(ans)
|
p04020 | s947426378 | Accepted | N = int(input())
A_list = []
for i in range(N):
A = int(input())
A_list.append(A)
# print(A_list)
ans = 0
tmp = 0
for i in range(len(A_list)):
if A_list[i] != 0:
if i == len(A_list)-1:
tmp += A_list[i]
ans += int(tmp/2)
else:
tmp += A_list[i]
else:
... |
p02953 | s005339503 | Accepted | N = int(input())
H = list(map(int,input().split()))
s=0
flag = True
if N==1:
print("Yes")
exit()
for i in range(N-1):
s = max(s,H[i])
if s-H[i+1]>1:
flag = False
if flag:
print("Yes")
else:
print("No") |
p03759 | s471501660 | Accepted | a, b, c = map(int, input().split())
print("YES" if c - b == b - a else "NO") |
p02618 | s770833471 | Wrong Answer | import random
d = int(input()) #365
c = list(map(int, input().split())) # 26個
s = [list(map(int, input().split())) for _ in range(d)]
#output
t = [random.randint(1,27) for _ in range(d)]
for i in range(d):
print(t[i]) |
p03994 | s455748068 | Accepted | import string
s=list(input())
k=int(input())
str=string.ascii_lowercase
abc=str+str
s_len=len(s)
for i in range(s_len):
si_inx=abc.index(s[i])
if i==s_len-1:
k%=26
s[i]=abc[si_inx+k]
break
if s[i]=='a':
continue
if k>=26-si_inx:
k-=26-si_inx
s[i]='a'
else:
continue
print(''.... |
p03481 | s765896922 | Wrong Answer | import math
x,y = map(int,input().split())
n = math.floor(math.log2(y)-math.log2(x)+1)
print(n) |
p02755 | s026142326 | Wrong Answer | a,b=input().split()
a=int(a)
b=int(b)
x=10
y=int(x*8/100)
z=int(x*10/100)
for i in range(10000):
if y==a and z==b:
print(x)
else:
x=x+1 |
p03679 | s660523850 | Accepted | x,a,b=map(int,input().split())
if b-a<=0:
print('delicious')
elif b-a<=x:
print('safe')
elif b-a>=x+1:
print('dangerous') |
p03605 | s335223383 | Wrong Answer | x=int(input())
if x==9 or x//10==9:
print("Yes")
else:
print("No") |
p03836 | s448368895 | Wrong Answer | import sys
input = sys.stdin.readline
sx, sy, tx, ty = map(int, input().split())
mov_x = tx - sx
mov_y = ty - sy
ans = ''
ans += 'R' * mov_x
ans += 'U' * mov_y
ans += 'L' * mov_x
ans += 'D' * mov_y
ans += 'D'
ans += 'R' * (mov_x + 2)
ans += 'U' * (mov_y + 2)
ans += 'U'
ans += 'L' * (mov_x + 2)
ans += 'D' * (mov_y + ... |
p03644 | s859539436 | Accepted | n=int(input())
m=0
a=1
for i in range(1,n+1):
c=0
j=i
while 1:
j/=2
if j%1==0:
c+=1
else:
break
if m<c:
m=c
a=i
print(a)
|
p02791 | s106097421 | Accepted | n = int(input())
a = list(map(int,input().split()))
pf = [0]*n
mn = 1e9
for i in range(0,n):
mn = min(mn,a[i])
pf[i] = mn
cn = 0
for i in range(n):
if(a[i]<=pf[i]):
cn += 1
print(cn) |
p02552 | s396245216 | Wrong Answer | x = int(input())
print(0 if x == 0 else 1) |
p02730 | s347384578 | Wrong Answer | s = input()
n = len(s)
s_lh_r = s[n//2+1:][::-1]
s_fh = s[:n//2]
if not s_lh_r == s_fh:
print("No")
exit()
n = len(s_fh)
if not s_fh[:n//2] == s_fh[n//2+1:][::-1] or not s_lh_r[:n//2] == s_lh_r[n//2+1:][::-1]:
print("No")
exit()
print("Yes") |
p03408 | s781426794 | Accepted | n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
ans=0
for i in s:
ans=max(ans,s.count(i)-t.count(i))
print(ans) |
p02641 | s045745885 | Accepted | X, N = map(int, input().split())
try:
P = set((map(int, input().split())))
except:
print(X)
exit()
dif = 0
while X - dif in P:
if not X + dif in P:
print(X + dif)
exit()
dif += 1
print(X - dif) |
p02706 | s371756213 | Accepted | N,M = map(int, input().split())
l = list(map(int, input().split()))
if N - sum(l) < 0:
print("-1")
else:
print(N - sum(l)) |
p03317 | s269135430 | Wrong Answer | N,K = map(int,input().split())
print(N//(K-1)) |
p02689 | s381119138 | Wrong Answer | N,M= list(map(int , input().split()))
H = list(map(int , input().split()))
A = []
B = []
for i in range(M):
x,y=[int(i) for i in input().split()]
A.append(x)
B.append(y)
S = []
for j in range (M):
if H[A[j]-1] > H[B[j]-1]:
S.append(B[j])
elif H[A[j]-1] < H[B[j]-1]:
S.append(A... |
p03943 | s055289289 | Accepted | a,b,c=sorted(map(int,input().split()))
print("Yes" if a+b==c else "No") |
p03778 | s921688370 | Accepted | W,a,b=map(int,input().split())
print(max(max(a,b)-W-min(a,b),0)) |
p03150 | s549701391 | Accepted | #!/usr/bin/env python
# coding: utf-8
# In[22]:
S = input()
# In[24]:
keyence = "keyence"
length = len(keyence)
flag = True
for i in range(len(keyence)):
# print(S[:i+1], keyence[:i+1], S[-length+i+1:], keyence[-length+i+1:])
if S[:i+1] == keyence[:i+1]:
if S[-length+i+1:] == keyence[-length+i+1:... |
p02706 | s931663508 | Accepted |
def solve():
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
print(max(N - sum(A), -1))
if __name__ == '__main__':
solve()
|
p03680 | s534252932 | Wrong Answer | n = int(input())
a = [int(input()) for i in range(n)]
now = a[0]
cnt = 0
for i in range(n - 1):
#print(now)
now = a[now - 1]
cnt += 1
if now == a[1]:
print(cnt)
exit()
print("-1") |
p02546 | s662804644 | Accepted | S = input()
if S[-1] == "s":
print(S + "es")
else:
print(S + "s") |
p03416 | s931164161 | Accepted | a, b = map(int, input().split())
cnt = 0
for num in range(a, b + 1):
if str(num) == str(num)[::-1]:
cnt += 1
print(cnt)
|
p02688 | s258706485 | Wrong Answer | N,K = map(int,input().split())
print(N - int(input())) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.