Update pair.cpp

worked successfully, some test cases still remaining