Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CODEFORCES_DEBUG_H
- #define CODEFORCES_DEBUG_H
- #include <bits/stdc++.h>
- template <typename T>
- std::ostream &operator<<(std::ostream &out, std::vector<std::vector<T>> const &v)
- {
- for (auto &&i : v) {
- for (auto &&j : i)
- out << j << " ";
- out << std::endl;
- }
- return out;
- }
- template <typename T, size_t rows, size_t cols>
- std::ostream &operator<<(std::ostream &out, T (&array)[rows][cols])
- {
- for (int i = 0; i < rows; ++i) {
- for (int j = 0; j < cols; j++) {
- out << array[i][j] << " ";
- }
- out << std::endl;
- }
- return out;
- }
- template <size_t rows, size_t cols>
- std::ostream &operator<<(std::ostream &out, char (&array)[rows][cols])
- {
- for (int i = 0; i < rows; ++i) {
- out << array[i] << " " << std::endl;
- }
- out << std::endl;
- return out;
- }
- template <size_t rows>
- std::ostream &operator<<(std::ostream &out, int (&array)[rows])
- {
- for (auto &j : array) {
- out << j << " ";
- }
- out << std::endl;
- return out;
- }
- template <typename T, typename V>
- std::ostream &operator<<(std::ostream &os, const std::pair<T, V> pai)
- {
- return os << '(' << pai.first << ' ' << pai.second << ')';
- }
- template <typename T>
- std::ostream &operator<<(std::ostream &os, const std::vector<T> v)
- {
- std::cout << '[';
- for (auto &item : v) {
- std::cout << item << ",";
- }
- std::cout << "]";
- return os;
- }
- template <typename T>
- std::ostream &operator<<(std::ostream &os, const std::set<T> v)
- {
- std::cout << "{";
- for (auto p : v)
- std::cout << p << ",";
- std::cout << "}";
- return os;
- }
- template <typename T, typename V>
- std::ostream &operator<<(std::ostream &os, const std::map<T, V> v)
- {
- std::cout << "{";
- for (auto p : v)
- std::cout << p << ",";
- std::cout << "}";
- return os;
- }
- std::ifstream in("/home/frs/CLionProjects/codeforce/in.txt");
- std::ofstream out("/home/frs/CLionProjects/codeforce/out.txt");
- auto cinbuf = std::cin.rdbuf(in.rdbuf());
- auto coutbuf = std::cout.rdbuf(out.rdbuf());
- #define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
- template <class TH>
- void _dbg(const char *sdbg, TH h)
- {
- std::cout << sdbg << '=' << h << std::endl;
- }
- template <class TH, class... TA>
- void _dbg(const char *sdbg, TH h, TA... a)
- {
- while (*sdbg != ',')
- std::cout << *sdbg++;
- std::cout << '=' << (h) << ',';
- _dbg(sdbg + 1, a...);
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement