Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
lis.sort()
p = 0
counter = n
for i in range(n):
    if i>0 and lis[i] == lis[i-1]:
        counter -=1
    elif i>0 and lis[i]<lis[0]*2:
        p += 1
    else:
        for j in range(n):
            if i != j and lis[i]%lis[j] ==0:
                counter -=1
                break
print(counter)


Fixed submission:
x, n = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort()
if n == 0:
    print(x)
else:
    for i in range(lis[n-1]+2):
        
        if i < x and i not in lis:
            a = i
        if i >= x and i not in lis:
            b = i
            if abs(a-x) <= abs(b-x):
                print(a)
            else:
                print(b)
            break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int, input().split()))
a = 1
for i in range(n):
    a = a * lis[i]
if a > 10**18:
    a = -1
print(a)

Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
a = 1
for i in range(n):
    a = a * lis[i]
    if a > 1000000000000000000:
        a = -1
        if 0 in lis:
            a = 0
        break
print(a)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

############################

x,n = map(int,input().split())

if n==0:
    print(x)
    exit()


z=101
p_list = list(map(int,input().split()))
pp_list = [i for i in range(min(p_list),max(p_list)+1)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)

Fixed submission:
# coding: utf-8

############################

x,n = map(int,input().split())

if n==0:
    print(x)
    exit()

