For this Question: Given an unsorted integer array having distinct integers, find a pair with the given sum in it.
First element of pair > second element of pairFirst line of input contains a single integer N, next line contains N space separated integers depicting the values of array and third line consist target sum.

Constraints:
2<=N<=5*(10^5)
1<=A[i], target<=2*(10^9)
TargetPrint the pair of integers which sum is target.
Sample Input1:-
6
8 7 4 5 3 1
10

Sample Output:-
Pair found (7, 3)


Sample Input2:
 6
5 2 6 8 1 9
12
 
Sample Output:
Pair not found, I have written this Solution Code: #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

// Function to find a pair in an array with a given sum using sorting
void findPair(vector<int> &nums, int n, int target)
{
    // sort the array in ascending order
    sort(nums.begin(), nums.end());

    // maintain two indices pointing to endpoints of the array
    int low = 0;
    int high = n - 1;

    // reduce the search space `nums[low…high]` at each iteration of the loop

    // loop till the search space is exhausted
    while (low < high)
    {
        // sum found
        if (nums[low] + nums[high] == target)
        {
            if (nums[low] < nums[high])
                swap(nums[low], nums[high]);
            cout << "Pair found (" << nums[low] << ", " << nums[high] << ")\n";
            return;
        }

        // increment `low` index if the total is less than the desired sum;
        // decrement `high` index if the total is more than the desired sum
        (nums[low] + nums[high] < target) ? low++ : high--;
    }

    // we reach here if the pair is not found
    cout << "Pair not found";
}

int main()
{
    int n;
    cin >> n;
    vector<int> nums(n);
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    int target;
    cin >> target;

    findPair(nums, n, target);

    return 0;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?