Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())

road = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    road[a - 1].append(b - 1)
    road[b - 1].append(a - 1)

for i in range(q):
    idx, v = map(int, input().split())
    cnt[idx - 1] += v

dist = [-1] * n
que = deque()
dist[0] = 0
que.append(0)

while(len(que) != 0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r] != -1:
            continue
        # print(r, v)
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)
print(*cnt)


Fixed submission:
from collections import deque
n, q = map(int, input().split())

road = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    road[a - 1].append(b - 1)
    road[b - 1].append(a - 1)

for i in range(q):
    idx, v = map(int, input().split())
    cnt[idx - 1] += v

dist = [-1] * n
que = deque()
dist[0] = 0
que.append(0)

while(len(que) != 0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r] != -1:
            continue
        # print(r, v)
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)
print(*cnt)

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

road = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    road[a - 1].append(b - 1)
    road[b - 1].append(a - 1)

for i in range(q):
    idx, v = map(int, input().split())
    cnt[idx - 1] += v

dist = [-1] * n
que = deque()
dist[0] = 0
que.append(0)

while(len(que) != 0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r] != -1:
            continue
        # print(r, v)
        dist[r] = dist[v] + 1
        print(cnt)
        cnt[r] += cnt[v]
        que.append(r)
print(*cnt)


Fixed submission:
from collections import deque
n, q = map(int, input().split())

road = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    road[a - 1].append(b - 1)
    road[b - 1].append(a - 1)

for i in range(q):
    idx, v = map(int, input().split())
    cnt[idx - 1] += v

dist = [-1] * n
que = deque()
dist[0] = 0
que.append(0)

while(len(que) != 0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r] != -1:
            continue
        # print(r, v)
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)
print(*cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for v in range(N)]

for i in range(N):
    L = A[:]
    A.pop(i)
    m = max(A)
    print(m)
    A = L[:]


Fixed submission:
N = int(input())
A = [int(input()) for v in range(N)]

L = A[:]
m1 = max(A)
m1i = A.index(m1)
A.pop(m1i)
m2 = max(A)
m2i = A.index(m2)
A.pop(m2i)

for i in range(N):
    if (L[i] == m1):
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Runtime Error):
from fractions import Fraction

N, K = map(int, input().split())


def saikoro(x):
    y = Fraction(1, N)
    kakuritu = 1
    while 1 <= x and x <= K - 1:
        # 表
        x *= 2
        kakuritu *= 0.5
        if (x <= K):
            continue
        elif (x >= K):
            return kakuritu * float(y)
            break


count = 0
for i in range(1, N + 1):
    count += saikoro(i)
print(count)


Fixed submission:
from fractions import Fraction

N, K = map(int, input().split())

y = Fraction(1, N)


count = 0
for i in range(1, N + 1):
    kakuritu = 1
    while 1 <= i and i <= K - 1:
        i *= 2
        kakuritu /= 2
        if (i <= K):
            continue
        elif (i >= K):
            break
    count += kakuritu
print("{:.12f}".format(count * float(y)))
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())

