qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N, M, C = map(int, input().split())
Bli = list(map(int,input().split()))
Ali = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for A in Ali:
    sumNum = 0
    for num, a in enumerate(A):
        sumNum += a * Bli[num]
        
    print(sumNum)
    if sumNum + C > 0:
        ans += 1

print(ans)


Fixed code:
N, M, C = map(int, input().split())
Bli = list(map(int,input().split()))
Ali = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for A in Ali:
    sumNum = 0
    for num, a in enumerate(A):
        sumNum += a * Bli[num]
        
    if sumNum + C > 0:
        ans += 1

print(ans)
Buggy code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
Ai= [input().split() for l in range(N)]
count=0
tot=0
for i in range(N):
    for j in range(M):
        tot+=Ai[i][j]*B[i]
        if tot+C>0:
            count+=1
print(count)

Fixed code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
Ai= [input().split() for l in range(N)]
count=0
for i in range(N):
    tot=0
    for j in range(M):
        tot+=int(Ai[i][j])*B[j]
    if tot+C>0:
        count+=1  
print(count)
Buggy code:
base_data = list(map(int,input().split()))
line = base_data[0]
num = base_data[1]
last_num = base_data[2]

elements = 0
result = 0

multi_data = list(map(int,input().split()))

for i in range(line):
  data = list(map(int,input().split()))
  while num > 0:
    elements += data[num-1] * multi_data[num-1]
    num -= 1
  if elements + last_num > 0:
    result += 1

print(result)

Fixed code:
base_data = list(map(int,input().split()))
line = base_data[0]
last_num = base_data[2]

elements = 0
result = 0

multi_data = list(map(int,input().split()))

for i in range(line):
  elements = 0
  num = base_data[1]
  data = list(map(int,input().split()))
  
  while num > 0:
    elements += data[num-1] * multi_data[num-1]
    num -= 1

  if elements + last_num > 0:
    result += 1
    
print(result)
Buggy code:
n, m, C = map(int, input().split())
B = list(map(int, input().split()))
source = []
pre = 0
score  = 0
for i in range(n):
    source.append([int(x) for x in input().split()])

for j in range(0,n-1):
    for k in range(0,m-1):
        pre += source[j][k]*B[k]
    else:
        if pre + C > 0:
            score += 1
        pre = 0
print(score)



Fixed code:
n, m, C = map(int, input().split())
B = list(map(int, input().split()))
source = []
score  = 0
for i in range(n):
    source.append([int(x) for x in input().split()])

for j in range(n):
    pre = 0
    for k in range(m):
        pre += source[j][k]*B[k]
    else:
        if pre + C > 0:
            score += 1
print(score)
Buggy code:
n, m, c = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
a = [[int(_) for _ in input().split()] for i in range(n)]
sum = 0
cnt = 0
for i in range(n):
  sum = 0
  for j in range(m):
    sum = a[i][j] * b[j] + c
  if sum > 0:
    cnt += 1
print(cnt)

Fixed code:
n, m, c = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
a = [[int(_) for _ in input().split()] for i in range(n)]
sum = 0
cnt = 0
for i in range(n):
  sum = 0
  for j in range(m):
    sum += a[i][j] * b[j]
  if sum + c > 0:
    cnt += 1
print(cnt)
Buggy code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B
n,m,c = LI()
b = LI()
a = LIR(n)
ans = 0
for i in range(n):
    d = 0
    for k in range(m):
        d += b[k]*a[i][k]
    if d > 0:
        ans += 1
print(ans)
#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Fixed code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B
n,m,c = LI()
b = LI()
a = LIR(n)
ans = 0
for i in range(n):
    d = c
    for k in range(m):
        d += b[k]*a[i][k]
    if d > 0:
        ans += 1
print(ans)
#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T
Buggy code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0
for i in range(N):
  A=list(map(int,input().split()))
  if sum([a*b for a in A for b in B])+C>0:
    ans+=1
print(ans)

Fixed code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0
for i in range(N):
  A=list(map(int,input().split()))
  if sum([a*b for a,b in zip(A,B)])+C>0:
    ans+=1
print(ans)
Buggy code:
N, M, C = (map(int, input().split()))
B = list((map(int, input().split())))
counter = 0
for i in range(N):
	tmp = list((map(int, input().split())))
	total = C
	for j in range(M):
		total += B[i] * tmp[i]
		if total > 0:
			counter += 1
			break
			
