Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def main():
    List=[]
    while(True):
        a=input()
        if a=="":
            break
        else:
            List.append(a)

    List.sort(reverse=True)
    print(List[0])
    print(List[1])
    print(List[2])
        
 
if __name__ == '__main__':
    main()

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

def main():
    List=[]

    for i in range(10):
        a=int(input())
        List.append(a)

    List.sort(reverse=True)
    print(List[0])
    print(List[1])
    print(List[2])
        
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    IN=input()
    if IN=='':
        break
    print(IN[::-1])

Fixed submission:
IN=input()
print(IN[::-1])
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        a=int(input())+int(input())
        if la>=10**80:
            print("overflow")
        print(a)
            
    
if __name__ == '__main__':
    main()

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

def main():
    for i in range(int(input())):
        a=int(input())+int(input())
        if a>=10**80:
            print("overflow")
        else:
            print(a)
            
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def main():
    n=int(input())

    for i in range(n):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
        a=(y2-y1)/(x2-x1)
        b=(y4-y3)/(x4-x3)

        if a==b:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

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

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
        a=(y2-y1)/(x2-x1)
        b=(y4-y3)/(x4-x3)

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

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

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math as m
r=int(input())
print("%.6f"%(r**2*m.pi),"%.6f"%(r*2*m.pi))

Fixed submission:
# encoding:utf-8
import math

r = float(input())

area = r**2*math.pi
circumference = r * 2 * math.pi

area = ('%03.6f' % area)
circumference = ('%03.6f' % circumference)

print(area),
print(circumference)

Buggy python submission (verdict: Runtime Error):
import math as m
r=int(input())
print("%.6f"%(r**2*m.pi),"%.6f"%(r*2*m.pi))

Fixed submission:
# encoding:utf-8
import math

r = float(input())

area = r**2*math.pi
circumference = r * 2 * math.pi

area = ('%03.6f' % area)
circumference = ('%03.6f' % circumference)

print(area),
print(circumference)

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

Fixed submission:
# encoding:utf-8
import math

r = float(input())

area = r**2*math.pi
circumference = r * 2 * math.pi

area = ('%03.6f' % area)
circumference = ('%03.6f' % circumference)

print(area),
print(circumference)
Buggy python submission (verdict: Runtime Error):
import sys


def main():
    for line in sys.stdin.readlines():
        a,b = [int(n) for n in line]
        ret = a + b
        print len(str(ret))


main()

Fixed submission:
import sys


def main():
    for line in sys.stdin.readlines():
        a,b = [int(n) for n in line.split()]
        ret = a + b
        print len(str(ret))


main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def solve(w, n):
    l = [i for i in range(1, w+1)]
    for _ in range(n):
        a, b = map(int, input().split(','))
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

if __name__ == '__main__':
    w = int(input())
    n = int(input())
    solve(w, n)

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


def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

    for _ in range(n):
        a, b = map(int, input().split(','))
        a -= 1
        b -= 1
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

solve()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

    for _ in range(n):
        a, b = map(int, input().split(','))
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

solve()

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


def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

    for _ in range(n):
        a, b = map(int, input().split(','))
        a -= 1
        b -= 1
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

solve()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

print(' '.join(sorted([input().split()], reverse=True)))

Fixed submission:
# -*- coding: utf-8 -*-
l = [int(e) for e in input().split()]
print(' '.join(str(e) for e in sorted(l, reverse=True)))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')


if __name__ == '__main__':
    while True:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]

        if a and b:
            main(a, b)
        else:
            exit()

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


def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')

while True:
    try:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]
    except:
        break

    main(a, b)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

DICT = {k: 0 for k in range(0, 10)}


def solve(d):
    l = []
    _max = max(d.values())
    for k, v in d.items():
        if _max == v:
            l.append(k)
    print('\n'.join(l))

if __name__ == '__main__':
    while True:
        try:
            n = int(input())
            DICT[n] += 1
        except:
            break

    solve(DICT)

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

