Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<map>
using namespace std;

typedef long long LL;

class Combination
{
public:
	Combination(LL sz, LL m) :
		size(sz+1),
		mod(m),
		param(size, 1)
	{
		for(LL i=2; i<size; i++)
		{
			param[i] = param[i-1] * i;
			param[i] %= mod;
		}
	}

	LL nCr(LL n, LL c)
	{
		LL ret = param[n];
		ret *= inverse(c);
		ret %= mod;
		ret *= inverse(n-c);
		ret %= mod;

		return ret;
	}

private:
	LL inverse(LL n)
	{
		LL ret = 1;
		LL a = param[n];
		for(LL i=mod-2; i>0; i/=2)
		{
			if(i&1)
			{
				ret *= a;
				ret %= mod;
			}
			a *= a;
			a %= mod;
		}
		return ret % mod;
	}

	const LL size;
	const LL mod;
	vector<LL> param;
};

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

	vector<int> a(n+1);
	map<int, int> table;
	for(int i=0; i<n+1; i++)
	{
		cin >> a[i];
		table[a[i]]++;
	}

	int left, right;
	for(auto it=table.begin(); it!=table.end(); it++)
	{
		if(it->second == 2)
		{
			left = find(a.begin(), a.end(), it->first) - a.begin();
			right = find(a.begin()+left+1, a.end(), it->first) - a.begin();

			break;
		}
	}

	Combination comb(n+1, 1E9+7);
	for(int i=1; i<=n+1; i++)
	{
		long long ret = comb.nCr(n+1, i);
		if(left+n-right >= i-1)
			ret -= comb.nCr(left+n-right, i-1);

		cout << ret << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:36: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, const int&)'
   77 |                         left = find(a.begin(), a.end(), it->first) - a.begin();
      |                                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:77:36: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   77 |                         left = find(a.begin(), a.end(), it->first) - a.begin();
      |                                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:78:37: error: no matching function for call to 'find(__gnu_cxx::__normal_iterator<int*, std::vector<int> >, std::vector<int>::iterator, const int&)'
   78 |                         right = find(a.begin()+left+1, a.end(), it->first) - a.begin();
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:78:37: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   78 |                         right = find(a.begin()+left+1, a.end(), it->first) - a.begin();
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~