Source Code
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	string s; cin >> s;
	int q; cin >> q;
	while (q--) {
		ll l, r; cin >> l >> r;l--,r--;
		bitset<63>b(s, l, r-l+1);
		//cout<<b<<"\n";
		cout << b.to_ullong()%10<< "\n";
	}
	return 0;
}
/*
5
0
3
3
7*/
Copy
Binarithm Walaa Abd Elhady
GNU G++17
160 ms
960 KB
Wrong Answer