Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = np.maximum(0,people - mean//food)
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = 10**12
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = np.maximum(0,people - mean//food)
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = 10**12
_min = 0

while _max!=_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = np.maximum(0,people - mean//food)
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K = map(int,input().split())
people = np.array(sorted(list(map(int,input().split()))))
food = np.array(sorted(list(map(int,input().split())))[::-1])


#2分探索　Kの値で
_max = 10**12
_min = 0

while _max!=_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = np.maximum(0,people - mean//food)
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K = map(int,input().split())
people = np.array(sorted(list(map(int,input().split()))))
food = np.array(sorted(list(map(int,input().split())))[::-1])


#2分探索　Kの値で
_max = 10**12
_min = 0

while _max!=_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = people - mean//food
  K_arr = K_arr[K_arr>0]
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K = map(int,input().split())
people = np.array(sorted(list(map(int,input().split()))))
food = np.array(sorted(list(map(int,input().split())))[::-1])


#2分探索　Kの値で
_max = 10**12
_min = 0

while _max!=_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  K_arr = people - mean//food
  K_arr = [k for k in list(K_arr) if k>0]
  # 総修行回数
  _K = sum(K_arr)
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)
  

Fixed submission:
import sys
import numpy as np
readline = sys.stdin.buffer.readline

N,K = map(int,readline().split())
people = np.array(readline().split(),np.int64)
food = np.array(readline().split(),np.int64)
 
people.sort()
food.sort()
food=food[::-1]

#2分探索　Kの値で
_max = max(people)*max(food)
_min = 0

while _max>_min:
  mean = (_max+_min)//2
  # 各人が修行をする回数の配列　負の値もでる
  _K = np.maximum(0,people - mean//food).sum()
  if _K > K:
    _min = mean+1
  else:
    _max = mean
    
print(_max)