fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class RandomGCD {
  5. public:
  6. long long Pow(long long a, long long e, long long mod) {
  7. if(e <= 0) return 1;
  8. long long x =Pow(a,e/2,mod);
  9. x =(x*x)%mod;
  10. if(e%2 != 0) x =(x*a)%mod;
  11. return x;}
  12.  
  13. long long mod =1000000007;
  14. int High,Low,M;
  15.  
  16. long long count(vector<long long> &A, int D) {
  17. if(High/D == Low/D) return 0;
  18. if(A[D] >= 0) return A[D];
  19. A[D] =Pow(High/D-Low/D,M,mod)-(High/D-Low/D);
  20. for(int i =2; i <= (High-Low)/D; i++)
  21. if(High/(D*i)-Low/(D*i) > 1) A[D] =(A[D]+mod-count(A,D*i))%mod;
  22. return A[D];}
  23.  
  24. int countTuples(int N, int K, int low, int high) {
  25. Low =(low-1)/K;
  26. High =high/K;
  27. M =N;
  28. vector<long long> A(High-Low+1,-1);
  29. return count(A,1)+((Low < 1 && High >= 1)?1:0);}
  30. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty