Python Backtracking
```\nclass Solution:\n    def maxCompatibilitySum(self, students: List[List[int]], mentors: List[List[int]]) -> int:\n        n = len(students)\n        \n     
```\nclass Solution:\n    def maxCompatibilitySum(self, students: List[List[int]], mentors: List[List[int]]) -> int:\n        n = len(students)\n        \n        def dfs(i, used, score):\n            if i == n: return score\n            \n            res = float(-inf)\n            \n            for j, mentor in enumerate(mentors):\n                if j in used: continue\n                    \n                ss = sum(int(a == b) for a, b in zip(students[i], mentor))\n                used.add(j)\n                score += ss\n                \n                res = max(res, dfs(i + 1, used, score))\n\n                used.remove(j)\n                score -= ss\n            \n            return res\n        \n        return dfs(0, set(), 0)\n
[]