Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

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

def solve():
    n = input()
    nums = list(map(int, input().split()))
    c_m = lcm(nums[0], nums[1])
    for n in nums[2:]:
        c_m = lcm(c_m, n)
    print(c_m)

solve()

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()
Buggy python submission (verdict: Time Limit Exceeded):
def is_prime(x):
    # Perform prime number discrimination for odd numbers of 3 or more.
    return pow(2, x - 1, x) == 1

def solve():
    n = int(input())
    ans = n
    if n % 2 == 0:
        ans -= ans // 2
        while n % 2 == 0:
            n //= 2
    d = 3
    while d <= n // 2:
        if is_prime(d) and n % d == 0:
            ans -= ans // d
            while n % d == 0:
                n //= d
        d += 2
    if is_prime(n):
        ans -= ans // n
    print(ans)

solve()

Fixed submission:
def is_prime(x):
    # Perform prime number discrimination for odd numbers of 3 or more.
    return pow(2, x - 1, x) == 1

def solve():
    n = int(input())
    ans = n
    if n % 2 == 0:
        ans -= ans // 2
        while n % 2 == 0:
            n //= 2
    d = 3
    while d <= n ** 0.5:
        if is_prime(d) and n % d == 0:
            ans -= ans // d
            while n % d == 0:
                n //= d
        d += 2
    if is_prime(n):
        ans -= ans // n
    print(ans)

solve()
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def solve():
    a, b = map(int, input().split())
    if a == b or a % b == 0:
        print(0, 1)
    elif b % a == 0:
        print(1, 0)
    else:
        coe = [[1, 0], [0, 1]]
        while b != 1:
            quo = a // b
            coe_d1 = coe[1]
            coe_d2 = [coe[0][0] - coe[1][0] * quo, coe[0][1] - coe[1][1] * quo]
            coe = [coe_d1, coe_d2]
            a, b = b, a % b
        print(*coe[1])

solve()

Fixed submission:
def solve():
    a, b = map(int, input().split())
    s_i, s_j = 1, 0
    t_i, t_j = 0, 1
    while b:
        q, r = divmod(a, b)
        s_i, s_j = s_j, s_i - q * s_j
        t_i, t_j = t_j, t_i - q * t_j
        a, b = b, r
    print(s_i, t_i)

solve()
Buggy python submission (verdict: Runtime Error):
while True:
  H, W = map(int, input().split())
  for j in range(H):
    for i in range(W):
      print('#',end='')
    print()

if H == 0 and W == 0 :
  break


Fixed submission:
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0 :
    break
  
  for j in range(H):
    for i in range(W):
      print('#',end='')
    print()
  print()

  if H == 0 and W == 0 :
    break
Buggy python submission (verdict: Runtime Error):
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0 :
    break

for i in range(H):
    for j in range(W):
        if                       :
            print("#", end="")
        else:
            print(".", end="")
    print()


Fixed submission:
while True:
  H, W = map(int, input().split())
  
  if H == 0 and W == 0 :
    break
  for i in range(H):
      for j in range(W):
          if i == 0 or i == H-1 or j == 0 or j == W-1 :
              print("#", end="")
          else:
              print(".", end="")
      print()
      
  print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1

#print(cards)

for c in range['S','H','C ','D']:
    for n in range(1,13):
        key = C + ' '+ str(n)
        if not key in cards:
            print(key)



Fixed submission:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)
Buggy python submission (verdict: Runtime Error):
#include<iostream>
using namespace std;
int main(){
    int r,c,t;
    t=0;
    cin>>r>>c;
    int R[c+1]={};
    int S[c+1]={};
    for (int i=0;i<r;i++){
        for(int x=0;x<c;x++){
            cin>>R[x];
            cout<<R[x]<<" ";
        }
        for(int x=0;x<c;x++){
            t+=R[x];
        }
    cout<<t<<endl;
    for(int b=0;b<c;b++){
        S[b]+=R[b];
    }
    R[c+1]={};
    t=0;
    }
    for(int x=0;x<c;x++){
        cout<<S[x]<<" ";
        S[c]+=S[x];
    }
    cout<<S[c]<<endl;    
}


Fixed submission:
i,j=map(int,input().split())
listA=[]
for n in range(i):
    listA.append(list(map(int,input().split())))
    listA[n].append(sum(listA[n]))
listA.append([])
for n in range(j+1):
    number=0
    for m in range(i):
        number+=listA[m][n]
    listA[i].append(number)
