Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

R, G = iInM()
ans = 2 * G - R
print(ans)

Fixed submission:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

R = iIn()
G = iIn()

ans = 2 * G - R
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = min(n_color + n_rank[-1])

print(str(min_color) +' '+ str(max_color))
  



Fixed submission:
import bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = n_color + n_rank[-1]

print(str(min_color) +' '+ str(max_color))

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

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = min(n_color + n_rank[-1])

print(str(min_color) +' '+ str(max_color))
  



Fixed submission:
import bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = n_color + n_rank[-1]

print(str(min_color) +' '+ str(max_color))
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
A = list(map(int,input().split()))
product = 1

for x in range(n):
    product = product*A[x]

if product > 10**18:
    print(-1)
else:
    print(product)

Fixed submission:
import sys

n = int(input())
A = list(map(int,input().split()))
product = 1

if 0 in A:
    print(0)
    sys.exit()
else:
    for x in range(n):
        product = product*A[x]
        if product > 10**18:
            print(-1)
            sys.exit()

print(product)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
ans = 'No'

for i in X:
    j = X - i
    if (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)

Fixed submission:
X, Y = map(int, input().split())
ans = 'No'

for i in range(X+1):
    j = X - i
    if (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)

Buggy python submission (verdict: Runtime Error):
X = int(input())
Y = int(input())

flg = 0
for i in range(1, X):
    j = X - i
    ans = i*2 + j * 4

    if Y == ans:
        print("Yes")
        flg = 1
        break

if flg == 0:
    print("No")


Fixed submission:
X, Y = map(int, input().split())
ans = 'No'

for i in range(X+1):
    j = X - i
    if (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)

Buggy python submission (verdict: Runtime Error):
X = int(input())
Y = int(input())

flg = 0
for i in range(1, 100):
    j = X - i
    ans = i*2 + j * 4

    if ans == Y:
        print("Yes")
        flg = 1
        break

if flg == 0:
    print("No")


Fixed submission:
X, Y = map(int, input().split())
ans = 'No'

for i in range(X+1):
    j = X - i
    if (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)

Buggy python submission (verdict: Runtime Error):
X = int(input())
Y = int(input())

for i in range(1, 100):
    j = X - i
    ans = i*2 + j * 4

    if ans == Y:
        print("Yes")
        exit(1)

print("No")


Fixed submission:
X, Y = map(int, input().split())
ans = 'No'

for i in range(X+1):
    j = X - i
    if (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
n_list = list(map(int,input().split()))

a = 1
b = 10**18

for i in range(0,N):
  
  a = n_list[i] * a
  #print(a)
 
if a > b:
   print(-1)
else : 
  print(a)

Fixed submission:
import sys
N = int(input())
n_list = list(map(int,input().split()))

a = 1
b = 10**18

if 0 in n_list:
  print(0)
  sys.exit()

for i in range(0,N):
  
  a = n_list[i] * a
  #print(a)
 
  if a > b:
     print(-1)
     sys.exit()

print(a)
Buggy python submission (verdict: Runtime Error):
n = input()
s = input()

if len(s) <= n:
  print(s)
else :
  print(s[:n] + "...")

Fixed submission:
n = int(input())
s = input()

if len(s) <= n:
  print(s)
else :
  print(s[:n] + "...")
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
 
if len(s) + 1  == len(t) and s in t:
  print(Yes)
  
else :
  print(No)

Fixed submission:
s = input()
t = input()

if s == t[0:-1]:
  
  print('Yes')
  
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

if len(t) + 1  == len(s) and s in t:
  print(Yes)
  
else :
  print(No)

Fixed submission:
s = input()
t = input()

if s == t[0:-1]:
  
  print('Yes')
  
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())

ans=0

if a>= k:
  print(k)

elif a+b >= k:
  print(a)
  
else:
  print(a-((k-a-b))


Fixed submission:
a,b,c,k = map(int,input().split())

ans=0

if a>= k:
  print(k)

elif a+b >= k:
  print(a)
  
else:
  print(a-((k-a-b)))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int,input().split())

ans=0

for i in range(k):
  
  if a > 0:
    a = a-1
    ans = ans+1
 	
  elif b > 0:
    b = b-1
  
  elif c > 0:
    c = c-1
    ans = ans -1 
    
