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

// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "pch.h"

#include <iostream>
#include <string>
#include <map>

int check(const std::string& s, int i, int j)
{
	std::map<char, int> map;
	for (int k = i; k <= j; k++)
	{
		if (map[k]++ > 1)
			return 0;
	}
	return 1;
}

int main(void)
{
	int n;
	std::string s;
//	std::cin >> n >> s;
	n = 4;
	s = "abcd";

	int i, j;
	int cnt = 0;
	for (i = 0; i <= n; i++)
	{
		for (j = 0; j <= n; j++)
		{
			if (i<=j)
				cnt += check(s, i, j);
		}
	}
	std::cout << cnt%1000000007 << std::endl;
}


Compiler output:
a.cc:4:10: fatal error: pch.h: No such file or directory
    4 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: Java

import java.util.*;
public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		long ans=1;
		int []map=new int[26];
		for (int i=0;i<n;i++) {
			map[s.charAt(i)-'a']++;
		}
		for(int i=0;i<26;i++) {
			ans=ans*(map[i]+1)%1000000007;
		}
		ans--;
		int res=(int)ans;
		sc.close();
        System.out.println(res);	
	}
}


Compiler output:
Main.java:2: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
      	sc.close();
		long ans=1;
		
      	
		System.out.println(res);
	}
}

Compiler output:
Main.java:11: error: cannot find symbol
		System.out.println(res);
		                   ^
  symbol:   variable res
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
  ll i,j,k;
  static ll N,K,A,B,C,ans;
  string S,T;
  map<string> m;
  cin>>N;
  cin>>S;
  sort(S.begin(),S.end());
  for(i=0;i<N;i++)
   m[S[i]]++;
  for(i=0;i<N;i++)
   if(m[i]>1) K++;
  if(K>1) cout<<(N*N)-(int)pow((double)2,(double)K+1);
  else
    cout<<N*N-1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: wrong number of template arguments (1, should be at least 2)
    9 |   map<string> m;
      |             ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:14:5: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}]' for array subscript
   14 |    m[S[i]]++;
      |     ^
a.cc:16:8: error: invalid types 'int[long long int]' for array subscript
   16 |    if(m[i]>1) K++;
      |        ^
Language: C++

#include<iostream>
#include<string>
using namespase std;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int ans = 0;
  int alpha[26];
  int offset = int('a')
  for(int i=0;i<26;i++)alpha[i]=0;
  
  for(int i=0;i<N;i++)alpha[int(S[i])-offset]++;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespase'
    3 | using namespase std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:3: error: 'string' was not declared in this scope
    8 |   string S;
      |   ^~~~~~
a.cc:8:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:9:10: error: 'S' was not declared in this scope
    9 |   cin >> S;
      |          ^
a.cc:14:3: error: expected ',' or ';' before 'for'
   14 |   for(int i=0;i<26;i++)alpha[i]=0;
      |   ^~~
a.cc:14:15: error: 'i' was not declared in this scope
   14 |   for(int i=0;i<26;i++)alpha[i]=0;
      |               ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }return 0; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
const ll INF =1LL << 62;

int main(){
  ll N ;
  cin >> N;
  string s ;
  cin >> s;
  char str[26] = {'a','b','c','d','e','f','g','h'
    ,'i','j','k','l','m','n','o'
    ,'p','q','r','s','t','u','v','w'
    ,'x','y','z','\0'};
  rep(i,26)
    ll res[i]=0;
  rep(i,N){
    rep(j,26){
      if(string[i] == char[j])
        res[j] ++;
    }
  }
  ll ans =1;
  rep(i,26)
    ans *= res[i];
  ans --;
  cout << ans%1000000007 <<endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: too many initializers for 'char [26]'
   22 |     ,'x','y','z','\0'};
      |                      ^
a.cc:24:15: error: array must be initialized with a brace-enclosed initializer
   24 |     ll res[i]=0;
      |               ^
a.cc:27:16: error: expected unqualified-id before '[' token
   27 |       if(string[i] == char[j])
      |                ^
a.cc:28:9: error: 'res' was not declared in this scope; did you mean 'rep'?
   28 |         res[j] ++;
      |         ^~~
      |         rep
a.cc:33:12: error: 'res' was not declared in this scope; did you mean 'rep'?
   33 |     ans *= res[i];
      |            ^~~
      |            rep
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;

int main()
{
    long long n,i,ans = 1;
    string s;
    cin >> n >> s;
    vector<long long> al(26,0);
    for(i = 0;i < n;++i){
        ++al.at((int)s.at(i)-97);
    }
    for(i = 0;i < 26;++i){
        ans *= al.at(i)+1;
    }
    long long t = 1000000000+7
    ans = (ans-1)%t;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'ans'
   24 |     ans = (ans-1)%t;
      |     ^~~
Language: C++

#include <iostream>
#include <string>
#include <map>

using namespace std;

typedef long long ll;

int main(){
  int N;
  string S;
  ll ans = 1;
  ll mod = 1e9 + 7;
  map<char, int> num;
  string al = "abcdefghijklmnopqrstuvwxyz";
  for (int i=0; i<al.size(); i++){
    num[al[i]] = 0;
  }
  cin >> N;
  cin >> S;
  for (int i=0; i<N; i++) num[S[i]]++;
  for (int i=0; i<N; i++){
    ans *= (num[al[i]] + 1);
    ans = ans % mod
  }
  
  cout << (ans != 0 ? ans - 1 : mod - 1) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: expected ';' before '}' token
   24 |     ans = ans % mod
      |                    ^
      |                    ;
   25 |   }
      |   ~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
      	sc.close();
		long ans=1;
		int []map=new int[26];
		for (int i=0;i<N;i++) {
			map[s.charAt(i)-'a']++;
		}
		for(int i=0;i<26;i++) {
			ans=ans*(map[i]+1)%1000000007;
		}
		ans--;
      	int res=(int)ans;
      	
		System.out.println(res);
	}
}

