Buggy python submission (verdict: Time Limit Exceeded):
import math
def parent(i):
    return math.floor(i / 2)

def get_largest(i):
    global SIZE
    l = i << 1
    r = l + 1
    largest = None
    if l <= SIZE and A[i] < A[l]:
        largest = l
    else:
        largest = i
    if r <= SIZE and A[largest] < A[r]:
        largest = r
    return largest


def max_heapify(i):
    largest = get_largest(i)
    x = i
    while largest is not x:
        tmp = A[x]
        A[x] = A[largest]
        A[largest] = tmp
        x = largest
        largest = get_largest(x)

def extract():
    global SIZE
    m = A[1]
    A[1] = A[SIZE]
    SIZE -= 1
    max_heapify(1)
    return m

def increase_key(i, key):
    if key < A[i]:
        raise NameError('key is less than A[i]')
    A[i] = key
    while 1 < i and A[parent(i)] < A[i]:
        tmp = A[i]
        A[i] = A[parent(i)]
        A[parent(i)] = tmp
        i = parent(i)

def insert_key(key):
    global SIZE
    SIZE += 1
    A.append(None)
    A[SIZE] = -1
    increase_key(SIZE, key)

inp = input()
A = [None]
SIZE = 0

loop =  inp[0:2] is not 'en'

while loop:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(extract())
    elif inp[0] == 'i':
        insert_key(int(inp[7:]))
    inp = input()

Fixed submission:
import math
import heapq

A = []
inp = input()
while True:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(-heapq.heappop(A))
    elif inp[0] == 'i':
        heapq.heappush(A, -int(inp[7:]))
    inp = input()

Buggy python submission (verdict: Time Limit Exceeded):
import math
def parent(i):
    return math.floor(i / 2)

def get_largest(i):
    l = i << 1
    r = l + 1
    largest = None
    size = len(A) - 1
    if l <= size and A[i] < A[l]:
        largest = l
    else:
        largest = i
    if r <= size and A[largest] < A[r]:
        largest = r
    return largest


def max_heapify(i):
    largest = get_largest(i)
    x = i
    while largest is not x:
        tmp = A[x]
        A[x] = A[largest]
        A[largest] = tmp
        x = largest
        largest = get_largest(x)

def extract():
    m = A[1]
    A[1] = A[-1]
    A.pop()
    max_heapify(1)
    return m

def insert_key(key):
    A.append(key)
    i = len(A) - 1
    while 1 < i and A[parent(i)] < A[i]:
        tmp = A[i]
        A[i] = A[parent(i)]
        A[parent(i)] = tmp
        i = parent(i)

inp = input()
A = [None]

while True:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(extract())
    elif inp[0] == 'i':
        insert_key(int(inp[7:]))
    inp = input()

Fixed submission:
import math
import heapq

A = []
inp = input()
while True:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(-heapq.heappop(A))
    elif inp[0] == 'i':
        heapq.heappush(A, -int(inp[7:]))
    inp = input()

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

def parent(i):
    return math.floor(i / 2)

def get_largest(i):
    l = i << 1
    r = l + 1
    largest = None
    size = len(A) - 1
    if l <= size and A[i] < A[l]:
        largest = l
    else:
        largest = i
    if r <= size and A[largest] < A[r]:
        largest = r
    return largest


def max_heapify(i):
    largest = get_largest(i)
    x = i
    while largest is not x:
        tmp = A[x]
        A[x] = A[largest]
        A[largest] = tmp
        x = largest
        largest = get_largest(x)

def extract():
    m = A[1]
    A[1] = A[-1]
    A.pop()
    max_heapify(1)
    return m

def insert_key(key):
    A.append(key)
    i = len(A) - 1
    while 1 < i and A[parent(i)] < A[i]:
        tmp = A[i]
        A[i] = A[parent(i)]
        A[parent(i)] = tmp
        i = parent(i)

inp = input()
A = deque()
A.append(0)

while True:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(extract())
    elif inp[0] == 'i':
        insert_key(int(inp[7:]))
    inp = input()

Fixed submission:
import math
import heapq

A = []
inp = input()
while True:
    if inp == 'end':
        break
    elif inp[0] == 'e':
        print(-heapq.heappop(A))
    elif inp[0] == 'i':
        heapq.heappush(A, -int(inp[7:]))
    inp = input()