Tasks

A. Product … Simple if else based on modulus

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

B. 1 21 … Inputs can be concatenated as they are strings, and cast the result and make them integer. math.sqrt function make the integer into float. compare resulting float and integer.

from math import sqrt
a, b = input().split()
x = sqrt(int(a + b))
print("Yes" if x == int(x) else "No")

C. Traveling … First I tried to brute force all the path, but it will end up 4^N and it cannot be completed in time. With the below code, the cost is only N.

def can_Travel(visits):
current_loc = (0, 0)
current_time = 0
for visit in visits:
next_loc = (visit[1], visit[2])
distance = abs(next_loc[0] - current_loc[0]) + abs(next_loc[1] - current_loc[1])
# distance is further than it can be reached
if distance > visit[0] - current_time:
return False
# the distance is within the achievable range, but it cannot be done as we cannot stop
elif (visit[0] - current_time - distance)%2 != 0:
return False
return True
n = int(input())
visits = []
for _ in range(n):
visits.append(list(map(int, input().split())))
print("Yes" if can_Travel(visits) else "No")

*Related*