z=101
p_list = list(map(int,input().split()))
pp_list = [i for i in range(102)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

############################

x,n = map(int,input().split())
p_list = list(map(int,input().split()))

if n==0:
    print(x)
    exit()


z=101
pp_list = [i for i in range(min(p_list),max(p_list)+1)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)

Fixed submission:
# coding: utf-8

############################

x,n = map(int,input().split())

if n==0:
    print(x)
    exit()

z=101
p_list = list(map(int,input().split()))
pp_list = [i for i in range(102)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

s=str(input())

if s=="AAA" or s="BBB":
    print("No")
else:
    print("Yes")

Fixed submission:
# coding: utf-8

s=str(input())

if s=="AAA" or s=="BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n,a,b=map(int,input().split())
cnt=0

x=n//(a+b)*a       # (a+b)個までで入っている青の数（入力例1の場合，3個）
y=n%(a+b)       # nを(a+b)で割った余り（入力例1の場合，1個）

for i in range(y):
    x += 1
    cnt += 1
    
    if cnt == a:
        break

print(x)

Fixed submission:
# coding: utf-8

n,a,b=map(int,input().split())
cnt=0

x=n//(a+b)*a       # a+b個までで入っている青の数（入力例1の場合，3個）
y=n%(a+b)       # nを(a+b)で割った余り（入力例1の場合，1）

if y>a:
    x = x + a
else:
    x = x + y

print(x)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
h=list(map(int,input().split()))

if n<=k:
    print(0)
else:
    for _ in range(k):
        h.remove(max(h))
    print(sum(h))

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
h=list(map(int,input().split()))

if n<=k:
    print(0)
else:
    h.sort()
    print(sum(h[:len(h)-k]))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n,k=map(int,input().split())
h=list(map(int,input().split()))

if n<=k:
    print(0)
else:
    for _ in range(k):
        h.remove(max(h))
    print(sum(h))

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
h=list(map(int,input().split()))

if n<=k:
    print(0)
else:
    h.sort()
    print(sum(h[:len(h)-k]))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n,k=map(int,input().split())
h=list(map(int,input().split()))

while k>0:
    if h:
        h.remove(max(h))
        k-=1
    elif not h:
        break

if h:
    print(sum(h))
elif not h:
    print(0)

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
h=list(map(int,input().split()))

if n<=k:
    print(0)
else:
    h.sort()
    print(sum(h[:len(h)-k]))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input=sys.stdin.readline

h=int(input())
cnt1=0
cnt2=1

while True:
    h=h//2
    cnt2*=2
    cnt1 += cnt2//2
    if h==1:
        break

print(cnt1+cnt2)

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

h=int(input())
cnt1=1
cnt2=0

while h>1:
    h=h//2
    cnt1*=2
    cnt2 += cnt1//2

print(cnt1+cnt2)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input=sys.stdin.readline

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0

for i in p:
    P.append(i)
    if i==min(P):
        cnt+=1

print(cnt)

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0
lowest=float("inf")

for i in p:
    if i<=lowest:
        lowest=i
        cnt+=1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0

for i in p:
    P.append(i)
    if i==min(P):
        cnt+=1

print(cnt)

Fixed submission:
# coding: utf-8

import sys
input=sys.stdin.readline

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0
lowest=float("inf")

for i in p:
    if i<=lowest:
        lowest=i
        cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import math

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

Fixed submission:
# coding: utf-8

import fractions

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

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import math

a,b = map(int,input().split())

def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

print(lcm(a, b))

Fixed submission:
# coding: utf-8

import fractions

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

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import math

a,b = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Fixed submission:
# coding: utf-8

import fractions

a,b = map(int,input().split())
print((a * b) // fractions.gcd(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n = int(input().rstrip())
a_list = list(map(int,input().split()))
money = 2020202020

for i in range(len(a_list)-1):
    x = a_list[:i+1]
    y = a_list[i+1:]
    z = abs(sum(x)-sum(y))
    
    if money > z:
        money = z

print(money)

Fixed submission:
# coding: utf-8

n = map(int,input().split())
a = list(map(int,input().split()))
a_sum = sum(a)
kyoukaisen = a_sum /2
left = 0

for i in range(len(a)):
    left += a[i]
    
    if left >= kyoukaisen:
        print(min(abs(a_sum - 2*left),abs( (a_sum - (left-a[i])) - (a_sum-(a_sum - (left-a[i])))) ))
        break
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
a = b = 1


def prime_factorize(n):     #関数
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
    
    
list_bunkai = prime_factorize(n)     #上記の関数による，試し割り法での素因数分解

if len(list_bunkai) > 2:             #要素数が2より大きい場合
    while a <= min(list_bunkai):
        a *= min(list_bunkai)
        list_bunkai.remove(min(list_bunkai))
else:                                #要素数が2の場合（nが1でしか割れない場合）
    a = min(list_bunkai)
    list_bunkai.remove(min(list_bunkai))
    

if len(list_bunkai) != 0:            #要素が1以上残っているなら，他の値を掛け合わせる
    for i in list_bunkai:
        b *= i 
    

print(a +b -2)                       #出力

Fixed submission:
# coding: utf-8

from math import sqrt
N = int(input())
n = int( N ** 0.5 )
ans = 0


for i in range(1,n+1):
    
    if N % i == 0:
        
      if ans == 0:
        ans = i + N/i
      else:
        ans = min(ans, i + N/i)
        

print(int(ans -2))
Buggy python submission (verdict: Runtime Error):
n = int(input().rstrip())
s = list(input())

for i in range(n):
    
    if s[i] == s[i+1]:
        s.pop(s[i+1])
        
print(len(s))

Fixed submission:
# coding: utf-8


n = int(input().rstrip())
s = list(input())
count = 0
 
 
for i in range(n):
    
    try:
        if s[i] == s[i+1]:
            count += 1
    except IndexError:
        break
        
        
print(len(s) - count)
Buggy python submission (verdict: Runtime Error):
i=(input().split())
j=(input().split())
k=(input())

A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)

print(B)

if B>=A:
    if (B-A)+W*T <= V*T:
        print("YES")
    else (B-A)+W*T > V*T:
        print("NO")

if B<A:
    if (A-B)+W*T <= V*T:
        print("YES")
    else (A-B)+W*T > V*T:
        print("NO")

Fixed submission:
i=(input().split())
j=(input().split())
k=(input())

A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)

if abs(B-A)+W*T <= V*T:
    print("YES")
elif abs(B-A)+W*T > V*T:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
if a+b >= k:
    print(a*1+b*0)
else:
    print(a*1+b*0(k-a-b)*(-1))
    



Fixed submission:
a,b,c,k = map(int,input().split())
xa = min(a,k)
k-=xa
xb=min(b,k)
k-=xb
xc=k
print(xa-xc)
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())

