Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

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

print(int((a * b) // math.gcd(a,b)))

Fixed submission:
import fractions

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

print(int((a * b) // fractions.gcd(a,b)))

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

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

print(int(a * b // math.gcd(a,b)))

Fixed submission:
import fractions

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

print(int((a * b) // fractions.gcd(a,b)))

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

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

print(int(a * b / math.gcd(a,b)))

Fixed submission:
import fractions

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

print(int((a * b) // fractions.gcd(a,b)))

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

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

print(int(a * b / math.gcd(a,b)))


Fixed submission:
import fractions

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

print(int((a * b) // fractions.gcd(a,b)))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 1
    th = 1000000000000000000

    for a in A:
        ans *= a
    if ans > th:
        print('-1')
    else:
        print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 1
    th = 1000000000000000000

    for a in A:
        if a == 0:
            print('0')
            return 0

    for a in A:
        ans *= a
        if ans > th:
            print('-1')
            return 0
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# reference https://maspypy.com/atcoder-%e5%8f%82%e5%8a%a0%e6%84%9f%e6%83%b3-2019-02-09abc-154
from functools import lru_cache

N = int(input())
K = int(input())


# @lru_cache(None)
def F(N, K):
    # print("NK", N, K)
    """N以下で0でないものがちょうどK個。0を含める"""
    # assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0  # 求める数字は作れない
    q, r = divmod(N, 10)
    # print("qr", q, r)
    ret = 0
    if K >= 1:  # 1 の位が nonzero (1 の位で 0 でない数字 を消費するので、第 2 引数は K - 1)
        ret += F(q, K-1) * r  # smaller than 1 の位
        ret += F(q-1, K-1) * (9-r)  # bigger than 1 の位
    ret += F(q, K)  # 1の位が zero (1 の位で 0 でない数字 を消費していないので、第 2 引数は K)
    return ret


print(F(N, K))


Fixed submission:
# reference https://maspypy.com/atcoder-%e5%8f%82%e5%8a%a0%e6%84%9f%e6%83%b3-2019-02-09abc-154
from functools import lru_cache

N = int(input())
K = int(input())


@lru_cache(None)
def F(N, K):
    # print("NK", N, K)
    """N以下で0でないものがちょうどK個。0を含める"""
    # assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0  # 求める数字は作れない
    q, r = divmod(N, 10)
    # print("qr", q, r)
    ret = 0
    if K >= 1:  # 1 の位が nonzero (1 の位で 0 でない数字 を消費するので、第 2 引数は K - 1)
        ret += F(q, K-1) * r  # smaller than 1 の位
        ret += F(q-1, K-1) * (9-r)  # bigger than 1 の位
    ret += F(q, K)  # 1の位が zero (1 の位で 0 でない数字 を消費していないので、第 2 引数は K)
    return ret


print(F(N, K))
Buggy python submission (verdict: Time Limit Exceeded):
# ref https://atcoder.jp/contests/abc153/submissions/9758833
# ref http://drken1215.hatenablog.com/entry/2020/01/26/225000

# coding: utf-8
H, N = map(int, input().split())
A = [0]
B = [0]

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

dp = [[float('inf') for i in range(H+1)] for j in range(N+1)]

for i in range(N+1):
    dp[i][0] = 0

for i in range(1, N+1):
    for j in range(1, H+1):
        dp[i][j] = min(dp[i-1][j],  # do not use magic
                       #    dp[i-1][max(j-A[i], 0)] + B[i],  # use i-th magic
                       dp[i][max(j-A[i], 0)] + B[i])   # use i-th magic
        #print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])


print(dp[N][H])


Fixed submission:
# ref https://atcoder.jp/contests/abc153/submissions/9758833
# ref http://drken1215.hatenablog.com/entry/2020/01/26/225000

# coding: utf-8
H, N = map(int, input().split())
A = [0]
B = [0]

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

dp = [[float('inf') for i in range(H+1)] for j in range(N+1)]

for i in range(N+1):
    dp[i][0] = 0

for i in range(1, N+1):
    for j in range(1, H+1):
        dp[i][j] = min(dp[i-1][j],
                       dp[i-1][max(j-A[i], 0)] + B[i],
                       dp[i][max(j-A[i], 0)] + B[i])
        #print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])


print(dp[N][H])

Buggy python submission (verdict: Time Limit Exceeded):
# ref https://atcoder.jp/contests/abc153/submissions/9758833
# ref http://drken1215.hatenablog.com/entry/2020/01/26/225000

# coding: utf-8
H, N = map(int, input().split())
A = [0]
B = [0]

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

dp = [[float('inf') for i in range(H+1)] for j in range(N+1)]

for i in range(N+1):
    dp[i][0] = 0

for i in range(1, N+1):
    for j in range(1, H+1):
        dp[i][j] = min(dp[i-1][j],
                       dp[i][max(j-A[i], 0)] + B[i])
        #print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])


print(dp[N][H])


Fixed submission:
# ref https://atcoder.jp/contests/abc153/submissions/9758833
# ref http://drken1215.hatenablog.com/entry/2020/01/26/225000

# coding: utf-8
H, N = map(int, input().split())
A = [0]
B = [0]

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

dp = [[float('inf') for i in range(H+1)] for j in range(N+1)]

for i in range(N+1):
    dp[i][0] = 0

for i in range(1, N+1):
    for j in range(1, H+1):
        dp[i][j] = min(dp[i-1][j],
                       dp[i-1][max(j-A[i], 0)] + B[i],
                       dp[i][max(j-A[i], 0)] + B[i])
        #print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])


print(dp[N][H])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

answerd = [0] * 10010
WA_count = 0
AC_count = 0

for i in range(M):
    p, s = input().split()
    p = int(p)

    if s == 'WA' and answerd[p] == 0:
        WA_count += 1

    elif s == 'AC' and answerd[p] == 0:
        AC_count += 1
        answerd[p] = 1

print(AC_count, WA_count)


Fixed submission:
N, M = map(int, input().split())
ACed = [0] * (N + 1)
WAed = [0] * (N + 1)
WA_count = 0
AC_count = 0
WA_sum = 0

for i in range(M):
    p, s = input().split()
    p = int(p)

    if s == 'WA':
        WAed[p] += 1

    if s == 'AC' and ACed[p] == 0:
        ACed[p] = 1
        AC_count += 1
        WA_sum += WAed[p]

print(AC_count, WA_sum)
Buggy python submission (verdict: Runtime Error):
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

R = intinput()
print(2*R*3.1415)


Fixed submission:
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import numpy as np
import statistics
import string
import sys
from array import array
from collections import deque
from functools import wraps
import time

def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

R = intinput()
print(2*R*3.1415)

Buggy python submission (verdict: Runtime Error):
R = intinput()
print(2*R*3.1415)

Fixed submission:
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import numpy as np
import statistics
import string
import sys
from array import array
from collections import deque
from functools import wraps
import time

def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

R = intinput()
print(2*R*3.1415)
Buggy python submission (verdict: Runtime Error):
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import statistics
import string


def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

N, M = splitintinput()
restriction = {}
flag = 1
ans = ''
for i in range(M):
    s,c = splitintinput()
    if s in restriction:
        if restriction[s] != str(c):
            flag = 0
            break
    else:
        restriction[s] = str(c)
if N != 1 and restriction[1] == "0":
    flag = 0

if flag == 0:
    print(-1)
else:
    for i in range(M):
        if i+1 in restriction:
            ans += restriction[i+1]
        else:
            if i == 0 and M != 1:
                ans += "1"
            else:
                ans += "0"
    print(ans)


Fixed submission:
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import statistics
import string


def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

N, M = splitintinput()
restriction = {}
flag = 1
ans = ''
for i in range(M):
    s,c = splitintinput()
    if s in restriction:
        if restriction[s] != str(c):
            flag = 0
            break
    else:
        restriction[s] = str(c)


if flag == 0:
    print(-1)
else:
    for i in range(N):
        if i+1 in restriction:
            ans += restriction[i+1]
        else:
            if i == 0 and N != 1:
                ans += "1"
            else:
                ans += "0"
    if N != 1 and ans[0] == "0":
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
A = {}

for i in range(N):
    s = input()
    if s in A:
        A[s] += 1
    else:
        A[s] = 1

maxalist = [kv[0] for kv in A.items() if kv[1] == max(A.values())]
maxalist.sort()
for i in maxalist:
    print(i)


Fixed submission:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
A = {}

for i in range(N):
    s = input()
    if s in A:
        A[s] += 1
    else:
        A[s] = 1
        
j = max(A.values())

maxalist = [kv[0] for kv in A.items() if kv[1] == j]
maxalist.sort()
for i in maxalist:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
A = {}

for i in range(N):
    s = input()
    if s in A:
        A[s] += 1
    else:
        A[s] = 1

maxalist = [kv[0] for kv in A.items() if kv[1] == max(A.values())]
maxalist.sort()
for i in maxalist:
    print(i)


Fixed submission:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
A = {}

for i in range(N):
    s = input()
    if s in A:
        A[s] += 1
    else:
        A[s] = 1
        
j = max(A.values())

maxalist = [kv[0] for kv in A.items() if kv[1] == j]
maxalist.sort()
for i in maxalist:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    if tmpa-tmpb in a:
        a[tmpa-tmpb].append(tmpa+tmpb)
    else:
        a.append([tmpa-tmpb,tmpa+tmpb])

b = sorted(a, key=itemgetter(1))
tmp = b[0][1]
for i in range(1, N):
    if b[i][0] >= tmp:
        ans += 1
        tmp = b[i][1]
print(ans)

Fixed submission:
from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    a.append([tmpa+tmpb, tmpa-tmpb])

a.sort()
    
tmp = a[0][0]
for i in range(1, N):
    if a[i][1] >= tmp:
        ans += 1
        tmp = a[i][0]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    if tmpa-tmpb in a:
        a[tmpa-tmpb].append(tmpa+tmpb)
    else:
        a.append([tmpa-tmpb,tmpa+tmpb])

a.sort(key=itemgetter(1))
tmp = a[0][1]
for i in range(1, N):
    if a[i][0] >= tmp:
        ans += 1
        tmp = a[i][1]
print(ans)


Fixed submission:
from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    a.append([tmpa+tmpb, tmpa-tmpb])

a.sort()
    
tmp = a[0][0]
for i in range(1, N):
    if a[i][1] >= tmp:
        ans += 1
        tmp = a[i][0]
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque    
H,W = map(int, input().split())
maze = []
ans = 0
dist =[]
q = deque([])

for i in range(H):
    maze.append(input())

for i in range(H):
    for j in range(W):
        dist = [[-1]*W for i in range(H)] # 配列の初期化
        q.append([i,j]) #初期値挿入
        dist[i][j] = 0
        while(q):
            a,b = q.popleft()
            if a + 1 < H:
                if maze[a+1][b] == '.' and dist[a+1][b] == -1:
                    q.append([a+1, b])
                    dist[a+1][b] = dist[a][b] + 1
                    tmp = dist[a+1][b] 
            if a > 0:
                if maze[a-1][b] == '.' and dist[a-1][b] == -1:
                    q.append([a-1, b])
                    dist[a-1][b] = dist[a][b] + 1
                    tmp = dist[a-1][b]
            if b + 1 < W:
                if maze[a][b+1] == '.' and dist[a][b+1] == -1:
                    q.append([a, b+1])
                    dist[a][b+1] = dist[a][b] + 1
                    tmp = dist[a][b+1]
            if b > 0:
                if maze[a][b-1] == '.' and dist[a][b-1] == -1:
                    q.append([a, b-1])
                    dist[a][b-1] = dist[a][b] + 1
                    tmp = dist[a][b-1]
        ans = max(ans,tmp)


print(ans)

Fixed submission:
from collections import deque    
H,W = map(int, input().split())
maze = []
ans = 0
dist =[]
q = deque([])
tmp = 0

for i in range(H):
    maze.append(input())

for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            continue
        dist = [[-1]*W for i in range(H)] # 配列の初期化
        q.append([i,j]) #初期値挿入
        dist[i][j] = 0
        while(q):
            a,b = q.popleft()
            if a + 1 < H:
                if maze[a+1][b] == '.' and dist[a+1][b] == -1:
                    q.append([a+1, b])
                    dist[a+1][b] = dist[a][b] + 1
                    tmp = dist[a+1][b] 
            if a > 0:
                if maze[a-1][b] == '.' and dist[a-1][b] == -1:
                    q.append([a-1, b])
                    dist[a-1][b] = dist[a][b] + 1
                    tmp = dist[a-1][b]
            if b + 1 < W:
                if maze[a][b+1] == '.' and dist[a][b+1] == -1:
                    q.append([a, b+1])
                    dist[a][b+1] = dist[a][b] + 1
                    tmp = dist[a][b+1]
            if b > 0:
                if maze[a][b-1] == '.' and dist[a][b-1] == -1:
                    q.append([a, b-1])
                    dist[a][b-1] = dist[a][b] + 1
                    tmp = dist[a][b-1]
        ans = max(ans,tmp)


print(ans)
Buggy python submission (verdict: Runtime Error):
33
ABCCABCBABCCABACBCBBABCBCBCBCABCB

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(N-2):
    if S[i:i+3] == 'ABC':
       ans += 1 
print(ans)
Buggy python submission (verdict: Runtime Error):
ans = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1, }
s = input()
print(ans[s])D

Fixed submission:
ans = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1, }
s = input()
print(ans[s])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > 9 or b > 9:
    print(-1)
else:
    print(A*B)


Fixed submission:
a,b = map(int,input().split())
if a > 9 or b > 9:
    print(-1)
else:
    print(a*b)
Buggy python submission (verdict: Runtime Error):

from decimal import *
getcontext().prec = 28
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = Decimal(0)
outer = Decimal(0)
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

b = (Decimal(Decimal(inner) * Decimal(k)) + Decimal(Decimal(outer) * Decimal(Decimal(k) * Decimal(k-1)) / 2))
print(Decimal(Decimal(b)%Decimal(1000000007)))

Fixed submission:
m, d = map(int,input().split())
ans = 0

for i in range(1,m+1):
    for j in range(1, d + 1):
        if i == int(j/10)*int(j%10) and int(j%10) >= 2 and int(j/10) >= 2:
            ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = float(0)
outer = float(0)
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

b = (int(inner * int(k)) + int(outer * int(k) * int(k-1) / 2))
print(int(b%int(1000000007)))

Fixed submission:
m, d = map(int,input().split())
ans = 0

for i in range(1,m+1):
    for j in range(1, d + 1):
        if i == int(j/10)*int(j%10) and int(j%10) >= 2 and int(j/10) >= 2:
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 20
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = Decimal(0)
outer = Decimal(0)
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

print((Decimal(((inner) * (k)) + ((outer) * (Decimal(k) * (k-1)) / 2))%(1000000007)

Fixed submission:
from decimal import *
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = 0
outer = 0
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

print((Decimal(((inner) * (k)) + Decimal((outer) * Decimal((k) * (k-1)) / 2))%(1000000007)))

Buggy python submission (verdict: Time Limit Exceeded):

from decimal import *
getcontext().prec = 28
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = Decimal(0)
outer = Decimal(0)
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

b = (Decimal(Decimal(inner) * Decimal(k)) + Decimal(Decimal(outer) * Decimal(Decimal(k) * Decimal(k-1)) / 2))
print(Decimal(Decimal(b)%Decimal(1000000007)))

Fixed submission:
from decimal import *
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = 0
outer = 0
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

print((Decimal(((inner) * (k)) + Decimal((outer) * Decimal((k) * (k-1)) / 2))%(1000000007)))