TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
N,K=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
F=sorted(list(map(int,input().split())))

def judge(t):
    global a,F,N,K
    K_t=K
    for i in range(N):
        target=t//F[i]
        if a[i]<=target:
            continue
        if K_t>=a[i]-target:
            K_t-=a[i]-target
        else:
            return False
    return True

t_max=a[-1]*F[0] 
t_min=-1 
while t_max>t_min+1:
    t_mid=(t_max+t_min)//2
    if judge(t_mid):
        t_max=t_mid
    else:
        t_min=t_mid
print(t_max)

N,K=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
F=sorted(list(map(int,input().split())))
import numpy as np
a=np.array(a)
F=np.array(F)

t_max=a[0]*F[-1] 
t_min=-1 
while t_max>t_min+1:
    t_mid=(t_max+t_min)//2
    K_temp=np.sum(np.maximum(a-t_mid//F,0))
    if K_temp<=K:
        t_max=t_mid
    else:
        t_min=t_mid
print(t_max)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import numpy as np

n, k = map(int, input().split())
a = list(int(i) for i in input().split())
f = list(int(i) for i in input().split())
sorted(a, reverse=True)
sorted(f, reverse=True)
a = np.array(a)
f = np.array(f)
for i in range(n):
    if a[i] < k:
        k -= a[i]
        a[i] = 0
        print(k)
    else:
        a[i] = a[i] - k
        break

ans = min(a*f)
print(ans)

import numpy as np

n, k = map(int, input().split())
a = np.array(input().split(), np.int64)
f = np.array(input().split(), np.int64)
a.sort()
f.sort()
a = a[::-1]
left = -1
right = np.max(a * f)
while left + 1 < right:
    mid = (left + right) // 2
    print(np.sum(np.maximum(a - mid // f, 0)))
    if np.sum(np.maximum(a - mid // f, 0)) <= k:
        right = mid
    else:
        left = mid

print(right)


import numpy as np

n, k = map(int, input().split())
a = np.array(input().split(), np.int64)
f = np.array(input().split(), np.int64)
a.sort()
f.sort()
a = a[::-1]
left = -1
right = np.max(a * f)
while left + 1 < right:
    mid = (left + right) // 2
    if np.sum(np.maximum(a - mid // f, 0)) <= k:
        right = mid
    else:
        left = mid

print(right)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import sys
import numpy as np


n, k = map(int,input().split())

a = np.array(sorted(list(map(int, input().split()))))
f = np.array(sorted(list(map(int, input().split())), reverse=True))

asum = a.sum()

l,r = 0, 10**13
while l != r:
    mid = (l+r)//2

    can = (asum - np.minimum(mid//f, a).sum()) <= k

    if can:
        r = mid -1
    else:
        l = mid 

print(l)

import sys
import numpy as np


n, k = map(int,input().split())

a = np.array(sorted(list(map(int, input().split()))))
f = np.array(sorted(list(map(int, input().split())), reverse=True))

asum = a.sum()

l,r = 0, 10**13
while l != r:
    mid = (l+r)//2

    can = (asum - np.minimum(mid//f, a).sum()) <= k

    if can:
        r = mid 
    else:
        l = mid +1

print(l)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import sys
read=sys.stdin.buffer.read
import numpy as np

n,k=map(int,input().split())
A=np.array(read().split(),np.int64)
F=np.array(read().split(),np.int64)
A.sort()
F.sort()
F=F[::-1]
    
def ok(x): 
    B=A-x//F
    return sum(B[B>0])<=k
    
l=-1
r=10**18
while r-l>1:
    mid=(r+l)//2
    if ok(mid):
        r=mid
    else:
        l=mid
print(r)  

def main():
    import sys
    input=sys.stdin.readline
    import numpy as np

    n,k=map(int,input().split())
    A=np.array(input().split(),dtype=np.int64)
    F=np.array(input().split(),dtype=np.int64)
    A.sort()
    F.sort()
    F=F[::-1]

    def ok(x): 
        cnt=np.maximum(0,A-x//F).sum()
        return cnt<=k
    
    l=-1
    r=10**12+1
    while r-l>1:
        mid=(r+l)//2
        if ok(mid):
            r=mid
        else:
            l=mid
    print(r)   

if __name__=='__main__':
    main()



Verdicts: Runtime Error

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))


N, K = lr()
A = np.array(lr()); A.sort()
F = np.array(lr()); F.sort()
F = F[::-1]
print(A)
print(F)
def check(x):
    limit = x // F 
    Y = A - limit
    if np.any(Y > K):
        return False
    cost = Y[Y>=0].sum()
    if cost <= K:
        return True
    else:
        return False

ok = 10 ** 15; ng = -1
while abs(ng-ok) > 1:
    mid = (ok+ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

print(ok)


import numpy as np
N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))
F = np.array(list(map(int, input().split())))
A = np.sort(A)[::-1]
F = np.sort(F)

if A.sum() <= K:
    print(0)
    exit()
if K == 0:
    print((A * F).max())
up = (A * F).max() 
low = 0 
while up > low + 1:
    mid = (up + low) // 2
    if (A - min(A, (mid // F))).sum() <= K: 
        up = mid
    else:
        low = mid
print(up)

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))


N, K = lr()
A = np.array(lr()); A.sort()
F = np.array(lr()); F.sort(); F = F[::-1]

def check(x):
    cost = np.maximum(0, A - (x // F)).sum()
    return cost <= K

ok = 10 ** 15; ng = -1
while abs(ng-ok) > 1:
    mid = (ok+ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import numpy as np

n, k = map(int,input().split()) 
a = list(map(int, input().split()))
f = list(map(int, input().split()))

if k > sum(a):
    print(0)
    exit()

a.sort(reverse=True)
f.sort()

a = np.array(a)
f = np.array(f)

lb = -1
ub = a[0]*f[-1]

while ub - lb > 1:
    x = (lb+ub)//2
    cx = np.full(n, x)
    ck = a - x//f
    ck = np.where(ck < 0, 0, ck)
    ck_sum = ck.sum()
    if ck_sum == k:
        break
    if ck_sum > k:
        lb = x
    else:
        ub = x
a_ck = a - ck
ans = a_ck * f
print(max(ans))


print(0)

import numpy as np

n, k = map(int,input().split()) 
a = list(map(int, input().split()))
f = list(map(int, input().split()))

if k > sum(a):
    print(0)
    exit()

a.sort(reverse=True)
f.sort()

a = np.array(a)
f = np.array(f)

lb = -1
ub = a[0]*f[-1]

while ub - lb > 1:
    x = (lb+ub)//2
    cx = np.full(n, x)
    ck = a - x//f
    ck = np.where(ck < 0, 0, ck)
    ck_sum = ck.sum()
    if ck_sum > k:
        lb = x
    else:
        ub = x
print(ub)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    A = LI()
    F = LI()

    for j in range(20):
        print(j, [j//i for i in F])

    
    def can_complete(t):
        
        return sum(A)-sum([t//i for i in F])<=K

    ng = -1
    ok = 10**12
    while abs(ok-ng)>1:
        m = (ng+ok)//2
        if can_complete(m):
            ok = m
        else:
            ng = m
    print(ok)

if __name__ == '__main__':
    resolve()


import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    A = np.array(LI())
    F = np.array(LI())

    A.sort()
    F.sort()
    F = F[::-1]

    
    def can_complete(t):
        return np.maximum(0, A-t//F).sum() <= K

    # for j in range(20):
    #     print(can_complete(j))

    ng = -1
    ok = max(A)*max(F)
    while abs(ok-ng)>1:
        m = (ng+ok)//2
        if can_complete(m):
            ok = m
        else:
            ng = m
    print(ok)

if __name__ == '__main__':
    resolve()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import numpy as np
N, train_max = map(int, input().split())
members = np.sort(list(map(int, input().split())))
members_sum = members.sum()
foods = np.sort(list(map(int, input().split())))[::-1]

inferenced_time_max = int(1e+6 * 1e+6)
inferenced_time_min = -1
inferenced_time = None

while inferenced_time_max > inferenced_time_min+1:
  inferenced_time = (inferenced_time_max + inferenced_time_min) // 2
  inferenced_members = np.minimum(members, inferenced_time // foods)
  if members_sum - inferenced_members.sum() <= train_max:
    inferenced_time_max = inferenced_time
  else:
    inferenced_time_min = inferenced_time

print(inferenced_time)

import numpy as np
N, train_max = map(int, input().split())
members = np.sort(list(map(int, input().split())))
members_sum = members.sum()
foods = np.sort(list(map(int, input().split())))[::-1]

inferenced_time_max = int(1e+6 * 1e+6)
inferenced_time_min = -1

while inferenced_time_max > inferenced_time_min+1:
  inferenced_time = (inferenced_time_max + inferenced_time_min) // 2
  inferenced_members = np.minimum(members, inferenced_time // foods)
  if members_sum - inferenced_members.sum() <= train_max:
    inferenced_time_max = inferenced_time
  else:
    inferenced_time_min = inferenced_time

print(inferenced_time_max)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
N,K = (int(num) for num in input().split())
Araw= list(int(num1) for num1 in input().split())
Fraw= list(int(num2) for num2 in input().split())

if sum(Araw)<=K:
    print(0)
else:
    A = sorted(Araw)
    F = sorted(Fraw)
    S = [0] * N

    for i in range(0,N,1):
        S[i] = A[i] * F[N-1-i]

    S, A = (list(x) for x in zip(*sorted(zip(S, A))))

    for i in range(K):
        S[N-1] = S[N-1] - (S[N-1] / A[N-1])
        A[N-1] = A[N-1] - 1
        S, A = (list(x) for x in zip(*sorted(zip(S, A))))
    
    print(S[N-1])


import numpy as np
import sys

input = sys.stdin.buffer.readline

N,K = map(int,input().split())
A = np.array(input().split(),np.int64)
F = np.array(input().split(),np.int64)

A.sort()
F.sort()
F_ = F[::-1]

m = -1
M = (A*F_).sum()

while (m+1)<M:
    mid = (m+M) //2
    judge = np.maximum(0,A - mid//F_).sum() <= K
    if judge:
        M = mid
    else:
        m = mid
        
print(M)    

Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import numpy as np

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

Asum = sum(A)

def test(X):
    return (Asum - np.minimum(A, X//F).sum() <= K)

l = -1
r = 10**13

while (l +1 < r):
    mid = (l + r) // 2
    if test(mid):
        r = mid
    else:
        l = mid

ans = r
print(ans)


import numpy as np

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

A = np.array(A, np.int64)
F = np.array(F, np.int64)

Asum = sum(A)

def test(X):
    return (Asum - np.minimum(A, X//F).sum() <= K)

l = -1
r = 10**12

while (l + 1 < r):
    mid = (l + r) // 2
    if test(mid):
        r = mid
    else:
        l = mid

ans = r
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum((AF[(AF - saidai) > 0] - saidai) // F[(AF - saidai) > 0])
    return count <= K


if(__name__ == "__main__"):
    main()


import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum(np.ceil((AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]))
    return count <= K


if(__name__ == "__main__"):
    main()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
import numpy as np
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
f=[int(i) for i  in input().split()]

A=np.array(sorted(a))
F=np.array(sorted(f, reverse=True))


left=-1
right=10**12
s=A.sum()
x=(left+right)//2


while left+1<right:
    if np.maximum(A-x//F,0).sum()<=k:
        
        right=x
    else:
        
        left=x
print(right)

import numpy as np
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
f=[int(i) for i  in input().split()]

A=np.array(sorted(a))
F=np.array(sorted(f, reverse=True))


left=-1
right=10**12
s=A.sum()
x=(left+right)//2


while left+1<right:
    if s-np.minimum(A , x//F).sum()<=k:
        
        right=x
    else:
        
        left=x
print(right)

import numpy as np
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
f=[int(i) for i  in input().split()]
A=np.array(sorted(a))
F=np.array(sorted(f, reverse=True))
left=-1
right=10**12
while left+1<right:
    x=(left+right)//2
    if np.maximum(A-x//F , 0).sum()<=k:
        right=x
    else:
        left=x
print(right)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The _consumption coefficient_ of Member i is A_i.  In the contest, N foods numbered 1 through N will be presented, and the _difficulty_ of Food i is F_i. The details of the contest are as follows:    * A team should assign one member to each food, and should not assign the same member to multiple foods.   * It will take x \times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.   * The score of a team is the longest time it takes for an individual member to finish the food.  Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.  What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?

Submission attempts (in order):
from math import ceil
import sys
sys.setrecursionlimit(10 ** 7)


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    f = list(map(int, input().split()))

    a.sort()
    f.sort(reverse=True)

    t = [(ae, fe) for ae, fe in zip(a, f)]

    def bs(l, m, r):
        #print(l, m, r)
        if l == m or m == r:
            return m
        cnt = 0
        for ae, fe in t:
            train = max(0, ceil((ae * fe - m) / fe))
            cnt += train

        if cnt <= k:
            return bs(l, (m - l) // 2 + l, m)

        else:
            return bs(m, (r - m) // 2 + m, r)

    ans = bs(0, 10 ** 12 // 2, 10 ** 12)

    print(ans)


if __name__ == "__main__":
    main()


import sys
sys.setrecursionlimit(10 ** 7)

import numpy as np


def main():
    n, k = map(int, input().split())
    a = np.array(input().split(), np.int64)
    f = np.array(input().split(), np.int64)

    a.sort()
    f.sort()
    f = f[::-1]

    l = -1
    r = 10 ** 13

    def test(x):
        cnt = np.maximum(0, a - x // f).sum()
        return cnt <= k

    while l + 1 < r:
        m = (l + r) // 2
        if test(m):
            r = m
        else:
            l = m

    ans = r
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
b, a=map(int, input().split())
if b>=(2*a):
  print(0)
else:
  print(b-(2*a))

b, a=map(int, input().split())
if b<=(2*a):
    print(0)
else:
    print(b-(2*a))

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N=int(input())
L=list(map(int,input().split()))
L.sort()
L.reverse()
count=0
a=len(L)
#print(L)
for i in range(a-2):
  count1=0
  for j in range(i+1,a-1):
    for k in range(j+1,a):
      if L[i]<L[j]+L[k]:
        count+=1
        #print(L[i],L[j],L[k])
      else:
        count1+=1
        break
    if count1==1:
         break
print(count)

N=int(input())
L=list(map(int,input().split()))
L.sort()
L.reverse()
count=0
count1=0
a=len(L)
#print(L)
for i in range(a-2):
  for j in range(i+1,a-1):
    for k in range(j+1,a):
      if L[i]<L[j]+L[k]:
        count+=1
        #print(L[i],L[j],L[k])
      else:
         break

print(count)


a=int(input())
b=int(input())
if a>=2*b:
  print(a-2*b)
else:
  print(0)

N=int(input())
L=list(map(int,input().split()))
L.sort()
L.reverse()
count=0
a=len(L)
#print(L)
for i in range(a-2):
  count1=0
  for j in range(i+1,a-1):
    for k in range(j+1,a):
      if L[i]<L[j]+L[k]:
        count+=1
        #print(L[i],L[j],L[k])
      else:
        count1+=1
        break
    if count1==1:
         break
print(count)



a,b=map(int,input().split())
if a>=2*b:
  print(a-2*b)
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b=map(int,input().split())
if a<b*2:
  print(a-b*2)
else:
  print(0)

a,b=map(int,input().split())
if a>b*2:
  print(a-b*2)
else:
  print(0)

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A, B = map(int, input().split())
print(0 if A - (B*2) < 0 else A - (B*2))A

a,b=map(int,input().split());print([0,a-b*2][a-b*2>0])

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A = int(input())
B = int(input())

remain = max(0, A - B * 2)

print(remain)


data = input().split()
A = int(data[0])
B = int(data[1])

remain = max(0, A - B * 2)

print(remain)


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b=map(int,input().split())
if (b*2)>=a:
  print(a-(b*2))
else:
  print("0")
  

a,b=map(int,input().split())
if (b*2)>a:
  print(a-(b*2))
else:
  print("0")
  

a,b=map(int,input().split())
if (b*2)<=a:
  print(a-(b*2))
else:
  print("0")
  

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(int,input().split())
if a - (b*2) > 0:
  print(a - (b*2))
print(0)

a,b = map(int,input().split())
if a - (b*2) > 0:
  print(a - (b*2))
else:
  print(0)

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
import sys
input = sys.stdin.readline
n=int(input())
l = sorted(list(map(int, input().split())))
ans=0
for i in range(n):
  for k in range(i+1,n):
    for _ in range(k+1,n):
      if -l[i]+l[k]>=l[_]:
        continue
      elif l[i]+l[k]<=l[_]:
        break
      else:
        ans+=1
print(ans)

a,b=map(int,input().split())
if a-2b>0:
  print(a-2b)
else:
  print(0)

a,b=map(int,input().split())
if a-2*b>0:
  print(a-2*b)
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
A.sort()
from bisect import bisect_left
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        ans += bisect_left(A, A[i] + A[j]) - bisect_left(A, A[j]) - 1
print(ans)


a, b = map(int, input().split())
print(max(0, a - 2 * b))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(int,input().split())
if a-2*b>0:
    print(a-2*b>0)
else:
    print(0)


a,b = map(int,input().split())
if a-2*b>0:
    print(a-2*b)
else:
    print(0)

    

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b=map(int,input().split())

if 2*b-a<0:
  print(0)
else:
  print(2*b-a)

a,b=map(int,input().split())
if a-2*b<0:
    print(0)
else:
    print(a-2*b)


Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N,M=map(int,input90.split())
print(max(0,N-2*M))

N,M=map(int, input().split())
print(max(0,N-2*M))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
w ,k = map(int, input().split())
x = w - (k*2)
if 0 <= x:
  print(x)
 else:
  print(0)

w ,k = map(int, input().split())
print(max(0, w-k*2))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
n = int(input())
d = list(map(int,input().split()))
comb_sum = 0
for i in range(n-1):
  for j in range(i+1,n):
    comb_sum += d[i] * d[j]
print(comb_sum)

a , b = map(int,input().split())
if a <= b *2:
	print(0)
else:
	print(a - b *2)

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int, input().split())
c = b * 2 - a
print(c if 0 <= c else 0)


a, b = map(int, input().split())
c = a - b * 2
print(c if 0 <= c else 0)


Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N=int(input())
S=list(input())

t=0
for i in range(N-1):
    if S[i+1] == S[i]:
        t+=1
print(N-t)


N=int(input())
b=[]
L=[]
b=input().split()
M=[]
for i in range(N):
    L.append(int(b[i]))
L.sort()
L.reverse()
#print(L)
x=0
y=0
p=0
index=0
for i in range(N-2):
    x=L.pop(0)
    for j in range(N-2-i):
        y=L.pop(0)
        for k in range(N-2-i-j):
#            print('i,j,k :'+str(i)+str(j)+str(k)+':'+str(x)+str(y)+str(L[k]))
            if x<y+L[k]:
                index+=1
            else:
                break
        M.append(y)
    L=M+L
    M.clear()
print(index)


A,B = map(int,input().split())
if A>=B*2:
    print(A-B*2)
else:
    print(0)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A,B=map(int,input().split()
print(max(A-2*B,0))


A,B=map(int,input().split())
print(max(A-2*B,0))


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A, B = map(int,input().split())
max(A - B * 2 , 0)

A, B = map(int, input().split())

if A - B * 2 >= 1:
  print(A - B * 2)
else:
  print(0)

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b= map(int, input().split())
if a<=2*b:
	print('0')
else:
	print('a-2*b')

a, b= map(int, intput().split())
if a<=2*b:
	print('0')
else:
	print('a-2*b')

a, b= map(int, input().split())
if a<=2*b:
	print('0')
else:
	print(a-2*b)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A, B = map(int, input().split())

print(min(0, A-B*2))

A, B = map(int, input().split())

print(max(0, A-B*2))

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
,b=list(map(int,input().split()))
s=a-2*b
if s<=0:
    print(0)
else:
    print(s)



a,b=list(map(int,input().split()))
s=a-2*b
if s<=0:
    print(0)
else:
    print(s)



Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
import itertools
N = int(input())
L = list(map(int, input().split()))
num = []
ans = 0

for i in itertools.permutations(L, r=3):
    i = list(i)
    i.sort()
    if i not in num:
        num.append(i)

for i in range(len(num)):
    if num[i][0] + num[i][1] > num[i][2]　and num[i][1] + num[i][2] > num[i][0] and num[i][0] + num[i][2] > num[i][1]:
        ans += 1
print(ans)


A, B = map(int, input().split())
B *= 2

if B >= A:
    print(0)

else:
    print(A-B)


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):

num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')


num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print(0)

num1,num2 = map(int,input().split())
if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A,B = [int(c) for c in input().strip().split('')]
if 2*B>A:
  print(0)
else:
  print(A-2*B)

A,B = [int(c) for c in input().strip().split(' ')]
if A>2*B:
    print(A-2*B)
else:
    print(0)

Verdicts: Runtime Error

Accepted