for n in range(i+1):
    print(' '.join(map(str,listA[n])))
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;
 
int main() {
  int n, m, l, a[110][110] = {0}, b[110][110] = {0};
  long long c[110][110] = {0};
  cin >> n >> m >> l;
  for (int i=0;i<n;i++)
    for (int j=0;j<m;j++)
      cin >> a[i][j];
  for (int i=0;i<m;i++)
    for (int j=0;j<l;j++)
      cin >> b[i][j];
 
  for (int i=0;i<n;i++)
    for (int j=0;j<l;j++)
      for (int k=0;k<m;k++)
        c[i][j] += a[i][k] * b[k][j];
  for (int i=0;i<n;i++) {
    for (int j=0;j<l-1;j++)
      cout << c[i][j] << " ";
    cout << c[i][l-1] << endl;
  }
}


Fixed submission:
n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
   
for i in range(n):
  a[i] = list(map(int, input().split()))
   
for i in range(m):
  b[i] = list(map(int, input().split()))
   
for i in range(n):
  line = []
    
  for j in range(l):
    c = 0
      
    for k in range(m):
      c += a[i][k]*b[k][j]
      
    line.append(str(c))
  
  print(' '.join(line))

Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;
 
int main() {
  int n, m, l, a[110][110] = {0}, b[110][110] = {0};
  long long c[110][110] = {0};
  cin >> n >> m >> l;
  for (int i=0;i<n;i++)
    for (int j=0;j<m;j++)
      cin >> a[i][j];
  for (int i=0;i<m;i++)
    for (int j=0;j<l;j++)
      cin >> b[i][j];
 
  for (int i=0;i<n;i++)
    for (int j=0;j<l;j++)
      for (int k=0;k<m;k++)
        c[i][j] += a[i][k] * b[k][j];
  for (int i=0;i<n;i++) {
    for (int j=0;j<l-1;j++)
      cout << c[i][j] << " ";
    cout << c[i][l-1] << endl;
  }
}


Fixed submission:
n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
   
for i in range(n):
  a[i] = list(map(int, input().split()))
   
for i in range(m):
  b[i] = list(map(int, input().split()))
   
for i in range(n):
  line = []
    
  for j in range(l):
    c = 0
      
    for k in range(m):
      c += a[i][k]*b[k][j]
      
    line.append(str(c))
  
  print(' '.join(line))
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string s;
  getline(cin, s);
  for (int i=0;i<s.size();i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      s[i] += 'A' - 'a';
    else if (s[i] >= 'A' && s[i] <= 'Z')
      s[i] -= 'A' - 'a';
  }
  cout << s << endl;
}


Fixed submission:
print(input().swapcase())

Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string s;
  getline(cin, s);
  for (int i=0;i<s.size();i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      s[i] += 'A' - 'a';
    else if (s[i] >= 'A' && s[i] <= 'Z')
      s[i] -= 'A' - 'a';
  }
  cout << s << endl;
}


Fixed submission:
print(input().swapcase())

Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string s;
  getline(cin, s);
  for (int i=0;i<s.size();i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      s[i] += 'A' - 'a';
    else if (s[i] >= 'A' && s[i] <= 'Z')
      s[i] -= 'A' - 'a';
  }
  cout << s << endl;
}


Fixed submission:
print(input().swapcase())
Buggy python submission (verdict: Runtime Error):
ans=[]
W=raw_input()
while True:
    i = raw_input()
    if i == 'END_OF_TEXT': break
    ans+=[j.lower() for j in i.split()]
print ans.count(W)


Fixed submission:
W=input().lower()
cnt=0
while True:
    T=input()
    if T=='END_OF_TEXT': break
    cnt += T.lower().split().count(W)
print(cnt)

Buggy python submission (verdict: Runtime Error):
ans=[]
W=raw_input()
while True:
    i = raw_input()
    if i == 'END_OF_TEXT': break
    ans+=[j.lower() for j in i.split()]
print ans.count(W)


Fixed submission:
W=input().lower()
cnt=0
while True:
    T=input()
    if T=='END_OF_TEXT': break
    cnt += T.lower().split().count(W)
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
cards = {} #からの辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(d)

for c in ['S', 'H', 'C', 'D']:
    for n in rarge(1, 13):
        key = c + ' ' + str(n)
    if not key in cards:
        print(key)


