Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
array = list(map(int, input().split()))
one_tento:int = 0
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
two_tento:int = 0
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1

result1:int = (one_tento * k) % (7 + 10**9)
result2:int = (two_tento * k * (k - 1) / 2) % (7 + 10**9)
result3:int = (result1 + result2) % (7 + 10**9)
print(int(result3))

Fixed submission:
n,k = map(int, input().split())
array = list(map(int, input().split()))

one_tento = 0
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
one_tento = int(one_tento)

two_tento = 0
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1
two_tento = int(two_tento)

result1 = (one_tento * k) % (7 + 10**9)
result2 = ((two_tento % (7 + 10**9)) * ((k * (k - 1) // 2) % (7 + 10**9))) % (7 + 10 **9)
result3 = (result1 + result2) % (7 + 10**9)
print(int(result3))

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
array = list(map(int, input().split()))
one_tento:int = 0
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
two_tento:int = 0
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1

result1:int = (one_tento * k) % (7 + 10**9)
result2:int = (two_tento * k * (k - 1) / 2) % (7 + 10**9)
result3:int = (result1 + result2)% (7 + 10**9)
print(int(result3))

Fixed submission:
n,k = map(int, input().split())
array = list(map(int, input().split()))

one_tento = 0
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
one_tento = int(one_tento)

two_tento = 0
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1
two_tento = int(two_tento)

result1 = (one_tento * k) % (7 + 10**9)
result2 = ((two_tento % (7 + 10**9)) * ((k * (k - 1) // 2) % (7 + 10**9))) % (7 + 10 **9)
result3 = (result1 + result2) % (7 + 10**9)
print(int(result3))

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
array = list(map(int, input().split()))

one_tento:int = 0 # Aの転倒数を求める
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
two_tento:int = 0 # ２つのAの転倒数を求める
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1

result1:int = (one_tento * k) % (7 + 10**9)
result2:int = (two_tento * k * (k - 1) / 2) % (7 + 10**9)
#print('本来のただしい答えは、{}'.format(int(result1 % (7 + 10 ** 9))))
#print('公式に当てはめた答えは{}'.format(int(result2 % (7 + 10 ** 9))))
result3:int = (result1 + result2)% (7 + 10**9)
print(int(result3))

Fixed submission:
n,k = map(int, input().split())
array = list(map(int, input().split()))

one_tento = 0
for i in range(n-1):
    for j in range(i+1,n):
        if array[i] > array[j]:
            one_tento += 1
one_tento = int(one_tento)

two_tento = 0
for i in range(n):
    for j in range(n):
        if array[i] > array[j]:
            two_tento += 1
two_tento = int(two_tento)

result1 = (one_tento * k) % (7 + 10**9)
result2 = ((two_tento % (7 + 10**9)) * ((k * (k - 1) // 2) % (7 + 10**9))) % (7 + 10 **9)
result3 = (result1 + result2) % (7 + 10**9)
print(int(result3))