Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = input().split()

if x + r > W or y + r > H or x - r < 0 or y - r < 0:
    print("No")
else :
    print("Yes")

Fixed submission:
W, H, x, y, r = [int(i) for i in input().split()]

if x + r > W or y + r > H or x - r < 0 or y - r < 0:
    print("No")
else :
    print("Yes")
Buggy python submission (verdict: Runtime Error):
r = int(input())
pi = 3.14159265
print("{:.6f} {:.6f}".format(pi * r * r, 2 * pi * r))

Fixed submission:
import math
r = float(input())
print("{:.6f} {:.6f}".format(math.pi * r *r, 2 * math.pi * r))
Buggy python submission (verdict: Runtime Error):
house = {1:[[0 for i in range(10)] for j in range(3)], 2:[[0 for i in range(10)] for j in range(3)],
         3:[[0 for i in range(10)] for j in range(3)], 4:[[0 for i in range(10)] for j in range(3)]}
n = int(input())
for i in range(n):
    building, floor, room, people_numbers = [int(j) for j in input().split()]
    house[building][floor - 1][room - 1] = people_numbers

partition = "#"*20
for i in range(4):
    for j in range(3):
        print(" "+ *house[i + 1][j])
        if j == 2 and i != 3: print(partition)

Fixed submission:
house = {1:[[0 for i in range(10)] for j in range(3)], 2:[[0 for i in range(10)] for j in range(3)],
         3:[[0 for i in range(10)] for j in range(3)], 4:[[0 for i in range(10)] for j in range(3)]}
n = int(input())
for i in range(n):
    building, floor, room, people_numbers = [int(j) for j in input().split()]
    house[building][floor - 1][room - 1] += people_numbers

partition = "#"*20
for i in range(4):
    for j in range(3):
        tmp_list = [str(tmp) for tmp in house[i + 1][j]]
        print(" {}".format(" ".join(tmp_list)))
        if j == 2 and i != 3: print(partition)
Buggy python submission (verdict: Runtime Error):
cnt_dict = { key:0 for key in "abcdefghijklmnopqrstuvwxyz"}
string = input().lower()
for i in string:
    if i == " ": continue
    cnt_dict[i] += 1
for i in cnt_dict:
    print( i + " : " + str(cnt_dict[i]) )

Fixed submission:
import sys
alpha = "abcdefghijklmnopqrstuvwxyz"
cnt_dict = { key:0 for key in alpha}
string = sys.stdin.read().lower()
for i in alpha:
    print("{0} : {1}".format(i, string.count(i)))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    doubly_linked_list=[]
    for i in range(n):
        # organize an inputted command
        input_command = input()
        if ' ' in input_command:
            command, key = input_command.split()
        else:
            command, key = input_command, None

        # execute a command
        if command == 'insert':
            doubly_linked_list.insert(0, key)
        elif command == 'delete':
            if key in doubly_linked_list:
                doubly_linked_list.remove(key)
        elif command == 'deleteFirst':
            doubly_linked_list.pop(0)
        elif command == 'deleteLast':
            doubly_linked_list.pop()
        else:
            raise AssertionError
        #print(doubly_linked_list)

    print(' '.join(doubly_linked_list))

    return


main()


Fixed submission:
import sys
from collections import deque


def main():
    line = sys.stdin.readlines()
    deq = deque()
    for i in range(1, int(line[0]) + 1):
        input_command = line[i]

        if input_command[0] == 'i':         # 'insert index'
            deq.appendleft(input_command[7:-1])
        elif input_command[0] == 'd':
            if input_command[6] == ' ':     # 'delete index'
                key = input_command[7:-1]
                if key in deq:
                    deq.remove(key)
            elif input_command[6] == 'F':   # 'deleteFirst':
                deq.popleft()
            elif input_command[6] == 'L':   # 'deleteLast':
                deq.pop()

    print(' '.join(deq))
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())

    repo = []
    for i in range(n):
        command, acgt = input().split()
        if command[0] == 'i':
            if acgt not in repo:
                repo.append(acgt)
        elif command[0] == 'f':
            if acgt in repo:
                print('yes')
            else:
                print('no')
    return


