Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
elif abs(n-m)>1:
    a=0
print(a％mod)


Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

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

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
elif abs(n-m)>1:
    a=0
print(a)


Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

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

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
elif abs(n-m)>1:
    print(0)
    exit()
print(a)


Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

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

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
if abs(n-m)>1:
    print(0)
    exit()
print(a)


Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
mod=10**9+7
import math
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
if abs(n-m)>1:
    print(0)
    exit()
print(a)

Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
mod=10**9+7
import math
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
if abs(n-m)>1:
    print(0)
    exit()
print(a)

Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
 
    if abs(x - y) <= 1:
        print('Brown')
    else:
        print('Alice')
 

Fixed submission:
x, y = map(int, input().split())
 
if abs(x - y) <= 1:print('Brown')
else:
  print('Alice')
Buggy python submission (verdict: Runtime Error):
s=input()
d=[]
n=len(s)
ans=0
for i in range(1<<n):
    tmp=0
    for j in range(n):
        if (i>>j)&1:
            ans+=int(s[tmp:j+1])
            tmp=j+1
    ans+=int(s[tmp:])

print(ans)


Fixed submission:
s=input()
n=len(s)
n-=1
ans=0
for i in range(1<<n):
    tmp=0
    for j in range(n):
        if (i>>j)&1:
            ans+=int(s[tmp:j+1])
            tmp=j+1
    ans+=int(s[tmp:])
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e = map(int,input(). split ())
for i in 5:
    if i * 1 == 0:
        print(i)

Fixed submission:
a,b,c,d,e = map(int,input(). split ())
x = [a,b,c,d,e]
for i in x:
    if i * 1 == 0:
        print(x.index(i) + 1)
Buggy python submission (verdict: Runtime Error):
N,K,M=map(int,input().split())
l = input().split()
L = [int(i) for i in l]

Lsum=sum(L)

if M*N-Lsum>K:
    print(-1)
elif M*N-Lsum<0:
    print(0)
else:
    print(M*N-Lsum)


Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=input().split()
L=list(map(int,L))
# print(N)
# print(L)
# print("")
count=0
i=0
while i+1 in L:
        K=L.index(i+1)
        # print(i+1)
        # print("は")
        # print(K+1)
        # print("番目")
        # print(L)
        # print("↓")
        L=L[K+1:]
        # print(L)
        count+=1
        # print("count")
        # print(count)
        # print("")
        i+=1
if count==0:
    print(-1)
else:
    print(N-count)

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

for j in range(N):
    if i==L[j]:
        i+=1

if i==1:
    print(-1)
else:
    print(N-i+1)
Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())
l = input()
mi = 300000

for i in range(N):
    count=0
    for j in range(N):
        if i>j:
            if l[j]=="W":
                count+=1
        elif i<j:
            if l[j]=="E":
                count+=1
        else:
            continue
    mi=min(mi,count)

print(mi)

Fixed submission:
N=int(input())
l = input()
count0 = l[1:].count("E")
count=count0
mi=count0
for i in range(1, N):
    if l[i-1]=="W":
        count+=1
    if l[i]=="E":
        count-=1
    mi=min(mi,count)
print(mi)
Buggy python submission (verdict: Runtime Error):
N,yen=map(int,input().split())
count=0
end=0
# print(N)
# print(yen)

for i in range(N):
    if end==1:
        break
    for j in range(N-i+1):
        # print(i)
        # print(j)
        k=N-i-j
        # print(k)
        sum=i*10000+j*5000+k*1000
        # print(sum)
        if sum==yen:
            man=i
            gosen=j
            sen=k
            end=1
            break


print(str(man)+" "+str(gosen)+" "+str(sen))


Fixed submission:
N,yen=map(int,input().split())
count=0
end=0
man=0
gosen=0
sen=0
# print(N)
# print(yen)

for i in range(N+1):
    if end==1:
        break
    for j in range(N-i+1):
        # print(i)
        # print(j)
        k=N-i-j
        # print(k)
        sum=i*10000+j*5000+k*1000
        # print(sum)
        if sum==yen:
            man=i
            gosen=j
            sen=k
            end=1
            break

if man==0 and gosen==0 and sen==0:
    print("-1 -1 -1")
else:
    print(str(man)+" "+str(gosen)+" "+str(sen))
Buggy python submission (verdict: Runtime Error):
if b<=c:
    print(0)
elif d<=a:
    print(0)
elif c>=a and d<=b:
    print(d-c)
