Language: C++

/*#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v[100009];;
vector<int> v1;
int a[100009];
int b[100009];
int tree[100009];
int num=0;
int DFS(int i,int p)
{
    v1.push_back(i);
    int ans=0;
    b[i]=num;
    num++;
    for(int j=0;j<v[i].size();j++)
    {
        int k=v[i][j];
        if(k==p)continue;
        ans+=1+DFS(k,i);
    }
    a[i]=ans;
    return ans;
}
int query(int node,int l,int r,int s,int e)
{

}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    a[1]=DFS(1,-1);
    int q;
    for(int i=1;i<=n;i++)
    {
        build(1,0,n-1,k);
    }
    while(q--)
    {
        int x,y;
        int u;
        cin>>u;
        if(u==1)
        {
            cin>>x;
         cout<<query(1,0,n-1,b[x],b[x]+a[x]);
        }
        else
        {

        }
    }
}
*/
#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000009];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    long long ans1=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==a[i+1]&&a[i]==a[i+2]&&a[i]==a[i+3])
            ans1=max(ans1,a[i]*a[i]);
        else
        {
            if(a[i]==a[i+1]&&a[i]==a[i+2]&&a[i+3]==a[i+4])
                ans1=max(ans1,a[i]*a[i+3]);
            else
            {
                if(a[i]==a[i+1]&&a[i+2]==a[i+3])
                    ans1=max(ans1,a[i]*a[i+2]);
            }
        }
    }
    cout<<ans1;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:21: error: no matching function for call to 'max(long long int&, int)'
   76 |             ans1=max(ans1,a[i]*a[i]);
      |                  ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:62:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:76:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   76 |             ans1=max(ans1,a[i]*a[i]);
      |                  ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:76:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   76 |             ans1=max(ans1,a[i]*a[i]);
      |                  ~~~^~~~~~~~~~~~~~~~
a.cc:80:25: error: no matching function for call to 'max(long long int&, int)'
   80 |                 ans1=max(ans1,a[i]*a[i+3]);
      |                      ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:80:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   80 |                 ans1=max(ans1,a[i]*a[i+3]);
      |                      ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:80:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   80 |                 ans1=max(ans1,a[i]*a[i+3]);
      |                      ~~~^~~~~~~~~~~~~~~~~~
a.cc:84:29: error: no matching function for call to 'max(long long int&, int)'
   84 |                     ans1=max(ans1,a[i]*a[i+2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:84:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   84 |                     ans1=max(ans1,a[i]*a[i+2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:84:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   84 |                     ans1=max(ans1,a[i]*a[i+2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~