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;s='*'+s;
	int q; cin >> q;
	while (q--) {
		ll l, r; cin >> l >> r;
		bitset<63>b(s, l, r-l+1);
		cout <<(1LL)* b.to_ullong()%10<< "\n";
	}
	return 0;
}
/*
5
0
3
3
7*/
Copy
Binarithm Walaa Abd Elhady
GNU G++17
141 ms
892 KB
Wrong Answer