Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#! python3
# doubly_linked_list.py

keys = []

n = int(input())
for i in range(n):
    command = input()
    if command == 'deleteFirst':
        keys.pop(0)
    elif command == 'deleteLast':
        keys.pop(-1)
    else:
        command, x = command.split(' ')
        if command == 'insert':
            keys.insert(0, int(x))
        elif command == 'delete':
            keys.remove(int(x))

print(' '.join([str(k) for k in keys]))



Fixed submission:
#! python3
# doubly_linked_list.py

from collections import deque

keys = deque([])

n = int(input())

for i in range(n):
    command = input()
    if command == 'deleteFirst':
        keys.popleft()
    elif command == 'deleteLast':
        keys.pop()
    else:
        command, x = command.split(' ')
        if command == 'insert':
            keys.appendleft(int(x))
        elif command == 'delete':
            if int(x) in keys:
                keys.remove(int(x))

print(' '.join([str(k) for k in keys]))

Buggy python submission (verdict: Time Limit Exceeded):
#! python3
# doubly_linked_list.py

keys = []

n = int(input())
for i in range(n):
    command = input()
    if command == 'deleteFirst':
        keys.pop(0)
    elif command == 'deleteLast':
        keys.pop(-1)
    else:
        command, x = command.split(' ')
        if command == 'insert':
            keys.insert(0, int(x))
        elif command == 'delete':
            if int(x) in keys:
                keys.remove(int(x))

print(' '.join([str(k) for k in keys]))


Fixed submission:
#! python3
# doubly_linked_list.py

from collections import deque

keys = deque([])

n = int(input())

for i in range(n):
    command = input()
    if command == 'deleteFirst':
        keys.popleft()
    elif command == 'deleteLast':
        keys.pop()
    else:
        command, x = command.split(' ')
        if command == 'insert':
            keys.appendleft(int(x))
        elif command == 'delete':
            if int(x) in keys:
                keys.remove(int(x))

print(' '.join([str(k) for k in keys]))
Buggy python submission (verdict: Time Limit Exceeded):
#! python3
# areas_on_the_cross_section_diagram.py

cross_section = input()
cross_section_height = [0]
for i in range(len(cross_section)):
    if cross_section[i] == '\\':
        cross_section_height.append(cross_section_height[i]-1)
    elif cross_section[i] == '_':
        cross_section_height.append(cross_section_height[i])
    elif cross_section[i] == '/':
        cross_section_height.append(cross_section_height[i]+1)

# 水たまりを探す
# 左から探す
puddles = []
width = len(cross_section_height)
i = 0
while i < width-2:
    # i とペアとなる高さ
    is_down = False
    for j in range(i+1, width):
        if cross_section_height[j] > cross_section_height[i]:
            i += 1
            break
        elif cross_section_height[j] < cross_section_height[i]:
            is_down = True
        else:
            if is_down:
                puddles.append([i, j])
            i = j
            break

        if j == width-1:
            i += 1

# 面積の計算
puddle_areas = []
for start, end in puddles:
    area = 0
    for i in range(start+1, end+1):
        if cross_section[i-1] == '_':
            area += cross_section_height[start] - cross_section_height[i]
        elif cross_section[i-1] == '/':
            area += cross_section_height[start] - cross_section_height[i] + 0.5
        else:
            area +=cross_section_height[start] - cross_section_height[i] -  0.5
    puddle_areas.append(int(area))


if len(puddle_areas) == 0:
    print("0\n0")
else:
    print(sum(puddle_areas))
    print(len(puddle_areas), ' '.join([str(x) for x in puddle_areas]))


Fixed submission:
cross_section = input()

stack = []
areas_stack = []
area = 0
for i in range(len(cross_section)):
    c = cross_section[i]
    if c == '\\':
        stack.append(i)
    elif c == '/' and len(stack) != 0:
        j = stack.pop()
        a = i - j
        area += a
        while len(areas_stack) != 0 and areas_stack[-1][0] > j:
            a += areas_stack.pop()[1]
        areas_stack.append([j, a])

print(area)
if area == 0:
    print(0)
