Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import copy
class Dice2:
    def __init__(self, nums):
        self.nums = nums
        self.dic = \
                {(1,2):3, (1,3):5, (1,4):2, (1,5):4, (2,3):1, (2,4):6, (2,6):3, (3,5):1, (3,6):5, (4,5):6, (4,6):2, (5,6):4}
    def output_right(self, x):
        nums = self.nums
        y = copy.deepcopy(x)
        x.sort()
        key = tuple(x)
        if tuple(y)==key:
            return nums[self.dic[key]-1]
        else:
            return nums[6-self.dic[key]]

dice = Dice2(list(map(int, input().split())))
q = int(input())
for i in range(q):
    print(dice.output_right(list(map(int, input().split()))))

Fixed submission:
import copy
class Dice2:
    def __init__(self, nums):
        self.nums = nums
        self.dic = \
                {(1,2):3, (1,3):5, (1,4):2, (1,5):4, (2,3):1, (2,4):6, (2,6):3, (3,5):1, (3,6):5, (4,5):6, (4,6):2, (5,6):4}
    def output_right(self, x):
        x[0] = self.nums.index(x[0]) + 1
        x[1] = self.nums.index(x[1]) + 1
        nums = self.nums
        y = copy.deepcopy(x)
        x.sort()
        key = tuple(x)
        if tuple(y)==key:
            return nums[self.dic[key]-1]
        else:
            return nums[6-self.dic[key]]

dice = Dice2(list(map(int, input().split())))
q = int(input())
for i in range(q):
    print(dice.output_right(list(map(int, input().split()))))
Buggy python submission (verdict: Runtime Error):
x = input()
print(x**3)

Fixed submission:
x = int(input())
print(x**3)
Buggy python submission (verdict: Runtime Error):
x = map(int, input().split())
x.sort()
print(x)

Fixed submission:
x = list(map(int, input().split()))
x.sort()
print(x[0], x[1], x[2])
Buggy python submission (verdict: Runtime Error):
[a, b] = list(map(int, input().split()))

