Problem: AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Submission attempts (in order):
# -*- coding: utf-8 -*-
from collections import Counter
import numpy as np

n, k = list(map(int,input().split()))
table = np.zeros((2*k,2*k),dtype='int32')
for i in range(n):
    t = input().split()
    if(t[2]=='B'):
        table[int(t[0])%(2*k)][int(t[1])%(2*k)] += 1
    else:
        table[(int(t[0])+k)%(2*k)][int(t[1])%(2*k)] += 1
        
n_table = np.zeros((3*k,3*k),dtype='int32')
n_table[0:2*k,0:2*k] = table
n_table[2*k:3*k,0:2*k] = table[0:k,0:2*k]
n_table[0:2*k,2*k:3*k] = table[0:2*k,0:k]
n_table[2*k:3*k,2*k:3*k] = table[0:k,0:k]

i_table = np.zeros((3*k,3*k),dtype='int32')

for i in range(0,3*k):
    i_table[i][0] = n_table[i][0]
    for j in range(1,3*k):
        i_table[i][j] += i_table[i][j-1] + n_table[i][j] 
for i in range(1,3*k):
    for j in range(0,3*k):
        i_table[i][j] += i_table[i-1][j]  

ans = 0
hope1 = i_table[k-1][k-1]
hope2 = i_table[2*k-1][2*k-1] - i_table[2*k-1][k-1] - i_table[k-1][2*k-1] + i_table[k-1][k-1]
ans = max(ans,hope1+hope2)
for i in range(1,k):
    hope1 = i_table[k-1][i+k-1] - i_table[k-1][i-1]
    hope2 = i_table[2*k-1][i+2*k-1] - i_table[2*k-1][i+k-1] - i_table[k-1][i+2*k-1] + i_table[k-1][i+k-1]
    ans = max(ans,hope1+hope2)
for i in range(1,k):        
        hope1 = i_table[i+k-1][k-1]- i_table[i-1][k-1]
        hope2 = i_table[i+2*k-1][2*k-1] - i_table[i+2*k-1][k-1] - i_table[i+k-1][2*k-1] + i_table[i+k-1][k-1]
        ans = max(ans,hope1+hope2)

for i in range(1,k):
    for j in range(1,k):        
        hope1 = i_table[i+k-1][j+k-1] - i_table[i+k-1][j-1] - i_table[i-1][j+k-1] + i_table[i-1][j-1]
        hope2 = i_table[i+2*k-1][j+2*k-1] - i_table[i+2*k-1][j+k-1] - i_table[i+k-1][j+2*k-1] + i_table[i+k-1][j+k-1]
        ans = max(ans,hope1+hope2)
print(ans)

# -*- coding: utf-8 -*-      
import sys

n = int(input())
tprev = 0
tdiff = 0
pos = [0, 0]
for i in range(n):
    t, x, y = list(map(int,input().split()))
    tdiff = t - tprev
    print(pos,tdiff,abs(x-pos[0])+abs(y-pos[1]))
    if(tdiff>=abs(x-pos[0])+abs(y-pos[1])):
        if((tdiff-(abs(x-pos[0])+abs(y-pos[1])))%2 == 0):
            tprev = t
            pos = [x, y]
        else:
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()
else:
    print('Yes')
        

# -*- coding: utf-8 -*-      
import sys

n = int(input())
tprev = 0
tdiff = 0
pos = [0, 0]
for i in range(n):
    t, x, y = list(map(int,input().split()))
    tdiff = t - tprev
    if(tdiff>=abs(x-pos[0])+abs(y-pos[1])):
        if((tdiff-(abs(x-pos[0])+abs(y-pos[1])))%2 == 0):
            tprev = t
            pos = [x, y]
        else:
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()
else:
    print('Yes')
        

Verdicts: Runtime Error

Wrong Answer

Accepted