criyle/codenet-compile-errors huggingface dataset:
Language: C++

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S):
    ans = sys.maxsize
    for i in range(N):
        ans = min(ans, S[:i].count('W') + S[i + 1:].count('E'))
    return ans


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:49:28: warning: multi-character character constant [-Wmultichar]
   49 |         error_print(e - s, 'sec')
      |                            ^~~~~
a.cc:55:1: error: stray '@' in program
   55 | @mt
      | ^
a.cc:69:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   69 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import bisect
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
#include <tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int,int> T;
const int inf=20000000;

int now;
int main(){
  int n;
  int a=0,b=0;
  string s;
  cin>>s;
  for(int i=0;i<s.size;i++){
    if(s[i]=='E')a++;
    else b++;
  }
  if(a==0 or b==0)cout<<0<<endl;
  else cout<<min(a,b)-1<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   35 |   for(int i=0;i<s.size;i++){
      |                 ~~^~~~
      |                       ()
Language: C++

#include<bits/stdc++.h>
using namespace std
  
int main()
{
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin >> a[i];
  }
  int count=0, sum=0, ad=a[0];
  for(int i=1;i<n;i++)
  {
    ad = ad && a[i];
    if(ad==0)
      count++;
    sum+=count;
  }
  cout << sum+n;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main()
      | ~~~
Language: C++

#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut sum = 0;
    let mut r = 0;
    let mut ans = 0;
    for l in 0..n{
        while r < n && sum + a[r] == sum ^ a[r]{
            sum += a[r];
            r += 1;
        }
        ans += r - l;
        sum -= a[l];
    }
    println!("{}", ans);
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #![allow(unused_imports)]
      |  ^
a.cc:2:2: error: invalid preprocessing directive #!
    2 | #![allow(unused_variables)]
      |  ^
a.cc:16:14: error: too many decimal points in number
   16 |     for l in 0..n{
      |              ^~~~
a.cc:3:1: error: 'use' does not name a type
    3 | use proconio::input;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use proconio::marker::*;
      | ^~~
a.cc:5:1: error: 'use' does not name a type
    5 | use std::cmp::{min, max};
      | ^~~
a.cc:6:1: error: 'use' does not name a type
    6 | use std::collections::{HashSet, HashMap, BinaryHeap};
      | ^~~
a.cc:8:1: error: 'fn' does not name a type
    8 | fn main() {
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(c)  c.begin(), c.end()
#define mp make_pair
#define endl "\n"
#define N 100001
#define INF 1e9


int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    
    
    ll n , i  , num = 0 ;
    cin >> n , i ;
    ll a[ n ] ;
    for(i=0 ; i<n ; i++){
        cin >> a[ i ] ;
    }
    ll idx = 0 , num = 0 , ans = 0 ;
    for(i=0 ; i<n ; i++){
       while(idx<n && num ^ a[ idx ] == num + a[ idx ]){
           num = num + a[ idx++ ] ; 
       }
       ans += idx-i ;
       if(i==idx)idx++ ;
       else num-=a[ i ] ;
    }
    cout << ans ;
    return 0 ;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: redeclaration of 'long long int num'
   31 |     ll idx = 0 , num = 0 , ans = 0 ;
      |                  ^~~
a.cc:25:17: note: 'long long int num' previously declared here
   25 |     ll n , i  , num = 0 ;
      |                 ^~~
Language: C++



#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    int N;
    cin >> N;
    ll A[N];
    rep(i, N){
        cin >> A[i];
    }

    ll res = 0;
    int right = 0;
    int sum = 0;
    for (int left = 0; left < n; ++left) {
        while (right < n && (sum ^ a[right]) == (sum + a[right])) {
            sum += a[right];
            ++right;
        }
        res += right - left;

        sum -= a[left];
        
    }

    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:31: error: 'n' was not declared in this scope
   27 |     for (int left = 0; left < n; ++left) {
      |                               ^
a.cc:28:36: error: 'a' was not declared in this scope
   28 |         while (right < n && (sum ^ a[right]) == (sum + a[right])) {
      |                                    ^
a.cc:34:16: error: 'a' was not declared in this scope
   34 |         sum -= a[left];
      |                ^
Language: C++

#include <queue>
#include <iostream>
using namespace std;
typedef unsigned long ul;
int main(){
  queue<ul> q;
  int n;
  long t=0,u=0;
  ul l,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>l;
    if(c&l){
      do{
        c-=q.front();
        q.pop();
        u--;
      }while(c&l);
    }
  c+=l;
  q.push(l);
  t+=++u;
  }
  cout << t;

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: expected '}' at end of input
   24 |   cout << t;
      |             ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e10;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 




////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////
int n,a[210000];
signed main(){
  cin>>n;rep(i,n)cin>>a[i];
  int ans = 0, sum = 0, right = 0;
  rep(left, n){
    while(right < n && (sum ^ a[right]) == (sum + a[right])){
      sum += a[right];right++;
    }
    res += right - left;
    if(left == right)right++;
    else{
      sum -= a[left];
    }
  }
  cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'res' was not declared in this scope; did you mean 'rep'?
   32 |     res += right - left;
      |     ^~~
      |     rep
a.cc:38:11: error: 'res' was not declared in this scope; did you mean 'rep'?
   38 |   cout << res << endl;
      |           ^~~
      |           rep
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

typedef std::bitset<32> bitset;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  std::vector<bitset> a(n);
  for(int i=0;i<n;i++){
    uint32_t a_;
    cin>>a_;
    a[i]=bitset(a_);
  }

  int right=1;
  int32_t count[32]={};
  for(int i=0;i<32;i++){
    if(a[0][i]){
      count[i]=1;
    }
  }
  int64_t result=0;

  for(int left=0;left<n;left++){
    while(right<n){

      bool can_move_right=true;
      for(int i=0;i<32;i++){
        if(a[right][i]){
          if(count[i]+1>1){
            can_move_right=false;
            break;
          }
        }
      }

      if(can_move_right){
        for(int i=0;i<32;i++){
          if(a[right][i]){
            count[i]++;
          }
        }
        right++;
      }else{
        break;
      }

    }

    result+=right-left;

    if(right==left){
      right++;
    }else{
      for(int i=0;i<32;i++){
        if(a[left][i]){
          count[i]--;
        }
      }
    }


  }

  cout<<result<<endl;

  return 0;
}


Compiler output:
a.cc:21:14: error: 'bitset' in namespace 'std' does not name a template type
   21 | typedef std::bitset<32> bitset;
      |              ^~~~~~
a.cc:15:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   14 | #include <utility>
  +++ |+#include <bitset>
   15 | #include <vector>
a.cc: In function 'int main()':
a.cc:30:15: error: 'bitset' was not declared in this scope
   30 |   std::vector<bitset> a(n);
      |               ^~~~~~
a.cc:30:21: error: template argument 1 is invalid
   30 |   std::vector<bitset> a(n);
      |                     ^
a.cc:30:21: error: template argument 2 is invalid
a.cc:32:5: error: 'uint32_t' was not declared in this scope
   32 |     uint32_t a_;
      |     ^~~~~~~~
a.cc:15:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <utility>
  +++ |+#include <cstdint>
   15 | #include <vector>
a.cc:33:10: error: 'a_' was not declared in this scope; did you mean 'a'?
   33 |     cin>>a_;
      |          ^~
      |          a
a.cc:34:6: error: invalid types 'int[int]' for array subscript
   34 |     a[i]=bitset(a_);
      |      ^
a.cc:40:9: error: invalid types 'int[int]' for array subscript
   40 |     if(a[0][i]){
      |         ^
a.cc:51:13: error: invalid types 'int[int]' for array subscript
   51 |         if(a[right][i]){
      |             ^
a.cc:61:15: error: invalid types 'int[int]' for array subscript
   61 |           if(a[right][i]){
      |               ^
a.cc:78:13: error: invalid types 'int[int]' for array subscript
   78 |         if(a[left][i]){
      |             ^
Language: Java



import java.util.Scanner;

public class newthignsa {

	public static void main(String args[]) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int ar[]=new int[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=scan.nextInt();
		}
		int bit[][]=new int[n][20];
//		int 
		int x=5;
//		System.out.println(x&(1<<0));
//		System.out.println(x&(1<<2));
//		System.out.println(x&(1<<3));
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<20;j++)
			{
				if((ar[i]&(1<<j))>=1)
				{
					bit[i][j]=1;
				}
			}
		}
		
		long ans=0;
		int tem[]=new int[20];
		int right=0;
	for(int left=0;left<n;left++)
	{
		while(right<n) {
			
			boolean good=true;
			for(int i=0;i<20;i++){
				if((tem[i]==1) && (bit[right][i]==1))
				{
//					System.out.println("ok"+" "+left+" "+right);
					good=false;
//					System.out.println(good);
					break;
				}
			}
			if(good==false){
//				System.out.println("WTFFF");
				break;
				
			}
			else{
				for(int i=0;i<20;i++)
				{
					if(bit[right][i]==1)
					{
						tem[i]=1;
					}
				}
				right++;
			}
				
			}
				
				ans+=right-left;
				
				for(int i=0;i<20;i++)
				{
					if(bit[left][i]==1)
					{
						tem[i]=0;
					}
				}
//			System.out.println(left+" "+right);	
			}
			System.out.println(ans);
			
		}
	}



Compiler output:
Main.java:5: error: class newthignsa is public, should be declared in a file named newthignsa.java
public class newthignsa {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<vector<int>> vec(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    for (int j = 0; a>0 ; j++){
      if(a%2==1)vec[i].push_back(j);
      a = a/2;
    }
  }
  long sum=0;
  int right = 0;
  set<int> s;
  for (int left = 0; left < n; ++left) {
    while (right < n) {
      bool al=true;
      set<int> t=s;
      for(int i=0;i<vec[right].size();i++){
        auto r=t.insert(vec[right][i]);
        if(!r.second)al=false;
      }
      if(al){
        s=t;
        /* 実際に right を 1 進める */
        // ex: sum += a[right];
        ++right;
      }
      else break;
    }
    sum+=right-left+1;
    if(right==left) right++;
    for(int i=0;i<vec[left].size();i++){
      s.erase(vec[left][i]);
    }
  }
  cout << sum;

    /* break した状態で right は条件を満たす最大なので、何かする */
    // ex: res += (right - left);

    /* left をインクリメントする準備 */
    // ex: if (right == left) ++right;
    // ex: else sum -= a[left];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:29: error: 'n' was not declared in this scope
   19 |   for (int left = 0; left < n; ++left) {
      |                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)


signed main(){
	int n;cin>>n;
	int cnt=0;
	vector<int>a(n);
	for(auto&& u:a)cin>>u;
	int l=0,r=0,cnt=0,sm=0;
	rep(l,n+1){
	if(l>0)sm-=a[l-1];
	if(r<l)r=l;
		while(sm&a[r]==0)){
			sm^=a[r];r++;
		}
		cnt+=r-l;
	}
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: redeclaration of 'long long int cnt'
   13 |         int l=0,r=0,cnt=0,sm=0;
      |                     ^~~
a.cc:10:13: note: 'long long int cnt' previously declared here
   10 |         int cnt=0;
      |             ^~~
a.cc:17:34: error: expected primary-expression before ')' token
   17 |                 while(sm&a[r]==0)){
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)


signed main(){
	int n;cin>>n;
	int cnt=0;
	vector<int> a(n);
	for(auto&& u:a)cin>>u;
	int l=0,r=0,cnt=0,sm=0;
	rep(l,n){
		while(sm&a[r]==0)){
			sm^=a[r];r++;
		}
		cnt+=r-l;
		sm^=a[l];
	}
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: redeclaration of 'long long int cnt'
   13 |         int l=0,r=0,cnt=0,sm=0;
      |                     ^~~
a.cc:10:13: note: 'long long int cnt' previously declared here
   10 |         int cnt=0;
      |             ^~~
a.cc:15:34: error: expected primary-expression before ')' token
   15 |                 while(sm&a[r]==0)){
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)

bool over_digit(int x,int y){
	if(x<y)swap(x,y);
	while(x>0){
	  if((x&1==1) && (y&1==1))return false;
		x>>=1;y>>=1;
	}
		return true;
} 

signed main(){
	int n;cin>>n;

	vector<int> a(n);
	for(auto&& u:a)cin>>u;
	int l=0,r=1,cnt=0,sm=a[0];
	rep(l,n){
		while(sm&a[r]==0)){
			sm^=a[r];r++;
		}
		cnt+=r-l;
		sm^=a[l];
		if(r<=l)r=l+1;
	}
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: expected primary-expression before ')' token
   23 |                 while(sm&a[r]==0)){
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)

bool over_digit(int x,int y){
	if(x<y)swap(x,y);
	while(x>0){
	  if((x&1==1) && (y&1==1))return false;
		x>>=1;y>>=1;
	}
		return true;
} 

signed main(){
	int n;cin>>n;
	int cnt=0;
	vector<int> a(n);
	for(auto&& u:a)cin>>u;
	int l=0,r=1,cnt=0,sm=a[0];
	rep(l,n){
		while(sm&a[r]==0)){
			sm^=a[r];r++;
		}
		cnt+=r-l;
		sm^=a[l];
		if(r<=l)r=l+1;
	}
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: redeclaration of 'long long int cnt'
   21 |         int l=0,r=1,cnt=0,sm=a[0];
      |                     ^~~
a.cc:18:13: note: 'long long int cnt' previously declared here
   18 |         int cnt=0;
      |             ^~~
a.cc:23:34: error: expected primary-expression before ')' token
   23 |                 while(sm&a[r]==0)){
      |                                  ^
Language: C++

#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>

using namespace std;
using ll = long long;

int main()
{
	int n;
	cin >> n;

	vector<int> v(n+1);
	vector <int> a(n+1);
	v[0] = 0;
	a[0] = -1;

	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	
	for (int i = n; i > 0;)
	{
		int cnt = 1;
		int sum = a[i-1] + a[i];
		int xor = a[i-1] ^ a[i];

		while ((sum == xor) && (i-cnt > 0))
		{
			cnt++;
			sum += a[i - cnt];
			xor ^= a[i - cnt];
		}

		v[i] = i - cnt;
		i --;
	}

	int ret = 0;

	int lasti = 0;

	for (int i = n; i > 0; --i)
	{
		ret += i - v[i];
	}


	cout << ret << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:21: error: expected unqualified-id before 'xor' token
   34 |                 int xor = a[i-1] ^ a[i];
      |                     ^~~
a.cc:36:32: error: expected primary-expression before 'xor' token
   36 |                 while ((sum == xor) && (i-cnt > 0))
      |                                ^~~
a.cc:36:35: error: expected primary-expression before ')' token
   36 |                 while ((sum == xor) && (i-cnt > 0))
      |                                   ^
a.cc:40:25: error: expected primary-expression before 'xor' token
   40 |                         xor ^= a[i - cnt];
      |                         ^~~
a.cc:40:29: error: expected primary-expression before '^=' token
   40 |                         xor ^= a[i - cnt];
      |                             ^~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  int a[n];
  REP(i,n){
    cin>>a[i];
  }
  //a[i]のj桁目のbitが立っているかどうかを格納する配列
  vector<vector<bool>> bits(n,vector<bool>(20,false));
  REP(i,n){
    REP(j,20){
      if(1&a[i]>>j){
        bits[i][j]=true;
      }
    }
  }
  vector<int> sbits(20,0);
  int r=0;
  long long ans=0;
  REP(l,n){
    if(r+1>=n){
      ans += r-l+1;
      continue;
    }
    bool flag=true;
    while(flag && r+1<n){
      REP(i,20){
        if(sbits[i]+bits[r+1][j]>1){
          flag=false;
          break;
        }
      }
      if(flag){
        r++;
      }
    }
    ans += r-l+1;
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:116:31: error: 'j' was not declared in this scope
  116 |         if(sbits[i]+bits[r+1][j]>1){
      |                               ^
Language: C++

#include <cstdio>
using namespace std;

typedef long long ll;

string bit(int n){
  string ans="";
  for(int i=0;i<20;i++){
    char c=n%2+'0';
    ans=c+ans;
    n/=2;
  }
  return ans;
}

int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
  ll ans=0;
  int count[n][20];
  for(int i=0;i<n;i++){
    for(int j=0;j<20;j++){
      count[i][j]=bit(a[i])[j]-'0';
    }
  }
  int right=0;
  int sum[20];
  for(int i=0;i<20;i++) sum[i]=0;
  for(int left=0;left<n;left++){
    bool check=true;
    for(int i=0;i<20;i++){
      if(sum[i]+count[right][i]>1){
        check=false;
      }
    }
    while(check){
      for(int i=0;i<20;i++){
        sum[i]+=count[right][i];
      }
      right++;
      for(int i=0;i<20;i++){
        if(sum[i]+count[right][i]>1){
          check=false;
        }
      }
    }
    ans+=(right-left);
    if(right==left) right++;
    else{
      for(int i=0;i<20;i++){
        sum[i]-=count[left][i];
      }
    }
  }
  printf("%lld\n",ans);
}

Compiler output:
a.cc:6:1: error: 'string' does not name a type; did you mean 'stdin'?
    6 | string bit(int n){
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:25:19: error: 'bit' was not declared in this scope
   25 |       count[i][j]=bit(a[i])[j]-'0';
      |                   ^~~
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int MAX=1e9;
int MOD=1e9+7;

int main(){
  ll n,num=0,ans=0;cin>>n;
  ll b[n]=0,c[n]=0;
  for(int i=1;i<=n;i++){
    ll a;cin>>a;
    b[i]=a^b[i-1];
    c[i]=a+c[i-1];
  }
  for(int i=0;i<n;i++){
    num=max(i+1,r);
    while(r<n&&c[r+1]-c[i]==b[r+1]^b[i]){
      num++;
    }
    ans+=num-i;
  }
  cout<<num<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: array must be initialized with a brace-enclosed initializer
   13 |   ll b[n]=0,c[n]=0;
      |           ^
a.cc:13:18: error: array must be initialized with a brace-enclosed initializer
   13 |   ll b[n]=0,c[n]=0;
      |                  ^
a.cc:20:17: error: 'r' was not declared in this scope
   20 |     num=max(i+1,r);
      |                 ^
Language: C++

/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}


int a[MAXN];
int ans;

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
	#endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
    	a[i] = readInt();
    }
    int l = 1;
    int kek = a[1];
    for (int r = 1; r <= n; r++) {
    	while ((kek & a[l])) {
			kek ^= a[l];
			l++;		
    	}
    	ans += (r - i + 1);
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:21: error: 'i' was not declared in this scope
   88 |         ans += (r - i + 1);
      |                     ^
Language: C++

#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
typedef long long ll;
using namespace std;

int n, a[100000], l, r;
ll ans, mem;

bool xor(ll x,ll y) {
	lp(20) {
		if (x % 2 == 1 && y % 2 == 1)
			return false;
		x /= 2;
		y /= 2;
	}
	return true;
}

int main() {
	cin >> n;
	lp(n)
		cin >> a[i];
	ans = l = 0;
	r = -1;
	mem = 0;
	while (r != n - 1) {
		if (xor (mem, a[r + 1])) {
			mem += a[r + 1];
			r++;
		}
		else {
			ans += r - l + 1;
			mem -= a[l];
			l++;
		}
	}
	ans += (r - l + 1)*(r - l + 2) / 2;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:28:6: error: expected unqualified-id before 'xor' token
   28 | bool xor(ll x,ll y) {
      |      ^~~
a.cc: In function 'int main()':
a.cc:46:21: error: expected primary-expression before 'xor' token
   46 |                 if (xor (mem, a[r + 1])) {
      |                     ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;

ll N, l, r;
ll arr[200001];

int main() {
	cin.tie(NULL); cout.tie(NULL);
	ios::sync_with_stdio(false);

	cin >> N;
	for (int i = 1; i <= N; ++i) {
		cin >> arr[i];
	}

	l = 1;
	ll xor = 0, sum = 0, res = 0;

	for (int i = 1; i <= N; ++i) {
		xor ^= arr[i];
		sum += arr[i];
		if (xor != sum) {
			res += (i - l + 1)*(i - l) / 2;
			while (xor != sum) {
				xor ^= arr[l];
				sum -= arr[l++];
			}
			res -= (i - l + 1)*(i - l) / 2;
		}
	}

	if (xor == sum) {
		res += (N - l + 2)*(N - l + 1) / 2;
	}

	cout << res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: expected unqualified-id before 'xor' token
   26 |         ll xor = 0, sum = 0, res = 0;
      |            ^~~
a.cc:29:17: error: expected primary-expression before 'xor' token
   29 |                 xor ^= arr[i];
      |                 ^~~
a.cc:29:21: error: expected primary-expression before '^=' token
   29 |                 xor ^= arr[i];
      |                     ^~
a.cc:30:17: error: 'sum' was not declared in this scope
   30 |                 sum += arr[i];
      |                 ^~~
a.cc:31:21: error: expected primary-expression before 'xor' token
   31 |                 if (xor != sum) {
      |                     ^~~
a.cc:31:25: error: expected primary-expression before '!=' token
   31 |                 if (xor != sum) {
      |                         ^~
a.cc:32:25: error: 'res' was not declared in this scope
   32 |                         res += (i - l + 1)*(i - l) / 2;
      |                         ^~~
a.cc:33:32: error: expected primary-expression before 'xor' token
   33 |                         while (xor != sum) {
      |                                ^~~
a.cc:33:36: error: expected primary-expression before '!=' token
   33 |                         while (xor != sum) {
      |                                    ^~
a.cc:34:33: error: expected primary-expression before 'xor' token
   34 |                                 xor ^= arr[l];
      |                                 ^~~
a.cc:34:37: error: expected primary-expression before '^=' token
   34 |                                 xor ^= arr[l];
      |                                     ^~
a.cc:41:13: error: expected primary-expression before 'xor' token
   41 |         if (xor == sum) {
      |             ^~~
a.cc:41:17: error: expected primary-expression before '==' token
   41 |         if (xor == sum) {
      |                 ^~
a.cc:41:20: error: 'sum' was not declared in this scope
   41 |         if (xor == sum) {
      |                    ^~~
a.cc:42:17: error: 'res' was not declared in this scope
   42 |                 res += (N - l + 2)*(N - l + 1) / 2;
      |                 ^~~
a.cc:45:17: error: 'res' was not declared in this scope
   45 |         cout << res;
      |                 ^~~
Language: C++

/*
  AtCoder Regular Contest 098
  D - Xor Sum 2
*/

#include<iostream>
using namespace std;

int N;
unsigned long long sum = 0;
unsigned long long A[200001];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%llu", &A[i]);

  ull count = 0;
  int j = 1;
  sum = A[0];
  for (int i = 0; i < N; ++i) {
    while((j < N) && ((sum & A[j]) == 0)) sum ^= A[j++];
    count += j - i;
    sum ^= A[i];
  }

  printf("%llu\n", count);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'ull' was not declared in this scope
   17 |   ull count = 0;
      |   ^~~
a.cc:22:5: error: 'count' was not declared in this scope
   22 |     count += j - i;
      |     ^~~~~
a.cc:26:20: error: 'count' was not declared in this scope
   26 |   printf("%llu\n", count);
      |                    ^~~~~
Language: C++

#include <iostream>
using namespace std;
using i64 = long long;
int main(){
	int N;
	vector<i64> A;
	cin >> N;
	A.resize(N);
	for(int i = 0;i < N;i++){
		cin >> A[i];
	}
	i64 XOR = 0;
	int r = 0;
	i64 ans = 0;
	for(int l = 0;l < N;l++){
		while(r < N && (XOR & A[r]) == 0){
			XOR |= A[r];
			r++;
		}
		ans += r - l;
		if(l == r){
			r++;
		}
		else{
			XOR = XOR & ~A[l];
		}
	}
	cout << ans << endl;
}


	

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<i64> A;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:6:19: error: expected primary-expression before '>' token
    6 |         vector<i64> A;
      |                   ^
a.cc:6:21: error: 'A' was not declared in this scope
    6 |         vector<i64> A;
      |                     ^
Language: C++

#include<iostream>
using namespace std;
int A[1<<20];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=N;i++){
		cin>>A[i];
	}
	int r=1;
	long long sum=0;
	long long res=0;
	for(int l=1;l<=N;l++){
		while((r<=N)&&(sum+A[r]==(sum^A[r]))){
			sum+=A[r];
			r++;
		}
		res+=r-l;
		sum-=A[l];
	}
	cout<<res<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: 'N' was not declared in this scope
    7 |         for(int i=1;i<=N;i++){
      |                        ^
a.cc:13:24: error: 'N' was not declared in this scope
   13 |         for(int l=1;l<=N;l++){
      |                        ^
Language: C++

#include<iostream>
#define ls rt<<1
#define rs rt<<1|1
#define m (l+r)/2
using namespace std;
int n,T1[800009],T2[800009],a[200003];
void Build(int l,int r,int rt){
	if(l==r){
		T1[rt]=a[l];
		T2[rt]=a[l];
		return;
	}
	Build(l,m,ls);
	Build(m+1,r,rs);
	T1[rt]=T1[ls]^T1[rs];
	T2[rt]=T2[ls]+T2[rs];
}
pair <int,int> Query(int L,int R,int l,int r,int rt){
	if(L<=l&&r<=R)
		return pair <int,int> (T1[rt],T2[rt]);
	pair <int,int> p1,p2;
	if(L<=m)p1=Query(L,R,l,m,ls);
	if(R>m)p2=Query(L,R,m+1,r,rs);
	p1.first^=p2.first;
	p1.second+=p2.second;
	return p1;
}
int main(){ 
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	Build(1,n,1);
	int ans=0;
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=i+33;p=Query(i,j,1,n,1);
			if(p.first==p.second)ans++;
		}
	cout<<ans+n<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:39: error: 'p' was not declared in this scope
   35 |                 for(int j=i+1;j<=i+33;p=Query(i,j,1,n,1);
      |                                       ^
a.cc:35:57: error: expected ')' before ';' token
   35 |                 for(int j=i+1;j<=i+33;p=Query(i,j,1,n,1);
      |                    ~                                    ^
      |                                                         )
a.cc:36:28: error: 'p' was not declared in this scope
   36 |                         if(p.first==p.second)ans++;
      |                            ^
a.cc: At global scope:
a.cc:38:9: error: 'cout' does not name a type
   38 |         cout<<ans+n<<endl;
      |         ^~~~
a.cc:39:9: error: expected unqualified-id before 'return'
   39 |         return 0;
      |         ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] A=new int[n];
		for(int i=0;i<n;i++){
			A[i]=sc.nextInt();
		}
		
		int l=0,r=0;
		long x=A[0];
		int comb=1;
		while(r<n-1){
//			System.out.println(l+","+r+","+x);
			if((x&A[r+1])==0){
				x=x|A[r+1];
				r++;
				comb+=r-l+1;
			}else{
				x=x^A[l];
				l++;
			}
		}
		System.out.println(comb);
		
	}
	
	public static int[][] readhw(int height, int width){
		int[][] hw = new int[height][width];
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<height;i++)
			for(int j=0;j<width;j++)
				hw[i][j]=sc.nextInt();
		return hw;
	}
}


Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:30: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:30: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
4 errors
Language: C++

#include "omp.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <random>
#include <bitset>
#include <unordered_set>
#include <cassert>
#include <list>


using namespace std;

typedef long long ll;
typedef long double ld;


const int sze = 1e5 + 10;
const ll MOD1 = 1e9 + 7;

ll fact[sze];


inline ll MOD(ll v)
{
	return v % MOD1;
}


ll bin_pow(ll v, int pow)
{
	ll res = 1;

	while (pow)
	{
		if (pow & 1)
			res = MOD(res * v);

		pow >>= 1;

		v = MOD(v * v);
	}

	return res;
}


ll A(ll n, ll k)
{
	return MOD(fact[n] * bin_pow(fact[n - k], MOD1 - 2));
}


ll C(ll n, ll k)
{
	return MOD(fact[n] * bin_pow(MOD(fact[n - k] * fact[k]), MOD1 - 2));
}


signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;
	cin >> n;

	vector<ll> values(n), next(n);
	for (int i = 0; i < n; ++i)
		cin >> values[i];

	int ind = n;
	for (int i = n - 1; i >= 0; --i)
	{
		next[i] = ind;

		if (values[i] != 0)
			ind = i;
	}

	ll ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ll sum = 0, xor = 0;
		int j = i;
		while (j < n)
		{
			sum += values[j];
			xor ^= values[j];

			if (sum == xor)
			{
				ans += next[j] - j;
				j = next[j];
			}
			else
				break;
		}
	}

	cout << ans;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:97:29: error: expected unqualified-id before 'xor' token
   97 |                 ll sum = 0, xor = 0;
      |                             ^~~
a.cc:102:25: error: expected primary-expression before 'xor' token
  102 |                         xor ^= values[j];
      |                         ^~~
a.cc:102:29: error: expected primary-expression before '^=' token
  102 |                         xor ^= values[j];
      |                             ^~
a.cc:104:36: error: expected primary-expression before 'xor' token
  104 |                         if (sum == xor)
      |                                    ^~~
a.cc:104:39: error: expected primary-expression before ')' token
  104 |                         if (sum == xor)
      |                                       ^
Language: C++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
//#include <bits/stdc++.h>

using namespace std;
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int N;
vector<bitset<20>> A;
int f_1(int r ) {
	int num = 0;
	bitset<20> x = 0 ;
	bitset<20> and;
	for (int j = 0; j < N -r; j++) {
		and = x & A[r + j];
		x = x | A[r+ j];
		if (and != bitset<20>(0)) {
			return num;
		}
		++num;
	}
	return num;
}
int main() {

	cin >> N;
	int a;
	for (int i = 0; i < N; i++) {
		cin >> a;
		A.push_back((bitset<20> )a);
	}
	int ret=0;
	for (int r = 0; r < N; r++) {
		ret+=f_1(r);
	}
	cout << ret;

	return 0;
}

Compiler output:
a.cc: In function 'int f_1(int)':
a.cc:29:23: error: expected unqualified-id before ';' token
   29 |         bitset<20> and;
      |                       ^
a.cc:31:21: error: expected identifier before '=' token
   31 |                 and = x & A[r + j];
      |                     ^
a.cc:33:25: error: expected identifier before '!=' token
   33 |                 if (and != bitset<20>(0)) {
      |                         ^~
Language: C++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
//#include <bits/stdc++.h>

using namespace std;
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int N;
vector<bitset<20>> A;
int f_1(int r ) {
	int num = 0;
	bitset<20> or = 0 ;
	bitset<20> and;
	for (int j = 0; j < N -r; j++) {
		and = or & A[r + j];
		or = or | A[r+ j];
		if (and != bitset<20>(0)) {
			return num;
		}
		++num;
	}
	return num;
}
int main() {

	cin >> N;
	int a;
	for (int i = 0; i < N; i++) {
		cin >> a;
		A.push_back((bitset<20> )a);
	}
	int ret=0;
	for (int r = 0; r < N; r++) {
		ret+=f_1(r);
	}
	cout << ret;

	return 0;
}

Compiler output:
a.cc: In function 'int f_1(int)':
a.cc:28:20: error: expected unqualified-id before 'or' token
   28 |         bitset<20> or = 0 ;
      |                    ^~
a.cc:29:23: error: expected unqualified-id before ';' token
   29 |         bitset<20> and;
      |                       ^
a.cc:31:21: error: expected identifier before '=' token
   31 |                 and = or & A[r + j];
      |                     ^
a.cc:31:23: error: expected primary-expression before 'or' token
   31 |                 and = or & A[r + j];
      |                       ^~
a.cc:32:17: error: expected primary-expression before 'or' token
   32 |                 or = or | A[r+ j];
      |                 ^~
a.cc:32:20: error: expected primary-expression before '=' token
   32 |                 or = or | A[r+ j];
      |                    ^
a.cc:32:22: error: expected primary-expression before 'or' token
   32 |                 or = or | A[r+ j];
      |                      ^~
a.cc:32:25: error: expected primary-expression before '|' token
   32 |                 or = or | A[r+ j];
      |                         ^
a.cc:33:25: error: expected identifier before '!=' token
   33 |                 if (and != bitset<20>(0)) {
      |                         ^~
Language: C++

#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll n, a[2020];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	ll xor = 0, cnt = 0, num = 0, ans = 0;
	bool f = 0;
	for (int i = 0; i < n; i++) {
		num += a[i];
		xor ^= a[i];
		if (num == xor)cnt++;
		else {
			ans += cnt * (cnt + 1) / 2;
			if (cnt == 1 && !f)ans--;
			if (f)f = 0;
			if (cnt > 1) {
				i -= 2;
				f = 1;
			}
			cnt = num = xor = 0;
		}
	}
	ans += cnt * (cnt + 1) / 2;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: expected unqualified-id before 'xor' token
   20 |         ll xor = 0, cnt = 0, num = 0, ans = 0;
      |            ^~~
a.cc:23:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   23 |                 num += a[i];
      |                 ^~~
      |                 enum
a.cc:24:17: error: expected primary-expression before 'xor' token
   24 |                 xor ^= a[i];
      |                 ^~~
a.cc:24:21: error: expected primary-expression before '^=' token
   24 |                 xor ^= a[i];
      |                     ^~
a.cc:25:28: error: expected primary-expression before 'xor' token
   25 |                 if (num == xor)cnt++;
      |                            ^~~
a.cc:25:31: error: expected primary-expression before ')' token
   25 |                 if (num == xor)cnt++;
      |                               ^
a.cc:25:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   25 |                 if (num == xor)cnt++;
      |                                ^~~
      |                                int
a.cc:27:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |                         ans += cnt * (cnt + 1) / 2;
      |                         ^~~
      |                         abs
a.cc:27:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |                         ans += cnt * (cnt + 1) / 2;
      |                                ^~~
      |                                int
a.cc:34:37: error: expected primary-expression before 'xor' token
   34 |                         cnt = num = xor = 0;
      |                                     ^~~
a.cc:34:41: error: expected primary-expression before '=' token
   34 |                         cnt = num = xor = 0;
      |                                         ^
a.cc:37:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |         ans += cnt * (cnt + 1) / 2;
      |         ^~~
      |         abs
a.cc:37:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |         ans += cnt * (cnt + 1) / 2;
      |                ^~~
      |                int
Language: C++

#include <iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int a[200002];
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	int l = 0, r = 1;
	ll ct = 0;
	int nowbs = a[0];
	while(l != N || r != N){
		if(r < N && (nowbs | a[r]) == nowbs + a[r]){
			ct += r - l;
			nowbs ^= a[r];
			r++;
		}else{
			ct++;
			nowbs ^= a[l];
			l++;
		}
	}
	cout << ct << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'll' was not declared in this scope; did you mean 'l'?
   13 |         ll ct = 0;
      |         ^~
      |         l
a.cc:17:25: error: 'ct' was not declared in this scope
   17 |                         ct += r - l;
      |                         ^~
a.cc:21:25: error: 'ct' was not declared in this scope
   21 |                         ct++;
      |                         ^~
a.cc:26:17: error: 'ct' was not declared in this scope
   26 |         cout << ct << endl;
      |                 ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,a[200000];
int main()
{
long long beg,end,x,ans=0;
cin>>n;
for(i=0;i<n;i++)cin>>a[i];
for(beg=0;beg<n;beg++)
{
x=0;
for(end=beg;(end<n)&&((x&a[end])==0);end++)
x^=a[end];
ans+=(end-beg);
}
cout<<ans;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'i' was not declared in this scope
    8 | for(i=0;i<n;i++)cin>>a[i];
      |     ^
Language: C++

#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>

using namespace std;

int n;
int a[200001] = {};
long s[200001] = {};
int x[200001][21] = {};

int main(){
cin >> n;
for(int i = 1; i < n+1; i++) cin >> a[i];
for(int i = 1; i < n+1; i++){
  s[i] = s[i-1] + a[i];
  for (int j = 0; j < 20; j++) {
    x[i][j] = ((a[i]>>j)&1) + x[i-1][j];
  }
}

int c = 0;
int i = 1, j = 1;

while(i<n+1){
  while(true){
    int sn = 0, xn =0;
    for (int h = 0; h <= 20; h++){
      xn += ((x[j][h]-x[i-1][h])%2) * pow(2,h);
      }
    sn = s[j]-s[i-1];
    if (sn!=xn){
      c+=j-i;
      j--;
      i++;
      break;
    }
    if(j == n){c += j-i+1;
      i++;
      break;}

    j++;
}


cout << c << endl;



return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:16:11: note: to match this '{'
   16 | int main(){
      |           ^