TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
A = []
B = []
for i in range(N):
	tmp = input()
	A[i] = int(tmp.split()[0])
	B[i] = int(tmp.split()[1])

cnt=0
total=0
while cnt < M:
	mini = N
	minv = 999999999999999
	for i in range(N):
		if minv > A[i]:
			minv = A[i]
			mini = i
	cnt += B[mini]
	total += A[mini]*B[mini]
	A[mini] = 999999999999999
total -= minv*(cnt-M)
print(total)

tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
A = []
B = []
for i in range(N):
	tmp = input()
	A[i] = int(tmp.split()[0])
	B[i] = int(tmp.split()[1])

minv = 100000000000
cnt=0
total=0
while cnt < M:
	mini = N
	for i in range(N):
		if minv > A[i]:
			minv = A[i]
			mini = i
	cnt += B[mini]
	total = A[mini]*B[mini]
	A[mini] = 1000000000000
total -= minv*(cnt-M)
print(total)

tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
AB = []
for i in range(N):
	tmp = input()
	AB.append([int(tmp.split()[0]),int(tmp.split()[1])])

AB.sort()

cnt=0
total=0
i = 0
while cnt < M:
	cnt += AB[i][1]
	total += AB[i][0]*AB[i][1]
	i+=1
total -=  AB[i-1][0]*(cnt-M)
print(total)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
# coding: utf-8
import os
from sys import stdin
from functools import total_ordering

__dirname = os.path.dirname(__file__)
__basename = os.path.splitext(os.path.basename(__file__))[0]
__targetname = './input/' + __basename + '.txt'
target_path = os.path.join(__dirname, __targetname)
stdin = open(target_path)

@total_ordering
class struct(object):
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def __lt__	(self,other):
        return self.a < other.a
    def __eq__	(self,other):
        return self.a == other.a

def main():
    # st = struct(10,1)
    # print(st.a)
    input_line = stdin.readline().rstrip().split(' ')
    N, M = map(int, input_line)
    A = list()
    for _ in range(N):
        input_line = stdin.readline().rstrip().split(' ')
        a,b=map(int, input_line)
        st=struct(a,b)
        A.append(st)
    A.sort()
    ans=0
    time=0
    for x in A:
        # print(x.a,x.b)
        if(time>M):
            continue
        if((time+x.b)<=M):
            ans += x.a*x.b
            time += x.b
        else:
            ans += x.a*(M-time)
            time = M
    print(ans)



if __name__ == "__main__":
    main()
    

# coding: utf-8
import os
from sys import stdin
from functools import total_ordering

# __dirname = os.path.dirname(__file__)


# target_path = os.path.join(__dirname, __targetname)


@total_ordering
class struct(object):
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def __lt__	(self,other):
        return self.a < other.a
    def __eq__	(self,other):
        return self.a == other.a

def main():
    # st = struct(10,1)
    # print(st.a)
    input_line = stdin.readline().rstrip().split(' ')
    N, M = map(int, input_line)
    A = list()
    for _ in range(N):
        input_line = stdin.readline().rstrip().split(' ')
        a,b=map(int, input_line)
        st=struct(a,b)
        A.append(st)
    A.sort()
    ans=0
    time=0
    for x in A:
        # print(x.a,x.b)
        if(time>M):
            continue
        if((time+x.b)<=M):
            ans += x.a*x.b
            time += x.b
        else:
            ans += x.a*(M-time)
            time = M
    print(ans)



if __name__ == "__main__":
    main()
    

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M = [int(s) for s in input().split()]
pre_lst=[]
for i in range(N):
  a,b = [int(s) for s in input().split()]
  pre_lst=lst+[[a,b,a*b]]
lst = sorted(pre_lst, key=lambda x: x[0])
m=0
i=0
cost=0
while(m<M):
  m+=lst[i][1]
  cost+=lst[i][2]
  i+=1
if(m>M):
  cost-=lst[i-1][0]*(m-M)
print(cost)


N,M = [int(s) for s in input().split()]
pre_lst=[]
for i in range(N):
  a,b = [int(s) for s in input().split()]
  pre_lst=lst+[[a,b,a*b]]
