[Problem C : Mr. Kitayuta, the Treasure Hunter ](http://mirror.codeforces.com/contest/505/problem/C)↵
↵
I was trying to solve this Problem on codeforces but when i was trying to solve it in my laptop it gave me ↵
StackOverflow error even for small inputs. ↵
↵
I wrote the code in Sublime Text and run it using command prompt↵
↵
![ ](http://mirror.codeforces.com/predownloaded/03/23/0323d020c339f5d5ed461125a9a73b07dbfa87ed.png)↵
↵
I tried running the same code on Eclipse IDE but in vain . Got the same StackOverflowErrorerror.↵
↵
![ ](http://mirror.codeforces.com/predownloaded/6c/3d/6c3d489422a0903407661d70f0267cd564e32e76.png)↵
↵
I checked other people's AC codes and found that logic was same . So i tried↵
submitting the code on codeforces and to my surprise it gotAC**AC**. ↵
↵
**Submitted Solution :-** [submission:21278829]↵
↵
Do i need to create a thread and initialize something or something is wrong with the memory.↵
I am unable to figure out the mistake why the program is not executing successfully↵
in my laptop. ↵
If someone knows what might be the appropriate solution it would be helpful...!↵
↵
↵
↵
↵
↵
I was trying to solve this Problem on codeforces but when i was trying to solve it in my laptop it gave me ↵
StackOverflow error even for small inputs. ↵
↵
I wrote the code in Sublime Text and run it using command prompt↵
↵
![ ](http://mirror.codeforces.com/predownloaded/03/23/0323d020c339f5d5ed461125a9a73b07dbfa87ed.png)↵
↵
I tried running the same code on Eclipse IDE but in vain . Got the same StackOverflowError
↵
![ ](http://mirror.codeforces.com/predownloaded/6c/3d/6c3d489422a0903407661d70f0267cd564e32e76.png)↵
↵
I checked other people's AC codes and found that logic was same . So i tried↵
submitting the code on codeforces and to my surprise it got
↵
**Submitted Solution :-** [submission:21278829]↵
↵
Do i need to create a thread and initialize something or something is wrong with the memory.↵
I am unable to figure out the mistake why the program is not executing successfully↵
in my laptop. ↵
If someone knows what might be the appropriate solution it would be helpful...!↵
↵
↵
↵
↵