Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
d = deque()
for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]
    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()
print(' '.join(list(d)))

Fixed submission:
from collections import deque
n = int(input())
d = deque()

for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]

    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        if ele in d:
            d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()

print(' '.join(list(d)))

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
d = deque()
for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]

    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()
print(' '.join(list(d)))

Fixed submission:
from collections import deque
n = int(input())
d = deque()

for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]

    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        if ele in d:
            d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()

print(' '.join(list(d)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input().split()
q = int(input())
T = input().split()

count = 0
for i in T:
        if i in S:
            count += 1

print(count)

Fixed submission:
n = int(input())
S = set(int(i) for i in input().split())
q = int(input())
T = set(int(i) for i in input().split())
print(len(S & T))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [int(i) for i in input().split()]
S = sorted(set(s), key=s.index)
q = int(input())
t = [int(i) for i in input().split()]
T = sorted(set(t))

count = 0
for v in T:
    if v in S:
        count += 1
        S[:] = S[S.index(v)+1:]

print(count)

Fixed submission:
n = int(input())
S = set(int(i) for i in input().split())
q = int(input())
T = set(int(i) for i in input().split())
print(len(S & T))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [int(i) for i in input().split()]
S = sorted(set(s), key=s.index)
q = int(input())
t = [int(i) for i in input().split()]
T = sorted(set(t))

copy = S[:]
count = 0
for v in T:
    S = copy[:]
    while True:
        if len(S) == 0: break
        if v == S[len(S)//2]:
            count += 1
            break
        elif v > S[len(S)//2]:
            S[:] = S[len(S)//2+1:]
        elif v < S[len(S)//2]:
            S[:] = S[:len(S)//2]

print(count)

Fixed submission:
n = int(input())
S = set(int(i) for i in input().split())
q = int(input())
T = set(int(i) for i in input().split())
print(len(S & T))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [int(i) for i in input().split()]
S = sorted(set(s), key=s.index)
q = int(input())
t = [int(i) for i in input().split()]
T = sorted(set(t))

copy = S[:]
count = 0
for v in T:
    S = copy[:]
    while True:
        if len(S) == 0: break
        if v == S[len(S)//2]:
            count += 1
            S[:] = S[S.index(v)+1:]
            break
        elif v > S[len(S)//2]:
            S[:] = S[len(S)//2+1:]
        elif v < S[len(S)//2]:
            S[:] = S[:len(S)//2]

print(count)

Fixed submission:
n = int(input())
S = set(int(i) for i in input().split())
q = int(input())
T = set(int(i) for i in input().split())
print(len(S & T))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

hash = []
for i in range(n):
    command, value = input().split()
    if command == 'insert':
        hash.append(value)
    elif command == 'find':
        if value in hash:
            print('yes')
        else:
            print('no')

Fixed submission:
import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic.add(op)
    if ins == 'find':
        print('yes' if op in dic else 'no')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
q = int(input())
ms = [int(i) for i in input().split()]

def solve(i, m):
    if m == 0:
        return True
    if i >= n:
        return False
    # i?????????????´?????????°????????£?????´?????¨???????????´?????§?????°????????????
    res = solve(i+1, m) or solve(i+1, m-A[i])
    return res

for m in ms:
    if solve(0, m):
        print('yes')
    else:
        print('no')

Fixed submission:
is_able_make = [False] * 2000
n = int(input())
A = [int(i) for i in input().split()]
q = int(input())
M = [int(i) for i in input().split()]

for i in A:
    for j in range(2000-i, 0, -1):
        if is_able_make[j] == True:
            is_able_make[i+j] = True
    is_able_make[i] = True

for x in M:
    if is_able_make[x] == True:
        print('yes')
    else:
        print('no')
Buggy python submission (verdict: Runtime Error):
from math import pi
r = int(input())
print(format(r * r * pi, '.6f'), format(r * 2 * pi, '.6f'))

Fixed submission:
from math import pi
r = float(input())
print(format(r * r * pi, '.6f'), format(r * 2 * pi, '.6f'))
Buggy python submission (verdict: Runtime Error):
from collections import deque, defaultdict

def topological_sort(V, E):
    '''
    Kahn's Algorithm (O(|V| + |E|) time)
    Input:
    V = [0, 1, ..., N-1]: a list of vertices of the digraph
    E: the adjacency list of the digraph (dict)
    Output:
    If the input digraph is acyclic, then return a topological sorting of the digraph.
    Else, return None.
    '''
    indeg = {v: 0 for v in V}
    for ends in E.values():
        for v in ends:
            indeg[v] += 1
    
    q = deque([v for v in V if indeg[v] == 0])
    top_sorted = []
    while q:
        v = q.popleft()
        top_sorted.append(v)
        
        for u in E[v]:
            indeg[u] -= 1
            if indeg[u] == 0:
                q.append(u)
    if len(top_sorted) == len(V): # The input digraph is acyclic.
        return top_sorted
    else: # There is a directed cycle in the digraph.
        return None

N, M = map(int, input().split())
E = defaultdict(list)
for _ in range(M):
    s, t = map(int, input().split())
    E[s].append(t)
print(*topological_sort(V, E), sep='\n')


Fixed submission:
from collections import deque, defaultdict

def topological_sort(V, E):
    '''
    Kahn's Algorithm (O(|V| + |E|) time)
    Input:
    V = [0, 1, ..., N-1]: a list of vertices of the digraph
    E: the adjacency list of the digraph (dict)
    Output:
    If the input digraph is acyclic, then return a topological sorting of the digraph.
    Else, return None.
    '''
    indeg = {v: 0 for v in V}
    for ends in E.values():
        for v in ends:
            indeg[v] += 1
    
    q = deque([v for v in V if indeg[v] == 0])
    top_sorted = []
    while q:
        v = q.popleft()
        top_sorted.append(v)
        
        for u in E[v]:
            indeg[u] -= 1
            if indeg[u] == 0:
                q.append(u)
    if len(top_sorted) == len(V): # The input digraph is acyclic.
        return top_sorted
    else: # There is a directed cycle in the digraph.
        return None

N, M = map(int, input().split())
V = range(N)
E = defaultdict(list)
for _ in range(M):
    s, t = map(int, input().split())
    E[s].append(t)
print(*topological_sort(V, E), sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = []

for i in range(N):
    a.append(int(input()))


count = 0
Sosu = True

for i in range(0,N):
    Sosu = True
    for j in range(2,a[i]):
        if a[i] % j == 0:
            Sosu = False
            break
        else :
            pass
    if Sosu :
        count+=1
    else:
        pass


print(count)







Fixed submission:
N = int(input())
a = []

count = 0
for i in range(N):
    x=int(input())
    if x == 2:
        count+=1
    else:
        if pow(2, x-1,x ) == 1:
            count+=1
        else:
            pass

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

b = a[1] - a[0]
for i in range(n):
    for j in range(i+1 , n):
        if b < a[j] - a[i]:
            b = a[j] - a[i]

print(b)




Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

mini = a[0]
b = -10000000000
del a[0]
for i in a:
    if b < i - mini:
        b = i - mini
    if mini > i:
        mini = i

print(b)
Buggy python submission (verdict: Runtime Error):
 r=float(input())
 x=3.14159265359*r*2
 y=3.14159265359*r**2
 print("{0} {1}".format(x,y))  


Fixed submission:
import math
r=float(input())
x=math.pi*r*2
y=math.pi*r**2
print("{0} {1}".format(y,x))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
for i in range(n ,-1, -1):
    print("{0}".format(a[i]),end="")
    if i == n:
        pass
    else:
        print(" ",end="")



Fixed submission:
n = int(input())
a = list(map(int,input().split()))
j = 0
for i in a[::-1]:
    j+=1
    print("{0}".format(i),end="")
    if j != n :
        print(" ",end="")
    else:
        print()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    ans = 0
    for i in range(n):
        x = int(input())
        flag = True
        for j in range(2, x):
            if x % j == 0:
                flag = False
                break
        if flag:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import math


def main():
    n = int(input())
    ans = 0
    for i in range(n):
        x = int(input())
        if x == 2:
            ans += 1
        elif x % 2 == 0:
            pass
        else:
            flag = True
            j = 3
            while j <= math.sqrt(x):
                if x % j == 0:
                    flag = False
                    break
                j += 2
            if flag:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    r = []
    ans = 0
    for i in range(n):
        r.append(int(input()))

    ans = min(r) - max(r)
    for i in reversed(range(n)):
        for j in reversed(range(i)):
            tmp = r[i] - r[j]
            if tmp > ans:
                ans = tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    ans = 0
    minr = int(input())
    ans = -1 * 10**9
    for i in range(n-1):
        r = int(input())
        ans = max(ans, r-minr)
        minr = min(minr, r)

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    r = []
    ans = 0
    for i in range(n):
        r.append(int(input()))

    ans = min(r) - max(r)
    for i in reversed(range(1, n)):
        tmpr = r[:i]
        tmp = r[i] - min(tmpr)
        if tmp > ans:
            ans = tmp
    print(ans)


if __name__ == '__main__':
    main(


Fixed submission:
def main():
    n = int(input())
    ans = 0
    minr = int(input())
    ans = -1 * 10**9
    for i in range(n-1):
        r = int(input())
        ans = max(ans, r-minr)
        minr = min(minr, r)

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    r = []
    ans = 0
    for i in range(n):
        r.append(int(input()))

    ans = min(r) - max(r)
    for i in reversed(range(1, n)):
        tmpr = r[:i]
        tmp = r[i] - min(tmpr)
        if tmp > ans:
            ans = tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    ans = 0
    minr = int(input())
    ans = -1 * 10**9
    for i in range(n-1):
        r = int(input())
        ans = max(ans, r-minr)
        minr = min(minr, r)

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
ef main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
class Cube:
    def __init__(self, u, s, e, w, n, d):
        self.u = u
        self.s = s
        self.e = e
        self.w = w
        self.n = n
        self.d = d

    def rotate(self, dic):
        if dic == "N":
            tmp = self.u
            self.u = self.s
            self.s = self.d
            self.d = self.n
            self.n = tmp
        elif dic == "E":
            tmp = self.u
            self.u = self.w
            self.w = self.d
            self.d = self.e
            self.e = tmp
        elif dic == "W":
            tmp = self.u
            self.u = self.e
            self.e = self.d
            self.d = self.w
            self.w = tmp
        else:
            tmp = self.u
            self.u = self.n
            self.n = self.d
            self.d = self.s
            self.s = tmp


def main():
    u, s, e, w, n, d = map(int, input().split())
    O = input()

    cube = Cube(u, s, e, w, n, d)
    for i in range(len(O)):
        cube.rotate(O[i])
    print(cube.u)


if __name__ == '__main__':
    main(


Fixed submission:
class Cube:
    def __init__(self, u, s, e, w, n, d):
        self.u = u
        self.s = s
        self.e = e
        self.w = w
        self.n = n
        self.d = d

    def rotate(self, dic):
        if dic == "N":
            tmp = self.u
            self.u = self.s
            self.s = self.d
            self.d = self.n
            self.n = tmp
        elif dic == "E":
            tmp = self.u
            self.u = self.w
            self.w = self.d
            self.d = self.e
            self.e = tmp
        elif dic == "W":
            tmp = self.u
            self.u = self.e
            self.e = self.d
            self.d = self.w
            self.w = tmp
        else:
            tmp = self.u
            self.u = self.n
            self.n = self.d
            self.d = self.s
            self.s = tmp


def main():
    u, s, e, w, n, d = map(int, input().split())
    O = input()

    cube = Cube(u, s, e, w, n, d)
    for i in range(len(O)):
        cube.rotate(O[i])
    print(cube.u)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import random


class Cube:
    def __init__(self, u, s, e, w, n, d):
        self.u = u
        self.s = s
        self.e = e
        self.w = w
        self.n = n
        self.d = d

    def rotate(self, dic):
        if dic == "N":
            tmp = self.u
            self.u = self.s
            self.s = self.d
            self.d = self.n
            self.n = tmp
        elif dic == "E":
            tmp = self.u
            self.u = self.w
            self.w = self.d
            self.d = self.e
            self.e = tmp
        elif dic == "W":
            tmp = self.u
            self.u = self.e
            self.e = self.d
            self.d = self.w
            self.w = tmp
        else:
            tmp = self.u
            self.u = self.n
            self.n = self.d
            self.d = self.s
            self.s = tmp


def main():
    u, s, e, w, n, d = map(int, input().split())
    cube = Cube(u, s, e, w, n, d)
    q = int(input())
    for i in range(q):
        upper, front = map(int, input().split())
        while True:
            cube.rotate(random.choice("NWES"))
            if upper == cube.u and front == cube.s:
                print(cube.e)
                break


if __name__ == '__main__':
    main(


Fixed submission:
import random


class Cube:
    def __init__(self, u, s, e, w, n, d):
        self.u = u
        self.s = s
        self.e = e
        self.w = w
        self.n = n
        self.d = d

    def rotate(self, dic):
        if dic == "N":
            tmp = self.u
            self.u = self.s
            self.s = self.d
            self.d = self.n
            self.n = tmp
        elif dic == "E":
            tmp = self.u
            self.u = self.w
            self.w = self.d
            self.d = self.e
            self.e = tmp
        elif dic == "W":
            tmp = self.u
            self.u = self.e
            self.e = self.d
            self.d = self.w
            self.w = tmp
        else:
            tmp = self.u
            self.u = self.n
            self.n = self.d
            self.d = self.s
            self.s = tmp


def main():
    u, s, e, w, n, d = map(int, input().split())
    cube = Cube(u, s, e, w, n, d)
    q = int(input())
    for i in range(q):
        upper, front = map(int, input().split())
        while True:
            cube.rotate(random.choice("NWES"))
            if upper == cube.u and front == cube.s:
                print(cube.e)
                break


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print (int(a)*int(b) 2*(int(a)+int(b)))


Fixed submission:
#
# 1c
#


def main():
    a, b = map(int, input().split())
    print(a*b, 2*(a+b))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
print ( int(a)*int(b) 2*(int(a)+int(b)) )


Fixed submission:
#
# 1c
#


def main():
    a, b = map(int, input().split())
    print(a*b, 2*(a+b))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
time = int(input())
sec = time%60
min = (time/60)%60
hour = time/60
print (hour+":"+min+":"+sec)



Fixed submission:
#
# 1d
#

def main():
    S = int(input())
    h = S // 60 // 60
    m = S // 60 % 60
    s = S % 60
    print(f"{h}:{m}:{s}")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
time = int(input())
sec = time%60
min = (time/60)%60
hour = (time/60)/60
print (hour+":"+min+":"+sec)



Fixed submission:
#
# 1d
#

def main():
    S = int(input())
    h = S // 60 // 60
    m = S // 60 % 60
    s = S % 60
    print(f"{h}:{m}:{s}")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
time = int(input())
sec = time%60
min = (time//60)%60
hour = (time//60)//60

print (hour+":"+min+":"+sec)




Fixed submission:
#
# 1d
#

def main():
    S = int(input())
    h = S // 60 // 60
    m = S // 60 % 60
    s = S % 60
    print(f"{h}:{m}:{s}")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
array = input().split()
if (int(array[0] > int(array[1] > int(array[2]):
    print("Yes")
else:
    print("No")


Fixed submission:
#
# 2b
#

def main():
    a, b, c = map(int, input().split())
    if a < b < c:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split()
if (int(array[0] > int(array[1]) and int(array[1]) > int(array[2]):
    print("Yes")
else:
    print("No")


Fixed submission:
#
# 2b
#

def main():
    a, b, c = map(int, input().split())
    if a < b < c:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split()
if (int(array[0]) > int(array[1]) and int(array[1]) > int(array[2]):
    print("Yes")
else:
    print("No")


Fixed submission:
#
# 2b
#

def main():
    a, b, c = map(int, input().split())
    if a < b < c:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
array = input().split().sort()

for i in range(len(array)):
    print(array[i], end="")


Fixed submission:
#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split().sort()

for i in range(0..2):
    print(array[i], end="")


Fixed submission:
#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split().sort()

for i in array:
    print(i, end="")


Fixed submission:
#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split().sort())

for i in array:
    print(i, end="")


Fixed submission:
#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
array = input().split().sort()

for i in array:
    print(i, end="")


Fixed submission:
#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
w,h,x,y,r = map(int, input().split())

if x-r <= 0 or y-r <= 0 or x+r => w or y+r => h:
    print("No")
else:
    print("Yes")
    


Fixed submission:
#
# 2d
#

def main():
    W, H, x, y, r = map(int, input().split())
    if x-r < 0 or x+r > W or y-r < 0 or y+r > H:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a,b,c = map(i, input().split())
ret = 0
for i in range(a,b+1):
    if c % i == 0
        ret++
print(ret)


Fixed submission:
#
# 3d
#

def main():
    a, b, c = map(int, input().split())
    r = 0
    for i in range(a, b+1):
        if c % i == 0:
            r += 1
    print(r)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
a,b,c = map(i, input().split())
ret = 0
for i in range(a,b+1):
    if c % i == 0:
        ret++
print(ret)


Fixed submission:
#
# 3d
#

def main():
    a, b, c = map(int, input().split())
    r = 0
    for i in range(a, b+1):
        if c % i == 0:
            r += 1
    print(r)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
a,b,c = map(i, input().split())
ret = 0
for i in range(a,b+1):
    if c % i == 0:
        ret += 1
print(ret)


Fixed submission:
#
# 3d
#

def main():
    a, b, c = map(int, input().split())
    r = 0
    for i in range(a, b+1):
        if c % i == 0:
            r += 1
    print(r)


if __name__ == '__main__':
    main()