Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
size = 101
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
ans = None
for i in range(size):
  for j in range(size):
    # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
    max_h = None
    succ = True
    for x, y, h in points:
      tmp = abs(i-x) + abs(j-y) + h
      if max_h == None:
        max_h = tmp
        continue
      else:
        if max_h != tmp:
          succ = False
          break
    if succ:
      ans = (i, j, max_h)
      break
  if succ: break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Fixed submission:
def solve():
  size = 101
  n = int(input())
  points = []
  for _ in range(n):
    x, y, h = map(int, input().split())
    # h=0の点はスキップ ←勾配がないので高さ計算に使えない
    if h == 0: continue
    else: points.append((x, y, h))

  if len(points) == 1:
    # 必ず頂上が1つに定まる制約なので、測定点が1つしかなければそれが答え
    ans = points[0]
    return ans

  ans = (-1, -1, -1)
  for i in range(size):
    for j in range(size):
      # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
      max_h = None
      succ = True
      for x, y, h in points:
        tmp = abs(i-x) + abs(j-y) + h
        if max_h == None:
          max_h = tmp
          continue
        else:
          if max_h != tmp:
            succ = False
            break
      # 成り立っているなかでの最高点を更新していく
      if succ:
        if ans[2] < max_h:
          ans = (i, j, max_h)
  # すべて終了
  return ans

ans = solve()
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
size = 101
ans = None
for i in range(size):
  for j in range(size):
    # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
    max_h = 0
    succ = True
    for x, y, h in points:
      tmp = abs(i-x) + abs(j-y) + h
      if max_h == 0:
        max_h = tmp
        continue
      else:
        if max_h != tmp:
          succ = False
          break
    if succ:
      ans = (i, j, max_h)
      break
  if succ: break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Fixed submission:
def solve():
  size = 101
  n = int(input())
  points = []
  for _ in range(n):
    x, y, h = map(int, input().split())
    # h=0の点はスキップ ←勾配がないので高さ計算に使えない
    if h == 0: continue
    else: points.append((x, y, h))

  if len(points) == 1:
    # 必ず頂上が1つに定まる制約なので、測定点が1つしかなければそれが答え
    ans = points[0]
    return ans

  ans = (-1, -1, -1)
  for i in range(size):
    for j in range(size):
      # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
      max_h = None
      succ = True
      for x, y, h in points:
        tmp = abs(i-x) + abs(j-y) + h
        if max_h == None:
          max_h = tmp
          continue
        else:
          if max_h != tmp:
            succ = False
            break
      # 成り立っているなかでの最高点を更新していく
      if succ:
        if ans[2] < max_h:
          ans = (i, j, max_h)
  # すべて終了
  return ans

ans = solve()
print('{} {} {}'.format(ans[0], ans[1], ans[2]))
Buggy python submission (verdict: Runtime Error):
def abc106_d():
    n, m, q = map(int, input().split())
    table = [[0]*(n+1) for _ in range(n+1)]
    for _ in range(m):
        l, r = map(int, input().split())
        table[l][r] += 1
    query = [tuple(map(int, input().split())) for _ in range(q)]

    dp = [[-1]*(n+1) for _ in range(n+1)]

    def calc(l, r):
        nonlocal dp
        if l == 0 or r == 0: return 0
        if dp[l][r] != -1: return dp[l][r]
        res = calc(l-1, r) + calc(l, r-1) - calc(l-1, r-1) + table[l][r]
        dp[l][r] = res
        return res

    for p, q in query:
        ans = calc(q, q) - calc(q, p-1) - calc(p-1, q) + calc(p-1, p-1)
        print(ans)

if __name__ == '__main__':
    abc106_d()

Fixed submission:
import sys
sys.setrecursionlimit(10010010)