lst = sorted(pre_lst, lambda=x: x[0])
m=0
i=0
cost=0
while(m<M):
  m+=lst[i][1]
  cost+=lst[i][2]
  i+=1
if(m>M):
  cost-=lst[i-1][0]*(m-M)
print(cost)

N,M = [int(s) for s in input().split()]
lst=[]
for i in range(N):
  lst.append([int(s) for s in input().split()])

lst.sort()
count=0
cost=0
for e in lst:
  count+=e[1]
  cost+=e[0]*e[1]
  if(count>=M):
    cost-=e[0]*(count-M)
    break
print(cost)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = map(int,input().split())
A = []
B = []
for i in range(N):
  a, b = map(int,input().split())
  A.append(a)
  B.append(b)

vdic = {}

for i in range(N):
  if A[i] not in vdic.keys():
    vdic[A[i]] = B[i]
  else:
    vdic[A[i]] += B[i]
    
count = 0
cost = 0
    
for i in vdic.keys():
  if vdic[i] + count >= M:
    cost += (M - count) * i
    break
  else:
    cost += vdic[i] * i
    count += vdic[i]
    
print(cost)

N, M = map(int,input().split())
A = []
B = []
for i in range(N):
  a, b = map(int,input().split())
  A.append(a)
  B.append(b)

vdic = {}

for i in range(N):
  if A[i] not in vdic.keys():
    vdic[A[i]] = B[i]
  else:
    vdic[A[i]] += B[i]
    
Vdic = sorted(vdic.items())
    
count = 0
cost = 0
    
for i in range(len(Vdic)):
  if Vdic[i][1] + count >= M:
    cost += (M - count) * Vdic[i][0]
    break
  else:
    cost += Vdic[i][1] * Vdic[i][0]
    count += Vdic[i][1]
    
print(cost)

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m = list(map(int,input().split()))
a = []
b = []
for i in range(n):
    x,y = list(map(int,input().split()))
    a.append(x)
    b.append(y)
count = 0

while True:
    mi = min(a)
    print(mi,"mi")
    if m - b[a.index(min(a))] > 0 : 
        m = m-b[a.index(min(a))]
        count += b[a.index(min(a))] * min(a)
        
    elif m - b[a.index(min(a))] == 0:
        count += m * min(a)
        
        break
    else:
        count += m * min(a)
        break
    d = a.index(min(a))
    del a[d]
    del b[d]

print(count)




n,m = list(map(int,input().split()))
a = []
b = []
dic = {}
count = 0
data = [0] * n
for i in range(n):
    x,y = list(map(int,input().split()))
    data[i] = [x,y]
data = sorted(data,key = lambda x : x[0])
for i in range(n):
    if m > data[i][1]:
        count += data[i][0] * data[i][1]
        m -= data[i][1]
    else:
        count += data[i][0] * m
        break
print(count)


            




Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, b[i])
  cost += min(m, b[i]) * a[i]
  m -= min(m, b[i])
print(cost)

n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, shop[i][1])
  cost += min(m, shop[i][1]) * shop[i][0]
  m -= min(m, shop[i][1])
print(cost)

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m = map(int,input().split())
d = []
for i in range(n):
    a,b = map(int,input().split())
    d.append([a,b])
 
d.sort(key=lambda x:x[0])

sum_ = 0
cnt = 0
for ab in d:
    if cnt + ab[1] > M:
        sum_ += ab[0] * (M-cnt)
        break
    else:
        cnt += ab[1]
        sum_ += ab[0]*ab[1]
print(sum_)


n,M = map(int,input().split())
d = []
for i in range(n):
    a,b = map(int,input().split())
    d.append([a,b])
 
d.sort(key=lambda x:x[0])

sum_ = 0
cnt = 0
for ab in d:
    if cnt + ab[1] > M:
        sum_ += ab[0] * (M-cnt)
        break
    else:
        cnt += ab[1]
        sum_ += ab[0]*ab[1]
print(sum_)


Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M = (int(i) for i in input().split())
dic = {}
drink = M
money = 0
for i in range(N):
  a,b = (int(i) for i in input().split())
  dic[a] += b
c = sorted(dic.keys())
print(c)
for j in c:
  if drink > dic[j]:
    money += j * dic[j]
    drink -= dic[j]
  else:
    money += j * drink
    break
print(money)