else:
    print(len(areas_stack), ' '.join([str(x[1]) for x in areas_stack]))
Buggy python submission (verdict: Runtime Error):
def counting_sort(A, k):
    n = len(A)
    B = [0 for i in range(n)]
    C = [0 for i in range(k+1)]

    for j in range(n):
        C[A[j]] += 1

    for i in range(1, k):
        C[i] = C[i] + C[i-1]

    for j in range(n-1, -1, -1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

    return B

n = int(input())
A = list(map(int, input().split(' ')))
B = counting_sort(A, 6)
print(' '.join(map(str, B)))


Fixed submission:
def counting_sort(A, k):
    n = len(A)
    B = [0 for i in range(n)]
    C = [0 for i in range(k+1)]

    for j in range(n):
        C[A[j]] += 1

    for i in range(1, k):
        C[i] = C[i] + C[i-1]

    for j in range(n-1, -1, -1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

    return B

n = int(input())
A = list(map(int, input().split(' ')))
B = counting_sort(A, 10000)
print(' '.join(map(str, B)))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

def num_from_card(card):
    return int(card[2:])

def partition(A, p, r):
    x = num_from_card(A[r])
    i = p-1
    for j in range(p, r):
        if num_from_card(A[j]) <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q-1)
        quick_sort(A, q+1, r)

def is_stable(A, sorted_A, N):
    A_nums = [int(x[2:]) for x in A]
    same_num = [x for x in set(A_nums) if A_nums.count(x) > 1]
    A_symbols, sorted_A_symbols = [], []
    flag = 'Stable'
    for num in same_num:
        if [card[0] for card in A if int(card[2:]) == num] != [card[0] for card in sorted_A if int(card[2:]) == num]:
            flag = 'Not stable'
            break
    return flag

n = int(input())
cards = [input() for i in range(n)]
init_cards = copy.copy(cards)

quick_sort(cards, 0, n-1)
print(is_stable(init_cards, cards, n))
for c in cards:
    print(c)


Fixed submission:
import copy

def num_from_card(card):
    return int(card[2:])

def partition(A, p, r):
    x = num_from_card(A[r])
    i = p-1
    for j in range(p, r):
        if num_from_card(A[j]) <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q-1)
        quick_sort(A, q+1, r)

def merge(A, left, mid, right):
    L = A[left: mid]
    R = A[mid: right]
    L.append('  ' + str(int(10e9 + 1)))
    R.append('  ' + str(int(10e9 + 1)))
    i, j = 0, 0
    for k in range(left, right):
        if num_from_card(L[i]) <= num_from_card(R[j]):
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def merge_sort(A, left, right):
    if left + 1 < right:
        mid = int((left + right)/2)
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)

n = int(input())
cards = [input() for i in range(n)]
merge_cards = copy.copy(cards)

quick_sort(cards, 0, n-1)
merge_sort(merge_cards, 0, n)

if merge_cards == cards:
    print('Stable')
else:
    print('Not stable')

for c in cards:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

class PriorityQueue:
    def __init__(self):
        self.nodes = deque([])

    def max_heapify(self, i):
        if i >= len(self.nodes): return
        left, right = (i+1)*2-1, (i+1)*2

        largest = i
        if left < len(self.nodes) and self.nodes[i] < self.nodes[left]: largest = left
        if right < len(self.nodes) and self.nodes[largest] < self.nodes[right]: largest = right

        if largest != i:
            self.nodes[i], self.nodes[largest] = self.nodes[largest], self.nodes[i]
            self.max_heapify(largest)

    def print_element(self):
        for node in self.nodes:
            print('', node, end='')
        print('')

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

pq = PriorityQueue()
pq.nodes = deque(A)

