Language: C++

template <typename T>
ostream& operator << (ostream& os, const vector<T> V) {
    os << "[";
    int cnt = 0;
    T curr;
    if(!V.empty()){
        for (int i = 0; i < V.size() - 1; ++i) {
            if(V[i] == curr)cnt ++;
            else cnt = 0;
            if(cnt == 4)os << "... ";
            if(cnt < 4)
                os << V[i] << " ";
            curr = V[i];
        }
        os << V.back();
    }
    os << "]";
    return os;
}

template <typename T, typename U>
ostream& operator << (ostream& os, const pair<T,U> P) {
    os << "(";
    os << P.first << "," << P.second;
    os << ")";
    return os;
}

template <typename T, typename U>
ostream& operator << (ostream& os, const set<T,U> V) {
    os << "{";
    if(!V.empty()){
        auto it = V.begin();
        for (int i = 0; i < V.size() -1; ++i) {
            os << *it << " ";
            it++;
        }
        os << *it;
    }
    os << "}";
    return os;
}

template <typename K, typename H, typename P>
ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {
    os << "{";
    if(!V.empty()){
        auto it = V.begin();
        for (int i = 0; i < V.size() -1; ++i) {
            os << *it << " ";
            it++;
        }
        os << *it;
    }
    os << "}";
    return os;
}

template <typename K, typename C>
ostream& operator << (ostream& os, const multiset<K, C> V) {
    os << "{";
    if(!V.empty()){
        auto it = V.begin();
        for (int i = 0; i < V.size() -1; ++i) {
            os << *it << " ";
            it++;
        }
        os << *it;
    }
    os << "}";
    return os;
}

template <typename K, typename T, typename C>
ostream& operator << (ostream& os, const map<K,T,C> V) {
    os << "{";
    if(!V.empty()){
        auto it = V.begin();
        for (int i = 0; i < V.size() -1; ++i) {
            os << "(";
            os << it->first << "," << it->second;
            os << ") ";
            it++;
        }
        os << "(";
        os << it->first << "," << it->second;
        os << ")";
    }
    os << "}";
    return os;
}

template <typename K, typename T, typename C>
ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {
    os << "{";
    if(!V.empty()){
        auto it = V.begin();
        for (int i = 0; i < V.size() -1; ++i) {
            os << "(";
            os << it->first << "," << it->second;
            os << ") ";
            it++;
        }
        os << "(";
        os << it->first << "," << it->second;
        os << ")";
    }
    os << "}";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const deque<T> V) {
    os << "[";
    if (!V.empty()) {
        for (int i = 0; i < V.size() - 1; ++i) {
            os << V[i] << "->";
        }
        if (!V.empty())os << V.back();
    }
    os << "]";
    return os;
};

template <typename T, typename Cont, typename Comp>
ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {
    priority_queue<T, Cont, Comp> _V = V;
    os << "[";
    if(!_V.empty()){
        while(_V.size() > 1){
            os << _V.top() << "->";
            _V.pop();
        }
        os << _V.top();
    }
    os << "]";
    return os;
};

Compiler output:
a.cc:2:1: error: 'ostream' does not name a type
    2 | ostream& operator << (ostream& os, const vector<T> V) {
      | ^~~~~~~
a.cc:22:1: error: 'ostream' does not name a type
   22 | ostream& operator << (ostream& os, const pair<T,U> P) {
      | ^~~~~~~
a.cc:30:1: error: 'ostream' does not name a type
   30 | ostream& operator << (ostream& os, const set<T,U> V) {
      | ^~~~~~~
a.cc:45:1: error: 'ostream' does not name a type
   45 | ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {
      | ^~~~~~~
a.cc:60:1: error: 'ostream' does not name a type
   60 | ostream& operator << (ostream& os, const multiset<K, C> V) {
      | ^~~~~~~
a.cc:75:1: error: 'ostream' does not name a type
   75 | ostream& operator << (ostream& os, const map<K,T,C> V) {
      | ^~~~~~~
a.cc:94:1: error: 'ostream' does not name a type
   94 | ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {
      | ^~~~~~~
a.cc:113:1: error: 'ostream' does not name a type
  113 | ostream& operator << (ostream& os, const deque<T> V) {
      | ^~~~~~~
a.cc:126:1: error: 'ostream' does not name a type
  126 | ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {
      | ^~~~~~~