If you only need to check whether a perfect matching exists (not find the actual pairs), you can terminate early once the matching size reaches or you determine it is impossible. You can also use the Hopcroft-Karp algorithm for better time complexity: instead of .
This matters for large graphs but adds necessary implementation complexity. For most competitive programming problems, Kuhn's algorithm is sufficient.
Space complexity is for the data structures used.