main()


Fixed submission:
import sys

def main():
    lines = sys.stdin.readlines()
    n = int(lines[0])

    repo = {}
    for i in range(1, n + 1):
        command, acgt = lines[i].split()
        if command[0] == 'i':
            if acgt not in repo:
                repo[acgt] = 0
        elif command[0] == 'f':
            if acgt in repo:
                print('yes')
            else:
                print('no')
    return


main()

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

def main():
    lines = sys.stdin.readlines()
    n = int(lines[0])

    repo = []
    for i in range(1, n + 1):
        command, acgt = lines[i].split()
        if command[0] == 'i':
            if acgt not in repo:
                repo.append(acgt)
        elif command[0] == 'f':
            if acgt in repo:
                print('yes')
            else:
                print('no')
    return


main()


Fixed submission:
import sys

def main():
    lines = sys.stdin.readlines()
    n = int(lines[0])

    repo = {}
    for i in range(1, n + 1):
        command, acgt = lines[i].split()
        if command[0] == 'i':
            if acgt not in repo:
                repo[acgt] = 0
        elif command[0] == 'f':
            if acgt in repo:
                print('yes')
            else:
                print('no')
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
def can_load(baggages, trucks, max_load):
    truck_list = [max_load for x in range(trucks)]

    for truck in truck_list:
        while truck > 0:
            if len(baggages) == 0:
                #print(max_load,"True")
                return True
            if truck >= baggages[0]:
                truck -= baggages[0]
                baggages.pop(0)
            else:
                break
    #print(max_load, len(baggages) == 0)
    return len(baggages) == 0