def abc106_d():
    n, m, q = map(int, input().split())
    table = [[0]*(n+1) for _ in range(n+1)]
    for _ in range(m):
        l, r = map(int, input().split())
        table[l][r] += 1
    query = [tuple(map(int, input().split())) for _ in range(q)]

    dp = [[-1]*(n+1) for _ in range(n+1)]

    def calc(l, r):
        nonlocal dp
        if l == 0 or r == 0: return 0
        if dp[l][r] != -1: return dp[l][r]
        res = calc(l-1, r) + calc(l, r-1) - calc(l-1, r-1) + table[l][r]
        dp[l][r] = res
        return res

    for p, q in query:
        ans = calc(q, q) - calc(q, p-1) - calc(p-1, q) + calc(p-1, p-1)
        print(ans)

if __name__ == '__main__':
    abc106_d()
Buggy python submission (verdict: Runtime Error):
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D - 1):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  #print('mask {}, score {}, num {}, rest_max {}'.format(format(mask, '010b'), score, num, rest_max))

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      #print('fault')
      continue
    num += need
    #print('追加 {}, 合計 {}'.format(need, num))
  else:
    #print('合計 {}'.format(num))

  ans = min(ans, num)

print(ans)

Fixed submission:
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      continue
    num += need

  ans = min(ans, num)

