Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = input().split()
if '0' in A:
  print(0)
else:
  a = 1
  for i in A:
    a *= int(i)
  if a > 10**18:
      print(-1)
  else:
    print(a)

Fixed submission:
N = input()
A = input().split()
if '0' in A:
  print(0)
else:
  a = 1
  for i in A:
    a *= int(i)
    if a > 10**18:
        print(-1)
        exit()
  else:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
N = input()
A = list(map(int, input().split()))
a = 1
if 0 in A:
  print(0)
else:
  a = reduce(lambda x, y:x*y, A)
  if a > 10**18:
      print(-1)
  else:
    print(a)

Fixed submission:
N = input()
A = input().split()
if '0' in A:
  print(0)
else:
  a = 1
  for i in A:
    a *= int(i)
    if a > 10**18:
        print(-1)
        exit()
  else:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = map(int, input().split())
a = 1
for i in A:
  a *= i
  
if a > 10**18:
	print(-1)
else:
  print(a)

Fixed submission:
N = input()
A = input().split()
if '0' in A:
  print(0)
else:
  a = 1
  for i in A:
    a *= int(i)
    if a > 10**18:
        print(-1)
        exit()
  else:
    print(a)
Buggy python submission (verdict: Runtime Error):
n = input()
A = []
B = []
for i in range(n):
  a,b = map(int, input().split())
  A.append(a)
  B.append(b)
A.sort()
B.sort()
j = n//2
if n%2 == 0:
  print((B[j]+B[j+1])-(A[j]+A[j+1])+1)
else:
  print(B[j]-A[j]+1)

Fixed submission:
n = int(input())
A = []
B = []
for i in range(n):
  a,b = list(map(int, input().split()))
  A.append(a)
  B.append(b)
A.sort()
B.sort()
j = n//2
if n%2 == 0:
  print((B[j]+B[j-1])-(A[j]+A[j-1])+1)
else:
  print(B[j]-A[j]+1)
Buggy python submission (verdict: Runtime Error):
import math