N,M = (int(i) for i in input().split())
dic = {}
drink = M
money = 0
for i in range(N):
  a,b = (int(i) for i in input().split())
  if a not in dic:
    dic[a] = b
  else:
    dic[a] += b
c = sorted(dic.keys())
print(c)
for j in c:
  if drink > dic[j]:
    money += j * dic[j]
    drink -= dic[j]
  else:
    money += j * drink
    break
print(money)

N,M = (int(i) for i in input().split())
dic = {}
drink = M
money = 0
for i in range(N):
  a,b = (int(i) for i in input().split())
  if a not in dic:
    dic[a] = b
  else:
    dic[a] += b
c = sorted(dic.keys())
for j in c:
  if drink > dic[j]:
    money += j * dic[j]
    drink -= dic[j]
  else:
    money += j * drink
    break
print(money)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = map(int, input().split())
AB = list(map(int, input().split()) for _ in range(N))

sorted_ab = sorted(AB)
cost = 0
while M > 0:
    for i in range(N):
        for j in range(sorted_ab[i][1]):
            M -= 1
            cost += sorted_ab[i][0]
print(cost)

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
 
AB.sort()
cost = 0
for i in range(N):
    M -= AB[i][1]
    cost += AB[i][1]*AB[i][0]
    if M<=0:
        store_num = i
        break
if M<0:
    m = abs(M)
    cost -= m*AB[store_num][0]
print(cost)

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M=map(int,input().split())
l=[]
for i in range(N):
  A,B=map(int,input().split())
  l.append([A,B])
l.sort(key=lambda x:x[0])
i=0
ans=0
while M>l[i][1]:
  M-=l[i][1]
  i+=1
  ans+=l[i][0]*l[i][1]
ans+=l[i][0]*M
print(ans)

N,M=map(int,input().split())
l=[]
for i in range(N):
  A,B=map(int,input().split())
  l.append([A,B])
l.sort(key=lambda x:x[1])
i=0
ans=0
while M>l[i][1]:
  M-=l[i][1]
  i+=1
  ans+=l[i][0]+l[i][1]
ans+=l[i][0]*M
print(ans)

N,M=map(int,input().split())
l=[]
for i in range(N):
  A,B=map(int,input().split())
  l.append([A,B])
l.sort(key=lambda x:x[0])
i=0
ans=0
while M>l[i][1]:
  M-=l[i][1]
  i+=1
  ans+=l[i][0]+l[i][1]
ans+=l[i][0]*M
print(ans)

N,M=map(int,input().split())
l=[]
for i in range(N):
  A,B=map(int,input().split())
  l.append([A,B])
l.sort(key=lambda x:x[0])
i=0
ans=0
while M>l[i][1]:
  M-=l[i][1]
  ans+=l[i][0]*l[i][1]
  i+=1
ans+=l[i][0]*M
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = [int(i) for i in input().split()]
shops = []

for i in range(0, N):
    A, B = [int(i) for i in input().split()]
    shops.append((A, B))

shops.sort()

print(shops)
result = 0
rest_count = M
for shop in shops:
    if rest_count > shop[1]:
        result += shop[0] * shop[1]
        rest_count -= shop[1]
    else:
        result += shop[0] * rest_count
        break

print(result)

N, M = [int(i) for i in input().split()]
shops = []

for i in range(0, N):
    A, B = [int(i) for i in input().split()]
    shops.append((A, B))

shops.sort()

result = 0
rest_count = M
for shop in shops:
    if rest_count > shop[1]:
        result += shop[0] * shop[1]
        rest_count -= shop[1]
    else:
        result += shop[0] * rest_count
        break

print(result)

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a.sort()
dr=0
i=0
pr=0
while(dr<m):
  if dr+a[i][1]>=m:
    dr+=m-dr
    pr+=(m-dr)*a[i][0]
  else:
    dr+=a[i][1]
    pr+=a[i][0]*a[i][1]
  i+=1
print(pr)

n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a.sort()
dr=0
i=0
pr=0
while(dr<m):
  if dr+a[i][1]>=m:
    pr+=(m-dr)*a[i][0]
    dr+=m-dr
  else:
    dr+=a[i][1]
    pr+=a[i][0]*a[i][1]
  i+=1