DICT = {k: 0 for k in range(1, 101)}


def solve(d):
    _max = max(d.values())
    for k, v in sorted(d.items()):
        if _max == v:
            print(k)

if __name__ == '__main__':
    while True:
        try:
            n = int(input())
            DICT[n] += 1
        except:
            break

    solve(DICT)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def sum_and_average(_input):
    _sum_list = []
    _avg_list = []

    while 1:
        try:
            _sum, _avg = [int(e) for e in _input]
            _sum_list.append(_sum)
            _avg_list.append(_avg)
        except EOFError:
            break
    return sum(_sum_list), (sum(_avg_list) / len(_avg_list))

if __name__ == '__main__':
    _sum, _avg = sum_and_average(input().split())
    print(round(_sum, 1), round(_avg, 1))

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

_sum = 0
_avg = 0
n = 0


while 1:
    try:
        _s, _a = [int(e) for e in input().split(',')]
        _sum += _s * _a
        _avg += _a
        n += 1
    except:
        print(_sum)
        print(int(_avg / n + 0.5))
        break

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def sum_and_average():
    _sum_list = []
    _avg_list = []

    while 1:
        try:
            _sum, _avg = [int(e) for e in input().split()]
            _sum_list.append(_sum)
            _avg_list.append(_avg)
        except EOFError:
            break
    return sum(_sum_list), (sum(_avg_list) / len(_avg_list))

if __name__ == '__main__':
    _sum, _avg = sum_and_average()
    print(round(_sum, 1), round(_avg, 1))

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

_sum = 0
_avg = 0
n = 0


while 1:
    try:
        _s, _a = [int(e) for e in input().split(',')]
        _sum += _s * _a
        _avg += _a
        n += 1
    except:
        print(_sum)
        print(int(_avg / n + 0.5))
        break

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


_sum_list = []
_avg_list = []

while 1:
    try:
        _sum, _avg = [int(e) for e in input().split()]
        _sum_list.append(_sum)
        _avg_list.append(_avg)
    except EOFError:
        break


_sum, _avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
print(round(_sum, 1), round(_avg, 1))

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

_sum = 0
_avg = 0
n = 0


while 1:
    try:
        _s, _a = [int(e) for e in input().split(',')]
        _sum += _s * _a
        _avg += _a
        n += 1
    except:
        print(_sum)
        print(int(_avg / n + 0.5))
        break

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []

while 1:
    try:
        _sum, _avg = [int(e) for e in input().split()]
        _sum_list.append(_sum)
        _avg_list.append(_avg)
    except:
        break


_sum, _avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
print(round(_sum, 1), round(_avg, 1))

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

_sum = 0
_avg = 0
n = 0


while 1:
    try:
        _s, _a = [int(e) for e in input().split(',')]
        _sum += _s * _a
        _avg += _a
        n += 1
    except:
        print(_sum)
        print(int(_avg / n + 0.5))
        break
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def judge_class(s):
    if s <= 48.00:
        return 'light fly'
    elif 48.00 < s <= 51.00:
        return 'fly'
    elif 51.00 < s <= 54.00:
        return 'bantam'
    elif 54.00 < s <= 57.00:
        return 'feather'
    elif 57.00 < s <= 60.00:
        return 'light'
    elif 60.00 < s <= 64.00:
        return 'light welter'
    elif 64.00 < s <= 69.00:
        return 'welter'
    elif 69.00 < s <= 75.00:
        return 'light middle'
    elif 75.00 < s <= 81.00:
        return 'middle'
    elif 81.00 < s <= 91.00:
        return 'light heavy'
    elif 91.00 <= s:
        return 'heavy'


if __name__ == '__main__':
    s = input()
    print(judge_class(s))

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


