Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
ww = [int(input()) for _ in range(n)]
def chk(p):
    c = 1
    s = 0
    for w in ww:
        if w > p:
            return False
        if s + w <= p:
            s += w
        else:
            c += 1
            s = w
    return c <= k
def search(l, r):
    if r - l < 10:
        for i in range(l, r):
            if chk(i):
                return i
    m = (l + r) // 2
    if chk(m):
        return search(l, m)
    else:
        return search(m, r)
print(search(0, 2 ** 30))

Fixed submission:
n, k = map(int, input().split())
ww = [int(input()) for _ in range(n)]
def chk(p):
    c = 1
    s = 0
    for w in ww:
        if w > p:
            return False
        if s + w <= p:
            s += w
        else:
            c += 1
            s = w
        if c > k:
            return False
    return True
def search(l, r):
    if r - l < 10:
        for i in range(l, r):
            if chk(i):
                return i
    m = (l + r) // 2
    if chk(m):
        return search(l, m + 1)
    else:
        return search(m + 1, r)
print(search(0, 2 ** 30))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
ww = [int(input()) for _ in range(n)]
def chk(p):
    c = 1
    s = 0
    for w in ww:
        if w > p:
            return False
        if s + w <= p:
            s += w
        else:
            c += 1
            s = w
        if c > k:
            return False
    return True
def search(l, r):
    if r - l < 10:
        for i in range(l, r):
            if chk(i):
                return i
    m = (l + r) // 2
    if chk(m):
        return search(l, m)
    else:
        return search(m, r)
print(search(0, 2 ** 30))

Fixed submission:
n, k = map(int, input().split())
ww = [int(input()) for _ in range(n)]
def chk(p):
    c = 1
    s = 0
    for w in ww:
        if w > p:
            return False
        if s + w <= p:
            s += w
        else:
            c += 1
            s = w
        if c > k:
            return False
    return True
def search(l, r):
    if r - l < 10:
        for i in range(l, r):
            if chk(i):
                return i
    m = (l + r) // 2
    if chk(m):
        return search(l, m + 1)
    else:
        return search(m + 1, r)
print(search(0, 2 ** 30))
Buggy python submission (verdict: Runtime Error):
r = list(map(int, input().split()))
print('{0:f}'.format(((r[2] - r[0]) ** 2 + (r[3] - r[1]) ** 2) ** 0.5))

Fixed submission:
r = list(map(float, input().split()))
print('{0:f}'.format(((r[2] - r[0]) ** 2 + (r[3] - r[1]) ** 2) ** 0.5))
Buggy python submission (verdict: Runtime Error):
class Dice:
    def __init__(self, labels):
        self.labels = labels
        self.up = labels[0]
        self.front = labels[1]
        self.right = labels[2]
        self.left = labels[3]
        self.back = labels[4]
        self.down = labels[5]
    def east(self):
        self.up, self.right, self.down, self.left = self.left, self.up, self.right, self.down
        self.update_labels()
    def north(self):
        self.up, self.back, self.down, self.front = self.front, self.up, self.back, self.down
        self.update_labels()
    def south(self):
        self.up, self.front, self.down, self.back = self.back, self.up, self.front, self.down
        self.update_labels()
    def west(self):
        self.up, self.left, self.down, self.right = self.right, self.up, self.left, self.down
        self.update_labels()
    def clockwise(self):
        self.front, self.left, self.back, self.right = self.right, self.front, self.left, self.back
        self.update_labels()
    def counterclockwise(self):
        self.front, self.right, self.back, self.left = self.left, self.front, self.right, self.back
        self.update_labels()
    def set_up(self, up):
        for i in range(6):
            if up == self.up:
                break
            if i % 2:
                self.east()
            else:
                self.north()
    def set_front(self, front):
        while True:
            if front == self.front:
                break
            self.clockwise()
    def update_labels(self):
        self.labels = [self.up, self.front, self.right, self.left, self.back, self.down]

dice_1 = Dice(list(map(int, input().split())))
dice_2 = Dice(list(map(int, input().split())))
flag = False
for i in range(30):
    if dice_1.labels == dice_2.labels:
        flag = True
        break
    if i % 5 == 0:
        if i % 10 == 0:
            dice_2.east()
        else:
            dice_2.north()
    else:
        dice_2.clockwise()
if flag:
    print('Yes')
else:
    print('No')