print(ans)
 

Fixed submission:
a,b,c,k = map(int,input().split())

ans=0

if a>= k:
  print(k)

elif a+b >= k:
  print(a)
  
else:
  print(a-((k-a-b)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
n = str(n)
 
flag = 0
 
for i in n:
  if(i != '7'):
    flag = 0
  else:
    flag = 1
 
    
if flag = 0:
  print('No')
else :
  print('Yes')

Fixed submission:
n = int(input())
 
n = str(n)
 
flag = 0
 
for i in n:
  if(i != '7'):
    flag = 0
  else:
    flag = 1
    break
 
    
if flag == 0:
  print('No')
else :
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n = longlong(input())

a = 0


for i in n:
	if(n%i*3 == 0 and n%i*5 == 0):
      a += i
    elif(n%i*3 == 0):
      a += i
    elif(n%i*5 == 0):
      a += i
print(i)
      
  
 

Fixed submission:
n = int(input())

a = 0


for i in range(1,n+1):
  
  if(i%3 == 0 or i%5 == 0):
    pass
  else:
    a += i
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(answer)


Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))

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

n = int(input())

answer = 0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gractions.gcd(i,j,h)
    	answer += f

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())

answer = 0.0

for i in range(1,n+1):
  
  for j in range(1,n+1):
    
    for h in range(1,n+1):
      f = gcd(i,j,h)
      answer += f
      
print(int(answer))
Buggy python submission (verdict: Runtime Error):
N = int(input())
mylist = (input().split(" "))
result = 1

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result > 10 ** 18:
            result = -1
            break
        else:
            result *= i
print(result)

Fixed submission:
N = int(input())
mylist = list(map(int , input().split(" ")))
result = 1

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result * i > 10 ** 18:
            result = -1
            break
        else:
            result *= i
            
print(result)
Buggy python submission (verdict: Runtime Error):
x = int(input())
y = int(input())
z = int(input())
point = x + y + z

if point <= 21:
  print("win")

else:
  print("bust")

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

point = x + y + z

if point <= 21:print("win")

else: print("bust")
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

def delete_list(n,l):
    new_l = l.copy()
    new_l.remove(new_l[n])
    return new_l

for i in range(n):
    print(max(delete_list(i,l)))

Fixed submission:
n = int(input())
l = []

for i in range(n):
    l.append(int(input()))

def has_duplicates(seq):
    return sorted(seq)[len(seq)-1] == sorted(seq)[len(seq)-2]

x = max(l)

if has_duplicates(l):
    for i in l:
        print(x)
else:
    for i in l:
        if i != x:
            print(x)
        else:
            print(sorted(l)[n-2])
Buggy python submission (verdict: Runtime Error):
s = input()
txt = []

for c in s:
  if c == 'B' && len(txt) > 0:
    txt.pop()
  else:
    txt.append(c)
    
print(''.join(txt))


Fixed submission:
s = input()
txt = []

for c in s:
    if c == 'B':
        if len(txt):
            txt.pop()
    else:
        txt.append(c)

print(''.join(txt))

Buggy python submission (verdict: Runtime Error):
s = input()
txt = []

for c in s:
  if c == 'B' and len(txt) > 0:
    txt.pop()
  elif:
    txt.append(c)
    
print(''.join(txt))


Fixed submission:
s = input()
txt = []

for c in s:
    if c == 'B':
        if len(txt):
            txt.pop()
    else:
        txt.append(c)

print(''.join(txt))

Buggy python submission (verdict: Runtime Error):
s = input()
txt = []

for c in s:
  if c == 'B' && len(txt) > 0:
    txt.pop()
  elif:
    txt.append(c)
    
print(''.join(txt))

Fixed submission:
s = input()
txt = []

for c in s:
    if c == 'B':
        if len(txt):
            txt.pop()
    else:
        txt.append(c)

print(''.join(txt))
Buggy python submission (verdict: Runtime Error):
from math import gcd

a, b = map(int, input().split())
print(int((a * b) / gcd(a, b)))

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())
print(int((a * b) / gcd(a, b)))

Buggy python submission (verdict: Runtime Error):
from math import gcd

