criyle/codenet-compile-errors huggingface dataset:
Language: Java

n=int(input())
c=[int(input()) for _ in [0]*n]
l=[-1]*200001
dp=[1]*n
l[c[0]]=0
mod=10**+9+7
for i in range(1,n):
	ci=c[i]
	if l[ci] not in [-1,i-1]:
		dp[i]=(dp[i-1]+dp[l[ci]])%mod
	else:
		dp[i]=dp[i-1]
	l[ci]=i
print(dp[n-1])

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n=int(input())
^
1 error
Language: Java

n=int(input())
c=[int(input()) for _ in [0]*n]
l=[-1]*200000
dp=[1]*n
l[c[0]]=0
mod=10**+9+7
for i in range(1,n):
	ci=c[i]
	if l[ci] not in [-1,i-1]:
		dp[i]=(dp[i-1]+dp[l[ci]])%mod
	else:
		dp[i]=dp[i-1]
	l[ci]=i
print(dp[n-1])

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n=int(input())
^
1 error
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
vector<ll> c;
vector<int> a;;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    map<int,ll> m;

    vector<vector<ll> > count(n);
    ll dp[n+1];
    dp[0]=0;
    int before;
    for (int i = 1; i <= n; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp);
        if(before==temp)continue;
        before=temp;
        dp[i]=dp[i-1];
        if()
        if(count[temp].size()!=0){
            for(auto iter=count[temp].begin();iter!=count[temp].end();iter++){
                if(i-*iter>1){
                    dp[i]++;
                    dp[i]+=dp[*iter];
                    dp[i]%=MOD;
                }
            }
        }
        count[temp].push_back(i);
    }
    cout << dp[n] << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:12: error: expected primary-expression before ')' token
   59 |         if()
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int ans,last,x,n,c[200019];
ll ans;

