Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque

dic={'o':lambda s:1-(s[1]^s[0]), 'x':lambda s:s[1]^s[0]}
def mknseq(ox,ld):
    for x in ld:
        x.append(dic[ox]((x[-2],x[-1])))
def main():
    N=int(sys.stdin.readline().strip())
    s=list(sys.stdin.readline().strip())
    ans=[deque([x,y]) for x in range(2) for y in range(2)]
    for x in range(N):
        mknseq(s[x],ans)
    # print(ans)
    for x in ans:
        if x[:2]==x[-2:]:
            return print(''.join([['W','S'][i] for i in x])[1:-1])
    print(-1)

if __name__=='__main__':
    main()


Fixed submission:
import sys
from collections import deque

dic={'o':lambda s:1-(s[1]^s[0]), 'x':lambda s:s[1]^s[0]}
def mknseq(ox,ld):
    for x in ld:
        x.append(dic[ox]([x[-2],x[-1]]))
def main():
    N=int(sys.stdin.readline().strip())
    s=list(sys.stdin.readline().strip())
    ans=[deque([x,y]) for x in range(2) for y in range(2)]
    for x in range(N):
        mknseq(s[x],ans)
    ans=[list(x) for x in ans]
    # print(ans)
    for x in ans:
        if x[:2]==x[-2:]:
            return print(''.join([['W','S'][i] for i in x[1:-1]]))
    print(-1)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A, B=map(int,input())

func=lambda x:(x,x+13)[x==1]

if func(A)==func(B):
  print('Draw')
elif func(A)<func(B):
  print('Bob')
else:
  print('Alice')

Fixed submission:
A, B=map(int,input().split())
 
func=lambda x:[x,x+13][x==1]
 
if func(A)==func(B):
  print('Draw')
elif func(A)<func(B):
  print('Bob')
else:
  print('Alice')
Buggy python submission (verdict: Runtime Error):
s=input()
 
ds=list(s)
 
 
c1=0
while ds[c1]!='A'
  c1+=1
 
c2=-1
while ds[c2]!='Z':
  c2-=1
 
print(len(s[c1:c2]))

Fixed submission:
from collections import deque
s=input()

ds=deque(s)
flag=True

while ds[0]!='A' or ds[-1]!='Z':
  if ds[0]!='A':
    ds.popleft()
  if ds[-1]!='Z':
    ds.pop()
print(len(ds))

Buggy python submission (verdict: Runtime Error):
s=input()
 
ds=list(s)
 
 
c1=0
while ds[c1]!='A'
  c1+=1
 
c2=-1
while ds[c2]!='Z':
  c2-=1
 
print(s[c1:c2])
 
s=input()

ds=list(s)


c1=0
while ds[c1]!='A'
  c1+=1

c2=-1
while ds[c2]!='Z':
  c2-=1

print(len(s[c1:c2]))



Fixed submission:
from collections import deque
s=input()

ds=deque(s)
flag=True

while ds[0]!='A' or ds[-1]!='Z':
  if ds[0]!='A':
    ds.popleft()
  if ds[-1]!='Z':
    ds.pop()
print(len(ds))

Buggy python submission (verdict: Runtime Error):

s=input()

ds=list(s)


c1=0
while ds[c1]!='A'
  c1+=1

c2=-1
while ds[c2]!='Z':
  c2-=1

print(s[c1:c2])



Fixed submission:
from collections import deque
s=input()

ds=deque(s)
flag=True

while ds[0]!='A' or ds[-1]!='Z':
  if ds[0]!='A':
    ds.popleft()
  if ds[-1]!='Z':
    ds.pop()
print(len(ds))
Buggy python submission (verdict: Runtime Error):
x=int(input())
 
p=x//11
q=x%11
q2=q-6
 
if q==0
  print(2*p)
elif q2<0:
  print(2*p+1)
else:
  print(2*p+2)

Fixed submission:
x=int(input())
 
p=x//11
q=x%11
q2=q-6
 
if q==0:
  print(2*p)
elif q2<=0:
  print(2*p+1)
else:
  print(2*p+2)
Buggy python submission (verdict: Runtime Error):
s=input()

s[5]=' '
s[13]=' '

print(s)

Fixed submission:
s=input()

print(s.replace(',',' '))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

c=0

for x in range(s+1):
  for y in range(s+1-x):
    for z in range(s+1-x-y):
      if x>k or y>k or z>k:
        continue
      if x+y+z==s:
        c+=1