for i range(a, b):
  if i % k ==0:
    print("OK")
  else:
    print("NO")

Fixed submission:
k=int(input())
a,b=map(int,input().split())
for n in range(a, b+1):
    if n%k==0:
        print('OK')
        exit()
print('NG')
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

for _ in range(10000):
  C -= B
  if C <= 0:
    print("Yes")
    exit()

  A -= D
  if A <= 0:
    print("No")
    exit()


Fixed submission:
s, w = map(int, input().split())

if s > w:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
n = int(input())
long sum = 0
for i in range(1, n):
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        sum+= i
print(sum)

Fixed submission:
n = int(input())
sum = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
if a == 1 and b == 2:
  print("3")
elif a == 1 and b == 3:
  print("2")
elif a == 2 and b == 3:
  print("1")

Fixed submission:
a = int(input())
b = int(input())
if a == 1 and b == 2:
  print("3")
elif a == 1 and b == 3:
  print("2")
elif a == 2 and b == 3:
  print("1")
elif a == 2 and b == 1:
  print("3")
elif a == 3 and b == 1:
  print("2")
elif a == 3 and b == 2:
  print("1")
Buggy python submission (verdict: Runtime Error):
n = int(input())
d =list(map(int,input().split()))

s = 0

for i in range(n):
  	for j in range(i+1,n):
      	s += d[i] * d[j]
print(s)

Fixed submission:
n = int(input())
d =list(map(int,input().split()))
s = 0
for i in range(n):
    for j in range(i+1,n):
       s += d[i] * d[j]
print(s)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d =list(map(int,input().split()))

sum = 0

for i in range(n):
  	for j in range(i+1,n):
      	s += d[i] * d[j]
print(s)

Fixed submission:
n = int(input())
d =list(map(int,input().split()))
s = 0
for i in range(n):
    for j in range(i+1,n):
       s += d[i] * d[j]
print(s)
Buggy python submission (verdict: Runtime Error):
s,t=input()
ans=0
if s[0] == t[0]:
    ans+=1
if s[1] == t[1]:
    ans+=1
if s[2] == t[2]:
    ans+=1
print(ans)

Fixed submission:
s=input()
t=input()
ans=0
if s[0] == t[0]:
    ans+=1
if s[1] == t[1]:
    ans+=1
if s[2] == t[2]:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split(())))
count=0
for i in range(n);
    if p[i] != i+1:
        count+=1
if count==0 or count==2:
    print("Yes")
else:
    print("No")



Fixed submission:
N = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(N):
  if p[i] != i + 1:
    count += 1
    
if count <= 2:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split(())))
count=0
for i in range(n);
    if p[i] != i+1:
        count+=1
if count==0 or count==2:
    print("Yes")
else:
    print("Noß")



Fixed submission:
N = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(N):
  if p[i] != i + 1:
    count += 1
    
if count <= 2:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n= int(input())
v,c= list(map(int, input().split()))

ans=0
for i in range(n):
    if v[i] > c[i]:
        ans+=v[i]-c[i]
print(ans)