print(pr)


Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = map(int, input().split())
shops = sorted([list(map(int, input().split())) for i in range(n)])
drink = 0
cost = 0

for i in range(N):
    cost += shops[i][0]*shops[i][1]
    drink += shops[i][1]
    if drink >= M:
        cost -= (drink -　M) * shops[i][0]
        break
        
print(cost)

N, M = map(int, input().split())
shops = sorted([list(map(int, input().split())) for i in range(n)])
drink = 0
cost = 0

for i in range(N):
    cost += shops[i][0]*shops[i][1]
    drink += shops[i][1]
    if drink >= m:
        cost -= (drink -m) * shops[i][0]
        break
        
print(cost)


N, M = map(int, input().split())
shops = sorted([list(map(int, input().split())) for i in range(N)])
drink = 0
cost = 0

for i in range(N):
    cost += shops[i][0]*shops[i][1]
    drink += shops[i][1]
    if drink >= M:
        cost -= (drink -M) * shops[i][0]
        break
        
print(cost)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
data = line.split(" ")
shoplist = [] 
for i in range(int(data[0])):
    shop = input()
    shopdata = shop.split(" ")
    shop_int = []
    for j in range(len(shopdata)):
        shop_int.append(int(shopdata[j]))
    shoplist.append(shop_int)

payment = 0 
wantdrink = int(data[1]) 
pricelist = []  
for i in range(len(shoplist)):
    pricelist.append(shoplist[i][0])
while wantdrink > 0 :
    pricemin = min(pricelist[i] for i in range(len(pricelist)))
    min_index = pricelist.index(pricemin)
    restdrink = shoplist[min_index][1]
    if restdrink >= wantdrink:
      while restdrink > 0:
        payment += pricemin
        restdrink -= 1
        wantdrink -= 1
        if wantdrink == 0:
              break
    else:
        payment += restdrink * pricemin
        wantdrink -= restdrink
    del shoplist[min_index]
    del pricelist[min_index]
print(payment)

data = line.split(" ")
shoplist = [] 
for i in range(int(data[0])):
    shop = input()
    shopdata = shop.split(" ")
    shop_int = []
    for j in range(len(shopdata)):
        shop_int.append(int(shopdata[j]))
    shoplist.append(shop_int)

payment = 0 
wantdrink = int(data[1]) 
pricelist = []  
for i in range(len(shoplist)):
    pricelist.append(shoplist[i][0])
while wantdrink > 0 :
    pricemin = min(pricelist[i] for i in range(len(pricelist)))
    min_index = pricelist.index(pricemin)
    restdrink = shoplist[min_index][1]
    if restdrink >= wantdrink:
      while restdrink > 0:
        payment += pricemin
        restdrink -= 1
        wantdrink -= 1
        if wantdrink == 0:
              break
    else:
        payment += restdrink * pricemin
        wantdrink -= restdrink
    del shoplist[min_index]
    del pricelist[min_index]
print(payment)

# coding: utf-8

data = input().split()
shoplist = []
for i in range(int(data[0])):
    shopdata = list(map(int, input().split()))
    shoplist.append(shopdata)
shoplist.sort()

payment = 0
wantdrink = int(data[1])
while wantdrink > 0 :
    restdrink = shoplist[0][1]
    if restdrink >= wantdrink:
        payment += wantdrink * shoplist[0][0]
        break
    else:
        payment += restdrink * shoplist[0][0]
        wantdrink -= restdrink
        del shoplist[0]
print(payment)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = map(int, input().split())
A = [0] * N 
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()

N, M = map(int, input().split())
A = [0] * N 
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()

print(1)

N, M = map(int, input().split())
AB = [0] * N
for i in range(N):
    AB[i] =list(map(int, input().split()))

AB.sort()

count = 0
money = 0
i = 0

while count < M:
    money += AB[i][0] * AB[i][1]
    count += AB[i][1]
    i += 1

if count > M:
    tmp = count - M
    money -= AB[i-1][0]*tmp

ans = money
print(ans)





Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key = lambda x: x[0])

total = 0
i = 0

while True:
    total += AB[i][1]
    if total < m:
        i += 1
    else:
        break

ans = 0
for j in range(i):
    ans += AB[j][0]*AB[j][1]