rm = n // r
gm = n // g
count = 0
for i in range(rm + 1):
    for j in range(gm + 1):
        if ((n - r * i - g * j) % b == 0 and (n - r * i - g * j) // b >= 0):
            count += 1

print(count)


Fixed submission:
r, g, b, n = map(int, input().split())

rm = n // r
gm = n // g
count = 0
for i in range(rm + 1):
    for j in range(gm + 1):
        if ((n - r * i - g * j) % b == 0 and (n - r * i - g * j) // b >= 0):
            count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
li = list(map(int,input().split()))

f_inf = float('inf')
dp = [f_inf]*(10**5+10)

# 初期値
dp[0] = 0
for i in range(1,n):
    for j in range(1,k+1):
        if (i-j>=0):
            dp[i] = min(dp[i],dp[i-j]+abs(li[i]-li[i-j]))
print(dp[n-1])

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

f_inf = float('inf')
dp = [f_inf]*(10**5+10)

# 初期値
dp[0] = 0
for i in range(1,n):
    for j in range(1,k+1):
        if (i-j>=0):
            dp[i] = min(dp[i],dp[i-j]+abs(li[i]-li[i-j]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int,input().split())
li = []
while True:
    try:
        li.append(list(map(int,input().split())))
    except:
        break

dp=[[0] * (w+1) for _ in range(n+1)]
for i in range(1, n+1):
    for j in range(1,w+1):
        if (j-li[i-1][0]>=0):
            # 品物がひとつ前で重さは同じ所の価値と品物がひとつ前で重さが加える価値を持し品物の重さ分引いたときの価値にひとつ前の品物の価値を加えたもの
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-li[i-1][0]]+li[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[n][w])

Fixed submission:
n, w = map(int,input().split())
li = []
while True:
    try:
        li.append(list(map(int,input().split())))
    except:
        break

dp=[[0] * (w+1) for _ in range(n+1)]
for i in range(1, n+1):
    for j in range(1,w+1):
        if (j-li[i-1][0]>=0):
            # 品物がひとつ前で重さは同じ所の価値と品物がひとつ前で重さが加える価値を持し品物の重さ分引いたときの価値にひとつ前の品物の価値を加えたもの
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-li[i-1][0]]+li[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

N, X = map(int, input().split())
L = list(map(int, input().split()))

# move1 = D
# move2 = -D


# D = 1のときは必ずゴールできる
ans = []
# 初期のXとそれ以外の街の差をDで割ったあまりが全て0なら訪れることができる
# つまりそれぞれの街の差を保存し、その最大公約数がDとなる
for i in range(N):
    dfe = abs(L[i] - X)
    ans.append(dfe)

ans = list(set(ans))

# reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]
# functoolsのreduceはある関数があり、それを前の計算結果と重なりを考慮しながら
# 関数に当てはめる、というアクションを繰り返す


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


# print(ans)
# print(reduce(lambda x, y: x + y, ans))
print(gcd_list(ans))

Fixed submission:
import fractions
from functools import reduce

N, X = map(int, input().split())
L = list(map(int, input().split()))

# move1 = D
# move2 = -D


# D = 1のときは必ずゴールできる
ans = []
# 初期のXとそれ以外の街の差をDで割ったあまりが全て0なら訪れることができる
# つまりそれぞれの街の差を保存し、その最大公約数がDとなる
for i in range(N):
    dfe = abs(L[i] - X)
    ans.append(dfe)

ans = list(set(ans))

# reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]
# functoolsのreduceはある関数があり、それを前の計算結果と重なりを考慮しながら
# 関数に当てはめる、というアクションを繰り返す


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


# print(ans)
# print(reduce(lambda x, y: x + y, ans))
print(gcd_list(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))


for i in range(N):
    price = 0
    now = 0
    cnt = 0
    while True:
        if (cnt == i):
            cnt += 1
            continue
        if (cnt == N):
            price += abs(now)
            break
        price += abs(A[cnt] - now)
        now = A[cnt]
        cnt += 1

    print(price)


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

all_price = 0
now = 0
for i in range(N + 1):
    if (i == N):
        all_price += abs(A[i - 1])
        break
    all_price += abs(A[i] - now)
    now = A[i]


for i in range(N):
    if (i == 0):
        print(all_price + abs(A[i + 1] - 0) -
              (abs(A[i] - 0) + abs(A[i + 1] - A[i])))

    elif (i == N - 1):
        print(all_price + abs(A[i - 1] - 0) -
              (abs(A[i] - A[i - 1]) + abs(abs(A[i] - 0))))

    else:
        print(all_price + abs(A[i - 1] - A[i + 1]) -
              (abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1])))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n, k = map(int, input().split())
A = list(map(int, input().split()))

now_cnt = len(list(set(A)))

if (now_cnt <= k):
    print(0)
    exit()

c = Counter(A)
c_sorted = sorted(c.items(), key=lambda x: x[1])
dec = now_cnt - k
cnt = 0
L = []

for (i, v) in c_sorted:
    L.append([i, v])

while True:
    if (dec != 0):
        L[0][1] -= 1
        L[-1][1] += 1
        cnt += 1
    else:
        print(cnt)
        exit()

    if (L[0][1] == 0):
        L.pop(0)
        dec -= 1

print(cnt)


Fixed submission:
from collections import Counter, deque

n, k = map(int, input().split())
A = list(map(int, input().split()))

now_cnt = len(list(set(A)))

if (now_cnt <= k):
    print(0)
    exit()

c = Counter(A)
c_sorted = sorted(c.items(), key=lambda x: x[1])
dec = now_cnt - k
cnt = 0
L = deque()

for (i, v) in c_sorted:
    L.append([i, v])

while True:
    if (dec != 0):
        L[0][1] -= 1
        L[-1][1] += 1
        cnt += 1
    else:
        print(cnt)
        exit()

    if (L[0][1] == 0):
        L.popleft()
        dec -= 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n, k = map(int, input().split())
