Stuck in a problem called "The smallest pair''

Solution: 48507178 | CodeChef : link to my solution.

I am not understanding why am I getting SIGTSTP error.
After editing the code a little, I am getting SIGEMT and SIESEGV errors sometimes.
Thanks!

for(int i=(n-1); i>=0 ; i–)
{
a[i] = number % 10;
number /= 10;
}

why have you used this ??

I thought the input number is in continuous format without any spaces. I tried taking input using loops, but It isn’t helping.

https://www.codechef.com/viewsolution/48510241
ur problem done ur way
u had two mistakes one while taking input for array
second to find the second minimum u don’t need to compare with a[0]
instead just compare if the values are not equal to min1 and then get min2.
An efficient approach than this is sort the array then find minimum of (a[0],a[1])

Just sort the array by using sort() fuction and then do sum of first two numbers, its simple.
sort(arr,arr+n);
cout<<arr[0] + arr[1];