Fixed submission:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Buggy python submission (verdict: Runtime Error):
n = int(input())
cards = {} #からの辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(d)

for c in ['S', 'H', 'C', 'D']:
    for n in rarge(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)


Fixed submission:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)
Buggy python submission (verdict: Runtime Error):
​
while True:
  x,y=map(int, input().split())
​
  if x+y==0:
    break
  if x>=y:
    tmp = x
    x=y
    y=tmp
​
  print(x,y)


Fixed submission:
while True:
  x,y=map(int, input().split())

  if x==0 and y==0:
    break
  if x>=y:
    x,y = y,x
  print(x,y)

Buggy python submission (verdict: Runtime Error):
​while True:
  x,y=map(int, input().split())

  if x+y==0:
    break
  if x>=y:
    tmp = x
    x=y
    y=tmp

  print(x,y)



Fixed submission:
while True:
  x,y=map(int, input().split())

  if x==0 and y==0:
    break
  if x>=y:
    x,y = y,x
  print(x,y)

Buggy python submission (verdict: Runtime Error):
while True:
  x,y=map(int, input().split())
​
  if x+y==0:
    break
  if x>=y:
    tmp = x
    x=y
    y=tmp
​
  print(x,y)



Fixed submission:
while True:
  x,y=map(int, input().split())

  if x==0 and y==0:
    break
  if x>=y:
    x,y = y,x
  print(x,y)

Buggy python submission (verdict: Runtime Error):
while True:
  x,y=map(int, input().split())
​
  if x+y==0:
    break
  if x>=y:
    tmp = x
    x=y
    y=tmp
​
  print(x,y)



Fixed submission:
while True:
  x,y=map(int, input().split())

  if x==0 and y==0:
    break
  if x>=y:
    x,y = y,x
  print(x,y)

Buggy python submission (verdict: Runtime Error):
while True:
  x,y=map(int, input().split())
​
  if x==0 and y==0:
    break
  if x>=y:
    tmp = x
    x=y
    y=tmp
​
  print(x,y)



Fixed submission:
while True:
  x,y=map(int, input().split())

  if x==0 and y==0:
    break
  if x>=y:
    x,y = y,x
  print(x,y)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = {} #空の辞書
for i in range(n):
    card = input()
    d[card] = 1
    
#print(cards)
    
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 13):
        key = c +' ' +str(n)
        if not key in cards:
            print(key)


Fixed submission:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)
    
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c +' ' + str(n)
        if not key in cards:
            print(key)
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"
else:
    print "none"


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):
#include<iostream>
using namespace std;

int main(){
    int n, a, b;
    int c[6]={};
    for (int i=0; i<6; i++) {
        cin >> c[i];
    }
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a >> b;
        if (a==c[0]) {
            if (b==c[1]) {
                cout << c[2] << endl;
            } else if (b==c[2]) {
                cout << c[4] << endl;
            } else if (b==c[3]) {
                cout << c[1] << endl;
            } else if (b==c[4]) {
                cout << c[3] << endl;
            }
        } else if (a==c[1]) {
            if (b==c[0]) {
                cout << c[3] << endl;
            } else if (b==c[2]) {
                cout << c[0] << endl;
            } else if (b==c[3]) {
                cout << c[5] << endl;
            } else if (b==c[5]) {
                cout << c[2] << endl;
            }
        } else if (a==c[2]) {
            if (b==c[0]) {
                cout << c[1] << endl;
            } else if (b==c[1]) {
                cout << c[5] << endl;
            } else if (b==c[4]) {
                cout << c[0] << endl;
            } else if (b==c[5]) {
                cout << c[4] << endl;
            }
        } else if (a==c[3]) {
            if (b==c[0]) {
                cout << c[4] << endl;
            } else if (b==c[1]) {
                cout << c[0] << endl;
            } else if (b==c[4]) {
                cout << c[5] << endl;
            } else if (b==c[5]) {
                cout << c[1] << endl;
            }
        } else if (a==c[4]) {
            if (b==c[0]) {
                cout << c[2] << endl;
            } else if (b==c[2]) {
                cout << c[5] << endl;
            } else if (b==c[3]) {
                cout << c[0] << endl;
            } else if (b==c[5]) {
                cout << c[3] << endl;
            }
        } else if (a==c[5]) {
            if (b==c[1]) {
                cout << c[3] << endl;
            } else if (b==c[2]) {
                cout << c[1] << endl;
            } else if (b==c[3]) {
                cout << c[4] << endl;
            } else if (b==c[4]) {
                cout << c[2] << endl;
            }
        } 
    }
    return 0;
}


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