print(a//b)
print(a%b)
print({:.5f}.format(a/b))

Fixed submission:
[a, b] = list(map(int, input().split()))

print(a//b)
print(a%b)
print("{:.5f}".format(a/b))
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print("{0:.5f} {1:.5f}".format(math.pi*r**2, 2*math.pi*r))

Fixed submission:
import math
r = float(input())
print("{0:.6f} {1:.6f}".format(math.pi*r**2, 2*math.pi*r))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print("{0:.6f} {1:.6f}".format(math.pi*r**2, 2*math.pi*r))

Fixed submission:
import math
r = float(input())
print("{0:.6f} {1:.6f}".format(math.pi*r**2, 2*math.pi*r))
Buggy python submission (verdict: Runtime Error):
sols = []
while True:
    x = list(input().split())
    a = int(x[0])
    b = int(x[2])
    oprnd = x[1]
    if oprnd=="+":
        sols.append(a+b)
    elif oprnd=="-":
        sols.append(a-b)
    elif oprnd=="*":
        sols.append(a*b)
    elif oprnd=="/":
        sols.append(a/b)
    elif oprnd=="?":
        break
for i in len(sols):
    print(sols[i])

Fixed submission:
import math
while True:
    x = input().split()
    a = int(x[0])
    b = int(x[2])
    oprnd = x[1]
    if oprnd=="+":
        print(a+b)
    elif oprnd=="-":
        print(a-b)
    elif oprnd=="*":
        print(a*b)
    elif oprnd=="/":
        print(math.floor(a/b))
    elif oprnd=="?":
        break

Buggy python submission (verdict: Runtime Error):
sols = []
while True:
    x = list(input().split())
    a = int(x[0])
    b = int(x[2])
    oprnd = x[1]
    if oprnd=="+":
        sols.append(a+b)
    elif oprnd=="-":
        sols.append(a-b)
    elif oprnd=="*":
        sols.append(a*b)
    elif oprnd=="/":
        sols.append(a/b)
    elif oprnd=="?":
        break
if len(sols==1):
    print(sols)
else:
    for i in len(sols):
        print(sols[i])

Fixed submission:
import math
while True:
    x = input().split()
    a = int(x[0])
    b = int(x[2])
    oprnd = x[1]
    if oprnd=="+":
        print(a+b)
    elif oprnd=="-":
        print(a-b)
    elif oprnd=="*":
        print(a*b)
    elif oprnd=="/":
        print(math.floor(a/b))
    elif oprnd=="?":
        break
Buggy python submission (verdict: Runtime Error):
n = int(input().split())
for i in range(n):
    if i%3==0:
        print(" "+str(i+1), end="")
    else:
        x = i+1
        while(x>0):
            if x%10==3:
                print(" "+str(i+1), end="")
                break
            else:
                x = x//10

Fixed submission:
n = int(input())
for i in range(n):
    if (i+1)%3==0:
        print(" "+str(i+1), end="")
    else:
        x = i+1
        while(x>0):
            if x%10==3:
                print(" "+str(i+1), end="")
                break
            else:
                x = x//10
print("")
Buggy python submission (verdict: Runtime Error):
def fib(n):
   if n == 0 || n == 1:
       return 1
    
   return fib(n-1) + fib(n-2)


n=int(raw_input())
print fib(n)

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    def _fibonacci(n,cache):
        if n in cache:
            return cache[n]

        elif n == 0 or n == 1:
            ret = 1
            cache[n] = ret
            return ret
        else:
            ret = _fibonacci(n - 1, cache) + _fibonacci(n - 2, cache)
            cache[n] = ret
            return ret

    N = int(raw_input())
    cache = {}
    return _fibonacci(N,cache)

print main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    def _fibonacci(n):
        if n == 0:
            return 1
        elif n == 1:
            return 1
        else:
            return _fibonacci(n - 1) + _fibonacci(n - 2)

    N = int(raw_input())
    return _fibonacci(N)


print main()

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    def _fibonacci(n,cache):
        if n in cache:
            return cache[n]

        elif n == 0 or n == 1:
            ret = 1
            cache[n] = ret
            return ret
        else:
            ret = _fibonacci(n - 1, cache) + _fibonacci(n - 2, cache)
            cache[n] = ret
            return ret

    N = int(raw_input())
    cache = {}
    return _fibonacci(N,cache)

print main()
Buggy python submission (verdict: Runtime Error):
import math

data = input()
data1 = input()

data = int(data)
data = int(data1)
print (data * data1," ",data*2 + data1*2)

Fixed submission:
import math


a,b = (int(i) for i in input().split())

a = int(a)
b = int(b)
print (a * b,a*2 + b*2)

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

data = input()
data1 = input()

data = int(data)
data1 = int(data1)
print (data * data1," ",data*2 + data1*2)

Fixed submission:
import math


a,b = (int(i) for i in input().split())

a = int(a)
b = int(b)
print (a * b,a*2 + b*2)
Buggy python submission (verdict: Runtime Error):
int i = 1
while(true):
 x = int(input())
 if(x == 0):
  break
 print('case {0}: {1}'.format(i,x))
 i++


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
int i = 1
while true:
 x = int(input())
 if(x == 0):
  break
 print('case {0}: {1}'.format(i,x))
 i++


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
int i = 1
while true:
 x = int(input())
 if(x == 0):
  break
 print('case {0}: {1}'.format(i,x))
 i = i+1


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
int i = 1
while true:
 x = int(input())
 if x == 0:
  break
 print('case {0}: {1}'.format(i,x))
 i = i+1


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
i = 1
while true:
 x = int(input())
 if x == 0:
  break
 print('case {0}: {1}'.format(i,x))
 i = i+1


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
i = 1
while true:
 x = int(input())
 if x == 0:
  break
 print('case %d: %d' % (i,x))
 i +=1


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1

Buggy python submission (verdict: Runtime Error):
i = 1
while true:
 x = int(input())
 if x == 0:
  break
 print('case %d: %d' % (i,x))
 i +=1


Fixed submission:
i = 1
while True:
 x = int(input())
 if x == 0:
  break
 print('Case %d: %d' % (i,x))
 i +=1
Buggy python submission (verdict: Runtime Error):
while True:
 x = int(input().split())

 if x[0] == 0 and x[1] == 0:
  break

 if x[0]>x[1]:
  print('%d %d' % (x[1],x[0])
 else:
  print('%d %d' % (x[0],x[1])


Fixed submission:
while True:
 a,b = map(int,input().split())

 if a == 0 and b == 0:
  break

 if a>b:
  print(b,a)
 else:
  print(a,b)

Buggy python submission (verdict: Runtime Error):
while True:
 x = int(input().split())

 if x[0] == 0 and x[1] == 0:
  break

 if x[0]>x[1]:
  print('%d %d' % (x[1],x[0]))
 else:
  print('%d %d' % (x[0],x[1]))


Fixed submission:
while True:
 a,b = map(int,input().split())

 if a == 0 and b == 0:
  break

 if a>b:
  print(b,a)
 else:
  print(a,b)

Buggy python submission (verdict: Runtime Error):
while True:
 x = int(input().split())

 if x[0] == 0 and x[1] == 0:
  break

 if x[0]>x[1]:
  print(x[1],x[0])
 else:
  print(x[0],x[1])


Fixed submission:
while True:
 a,b = map(int,input().split())

 if a == 0 and b == 0:
  break

 if a>b:
  print(b,a)
 else:
  print(a,b)
Buggy python submission (verdict: Runtime Error):
import math

r = int(input())

s = r*r*math.pi
l = 2*r*math.pi

print(s,l)


Fixed submission:
import math

r = float(input())

s = r*r*math.pi
l = 2*r*math.pi

print(s,l)

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

r = int(input())

s = r*r*math.pi
l = 2*r*math.pi

print(s,l)


Fixed submission:
import math

r = float(input())

s = r*r*math.pi
l = 2*r*math.pi

print(s,l)
Buggy python submission (verdict: Runtime Error):
while True:
 a, op, b = input().split()
 a = int(a)
 b = int(b)

 if op == '?':
  break
 if op == '+':
  ans = a + b
 elif op == '-':
  ans = a-b
 elif op == '*':
  ans = a*b
 else op == '/':
  ans = a/b

 print(ans)


Fixed submission:
while True:
 a, op, b = input().split()
 a = int(a)
 b = int(b)

 if op == '?':
  break

 if op == '+':
  ans = a+b
 elif op == '-':
  ans = a-b
 elif op == '*':
  ans = a*b
 else:
  ans = a/b

 print('%d' %(ans))
Buggy python submission (verdict: Runtime Error):
def main():
    line = input()

    s1 = []
    s2 = []
    sum = 0
    for i, s in enumerate(line):
        if s == "\\":
            # 谷の位置をスタックに積む
            s1.append(i)
        elif s == "/" and len(s1) > 0:
            # 山で対応する谷があるなら、面積に追加
            j = s1.pop()
            sum += i - j  # 谷から山の距離を水たまりの面積に追加
            # jより前に位置する水たまりの面積を追加
            a = i - j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            # (水たまりの左端の位置, 水たまりの面積)のタプルをスタックに積む
            s2.append((j, a))

    print(sum)
    print(len(s2), s2[0][1])


if __name__ == "__main__":
    main()



Fixed submission:
def main():
    line = input()
    s1 = []
    s2 = []
    sum = 0
    for i, s in enumerate(line):
        if s == "\\":
            # 谷の位置をスタックに積む
            s1.append(i)
        elif s == "/" and len(s1) > 0:
            # 山で対応する谷があるなら、面積に追加
            j = s1.pop()
            sum += i - j  # 谷から山の距離を水たまりの面積に追加
            # jより前に位置する水たまりの面積を追加
            a = i - j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            # (水たまりの左端の位置, 水たまりの面積)のタプルをスタックに積む
            s2.append((j, a))

    print(sum)
    print(len(s2), end="")
    for x in s2:
        print(f" {x[1]}", end="")
    print()


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# line = "4 3 2 1"
# L = [int(x) for x in line.split()]
# n = len(L)

n = int(input())
line = input()
L = [int(x) for x in line.split()]

flags = [False] * n
loops = []

for i, x in enumerate(L):
    k = x - 1
    if flags[k]:
        continue
    if i == k:
        flags[i] = True
        continue

    loop = []
    while x not in loop:
        flags[k] = True
        loop.append(x)
        x = L[k]
        k = x - 1
    loops.append(loop)

cost = 0
for loop in loops:
    m = min(loop)
    cost += m * (len(loop)-1) + sum(loop) - m

print(cost)

Fixed submission:
n = int(input())
line = input()
L = [int(x) for x in line.split()]

flags = [False] * n
loops = []

S = sorted(L)
for idx, x in enumerate(L):
    k = S.index(x)
    if flags[k]:
        continue
    if k == idx:
        flags[k] = True
        continue

    ws = []
    while x not in ws:
        flags[k] = True
        ws.append(x)
        x = L[k]
        k = S.index(x)
    loops.append(ws)

cost = 0
for ws in loops:
    n = len(ws)
    a = sum(ws) + (n - 2) * min(ws)
    b = sum(ws) + min(ws) + (n + 1) * min(L)
    cost += min(a, b)

print(cost)

Buggy python submission (verdict: Runtime Error):
n = int(input())
line = input()
L = [int(x) for x in line.split()]

flags = [False] * n
loops = []

for i, x in enumerate(L):
    k = x - 1
    if flags[k]:
        continue
    if i == k:
        flags[i] = True
        continue

    loop = []
    while x not in loop:
        flags[k] = True
        loop.append(x)
        x = L[k]
        k = x - 1
    loops.append(loop)

cost = 0
for loop in loops:
    m = min(loop)
    cost += m * (len(loop)-1) + sum(loop) - m

print(cost)

Fixed submission:
n = int(input())
line = input()
L = [int(x) for x in line.split()]

flags = [False] * n
loops = []

S = sorted(L)
for idx, x in enumerate(L):
    k = S.index(x)
    if flags[k]:
        continue
    if k == idx:
        flags[k] = True
        continue

    ws = []
    while x not in ws:
        flags[k] = True
        ws.append(x)
        x = L[k]
        k = S.index(x)
    loops.append(ws)

cost = 0
for ws in loops:
    n = len(ws)
    a = sum(ws) + (n - 2) * min(ws)
    b = sum(ws) + min(ws) + (n + 1) * min(L)
    cost += min(a, b)

print(cost)
Buggy python submission (verdict: Runtime Error):
# 0-1 Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
    items.append(tuple(int(x) for x in input().split()))

DP = [0] * (W+1)
for i in range(N):
    v, w = items[i]
    for j in range(W, w-1, -1):
        DP[j] = max(DP[j], v + DP[j-w])

print(DP[-1][-1])

Fixed submission:
# 0-1 Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
    items.append(tuple(int(x) for x in input().split()))

DP = [0] * (W+1)
for i in range(N):
    v, w = items[i]
    for j in range(W, w-1, -1):
        DP[j] = max(DP[j], v + DP[j-w])

print(DP[-1])
Buggy python submission (verdict: Time Limit Exceeded):
# Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
    items.append(tuple(int(x) for x in input().split()))

DP = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        v, w = items[i]
        k = 0
        while k * w <= j:
            DP[i+1][j] = max(DP[i+1][j], k*v + DP[i][j-k*w])
            k += 1

print(DP[-1][-1])

Fixed submission:
# Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
    items.append(tuple(int(x) for x in input().split()))


DP = [0] * (W+1)
for i in range(N):
    v, w = items[i]
    for j in range(w, W+1):
        DP[j] = max(DP[j], v + DP[j-w])

print(DP[-1])
Buggy python submission (verdict: Runtime Error):
def dfs(u, node_info, matrix):
    # ????????????????????¨??????????????????
    colors = [0] * len(matrix)
    detect_time = [0] * len(matrix)
    finished_time = [0] * len(matrix)
    time = 1
    stack = list()
    stack.append(u)
    colors[u] = 1
    detect_time[u] = time
    while len(stack):
        for i, val in enumerate(matrix[u]):
            if val == 1 and colors[i] == 0:
                time += 1
                stack.append(i)
                colors[i] = 1
                detect_time[i] = time
                u = i
                break
        else:
            time += 1
            e = stack.pop()
            colors[e] = 2
            finished_time[e] = time
            if len(stack):
                u = stack[-1]
    for i in range(len(matrix)):
        print('{} {} {}'.format(i + 1, detect_time[i], finished_time[i]))


if __name__ == '__main__':
    N = int(input())
    matrix = [[0] * N for _ in range(N)]
    color = [0] * N
    for i in matrix:
        node_info = [int(i) for i in input().split()]
        node_i = node_info[0] - 1
        if not node_info[1] == 0:
            for i in node_info[2:]:
                matrix[node_i][i - 1] = 1
    for line in matrix:
    dfs(0, None, matrix)

Fixed submission:
def dfs(u, colors, matrix, time, detect_time, finished_time):
    # ????????????????????¨??????????????????
    colors = colors
    detect_time = detect_time
    finished_time = finished_time
    time = time + 1
    stack = list()
    stack.append(u)
    colors[u] = 1
    detect_time[u] = time
    while len(stack):
        for i, val in enumerate(matrix[u]):
            if val == 1 and colors[i] == 0:
                time += 1
                stack.append(i)
                colors[i] = 1
                detect_time[i] = time
                u = i
                break
        else:
            time += 1
            e = stack.pop()
            colors[e] = 2
            finished_time[e] = time
            if len(stack):
                u = stack[-1]
    return time


if __name__ == '__main__':
    N = int(input())
    matrix = [[0] * N for _ in range(N)]
    color = [0] * N
    for i in matrix:
        node_info = [int(i) for i in input().split()]
        node_i = node_info[0] - 1
        if not node_info[1] == 0:
            for i in node_info[2:]:
                matrix[node_i][i - 1] = 1
    colors = [0] * len(matrix)
    detect_time = [0] * len(matrix)
    finished_time = [0] * len(matrix)
    time = 0
    for i, val in enumerate(colors):
        if val == 0:
            time = dfs(i, colors, matrix, time, detect_time, finished_time)

    for i in range(len(matrix)):
        print('{} {} {}'.format(i + 1, detect_time[i], finished_time[i]))
Buggy python submission (verdict: Time Limit Exceeded):
class Solver():
    def __init__(self, A: [int]):
        self.A = A
        self.max_depth = len(A)

    def solve(self, tgt):
        self.tgt = tgt
        if self._rec_solve(0, 0):
            return 'yes'
        else:
            return 'no'

    def _rec_solve(self, _sum, index):
        if _sum == self.tgt:
            return True
        elif index >= self.max_depth or _sum > self.tgt:
            return False
        else:
            return self._rec_solve(_sum + self.A[index], index + 1) or self._rec_solve(_sum, index + 1)
            


if __name__ == '__main__':
    n = int(input())
    A = [int(i) for i in input().rstrip().split()]
    q = int(input())
    m_ary = [int(i) for i in input().rstrip().split()]
    s = Solver(A)
    for i in m_ary[:]:
        print(s.solve(i))

Fixed submission:
class Solver():
    def __init__(self, A: [int]):
        self.A = A
        self.max_depth = len(A)

    def solve(self, tgt):
        self.tgt = tgt
        self.history = (self.max_depth+1)*[4000 * [None]]
        self.history = [[None for i in range(4000)] for x in range(self.max_depth + 1)]
        if self._rec_solve(0, 0):
            return 'yes'
        else:
            return 'no'

    def _rec_solve(self, _sum, index):
        if self.history[index][_sum] is not None:
            return self.history[index][_sum]
        if _sum == self.tgt:
            self.history[index][_sum] = True
            return True
        if index >= self.max_depth or _sum > self.tgt:
            self.history[index][_sum] = False
            return False
        self.history[index][_sum] = self._rec_solve(_sum + self.A[index], index + 1) or self._rec_solve(_sum, index + 1)
        return self.history[index][_sum]
            


if __name__ == '__main__':
    n = int(input())
    A = [int(i) for i in input().rstrip().split()]
    q = int(input())
    m_ary = [int(i) for i in input().rstrip().split()]
    s = Solver(A)
    for val in m_ary:
        print(s.solve(val))
Buggy python submission (verdict: Runtime Error):
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if 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


fin = open('sample.txt')
input = fin.readline

if __name__ == '__main__':
    N = int(input().strip())
    AA = [int(a) for a in input().strip().split()]
    i = partition(AA, 0, N - 1)
    _str = ' '.join([str(a) for a in AA[:i]]) + \
           ' [{}] '.format(AA[i]) + \
            ' '.join([str(a) for a in AA[i+1:]])
    print(_str)

Fixed submission:
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if 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


if __name__ == '__main__':
    N = int(input().strip())
    AA = [int(a) for a in input().strip().split()]
    i = partition(AA, 0, N - 1)
    _str = ' '.join([str(a) for a in AA[:i]]) + \
           ' [{}] '.format(AA[i]) + \
            ' '.join([str(a) for a in AA[i+1:]])
    print(_str)
Buggy python submission (verdict: Runtime Error):
fin = open('sample.txt')
input = fin.readline


def main():
    N = int(input())
    A = [0] * N
    node_info = [[-1, 0, 'internal node', None] for _ in range(int(1E5 + 1))]
    for i in range(N):
        A[i] = [int(i) for i in input().strip().split()]
    for line in A:
        if line[1] != 0:
            node_info[line[0]][3] = line[2:]
            for c in line[2:]:
                node_info[c][0] = line[0]

    for line in A:
        pid = node_info[line[0]][0]
        if pid == -1:
            node_info[line[0]][2] = 'root'
        else:
            if node_info[line[0]][3] is None:
                node_info[line[0]][2] = 'leaf'
        if node_info[line[0]][3] is None:
            node_info[line[0]][3] = ['']

        depth = 0
        while pid != -1:
            depth += 1
            pid = node_info[pid][0]
        node_info[line[0]][1] = depth

    for line in sorted(A, key=lambda a: a[0]):
        print('node {}: parent = {}, depth = {}, {}, [{}]'.format(
            line[0], node_info[line[0]][0],
            node_info[line[0]][1], node_info[line[0]][2], ', '.join([str(i) for i in node_info[line[0]][3]]))
        )


if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())

tree = [{'p': -1, 'c': list(), 'd': 0} for _ in range(N)]

for _ in range(N):
    l = list(map(int, input().split()))
    tree[l[0]]['c'] = l[2:]
    for i in l[2:]:
        tree[i]['p'] = l[0]


def calcDepth(tree, root, curDepth=0):
    tree[root]['d'] = curDepth
    [calcDepth(tree, c, curDepth + 1) for c in tree[root]['c']]


r = 0
for i, t in enumerate(tree):
    if t['p'] == -1:
        r = i
        break
calcDepth(tree, r)

for i in range(N):
    state = 'leaf'
    if tree[i]['p'] == -1:
        state = 'root'
    elif len(tree[i]['c']):
        state = 'internal node'
    print('node {i}: parent = {p}, depth = {d}, {state}, {ch}'.format(
        i=i, p=tree[i]['p'], d=tree[i]['d'], state=state, ch=tree[i]['c']
    ))
Buggy python submission (verdict: Runtime Error):
#input number
n = raw_input()

if n < 1 and n > 100:
	exit()

# input elements
l = raw_input()

elements = l.split()

for e in elements:
	o += str(e) + ' '
print o

for i in range(1, int(n)):
	key = elements[i]
	j = i - 1
	while j >= 0 and elements[j] > key:
		elements[j + 1] = elements[j]
		j -= 1
	elements[j + 1] = key
	# output
	o = ''
	for e in elements:
		o += str(e) + ' '
	print o

Fixed submission:
#input number
n = raw_input()

if n < 1 and n > 100:
	exit()

# input elements
l = raw_input()

elements = [int(e) for e in l.split()]

print ' '.join(str(e) for e in elements)

for i in range(1, int(n)):
	key = elements[i]
	j = i - 1
	while j >= 0 and elements[j] > key:
		elements[j + 1] = elements[j]
		j -= 1
	elements[j + 1] = key
	# output
	print ' '.join(str(e) for e in elements)