problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03035
s164389135
Accepted
n=input().split() A=int(n[0]) B=int(n[1]) if 13<=A: print(B) elif 6<=A<=12: print(int(B/2)) elif A<=5: print("0")
p03059
s876046614
Wrong Answer
a,b,t=map(int,input().split()) print(((t+0.5)//a)*b)
p02939
s018954130
Accepted
s=input() a=len(s) cnt=0 l=0 r=1 W='aaa' while r<a+1: if s[l:r]!=W: cnt+=1 W=s[r-1:r] r+=1 l=r-1 else: cnt+=1 W=s[r-1:r+1] r+=2 l=r-1 if r!=a+1: cnt-=1 print(cnt)
p02601
s258102527
Wrong Answer
a,b,c=map(int,input().split()) k=int(input()) d=b e=c while a>b: b=b*2 while b>c: c=c*2 f=b/d g=c/e h=f//2 i=g//2 if k>=h+i: print('Yes') else: print('No')
p02860
s657251817
Accepted
N = int(input()) S = list(input()) cnt = 0 if N % 2 == 1: print("No") else: for i in range(1,N//2 + 1): if S[i-1] != S[N//2 + i - 1]: cnt = 1 if cnt == 0: print("Yes") else: print("No")
p03617
s099723417
Wrong Answer
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main(): q,h,s,d = map(int,input().split()) n = int(input()) q=4*q h=2*h d=d//2 p1=min(q,h,s) p2=min(2*s,2*d) if n%2==0: print(n*p2) else: c=n//2 print(c*p2+p1) if __name__=="__main__": main()
p03219
s041632354
Accepted
L = list(map(int,input().split())) print(L[0]+L[1]//2)
p02861
s999650641
Accepted
from sys import stdin as s from math import sqrt as sq lx=[] ly=[] c=0 n=int(s.readline()) for i in range(n): x,y=map(int,s.readline().split()) lx.append(x) ly.append(y) for i in range(n): for j in range(i+1,n): c+=sq((lx[i]-lx[j])**2+(ly[i]-ly[j])**2) print(c*2/n)
p02785
s835813051
Accepted
n, k = map(int, input().split()) h = sorted(map(int, input().split())) # print(h) if k >= len(h): k = len(h) for _ in range(k): h.pop(-1) answer = sum(h) print(answer)
p03657
s704984762
Wrong Answer
print('Possible' if sum(list(map(int, input().split())))%3==0 else 'Impossible')
p03617
s886869842
Accepted
q,h,s,d=map(int,input().split()) n=int(input()) l=min(q*n*8,h*n*4,s*n*2,d*n) if l != d*n: print(l//2) else: m=min(q*4,h*2,s) print((d*(n-1))//2+m if n%2==1 else l//2)
p03435
s898064998
Accepted
grid = [list(map(int, input().split())) for _ in range(3)] for i in range(3): c = grid[i][0] for j in range(3): grid[i][j] -= c ans = 'Yes' if grid[0] == grid[1] and grid[1] == grid[2] else 'No' print(ans)
p02624
s537181524
Accepted
n=int(input()) #print(sum([((n//i)*(i+(n//i*i))//2) for i in range(1,n+1)])) ans=0 for i in range(1,n+1): ans+=((n//i)*(i+(n//i*i))//2) print(ans)
p03338
s129112969
Accepted
n = int(input()) s = list(input()) l = [] for i in range(n): l.append(len(set(s[:i]) & set(s[i:]))) print(max(l))
p02833
s250274079
Accepted
import math N = int(input()) if N % 2 == 1: print(0) else: zero_count = 0 if N == 0: print(0) else: for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か zero_count += (N//2)//(5**i) print(int(zero_count))
p02602
s866127520
Wrong Answer
import numpy as np n,k=input().split() n=int(n) k=int(k) clist=list(map(int,input().split())) for i in range(len(clist[k:])): i=i+k x=np.prod(clist[i-k:i]) if(x<((x*clist[i])//clist[i-k])): print("Yes") else: print("No")
p02862
s100885421
Wrong Answer
a,b=map(int,input().split()) if (2*b-a)%3!=0 or (2*a-b)%3!=0: print(0) n=(2*b-a)//3 m=(2*a-b)//3 p = 10**9+7 def nCr(n,r): if r*2>n: return nCr(n,n-r) else: a = b = 1 for i in range(r): a = a * (n - i) % p b = b * (r - i) % p return (a * pow(b,p-2,p)) % p print(nCr((m+n),m))
p02718
s686096024
Wrong Answer
N,M = list(map(int, input().split())) A = list(map(int, input().split())) sum_a = sum(A) ans = 0 for i,a in enumerate(A): if a > sum_a / (4 * M): ans += 1 if ans >= M: print('Yes') else: print('No')
p04011
s698717805
Accepted
l=[int(input()) for i in range(4)] if(l[0]>l[1]): a=l[1]*l[2]+(l[0]-l[1])*l[3] else: a=l[0]*l[2] print(a)
p03657
s915169203
Accepted
A,B = map(int,input().split()) if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0: print("Possible") else: print("Impossible")
p02700
s805453484
Accepted
A,B,C,D = map(int,input().split()) if (A+D-1)//D >= (C+B-1)//B: print("Yes") else: print("No")
p02726
s457955529
Accepted
n, x, y = map(int, input().split()) ans=[0] * n for i in range(1, n+1): for j in range(i+1, n+1): dist1 = j-i dist2 = abs(x-i)+abs(y-j)+1 d = min(dist1,dist2) ans[d] += 1 for i in range(1, n): print(ans[i])
p02848
s018102851
Wrong Answer
n = int(input()) s = input() ans = '' for i in s: ans += chr((ord(i)+n-1 - ord('A'))%26 + 1 + ord('A')) print(ans)
p02756
s865621929
Wrong Answer
s = input() q_number = int(input()) reverse_flag = 1 for i in range(q_number): temp = input().split() if temp[0] == "1": reverse_flag = reverse_flag * -1 else: if int(temp[1])*reverse_flag == 1 or -2: s = temp[2] + s else: s = s + temp[2] if reverse_flag == -1: s = s[::-1] print(s)
p03612
s373697115
Accepted
n = int(input()) p = list(map(int, input().split())) cnt = 0 increased = False for i in range(n): if increased: increased = False continue if p[i] == i+1: cnt += 1 i += 1 increased = True print(cnt)
p03644
s880168926
Wrong Answer
N=int(input()) j=0 for i in range(1,N+1): if 2**i <=N: j=2**i print(j)
p02759
s967814740
Accepted
n=int(input()) if n&1: print((n+1)//2) else: print(n//2)
p02982
s852397721
Accepted
import itertools N,D=map(int,input().split()) X=[] for _ in range(N): X.append(list(map(int,input().split()))) n=[i for i in range(N)] comb=itertools.combinations(n,2) conunter=0 for c in comb: XI=X[c[0]] XJ=X[c[1]] total=0 for d in range(D): total+=(XI[d]-XJ[d])**2 total=total**0.5 if(total.is_integer()): conunter+=1 print(conunter)
p02570
s132551600
Wrong Answer
def ans(): if t==0: return "N0" if d//s <=t: return "Yes" else: return "No" d, s, t = map(int, input().split()) print(ans())
p03474
s546154854
Accepted
# ABC084B a, b = map(int, input().split()) s = input() ans = 'Yes' if s[a] != '-': ans = 'No' else: for i, c in enumerate(s): if (c < '0' or c > '9') and i != a: ans = 'No' break print(ans)
p02708
s107248002
Accepted
n, k = map(int,input().split()) mod = 10 ** 9 + 7 ans = 0 for i in range(k, n+2): min_i = (i-1) * i // 2 max_i = i * (2*n - i + 1) // 2 ans += max_i - min_i + 1 ans %= mod print(ans)
p02660
s195650840
Accepted
import math n = int(input()) count = 0 p = n for z in range(2, int(math.sqrt(n)) + 1): e = 1 while n % z ** e == 0: n //= z ** e count += 1 e += 1 if n % z == 0: #これを行わなければ,素因数同士でかける場合も含んでしまう. while n % z == 0: n //= z if n != 1: count += 1 if count == 0 and p != 1: count = 1 print(count)
p02613
s112856364
Accepted
def main(): N = int(input()) di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0} for _ in range(N): di[input()] += 1 for k, v in di.items(): print(f"{k} x {v}") if __name__ == "__main__": main()
p02601
s471452564
Accepted
a,b,c=map(int,input().split()) k=int(input()) for i in range(k): if b<=a: b*=2 elif c<=b: c*=2 if a<b<c: print('Yes') else: print('No')
p02793
s774656273
Accepted
from fractions import gcd from functools import reduce n = int(input()) aaa = list(map(int, input().split())) lcm = reduce(lambda a, b: a * b // gcd(a, b), aaa) print(sum(lcm // a for a in aaa) % 1000000007)
p03251
s902197684
Accepted
n, m, X, Y = map(int, input().split()) x = list(map(int, input().split())) + [X] y = list(map(int, input().split())) + [Y] if min(y)-max(x) >= 1: print('No War') else: print('War')
p04011
s314060643
Accepted
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N <= K: print(N * X) else: print(X * K + Y * (N - K))
p02987
s124424729
Accepted
import collections S = input() C = collections.Counter(S) ans = "No" if C.most_common()[0][1] == 2 and C.most_common()[1][1] == 2: ans = "Yes" print(ans)
p03043
s978225043
Accepted
import math N, K = map(int, input().split()) ans = 0 for i in range(1,N+1): tmp = math.log(K/i, 2) x = int(math.log(K/i,2)) if i >= K: ans += 1/N else: if tmp - x != 0: x += 1 ans += 1/N * (0.5)**x print(ans)
p02773
s858076679
Wrong Answer
import collections n=int(input()) s=[input() for k in range(n)] s1=[k for k in list(sorted(set(s))) if s.count(k)>1] c=collections.Counter(s) p=[] for i in s1: p.append(c[i]) for j, x in enumerate(p): if(x == max(p)): print(s1[j])
p03605
s171075697
Accepted
N = input() if '9'in N: print('Yes') else: print('No')
p02862
s387116402
Accepted
x, y= map(int, input().split()) mod=10**9+7 import math a=(2*y-x)//3 b=(2*x-y)//3 if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0: print(0) else: L=[1]*(a+b+1) for i in range(1,a+b+1): L[i]=L[i-1]*i L[i]=L[i]%mod p=pow(L[a], mod-2, mod) q=pow(L[b], mod-2, mod) ans=(L[a+b]*p*q)%mod print(ans)
p03042
s146527471
Wrong Answer
S = input() highInt = int(S[0:2]) lowInt =int(S[2:4]) if highInt < 13 and lowInt < 13: ans = 'AMBIGUOUS' elif highInt > 12 and lowInt > 12: ans = 'NA' elif highInt < 13: ans = 'MMYY' else: ans = 'YYMM' print(ans)
p02811
s485184062
Wrong Answer
n, m = map(int, input().split()) if 500 * n > m: print("Yes") else: print("No")
p03944
s984130676
Wrong Answer
W,H,N=map(int,input().split()) xl,xr,yh,yl=0,W,H,0 for i in range(N): x,y,a=map(int,input().split()) if a==1: xl=max(xl,x) elif a==2: xr=min(xr,x) elif a==3: yl=max(yl,y) elif a==4: yh=min(yh,y) print(max((xr-xl)*(yh-yl),0))
p03803
s102285325
Wrong Answer
A,B=map(int,input().split()) if A==B: print('Draw') elif A < B or B==1 and A!=1: print('Bob') else: print('Alice')
p02935
s898821351
Accepted
n = int(input()) v = list(map(int, input().split())) newv = sorted(v) for i in range(n-1): newv[i+1] = (newv[i] + newv[i+1])/2 print(newv[n-1])
p03041
s217193156
Accepted
N, K = map(int, input().split()) S = input() ans = S[:K-1]+S[K-1].lower()+S[K:] print(ans)
p02720
s742255071
Accepted
from collections import deque k = int(input()) queue = deque([i for i in range(1, 10)]) ans = 1 for _ in range(k): ans = queue.popleft() right_digit = ans % 10 if right_digit == 0: queue.append(ans * 10 + right_digit) queue.append(ans * 10 + right_digit + 1) elif right_digit == 9: queue.append(ans * 10 + right_digit - 1) queue.append(ans * 10 + right_digit) else: queue.append(ans * 10 + right_digit - 1) queue.append(ans * 10 + right_digit) queue.append(ans * 10 + right_digit + 1) print(ans)
p03475
s047235193
Accepted
from math import ceil N = int(input()) dia = [0]*(N-1) for i in range(N-1): c,s,f = map(int,input().split()) dia[i] = (c,s,f) for i in range(N-1): time = 0 for j in range(i,N-1): c,s,f = dia[j] if time > s: x = (time - s)/f s += ceil(x)*f time = s + c print(time) print(0)
p02577
s685607235
Accepted
n = int(input()) total = 0 n = str(n) for i in range(len(n)): total += int(n[i]) if total % 9 == 0: print('Yes') else: print('No')
p03035
s367529356
Accepted
def mapt(fn, *args): return list(map(fn, *args)) def Input(): return mapt(int, input().split(" ")) def main(): a, b = Input() if a >= 13: print(b) elif 6 <= a <= 12: print(b//2) else: print(0) main()
p03493
s609313024
Accepted
number = input() sum = 0 for i in range(3): if number[i] == '1': sum += 1 print(sum)
p03163
s008032600
Accepted
N,W=map(int,input().split()) dp=[-1]*(W+1) dp[0]=0 for _ in range(N): w,v=map(int,input().split()) for i in range(W+1)[::-1]: if dp[i]!=-1 and i+w<=W: dp[i+w]=max(dp[i+w],dp[i]+v) print(max(dp))
p03011
s324744659
Accepted
l = list(map(int, input().split())) l = sorted(l) print(l[0] + l[1])
p02729
s855372865
Accepted
N, M = map(int, input().split()) if N == 1: print(int((M*(M-1))/2)) elif M == 1: print(int((N*(N-1))/2)) else: print(int((N*(N-1))/2)+int((M*(M-1))/2))
p02694
s237988049
Accepted
#ABC165 x = int(input()) a = 100 ans = 0 while a < x: a = a*101//100 ans+=1 print(ans)
p03457
s819805122
Accepted
def main(): N = int(input()) posi = [0, 0] time = 0 txy = [[int(i) for i in input().split()] for _ in range(N)] for t, x, y in txy: move = abs(posi[0] - x) + abs(posi[1] - y) if (t - time) < move or (t - time) % 2 != move % 2: return print("No") time = t posi = [x, y] print("Yes") if __name__ == '__main__': main()
p02909
s101576394
Accepted
# import math # from itertools import permutations as permus # from fractions import gcd # from collections import deque,Counter import numpy as np # import scipy as scp # 入力の受け取り s = input() lis = ["Sunny","Cloudy","Rainy"] idx = (lis.index(s) +1) % 3 ans = lis[idx] print(ans)
p03331
s682295953
Wrong Answer
num=int(input()) ans_list=[] ans=400000 for i in range(2,num-1): max_list=list(map(int,str(num-i))) min_list=list(map(int,str(i))) tot=sum(max_list)+sum(min_list) ans=min(tot,ans) print(ans)
p03605
s827349778
Accepted
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N = readline().strip() if '9' in N: print('Yes') else: print('No') return if __name__ == '__main__': main()
p03944
s975548785
Accepted
w, h, n = map(int, input().split()) high = h low = 0 left = 0 right = w for i in range(n): x, y, a = map(int, input().split()) if a == 1: left = max(left, x) elif a == 2: right = min(right, x) elif a == 3: low = max(low, y) else: high = min(high, y) print(max(high - low, 0)*max(right - left, 0))
p02607
s012369467
Wrong Answer
n =int(input()) a =list(map(int,input().split())) ans =0 for i in range(1,n,2): if a[i]%2==1: ans +=1 print(ans)
p03719
s825671567
Accepted
a, b, c = map(int, input().split()) if a <= c <= b: print('Yes') else: print('No')
p02676
s494324057
Accepted
K=int(input()) S=input() if len(S)<=K: print(S) else: print(S[:K]+"...")
p02661
s949171046
Accepted
n = int(input()) a, b = [*map(list, zip(*[[*map(int, input().split())] for _ in range(n)]))] a.sort() b.sort() l0, r0 = a[(n-1)//2], b[(n-1)//2] if n % 2 == 1: print(r0-l0+1) else: l1, r1 = a[n//2], b[n//2] print((r1+r0)-(l1+l0)+1)
p02755
s235861303
Accepted
import math a = list(map(int,input().split())) flag = False for i in range(1001): if math.floor(i*0.08) == a[0]: if math.floor(i*0.1) == a[1]: flag = True break if flag: print(i) else: print("-1")
p02646
s070872392
Wrong Answer
A,V = map(int,input().split()) B,W = map(int,input().split()) N = int(input()) if W > V: print('No') else: if abs(A-B) <= N*(V-W): print('Yes') else: print('No')
p02935
s281996888
Accepted
import bisect N = int(input()) v = list(map(int,input().split())) v.sort() while len(v) > 1: l = v.pop(0) r = v.pop(0) t = (l+r)/2 bisect.insort(v,t) print(v[0])
p03852
s950450580
Wrong Answer
c = input() boin = 'aeiou' if boin.find(c) == -1: print("consonant") else: print("voel")
p02777
s798597346
Accepted
s,t = input().split() a,b = map(int,input().split()) u = input() if u==s: print(a-1, b) else: print(a,b-1)
p02761
s668891075
Accepted
N,M = map(int,input().split()) SC = [tuple(map(int,input().split())) for i in range(M)] if N==1: r = range(0,10) elif N==2: r = range(10,100) else: r = range(100,1000) for n in r: n = str(n) for s,c in SC: s -= 1 if n[s] != str(c): break else: print(n) exit() print(-1)
p03796
s571846766
Accepted
import sys def I(): return int(sys.stdin.readline().rstrip()) N = I() ans = 1 for i in range(1,N+1): ans *= i ans %= 10**9+7 print(ans)
p02790
s710019829
Accepted
a,b = (int(i) for i in input().split()) ans = "" roop = max(a,b) min_num_str = str(min(a,b)) for i in range(roop): ans += min_num_str print(ans)
p02618
s584422219
Accepted
d=int(input()) c=list(map(int,input().split())) s=[] for i in range(d): t=list(map(int,input().split())) s.append(t) for i in range(d): p=sorted(s[i]) print(s[i].index(p[-3])+1)
p04044
s160549603
Accepted
N, L = map(int, input().split()) S = [] for _ in range(N): S.append(input()) S = sorted(S) choniki = str(S[0]) for i in range (1, N): choniki=choniki+S[i] print(choniki)
p03107
s843998481
Wrong Answer
s = input() cnt_0, cnt_1 = s.count('0'), s.count('1') print(max(cnt_0, cnt_1) - min(cnt_0, cnt_1))
p03680
s144813694
Wrong Answer
N = int(input()) button = [int(input()) for _ in range(N)] ans = 0 number = button[0] while ans <= N + 5: number = button[number - 1] ans += 1 if number == 2: print(ans + 1) exit() print(-1)
p02761
s772880761
Wrong Answer
f=0 N, M = map(int, input().split()) list = [] for i in range(M): a,b=input().split() list.append((int(a), int(b))) for i in range(1000): f=0 for j in range(M): if int(i/(10**(N-list[j][0])))%10 != list[j][1]: f=1 break if f==0: print(i) break if f==1: print(-1)
p04020
s440437024
Wrong Answer
N = int(input()) ans = 0 prev = 0 for i in range(N): a = int(input()) ans += a // 2 if prev == 1 and a % 2: ans += 1 a -= 1 prev = a % 2 print(ans)
p02718
s239703094
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) sum, c = 0, 0 for i in a: sum += i for i in a: if sum / (m * 4) <= i: c += 1 if c > m: print("Yes") else: print("No")
p03681
s215406967
Accepted
#065_C n,m=map(int,input().split()) mod=10**9+7 f=[i for i in range(max(n,m)+1)] for i in range(1,max(n,m)): f[i+1]=(f[i+1]*f[i])%mod ans=0 if abs(n-m)==1: ans=(f[n]*f[m])%mod elif n==m: ans=(f[n]**2)*2%mod print(ans)
p03760
s777868215
Wrong Answer
O = list(input()) E = list(input()) N = len(O)+len(E) if len(O)>len(E): E += ' ' elif len(O)<len(E): O += ' ' print(E) print(O) answer = [] for i,j in zip(O,E): answer.append(i) answer.append(j) print(''.join(answer))
p03478
s171158757
Accepted
N, A, B = map(int, input().split()) total = 0 for i in range(1, N+1): nstr = str(i) s = 0 for c in nstr: s += int(c) if A <= s <= B: total += i print(total)
p02717
s474978977
Wrong Answer
X, Y, Z = map(int, input().split()) data = [X, Y, Z] data[0] = Z data[1] = X data[2] = Y print(data)
p02744
s508795326
Accepted
def dfs(n, i, s, maxi): global ans maxi = max(i, maxi) s += chr(i) if n == N: ans += [s] return for ii in range(97, maxi+2): dfs(n+1, ii, s, maxi) N = int(input()) i = 97 ans = [] dfs(1, 97, '', 97) ans = sorted(ans) for a in ans: print(a)
p02843
s296778893
Accepted
N=int(input()) coins = [100,101,102,103,104,105] dp = [int(i%coins[0]==0) for i in range(N+1)] for coin in coins[1:]: for i in range(coin,N+1): dp[i] += dp[i - coin] if dp[-1] != 0: print(1) else: print(0)
p02731
s371253977
Accepted
l = int(input()) x = l/3 print(x**3)
p03324
s414292735
Accepted
d, n = map(int, input().split()) if n < 100: print(n * (100 ** d)) else: print((n + 1) * (100 ** d))
p03474
s096047831
Wrong Answer
import sys a,b = map(int,input().split()) s = input() if not s[:a].isdigit() or not s[a]=='-' or not s[a+2:].isdigit(): print("No") else: print("Yes")
p02714
s717001868
Accepted
N=int(input()) S=input() r = S.count("R") g = S.count("G") b = S.count("B") out =r*g*b for i in range(0,N): w = 1 while i+w*2<N: if S[i]!=S[i+w] and S[i]!=S[i+2*w] and S[i+w]!=S[i+2*w]: out = out -1 w = w+1 print(out)
p02627
s505913209
Wrong Answer
a = input() if a.isupper(): print(a.upper()) elif a.islower(): print(a.lower())
p03427
s471964921
Accepted
N = input() c = N[0] K = len(N) temp = int(c + "9"*(K-1)) temp_s = sum(int(a) for a in list(str(temp))) if temp <= int(N): print(temp_s) else: print(temp_s - 1)
p03254
s848932598
Accepted
import sys input = sys.stdin.readline def main(): N, x = map(int, input().split()) a_list = list(map(int, input().split())) ans = 0 for a in sorted(a_list): if a <= x: ans += 1 x -= a else: break if x == 0 or ans != N: print(ans) else: print(max(ans - 1, 0)) if __name__ == '__main__': main()
p03545
s861993992
Accepted
num = list(input()) n = len(num) - 1 for i in range(2**n): temp = [0]*(len(num)+n) lst = ["-"]*n for j in range(n): if i&(1<<j): lst[j] = "+" temp[::2] = num temp[1::2] = lst wa = eval("".join(temp[:])) if wa == 7: print("".join(temp[:]) + "=7") exit()
p02996
s059597350
Accepted
n = int(input()) ab = [list(map(int, input().split())) for _ in range(n)] sorted_ab = sorted(ab, key=lambda AB: AB[1]) ans = 'Yes' t = 0 for AB in sorted_ab: t += AB[0] if t > AB[1]: ans = 'No' break print(ans)
p02615
s962578458
Accepted
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) def main(): N = int(input()) A = list(map(int,input().split())) As = sorted(A) res = 0 for i in range(1,N): res += As[N-1-i//2] print(res) main()
p02948
s552418861
Accepted
from heapq import heapify,heappop,heappush N,M=map(int,input().split()) item=[list(map(int,input().split())) for i in range(N)] item.sort(key=lambda x:x[0]) que=[] heapify(que) ans=0 j=0 for i in range(1,M+1): while(j<N and item[j][0]<=i): heappush(que,-item[j][1]) j+=1 if que: ans+=-heappop(que) print(ans)
p04034
s231415953
Wrong Answer
n, m = map(int, input().split()) N = [1]*n P = [1] + [0]*(n-1) for i in range(m): x, y = list(map(lambda tmp: tmp-1, map(int, input().split()))) P[y] = (P[y]*N[y]+P[x])/(N[y]+1) N[x] -= 1; N[y] += 1 P[x] = 0 if N[x]==0 else P[x] print(sum(map(bool, P)))
p03408
s200251963
Accepted
from collections import Counter N = int(input()) S = [input() for _ in range(N)] M = int(input()) T = [input() for _ in range(M)] Counter_S = Counter(S) Counter_T = Counter(T) Counter_plus = Counter_S - Counter_T if len(Counter_plus.values()): print(max(Counter_plus.values())) else: print(0)