for i in range(n):
  q=list(map(int,input().split()))
  if q in [[S[3],S[1]],[S[1],S[2]],[S[2],S[4]],[S[4],S[3]]]:
           print(S[0])
           
  if q in [[S[0],S[3]],[S[3],S[5]],[S[5],S[2]],[S[2],S[0]]]:
           print(S[1])
           
  if q in [[S[0],S[1]],[S[1],S[5]],[S[5],S[4]],[S[4],S[0]]]:
           print(S[2])
           
  if q in [[S[4],S[5]],[S[5],S[1]],[S[1],S[0]],[S[0],S[4]]]:
           print(S[3])
           
  if q in [[S[0],S[2]],[S[2],S[5]],[S[5],S[3]],[S[3],S[0]]]:
           print(S[4])
  
  if q in [[S[2],S[1]],[S[1],S[3]],[S[3],S[4]],[S[4],S[2]]]:
           print(S[5])
Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split())
if x >= r and x + r <= W and y >= r and y + r <= H
print("Yes")
else:
print("No")


Fixed submission:
W, H, x, y, r = map(int, input().split())
 
if r < (x + r) <= W :
  if r < (y + r) <= H :
    print('Yes')
  else :
    print('No')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):


BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
 
while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for a in range(1,N+1):
        for b in range(1,N+1):
            if b <= a:
                continue
            c = X-(a+b)
            if c > b and c <= N:
                ans += 1
    print("%d"%(ans))

Compile Error Logs:

Status
Judge: 4/4 	Python3 	CPU: 00:07 sec 	Memory: 5608 KB 	Length: 369 B 	2019-05-27 14:40
Results for testcases
Case # 	Verdict 	CPU Time 	Memory 	In 	Out 	Case Name
Case #1	: Accepted	00:02	5604	8	2	testcase_00
Case #2	: Accepted	00:03	5604	28	10	testcase_01
Case #3	: Accepted	00:02	5608	85	36	testcase_02
Case #4	: Accepted	00:07	5600	297	163	testcase_03
< prev | 		/ 		| next > 	  		
 
Judge Input #  ( | ) 		Judge Output #  ( | )

		




Fixed submission:
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
 
while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for a in range(1,N+1):
        for b in range(1,N+1):
            if b <= a:
                continue
            c = X-(a+b)
            if c > b and c <= N:
                ans += 1
    print("%d"%(ans))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
d=a//b
r=a%b
f=a/b
print(d,r,f)


Fixed submission:
a,b,c = map(int, input().split())
d=0
for i in range(a,b+1):
  if c%i==0:
    d=d+1
print(d)
Buggy python submission (verdict: Runtime Error):
while H!=0 and W!=0:
  H,W = map(int, input().split())

  for i in range(H):
    for j in range(W):
      print('#', end="")
    print()
  print()
  if W==0 and H==0:
    break


Fixed submission:
while True:
  H,W = map(int, input().split())
  if W==0 and H==0:
   break
  for i in range(H):
    for j in range(W):
      print('#', end="")
    print()
  print()
Buggy python submission (verdict: Runtime Error):
x1,y1,x2,y2=map(int,input().split())
d=((x1-x2)**2 + (y1-y2)**2)**(1/2)
print(d)


Fixed submission:
x1,y1,x2,y2=map(float,input().split())
d=((x1-x2)**2 + (y1-y2)**2)**(1/2)
print(d)

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


Fixed submission:
x1,y1,x2,y2=map(float,input().split())
d=((x1-x2)**2 + (y1-y2)**2)**(1/2)
print(d)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
s=int(a)*int(b)
t=int(a)*2+int(b)*2
print(s, t)


Fixed submission:
a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)

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


Fixed submission:
a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)

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


Fixed submission:
a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)

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


Fixed submission:
a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split(" "))

list_x = [i for i in range(1,x+1) if x % i == 0]

list_y = [j for j in range(1,y+1) if y % j == 0]

print(max([k for k in list_x if k in list_y]))



Fixed submission:
x,y = map(int,input().split(" "))

while y != 0:
    x,y=y,x%y

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split(" "))

#xの約数を求める
list_x = [i for i in range(1,x+1) if x % i == 0]