print(c)

Fixed submission:
k,s=map(int,input().split())
 
c=0
m=min(s,k)
for x in range(m+1):
  for y in range(m+1):
    if s<x+y:
      break
    elif s>x+y+k:
      continue
    else:
      c+=1
print(c)

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

c=0
m=min(s,k)
for x in range(m+1):
  for y in range(m+1-x)
    for z in range(m+1-x-y)
      if x+y+z==s:
        c+=1
print(c)
  

Fixed submission:
k,s=map(int,input().split())
 
c=0
m=min(s,k)
for x in range(m+1):
  for y in range(m+1):
    if s<x+y:
      break
    elif s>x+y+k:
      continue
    else:
      c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RU'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='U'
print(s)

Fixed submission:
sx, sy, tx, ty=map(int,input().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)

Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4):
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

Fixed submission:
sx, sy, tx, ty=map(int,input().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)

Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4)"
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

Fixed submission:
sx, sy, tx, ty=map(int,input().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)
Buggy python submission (verdict: Runtime Error):
def main(a,op,b):
  if op=='+':
    return int(a)+int(b)
  elif op=='-':
    return int(a)-int(b)

  
if __init__=='__main__':
  a,op,b=input().split()
  print(main(a,op,b))

Fixed submission:
def main(a,op,b):
  if op=='+':
    return int(a)+int(b)
  elif op=='-':
    return int(a)-int(b)
 
  
if __name__=='__main__':
  a,op,b=input().split()
  print(main(a,op,b))
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1))

if __name__='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))
  

Fixed submission:
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1)) % p

if __name__=='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  if g==1:
    if a.count(0)!=1:
      del a[a.index(0)]
  b=[0]*(n-g)
  d=deque(a)
  while d:
    x=d.pop()
    b[x-1-g]=x
    b[x-g]=x
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if b!=c:
      return 0
  return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))

print(main(n,a))
  

Fixed submission:
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1)) % p

if __name__=='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))

Buggy python submission (verdict: Runtime Error):
import sys
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  tp=2**h
  if g==1:
    if a.count(0)!=1:
      return 0
    else:
      del a[a.index(0)]
  c=sum([2**((x-1)//2) % tp for x in a])
  if c ^ 2*(tp-1):
      return 0
  return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))

print(main(n,a))
  

Fixed submission:
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1)) % p

if __name__=='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))
Buggy python submission (verdict: Runtime Error):
import sys

p=10**9+7
dthbit=lambda d,n: (n>>d)&1

def main(n):
    dp=[[0 for _ in range(3)] for _ in range(64)]
    dp[63][0]=1
    for d in range(62,-1,-1):
        b=dthbit(d,n)
        s=dp[d+1][:]
        dp[d][0]=dp[d+1][0]+(1^b)*dp[d+1][1] % p
        dp[d][1]=b*dp[d+1][0]+dp[d+1][1] % p
        dp[d][2]=(1+b)*dp[d+1][1]+3*dp[d+1][2] % p
    return sum(dp[0][:] % p)

n=int(input())
print(main(n))


Fixed submission:
import sys

p=10**9+7
dthbit=lambda d,n: (n>>d)&1

def main(n):
    dp=[[0 for _ in range(3)] for _ in range(64)]
    dp[63][0]=1
    for d in range(62,-1,-1):
        b=dthbit(d,n)
        s=dp[d+1][:]
        dp[d][0]=dp[d+1][0]+(1^b)*dp[d+1][1] % p
        dp[d][1]=b*dp[d+1][0]+dp[d+1][1] % p
        dp[d][2]=(1+b)*dp[d+1][1]+3*dp[d+1][2] % p
    return sum(dp[0][:]) % p

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

vowels=['a','i','u','e','o']

if s[0]\invowels:
  print('vowel')
else:
  print('consonant')

Fixed submission:
s = input()
 
vowels=['a','i','u','e','o']
 
if s[0] in vowels:
  print('vowel')
else:
  print('consonant')
Buggy python submission (verdict: Runtime Error):
import sys

def nextrec(coor,pt):
    if pt[2]==1:
        coor[0]=min(max(coor[0],pt[0]),coor[2])
    elif pt[2]==2:
        coor[2]=max(min(coor[2],pt[0]),coor[0])
    elif pt[2]==3:
        coor[1]=min(max(coor[1],pt[1]),coor[3])
    elif pt[2]==4:
        coor[3]=max(min(coor[3],pt[1]),coor[1])
