Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
while True:
    H,W = [int(i) for in input().split()]
    if H == 0 and W == 0:
        break
    else:
        for line in list(range(1,H+1,1)):
            for column in list(range(1,W+1,1)):
                if line == 1 or line == H:
                    if column == W:
                        print("#")
                    else:
                        print("#", end = "")

                else:
                    if column == 1:
                        print("#", end = "")
                    elif column == W:
                        print("#")
                    else:
                        print(".", end = "")
        print("")


Fixed submission:
while True:
    H,W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    else:
        for line in list(range(1,H+1,1)):
            for column in list(range(1,W+1,1)):
                if line == 1 or line == H:
                    if column == W:
                        print("#")
                    else:
                        print("#", end = "")

                else:
                    if column == 1:
                        print("#", end = "")
                    elif column == W:
                        print("#")
                    else:
                        print(".", end = "")
        print("")
Buggy python submission (verdict: Runtime Error):
sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum-1):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hCard = 0
cCard = 0
dCard = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        sLack = sLack + 1
    elif hCard[cardLoop] == 0:
        hLack = hLack +1
    elif cCard[cardLoop] == 0:
        cLack = cLack +1    
    elif dCard[cardLoop] == 0:
        dLack = dLack +1

print("S " + str(sLack))
print("H " + str(hLack))
print("C " + str(cLack))
print("D " + str(dLack))


Fixed submission:
sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hLack = 0
cLack = 0
dLack = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        print("S " + str(cardLoop+1))
for cardLoop in range(13):
    if hCard[cardLoop] == 0:
        print("H " + str(cardLoop+1))
for cardLoop in range(13):
    if cCard[cardLoop] == 0:
        print("C " + str(cardLoop+1))
for cardLoop in range(13):
    if dCard[cardLoop] == 0:
        print("D " + str(cardLoop+1))
Buggy python submission (verdict: Runtime Error):
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(columnNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])


Fixed submission:
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(rowNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])

Buggy python submission (verdict: Runtime Error):
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(columnNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])


Fixed submission:
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(rowNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])
Buggy python submission (verdict: Runtime Error):
midScore =[0]*50
finScore = [0]*50
reScore = [0]*50
personNum = 0
while True:
    m,f,r = map(int,input().split())
    midScore[personNum] = m
    finScore[personNum] = f
    reScore[personNum] = r
    personNum += 1
    if m is f is r is -1:
        break
    
    
for person in range(personNum):
    totalScore = midScore[person] + finScore[person]
    if midScore[person] is finScore[person] is reScore[person] is -1:
        pass
    elif midScore[person] == -1 or finScore[person] == -1:
        print("F")
    elif 80<=totalScore:
        print("A")
    elif 65<=totalScore<80:
        print("B")
    elif 50<=totalScore<65:
        print("C")
    elif 30<=totalScore<50:
        if 50<=reScore:
            print("C")
        else:
            print("D")
    elif totalScore<30:
        print("F")


Fixed submission:
midScore =[0]*50
finScore = [0]*50
reScore = [0]*50
personNum = 0
while True:
    m,f,r = map(int,input().split())
    midScore[personNum] = m
    finScore[personNum] = f
    reScore[personNum] = r
    personNum += 1
    if m is f is r is -1:
        break
    
    
for person in range(personNum):
    totalScore = midScore[person] + finScore[person]
    if midScore[person] is finScore[person] is reScore[person] is -1:
        pass
    elif midScore[person] == -1 or finScore[person] == -1:
        print("F")
    elif 80<=totalScore:
        print("A")
    elif 65<=totalScore<80:
        print("B")
    elif 50<=totalScore<65:
        print("C")
    elif 30<=totalScore<50:
        if 50<=reScore[person]:
            print("C")
        else:
            print("D")
    elif totalScore<30:
        print("F")
Buggy python submission (verdict: Runtime Error):
class Stack:
    data_list = []
    def push(self, a):
        self.data_list.append(a)
    def pop(self):
        return self.data_list.pop()

data = input()
lines = data.strip().split()
stack = Stack()
for line in lines:
    if line == '+':
        num = int(stack.pop()) + int(stack.pop())
        stack.push(num)
    elif line == '-':
        num = int(stack.pop()) - int(stack.pop())
        stack.push(-1*num)
    elif line == '*':
        num = int(stack.pop()) * int(stack.pop())
        stack.push(num)
    else:
        stack.push(line)

