Help on Find the Maximum Value

Link to problem: LOSTMAX Problem - CodeChef
This is my logic for the problem. Is this solution correct? I am really getting frustrated with competitive programming as I cannot think of the algorithm for some of the problems on the easy section. Please someone help me in anyway they can. I really need to get a job and make money for myself. Thank you.

#include <iostream>
#include <vector>
#include <algorithm>


int main() {
    int tc = 0;
    std::cin >> tc;

    while(tc--) {
        //Read in N
        int N = 0;
        std::cin >> N;
    
        //Declar vector inputs and vector
        int input = 0;
        std::vector<int> intVec(N + 1);
    
        //Read in values for vector
        for (int i = 0; i < N + 1; ++i) {
            std::cin >> input;
            intVec.push_back(input);
        }
    
        //Remove N from the vector
        intVec.erase(std::remove(intVec.begin(), intVec.end(), N), intVec.end());
    
        //Find the max of the remaining elements and print out the max number
        std::cout << *std::max_element(intVec.begin(), intVec.end()) << std::endl;
    }

    return 0;
}

Read the Input carefully : Each of the next T lines will contain N and N numbers, but it is not guaranteed that N is the first number.

So is N given as input? I am confused on that.

See N is there but not necessarily as the first number.
4 2 3 5 has 3 as N as there are 4 numbers as input.
Similarly 1 2 3 has 2 as N, 2 1 has 1 as N.

So, will my code fail here or not?