Rectangular Game Solution

You are given an infinite 2d grid with the bottom left cell referenced as (1,1). All the cells contain a value of zero initially. Let’s play a game?
The game consists of N steps wherein each step you are given two integers a and b.

Pascal’s Triangle

In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. It can also be viewed as: each number in Pascal’s triangle is the sum of the two numbers directly above it.