Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from heapq import heappush, heappop

inf = 1<<30

def solve():
    N, M, s = map(int, sys.stdin.readline().split())
    Adj = [[] for i in range(N)]

    for i in range(M):
        ui, vi, ci = map(int, sys.stdin.readline().split())
        Adj[ui].append((vi, ci))

    d = dijkstra(N, Adj, s)

    for di in d:
        print(di if di < inf else 'INF')

def dijkstra(N, Adj, s):
    d = [inf] * N
    d[s] = 0
    pq = [(0, s)]

    for i in range(N - 1):
        while 1:
            di, v = heappop(pq)

            if di == d[v]:
                break

        for u, c in Adj[v]:
            if d[v] + c < d[u]:
                d[u] = d[v] + c
                heappush(pq, (d[u], u))

    return d

if __name__ == '__main__':
    solve()

Fixed submission:
import sys
from heapq import heappush, heappop

inf = 1<<30

def solve():
    N, M, s = map(int, sys.stdin.readline().split())
    Adj = [[] for i in range(N)]

    for i in range(M):
        ui, vi, ci = map(int, sys.stdin.readline().split())
        Adj[ui].append((vi, ci))

    d = dijkstra(N, Adj, s)

    for di in d:
        print(di if di < inf else 'INF')

def dijkstra(N, Adj, s):
    d = [inf] * N
    d[s] = 0
    pq = [(0, s)]
    fixed = 0

    while pq:
        di, v = heappop(pq)

        if di > d[v]:
            continue

        for u, c in Adj[v]:
            if d[v] + c < d[u]:
                d[u] = d[v] + c
                heappush(pq, (d[u], u))

        fixed += 1

        if fixed == N - 1:
            break

    return d

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
import math

r = int(input())

print("{0:.8f}".format(r ** 2 * math.pi))

Fixed submission:
from math import pi

r = float(input())
print(r**2 * pi, 2 * r * pi)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
import math

r = int(input())

print("{0:.8f} {1:.8f}".format(r ** 2 * math.pi,2 * math.pi * r))

Fixed submission:
from math import pi

r = float(input())
print(r**2 * pi, 2 * r * pi)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
import math

r = int(input())

print("{0:.8f} {1:.8f}".format((r ** 2) * math.pi,2 * math.pi * r))

Fixed submission:
from math import pi

r = float(input())
print(r**2 * pi, 2 * r * pi)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
import numpy as np
N, M = map(int, input().split())

A = []
b = []

for _ in range(N):
    A.append([int(i) for i in input().split()])
    
for _ in range(M):
    b.append([int(input())])

A = np.matrix(A)
b = np.matrix(b)

c = A.dot(b)

print("\n".join([str(int(c[i])) for i in range(N)]))

Fixed submission:
# coding: utf-8
# Here your code !
N, M = map(int, input().split())

A = []
b = []

for _ in range(N):
    A.append([int(i) for i in input().split()])
    
for _ in range(M):
    b.append(int(input()))
    
for i in range(N):
    print(sum([A[i][j] * b[j] for j in range(M)]))
Buggy python submission (verdict: Runtime Error):

n, m, l = map(int, input().split())

A = []
B = []

for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    B.append([int(j) for j in input().split()])

# ??????????????????????????????B?????¢??????????????¨???????????????
B_T = list(map(list, zip(*B)))

C = [[0 for i in range(n)] for j in range(l)]

for i in range(n):
    for j in range(l):
        C[i][j] = sum([a * b for (a, b) in zip(A[i], B_T[j])])

for i in range(n):
    print(*C[i])

Fixed submission:

n, m, l = map(int, input().split())

A = []
B = []

for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    B.append([int(j) for j in input().split()])

# ??????????????????????????????B?????¢??????????????¨???????????????
B_T = list(map(list, zip(*B)))

C = [[0 for j in range(l)] for i in range(n)]

for i in range(n):
    for j in range(l):
        C[i][j] = sum([a * b for (a, b) in zip(A[i], B_T[j])])