n,d=list(map(int(input().split()))
         
print (math.ceil(n/1+2*d))

Fixed submission:
import math

n, d = list(map(int, input().split()))

print(math.ceil(n / (1+2*d)))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split(' '))
Mod=1000000007
spl=int(n**0.5)+1
f,k=[i for i in range(spl)]+[n//i for i in range(1,spl)][::-1],2*spl-1
dp=[0]+[1]*(k-1)
for i in range(m):
	dp2=[0]*k
	for j in range(1,k):
		dp2[j]=(dp2[j-1]+dp[k-j]*(f[j]-f[j-1]))%Mod
	dp=dp2
print(dp[k-1])

Fixed submission:
n,m=map(int,input().split(' '))
Mod=1000000007
spl=int(n**0.5)+1
f,k=[i for i in range(spl)]+[n//i for i in range(1,spl)][::-1],2*spl-1
dp=[0]+[1]*(k-1)
for i in range(m):
	dp2=[0]*k
	for j in range(1,k):
		dp2[j]=(dp2[j-1]+dp[k-j]*(f[j]-f[j-1]))%Mod
	dp=dp2
print(dp[k-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18:
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18 and i < len(a):
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans*=i
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18 and i < len(a):
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  print(a.count(i+1))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
All = Counter(a)
for i in range(1,n+1):
    try:
        print(All[i])
    except:
        print(0)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split()
ans = max(a+b), a-b)
ans = max(ans, a*b)
print(ans)

Fixed submission:
a, b = map(int, input().split())
ans = max(a+b, a-b)
ans = max(ans, a*b)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for _ in range(n):
    s.append(sorted(input()))
count = 0
for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            count += 1
print(count)

Fixed submission:
import collections
n = int(input())
d = collections.defaultdict(int)
for _ in range(n):
    a = sorted(input())
    s = ''.join(a)
    d[s] += 1
count = 0
for v in d.values():
    count += v * (v-1) // 2
print(count)
Buggy python submission (verdict: Runtime Error):
from heapq import *
n, m = map(int, input().split())
pay = []
for _ in range(n):
    a, b = map(int, input().split())
    pay.append((a, b))
pay = sorted(pay, reverse=True)
print(pay)
q = []
ans = 0
for i in range(1, m+1):
    while pay and pay[-1][0] <= i:
        a, b = pay.pop()
        heappush(q, -b)
    print(q)
    if q:
        b = -heappop(q)
        ans += b
print(ans)

Fixed submission:
from heapq import *
n, m = map(int, input().split())
pay = []
for _ in range(n):
    a, b = map(int, input().split())
    pay.append((a, b))
pay = sorted(pay, reverse=True)
q = []
ans = 0
for i in range(1, m+1):
    while pay and pay[-1][0] <= i:
        a, b = pay.pop()
        heappush(q, -b)
    if q:
        b = -heappop(q)
        ans += b
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

T = input()

x = T[0:-1]

if S == x and :
    print('YES')
else:
    print('NO')


Fixed submission:
S = input()

T = input()

x = T[0:-1]

if S == x:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

x = T - S

y = len(x)

if y == 1:
    print('YES')
else:
    print('NO')


Fixed submission:
S = input()

T = input()

x = T[0:-1]

if S == x:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()

a = input()

T = S + a

if T - a == S:
    print('YES')
else:
    print('NO')


Fixed submission:
S = input()

T = input()

x = T[0:-1]

if S == x:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()

a = input()

T = S + a

if T - a = S:
    print('YES')
else:
    print('NO')


Fixed submission:
S = input()

T = input()

x = T[0:-1]

if S == x:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()

if S = 'ABC':
    print('ARC')
else:
    print('ABC')


Fixed submission:
S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy python submission (verdict: Runtime Error):
S = str(input())

if S = 'ABC':
    print('ARC')
else:
    print('ABC')

Fixed submission:
S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')
Buggy python submission (verdict: Runtime Error):
S, W = int(inpit())

if S <= W:
    print('unsafe')
else S > W:
    print('safe')
    


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

if S <= W:
    print('unsafe')
else:
    print('safe')

Buggy python submission (verdict: Runtime Error):
S, W = int(input())

if S <= W:
    print('unsafe')
    elif S > W
    print('safe')
    


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

if S <= W:
    print('unsafe')
else:
    print('safe')

Buggy python submission (verdict: Runtime Error):
S, W = int(inpit())

if S <= W:
    print('unsafe')
    elif S > W
    print('safe')
    

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

if S <= W:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)
ans=0

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

while b>0 and k>0:
  b+=-1
  k+=-1

while c>0 and k>0:
  ans+=-1
  c+=-1
  k+=-1
  
print(ans)

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

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

if b>0 and k>0 and b<=k:
  k=k-b
elif b>0 and k>0 and b>k:
  k=0
  
if c>0 and k>0 and c<=k:
  k=k-c
  ans=ans-c
elif c>0 and c>0 and c>k:
  ans=ans-k
  k=0

  
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, c, k=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)
ans=0

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
   k=0

while b>0 and k>0:
  b+=-1
  k+=-1

while c>0 and k>0:
  ans+=-1
  c+=-1
  k+=-1
  
print(ans)

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

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

if b>0 and k>0 and b<=k:
  k=k-b
elif b>0 and k>0 and b>k:
  k=0
  
if c>0 and k>0 and c<=k:
  k=k-c
  ans=ans-c
elif c>0 and c>0 and c>k:
  ans=ans-k
  k=0

  
print(ans)

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

while a>0 and k>0:
  ans+=1
  a+=-1
  k+=-1

while b>0 and k>0:
  b+=-1
  k+=-1

while c>0 and k>0:
  ans+=-1
  c+=-1
  k+=-1
  
print(ans)

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

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

if b>0 and k>0 and b<=k:
  k=k-b
elif b>0 and k>0 and b>k:
  k=0
  
if c>0 and k>0 and c<=k:
  k=k-c
  ans=ans-c
elif c>0 and c>0 and c>k:
  ans=ans-k
  k=0

  
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

r=int(import())

print(r*math.pi*2)

Fixed submission:
import math

r=float(input())

print(2*r*math.pi)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
sum_=1
for i in range(N):
    while sum_ < 10**18:
        sum_ *= a[i]
        if sum_ > 10**18:
            sum_ =-1
        break
        if sum_ = 0:
        break
print(sum_)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
sum_=1
if 0 in a:
    print (0)
else:
    for i in range(N):
        sum_ *= a[i]
        if sum_> 10**18:
            sum_ =-1
            break
    print(sum_)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
sum_=1
for i in range(N):
    while sum_ < 10**18:
        sum_ *= a[i]
        if sum_ > 10**18:
            sum_ =-1
        break
        if sum_ = 0:
            break
print(sum_)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
sum_=1
if 0 in a:
    print (0)
else:
    for i in range(N):
        sum_ *= a[i]
        if sum_> 10**18:
            sum_ =-1
            break
    print(sum_)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
sum_=1
for i in range(N):
    while sum_ < 10**18:
        sum_ *= a[i]
        if sum_ > 10**18:
            sum_ =-1
        break
print(sum_)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
sum_=1
if 0 in a:
    print (0)
else:
    for i in range(N):
        sum_ *= a[i]
        if sum_> 10**18:
            sum_ =-1
            break
    print(sum_)
Buggy python submission (verdict: Runtime Error):
A = int(input('A = '))
B = int(input('B = '))
C = int(input('C = '))
K = int(input('Selected number = '))
#----------以上入力----------
if A+B >= K:
    print(A)
else:
    print(A-(K-A-B))

Fixed submission:
#ABC167
A,B,C,K=map(int,input().split())
#----------以上入力----------
if A > K:
    print(K)
elif  A+B >= K:
    print(A)
else:
    print(A-(K-A-B))
Buggy python submission (verdict: Runtime Error):
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b] = 0
    elif H[a-1] < H[b-1]:
        A[a] = 0
    else:
        A[a] = 0
        A[b] = 0
