Simple Backtracking solution C++
\nclass Solution {\npublic:\n    int calculate(vector<int>v1,vector<int>v2)\n    {\n        int s=0;\n        for(int i=0;i<v1.size();i++)\n        {\n         
```\nclass Solution {\npublic:\n    int calculate(vector<int>v1,vector<int>v2)\n    {\n        int s=0;\n        for(int i=0;i<v1.size();i++)\n        {\n            if(v1[i]==v2[i])\n                s+=1;\n        }\n        return s;\n    }\n    int maxscore=0;\n    \n    void allcombo(vector<vector<int>>& students, vector<vector<int>>& mentors,vector<int>&done,int i=0,int sum=0)//i is for students\n    {\n        if(i==mentors.size())\n        {\n            maxscore=max(maxscore,sum);\n            return ;\n        }\n        for(int j=0;j<mentors.size();j++)\n        {\n            if(done[j]==0)\n            {\n                done[j]=1;\n                allcombo(students,mentors,done,i+1,sum+calculate(students[i],mentors[j]));\n                done[j]=0;\n            }\n        }\n    }\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n        vector<int>done(mentors.size(),0);\n        allcombo(students,mentors,done);\n        return maxscore;\n    }\n};\n```
[]