print(ans)
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc102/submissions/7991084
def abc102_c():
    N = int(readline())
    A = np.array(read().split(), dtype=np.int64)

    # b=0として変形する
    B = A - np.arange(1, N+1)
    # 中央値が0になるよう高さ調整する
    B.sort()
    x = B[N//2]
    # 絶対値の合計をとる
    ans = np.abs(B - x).sum()
    print(ans)

abc102_c()

Fixed submission:
# https://atcoder.jp/contests/abc102/submissions/7991084

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

def abc102_c():
    N = int(readline())
    A = np.array(read().split(), dtype=np.int64)

    # b=0として変形する
    B = A - np.arange(1, N+1)
    # 中央値が0になるよう高さ調整する
    B.sort()
    x = B[N//2]
    # 絶対値の合計をとる
    ans = np.abs(B - x).sum()
    print(ans)

abc102_c()
Buggy python submission (verdict: Time Limit Exceeded):
def abc097_c():
    S = str(input())
    K = int(input())
    pos = dict()
    subs = set()

    for i, c in enumerate(S):
        if pos.get(c):
            pos[c].append(i)
        else:
            pos[c] = [i]

    keys = sorted(list(pos.keys()))
    for c in keys:
        for st in pos[c]:
            for ed in range(st+1, len(S)+1):
                subs.add(S[st:ed])
        if len(subs) >= K:
            break

    ans = sorted(list(subs))[K-1]
    print(ans)

abc097_c()

Fixed submission:
def abc097_c():
    S = str(input())
    K = int(input())
    subs = set()

    for i in range(len(S)):
        for j in range(i+1, min(len(S)+1, i+K+1)):
            subs.add(S[i:j])

    subs_asc = sorted(list(subs))
    ans = subs_asc[K-1]
    print(ans)

abc097_c()

Buggy python submission (verdict: Time Limit Exceeded):
def abc097_c():
    S = str(input())
    K = int(input())
    subs = set()

    for n in range(1, len(S)+1):
        for i in range(0, len(S)-n+1):
            subs.add(S[i: i+n])

    subs_asc = sorted(list(subs))
    ans = subs_asc[K-1]
    print(ans)

abc097_c()

Fixed submission:
def abc097_c():
    S = str(input())
    K = int(input())
    subs = set()

    for i in range(len(S)):
        for j in range(i+1, min(len(S)+1, i+K+1)):
            subs.add(S[i:j])

    subs_asc = sorted(list(subs))
    ans = subs_asc[K-1]
    print(ans)

abc097_c()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
inp = iter(map(int, read().split()))

H, W, D = next(inp), next(inp), next(inp)
addr = [None] * (H*W+1)
for i in range(H):
    for j in range(W):
        v = next(inp)
        addr[v] = (i, j)

Q = next(inp)
for _ in range(Q):
    s, t = next(inp), next(inp)
    r, c = addr[s]
    cost = 0
    while s < t:
        s += D
        nr, nc = addr[s]
        cost += abs(nr - r) + abs(nc - c)
        r, c = nr, nc
    print(cost)

Fixed submission:
import sys
read = sys.stdin.buffer.read
inp = iter(map(int, read().split()))

H, W, D = next(inp), next(inp), next(inp)
addr = [None] * (H*W+1)
for i in range(H):
    for j in range(W):
        v = next(inp)
        addr[v] = (i, j)

cost = []
for m in range(D):
    arr = [0]
    for x in range((H*W-m)//D):
        if m + x * D == 0:
            arr.append(0)
            continue
        r, c = addr[m + x * D]
        nr, nc = addr[m + (x+1) *D]
        arr.append(arr[-1] + abs(nr - r) + abs(nc - c))
    cost.append(arr)

Q = next(inp)
for _ in range(Q):
    s, t = next(inp), next(inp)
    m = s % D
    ans = cost[m][t//D] - cost[m][s//D]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def abc084_d():

  def primes_list(n):
    # n以下の素数列挙
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
      primes.difference_update(range(i*2, n+1, i))
    return list(primes)

  # 素数リストを用意する
  primes = sorted(primes_list(10**5))

  # (n+1)//2 を素数判定するための準備
  is_prime = [False] * (10**5 + 10)
  for p in primes:
    is_prime[p] = True

  # 入力を受け取る
  q = int(input())
  query = [tuple(map(int, input().split())) for _ in range(q)]

  # クエリを処理する
  from bisect import bisect_left
  for l, r in query:
    # 2は素数だが奇数ではない、rは3以上でないと解が無い
    if r < 3:
      print(0)
      continue
    # 左側は3以下はカット
    l = max(l, 3)
    # 二分探索で範囲決める
    idx_start = bisect_left(primes, l)
    idx_stop = bisect_left(primes, r+1)
    ans = 0
    for i in range(idx_start, idx_stop):
      # (n+1)//2 が素数なら当たり
      if is_prime[(primes[i]+1) // 2]:
        ans += 1
    print(ans)

abc084_d()

Fixed submission:
def abc084_d():

  def primes_list(n):
    # n以下の素数列挙
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
      primes.difference_update(range(i*2, n+1, i))
    return list(primes)

  # 素数リストを用意する
  primes = sorted(primes_list(10**5))

  # (n+1)//2 を素数判定するための準備
  is_prime = [False] * (10**5 + 10)
  for p in primes:
    is_prime[p] = True

  # 2017に似た数の累積個数 (1-index)
  acc_like = [0]
  for p in primes:
    this_like = 1 if is_prime[(p+1) // 2] else 0
    acc_like.append(acc_like[-1] + this_like)

  # 入力を受け取る
  q = int(input())
  query = [tuple(map(int, input().split())) for _ in range(q)]

  # クエリを処理する
  from bisect import bisect_left
  for l, r in query:
    # 2は素数だが奇数ではない、rは3以上でないと解が無い
    if r < 3:
      print(0)
      continue
    # 左側は3以下はカット
    l = max(l, 3)
    # 二分探索で範囲決める
    idx_l = bisect_left(primes, l)
    idx_r = bisect_left(primes, r+1)
    # 累積和から個数求める
    ans = acc_like[idx_r] - acc_like[idx_l]
    print(ans)

abc084_d()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def abc077_c():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    A.sort()
    B.sort()
    C.sort()
    ans = 0

    # 二分探索で Ai < Bj < Ck となる個数を数える
    from bisect import bisect_left
    for i in range(N):
        # 真に大きいが条件なので Ai + 1 が入るポイントを探す
        jst = bisect_left(B, A[i] + 1)
        if jst == N: continue
        for j in range(jst, N):
            kst = bisect_left(C, B[j] + 1)
            ans += N - kst
    print(ans)

abc077_c()

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def abc077_c():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    A.sort()
    B.sort()
    C.sort()
    ans = 0

    from bisect import bisect_left

    # Bjに対するCの使える個数は、前処理で求めておく
    B2C = [0] * N
    # 真に大きいが条件なので Ai + 1 が入るポイントを探す
    for j in range(N):
        B2C[j] = N - bisect_left(C, B[j]+1)
    # 累積和
    accum = [0]
    for j in range(N):
        accum.append(accum[-1] + B2C[j])

    # Ai -> B は二分探索
    for i in range(N):
        jst = bisect_left(B, A[i]+1)
        if jst == N: continue
        # 前処理済みなので、Bj以降を使ったときにCが何個使えるかはすぐわかる
        ans += accum[N] - accum[jst]
    print(ans)

abc077_c()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

def abc077_c():
    N = int(readline())
    A = np.fromiter(readline().split(), dtype=np.int32)
    B = np.fromiter(readline().split(), dtype=np.int32)
    C = np.fromiter(readline().split(), dtype=np.int32)
    A.sort()
    B.sort()
    C.sort()
    ans = 0

    # 二分探索で Ai < Bj < Ck となる個数を数える
    for i in range(N):
        # 真に大きいが条件なので Ai + 1 が入るポイントを探す
        jst = np.searchsorted(B, A[i] + 1)
        if jst == N: continue
        for j in range(jst, N):
            kst = np.searchsorted(C, B[j] + 1)
            ans += N - kst
    print(ans)

abc077_c()

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def abc077_c():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    A.sort()
    B.sort()
    C.sort()
    ans = 0

    from bisect import bisect_left

    # Bjに対するCの使える個数は、前処理で求めておく
    B2C = [0] * N
    # 真に大きいが条件なので Ai + 1 が入るポイントを探す
    for j in range(N):
        B2C[j] = N - bisect_left(C, B[j]+1)
    # 累積和
    accum = [0]
    for j in range(N):
        accum.append(accum[-1] + B2C[j])

    # Ai -> B は二分探索
    for i in range(N):
        jst = bisect_left(B, A[i]+1)
        if jst == N: continue
        # 前処理済みなので、Bj以降を使ったときにCが何個使えるかはすぐわかる
        ans += accum[N] - accum[jst]
    print(ans)

abc077_c()
Buggy python submission (verdict: Runtime Error):
N = int(input())
b, c, d = 1, 1, 2
while True:
    x = N//4 + b
    y = c*N*x
    tmp = c * (4*x - N) - 1
    if y % tmp == 0:
        z = y // tmp
        break
    else:
        b += 1
print(*[x,y,z], sep=' ')

Fixed submission:
def tenka17_c():
    N = int(input())
    ans = None
    for x in range(1, 3501):
        for y in range(1, 3501):
            a = N * x * y
            b = 4*x*y - N*y - N*x
            if b < 1: continue
            if a % b == 0:
                ans = (x, y, a//b)
                break
        if ans: break
    print(*ans, sep=' ')

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

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*np.flip(grid[i]), sep=' ')

abc069_d()

Fixed submission:
import numpy as np

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*grid[i, ::-1], sep=' ')

abc069_d()
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t = print(s)
else: print(t)

Fixed submission:
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t: print(s)
else: print(t)
Buggy python submission (verdict: Runtime Error):
def codefes16qa_c():
    s = str(input())
    k = int(input())
    n = len(s)
    ans = ''
    for i in range(n):
        step2a = 1 + ord('z') - ord(s[i])
        if step2a <= k:
            ans += 'a'
            k -= step2a
        else:
            ans += s[i]
    if k > 0:
        last = ord(ans[-1]) + k
        ans = ans[:n-1] + chr(last)
    print(ans)

codefes16qa_c()

Fixed submission:
def codefes16qa_c():
    s = str(input())
    k = int(input())
    n = len(s)
    ans = ''
    for i in range(n):
        if s[i] == 'a':
            ans += s[i]
            continue
        step2a = 1 + ord('z') - ord(s[i])
        if step2a <= k:
            ans += 'a'
            k -= step2a
        else:
            ans += s[i]
    if k > 0:
        last = ord(ans[-1]) + (k % 26)
        ans = ans[:n-1] + chr(last)
    print(ans)

codefes16qa_c()
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=[int(i) for i in input().split()]

def ml(i,count,maxmove):
  if i==n-1:
    if count>maxmove: maxmove=count
    return maxmove
  if h[i]>=h[i+1]:
    count+=1
    return ml(i+1,count,maxmove)
  if count>maxmove:
    maxmove=count
  return ml(i+1,0,maxmove)
  
print(ml(0,0,0))

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]

count=0
ans=0

for i in range(n-1):
  if h[i]>=h[i+1]:
    count+=1
  else:
    count=0
  ans=max(count, ans)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
a=input()
s=input()

if a>=3200: print(s)
else: print("red")

Fixed submission:
a=int(input())
s=input()

if a>=3200: print(s)
else: print("red")
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=list(map(int, input().split()))

v.sort()
dif=[v[i+1]-v[i] for i in range(n-1)]

while len(v)>2:
  i=dif.index(min(dif))
  v[i]=(v[i]+v.pop(i+1))/2
  dif.pop(i)
  dif[i]=v[i+1]-v[i]
  if i!=0: dif[i-1]=v[i]-v[i-1]

print((v[0]+v[1])/2)  

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

v.sort()
ans=(v[0]+v[1])/2

for i in range(2,n):
  ans=(ans+v[i])/2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    for i in range(len(A)-1):
        b_sum = sum(A[i+1:]) % m
        ans = A[i] * b_sum % m
        s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    b_sum = sum(A)
    for i in range(len(A)-1):
        b_sum = b_sum -A[i]
        rest = b_sum % m
        ans = A[i] * rest % m
        s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    for i in range(len(A)-1):
        b_sum = sum(A[i+1:]) % m
        ans = A[i] * b_sum % m
        s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    b_sum = sum(A)
    for i in range(len(A)-1):
        b_sum = b_sum -A[i]
        rest = b_sum % m
        ans = A[i] * rest % m
        s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    for i in range(len(A)-1):
        for j in range(i+1,len(A)):
            aa = A[i]% m
            bb = A[j]% m
            ans = aa * bb
            s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    m = 10 ** 9 + 7
    s = 0
    b_sum = sum(A)
    for i in range(len(A)-1):
        b_sum = b_sum -A[i]
        rest = b_sum % m
        ans = A[i] * rest % m
        s += ans

    s = s % m
    print(s)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    h = [int(x) for x in stdin.readline().rstrip().split()]
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def main():
    h = int(input())
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def multiple(A,st,ed):
    res = 1
    for i in range(st,ed):
        res = res * A[i]

    return res

def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]

    H = [0] * (n-k)
    pre = multiple(A,0,k)
    H[0] = pre

    st = -1
    for i in range(k+1,n+1):
        st += 1
        cur = pre * A[i-1] / A[st]
        if cur > pre:
            print("Yes")
        else:
            print("No")
        pre = cur

if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def multiple(A,st,ed):
    res = 1
    for i in range(st,ed):
        res = res * A[i]

    return res

def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]

    st = -1
    for i in range(k+1,n+1):
        st += 1
        if A[i-1] > A[st]:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    n, m, k = [int(x) for x in stdin.readline().rstrip().split()]

    pileda = 0
    a = [0]
    # ai = 0
    for x in stdin.readline().rstrip().split():
        # ai += 1
        x = int(x)
        pileda += x
        a.append(pileda)
        if pileda > k:
            break
    
    piledb = 0
    b = [0]
    for x in stdin.readline().rstrip().split():
        x = int(x)
        piledb += x
        b.append(piledb)
        if piledb > k:
            break

    ans = 0
    for ai, time_a in enumerate(a):
        for bi, time_b in enumerate(b):
            if time_a + time_b > k:
                break
            if time_a + time_b <= k and ai + bi > ans:
                ans = ai + bi
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    nn = n ** 2
    nnn = n ** 3
    ans = n + nn + nnn
    print(ans)
    

if __name__ == "__main__":
    main()