print(stack.pop())


Fixed submission:
class Stack:
    data_list = []
    def push(self, a):
        self.data_list.append(a)
    def pop(self):
        return self.data_list.pop()

data = input()
lines = data.strip().split()
stack = Stack()
for line in lines:
    if line == '+':
        num = int(stack.pop()) + int(stack.pop())
        stack.push(num)
    elif line == '-':
        num = int(stack.pop()) - int(stack.pop())
        stack.push(-1*num)
    elif line == '*':
        num = int(stack.pop()) * int(stack.pop())
        stack.push(num)
    else:
        stack.push(line)

print(stack.pop())
Buggy python submission (verdict: Runtime Error):
x1,y1,x2,y2 = map(int,input().split())
print(((x1-x2)**2+(y1-y2)**2)**0.5)


Fixed submission:
x1,y1,x2,y2 = map(float,input().split())
print(((x1-x2)**2+(y1-y2)**2)**0.5)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,l = map(int,input().split())
a = np.array([list(map(int,input().split())) for i in range(n)])
b = np.array([list(map(int,input().split())) for i in range(m)])
c = np.dot(a,b)
for i in range(n):
    for j in range(n):
        if j == n-1:print(c[i][j])
        else:print(c[i][j],end=" ")


Fixed submission:
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += a[i][k]*b[k][j]
        if j==l-1:print(sum)
        else:print(sum,end=" ")

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    for j in range(n):
        sum = 0
        for k in range(m):
            sum += a[i][k]*b[k][j]
        if j==n-1:print(sum)
        else:print(sum,end=" ")


Fixed submission:
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += a[i][k]*b[k][j]
        if j==l-1:print(sum)
        else:print(sum,end=" ")
Buggy python submission (verdict: Runtime Error):
ans = [0 for i in range(23)]
S = list(map(ord,input().upper()))
S = [e for e in S if 64<e<91]
print(S)
for i in S:
    ans[i-65]+=1
for i in range(26):
    print("{} : {}".format(chr(97+i),ans[i]))


Fixed submission:
import sys
input_str = sys.stdin.read()
table = [0]*26
letters = "abcdefghijklmnopqrstuvwxyz"
for A in input_str:
    index = 0
    for B in letters:
        if A == B or A == B.upper():
            table[index] += 1
            break
        index += 1
for i in range(len(letters)):
    print("{} : {}".format(letters[i],table[i]))

Buggy python submission (verdict: Runtime Error):
ans = [0 for i in range(26)]
while True:
    a = input().upper()
    if a == "":break
    S = list(map(ord,a))
    S = [e for e in S if 64<e<91]
    for i in S:
        ans[i-65]+=1
for i in range(26):
    print("{} : {}".format(chr(97+i),ans[i]))


Fixed submission:
import sys
input_str = sys.stdin.read()
table = [0]*26
letters = "abcdefghijklmnopqrstuvwxyz"
for A in input_str:
    index = 0
    for B in letters:
        if A == B or A == B.upper():
            table[index] += 1
            break
        index += 1
for i in range(len(letters)):
    print("{} : {}".format(letters[i],table[i]))
Buggy python submission (verdict: Time Limit Exceeded):
def InputData():
    
    sequence_len = int(input())
    sequence = [None] + [int(a) for a in input().split(" ")]

    return sequence_len, sequence

