Skip to content

Instantly share code, notes, and snippets.

@rishabhdeepsingh
Last active February 21, 2025 16:29
Show Gist options
  • Save rishabhdeepsingh/be8bb28367e9b8c2fe853ffdf2790754 to your computer and use it in GitHub Desktop.
Save rishabhdeepsingh/be8bb28367e9b8c2fe853ffdf2790754 to your computer and use it in GitHub Desktop.
{
"test_cases": {
"prefix": "temp-cases",
"body": [
"int tc;",
"cin >> tc;",
"for (int t = 0; t < tc; ++t) {",
" solve();",
"}",
""
],
"description": "Test cases",
},
"task": {
"prefix": "temp-task",
"body": [
"// doot diddly donger cuckerino Hahahahahah",
"#include <bits/stdc++.h>",
"using namespace std;",
"",
"using ll = long long;",
"using ld = long double;",
"",
"template<typename T>",
"std::ostream& operator<<(std::ostream& out, const std::vector<T>& vec) {",
" for (auto& x: vec) out << x << ' ';",
" return out;",
"}",
"template<typename T>",
"std::istream& operator>>(std::istream& in, std::vector<T>& vec) {",
" for (auto& x: vec) in >> x;",
" return in;",
"}",
"",
"void solve() {}",
"",
"int32_t main() {",
" std::ios::sync_with_stdio(false);",
" std::cin.tie(nullptr);",
" std::cout.tie(nullptr);",
" solve();",
" return 0;",
"}",
""
],
"description": "task"
},
"Rng Generator": {
"prefix": "temp-rng",
"body": [
"std::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count());",
],
"description": "mt19937 rng"
},
"chmin chmax": {
"prefix": "temp-chmin",
"body": [
"template <typename T, typename U>",
"inline bool chmax(T &a, U b) { return a < b && (a = b, true); }",
"template <typename T, typename U>",
"inline bool chmin(T &a, U b) { return a > b && (a = b, true); }"
],
"description": "chmin and chmax"
},
"pbds": {
"prefix": "temp-pbds",
"body": [
"#include <ext/pb_ds/assoc_container.hpp>",
"#include <ext/pb_ds/tree_policy.hpp>",
"",
"using namespace __gnu_pbds;",
"using namespace __gnu_cxx;",
"",
"template <typename T>",
"using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;",
"",
"template <typename T>",
"using ordered_multiset = tree<T, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;"
],
"description": "push-back datastructure"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment