N can be max 10 ^ 18 and hence digitsum will be 162 maximum .
static long dp [ ] [ ] [ ] = new long [ 18 ] [ 2 ] [ 162 ] ; static long solve ( int i , boolean tight , int sum_so_far , int Sum , String number , int len ) { if ( i == len ) {