Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

line = input()
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)
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)

Fixed submission:
# 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)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

line = input()
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)
shoplist = sorted(shoplist)
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)

Fixed submission:
# 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)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

line = input()
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)

Fixed submission:
# 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)

Buggy python submission (verdict: Runtime Error):
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)

Fixed submission:
# 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)

Buggy python submission (verdict: Runtime Error):
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)

Fixed submission:
# 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)

Buggy python submission (verdict: Time Limit Exceeded):
line = input()
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)
    restwater = shoplist[min_index][1]
    while restwater > 0:
        payment += pricemin
        restwater -= 1
        wantdrink -= 1
        if wantdrink == 0:
            break
    del shoplist[min_index]
    del pricelist[min_index]
print(payment)

Fixed submission:
# 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)

Buggy python submission (verdict: Time Limit Exceeded):
line = input()
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]) #ほしい飲み物の数
while wantdrink > 0 :
    pricelist = []  #金額のみのデータリスト
    for i in range(len(shoplist)):
        pricelist.append(shoplist[i][0])
    pricemin = min(pricelist[i] for i in range(len(pricelist)))
    min_index = pricelist.index(pricemin)
    restwater = shoplist[min_index][1]
    while restwater > 0:
        payment += pricemin
        restwater -= 1
        wantdrink -= 1
        if wantdrink == 0:
            break
    del shoplist[min_index]
print(payment)

Fixed submission:
# 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)