Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 1e5 + 100
using namespace std;

typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
#define int ll
vl used(MAX,0);
vi v(MAX,0);
class unionfind {
    vector<int> par, rank, size_;//テゥツ?淌・ツコツヲテ」ツ?ァテ」ツ?ッテ」ツ?ェテ」ツ?湘」ツδ。テ」ツδ「テ」ツδェテ・ツ環ケテァツ篠?」ツつ津ィツ?ε」ツ?暗」ツつ凝」ツ?ェテ」ツつ詠ankテ」ツ?ョテ」ツ?凝」ツつ湘」ツつ甘」ツ?ォsizeテ」ツつ津、ツスツソテ」ツ??
public:
    unionfind(int n) :par(n), rank(n), size_(n, 1) {
        iota(all(par), 0);
    }
    int find(int x) {
        if (par[x] == x)return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])swap(x, y);
        par[y] = x;
        size_[x] += size_[y];
        if (rank[x] == rank[y])rank[x]++;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return size_[find(x)];
    }
};

signed main(){
    int n;cin>>n;
    unionfind uni(MAX);
    for(int i=0; i<n;i++){
        cin>>v[i];
        v[i]=(v[i]+i)%n;
        uni.unite(v[i],i);
    }
    int ans=0;
    vb var(MAX,true);
    rep(i,n){
        if(var[uni.find(i)]){
            var[uni.find(i)]=false;
            used[i]=1;
            while(true){
                int now=v[i];
                
                if(used[now]==0)used[now]=used[i]+1;
                else{
                    ans+=used[i]-used[now]+1;
                    break;
                }
                i=now;
            }
        }
    }
    //rep(i,n)cout<<i<<" "<<uni.find(i)<<" "<<used[i]<<endl;
    cout<<ans<<endl;
}

Compiler output:
a.cc:26:21: error: template argument 1 is invalid
   26 | #define vl vector<ll>
      |                     ^
a.cc:46:1: note: in expansion of macro 'vl'
   46 | vl used(MAX,0);
      | ^~
a.cc:26:21: error: template argument 2 is invalid
   26 | #define vl vector<ll>
      |                     ^
a.cc:46:1: note: in expansion of macro 'vl'
   46 | vl used(MAX,0);
      | ^~
a.cc:46:14: error: expression list treated as compound expression in initializer [-fpermissive]
   46 | vl used(MAX,0);
      |              ^
a.cc: In function 'int main()':
a.cc:87:17: error: invalid types 'int[long long int]' for array subscript
   87 |             used[i]=1;
      |                 ^
a.cc:91:24: error: invalid types 'int[long long int]' for array subscript
   91 |                 if(used[now]==0)used[now]=used[i]+1;
      |                        ^
a.cc:91:37: error: invalid types 'int[long long int]' for array subscript
   91 |                 if(used[now]==0)used[now]=used[i]+1;
      |                                     ^
a.cc:91:47: error: invalid types 'int[long long int]' for array subscript
   91 |                 if(used[now]==0)used[now]=used[i]+1;
      |                                               ^
a.cc:93:30: error: invalid types 'int[long long int]' for array subscript
   93 |                     ans+=used[i]-used[now]+1;
      |                              ^
a.cc:93:38: error: invalid types 'int[long long int]' for array subscript
   93 |                     ans+=used[i]-used[now]+1;
      |                                      ^