Triple sum target

it is showing runtime error.Can you modify the 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++){
		for(int k=i+2;k<n;k++){
			sum=arr[i]+arr[j]+arr[k];
			if(sum==t){
				cout<<arr[i]<<","<<arr[j]<<" and "<<arr[k]<<endl;
			}
		}
	}
}

}

it is giving run time error because size of array is less than that mention in question constraints
make size of array to 10000
int arr[10000];