Fixed submission:
n= int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans=0
for i in range(n):
    if v[i] > c[i]:
        ans+=v[i]-c[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n[0] == "9" or n[1] == "9":
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")

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

if n[0] == 9:
  print("Yes")
elif n[1] == 9:
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")

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

if n[0] == 9 or n[1] == 9:
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")

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

if n[0] == 9 or n[1] == 9:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")

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

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 n == 92 or n == 93 n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Fixed submission:
n = input()

if n[0] == n[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

print("ABC" + n)

Fixed submission:
n = int(input())

print("ABC" + str(n))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0
	print("Possible")
else:
  	print("Impossible")

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
	print("Possible")
else:
  	print("Impossible")
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

a = [1,3,5,7,,8,10,12]
b = [4,6,9,11]

if x in a and y in a:
  	print("Yes")
elif x in b and y in b:
  	print("Yes")
else:
  	print("No")

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

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if x in a and y in a:
  	print("Yes")
elif x in b and y in b:
  	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input()).split()

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c = int(input())

if a <=c and b >= c:
  print("Yes")
else:
  print("No")

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c = int(input())

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
print(a[0].upper() + b[0].upper() + c[0]upper()) 

Fixed submission:

s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
print(a[0].upper() +b[0].upper() + c[0]upper()) 

Fixed submission:

s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Buggy python submission (verdict: Runtime Error):
S1,S2,S3 = list(map(str,input().split()))
s1.upper()
s2.upper()
s3.upper()
print(s1,s2,s3)

Fixed submission:

s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())
Buggy python submission (verdict: Runtime Error):

H, W = map(int, input().split())
for i in range(H):
s = input()
    print(s)
    print(s)



Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):

H, W = map(int, input().split())
for i in range(H):
  	s = input()
    print(s)
    print(s)


Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
for _ in range(H):
  	c = input()
    print(c)
    print(c)
    


Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
for i in range(h):
  	c = input()
    print(c)
    print(c)

Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())

for _ in range(h):
  	c = input()
    print(c)
    print(c)
    


Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())

for _ in range(h):
  	c = input()
    print(c)
    print(c)
    


Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())

for i in range(h):
  	c = input()
    print(c)
    print(c)

Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())

for i in range(h):
  	c = input()
    print(c)
    print(c)

Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

A0 = 0
A1 = 0
B0 = 0
B1 = 0

A0 = a / 0.08
A1 = (a+1) / 0.08
B0 = b / 0.1
B1 = (b+1) / 0.1
ans1 = [i for i in range(int(A0), int(A1)+1)]
ans2 = [i for i in range(int(B0), int(B1)+1)]
ans = set(ans1) &  set(ans2)
if ans == {}:
    print('-1')
else:
    print(min(ans))

Fixed submission:
import math as ma
def minCharge810(a, b):
    A0 = 0
    A1 = 0
    B0 = 0
    B1 = 0

    A0 = ma.ceil(a / 0.08)
    A1 = ma.floor((a+1) / 0.08)
    B0 = ma.ceil(b / 0.1)
    B1 = ma.floor((b+1) / 0.1)

    ans1 = [i for i in range(int(A0), int(A1))]
    ans2 = [i for i in range(int(B0), int(B1))]
    ans = set(ans1) &  set(ans2)
    if ans == set():
        return '-1'
    else:
        return min(ans)
a, b = map(int, input().split())
print(minCharge810(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for i in range(1, q+1):
    try:
        t, f, c = input().split()
    except ValueError:
        t = '1'
    if t == '1':
        s = s[::-1]
    else:
        if f == '1':
            s = c + s
        else:
            s = s + c
print(s)

Fixed submission:
s = input()
q = int(input())
inv = False
left =''
right = ''

for i in range(1, q+1):
    try:
        t, f, c = input().split()
    except ValueError:
        t = '1'
    if t == '1':
        inv = not inv
    else:
        if inv:
            if f == '1':
                right = right + c
            else:
                left = c + left
        else:
            if f == '1':
                left = c + left
            else:
                right = right + c
#     print('%s, %s, %s, %s, %s' %(left, right, inv, t, f))

# # print(left)
# # print(right)
if inv:
    right = right[::-1]
    left = left[::-1]
    s = s[::-1]
    print(right + s + left)
else:
    print(left + s + right)