A = list(map(int, input().split()))

now_cnt = len(list(set(A)))

if (now_cnt <= k):
    print(0)
    exit()

c = Counter(A)
c_sorted = sorted(c.items(), key=lambda x: x[1])
dec = now_cnt - k
cnt = 0
L = []

for (i, v) in c_sorted:
    L.append([i, v])

while True:
    if (dec != 0):
        L[0][1] -= 1
        L[-1][1] += 1
        cnt += 1
    else:
        print(cnt)
        exit()

    if (L[0][1] == 0):
        L.pop(0)
        dec -= 1

print(cnt)


Fixed submission:
from collections import Counter, deque

n, k = map(int, input().split())
A = list(map(int, input().split()))

now_cnt = len(list(set(A)))

if (now_cnt <= k):
    print(0)
    exit()

c = Counter(A)
c_sorted = sorted(c.items(), key=lambda x: x[1])
dec = now_cnt - k
cnt = 0
L = deque()

for (i, v) in c_sorted:
    L.append([i, v])

while True:
    if (dec != 0):
        L[0][1] -= 1
        L[-1][1] += 1
        cnt += 1
    else:
        print(cnt)
        exit()

    if (L[0][1] == 0):
        L.popleft()
        dec -= 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
i = int(input())
lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
a=lst[0]
b=lst[1]
c=lst[2]
d=lst[3]
sa=str(a)
sb=str(b)
sc=str(c)
sd=str(d)

if(a+b+c+d==7):
    print(sa+"+"+sb+"+"+sc+"+"+sd+"=7")
elif (a+b+c-d==7):
    print(sa+"+"+sb+"+"+sc+"-"+sd+"=7")
elif (a+b-c+d==7):
    print(sa+"+"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c+d==7):
    print(sa+"-"+sb+"+"+sc+"+"+sd+"=7")
elif(a-b-c+d==7):
    print(sa+"-"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c-d==7):
    print(sa+"-"+sb+"+"+sc+"-"+sd+"=7")
elif(a+b-c-d==7):
    print(sa+"+"+sb+"-"+sc+"-"+sd+"=7")
elif(a-b-c-d==7):
    print(sa+"-"+sb+"-"+sc+"-"+sd+"=7")


Fixed submission:
i = input()

a=int(i[0])
b=int(i[1])
c=int(i[2])
d=int(i[3])
sa=i[0]
sb=i[1]
sc=i[2]
sd=i[3]

if(a+b+c+d==7):
    print(sa+"+"+sb+"+"+sc+"+"+sd+"=7")
elif (a+b+c-d==7):
    print(sa+"+"+sb+"+"+sc+"-"+sd+"=7")
elif (a+b-c+d==7):
    print(sa+"+"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c+d==7):
    print(sa+"-"+sb+"+"+sc+"+"+sd+"=7")
elif(a-b-c+d==7):
    print(sa+"-"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c-d==7):
    print(sa+"-"+sb+"+"+sc+"-"+sd+"=7")
elif(a+b-c-d==7):
    print(sa+"+"+sb+"-"+sc+"-"+sd+"=7")
elif(a-b-c-d==7):
    print(sa+"-"+sb+"-"+sc+"-"+sd+"=7")

Buggy python submission (verdict: Runtime Error):
i = int(input())
lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
a=lst[0]
b=lst[1]
c=lst[2]
d=lst[3]
sa=str(a)
sb=str(b)
sc=str(c)
sd=str(d)

if(a+b+c+d==7):
    print(sa+"+"+sb+"+"+sc+"+"+sd+"=7")
elif (a+b+c-d==7):
    print(sa+"+"+sb+"+"+sc+"-"+sd+"=7")
elif (a+b-c+d==7):
    print(sa+"+"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c+d==7):
    print(sa+"-"+sb+"+"+sc+"+"+sd+"=7")
elif(a-b-c+d==7):
    print(sa+"-"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c-d==7):
    print(sa+"-"+sb+"+"+sc+"-"+sd+"=7")
elif(a+b-c-d==7):
    print(sa+"+"+sb+"-"+sc+"-"+sd+"=7")
elif(a-b-c-d==7):
    print(sa+"-"+sb+"-"+sc+"-"+sd+"=7")
else:
  print('none')

Fixed submission:
i = input()

a=int(i[0])
b=int(i[1])
c=int(i[2])
d=int(i[3])
sa=i[0]
sb=i[1]
sc=i[2]
sd=i[3]

if(a+b+c+d==7):
    print(sa+"+"+sb+"+"+sc+"+"+sd+"=7")
