#include<bits/stdc++.h>
using namespace std;
#define int long long
int q;
int pref[30], arr[30];
int get_range(int a, int b){
int l = (a - 1) % 9 + 1;
int r = (b - 1) % 9 + 1;
return pref[r] - pref[l-1] + 45 * ((b - a) / 9);
}
int main(){
cin >> q;
pref[0] = 0;
for (int i = 0; i < 30; i++){
arr[i] = (i - 1) % 9 + 1;
pref[i] = arr[i] + pref[i-1];
}
for (int i = 0; i < q; i++)
{
int l,r;
cin >> l >> r;
cout << get_range(l,r) << "\n";
}
}
Compilation message
cc1plus: error: '::main' must return 'int'