Hi I am getting wrong answer when I am submitting this code it looks fine to me can you please tell me what is wrong with my code

#include <stdio.h>
#include
#include
#include
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin); // redirects standard input
freopen(“output.txt”, “w”, stdout); // redirects standard output
#endif
int n;
cin >> n;
int ar[n];
for (int i = 0; i < n; i++)
cin >> ar[i];
sort(ar, ar + n);
int target;
cin >> target;
int s = 0, e = n - 1;
while (s < e)
{
int sum = ar[s] + ar[e];
//cout << "Target - " << sum << endl;
if (sum == target)
cout << ar[s] << " and " << ar[e];
else if (sum > target)
e–;
else
s++;
}
return 0;
}