elif (a+b+c-d==7):
    print(sa+"+"+sb+"+"+sc+"-"+sd+"=7")
elif (a+b-c+d==7):
    print(sa+"+"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c+d==7):
    print(sa+"-"+sb+"+"+sc+"+"+sd+"=7")
elif(a-b-c+d==7):
    print(sa+"-"+sb+"-"+sc+"+"+sd+"=7")
elif(a-b+c-d==7):
    print(sa+"-"+sb+"+"+sc+"-"+sd+"=7")
elif(a+b-c-d==7):
    print(sa+"+"+sb+"-"+sc+"-"+sd+"=7")
elif(a-b-c-d==7):
    print(sa+"-"+sb+"-"+sc+"-"+sd+"=7")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

# 先にxを選んでおく！
ans = 0
m = max(L) + 1
for i in range(m):
    cm = L.count(i - 1)
    ce = L.count(i)
    cl = L.count(i + 1)
    ans = max(ans, cm + ce + cl)

print(ans)


Fixed submission:
from collections import Counter
N = int(input())
L = list(map(int, input().split()))
c = Counter(L)
# print(c)
# 先にxを選んでおく！
ans = 0
m = max(L) + 1
for i in range(m):
    ans = max(ans, c[i - 1] + c[i] + c[i + 1])

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
L = list(map(int, input().split()))

cnt = 0
larger = 1
smaller = -1

d = [0] * (n - 1)
if (L[0] > L[1]):
    d[0] = -1
elif (L[0] < L[1]):
    d[0] = 1

cnt = 1
for i in range(n):
    if (i == 0):
        continue
    elif (i == n - 1):
        break
    else:
        if (L[i] < L[i + 1] and d[i - 1] >= 0):
            d[i] = 1
        elif (L[i] > L[i + 1] and d[i - 1] <= 0):
            d[i] = -1
        elif (L[i] < L[i + 1] and d[i - 1] < 0):
            cnt += 1
        elif (L[i] > L[i + 1] and d[i - 1] > 0):
            cnt += 1
        elif (L[i] == L[i + 1]):
            continue

print(cnt)


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

if n == 1:
    print(1)
    exit()

d = [0] * (n - 1)
if (L[0] > L[1]):
    d[0] = -1
elif (L[0] < L[1]):
    d[0] = 1

for i in range(n):
    if (i == 0):
        continue
    elif (i == n - 1):
        break
    else:
        if (L[i] < L[i + 1]):
            d[i] = 1
        elif (L[i] > L[i + 1]):
            d[i] = -1

prev = 0
count = 0
for i in range(len(d)):
    if (i == 0):
        prev = d[i]
        continue
    if (prev == 1):
        if (d[i] == 1):
            continue
        elif (d[i] == 0):
            continue
        else:
            count += 1
            prev = 0
    elif (prev == -1):
        if (d[i] == -1):
            continue
        elif (d[i] == 0):
            continue
        else:
            count += 1
            prev = 0
    elif (prev == 0):
        if (d[i] == 1):
            prev = 1
        elif (d[i] == -1):
            prev = -1

print(count + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(map(int, input().split()))

count = N
for i in range(N - 1, -1, -1):
    if sum(A[0:i]) * 2 >= A[i]:
        continue

    else:
        if (i == 0):
            continue
        count -= len(A[0:i])
        break

print(count)


Fixed submission:
N = int(input())
A = sorted(map(int, input().split()))
sum_A = sum(A)
count = N
for i in range(N - 1, -1, -1):
    sum_A -= A[i]
    if (sum_A) * 2 >= A[i]:
        continue

    else:
        if (i == 0):
            continue
        count -= len(A[0:i])
        break

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

sunuke = 1

li = [i for i in range(1,n+1)]
for j in range(n):
    sunuke=sunuke*li[j]

print(sunuke%(10**9+7))

Fixed submission:

n = int(input())

sunuke = 1

for j in range(1,n+1):
    sunuke*=j
    sunuke%=(10**9+7)


print(sunuke)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

sunuke = 1

li = [i for i in range(1,n+1)]
for j in range(n):
    sunuke=sunuke*li[j]

print(sunuke%(10**9+7))

Fixed submission:

n = int(input())

sunuke = 1

for j in range(1,n+1):
    sunuke*=j
    sunuke%=(10**9+7)


print(sunuke)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
for _ in range(N):
    a = input()
    A.append(a)

B = []
for _ in range(M):
    b = input()
    B.append(b)

idx = [0, 0]
while True:
    if idx[0] == N - 1 and idx[1] == N:
        break
    if A[idx[0]][idx[1]] == B[0][0]:
        check = False
        for i in range(M):
            for j in range(M):
                if 0 <= idx[0] + i < N and 0 <= idx[1] + j < N:
                    if A[idx[0] + i][idx[1] + j] != B[i][j]:
                        check = True
                        break
                else:
                    check = True
                    break
            if check:
                break

        if not check:
            print('Yes')
            exit()
    if idx[1] < N - 1:
        idx[1] += 1
        continue
    else:
        idx[0] += 1
        idx[1] = 1
        continue

print('No')


Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]