def bubbleSort(A):
    cnt = 0
    for i in range(len(A)-1):
        for j in range(len(A)-1, i+1, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    
    return cnt

def PrintOut(cnt):
    print(cnt)

def main():
    [sequence_len, sequence] = InputData()
    cnt = bubbleSort(sequence)
    PrintOut(cnt)

if __name__=="__main__":
    main()


Fixed submission:
def InputData():
    
    sequence_len = int(input())
    sequence = [int(a) for a in input().split(" ")]

    return sequence_len, sequence

def bubbleSort(A):
    cnt = 0
    for i in range(len(A)-1):
        for j in range(len(A)-1, i+1, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    
    return cnt

def merge(sequence, left, mid, right):
    global merge_cnt
    n1 = mid - left
    n2 = right - mid
    sequence_left = sequence[left:left + n1]
    sequence_right = sequence[mid:mid + n2]
    sequence_left.append(float('inf'))
    sequence_right.append(float('inf'))

    left_cnt = 0
    right_cnt = 0
    for i in range(left, right):
        if sequence_left[left_cnt] <= sequence_right[right_cnt]:
            # print(sequence_left[left_cnt])
            sequence[i] = sequence_left[left_cnt]
            left_cnt += 1
        else:
            # print(sequence_right[right_cnt])
            sequence[i] = sequence_right[right_cnt]
            right_cnt += 1
            merge_cnt += n1 - left_cnt

def mergeSort(sequence, left, right):
    if left + 1 < right:
        # print(merge_cnt)
        mid = (left + right) // 2
        mergeSort(sequence, left, mid)
        mergeSort(sequence, mid, right)
        merge(sequence, left, mid, right)

def PrintOut(cnt):
    print(cnt)

def main():
    [sequence_len, sequence] = InputData()
    # cnt = bubbleSort(sequence)
    global merge_cnt
    merge_cnt = 0
    mergeSort(sequence, 0, sequence_len)
    PrintOut(merge_cnt)

if __name__=="__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
x1, y1, x2, y2 = map(int, input().split())
print(math.sqrt((x1-x2)**2 + (y1-y2)**2))


Fixed submission:
import math
x1, y1, x2, y2 = map(float, input().split())
print(math.sqrt((x1-x2)**2 + (y1-y2)**2))

Buggy python submission (verdict: Runtime Error):
import math
x1, y1, x2, y2 = map(int, input().split())
print(math.sqrt((x1-x2)**2 + (y1-y2)**2))


Fixed submission:
import math
x1, y1, x2, y2 = map(float, input().split())
print(math.sqrt((x1-x2)**2 + (y1-y2)**2))
Buggy python submission (verdict: Runtime Error):
import sys
s = sys.stdin.read().split()
print(s[1:].split().count(s[0]))


Fixed submission:
import sys
s = input().lower()
t = sys.stdin.read().lower().split()
print(t.count(s))
Buggy python submission (verdict: Runtime Error):
s = input()
while s != "0":
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)
    s = input()



Fixed submission:
s = input()
while s != "-":
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)
    s = input()
Buggy python submission (verdict: Runtime Error):
s = input()
n = int(input())
for i in range(n):
    t = input().split()
    cmd, a, b = t[0], int(t[1]), int(t[2])
    if cmd == "print":
        print(s[a:b+1])
    elif cmd == "reverse":
        s = s[:a] + s[a:b].reverse() + s[b:]
    else:
        s = s[:a] + t[3] + s[b:]