def judge_class(s):
    if s <= 48.00:
        return 'light fly'
    elif 48.00 < s <= 51.00:
        return 'fly'
    elif 51.00 < s <= 54.00:
        return 'bantam'
    elif 54.00 < s <= 57.00:
        return 'feather'
    elif 57.00 < s <= 60.00:
        return 'light'
    elif 60.00 < s <= 64.00:
        return 'light welter'
    elif 64.00 < s <= 69.00:
        return 'welter'
    elif 69.00 < s <= 75.00:
        return 'light middle'
    elif 75.00 < s <= 81.00:
        return 'middle'
    elif 81.00 < s <= 91.00:
        return 'light heavy'
    elif 91.00 <= s:
        return 'heavy'


while True:
    try:
        weight = float(input())
        print(judge_class(weight))
    except:
        break
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
 
def main(n):
    lst = []
    lst.append(1)
    lst.append(1)
    for i in range(2, n + 1):
        lst[i] = lst[i - 1] + lst[i - 2]
    return lst[n]
 

if __name__ == '__main__': 
    n = int(input())
    print(main(n))

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


def main(n):
    lst = [1, 1]
    for i in range(2, n + 1):
        lst.append(lst[i - 1] + lst[i - 2])
    return lst[n]


if __name__ == '__main__':
    n = int(input())
    print(main(n))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


a = [e for e in input().split()]
l = []
i = 0


for x in a:

    if x not in ['+', '-', '*']:
        x = int(x)
        l.append(x)
    else:
        a = l.pop(i)
        b = l.pop(i)

        if x == '+':
            l.append(a + b)
        elif x == '-':
            l.append(a - b)
        elif x == '*':
            l.append(a * b)

        i += 1


print(sum(l))

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


a = [e for e in input().split()]
# a = ['1', '2', '+', '3', '4','-', '*']
# a = ['1', '2', '+']
l = []


for x in a:

    if x not in ['+', '-', '*']:
        x = int(x)
        l.append(x)
    else:
        a = l.pop()
        b = l.pop()

        if x == '+':
            l.append(b + a)
        elif x == '-':
            l.append(b - a)
        elif x == '*':
            l.append(b * a)


print(sum(l))
Buggy python submission (verdict: Runtime Error):
# encording: utf-8

n = int(input())
ns = [int(input()) for _ in range(n)]
q = int(input())
qs = [int(input()) for _ in range(n)]


def main(ns, qs):
    total = 0
    for q in qs:
        if q in ns:
            total += 1
    return total


print(main(ns, qs))

Fixed submission:
# encording: utf-8

_ = int(input())
ns = [int(e) for e in input().split()]
_ = int(input())
qs = [int(e) for e in input().split()]


def main(ns, qs):
    total = 0
    for q in qs:
        if q in ns:
            total += 1
    return total


print(main(ns, qs))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


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


def main():
    n = int(input())
    A = [int(e) for e in input().split()]
    p = 0
    r = len(A) - 1
    idx = partition(A, p, r)
    A[idx] = "[%s]" % A[idx]
    return " ".join(A)

main()

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


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


if __name__ == '__main__':
    n = int(input())
    ns = [int(e) for e in input().split()]
    # n = 12
    # ns = [13, 19, 9, 5, 12, 8, 7, 4, 21, 2, 6, 11]
    r = len(ns) - 1
    idx, ns = partition(ns, 0, r)
    ns = [str(n) for n in ns]
    ns[idx] = '[{}]'.format(ns[idx])
    print(" ".join(ns))
Buggy python submission (verdict: Runtime Error):
def solve(h, w):
    if h == 0 and w == 0:
        return None

    a, b = '#', '.'

    for i in range(h):
        row = ''
        flag = True if i % 2 == 0 else False
        for j in range(w):
            if flag:
                row += a
            else:
                row += b
            flag = not flag
        print(row)
    print('')


if __name__ == '__main__':
    _input = map(int, input().split())

    for h, w in _input:
        solve(h, w)

