Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==0:
     print('Even')
else:
     print("Odd")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
imos = [[0 for i in range(k)] for j in range(k)]
white = 0
for i in range(n):
    x, y, c = input().split()
    x = int(x)
    y = int(y)
    if c == "W":
        c = 1
    else:
        c = 0
    x %= 2*k
    y %= 2*k

    if x > k-1:
        x -= k
        c += 1
    if y > k-1:
        y -=k
        c += 1
    c %= 2

    if c == 1:
        white += 1
        imos[x][y] -= 1
    else:
        imos[x][y] += 1

for i in range(k):
    for j in range(k-1):
        imos[i][j+1] += imos[i][j]

for j in range(k):
    for i in range(k-1):
        imos[i+1][j] += imos[i][j]

ans = 0
for i in range(k):
    for j in range(k):
        exp = imos[k-1][k-1] - imos[k-1][j] - imos[i][k-1] + 2 * imos[i][j] + white
        ans = max(ans, max(exp, n - exp))

print(ans)

Buggy submission (verdict: Runtime Error):

n,k=map(int,input().split())
l=[input().split() for _ in range(n)]
b=[[0]*k for _ in range(k)]
w=[[0]*k for _ in range(k)]
anb=[[0]*k for _ in range(k)]
anw=[[0]*k for _ in range(k)]
ans=0
i=0
while i<n:
    m=(((int(l[i][0]))//k)+((int(l[i][1]))//k))%2
    if (m==0 and str(l[i][2])=="W"):
        w[int(l[i][0])%k][int(l[i][1])%k]+=1 
    elif (m==1 and str(l[i][2])=="B"):
        b[int(l[i][0])%k][int(l[i][1])%k]+=1
    elif (m==1 and str(l[i][2])=="W"):
        anw[int(l[i][0])%k][int(l[i][1])%k]+=1
    else:
        anb[int(l[i][0])%k][int(l[i][1])%k] +=1

from numpy import matrix

w=matrix(w)
b=matrix(b)
anw=matrix(anw)
anb=matrix(anb)

for a in range(0,k):
     for b in range(0,k):
         total=w[a:k][b:k].sum()+anw[0:a][0:b].sum()+b[a:k][b:k].sum()+anb[0:a][0:b].sum()
         ans=max(ans,total,n-total)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[input().split() for _ in range(n)]
ans=0
for a in range(0,k):
     for b in range(0,k):
         i=0
         total=0
         while i<n:
           m=(((int(l[i][0])-a)//k)+((int(l[i][1])-b)//k))%2
           if (m==0 and str(l[i][2])=="W") or (m==1 and str(l[i][2])=="B"):
               total=total+1
               i=i+1
           else:
               i=i+1

         else:
              ans=max(ans,total,n-total)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for j in range(0,n):
    l.append(input().split())
ans=0
for a in range(0,k):
     for b in range(0,a+1):
         i=0
         total=0
         while i<n:
           m=((int(l[i][0])-a)//k)%2
           h=((int(l[i][1])-b)//k)%2
           if ((m+h)%2==0 and str(l[i][2])=="W") or ((m+h)%2==1 and str(l[i][2])=="B"):
               total=total+1
               i=i+1
           else:
               i=i+1

         else:
              ans=max(ans,total,n-total)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for j in range(0,n):
    l.append(input().split())
ans=0
for a in range(0,k):
     for b in range(0,k):
         i=0
         total=0
         while i<n:
           m=((int(l[i][0])-a)//k)%2
           h=((int(l[i][1])-b)//k)%2
           if ((m+h)%2==0 and str(l[i][2])=="W") or ((m+h)%2==1 and str(l[i][2])=="B"):
               total=total+1
               i=i+1
           else:
               i=i+1

         else:
              ans=max(ans,total,n-total)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for j in range(0,n):
    l.append(input().split())
ans=0
for a in range(0,k):
     for b in range(0,k):
         i=0
         total=0
         while i<n:
           m=(abs(int(l[i][0])-a)//k)%2
           h=(abs(int(l[i][1])-b)//k)%2
           if ((m+h)%2==0 and str(l[i][2])=="W") or ((m+h)%2==1 and str(l[i][2])=="B"):
               total=total+1
               i=i+1
           else:
               i=i+1

         else:
              ans=max(ans,total,n-total)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
f=[]
for a in range(0,k):
     for b in range(0,k):
         i=0
         total=0
         while i<n:
           x1,y1,z=map(str,input().split())
           x,y=map(int,[x1,y1])
           l=(abs(x+y-a-b)//k)%2
           if (l==0 and z=="W") or (l==1 and z=="B"):
               total=total+1
               i=i+1
           else:
               i=i+1

         else:
              f.append(max([total,n-total]))
print(max(f))

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

from numpy import array

i=0
o=array([0,0,0])
while i<n:
   c=list(map(int,input().split()))
   z=array(c)
   w=z-o
   a,b=map(int,[w[0],abs(w[1])+abs(w[2])])

   if a<b:
       print("No")
       break

   else:
       if (a+b)%2==0:
           o=z
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
 if (a*b)%2==0:
     print('even')
 else:
     print("odd")