Language: C++

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

long long int N, a[514][514], l[514], c[514], i, j, f, g, ans;
//vector<long long int> low[514], col[514];
vector<pair<long long int, long long int> > vp;
char C;

int main(){
    scanf("%lld", &N);
    for(i = 0; i < N; ++i){
        for(j = 0; j < N; ++j){
            scanf(" %c", &C);
            a[i][j] = (C == '.') ? 0 : 1;
            if(C != '.'){
                ++f;
                //low[i].push_back(j);
                //col[j].push_back(i);
                ++l[i];
                ++c[j];
            }
        }
    }
    if(f == 0)return 0 & puts("-1");
    f = count(l, l + N, N);
    g = count(c, c + N, N);
    //cout << f << " " << g << endl;
    if(f > 0)return 0 & printf("%lld\n", N - g);
    ans = N * 2 + 1;
    /*
    cout << " ";
    for(i = 0; i < N; ++i){
        cout << " " << c[i];
    }
    cout << endl;
    for(i = 0; i < N; ++i){
        cout << l[i] << " ";
        for(j = 0; j < N; ++j){
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    */
    for(i = 0; i <= N; ++i){
        //if(c[i] == 0)continue;
        ans = min(ans, N * 2 - l[i] - g + (c[i] == 0) ? 0 : 1);
    }
    cout << ans << endl;
    //f = max_element()
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:18: error: no matching function for call to 'min(long long int&, int)'
   46 |         ans = min(ans, N * 2 - l[i] - g + (c[i] == 0) ? 0 : 1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:46:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   46 |         ans = min(ans, N * 2 - l[i] - g + (c[i] == 0) ? 0 : 1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:46:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   46 |         ans = min(ans, N * 2 - l[i] - g + (c[i] == 0) ? 0 : 1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~