def main(w,h,n,pts):
    rec=[0,0,w,h]
    for x in range(n):
        nextrec(rec,pt[x]):
    return (rec[0]-rec[2])*(rec[1]-rec[3])

w,h,n=map(int,sys.stdin.readline().strip().split())
pts=[list(map(int,sys.stdin.readline().strip().split())) \
    for x in range(n)]

print(main(w,h,n,pts))


Fixed submission:
import sys

def nextrec(coor,pt):
    if pt[2]==1:
        coor[0]=min(max(coor[0],pt[0]),coor[2])
    elif pt[2]==2:
        coor[2]=max(min(coor[2],pt[0]),coor[0])
    elif pt[2]==3:
        coor[1]=min(max(coor[1],pt[1]),coor[3])
    elif pt[2]==4:
        coor[3]=max(min(coor[3],pt[1]),coor[1])
def main(w,h,n,pts):
    rec=[0,0,w,h]
    for x in range(n):
        nextrec(rec,pts[x])
    return (rec[0]-rec[2])*(rec[1]-rec[3])

w,h,n=map(int,sys.stdin.readline().strip().split())
pts=[list(map(int,sys.stdin.readline().strip().split())) \
    for x in range(n)]

print(main(w,h,n,pts))
Buggy python submission (verdict: Runtime Error):
import sys

def main(a,b,h):
    reuturn (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))


Fixed submission:
import sys

def main(a,b,h):
    return (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))

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

def main(a,b,h)
    reuturn (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))


Fixed submission:
import sys

def main(a,b,h):
    return (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))

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

def main(a,b,h)
    reuturn (a+b)*h//2

a =int(sys.stdin.readlin().strip())
b =int(sys.stdin.readlin().strip())
h =int(sys.stdin.readlin().strip())

print(main(a,b,h))


Fixed submission:
import sys

def main(a,b,h):
    return (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))
Buggy python submission (verdict: Runtime Error):
import sys
import math

def divlist(n):
   sl=[]
   ll=[]
   for x in range(1,int(math.sqrt(n))+1):
       if n%x==0:
           sl.append(x)
           ll.append(n//x)
   ll.reverse()
   sl.extend(ll)
   return sl

def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)

def main(n,s):
    if n<s:
        return print(-1)
    elif n==s:
        return prnit(n+1)
    else:
        dl=divlist(n-s)
        for x in dl:
            if s==f(x+1,n):
                return print(x+1)
        return print(-1)

n=int(sys.stdin.readline().strip())
s=int(sys.stdin.readline().strip())

main(n,s)


Fixed submission:
import sys
import math

def divlist(n):
   sl=[]
   ll=[]
   for x in range(1,int(math.sqrt(n))+1):
       if n%x==0:
           sl.append(x)
           ll.append(n//x)
   ll.reverse()
   sl.extend(ll)
   return sl

def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)

def main(n,s):
    if n<s:
        return print(-1)
    elif n==s:
        return print(n+1)
    else:
        dl=divlist(n-s)
        for x in dl:
            if s==f(x+1,n):
                return print(x+1)
        return print(-1)

n=int(sys.stdin.readline().strip())
s=int(sys.stdin.readline().strip())

main(n,s)

Buggy python submission (verdict: Runtime Error):
import sys
import math

n=int(sys.stdin.readline().strip())
s=int(sys.stdin.readline().strip())

def divlist(n):
   sl=[]
   ll=[]
   for x in range(1,int(math.sqrt(n))+1):
       if n%x==0:
           sl.append(x)
           ll.append(n//x)
   ll.reverse()
   sl.extend(ll)
   return sl

def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)