for i in range((n-1)//2, -1, -1):
    pq.max_heapify(i)

pq.print_element()


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

def max_heapify(i):
    l = (i+1)*2-1
    r = (i+1)*2
    largest = i
    if l < n and H[l] > H[i]:
        largest = l
    else:
        largest = i
    if r < n and H[r] > H[largest]:
        largest = r

    if largest != i:
        H[i], H[largest] = H[largest], H[i]
        max_heapify(largest)

def print_elements(lst):
    for ele in lst:
        print(' {}'.format(ele), end='')
    print('')

for i in range(int(n/2), -1, -1):
    max_heapify(i)

print_elements(H)
Buggy python submission (verdict: Runtime Error):
import math

class Point():
    def __init__(self, x=None, y=None):
        self.x = x
        self.y = y

class Vector():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.abs = math.sqrt(x*x + y*y)

    def constant_multipled(self, c):
        return Vector(self.x*c, self.y*c)

    def inner_product(self, vec):
        return self.x*vec.x + self.y*vec.y

x1, y1, x2, y2 = list(map(int, input().split(' ')))
start = Point(x1, y1)
base_vec = Vector(x2-x1, y2-y1)
q = int(input())
vectors = []
for i in range(q):
    x, y = list(map(int, input().split(' ')))
    vectors.append(Vector(x-start.x, y-start.y))

for vec in vectors:
    cos = base_vec.inner_product(vec)/(base_vec.abs*vec.abs)
    b_cos = vec.abs*cos
    vec_x = base_vec.constant_multipled(b_cos/base_vec.abs)
    ans_x, ans_y = vec_x.x + start.x, vec_x.y + start.y
    print('%.8f'%ans_x, '%.8f'%ans_y)


Fixed submission:
import math

class Point():
    def __init__(self, x=None, y=None):
        self.x = x
        self.y = y

class Vector():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.abs = math.sqrt(x*x + y*y)

    def constant_multipled(self, c):
        return Vector(self.x*c, self.y*c)

    def inner_product(self, vec):
        return self.x*vec.x + self.y*vec.y

x1, y1, x2, y2 = list(map(int, input().split(' ')))
start = Point(x1, y1)
base_vec = Vector(x2-x1, y2-y1)
q = int(input())
vectors = []
for i in range(q):
    x, y = list(map(int, input().split(' ')))
    vectors.append(Vector(x-start.x, y-start.y))

for vec in vectors:
    if vec.abs == 0:
        ans_x, ans_y = 0, 0
        print('%.8f'%ans_x, '%.8f'%ans_y)
        continue
    cos = base_vec.inner_product(vec)/(base_vec.abs*vec.abs)
    b_cos = vec.abs*cos
    vec_x = base_vec.constant_multipled(b_cos/base_vec.abs)
    ans_x, ans_y = vec_x.x + start.x, vec_x.y + start.y
    print('%.8f'%ans_x, '%.8f'%ans_y)
Buggy python submission (verdict: Runtime Error):
import math

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

class Segment():
    def __init__(self, x1, y1, x2, y2):
        self.p1 = Point(x1, y1)
        self.p2 = Point(x2, y2)
        self.slope = None
        self.intersept = None
        if self.p1.x == self.p2.x:
            self.slope = float('inf')
        else:
            self.slope = (self.p2.y - self.p1.y)/(self.p2.x - self.p1.x)
            self.intersept = self.p1.y - self.slope*self.p1.x

    def is_in_range(self, x, y):
        return ((x - self.p1.x)*(x - self.p2.x) <= 0 and (y - self.p1.y)*(y - self.p2.y) <= 0)

    def is_intersect(self, seg):
        if self.slope == seg.slope: return False
        slope_diff = seg.slope - self.slope
        if self.slope == float('inf'):
            x = self.p1.x
        elif seg.slope == float('inf'):
            x = seg.p1.x
        else:
            x = -(seg.intersept - self.intersept)/slope_diff
        y = self.slope * x + self.intersept
        if seg.is_in_range(x, y) and self.is_in_range(x, y): return True
        return False


q = int(input())
for i in range(q):
    x0, y0, x1, y1, x2, y2, x3, y3 = list(map(int, input().split(' ')))
    line1, line2 = Segment(x0, y0, x1, y1), Segment(x2, y2, x3, y3)
    if line1.is_intersect(line2):
        print(1)
    else:
        print(0)


Fixed submission:
class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Segment():
    def __init__(self, x1, y1, x2, y2):
        self.p1 = Point(x1, y1)
        self.p2 = Point(x2, y2)
        self.slope = None
        if self.p1.x == self.p2.x:
            self.slope = float('inf')
        else:
            self.slope = (self.p2.y - self.p1.y)/(self.p2.x - self.p1.x)

    def is_intersect(self, seg):
        a = (seg.p1.x - seg.p2.x) * (self.p1.y - seg.p1.y) + (seg.p1.y - seg.p2.y) * (seg.p1.x - self.p1.x)
        b = (seg.p1.x - seg.p2.x) * (self.p2.y - seg.p1.y) + (seg.p1.y - seg.p2.y) * (seg.p1.x - self.p2.x)
        c = (self.p1.x - self.p2.x) * (seg.p1.y - self.p1.y) + (self.p1.y - self.p2.y) * (self.p1.x - seg.p1.x)
        d = (self.p1.x - self.p2.x) * (seg.p2.y - self.p1.y) + (self.p1.y - self.p2.y) * (self.p1.x - seg.p2.x)
        e = (self.p1.x - seg.p1.x)*(self.p2.x - seg.p2.x)
        f = (self.p1.x - seg.p2.x)*(self.p2.x - seg.p1.x)
        g = (self.p1.y - seg.p1.y)*(self.p2.y - seg.p2.y)
        h = (self.p1.y - seg.p2.y)*(self.p2.y - seg.p1.y)
        return a*b <= 0 and c*d <= 0 and (e <= 0 or f <= 0) and (g <= 0 or h <= 0)

q = int(input())
for i in range(q):
    x0, y0, x1, y1, x2, y2, x3, y3 = list(map(int, input().split(' ')))
    line1, line2 = Segment(x0, y0, x1, y1), Segment(x2, y2, x3, y3)
    if line1.is_intersect(line2):
        print(1)
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]

