Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        n = max((n // (10**k)) * (n % (10**k))
                for k in range(1, int(log10(n)) + 1))
        j += 1
    print(j)

Fixed submission:
from math import log10

for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        n = max((n // (10**k)) * (n % (10**k)) for k in range(1, int(log10(n)) + 1))
        j += 1
    print(j)

Buggy python submission (verdict: Runtime Error):
for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        L = [(n // (10**k)) * (n % (10**k))
             for k in range(1, int(log10(n)) + 1)]
        n = max(L)
        j += 1
    print(j)

Fixed submission:
from math import log10

for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        n = max((n // (10**k)) * (n % (10**k)) for k in range(1, int(log10(n)) + 1))
        j += 1
    print(j)

Buggy python submission (verdict: Runtime Error):
for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        m_max = 0
        for k in range(1, int(log10(n)) + 1):
            m = (n // (10**k)) * (n % (10**k))
            if m >= m_max:
                m_max = m
        n = m_max
        j += 1
    print(j)

Fixed submission:
from math import log10

for i in range(int(input())):
    n = int(input())
    j = 0
    while n >= 10:
        n = max((n // (10**k)) * (n % (10**k)) for k in range(1, int(log10(n)) + 1))
        j += 1
    print(j)
Buggy python submission (verdict: Runtime Error):
x, y = (int(s) for s in input().split())
while y > 0
    x, y = y, x % y
print(x)

Fixed submission:
x, y = (int(s) for s in input().split())
while y > 0:
    x, y = y, x % y
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N, M = map(int, input().split())
    if N*M == 0:
        return False
    P = [0]+[int(input()) for _ in range(N)]
    # solve
    k = [p1+p2 for p1, p2 in zip(P, P)]
    k = sorted(k)

    ret = 0
    for i in range(N):
        for j in range(N):
            tmp = P[i]+P[j]
            if tmp > M:
                continue
            else:
                r = M-tmp
                l = bisect.bisect_right(k, r)
                if l >= len(k):
                    tmp += k[-1]
                elif l != 0:
                    tmp += k[l-1]
            ret = max(ret, tmp)
    return ret


ans = []
while True:
    ret = solve()
    if ret:
        ans.append(ret)
    else:
        break
print("\n".join(map(str, ans)))



Fixed submission:
import bisect
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N, M = map(int, input().split())
    if N*M == 0:
        return False
    P = [0]+[int(input()) for _ in range(N)]
    # solve
    k = [P[i]+P[j] for i in range(N) for j in range(i, N)]
    k = sorted(k)

    ret = 0
    for tmp in k:
        if tmp > M:
            break
        else:
            r = M-tmp
            l = bisect.bisect_right(k, r)
            tmp += k[l-1]
            ret = max(ret, tmp)
    return ret


ans = []
while True:
    ret = solve()
    if ret:
        ans.append(ret)
    else:
        break
print("\n".join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def leven(s1, s2):
    n1 = len(s1)
    n2 = len(s2)
    dp = [[0]*(n1+1) for _ in range(n2+1)]

    for i in range(1, n1+1):
        dp[0][i] = i
    for i in range(1, n2+1):
        dp[i][0] = i

    for j in range(1, n2+1):
        for k in range(1, n1+1):
            m = min(dp[j-1][k]+1, dp[j][k-1])
            if s1[j-1] == s2[k-1]:  # 最後の文字削除
                m = min(m, dp[j-1][k-1])
            else:
                m = min(m, dp[j-1][k-1]+1)
            dp[j][k] = m
    print(dp[-1][-1])


s1 = input()[:-1]
s2 = input()[:-1]
leven(s1, s2)



Fixed submission:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def leven(s1, s2):
    n1 = len(s1)
    n2 = len(s2)
    dp = [[0]*(n1+1) for _ in range(n2+1)]

    for i in range(1, n1+1):
        dp[0][i] = i
    for i in range(1, n2+1):
        dp[i][0] = i

    for j in range(1, n2+1):
        for k in range(1, n1+1):
            m = min(dp[j-1][k], dp[j][k-1])+1
            if s1[k-1] == s2[j-1]:  # 最後の文字削除
                m = min(m, dp[j-1][k-1])
            else:
                m = min(m, dp[j-1][k-1]+1)
            dp[j][k] = m
    print(dp[-1][-1])


s1 = input()[:-1]
s2 = input()[:-1]
leven(s1, s2)
Buggy python submission (verdict: Runtime Error):
print(input()**3)


Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
a,b=int(input().split())
print(a*b, 2*(a+b))


Fixed submission:
a,b=map(int,input().split())
print(a*b, 2*(a+b))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,(input().split())
print(a*b, 2*(a+b))


Fixed submission:
a,b=map(int,input().split())
print(a*b, 2*(a+b))
Buggy python submission (verdict: Runtime Error):
s=int(input())
print(s//(u=60)//u, s//u%u, s%u, sep=":")


Fixed submission:
u,s=60,int(input())
print(s//u//u, s//u%u, s%u, sep=":")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(['No','Yes'][a<b<c])


Fixed submission:
a,b=map(int,input().split())
print('a','>'if a>b else'<'if a<b else'==','b')
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print([a<b<c]['No','Yes'])


Fixed submission:
a,b,c=map(int,input().split())
print(['No','Yes'][a<b<c])
Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = input().split()
print(['No','Yes'][r<=x & x<=w-r & r<=y & y<=h-r]


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = input().split()
print(['No','Yes'][r<=x and x<=w-r and r<=y and y<=h-r]


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][r<=x & x<=w-r & r<=y & y<=h-r]


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][r<=x and x<=w-r and r<=y and y<=h-r]


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][(r<=x<=w-r)*(r<=y<=h-r)]


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][r<=x<=w-r & r<=y<=h-r])


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(input().split())
print(['No','Yes'][(r<=x<=w-r)*(r<=y<=h-r)])


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])

Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][(r<=x<=w-r)*(r<=y<=h-r)])in


Fixed submission:
w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])
Buggy python submission (verdict: Runtime Error):
i,a,b,c = 0,map(int,input().split())
for x in range(a+1,b)
  if c % x == 0: i+=1
print(i)


Fixed submission:
i=0
a,b,c = map(int,input().split())
for x in range(a,b+1):
  if c % x == 0: i+=1
print(i)

Buggy python submission (verdict: Runtime Error):
i=0
a,b,c = map(int,input().split())
for x in range(a+1,b)
  if c % x == 0: i+=1
print(i)


Fixed submission:
i=0
a,b,c = map(int,input().split())
for x in range(a,b+1):
  if c % x == 0: i+=1
print(i)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(a//b a%b a/b)


Fixed submission:
a,b = map(int,input().split())
print(a//b,a%b,f'{a/b:f}')
Buggy python submission (verdict: Runtime Error):
import math
print(int(input())**2*math.pi)


Fixed submission:
import math
r,p = float(input()),math.pi
print(r**2*p,2*p*r)

Buggy python submission (verdict: Runtime Error):
from math import math
print(int(input())**2*math.pi)


Fixed submission:
import math
r,p = float(input()),math.pi
print(r**2*p,2*p*r)
Buggy python submission (verdict: Runtime Error):
a,o,b = input().split()
a,b = map(int,(a,b))
print(a+b if o=='+': else a-b if o=='-': else a*b if o=='*': else a/b)


Fixed submission:
while 1:
  s = input()
  if '?' in s:break
  print(int(eval(s)))

Buggy python submission (verdict: Runtime Error):
while 1:
  a,o,b = input().split()
  if o=='?': break
  a,b = int(a,b)
  print(a+b if o=='+' else a-b if o=='-' else a*b if o=='*' else a//b)


Fixed submission:
while 1:
  s = input()
  if '?' in s:break
  print(int(eval(s)))
Buggy python submission (verdict: Runtime Error):
a=input
b=a*a*a
print a

Fixed submission:
a=input()
b=a*a*a
print b

Buggy python submission (verdict: Runtime Error):
a=input()
b=a*a*a
print a"\n"

Fixed submission:
a=input()
b=a*a*a
print b

Buggy python submission (verdict: Runtime Error):
a=input()
b=a*a*a
print a\n

Fixed submission:
a=input()
b=a*a*a
print b
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print a*b
print 2*a+2*b

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]

Buggy python submission (verdict: Runtime Error):
a,b=input(),input()
print a*b
print 2*a+2*b

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]

Buggy python submission (verdict: Runtime Error):
a=list(input())
print a[0]*a[1]
print 2*a[0]+2*a[1]

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]

Buggy python submission (verdict: Runtime Error):
a = map(int, raw_input().split())
print a[0]*a[1] 2*a[0]+2*a[1]

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]

Buggy python submission (verdict: Runtime Error):
a = map(int, raw_input().split())
print a[0]*a[1]    2*a[0]+2*a[1]

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]

Buggy python submission (verdict: Runtime Error):
a = map(int, raw_input().split())
print ,a[0]*a[1],2*a[0]+2*a[1]

Fixed submission:
a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]
Buggy python submission (verdict: Runtime Error):
import sys
import math

r = int(sys.stdin.readline())
print("%f %f" % (r*r*math.pi, r*2*math.pi))

Fixed submission:
import sys
import math

r = float(sys.stdin.readline())
print("%f %f" % (r*r*math.pi, r*2*math.pi))
Buggy python submission (verdict: Runtime Error):
import numpy as np

m1 = []
m2 = []
n, m = map(int, input().split())
for _ in range(n):
    m1.append([int(x) for x in input().split()])
for _ in range(m):
    m2.append([int(input())])

m1 = np.matrix(m1)
m2 = np.matrix(m2)
ans = m1 * m2

for i in range(n):
    print(ans[i, 0])

Fixed submission:
n, m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
for ni in range(n):
    ans = 0
    for mi in range(m):
        ans += A[ni][mi] * b[mi]
    print(ans)

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

m1 = []
m2 = []
n, m = map(int, input().split())
for _ in range(n):
    m1.append([int(x) for x in input().split()])
for _ in range(m):
    m2.append([int(input())])

m1 = np.matrix(m1)
m2 = np.matrix(m2)
ans = m1 * m2

for i in range(n):
    print(ans[i, 0])

Fixed submission:
n, m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
for ni in range(n):
    ans = 0
    for mi in range(m):
        ans += A[ni][mi] * b[mi]
    print(ans)