def main():
    num_baggages, num_trucks = map(int, input().split())
    baggages = [int(input()) for x in range(num_baggages)]

    start = max(sum(baggages) // num_trucks, min(baggages))
    end = sum(baggages)

    while start < end:
        mid = (start + end) // 2
        if can_load(baggages[:], num_trucks, mid):
            end = mid
        else:
            start = mid + 1

    print(start)
    return


main()


Fixed submission:
import sys
def can_load(num_baggages, baggages, num_truck, max_load):
    bag_no = 0

    for i in range(num_truck):
        load_cap = max_load
        while load_cap > 0:
            if bag_no >= num_baggages:
                #print(max_load, "True")
                return True
            if load_cap >= baggages[bag_no]:
                load_cap -= baggages[bag_no]
                bag_no += 1
            else:
                break
    #print(max_load, bag_no >= num_baggages)
    return bag_no >= num_baggages

def main():
    num_baggages, num_trucks = map(int, input().split())
    baggages = tuple(map(int, sys.stdin.read().splitlines()))

    start = max(sum(baggages) // num_trucks, min(baggages))
    end = sum(baggages)

    while start < end:
        mid = (start + end) // 2
        if can_load(num_baggages, baggages, num_trucks, mid):
            end = mid
        else:
            start = mid + 1

    print(start)
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
def can_construct_q(q, array, i, sum_sofar):
    if sum_sofar == q or sum_sofar + array[i] == q:
        return True
    elif sum_sofar > q or i >= len(array) - 1:
        return False
    if can_construct_q(q, array, i + 1, sum_sofar + array[i]):
        return True
    if can_construct_q(q, array, i + 1, sum_sofar):
        return True


def main():
    input()
    array_a = list(map(int, input().split()))
    input()
    array_q = map(int, input().split())
    for q in array_q:
        if can_construct_q(q, array_a, 0, 0):
            print('yes')
        else:
            print('no')
    return


main()


Fixed submission:
def main():
    input()
    array_a = list(map(int, input().split()))
    input()
    array_q = map(int, input().split())

    def can_construct_q (q, i, sum_sofar):
        if sum_sofar == q or sum_sofar + array_a[i] == q:
            return True
        elif sum_sofar > q or i >= len (array_a) - 1:
            return False
        if can_construct_q(q, i + 1, sum_sofar + array_a[i]):
            return True
        if can_construct_q(q, i + 1, sum_sofar):
            return True
    sum_array_a = sum(array_a)
    for q in array_q:
        #print(q)
        if sum_array_a < q:
            print('no')
        elif can_construct_q(q, 0, 0):
            print('yes')
        else:
            print('no')
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    input()
    array = [int(x) for x in input().split()]
    counting_dict = {}
    for val in array:
        if val not in counting_dict:
            counting_dict[val] = [1, 0]
        count = 0
        for key in counting_dict.keys():
            if key > val:
                count += counting_dict[key][0]
        counting_dict[val][1] += count

    swaps = 0
    for value in counting_dict.values():
        swaps += value[1]
    print(swaps)

    return

main()


Fixed submission:
import sys
time_check = False
if time_check:
    import time

num_of_inversions = 0
array = [0 for x in range(200000)]

def merge(left, mid, right):
    n_fore = mid - left
    n_rear = right - mid
    l_fore = array[left:left + n_fore]
    l_fore.append(sys.maxsize)
    l_rear = array[mid:mid + n_rear]
    l_rear.append(sys.maxsize)

    i = j = 0
    global num_of_inversions

    offset = len(l_fore) - 1 + left
    for k in range(left, right):
        if l_fore[i] < l_rear[j]:
            array[k] = l_fore[i]
            i += 1
        else:
            array[k] = l_rear[j]
            num_of_inversions += j - k + offset
            #print(l_fore,l_rear, array[:23])
            #print(num_of_inversions,len(l_fore),len(l_rear),i,j,k)
            j += 1


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


def main():

    n = int(input())
    for idx, value in enumerate(input().split()):
        array[idx] = int(value)

    if time_check:
        start = time.time()

    merge_sort(0, n)

    if time_check:
        print("elapsed_time:", time.time() - start)

    #print(" ".join(map(str, array[:n])))
    print(num_of_inversions)

    return


main()
Buggy python submission (verdict: Runtime Error):
import math
import decimal
def main():
    a, b = map(int, input().split())
    decimal.getcontext().prec = int(math.log10(a)) + 1
    print(int(decimal.Decimal(a)/decimal.Decimal(b)))


main()


Fixed submission:
import decimal
def main():
    a, b = map(int, input().split())
    decimal.getcontext().prec = len(str(a))
    print(int(decimal.Decimal(a)/decimal.Decimal(b)))


main()

Buggy python submission (verdict: Runtime Error):
import math
import decimal
def main():
    a, b = map(int, input().split())
    decimal.getcontext().prec = int(math.log10(abs(a))) + 1
    print(int(decimal.Decimal(a)/decimal.Decimal(b)))


main()


Fixed submission:
import decimal
def main():
    a, b = map(int, input().split())
    decimal.getcontext().prec = len(str(a))
    print(int(decimal.Decimal(a)/decimal.Decimal(b)))


main()
Buggy python submission (verdict: Runtime Error):
print(float(input()) * float(input())


Fixed submission:
inp = input().split()
print(int(inp[0]) * int(inp[1]), int(inp[0]) + int(inp[1]) + int(inp[0]) + int(inp[1]))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    nvertices, nedges, s = map(int, input().split())
    E = []
    for i in range(nedges):
        u, v, w = map(int, input().split())
        E.append((u, v, w))

    INF = 1000000000
    d = [INF] * nvertices
    d[s] = 0
    for i in range(nvertices - 1):
        for u, v, w in E:
            if d[u] + w < d[v]:
                d[v] = d[u] + w

    for val in d:
        if val >= INF:
            print("INF")
        else:
            print(val)


main()

Fixed submission:
import heapq


def main():
    nvertices, nedges, s = map(int, input().split())
    adj = [[] for i in range(nvertices)]
    for i in range(nedges):
        u, v, w = map(int, input().split())
        adj[u].append((v, w))

    INF = float('inf')
    costs = [INF] * nvertices
    costs[s] = 0
    que = [(0, s)]
    for i in range(1, nvertices):
        que.append((INF, 1))
    cnt = 0
    while que:
        cost, u = heapq.heappop(que)
        if cost > costs[u]:
            continue
        costs[u] = cost
        for v, w in adj[u]:
            if costs[v] > costs[u] + w:
                costs[v] = costs[u] + w
                heapq.heappush(que, (costs[v], v))
        cnt += 1
        if cnt == nvertices:
            break

    for i in range(nvertices):
        print(costs[i] if costs[i] < INF else "INF")


main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
G = [[] for i in range(N)]
for nod in range(N):
    tmp = list(map(int, input().split()))
    for i in range(2, tmp[1]*2+1, 2):
        edge, cos = tmp[i], tmp[i+1]
        G[nod].append([edge, cos])



import heapq


def dijkstra(x):
    d = [float('inf')] * N
    d[x] = 0
    visited = {x}

    # d, u
    hq = [(0, x)]

    while hq:
        u = heapq.heappop(hq)[1]
        visited.add(u)

        for node, cost in G[u]:
            if (node not in visited) and d[node] > d[u] + cost:
                d[node] = d[u] + cost
                heapq.heappush(hq, (d[u]+cost, node))
    return d


distance = dijkstra(0)
#print(distance)
for i in range(N):
    print(i, distance[i])

N = int(input())
G = [[] for i in range(N)]
for nod in range(N):
    tmp = list(map(int, input().split()))
    for i in range(2, tmp[1]*2+1, 2):
        edge, cos = tmp[i], tmp[i+1]
        G[nod].append([edge, cos])



import heapq


def dijkstra(x):
    d = [float('inf')] * N
    d[x] = 0
    visited = {x}

    # d, u
    hq = [(0, x)]

    while hq:
        u = heapq.heappop(hq)[1]
        visited.add(u)

        for node, cost in G[u]:
            if (node not in visited) and d[node] > d[u] + cost:
                d[node] = d[u] + cost
                heapq.heappush(hq, (d[u]+cost, node))
    return d


distance = dijkstra(0)
#print(distance)
for i in range(N):
    print(i, distance[i])




Fixed submission:
N = int(input())
G = [[] for i in range(N)]
for nod in range(N):
    U = list(map(int, input().split()))[2:]
    G[nod] = zip(U[0::2], U[1::2])



import heapq


def dijkstra(x):
    d = [float('inf')] * N
    d[x] = 0
    visited = {x}

    # d, u
    hq = [(0, x)]

    while hq:
        u = heapq.heappop(hq)[1]
        visited.add(u)

        for node, cost in G[u]:
            if (node not in visited) and d[node] > d[u] + cost:
                d[node] = d[u] + cost
                heapq.heappush(hq, (d[u]+cost, node))
    return d


distance = dijkstra(0)
#print(distance)
for i in range(N):
    print(i, distance[i])
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
numbers = [int(input()) for i in range(N)]
ans = []

def check_prime(n):
    for i in range(2, n):
        if n % i == 0:
            return 0
    else:
        return 1
    
for n in numbers:
    ans.append(check_prime(n))

print(sum(ans))

Fixed submission:
N = int(input())
numbers = [int(input()) for i in range(N)]
ans = []

def check_prime(n):
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return 0
    else:
        return 1
    
for n in numbers:
    ans.append(check_prime(n))

print(sum(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)


BIT = BinaryIndexedTree(N)
ans = 0
for j in range(N):
    ans += j - BIT.sum(A[j])
    BIT.add(A[j], 1)
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)

    def reset(self):
        self.bit = [0] * (self.size + 1)


BIT = BinaryIndexedTree(N)

A_sorted = {a: i for i, a in enumerate(sorted(A), start=1)}
ans = 0
for j, a in enumerate(A):
    ans += j - BIT.sum(A_sorted[a])
    BIT.add(A_sorted[a], 1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)


BIT = BinaryIndexedTree(max(A))
ans = 0
for j in range(N):
    ans += j - BIT.sum(A[j])
    BIT.add(A[j], 1)
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)

    def reset(self):
        self.bit = [0] * (self.size + 1)


BIT = BinaryIndexedTree(N)

A_sorted = {a: i for i, a in enumerate(sorted(A), start=1)}
ans = 0
for j, a in enumerate(A):
    ans += j - BIT.sum(A_sorted[a])
    BIT.add(A_sorted[a], 1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    s, t = map(int, input().split())
    G[s].append(t)

ans = []
V = set()

def dfs(n):
    for e in G[n]:
        dfs(e)
    if n not in V:
        ans.append(n)
        V.add(n)


for i in range(N):
    if i not in V:
        if i not in V:
            dfs(i)

print(*ans[::-1], sep="\n")



Fixed submission:
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    s, t = map(int, input().split())
    G[s].append(t)


def topological_sort(g):
    topological_list = []
    visited = set()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.add(n)

    for i in range(len(g)):
        if i not in visited:
            dfs(i)

    return topological_list[::-1]


print(*topological_sort(G), sep="\n")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    s, t = map(int, input().split())
    G[s].append(t)

def topological_sort(g):
    topological_list　= []
    visited = set()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.add(n)

    for i in range(len(g)):
        if i not in visited:
            dfs(i)

    return topological_list[::-1]


print(*topological_sort(G), sep="\n")



Fixed submission:
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    s, t = map(int, input().split())
    G[s].append(t)


def topological_sort(g):
    topological_list = []
    visited = set()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.add(n)

    for i in range(len(g)):
        if i not in visited:
            dfs(i)

    return topological_list[::-1]


print(*topological_sort(G), sep="\n")
Buggy python submission (verdict: Runtime Error):
import math

class Point():

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

x1, y1, x2, y2 = [int(i) for i in input().split()]

point1 = Point(x1, y1)
point2 = Point(x2, y2)

x_dist = point1.x - point2.x
y_dist = point1.y - point2.y

dist = math.sqrt(x_dist ** 2 + y_dist ** 2)

print(dist)


Fixed submission:
import math

class Point():

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

x1, y1, x2, y2 = [float(i) for i in input().split()]

point1 = Point(x1, y1)
point2 = Point(x2, y2)

x_dist = point1.x - point2.x
y_dist = point1.y - point2.y

dist = math.sqrt(x_dist ** 2 + y_dist ** 2)

print(dist)
Buggy python submission (verdict: Runtime Error):
line=input().split()
x=int(line[0])
y=int(line[1])
if x<y:
    temp=x
    x=y
    y=temp
def greatst(x,y):
    if x==y:
        return x
    else:
        return greatst(y,x%y)
print(greatst(x,y))


Fixed submission:
import math
line=input().split()
x=int(line[0])
y=int(line[1])
print(math.gcd(x,y))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")


Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

Buggy python submission (verdict: Runtime Error):
a=raw_input().split()
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

Buggy python submission (verdict: Runtime Error):
a=int(input().split())
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

Buggy python submission (verdict: Runtime Error):
a=int(input()).split()
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

Buggy python submission (verdict: Runtime Error):
a=map(int,input().split())
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split)
if a<b and b<a:
    print("Yes")
else:
    print("No")
    


Fixed submission:
a,b,c=map(int,input().split())
if a<b and b<c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
number=input()
list=number.split()
list.sort()
for x in list:
    print x,


Fixed submission:
number=input()
list=number.split()
list.sort()
print(list[0]+" "+list[1]+" "+list[2])

Buggy python submission (verdict: Runtime Error):
number=input()
list=number.split()
list.sort()
print list[0]+list[1]+list[2]


Fixed submission:
number=input()
list=number.split()
list.sort()
print(list[0]+" "+list[1]+" "+list[2])