for i in range(n):
    print(*C[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys

mod = 10**9 + 7

def solve():
    m, n = map(int, input().split())

    ans = modpow(m, n, mod)

    print(ans)

def modpow(x, y, mod):
    res = 1

    while y:
        if y & 1:
            res = (res * x) % mod

        x *= x
        y >>= 1

    return res

if __name__ == '__main__':
    solve()

Fixed submission:
import sys

mod = 10**9 + 7

def solve():
    m, n = map(int, input().split())
    print(pow(m, n, mod))

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
from math import gcd
from functools import reduce

def solve():
    n = int(input())
    a = [int(i) for i in input().split()]

    ans = reduce(lcm, a, 1)

    print(ans)

def lcm(a, b):
    return a * b // gcd(a, b)

if __name__ == '__main__':
    solve()

Fixed submission:
import sys
from fractions import gcd
from functools import reduce

def solve():
    n = int(input())
    a = [int(i) for i in input().split()]

    ans = reduce(lcm, a, 1)

    print(ans)

def lcm(a, b):
    return a * b // gcd(a, b)

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
menseki=a*b
syu=a*2+b*2
print(menseki,syu)

Fixed submission:
l = 0
l = input().split()
men = 0
syu = 0
unko = int(l[0])
tinko = int(l[1])
men = unko*tinko
syu = unko*2+tinko*2
print(men,syu)
Buggy python submission (verdict: Runtime Error):
def main():
    while True:
        n = int(input())
        if n:
            aa,ba = 0,0
            a,b = [None]*n,[None]*n
            for i in range(n):
                a[i],b[i] = map(int, input().split())
                if a[i] > b[i]:
                    aa += (a[i]+b[i])
                elif a[i] < b[i]:
                    ba += (a[i]+b[i])
                else:
                    aa += a[i]
                    ba += b[i]
            print(aa,ba)
        else:
            break

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    while True:
        n = int(input())
        if n:
            aa,ba = 0,0
            a,b = [None]*n,[None]*n
            for i in range(n):
                a[i],b[i] = map(int, input().split())
                if a[i] > b[i]:
                    aa += (a[i]+b[i])
                elif a[i] < b[i]:
                    ba += (a[i]+b[i])
                else:
                    aa += a[i]
                    ba += b[i]
            print(aa,ba)
        else:
            break

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        Nu = list(map(int,input().split()))
        print(len(str(Nu[0]+Nu[1])))
    except IndexError:
        break

Fixed submission:
while True:
    try:
        a,b = map(int,input().split())
        print(len(str(a+b)))
    except EOFError:
        break

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a,b = map(int,input().split())
        print(len(str(a+b)))
    except ValueError:
        break

Fixed submission:
while True:
    try:
        a,b = map(int,input().split())
        print(len(str(a+b)))
    except EOFError:
        break
Buggy python submission (verdict: Runtime Error):
import math
while True:
    try:
        a,b = map(int,input().split())
        gcd = math.gcd(a,b)
        lcm = a*b /gcd
        print(gcd,int(lcm))
    except EOFError:
        break

Fixed submission:
while True:
    try:
        As,Bs = map(int,input().split())
        a,b = As, Bs
        while True:
            if a % b == 0:
                gcd = b
                break
            a,b = b, a % b
        print(gcd,int(As * Bs / gcd))
    except EOFError:
        break

Buggy python submission (verdict: Runtime Error):
import math
while True:
    try:
        a,b = map(int,input().split())
        gcd = math.gcd(a,b)
        lcm = a*b /gcd
        print(gcd,int(lcm))
    except (EOFError,ValueError):
        break

Fixed submission:
while True:
    try:
        As,Bs = map(int,input().split())
        a,b = As, Bs
        while True:
            if a % b == 0:
                gcd = b
                break
            a,b = b, a % b
        print(gcd,int(As * Bs / gcd))
    except EOFError:
        break
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    n = int(input())
    if n == 0:
        break
    else:
        Sum = []
        for i in range(n):
            Sum.append(int(input()))
        for i in range(2,n + 1):
            for j in range(n - i + 1):
                Wa = 0
                for k in range(j,j + i):
                    Wa += Sum[k]
                Sum.append(Wa)
        print(max(Sum))

Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    else:
        A = []
        Sum = []
        for i in range(n):
            A.append(int(input()))
        Wa = 0
        for i in range(0,n):
            Wa += A[i]
            Sum.append(Wa)
        for i in range(0 , n):
            for j in range(0 , i):
                Num = Sum[i] - Sum[j]
                Sum.append(Num)
        print(max(Sum))
Buggy python submission (verdict: Runtime Error):
kosu = [0] * 100
k = 1
while True:
    try:
        n = int(input())
        kosu[n - 1] += 1
    except (EOFError,ValueError):
        ma = max(kosu)
        num = kosu.index(ma) + k
        print(num)
        
        
        kosu.remove(max(kosu))
        while True:
            if ma > max(kosu):
                break
            k += 1
            num = kosu.index(ma) + k
            kosu.remove(max(kosu))
            print(num)

Fixed submission:
kosu = [0] * 100
k = 1
while True:
    try:
        n = int(input())
        kosu[n - 1] += 1
    except (EOFError,ValueError):
        ma = max(kosu)
        num = kosu.index(ma) + k
        print(num)
        
        
        kosu.remove(max(kosu))
        while True:
            if ma > max(kosu):
                break
            k += 1
            num = kosu.index(ma) + k
            kosu.remove(max(kosu))
            print(num)
        break
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
            
            
    except EOFError:
        break

Fixed submission:
while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
        kara = input()
            
    except EOFError:
        break
Buggy python submission (verdict: Time Limit Exceeded):
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except EOFError:
        print(P_Sum)
        print(round(N_Sum / Kazu))

Fixed submission:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except(EOFError,ValueError):
        print(P_Sum)
        print(int((N_Sum / Kazu)+ 0.5))
        break
Buggy python submission (verdict: Runtime Error):
Ans = "A"
while True:
    
    Pos = list(map(str,input().split(",")))
    if Pos == ['']:
        print(Ans)
        break
    if Ans in Pos:
        Ans = Pos[((Pos.index(Ans)) + 1) % 2]

Fixed submission:
Ans = "A"
while True:
    try:
        Pos = list(map(str,input().split(",")))
        if Pos == ['']:
            print(Ans)
            break
        if Ans in Pos:
            Ans = Pos[((Pos.index(Ans)) + 1) % 2]
    except:
        print(Ans)
        break

Buggy python submission (verdict: Runtime Error):
Ans = "A"
while True:
    try:
        if Ans in Pos:
            Ans = Pos[((Pos.index(Ans)) + 1) % 2]
    except EOFError:
         print(Ans)
            break

Fixed submission:
Ans = "A"
while True:
    try:
        Pos = list(map(str,input().split(",")))
        if Pos == ['']:
            print(Ans)
            break
        if Ans in Pos:
            Ans = Pos[((Pos.index(Ans)) + 1) % 2]
    except:
        print(Ans)
        break

Buggy python submission (verdict: Runtime Error):
Ans = "A"
while True:
    try:
        if Ans in Pos:
            Ans = Pos[((Pos.index(Ans)) + 1) % 2]
    except:
         print(Ans)
            break

Fixed submission:
Ans = "A"
while True:
    try:
        Pos = list(map(str,input().split(",")))
        if Pos == ['']:
            print(Ans)
            break
        if Ans in Pos:
            Ans = Pos[((Pos.index(Ans)) + 1) % 2]
    except:
        print(Ans)
        break
Buggy python submission (verdict: Runtime Error):
def moov(x,y):
    if (x,y) in Loc:
        return "LOOP"
    else:
        Loc.append((x,y))
        if Room[y][x] == ".":
            return str(x)+" "+str(y)
        elif Room[y][x] == ">":
            return moov(x + 1,y)
        elif Room[y][x] == "<":
            return moov(x - 1,y)
        elif Room[y][x] == "^":
            return moov(x,y - 1)
        elif Room[y][x] == "v":
            return moov(x,y + 1)
    

while True:
    Loc = []
    num = 0
    Room = []
    h,w = map(int,input().split())
    if h == w == 0:
        break
    for i in range(h):
        vec = input()
        Room.append(list(vec))
    print(moov(1,0))

Fixed submission:
def move(Tiles_map, x, y, Loop_ch):
    if [x,y] in Loop_ch:
        print("LOOP")
        return
    else:
        Loop_ch.append([x,y])

    if Tile_map[x][y] == ".":
        print(str(y) + " " + str(x))
        return
    elif Tile_map[x][y] == ">":
        move(Tiles_map, x, y+1, Loop_ch)
    elif Tile_map[x][y] == "<":
        move(Tiles_map, x, y-1, Loop_ch)
    elif Tile_map[x][y] == "v":
        move(Tiles_map, x+1, y, Loop_ch)
    elif Tile_map[x][y] == "^":
        move(Tiles_map, x-1, y, Loop_ch)

        
        
while True:
    Tile_map = []
    Loop_ch = []
    H, W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        Tiles = input()
        Tiles = list(str(Tiles))
        Tile_map.append(Tiles)
    ans = move(Tile_map,0,0,Loop_ch)

Buggy python submission (verdict: Runtime Error):
def moov(x,y):
    if (x,y) in Loc:
        return "LOOP"
    else:
        Loc.append((x,y))
        if Room[y][x] == ".":
            return str(x)+" "+str(y)
        elif Room[y][x] == ">":
            return moov(x + 1,y)
        elif Room[y][x] == "<":
            return moov(x - 1,y)
        elif Room[y][x] == "^":
            return moov(x,y - 1)
        elif Room[y][x] == "v":
            return moov(x,y + 1)
    

while True:
    Loc = []
    Room = []
    h,w = map(int,input().split())
    if h == w == 0:
        break
    for i in range(h):
        vec = input()
        Room.append(list(vec))
    print(moov(1,0))

Fixed submission:
def move(Tiles_map, x, y, Loop_ch):
    if [x,y] in Loop_ch:
        print("LOOP")
        return
    else:
        Loop_ch.append([x,y])

    if Tile_map[x][y] == ".":
        print(str(y) + " " + str(x))
        return
    elif Tile_map[x][y] == ">":
        move(Tiles_map, x, y+1, Loop_ch)
    elif Tile_map[x][y] == "<":
        move(Tiles_map, x, y-1, Loop_ch)
    elif Tile_map[x][y] == "v":
        move(Tiles_map, x+1, y, Loop_ch)
    elif Tile_map[x][y] == "^":
        move(Tiles_map, x-1, y, Loop_ch)

        
        
while True:
    Tile_map = []
    Loop_ch = []
    H, W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        Tiles = input()
        Tiles = list(str(Tiles))
        Tile_map.append(Tiles)
    ans = move(Tile_map,0,0,Loop_ch)
Buggy python submission (verdict: Runtime Error):
def nibutan(f_id,e_id,f_num,yn):
    
    
    m_id = int((f_id + e_id) / 2)
    m_num = w_lis[m_id]


    if e_id - f_id <= 1:
        if yn == 0:

            return e_id
        else:
            return f_id
    else:
        if m_num > f_num:
            return(nibutan(f_id,m_id -1,f_num,yn))
        elif m_num < f_num:
            return(nibutan(m_id + 1,e_id,f_num,yn))
        else:
            return  m_num




while True:
    global w_lis
    b_lis = []
    w_lis = []
    dan_num = [0]
    atu_num = [0]
    wa = 0
    m,n = map(int,input().split())
    if m == n == 0:
        break
    for i in range(n):
        num = int(input())
        wa += num
        b_lis.append(num)
        w_lis.append(wa)
    best_num = wa / m
    if best_num < max(b_lis):
        print(max(b_lis))
    else:
        bid = 0
        n_si = 0
        for i in range(m):
            bid = nibutan(bid,n - 1,n_si + best_num,i)
            n_si = w_lis[bid]
            dan_num.append(n_si)
            atu_num.append(n_si - dan_num[i])
            
        print(max(atu_num))
    
    
    

Fixed submission:
def hondan(w,m):
    m_sum = b_lis[0]
    num = 0
    if w < max(b_lis):
        return False
    else:
        for i in range(len(b_lis) - 1):
            m_sum += b_lis[i + 1]
            if m_sum > w:

                m_sum = b_lis[i + 1]
                num += 1

        if num < m:
            return True
        else:
            return False
        
def nibutan(f_id,e_id,m):
    
    
    m_id = int((f_id + e_id) / 2)
    m_bo = hondan(m_id,m)


    if (f_id > e_id):
        return m_id + 1
    else:
        if m_bo:
            return(nibutan(f_id,m_id -1,m))
        elif not m_bo:
            return(nibutan(m_id + 1,e_id,m))
        else:
            return m_id + 1



while True:
    global w_lis
    b_lis = []
    w_lis = []
    dan_num = [0]

    m,n = map(int,input().split())
    if m == n == 0:
        break
    for i in range(n):
        num = int(input())
        b_lis.append(num)
    s_num = int(sum(b_lis) /m)

    print(nibutan(s_num,1500000,m) )
Buggy python submission (verdict: Runtime Error):
def nibutan(f_id,e_id,f_num,count):
    
    
    m_id = int((f_id + e_id) / 2)
    m_num = n_lis[m_id]

    count += 1
    if (f_id > e_id):
        return count
    else:

        if m_num > f_num:
            return(nibutan(f_id,m_id -1,f_num,count))
        elif m_num < f_num:
            return(nibutan(m_id + 1,e_id,f_num,count))
        else:
            return count
                
while True:
    global n_lis

    n = int(input())
    if n == 0:
        break
    n_lis = []
    for i in range(n):
        n_lis.append(int(input()))
    f_n = int(input())
    ans = nibutan(0,n,f_n,0)
    print(ans)

Fixed submission:
def nibutan(f_id,e_id,f_num,count):
    
    
    m_id = int((f_id + e_id) / 2)
    m_num = n_lis[m_id]

   
    if (f_id > e_id):
        return count
    else:
        count += 1

        if m_num > f_num:
            return(nibutan(f_id,m_id -1,f_num,count))
        elif m_num < f_num:
            return(nibutan(m_id + 1,e_id,f_num,count))
        else:
            return count
                
while True:
    global n_lis

    n = int(input())
    if n == 0:
        break
    n_lis = []
    for i in range(n):
        n_lis.append(int(input()))
    f_n = int(input())
    ans = nibutan(0,n - 1,f_n,0)
    print(ans)
Buggy python submission (verdict: Runtime Error):
d,c = map(int,input(),split())
print(d * c)

Fixed submission:
d,c = map(int,input().split())
print(d * c)
Buggy python submission (verdict: Runtime Error):
moji_lis = [[".",",","!","?"," "],["a","b","c"],["d","e","f"],["g","h","i"],["j","k","l"],["m","n","o"],["p","q","r","s"],["t","u","v"],["w","x","y","z"]]
n = int(input())
for i in range(n):
    N_lis = list(input())
    N_lis = list(map(int,N_lis))
    
    a_0 = N_lis[0]
    n_num = 1
    moji = ""
    for j in range(1,len(N_lis)):

        a_1 = N_lis[j]
        
        if a_0 == a_1:
            n_num += 1
        else:
            if a_0 == 1:
                moji += moji_lis[0][(n_num - 1) % 5]
                
            elif a_0 == 6 or a_0 == 8:
                moji += moji_lis[a_0 - 1][(n_num - 1) % 4]
                
            elif a_0 != 0:
                moji += moji_lis[a_0 - 1][(n_num - 1) % 3]
                
        a_0 = a_1
        if a_1 == 0:
            n_num = 1
    print(moji)

Fixed submission:
moji_lis = [[".",",","!","?"," "],["a","b","c"],["d","e","f"],["g","h","i"],["j","k","l"],["m","n","o"],["p","q","r","s"],["t","u","v"],["w","x","y","z"]]
n = int(input())
for i in range(n):
    N_lis = list(input())
    N_lis = list(map(int,N_lis))
    
    a_0 = N_lis[0]
    n_num = 1
    moji = ""
    for j in range(1,len(N_lis)):

        a_1 = N_lis[j]
        
        if a_0 == a_1:
            n_num += 1
        else:
            if a_0 == 1:
                moji += moji_lis[0][(n_num - 1) % 5]
                
            elif a_0 == 7 or a_0 == 9:
        
                moji += moji_lis[a_0 - 1][(n_num - 1) % 4]
           
                
            elif a_0 != 0:
  
                moji += moji_lis[a_0 - 1][(n_num - 1) % 3]
                
        a_0 = a_1
        if a_1 == 0:
            n_num = 1
    print(moji)