elif c>=a and c<=b and d>=b:
    print(b-c)
elif a>=c and a<=d and d<=b:
    print(d-a)
elif a>=c and b<=d:
    print(b-a)
else:
    print(err)

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

if min(b,d)-max(a,c)>=0:
    print(min(b,d)-max(a,c))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

a=1

for i in range(N):
  a*=i+1

a%=1000000007

print(a)

Fixed submission:
N=int(input())
 
a=1
 
for i in range(N):
  a*=(i+1)
  a%=1000000007
 
print(a)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
x,n=map(int,input().split())
if n!=0:
    a=list(map(int,input().split()))
else:
    a=[0]*3
number=[0]*101

for num in range(len(a)):
    number[a[num]]=a[num]
    
counter=0
plus=0
ans=0

while counter==0:
    if number[x-plus]==0:
        counter+=1
        ans=x-plus
    elif number[x+plus]==0:
        counter+=1
        ans=x+plus
    else:
        plus+=1
        if plus>x or plus>(100-x):
            counter+=1
            ans=0

print(ans)

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

for num in range(len(a)):
    if a[num]==0:
        print(num+1)

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

if y%2==0 and y/x<=4 and y/x>=2:
    print("Yes")
else:
    print("No")

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

for num in range(len(a)):
    if a[num]==0:
        print(num+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
flag = False
limit = 1000000000000000000
a = [int(item) for item in input().split()]
ans = 1
for i in a:
    ans = ans*i
if(ans > limit):
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
flag = False
limit = 1000000000000000000
a = [int(item) for item in input().split()]
ans = 1
for i in a:
    if(i == 0):
        flag = True
        break
for i in a:
    ans = ans*i
    if(ans > limit):
        break
if(flag):
    print(0)
elif(ans > limit):
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
a = input().split(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1

Fixed submission:
a = input().split(" ")
temp = 0
for i, ai in enumerate(a):
    if int(ai)==0:
        temp=i
        break
 
print(temp+1)

Buggy python submission (verdict: Runtime Error):
a = input().aplit(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1

Fixed submission:
a = input().split(" ")
temp = 0
for i, ai in enumerate(a):
    if int(ai)==0:
        temp=i
        break
 
print(temp+1)

Buggy python submission (verdict: Runtime Error):
a = int(input()).aplit(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1
  


Fixed submission:
a = input().split(" ")
temp = 0
for i, ai in enumerate(a):
    if int(ai)==0:
        temp=i
        break
 
print(temp+1)
Buggy python submission (verdict: Runtime Error):
n=input()

if int(n[-1]) in [2,4,5,7,9]:
    print('hon')
elif int(n[-1]) in [0,1,6,8]:
    print('pon')
else:
    print('bon')

Fixed submission:
s = input()
t = input()

if s == t[:-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int, input().split()))

s = -1
ans = 0
for i in range(n):
    s +=1
    for j in range(s,n):
        #print(j)
        if abs(i-j) == A[i] + A[j]:
            ans += 1
print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = {}
ans = 0
for i in range(n):
    R = i + a[i]
    if not R in x:
        x[R]=1
    else: x[R]+=1
    
for i in range(n):
    L = i - a[i]
    if L in x:
        ans+=x[L]
print(ans)

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

#import itertools
#print(list(itertools.combinations(A, 2)))
s = -1
ans = 0
for i in range(len(A)):
    s +=1
    
    for j in range(s,len(A)):
        #print(j)
        if abs(i-j) == A[i] + A[j]:
            ans += 1
print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = {}
ans = 0
for i in range(n):
    R = i + a[i]
    if not R in x:
        x[R]=1
    else: x[R]+=1
    
for i in range(n):
    L = i - a[i]
    if L in x:
        ans+=x[L]
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
val = map(int, input().split())
count = 0
val_list = np.array(list(map(int, val.split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)

Fixed submission:
import numpy as np
n = int(input())
count = 0
val_list = np.array(list(map(int, input().split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
val = map(int, input().split())
count = 0
val_list = np.array(list(map(int, val.split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)

Fixed submission:
import numpy as np
n = int(input())
count = 0
val_list = np.array(list(map(int, input().split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)
Buggy python submission (verdict: Runtime Error):
n = input().spilt()
for i, j in range(n):
  if j == '0':
    print(i+1)
    exit()

Fixed submission:
n = input().split()
for i, j in enumerate(n):
  if j == '0':
    print(i+1)
    break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int, input()))

a = [[set() for j in range(10)] for i in range(10)]
l = set()
for i in range(1, len(s) - 1):
    t = s[i]
    l.add(s[i-1])
    r = set(s[i+1:])
    for j in l:
        a[t][j] |= r

ans = 0
for b in a:
    for c in b:
        ans += len(c)
print(ans)

Fixed submission:
n = int(input())
s = list(map(int, input()))

rr = {}
r = set()
for i in range(len(s) - 1, 0, -1):
    t = s[i]
    r.add(t)
    rr[i] = r.copy()

a = [[set() for j in range(10)] for i in range(10)]
l = set()
for i in range(1, len(s) - 1):
    t = s[i]
    l.add(s[i-1])
    r = rr[i+1]
    for j in l:
        a[t][j] |= r

ans = 0
for b in a:
    for c in b:
        ans += len(c)
print(ans)

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

a = [[set() for j in range(10)] for i in range(10)]
for i in range(1, len(s) - 1):
    t = s[i]
    l = set(s[i+1:])
    for j in set(s[:i]):
        a[t][j] |= l

ans = 0
for b in a:
    for c in b:
        ans += len(c)
print(ans)

Fixed submission:
n = int(input())
s = list(map(int, input()))

rr = {}
r = set()
for i in range(len(s) - 1, 0, -1):
    t = s[i]
    r.add(t)
    rr[i] = r.copy()

a = [[set() for j in range(10)] for i in range(10)]
l = set()
for i in range(1, len(s) - 1):
    t = s[i]
    l.add(s[i-1])
    r = rr[i+1]
    for j in l:
        a[t][j] |= r

ans = 0
for b in a:
    for c in b:
        ans += len(c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())

for x in range(min(10**9, s), -1, -1):
  for y in range(x, -1, -1):
    t = s + x*y
    if t <= x*y:
      break
    if t - int(t) == 0:
      if t % 2 == 0 and t / 2 <= 10**9:
        print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, 2, t//2, y))
        quit()
      else:
        for i in range(1, x, 2):
          if t % i == 0 and t // i <= 10**9:
            print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, i, t//i, y))
            quit()

Fixed submission:
s = int(input())

a = s // 10**9 + 1
b = 10**9 - s % 10**9
if a > 10**9:
  a -= 1
  b -= 10**9

assert abs(a * 10**9 - b) == s

print(" ".join(map(str, [0, 0, a, 1, b, 10**9])))

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

for x in range(0, 10**9):
  for y in range(x, -1, -1):
    t = s - x*y
    if t <= 0:
      break
    if t - int(t) == 0:
      if t % 2 == 0 and t / 2 <= 10**9:
        if abs(x*y - t) != s:
            continue
        print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, 2, t//2, y))
        quit()
      else:
        for i in range(1, 10**9, 2):
          if t % i == 0 and t // i <= 10**9:
            if abs(x*y - t) != s:
                continue
            print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, i, t//i, y))
            quit()

Fixed submission:
s = int(input())

a = s // 10**9 + 1
b = 10**9 - s % 10**9
if a > 10**9:
  a -= 1
  b -= 10**9

assert abs(a * 10**9 - b) == s

print(" ".join(map(str, [0, 0, a, 1, b, 10**9])))

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

for x in range(10**9):
  for y in range(10**9):
    t = s - x*y
    if t <= 0:
      break
    if t - int(t) == 0:
      if t % 2 == 0 and t / 2 <= 10**9:
        if abs(x*y - t) != s:
            continue
        print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, 2, t//2, y))
        quit()
      else:
        for i in range(1, 10**9, 2):
          if t % i == 0 and t // i <= 10**9:
            if abs(x*y - t) != s:
                continue
            print('{0} {1} {2} {3} {4} {5}'.format(0, 0, x, i, t//i, y))
            quit()

Fixed submission:
s = int(input())

a = s // 10**9 + 1
b = 10**9 - s % 10**9
if a > 10**9:
  a -= 1
  b -= 10**9

assert abs(a * 10**9 - b) == s

print(" ".join(map(str, [0, 0, a, 1, b, 10**9])))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
B = [0]*N
for i in input().split():
  B[int(i)] += 1
print(sum(sorted(B)[:-K]))

Fixed submission:
N, K = map(int, input().split())
B = [0]*(N+1)
for i in input().split():
  B[int(i)] += 1
print(sum(sorted(B)[:-K]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.items(), key=lambda x: x[1])

total = 0
while len(sort_count) > k:
    _, n = sort_count.pop(0)
    total += n

print(total)

Fixed submission:
N, K = map(int, input().split())
B = [0]*(N+1)
for i in input().split():
  B[int(i)] += 1
print(sum(sorted(B)[:-K]))
Buggy python submission (verdict: Runtime Error):
s = input()
print('{0] {1}'.format(s[:4],s[4:]))

Fixed submission:
a = input()
a = u'{0}'.format(a)
print('{0} {1}'.format(a[:4],a[4:]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
Sa = input()
Sb = input()
Sc = input()

def string2int(in_list):
  out_list = np.array(in_list, dtype='S')
  out_list[out_list=='a'] = 0
  out_list[out_list=='b'] = 1
  out_list[out_list=='c'] = 2
  return np.array(out_list, dtype=int)
Sa = string2int(list(Sa))
Sb = string2int(list(Sb))
Sc = string2int(list(Sc))
ALL = [list(Sa), list(Sb), list(Sc)]

current = 0
pre = 0
while True:
  left = len(ALL[current])
  if left == 0:
    break
  current = ALL[current][0]
  ALL[pre] = ALL[pre][1:]
  pre = current

cor = ['A','B','C']
print( cor[current] )

Fixed submission:
import numpy as np
Sa = input()
Sb = input()
Sc = input()

def string2int(in_list):
    out_list = np.array(in_list, dtype='S')
    out_list[out_list==b'a'] = 0
    out_list[out_list==b'b'] = 1
    out_list[out_list==b'c'] = 2
    return np.array(out_list, dtype=int)
Sa = string2int(list(Sa))
Sb = string2int(list(Sb))
Sc = string2int(list(Sc))
ALL = [list(Sa), list(Sb), list(Sc)]

current = 0
pre = 0
while True:
    left = len(ALL[current])
    if left == 0:
        break
    current = ALL[current][0]
    ALL[pre] = ALL[pre][1:]
    pre = current

cor = ['A','B','C']
print( cor[current] )
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy

a = map(int,raw_input().split())

def myfunc(a):
  A.sort(reverse=True)
  if (A[0]%2 != 0 and A[1]%2 !=0 and A[2]%2 != 0):
    print A[1]*A[2]
  else:
    print 0

myfunc(a)

Fixed submission:
import numpy as np
a = map(int,raw_input().split())
a = np.array(a)

if len(a[a % 2==0]) > 0:
  print 0
else:
  m = max(a)
  a = list(a)
  a.remove(m)
  print np.prod(np.array(a))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy

a = map(int,raw_input().split())
H = a[0]
W = a[1]
A = []
for idx in xrange(H):
  A.append( list(raw_input()) )

def textMap(A):
  A = np.array(A, dtype='S')
  A[A!='0'] = '#'
  A[A=='0'] = '.'
  texts = []
  for vec in A:
    texts.append( ''.join(vec) )
  return '\n'.join(texts)

def myfunc(H,W,A):
  A = np.array(A)
  A[A=='#'] = 1
  A[A=='.'] = 0
  A = np.array(A, dtype=np.int)
  T = np.zeros((H,W), dtype=np.int)
  O = np.zeros((H,W), dtype=np.int)
  T[:,0] = 1
  O[:,-1] = 1
  if H%2 == 0:
    for idx in xrange(H/2):
      T[idx*2,1:-1] = 1
      O[idx*2+1,1:-1] = 1
  else:
    for idx in xrange(H/2):
      T[idx*2,1:-1] = 1
      O[idx

Fixed submission:
import numpy as np
import copy

a = map(int,raw_input().split())
H = a[0]
W = a[1]
A = []
for idx in xrange(H):
  A.append( list(raw_input()) )

def textMap(A):
  A = np.array(A, dtype='S')
  A[A!='0'] = '#'
  A[A=='0'] = '.'
  texts = []
  for vec in A:
    texts.append( ''.join(vec) )
  return '\n'.join(texts)

def myfunc(H,W,A):
  A = np.array(A)
  A[A=='#'] = 1
  A[A=='.'] = 0
  A = np.array(A, dtype=np.int)
  T = np.zeros((H,W), dtype=np.int)
  O = np.zeros((H,W), dtype=np.int)
  T[:,0] = 1
  O[:,-1] = 1
  if H%2 == 0:
    for idx in xrange(H/2):
      T[idx*2,1:-1] = 1
      O[idx*2+1,1:-1] = 1
  else:
    for idx in xrange(H/2):
      T[idx*2,1:-1] = 1
      O[idx*2+1,1:-1] = 1
    T[-1,1:-1] = 1
  T[A==1] += 1
  O[A==1] += 1

  tT = textMap(T)
  tO = textMap(O)
  print '\n'.join([tT,'',tO])

myfunc(H,W,A)
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
A = [0] * N
for idx in xrange(N):
  A[idx] = int(raw_input())
total =  0
pre = 0
for item in A:
  total += (item+pre) / 2
  if item == 0:
    pre = 0
  else:
    pre = (item+pre) % 2

print total

Fixed submission:
S = raw_input()
S = list(S)
S = set(S)
flagSN = False
flagEW = False
if ('N' in S and 'S' in S) or ('N' not in S and 'S' not in S):
  flagSN = True
if ('W' in S and 'E' in S) or ('W' not in S and 'E' not in S):
  flagEW = True
if flagSN and flagEW:
  print 'Yes'
else:
  print 'No'

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(raw_input())
A = [0] * N
for idx in xrange(N):
  A[idx] = int(raw_input())
total =  0
pre = 0
for item in A:
  total += (item+pre) / 2
  if item == 0:
    pre = 0
  else:
    pre = (item+pre) % 2

print total

Fixed submission:
S = raw_input()
S = list(S)
S = set(S)
flagSN = False
flagEW = False
if ('N' in S and 'S' in S) or ('N' not in S and 'S' not in S):
  flagSN = True
if ('W' in S and 'E' in S) or ('W' not in S and 'E' not in S):
  flagEW = True
if flagSN and flagEW:
  print 'Yes'
else:
  print 'No'
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

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

def prime(i):
  k=[]
  maxi=i**0.5
  j=2
  moto=i
  while i>1:
    if i%j==0:
      k.append(j)
      i/=j
      j=2
    else:
      j+=1
  k.append(1)
  k=list(set(k))
  return k

a=set(prime(M[0]))
b=set(prime(M[1]))
print(len(list(a&b)))

Fixed submission:
import math
import sys

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


def prime(i):
  k=[]
  num=i
  j=2
  while j*j<=num:
    if i%j==0:
      i//=j
      k.append(j)
    else:
      j+=1
  if i!=1:
    k.append(i)
  k.append(1)
  return k

a=set(prime(M[0]))
b=set(prime(M[1]))
print(len(list(a&b)))

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

M=list(map(int,input().split()))
x=[]
def cf(x1,x2):
  cf=[]
  for i in range(1,min(x1,x2)+1):
    if x1 % i == 0 and x2 % i == 0:
      cf.append(i)
  return cf
    
def searchPrimeNum(N):
    max = int(math.sqrt(N))
    searchList = [i for i in range(2,N+1)]
    primeNum = []
    while searchList[0] <= max:
        primeNum.append(searchList[0])
        tmp = searchList[0]
        searchList = [i for i in searchList if i % tmp != 0]
    primeNum.extend(searchList)
    return primeNum
P=[]
x=cf(M[0],M[1])
if M[0]!=1 and M[1]!=1: 
  P=searchPrimeNum(min(M[0],M[1]))
P.append(1)
cnt=0

for i in x:
  if i in P:
    cnt+=1
    
print(cnt)

Fixed submission:
import math
import sys

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


def prime(i):
  k=[]
  num=i
  j=2
  while j*j<=num:
    if i%j==0:
      i//=j
      k.append(j)
    else:
      j+=1
  if i!=1:
    k.append(i)
  k.append(1)
  return k

a=set(prime(M[0]))
b=set(prime(M[1]))
print(len(list(a&b)))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys

s=list(map(int,input().split()))
S=[]
for i in range(s[2]):
  S.append(int(input()))

P=np.array([s[1]]*s[0])
m=np.array([-1]*s[0])

for i in range(s[2]):
  P=P+m
  P[S[i]-1]+=1

for i in range(s[0]):
  if P[i]<=0:
    print('No')
  else:
    print('Yes')

Fixed submission:
import numpy as np
import sys

s=list(map(int,input().split()))
S=[]
for i in range(s[2]):
  S.append(int(input()))

P=np.array([s[1]-s[2]]*s[0])
for i in range(s[2]):
  P[S[i]-1]+=1

for i in range(s[0]):
  if P[i]<=0:
    print('No')
  else:
    print('Yes')