func_code_string: #include <bits/stdc++.h>   using namespace std;   int q;   long long int input;   long long int lastSum[20];   long long int limit[20];   long long int targetSum(int digit, long long int target) {     long long int ret = lastSum[digit - 1] * target;     ret += target * (target + 1) * digit / 2;     return ret;   }   long long int targetSubSum(long long int target) {     if (target == 0) return 0;     int digit = 0;     long long int tmp = target, ret = 0, mul = 1;     while (tmp) digit++, tmp /= 10, mul *= 10;     ret += lastSum[digit - 1];     target -= (mul / 10) - 1;     ret += target * digit;     return ret;   }   int main() {     long long int mul = 9;     for (int digit = 1; digit < 10; digit++) {       lastSum[digit] = lastSum[digit - 1] + digit * mul;       limit[digit] = limit[digit - 1] + lastSum[digit - 1] * mul +                      digit * mul * (mul + 1) / 2;       mul *= 10;     }     scanf( %d , &q);     while (q) {       scanf( %lld , &input);       int digit = 1;       long long int low = 0, high = 9, answer = 1;       while (limit[digit] < input) digit++, high *= 10;       input -= limit[digit - 1];       while (low <= high) {         long long int mid = (low + high) / 2;         if (targetSum(digit, mid) <= input) {           answer = mid;           low = mid + 1;         } else           high = mid - 1;       }       long long int mul = 1;       for (int i = 1; i < digit; i++) mul *= 10;       input -= targetSum(digit, answer);       if (input == 0)         printf( %lld n , (answer + mul - 1) % 10);       else {         low = 0, high = answer + mul - 1, answer = 0;         while (low <= high) {           long long int mid = (low + high) / 2;           if (targetSubSum(mid) <= input) {             answer = mid;             low = mid + 1;           } else             high = mid - 1;         }         input -= targetSubSum(answer);         if (input == 0)           printf( %lld n , answer % 10);         else {           stack<int> s;           answer++;           while (answer) {             s.push(answer % 10);             answer /= 10;           }           for (int i = 1; i < input; i++) s.pop();           printf( %d n , s.top());         }       }       q--;     }   }   