ans += (m - sum(AB[p][1] for p in range(0,i))) * AB[i][0]

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key = lambda x: x[0])

total = 0
i = 0

while True:
    total += AB[i][1]
    if total < M:
        i += 1
    else:
        break

ans = 0
for j in range(i):
    ans += AB[j][0]*AB[j][1]
ans += (M - sum(AB[p][1] for p in range(0,i))) * AB[i][0]
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort(reverse = True)
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += AB[i][0]*(m-c)
    break

print(ans)


n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort(reverse = True)
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += Ab[i][0]*(m-c)
    break

print(ans)

n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort()
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += AB[i][0]*(m-c)
    break

print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
m = 0
cnt = 0
for i in range(N):
    
    cnt += c[i][1]
    m += c[i][0] * c[i][1]
     
    if cnt == M:
        print(m)
        break
    elif cnt > M:
        print(m - c[i][0] * (cnt - M))
        break
    else:
        continue

N, M = map(int, input().split())
a, b = [0 for _ in range(N)], [0 for _ in range(N)]
for i in range(N):
    a[i], b[i] = (list(map(int, input().split())))
c = []
for i in range(N):
    c.append([a[i],b[i],i])
c = sorted(c, key=lambda x: x[0])
m = 0
cnt = 0
for i in range(N):
    
    cnt += c[i][1]
    m += c[i][0] * c[i][1]
     
    if cnt == M:
        print(m)
        break
    elif cnt > M:
        print(m - c[i][0] * (cnt - M))
        break
    else:
        continue

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m = map(int,input().split())
l = [map(int, input().split()) for i in range(n)]
ans = 0
for a,b in l:
  if b >= m:
    ans += a * (b-m)
    break
  else:
    ans += a*b
    m -= b
print(ans)

n,m = map(int,input().split())
l = [map(int, input().split()) for i in range(n)]
ans = 0
l.sort()
for a,b in l:
  if b >= m:
    ans += a * m
    break
  else:
    ans += a*b
    m -= b
print(ans)

n,m = map(int,input().split())
l = []
for i in range(n):
    a,b = map(int, input().split())
    l.append((a,b))
ans = 0
l.sort()
for a,b in l:
  if b >= m:
    ans += a * m
    break
  else:
    ans += a*b
    m -= b
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M = map(int,input().split())
a = []

for i in range(N):
  a.append(list(map(int,input().split())))

a.sort()

num = 0
ans = 0
for i in range(N):
  ans = 0
  num = 0
  while i <= N - 1:
    ans += a[i][0] * a[i][1]
    num += a[i][1]
    if num > M:
        ans -= a[i][0] * (num - M)
        break
print(ans)  


N,M = map(int,input().split())
a = []

for i in range(N):
  a.append(list(map(int,input().split())))

a = sorted(a)

i = 0
num = 0
ans = 0
while i <= N - 1:
  ans += a[i][0] * a[i][1]
  num += a[i][1]
  if num > M:
    ans -= a[i][0] * (num - M)
    break
  i += 1
print(ans)  


Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N, M = list(map(int, input().split()))

# Insert all the data into dictionary
stores = []
while 1:
	try:
		a, b = list(map(int, input().split()))
		stores.append([a,b])
	except:
		break

stores = sorted(stores, key=lambda x:x[0])

m = 0
money = 0

for store in stores:
	money += min(store[1], M - m) * store[0]
	if m == M:
		break
print(money)
        
print(stores)

N, M = list(map(int, input().split()))

# Insert all the data into dictionary
stores = []
for _ in range(N):
  a, b = list(map(int, input().split()))
  stores.append([a,b])

stores = sorted(stores, key=lambda x:x[0])
print(stores)

m = 0
money = 0

for store in stores:
  money += min(store[1], M - m) * store[0]
  m += min(store[1], M - m)
  if m == M:
    break
print(money)

N, M = list(map(int, input().split()))

# Insert all the data into dictionary
stores = []
for _ in range(N):
  a, b = list(map(int, input().split()))
  stores.append([a,b])

stores = sorted(stores, key=lambda x:x[0])

m = 0
money = 0

for store in stores:
  money += min(store[1], M - m) * store[0]
  m += min(store[1], M - m)
  if m == M:
    break
print(money)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
print(AB)

N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
AB.sort(key=lambda x: x[0])

s = 0
for ab in AB:
    if ab[1] > M:
        s += M*ab[0]
        break
    else:
        s += ab[0]*ab[1]
        M -= ab[1]

print(s)


import numpy as np
N, M, C = [int(x) for x in input().split()]
B = np.array([int(x) for x in input().split()])
A = np.array([[int(x) for x in input().split()] for _ in range(N)])
 
print(np.sum(A.dot(B) > -C))

import numpy as np
N, M, C = [int(x) for x in input().split()]
B = np.array([int(x) for x in input().split()])
A = np.array([[int(x) for x in input().split()] for _ in range(N)])
 
print(np.sum(A@B > -C))

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    AB = sorted(range(N), key=lambda x: A[x])

    s = 0
    for i in AB:
        if B[i] > M:
            s += M*A[i]
            break
        else:
            s += A[i]*B[i]
            M -= B[i]

    print(s)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x:x[0])
print(ab)
ans = 0
d = 0
i = 0
while d < m:
  ans += ab[i][0]*min(m-d,ab[i][1])
  d += ab[i][1]
  i += 1
print(ans)

n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x:x[0])
ans = 0
d = 0
i = 0
while d < m:
  ans += ab[i][0]*min(m-d,ab[i][1])
  d += ab[i][1]
  i += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M = map(int, input().split())
A = []
quantity = 0
price = 0

for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)
print(A)
A = sorted(A)
for i in range(M):
    quantity += A[i][1]
    if quantity <= M:
        price += A[i][0]*A[i][1]
    else:
       price += A[i][0]*(M-(quantity-A[i][1]))
       break
print(price)

N,M = map(int, input().split())
A = []
quantity = 0
price = 0

for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)
A = sorted(A)
for i in range(M):
    quantity += A[i][1]
    if quantity < M:
        price += A[i][0]*A[i][1]
    else:
       price += A[i][0]*(M-(quantity-A[i][1]))
       break
print(price)

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n, m = [int(i) for i in input().split()]
dat = [[int(i) for i in input().split()] for i in range(n)]
sort(dat)
sum = 0
_m = 0
for i in dat:
    _m += dat[1]
    if _m > m:
        print(sum + dat[0]*(m - _m))
        break
    sum += dat[0] * dat[1]


n, m = [int(i) for i in input().split()]
dat = [[int(i) for i in input().split()] for i in range(n)]
dat.sort()
sum = 0
_m = 0
for i in dat:
    if _m + i[1] >= m:
        print(sum + i[0]*(m - _m))
        break
    _m += i[1]
    sum += i[0] * i[1]

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
n,m=map(int,input().split())
s=[list(map(int, input().split())) for i in range(n)] 
s.sort()
s.append([0,0])
a=0
b=0
for i in range(n):
    if a<m:
        a+=s[i][1]
        b+=s[i][0]*s[i][1]
    else:
        print(a,b,s[i-1][1])
        b-=(a-m)*s[i-1][0]
        break
        
print(b)

n,m=map(int,input().split())
s=[list(map(int, input().split())) for i in range(n)] 
s.sort()
s.append([0,0])
a=0
b=0
for i in range(n+1):
    if a<m:
        a+=s[i][1]
        b+=s[i][0]*s[i][1]
    else:
        b-=(a-m)*s[i-1][0]
        break
        
print(b)

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
N,M = map(int,input().split())
list = [list(map(int,input().split())) for _ in range(N)]
list.sort()

cnt = 0
sum = 0

for i in range(N):
    if cnt + list[i][1] <= M:
        cnt += list[i][1]
        sum += list[i][1]*list[i][0]
    else:
        sum += (M-cnt)*list[i][0]
        break

print(cnt,sum)

import sys
sys.setrecursionlimit(10**6)

N,M = map(int,input().split())
list = [list(map(int,input().split())) for i in range(N)]
list.sort(key=lambda x:x[0])

def dfs(m,cnt):
    if m <= 0 or cnt == len(list):
        return 0
    b = list[cnt][1] if list[cnt][1] < m else m
    a = b*list[cnt][0]

    return a + dfs(m-b,cnt+1)