if n<s:
    print(-1
elif n==s:
    print(n+1)
else:
    dl=divlist(n-s)
    for x in dl:
        if s==f(x+1,n):
            print(x+1)
            sys.exit()
    print(-1)



Fixed submission:
import sys
import math

def divlist(n):
   sl=[]
   ll=[]
   for x in range(1,int(math.sqrt(n))+1):
       if n%x==0:
           sl.append(x)
           ll.append(n//x)
   ll.reverse()
   sl.extend(ll)
   return sl

def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)

def main(n,s):
    if n<s:
        return print(-1)
    elif n==s:
        return print(n+1)
    else:
        dl=divlist(n-s)
        for x in dl:
            if s==f(x+1,n):
                return print(x+1)
        return print(-1)

n=int(sys.stdin.readline().strip())
s=int(sys.stdin.readline().strip())

main(n,s)
Buggy python submission (verdict: Runtime Error):
s=input()

ans=''
for x in s:
  if ans<>'':
    if x=='B'
      ans=ans[:-1]
      continue
  if x<>'B':
    ans+=x
print(ans)

Fixed submission:
s=input()
 
ans=''
for x in s:
  if x!='B':
    ans+=x
  else:
    if x!='':
      ans=ans[:-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,w,a,b=map(int,input().split())

p=10**9+7
#p=127

def modp_factorial(n):
    s=1
    for x in range(1,h+1):
        s=(s*x) % p
    return s
def modp_prod(lst):
    s=1
    for x in lst:
        s=(s*x)%p
    return s
def inv(n):
    s=1
    q=p-2
    while q>0:
        if q&1:
            s=s*n % p
        n=n*n
        q>>=1
    return s

l=[1]
f=1
for x in range(1,h+w+1):
    f=f*x % p
    l.append(f)
invl=[inv(l[-1])]
for n in range(h+w,1,-1):
    invl.append((invl[-1]*n) % p)
invl.append(1)
invl.reverse()


s=0
for x in range(1,h-a+1):
    s=s+modp_prod([l[x+b-2],invl[x-1],invl[b-1]\
        ,l[w-b+h-x-1],invl[h-x],invl[w-b-1]])% p
print(s)


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

p=10**9+7
#p=127

def modp_factorial(n):
    s=1
    for x in range(1,h+1):
        s=(s*x) % p
    return s
def modp_prod(lst):
    s=1
    for x in lst:
        s=(s*x)%p
    return s
def inv(n):
    s=1
    q=p-2
    while q>0:
        if q&1:
            s=(s*n) % p
        n=(n*n) % p
        q>>=1
    return s

l=[1]
f=1
for x in range(1,h+w):
    f=(f*x) % p
    l.append(f)
invl=[inv(l[-1])]
for n in range(h+w-1,1,-1):
    invl.append((invl[-1]*n) % p)

invl.append(1)
invl.reverse()


s=0
for x in range(1,h-a+1):
    s=(s+modp_prod([l[x+b-2],invl[x-1],invl[b-1]\
        ,l[w-b+h-x-1],invl[h-x],invl[w-b-1]])) % p
print(s)
Buggy python submission (verdict: Runtime Error):
n, a, b, ans = map(int, raw_input().split()), 0
for _ in range(n + 1):
    if a <= sum(map(int, list(str(i)))) <= b:
        ans += i
print ans

Fixed submission:
n, a, b = map(int, raw_input().split())
ans = 0
for _ in range(n + 1):
    if a <= sum(map(int, list(str(_)))) <= b:
        ans += _
print ans
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][c % gcd(a, b) ^ 1]


Fixed submission:
from fractions import gcd
a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][c % gcd(a, b) is 0]
Buggy python submission (verdict: Runtime Error):
s1 = raw_input()
s2 = raw_input()
ans = ''
for i in range(min(len(s1), len(s2))):
    ans += s1[i] + s2[i]
if len(s2) < len(s1):
    ans += s1[-1]
print ans

Fixed submission:
a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][b - a == c - b]
Buggy python submission (verdict: Runtime Error):
print (int(raw_input()) + int(raw_input())) % 24


Fixed submission:
print sum(map(int, raw_input().split())) % 24

Buggy python submission (verdict: Runtime Error):
print (int(raw_input()) + int(raw_input()) % 24

Fixed submission:
print sum(map(int, raw_input().split())) % 24
Buggy python submission (verdict: Runtime Error):
dict = { 'b' : 'd', 'd' : 'b', 'p' : 'q', 'q' : 'p' }
s = raw_input()
t = ''.join(map(lambda x : dict[x], list(S[::-1])))
print ['No', 'Yes'][s == t]

Fixed submission:
dict = { 'b' : 'd', 'd' : 'b', 'p' : 'q', 'q' : 'p' }
s = raw_input()
t = ''.join(map(lambda x : dict[x], list(s[::-1])))
print ['No', 'Yes'][s == t]
Buggy python submission (verdict: Runtime Error):
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2))) == 2):
        ans += 1
print ans

Fixed submission:
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2])) == 2):
        ans += 1
print ans

Buggy python submission (verdict: Runtime Error):
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2))) == 2):
        ans += 1
print cnt

Fixed submission:
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2])) == 2):
        ans += 1
print ans

Buggy python submission (verdict: Runtime Error):
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2))) == 2):
        cnt += 1
print cnt

Fixed submission:
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2])) == 2):
        ans += 1
print ans
Buggy python submission (verdict: Runtime Error):
s1 = 'CODEFESTIVAL2016'
print s2
ans = 0
for i in range(len(s1)):
    ans += [0, 1][s1[i] != s2[i]]
print ans


Fixed submission:
s1 = 'CODEFESTIVAL2016'
s2 = raw_input()
ans = 0
for i in range(len(s1)):
    ans += [0, 1][s1[i] != s2[i]]
print ans
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = 0
for i in range(a):
    n = int(input())
    if n < b:
        ans += 1
print ans

Fixed submission:
a, b, c = map(int, input().split())
ans = 0
for i in range(a):
    n = int(input())
    if n < b or n >= c:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
print sum(range(1, int(raw_input() + 1)))

Fixed submission:
print sum(range(1, int(raw_input()) + 1))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a * b < 0:
    print 'Zero'
elif n + m < 0 and abs(a - b) & 1 == 0:
    print 'Negative'
else:
    print 'Positive'


Fixed submission:
a, b = map(int, raw_input().split())
if a * b < 0:
    print 'Zero'
elif a + b < 0 and abs(a - b) & 1 == 0:
    print 'Negative'
else:
    print 'Positive'

Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
s = 1
for i in range(a, b + 1):
    s *= i
if s == 0:
    print 'Zero'
else:
    print ['Negative', 'Positive'][s > 0]


Fixed submission:
a, b = map(int, raw_input().split())
if a * b < 0:
    print 'Zero'
elif a + b < 0 and abs(a - b) & 1 == 0:
    print 'Negative'
else:
    print 'Positive'
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = ''
for i in range(n):
    s += raw_input()
s = sorted(s)
ans = ''
for i in s:
    ans += i
print ans


Fixed submission:
n = int(raw_input().split()[0])
a = []
for i in range(n):
    a.append(raw_input())
a.sort()
ans = ''
for i in a:
    ans += i;
print ans
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))

# initialize the cards array. True if the card shows Back side. False if the card shows Top side
arr = [ [False] * m ] * n

for i in range(n):
    for j in range(m):
        for a in [-1, 0, 1]:
            for b in [-1, 0, 1]:
                if (i-b >=0 and j-a >= 0) and (i-b < n and j-a < m):
                    arr[i-b][j-a] = not arr[i-b][j-a]

print(sum(sum(l) for l in arr))

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

if n == 1 and m == 1:
    print(1)
elif n == 1 and m > 1:
    print(m - 2)
elif n > 1 and m == 1:
    print(n - 2)
else:
    print((n-2)*(m-2))

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

# initialize the cards array. True if the card shows Back side. False if the card shows Top side
arr = [ [False] * m ] * n

for i in range(n):
    for j in range(m):
        for a in [-1, 0, 1]:
            for b in [-1, 0, 1]:
                if (i-b >=0 and j-a >= 0) and (i-b < n and j-a < m):
                    arr[i-b][j-a] = not arr[i-b][j-a]

print(arr)
print(sum(sum(l) for l in arr))

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

if n == 1 and m == 1:
    print(1)
elif n == 1 and m > 1:
    print(m - 2)
elif n > 1 and m == 1:
    print(n - 2)
else:
    print((n-2)*(m-2))

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

# initialize the cards array. True means the card shows back side
arr = [ [False] * m ] * n

for i in range(n):
    for j in range(m):
        for a in [-1, 0, 1]:
            for b in [-1, 0, 1]:
                if i-b >=0 and j-a >= 0:
                    try:
                        arr[i-b][j-a] = not arr[i-b][j-a]
                    except IndexError:
                        pass
        print(i,j, arr)

print(sum(sum(l) for l in arr))

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

if n == 1 and m == 1:
    print(1)
elif n == 1 and m > 1:
    print(m - 2)
elif n > 1 and m == 1:
    print(n - 2)
else:
    print((n-2)*(m-2))