problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02970 | s291408131 | Wrong Answer | import math
N,D = map(int,input().split())
print(math.ceil(D/(N*2+1))) |
p02778 | s738258191 | Accepted | S=input()
L = len(list(S))
ans = ""
for i in range(L):
ans = ans + "x"
print(ans) |
p02780 | s022971989 | Accepted | n,k=list(map(int,input().split()))
m=list(map(int,input().split()))
s=sum(m[:k])
mx=s
for i in range(1,n-k+1):
s-=m[i-1]
s+=m[i+k-1]
mx=max(mx,s)
print((mx+k)/2)
|
p03377 | s819225637 | Accepted | a, b, x= map(int, input().split())
if a <= x <= a + b:
print('YES')
else:
print('NO') |
p03220 | s908026698 | Wrong Answer | N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))
pointID = -1
min_diff = 9999999999
for i in range (N):
#地点i の温度 と 平均気温の差(絶対値)
diff = abs(T - 1000 * H[i] - A)
if diff < min_diff:
pointID = i+1
min_diff = diff
print(pointID) |
p03262 | s981665680 | Wrong Answer | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
def lcm(a,b):
return a*b//math.gcd(a,b)
if __name__ == "__main__":
n,x = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
a = bisect.bisect_left(X,x)
X.insert(a,x)
ans = []
for i in range(1,len(X)):
diff = X[i] - X[i-1]
ans.append(diff)
print(min(ans))
|
p03324 | s741135274 | Wrong Answer | import numpy as np
D, N = [int(i) for i in input().split()]
ans = (N+1)*10**(2*D)
print(ans) |
p04020 | s559032734 | Accepted | n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
cur_sum = 0 # 0が入るまでのsum
for i in range(n):
if a[i] == 0:
ans += cur_sum // 2
cur_sum = 0
else:
cur_sum += a[i]
ans += cur_sum // 2
print(ans)
|
p02629 | s150498873 | Wrong Answer | n = int(input()) - 1
num = 1
while 26**num < n:
n -= 26**num
num += 1
r = []
while 25 < n:
r.append(n % 26)
n //= 26
r.append(n)
if len(r) < num:
for i in range(num - len(r)):
r.append(0)
for i in r[::-1]:
print(chr(97+i), end='') |
p03408 | s373614186 | Accepted | s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
res=0
for i in set(s):
res=max(s.count(i)-t.count(i),res)
print(res) |
p03944 | s230243885 | Accepted | W,H,N = map(int,input().split())
XW = [1] * W
YW = [1] * H
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
XW[:x] = [0]*x
elif a == 2:
XW[x:] = [0]*(W-x)
elif a == 3:
YW[:y] = [0]*y
elif a == 4:
YW[y:] = [0]*(H-y)
print(sum(XW)*sum(YW))
|
p02607 | s809595511 | Accepted | N = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
counter = 0
for i in range(1,N+1,2):
if a[i] % 2 == 1:
counter += 1
print(counter) |
p03086 | s732984580 | Wrong Answer | checklist=["A","C","G","T"]
sn = list(input())
answer = 0
count = 0
for s in sn :
if s in checklist:
count += 1
else :
answer = max(answer,count)
count = 0
print(answer)
print(sn) |
p03854 | s178753359 | Accepted | s = list(input());tmp = ""
t = ["maerd", "remaerd", "esare", "resare"]
while s:
tmp += s.pop()
if tmp in t: tmp = ""
if len(tmp)>=7: print("NO")
else: print("YES") |
p02639 | s247836711 | Accepted | print(input().split().index('0')+1) |
p03761 | s176943101 | Accepted | txt = ""
num = (int)(input())
message = [[0 for i in range(26)] for j in range(num)]
for i in range(num):
text = input()
for j in text:
#print(ord(j))
message[i][ord(j) - 97] += 1
#print(message[0])
r_message = [[0 for i in range(num)] for j in range(26)]
for i in range(26):
for j in range(num):
r_message[i][j] = message[j][i]
#print(r_message)
for j in range(26):
for k in range(min(r_message[j])):
txt += chr(j + 97)
print(txt) |
p02860 | s653011194 | Accepted | import sys
n=int(input())
s=input()
if n%2==1:
print("No")
sys.exit()
s1=s[0:int(n/2)]
s2=s[int(n/2):]
if s1==s2:
print("Yes")
else:
print("No")
#print(s1)
#print(s2) |
p02860 | s993468956 | Accepted | n=int(input())
s=input()
m=n//2
print("Yes" if s==s[0:m]+s[0:m] else "No") |
p03243 | s304707818 | Wrong Answer | n = input()
mx = 0
for i in range(3):
if int(n[i]) > mx:
mx = int(n[i])
print(str(mx)*3) |
p03994 | s585475700 | Wrong Answer | N = list(str(input()))
K = int((input()))
for i in range(len(N) - 1):
if ord(N[i]) >= 98 and K >= 123 - int(ord(N[i])):
K = K - (123 - ord(N[i]))
N[i] = 'a'
a = ord(N[len(N)-1]) + K
if a > 122:
b = (a - 98) % 25
a = b + 97
N[len(N)-1] = chr(a)
for j in N:
print(j, end='') |
p03625 | s531936064 | Accepted | import collections
i = int(input())
li = list(map(int,input().split()))
c = collections.Counter(li)
li = list(set(li))
li.sort(reverse=True)
ans = 1
x = 0
i = 0
for i in li:
if c[i] > 3 and x == 0:
ans = i**2
x += 2
elif c[i] > 1:
ans *= i
x += 1
if x == 2:
break
if x == 2:
print(ans)
else:
print(0) |
p04005 | s285403250 | Accepted | A,B,C = map(int, input().split())
if A%2==0 or B%2==0 or C%2==0:
print(0)
else:
print(min(A*B,B*C,C*A)) |
p03545 | s283972514 | Accepted | def main():
import sys
a = input()
ans =0
for i in range(2**3):
t = a[0]
for j in range(3):
if i & (1 <<j):
t = t +'+'
else:
t = t +'-'
t = t +a[j+1]
ans =eval(t)
if ans == 7:
print(t+'=7')
sys.exit()
if __name__ =='__main__':
main()
|
p02773 | s021478345 | Accepted | d = {}
n = int(input())
for i in range(n):
x = input()
if x in d:
d[x] += 1
else:
d[x] = 1
mx = 0
ans = []
for itm in d.items():
if itm[1] == mx:
ans.append(itm[0])
elif itm[1] > mx:
ans = [itm[0]]
mx = itm[1]
else:
continue
ans.sort()
for x in ans:
print(x) |
p02697 | s187793472 | Wrong Answer | n, m = map(int, input().split())
m = (n-1) // 2
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):
if (n - d in memo):
cnt += 1
d += 1
memo.add(d)
if cnt > 1 or a < 1 or a+d > n:
print(1/0)
print(a, a+d)
a -= 1
d += 2
|
p02779 | s922117406 | Accepted | N =int(input())
d = {}
for word in input().split():
if word in d:
print("NO")
exit()
else:
d[word] = 1
print("YES") |
p02935 | s714645952 | Wrong Answer | n=int(input())
vlis=list(map(int,input().split()))
while len(vlis)>=2:
tlis=[]
for i in range(len(vlis)-1):
t=(vlis[i]+vlis[i+1])/2
tlis.append(t)
vlis.insert(tlis.index(min(tlis)),min(tlis))
for i in range(2):
vlis.pop(tlis.index(min(tlis))+1)
print(int(vlis[0])) |
p03435 | s683696772 | Accepted | import sys
input=sys.stdin.buffer.readline
# a1 = 0としてよい
A = [0,None,None]
B = [None,None,None]
bl = True
for i in range(3):
C = [int(x) for x in input().split()]
for j,c in enumerate(C):
if A[i] is None:
A[i] = c - B[j]
if B[j] is None:
B[j] = c - A[i]
if A[i]+B[j] != c:
bl = False
answer = 'Yes' if bl else 'No'
print(answer)
|
p02880 | s279208622 | Accepted | n=int(input())
for i in range(1,10):
if n%i==0 and n//i<10:
print('Yes')
exit()
print('No') |
p03456 | s631174904 | Accepted | a,b = input().split()
n = int(a+b)
if (n ** .5).is_integer():
print('Yes')
else:
print('No') |
p03011 | s006583691 | Accepted | L = list(map(int, input().split()))
list.sort(L)
print(L[0]+L[1]) |
p02606 | s320088217 | Wrong Answer | l,r,d = map(int,input().split())
b = l/d
a = r/d
if d==1:
b-=1
print(int(a)-int(b)) |
p02664 | s967992210 | Accepted | t=input()
print(t.replace('?','D')) |
p02695 | s305050777 | Accepted | from itertools import combinations_with_replacement
n, m, q = map(int, input().split())
abcd = [[int(i) for i in input().split()] for _ in range(q)]
s = 0
for p in combinations_with_replacement(range(1, m + 1), n):
t = 0
for a, b, c, d in abcd:
t += d * (p[b - 1] - p[a - 1] == c)
s = max(s, t)
print(s) |
p02912 | s404195767 | Wrong Answer | N,M = map(int,input().split())
A = list(map(int,input().split()))
import heapq
heapq.heapify(A)
for i in range(M):
a = A.pop()
a = a//2
heapq.heappush(A,a)
ans = sum(A)
print(ans) |
p03434 | s011248816 | Accepted | N=int(input())
s = sorted(list(map(int,input().split())))
print(abs(sum(s[:N:2])-sum(s[1:N:2]))) |
p02835 | s783505010 | Accepted | ans = sum(map(int, input().split()))
if ans > 21:
print('bust')
else:
print('win') |
p02598 | s071237511 | Wrong Answer | n,k,*a = map(int,open(0).read().split())
def func(b):
c = k
for i in a:
if b == 0:
c -= (i+1)
else:
c -= i//b
if c < 0:
return False
return True
l = 0
r = max(a)
while(r>l):
lr = (l+r)//2
if func(lr):
r = lr
else:
l = lr + 1
print(r) |
p03285 | s497066171 | Wrong Answer | N=int(input())
print('Yes' if N%4==0 or N%7==0 or (N%7)%4==0 else 'No') |
p03795 | s892672611 | Accepted | num_ate_food = int(input())
total_cost = num_ate_food * 800
cash_back = 0
if num_ate_food >= 15:
cash_back = (num_ate_food // 15) * 200
total_paid = total_cost - cash_back
print(total_paid) |
p02765 | s208916862 | Accepted | def main():
inside_rate, outside_rate = map(int, input().split())
correction = 0
if inside_rate < 10:
correction = 100 * (10 - inside_rate)
print(outside_rate + correction)
main() |
p02578 | s792943035 | Accepted | N = int(input())
A = list(map(int, input().split()))
cnt = 0
if N == 1:
print(0)
exit()
for i in range(1, N):
if A[i] >= A[i - 1]:
continue
else:
cnt += A[i - 1] - A[i]
A[i] = A[i - 1]
print(cnt)
|
p02787 | s605160886 | Accepted | h, n = map(int, input().split())
A = [0] * n
B = [0] * n
for i in range(n):
A[i], B[i] = map(int, input().split())
dp = [float("inf")] * (h+1)
dp[0] = 0
for i in range(h):
for j in range(n):
next_index = min(i + A[j], h)
dp[next_index] = min(dp[next_index], dp[i] + B[j])
print(dp[-1])
|
p02783 | s397803350 | Accepted | h, a = map(int, input().split())
cnt = 0
while h > 0:
h -= a
cnt += 1
print(cnt) |
p03693 | s257315391 | Accepted | print("YES" if int(input().replace(" ", "")) % 4 == 0 else "NO") |
p02731 | s681358300 | Accepted | L = int(input())
print((L/3)**3) |
p02917 | s399654484 | Accepted | import copy
N = int(input())
Bs = list(map(int, input().split()))
As = [copy.copy(Bs[0])]
As.extend(copy.copy(Bs))
#print(Bs)
#print(As)
for index, B in enumerate(Bs):
# print(Bs)
# print(As)
if B < As[index]:
As[index] = B
#print(As)
print(sum(As))
|
p04034 | s989980357 | Accepted | n, m = map(int, input().split())
X = [0]*n
C = [1]*n
X[0] = 1
for i in range(m):
x, y = map(int, input().split())
x, y = x-1, y-1
if X[x] == 1:
X[y] = 1
if C[x] == 1:
X[x] = 0
C[x] -= 1
C[y] += 1
else:
C[x] -= 1
C[y] += 1
ans = sum(X)
print(ans)
|
p04029 | s103091984 | Accepted | n =int(input())
ans = 0
for i in range(1,n+1):
ans += i
print(ans) |
p03416 | s634557184 | Accepted | a, b = map(int, input().split())
ans = 0
for i in range(a, b+1, 1):
i = str(i)
if i==i[::-1]:
ans+=1
print(ans) |
p02717 | s031011657 | Wrong Answer | import sys
import math
import bisect
def main():
a, b, c = map(int, input().split())
#a, b = (b, a)
a, b = b, a
b, c = c, b
print('%d %d %d' % (a, b, c))
if __name__ == "__main__":
main()
|
p02811 | s017241867 | Accepted | K,X=map(int,input().split())
print("Yes" if 500*K>=X else "No") |
p02983 | s826698000 | Wrong Answer | def nyu():
L,R = map(int,input().split())
return L,R
def convert(LL,LR):
LL = LL % 2019
LR = LR % 2019
return LL,LR
def kansu(LL,LR):
ans = 2020
for ll in range(LL,LR):
for lr in range(LL+1,LR+1):
tmp = (ll * lr) % 2019
if ans > tmp:
ans = tmp
print(ans)
ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)
|
p03612 | s538328096 | Accepted | N=int(input())
k=0
s=0
m=0
L=list(map(int,input().split()))
for i in range(N):
if L[i]==i+1:
m+=1
else:
s+=m//2+m%2
m=0
s+=m//2+m%2
print(s) |
p02677 | s460595388 | Accepted | import math
A,B,H,M=map(int,input().split())
b=2*math.pi*(M/60)
a=2*math.pi*((H/12) + (M/(60*12)))
t=abs(a-b)
if t>math.pi:
t=2*math.pi-t
print(math.sqrt(A**2+B**2-2*A*B*math.cos(t))) |
p03075 | s634632953 | Wrong Answer | list = [int(input()) for i in range(5)]
K = int(input())
lists = sorted(list)
no = 0
for I in range(4):
if lists[no+1] - lists[no] <= K:
no += 1
else:
print(":(")
exit()
print("Yay!") |
p03548 | s912162938 | Wrong Answer | x,y,z=map(int,input().split())
print((x-1)//(y+z)) |
p02641 | s159163464 | Wrong Answer | x, n = map(int, input().split())
seisulist = list(map(int, input().split()))
if n != 0 and max(seisulist) > x:
size = max(seisulist) + 1
else:
size = x + 1
numlist = [i for i in range(-1*size,size) if i not in seisulist]
xretu = [x]*len(numlist)
hikizan = [abs(s-t) for (s, t) in zip(numlist, xretu)]
sa = min(hikizan)
if x-sa not in seisulist:
print(x-sa)
else:
print(x+sa) |
p03293 | s654486129 | Wrong Answer | S=input()
T=input()
l=len(S)
if S==T:
print("Yes")
exit()
for i in range(l):
tmp=S[-1]
S=S.strip(S[-1])
new_string=tmp+S
if new_string==T:
print("Yes")
exit()
S=new_string
print("No") |
p02720 | s558110506 | Accepted | from collections import deque
k = int(input())
q = deque(range(1, 10))
for _ in range(k):
x = q.popleft()
if x % 10 != 0:
q.append(x*10 + x%10 - 1)
q.append(x*10 + x%10)
if x % 10 != 9:
q.append(x*10 + x%10 + 1)
print(x) |
p02622 | s890033808 | Accepted | #!/usr/bin/env python3
s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
if s[i] != t[i]:
ans += 1
print(ans)
|
p02596 | s851739332 | Accepted | K = int(input())
sevens = 7
if K % 2 == 0 or K % 5 == 0:
print(-1)
else:
i = 1
while True:
if sevens % K == 0:
print(i)
break
sevens = (sevens % K)*10+7
i += 1
|
p03493 | s507221356 | Wrong Answer | s = list(map(str, input().split()))
counter = 0
for si in s:
if si == '1':
counter += 1
print(counter)
|
p03017 | s988040430 | Wrong Answer | N, A, B, C, D = map(int, input().split())
s = input()
flag = True
if C > D:
if "..." in s[B-2:D+1]:
flag = False
if "##" in s:
print("Yes")
else:
if flag:
print("No")
else:
print("Yes")
else:
if "##" in s:
print("No")
else:
print("Yes") |
p02600 | s680245227 | Accepted | X = int(input())
if 400 <= X < 600:
A = 8
if 600 <= X < 800:
A = 7
if 800 <= X < 1000:
A = 6
if 1000 <= X < 1200:
A = 5
if 1200 <= X < 1400:
A = 4
if 1400 <= X < 1600:
A = 3
if 1600 <= X < 1800:
A = 2
if 1800 <= X < 2000:
A = 1
print(A)
|
p02624 | s144644036 | Wrong Answer | n=int(input())
lis=[1 for i in range(10**7)]
for i in range(2,10**7+1):
for j in range(1,(10**7)//i+1):
lis[i*j-1]+=1
print("A")
s=0
for i in range(n):
s+=lis[i]*(i+1)
print(s) |
p02935 | s016055398 | Wrong Answer | N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
a = (v[i]+v[i+1])/2
v[i+1] = int(a)
v[i] = 'A'
a = 0
print(v[-1]) |
p02612 | s253878942 | Accepted | N = int(input())
if N%1000 == 0:
print(0)
else:
print(1000-N%1000)
|
p03208 | s357643029 | Wrong Answer | N,K=map(int,input().split())
h=[int(input()) for _ in range(N)]
h.sort()
a=max(h[:K])
b=min(h[:K])
c=max(h[-K:])
d=min(h[-K:])
print(min(a-b,c-d))
|
p02707 | s865291576 | Accepted | N = int(input())
A = list(map(int, input().split()))
joushi = [0 for _ in range(N)]
for Ai in A:
joushi[Ai-1] += 1
for ans in joushi:
print(ans) |
p02602 | s091513232 | Accepted | #n=int(input())
n,k=map(int,input().split())
l=list(map(int,input().split()))
mul=1
for i in range(k):
mul=mul+l[i]
z=mul
j=0
for i in range(k,n):
z=z-l[j]
z=z+l[i]
if z>mul:
print('Yes')
else:
print('No')
j+=1
mul=z |
p02862 | s172610123 | Accepted | import sys
p=10**9+7
x,y=map(int,input().split())
if (x+y)%3!=0 or x>2*y or y>2*x:
print(0)
sys.exit()
a=(-x+2*y)//3
b=(2*x-y)//3
A=1
for i in range(1,a+1):
A=A*i
A=A%p
B=1
for i in range(1,b+1):
B=B*i
B=B%p
AB=1
for i in range(1,a+b+1):
AB=AB*i
AB=AB%p
C=(AB*pow(A,p-2,p)*pow(B,p-2,p))%p
print(C) |
p03327 | s923406673 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
N = int(input())
print('ABC'if N < 1000 else 'ABD')
if __name__ == "__main__":
main()
|
p02854 | s016699312 | Accepted | n = int(input())
A = list(map(int, input().split()))
ans = 10**18
total = sum(A)
acc = 0
for a in A:
acc += a
ans = min(ans, abs(total - acc * 2))
print(ans) |
p02700 | s482596705 | Accepted | a,b,c,d = map(int,input().split())
for i in range(10**10):
if i%2 == 0:
c-=b
else:
a-=d
if a <= 0:
print("No")
break
elif c <= 0:
print("Yes")
break |
p03331 | s640956270 | Wrong Answer | n=input()
ans=0
for i in range(len(n)):
ans+=int(n[i])
if ans==n[0]:
ans+=9
print(ans) |
p03319 | s220463445 | Accepted | N,K=map(int, input().split())
*A,=map(int, input().split())
print(((N-1)+(K-1)-1)//(K-1)) |
p02996 | s316090546 | Accepted | n = int(input())
ab = [list(map(int,input().split())) for i in range(n)]
ab = sorted(ab,key=lambda x: x[1])
now = 0
for i in ab:
if i[1] >= now + i[0]:
now += i[0]
else:
print("No")
exit()
print("Yes") |
p04034 | s332601814 | Wrong Answer | import numpy as np
n, m = map(int, input().split())
probability = [0 for _ in range(n)]
ball = [1 for _ in range(n)]
probability[0] = 1
for i in range(m):
x, y = map(int, input().split())
prob = probability[x-1]
probability[x-1] = prob * (ball[x-1] - 1) / ball[x-1]
probability[y-1] += prob / ball[x-1]
ball[x-1] -= 1
ball[y-1] += 1
print(np.sum(np.array(probability) > 0)) |
p02612 | s494317320 | Wrong Answer | n = int(input())
ans = n%1000
if (0<=ans and ans<=500):
print(ans)
else:
print(1000 - ans)
|
p03944 | s668622566 | Accepted | w,h,n=map(int,input().split())
lx=0
rx=w
sy=h
iy=0
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
lx=max(lx,x)
elif a==2:
rx=min(rx,x)
elif a==3:
iy=max(iy,y)
else:
sy=min(sy,y)
x=rx-lx
y=sy-iy
if x<0 or y<0:
print(0)
exit()
print(x*y) |
p02817 | s550216553 | Wrong Answer | a, b = map(str,input().split())
print(a+b) |
p02813 | s931868402 | Wrong Answer | n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
list1 = [i for i in range(1, n + 1)]
ans_a = 0
ans_b = 0
for i in range(n):
if p[i] != 1:
ans_a += (p[i]-1)** (n-i-1)
if q[i] != 1:
ans_b += (q[i]-1) ** (n-i-1)
print(ans_a)
print(ans_b) |
p02761 | s676263742 | Wrong Answer | N, M = map(int, input().split())
sc = []
tf = True
for i in range(M):
sc.append(list(map(int, input().strip().split())))
num = []
for i in range(N):
num.append(0)
sc.sort()
for i in range(M-1):
if sc[i][0] == sc[i+1][0] and sc[i][1] != sc[i+1][1]:
tf = False
for i in sc:
if i[0] == 1 and i[1] == 0:
tf = False
else:
num[i[0]-1] = i[1]
if tf and num[0] == 0:
num[0] = 1
string = ""
for i in num:
string += str(i)
if tf == True:
print(string)
else:
print(-1) |
p02742 | s817065580 | Wrong Answer | from math import floor
N = [int(_) for _ in input().split()]
H, W = N[0], N[1]
def solve(H, W):
if H == 1 or W == 1:
return 1
cnt = int(H * W / 2)
return cnt
print(solve(H, W)) |
p03565 | s879595467 | Wrong Answer | import sys
S = input()
T = input()
s = len(S)
t = len(T)
if s < t:
print('UNRESTORABLE')
for i in range(s - t, 0, -1):
OK = True
for j in range(t):
if S[i + j] != T[j] and S[i + j] != '?':
OK = False
if OK:
for j in range(t):
SS = S[:i] + T + S[i + j + 1:]
SS = SS.replace('?', 'a')
print(SS)
sys.exit()
print('UNRESTORABLE') |
p03136 | s997980036 | Accepted | n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
x = l[0]
y = sum(l[1:])
if x < y:
print("Yes")
else:
print("No") |
p02778 | s991473369 | Wrong Answer | n = input()
print("×"*len(n)) |
p02630 | s949435248 | Accepted | n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
if i not in d:
d[i] = 1
else:
d[i] += 1
sumz = sum(l)
for _ in range(int(input())):
b,c = map(int, input().split())
if b in d:
sumz = sumz +( ((d[b]*c) - (d[b]*b)) )
if c not in d:
d[c] = d[b]
else:
d[c] += d[b]
del d[b]
print(sumz)
|
p02861 | s925265788 | Wrong Answer | from itertools import combinations
N = int(input())
town = []
for n in range(N):
x, y = map(int,input().split())
town.append((x,y))
ans = 0
for i,j in combinations(town,2):
ans += ((i[0]-j[0])**2 + (i[1]-j[1])**2)**0.5
print ((N-1)*ans/N) |
p03623 | s679305345 | Accepted | x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
print('B')
else:
print('A') |
p03607 | s301809085 | Accepted | import collections
N = int(input())
A = collections.Counter(int(input()) for T in range(N)).most_common()
Num = 0
for T in range(len(A)):
if A[T][1]%2!=0:
Num += 1
print(Num) |
p03943 | s244929901 | Accepted | l = list(map(int, input().split()))
l = sorted(l)
if l[0] + l[1] == l[2]:
print("Yes")
else:
print("No") |
p03698 | s289969788 | Accepted | s=input()
if len(s)==len(set(s)):
print('yes')
else:
print('no') |
p03416 | s845094140 | Wrong Answer | A, B = map(int, input().split())
count = 0
for i in range(A, B):
n = list(str(i))
_n = n[::-1]
if n == _n:
count += 1
print(count)
|
p02802 | s063885647 | Accepted | import numpy as np
N,M = map(int, input().split())
#A = list(map(int, input().split()))
A=[0 for _ in range(N)]
B=[0 for _ in range(N)]
C=[0 for _ in range(N)]
for i in range(M):
p,S = input().split()
p = int(p)-1
if S == "AC":
A[p] = 1
C[p] = B[p]
elif A[p]==0:
B[p] += 1
A = np.array(A)
C = np.array(C)
print(np.sum(A), np.sum(C))
|
p03106 | s028123522 | Accepted | A, B, K = map(int, input().split())
l = []
for i in range(1, 1000):
if A % i == 0 and B % i == 0:
l.append(i)
print(l[-K]) |
p02953 | s379663460 | Wrong Answer | N = int(input())
H = list(map(int, input().split()))
flg = 1
for i in range(N-1):
if H[i] - H[i+1] >= 2:
flg = 0
break
if H[i] - H[i+1] == 1:
if i == 0:
continue
if H[i-1] == H[i]:
flg = 0
break
H[i] -= 1
if flg == 1:
print('Yes')
else:
print('No') |
p03479 | s615746058 | Accepted | x, y = map(int, input().split())
ans = 0
while x <= y:
ans += 1
x *= 2
print(ans) |
p03105 | s221002022 | Accepted | A,B,C=map(int,input().split())
if A*C<=B:
print(C)
else:
print(int(B/A)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.