problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02784 | s924062872 | Wrong Answer | a, b = map(int, input().split())
attack = [int(i) for i in input().split()]
for j in range(b):
a -= attack[j]
if a <= 0:
print("YES")
break
else:
print("NO") |
p03471 | s961698403 | Wrong Answer | N, Y = map(int, input().split())
for x in range(N):
for y in range(N-x):
z = N - x - y
if z > 0 and 10000*x + 5000*y + 1000*z == Y:
print(str(x)+" "+str(y)+" "+str(z))
exit()
print("-1 -1 -1") |
p02939 | s935888877 | Accepted | s = list(input())
i = len(s)
p = 0
while i >= 3:
if s[i-1] == s[i-2]:
i -= 3
p += 2
else:
i -= 1
p += 1
if i <= 1:
print(p+i)
else:
if s[i-1] == s[i-2]:
print(p+1)
else:
print(p+2) |
p03417 | s032663919 | Wrong Answer | def main():
n, m = map(int,(input().split()))
if n <= 2 or m <= 2:
print(0)
else:
print((n-2)*(m-2))
if __name__ == "__main__":
main() |
p02675 | s082322540 | Wrong Answer | N = input()
if N[-1] in ["2","4","5","7","9"]:
print("hon")
elif N[-1] in ["1","6","8"]:
print("pon")
else:
print("bon")
|
p02629 | s113190336 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
ans = []
char = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
while N:
i = N... |
p03951 | s742634926 | Accepted | n = int(input())
S = input()
T = input()
cnt = 0
for i in range(n):
if S[n - i - 1:] == T[: i + 1]:
cnt = i + 1
print(2*n-cnt) |
p03328 | s807792065 | Accepted | a, b = map(int, input().split())
diff = b - a
print((diff + 1)*diff//2 - b) |
p03162 | s700028747 | Wrong Answer | # C - Vacation
import numpy as np
N = int(input())
value = np.zeros((N, 3))
for i in range(N):
value[i, :] = list(map(int, input().split()))
value = value.tolist()
dp = [0]*3
for a, b, c in value:
dp = [max(dp[1], dp[2])+a, max(dp[0], dp[2])+b, max(dp[0], dp[1])+c]
print(max(dp)) |
p02760 | s759527545 | Accepted | m = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
for i in range(n):
x = int(input())
for h in range(3):
for w in range(3):
if m[h][w] == x: m[h][w] = 0
for i in range(3):
if sum(m[i]) == 0 :print('Yes'); exit()
for i in range(3):
if m[0][i] + m[1][i] + m[2... |
p03720 | s334933765 | Wrong Answer | n, m = map(int, input().split())
mat = [[0] * n] * n
for i in range(m):
a, b = map(int, input().split())
mat[a - 1][b - 1] = 1
mat[b - 1][a - 1] = 1
for i in range(n):
ans = sum(mat[i])
print(ans)
|
p02958 | s555350075 | Wrong Answer | n = int(input())
s = []
for i in range(n):
s.append(i)
for i in range(n):
t = 0
if(s[i] != i + 1):
t += 1
if(t == 0 or 2):
print('YES')
else:
print('NO')
|
p03659 | s837348044 | Accepted | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = map(int, read().split())
total = sum(A)
ans = INF
s = 0
for i in range(N-1):
s... |
p03239 | s784772357 | Accepted | def main():
n, t = map(int, input().split())
min_cost = 1001
for _ in range(n):
ci, ti = map(int, input().split())
if ti <= t and ci < min_cost:
min_cost = ci
print('TLE' if min_cost == 1001 else min_cost)
if __name__ == '__main__':
main()
|
p02743 | s172937749 | Wrong Answer | from math import sqrt
n = [int(e) for e in input().split(" ")]
print("Yes" if sqrt(n[0]) + sqrt(n[1]) < sqrt(n[2]) else "No") |
p03804 | s088347049 | Accepted | N, M = map(int, input().split())
a_mat = [input() for _ in range(N)]
b_mat = ''.join([input() for _ in range(M)])
def to_vectors(mat, size=M):
vectors = []
for h in range(N-M+1):
for w in range(N-M+1):
tmp = [mat[h+i][w:w+M] for i in range(M)]
vectors.append(''.join(tmp))
... |
p03817 | s158714741 | Accepted | x = int(input())
ans = (x // 11) * 2
remains = x % 11
if remains != 0:
ans += 1
if remains > 6:
ans += 1
print(ans)
|
p03861 | s668103897 | Accepted | a, b, x = map(int, input().split())
A = b//x
B = a//x
if a%x == 0:
print(A-B+1)
else:
print(A-B) |
p03455 | s274752915 | Wrong Answer | a,b=map(int,input().split())
if (a*b)&1:print("Even")
else:print("Odd") |
p03645 | s071008982 | Accepted | N,M = map(int, input().split())
X = set()
Y = set()
for i in range(M):
a,b = map(int, input().split())
if a == 1:
X.add(b)
if b == N:
Y.add(a)
if (X & Y) == set():
print('IMPOSSIBLE')
else:
print('POSSIBLE')
|
p03105 | s827496203 | Accepted | a,b,c = map(int,input().split())
if a*c <= b:
print(c)
else:
print(b//a)
|
p03627 | s350881097 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
d = Counter(A)
tmp_2 = []
tmp_4 = []
for k, v in d.items():
if v >= 4:
tmp_4.append(k)
if v >= 2:
tmp_2.append(k)
ans = 0
tmp_2.sort()
tmp_4.sort()
if len(tmp_4):
ans = tmp_4[-1]**2
if len(tmp_2) >= 2:
... |
p02677 | s630651025 | Accepted | import math
a, b, h, m = map(float, input().split(" "))
arg_a = 2 * math.pi * (h + m / 60) / 12
arg_b = 2 * math.pi * m / 60
arg = min(abs(arg_a - arg_b), 2 * math.pi - abs(arg_a - arg_b))
"""
print(str(arg_a / (math.pi * 2) * 360)
+ " "
+ str(arg_b / (math.pi * 2) * 360))
print(str(arg_a) + " " + str(arg_... |
p02702 | s693417886 | Wrong Answer | s = str(input())
cnt = 0
print(s[0:13])
for i in range(len(s)-3):
for j in range(len(s)-i+1):
if j < 3:
continue
if (int(s[i:i+j]) % 2019 == 0):
cnt += 1
print(cnt)
|
p02996 | s553693801 | Accepted | # 初期入力
import sys
input = sys.stdin.readline
N = int(input())
A =[]
for i in range(N):
a,b = (int(x) for x in input().split())
A.append((a,b))
now =0
A_sort =sorted(A,key=lambda x: x[1])
for progress,deadline in A_sort:
now +=progress
if now <=deadline:
ans ="Yes"
else:
ans ="No"
... |
p03061 | s270434026 | Accepted | from fractions import gcd
n = int(input())
an = list(map(int, input().split()))
left = [an[0]]
right = [an[-1]]
for i in range(1, n-1):
left.append(gcd(left[-1], an[i]))
right.append(gcd(right[-1], an[-(i+1)]))
ans = max(right[-1], left[-1])
for i in range(n-2):
ans = max(ans, gcd(left[i], right[-(i+2)]))... |
p03067 | s736040834 | Accepted | a,b,c=map(int,input().split());print("NYoe s"[(a<c<b or b<c<a)::2]) |
p03345 | s614428196 | Wrong Answer | A, B, C, K= map(int, input().split())
if K%2==1:
ans = A - B
else:
ans = B - A
if ans >= 10**8:
ans = 'Unfair'
elif ans <= -1*10**8:
ans = 'Unfair'
print(ans)
|
p02888 | s923233310 | Accepted | import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for b in range(n - 2):
for c in range(b + 1,n - 1):
left = bisect.bisect_left(l,l[c] + l[b])
ans+=left - c - 1
print(ans) |
p02918 | s736962109 | Accepted | N,K=map(int,input().split())
S=input()
now=S[0]
a=-1
for s in S:
a+=now==s
now=s
a+=K*2
ans=min(N-1,a)
print(ans) |
p02987 | s853152691 | Accepted | S=input()
if (S[0]==S[1] and S[2]==S[3] and S[0]!=S[3]) or (S[0]==S[2] and S[1]==S[3] and S[0]!=S[3]) or (S[0]==S[3] and S[2]==S[1] and S[0]!=S[1]):
print("Yes")
else:
print("No") |
p03001 | s517575216 | Accepted | W,H,X,Y=map(int,input().split())
ans2=0
if ((W%2==0)*W//2==X)*(X>0) and ((H%2==0)*H//2==Y)*(Y>0):
ans2=1
ans1=W*H/2
print(ans1,ans2) |
p03161 | s729156178 | Accepted | n, k = map(int, input().split())
h = list(map(int, input().split()))
def chmin(a, b):
if a > b:
return b
else:
return a
f_inf = float('inf')
for _ in range(k+2):
h.append(f_inf)
dp = [f_inf]*(n+k)
dp[0] = 0
for i in range(1, n):
for j in range(1, k+1):
if i >= j:
... |
p02678 | s034348645 | Accepted | from collections import deque
n,m = map(int, input().split())
V = [[] for _ in range(n+1)]
for _ in range(m):
a,b = map(int, input().split())
V[a].append(b)
V[b].append(a)
ans = [-1]*(n+1)
q = deque()
q.append(1)
while len(q):
p = q.popleft()
for c in V[p]:
if c > 1 and ans[c] < 0:
... |
p03910 | s120451927 | Wrong Answer | N = int(input())
K = format(N,'b')
L = len(K)
for i in range(L):
if K[-(i+1)] == "1":
print(2**(i)) |
p03328 | s161819247 | Accepted | def answer(a: int, b: int) -> int:
return sum(range(1, b - a + 1)) - b
def main():
a, b = map(int, input().split())
print(answer(a, b))
if __name__ == '__main__':
main()
|
p02922 | s363063472 | Accepted | A, B = input().split(' ')
A = int(A)
B = int(B)
if B == 1:
print(0)
else:
print(-(-(B-1) // (A-1))) |
p03077 | s199796533 | Accepted | import numpy as np
N = int(input())
time_array = np.array([int(input()) for _ in range(5)])
N_array = np.ones(5, dtype=np.int)*N
count_array = np.ceil(N_array / time_array)
answer = int(count_array.max() + 4)
print(answer)
|
p02922 | s428514341 | Accepted | #ABC139B
a,b = map(int,input().split())
ans = 0
outlet = 1
while b>outlet:
outlet = outlet - 1
outlet = outlet + a
ans = ans + 1
print(ans) |
p02584 | s275356514 | Accepted | def main():
x, k, d = map(int, input().split())
if x < 0: x = -x
if k * d <= x:
print(x - k*d)
return
x %= d + d
if k % 2 == 1:
x -= d
else:
x = min(abs(x-d-d), x)
print(abs(x))
main()
|
p03951 | s329365410 | Accepted | n=int(input())
s=input()
t=input()
for i in range(n):
if s[i:]==t[:n-i]:
print(n+i)
break
else:print(2*n) |
p02881 | s279316459 | Accepted | import math
N = int(input())
r = 0
for i in range(2,int(math.sqrt(N))+1):
if N % i == 0:
r = max(r, i)
if r > 0:
print(r+(N//r)-2)
else:
print(N-1)
|
p03017 | s421282335 | Accepted | n,a,b,c,d = map(int,input().split())
s = input()
ans = 'Yes'
if '##' in s[a-1:c]:
ans = 'No'
if '##' in s[b-1:d]:
ans = 'No'
if c > d:
if '...' not in s[b-2:d+1]:
ans = 'No'
print(ans) |
p03478 | s026231606 | Wrong Answer | # 083 B
N,A,B = map(int, input().split())
t = 0
for i in range(N):
s =0
n = i+1
while n > 0:
s += n%10
n = int(n/10)
print(s)
if (s >= A)and(s <= B):
t += (i+1)
print(t) |
p03419 | s548291917 | Accepted | N,M = list(map(int,input().split()))
print(abs((N-2)*(M-2))) |
p03862 | s376591153 | Wrong Answer | f=lambda:map(int,input().split())
N,X=f()
*A,=f()
c=0
for i in range(N-1):
print(A[i]+A[i+1]-X)
c+=max(0,A[i]+A[i+1]-X)
A[i+1]=min(A[i+1],X-A[i])
print(c) |
p03067 | s192479249 | Accepted | a,b,c=map(int,input().split())
print('Yes' if a<c<b or a>c>b else 'No') |
p02835 | s521160242 | Wrong Answer | S=list(input())
hug=0
for i in range(len(S)//2):
if S[i]!=S[len(S)-i-1]:
hug+=1
print(hug)
|
p02759 | s745353075 | Wrong Answer | N=int(input())
if N%2==0:
print(N/2)
else:
print(N+1/2) |
p03456 | s197629008 | Accepted | import sys
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
a,b= LS()
jo = int(a + b)
flag = 0
for i in range(1,int(jo/2)+1):
... |
p02747 | s568790066 | Accepted | S = str(input())
S_len = len(S)
half_len = int(len(S)/2)
if S_len%2 != 0:
print('No')
exit()
for i in range(half_len):
if S[2*i:2*i+2] != 'hi':
print('No')
exit()
print('Yes')
|
p02838 | s897850693 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=[0]*64
for i in range(n):
for j in range(a[i].bit_length()):
if a[i]>>j & 1: b[j]+=1
c=0
for i in range(64):
c+=(b[i]*(n-b[i])*2**i) % 1000000007
print(c%1000000007)
|
p02601 | s428698336 | Accepted | [A,B,C] = list(map(int,input().split()))
K = int(input())
cnt=0
while True:
if A>=B:
B=B*2
cnt+=1
else:
break
while True:
if B>=C:
C=C*2
cnt+=1
else:
break
if cnt<=K:
print('Yes')
else:
print('No')
|
p02797 | s014800865 | Wrong Answer | #%%
n, k, s = map(int, input().split())
ans = []
tmp = 0
for i in range(n):
if i < k :
tmp = s
else:
if s == 1:
tmp = 2
else:
tmp = 1
ans.append(str(tmp))
print(' '.join(ans))
|
p02582 | s284259450 | Wrong Answer | s = input()
s = s.replace('S', '')
print(len(s)) |
p03699 | s332010219 | Accepted | n = int(input())
s1 = [int(input()) for i in range(n)]
total = sum(s1)
if total%10 != 0:
print(total)
else:
s1.sort()
s2=[s for s in s1 if s%10!=0]
if s2:
print(total-s2[0])
else:
print(0)
|
p03371 | s343042050 | Accepted | a,b,c,x,y = map(int,input().split())
l = 0
flg = x
if x > y:
l += (x - y) * a
flg = y
elif x < y:
l += (y - x) * b
else:
pass
l += flg * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m)) |
p03317 | s705039586 | Accepted | # https://atcoder.jp/contests/abc101/tasks/arc099_a
import sys
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
N, K = read_ints()
if N == K:
print(1)
exit()
A = read_ints()
K -= 1
i = A.index(1)
# 怒りの全探索
ans = 0
for j in range(0, N - 1, K):... |
p02613 | s022794259 | Accepted | len = int(input())
dict = {}
for i in range(len):
result = input()
if result in dict:
dict[result] += 1
else:
dict[result] = 1
keys = ['AC', 'WA', 'TLE', 'RE']
for k in keys:
cnt = 0
if k in dict:
cnt = dict[k]
print("{0} x {1}".format(k, cnt)) |
p03109 | s339065823 | Accepted | S=input()
S=S.replace("/","")
if int(S)<=20190430:
print("Heisei")
else:
print("TBD")
|
p03250 | s202610463 | Accepted | a, b, c = sorted(map(int, input().split()))
print(10*c+b+a) |
p02631 | s978717035 | Accepted | from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
m = a[0]
for i in range(1,n):
m = m^a[i]
sol = [str(m^a[i]) ... |
p02647 | s379649163 | Wrong Answer | n,k=map(int,input().split())
a=list(map(int,input().split()))
b=0
aa=[]
for i in range(n):
for j in range(n):
if j-a[j]-0.5<=i and j+a[j]+0.5>=i:
b+=1
elif j-a[j]-0.5>i:
break
aa.append(b)
b=0
# print(i,*a)
print(*aa) |
p03208 | s185872420 | Accepted | N , K =map(int,input().split())
H = []
for i in range(N):
H.append(int(input()))
H =sorted(H)
ans = 1000000000
for j in range(N-K+1):
ans=min(int(H[j+K-1])-int(H[j]),ans)
print(ans) |
p03544 | s822173231 | Accepted | n = int(input())
a,b = 2,1
for i in range(n):
a,b=b,a+b
print(a) |
p03243 | s446199291 | Accepted | n = int(input())
print(111 * ((n-1) // 111 + 1)) |
p03633 | s545904840 | Accepted | from math import gcd
from functools import reduce
def lcm(a, b):
return (a * b) // gcd(a, b)
def main():
n = int(input())
t = {int(input()) for _ in range(n)}
print(reduce(lcm, t))
if __name__ == '__main__':
main()
|
p02777 | s036538591 | Accepted | s,t = input().split()
a,b = map(int,input().split())
A = input()
if A == s:print(a-1,b)
else:print(a,b-1) |
p03803 | s537653963 | Wrong Answer | tmp = list(map(int, input().split()))
for i in range(2):
if tmp[i] == 1:
tmp[i] == 14
A, B = tmp
if A > B:
print("Alice")
elif A == B:
print("Draw")
else:
print("Bob") |
p02623 | s055910677 | Accepted | from itertools import accumulate
from bisect import bisect_left,bisect_right
def main():
n,m,k=map(int,input().split())
a=[0]+list(accumulate(map(int,input().split())))
b=[0]+list(accumulate(map(int,input().split())))
result = 0
for i in range(n+1):
tmp = k - a[i]
if tmp < 0:
... |
p03017 | s881050327 | Accepted | #!/usr/bin/env python3
# from numba import njit
# input = stdin.readline
# @njit
def solve(a,b,c,d,s):
if '##' in s[a:c+1] or '##' in s[b:d+1]:
return False
if c < d:
return True
elif c > d:
if "..." in s[b-1:d+2]:
return True
else:
return False
else:
raise ValueError
def ... |
p03448 | s927827482 | Wrong Answer | A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if (A*500 + B*100 + C*50)==X:
counts += 1
print(counts) |
p03944 | s495286912 | Accepted | W, H, N = map(int, input().split())
a1, a2, a3, a4 = [], [], [], []
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
a1.append(x)
elif a == 2:
a2.append(x)
elif a == 3:
a3.append(y)
else:
a4.append(y)
max_x = max(a1) if a1 else 0
min_x = min(a2) if a... |
p02922 | s085875375 | Accepted | A,B=map(int,input().split())
count=0
while count*A-count+1<B:
count+=1
print(count) |
p03814 | s806260460 | Accepted | s = input()
A = s.find("A")
Z = s.rfind("Z")
print(Z-A+1)
|
p03481 | s310822988 | Accepted | x,y = list(map(int,input().split()))
a = [x]
while a[-1] < y:
a.append(a[-1]*2)
if a[-1] > y: a.pop(-1)
print(len(a))
|
p02661 | s146390331 | Accepted | n = int(input())
a = []
b = []
for i in range(n):
A,B = map(int,input().split())
a.append(A)
b.append(B)
a.sort()
b.sort()
if n%2==1:
ans = b[n//2]-a[n//2]+1
else:
x1 = a[n//2]+a[n//2-1]
x2 = b[n//2]+b[n//2-1]
ans = x2-x1+1
print(ans) |
p02888 | s136422155 | Wrong Answer | N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
#print(L)
bucket=[0]*(2*10**3+1)
for val in L:
bucket[val]+=1
#print(bucket)
for i in range(2*10**3):
bucket[i+1] += bucket[i]
#print(bucket)
cnt=0
for i in range(0, N-2):
for j in range(i+1, N-1):
cnt += bucket[L[i]+L[j]-1] - b... |
p02658 | s200776627 | Accepted | n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a:
print(0)
exit()
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
print(ans) |
p02793 | s167627582 | Wrong Answer | import numpy as np
import math
n = input()
arr = np.array(list(map(int, input().split())))
def lcm(a):
from fractions import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
lcm_v = lcm(arr)
div_arr = lcm_v / arr
print(int(div_arr.sum()) % (10**9 + 7)) |
p03962 | s149743446 | Accepted | #AtCoDeerくんとペンキ
def ABC_46_A():
A,B,C = map(int, input().split())
iroha = [0 for i in range(3)]
iroha = []
iroha.append(A)
iroha.append(B)
iroha.append(C)
if iroha.count(A)==3:
print(1)
elif iroha.count(A)==2 or iroha.count(B)==2:
print(2)
else:
print(3)
if ... |
p03011 | s847265604 | Wrong Answer | p,q,r = map(int, input().split())
print(max(p+q,q+r,r+p))
|
p03069 | s864640020 | Accepted | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count('.')
cnt = cnt_w
for i in range(n):
... |
p02665 | s293979619 | Accepted | import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N = ri()
A = rl()
if N == 0:
if A[0] == 1:
print(1)
else:
print(-1)
exit()
num = 1
M = [0] * (N+1)
for i in range(N+1):
M[i] = num
if A[i] > num:
... |
p02860 | s073192549 | Accepted | n = int(input())
s = input()
t = s[:n//2]
if n%2 != 0:
print('No')
elif s == t*2:
print('Yes')
else:
print('No') |
p03252 | s837358574 | Accepted | from collections import Counter
s=input()
t=input()
c1=list(Counter(s).values())
c2=list(Counter(t).values())
c1.sort()
c2.sort()
print('Yes' if c1==c2 else 'No')
|
p03289 | s458578409 | Accepted | import re
print('AC' if re.match('^A[a-z]+C[a-z]+$', input()) else 'WA') |
p03760 | s272121283 | Wrong Answer | O = input()
E = input()
for o, e in zip(O, E):
print(o,e, sep='', end='')
if abs(len(O) - len(E)) == 1:
if abs(len(O) - len(E)) > 1:
print(O[-1])
elif abs(len(O) - len(E)) < 1:
print(E[-1]) |
p03338 | s773707049 | Accepted | n = int(input())
s = input()
#n = 45
#s = "tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir"
ans = 0
alphabet = [chr(i) for i in range(97, 97+26)]
def count(i):
num = 0
a=list(set(list(s[:i])))
b=list(set(list(s[i:])))
for i in alphabet:
if (i in a) & (i in b):
num += 1
return num
f... |
p03475 | s775864859 | Wrong Answer | n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
ans = 0
for j in range(i, n-1):
if csf[j][1] >= ans:
ans = csf[j][0] + csf[j][1]
else:
ans += csf[j][0] + ans % csf[j][2]
print(ans) |
p02948 | s814935879 | Accepted | # 参考 yy4さん
from heapq import heappush, heappop
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
vmax = pow(10, 5)
jobs = {i:[] for i in range(1,vmax + 1)}
for _ in range(n):
a, b = map(int, input().split())
jobs[a].append(-b)
ans =0
hq = []
for i in range(1, m + 1):
... |
p02727 | s085189629 | Accepted | x,y,a,b,c=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
A.sort()
B.sort()
A=A[a-x:]
B=B[b-y:]
D=A+B+C
D.sort(reverse=True)
sum=0
for i in range(x+y):
sum+=D[i]
print(sum)
|
p02578 | s973924003 | Accepted | N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
if A[i+1] < A[i]:
ans += A[i]-A[i+1]
A[i+1] = A[i]
print(ans)
|
p02911 | s270929020 | Wrong Answer | import numpy as np
n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]
#cnt = [0 for _ in range(n)]
win = [0 for _ in range(n)]
#p = np.array([k for _ in range(n)])
for ai in a:
win[ai-1] += 1
print(win)
for w in win:
if k-q+w<=0: print('No')
else: print('Yes') |
p03555 | s367663173 | Wrong Answer | S=str(input())
T=str(input())
print('Yes' if S[0]==T[2] and S[1]==T[1] and S[2]==T[0] else 'No') |
p02897 | s030531649 | Wrong Answer | n = int(input())
print((n // 2) / n) |
p03131 | s871539550 | Accepted | k, a, b = map(int, input().split())
if b - a <= 2 or k-(a-1) <= 0:
ans = 1 + k
else:
k = k - (a-1)
n = k // 2
ans = (n-1) * (b-a) + b + (k-2*n)
print(ans) |
p03971 | s138090987 | Accepted | n,a,b =map(int, input().split())
s =input()
ca = 0
cb = 0
for i in s:
if i=='a' and ca+cb<a+b:
ca+=1
print('Yes')
elif i=='b' and ca+cb<a+b and cb<b:
cb+=1
print('Yes')
else:
print('No') |
p02958 | s703036329 | Accepted | n = int(input())
s = list(map(int, input().split()))
if s == sorted(s):
print('YES')
else:
s1 = sorted(s)
count = 0
for i in range(n):
if s1[i]!=s[i]: count+=1
if count==2:
print('YES')
else:
print('NO')
|
p03293 | s156050280 | Wrong Answer | s = input()
ans = ""
for i in list(s):
if i == "0" or i == "1":
ans += i
else:
ans = ans[:-1]
print (ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.