int main() {
  cin >> n;
  ans=1;
  last=-1;

  for(int i=0; i<n; i++){c[i]=0;}
  
  for(int i=0; i<n; i++){
    cin >> x;
    if(x==last){continue;}
    last=x;
    ans = (ans+c[x])%1000000007;
    c[x]=ans;
  }

  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:5:4: error: conflicting declaration 'll ans'
    5 | ll ans;
      |    ^~~
a.cc:4:5: note: previous declaration as 'int ans'
    4 | int ans,last,x,n,c[200019];
      |     ^~~
Language: C++

int pt[1000000], last[1000000];
int main(){
    int num;
    cin >> num;
    pt[0]=1;
    for(int i=1,x;i<=num;i++){
        cin>>x;
        pt[i]=pt[i-1];
        if(last[x]&&last[x]!=i-1)
            pt[i]+=pt[last[x]];
        last[x]=i;
        pt[i]%=1000000007;
    }
    cout<<pt[num];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> num;
      |     ^~~
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout<<pt[num];
      |     ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int pt[1000000008], last[1000000008];
int main(){
    int num;
    cin >> num;
    
    for(int i=1,x;i<num;i++){
        cin>>x;
        pt[i]=pt[i-1];
        if(last[x]&&last[x]!=i-1)
            pt[i]+=pt[last[x]];
        last[x]=i;
        pt[i]%=1000000007;
    }
    cout<<pt[num];
    return 0;
}

Compiler output:
/tmp/cc90NvDu.o: in function `main':
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cc90NvDu.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cc90NvDu.o
a.cc:(.text+0xd5): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cc90NvDu.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cc90NvDu.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    vector<int> C(N);
    rep(i,N){
        cin >> C[i];
        C[i]--;
    }
    map<int,int> m;
    vector<ll> dp(N+1),count(N,0);
    dp[0]=1;
    rep(i,N){
        if (!m.count(C[i])){
            dp[i+1]=dp[i];
        }
        else {
            int j=m[C[i]];
            if (j!=i){
                dp[i+1]=(dp[i]+count[C[i]])%MOD;
            }
            else {
                dp[i+1]=dp[i];
            }
        }
        m[C[i]]=i+1;
        count[C[i]]+=dp[i];
        count[C[i]%=MOD;
    }
    cout << dp[N] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: expected ']' before ';' token
   37 |         count[C[i]%=MOD;
      |                        ^
      |                        ]
a.cc:37:24: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    vector<int> C(N);
    rep(i,N){
        cin >> C[i];
        C[i]--;
    }
    map<int,int> m;
    vector<ll> dp(N+1),count(N,0);
    dp[0]=1;
    rep(i,N){
        if (!m.count(C[i])){
            dp[i+1]=dp[i];
        }
        else {
            int j=m[C[i]];
            if (j!=i){
                dp[i+1]=(dp[i]+count[C[i]])%MOD;
            }
            else {
                dp[i+1]=dp[i];
            }
        }
        m[C[i]]=i+1;
        count[C[i]]+=dp[i];
        count[C[i]%=MOD;]
    }
    cout << dp[N] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: expected ']' before ';' token
   37 |         count[C[i]%=MOD;]
      |                        ^
      |                        ]
a.cc:37:24: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:37:25: error: expected primary-expression before ']' token
   37 |         count[C[i]%=MOD;]
      |                         ^
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 c[n];
  REP(i,n){
    cin>>c[i];
  }
  
  long long dp[n]={};
  long long sub_[n]={};
  REP(i,n){
    if(i==0){
      dp[0]=1;
      sub_[0]=1;
    }else{
      dp[i] = dp[i-1] + sub_[c[i]];
      sub_
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:107:11: error: expected ';' before 'return'
  107 |       sub_
      |           ^
      |           ;
  108 |   return 0;
      |   ~~~~~~   
a.cc:109:2: error: expected '}' at end of input
  109 | }
      |  ^
a.cc:101:11: note: to match this '{'
  101 |   REP(i,n){
      |           ^
a.cc:109:2: error: expected '}' at end of input
  109 | }
      |  ^
a.cc:90:11: note: to match this '{'
   90 | int main(){
      |           ^
Language: C++

////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 2e5;
const LL MOD = 1e9 + 7;
vector<int> lst;
LL dp[N + 5];
LL psum[N + 5];

void hora(int tc) {
	int n;
	cin>>n;
	lst.PB(0);
	for(int i = 0;i < n;i++) {
		int x;
		cin>>x;
		if(lst.back() == x) continue;
		lst.PB(x);
	}
	dp[0] = pref[0] = 1;
	psum[lst[1]] = 1;
	n = lst.size();
	n--;
	for(int i = 1;i <= n;i++) {
		dp[i] = (dp[i] + psum[lst[i]]) % MOD;
		psum[lst[i + 1]] = (psum[lst[i + 1]] + dp[i]) % MOD;
	}
	cout<<dp[n]<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Compiler output:
a.cc: In function 'void hora(int)':
a.cc:73:17: error: 'pref' was not declared in this scope
   73 |         dp[0] = pref[0] = 1;
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int n;
int a[200000];
int dp[200001];
int f[200001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    n = unique(a + 1, a + 1 + n) - (a + 1);
    dp[0] = 1; // dp[k] - solution for a[1..k]
    for (int i = 1; i <= n; ++i)
    {
        // dp[k] = dp[k - 1] + \sum_i dp[i - 1] s,t, a[i] == a[k], i < k
        dp[i] = add(dp[i - 1], f[a[i]]));
        adds(f[a[i]], dp[i - 1]);
    }
    cout << dp[n];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:40: error: expected ';' before ')' token
   43 |         dp[i] = add(dp[i - 1], f[a[i]]));
      |                                        ^
      |                                        ;
Language: C++

#include <iostream>
#include <unordered_map>

#define MOD 1000000007
typedef unsigned long long int ull;

int main(void){
	int N;
  	std::cin >> N;
  	ull result = 0;
  	std::unordered_map<int, int> S;
  	std::unordered_map<int, int> count;
  	int tmp;
  	for(int i = 0; i < N; ++i){
    	std::cin >> tmp;
      	if(S[tmp]){
        	if(S[tmp] != i-1){
            	++count[tmp];
            }
        }
        S[tmp] = i;
    }
  	
  	for(auto iter = count.begin(); iter != count.end(); ++iter){
    	result += iter->second * (iter->second + 1) / 2
    }
  
  	std::cout << result % MOD;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:56: error: expected ';' before '}' token
   25 |         result += iter->second * (iter->second + 1) / 2
      |                                                        ^
      |                                                        ;
   26 |     }
      |     ~
Language: C++

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N, C):
    last = [-1] * N
    pairs = []
    for i, c in enumerate(C):
        prev = last[c - 1]
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    print(0)
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python3
      |  ^
a.cc:4:19: error: stray '#' in program
    4 | MOD = 1000000007  # type: int
      |                   ^
a.cc:31:3: error: invalid preprocessing directive #Generated
   31 | # Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
      |   ^~~~~~~~~
a.cc:38:28: error: stray '#' in program
   38 |     N = int(next(tokens))  # type: int
      |                            ^
a.cc:39:50: error: stray '#' in program
   39 |     C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
      |                                                  ^
a.cc:42:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   42 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

const long long MOD = 1000000007;

ll P[200010];
ll ans[200010] = {};
int C[20010] = {};

void solve(long long N, std::vector<int> C){
    ans[0] = 1;
    fill(P, P + 200010, -1);
    loop1 (N, i) {
        ans[i] = ans[i - 1];
        if (P[C[i]] != -1) {
            int p = P[C[i]];
            if (p <= i - 2) {
                ans[i] = (ans[i] + ans[p]) % MOD;
            }
        }
        P[C[i]] = i;
    }
    cout << ans[N] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i + 1]);
    }
    solve(N, std::move(C));
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:23: error: could not convert '(int*)std::move<int (&)[20010]>(C)' from 'int*' to 'std::vector<int>'
   39 |     solve(N, std::move(C));
      |              ~~~~~~~~~^~~
      |                       |
      |                       int*
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define caseout(i, x) cout << "Case #" << i << ": " << x << endl;

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

    int n;
    cin >> n;
    vector<int> c(n+1);
    vector<int> s(200010,-1);
    rep(i, n){
        cin >> c[i+1];
    }
    vector<ll> dp(n+1);
    dp[0] = 1;
    ll mod = 1e9 + 7;

    forx(i,1,n+1)){
        dp[i] = dp[i-1];

        if(s[c[i]]!=-1)
            dp[i] += dp[s[c[i]]];
        
        if(c[i-1]!=c[i])s[c[i]] = i;

        dp[i + 1] %= mod;
    }

    cout << dp[n] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: expected primary-expression before ')' token
   24 |     forx(i,1,n+1)){
      |                  ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main (){
  ll n;
  cin>>n;
  vector<ll>c(n,0);
  for(ll i=0;i<n;i++){
    cin>>c[i];
    c[i]--;
  }
  if(n==1){
    c[i]++;
    cout<<c[i]<<endl;
    return 0;
  }
  vector<ll>dp(n,0);
  vector<ll>v(n,0);
  vector<ll>vv(n,-1);
  dp[n-1]=1;
  v[c[n-1]]=1;
  vv[c[n-1]]=n-1;
  for(ll i=n-2;i>=0;i--){
    if(v[c[i]]==0||vv[c[i]]-i==1){
      dp[i]=dp[i+1];
      v[c[i]]=dp[i];
    }
    else{
      dp[i]=dp[i+1]+v[c[i]];
      v[c[i]]=dp[i];
    }
    vv[c[i]]=i;
    dp[i]%=MOD;
    v[c[i]]%=MOD;
  }
  cout<<dp[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:7: error: 'i' was not declared in this scope
   25 |     c[i]++;
      |       ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main (){
  ll n;
  cin>>n;
  vector<ll>c(n,0);
  for(ll i=0;i<n;i++){
    cin>>c[i];
    c[i]--;
  }
  if(n==1){
    cout<<c[i]+1<<endl;
    return 0;
  }
  vector<ll>dp(n,0);
  vector<ll>v(n,0);
  vector<ll>vv(n,-1);
  dp[n-1]=1;
  v[c[n-1]]=1;
  vv[c[n-1]]=n-1;
  for(ll i=n-2;i>=0;i--){
    if(v[c[i]]==0||vv[c[i]]-i==1){
      dp[i]=dp[i+1];
      v[c[i]]=dp[i];
    }
    else{
      dp[i]=dp[i+1]+v[c[i]];
      v[c[i]]=dp[i];
    }
    vv[c[i]]=i;
    dp[i]%=MOD;
    v[c[i]]%=MOD;
  }
  cout<<dp[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'i' was not declared in this scope
   25 |     cout<<c[i]+1<<endl;
      |             ^
Language: Java


import static java.lang.System.*;
import java.util.*;

public class Main {
	public static final int MOD = 1000000007;
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);

        int n = sc.nextInt();
		int[] stone = new int[n];
		for(int i=0; i<n; i++) stone[i] = sc.nextInt()-1;
		
//		int[] next = new int[n];
//		Arrays.fill(next, -1);
//		int[] last = new int[n];
//		Arrays.fill(last, -1);
//		for(int i=n-1; i>=0; i--) {
//			if(last[stone[i]] > i+1) 
//				next[i] = last[stone[i]];
//			last[stone[i]] = i;
//		}
//		
		long[] dp = new long[n];
		Arrays.fill(dp, 0L);
		dp[0] = 1L;
		
		for(int i=0; i<n-1; i++) {
			dp[i+1] += dp[i];
			dp[i+1] %= MOD;
			
			if(next[i] != -1) {
				dp[next[i]] += dp[i];
				dp[next[i]] %= MOD;
			}
			
			// for(int j=0; j<n; j++) out.print(dp[j] + " ");
			// out.println();
		}

        out.println(dp[n-1]);
    }
}


Compiler output:
Main.java:33: error: cannot find symbol
			if(next[i] != -1) {
			   ^
  symbol:   variable next
  location: class Main
Main.java:34: error: cannot find symbol
				dp[next[i]] += dp[i];
				   ^
  symbol:   variable next
  location: class Main
Main.java:35: error: cannot find symbol
				dp[next[i]] %= MOD;
				   ^
  symbol:   variable next
  location: class Main
3 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define ll long long
#define mod 1000000007

int N;
vector<int> C,nex
vector<ll> v; dp;



void next_define(){
	vector<int> prev(N,-1);
	nex.assign(N,-1);
	for(int i=0;i<N;i++){
		if(prev[C[i]] != -1){
			nex[prev[C[i]]] = i;
		}
		prev[C[i]] = i;
	}
}


int solve(){
	next_define();
	dp.assign(N,0);

	dp[N-1] = 1;

	for(int i=N-2;0<=i;i--){
		if(nex[i] == -1 || nex[i] == i+1){
			dp[i] = dp[i+1];
		}else{
			dp[i] = dp[i+1] + dp[nex[i]];
			dp[i] = dp[i] % mod;
		}
	}

	cout << dp[0] << endl;
	return 0;
}


int main(){
	cin >> N;
	C.resize(N);
	for(int i=0;i<N;i++){
		cin >> C[i];
	}
	solve();
	return 0;
}

Compiler output:
a.cc:11:1: error: expected initializer before 'vector'
   11 | vector<ll> v; dp;
      | ^~~~~~
a.cc:11:15: error: 'dp' does not name a type
   11 | vector<ll> v; dp;
      |               ^~
a.cc: In function 'void next_define()':
a.cc:17:9: error: 'nex' was not declared in this scope
   17 |         nex.assign(N,-1);
      |         ^~~
a.cc: In function 'int solve()':
a.cc:29:9: error: 'dp' was not declared in this scope
   29 |         dp.assign(N,0);
      |         ^~
a.cc:34:20: error: 'nex' was not declared in this scope
   34 |                 if(nex[i] == -1 || nex[i] == i+1){
      |                    ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int N=2e5+5;
const double eps=1e-4;
typedef long long ll;
typedef pair<int,int> pii;
int a[N];
int vis[N];
vector<int>g[N];
int main()
{
    int n;
    scanf("%d",&n);
    a[0]=1;
    for(int i=1;i<=n;i++)
    {
        int b;
        scanf("%d",&b);
        a[i]=a[i-1];
        if(vis[a]&&vis[a]<i-1)
            a[i]=(a[i]+a[vis[b]])%mod;
        vis[b]=i;
    }
    printf("%d\n",a[n]);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: invalid types 'int [200005][int [200005]]' for array subscript
   22 |         if(vis[a]&&vis[a]<i-1)
      |               ^
a.cc:22:23: error: invalid types 'int [200005][int [200005]]' for array subscript
   22 |         if(vis[a]&&vis[a]<i-1)
      |                       ^
Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
const int N = 2*(int)1e5 + 10;

int n, a[N];
int dp[N], dp_on_num[N];

int32_t main(){_

   cin>>n;

   vector<int> v;
   v.pb(0);
   for (int i = 1; i <= n; ++i)
   {
      int x;
      cin>>x;
      if(v.back() == x)continue;
      v.emplace_back(x);
   }

   n = sz(v);
   dp[0] = 1;

   for (int i = 1; i < n; ++i)
   {
      dp[i] = dp[i-1];
      dp[i] += dp_on_num[v[i]];
      dp[i] %= mod;
      dp_on_num[v[i]] = dp[i];
   }
   
   cout<<dp[n-1];
   #warning make sure N size is correct!
   return 0;
}

Compiler output:
a.cc:47:5: warning: #warning make sure N size is correct! [-Wcpp]
   47 |    #warning make sure N size is correct!
      |     ^~~~~~~
a.cc: In function 'int32_t main()':
a.cc:26:6: error: 'class std::vector<int>' has no member named 'pb'
   26 |    v.pb(0);
      |      ^~
Language: C++

#include <vector>
typedef long long ll;

using namespace std;

signed main() {
    int N;
    cin >> N;
    vector<ll> C;
    vector<ll> dp(N,0);
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        C.push_back(a);
    }
    dp[0] = 1;
    vector<ll> summation_cash(100000,0);
    summation_cash[C[0]] = 1;
    for(int i=1;i<N;i++){
        ll now_color = C[i];
        if(C[i] != C[i-1]){
            dp[i] = dp[i-1] + summation_cash[now_color];
            summation_cash[now_color] = dp[i];
        }else{
            dp[i] = dp[i-1];
        }
    }


    cout << dp[N-1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> N;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | typedef long long ll;
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout << dp[N-1] << endl;
      |     ^~~~
a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:24: error: 'endl' was not declared in this scope
   30 |     cout << dp[N-1] << endl;
      |                        ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <vector>
  +++ |+#include <ostream>
    2 | typedef long long ll;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long MOD = 1000000007;

vector<int> places[210000];
long long dp[210000];
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int main() {
    // 入力
    int N; cin >> N;
    vector<int> c(N);
    for (int i = 0; i < N; ++i) cin >> c[i];

    // places[i] := (c[j] = i となるような j の集まり)
    for (int i = 0; i < 210000; ++i) places[i].clear();
    for (int i = 0; i < N; ++i) places[c[i]].push_back(i);

    // DP
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;
    for (int i = 0; i < N; ++i) {
        // 特に操作しない場合
        add(dp[i+1], dp[i]);

        // 操作する場合
        int color = c[i];
        int it = lower_bound(places[color].begin(), places[color].end(), i)
            - places[color].begin(); // c[i] が color 色の何番目の要素か
        if (it > 0) {
            int j = places[color][it - 1]; // c[j] = c[i] となる j
            if (i - j > 1) add(dp[i+1], dp[j+1]);
        }
    }
    cout << dp[N] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if ONLINE_JUDGE
#define tr(...)
#define endl '\n'
#else
#include "../../tr.h"
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 2*(int)1e5 + 10;

int n;
vector<int> v;
set<vector<int> > s;
map<vector<int>, bool> dp[N];

void solve(int idx, vector<int> a){
   if(idx >= n){
      s.insert(a);
      return ;
   }

   if(dp[idx].count(a))
      return ;

   dp[idx][a] = 1;
   solve(idx+1, a);

   for (int i = idx+1; i < n; ++i)
   {
      if(a[i] == a[idx]){
         vector<int> tmp = a;

         for (int j = idx; j <= i; ++j)
            tmp[j] = a[idx];

         solve(i+1, tmp);
      }
   }
}

int32_t main(){_

   cin>>n;
   v.resize(n);

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

   vector<int> tmp;
   for (int i = 0, j = 0; i < n; i=j)
   {
      j = i;
      tmp.pb(v[j]);
      while(j < n and v[i] == v[j])++j;
   }

   v = tmp;
   n = sz(v);
   // tr(v, n);

   solve(0, v);

   // tr(sz(s));

   cout<<sz(s);
   // cout<<s<<endl;

   #warning make sure N size is correct!
   return 0;
}

Compiler output:
a.cc:17:10: fatal error: ../../tr.h: No such file or directory
   17 | #include "../../tr.h"
      |          ^~~~~~~~~~~~
compilation terminated.
Language: C++


#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;


int main()
{
  int MOD=1000000007;
  int N;
  cin>>N;
  vector<int> C(N),dp(N),right(N+1);

  for(int i=0;i<=N;i++){
    right[i]=-1;
  }
  dp[0]=1;
  cin>>C[0];
  right[C[0]]=0;
  for(int i=1;i<N;i++){
    cin>>C[i];
    if(right[C[i]]!=-1 && C[i]!=C[i-1]){
      dp[i]=dp[right[C[i]]-1]+dp[i-1]+1;
    }else{
      dp[i]=dp[i-1];
    }
    right[C[i]]=i;
    dp[i]%=MOD
  }
  cout<<dp[N-1]<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: expected ';' before '}' token
   34 |     dp[i]%=MOD
      |               ^
      |               ;
   35 |   }
      |   ~
Language: Java

final class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int [] a = new int [n];
        for(int i=0; i<a.length; i++){
            a[i] = stdIn.nextInt();
        }
        stdIn.close();

        //処理別れる
        if(n == 1 || n == 2){
            System.out.println(0);
        }else{
            System.out.println(5);
        }
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner stdIn = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner stdIn = new Scanner(System.in);
                            ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

final class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int [] a = new int [n];
        for(int i=0; i<a.length; i++){
            a[i] = stdIn.nextInt();
        }
        stdIn.close();

        //処理別れる
        if(n == 1 || n == 2){
            System.out.println(0);
        }else{
            System.out.println(5);
    }
}


Compiler output:
Main.java:20: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

template <class Abel>
class BIT
{
public:
  using F=function<Abel(Abel,Abel)>;
  F f;
  ll l;
  vector<Abel> bit;
  Abel m0;
  BIT(ll maxidx,F fu,Abel m0):f(fu),l(maxidx),m0(m0)
  {
    bit.assign(l,m0);
  }
  void update(ll idx,ll val)
  {
    while(idx<=l)
    {
      bit[idx]=f(bit[idx],val);
      idx+=idx & -idx;
    }
  }
  ll query(ll idx)
  {
    ll res=m0;
    while(idx>0)
    {
      res=f(bit[idx],res);
      idx-=idx& -idx;
    }
    return res;
  }
};
ll mod=1e9+7;
ll main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll> s(n);
  rep(i,n)cin>>s[i];
  s.erase(unique(all(s)),s.end());
  //rep(i,s.size())cout<<s[i];
  ll l=(ll)s.size();
  map<ll,vector<ll>> cidx;
  map<ll,ll> ns;
  vector<ll>tv;
  rep(i,l)
  {
    if(cidx.count(s[i])==0)
    {
      cidx[s[i]]=tv;
    }
    cidx[s[i]].push_back(i);
  }
  BIT<ll>bt(400100,[&](ll a,ll b){return (a+b)%((ll)1e9+7);},0);

  rep(i,l)
  {
    //cout<<i<<" "<<s[i]<<" ";
    ll tsum=bt.query(i);

    //cout<<tsum<<endl;
    ll nidx=upper_bound(all(cidx[s[i]]),i)-cidx[s[i]].begin();
    if(nidx>=cidx[s[i]].size())continue;
    bt.update(cidx[s[i]][nidx]+1,(tsum+1)+ns[s[i]]);
    ns[s[i]]=tsum+1;
    //cout<<tsum<<endl;

  }
  ll res=(bt.query(l)+1)%mod;
  if(res<0)res+=mod;
  cout<<res<<endl;



  return 0;

}


Compiler output:
a.cc:59:1: error: '::main' must return 'int'
   59 | ll main()
      | ^~
Language: C++

#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef longlong ll;
const int N=2e5+5;
const int P=1e9+7;
int dp[N],Sum[N];
int a[N];
int n;

int main()
{
	scanf("%d",&n);
	FOR(i,1,n)scanf("%d",&a[i]);
	int m=n;
	n=1;
	FOR(i,2,m)if(a[i]!=a[n])a[++n]=a[i];
	dp[0]=1;
	FOR(i,1,n)
	{
		dp[i]=(dp[i-1]+Sum[a[i]])%P;
		(Sum[a[i]]+=dp[i-1])%=P;
	}
	printf("%d\n",dp[n]);
	return 0;
}

Compiler output:
a.cc:11:9: error: 'longlong' does not name a type
   11 | typedef longlong ll;
      |         ^~~~~~~~
Language: C++


#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int N;
  cin>>N;
  vector<int> C(N), dp(N),right(N+1);
  dp[0]=1;
  for(int i=0;i<N+1;i++){
    right[i]=-1;
  }
  for(int i=0;i<N;i++){
    cin>>C[i];
    if(i==0){
      right[C[i]]=i;
      continue;
    }
    if(C[i]!=C[i-1]){
      if(right[C[i]]==-1){
        right[C[i]]=i;
        dp[i]=dp[i-1];
      }else{
        dp[i]=dp[right[C[i]]]+dp[i-1];
        right[C[i]]=i; 
      }
    }else{
      dp[i]=dp[i-1];
    }
    dp[i]%=1000000007;
  }
  // for(int i=0;i<N;i++){
  //   cout<<i<<':'<<dp[i]<<endl;
  // }
  if(n!=1){
    cout<<dp[N-1]<<endl;
  }else{
    cout<<1<<endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:6: error: 'n' was not declared in this scope
   43 |   if(n!=1){
      |      ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

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

  if(n<=2){
    cout<<1<<endl;
    return 0;
  }

  llong c[n];
  REP(i,n){
    cin>>c[i];
  }
  vector<LP> interval;
  map<llong,llong> ma;//直前の番号
  llong zeroColor = c[0];
  REP(i,n){
    if(ma[c[i]]==0&&c[i]==zeroColor&&i>1){
      LP lp;
      lp.first = 0;
      lp.second = i;
      interval.pb(lp);
    }else if(ma[c[i]] != 0&&(i-ma[c[i]])>1){
      LP lp;
      lp.first = ma[c[i]];
      lp.second = i;
      interval.pb(lp);
    }
    ma[c[i]] = i;
  }
  VSORT(interval);

  REP(i,interval.size()){
    cout<<interval[i].first<<"      "<<interval[i].second<<endl;
  }

  llong m = interval.size();//間の個数
  llong counter = m-1;

  if(m==0){
    cout<<1<<endl;
    return 0;
  }

  llong dp[n];
  dp[n-1] = 1;
  for(int i=n-2;i>=0;i--){
    if(i == interval[counter].first){
      dp[i] = dp[i+1] + dp[interval[counter].second];
      dp[i] = dp[i]%(pow(10,9)+7)
      if(counter!=0)counter--;
    }else{
      dp[i] = dp[i+1];
    }
  }
  cout<<dp[0]<<endl;

 

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:20: error: invalid operands of types 'long long int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   69 |       dp[i] = dp[i]%(pow(10,9)+7)
      |               ~~~~~^~~~~~~~~~~~~~
      |                   |           |
      |                   |           __gnu_cxx::__promote<double>::__type {aka double}
      |                   long long int
Language: C++

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

using namespace std;

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

	vector <int> color;
	vector <int> imamade(n, 0);
	map<int, int> m;

	int last = 0;
	for(int i = 0; i < n; i++)
	{
		int c;
		cin >> c;
		if (i > 0)
		{
			imamade[i] = imamade[i - 1];
		}
		if (c == last)
		{
			continue;
		}
		
		if (m[c] != 0)
		{
			int basho = m[c] - 1;
			int inc = long long int(pow(2, imamade[basho])) % long long int(pow(10, 9) + 7);
			imamade[i] += inc;
		}

		m[c] = i + 1;
		color.push_back(c);
		last = c;
	}
	

	cout << imamade[n-1] + 1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:35: error: expected primary-expression before 'long'
   38 |                         int inc = long long int(pow(2, imamade[basho])) % long long int(pow(10, 9) + 7);
      |                                   ^~~~
Language: C++

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

using namespace std;

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

	vector <int> color;
	vector <int> imamade(n, 0);
	map<int, int> m;

	int last = 0;
	for(int i = 0; i < n; i++)
	{
		int c;
		cin >> c;
		if (i > 0)
		{
			imamade[i] = imamade[i - 1];
		}
		if (c == last)
		{
			continue;
		}
		
		if (m[c] != 0)
		{
			int basho = m[c] - 1;
			imamade[i] += (long long int(pow(2, imamade[basho])) % long long int(pow(10, 9) + 7)) ;
		}

		m[c] = i + 1;
		color.push_back(c);
		last = c;
	}
	

	cout << imamade[n-1] + 1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:40: error: expected primary-expression before 'long'
   38 |                         imamade[i] += (long long int(pow(2, imamade[basho])) % long long int(pow(10, 9) + 7)) ;
      |                                        ^~~~
a.cc:38:40: error: expected ')' before 'long'
   38 |                         imamade[i] += (long long int(pow(2, imamade[basho])) % long long int(pow(10, 9) + 7)) ;
      |                                       ~^~~~
      |                                        )
Language: C++


#include <bits/stdc++.h>

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll>   pairl;
typedef vector<ll>     vl;
typedef vector<ll>     vll;
typedef vector<vector<ll> > vvl;
const   int            infi = numeric_limits<int>::max();
const   ll             infl = numeric_limits<ll>::max();
const   double         eps = 0;
const   int            ms  = 0;

const int MOD = 1000000007;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int N;
    cin >> N;
    vl C(N);
    vl L(2*100000, -1);
    vl p(N, 1);
    rep(i, N)cin >> C[i];   
    ll ans = 1;

    L[C[0]] = 0;    
    for(int i = 1 ; i < N; i++){
        //debug(i)
        int c = C[i];
        int l = L[c];

        if(L[c] != -1 && L[c] != i-1){
            p[i] = p[l];
            ans += p[l];
            p[i] = (p[i]+p[i-1])%MOD;
        }
        else(L[c] == -1){
            p[i] = p[i-1];
        }
        L[c] = i;
        //p[i] = p[L[c]] + p[i-1];
        //debug(ans)
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:25: error: expected ';' before '{' token
   63 |         else(L[c] == -1){
      |                         ^
      |                         ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using vl=vector<ll>;
using vb=vector<bool>;
using vs=vector<string>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll MOD = 1e9 + 7;
const ll MAX_N = 100000 * 2;
int main(){
	ll N; cin >> N;
	vl cs(N);
	FOR(i, 0, N) {
		cin >> cs[i];
		cs[i] --;
	}

	vector<pll> segs;

	vl lasts(MAX_n+10, -1);

	FOR(i, 0, N) {
		if (lasts[cs[i]] != -1 && lasts[cs[i]] != i - 1) {
			segs.pb( {lasts[cs[i]], i});
		}
		lasts[cs[i]] = i;
	}

	if (!sz(segs)) {
		cout << 1 << endl;
		return 0;
	}

	sort(all(segs));

	vl mem(sz(segs));
	mem[sz(mem)-1] = 2;

	FORD(i, 0, sz(mem)-1) {
		pll search = pll(segs[i].yy, -1);
		auto non_overlap = lower_bound(segs.begin() + i, segs.end(), search);
		assert(non_overlap == segs.end() || (non_overlap - segs.begin()) < sz(mem));
		// Nehmen
		if (non_overlap != segs.end() && (non_overlap - segs.begin()) < sz(mem) && (non_overlap - segs.begin() >= 0)) {
			mem[i] += mem[non_overlap - segs.begin()];
		} else {
			mem[i] += 1;
		}
		mem[i] = mem[i] % MOD;
		// Nicht nehmen
		mem[i] += mem[i+1];
		mem[i] = mem[i] % MOD;
	}

	//FOR(i, 0, sz(mem)) { cerr << i << ": " << mem[i] << endl; }

	cout << mem[0] << endl;
	return 0;

} //cin.tie(0) bei schnellem Wechseln



Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: 'MAX_n' was not declared in this scope; did you mean 'MAX_N'?
   35 |         vl lasts(MAX_n+10, -1);
      |                  ^~~~~
      |                  MAX_N
Language: C++

#include<iostream>
using namespace std;
const long INF = 1000000007
int main () {
  int N;
  cin >> N;
  int co[200001];
  for (int i = 0; i < N; i ++) cin >> co[i];
  co[N] = -1;
  long co_[200001];
  long renzoku[200001];
  for (int i = 0; i < 200001; i ++) co_[i] = renzoku[i] = 0;
  for (int i = 0; i < N; i ++) {
    co_[co[i]] ++;
  }
  for (int i = 0; i < N;) {
    int j = 0;
    while(co[i] == co[i + 1]) {
      i ++;
      j ++;
    }
    renzoku[j] ++;
    i ++;
  }
  long ans = 0;
  for (int i = 0; i < 200001; i ++) {
    ans += co_[i] * (co_[i] - 1) / 2;
    ans = ans % INF;
  }
  for (int i = 1; i < 200001; i ++) {
    ans -= i * (i + 1) * renzoku[i];
    while(ans < 0) ans += INF;
    ans = ans % INF;
  }
  cout << ans << endl;
}

Compiler output:
a.cc:4:1: error: expected ',' or ';' before 'int'
    4 | int main () {
      | ^~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N;
  cin>>N;
  int C[N+1],S[N+1];
  long int dp[N+1];
  dp[0]=0;
  dp[1]=1;
  for(int i=1; i<=N; ++i){
    cin>>C[i];
    S[i]=0;
  }
  s[C[1]]=1;
  for(int i=2; i<N; ++i){
    if(C[1]==C[2]) dp[i+1]=dp[i];
    else if(S[C[i+1]]!=0) dp[i+1]=dp[i];
    else dp[i+1]=(dp[i]+dp[S[C[i+1]]])%1000000007;
    S[C[i+1]]=i+1;
  }
  cout<<dp[N]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 's' was not declared in this scope
   15 |   s[C[1]]=1;
      |   ^