Array target sum

what is wrong with my code
#include
#include
using namespace std;
int main() {
int arr[100],n,t,sum;
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
}
cin>>t;
sort(arr,arr+n);

for(int i=0;i<n;i++){
	for(int j=i+1;j<n;j++){
		sum=arr[i]+arr[j];
		if(sum==t){
			cout<<arr[i]<<"and"<<arr[j]<<endl;
		}
	}
}

}

make size of array to 10000
int arr[10000];

it is giving run time error because size of array is less than that mention in question constraints

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.