Language: C++


#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
int main()
{
	sync;
	ll n;
	cin>>n;
	ll a[n];
	input(a,n);
	map<ll,ll>mp;
	ll ans=0,val=0;
	vector<ll>arr;
	for(ll i=0;i<n-1;i++)
	if(a[i]!=a[i+1])
	arr.push_back(a[i]);
	arr.push_back(a[n-1]);
	for(ll i=0;i<n;i++)
	{
		val=ans;
		if(mp[arr[i]])
		ans+=mp[arr[i]];
		mp[arr[i]]+=1+val;

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'sync' was not declared in this scope
    8 |         sync;
      |         ^~~~
a.cc:9:9: error: 'll' was not declared in this scope
    9 |         ll n;
      |         ^~
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin>>n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <ext/pb_ds/tree_policy.hpp>
  +++ |+#include <iostream>
    3 | using namespace __gnu_pbds;
a.cc:10:14: error: 'n' was not declared in this scope
   10 |         cin>>n;
      |              ^
a.cc:11:11: error: expected ';' before 'a'
   11 |         ll a[n];
      |           ^~
      |           ;
a.cc:12:15: error: 'a' was not declared in this scope
   12 |         input(a,n);
      |               ^
a.cc:12:9: error: 'input' was not declared in this scope; did you mean 'int'?
   12 |         input(a,n);
      |         ^~~~~
      |         int
a.cc:13:9: error: 'map' was not declared in this scope
   13 |         map<ll,ll>mp;
      |         ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include <ext/pb_ds/tree_policy.hpp>
  +++ |+#include <map>
    3 | using namespace __gnu_pbds;
a.cc:13:19: error: 'mp' was not declared in this scope
   13 |         map<ll,ll>mp;
      |                   ^~
a.cc:14:11: error: expected ';' before 'ans'
   14 |         ll ans=0,val=0;
      |           ^~~~
      |           ;
a.cc:15:9: error: 'vector' was not declared in this scope
   15 |         vector<ll>arr;
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <ext/pb_ds/tree_policy.hpp>
  +++ |+#include <vector>
    3 | using namespace __gnu_pbds;
a.cc:15:19: error: 'arr' was not declared in this scope
   15 |         vector<ll>arr;
      |                   ^~~
a.cc:16:15: error: expected ';' before 'i'
   16 |         for(ll i=0;i<n-1;i++)
      |               ^~
      |               ;
a.cc:16:20: error: 'i' was not declared in this scope
   16 |         for(ll i=0;i<n-1;i++)
      |                    ^
a.cc:20:15: error: expected ';' before 'i'
   20 |         for(ll i=0;i<n;i++)
      |               ^~
      |               ;
a.cc:20:20: error: 'i' was not declared in this scope
   20 |         for(ll i=0;i<n;i++)
      |                    ^
a.cc:22:17: error: 'val' was not declared in this scope
   22 |                 val=ans;
      |                 ^~~
a.cc:22:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |                 val=ans;
      |                     ^~~
      |                     abs
a.cc:25:35: error: expected '}' at end of input
   25 |                 mp[arr[i]]+=1+val;
      |                                   ^
a.cc:21:9: note: to match this '{'
   21 |         {
      |         ^
a.cc:25:35: error: expected '}' at end of input
   25 |                 mp[arr[i]]+=1+val;
      |                                   ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^