Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
length = int(input())
targ = []
cnt = 0
mcnt = 1
for l in range(length):
    targ.append(int(input()))
m = 1
mlist = [1]
while length / 9 >= m:
    m = 3 * m + 1
    mcnt += 1
    mlist.append(m)
print(mcnt)
print(' '.join([str(n) for n in reversed(mlist)]))
while m >= 1:
    divided = length // m
    for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
    m //= 3
print(cnt)
for l in range(length):
    print(targ[l])

Fixed submission:
import math
length = int(input())
targ = []
cnt = 0
mcnt = 1
for l in range(length):
    targ.append(int(input()))
m = 1
mlist = [1]
while True:
    m = math.ceil(2.25 * m + 1)
    if length <= m:
        break
    mcnt += 1
    mlist.append(m)
print(mcnt)
print(' '.join([str(n) for n in reversed(mlist)]))
mlength = mcnt - 1
while mlength >= 0:
    m = mlist[mlength]
    divided = length // m
    for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
    mlength -= 1
print(cnt)
for l in range(length):
    print(targ[l])
Buggy python submission (verdict: Runtime Error):
a_len = int(input())
a_ar = sorted([int(n) for n in input().split(" ")])
b_len = int(input())
b_ar = [int(n) for n in input().split(" ")]
max_b = max(b_ar)
dp = [0 for n in range(max_b + 1)]
for a in a_ar:
    new_dp = dp[:]
    new_dp[a] = 1
    for i,d in enumerate(dp):
        if d and i + a <= max_b + 1:
            new_dp[i + a] = 1
    dp = new_dp
for b in b_ar:
    if dp[b]:
        print("yes")
    else:
        print("no")

Fixed submission:
a_len = int(input())
a_ar = sorted([int(n) for n in input().split(" ")])
b_len = int(input())
b_ar = [int(n) for n in input().split(" ")]
max_b = max(b_ar)
dp = [0 for n in range(max_b + 1)]
for a in a_ar:
    new_dp = dp[:]
    new_dp[a] = 1
    for i,d in enumerate(dp):
        if d and i + a <= max_b:
            new_dp[i + a] = 1
    dp = new_dp
for b in b_ar:
    if dp[b]:
        print("yes")
    else:
        print("no")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
def preorder(here, conn, chain):
    if here == -1:
        return
    chain.append(here)
    if conn[here]:
        preorder(conn[here][0], conn, chain)
        preorder(conn[here][1], conn, chain)

def inorder(here, conn, chain):
    if here == -1:
        return
    if conn[here]:
        inorder(conn[here][0], conn, chain)
        chain.append(here)
        inorder(conn[here][1], conn, chain)

def postorder(here, conn, chain):
    if here == -1:
        return
    if conn[here]:
        postorder(conn[here][0], conn, chain)
        postorder(conn[here][1], conn, chain)
    chain.append(here)

query = int(input())
connect = defaultdict(list)
in_v = [0 for n in range(query + 1)]
for _ in range(query):
    here, left, right = (int(n) for n in input().split(" "))
    connect[here] = [left, right]
    in_v[left] += 1
    in_v[right] += 1
for i in range(query):
    if not in_v[i]:
        root = i
        break
preo = []
ino = []
posto = []
preorder(root, connect, preo)
inorder(root, connect, ino)
postorder(root, connect, posto)

print("Preorder")
print(" " + *preo)
print("Inorder")
print(" " + *ino)
print("Postorder")
print(" " + *posto)

Fixed submission:
from collections import defaultdict
def preorder(here, conn, chain):
    if here == -1:
        return
    chain.append(here)
    if conn[here]:
        preorder(conn[here][0], conn, chain)
        preorder(conn[here][1], conn, chain)

def inorder(here, conn, chain):
    if here == -1:
        return
    if conn[here]:
        inorder(conn[here][0], conn, chain)
        chain.append(here)
        inorder(conn[here][1], conn, chain)

def postorder(here, conn, chain):
    if here == -1:
        return
    if conn[here]:
        postorder(conn[here][0], conn, chain)
        postorder(conn[here][1], conn, chain)
    chain.append(here)

query = int(input())
connect = defaultdict(list)
in_v = [0 for n in range(query + 1)]
for _ in range(query):
    here, left, right = (int(n) for n in input().split(" "))
    connect[here] = [left, right]
    in_v[left] += 1
    in_v[right] += 1
