Sorry, this is my problem. Following line would not work right now.
This is just a small parsing problem.
>  a=new int*[n];
As a work around,  please do following,
   a=(int*)malloc(sizeof(int*)*n);
   a=(int*)new long[n];
Masaharu Goto