print(N-A.count(0))

Fixed submission:
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0
print(N-A.count(0))

Buggy python submission (verdict: Runtime Error):
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(N))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0 and A[b-1] = 0

print(N-A.count(0))

Fixed submission:
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0
print(N-A.count(0))

Buggy python submission (verdict: Runtime Error):
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(M))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1]>H[b-1]:
        A[b-1] = 0
    elif H[a-1]<H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0

print(N-A.count(0))

Fixed submission:
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0
print(N-A.count(0))
Buggy python submission (verdict: Runtime Error):
n = int(input())

def solve(n):
    res = 0
    for i in range(2, int(n ** 0.5) + 2):
        cnt = 0
        while n % pow(i, cnt + 1) == 0:
            n /= pow(i, cnt + 1)
            cnt += 1
            if n % pow(i, cnt + 1) != 0:
                res += cnt
                break
    
    if n != 1:
            res = 1
    
    return res

print(solve(n))


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

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

Fixed submission:
a, b = map(int, input().split())
print(a * b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
print(-1 if ans > pow(10, 18) else ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
def solve(a):
    ans = 1
    if 0 in a:
        return 0
    for i in a:
        ans *= i
        if ans > pow(10, 18):
            return -1
    return ans
ans = solve(a)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
if n % 2 == 0:
  print(n / 2)
else:
  print((n + 1) / 2)

Fixed submission:
n = int(input())
if n % 2 == 0:
  print(int(n / 2))
else:
  print(int((n + 1) / 2))
Buggy python submission (verdict: Runtime Error):
n = int(input()) % 10
if n in {2, 4, 5, 7, 9}:
    print('hon')
elif n in {0, 1, 6, 8}:
    print('pon')
else
    print('bon')


Fixed submission:
n = int(input()) % 10
if n in {2, 4, 5, 7, 9}:
    print('hon')
elif n in {0, 1, 6, 8}:
    print('pon')
else:
    print('bon')
Buggy python submission (verdict: Runtime Error):
def pal(s):
  f = True;
  i = 0;
  l = s.size() - 1;
  while i < l - i:
    if s[i] != s[l - i]:
      f = false;
	i++;
  return f;

s = input();
f = pal(s) and pal(s[0:(n//2 - 1):]) and pal(s[(n//2 + 1)::]);
if f == True:
  print("Yes");
else:
  print("No");

Fixed submission:
def pal(t):
  return t == t[::-1];


s = input();
f = pal(s) and pal(s[0:len(s)//2:]) and pal(s[(len(s)//2 + 1)::]);
#f = pal(s);
if f == True:
  print("Yes");
else:
  print("No");
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
aa = list(map(int, input().split()))

if 0 in aa:
    print("0")
else:
    result = 1
    for a in aa:
        result *= a

    if result > pow(10, 18):
        result = -1

    print(result)


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

if 0 in aa:
    print('0')
    exit(0)

result = 1
for a in aa:
    result *= a
    if result > pow(10, 18):
        print('-1')
        exit(0)

print(result)

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

result = 1
for a in aa:
    result *= a

if result > pow(10, 18):
    result = -1

print(result)


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

if 0 in aa:
    print('0')
    exit(0)

result = 1
for a in aa:
    result *= a
    if result > pow(10, 18):
        print('-1')
        exit(0)

print(result)
Buggy python submission (verdict: Runtime Error):
, m = list(map(int, input().split(' ')))


# 再帰処理：関数の中でその関数自身が呼び出されること。→ 繰り返し処理の実装が可能
def conversion(_n, _m):
    if int(_n / _m):
        return conversion(int(_n / _m), _m) + str(_n % _m)
    return str(_n % _m)


print(conversion(n, m))


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


# 再帰処理：関数の中でその関数自身が呼び出されること。→ 繰り返し処理の実装が可能
def conversion(_n, _m):
    if int(_n / _m):
        return conversion(int(_n / _m), _m) + str(_n % _m)
    return str(_n % _m)


digit = (conversion(n, m))
print(len(digit))
Buggy python submission (verdict: Runtime Error):
S = int(input())
if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')

Fixed submission:
S = input()
if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
ballcolumn = ''
for i in range(round(N/(A+B))+1):
    ballcolumn+=blue*A
    ballcolumn+=red*B
targetstring = ballcolumn[:N]
print(targetstring.count('b'))

Fixed submission:
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
amari = N % (A+B)
if A >= amari: 
    countnum = N // (A+B) * A +amari
else:
    countnum = N // (A+B) * A +A
print(countnum)

Buggy python submission (verdict: Runtime Error):
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
ballcolumn = ''
for i in range(10**100):
    ballcolumn+=blue*A
    ballcolumn+=red*B
targetstring = ballcolumn[:N]
print(targetstring.count('b'))

Fixed submission:
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
amari = N % (A+B)
if A >= amari: 
    countnum = N // (A+B) * A +amari
else:
    countnum = N // (A+B) * A +A
print(countnum)

Buggy python submission (verdict: Runtime Error):
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
ballcolumn = ''
for i in range(10):
    ballcolumn+=blue*A
    ballcolumn+=red*B
targetstring = ballcolumn[:N]
print(targetstring.count('b'))

Fixed submission:
inputarray = input().split(' ')
N = int(inputarray[0])
A = int(inputarray[1])
B = int(inputarray[2])
blue = 'b'
red = 'r'
amari = N % (A+B)
if A >= amari: 
    countnum = N // (A+B) * A +amari
else:
    countnum = N // (A+B) * A +A
print(countnum)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        S = S[::-1]
    elif list[1] == '1':
        S = list[2]+S
    elif list[1] == '2':
        S = S+list[2]
print(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        S = S[::-1]
    elif list[1] == '1':
        S = list[2]+S
    elif list[1] == '2':
        S = S+list[2]
print(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        S = S[::-1]
        continue
    elif list[1] == '1':
        S = list[2]+S
        continue
    elif list[1] == '2':
        S = S+list[2]
        continue
print(S)

Fixed submission:
from collections import deque
S = deque()
S.extend(input())
Q = int(input())
reverse = 0
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        reverse += 1
    elif list[1] == '1':
        if reverse % 2 == 1:
            S.append(list[2])
        else:
            S.appendleft(list[2])
    elif list[1] == '2':
        if reverse % 2 == 1:
            S.appendleft(list[2])
        else:
            S.append(list[2])
if reverse % 2 == 1:
    S.reverse()
ans = ''.join(S)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split(' '))
num = 0
if A == B == C:
    print(-1)
elif A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        A_c = A
        B_c = B
        C_c = C
        A = B_c /2 + C_c / 2
        B = A_c / 2 + C_c /2
        C = A_c /2 + B_c / 2
        num += 1
    print(num)
else:
    print(0)

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
N=input()
if N%2 == 0:
  print(int(N/2))
else:
  print(int(((N+1)/2)))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(int(N/2))
else:
  print(int((N+1)/2))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(int(N/2))
else:
  print(int(N+1/2))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(int(N/2))
else:
  print(int(round(N/2)))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(int(N/2))
else:
  print(int(round(N/2)))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
N=101
if N%2 == 0:
  print(int(N/2))
else:
  print(int(round(N/2))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(N/2)
else:
  print(math.ceil(N/2))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))

Buggy python submission (verdict: Runtime Error):
if N%2 == 0:
  print(N/2)
else:
  print(ceil(N/2))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))