print(counter)

Fixed code:
N, M, C = (map(int, input().split()))
B = list(map(int, input().split()))
counter = 0
for i in range(N):
	tmp = list(map(int, input().split()))
	total = C
	for j in range(M):
		total += B[j] * tmp[j]
	if total > 0:
		counter += 1
			
print(counter)
Buggy code:
n,m,c=map(int,input().split())
b_l=list(map(int,input().split()))

cnt=0
for i in range(n):
            a_l_i = list(map(int,input().split()))
            c_l = 0
            for j in range(m-1):
                        c_l += a_l_i[j] * b_l[j]
            last_ = c_l - c
            if last_>0:
                        cnt+=1
print(cnt)                        
                        




Fixed code:
n,m,c=map(int,input().split())
b_l=list(map(int,input().split()))

cnt=0
for i in range(n):
            a_l_i = list(map(int,input().split()))
            c_l = 0
            for j in range(m):
                        c_l += a_l_i[j] * b_l[j]
            last_ = c_l + c

            if last_>0:
                        cnt+=1
print(cnt)
Buggy code:
n,m,c=map(int,input().split())
b=list(int,input())
a=[list(map(int,input().split())) for i in range(n)]
count=0
for i in range(n):
  sum=c
  for j in range(m):
    sum+=a[i,j]*b[j]
  if sum>0:
    sum+=1
print(sum)

Fixed code:
n,m,c=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n+1)]
count=0
for i in range(n):
  sum=c
  for j in range(m):
    sum+=a[i+1][j]*a[0][j]
  if sum>0:
    count+=1
print(count)
Buggy code:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for i in range(n):
    sum = 0

    for j in range(m):
        sum += a[i][j] * b [j]

        if sum + c > 0:
            ans += 1


print(ans)

Fixed code:
n,m,c=map(int, input().split())
b=list(map(int, input().split()))
ans=0
for _ in range(n):
	a=list(map(int, input().split()))
	r=c+sum([a[i]*b[i] for i in range(m)])
	ans += 1 if r>0 else 0
print(ans)
Buggy code:
vdef judge():
	result = C
	for i in range(M):
		result += A[i] * A[j]

	return result > 0

def main():
	N, M, C = map(int, input().split())
	B = map(int, input().split())
	count = 0

	for i in N:
		A = map(int, input().split())

		if judge(A, B, C, M):
			count += 1

	print(count)



if __name__ == '__main__':
	main()

Fixed code:
def judge(A, B, C, M):
	result = C
	for i in range(M):
		result += A[i] * B[i]

	return result > 0

def main():
	N, M, C = map(int, input().split())
	B = [int(x) for x in input().split()]
	count = 0

	for i in range(N):
		A = [int(x) for x in input().split()]

		if judge(A, B, C, M):
			count += 1

	print(count)



if __name__ == '__main__':
	main()
Buggy code:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

count = 0
for n in range(N):
  sum = C
  for m in range(M):
    sum += b[m]*a[n][m]
  if sum > 0:
    count += 1
print(count)

Fixed code:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
count=0
for n in range(N):
    sum = C
    for m in range(M):
        sum += B[m]*A[n][m]
    if sum > 0:
        count+= 1
print(count)
Buggy code:
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
li = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    num = 0
    for j in range(m):
        d = li[i][j] * B[j]
    else:
        d += c
        if d > 0:
            count += 1
print(count)

Fixed code:
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
li = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    d = 0
    for j in range(m):
        d += li[i][j] * B[j]
    else:
        d += c
        if d > 0:
            count += 1
print(count)
Buggy code:
N,M,C =map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split()))for _ in range(N)]

count = 0

for i in range(N):
    p = C
    for j in range(M):
        p += A[i][j]*B[j]
        if p > 0:
            count += 1

print(count)

Fixed code:
N,M,C =map(int,input().split())
B = list(map(int,input().split()))
count = 0
for i in range(N):
    A = list(map(int,input().split()))
    p = C
    for j in range(M):
        p += A[j] * B[j]
    if p > 0:
        count += 1

print(count)
Buggy code:
n,m,c=map(int,input().split())
b= [int(x) for x in input().split()]
ans=0