for i in range(N - M + 1):
    for j in range(N - M + 1):
        check = True
        count = 0
        for k in range(M):
            if (A[i + k][j: j + M] == B[k]):
                # print(A[i + k][j:j + M], B[k])
                count += 1
                continue
            else:
                check = False
                break

        if (check and count == M):
            print('Yes')
            exit()

print('No')
Buggy python submission (verdict: Runtime Error):
import math
N, Ma, Mb = map(int, input().split())
cost = [[0] * 10 for _ in range(10)]
for _ in range(N):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    cost[a][b] = c

min_cost = 10 ** 9 + 7
for k in range(N):
    for i in range(N):
        for j in range(N):
            g = math.gcd(i + 1 + k + 1, k + 1 + j + 1)
            if (i + 1 + k + 1) // g == Ma and (k + 1 + j + \
                1) // g == Mb and cost[i][k] + cost[k][j] != 0:
                # print(cost[i][k] + cost[k][j])
                min_cost = min(min_cost, cost[i][k] + cost[k][j])


if min_cost == 10 ** 9 + 7:
    print(-1)
else:
    print(min_cost)


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

sum_a = 0
sum_b = 0
A = []
B = []
C = []
for _ in range(N):
    a, b, c = map(int, input().split())
    sum_a += a
    sum_b += b
    A.append(a)
    B.append(b)
    C.append(c)

inf = 10 ** 9 + 7
# 3次元dpを考える
dp = [[[inf] * (sum_b + 1) for _ in range(sum_a + 1)] for _ in range(N + 1)]

dp[0][0][0] = 0
for i in range(N):
    for sa in range(sum_a):
        for sb in range(sum_b):
            if sa - A[i] >= 0 and sb - B[i] >= 0:
                dp[i + 1][sa][sb] = min(dp[i][sa - A[i]]
                                        [sb - B[i]] + C[i], dp[i][sa][sb])
            else:
                dp[i + 1][sa][sb] = min(dp[i][sa][sb], dp[i + 1][sa][sb])

ans = inf
for i in range(1, sum_a + 1):
    for j in range(1, sum_b + 1):
        if Ma * j == Mb * i:
            ans = min(ans, dp[N][i][j])

print(ans if ans != inf else -1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())

li = [i for i in range(a,b+1)]

count =0 
for j in range(len(li)):
    if(li[j]%x==0):
        count+=1
print(count)


Fixed submission:
a,b,x = map(int,input().split())

print(b//x-((a-1)//x))
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0] * (N + 1) for _ in range(N + 1)]

max_num = max(A)
max_index = A.index(max_num)

idx = 0
dfe = 0
count = 0
while True:
    print(idx)
    if idx >= len(A) - 1:
        break
    max_num = max(A[idx:])
    max_index = A.index(max_num)

    min_num = min(A[idx:max_index + 1])
    if dfe == max_num - min_num:
        count += 1
    elif dfe < max_num - min_num:
        dfe = max_num - min_num
        count = 1

    idx = max_index + 1

print(count)


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

min_num = 10 ** 9 + 7
diff = 0
count = 0
for i in range(N):
    min_num = min(min_num, A[i])
    if diff == A[i] - min_num:
        count += 1
    elif A[i] - min_num > diff:
        count = 1
        diff = A[i] - min_num
    else:
        continue

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, input().split())
A = list(map(int, input().split()))

max_num = 0
count = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if max_num < A[j] - A[i]:
            max_num = A[j] - A[i]
            count = 1
            continue

        if max_num == A[j] - A[i]:
            count += 1

print(count)


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

min_num = 10 ** 9 + 7
diff = 0
count = 0
for i in range(N):
    min_num = min(min_num, A[i])
    if diff == A[i] - min_num:
        count += 1
    elif A[i] - min_num > diff:
        count = 1
        diff = A[i] - min_num
    else:
        continue

print(count)