Fixed submission:
def solve(h, w):
    a, b = '#', '.'

    for i in range(h):
        row = ''
        flag = True if i % 2 == 0 else False
        for j in range(w):
            if flag:
                row += a
            else:
                row += b
            flag = not flag
        print(row)
    print('')


if __name__ == '__main__':
    # _input = [
    #     (3, 4),
    #     (5, 6),
    #     (3, 3),
    #     (0, 0)
    # ]
    while True:
        h, w = map(int, input().split())
        if h == 0 and w == 0:
            break
        solve(h, w)
Buggy python submission (verdict: Runtime Error):
while True:
    n, r = map(int, input().split())
    if n == 0 and r == 0:
        break

    l = []
    for i in range(1, n + 1):
        l.append(i)

    for i in range(0, r):
        p, c = map(int, input().split())
        tmp = l[len(l) - p + 1:len(l)]
        del l[len(l) - p + 1:len(l)]
        l[len(l) - c:len(l) - c] = tmp

    print(l[len(l) - 1])

Fixed submission:
while True:
    n, r = map(int, raw_input().split())
    if n == 0 and r == 0:
        break

    l = range(n, 0, -1)

    for i in range(r):
        tmp = []
        p, c = map(int, raw_input().split())
        for j in range(c):
            tmp.append(l.pop(p - 1))
        l = tmp + l
    print l[0]
Buggy python submission (verdict: Runtime Error):
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]


def dfs(x, y, cnt):
    global board, W, H, ans
    if ans <= cnt:
        return

    for i in range(4):
        mx, my = x, y
        mx += dx[i]
        my += dy[i]

        if 0 > mx or 0 > my or W <= mx or H <= my:
            continue
        if board[my][mx] == 1:
            continue

        while True:
            if board[my][mx] == 3:
                ans = cnt
                return

            mx += dx[i]
            mx += dy[i]

            if 0 > mx or 0 > my or W <= mx or H <= my:
                break

            if board[my][mx] == 1:
                board[my][mx] = 0
                dfs(mx - dx[i], my - dy[i], cnt + 1)
                board[my][mx] = 1
                break

while True:
    W, H = map(int, raw_input().split())
    if W == 0:
        break

    ans = 11
    board = [map(int, raw_input().split()) for _ in range(H)]
    for y in range(H):
        for x in range(W):
            if board[y][x] == 2:
                sx, xy = x, y
    dfs(sx, sy, 1)
    print ans if ans < 11 else - 1

# dxy = zip([1,0,-1,0],[0,1,0,-1])
# def rec(x,y,t):
#     global ans
#     if t >= ans: return
#     for dx,dy in dxy:
#         nx,ny = x+dx,y+dy
#         while 0 <= nx < W and 0 <= ny < H:
#             if   field[ny][nx] == 3: ans = t
#             elif field[ny][nx] == 1:
#                 if abs(nx-x)+abs(ny-y) == 1: break
#                 field[ny][nx] = 0
#                 rec(nx-dx,ny-dy,t+1)
#                 field[ny][nx] = 1
#                 break
#             nx += dx; ny += dy
 
# while True:
#     W, H = map(int, raw_input().split())
#     if W == 0:
#         break

#     field = [map(int, raw_input().split()) for _ in range(H)]
#     for y in range(H):
#         for x in range(W):
#             if field[y][x] == 2:
#                 sx, sy = x, y
#     ans = 11
#     rec(sx, sy, 1)
#     print ans if ans < 11 else -1

Fixed submission:
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]


def dfs(x, y, cnt):
    global board, W, H, ans
    if cnt >= ans:
        return

    for i in range(4):
        mx = x + dx[i]
        my = y + dy[i]

        if 0 > mx or 0 > my or W <= mx or H <= my:
            continue
        if board[my][mx] == 1:
            continue

        while True:
            if board[my][mx] == 3:
                ans = cnt
                return

            mx += dx[i]
            my += dy[i]

            if 0 > mx or 0 > my or W <= mx or H <= my:
                break

            if board[my][mx] == 1:
                board[my][mx] = 0
                dfs(mx - dx[i], my - dy[i], cnt + 1)
                board[my][mx] = 1
                break