def lis_linear(a, n):
    dp = [0 for i in range(n)]
    longest = 1
    for i in range(n):
        max_val = 1
        for j in range(i):
            if a[j] < a[i] and max_val < dp[j] + 1:
                max_val = dp[j] + 1
        dp[i] = max_val
        if dp[i] > longest: longest = dp[i]
    return longest

print(lis_linear(a, n))


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]

def lis_linear(a, n):
    dp = [0 for i in range(n)]
    longest = 1
    for i in range(n):
        max_val = 1
        for j in range(i):
            if a[j] < a[i] and max_val < dp[j] + 1:
                max_val = dp[j] + 1
        dp[i] = max_val
        if dp[i] > longest: longest = dp[i]
    return longest

def lis_binary(a, n):
    tail = [a[0]]
    for i in range(1, n):
        if a[i] > tail[-1]:
            tail.append(a[i])
            continue
        for j in range(len(tail)):
            if a[i] <= tail[j]:
                tail[j] = a[i]
                break
    return len(tail)

print(lis_binary(a, n))
Buggy python submission (verdict: Time Limit Exceeded):
#! python3
# disjoint_set_union_find_tree.py

n, q = [int(x) for x in input().split(' ')]

sets = [set([i]) for i in range(n)]

def unite(Sx, Sy):
    return Sx | Sy

def search(x):
    global sets
    flag = False
    for i in range(len(sets)):
        if x in list(sets[i]):
            flag = True
            break
    if flag:
        return i
    else:
        return None

def same(x, y):
    global sets
    flag = 0
    for set in sets:
        if x in set:
            if y in set:
                 flag = 1
            break
    return flag

for i in range(q):
    query, x, y = input().split(' ')
    x, y = int(x), int(y)
    if query == '0':
        # unite
        i_x = search(x)
        i_y = search(y)
        if i_x != None and i_y != None and i_x != i_y:
            sets[i_x] = unite(sets[i_x], sets[i_y])
            del sets[i_y]
    elif query == '1':
        # same
        print(same(x, y))



Fixed submission:
#! python3
# disjoint_set_union_find_tree.py

class UnionFindTree():
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.find(self.par[x])

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

n, q = [int(x) for x in input().split(' ')]
uft = UnionFindTree(n-1)