for i in range(query):
    if not in_v[i]:
        root = i
        break
preo = []
ino = []
posto = []
preorder(root, connect, preo)
inorder(root, connect, ino)
postorder(root, connect, posto)

print("Preorder")
print("", end = " ")
print(*preo)
print("Inorder")
print("", end = " ")
print(*ino)
print("Postorder")
print("", end = " ")
print(*posto)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
queue = []
targ = input()
while targ != "end":
    targ = targ.split(' ')
    if targ[0] == "insert":
        queue.insert(bisect.bisect_left(queue,int(targ[1])),int(targ[1]))
    else:
        temp = queue.pop()
        print(temp)
    targ = input()

Fixed submission:
import heapq
queue = []
targ = input()
while targ != "end":
    if targ[0] == "i":
        heapq.heappush(queue,-int(targ.split(' ')[1]))
    else:
        print(-heapq.heappop(queue))
    targ = input()
Buggy python submission (verdict: Time Limit Exceeded):
def binary(first,last,find):
    mid = first + (last - first) // 2
    if first == last:
        if Sset[first] == find:
            return True
        else:
            return False
    else:
        return bool(binary(first,mid,find) + binary(mid + 1,last,find))

Snum = int(input())
global Sset
Sset = [int(n) for n in input().split(' ')]
Tnum = int(input())
Tset = [int(n) for n in input().split(' ')]
ans = 0
for t in range(Tnum):
    ans += binary(0,Snum-1,Tset[t])
print(ans)

Fixed submission:
def binary(first,last,find):
    mid = first + (last - first) // 2
    if first == last:
        if Sset[first] == find:
            return True
        else:
            return False
    else:
        if find <= Sset[mid]:
            return binary(first,mid,find)
        else:
            return binary(mid + 1,last,find)

Snum = int(input())
global Sset
Sset = [int(n) for n in input().split(' ')]
Sset.sort()
Tnum = int(input())
Tset = [int(n) for n in input().split(' ')]
ans = 0
for t in range(Tnum):
    ans += binary(0,Snum-1,Tset[t])
print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if a<b:
    print('a < b')
elif a>b:
    print('a > b')
elif a==b:
    printf('a == b')


Fixed submission:
st = input()
stin = st.split()
a = int(stin[0])
b = int(stin[1])
if a<b:
    print('a < b')
elif a>b:
    print('a > b')
elif a==b:
    print('a == b')

Buggy python submission (verdict: Runtime Error):
st = input()
stin = st.split()
a = int(stin[0])
b = int(stin[1])
if a<b:
    print('a < b')
elif a>b:
    print('a > b')
elif a==b:
    printf('a == b')



Fixed submission:
st = input()
stin = st.split()
a = int(stin[0])
b = int(stin[1])
if a<b:
    print('a < b')
elif a>b:
    print('a > b')
elif a==b:
    print('a == b')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)

    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)


class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c

        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)

        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) ).real


eps = 0.0001
while True:
    line = input()
    if line == "":
        break
    line = [float(x) for x in line.split()]
    p1 = Point(line[0], line[1])
    p2 = Point(line[2], line[3])
    p3 = Point(line[4], line[5])
    P  = Point(line[6], line[7])
    t1 = Triangle(p1, p2, P)
    t2 = Triangle(p2, p3, P)
    t3 = Triangle(p3, p1, P)
    if (math.degrees(t1.angleC + t2.angleC + t3.angleC) <= 360+eps) and (math.degrees(t1.angleC + t2.angleC + t3.angleC) >= 360-eps):
        print("YES")
    else:
        print("NO")

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import cmath
import math

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)

    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)


class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c

        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)

        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) ).real


eps = 0.0001
for line in sys.stdin:
    line = [float(x) for x in line.split()]
    p1 = Point(line[0], line[1])
    p2 = Point(line[2], line[3])
    p3 = Point(line[4], line[5])
    P  = Point(line[6], line[7])
    t1 = Triangle(p1, p2, P)
    t2 = Triangle(p2, p3, P)
    t3 = Triangle(p3, p1, P)
    if (math.degrees(t1.angleC + t2.angleC + t3.angleC) <= 360+eps) and (math.degrees(t1.angleC + t2.angleC + t3.angleC) >= 360-eps):
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
def function(a):
    for j in range(2,a):
        if a%j==0:
            return 1
    return 0
