#include <iostream>
#include <vector>
#include <set>
#include <tuple>
// mecroses:
#define watch(x) debug && std::cout << #x << " = " << x
#define watchln(x) watch(x) << std::endl
#define watchsp(x) watch(x) << " "
// printing of containers:
// printing a range for two iterators:
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 << "}";
}
// printing vector:
template<class X> std::ostream& operator<<(std::ostream& os, const std::vector<X>& vec) {
return print_range(os, vec.begin(), vec.end());
}
// printing set
template<class X> std::ostream& operator<<(std::ostream& os, const std::set<X>& set) {
return print_range(os, set.begin(), set.end());
}
// printing pair:
template<class X, class T> std::ostream& operator<<(std::ostream& os, const std::pair<X,T>& pr) {
return os << "{" << pr.first << ", " << pr.second << "}";
}
// enable debug:
const int debug = 1;
// examples:
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+CgovLyBtZWNyb3NlczoKCiNkZWZpbmUgd2F0Y2goeCkgZGVidWcgJiYgc3RkOjpjb3V0IDw8ICN4IDw8ICIgPSAiIDw8IHgKI2RlZmluZSB3YXRjaGxuKHgpIHdhdGNoKHgpIDw8IHN0ZDo6ZW5kbAojZGVmaW5lIHdhdGNoc3AoeCkgd2F0Y2goeCkgPDwgIiAiCgovLyBwcmludGluZyBvZiBjb250YWluZXJzOgoKLy8gcHJpbnRpbmcgYSByYW5nZSBmb3IgdHdvIGl0ZXJhdG9yczoKdGVtcGxhdGU8Y2xhc3MgSXRlcmF0b3I+IHN0ZDo6b3N0cmVhbSY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