Language: C++

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

int main(){
  int N;
  cin >> N;
  
  vector<tuple<int, string, int>> vec1(N);
  vector<tuple<string, int, int>> vec2(N);
  for(int i = 0; i < N; i++){
    string a;
    int b;
    cin >> a >> b;
    vec1.at(i) = make_tuple(b, a, i);
  }
  
  sort(vec1.begin(), vec1.end());
  reverse(vec1.begin(), vec1.end());
  
  for(int i = 0; i < N; i++){
    int a, c;
    string b;
    tie(a, b, c) = vec1;
    vec2 = make_tuple(b, a, c);
  }
  
  sort(vec2.begin(), vec2.end());
  
  for(int i = 0; i < N; i++){
    cout << get<2>(vec2.at(i)) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: no match for 'operator=' (operand types are 'std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>' and 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >')
   23 |     tie(a, b, c) = vec1;
      |                    ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:1930:9: note: candidate: 'template<class ... _UElements> std::__enable_if_t<((bool)__assignable<const _UElements& ...>()), std::tuple< <template-parameter-1-1> >&> std::tuple< <template-parameter-1-1> >::operator=(const std::tuple<_Args1 ...>&) [with _UElements = {_UElements ...}; _Elements = {int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&}]'
 1930 |         operator=(const tuple<_UElements...>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:1930:9: note:   template argument deduction/substitution failed:
a.cc:23:20: note:   'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >' is not derived from 'const std::tuple<_UTypes ...>'
   23 |     tie(a, b, c) = vec1;
      |                    ^~~~
/usr/include/c++/14/tuple:1940:9: note: candidate: 'template<class ... _UElements> std::__enable_if_t<((bool)__assignable<_UElements ...>()), std::tuple< <template-parameter-1-1> >&> std::tuple< <template-parameter-1-1> >::operator=(std::tuple<_Args1 ...>&&) [with _UElements = {_UElements ...}; _Elements = {int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&}]'
 1940 |         operator=(tuple<_UElements...>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:1940:9: note:   template argument deduction/substitution failed:
a.cc:23:20: note:   'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >' is not derived from 'std::tuple<_UTypes ...>'
   23 |     tie(a, b, c) = vec1;
      |                    ^~~~
/usr/include/c++/14/tuple:1907:7: note: candidate: 'std::tuple< <template-parameter-1-1> >& std::tuple< <template-parameter-1-1> >::operator=(std::__conditional_t<((bool)__assignable<const _Elements& ...>()), const std::tuple< <template-parameter-1-1> >&, const std::__nonesuch&>) [with _Elements = {int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&}; std::__conditional_t<((bool)__assignable<const _Elements& ...>()), const std::tuple< <template-parameter-1-1> >&, const std::__nonesuch&> = const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&]'
 1907 |       operator=(__conditional_t<__assignable<const _Elements&...>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:1909:52: note:   no known conversion for argument 1 from 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >' to 'std::__conditional_t<true, const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&, const std::__nonesuch&>' {aka 'const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&'}
 1907 |       operator=(__conditional_t<__assignable<const _Elements&...>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1908 |                                 const tuple&,
      |                                 ~~~~~~~~~~~~~       
 1909 |                                 const __nonesuch&> __in)
      |                                 ~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/14/tuple:1918:7: note: candidate: 'std::tuple< <template-parameter-1-1> >& std::tuple< <template-parameter-1-1> >::operator=(std::__conditional_t<((bool)__assignable<_Elements ...>()), std::tuple< <template-parameter-1-1> >&&, std::__nonesuch&&>) [with _Elements = {int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&}; std::__conditional_t<((bool)__assignable<_Elements ...>()), std::tuple< <template-parameter-1-1> >&&, std::__nonesuch&&> = std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&&]'
 1918 |       operator=(__conditional_t<__assignable<_Elements...>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:1920:47: note:   no known conversion for argument 1 from 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >' to 'std::__conditional_t<true, std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&&, std::__nonesuch&&>' {aka 'std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&>&&'}
 1918 |       operator=(__conditional_t<__assignable<_Elements...>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1919 |                                 tuple&&,
      |                                 ~~~~~~~~       
 1920 |                                 __nonesuch&&> __in)
      |                                 ~~~~~~~~~~~~~~^~~~
a.cc:24:30: error: no match for 'operator=' (operand types are 'std::vector<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >' and 'std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>')
   24 |     vec2 = make_tuple(b, a, c);
      |                              ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>; _Alloc = std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>' to 'const std::vector<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>; _Alloc = std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>' to 'std::vector<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>; _Alloc = std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>' to 'std::initializer_list<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~