# [Solution] Economics Class solution codechef

Economics Class solution codechef – Alice has recently learned in her economics class that the market is said to be in equilibrium when the supply is equal to the demand.

# Economics Class solution codechef

Alice has market data for NN time points in the form of two integer arrays SS and DD. Here, SiSi denotes the supply at the ithith point of time and DiDi denotes the demand at the ithith point of time, for each 1≤i≤N1≤i≤N.

Help Alice in finding out the number of time points at which the market was in equilibrium.

Input Format

• The first line of input will contain an integer TT— the number of test cases. The description of TT test cases follows.
• Each test case contains three lines of input.
• The first line of each test case contains an integer NN, the length of the arrays SSand DD.
• The second line of each test case contains NNspace-separated integers S1,S2,…,SNS1,S2,…,SN.
• The third line of each test case contains NNspace-separated integers D1,D2,…,DND1,D2,…,DN.

## Economics Class solution codechef

For each test case, output the number of time points at which the market was in equilibrium.

Constraints

• 1≤T≤101≤T≤10
• 1≤N≤1001≤N≤100
• 1≤Si,Di≤1001≤Si,Di≤100for every 1≤i≤N1≤i≤N

Sample Input 1

```2

4

1 2 3 4

2 1 3 4

4

1 1 2 2

1 2 1 1```

## Economics Class solution codechef

```2

1```

Economics Class Explanation

Test case 11: For i=3i=3 and i=4i=4, we have supply equal to demand, hence the market is in equilibrium.

Test case 22: For i=1i=1, we have supply equal to demand, hence the market is in equilibrium.