Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
            print(first)
 
if __name__ == '__main__' :
    main()

Fixed submission:
r = int(input())
S = 3 * r * r
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys

input = sys.stdin.readline

def main():
    
    N = int(input())
    A = [int(input()) for _ in range(N)]

    A = np.array(A)
    i = 0

    for a in A:
        print(max(np.delete(A, i)))
        i = i + 1

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys

input = sys.stdin.readline

def main():
    
    N = int(input())
    A = [int(input()) for _ in range(N)]

    A = np.array(A)

    for i in range(N):
        print(max(np.delete(A, [i], axis=0)))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def main():
    
    N = int(input())
    A = []
    for i in range(N):
        A.append(input())

    A = np.array(A)

    for i in range(N):
        print(max(np.delete(A, [i], axis=0)))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

A = np.array(A)

for i in range(N):
    print(max(np.delete(A, [i], axis=0)))

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

A = np.array(A)

for i in range(N):
    print(max(np.delete(A, [i], axis=0)))
    

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
S = input()
S.list()
S.sort()

if S == ["a", "b", "c"]:
    print("Yes")
else:
    print("No")

Fixed submission:
S = input()
S1 = list(S)
S1.sort()

if S1 == ["a", "b", "c"]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if (abs(x-a) > abc(x-b)):
    print("A")
else:
    print("B")

Fixed submission:
x,a,b = map(int, input().split())
if (abs(x-a) < abs(x-b)):
    print("A")
else:
    print("B")
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
kirai = [int(i) for i in input().split()] 
usable_num = [1,2,3,4,5,6,7,8,9]
for x in kirai:
    usable_num.remove(x)
    
ketasu = len(str(N))
#print(ketasu)
s = 0
for d in range(ketasu):
    s += min(usable_num) * 10 ** d 

if s >= N:
    print(s)
else:
    print(N+min(usable_num))

Fixed submission:
A,B,C = map(int, input().split())
list_num = [A,B,C]
list_num.sort()

if list_num==[5,5,7]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

if N == M: print 'Yes'
else: print 'No'

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

if N == M: 
    print ('Yes')
else: 
    print ('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
cnt = 0

for i in range(N):
    s.append(input())

for i in range(N):
    for j in range(i+1, N):
        a = sorted(s[i])
        b = sorted(s[j])
        for x in range(len(a)):
            if a[x] != b[x]:
                break
            elif x == len(a)-1:
                cnt += 1

print(cnt)



Fixed submission:
N = int(input())
dic = {}
count = 0


for i in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    count += dic.get(s_sorted, 0)
    dic[s_sorted] = dic.get(s_sorted, 0) + 1

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
cnt = 0

for i in range(N):
    s.append(input())

for i in range(N):
    for j in range(i+1, N):
        for k in range(len(s[i])):
          	tmp = s[i]
            tmp = s[i].replace(s[j][k], "")
        if tmp == "":
            cnt += 1
        else:
            continue
            
print(cnt)



Fixed submission:
N = int(input())
dic = {}
count = 0


for i in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    count += dic.get(s_sorted, 0)
    dic[s_sorted] = dic.get(s_sorted, 0) + 1

print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
ans = 'Yes'

H[0] -= 1
for i in range(N-1):
    if H[i] < H[i+1]
        H[i+1] -= 1
    elif H[i] > H[i+1]
        ans = 'No'
        break

print(ans)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 'Yes'

H[0] -= 1
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
    elif H[i] > H[i+1]:
        ans = 'No'
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())

if X < A: print(0)
else: print()10


Fixed submission:
X, A = map(int, input().split())

if X < A: print(0)
else: print(10)

Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())

if X < A: print(0)
else print()10


Fixed submission:
X, A = map(int, input().split())

if X < A: print(0)
else: print(10)
Buggy python submission (verdict: Runtime Error):
N = input()
S = list(map(int, input().split()))
ans = 10000

for T in range(1, N):
    s1 = 0
    s2 = 0
    for i in range(len(S)):
        if S[i] <= T:
            s1 += S[i]
        else:
            s2 += S[i]
    if abs(s1 - s2) < ans:
        ans = abs(s1 - s2)
        
print (ans)


Fixed submission:
N = int(input())
S = list(map(int, input().split()))
ans = 10000