Buggy python submission (verdict: Runtime Error):
# Here your code !
# -*- coding:utf-8 -*-
import sys

def init():
    data = []
    while(True):
        line = raw_input()
        if not line: break
        data.append(line)
    return data

def main():
    n = int(init().pop)
    if 1 <= n <= 100:
        print n**3
    else:
        print "Error / Invalid input (%d)" % n

if __name__ == '__main__':
    main()

Fixed submission:
# coding: utf-8
# Here your code !
# -*- coding:utf-8 -*-
import sys

def init():
    data = []
    try:
        while(True):
            line = raw_input()
            if not line: break
            data.append(line)
    except EOFError:
        pass
    return data

def main():
    n = int(init().pop())
    if 1 <= n <= 100:
        print n**3
    else:
        print "Error / Invalid input (%d)" % n

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
n=input()
print(factorial(n))

Fixed submission:
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
n=input()
print(factorial(int(n)))
Buggy python submission (verdict: Runtime Error):
while int(input()) != 0:
    sum=0
    for i in range(n):
         sum=sum+int(input())   
    print sum

Fixed submission:
while True:
    n = int(input())
    sumlist=[]
    sum=0
    max=-100000
    if n==0:
        break
    for i in range(n):
         sumlist.append(int(input()))
    for i in range(n):
        sum=0
        for j in range(0,n-i):
            sum=sumlist[i+j]+sum
            if max<sum:
                max=sum

    print(max)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dlist = []
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        dlist.remove(code[1])
    if code[0] == "deleteFirst":
        dlist.pop(0)
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")

Fixed submission:
from collections import deque
n = int(input())
dlist = deque()
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        try:
            dlist.remove(code[1])
        except:
            continue
    if code[0] == "deleteFirst":
        dlist.popleft()
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dlist = []
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        try:
            dlist.remove(code[1])
        except:
            continue
    if code[0] == "deleteFirst":
        dlist.pop(0)
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")

Fixed submission:
from collections import deque
n = int(input())
dlist = deque()
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        try:
            dlist.remove(code[1])
        except:
            continue
    if code[0] == "deleteFirst":
        dlist.popleft()
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")
Buggy python submission (verdict: Runtime Error):
h, r = list(map(int, input().split()))
print(int((h+r)/abs(h+r)))


Fixed submission:
h, r = list(map(int, input().split()))
print(int((h+r>0)-(h+r<0)))
Buggy python submission (verdict: Time Limit Exceeded):
def fib(n):
    if n==0 or n==1:
        return 1
    else:
        return fib(n-1) + fib(n-2)
print(fib(int(input())))



Fixed submission:
def fib(n):
    if n ==0 or n == 1:
        return 1
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1

    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))

Buggy python submission (verdict: Runtime Error):
def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1
    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))



Fixed submission:
def fib(n):
    if n ==0 or n == 1:
        return 1
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1

    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))

Buggy python submission (verdict: Runtime Error):
def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1
    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))