while True:
    W, H = map(int, raw_input().split())
    if W == 0:
        break

    ans = 11
    board = [map(int, raw_input().split()) for _ in range(H)]
    for y in range(H):
        for x in range(W):
            if board[y][x] == 2:
                sx, sy = x, y
    dfs(sx, sy, 1)
    print ans if ans < 11 else - 1
Buggy python submission (verdict: Runtime Error):
vx = [1, -1, 0, 0, 1, 1, -1, -1]
vy = [0, 0, 1, -1, 1, -1, 1, -1]


def dfs(col, row):
    c[col][row] = 0
    for x, y in zip(vx, vy):
        ny = col + y
        nx = row + x
        if nx < 0 or ny < 0 or nx >= w or ny >= h:
            continue
        if c[ny][nx] == 0:
            continue
        dfs(ny, nx)

while True:
    w, h = map(int, raw_input().split())
    if w == 0:
        break

    c = []
    for _ in range(h):
        c.append(map(int, raw_input().split()))

    cnt = 0

    for col in range(h):
        for row in range(w):
            if c[col][row] == 1:
                cnt += 1
                dfs(col, row)
    print cnt

Fixed submission:
import sys
sys.setrecursionlimit(100000)

vx = [1, -1, 0, 0, 1, 1, -1, -1]
vy = [0, 0, 1, -1, 1, -1, 1, -1]


def dfs(x, y):
    c[y][x] = 0
    for dx, dy in zip(vx, vy):
        nx = x + dx
        ny = y + dy
        if nx < 0 or ny < 0 or nx >= w or ny >= h:
            continue
        if c[ny][nx] == 0:
            continue
        dfs(nx, ny)

while True:
    w, h = map(int, raw_input().split())
    if w == 0:
        break

    c = []
    for _ in range(h):
        c.append(map(int, raw_input().split()))

    cnt = 0

    for y in range(h):
        for x in range(w):
            if c[y][x] == 1:
                cnt += 1
                dfs(x, y)
    print cnt

Buggy python submission (verdict: Runtime Error):
vx = [1, -1, 0, 0, 1, 1, -1, -1]
vy = [0, 0, 1, -1, 1, -1, 1, -1]


def dfs(col, row):
    c[col][row] = 0
    for x, y in zip(vx, vy):
        ny = col + y
        nx = row + x
        if nx < 0 or ny < 0 or nx >= w or ny >= h:
            continue
        if c[ny][nx] == 0:
            continue
        dfs(ny, nx)

while True:
    w, h = map(int, raw_input().split())
    if w == 0:
        break

    c = []
    for _ in range(h):
        c.append(map(int, raw_input().split()))

    cnt = 0

    for col in range(h):
        for row in range(w):
            if c[col][row] == 1:
                cnt += 1
                dfs(col, row)
    print cnt

Fixed submission:
import sys
sys.setrecursionlimit(100000)

vx = [1, -1, 0, 0, 1, 1, -1, -1]
vy = [0, 0, 1, -1, 1, -1, 1, -1]


def dfs(x, y):
    c[y][x] = 0
    for dx, dy in zip(vx, vy):
        nx = x + dx
        ny = y + dy
        if nx < 0 or ny < 0 or nx >= w or ny >= h:
            continue
        if c[ny][nx] == 0:
            continue
        dfs(nx, ny)

while True:
    w, h = map(int, raw_input().split())
    if w == 0:
        break

    c = []
    for _ in range(h):
        c.append(map(int, raw_input().split()))

    cnt = 0

    for y in range(h):
        for x in range(w):
            if c[y][x] == 1:
                cnt += 1
                dfs(x, y)
    print cnt