Large numbers in Arrays

I always have problem in Questions where testcases contain arrays in which elements at each index have larger value like more than 4 digit numbers. My code perfectly works for arrays with small values. Like in this Q of minimum number of swaps to get sorted array, my code doesn’t work for array of size 50 and each element of array was of 4-5 digits. I used long long int but that didn’t solve my problem. Can you tell me how to solve this problem. I would also like to mention that I many a times use in-built functions as well on them like I used inbuit sort fn sort() in that Q, If that have any relation with the problem I am facing…