input pattern in TLG

how can i input values in a specific format like in problem TLG and Sums in a Triangle?

In C/C++ , for the problem TLG , you can take input as follows:

int n; // number of rounds
int p1[n] , p2[n];   // create two arrays of size n for two players
for(int i=0;i<n;++i)
    scanf("%d%d",&p1[i],&p2[i]); //input their respective values

You can see my submissions in C++ (here) and Java (here).
Similarly , for the problem sum in a triangle , create a 2-dim array and take input
See here and here.