Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <bitset>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

bool check( vector<int> &cnt ){
    for(int i = 0; i < cnt.size(); i++){
        if(cnt[i] > 1) return false;
    }
    return true;
}

void add( vector<int> &cnt, bitset<20> &bs ){
    for(int i = 0; i < 20; i++){
        cnt[i] += bs[i];
    } 
}

void sub( vector<int> &cnt, bitset<20> &bs ){
    for(int i = 0; i < 20; i++){
        cnt[i] -= bs[i];
    } 
}


int main(){

    int n;
    cin >> n;

    vector < bitset<20> > v(n);
    for(int i = 0; i < n; i++){
        unsigned long s;
        cin >> s;
        bitset<20> bs(s);
        v[i] = bs;
    }

    vector<int> cnt(20);

    int left = 0;
    int right = -1;
    ll ans = 0;

    while(true){

        if( check(cnt) ){
            right ++;
            if(right == n){
                ans += ( n - left ) * (n - left + 1) / 2;
                break;
            } 
            add( cnt, v[right] );
        }
        else{
            //cout << right << " " << left << endl;
            ans += (right - left);
            sub( cnt, v[left] );
            left ++;
        }

        if(left == n ) break;

    }
    
    cout << ans << endl;


}#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <bitset>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

bool check( vector<int> &cnt ){
    for(int i = 0; i < cnt.size(); i++){
        if(cnt[i] > 1) return false;
    }
    return true;
}

void add( vector<int> &cnt, bitset<20> &bs ){
    for(int i = 0; i < 20; i++){
        cnt[i] += bs[i];
    } 
}

void sub( vector<int> &cnt, bitset<20> &bs ){
    for(int i = 0; i < 20; i++){
        cnt[i] -= bs[i];
    } 
}


int main(){

    int n;
    cin >> n;

    vector < bitset<20> > v(n);
    for(int i = 0; i < n; i++){
        unsigned long s;
        cin >> s;
        bitset<20> bs(s);
        v[i] = bs;
    }

    vector<int> cnt(20);

    int left = 0;
    int right = -1;
    ll ans = 0;

    while(true){

        if( check(cnt) ){
            right ++;
            if(right == n){
                ans += ( n - left ) * (n - left + 1) / 2;
                break;
            } 
            add( cnt, v[right] );
        }
        else{
            //cout << right << " " << left << endl;
            ans += (right - left);
            sub( cnt, v[left] );
            left ++;
        }

        if(left == n ) break;

    }
    
    cout << ans << endl;


}

Compiler output:
a.cc:81:2: error: stray '#' in program
   81 | }#include <iostream>
      |  ^
a.cc:81:3: error: 'include' does not name a type
   81 | }#include <iostream>
      |   ^~~~~~~
a.cc:96:12: error: redefinition of 'const bool DEBUG'
   96 | const bool DEBUG = true;
      |            ^~~~~
a.cc:16:12: note: 'const bool DEBUG' previously defined here
   16 | const bool DEBUG = true;
      |            ^~~~~
a.cc:98:6: error: redefinition of 'bool check(std::vector<int>&)'
   98 | bool check( vector<int> &cnt ){
      |      ^~~~~
a.cc:18:6: note: 'bool check(std::vector<int>&)' previously defined here
   18 | bool check( vector<int> &cnt ){
      |      ^~~~~
a.cc:105:6: error: redefinition of 'void add(std::vector<int>&, std::bitset<20>&)'
  105 | void add( vector<int> &cnt, bitset<20> &bs ){
      |      ^~~
a.cc:25:6: note: 'void add(std::vector<int>&, std::bitset<20>&)' previously defined here
   25 | void add( vector<int> &cnt, bitset<20> &bs ){
      |      ^~~
a.cc:111:6: error: redefinition of 'void sub(std::vector<int>&, std::bitset<20>&)'
  111 | void sub( vector<int> &cnt, bitset<20> &bs ){
      |      ^~~
a.cc:31:6: note: 'void sub(std::vector<int>&, std::bitset<20>&)' previously defined here
   31 | void sub( vector<int> &cnt, bitset<20> &bs ){
      |      ^~~
a.cc:118:5: error: redefinition of 'int main()'
  118 | int main(){
      |     ^~~~
a.cc:38:5: note: 'int main()' previously defined here
   38 | int main(){
      |     ^~~~