Getting runtime error SIGSEGV for this code of VOTERS!

Please help! I am getting the ID of the voter from the three officials. At the indices of their ID by default 0 is stored through memset! So if two or more than two officials type a particular ID, at that index increment is done! So finally those index (or ID) we want for the answer will store 2 or 3. And at the end that is printed! I even changed the size of the arr1 from 50001 to 5001 but still gotr the same error! Please help!

http://www.codechef.com/viewsolution/4376475

//