Language: C


#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
typedef long long lint;
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((int)(v).size())
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repf(i, a, b) for (int i = (a); i <= (b); ++i)
#define repd(i, a, b) for (int i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )

const int maxMark = 1000 + 10;

//struct node {
    //int num, res, ty;
    //node (int num = 0, int res = 0, int ty = 0) : num(num), res(res), ty(ty) {
    //}
//};

int lim[20];
int aa[20], bb[20];
int lenA, lenB;
int a, b, top[4], n, m;
int ans;
int dp[4][maxMark][3];
lint ten[20], dit[20];
set<pair<int, int> > ss[3];

int two(int x) {
    return 1 << x;
}

int F(int w, int len) {
    int res = 0;
    repd (i, len - 1, 0) {
        res = res * 2 + w / ten[i];
        w %= ten[i];
    }
    return res;
}

void init() { //int64
    lenA = 0;
    lenB = 0;
    int na = a, nb = b; 
    clr(aa);
    clr(bb);
    while (na != 0) {
        aa[lenA++] = na % 10;
        na /= 10;
    }
    if (lenA == 0)
        aa[lenA++] = 0;
    while (nb != 0) {
        bb[lenB++] = nb % 10;
        nb /= 10;
    }
    if (lenB == 0)
        bb[lenB++] = 0;
    
    ten[0] = 1;
    repf (i, 1, 13)
        ten[i] = ten[i - 1] * 10;
    
    dit[0] = bb[0];
    repf (i, 1, 13)
        dit[i] = dit[i - 1] * 10 + bb[i];
}

int getF(int *aa, int r, int l) {
    int res = 0;
    repd (i, r, l)
        res = res * 2 + aa[i];
    return res;
} 

int getD(int *aa, int r, int l) {
    int res = 0;
    repd (i, r, l)
       res = res * 10 + aa[i];
    return res; 
}

int getRes(const int& len, const int& ty) {
    if (len == -1) return 1;
    if (ty == 0) {
        return ten[len + 1];
    }
    else return dit[len];
}

int main(){
    int T, ca = 1;
    scanf("%d", &T);
    while (T--) {
        scanf("%d%d", &n, &m);
        a = n, b = m;
        init();        
    //printf("%d\n", F(1000000000, 9));
        ans = 0;
        int st = 0;
        clr(dp);
        ss[st].clear();
        dp[st][0][1] = 1; 
        ss[st].insert(make_pair(0, 1));
        //printf("%d\n", lenA);
        //repd (i, lenA, 0)
        //printf("%d", aa[i]); 
        //printf("\n");

        repd (i, max(lenB, lenA) - 1, 0) {
            //clr(dp[!st]);
            ss[!st].clear();
            int ha = getF(aa, i + 3, i) / two(3);
            int hb = getD(bb, i + 3, i);
            for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
            //repf (z, 0, 1) repf (k, 0, 999) {
                int x = it->first;
                int z = it->second;
                int y = dp[st][x][z]; 
                if (y == 0) continue;
                int now = F(x, 3) * 2;
                rep (j, 10) {
                    int nx = x * 10 + j;
                    if (z && nx > hb) break;
                    int nnow = (now + j) / two(3); 
                    if (nnow < ha) {
                        //printf("%d\n", ans);
                        if (nx == hb && z)
                            ans += getRes(i - 1, 1); 
                        else ans += getRes(i - 1, 0);
                        //printf("%d\n======\n", ans);
                    }
                    else if (nnow == ha) {
                        int nz = 0;
                        int nnx = (x % 100) * 10 + j;
                        if (nx == hb && z)
                            nz = 1;        
                        dp[!st][nnx][nz] += y;
                        ss[!st].insert(make_pair(nnx, nz));
                    }
                    else break;
                }
            }
            for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
                int x = it->first;
                int z = it->second;
                dp[st][x][z] = 0;
            }
            printf("%d\n", sz(ss[st]));
            st = !st;
        } 
        for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
        //repf (k, 0, 999)
            //repf (ty, 0, 1) 
            int k = it->first;
            int ty = it->second;
            if (dp[st][k][ty] != 0){
                int ha = getF(aa, 2, 0);
                int now = F(k, 3); 
                if (now <= ha) {
                    ans += dp[st][k][ty];
                    //printf("%d %d\n", k, ty);
                }
            }
        }
        printf("Case #%d: ", ca++);
        printf("%d\n", ans);
    }
    return 0;
}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.