print(dfs(M,0))

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
from sys import stdin
import heapq
hq = []  

NM = input()
NM = NM.split()
N = int(NM[0])
M = int(NM[1])

hq = []
AB = {}
for i in range(N):
  temp = input()
  temp = temp.split()
  AB[int(temp[0])] = int(temp[1])
  heapq.heappush(hq, (int(temp[0]), int(temp[1])))

print(hq)
cost = 0
amount = 0
for i in range(N):
  if amount + hq[i][1] < M:
    amount += hq[i][1]
    cost += hq[i][0]*hq[i][1]
  else:
    temp = M - amount
    cost += hq[i][0]*temp
    break
    
print(cost)


NM = NM.split()
N = int(NM[0])
M = int(NM[1])

AB = {}
for i in range(N):
  temp = input()
  temp = temp.split()
  AB[int(temp[0])] = int(temp[1])

A_list = list(AB.keys())
A_list.sort()

cost = 0
amount = 0
for i in range(N):
  if amount + AB[A_list[i]] <= M:
    amount += AB[A_list[i]]
    cost += A_list[i]*AB[A_list[i]]
  else:
    print(amount)
    temp = M - amount
    cost += A_list[i]*temp
    break
    
print(cost)

from sys import stdin
import heapq
hq = []  

NM = input()
NM = NM.split()
N = int(NM[0])
M = int(NM[1])

hq = []
AB = {}
for i in range(N):
  temp = input()
  temp = temp.split()
  AB[int(temp[0])] = int(temp[1])
  heapq.heappush(hq, (int(temp[0]), int(temp[1])))

cost = 0
amount = 0
for i in range(N):
  temp = heapq.heappop(hq)
  if amount + temp[1] < M:
    amount += temp[1]
    cost += temp[0]*temp[1]
  else:
    temp1 = M - amount
    cost += temp[0]*temp1
    break
    
print(cost)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
s = input().split()
N = int(s[0])
M = int(s[1])

AB = {}
for i in range(N):
  data = input().split()
  AB[int(data[0])] = int(data[1])

money = 0
num = 0
for A,B in sorted(AB.items()):
  if num+B < M:
    money += A*B
  	num += B
  else:
    money += A*(M-num)
    break
  
print(money)

s = input().split()
N = int(s[0])
M = int(s[1])
 
AB = {}
for i in range(N):
  data = input().split()
  if int(data[0]) in AB.keys():
    AB[int(data[0])] += int(data[1])
  else:
    AB[int(data[0])] = int(data[1])
AB = sorted(AB.items())
money = 0
num = 0
for A,B in AB:
  if num+B < M:
    money += A*B
    num += B
  elif num+B == M:
    money += A*B
    break
  elif num+B > M:
    money += A*(M-num)
    break
print(int(money))

Verdicts: Runtime Error

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
def main():
    N, M = map(int, input().split())
    A = [[0, 0] for _ in range(N)]
    for i in range(N):
        A[i][0], A[i][1] = map(int, input().split())
    
    cnt = 0
    money = 0
    A.sort(key=lambda x:x[0])
    for i in range(N):
        if(cnt < M):
            money += A[i][0]*A[i][1]
            cnt += A[i][1]
        else:
            break
    if(cnt == M):
        print(money)
    else:
        print(money-(cnt-M)*A[i-1][0])
    
main()

def main():
    N, M = map(int, input().split())
    A = [[0, 0] for _ in range(N)]
    for i in range(N):
        A[i][0], A[i][1] = map(int, input().split())
    
    cnt = 0
    money = 0

    A.sort(key=lambda x:(x[0], x[1]))
    for i in range(N):
        money += A[i][0]*A[i][1]
        cnt += A[i][1]
        if(cnt >= M):
            break
    if(cnt == M):
        print(money)
    else:
        print(money-(cnt-M)*A[i][0])
    
main()

Verdicts: Wrong Answer

Accepted
Problem: Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.  There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.  What is the minimum amount of money with which he can buy M cans of energy drinks?  It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Submission attempts (in order):
text = input()
vals = text.split(" ")
lines = []
for i in range(int(len(vals) / 2)):
    lines.append([vals[i * 2], vals[i * 2 + 1]])

n_and_m = lines[0]
n = n_and_m[0]
m = n_and_m[1]

