Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc104/tasks/abc104_c

d, g = map(int, input().split())

for i in range(d):
  pc.append(list(map(int,input().split())))

ans = float("inf")

#各配点について解くか解かないかを決め、その上で G 点に満たなければ、まだ解いてない配点のうち一番高い配点のものを足りない分解く

for i in range(2**d):
    count = 0 #解く問題数
    sum = 0
    nokori = set(range(1, d + 1)) #点数の列

    for j in range(d):
        if (i>>j)&1:
            sum += pc[j][0] * (j + 1) * 100 + pc[j][1] #(j+1)*100点+bounus
            count += pc[j][0]
            nokori.discard(j + 1) #(j+1)*100点を処理したので削除

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        # 解く問題が問題数を超えないように注意
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        #数が小さい方を残す
        ans = min(ans, count)

print(ans)

Fixed submission:
#https://atcoder.jp/contests/abc104/tasks/abc104_c
 
d, g = map(int, input().split())
pc = []
 
for i in range(d):
  pc.append(list(map(int,input().split())))
 
ans = float("inf")
 
#各配点について解くか解かないかを決め、その上で G 点に満たなければ、まだ解いてない配点のうち一番高い配点のものを足りない分解く
 
for i in range(2**d):
    count = 0 #解く問題数
    sum = 0
    nokori = set(range(1, d + 1)) #点数の列
 
    for j in range(d):
        if (i>>j)&1:
            sum += pc[j][0] * (j + 1) * 100 + pc[j][1] #(j+1)*100点+bounus
            count += pc[j][0]
            nokori.discard(j + 1) #(j+1)*100点を処理したので削除
 
    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        # 解く問題が問題数を超えないように注意
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100
 
    if sum >= g:
        #数が小さい方を残す
        ans = min(ans, count)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().split())

path = [[False] * n for i in range(n)]

for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
  
ans = 0

#頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n),n):
  #頂点1が始点
  if i[0] == 0:
    #生成した順列の中をさらにループ
    for j in range(n):
      # n-1まで続いたら条件を満たすパスが存在する
      if j == n-1:
        ans += 1
        break
      #i[j]からi[j+1]に行くパスがなければ終了
      if not path[i[j][j+1]]:
        break
        
print(ans)

Fixed submission:
import itertools
 
n,m = map(int,input().split())
 
path = [[False] * n for i in range(n)]
 
for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
  
ans = 0
 
#頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n),n):
  #頂点1が始点
  if i[0] == 0:
    #生成した順列の中をさらにループ
    for j in range(n):
      # n-1まで続いたら条件を満たすパスが存在する
      if j == n-1:
        ans += 1
        break
      #i[j]からi[j+1]に行くパスがなければ終了
      if not path[i[j]][i[j+1]]:
        break
        
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations, permutations

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n)]


def mean_dis(data):
    comb = permutations(data, n)
    sum = 0
    count = 0
    for c in comb:
        count += 1
        for i in range(1, len(c)):
            _c = np.array([c[i-1], c[i]])
            euclid = np.sqrt(np.sum((_c[0]-_c[1]) ** 2))
            sum += euclid
    return sum/count


print(mean_dis(ls))

Fixed submission:
import numpy as np
from itertools import combinations, permutations

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n)]


def mean_dis(data):
    comb = permutations(data, n)
    sum = 0
    count = 0
    for c in comb:
        count += 1
        for i in range(1, len(c)):
            _c = np.array([c[i-1], c[i]])
            euclid = np.sqrt(np.sum((_c[0]-_c[1]) ** 2))
            sum += euclid
    return sum/count


def mean_dis2(data, n):
    comb = combinations(data, 2)
    all_dis = 0
    for c in comb:
        _c = np.array([c[0], c[1]])
        euclid = np.sqrt(np.sum((_c[0] - _c[1]) ** 2))
        all_dis += euclid

    return (all_dis*2)/n

print(mean_dis2(ls, n))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import combinations, permutations

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n)]


def mean_dis(data):
    comb = permutations(data, n)
    sum = 0
    count = 0
    for c in comb:
        count += 1
        for i in range(1, len(c)):
            _c = np.array([c[i-1], c[i]])
            euclid = np.sqrt(np.sum((_c[0]-_c[1]) ** 2))
            sum += euclid
    return sum/count


