Algorithm


A. Marathon
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given four distinct integers abcd.

Timur and three other people are running a marathon. The value a is the distance that Timur has run and bcd correspond to the distances the other three participants ran.

Output the number of participants in front of Timur.

Input

The first line contains a single integer t (1t1041≤�≤104) — the number of test cases.

The description of each test case consists of four distinct integers abcd (0a,b,c,d1040≤�,�,�,�≤104).

Output

For each test case, output a single integer — the number of participants in front of Timur.

Example
input
Copy
4
2 3 4 1
10000 0 1 2
500 600 400 300
0 9999 10000 9998
output
Copy
2
0
1
3
Note

For the first test case, there are 22 people in front of Timur, specifically the participants who ran distances of 33 and 44. The other participant is not in front of Timur because he ran a shorter distance than Timur.

For the second test case, no one is in front of Timur, since he ran a distance of 1000010000 while all others ran a distance of 0011, and 22 respectively.

For the third test case, only the second person is in front of Timur, who ran a total distance of 600600 while Timur ran a distance of 500500.

 



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include<bits/stdc++.h>
using namespace std;


#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t;
  cin>>t;
  while(t--){
    int a;
    cin>>a;
    int x, count = 0;
    for(int i = 0; i < 3; i++){
      cin>>x;
      if(x > a){
        count++;
      }
    }
    cout<<count<<endl;

  }

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
4
2 3 4 1
10000 0 1 2
500 600 400 300
0 9999 10000 9998

Output

x
+
cmd
2
0
1
3
Advertisements

Demonstration


Codeforcess Solution 1692-A A. Marathon ,C++, Java, Js and Python ,1692-A,Codeforcess Solution

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+