Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B, C = main(int, input().split())
 
if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")

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

Buggy python submission (verdict: Runtime Error):
A, B, C = main(int, imput().split())

if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")

Fixed submission:
A, B, C = map(int, input().split())
 
if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s1, s2, s3 = map(input().split())

s1 = s1[0].str.upper()
s2 = s2[0].str.upper()
s3 = s3[0].str.upper()

print(s1, s2, s3)

Fixed submission:
s1, s2, s3 = input().split()

s1 = s1[0].upper()
s2 = s2[0].upper()
s3 = s3[0].upper()
 
print(s1+s2+s3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)
Buggy python submission (verdict: Runtime Error):
s = input()
a, b, k = s.split()
a, b, k = int(a), int(b), int(c)

aa = max(a-k, 0)
bb = max(b-max(k-a, 0), 0)
print(aa, bb)

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


aa = max(a-k, 0)
bb = max(b-max(k-a, 0), 0)
print(aa, bb)
Buggy python submission (verdict: Runtime Error):
import math
k=int(input())
if k%7==0:k/=7
if math.gcd(10,k)!=1: exit(print(-1))
if k==1: exit(print(1))
v=1
ans=0
while(v!=0):
    v=(v*10+1)%k
    ans+=1 
print(ans+1)

Fixed submission:
import math
k=int(input())
if k%7==0:k//=7
if math.gcd(10,k)!=1: exit(print(-1))
if k==1: exit(print(1))
v=1
ans=0
while(v!=0):
    v=(v*10+1)%k
    ans+=1 
print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout 
n,k=map(int,input().split())
a=[int(o) for o in input().split()]
prod=1
for i in range(k):
    prod*=a[i]
for i in range(k,n):
    prev=prod
    prod//=a[i-k]
    prod*=a[i]
    if prod>prev: stdout.write("Yes\n")
    else: stdout.write("No\n")


Fixed submission:
from sys import stdin, stdout 
n,k=map(int,input().split())
a=[int(o) for o in input().split()]
prod=1
for i in range(k,n):
    prev=a[i-k]
    if a[i]>prev: stdout.write("Yes\n")
    else: stdout.write("No\n")

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[int(o) for o in input().split()]
prod=1
for i in range(k):
    prod*=a[i]
for i in range(k,n):
    prev=prod
    prod//=a[i-k]
    prod*=a[i]
    if prod>prev: print("Yes")
    else: print("No")


Fixed submission:
from sys import stdin, stdout 
n,k=map(int,input().split())
a=[int(o) for o in input().split()]
prod=1
for i in range(k,n):
    prev=a[i-k]
    if a[i]>prev: stdout.write("Yes\n")
    else: stdout.write("No\n")
Buggy python submission (verdict: Runtime Error):
s=input()
if(s[0]==s[1] and s[1]==s[2])print("Yes")
else print("No")

Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2] :print("No")
else: print("Yes")

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

Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2] :print("No")
else: print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = [int(s) for s in input().split(" ")]
adict = {}
for a in alist:
  if a in adict:
    adict[a] += 1
  else:
    adict[a] = 1
q = int(input())
bclist = []
for _ in range(q):
  b, c = [int(s) for s in input().split(" ")]
  bclist.append([b, c])

for b, c in bclist:
  if c in adict and b in adict:
    adict[c] += adict[b]
    del adict[b]
  elif b in adict:
    adict[c] = adict[b]
    del adict[b]
  ans = 0
  for k, v in adict.items():
    ans += k * v
  print(ans)

Fixed submission:
n = int(input())
alist = [int(s) for s in input().split(" ")]
adict = {}
ans = 0
for a in alist:
  ans += a
  if a in adict:
    adict[a] += 1
  else:
    adict[a] = 1
q = int(input())
bclist = []
for _ in range(q):
  b, c = [int(s) for s in input().split(" ")]
  bclist.append([b, c])