n=int(input())
s=0
for i in range(n):
    a=int(input())
    s+=function(a)
print(n-s)


Fixed submission:
def function(a):
    for j in range(2,a):
        if a%j==0:
            return 1
        if j**2>a:
            break
    return 0
n=int(input())
s=0
for i in range(n):
    a=int(input())
    s+=function(a)
print(n-s)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
s=0
for i in range(q):
    if T[i] in S:
        s+=1
print(s)


Fixed submission:
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
s=0
S.append(10**10)
for i in range(q):
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if S[m]>T[i]:
            r=m
        else:
            l=m
    if S[l]==T[i]:
        s+=1    
print(s)
Buggy python submission (verdict: Runtime Error):
sec = int(input())
h = int(sec / 3600)
m = int((sec - h * 3600) / 60)
print(":".join([h, m, sec - h * 3600 - m * 60]))

Fixed submission:
sec = int(input())
h = int(sec / 3600)
m = int((sec - h * 3600) / 60)
print(":".join(list(map(str, [h, m, sec - h * 3600 - m * 60]))))

Buggy python submission (verdict: Runtime Error):
sec = int(input())
h = int(sec / 3600)
m = int((sec - h * 3600) / 60)
print(":".join([h, m, sec - h * 3600 - m * 60]))

Fixed submission:
sec = int(input())
h = int(sec / 3600)
m = int((sec - h * 3600) / 60)
print(":".join(list(map(str, [h, m, sec - h * 3600 - m * 60]))))
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
if (a == b) {
print(a, '==', b)
} elif (a > b) {
print(a, '>', b)
} else {
print(a, '<', b)
}

Fixed submission:
a,b = list(map(int, input().split()))
if a == b:
  print('a == b')
elif a > b:
  print('a > b')
else:
  print('a < b')
Buggy python submission (verdict: Runtime Error):
while:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join.(list(map(str, sorted(a)))))

Fixed submission:
while True:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join(list(map(str, sorted(a)))))

Buggy python submission (verdict: Runtime Error):
while:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join.(list(map(str, sorted(a)))))

Fixed submission:
while True:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join(list(map(str, sorted(a)))))

Buggy python submission (verdict: Runtime Error):
while:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join.(list(map(str, sorted(a)))))

Fixed submission:
while True:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join(list(map(str, sorted(a)))))

Buggy python submission (verdict: Runtime Error):
while True:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join.(list(map(str, sorted(a)))))

Fixed submission:
while True:
  a = list(map(int, input().split()))
  if sum(a) == 0:
    break
  print(' '.join(list(map(str, sorted(a)))))
Buggy python submission (verdict: Runtime Error):
a=input("")
b=input("")
print(a*b),(2*a+2*b)


Fixed submission:
x,y = input().split()
a = int(x)
b = int(y)
print(a*b,2*a+2*b)
Buggy python submission (verdict: Runtime Error):
import math


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


def tax(p, rate):
    return math.floor(p*(100+rate)/100)

ans = 0
x, y, s = rli()
while(x != 0 or y != 0 or s != 0):
    for i in range(1,1000):
        for j in range(1,1000):
            if(tax(i, x) + tax(j, x) == s):
                ans = max(ans, tax(i, y) + tax(j, y))
    print(ans)
    ans = 0
    x, y, s = rli()

Fixed submission:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))


def tax(p, rate):
    return p*(100+rate)//100

ans = 0
x, y, s = rli()
while(x != 0 or y != 0 or s != 0):
    sum_bf = int(s/(100+x)*100)
    for i in range(sum_bf-2, sum_bf+3):
        for j in range(1,i):
            k = i-j
            if(tax(k, x) + tax(j, x) == s):
                ans = max(ans, tax(k, y) + tax(j, y))
    print(ans)
    ans = 0
    x, y, s = rli()
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
result = np.array([[0]*4]*4)
for _ in range(n):
  inp = list(map(int, input().split()))
  u, k = inp[0], inp[1]
  v = inp[2:]
  if k != 0:
    for vv in v:
      result[u-1][vv-1] = 1

result = list(result)
for i in range(n):
  print(*result[i])


Fixed submission:
n = int(input())
result = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(n):
  inp = list(map(int, input().split()))
  u, k = inp[0], inp[1]
  v = inp[2:]
  if k != 0:
    for vv in v:
      result[u-1][vv-1] = 1

