Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;

void search(int a,int b,int &x,int &y){
    int c=a%b;
    if(c==0){x=0; y=1;}
    else{
        search(b,c,&y,&x);
        y-=a/b;
    }
}

int main(){
    int a,b,x,y;
    cin>>a>>b;
    search(a,b,x,y);
    cout<<x<<' '<<y;
    
    return 0;
}




Compiler output:
a.cc: In function 'void search(int, int, int&, int&)':
a.cc:17:15: warning: ignoring return value of '_FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2) [with _FIter1 = int; _FIter2 = int*]', declared with attribute 'nodiscard' [-Wunused-result]
   17 |         search(b,c,&y,&x);
      |         ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: declared here
 4090 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = int; _Predicate = __gnu_cxx::__ops::_Iter_equals_iter<int*>]':
/usr/include/c++/14/bits/stl_algobase.h:2203:23:   required from '_ForwardIterator1 std::__search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate) [with _ForwardIterator1 = int; _ForwardIterator2 = int*; _BinaryPredicate = __gnu_cxx::__ops::_Iter_equal_to_iter]'
 2203 |         return std::__find_if(__first1, __last1,
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 2204 |                 __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4102:27:   required from '_FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2) [with _FIter1 = int; _FIter2 = int*]'
 4102 |       return std::__search(__first1, __last1, __first2, __last2,
      |              ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4103 |                            __gnu_cxx::__ops::__iter_equal_to_iter());
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:15:   required from here
   17 |         search(b,c,&y,&x);
      |         ~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2153:48: error: no matching function for call to '__iterator_category(int&)'
 2153 |                        std::__iterator_category(__first));
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algobase.h:2153:34:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = int; _Predicate = __gnu_cxx::__ops::_Iter_equals_iter<int*>]'
 2153 |                        std::__iterator_category(__first));
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2203:23:   required from '_ForwardIterator1 std::__search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate) [with _ForwardIterator1 = int; _ForwardIterator2 = int*; _BinaryPredicate = __gnu_cxx::__ops::_Iter_equal_to_iter]'
 2203 |         return std::__find_if(__first1, __last1,
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 2204 |                 __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4102:27:   required from '_FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2) [with _FIter1 = int; _FIter2 = int*]'
 4102 |       return std::__search(__first1, __last1, __first2, __last2,
      |              ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4103 |                            __gnu_cxx::__ops::__iter_equal_to_iter());
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:15:   required from here
   17 |         search(b,c,&y,&x);
      |         ~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_equal_to_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int*]':
/usr/include/c++/14/bits/stl_algobase.h:2223:22:   required from '_ForwardIterator1 std::__search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate) [with _ForwardIterator1 = int; _ForwardIterator2 = int*; _BinaryPredicate = __gnu_cxx::__ops::_Iter_equal_to_iter]'
 2223 |           while (__predicate(__current, __p))
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4102:27:   required from '_FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2) [with _FIter1 = int; _FIter2 = int*]'
 4102 |       return std::__search(__first1, __last1, __first2, __last2,
      |              ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4103 |                            __gnu_cxx::__ops::__iter_equal_to_iter());
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:15:   required from here
   17 |         search(b,c,&y,&x);
      |         ~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:117:16: error: invalid type argument of unary '*' (have 'int')
  117 |       { return *__it1 == *__it2; }
      |                ^~~~~~