for b, c in bclist:
  if c in adict and b in adict:
    ans += (c - b) * adict[b]
    adict[c] += adict[b]
    del adict[b]
  elif b in adict:
    ans += (c - b) * adict[b]
    adict[c] = adict[b]
    del adict[b]
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = [int(s) for s in input().split(" ")]

import copy
a_ans = []
for i in range(n):
  atmp = copy.copy(alist)
  del atmp[i]
  ans = atmp[0]
  for a in atmp[1:]:
    ans ^= a
  a_ans.append(ans)
print(" ".join([str(a) for a in a_ans]))

Fixed submission:
n = int(input())
alist = [int(s) for s in input().split(" ")]
asum = alist[0]
for a in alist[1:]:
  asum ^= a

import copy
a_ans = []
for i in range(n):
  asum ^= alist[i]
  a_ans.append(asum)
  asum ^= alist[i]
print(" ".join([str(a) for a in a_ans]))
Buggy python submission (verdict: Runtime Error):
x = int(input())

if 360 % x == 0:
  print(360 // x)
else:
  import math
  gcd = mat.gcd(x, 360)
  lcm = (x * 360) // gcd
  print(lcm // x)

Fixed submission:
x = int(input())
     
if 360 % x == 0:
  print(360 // x)
else:
  import math
  gcd = math.gcd(x, 360)
  lcm = (x * 360) // gcd
  print(lcm // x)
Buggy python submission (verdict: Runtime Error):
n, a, b = [int(s) for in input().split(" ")]

print("%d" % min(n * a, b))

Fixed submission:
n, a, b = [int(s) for s in input().split(" ")]

print("%d" % min(n * a, b))
Buggy python submission (verdict: Runtime Error):
n, d = [int(s) for s in input().split(" ")]
pts = []
for _ in range(n):
  pts.append([int(s) for s in input().split(" ")])

def dist(x, y):
  sum = 0
  for xx, yy in zip(x, y):
    sum += (xx - yy)**2
  return math.sqrt(sum)

cnt = 0
for i in range(n):
  for j in range(i + 1, n):
    d = dist(pts[i], pts[j])
    if int(d) == d:
      cnt += 1

print("%d" % cnt)

Fixed submission:
import math
n, d = [int(s) for s in input().split(" ")]
pts = []
for _ in range(n):
  pts.append([int(s) for s in input().split(" ")])

def dist(x, y):
  sum = 0
  for xx, yy in zip(x, y):
    sum += (xx - yy)**2
  return math.sqrt(sum)

cnt = 0
for i in range(n):
  for j in range(i + 1, n):
    d = dist(pts[i], pts[j])
    if int(d) == d:
      cnt += 1

print("%d" % cnt)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%f %d" % (a * 0.5, int(w // 2 == x and h // 2 == y))

Fixed submission:
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%lf %d" % (a * 0.5, int(divmod(w, 2) == (x, 0) and divmod(h, 2) == (y, 0))))

Buggy python submission (verdict: Runtime Error):
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%d %d" % (a * 0.5, int(w // 2 == x and h // 2 == y))

Fixed submission:
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%lf %d" % (a * 0.5, int(divmod(w, 2) == (x, 0) and divmod(h, 2) == (y, 0))))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

print(n - max(d.values()))

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

if len(d) == 0:
  print(n)
else:
  print(n - max(d.values()))

Buggy python submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

print(n - max(d.values()))

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

if len(d) == 0:
  print(n)
else:
  print(n - max(d.values()))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

num = Counter(s)

if len(num) <= k:
    print(0)
else:
    cnt = len(num) - k
    ans = 0
    i = 0
    for v in sorted(num.values()):
        if cnt == i:
            break
        ans += v
        i += 1

print(ans)

Fixed submission:
from collections import Counter

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

num = Counter(s)


if len(num) <= k:
    print(0)

else:
    cnt = len(num) - k
    ans = 0
    i = 0
    for v in sorted(num.values()):
        if cnt == i:
            break
        ans += v
        i += 1

    print(ans)
Buggy python submission (verdict: Runtime Error):
x,k,d = map(int,input().split())

if x < 0:
    x *= -1

if x-k*d < 0:
    if (k-(math.floor(x/d)))%2 == 0:
        print(x%d)
    else:
        print(abs(x%d-d))
else:
    print(x-k*d)

Fixed submission:
import math

x,k,d = map(int,input().split())

if x < 0:
    x *= -1

if x-k*d < 0:
    if (k-(math.floor(x/d)))%2 == 0:
        print(x%d)
    else:
        print(abs(x%d-d))
else:
    print(x-k*d)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

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

com = list(combinations(p,k))
ans = list(map(sum,com))
print(min(ans))

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0

for i in range(k):
    ans += p[i]
    i += 1

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

for i in range(1,99):
    if n <= 26**i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a')+N%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])

Fixed submission:
n = int(input())
ans = ''

for i in range(1,99):
    if n <= 26**i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a')+n%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])

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

for i in range(100):
    if n <= 26**i:
        n -= 1
        for j in range(i)
            ans += chr(ord('a')+N%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])

Fixed submission:
n = int(input())
ans = ''

for i in range(1,99):
    if n <= 26**i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a')+n%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
mul = 1

for i in range(n):
    mul *= a[i]

if(mul > 1000000000000000000):
    mul = -1

print(mul)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 1

if 0 in a:
    print(0)
    exit()

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        ans = -1
        break

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

while k > 0:
    if a > 0:
        a -= 1
        sum += 1
    elif b > 0:
        b -= 1
    elif c > 0:
        c -= 1
        sum -= 1
    k -= 1

print(sum)

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

if k >= a:
    sum += a
else:
    sum += k
    print(sum)
    exit()

k -= a+b
if k <= 0:
    print(sum)
    exit()

if k >= c:
    sum -= c
else:
    sum -= k

print(sum)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(1, max(p) + n))
# print(kouho)

for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1


if abs(kouho[right] - kouho[kouho_num]) > abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
elif abs(kouho[right] - kouho[kouho_num]) == abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
else:
  print(kouho[right])


Fixed submission:
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(-200, 200))


for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1

if (x not in p):
  print(x)
elif abs(kouho[right] - kouho[kouho_num]) > abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
elif abs(kouho[right] - kouho[kouho_num]) == abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
else:
  print(kouho[right])

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(1, max(p) + n))
# print(kouho)

