#include <iostream>
#include <vector>
#include <set>
#include <tuple>
// макросы
#define watch(x) debug && std::cout << #x << " = " << x
#define watchln(x) watch(x) << std::endl
#define watchsp(x) watch(x) << " "
// вывод контейнеров:
// вывод диапазона:
template<class Iterator> std::ostream& print_range(std::ostream& os, Iterator begin, Iterator end) {
os << "{";
for (auto it = begin; it != end; os << *it++)
if (it != begin) os << ", ";
return os << "}";
}
// вывод vector:
template<class X> std::ostream& operator<<(std::ostream& os, const std::vector<X>& vec) {
return print_range(os, vec.begin(), vec.end());
}
// вывод set
template<class X> std::ostream& operator<<(std::ostream& os, const std::set<X>& set) {
return print_range(os, set.begin(), set.end());
}
// вывод pair:
template<class X, class T> std::ostream& operator<<(std::ostream& os, const std::pair<X,T>& pr) {
return os << "{" << pr.first << ", " << pr.second << "}";
}
// включение дебага:
const int debug = 1;
// примеры:
int main() {
std::vector<int> arr{1,2,3};
watchln(arr);
std::vector<std::set<int>> vector_of_sets{{1,2,2},{2,1,3},{3,3,3}};
watchln(vector_of_sets);
std::vector<std::vector<int>> vector_of_vectors{{1,2,2},{2,1,3},{3,3,3}};
watchln(vector_of_vectors);
std::pair<int,int> pair(1,2);
watchln(pair);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8dHVwbGU+CgovLyDQvNCw0LrRgNC+0YHRiwoKI2RlZmluZSB3YXRjaCh4KSBkZWJ1ZyAmJiBzdGQ6OmNvdXQgPDwgI3ggPDwgIiA9ICIgPDwgeAojZGVmaW5lIHdhdGNobG4oeCkgd2F0Y2goeCkgPDwgc3RkOjplbmRsCiNkZWZpbmUgd2F0Y2hzcCh4KSB3YXRjaCh4KSA8PCAiICIKCi8vINCy0YvQstC+0LQg0LrQvtC90YLQtdC50L3QtdGA0L7QsjoKCi8vINCy0YvQstC+0LQg0LTQuNCw0L/QsNC30L7QvdCwOgp0ZW1wbGF0ZTxjbGFzcyBJdGVyYXRvc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