fork download
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ld long double
  6. const ll M = 1e9 + 7;
  7.  
  8. ll t, n, m;
  9.  
  10. ll pow(ll n, ll m)
  11. {
  12. ll res = 1;
  13. while (m)
  14. {
  15. if (m & 1)
  16. res = (res * n) % M;
  17. n = (n * n) % M;
  18. m >>= 1;
  19. }
  20. return res;
  21. }
  22.  
  23. int32_t main()
  24. {
  25. ios::sync_with_stdio(0);
  26. cin.tie(0);
  27. cout.tie(0);
  28.  
  29. cin >> t;
  30. while (t--)
  31. {
  32. cin >> n >> m;
  33.  
  34. ll x = pow(2, n) - 1;
  35. ll ans = pow(x, m) % M;
  36.  
  37. cout << ans << '\n';
  38. }
  39. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty