Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#define INF 10000000
using namespace std;
typedef pair<int,int> P;

void swap(char *a,char *b){
  char temp = *a;
  *a = *b;
  *b = temp;
}

int main(){
  string input = "";
  char temp;
  for(int i=0;i<8;i++){
    cin >> temp;
    input.push_back(temp);
  }

  vector<string> que;
  queue<int> dist;

  que.push_back(input);
  dist.push(0);
  while(que.size()){
    string q = que[0];
    que.erase(que.begin());
    if(q=="01234567"){
      break;
    }
    int d = dist.front(); dist.pop();
    for(int i=0;i<3;i++){
      string next = q;
      swap(&next[i],&next[i+1]);
      if(find(que.begin(),que.end(),next)==que.end()){
        que.push_back(next);
        dist.push(d+1);
      }

      next = q;
      swap(&next[i+4],&next[i+5]);
      if(find(que.begin(),que.end(),next)==que.end()){
        que.push_back(next);
        dist.push(d+1);
      }
    }
    for(int i=0;i<4;i++){
      string next = q;
      swap(&next[i],&next[i+4]);
      vector<string>::iterator pos;
      if(find(que.begin(),que.end(),next)==que.end()){
        que.push_back(next);
        dist.push(d+1);
      }
    }
  }
  cout << dist.front() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:14: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   38 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:38:14: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   38 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:45:14: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   45 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:45:14: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   45 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:54:14: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   54 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:54:14: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   54 |       if(find(que.begin(),que.end(),next)==que.end()){
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~