Fixed submission:
class Dice:
    def __init__(self, labels):
        self.up = labels[0]
        self.front = labels[1]
        self.right = labels[2]
        self.left = labels[3]
        self.back = labels[4]
        self.down = labels[5]
    def east(self):
        self.up, self.right, self.down, self.left = self.left, self.up, self.right, self.down
    def north(self):
        self.up, self.back, self.down, self.front = self.front, self.up, self.back, self.down
    def south(self):
        self.up, self.front, self.down, self.back = self.back, self.up, self.front, self.down
    def west(self):
        self.up, self.left, self.down, self.right = self.right, self.up, self.left, self.down

dice = Dice(list(map(int, input().split())))
for cmd in list(input()):
    if cmd == 'E':
        dice.east()
    if cmd == 'N':
        dice.north()
    if cmd == 'S':
        dice.south()
    if cmd == 'W':
        dice.west()
print(dice.up)
Buggy python submission (verdict: Runtime Error):
n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
nums = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for d in data:
    nums[d[0] - 1][d[1] - 1][d[2] - 1] += d[3]
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' ' + nums[i][j][k], end='')
        print('')
    if i != 3:
        print('#' * 20)

Fixed submission:
n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
nums = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for d in data:
    nums[d[0] - 1][d[1] - 1][d[2] - 1] += d[3]
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' ' + str(nums[i][j][k]), end='')
        print('')
    if i != 3:
        print('#' * 20)
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    ans = 0
    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:
                    ans += 1
    print(ans // 6)

Fixed submission:
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B "How many ways?" ????§£??????
# 
import itertools
while True:
    n, x = map(int, input().split())
    if not n:
        break
    print(list(map(sum, itertools.combinations(range(1, n + 1), 3))).count(x))
Buggy python submission (verdict: Runtime Error):
uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowers = 'abcdefghijklmnopqrstuvwxyz'
s = []
while len(s) < 1200:
    s += list(input())
for i in range(26):
    print(lowers[i] + ' : ' + str(s.count(uppers[i]) + s.count(lowers[i])))

Fixed submission:
import sys
uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowers = 'abcdefghijklmnopqrstuvwxyz'
s = []
for line in sys.stdin:
    s += line
for i in range(26):
    print(lowers[i] + ' : ' + str(s.count(uppers[i]) + s.count(lowers[i])))
Buggy python submission (verdict: Runtime Error):
while True:
	n = int(input())
	if n == 0:
	    break
	s = []
    s = list(input().split())
	while True:
		t = []
        u = 0
    	v = 0
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1

Fixed submission:
while True:
	n = int(input())
	if n == 0:
	    break
	s = []
	u = 0
	v = 0
	s = list(map(int, input().split()))
	while True:
		t = []
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1

Buggy python submission (verdict: Time Limit Exceeded):
while True:
	n = int(input())
	if n == 0:
	    break
	s = []
	u = 0
	v = 0
	s = list(input().split())
	while True:
		t = []
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t_str:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1

Fixed submission:
while True:
	n = int(input())
	if n == 0:
	    break
	s = []
	u = 0
	v = 0
	s = list(map(int, input().split()))
	while True:
		t = []
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1
Buggy python submission (verdict: Runtime Error):
import sys

x = int(sys.argv[1])
print(x ** 3)

Fixed submission:
import sys

x = int(input())
print(x ** 3)
Buggy python submission (verdict: Runtime Error):
data = input()
a, b, c = [int(i) for i in data.split()]

if a < b < c:
    print('Yes')
else:
    print('No')

Fixed submission:
data = input()
a, b, c = [int(i) for i in data.split()]

if a < b < c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys

PI = 3.1415926

r = int(sys.stdin.readline().strip())
area = r * r * PI
periphery = r * 2 * PI

print('%.6f %.6f' % (area, periphery))

Fixed submission:
import sys

PI = 3.141592653589793

r = float(sys.stdin.readline().strip())
area = r * r * PI
periphery = r * 2 * PI

print('%.6f %.6f' % (area, periphery))
Buggy python submission (verdict: Runtime Error):
while True:
  inl=map(int, raw_input().split())
  num=inl[0]+inl[1]
  a=list(str(num))

  time=0
  for i in a:
    time+=1

  print time

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

Buggy python submission (verdict: Runtime Error):
while True:
  inl=map(int, raw_input().split())

  if inl==[]:
    break
  num=inl[0]+inl[1]
  a=list(str(num))

  time=0
  for i in a:
    time+=1

  print time

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

Buggy python submission (verdict: Runtime Error):
while True:
  inl=map(int, raw_input().split())

  if inl==[]:
  	break
  num=inl[0]+inl[1]
  a=list(str(num))

  time=0
  for i in a:
    time+=1

  print time

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

Buggy python submission (verdict: Runtime Error):
import sys
for i in sys.stdin:
  inl=map(int, raw_input().split())
  num=inl[0]+inl[1]
  a=list(str(num))

  time=0
  for i in a:
    time+=1

  print time

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

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

for i in sys.stdin:
  inl=i.split()
  a=inl[0]+inl[1]
  time=0
  for n in a
    time+=1
  print tie

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

Buggy python submission (verdict: Runtime Error):
a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time
Buggy python submission (verdict: Runtime Error):
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=inl[0]
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=inl[1]
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm==num1*num2/gud
    print gud,lcm

Fixed submission:
import sys
import math

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
            list.append(num1/check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm

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

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm==num1*num2/gud
    print gud,lcm

Fixed submission:
import sys
import math

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
            list.append(num1/check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm

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

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm

Fixed submission:
import sys
import math

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
            list.append(num1/check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm
Buggy python submission (verdict: Runtime Error):
list=[]
list.append(input())

While list!=[]:
    inp=input()
    if inp==0:
        print list[-1]
        del list[-1]
    else:
        list.append(inp)

Fixed submission:
import sys
import sys

a = []
for line in sys.stdin:
    a.append(line)

lis=[]
for n in a:
    inp=int(n)
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Buggy python submission (verdict: Runtime Error):
lis=[]
lis.append(input())

while True:
    inp=input()
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Fixed submission:
import sys
import sys

a = []
for line in sys.stdin:
    a.append(line)

lis=[]
for n in a:
    inp=int(n)
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Buggy python submission (verdict: Runtime Error):
lis=[]
lis.append(input())

while true:
    inp=input()
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Fixed submission:
import sys
import sys

a = []
for line in sys.stdin:
    a.append(line)

lis=[]
for n in a:
    inp=int(n)
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Buggy python submission (verdict: Runtime Error):
lis=[]
lis.append(input())

while True:
    inp=input()
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)

Fixed submission:
import sys
import sys

a = []
for line in sys.stdin:
    a.append(line)

lis=[]
for n in a:
    inp=int(n)
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)
Buggy python submission (verdict: Runtime Error):
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    num=int(n)
    x=0
    are=0
    while x<600:
         are+=(x**2)*num
         x+=num

print area

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    num=int(n)
    x=0
    are=0
    while x<600:
         are+=(x**2)*num
         x+=num

    print are
Buggy python submission (verdict: Runtime Error):
intl=map(int, raw_input())

a=intl[0]
b=intl[1]

if a==b:
  print "a==b"
elif a>b:
  print "a>b"
else:
  print "a<b"

Fixed submission:
intl=map(int, raw_input().split())

a=intl[0]
b=intl[1]

if a==b:
  print "a == b"
elif a>b:
  print "a > b"
else:
  print "a < b"

Buggy python submission (verdict: Runtime Error):
intl=map(int, raw_input().split)

a=intl[0]
b=intl[1]

if a==b:
  print "a == b"
elif a>b:
  print "a > b"
else:
  print "a < b"

Fixed submission:
intl=map(int, raw_input().split())

a=intl[0]
b=intl[1]

if a==b:
  print "a == b"
elif a>b:
  print "a > b"
else:
  print "a < b"
Buggy python submission (verdict: Runtime Error):
inl=map(int. raw_input().split())

a=inl[0]
b=inl[1]
c=inl[2]

if a<b and b<c:
  print "Yes"
else:
  print "No"

Fixed submission:
inl=map(int, raw_input().split())

a=inl[0]
b=inl[1]
c=inl[2]

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

if inl[0]>=inl[2]+inl[4] and inl[2]+inl[4]>=0 and inl[1]>=inl[3]+inl[4] and inl[3]+inl[4]>=0
  print "Yes"
else:
  print "No"

Fixed submission:
inl=map(int, raw_input().split())

if inl[0]>=inl[2]+inl[4] and inl[2]-inl[4]>=0 and inl[1]>=inl[3]+inl[4] and inl[3]-inl[4]>=0:
  print "Yes"
else:
  print "No"
Buggy python submission (verdict: Runtime Error):
for i in range(1,10):
	for j in range(1,10):
		print(i+"x"+j+"="+(i*j))

Fixed submission:
for i in range(1,10):
	for j in range(1,10):
		print(str(i)+"x"+str(j)+"="+str(i*j))
Buggy python submission (verdict: Runtime Error):
a=input()
while a!=None:
    b=map(int,a.split())
    print(len(str(sum(b))))
    a=input()

Fixed submission:
while True:
	try:
		a=input().split()
	except:
		break
	b=int(a[0])+int(a[1])
	print(len(str(b)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
for i in range(N):
	a=map(int,input().split())
	a.sort()
	if a[0]**2+a[1]**2==a[2]**2:
		print("YES")
	else:
		print("NO")

Fixed submission:
def d(a):
	return int(a)

N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=input().split()
	
	a.sort(key=d)
	if int(a[0])**2+int(a[1])**2==int(a[2])**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=map(int,input().split())
	a.sort()
	if a[0]**2+a[1]**2==a[2]**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)

Fixed submission:
def d(a):
	return int(a)

N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=input().split()
	
	a.sort(key=d)
	if int(a[0])**2+int(a[1])**2==int(a[2])**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)
Buggy python submission (verdict: Runtime Error):
ans=""
while True:
	try:
		info=input()
	except:
		break
	if ans!="":
		ans+="\n"
    info_2=info.split()
    ans+=str(int(info_2[0])+int(info_2[1]))
print(ans)

Fixed submission:
ans=""
while True:
	try:
		info=input()
	except:
		break
	if ans!="":
		ans+="\n"
	info_2=info.split()
	ans+=str(int(info_2[0])+int(info_2[1]))
print(ans)
Buggy python submission (verdict: Runtime Error):
s=int(raw_input())
h=s/3600
m=s/60%60
s=s%60
print str(h)+":"str(m)+":"str(s)

Fixed submission:
s=int(raw_input())
h=s/3600
m=s/60%60
s=s%60
print str(h)+":"+str(m)+":"+str(s)

Buggy python submission (verdict: Runtime Error):
s=int(raw_input())
h=s/3600
m=s/60%60
s=s%60
print str(h)+":"str(m)+":"str(s)

Fixed submission:
s=int(raw_input())
h=s/3600
m=s/60%60
s=s%60
print str(h)+":"+str(m)+":"+str(s)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,raw_input.split())

if a<b:
    print "a<b"
elif a>b:
    print "a>b"
elif a==b:
    print "a==b"

Fixed submission:
a,b=map(int,raw_input().split())

if a<b:
    print "a < b"
elif a>b:
    print "a > b"
elif a==b:
    print "a == b"
Buggy python submission (verdict: Runtime Error):
from collections import deque

n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        d.appendleft(int(cmd[1]))
    elif cmd[0] == 'delete':
        d.remove(int(cmd[1]))
    elif cmd[0] == 'deleteFirst':
        d.popleft()
    elif cmd[0] == 'deleteLast':
        d.pop()
print(*list(d))

Fixed submission:
from collections import deque

n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        d.appendleft(int(cmd[1]))
    elif cmd[0] == 'delete':
        try:
            d.remove(int(cmd[1]))
        except ValueError:
            pass
    elif cmd[0] == 'deleteFirst':
        d.popleft()
    elif cmd[0] == 'deleteLast':
        d.pop()
print(*list(d))

Buggy python submission (verdict: Runtime Error):
from collections import deque

n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        d.appendleft(int(cmd[1]))
    elif cmd[0] == 'delete':
        d.remove(int(cmd[1]))
    elif cmd[0] == 'deleteFirst':
        d.popleft()
    elif cmd[0] == 'deleteLast':
        d.pop()
print(*list(d))

Fixed submission:
from collections import deque

n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        d.appendleft(int(cmd[1]))
    elif cmd[0] == 'delete':
        try:
            d.remove(int(cmd[1]))
        except ValueError:
            pass
    elif cmd[0] == 'deleteFirst':
        d.popleft()
    elif cmd[0] == 'deleteLast':
        d.pop()
print(*list(d))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
S = list(map(int, input().split()))
q = input()
T = list(map(int, input().split()))
C = 0

for i in T:
    if i in S:
        C += 1

print(C)

Fixed submission:
n = input()
S = set(map(int, input().split()))
q = input()
T = set(map(int, input().split()))
C = 0

for i in T:
    if i in S:
        C += 1

print(C)