Fixed submission:
def fib(n):
    if n ==0 or n == 1:
        return 1
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1

    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))
Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = {}
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.append(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = []
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.append(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = ()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.append(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = ()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.append(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = ()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')



Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    x = input()
    if 'insert' in x:
        dic.add(x.strip('insert '))
    else :
        if x.strip('find ') in dic:
            print('yes')
        else :
            print('no')
Buggy python submission (verdict: Runtime Error):
a = True
while a:
    l = map(int, list(input()))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False



Fixed submission:
a = True
while a:
    l = list(map(int, list(input())))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False

Buggy python submission (verdict: Runtime Error):
a = True
while a:
    l = map(int, list(input()))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False


Fixed submission:
a = True
while a:
    l = list(map(int, list(input())))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n,m=map(int,input().split())
while n!=0:
    d=[]
    p=[]
    
    for i in range(n):
        d_i,p_i=map(int,input().split())
        d.append(d_i)
        p.append((p_i,i)) #タプルでインデックス情報を付加
    
    #単位長さあたりの期待値で降順ソート
    p.sort(key=lambda x:-x[0])
    
    #警備がいない場合の期待値を求める
    hazard=0
    for i in range(n):
        hazard+=d[i]*p[i][0]
    
    for i in range(n):
        rest=d[p[i][1]]
        while rest!=0:
            if m==0:
                break
            m-=1
            rest-=1
            hazard-=p[i][0]
        else:
            continue
        break
        
    print(hazard)
    
    n,m=map(int,input().split())



Fixed submission:
# coding: utf-8

n,m=map(int,input().split())
while n!=0:
    d=[]
    p=[]
    
    for i in range(n):
        d_i,p_i=map(int,input().split())
        d.append(d_i)
        p.append((p_i,i)) #タプルでインデックス情報を付加
    #警備がいない場合の期待値を求める
    
    hazard=0
    for i in range(n):
        hazard+=d[i]*p[i][0]
    
    #単位長さあたりの期待値で降順ソート
    p.sort(key=lambda x:-x[0])
    
    for i in range(n):
        rest=d[p[i][1]]
        if m<rest:
            hazard-=m*p[i][0]
            break
        else:
            m-=rest
            hazard-=rest*p[i][0]
        
    print(hazard)
    n,m=map(int,input().split())

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n,m=map(int,input().split())
while n!=0:
    d=[]
    p=[]
    
    for i in range(n):
        d_i,p_i=map(int,input().split())
        d.append(d_i)
        p.append((p_i,i)) #タプルでインデックス情報を付加
    
    #単位長さあたりの期待値で降順ソート
    p.sort(key=lambda x:-x[0])
    
    #警備がいない場合の期待値を求める
    hazard=0
    for i in range(n):
        hazard+=d[i]*p[i][0]
    
    for i in range(n):
        rest=d[p[i][1]]
        while rest!=0:
            if m==0:
                break
            m-=1
            rest-=1
            hazard-=p[i][0]
        else:
            continue
        break
        
    print(hazard)
    
    n,m=map(int,input().split())



Fixed submission:
# coding: utf-8

n,m=map(int,input().split())
while n!=0:
    d=[]
    p=[]
    
    for i in range(n):
        d_i,p_i=map(int,input().split())
        d.append(d_i)
        p.append((p_i,i)) #タプルでインデックス情報を付加
    #警備がいない場合の期待値を求める
    
    hazard=0
    for i in range(n):
        hazard+=d[i]*p[i][0]
    
    #単位長さあたりの期待値で降順ソート
    p.sort(key=lambda x:-x[0])
    
    for i in range(n):
        rest=d[p[i][1]]
        if m<rest:
            hazard-=m*p[i][0]
            break
        else:
            m-=rest
            hazard-=rest*p[i][0]
        
    print(hazard)
    n,m=map(int,input().split())
Buggy python submission (verdict: Runtime Error):
def eratos(n):
	is_prime = [True for i in range(n+1)]
	for i in range(2, n):
		if i * i > n:
			break
		for j in range(i*i, n, i):
			is_prime[j] = False
	return is_prime

is_prime = eratos(10000)
n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if is_prime[x] is True:
        ans += 1

print(ans)


Fixed submission:
def eratos(n):
	is_prime = [True for i in range(n+1)]
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, n+1):
		if i * i > n:
			break
		for j in range(i*i, n+1, i):
			is_prime[j] = False
	return is_prime

is_prime = eratos(10000)
primes = []
for i in range(10001):
    if is_prime[i] is True:
        primes.append(i)

n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if x <= 10000:
        if is_prime[x] is True:
            ans += 1
    else:
        ok = True
        for i in primes:
            if i * i > x:
                break
            if x % i == 0:
                ok = False
                break
        if ok is True:
            ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
print(int(input)**3)


Fixed submission:
print(int(input())**3)