5 lines of simple C++ understandable solution
\nint ans = 0;\n    int numTeams(vector<int>& rating) {\n    for (int i = 1 ; i < rating.size()-1 ;i++){\n        int left_lesser = 0, left_greater=0, right_les
```\nint ans = 0;\n    int numTeams(vector<int>& rating) {\n    for (int i = 1 ; i < rating.size()-1 ;i++){\n        int left_lesser = 0, left_greater=0, right_lesser=0, right_greater=0;\n        for(int j = i-1; j>=0; j--)if(rating[j] > rating[i])left_greater++;else left_lesser++;\n        for(int j = i+1; j<rating.size(); j++)if(rating[j] > rating[i])right_greater++;else right_lesser++;\n        ans+= left_lesser*right_greater + left_greater*right_lesser;\n    }\n    return ans;\n    }\n```\n# plz upvote if you find it helpful
['C']