Language: C++

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

bool binary_search(const long long *first, const long long *last, long long val)
{
    if( first >= last )     // 範囲が空
        return false;     // 発見できなかった場合
    const int *ptr = first + (last - first) / 2;       // 中央位置へのポインタ、last = first + 1 の場合は、ptr = first となる
    if( *ptr == val )
        return true;        // 発見
    if( val < *ptr )     // 検索している要素は ptr よりも前にある場合
        return binary_search(first, ptr, val);
    else     // 検索している要素は ptr よりも後ろにある場合
        return binary_search(ptr + 1, last, val);
}

int main(){
    int n;
    cin >> n;
    long long nagasa,trans;
    //int array[n];
    vector<long long> v;
    int ans = 0;
    string s;

    for (int i = 0; i < n; i++){
        cin >> s;
        nagasa = s.length();
        trans = 0;
        for (int j = nagasa; j > 0; j--){
            trans += ((s[nagasa-j]-'a')+1) * pow(27,j-1);
        }
            //auto itr = find(v.begin(),v.end(),trans);
        if(binary_search(v.begin(),v.end(),trans)){
            v.push_back(trans);
            ans += 1;
            sort(v.begin(),v.end());
        }

    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'bool binary_search(const long long int*, const long long int*, long long int)':
a.cc:8:28: error: cannot convert 'const long long int*' to 'const int*' in initialization
    8 |     const int *ptr = first + (last - first) / 2;       // 中央位置へのポインタ、last = first + 1 の場合は、ptr = first となる
      |                      ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            const long long int*
a.cc:12:29: error: no matching function for call to 'binary_search(const long long int*&, const int*&, long long int&)'
   12 |         return binary_search(first, ptr, val);
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   template argument deduction/substitution failed:
a.cc:12:29: note:   deduced conflicting types for parameter '_FIter' ('const long long int*' and 'const int*')
   12 |         return binary_search(first, ptr, val);
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 3 provided
a.cc:4:6: note: candidate: 'bool binary_search(const long long int*, const long long int*, long long int)'
    4 | bool binary_search(const long long *first, const long long *last, long long val)
      |      ^~~~~~~~~~~~~
a.cc:4:61: note:   no known conversion for argument 2 from 'const int*' to 'const long long int*'
    4 | bool binary_search(const long long *first, const long long *last, long long val)
      |                                            ~~~~~~~~~~~~~~~~~^~~~
a.cc:14:29: error: no matching function for call to 'binary_search(const int*, const long long int*&, long long int&)'
   14 |         return binary_search(ptr + 1, last, val);
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   template argument deduction/substitution failed:
a.cc:14:29: note:   deduced conflicting types for parameter '_FIter' ('const int*' and 'const long long int*')
   14 |         return binary_search(ptr + 1, last, val);
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 3 provided
a.cc:4:6: note: candidate: 'bool binary_search(const long long int*, const long long int*, long long int)'
    4 | bool binary_search(const long long *first, const long long *last, long long val)
      |      ^~~~~~~~~~~~~
a.cc:4:37: note:   no known conversion for argument 1 from 'const int*' to 'const long long int*'
    4 | bool binary_search(const long long *first, const long long *last, long long val)
      |                    ~~~~~~~~~~~~~~~~~^~~~~