Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def palindrome(s):
  for i in range(len(s) // 2):
    if s[i] != s[-i -1]:
      return False
  return True

def main():
  s = input()
  t = ''
  for ch in s:
    if ch != 'x':
      t += ch

  if (palindrome(t) == False):
    print(-1)
    return

  cnt = 0
  odd = len(t) & 1
  mid = len(t) // 2

  if odd == 1:  # ax[b]a

    for i in range(len(s)):
      if s[i] != 'x':
        cnt += 1
        if cnt == mid + 1:
          s1 = s[      : i]
          s2 = s[i + 1 :  ]
          break    

  else: # a[x]a

    for i in range(len(s)):
      if s[i] != 'x':
        cnt += 1
        if cnt == mid:
          s1 = s[  : i + 1]
        if cnt == mid + 1:
          s2 = s[i :  ]
          break

  st = ''
  for ch in s2:
    st = ch + st

  # print(s1, st)
  ans = 0
  i = 0
  j = 0
  while (i < len(s1) and j < len(st)):
    c1 = s1[i]
    c2 = st[j]
    if c1 == c2:
      i += 1
      j += 1
      continue

    ans += 1
    if c1 == 'x':
      i += 1
    else:
      j += 1

  ans += (len(s1) - i) + (len(st) - j)
  print(ans)






if __name__ == '__main__':
  main()

Fixed submission:
def palindrome(s):
  for i in range(len(s) // 2):
    if s[i] != s[-i -1]:
      return False
  return True

def main():
  s = input()
  t = ''
  for ch in s:
    if ch != 'x':
      t += ch

  if len(t) == 0:
    print(0)
    return

  if (palindrome(t) == False):
    print(-1)
    return

  cnt = 0
  odd = len(t) & 1
  mid = len(t) // 2

  if odd == 1:  # ax[b]a

    for i in range(len(s)):
      if s[i] != 'x':
        cnt += 1
        if cnt == mid + 1:
          s1 = s[      : i]
          s2 = s[i + 1 :  ]
          break    

  else: # a[x]a

    for i in range(len(s)):
      if s[i] != 'x':
        cnt += 1
        if cnt == mid:
          s1 = s[  : i + 1]
        if cnt == mid + 1:
          s2 = s[i :  ]
          break

  # print(s1, s2)
  ans = 0
  i = 0
  j = 0
  while (i < len(s1) and j < len(s2)):
    c1 = s1[i]
    c2 = s2[-j-1]
    if c1 == c2:
      i += 1
      j += 1
      continue

    ans += 1
    if c1 == 'x':
      i += 1
    else:
      j += 1

  ans += (len(s1) - i) + (len(s2) - j)
  print(ans)






if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def main():
    b = []
    line = input().split(" ")
    H = int(line[0])
    W = int(line[1])
    for l in range(H):
        b.append(input())

    result = []
    for i, line in enumerate(b):
        result_row = ""
        for j, c in enumerate(line):
            if c == ".":
                n = count(i, j, b, H, W)
                result_row += str(n)
            else:
                result_row += b[i][j]
        result.append(result_row)

    for l in result:
        print(l)


def count(row, column, board, H, W):
    n = 0
    rs, re = judge_row(row, H)
    cs, ce = judge_col(column, W)
    for r in range(rs, re):
        for c in range(cs, ce):
            if board[r][c] == "#":
                n += 1
    return n


def judge_row(row, H):
    if row == 0:
        return row, row+1+1 
    elif row == H-1:
        return row-1, row+1
    else:
        return row-1, row+1+1


def judge_col(col, W):
    if col == 0:
        return col, col+1+1 
    elif col == W-1:
        return col-1, col+1
    else:
        return col-1, col+1+1


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    b = []
    line = input().split(" ")
    H = int(line[0])
    W = int(line[1])
    for l in range(H):
        b.append(input())

    result = []
    for i, line in enumerate(b):
        result_row = ""
        for j, c in enumerate(line):
            if c == ".":
                n = count(i, j, b, H, W)
                result_row += str(n)
            else:
                result_row += b[i][j]
        result.append(result_row)

    for l in result:
        print(l)


def count(row, column, board, H, W):
    n = 0
    rs, re = judge_row(row, H)
    cs, ce = judge_col(column, W)
    for r in range(rs, re):
        for c in range(cs, ce):
            if board[r][c] == "#":
                n += 1
    return n


def judge_row(row, H):
    if H == 1:
        return 0, 1
    elif row == 0:
        return row, row+1+1 
    elif row == H-1:
        return row-1, row+1
    else:
        return row-1, row+1+1


def judge_col(col, W):
    if W == 1:
        return 0, 1
    elif col == 0:
        return col, col+1+1 
    elif col == W-1:
        return col-1, col+1
    else:
        return col-1, col+1+1


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

input()
d_list = input().split(" ")
input()
t_list = input().split(" ")

d_dict = defaultdict(lambda: 0)
for d in d_list:
    d_dict[d] += 1

t_dict = defaultdict(lambda: 0)
for t in t_list:
    t_dict[t] += 1

for k, v in t_dict.items():
    if v > d_dict[k]:
        print("NO")
        exit(1)
print("YES")

Fixed submission:
from collections import defaultdict

input()
d_list = input().split(" ")
input()
t_list = input().split(" ")

d_dict = defaultdict(lambda: 0)
for d in d_list:
    d_dict[d] += 1

t_dict = defaultdict(lambda: 0)
for t in t_list:
    t_dict[t] += 1

yes = True
for k, v in t_dict.items():
    if v > d_dict[k]:
        print("NO")
        yes = False
        break
if yes:
    print("YES")
Buggy python submission (verdict: Runtime Error):
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
print (a+b)*h/2

Fixed submission:
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
print (a+b)*c/2
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a < 0 and b < 0 and (b-a)%2 == 0:
    print 'Negative'
elif 0 in range(a, b+1):
    print 'Zero'
else:
    print 'Positive'

Fixed submission:
a, b = map(int, raw_input().split())
if a < 0 and b < 0 and (b-a)%2 == 0:
    print 'Negative'
elif a <= 0 <= b:
    print 'Zero'
else:
    print 'Positive'
Buggy python submission (verdict: Runtime Error):
s = input()
go = []
back = []
start = 0
end = len(s)-1
res = 0
while start<=end:
    gox = 0
    backx = 0
    while s[start] == 'x' and start<=end:
        start+=1
        gox += 1
    while s[end] == 'x'and start<=end:
        end -= 1
        backx +=1
    if start == end and s[start] == 'x':
        break
    if s[start] == s[end]:
        start += 1
        end -=1
        res += abs(gox-backx)
        gox = 0
        backx = 0
    else:
        res = -1
        break

print(res)


Fixed submission:
s = input()
go = []
back = []
start = 0
end = len(s)-1
res = 0
while start<=end:
    gox = 0
    backx = 0
    while s[end] == 'x' or s[start] == 'x':
        if s[start] == 'x' and start<end:
            start+=1
            gox += 1
        if s[end] == 'x'and start<end:
            end -= 1
            backx +=1
        if start == end:break
    if start == end and s[start] == 'x':
        break
    if s[start] == s[end]:
        start += 1
        end -=1
        res += abs(gox-backx)
        gox = 0
        backx = 0
    else:
        res = -1
        break

print(res)
Buggy python submission (verdict: Runtime Error):
if a == b and a != c:
    print(c)
elif a != b and a == c:
    print(b)
else:
    print(a)

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

if a == b and a != c:
    print(c)
elif a != b and a == c:
    print(b)
else:
    print(a)

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

if a == b:
  print(c)
elif a == c:
  print(b):
else:
  print(a)

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

if a == b:
  print(c)
elif a == c:
  print(b)
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
x, a, b = map(int, input().split())

if |x - a| >= |x-b|:
  print('A')

else:
  print('B')

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

if abs(x - a) >= abs(x - b):
  print('B')

else:
  print('A')
Buggy python submission (verdict: Runtime Error):
N = input()
if N = N[::-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()
if N == N[::-1]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
pirnt((n-1)*(m-1))

Fixed submission:
n,m = map(int, input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Runtime Error):
x, a, b =map(int, input().split())
if b - a > x
  print('dangerous')
elif b - a == x:
  print('safe')
else:
  print('delicious')
  

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

if a < b <= x + a:
  print('safe')
  
elif b <= a:
  print('delicious')

else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
a, b, c = input().split()
if b = '+':
  print(int(int(a) + int(c)))
else:
  print(int(int(a) - int(c)))

Fixed submission:
a, b, c = input().split()
if b == '+':
  print(int(int(a) + int(c)))
else:
  print(int(int(a) - int(c)))

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

print(int(a b c))

Fixed submission:
a, b, c = input().split()
if b == '+':
  print(int(int(a) + int(c)))
else:
  print(int(int(a) - int(c)))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if (a + b == c) or (a + c == b) or (b + c ==a):
  print(Yes)
else:
  print(No)

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

if (a + b == c) or (a + c == b) or (b + c ==a):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
num = map(int, input().split())
a = num[0]
b = num[1]
c = num[2]

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)




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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

Buggy python submission (verdict: Runtime Error):
num = map(int, input.split())
a = num[0]
b = num[1]
c = num[2]

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)




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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)




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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)




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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)



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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
  print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
  print(2)

else:
  print(3)


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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
	print(1)

if (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
	print(2)

else:
	print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)
Buggy python submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
		total += X
    else:
		total += Y

print(total)


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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)


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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a <= K:
      total += X
    else:
      total += Y

print(total)


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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)

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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (a ==5 and b==5 and c ==7) or (a==5 and b==7 and c==5) or (a==7 and b==5 and C==5):
    print('YES')
else:
    print('NO')


Fixed submission:
a, b, c = map(int, input().split())
if (a ==5 and b==5 and c ==7) or (a==5 and b==7 and c==5) or (a==7 and b==5 and c==5):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import scipy.misc as scm
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
   print(scm.comb(len(a), k, True) % mod - scm.comb(l+len(a)-r-1, k-1, True) % mod)

Fixed submission:
# ------ combination -------
N, MOD = 10**5 + 1, 10**9 + 7
fc, ifc = [0] * (N+1), [0] * (N+1)

def power(n, a):
    res, exp = 1, n
    while(a):
        if a & 1:
            res = res * exp % MOD
        exp = exp * exp % MOD
        a = a >> 1
    return res

fc[0] = 1
for i in range(1, N+1):
    fc[i] = fc[i-1] * i % MOD
ifc[N] = power(fc[N], MOD-2)
for i in range(N-1, -1, -1):
    ifc[i] = ifc[i+1] * (i+1) % MOD

def Comb(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fc[n] * ifc[r] % MOD * ifc[n-r] % MOD

# --------------------------

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

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
    ans = Comb(len(a), k) - Comb(l+len(a)-r-1, k-1)
    while ans < 0:
        ans += MOD
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import scipy.misc as scm
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
   print(scm.comb(len(a), k, True) % mod - scm.comb(l+len(a)-r-1, k-1, True) % mod)

Fixed submission:
# ------ combination -------
N, MOD = 10**5 + 1, 10**9 + 7
fc, ifc = [0] * (N+1), [0] * (N+1)

def power(n, a):
    res, exp = 1, n
    while(a):
        if a & 1:
            res = res * exp % MOD
        exp = exp * exp % MOD
        a = a >> 1
    return res

fc[0] = 1
for i in range(1, N+1):
    fc[i] = fc[i-1] * i % MOD
ifc[N] = power(fc[N], MOD-2)
for i in range(N-1, -1, -1):
    ifc[i] = ifc[i+1] * (i+1) % MOD

def Comb(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fc[n] * ifc[r] % MOD * ifc[n-r] % MOD

# --------------------------

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

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
    ans = Comb(len(a), k) - Comb(l+len(a)-r-1, k-1)
    while ans < 0:
        ans += MOD
    print(ans)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())



m = []

for i in range(h):
    l = list(input())
    m.append([ '#' if i=='#' else 0 for i in l])

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            for u in range(3):
                for v in range(3):
                    if u==1 and v==1:
                        pass
                    else:
                        try:
                            m[i + u -1][j + v-1] += 1
                        except:
                            pass





for l in r:
    s = map(str, l)
    print(''.join(s))


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

m = []

for i in range(h):
    l = list(input())
    m.append([ '#' if i=='#' else 0 for i in l])

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            for u in range(3):
                for v in range(3):
                    if u==1 and v==1:
                        pass
                    else:
                        try:
                            y = i+u-1
                            x = j+v-1
                            if y < 0 or x < 0:
                                continue

                            if m[y][x] != '#':
                                m[y][x] += 1

                        except:
                            pass

for l in m:
    s = map(str, l)
    print(''.join(s))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split(''))

if (a == b):
    print(c)
    exit()
if (b == c):
    print(a)
    exit()
if (a == c):
    print(b)
    exit()

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

#A-B B-C C-A 同じもの以外を出力

if (a == b):
    print(c)
    exit()
if (b == c):
    print(a)
    exit()
if (a == c):
    print(b)
    exit()
Buggy python submission (verdict: Runtime Error):
a = map(int,list(input()))
if (a[0] == 9 or a[1] == 9):
    print("Yes")
else:
    print("No")

Fixed submission:
a = int(input())
 
if (a//10 == 9 or a%10 == 9):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = map(int,list(input()))
if (a[0] == 9 or a[1] == 9):
    print("Yes")
else:
    print("No")

Fixed submission:
a = int(input())
 
if (a//10 == 9 or a%10 == 9):
    print("Yes")
else:
    print("No")

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

if (a//10 == 9 || a%10 == 9):
    print("yes")
else:
    print("No")

Fixed submission:
a = int(input())
 
if (a//10 == 9 or a%10 == 9):
    print("Yes")
else:
    print("No")

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

if (a/10 == 9 || a%10 == 9):
    print("yes")
else:
    print("No")

Fixed submission:
a = int(input())
 
if (a//10 == 9 or a%10 == 9):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
        def main():
            goats =3
            n = input()
            list = [int(i) for i in input().split()]
            if (list[0]%3==0 or list[1] %3==0  or (list[0]+list[1])%3==0):
               print('Possible')
            else:
               print("Impossible")
         
         
        if __name__ == "__main__":
            main()

Fixed submission:
def main():
    a, b = map(int, input().split())
    goats = 3
    if a%goats == 0 or b%goats == 0 or (a+b)%goats == 0:
        print("Possible")
    else:
        print("Impossible")


if __name__ == "__main__":
        main()

Buggy python submission (verdict: Runtime Error):
    def main():
        goats =3
        n = input()
        list = [int(i) for i in input().split()]
        if (list[0]%3==0 or list[1] %3==0  or (list[0]+list[2])%3==0):
           print('Possible')
        else:
           print("Impossible")
     
     
    if __name__ == "__main__":
        main()

Fixed submission:
def main():
    a, b = map(int, input().split())
    goats = 3
    if a%goats == 0 or b%goats == 0 or (a+b)%goats == 0:
        print("Possible")
    else:
        print("Impossible")


if __name__ == "__main__":
        main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

a = raw_input()
print ("ABC" + a )



Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
a = input()
print ("ABC" + a )
Buggy python submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = raw_input()
if n >= 64:
  a = 64
elif n >= 32:
  a = 32
elif n >= 16:
  a = 16
elif n >= 8:
  a= 8
elif n >= 4:
  a = 4
elif n >= 2:
  a = 2
else:
  a = 1
print(a)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = int(input())
if n >= 64:
  a = 64
elif n >= 32:
  a = 32
elif n >= 16:
  a = 16
elif n >= 8:
  a= 8
elif n >= 4:
  a = 4
elif n >= 2:
  a = 2
else:
  a = 1
print(a)