fork download
  1. int expo(int a,int b,int M)
  2. {
  3. int res=1;
  4. a%=M;
  5. while(b)
  6. {
  7. if(b&1)
  8. {
  9. res=(res*1ll*a)%M;
  10. }
  11. a=(a*1ll*a)%M;
  12. b>>=1;
  13. }
  14. return res;
  15. }
  16.  
  17. int fun(vector<int> arr) {
  18. int M =1e9+7, n=arr.size();
  19. int ans=0;
  20. for(int i=0; i<n;i++)
  21. {
  22. ans |=arr[i];
  23. }
  24.  
  25. ans = (expo(2,n-1,M) *1ll* ans)%M;
  26. return ans;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:17:9: error: ‘vector’ was not declared in this scope
 int fun(vector<int> arr) {
         ^~~~~~
prog.cpp:17:16: error: expected primary-expression before ‘int’
 int fun(vector<int> arr) {
                ^~~
stdout
Standard output is empty