result = list(result)
for i in range(n):
  print(*result[i])
Buggy python submission (verdict: Runtime Error):
from statistics import pstdev

while True:
    if input() == 0: break
    v_list = (int(x) for x in input().split())
    print(pstdev(v_list))

Fixed submission:
from statistics import pstdev

while True:
    if input() == '0': break
    v_list = (int(x) for x in input().split())
    print(pstdev(v_list))
Buggy python submission (verdict: Runtime Error):
print(x*x*x)

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
a = x*x*x
print(a)

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
a = x * x * x
print({}.format(a))

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
x = input()
print(x*x*x)

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
x = input
print(x*x*x)

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
x = input()
print(x*x*x)

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
a,b=input.split()

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
Arr=input.split()
print(Arr[0]*Arr[1])
print(2*Arr[0]+2*Arr[1])

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
Arr=[]
Arr=input.split()
print(Arr[0]*Arr[1])
print(2*Arr[0]+2*Arr[1])

Fixed submission:
x = int(input())
print(x*x*x)

Buggy python submission (verdict: Runtime Error):
[a,b]=input.split()
a = int(a)
b = int(b)
print("{} {}".format(a*b, 2*a+2*b))

Fixed submission:
x = int(input())
print(x*x*x)
Buggy python submission (verdict: Runtime Error):
a, b = input.split()
print(a)
print(b)

Fixed submission:
def temp(val):
    [a,b]=val.split()
    a = int(a)
    b = int(b)
    print("{} {}".format(a*b, 2*a+2*b))

temp(input())

Buggy python submission (verdict: Runtime Error):
print(input)
print(a)
print(b)

Fixed submission:
def temp(val):
    [a,b]=val.split()
    a = int(a)
    b = int(b)
    print("{} {}".format(a*b, 2*a+2*b))

temp(input())

Buggy python submission (verdict: Runtime Error):
[a,b]=input.split()
a = int(a)
b = int(b)
print("{} {}".format(a*b, 2*a+2*b))

Fixed submission:
def temp(val):
    [a,b]=val.split()
    a = int(a)
    b = int(b)
    print("{} {}".format(a*b, 2*a+2*b))

temp(input())

Buggy python submission (verdict: Runtime Error):
def temp(val):
    [a,b]=val.split()
    a = int(a)
    b = int(b)
    print("{} {}".format(a*b, 2*a+2*b))

temp(input)

Fixed submission:
def temp(val):
    [a,b]=val.split()
    a = int(a)
    b = int(b)
    print("{} {}".format(a*b, 2*a+2*b))

temp(input())
Buggy python submission (verdict: Runtime Error):
print("{}:{}:{}".format(input()/60, input/3600, input()%3600)

Fixed submission:
i = int(input())
print("{}:{}:{}".format(int(i/(60*60)), int((i%(60*60))/(60)), i%60))

Buggy python submission (verdict: Runtime Error):
print("{}:{}:{}".format(input()/60, input()/3600, input()%3600)

Fixed submission:
i = int(input())
print("{}:{}:{}".format(int(i/(60*60)), int((i%(60*60))/(60)), i%60))

Buggy python submission (verdict: Runtime Error):
print("{}:{}:{}".format(input()/60, input()/3600, input()%3600))

Fixed submission:
i = int(input())
print("{}:{}:{}".format(int(i/(60*60)), int((i%(60*60))/(60)), i%60))
Buggy python submission (verdict: Runtime Error):
[a,b] = input().split()
a = int(a)
b= int(b)
if(a == b):
    print('a=b')
elif(a > b):
    print("a>b")
else:
    print("a<b)

Fixed submission:
[a,b] = input().split()
a = int(a)
b= int(b)
if(a == b):
    print('a == b')
elif(a > b):
    print("a > b")
else:
    print("a < b")
Buggy python submission (verdict: Runtime Error):
r = int(input())
pi = 3.141592653589793
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))

Fixed submission:
r = float(input())
pi = 3.141592653589
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))

Buggy python submission (verdict: Runtime Error):
r = int(input())
pi = 3.141592653589793
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))

Fixed submission:
r = float(input())
pi = 3.141592653589
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))
Buggy python submission (verdict: Runtime Error):
search_s = input()
cnt = 0
while True:
    word_list = input().lower().split()
    if word_list[0] == "END_OF_TEXT" : break
    for word in word_list:
        if word == search_s:cnt += 1

