Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;
class key2{
public:
    string s,t;
    key2(string a,string b){
        if(a>b){
            swap(a,b);
        }
        s=a;
        t=b;
    }
};

bool operator<(const key2 &a,const key2 &b){
    return a.s<b.s||(a.s==b.s&&a.t<b.t);
}

class data{
public:
    string s,t;
    int num;
    data(key2 a,int b){
        s=a.s;
        t=a.t;
        num=b;
    }
    void out(){
        cout<<s<<" "<<t<<endl;
    }
};

int main(){
    int N,F;
    cin>>N>>F;
    map<key2,int> use;
    for(int i=0;i<N;++i){
        int time;
        cin>>time;
        vector<string> buylist(time);
        for(int j=0;j<time;++j){
            cin>>buylist[j];
        }
        for(int j=0;j<time;++j){
            for(int k=j+1;k<time;++k){
                key2 d(buylist[j],buylist[k]);
                auto itr = use.find(d);
                if(itr==use.end()){
                    use[d]=1;
                }else{
                    ++use[d];
                }
            }
        }
    }
    int ans=0;
    vector<data> anslist;
    for(auto itr=use.begin();itr!=use.end();++itr){
        if(itr->second>=F){
            anslist.push_back(data(itr->first,itr->second));
            ++ans;
        }
    }
    cout<<ans<<endl;
    for(int i=0;i<ans;++i){
        anslist[i].out();
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:16: error: template argument 1 is invalid
   61 |     vector<data> anslist;
      |                ^
a.cc:61:16: error: template argument 2 is invalid
a.cc:64:21: error: request for member 'push_back' in 'anslist', which is of non-class type 'int'
   64 |             anslist.push_back(data(itr->first,itr->second));
      |                     ^~~~~~~~~
a.cc:64:31: error: reference to 'data' is ambiguous
   64 |             anslist.push_back(data(itr->first,itr->second));
      |                               ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:23:7: note:                 'class data'
   23 | class data{
      |       ^~~~
a.cc:70:16: error: invalid types 'int[int]' for array subscript
   70 |         anslist[i].out();
      |                ^