fork download
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8.  
  9. int main() {
  10. long long a, b;
  11. cin >> a >> b;
  12. long long ans = 2;
  13. for (int i = 1; i <= a; i++) {
  14. ans = (ans * ans) % b;
  15. }
  16. cout << ans << endl;
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 3300KB
stdin
2 7
stdout
2