print(cnt)

Fixed submission:
search_s = input()
cnt = 0
while True:
    s = input()
    if s == "END_OF_TEXT": break
    word_list = s.lower().split()
    for word in word_list:
        if word == search_s:cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 写経した
import re
class Num:
    def __str__(self):
        return str(self.x)
    def __init__(self, value):
        self.x = value
    def __add__(self, value):
        return o(self.x + value.x)
    def __sub__(self, value):
        return o(self.x - value.x)
    def __mul__(self, value):
        return o(self.x * value.x)
    def __truediv__(self, value):
        return o(int(self.x / value.x))
     
N = int(input())
for i in range(N):
    s = input()[:-1]
    s = re.sub(r'(\d+)',r'Num(\1)',s)
    print(eval(s))


Fixed submission:
# -*- coding: utf-8 -*-
# 写経した
import re
class Num:
    def __str__(self):
        return str(self.x)
    def __init__(self, value):
        self.x = value
    def __add__(self, value):
        return Num(self.x + value.x)
    def __sub__(self, value):
        return Num(self.x - value.x)
    def __mul__(self, value):
        return Num(self.x * value.x)
    def __truediv__(self, value):
        return Num(int(self.x / value.x))
      
N = int(input())
for i in range(N):
    s = input()[:-1]
    s = re.sub(r'(\d+)',r'Num(\1)',s)
    print(eval(s))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

from heapq import heappop, heappush
from collections import defaultdict

def inpl(): return list(map(int, input().split()))
N, M, L = inpl()

while N:
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b, d, e = inpl()
        G[a].append([b, d, e])
        G[b].append([a, d, e])

    Q = [[0, 0, 1]] # bandits, distance, where
    visited = defaultdict(lambda : False)
    visited[(0, 0, 1)] = True
    
    while Q:
        e, d, p = heappop(Q)
        if p == N:
            print(e)
            break
        for q, dd, de in G[p]:
            if d + dd <= L and not visited[(e, d+dd, q)]:
                heappush(Q, (e, d+dd, q))
                visited[(e, d+dd, q)] = True
            if not visited[(e+de, d, q)]:
                heappush(Q, (e+de, d, q))
                visited[(e+de, d, q)] = True
    N, M, L = inpl()


Fixed submission:
from heapq import heappop, heappush
from collections import defaultdict

def inpl(): return list(map(int, input().split()))
N, M, L = inpl()

while N:
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b, d, e = inpl()
        G[a].append([b, d, e])
        G[b].append([a, d, e])

    Q = [[0, 0, 1]] # bandits, distance, where
    cost = [[10**6]*(L+1) for _ in range(N+1)]
    cost[1][0] = 0
    while Q:
        e, d, p = heappop(Q)
        if cost[p][d] < e:
            continue
        if p == N:
            print(e)
            break
        for q, dd, de in G[p]:
            if d + dd <= L and e < cost[q][d+dd]:
                heappush(Q, (e, d+dd, q))
                cost[q][d+dd] = e
            if e + de < cost[q][d]:
                heappush(Q, (e+de, d, q))
                cost[q][d] = e+de
    N, M, L = inpl()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from heapq import heappush, heappop

A = []
inp = [None]
while inp[0] != "end":
    inp = [n for n in input().split()]
    if inp[0] == "insert":
        heappush(A, -int(inp[1]))
    elif inp[0] == "extract":
        print(-heappop(A))

Fixed submission:
# -*- coding: utf-8 -*-
from heapq import heappush, heappop

A = []
inp = [None]
while inp[0] != "end":
    inp = input().split()
    if inp[0] == "insert":
        heappush(A, -int(inp[1]))
    elif inp[0] == "extract":
        print(-heappop(A))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from bisect import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
L = [A[0]]

for i in range(1, N):
    if L[-1] < A[i]:
        L.append(A[i])
    else:
        L[bisect(L, A[i])]  = A[i]
print(len(L))

Fixed submission:
# -*- coding: utf-8 -*-
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N = int(input())
A = [int(input()) for _ in range(N)]

LIS = [A[0]]

for a in A[1:]:
    if a > LIS[-1]:
        LIS.append(a)
    else:
        LIS[bisect_left(LIS, a)] = a

print(len(LIS))