for T in range(1, N):
    s1 = 0
    s2 = 0
    for i in range(len(S)):
        if i+1 <= T:
            s1 += S[i]
        if i+1 > T:
            s2 += S[i]
    if abs(s1 - s2) < ans:
        ans = abs(s1 - s2)
        
print (ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

ans = 0
for i in range(0, N):
  for j in range(0, i):
    if N[i] < N[j]:
      break
    if  i == j:
      ans += 1
    
print (ans)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))

ans = 1
for i in range(0, N):
  for j in range(0, i):
    if H[j] > H[i]:
      break
    if  j + 1 == i:
      ans += 1
    
print (ans)
Buggy python submission (verdict: Runtime Error):
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_eb, cnt_bw))

Fixed submission:
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_wb, cnt_bw))

Buggy python submission (verdict: Runtime Error):
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if w_b[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_eb, cnt_bw))

Fixed submission:
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_wb, cnt_bw))
Buggy python submission (verdict: Runtime Error):
import sys
 
antennas = [int(input()) for _ in range(5)]
k = int(input())
 
for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print ':('
      sys.exit()

print 'Yay!'

Fixed submission:
import sys
 
antennas = [int(input()) for _ in range(5)]
k = int(input())
 
for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print (':(')
      sys.exit()

print ('Yay!')

Buggy python submission (verdict: Runtime Error):
import sys

antennas = [int(input()) for _ in range(5)]
k = int(input())

for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print ':('
      sys.exit()

print 'Yay!'
      
    

Fixed submission:
import sys
 
antennas = [int(input()) for _ in range(5)]
k = int(input())
 
for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print (':(')
      sys.exit()

print ('Yay!')
Buggy python submission (verdict: Runtime Error):
price = 700

S = input()
if s[0] == 'o':
    price += 100
if s[1] == 'o':
    price += 100
if s[2] == 'o':
    price += 100
       
print (price)


Fixed submission:
price = 700

s = input()
if s[0] == 'o':
    price += 100
if s[1] == 'o':
    price += 100
if s[2] == 'o':
    price += 100

print (price)
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
ans = 0

if A + B <= C:
    ans = A*X + B*Y
else:
    ans += 2*C*min(X, Y)

    if X >= Y:
        ans + = A*(X-Y)
    else:
        ans + = B*(X-Y)

print (ans)


Fixed submission:
A, B, C, X, Y = map(int, input().split())
ans = 0

if A + B <= 2*C:
    ans = A*X + B*Y
else:
    ans += 2*C*min(X, Y)

    if X >= Y:
        ans += min(A, 2*C) * (X-Y)
    else:
        ans += min(B, 2*C) * (Y-X)

print (ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input.split())
ans = min(N*A, B) 

print (ans)


Fixed submission:
N, A, B = map(int, input().split())
ans = min(N*A, B) 

print (ans)
Buggy python submission (verdict: Runtime Error):
N = input()
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N /= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')


Fixed submission:
N = int(input())
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N //= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = input()

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')

Fixed submission:
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = input()

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')

Fixed submission:
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = input()

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')


Fixed submission:
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')


Fixed submission:
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [ 0 ] * 86

L[0] = 2
L[1] = 1

for i in range(2, N+1):
  L[i] = L[i-2] + L[i-1]

print (L[N])

Fixed submission:
N = int(input())
L = [ 0 ] * 1000000

L[0] = 2
L[1] = 1

for i in range(2, N+1):
  L[i] = L[i-2] + L[i-1]

print (L[N])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [ 0 ] * 86

L[0] = 2
L[1] = 1

for i in range(2, N):
    L[i] = L[i-2] + L[i-1]

print (L[N])
    


Fixed submission:
N = int(input())
L = [ 0 ] * 1000000

L[0] = 2
L[1] = 1

for i in range(2, N+1):
  L[i] = L[i-2] + L[i-1]

print (L[N])
Buggy python submission (verdict: Runtime Error):
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            val = a
            if op1 == "+":
                val += b
            else:
                val -= b

            if op2 == "+":
                val += c
            else:
                val -= c

            if op3 == "+":
                val += d
            else:
                val -= d

            if val==7:
                print("{}{}{}{}{}{}{}=7".format(a,op1,b,op2,c,op3,d))
                return


Fixed submission:
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            val = a
            if op1 == "+":
                val += b
            else:
                val -= b
 
            if op2 == "+":
                val += c
            else:
                val -= c
 
            if op3 == "+":
                val += d
            else:
                val -= d
            
            if val==7:
                print("{}{}{}{}{}{}{}=7".format(a,op1,b,op2,c,op3,d))
                exit(0)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
dislike = list(map(int, input().split()))

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break

Fixed submission:
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
dislike = list(map(int, input().split()))

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break

Fixed submission:
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO)

Fixed submission:
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
dislike = list(map(int, input().split()))

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(i) & set(dislike))
    if len(match)==0:
        print(i)
        break

Fixed submission:
N, K = map(int, input().split())
dislike = list(map(int, input().split()))
 
for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = {}
ans = 0
for i in range(n):
    s = ''.join(sorted(input()))
    if s in d.keys():
        ans += d[s]
        d[s] += 1
    d.setdefault(s, 1)
print(ans)


Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
jobs = []
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    jobs.append([a, b])
for i in range(1, m+1):
    today_income = [job[1] for job in jobs if job[0] <= i]
    if today_income:
        today_max_income = max(today_income)
        max_income_payment_day = [job[0] for job in jobs if job[1] == today_max_income]
        jobs.remove([max(max_income_payment_day), today_max_income])
        ans += today_max_income
print(ans)

Fixed submission:
import heapq
n, m = map(int, input().split())
ab_list = [list(map(int, input().split())) for i in range(n)]
ab_list.sort()
idx = 0
q = []
ans = 0
for j in range(1, m+1):
    while idx < n:
        a, b = ab_list[idx]
        if a <= j:
            heapq.heappush(q, -b)
            idx += 1
        else:
            break
    if len(q) > 0:
        b = heapq.heappop(q)
        ans -= b
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd, floor
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
anti_b = B - (floor(B/C) + floor(B/D) - floor(B/lcm))
anti_a = (A-1) - (floor((A-1)/C) + floor((A-1)/D) - floor((A-1)/lcm))
print(anti_b-anti_a)


Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) - ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))
Buggy python submission (verdict: Runtime Error):
if 500*K >= X:
	print("Yes")
else:
	print("No")

Fixed submission:
K, X = map(int, input().split())

if 500*K >= X:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
K = int(input())
print(K)
X = int(input())
print(X)

if 500*K >= X:
	print("Yes")
else:
	print("No")

Fixed submission:
K, X = map(int, input().split())

if 500*K >= X:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

def f(remain_cnt, idx):
    if remain_cnt <= AB[idx][1]:
        return remain_cnt * AB[idx][0]
    return AB[idx][0] * AB[idx][1] + f(remain_cnt - AB[idx][1], idx + 1)

print(f(M, 0))


Fixed submission:
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

sum = 0
remain_cnt = M
i = 0

while(True):
    if remain_cnt <= AB[i][1]:
        sum += remain_cnt * AB[i][0]
        break

    sum += AB[i][0] * AB[i][1]
    remain_cnt -= AB[i][1]
    i += 1

print(sum)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

def f(remain_cnt, l):
    if remain_cnt <= l[0][1]:
        return remain_cnt * l[0][0]
    return l[0][0] * l[0][1] + f(remain_cnt - l[0][1], l[1:])

print(f(M, AB))


Fixed submission:
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

sum = 0
remain_cnt = M
i = 0

while(True):
    if remain_cnt <= AB[i][1]:
        sum += remain_cnt * AB[i][0]
        break

    sum += AB[i][0] * AB[i][1]
    remain_cnt -= AB[i][1]
    i += 1

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
l = len(S)
c = l

while True:
    S = S.replace('01', '')
    S = S.replace('10', '')

    if(len(S) == c):
        break

    c = len(S)

print(l - len(S))


Fixed submission:
import numpy as np

S = np.array(list(map(int, input())))

n0 = (S == 0).sum()
n1 = (S == 1).sum()

print(min(n0, n1) * 2)
Buggy python submission (verdict: Runtime Error):
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()


Fixed submission:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    for i in range(len(S)):
        if S[i] != '1':
            break

    if i == len(S) - 1:
        print('1')
        return

    if K <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()


Fixed submission:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    for i in range(len(S)):
        if S[i] != '1':
            break

    if i == len(S) - 1:
        print('1')
        return

    if K <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()