Compiler output:
Main.java:10: error: cannot find symbol
		for (int i=0;i<N;i++) {
		               ^
  symbol:   variable N
  location: class Main
1 error
Language: C++

/*input
5
abcab
*/

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

int add(int a, int b) {
  int r = a + b;
  if (r >= MOD) r -= MOD;
  return r;
}

int mul(int a, int b) {
  return int((long long)a * b % MOD);
}

int sub(int a, int b) {
  int r = MOD + a - b;
  if (r >= MOD) r -= MOD;
  return r;
}

int cnt[32];

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);

  int n;
  scanf("%d\n", &n);

  char s[100005];
  gets(s);

  for (int i = 0; i < n; ++i)
  {
    cnt[s[i]-'a']++;
  }

  int ans = 1;
  for (int i = 0; i < 26; ++i)
  {
    ans = mul(ans, cnt[i] + 1);
  }

  printf("%d\n", sub(ans, 1));

  return 0;
} 

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:38:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
   38 |   gets(s);
      |   ^~~~
      |   getw
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		long ans=1;
		int []map=new int[26];
		for (int i=0;i<N;i++) {
			map[s.charAt(i)-'a']++;
		}
		for(int i=0;i<26;i++) {
			ans=ans*(map[i]+1)%1000000007;
		}
		ans--;
      	
		System.out.println((int)ans);
	}
}

Compiler output:
Main.java:9: error: cannot find symbol
		for (int i=0;i<N;i++) {
		               ^
  symbol:   variable N
  location: class Main
1 error
Language: C++

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

int main(){
    int n, i = 0;
    long long r = 1;
    int c[26] = {};
    string s;
    cin >> n >> s;
    for(i=0; i<n; i++){
        c[(int)s[i]-'a']++;
    }
    for(i=0; i<26; i++){
        r *= (long long)c[i] + 1;
        r %= 1000000007
    }
    cout << r - 1;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before '}' token
   15 |         r %= 1000000007
      |                        ^
      |                        ;
   16 |     }
      |     ~
Language: Java

import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] cs = sc.next().toCharArray();
        long[] ls = new long[26];
        long t = 1;
        for(int i = 0 ;i < 26;++i){
            ls[i] = 1;
        }
        for(int i = 0;i < n;++i){
            ++ls[cs[i] - 'a'];
        }
        for(int i = 0 ;i < 26;++i){
            t *= ls[i];x
        }
        t %= 1000000007;
        System.out.println(t - 1);
    }

}




Compiler output:
Main.java:17: error: not a statement
            t *= ls[i];x
                       ^
Main.java:17: error: ';' expected
            t *= ls[i];x
                        ^
2 errors
Language: C++

//#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define FORs(i,st) for(auto i : st)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    vector<ll> mp(26,1);
    cin>>n>>s;
    FOR(i,0,n){
      mp[s[i] - 'a']++;
    }

    ll res=1;
    FOR(i,0,26){
      res *= mp[i] % (1e9+7);
    }
    cout<<res-1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'double' to binary 'operator%'
   39 |       res *= mp[i] % (1e9+7);
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
const ll INF=99999999999999999;
ll a,b,c,d,e,f,ans=0;
int main(){
    ll n;
    string s;
    cin>>n>>s;
    vl k(26,0);
    rep(i,n){
        k[s[i]-'a']++;
    }
  ans=1;
    for(int i=0;i<26;i++){
        ans=(ans*(k[i]+1)%1000000007;
    }
 
    cout<<ans-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:37: error: expected ')' before ';' token
   19 |         ans=(ans*(k[i]+1)%1000000007;
      |             ~                       ^
      |                                     )
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<int>
#define vvel vector<vel>
#define vvvel vector<vvel>
#define veb vector<bool>
long long rui(long long a, long long n, long long p) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2, p);
	x = (x*x) % p;
	if (n % 2 == 1) {x = (x*a) % p;}
	return x;
}
signed main() {
	int n; cin >> n;
	string s;
	cin >> s;
	string hen = "abcdefghijklmnopqrstuvwxyz";
	vel count(26,0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 26; j++) {
			if (s[i] == hen[j]) { count[j]++; }
		}
	}
	int p = 1000;
	p* = p * p; p += 7;
	int ans = 1;
	for (int i = 0; i < 26; i++) {
		ans *= (count[i] + 1);
		ans = ans % p;
	}
	ans = (ans + p - 1) % p;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: expected primary-expression before '=' token
   33 |         p* = p * p; p += 7;
      |            ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s;
		int s = sc.nextLine();
		long ans=1;
		int []map=new int[26];
		for (int i=0;i<N;i++) {
			map[s.charAt(i)-'a']++;
		}
		for(int i=0;i<26;i++) {
			ans=ans*(map[i]+1)%1000000007;
		}
		ans--;
      	
		System.out.println((int)ans);
	}
}

