problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03221 | s447744542 | 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]))
for i in range(m):
p, y, num = city[i]
x = prefecture[p-1]
name[num-1] += "{}{}".... |
p03971 | s053046278 | Wrong Answer | N,A,B = map(int,input().split())
S = input()
pass_human = 0
overseas = 0
for i in S:
if i == "a":
if pass_human < A+B:
print("YES")
pass_human += 1
else:
print("NO")
elif i == "b":
if pass_human < A+B and overseas < B:
print("YES")
... |
p03627 | s185207006 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
a.sort()
tmp = a[0]
ans = []
for i in range(1,len(a)):
if tmp == a[i]:
ans.append(tmp)
else:
tmp = a[i]
ans = set(ans)
ans = list(ans)
if len(ans) < 2:
print(0)
else:
print(ans[len(ans)-1]*ans[len(ans)-2]) |
p02789 | s885960614 | Accepted | import sys
import math
import bisect
def main():
n, m = map(int, input().split())
if m == n:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
|
p02814 | s258609921 | Wrong Answer | import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
half_a=[ai//2 for ai in a]
# print(half_a)
lcm=half_a[0]
for i in range(n-1):
a,b=lcm,half_a[i+1]
lcm=a*b//math.gcd(a,b)
# print(lcm)
pow_cnt=-1
tmp=half_a[0]
while tmp%2==0:
pow_cnt+=1
tmp=tmp//2
flag=True
for ai in half_a[1:]:
... |
p02833 | s618387951 | Accepted | def readinput():
n=int(input())
return n
def main(n):
if n%2==1:
return 0
n=n//2
count=0
base=5
while(base<=n):
count+=n//base
base*=5
return count
if __name__=='__main__':
n=readinput()
ans=main(n)
print(ans)
|
p02744 | s035468804 | Wrong Answer | N = int(input())
que = ['a']
res = []
for i in range(1, N):
for q in que:
res.append(q + 'a')
res.append(q + 'b')
que = res
res = []
for q in que:
print(q) |
p04020 | s953068176 | Accepted | n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
for i in range(n - 1):
if a[i] & 1 and a[i + 1] > 0:
a[i] -= 1
a[i + 1] -= 1
ans += 1
for i in range(n):
ans += a[i] // 2
print(ans)
|
p03827 | s644698090 | Accepted | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
S = input()
ans = 0
cur = 0
for char in S:
if char == "I":
cur += 1
else:
cur -= 1
ans = max(ans, cur)
... |
p02640 | s123669333 | Wrong Answer | c=2
t=4
a=[]
val=0
v=0
flag=0
x,y = map(int, input().split())
for i in range(1,x+1):
val=i*c
v=i*t
a.append(val)
a.append(v)
if y in a:
flag=1
if y==(x*c):
flag=1
if y==(x*t):
flag=1
if flag==1:
print("Yes")
else:
print("No") |
p03720 | s985050954 | Accepted | N, M = tuple(map(int, input().split()))
cnt = [0 for _ in range(N+1)]
for _ in range(M):
fr, to = tuple(map(int, input().split()))
cnt[fr] += 1
cnt[to] += 1
for i in range(1, N+1):
print(cnt[i])
|
p03448 | s509590384 | Accepted | A = int(input())
B = int(input())
C = int(input())
X = int(input())
total=0
count=0
for l in range(A+1):
for m in range(B+1):
for n in range(C+1):
total=500*l + 100*m + 50*n
if(total==X): count += 1
print(count) |
p04005 | s339214117 | Accepted | a,b,c=map(int,input().split())
d=max(a,b,c)
if a%2==0 or b%2==0 or c%2==0:
print(0)
elif a%2==1 and b%2==1 and c%2==1 and d==a:
print(b*c)
elif a%2==1 and b%2==1 and c%2==1 and d==b:
print(a*c)
elif a%2==1 and b%2==1 and c%2==1 and d==c:
print(b*a) |
p03345 | s231278231 | Wrong Answer | a,b,c,k = map(int,input().split())
print(a-b) |
p02577 | s799401499 | Accepted | N = (int)(input())
if N%9==0:
print('Yes');
else:
print('No') |
p03693 | s771019256 | Accepted | r, g, b = map(str, input().split())
if int(r+g+b)%4==0:
print('YES')
else:
print('NO') |
p04034 | s885031580 | Wrong Answer | N,M = map(int,input().split())
A = [1 for _ in range(N+1)]
B = [0 for _ in range(N+1)]
B[1] = 1
cnt = 1
for _ in range(M):
a,b = map(int,input().split())
if B[a]==1 and A[a]>0:
A[a] -= 1
if A[a]==0:
cnt -= 1
A[b] += 1
if B[b]==0:
B[b]=1
cnt += ... |
p02683 | s439600033 | Wrong Answer | from numpy import array
n,m,x=map(int,input().split())
c=[]
d=[0]*(m+1)
for i in range(n):
c1=array(list(map(int,input().split())))
c.append(c1)
d+=c1
#print(c)
#c.sort(key=lambda x: x[0], reverse=True)
#print(c)
#print(d)
if(False in [x<=i for i in d[1:]]):
print(-1)
exit()
#print(d[0])
for i... |
p02658 | s395425801 | Wrong Answer | n = int(input())
*a, = map(int, input().split())
th = 1e18
mul = 1
for i in range(n):
mul *= a[i]
if mul >= th:
print(-1)
exit()
print(mul)
|
p02881 | s366971818 | Accepted | # C - Walk on Multiplication Table
# https://atcoder.jp/contests/abc144/tasks/abc144_c
import math
n = int(input())
sqr = int(math.sqrt(n)) + 1
for i in range(sqr, 0, -1):
if (n % i) == 0:
print(i + (n//i) - 2)
exit()
|
p02571 | s999205851 | Accepted | s = input()
t = input()
ans = 10000
for i in range(len(s)-len(t)+1):
cnt = 0
for j in range(len(t)):
if s[i+j] != t[j]:
cnt = cnt + 1
ans = min(ans,cnt)
print(ans) |
p03107 | s743068318 | Accepted | s = list(input())
n = len(s)
count = 0
for i in range(n):
if s[i] == "1":
count = count + 1
ans = min((n-count),count)*2
print(ans) |
p02819 | s163607967 | Accepted | X = int(input())
import math
def is_prime(n):
if n == 1: return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
while(is_prime(X)!= True):
X +=1
print(X)
|
p03208 | s376918703 | Wrong Answer | n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h = sorted(h)
diff = [h[i + 1] - h[i] for i in range(n - 1)]
diff = sorted(diff)
ans = sum(diff[:k - 1])
print(ans)
|
p03160 | s112148411 | Accepted | def frog(l,n):
dp=[0]*n
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
dp[i]=min(dp[i-1]+ abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))
return dp[n-1]
n=int(input())
l=list(map(int,input().split()))
print(frog(l,n)) |
p03637 | s049595160 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
for i in range(N):
A[i] = A[i] % 4
if A.count(2) % 2 == 0:
if A.count(0) * 2 >= (A.count(1)+A.count(3)):
print("Yes")
else:
print("No")
else:
if A.count(0) * 2 >= (A.count(1)+A.count(3)) + 1:
print("Yes")
else:
print... |
p02778 | s241191251 | Accepted | S=input()
A=len(S)
print("x"*A) |
p03474 | s131728953 | Accepted | a, b = map(int, input().split())
s = list(input())
num = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
cnt = 0
if s[a] != "-":
print("No")
exit()
else:
s.pop(a)
for i in s:
for j in num:
if i == j:
cnt += 1
if cnt != len(s):
print("No")
exit()
print("Yes") |
p03241 | s385833630 | Accepted | import math
n, m = map(int, input().split())
if n == 1:
print(m)
exit()
a = []
b = []
for i in range(1, math.ceil(math.sqrt(m))):
if m % n == 0:
print(m // n)
exit()
if m % i == 0:
b.append(i)
b.append(m // i)
#print(b)
for i in range(len(b)):
if b[i] * n <... |
p03251 | s409850251 | Wrong Answer | n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort()
y.sort()
for i in range(X+1,Y+1,1):
if i <= y[0] and i > x[-1]:
print("No war")
break
else:
print("War") |
p02881 | s237043792 | Accepted | import math
N = int(input())
answer = N+1
i = int(math.sqrt(N))
while i > 0:
if N % i == 0:
answer = i + N // i
break
i -= 1
print(answer-2) |
p02957 | s367645031 | Wrong Answer | a,b = map(int,input().split())
if (a+b) % 2 == 0:
print((a+b)/2)
else:
print("IMPOSSIBLE")
|
p02641 | s438558102 | Accepted | x,n = map(int,input().split())
p = list(map(int,input().split()))
tmp = []
for i in range(-101,102):
tmp.append(i)
if n == 0:
print(x)
else:
for i in p:
tmp.remove(i)
ans = []
for i in tmp:
a = abs(x-i)
ans.append(a)
b = min(ans)
c = x+b
d = x-b
... |
p03252 | s053432213 | Accepted | from collections import Counter
s=input()
t=input()
sc=Counter(s)
tc=Counter(t)
if len(sc)!=len(tc):
print("No")
else:
for s1,t1 in zip(sorted(sc.items(),key=lambda i: i[1]),sorted(tc.items(),key=lambda i: i[1])):
if s1[1]!=t1[1]:
print("No")
break
else:
print("Yes") |
p03377 | s250615950 | Accepted | l1 = input().split()
a = int(l1[0])
b = int(l1[1])
x = int(l1[2])
if x == a:
print("YES")
for i in range(1,b+1):
if x == a+i:
print("YES")
exit()
if x < a or (x > (a+b)):
print("NO") |
p03163 | s944140895 | Accepted | N, W = map(int, input().split())
w = {}
v = {}
for i in range(N):
w[i+1], v[i+1] = map(int, input().split())
dp = {}
dp[0] = {}
for i in range(W+1):
dp[0][i] = 0
for i in range(1, N+1):
dp[i] = {}
for j in range(0,W+1):
if j >= w[i]:
dp[i][j] = max(dp[i-1][j-w[i]]+v[i], dp[i-1][j... |
p02645 | s688394699 | Accepted | n = input()
n = n[:3]
print(n) |
p03994 | s382917419 | Wrong Answer | s = list(input())
k = int(input())
#print(ord("z"))
for i in range(len(s)):
if 123 - ord(s[i]) <= k:
k -= (123 - ord(s[i]))
s[i] = 'a'
#print(k)
#print(s, k)
k %= 26
if ord(s[-1]) + k > 122:
s[-1] = chr(ord(s[-1]) + k - 26)
else:
s[-1] = chr(ord(s[-1]) + k)
ans = ""
for i in s:
ans += i
print(ans) |
p03673 | s909365160 | Accepted | from collections import deque
n = int(input())
a = [int(x) for x in input().split()]
b = deque()
for i in range(n):
if i % 2 == 0:
b.append(a[i])
else:
b.appendleft(a[i])
if n % 2 != 0:
b.reverse()
b = list(b)
for i in range(len(b)-1):
print(b[i],end = " ")
print(b[-1])
|
p02712 | s226876428 | Accepted | num = int(input())
count = 0
for i in range(num):
if (i + 1) % 15 == 0:
pass
elif (i + 1) % 3 == 0:
pass
elif (i + 1) % 5 == 0:
pass
else:
count += i + 1
print(count)
|
p03062 | s686875462 | Accepted | n = int(input())
a = list(map(int, input().split()))
ab = [abs(i) for i in a]
cnt = 0
for i in a:
if i < 0:
cnt += 1
if 0 in a or cnt % 2 == 0:
print(sum(ab))
else:
print(sum(ab) - min(ab) * 2) |
p02833 | s559009799 | Wrong Answer | import sys
stdin = sys.stdin
import copy
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
if n % 2 != 0:
print(0)
else:
n2 = copy.copy(n)
n5 = copy.copy(n)
c2, c5 = 0, 0
while n2 > 1:
n2 //= 2
c2 += n2
... |
p02548 | s912033730 | Accepted | N=int(input())
x=0
for n in range(1,N):
x+=(N-1)//n
print(x)
|
p02982 | s813258932 | Wrong Answer | n, d = map(int, input().split())
l=[0]*n
for i in range(n):
l[i] = list(map(int, input().split()))
print(l) |
p02829 | s674319989 | Accepted | A = int(input())
B = int(input())
for i in range(1,4):
if (i != A)and(i != B):
print(i) |
p02784 | s223019376 | Accepted | h, n = map(int, input().split())
if sum(list(map(int, input().split()))) >= h:
print('Yes')
else:
print('No') |
p02629 | s256950701 | Accepted | n=int(input())
res=""
while n!=0:
mod=n%26
n=n//26
if mod==0:
mod=26
n-=1
res+=chr(97+mod-1)
print(res[::-1]) |
p03106 | s655779538 | Accepted | #120_B
A,B,K=map(int,input().split())
from fractions import gcd
x=gcd(A,B)
cnt=0
for i in range(x,0,-1):
if x%i==0:
cnt+=1
if cnt==K:
print(i)
exit() |
p04044 | s008978500 | Accepted | n,l=map(int,input().split())
list=[]
for _ in range(n):
list.append(input())
list.sort()
ans=""
for i in list:
ans+=i
print(ans) |
p02708 | s923262872 | Wrong Answer | def mapint_inp():
return map(int, input().split())
def intinp():
return int(input())
N, K = mapint_inp()
MOD = 10*9+7
ans = 0
for i in range(K, N+2):
mn = i*(i-1) // 2
mx = i*(2*N-i+1) // 2
ans += mx - mn + 1
print(ans%MOD) |
p03815 | s035367652 | Accepted | x = int(input())
result = (x-1)//11*2+1
if (x-1)%11 >5:
result += 1
print(result)
|
p03001 | s410045682 | Wrong Answer | W, H, x, y = map(int, input().split())
if x == W / 2 and y == H / 2:
print(W*H/2, 1)
exit()
if x == y == 0 or (x == W and y == 0) or (x == 0 and y == H) or (x == W and y == H):
print(W*H/2, 0)
exit()
if abs(x-W/2) < abs(y-H/2):
ans = min(x, W-x) * H
else:
ans = W * min(y,H-y)
print(ans, 0)
|
p02813 | s236343427 | Accepted | import itertools
n = int(input())
p_li = tuple(map(int, input().split()))
q_li = tuple(map(int, input().split()))
n_li = [ i for i in range(1, n+1)]
s = list(itertools.permutations(n_li, len(n_li)))
s.sort()
p = 0
q = 0
for i in range(len(s)):
if s[i] == p_li:
p = i
if s[i] == q_li:
q = i
... |
p02663 | s541819422 | Accepted | a,b,c,d,e=map(int,input().split())
print(c*60+d-a*60-b-e) |
p02711 | s726691027 | Accepted | n = str(input().split())
ans = 0
for i in range(len(n)):
if n[i] == "7":
ans = 1
if ans == 1:
print("Yes")
else:
print("No") |
p03338 | s823484150 | Accepted | N = int(input())
S = input()
ans = 0
for i in range(N):
ans = max(ans,len(set(S[:i])&set(S[i:])))
print(ans) |
p02675 | s298190832 | Accepted | N = input()[-1]
if N in ['2', '4', '5', '7', '9']:
print('hon')
elif N in ['0', '1', '6', '8']:
print('pon')
else:
print('bon') |
p04020 | s831833260 | Accepted | n = int(input())
a = [int(input()) for i in range(n)]
c = 0
for i in range(n-1):
if a[i]%2 == 1 and a[i+1]>=1:
c += 1
a[i] -= 1
a[i+1] -= 1
for i in range(n):
c += a[i]//2
a[i] -= (a[i]//2)*2
print (c) |
p02624 | s687447474 | Wrong Answer | n = int(input())
ans = 0
for k in range(1, n + 1):
m = n / k
mc2 = (m * (m + 1)) / 2
ans += mc2 * k
print(ans) |
p03524 | s832372115 | Wrong Answer | import math
S = list(input())
ls = len(S)
na = S.count("a")
nb = S.count("b")
nc = ls - na - nb
mi = min(na, nb, nc)
if ls == 1:
print("YES")
exit()
elif ls == 2:
if S[0] == S[1]:
print("NO")
else:
print("YES")
temp = math.ceil(ls / 4)
if mi >= temp:
print("YES")
else:
print("... |
p03043 | s131227584 | Wrong Answer | import math
N, K = map(int, input().split(' '))
s = 0
for i in range(1, N + 1):
if K > i:
s += 1 / math.pow(2, math.ceil(math.log2(K)) - math.ceil(math.log2(i)))
else:
s += 1
print(s / N)
|
p04044 | s995318357 | Wrong Answer | N,L = map(int,input().split())
L = sorted(input().split())
print(''.join(L)) |
p03997 | s196267434 | Wrong Answer | a = int(input())
b = int(input())
h = int(input())
print((a+b) * h / 2) |
p03210 | s790574995 | Wrong Answer | X = int(input())
if X == 7 or X == 5 or X == 3:
print('Yes')
else:
print('No') |
p02744 | s197636572 | Accepted | N = int(input())
def f(s):
if len(s) == N:
print(s)
return
for i in range(97, ord(max(list(s)))+1+1):
ns = s + chr(i)
f(ns)
f('a') |
p03438 | s943096181 | Accepted | import heapq
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B_pool = 0
deck = []
for i in range(N):
heapq.heappush(deck, A[i]-B[i])
while deck:
diff = heapq.heappop(deck)
if diff <= 0:
B_pool += (-diff) // 2
else:
B_pool -= diff
if B_pool >= 0:
print('Yes')
else:
... |
p03351 | s617803600 | Accepted | S = input()
data_list = S.split()
ab_distance = abs(int(data_list[0])-int(data_list[1]))
ac_distance = abs(int(data_list[0])-int(data_list[2]))
bc_distance = abs(int(data_list[1])-int(data_list[2]))
d = int(data_list[3])
if ac_distance <= d:
print('Yes')
elif ab_distance <= d and bc_distance <= d:
print('Yes')
... |
p03252 | s595650670 | Accepted | from collections import defaultdict
d = defaultdict(str)
k = defaultdict(str)
S = input()
T = input()
ans = "Yes"
for i in range(len(S)):
if d[S[i]] and d[S[i]] != T[i]:
ans = 'No'
break
if k[T[i]] and k[T[i]] != S[i]:
ans = 'No'
break
d[S[i]] = T[i]
k[T[i]] = S[i]
print(ans) |
p03854 | s225599297 | Accepted | s=input()
l=len(s)
while s!=0:
l=len(s)
if s.rfind("dream")==l-5:
s=s[:l-5]
elif s.rfind("dreamer")==l-7:
s=s[:l-7]
elif s.rfind("erase")==l-5:
s=s[:l-5]
elif s.rfind("eraser")==l-6:
s=s[:l-6]
else:
break
if len(s)==0:
print("YES")
else:
print("NO"... |
p02918 | s656499754 | Wrong Answer |
N, K = map(int, input().split())
S = input()
s = S[0]
count = 0
k = 0
for i in range(1, len(S)):
#print(S[i], s)
if s == S[i]:
count += 1
else:
s = S[i]
k += 1
count += K * 2
if K == k // 2 + 1:
count -= 1
print(count) |
p02613 | s840055536 | Wrong Answer | N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
S = input()
if S == 'AC':
ac += 1
elif S == 'WA':
wa += 1
elif S == 'TLE':
tle += 1
elif S == 'RE':
re += 1
else:
break
print('AC ×',ac)
print('WA ×',wa)
print('TLE ×',tle)
print('RE ×',re) |
p02731 | s179373655 | Accepted | l = int(input())
ans = (l/3)**3
print(ans) |
p02633 | s318563368 | Accepted | X=int(input())
cnt=0
for i in range(1,10**7):
cnt+=X
if cnt%360==0:
print(i)
break |
p02571 | s401124718 | Accepted | s = input()
t = input()
l = len(s)
t_l = len(t)
l_gap = l - t_l
x = 0
for i in range(l_gap + 1):
c = 0
for m in range(t_l):
if t[m] == s[i+m]:
c += 1
if c > x:
x = c
print(t_l -x) |
p02731 | s211938342 | Accepted | L = int(input())
r = L/3
print(r**3) |
p02603 | s394425350 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
money = 1000
cnt = 0
if A[0] < A[1]:
cnt += 1000 // A[0]
money -= cnt * A[0]
for i in range(1, N-1):
if A[i] <= A[i - 1] and A[i] < A[i + 1]:
cnt += money // A[i]
money -= cnt * A[i]
elif A[i] >= A[i-1] and A[i] > A[i + 1]:
mon... |
p02882 | s067758311 | Wrong Answer | import math
a,b,x = map(int,input().split())
if 2*(a**2)*b <= 2*(a**2)*x:
print(math.degrees(math.atan2(2*(b-x/(a**2)), a)))
else:
print(math.degrees(math.atan2(b, 2*x/(a*b)))) |
p03284 | s110705615 | Wrong Answer | # input
N, K = map(int, input().split())
print(N % K) |
p02701 | s963663371 | Wrong Answer | lis =[]
abc =[]
count = 0
N = int(input())
lis =[lis.append(input()) for _ in range(N)]
for i in lis:
if any(i == j for j in abc):
pass
else:
abc.append(i)
count += 1
print(count)
|
p02683 | s433284186 | Accepted | import numpy as np
import itertools
Cmin = 10**10
N, M, X = map(int, input().split())
L = np.array([[int(j) for j in input().split()] for i in range(N)])
for i in range(N):
for idx in itertools.combinations(list(range(N)), i+1):
A = np.zeros(M+1, dtype=int)
A = A + np.sum(L[list(idx)], axis=0)
if A[0] < ... |
p03160 | s010499872 | Accepted | n=int(input())
a=list(map(int,input().split()))
dp=[10**9]*(n)
dp[0]=0
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]))
if i==1:
continue
dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]))
print(dp[n-1]) |
p03854 | s005216035 | Wrong Answer | s=input()
while len(s)>7:
if s[-5:]=='dream' or s[-5:]=='erase':
s=s[-5:]
elif s[-6:]=='eraser':
s=s[-6:]
else:
s=s[-7:]
print('YES' if s=='erase' or s=='dreamer' or s=='dream' or s=='eraser' or s=='' else 'NO') |
p04033 | s385229059 | Wrong Answer | a,b=map(int,input().split())
if a==0 or b==0:
print('Zero')
elif a>0 and b>0:
print('Positive')
elif a<0 and b>0:
print('zero')
elif a<0 and b<0:
if (b-a)%2==0:
print('Negative')
else:
print('Positive') |
p03284 | s329538862 | Accepted | n, k= map(int, input().split())
print(0) if n%k == 0 else print(1) |
p02909 | s005940396 | Accepted | from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
###############################################################################\
s=input()
a="Sunny"
b="Cloudy"
c="Rainy"
if s==a:
print(b)
elif... |
p03241 | s230927078 | Wrong Answer | N, M = map(int, input().split())
for i in range(M//N, int(N**0.5)-1, -1):
if M % i == 0:
print(i)
break |
p02732 | s528224667 | Wrong Answer | n = int(input())
balls = list(map(int, input().split()))
conbi = [0]*n
result = 0
for i in balls:
conbi[i-1] +=1
print(conbi)
for j in range(n):
result += (conbi[j]*(conbi[j]-1))//2
for k in balls:
print(result-conbi[k-1]+1)
|
p03131 | s849632662 | Accepted | #!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
K,A,B=pin()
t=(B-A)/2
if K<A or B-A<=2:
print(K+1)
return
K-=(A-1)
... |
p03814 | s887104098 | Accepted | s = input()
start = 1000000
end = 0
for i in range(len(s)):
#print(s[i])
if s[i] == 'A' and start > i:
start = i
#print(start)
elif s[i] == 'Z' and end < i:
end = i
print(end - start + 1)
|
p02832 | s038562571 | Accepted | n = int(input())
a = list(map(int,input().split()))
cnt = 0
num = 1
for i in range(n):
if a[i] != num:
cnt += 1
continue
num += 1
print(cnt if cnt != n else -1) |
p02727 | s070625780 | Accepted | x, y, a, b ,c = map(int, input().split())
pList = sorted(list(map(int, input().split())), reverse=True)
qList = sorted(list(map(int, input().split())), reverse=True)
rList = sorted(list(map(int, input().split())), reverse=True)
xyList = sorted(pList[:x] + qList[:y]) # 小さい順
for i, r in enumerate(rList):
if len(xyLis... |
p02854 | s558367440 | Wrong Answer | def resolve():
N = int(input())
A = list(map(int, input().split()))
if N%2 == 0:
print(abs(sum(A[:N//2]) - sum(A[N//2:])))
else:
if A[0] <= A[-1]:
print(abs(sum(A[:N//2+1]) - sum(A[N//2+1:])))
if A[0] > A[-1]:
print(abs(sum(A[:N//2]) - sum(A[N//2:])))
reso... |
p02793 | s834642309 | Accepted | import fractions
n=int(input())
t = list(map(int, input().split()))
x=0
ans = t[0]
for i in range(1, n):
ans = ans * t[i] // fractions.gcd(ans, t[i])
for j in range(n):
x+=ans//t[j]
print(x%(10**9+7)) |
p02646 | s650052247 | Accepted | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
print('YES' if abs(a - b) <= t * (v - w) else 'NO')
|
p02711 | s794366449 | Accepted | # 2つの入力を空白で分割し、数値化
s = input()
for c in s:
if c == "7":
print("Yes")
exit(0)
else:
pass
print("No")
|
p03328 | s453635109 | Accepted | # https://atcoder.jp/contests/abc099/tasks/abc099_b
a, b = map(int, input().split())
num = 0
for i in range(1, 999):
if b - a == i + 1:
num = i
break
ans = num * (num + 1) // 2 - a
print(ans) |
p03038 | s433382882 | Wrong Answer | N, M = map(int, input().split())
A = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(M)]
bc = sorted(bc, key=lambda x:x[1], reverse=True)
idx = 0
for i in range(N):
if A[i] < bc[idx][1]:
bc[idx][0] -= 1
A[i] = bc[idx][1]
if bc[idx][0] == 0:
idx += 1
if idx == len(... |
p02681 | s104354436 | Wrong Answer | S = input()
T = input()
if S in T and S != T and len(T) == len(S) + 1:
print('Yes')
else:
print('No')
|
p02791 | s876638729 | Wrong Answer | N = input()
N = [int(s) for s in N]
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]
count = 0
for x in range(N[0]):
print("x",x)
flag = 1
for i in range(x+1):
print("i",i)
if Line[x] > Line[i] :
print(Line[x],Line[i])
flag = 0
print("... |
p02547 | s269848303 | Accepted | N = int(input())
cnt = 0
f = False
for i in range(N):
d1, d2 = map(int, input().split())
if d1 == d2:
cnt += 1
else:
cnt = 0
if cnt >= 3:
f = True
if f:
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.