a_and_b = lines[1:]
a = list(map(lambda x: x[0], a_and_b))
b = list(map(lambda x:x[1], a_and_b))

tmp = []

a_and_b = sorted(a_and_b, key=lambda x:int(x[0]))


remain = int(m)

price = 0
for i in range(len(a_and_b)):
    for j in range(int(a_and_b[i][1])):
        remain = remain - 1
        price = price + int(a_and_b[i][0])
        if (remain == 0):
            break
    else:
        continue
    break
print(price)


text = input()
lines = text.split("\n")

lines = list(map(lambda x: x.split(" "), lines))
n_and_m = lines[0]
n = n_and_m[0]
m = n_and_m[1]
a_and_b = []
for i in range(int(n)):
    a_and_b.append(input().split(" "))


tmp = []

a_and_b = sorted(a_and_b, key=lambda x:int(x[0]))


remain = int(m)

price = 0
for i in range(len(a_and_b)):
    for j in range(int(a_and_b[i][1])):
        remain = remain - 1
        price = price + int(a_and_b[i][0])
        if (remain == 0):
            break
    else:
        continue
    break
print(price)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi likes the sound when he buys a drink from a vending machine.  That sound can be heard by spending A yen (the currency of Japan) each time.  Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.  How many times will he hear the sound?

Submission attempts (in order):
# -*- coding: utf-8 -*-



def calc(a, b, c):
    rest = b
    count = 0
    while True:
        if count >= c:
            break
        if rest < a:
            break
        count += 1
        rest -= a
    return count


# -*- coding: utf-8 -*-



def calc(a, b, c):
    rest = b
    count = 0
    while True:
        if count >= c:
            break
        if rest < a:
            break
        count += 1
        rest -= a
    return count


a, b, c = map(int, input().split())
print(calc(a, b, c))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi likes the sound when he buys a drink from a vending machine.  That sound can be heard by spending A yen (the currency of Japan) each time.  Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.  How many times will he hear the sound?

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

num1 = 11 // 2

if num <= c:
  print(num)
else:
  print(c)

a, b, c = map(int, input().split())

num = a // b

if num <= c:
  print(num)
else:
  print(c)

a, b, k = map(int, input().split())
list = []

for i in range(1, 101):
  if a%i == 0 and b %i == 0:
    list.append(i)
    list.sort(reverse=True)
    
print(list[k-1])

a, b, c = map(int, input().split())

num = b // a

if num <= c:
  print(num)
else:
  print(c)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi likes the sound when he buys a drink from a vending machine.  That sound can be heard by spending A yen (the currency of Japan) each time.  Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.  How many times will he hear the sound?

Submission attempts (in order):
A, B, C = map(int, input().split())
money_time = A * C
if money_time <= B:
  print(A)
else:
  print(B // A)

a,b,c=map(int,input().split());print(min(b//a,c))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi likes the sound when he buys a drink from a vending machine.  That sound can be heard by spending A yen (the currency of Japan) each time.  Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.  How many times will he hear the sound?

Submission attempts (in order):
a,b,c = map(int,input().split())
count = 0
if a//b > c :
  an = (c)
else :
  an = (b//a)
print(an)
  

a,b,c = map(int,input().split())
if b//a > c :
  an = (c)
else :
  an = (b//a)
print(an)
  

Verdicts: Wrong Answer

Accepted
Problem: Takahashi likes the sound when he buys a drink from a vending machine.  That sound can be heard by spending A yen (the currency of Japan) each time.  Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.  How many times will he hear the sound?

Submission attempts (in order):
# -*- coding: utf-8 -*-


string = input()


max = min(len(string), 100000)


del_count = 0


del_flg = True


while del_flg:
    del_flg = False

    # 
    for idx in range(max):
        if idx == max or idx > max:
            break
            
        
        target = string[idx : idx + 2]
        
        if target == "01" or target == "10":
            
            
            string = string[:idx] + string[idx + 2:]
            del_count += 2
            max -= 2
            del_flg = True

print(del_count)

# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())
retVal = 0

if a > b:
    retVal = 0
elif b // a < c :
    retVal = b // a
else :
    retVal = c

print(retVal)

Verdicts: Wrong Answer

Accepted