I'm getting SIGSEGV error in codechef, not in compiler

see the compiled code at gIWKI1 - Online C++ Compiler & Debugging Tool - Ideone.com

state the problem which you are trying to solve !!

you dont need the this loop in lines 31 and 48.

for(i=0;i<size;i++)

because of these for loops variable ‘k’ reaches a value of size*size where as
you have allocated array ‘b’ only ‘size’ ints.
remove these for loops ideone link and you wont get any sigsev error but you will get tle(time limit exceeded).
see the editorial for faster algorithm.
a small suggestion try to write code with indentation as it will help you in reading code and debugging.

I think the question is ROTATION Problem - CodeChef