for i in range(n):
    a=[int(x)*y for x,y in zip(input().split(),b)]
    s=0
    for j in range(m):
        s=sum(a)
        if(s+c>0):
            ans=+1
print(ans)

Fixed code:
n,m,c=map(int,input().split())
b= [int(x) for x in input().split()]
ans=0

for i in range(n):
    a=[int(x)*y for x, y in zip(input().split(), b)]
    if(sum(a)+c>0):
        ans+=1
print(ans)
Buggy code:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
count = 0
for i in range(N):
    A = list(map(int, input().split()))
    x = C
    for index, val in enumerate(B):
        x += A[index] * val
    if x > 0:
        count += 1
    print(x)
print(count)


Fixed code:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
count = 0
for i in range(N):
    A = list(map(int, input().split()))
    x = C
    for index, val in enumerate(B):
        x += A[index] * val
    if x > 0:
        count += 1
print(count)
Buggy code:
n,m,c = map(int,input().split())

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

for i in range(n):
    a.append(list(map(int, input().split())))
sum = 0
count = 0

for i in range(n):
    for j in range(m):
        sum = sum + b[j]*a[i][j]

    if(sum+c>1):
        sum = 0
        count = count + 1

print(count)


Fixed code:
n,m,c = map(int,input().split())

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

for i in range(n):
    a.append(list(map(int, input().split())))
sum = 0
count = 0

for i in range(n):
    for j in range(m):
        sum = sum + b[j]*a[i][j]


    if(sum+c>0):
        count = count + 1
    sum = 0

print(count)
Buggy code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
  A=list(map(int, input().split()))
  p=C
  for j in range(M):
    p+=A[j]*B[j]
    if p>0:
      count+=1
print(count)

Fixed code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
  A=list(map(int,input().split()))
  if sum([A[i]*B[i] for i in range(M)])+C>0:
    count += 1
print(count)
Buggy code:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
  A=list(map(int, input().split()))
  p=C
  for j in range(M):
    P+=A[j]*B[j]
    if p>0:
      count+=1
print(count)

Fixed code:
N,M,C =map(int,input().split())

B = list(map(int,input().split()))
A = [list(map(int, input().split())) for i in range(N)]

count=0
for i in range(N):
  
  sum=0
  for j in range(M):
    sum=sum+A[i][j]*B[j]
  sum=sum+C
  if sum>0:
    count=count+1
    
print(count)
Buggy code:
n, m, c - [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]

r = 0
for i in range(n):
  a = [int(i) for i in input().split(' ')]
  s = 0
  for j in range(m):
    s += a[j] * b[j]
  s += c
  if s > 0:
    r += 1
  
print(r)

Fixed code:
n, m, c = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
 
r = 0
for i in range(n):
  a = [int(i) for i in input().split(' ')]
  s = 0
  for j in range(m):
    s += a[j] * b[j]
  s += c
  if s > 0:
    r += 1
  
print(r)
Buggy code:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    result=0
    a=list(map(int,input().split()))
    for c in range(m):
        result+=b[c]*a[c]
    if result>0:
        count+=1
print(count-1)

Fixed code:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    result=0
    a=list(map(int,input().split()))
    for z in range(m):
        result+=b[z]*a[z]
    if (result+c)>0:
        count+=1
if count==0:
    print(0)
else:
    print(count)
Buggy code:
N, M, C = map(int, input().split())
B = [int(input()) for i in range(M)]
A = [[int(input()) for i in range(M)] for j in range(N)]
cnt = 0
for i in range(N):
    ans = 0
    for j in range(M):
        ans += A[i][j] * B[j]
    if ans + C > 0:
        cnt += 1
print(cnt)


Fixed code:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

cnt = 0
for i in range(N):
  ans = C
  for j in range(M):
    ans += A[i][j] * B[j]
  if ans > 0:
    cnt += 1
