Language: C++

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
short dp[16][16][10][1<<16];
template<typename T>
void chmax(T &a,T b){
  if(a<b) a=b;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int n;
  cin>>n;
  using P = pair<Int, Int>;
  vector<P> v;
  for(Int i=0;i<n;i++){
    Int x,y;
    cin>>x>>y;
    v.emplace_back(x,y);
  }
  vector<vector<P> > r(n,vector<P>(n)); 
  for(Int i=0;i<n;i++){
    for(Int j=i+1;j<n;j++){
      if(v[i].first==v[j].first){
	r[i][j]=P(0,1);
	continue;
      }
      if(v[i].second==v[j].second){
	r[i][j]=P(1,0);
	continue;
      }
      Int dx=v[i].first-v[j].first;
       Int dy=v[i].second-v[j].second;
       if(dx<0){
	 dx*=-1;
	 dy*=-1;
       }
       Int k=__gcd(dx,abs(dy));
       dx/=k;dy/=k;
       r[i][j]=P(dx,dy);
       //cout<<i<<" "<<j<<":"<<dx<<" "<<dy<<endl;
     }
   }
  memset(dp,-1,sizeof(dp));
  //dp[0][0][0][0]=0;
  for(Int i=0;i<n;i++){
    for(Int j=i+1;j<n;j++){
      dp[i][j][1][(1<<i)|(1<<j)]=0;
    }
  }
  Int ans=0;
  for(Int b=0;b<(1<<n);b++){
    for(Int i=0;i<n;i++){
      for(Int j=i+1;j<n;j++){
	for(Int k=0;k<=n/2;k++){
	  if(dp[i][j][k][b]<0) continue;
	  //cout<<i<<" "<<j<<" "<<k<<" "<<b<<":"<<dp[i][j][k][b]<<endl;
	  for(Int s=0;s<n;s++){
	    for(Int t=s+1;t<n;t++){
	      if((b>>s)&1) continue;
	      if((b>>t)&1) continue;
	      Int nb=b|(1<<s)|(1<<t);
	      if(r[i][j]==r[s][t]){
		chmax(dp[s][t][k+1][nb],dp[i][j][k][b]+k);
		chmax(ans,dp[s][t][k+1][nb]);
	      }else{
		chmax(dp[s][t][1][nb],dp[i][j][k][b]);
		chmax(ans,dp[s][t][1][nb]);
	      }
	    }
	  }
	}
      }
    }
  }  
  cout<<ans<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:22: error: no matching function for call to 'chmax(short int&, Int)'
   64 |                 chmax(dp[s][t][k+1][nb],dp[i][j][k][b]+k);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: candidate: 'template<class T> void chmax(T&, T)'
    6 | void chmax(T &a,T b){
      |      ^~~~~
a.cc:6:6: note:   template argument deduction/substitution failed:
a.cc:64:22: note:   deduced conflicting types for parameter 'T' ('short int' and 'long long int')
   64 |                 chmax(dp[s][t][k+1][nb],dp[i][j][k][b]+k);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:65:22: error: no matching function for call to 'chmax(Int&, short int&)'
   65 |                 chmax(ans,dp[s][t][k+1][nb]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: candidate: 'template<class T> void chmax(T&, T)'
    6 | void chmax(T &a,T b){
      |      ^~~~~
a.cc:6:6: note:   template argument deduction/substitution failed:
a.cc:65:22: note:   deduced conflicting types for parameter 'T' ('long long int' and 'short int')
   65 |                 chmax(ans,dp[s][t][k+1][nb]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:68:22: error: no matching function for call to 'chmax(Int&, short int&)'
   68 |                 chmax(ans,dp[s][t][1][nb]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: candidate: 'template<class T> void chmax(T&, T)'
    6 | void chmax(T &a,T b){
      |      ^~~~~
a.cc:6:6: note:   template argument deduction/substitution failed:
a.cc:68:22: note:   deduced conflicting types for parameter 'T' ('long long int' and 'short int')
   68 |                 chmax(ans,dp[s][t][1][nb]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~