Source Code
#include <iostream>
#include "algorithm"
#include "cmath"
using namespace std;
int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int tt;
    cin >> tt;
    while (tt--) {
        int size;
        cin >> size;
        int arr[size];
        int i;
        for (i = 0; i < size; i++) {
            cin >> arr[i];
        }
        int counter = 0;
        bool not_eaqual = false;
        for (int j = 0; j < size; j++) {
            int max = arr[j];
            for (int k = j+1; k < size; k++) {
                if (max == arr[k]) {
                    not_eaqual = true;
                    counter++;
                 
                }
            }
            
        }
        if (not_eaqual)
            cout << counter+1 << endl;
        else
            cout << i << endl;
     
    }
}
Copy
Proud Competitors YoussefAbdelhakem
GNU G++17
26 ms
316 KB
Wrong Answer