Compiler output:
Main.java:7: error: variable s is already defined in method main(String[])
		int s = sc.nextLine();
		    ^
Main.java:7: error: incompatible types: String cannot be converted to int
		int s = sc.nextLine();
		                   ^
Main.java:10: error: cannot find symbol
		for (int i=0;i<N;i++) {
		               ^
  symbol:   variable N
  location: class Main
Main.java:11: error: int cannot be dereferenced
			map[s.charAt(i)-'a']++;
			     ^
4 errors
Language: C++

typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
const ll INF=99999999999999999;
ll a,b,c,d,e,f,g,ans=0;
int main(){
    ll n;
    string s;
    cin>>n>>s;
    vl k(26,0);
    rep(i,n){
        k[s[i]-'a']++;
    }
  ans=1;
    for(int i=0;i<26;i++){
        ans=(ans*(k[i]+1)%1000000007;
    }
 
    cout<<ans-1<<endl;
}

Compiler output:
a.cc:1:9: error: 'vector' does not name a type
    1 | typedef vector<ll> vl;
      |         ^~~~~~
a.cc:2:9: error: 'vector' does not name a type
    2 | typedef vector<pair<ll,ll>> vp;
      |         ^~~~~~
a.cc:3:7: error: 'll' does not name a type
    3 | const ll INF=99999999999999999;
      |       ^~
a.cc:4:1: error: 'll' does not name a type
    4 | ll a,b,c,d,e,f,g,ans=0;
      | ^~
a.cc: In function 'int main()':
a.cc:6:5: error: 'll' was not declared in this scope
    6 |     ll n;
      |     ^~
a.cc:7:5: error: 'string' was not declared in this scope
    7 |     string s;
      |     ^~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n>>s;
      |     ^~~
a.cc:8:10: error: 'n' was not declared in this scope
    8 |     cin>>n>>s;
      |          ^
a.cc:8:13: error: 's' was not declared in this scope
    8 |     cin>>n>>s;
      |             ^
a.cc:9:5: error: 'vl' was not declared in this scope
    9 |     vl k(26,0);
      |     ^~
a.cc:10:9: error: 'i' was not declared in this scope
   10 |     rep(i,n){
      |         ^
a.cc:10:5: error: 'rep' was not declared in this scope
   10 |     rep(i,n){
      |     ^~~
a.cc:13:3: error: 'ans' was not declared in this scope
   13 |   ans=1;
      |   ^~~
a.cc:15:19: error: 'k' was not declared in this scope
   15 |         ans=(ans*(k[i]+1)%1000000007;
      |                   ^
a.cc:15:37: error: expected ')' before ';' token
   15 |         ans=(ans*(k[i]+1)%1000000007;
      |             ~                       ^
      |                                     )
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout<<ans-1<<endl;
      |     ^~~~
a.cc:18:18: error: 'endl' was not declared in this scope
   18 |     cout<<ans-1<<endl;
      |                  ^~~~
Language: C++

//#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define FORs(i,st) for(auto i : st)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    vector<ll> mp(26,1);
    cin>>n>>s;
    FOR(i,0,n){
      mp[s[i] - 'a']++;
    }

    ll res=1;
    FOR(i,0,26){
      res *= mp[i]
    }
    cout<<res-1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:19: error: expected ';' before '}' token
   39 |       res *= mp[i]
      |                   ^
      |                   ;
   40 |     }
      |     ~
Language: C++

あｌｋｓｄｊｆ

Compiler output:
a.cc:1:1: error: '\U00003042\U0000ff4c\U0000ff4b\U0000ff53\U0000ff44\U0000ff4a\U0000ff46' does not name a type
    1 | あｌｋｓｄｊｆ
      | ^~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
int main() {
    long c[33], ans = 1,n,i;
    char s[111111];
    scanf("%ld%*c%s",&n, s);
    for (i = 0; i < 26; i++)
        c[i] = 0;
    for (i = 0; i < n; i++) 
        c[s[i]-'a']++;
    for (i = 0; i < 26; i++){
        ans = ans * (c[i] + 1);
        if (ans > 1000000007)
            ans -= 1000000007;
    ans--;
    if (ans == -1)
        ans += 1000000007;
    printf("%ld\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:2:12: note: to match this '{'
    2 | int main() {
      |            ^
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int t[26];
typedef long long ll;
ll ans=1;
int main(){
	cin>>n>>s;
	for (int i=0;i<s.size();i++)
		t[s[i]-'a']++;
	for (int i=0;i<26;i++)
		ans=ans*(t[i]+1)%(1e9+7);
	ans--;
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:33: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%'
   41 |                 ans=ans*(t[i]+1)%(1e9+7);
      |                     ~~~~~~~~~~~~^~~~~~~~
      |                        |             |
      |                        |             double
      |                        ll {aka long long int}
Language: C++

#include<iostream>
#include<vector>
#include<cstring>

using namespace std;
const int mod = 1e9+7;

int main(){
	int t,n,maxnum;
	cin >> t; cin >> n;
	vector<int> s;
	s.push_back(n);
	maxnum = n;
	while(--t){
        cin >> n;
		if(n == s.back())continue;
		s.push_back(n);
		if(n > maxnum)maxnum = n;
	}
    int dp(s.size()+1);
	int save[maxnum+1];
	memset(save, 0, sizeof(save));
    dp[0] = 1;
    for(int i = 0; i < s.size(); ++i){
		dp[i+1] = (dp[i] + save[s[i]])%mod;
		save[s[i]] = (save[s[i]]+ dp[i])%mod; 
    }
    cout << dp[s.size()];
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:7: error: invalid types 'int[int]' for array subscript
   23 |     dp[0] = 1;
      |       ^
a.cc:25:19: error: invalid types 'int[int]' for array subscript
   25 |                 dp[i+1] = (dp[i] + save[s[i]])%mod;
      |                   ^
a.cc:25:30: error: invalid types 'int[int]' for array subscript
   25 |                 dp[i+1] = (dp[i] + save[s[i]])%mod;
      |                              ^
a.cc:26:45: error: invalid types 'int[int]' for array subscript
   26 |                 save[s[i]] = (save[s[i]]+ dp[i])%mod;
      |                                             ^
a.cc:28:15: error: invalid types 'int[std::vector<int>::size_type {aka long unsigned int}]' for array subscript
   28 |     cout << dp[s.size()];
      |               ^
Language: C++

#include<iostream>
#include<vector>
#include<cstring>

using namespace std;
const int mod = 1e9+7;

int main(){
	int t,n,maxnum;
	cin >> t; cin >> n;
	vector<int> s;
	s.push_back(n);
	maxnum = n;
	while(--t){
        cin >> n;
		if(n == s.back())continue;
		s.push_back(n);
		if(n > maxnum)maxnum = n;
	}
    int dp(s.size()+1);
	int save[maxnum+1];
	memset(save, 0. sizeof(save));
    dp[0] = 1;
    for(int i = 0; i < s.size(); ++i){
		dp[i+1] = (dp[i] + save[s[i]])%mod;
		save[s[i]] = (save[s[i]]+ dp[i])%mod; 
    }
    cout << dp[s.size()];
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: expected ')' before 'sizeof'
   22 |         memset(save, 0. sizeof(save));
      |               ~        ^~~~~~~
      |                        )
a.cc:22:15: error: too few arguments to function 'void* memset(void*, int, size_t)'
   22 |         memset(save, 0. sizeof(save));
      |         ~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:3:
/usr/include/string.h:61:14: note: declared here
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |              ^~~~~~
a.cc:23:7: error: invalid types 'int[int]' for array subscript
   23 |     dp[0] = 1;
      |       ^
a.cc:25:19: error: invalid types 'int[int]' for array subscript
   25 |                 dp[i+1] = (dp[i] + save[s[i]])%mod;
      |                   ^
a.cc:25:30: error: invalid types 'int[int]' for array subscript
   25 |                 dp[i+1] = (dp[i] + save[s[i]])%mod;
      |                              ^
a.cc:26:45: error: invalid types 'int[int]' for array subscript
   26 |                 save[s[i]] = (save[s[i]]+ dp[i])%mod;
      |                                             ^
a.cc:28:15: error: invalid types 'int[std::vector<int>::size_type {aka long unsigned int}]' for array subscript
   28 |     cout << dp[s.size()];
      |               ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
struct stone{
    int color;
    int to_add;
};
int main(){
    int N;
    cin>>N;
    vector<stone> stones;
    int out=1;
    int temp,last;
    int colors[N];
    for(int i=0;i<N;i++){
        cin>>colors[i];
    }
    for(int i=0;i<N;i++){
        temp=colors[i];
        if(i&&temp==last)
            continue;
        else
            last=temp;
        bool in=false;
        for(auto& each:stones){
            if(temp==each.color){
                out+=each.to_add;
                out=out%(1e9+7);
                each.to_add=out;
                in = true;
                break;
            }
        }
        if(!in){
            stone temp_stone;
            temp_stone.color=temp;
            temp_stone.to_add=out;
            stones.push_back(temp_stone);
        }//新颜色
    }
    cout<<out<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   28 |                 out=out%(1e9+7);
      |                     ~~~^~~~~~~~
      |                     |       |
      |                     int     double
Language: C++

#include<iostream>
#include<vector>
using namespace std;
struct stone{
    long long color;
    long long to_add;
};
int main(){
    long long N;
    cin>>N;
    vector<stone> stones;
    long long out=1;
    long long temp,last;
    long long colors[N];
    for(int i=0;i<N;i++){
        cin>>colors[i];
    }
    for(int i=0;i<N;i++){
        temp=colors[i];
        if(i&&temp==last)
            continue;
        else
            last=temp;
        bool in=false;
        for(auto& each:stones){
            if(temp==each.color){
                out+=each.to_add;
                out%=1e9+7;
                each.to_add=out;
                in = true;
                break;
            }
        }
        if(!in){
            stone temp_stone;
            temp_stone.color=temp;
            temp_stone.to_add=out;
            stones.push_back(temp_stone);
        }//新颜色
    }
    cout<<out<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   28 |                 out%=1e9+7;
      |                 ~~~^~~~~~~
a.cc:28:20: note:   in evaluation of 'operator%=(long long int, double)'
Language: C++

#include<iostream>
#include<cstdio>
#include<unordered_map>

using namespace std;
typedef long long ll;
const int mod = 1e9+7;

int main(){
	ios::sync_with_stdio(false);
	int t,n;
	cin >> t; cin >> n;
	vector<int> s;
	s.push_back(n);
	while(t--){
        cin >> n;
		if(n == s.back())continue;
		s.push_back(n);
	}
	unordered_map<int,int> p;
    int pos[s.size()];
	for(int i = 0; i < s.size(); ++i){
        if(p.count(s[i])){
            pos[i] = p[s[i]];
        }else{
            pos[i] = i;
        }
        p[s[i]] = i;
    }
    int dp[s.size()+1];
    dp[0] = 1;
    for(int i = 0; i < s.size(); ++i){
        dp[i+1] = dp[i];
        int j = i;
        while(pos[j] != j){
            dp[i+1] = (dp[i+1] + dp[pos[j]]) %mod;
            j = pos[j];
        }
    }
    cout << dp[s.size()];
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'vector' was not declared in this scope
   13 |         vector<int> s;
      |         ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<unordered_map>
  +++ |+#include <vector>
    4 | 
a.cc:13:16: error: expected primary-expression before 'int'
   13 |         vector<int> s;
      |                ^~~
a.cc:14:9: error: 's' was not declared in this scope
   14 |         s.push_back(n);
      |         ^
a.cc:24:13: error: 'pos' was not declared in this scope
   24 |             pos[i] = p[s[i]];
      |             ^~~
a.cc:26:13: error: 'pos' was not declared in this scope
   26 |             pos[i] = i;
      |             ^~~
a.cc:31:5: error: 'dp' was not declared in this scope; did you mean 'p'?
   31 |     dp[0] = 1;
      |     ^~
      |     p
a.cc:35:15: error: 'pos' was not declared in this scope
   35 |         while(pos[j] != j){
      |               ^~~
Language: C++

#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n;
	cin >> n;
	
	vi c(n);
	for(int i = 0; i < n; i++) cin >> c[i];
	
	vi prev(n);
	map<int, int> u;
	for(int i = 0; i < n; i++) {
		if(!u[c[i]]) prev[i] = -1
		else prev[i] = u[c[i]];
		u[c[i]] = i;
	}
	
	vi dp(n, 0);
	dp[0] = 1;
	for(int i = 1; i < n; i++) {
		(dp[i] = dp[i - 1] + (prev[i] == -1 || prev[i] == i - 1 ? 0 : dp[prev[i]])) %= P;
	}
	
	cout << dp[n - 1] << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:32:42: error: expected ';' before 'else'
   32 |                 if(!u[c[i]]) prev[i] = -1
      |                                          ^
      |                                          ;
   33 |                 else prev[i] = u[c[i]];
      |                 ~~~~
Language: C++

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

int main(){
	int  n,pre=-1;
	cin >> n ; 
	vector<int>  dp(n+1,0),c(n+1,0);
	dp[0] = 1;
	for (int i=1,a ;i<=n; i++){ 
		cin >> x ; 
		if (pre != x) dp[i] = dp[c[x]] ;
		dp[i] += dp[i-1] ; 
		c[x] = i ; 
	    pre = x ; 
	}
	cout << dp[n] << endl ; 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'x' was not declared in this scope
   10 |                 cin >> x ;
      |                        ^
Language: C++

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

int main(){
	int  n,pre=-1;
	cin >> n ; 
	vi  dp(n+1,0),c(n+1,0);
	dp[0] = 1;
	for (int i=1,a ;i<=n; i++){ 
		cin >> x ; 
		if (pre != x) dp[i] = dp[c[x]] ;
		dp[i] += dp[i-1] ; 
		c[x] = i ; 
	    pre = x ; 
	}
	cout << dp[n] << endl ; 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'vi' was not declared in this scope
    7 |         vi  dp(n+1,0),c(n+1,0);
      |         ^~
a.cc:8:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
    8 |         dp[0] = 1;
      |         ^~
      |         dup
a.cc:10:24: error: 'x' was not declared in this scope
   10 |                 cin >> x ;
      |                        ^
a.cc:11:42: error: 'c' was not declared in this scope
   11 |                 if (pre != x) dp[i] = dp[c[x]] ;
      |                                          ^
a.cc:13:17: error: 'c' was not declared in this scope
   13 |                 c[x] = i ;
      |                 ^
Language: C++

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

const int MOD = 1000000007;

int main(){
    int N; cin >> N;
    vector<int> C(N);
    rep(i, N) cin >> C[i];
    vector<int> dp(N+1);
    map<int, int> d;
    dp[0] = 1;
    rep(i, N) {
        dp[i+1] = dp[i];
        if (i > 1 && C[i-1] == C[i]){
            continue;
        }
        if(d[C[i]] > 0){
            dp[i+1] += dp[d[C[i]]];
        }
        d[C[i]] = i+1;
        dp[i+1] %= MOD
    }
    cout << dp[N] << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: expected ';' before '}' token
   25 |         dp[i+1] %= MOD
      |                       ^
      |                       ;
   26 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    //　入力とランレングス圧縮
    int read = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[read];
        if(read == 0 || a[i - 1] != a[i])
            ++read;
    }
    n = read;
    // 座圧
    auto comp = a;
    sort(comp.begin(), comp.end());
    comp.erase(unique(comp.begin(), comp.end()), comp.end());
    vector<int> bef_pos(comp.back(), -1);
    vector<int> bef_arr(n, -1);
    // bef_arr[i]: iと同じ色のものの直前の出現位置(ないなら-1)
    for(int i = 0; i < n; ++i){
        a[i] = distance(comp.begin(), lower_bound(comp.begin(), comp.end(), a[i]));
        bef_arr[i] = bef_pos[a[i]];
        bef_pos[a[i]] = i;
    }
    vector<int> dp(n, 0);
    dp[0] = 1;
    for(int i = 1; i < n; ++i){
        // cnt: 最後の操作での右端がiであるような通り数
        i64 cnt = (bef_arr[i] == -1 ? 0 : dp[bef_arr[i]]);
        // 累積和をとって, dp[i]: 最後の操作での右端がiもしくはiより右側になるような通り数 とする
        dp[i] = (dp[i - 1] + cnt) % MOD;
    }
    cout << dp.back() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'i64' was not declared in this scope
   36 |         i64 cnt = (bef_arr[i] == -1 ? 0 : dp[bef_arr[i]]);
      |         ^~~
a.cc:38:30: error: 'cnt' was not declared in this scope; did you mean 'int'?
   38 |         dp[i] = (dp[i - 1] + cnt) % MOD;
      |                              ^~~
      |                              int
Language: C++

#include <bits/stdc++.h>

using namespace std;

const i64 MOD = 1e9 + 7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    //　入力とランレングス圧縮
    int read = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[read];
        if(read == 0 || a[i - 1] != a[i])
            ++read;
    }
    n = read;
    // 座圧
    auto comp = a;
    sort(comp.begin(), comp.end());
    comp.erase(unique(comp.begin(), comp.end()), comp.end());
    vector<int> bef_pos(comp.back(), -1);
    vector<int> bef_arr(n, -1);
    // bef_arr[i]: iと同じ色のものの直前の出現位置(ないなら-1)
    for(int i = 0; i < n; ++i){
        a[i] = distance(comp.begin(), lower_bound(comp.begin(), comp.end(), a[i]));
        bef_arr[i] = bef_pos[a[i]];
        bef_pos[a[i]] = i;
    }
    vector<int> dp(n, 0);
    dp[0] = 1;
    for(int i = 1; i < n; ++i){
        // cnt: 最後の操作での右端がiであるような通り数
        i64 cnt = (bef_arr[i] == -1 ? 0 : dp[bef_arr[i]]);
        // 累積和をとって, dp[i]: 最後の操作での右端がiもしくはiより右側になるような通り数 とする
        dp[i] = (dp[i - 1] + cnt) % MOD;
    }
    cout << dp.back() << endl;
}


Compiler output:
a.cc:5:7: error: 'i64' does not name a type
    5 | const i64 MOD = 1e9 + 7;
      |       ^~~
a.cc: In function 'int main()':
a.cc:36:9: error: 'i64' was not declared in this scope
   36 |         i64 cnt = (bef_arr[i] == -1 ? 0 : dp[bef_arr[i]]);
      |         ^~~
a.cc:38:30: error: 'cnt' was not declared in this scope; did you mean 'int'?
   38 |         dp[i] = (dp[i - 1] + cnt) % MOD;
      |                              ^~~
      |                              int
a.cc:38:37: error: 'MOD' was not declared in this scope
   38 |         dp[i] = (dp[i - 1] + cnt) % MOD;
      |                                     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll N = 200005;

namespace Modop {
    ll modAdd(ll a, ll b) {
        return (a + b) % MOD;
    }
    
    ll modSub(ll a, ll b) {
        return (((a - b) % MOD) + MOD) % MOD;
    }
    
    ll modMul(ll a, ll b) {
        return ((a % MOD) * (b % MOD)) % MOD;
    }

    ll modExp(ll base, ll power) {
        if (power == 0) {
            return 1;
        } else {
            ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
            if (power % 2 == 1) cur = cur * base;
            cur = cur % MOD;
            return cur;
        }
    }
    
    ll modInv(ll a) {
        return modExp(a, MOD - 2);
    }
    
    ll modDiv(ll a, ll b) {
        return modMul(a, modInv(b));
    }
}

using namespace Modop;

int n;
ll ans = 1;

bitset<N> last;
ll prob[N], pos[N];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; i++) {
        int ci; cin >> ci;
        if (!i || ci != a[a.size() - 1])
            a.push_back(ci);
    }
    n = a.size();
    pos[n] = 1;

    last.set();
    for (int i = n - 1; i >= 0; --i) {
        if (last[a[i]]) {
            prob[a[i]] += pos[i + 1];
            pos[i] = pos[i + 1];
            last[a[i]] = 0;
        } else {
            if (prob[a[i]] == 1) {
                pos[i] = 2;
            } else {
                pos[i] = pos[i + 1];
            }
            ans = modAdd(ans, prob[a[i]]);
            prob[a[i]] = moddAdd(prob[a[i]], prob[i + 1]);
        }
    }

    // for (int i = 0; i < n; i++) {
        // cout << i << ' ' << pos[i] << ' ' << prob[a[i]] << '\n';
    // }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:26: error: 'moddAdd' was not declared in this scope
   73 |             prob[a[i]] = moddAdd(prob[a[i]], prob[i + 1]);
      |                          ^~~~~~~
Language: C++

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

const ll MOD = 1e9+7;

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

	vector<int> a(n),b(200001,0),c;
	for(int i = 0;i<n;i++)cin >> a[i];
	c.push_back(a[0]);
	for(int i = 0;i<n-1;i++)
	{
		if(a[i]!=a[i+1])c.push_back(a[i+1]);
	}
	n = c.size();
	a = c;
	b[a[0]] = 1;
	for(int i = 1;i<n;++i)
	{
		if(i&&a[i]==a[i-1])continue;
			if(b[a[i]]==0)
			{
				(b[a[i]] = b[a[i-1]])%=MOD;
			}
			else
			{
				(b[a[i]]*=2)%=MOD;
			}
		
	}
	reverse(a.begin(),a.end());
	ll ans = b[a[0]];
	for(int i = 1;i<n;i++)
	{
		if(a[0]==a[i])break;
		(ans += b[a[i]])%=MOD
	}
	cout<<(ans-1+MOD)%MOD<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:38: error: expected ';' before '}' token
   40 |                 (ans += b[a[i]])%=MOD
      |                                      ^
      |                                      ;
   41 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int N;cin>>N;
    int C[N];
    vector<int> Cp[2e5+1];
  	REP(i,2e5+1)Cp[i].clear();
    REP(i,N){
        cin>>C[i];
        Cp[C[i]].pb(i);
    }
    int dp[N+1];
  	REPS(i,N)dp[i]=0;
    dp[0]=1;
    REPS(i,N){
        dp[i]+=dp[i-1];
        int c=C[i-1];
        int itr=lower_bound(all(Cp[c]),i-1)-Cp[c].begin();
        if(itr>0){
            int d=Cp[c][itr-1];
            if(i-d>2)dp[i]+=dp[d+1];
        }
        dp[i]%=MOD;
    }
    cout<<dp[N]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   35 |     vector<int> Cp[2e5+1];
      |                    ~~~^~
a.cc:35:23: error: could not convert '(2.0e+5 + (double)1)' from 'double' to 'long unsigned int'
   35 |     vector<int> Cp[2e5+1];
      |                    ~~~^~
      |                       |
      |                       double
a.cc:35:23: error: size of array 'Cp' has non-integral type 'double'
Language: C

#include<stdio.h>
#define MODN 1000000007

static inline long modadd(long a,long b){
    return (a+b) % MODN;
}

int main(void){
    register int i;
    int n;
    scanf("%d",&n);
    int c[n];
    for(i = 0;i < n;i++)scanf("%d",&c[i]);
    long dp[n];
    long dpcu = 1;
    dp[0] = 1;
    static long hst[200200];
    hst[c[0]] = 1;
    for(i = 0;i< n-1;i++){
        if(c[i] == c[i+1]){
            dp[i+1] = dp[i];
            continue;
        }
        dp[i+1] = moadadd(dp[i],hst[c[i+1]]);
        hst[c[i+1]] = dp[i+1];
    }
    printf("%ld",dp[n-1]);
}

Compiler output:
main.c: In function 'main':
main.c:24:19: error: implicit declaration of function 'moadadd'; did you mean 'modadd'? [-Wimplicit-function-declaration]
   24 |         dp[i+1] = moadadd(dp[i],hst[c[i+1]]);
      |                   ^~~~~~~
      |                   modadd
Language: C++

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll mod = 1000000007LL;
	ll N;
	cin >> N;

	vector<ll> Cs(N);
	for (ll i = 0; i < N; ++i) {
		cin >> Cs[i];
	}
	map<ll, vector<ll>> pos;
	for (ll i = 0; i < N; ++i) {
		if (pos.count(Cs[i]) == 0) {
			pos[Cs[i]] = vector<ll>();
		}
		pos[Cs[i]].emplace_back(i);
	}

	rll res;
	vector<ll> dps(N + 1);
	dps[0] = 1;
	for (ll i = 0; i < N; ++i) {
		auto idx = distance(pos[Cs[i]].begin(), lower_bound(pos[Cs[i]].begin(), pos[Cs[i]].end(), i));
		if (idx == 0 || pos[Cs[i]][idx - 1] == i - 1) {
			dps[i + 1] = dps[i];
		}
		else {
			dps[i + 1] = (dps[i] + dps[pos[Cs[i]][idx - 1] + 1]) % mod;
		}
	}

	cout << dps[N] << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:9: error: 'rll' was not declared in this scope; did you mean 'ull'?
   71 |         rll res;
      |         ^~~
      |         ull
Language: C++

// ConsoleApplication12.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
using namespace std;
#define int long long
int c[200005];
int dp[2];
int save[200005];

int main()
{
    int n;
    cin >> n;
    int now = -1;
    for (int i = 0; i != n; i++)
    {
        cin >> c[i];
        if (c[i] == now)
        {
            i--;
            n--;
        }
        else
        {
            now = c[i];
        }
    }
    dp[0] = 1;
    save[c[0]] = 1;
    for (int i = 1; i != n; i++)
    {
        dp[i&1] = dp[!(i&1)];
        dp[i&1] += save[c[i]];
        dp[i&1] %= 1000000009;
        save[c[i]] += dp[!(i&1)];
        save[c[i]] %= 1000000009;
    }
    cout << dp[!(n&1)];
}



Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

// ConsoleApplication12.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
using namespace std;
#define int long long
int c[200005];
int dp[200005];
int save[200005];

int main()
{
    int n;
    cin >> n;
    int now = -1;
    for (int i = 0; i != n; i++)
    {
        cin >> c[i];
        if (c[i] == now)
        {
            i--;
            n--;
        }
        else
        {
            now = c[i];
        }
    }
    dp[0] = 1;
    save[c[0]] = 1;
    for (int i = 1; i != n; i++)
    {
        dp[i] = dp[i - 1];
        dp[i] += save[c[i]];
        dp[i] %= 1000000009;
        save[c[i]] += dp[i - 1];
        save[c[i]] %= 1000000009;
    }
    cout << dp[n - 1];
}



Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MOD 1e9+7
int main(){
  long Nc;cin>>Nc;
  vector<long>C;
  for(long i=0;i<Nc;i++){
    long c;cin>>c;c--;
    if(i==0||c!=C[C.size()-1])C.push_back(c);
  }long N=C.size();
  vector<long>DP(N,1),L(Nc,0);
  for(long i=0;i<N;i++){
    if(i!=0)DP[i]=(DP[i-1]+L[C[i]])%MOD;
    L[C[i]]=(L[C[i]]+(i>0?DP[i-1]:1))%MOD;
  }
  cout<<DP[N-1]%MOD;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:36: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} and 'double' to binary 'operator%'
   13 |     if(i!=0)DP[i]=(DP[i-1]+L[C[i]])%MOD;
      |                   ~~~~~~~~~~~~~~~~~^
      |                           |
      |                           __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type {aka long int}
a.cc:14:38: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} and 'double' to binary 'operator%'
   14 |     L[C[i]]=(L[C[i]]+(i>0?DP[i-1]:1))%MOD;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                     |
      |                     __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type {aka long int}
a.cc:16:16: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} and 'double' to binary 'operator%'
   16 |   cout<<DP[N-1]%MOD;
Language: C++

#include<bits/stdc++.h>
#define mp #include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      vector<int>arr;
      int prev=-INF;
      for(int i=0;i<n;i++){
            int x;
            cin>>x;
            if(prev!=x)arr.pb(x);
            prev=x;
      }
      n=arr.size();
      if(n==0){
            cout<<"WA\n";
            return 0;
      }
      vector<int>next(300000,INF);
      vector<int>data(300000,INF);

      for(int i=n-1;i>=0;i--){
            next[i]=data[arr[i]];
            data[arr[i]]=i;
      }
      vector<int>dp(300000,0);
      int pre=1;
      for(int i=0;i<n;i++){
            if(i>0){
                  dp[i]+=dp[i-1];
                  dp[i]%=modulo;
            }
            else dp[i]=1;
            if(next[i]<dp.size()){
                  dp[next[i]]+=dp[i];
                  dp[next[i]]%=modulo;
            }
      }
      cout<<dp[n-1];
}
make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      vector<int>arr;
      int prev=-1;
      for(int i=0;i<n;i++){
            int x;
            cin>>x;
            if(prev!=x)arr.pb(x);
            prev=x;
      }
      vector<int>next(n+1,INF);
      vector<int>data(n+1,INF);

      for(int i=(int)arr.size()-1;i>=0;i--){
            next[i]=data[arr[i]];
            data[arr[i]]=i;
      }
      vector<int>dp(n+1,0);
      int pre=1;
      for(int i=0;i<arr.size();i++){
            if(i>0){
                  dp[i]+=dp[i-1];
                  dp[i]%=modulo;
            }
            else dp[i]=1;
            if(next[i]!=INF){
                  dp[next[i]]+=dp[i];
                  dp[next[i]]%=modulo;
            }
      }
      cout<<dp[(int)arr.size()-1];
}


Compiler output:
a.cc:3:9: warning: "mp" redefined
    3 | #define mp make_pair
      |         ^~
a.cc:2:9: note: this is the location of the previous definition
    2 | #define mp #include<bits/stdc++.h>
      |         ^~
a.cc:55:1: error: 'make_pair' does not name a type
   55 | make_pair
      | ^~~~~~~~~
a.cc:65:9: error: redefinition of 'int32_t main()'
   65 | int32_t main(){
      |         ^~~~
a.cc:13:9: note: 'int32_t main()' previously defined here
   13 | int32_t main(){
      |         ^~~~