#yの約数を求める
list_y = [j for j in range(1,y+1) if y % j == 0]

x_set = set(list_x)
y_set = set(list_y)

print(max(list(x_set & y_set)))



Fixed submission:
x,y = map(int,input().split(" "))

while y != 0:
    x,y=y,x%y

print(x)
Buggy python submission (verdict: Time Limit Exceeded):

loopnum = int(input())
cnt = 0
for i in range(loopnum):

	chknum = int(input())

	for j in range(2,chknum):
		if chknum % j == 0:
			break
	else:
		cnt += 1

print(cnt)



Fixed submission:
import math

loopnum = int(input())
cnt = 0
for i in range(loopnum):

	chknum = int(input())
	rootnum = int(math.sqrt(chknum))

	for j in range(2,rootnum+1):
		if chknum % j == 0:
			break
	else:
		cnt += 1

	# TLE
	#for j in range(2,chknum):
	#	if chknum % j == 0:
	#		break
	#else:
	#	cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

q = deque()

for _ in range(n):
	com,*num = input().split(" ")

	if com == "insert":
		q.appendleft(int(num[0]))
	elif com == "delete":
		if q.count(int(num[0])) != 0:
			q.remove(int(num[0]))
	elif com == "deleteFirst":
		q.popleft()
	elif com == "deleteLast":
		q.pop()

print(*q)




Fixed submission:
from collections import deque
from sys import stdin

n = int(input())

q = deque()

for _ in range(n):
	cmd = stdin.readline().strip().split()
	if cmd[0] == "insert":
		q.appendleft(cmd[1])
	elif cmd[0] == "deleteFirst":
		q.popleft()
	elif cmd[0] == "deleteLast":
		q.pop()
	elif cmd[0] == "delete":
		try:
			q.remove(cmd[1])
		except:
			pass

print(*q)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

q = deque()

list2 = [input().split(" ") for _ in range(n)]

for lst in list2:

	if lst[0] == "insert":
		q.appendleft(int(lst[1]))
	elif lst[0] == "delete":
		if q.count(int(lst[1])) != 0:
			q.remove(int(lst[1]))
	elif lst[0] == "deleteFirst":
		q.popleft()
	elif lst[0] == "deleteLast":
		q.pop()

print(*q)



Fixed submission:
from collections import deque
from sys import stdin

n = int(input())

q = deque()

for _ in range(n):
	cmd = stdin.readline().strip().split()
	if cmd[0] == "insert":
		q.appendleft(cmd[1])
	elif cmd[0] == "deleteFirst":
		q.popleft()
	elif cmd[0] == "deleteLast":
		q.pop()
	elif cmd[0] == "delete":
		try:
			q.remove(cmd[1])
		except:
			pass

print(*q)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

q = deque()

list2 = [input().split(" ") for _ in range(n)]

for lst in list2:

	if lst[0] == "insert":
		q.appendleft(int(lst[1]))
	elif lst[0] == "delete":
		try:
			q.remove(int(lst[1]))
		except:
			pass

	elif lst[0] == "deleteFirst":
		q.popleft()
	elif lst[0] == "deleteLast":
		q.pop()

print(*q)



Fixed submission:
from collections import deque
from sys import stdin

n = int(input())

q = deque()

for _ in range(n):
	cmd = stdin.readline().strip().split()
	if cmd[0] == "insert":
		q.appendleft(cmd[1])
	elif cmd[0] == "deleteFirst":
		q.popleft()
	elif cmd[0] == "deleteLast":
		q.pop()
	elif cmd[0] == "delete":
		try:
			q.remove(cmd[1])
		except:
			pass

print(*q)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

q = deque()

for _ in range(n):
	com,*num = input().split(" ")
	if com == "insert":
		q.appendleft(num[0])
	elif com == "delete":
		try:
			q.remove(num[0])
		except:
			pass

	elif com == "deleteFirst":
		q.popleft()
	elif com == "deleteLast":
		q.pop()

print(*q)



Fixed submission:
from collections import deque
from sys import stdin

n = int(input())

q = deque()

for _ in range(n):
	cmd = stdin.readline().strip().split()
	if cmd[0] == "insert":
		q.appendleft(cmd[1])
	elif cmd[0] == "deleteFirst":
		q.popleft()
	elif cmd[0] == "deleteLast":
		q.pop()
	elif cmd[0] == "delete":
		try:
			q.remove(cmd[1])
		except:
			pass

print(*q)