a, b = map(int, input().split())
print((a * b) // gcd(a, b))

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())
print(int((a * b) / gcd(a, b)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
result = 1

for number in A:
  result = result * number
  
if result > 1000000000000000000:
  print(-1)  
  
else:
  print(result)
  

Fixed submission:
tukawan = int(input())
A = list(map(int, input().split())) 
result = 1

if 0 in A:
    print(0)

else:
  for number in A:
    result = result * number
    
    if result > 1000000000000000000:
      result = -1
      break
    
  print(result)

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

from operator import add, mul, sub,truediv, floordiv
from functools import reduce

result = reduce(lambda x, y: x*y, A)

if result > 10**18:
  print(-1)  
  
else:
  print(result)
  

Fixed submission:
tukawan = int(input())
A = list(map(int, input().split())) 
result = 1

if 0 in A:
    print(0)

else:
  for number in A:
    result = result * number
    
    if result > 1000000000000000000:
      result = -1
      break
    
  print(result)

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

result = 1
for number in A:
  result = result * number
  
if result > 10**18:
  print(-1)  
  
else:
  print(result)
  

Fixed submission:
tukawan = int(input())
A = list(map(int, input().split())) 
result = 1

if 0 in A:
    print(0)

else:
  for number in A:
    result = result * number
    
    if result > 1000000000000000000:
      result = -1
      break
    
  print(result)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
next_town = A[now-1]
count = 1
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K <= len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
next_town = A[now-1]
count = 1
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K < len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
count = 0
next_town = A[now-1]
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K <= len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
next_town = A[now-1]
count = 1
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K < len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])
Buggy python submission (verdict: Runtime Error):
X = int(input())
li = [i**5 for i in range(0,100,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Fixed submission:
X = int(input())
li = [i**5 for i in range(0,10000,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Buggy python submission (verdict: Runtime Error):
X = int(input())
li = [i**5 for i in range(0,65,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Fixed submission:
X = int(input())
li = [i**5 for i in range(0,10000,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Buggy python submission (verdict: Runtime Error):
X = int(input())
li = [i**5 for i in range(0,40,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Fixed submission:
X = int(input())
li = [i**5 for i in range(0,10000,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
Q = int(input())
count = 0
for i in range(Q):
    tmp = list(input().split())
    if tmp[0]=="1":
        count += 1
    else:
        if tmp[1]=="1" and count%2==0 or tmp[1]=="2" and count%2==1:
            S = tmp[2]+S
        elif tmp[1]=="2" and count%2==0 or tmp[1]=="1" and count%2==1:
            S = S+tmp[2]
if count%2==0:
    print(S)
else:
    print(S[::-1])


Fixed submission:
from collections import deque
S = deque(str(input()))
Q = int(input())
count = 0
for i in range(Q):
    tmp = list(input().split())
    if tmp[0]=="1":
        count += 1
    else:
        if tmp[1]=="1" and count%2==0 or tmp[1]=="2" and count%2==1:
            S.appendleft(tmp[2])
        elif tmp[1]=="2" and count%2==0 or tmp[1]=="1" and count%2==1:
            S.append(tmp[2])
if count%2==0:
    ans = "".join(S)
    print(ans)
else: 
    S.reverse()
    ans = "".join(S)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
Q = int(input())

for i in range(Q):
    tmp = list(input().split())
    if tmp[0]=="1":
        S = S[::-1]
    else:
        if tmp[1]=="1":
            S = tmp[2]+S
        else:
            S = S+tmp[2]
print(S)


Fixed submission:
from collections import deque
S = deque(str(input()))
Q = int(input())
count = 0
for i in range(Q):
    tmp = list(input().split())
    if tmp[0]=="1":
        count += 1
    else:
        if tmp[1]=="1" and count%2==0 or tmp[1]=="2" and count%2==1:
            S.appendleft(tmp[2])
        elif tmp[1]=="2" and count%2==0 or tmp[1]=="1" and count%2==1:
            S.append(tmp[2])
if count%2==0:
    ans = "".join(S)
    print(ans)
else: 
    S.reverse()
    ans = "".join(S)
    print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A==B and B==C:
    print("No")
else:
print("Yes")


Fixed submission:
A,B,C = map(int,input().split())
if (A==B and B==C and A==C) or (A!=B and B!=C and A!=C):
    print("No")
else:
    print("Yes")