for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1


if kouho[right] - kouho[kouho_num] > kouho[kouho_num] - kouho[left]:
  print(kouho[left])
elif kouho[right] - kouho[kouho_num] == kouho[kouho_num] - kouho[left]:
  print(kouho[left])
else:
  print(kouho[right])


Fixed submission:
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(-200, 200))


for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1

if (x not in p):
  print(x)
elif abs(kouho[right] - kouho[kouho_num]) > abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
elif abs(kouho[right] - kouho[kouho_num]) == abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
else:
  print(kouho[right])
Buggy python submission (verdict: Runtime Error):
a, v = map(int, input().split())
b, w = map(int, input().split())

t = int(input())


if (v <= w and a < b):
  ans = t + 1
else:
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")



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

t = int(input())

if v <= w:
  print("NO")

else:
  ans = (b - a) / (v - w)
  if t >= abs(ans):
    print("YES")
  else:
    print("NO")

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

t = int(input())


if (v <= w) and (b > a):
  ans = t + 1
else:
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")



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

t = int(input())

if v <= w:
  print("NO")

else:
  ans = (b - a) / (v - w)
  if t >= abs(ans):
    print("YES")
  else:
    print("NO")

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

t = int(input())


if v <= w and b > a:
  ans = t + 1
else: 
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")



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

t = int(input())

if v <= w:
  print("NO")

else:
  ans = (b - a) / (v - w)
  if t >= abs(ans):
    print("YES")
  else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1


if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]

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

else:
  print(0)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)

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

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

ans = reduce(mul,a)

if ans > 10 ** 18:
  print(-1)

