#include <iostream>
#include <vector>
#include <algorithm>

bool CheckCommon( std::vector< long > &inVectorA, std::vector< long > &inVectorB )
{
    std::vector< long > *lower, *higher;

    size_t sizeL = 0, sizeH = 0;

    if( inVectorA.size() > inVectorB.size() )
    {
        lower = &inVectorA;
        sizeL = inVectorA.size();
        higher = &inVectorB;
        sizeH = inVectorB.size();
    }
    else
    {
        lower = &inVectorB;
        sizeL = inVectorB.size();
        higher = &inVectorA;
        sizeH = inVectorA.size();
    }

    size_t indexL = 0, indexH = 0;

    for( ; indexH < sizeH; indexH++ )
    {
        bool exists = std::binary_search( lower->begin(), lower->end(), higher->at(indexH) );

        if( exists == true )
            return true;
        else
            continue;
    }
    return false;
}

void test1()
{
   std::vector<long> A{10, 20, 30, 40, 50};
   std::vector<long> B{40, 50};

   std::cout << std::boolalpha << CheckCommon(A, B) << " " << CheckCommon(B, A) << std::endl;
}

void test2()
{
   std::vector <long> vectorA ;
     std::vector <long> vectorB ;
     vectorA.push_back(11111);
     vectorA.push_back(11112);
     vectorA.push_back(11113);
     vectorA.push_back(11114);
     vectorA.push_back(11467);
     vectorA.push_back(111345);
     vectorB.push_back(11116);
     vectorB.push_back(11118);
     vectorB.push_back(11112);
    vectorB.push_back(11120);
    vectorB.push_back(11190);
    vectorB.push_back(11640);
    vectorB.push_back(11740);
   std::cout << std::boolalpha << CheckCommon(vectorA, vectorB) << " " << CheckCommon(vectorA, vectorB) << std::endl;
}

int main()
{
  // test1();
   test2();
   return 0;
}