print(mean_dis(ls))

Fixed submission:
import numpy as np
from itertools import combinations, permutations

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n)]


def mean_dis(data):
    comb = permutations(data, n)
    sum = 0
    count = 0
    for c in comb:
        count += 1
        for i in range(1, len(c)):
            _c = np.array([c[i-1], c[i]])
            euclid = np.sqrt(np.sum((_c[0]-_c[1]) ** 2))
            sum += euclid
    return sum/count


def mean_dis2(data, n):
    comb = combinations(data, 2)
    all_dis = 0
    for c in comb:
        _c = np.array([c[0], c[1]])
        euclid = np.sqrt(np.sum((_c[0] - _c[1]) ** 2))
        all_dis += euclid

    return (all_dis*2)/n

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

from itertools import combinations

combi = list(combinations(ls, 2))

s = 0
for a, b in combi:
    s += (a * b)

print(s

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

from itertools import combinations

combi = list(combinations(ls, 2))

s = 0
for a, b in combi:
    s += (a * b)

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
points = [k] * n

mi = lambda x: x - 1

for _ in range(q):
    win = int(input())
    #points = [p-1 for p in points]
    points = list(map(mi, points))
    points[win-1] += 1

for i in points:
    if i >= 1:
        print('Yes')
    else:
        print('No')


Fixed submission:
n, k, q = map(int, input().split())
points = [k] * n


for _ in range(q):
    win = int(input())
    points[win-1] += 1

points = [p-q for p in points]
for i in points:
    if i >= 1:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
points = [k] * n


for _ in range(q):
    win = int(input())
    points = [p-1 for p in points]
    points[win-1] += 1

for i in points:
    if i >= 1:
        print('Yes')
    else:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
points = [k] * n


for _ in range(q):
    win = int(input())
    points[win-1] += 1

points = [p-q for p in points]
for i in points:
    if i >= 1:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
points = [k] * n


for _ in range(q):
    win = int(input())
    points = [p-1 for p in points]
    points[win-1] += 1

winner_point = max(points)
winners = [i for i in range(n) if points[i] == winner_point]
for i in range(n):
    if i in winners or points[i] >= 1:
        print('Yes')
    else:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
points = [k] * n


for _ in range(q):
    win = int(input())
    points[win-1] += 1

points = [p-q for p in points]
for i in points:
    if i >= 1:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    a = [int(input()) for _ in range(int(input()))]
    st = sorted(a)
    count = len(st)
    for i in a:
        index = st.index(i)
        if index == (count - 1):
            print(st[-2])
        else:
            print(st[-1])


resolve()

Fixed submission:
def resolve():
    a = [int(input()) for _ in range(int(input()))]
    st = sorted(a)
    first = st[-1]
    second = st[-2]
    for i in a:
        if i == first:
            print(second)
        else:
            print(first)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    a = [int(input()) for _ in range(int(input()))]
    for i, v in enumerate(a):
        _a = a.copy()
        del _a[i]
        print(max(_a))


resolve()

Fixed submission:
def resolve():
    a = [int(input()) for _ in range(int(input()))]
    st = sorted(a)
    first = st[-1]
    second = st[-2]
    for i in a:
        if i == first:
            print(second)
        else:
            print(first)


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, m = map(int, input().split())
    lst = [list(map(int, input().split())) for _ in range(m)]

    ans = set(range(lst[0][0], lst[0][1] + 1))
    for l in lst[1:]:
        ans = ans.intersection(set(range(l[0], l[1] + 1)))

    print(len(ans))


resolve()


Fixed submission:
def resolve():
    n, m = map(int, input().split())
    lst = [list(map(int, input().split())) for _ in range(m)]

    prev = lst[0]
    for new in lst[1:]:
        prev = [max(prev[0], new[0]), min(prev[1], new[1])]

    print(len(range(prev[0], prev[1]+1)))


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
i_list = [a + i + 1 for i, a in enumerate(A)]

ans = 0
for j in range(N):
    ans += i_list[:j+1].count(j+1-A[j])
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#i_list = [a + i + 1 for i, a in enumerate(A)]

ans = 0
mp = {}
for i in range(N):
    i_kou = i + 1 + A[i]
    if i_kou in mp:
        mp[i_kou] += 1
    else:
        mp[i_kou] = 1
    j_kou = i + 1 - A[i]
    if j_kou in mp:
        ans += mp[j_kou]
print(ans)

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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0

    L = []
    R = []
    for i, a in enumerate(A):
        L.append(A[i] + (i+1))
        R.append((i+1)-A[i])

    l_min = min(min(L), min(R))
    l_max = max(max(L), max(R))

    for x in range(l_min, l_max + 1):
        ans += (L.count(x) * R.count(x))

    print(ans)
    return 0

if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#i_list = [a + i + 1 for i, a in enumerate(A)]

ans = 0
mp = {}
for i in range(N):
    i_kou = i + 1 + A[i]
    if i_kou in mp:
        mp[i_kou] += 1
    else:
        mp[i_kou] = 1
    j_kou = i + 1 - A[i]
    if j_kou in mp:
        ans += mp[j_kou]
print(ans)
Buggy python submission (verdict: Runtime Error):


def floor(t):
    return int(t)


def fs(A, B, x):
    return floor(A*x/B) - (A * floor(x/B))

def main():
    A, B, N = map(int, input().split())

    ans = 0

    low = 1
    if N % 2 == 0:
        high = N
    else:
        high = N + 1

    while abs(low - high) != 1:
        mid = (high + low) // 2
        tmp = fs(A, B, mid)
        if tmp > ans:
            ans = tmp
            low = mid
        else:
            high = mid

    print(tmp)


    return 0

if __name__ == '__main__':
    main()

Fixed submission:
import math
def fs(A, B, x):
    return math.floor(A*x/B) - A * math.floor(x/B)


def main():
    A, B, N = map(int, input().split())

    print(fs(A, B, min(N, B-1)))
    return 0

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math

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

    Cou = collections.Counter(A)
    ans = 0

    oo = 0
    for c in Cou.values():
        oo += c * (c-1) // 2
    #print(Cou)
    for k in range(1, N+1):
        tmp = Cou.copy()
        c = tmp[A[k-1]] - 1

        print(oo - c)



    return 0


if __name__ == '__main__':
    main()

Fixed submission:
import collections
import math

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

    Cou = collections.Counter(A)
    ans = 0

    oo = 0
    for c in Cou.values():
        oo += c * (c-1) // 2
    #print(Cou)
    for k in range(1, N+1):
        c = Cou[A[k-1]] - 1
        print(oo - c)
    return 0


if __name__ == '__main__':
    main()

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

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

    Cou = collections.Counter(A)
    ans = 0
    for k in range(1, N+1):
        tmp = Cou.copy()
        tmp[A[k-1]] -= 1
        ans = 0
        for c in tmp.values():
            ans += c * (c-1) // 2
        print(ans)


    return 0


if __name__ == '__main__':
    main()

Fixed submission:
import collections
import math

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

    Cou = collections.Counter(A)
    ans = 0

    oo = 0
    for c in Cou.values():
        oo += c * (c-1) // 2
    #print(Cou)
    for k in range(1, N+1):
        c = Cou[A[k-1]] - 1
        print(oo - c)
    return 0


if __name__ == '__main__':
    main()

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

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

    Cou = collections.Counter(A)

    C_d = {}

    '''
    for k, c in Cou.items():
        if c > 1:
            C_d[k] = comb(c, 2)
        else:
            C_d[k] = 0
    print(C_d)
    '''
    ans = 0
    for k in range(1, N+1):
        tmp = Cou.copy()
        tmp[A[k-1]] -= 1
        ans = 0
        #print(tmp)
        for c in tmp.values():
            if c > 1:
                ans += comb(c, 2)

        print(ans)
        #tmp[A[k-1]] = max(0, tmp[A[k-1]]-2)
        #print(sum(tmp.values()))


    return 0


if __name__ == '__main__':
    main()

Fixed submission:
import collections
import math

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

    Cou = collections.Counter(A)
    ans = 0

    oo = 0
    for c in Cou.values():
        oo += c * (c-1) // 2
    #print(Cou)
    for k in range(1, N+1):
        c = Cou[A[k-1]] - 1
        print(oo - c)
    return 0


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    N, A, B = map(int, input().split())

    ans = 0
    a = 0
    b = 0
    for _ in range(N + 1):
        if (a < A) and (b == 0):
            ans += 1
            a += 1
        elif (a == A) and (b == 0):
            a = 0
            b += 1
        elif b < B:
            b += 1
        elif b == B:
            b = 0
    print(ans)
    return 0
if __name__ == '__main__':
    main()

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

def main():
    mod = (10 ** 9) + 7
    n, a, b = map(int, input().split())

    ans = 0

    if n % 2 == 0:
        for i in range(0, (n//2)):
            tmp = comb(n, i, mod)
            if (a != i) and (b != i):
                ans += tmp
            if (a != (n - i)) and (b != (n - i)):
                ans += tmp
        ans -= 1
        if (a != (n//2)) and (b != (n//2)):
            ans += comb(n, n//2, mod)
    else:
        for i in range(0, (n//2)+1):
            tmp = comb(n, i, mod)
            if (a != i) and (b != i):
                ans += tmp
            if (a != (n - i)) and (b != (n - i)):
                ans += tmp
        ans -= 1

    print(ans)
    return 0



if __name__ == '__main__':
    main()

Fixed submission:
import math
def main():
    m = (10 ** 9) + 7
    n, a, b = map(int, input().split())

    a_k = math.factorial(a)
    b_k = math.factorial(b)

    # フェルマーの小定理
    a_k = pow(a_k, m - 2, m)
    b_k = pow(b_k, m - 2, m)

    n_a = 1
    for i in range(n-a+1, n+1):
        n_a = (n_a * i) % m

    n_b = 1
    for i in range(n-b+1, n+1):
        n_b = (n_b * i) % m

    n_C_a = a_k * n_a
    n_C_b = b_k * n_b

    n_C_a = n_C_a % m
    n_C_b = n_C_b % m

    p = pow(2, n, m)

    print((p - n_C_a - n_C_b - 1)%m)
    return 0


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    N = int(input())
    dict = {}

    for _ in range(N):
        word = input()
        if word in dict:
            dict[word] += 1
        else:
            dict[word] = 0

    max_k_list = [kv[0] for kv in dict.items() if kv[1] == max(dict.values())]
    max_k_list = sorted(max_k_list)
    for m in max_k_list:
        print(m)
    return 0


if __name__ == '__main__':
    main()

Fixed submission:

def main():
    N = int(input())
    dict = {}

    for _ in range(N):
        word = input()
        if word in dict:
            dict[word] += 1
        else:
            dict[word] = 0

    m = max(dict.values())
    dict = sorted(dict.items(), key=lambda x: x[0])

    for d in dict:
        if d[1] == m:
            print(d[0])
    return 0


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
import math

def main():
    N = int(input())

    coordinate = np.array([[]])
    for _ in range(N):
        x, y = map(int, input().split())
        coordinate = np.append(coordinate, [x, y])
    coordinate = coordinate.reshape((N, 2))
    #print(coordinate)

    sum = 0

    for i in itertools.permutations(coordinate):
        v_1 = i[0]
        for j in range(1, len(i)):
            v_2 = i[j]
            sum += np.linalg.norm(v_1 - v_2)
            v_1 = v_2

    print(sum/math.factorial(N))
    return 0
if __name__ == '__main__':
    main()

Fixed submission:
import itertools
import numpy as np
import math

def main():
    N = int(input())

    coordinate = []
    for _ in range(N):
        coordinate.append(tuple(map(int, input().split())))

    distance = [[None]*N for _ in range(N)]

    for i in range(N):
        x1, y1 = coordinate[i]
        for j in range(N):
            x2, y2 = coordinate[j]
            distance[i][j] = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

    C = [i for i in range(N)]

    sum = 0
    for c in itertools.permutations(C):
        c_1 = c[0]
        for j in range(1, len(c)):
            c_2 = c[j]
            sum += distance[c_1][c_2]
            c_1 = c_2
    print(sum/math.factorial(N))

    return 0
if __name__ == '__main__':
    main()

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

def main():
    N = int(input())

    coordinate = []
    for _ in range(N):
        x, y = map(int, input().split())
        coordinate.append((x, y))

    path = [i for i in range(N)]
    sum = 0

    for i in itertools.permutations(path):
        v_1 = np.array(coordinate[i[0]])
        for j in range(1, len(i)):
            v_2 = np.array(coordinate[i[j]])
            sum += np.linalg.norm(v_1 - v_2)
            #print(np.linalg.norm(v_1 - v_2))
            v_1 = v_2


    print(sum/math.factorial(N))
    return 0
if __name__ == '__main__':
    main()

Fixed submission:
import itertools
import numpy as np
import math

def main():
    N = int(input())

    coordinate = []
    for _ in range(N):
        coordinate.append(tuple(map(int, input().split())))

    distance = [[None]*N for _ in range(N)]

    for i in range(N):
        x1, y1 = coordinate[i]
        for j in range(N):
            x2, y2 = coordinate[j]
            distance[i][j] = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

    C = [i for i in range(N)]

    sum = 0
    for c in itertools.permutations(C):
        c_1 = c[0]
        for j in range(1, len(c)):
            c_2 = c[j]
            sum += distance[c_1][c_2]
            c_1 = c_2
    print(sum/math.factorial(N))

    return 0
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    ans = 0

    for i in range(1, N+1):
        if i != N:
            ans += i%(i+1)

    print(ans)

    return 0
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    ans = (N-1)*N//2

    print(ans)

    return 0
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    ans = 0
    data = [i for i in range(1, N+1)]
    data_c = data.copy()
    tmp = data_c.pop(0)
    data_c.append(tmp)

    for i in range(N):
        ans += data[i]%data_c[i]

    print(ans)

    return 0
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    ans = (N-1)*N//2

    print(ans)

    return 0
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

l, r = map(int, input().split())
lis = [i for i in range(l, r+1)]

for i in range(M-1):
    l, r = map(int, input().split())
    if r > max(lis):
        r = max(lis)
    if l < min(lis):
        l = min(lis)
    tmp_lis = [i for i in range(l, r+1)]
    lis = set(lis) & set(tmp_lis)

lis = [i for i in lis if i <= N]
print(len(lis))


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

min, max = map(int, input().split())

for i in range(M-1):
    l, r = map(int, input().split())
    if min < l:
        min = l
    if max > r:
        max = r



lis = [i for i in range(min, max+1)]
print(len(lis))

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

l, r = map(int, input().split())
lis = [i for i in range(l, r+1)]

for i in range(M-1):
    l, r = map(int, input().split())
    tmp_lis = [i for i in range(l, r+1)]
    lis = set(lis) & set(tmp_lis)

lis = [i for i in lis if i <= N]
print(len(lis))


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

min, max = map(int, input().split())

for i in range(M-1):
    l, r = map(int, input().split())
    if min < l:
        min = l
    if max > r:
        max = r



lis = [i for i in range(min, max+1)]
print(len(lis))
Buggy python submission (verdict: Runtime Error):
N = int(intput())
H = list(map(int, input().split()))

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):

num = input()
num = int(num)

#2の2乗から順番に見ていく
#入力を超えたらその時点の値をマックスとして保持
#更新していく
max = 0
if num < 4:
    print("1")
else:
    for i in range(2,num):
        beki = 2
        cou = i**beki
        while i**beki <= num:
            beki += 1
        if max < i ** (beki-1):
            if beki > 2:
                max = i ** (beki-1)
    print(max)

Fixed submission:
import math
line = input()
line1 = line.split(" ")

#for i in line1:
  #  line1[i] = int(i)

adis = line1[0]
bdis = line1[1]
cdis = line1[2]
count = line1[3]

AB = abs(abs(int(bdis)) - abs(int(adis)))
BC = abs(abs(int(cdis)) - abs(int(bdis)))
#AB = abs(AB)


if int(AB) <= int(count) and int(BC) <= int(count):
    print("Yes")
elif abs(abs(int(cdis)) - abs(int(adis))) <= int(count):
    print("Yes")
else:
    print("No")