else:
  print(ans)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)

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

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

ans = reduce(mul,a)

if ans > 10 ** 18:
  print(-1)

else:
  print(ans)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

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


ans = prod(a)

if ans > 10 ** 18:
  print(-1)

else:
  print(ans)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = [0] * n

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


ans = 1
for i in range(n):
  ans *= a[i]

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


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math

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

ans = 0

for x in range(n + 1):
  new = math.floor((a * x) / b) - a * math.floor(x / b)
  if new > ans:
    ans = new

print(ans)


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

if b <= n:
  if n != 1:
    n = b - 1

ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2

print(ans3)

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

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

ans = 0

for x in range(n + 1):
  new = math.floor((a * x) / b) - a * math.floor(x / b)
  if new > ans:
    ans = new

print(ans)


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

if b <= n:
  if n != 1:
    n = b - 1

ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2

print(ans3)

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

ans = 0

for x in range(n + 1):
  new = (a * x) // b - a * (x // b)
  if new > ans:
    ans = new

print(ans)



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

if b <= n:
  if n != 1:
    n = b - 1

ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2

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

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + a
  print(ans)




Fixed submission:
s = list(input())


if len(list(set(s))) == 1:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + (rem % a)
  print(ans)


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

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + a
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = tuple(input())
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    s = s[::-1]
  else:
    if (int(query[1]) == 1):
      s = list(s)
      s.insert(0, query[2])
      s = tuple(s)
    else:
      s = s + (query[2],)

print(''.join(s))




Fixed submission:
from collections import deque

d = deque()
s = input()
d.append(s)
rev = 0
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    rev = (rev + 1) % 2
  else:
    if ((int(query[1]) + rev) % 2 == 0):
      d.append(query[2])
    else:
      d.appendleft(query[2])

ans = ''.join(list(d))
if rev == 1:
  ans = ans[::-1]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    s.reverse()
  else:
    if (int(query[1]) == 1):
      s.insert(0, query[2])
    else:
      s.append(query[2])
  
print(''.join(s))




Fixed submission:
from collections import deque

d = deque()
s = input()
d.append(s)
rev = 0
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    rev = (rev + 1) % 2
  else:
    if ((int(query[1]) + rev) % 2 == 0):
      d.append(query[2])
    else:
      d.appendleft(query[2])

ans = ''.join(list(d))
if rev == 1:
  ans = ans[::-1]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    s.reverse()
  else:
    if (int(query[1]) == 1):
      s.insert(0, query[2])
    else:
      s.append(query[2])
  
print(''.join(s))




Fixed submission:
from collections import deque

d = deque()
s = input()
d.append(s)
rev = 0
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    rev = (rev + 1) % 2
  else:
    if ((int(query[1]) + rev) % 2 == 0):
      d.append(query[2])
    else:
      d.appendleft(query[2])

ans = ''.join(list(d))
if rev == 1:
  ans = ans[::-1]

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

if (a < 10 and b < 10):
  ans = a * b
else:
  ans = -1

print(ans)


Fixed submission:
a, b = (int(x) for x in input().split())

if (a < 10 and b < 10):
  ans = a * b
else:
  ans = -1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = n

for num in range(1, n + 1):
  if n % num == 0:
    data_x = n / num
    data_y = num
    new = data_x + data_y - 2

    if new < ans:
      ans = new

print(int(ans))



Fixed submission:
import math

def make_divisors(n):
  divisors = []
  for i in range(1, int(math.sqrt(n))+1):
    if n % i == 0:
      x = i
      y = n // i
      divisors.append([x, y])

  return divisors

def list_sum(t_list):
  return t_list[0] + t_list[1]

n = int(input())
yakusu = make_divisors(n)

data = list(map(list_sum, yakusu))
print(min(data) - 2)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split)

cover_b = b * 2
if cover_b > a:
  print(0)

else:
  print(a - cover_b)


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

cover_b = b * 2
if cover_b > a:
  print(0)

else:
  print(a - cover_b)