for i in range(q):
    com, x, y = [int(x) for x in input().split(' ')]
    if com == 0:
        uft.unite(x, y)
    elif com == 1:
        if uft.same_check(x, y):
            print(1)
        else:
            print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math

INIT_VAL = pow(2, 31)-1

class SegmentTree():
    def __init__(self, n):
        self.n = n
        self.height = math.ceil(math.log2(n))
        self.nodes = [INIT_VAL for i in range(pow(2, self.height+1)-1)]
        self.leaf_start = pow(2, self.height)-1

    def update(self, i, x):
        pntr = self.leaf_start + i
        self.nodes[pntr] = x
        while True:
            pntr = (pntr-1)//2
            l, r = pntr*2 + 1, pntr*2 + 2
            self.nodes[pntr] = min(self.nodes[l], self.nodes[r])
            if pntr == 0: break

    def __query(self, s, t, k, l, r):
        if t - s <= 0: return INIT_VAL
        if r <= s or t <= l: return INIT_VAL
        if l == s and t == r: return self.nodes[k]
        else:
            m = (l+r)//2
            vl = self.__query(s, m, k*2+1, l, m)
            vr = self.__query(m, t, k*2+2, m, r)
            return min(vl, vr)

    def find(self, s, t):
        return self.__query(s, t+1, 0, 0, pow(2, self.height))

n, q = list(map(int, input().split(' ')))
st = SegmentTree(n)
for i in range(q):
    com, x, y = list(map(int, input().split(' ')))
    if com == 0:
        st.update(x, y)
    elif com == 1:
        print(st.find(x, y))


Fixed submission:
import math

INIT_VAL = pow(2, 31)-1

class SegmentTree():
    def __init__(self, n):
        self.n = n
        self.height = math.ceil(math.log2(n))
        self.nodes = [INIT_VAL for i in range(pow(2, self.height+1)-1)]
        self.leaf_start = pow(2, self.height)-1

    def update(self, i, x):
        pntr = self.leaf_start + i
        self.nodes[pntr] = x
        while True:
            pntr = (pntr-1)//2
            if pntr == -1: break
            l, r = pntr*2 + 1, pntr*2 + 2
            self.nodes[pntr] = min(self.nodes[l], self.nodes[r])

    def __query(self, s, t, k, l, r):
        if t - s <= 0: return INIT_VAL
        if r <= s or t <= l: return INIT_VAL
        if l == s and t == r: return self.nodes[k]
        else:
            m = (l+r)//2
            if t <= m:
                return self.__query(s, t, k*2+1, l, m)
            elif m <= s:
                return self.__query(s, t, k*2+2, m, r)
            else:
                vl = self.__query(s, m, k*2+1, l, m)
                vr = self.__query(m, t, k*2+2, m, r)
                return min(vl, vr)

    def find(self, s, t):
        return self.__query(s, t+1, 0, 0, pow(2, self.height))

n, q = list(map(int, input().split(' ')))
st = SegmentTree(n)
for i in range(q):
    com, x, y = list(map(int, input().split(' ')))
    if com == 0:
        st.update(x, y)
    elif com == 1:
        print(st.find(x, y))
Buggy python submission (verdict: Runtime Error):
import math

class SegmentTree():
    def __init__(self, n):
        self.n = n
        self.height = math.ceil(math.log2(n))
        self.nodes = [0 for i in range(pow(2, self.height+1)-1)]
        self.leaf_start = pow(2, self.height)-1

    def update(self, i, x):
        pntr = self.leaf_start + i
        self.nodes[pntr] += x
        while True:
            pntr = (pntr-1)//2
            if pntr == -1: break
            self.nodes[pntr] += x

    def __query(self, s, t, k, l, r):
        if t - s <= 0: return 0
        if r <= s or t <= l: return 0
        if l == s and t == r: return self.nodes[k]
        else:
            m = (l+r)//2
            if t <= m:
                return self.__query(s, t, k*2+1, l, m)
            elif m <= s:
                return self.__query(s, t, k*2+2, m, r)
            else:
                vl = self.__query(s, m, k*2+1, l, m)
                vr = self.__query(m, t, k*2+2, m, r)
                return vl + vr

    def find(self, s, t):
        return self.__query(s, t+1, 0, 0, pow(2, self.height))

