Core dumped error

Why I am getting core dumped error here in the IDE provided for the problem : Target Sum Triplet, while working correctly on sublime text.
My code :
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++){
cin>>a[i];
}
ll target;
cin>>target;
for(ll i=0;i<n;i++){
ll left = i+1;
ll right = n-1;
while(left < right){
ll sum = a[left] + a[right];
if(sum == (target - a[i])){
cout<<a[i]<<", β€œ<<a[left]<<” and "<<a[right]<<endl;
left++;
right–;
}
else if(sum > (target - a[i])){
right–;
}
else{
left++;
}
}
}
return 0;
}

please share your code through ide.codingblocks.com

your code is working just fine, but it would give wrong answer please sort the array after inputing it
Corrected Code

It is still showing the same error.
/bin/run.sh: line 4: 18 Bus error (core dumped) ./exe

are you submitting on hackerblocks?

try submitting on
https://hack.codingblocks.com/app/contests/1676/195/problem

Just now I tried by providing custom input and it worked.
Anyways Thank you