print(cnt)
Buggy code:
n, m, c = map(int, input().split()
B = list(map(int, input().split()))
A = [list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += b[j] * a[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)


Fixed code:
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += B[j] * A[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)
Buggy code:
def main():
    n,m,c = tuple([int(t)for t in input().split()])
	b = tuple([int(t)for t in input().split()])
    
    ans = 0
    for _ in [0]*n:
      	t = tuple([int(t)for t in input().split()])
        v = c
		for i in range(m):
            v+=b[m]*t[m]
        if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()

Fixed code:
def main():
    n,m,c = tuple([int(t)for t in input().split()])
    b = tuple([int(t)for t in input().split()]) 
    ans = 0
    for _ in [0]*n:
      t = tuple([int(t)for t in input().split()])
      v = c
      for i in range(m):
        v+=b[i]*t[i]
      if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()
Buggy code:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count = 0
ans = 0
for i in range(n):
  l = list(map(int,input().split()))
  for j in range(m):
    ans += b[j]*a[j]
  if ans +c > 0:
    count += 1
    
  ans = 0
print(count

Fixed code:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count = 0
ans = 0
for i in range(n):
  l = list(map(int,input().split()))
  for j in range(m):
    ans += b[j]*l[j]
  if ans +c > 0:
    count += 1
    
  ans = 0
print(count)
Buggy code:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count = 0
for i in range(n):
    a = list(map(int,input().split()))
    eq = c
    for j in range(m):
        eq += a[i] * b[i]
    if eq > 0:
        count += 1
print(count)

Fixed code:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count = 0
for i in range(n):
    a = list(map(int,input().split()))
    eq = c
    for j in range(m):
        eq += a[j] * b[j]
    if eq > 0:
        count += 1
print(count)
Buggy code:
tmp = input()
N = int(input().split()[0])
M = int(input().split()[1])
C = int(input().split()[2])
tmp = input()
B = [int(b) for b in tmp.split()]
cnt = 0
for i in range(N):
  tmp = input()
  A = [int(a) for a in tmp.split()]
  sum = 0
  for j in range(M):
    sum += B[j]*A[j]
  sum += C
  if C > 0:
    cnt += 1
print(cnt)


Fixed code:
tmp = input()
N = int(tmp.split(' ')[0])
M = int(tmp.split(' ')[1])
C = int(tmp.split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = C
  for j in range(M):
    sum += B[j]*A[j]
  if sum > 0:
    cnt += 1
print(cnt)
Buggy code:
n, m, c = map(int, input().split())
b = list(map(int, input(). split()))
cal = c
cnt = 0

for i in range(n):
	a = list(map(int, input().split()))
	for x in range(m):
		cal += a[x] * b[x]
		if cal > 0:
			cnt += 1
			break

print(cnt)

Fixed code:
n, m, c = map(int, input().split())
b = list(map(int, input(). split()))
cnt = 0

for i in range(n):
	a = list(map(int, input().split()))
	cal = c
	for x in range(m):
		cal += a[x] * b[x]
		if x == m - 1 and cal > 0:
			cnt += 1

print(cnt)
Buggy code:
N,M = map(int,input().split())
list = []
for _ in range(n):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in l:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)

Fixed code:
N,M = map(int,input().split())
list = []
for _ in range(N):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in list:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)
Buggy code:
n,m = map(int,input().split())
ab = [0]
num = m
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab.sort()
ans = 0
for i in ab:
    if i[1] >= num:
        ans += i[0]*num
        break
    else:
        ans += i[0]*i[1]
        num -= i[1]
print(ans)
        

Fixed code:
n,m = map(int,input().split())
ab = []
num = m
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab.sort()
ans = 0
for i in ab:
    if i[1] >= num:
        ans += i[0]*num
        break
    else:
        ans += i[0]*i[1]
        num -= i[1]
print(ans)
Buggy code:
import sys
N,M=map(int,input().split())
A=[0]*N
B=[0]*N
for i in range(0,N):
  A[i],B[i]=map(int,input().split())
index=sorted(range(len(A)), key=lambda k: A[k])

cost=0
get=0
for i in index:
  if get+B[i]<=M:
    get += B[i]
    cost += A[i]*B[i]
  else:
    cost += A[i]*(M-get)
    print(cost)
	sys.exit()

Fixed code:
import sys
N,M=map(int,input().split())
A=[0]*N
B=[0]*N
for i in range(0,N):
  A[i],B[i]=map(int,input().split())
index=sorted(range(len(A)), key=lambda k: A[k])
cost=0
get=0
for i in index:
  if get+B[i]<M:
    get += B[i]
    cost += A[i]*B[i]
  else:
    cost += A[i]*(M-get)
    print(cost)
    sys.exit()
Buggy code:
import numpy as np
N,les=list(map(int,input().split()))
data=np.array([list(map(int,input().split())) for _ in range(N)])
cost=0

t=data[:,0]
for n in np.argsort(data[:,0]):
    if data[n][1]>les:
        cost+=les*data[n][0]
    else:
        les-=data[n][1]
        cost+=data[n][0]*data[n][1]
print(cost)

Fixed code:
import numpy as np
N,les=list(map(int,input().split()))
data=np.array([list(map(int,input().split())) for _ in range(N)])
cost=0

t=data[:,0]
for n in np.argsort(data[:,0]):
    if data[n][1]>les:
        cost+=les*data[n][0]
        break
    else:
        les-=data[n][1]
        cost+=data[n][0]*data[n][1]
print(cost)
Buggy code:
N, M = map(int, input().split())
dic = {}
count = 0
goukei = 0

for i in range(N):
  price,honsu = map(int, input().split())
  dic[price] = honsu
dic = sorted(dic.items())  
for kakaku, number in dic:
    nokori = M-count
    count += number
    if count >= M:
      print(goukei)
      goukei += nokori*kakaku
      break
    else:
      goukei += number*kakaku
print (goukei)      
    
     
      
      

    

Fixed code:
N, M = map(int, input().split())
dic = {}
count = 0
goukei = 0
 
for i in range(N):
  price,honsu = map(int, input().split())
  if price in dic:
    dic[price] += honsu
  else:
    dic[price] = honsu
dic = sorted(dic.items())
for kakaku, number in dic:
    nokori = M-count
    count += number
    if count >= M:
      goukei += nokori*kakaku
      break
    else:
      goukei += number*kakaku
print (goukei)
Buggy code:
n,k = map(int, input().split())
a = sorted([tuple(input().split()) for i in range(n)])
ans = 0
for x in a:
  temp = min(x[1],k)
  ans += temp*x[0]
  k = max(0,k-temp)
print(ans)

Fixed code:
n,k = map(int, input().split())
a = sorted(tuple(map(int,input().split())) for i in range(n))
ans = 0
for x in a:
  temp = min(x[1],k)
  ans += temp*x[0]
  k = max(0,k-temp)
print(ans)
Buggy code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, m = rm()
cnt = 0
cnt_money = 0
for i in sorted([rl() for _ in range(n)]):
  a, b = i
  if cnt + b < m:
    cnt += b
    cnt_money += a*b
  else:
    cnt_money += (m - cnt) * a
print(cnt_money)
    

















Fixed code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, m = rm()
cnt = 0
cnt_money = 0
for i in sorted([rl() for _ in range(n)]):
  a, b = i
  if cnt + b < m:
    cnt += b
    cnt_money += a*b
  else:
    cnt_money += (m - cnt) * a
    break
print(cnt_money)
Buggy code:
import numpy as np

N, M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

B = sorted(A)

cnt = 0
amount = 0
for i in range(N):
  cnt += B[i][1]
  if cnt < M:
    amount += B[i][0]*B[i][1]
  if cnt >= M:
    amount += B[i][0]*(M-cnt+B[i][1])

print(amount)




Fixed code:
import numpy as np

N, M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

B = sorted(A)

cnt = 0
amount = 0
for i in range(N):
  if cnt+B[i][1] < M:
    cnt += B[i][1]
    amount += B[i][0]*B[i][1]
  elif cnt+B[i][1] >= M:
    #cnt = M
    amount += B[i][0]*(M-cnt)
    break

print(amount)
Buggy code:
N,M=map(int,input().split()) #N...ken M..hon
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A) #A...en B..hon
print(A)
price=0
num=0
for i in range(N):
    if num+A[i][1]<M:
        price+=A[i][0]*A[i][1]
        num+=A[i][1]
    elif num<M and num+A[i][1]>=M:
        price+=A[i][0]*(M-num)
        break
    else:
        break
print(price)


Fixed code:
N,M=map(int,input().split()) #N...ken M..hon
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A) #A...en B..hon
#print(A)
price=0
num=0
for i in range(N):
    if num+A[i][1]<M:
        price+=A[i][0]*A[i][1]
        num+=A[i][1]
    elif num<M and num+A[i][1]>=M:
        price+=A[i][0]*(M-num)
        break
    else:
        break
print(price)