Fixed submission:
s = input()
n = int(input())
for i in range(n):
    t = input().split()
    cmd, a, b = t[0], int(t[1]), int(t[2])
    if cmd == "print":
        print(s[a:b+1])
    elif cmd == "reverse":
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]
    else:
        s = s[:a] + t[3] + s[b+1:]
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    c = 0
    n, x= map(int, input().split())
    if n == 0 and x == 0:
        break
    for i in range(1, n + 1):
        for j in range(1, n + 1 ):
            for k in range(1, n + 1):
                if i != j and i != k and j != k and i + j + k == x:
                    c += 1
    print(c // 6)


Fixed submission:
while True:
    c = 0
    n, x= map(int, input().split())
    if n == 0 and x == 0:
        break
    for i in range(1, n + 1):
        for j in range(1, n + 1 ):
            if j <= i:
                continue
            for k in range(1, n + 1):
                if k <= j:
                    continue
                if i != j and i != k and j != k and i + j + k == x:
                    c += 1
    print(c)
Buggy python submission (verdict: Runtime Error):
while True:
    s = input()
    if s == "0":
        break
    a = 0
    for i in s:
        a += int(s[i])


Fixed submission:
while True:
    s = input()
    if s == "0":
        break
    a = 0
    for i,j in enumerate(s):
        a += int(s[i])
    print(a)

Buggy python submission (verdict: Runtime Error):
while True:
    s = input()
    if s == "0":
        break
    a = 0
    for i in s:
        a += int(s[i])
    print(a)



Fixed submission:
while True:
    s = input()
    if s == "0":
        break
    a = 0
    for i,j in enumerate(s):
        a += int(s[i])
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    dictionary = []
    for _ in range(int(input())):
        command = input().split()
        if command[0] == 'insert':
            dictionary.append(command[1])
        else:
            print('yes' if command[1] in dictionary else 'no')


if __name__ == '__main__':
    main()



Fixed submission:
def main():
    dictionary = set()
    for _ in range(int(input())):
        command = input().split()
        if command[0] == 'insert':
            dictionary.add(command[1])
        else:
            print('yes' if command[1] in dictionary else 'no')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = map(lambda x: int(x), input().split())
    w = [int(input()) for _ in range(n)]
    cumulative_sum = [0]
    for i in w:
        cumulative_sum.append(cumulative_sum[-1] + i)
    p = max(max(w), sum(w)//k)
    while True:
        left_track = k
        capacity = 0
        for weight in w:
            if capacity + weight <= p:
                capacity += weight
            else:
                left_track -= 1
                capacity = weight
                if left_track == 0:
                    p += 1
                    break
        else:
            break
    print(p)


if __name__ == '__main__':
    main()



Fixed submission:
import bisect


def main():
    n, k = map(lambda x: int(x), input().split())
    w = [int(input()) for _ in range(n)]

    cumulative_sum = [0]
    for weight in w:
        cumulative_sum.append(cumulative_sum[-1] + weight)
    p_min, p_max = max(w), cumulative_sum[-1]

    while p_min != p_max:
        p_mid = (p_min + p_max) // 2
        left_track = k
        index = 1
        while left_track > 0:
            left_track -= 1
            index = bisect.bisect_right(cumulative_sum, cumulative_sum[index-1] + p_mid)
            if index == len(cumulative_sum):
                break
        else:
            p_min = p_mid+1
            continue
        p_max = p_mid

    print(p_min)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
while True:
    x, y = [int(i) for i in sys.stdin.readline().split(' ')]
    if x == 0 & y == 0:
        break
    elif x <= y:
        print(x, y)
    else:
        print(y, x)


Fixed submission:
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 and y == 0:
            break
        elif x <= y:
            print(x, y)
        else:
            print(y, x)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())

tmp =  [input().split() for i in range(n)]
a = [[name,int(time)] for name,time in tmp]

total_time = 0

count = 0
while(a):
    current = a.pop 
    if(current[1] > q):
        current[1] -= q
        a.append(current)
        total_time += q
    else:
        total_time += current[1]
        print(current[0],total_time,sep = " ")


Fixed submission:
n,q = map(int,input().split())

tmp =  [input().split() for i in range(n)]
a = [[name,int(time)] for name,time in tmp]

total_time = 0

count = 0
while(a):
    current = a.pop(0)
    if(current[1] > q):
        current[1] -= q
        a.append(current)
        total_time += q
    else:
        total_time += current[1]
        print(current[0],total_time,sep = " ")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input.split())
if a < b < c:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())
if a < b < c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
while 1:
    a = list(map(int, input().split()))
    if a == 0 and b == 0:
        break
    print(min(a), max(a))


Fixed submission:
while 1:
    a = list(map(int, input().split()))
    if a[0] or a[1]:
        print(min(a), max(a))
    else:
        break
Buggy python submission (verdict: Runtime Error):
pi = 3.141592653589793

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


Fixed submission:
pi = 3.141592653589793

r = float(input())
print("%.6f %.6f" % (pi * r ** 2, 2 * pi * r))
Buggy python submission (verdict: Runtime Error):
s = input("")
ans = s * s * s
print(ans)


Fixed submission:
user = input("")
num = int(user)
ans = num * num * num
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

count = 0

for num in num_list:
    if num != 1:
        for i in range(2, num-1)
            if num % i == 0:
                continue
    count += 1

print count

Fixed submission:
import sys
import math

count = 0

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

for num in num_list:
        flag = 0
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

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

count = 0
judge = 0

for line in sys.stdin.readlines():
    num = int(line.strip())
    if judge == 0:
        judge = 1
    else:    
        flag = 0
        for i in range(2, sqrt(num) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

Fixed submission:
import sys
import math

count = 0

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

for num in num_list:
        flag = 0
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

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

count = 0
judge = 0

for line in sys.stdin.readlines():
    num = int(line.strip())
    if judge == 0:
        judge = 1
    else:    
        flag = 0
        for i in range(2, math.sqrt(num) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

Fixed submission:
import sys
import math

count = 0

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

for num in num_list:
        flag = 0
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math

count = 0

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

for num in num_list:
        flag = 0
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = 1
    #            break
        if flag == 0:
            count += 1

print count

Fixed submission:
import sys
import math

count = 0

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

for num in num_list:
        flag = 0
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count