1// Convert integer to vector of digits
2vector<int> int_to_vector(long long n) {
3 vector<int> vec;
4 while (n != 0) {
5 vec.push_back(n%10);
6 n /= 10;
7 }
8 reverse(vec.begin(), vec.end());
9 return vec;
10}
1// Convert vector of digits to integer
2long long vector_to_int(vector<int> num) {
3 long long n = 0;
4 int N = num.size();
5 for (int i = 0; i < N; i++) {
6 n += num[i]*pow(10, N-i-1);
7 }
8 return n;
9}