n, q = list(map(int, input().split(' ')))
st = SegmentTree(n)
for i in range(q):
    com, x, y = list(map(int, input().split(' ')))
    if com == 0:
        st.update(x, y)
    elif com == 1:
        print(st.find(x, y))




Fixed submission:
import math

class SegmentTree():
    def __init__(self, n):
        self.n = n
        self.height = math.ceil(math.log2(n))
        self.nodes = [0 for i in range(pow(2, self.height+1)-1)]
        self.leaf_start = pow(2, self.height)-1

    def update(self, i, x):
        pntr = self.leaf_start + i
        self.nodes[pntr] += x
        while True:
            pntr = (pntr-1)//2
            if pntr == -1: break
            self.nodes[pntr] += x

    def __query(self, s, t, k, l, r):
        if t - s <= 0: return 0
        if r <= s or t <= l: return 0
        if l == s and t == r: return self.nodes[k]
        else:
            m = (l+r)//2
            if t <= m:
                return self.__query(s, t, k*2+1, l, m)
            elif m <= s:
                return self.__query(s, t, k*2+2, m, r)
            else:
                vl = self.__query(s, m, k*2+1, l, m)
                vr = self.__query(m, t, k*2+2, m, r)
                return vl + vr

    def find(self, s, t):
        return self.__query(s, t+1, 0, 0, pow(2, self.height))

n, q = list(map(int, input().split(' ')))
st = SegmentTree(n)
for i in range(q):
    com, x, y = list(map(int, input().split(' ')))
    if com == 0:
        st.update(x-1, y)
    elif com == 1:
        print(st.find(x-1, y-1))
Buggy python submission (verdict: Runtime Error):
#! python3
# distance.py

import math

x1, y1, x2, y2 = [int(x) for x in input().split(' ')]
print('%.5f'%math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)))



Fixed submission:
#! python3
# distance.py

import math

x1, y1, x2, y2 = [float(x) for x in input().split(' ')]
print('%.5f'%math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)))
Buggy python submission (verdict: Runtime Error):
#! python3
# circle.py

import math

r = int(input())
print("%.6f"%(pow(r, 2)*math.pi), "%.6f"%(2*r*math.pi))


Fixed submission:
#! python3
# circle.py

import math

r = float(input())
print("%.6f"%(pow(r, 2)*math.pi), "%.6f"%(2*r*math.pi))
Buggy python submission (verdict: Runtime Error):
#! python3
# counting_characters.py

import sys

sents = []
for line in sys.stdin:
    sents.append(input())

dic = {chr(x):0 for x in range(ord('a'), ord('z')+1)}

for sent in sents:
    for c in sent:
        x = c.lower()
        if ord('a') <= ord(x) and ord(x) <= ord('z'):
            dic[x] += 1

for k, v in dic.items():
    print(k + ' : ' + str(v))


Fixed submission:
#! python3
# counting_characters.py

import sys

sents = [line.strip() for line in sys.stdin.readlines()]
dic = {chr(x):0 for x in range(ord('a'), ord('z')+1)}

for sent in sents:
    for c in sent:
        x = c.lower()
        if ord('a') <= ord(x) and ord(x) <= ord('z'):
            dic[x] += 1

for k, v in dic.items():
    print(k + ' : ' + str(v))
Buggy python submission (verdict: Runtime Error):

def shuffle(text, n):
    return text[n+1:] + text[:n]

while True:
    sent = input()
    if sent == '-': break
    m = int(input())
    hs = [int(input()) for i in range(m)]

    for h in hs:
        sent = shuffle(sent)

    print(sent)


Fixed submission:
#! python3
# shuffle.py

def shuffle(text, n):
    return text[n:] + text[:n]

while True:
    sent = input()
    if sent == '-': break
    m = int(input())

    h = 0
    for i in range(m):
        h += int(input())
    h = h % len(sent)

    sent = shuffle(sent, h)
    print(sent)