{"id":18817347,"url":"https://github.com/exoad/sandbox","last_synced_at":"2025-04-13T23:08:58.295Z","repository":{"id":45577877,"uuid":"391920567","full_name":"exoad/sandbox","owner":"exoad","description":"My programming notes","archived":false,"fork":false,"pushed_at":"2025-03-31T20:30:03.000Z","size":6695,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T23:08:30.963Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exoad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-02T11:19:58.000Z","updated_at":"2025-03-31T20:30:07.000Z","dependencies_parsed_at":"2025-03-26T15:31:34.483Z","dependency_job_id":"bfe995ce-990a-4017-8093-ce4b61de1ac8","html_url":"https://github.com/exoad/sandbox","commit_stats":null,"previous_names":["exoad/practice","exoad/sandbox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fsandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fsandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fsandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fsandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exoad","download_url":"https://codeload.github.com/exoad/sandbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794571,"owners_count":21162615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:10:59.065Z","updated_at":"2025-04-13T23:08:58.289Z","avatar_url":"https://github.com/exoad.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Practice\n\nThis is Jack Meng's coding practice repo. Most of the things here are just my solves to online judges like LeetCode, AtCoder, etc., but I also write notes and other helpful stuffs.\n:)\n\n## Content\n\n* [`./Solves/`](./Solves/) - Contains all of my general programming solutions and notes **as of October 2024**. These are mostly for OJs like Codeforces, Atcoder, LeetCode, etc..\n\n* [`./Notes/`](./Notes/) - All of my documented notes that I hopefully have formatted properly. They cover various topics. **THE LATEX MAY BE MESSED UP FROM GITHUB'S BUILTIN RENDERER. I use KaTeX by default to render them on my end.**\n\n* [`./Old-Solves/`](./Old-Solves/) - Contains all of my solutions from my past (pre 2023 era).\n\n* [`Resources.md`](./Resources.md) - Contains helpful resources that I have found to be extremely helpful.\n\n* [`To_Learn.md`](./To_Learn.md) - Are just simple reminders of what I still need to work on.\n\n* [`interesting.txt`](./interesting.txt) - This is my old list of resources.\n\n## Coding Templates\n\nLocated [here](./Solves/modules/googer.cxx)\n\n```cxx\n#include \u003calgorithm\u003e\n#include \u003carray\u003e\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n#include \u003cset\u003e\n#include \u003cmap\u003e\n#include \u003cqueue\u003e\n#include \u003cnumeric\u003e\n#include \u003cutility\u003e\n#include \u003cbitset\u003e\n#include \u003cunordered_map\u003e\n#include \u003cunordered_set\u003e\n#include \u003cstack\u003e\n#include \u003cbitset\u003e\n#include \u003ccmath\u003e\n#include \u003cassert.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cstdio.h\u003e\n#include \u003cstring.h\u003e\n#include \u003ccstdint\u003e\n#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n#pragma GCC diagnostic ignored \"-Wunused-result\"\n#pragma GCC diagnostic ignored \"-Wpragmas\"\n#pragma GCC diagnostic ignored \"-Wunused-function\"\n#pragma GCC diagnostic ignored \"-Wunused-but-set-variable\"\n#pragma GCC diagnostic ignored \"-Wunused-but-set-parameter\"\n#pragma GCC diagnostic ignored \"-Wwrite-strings\"\n#pragma GCC diagnostic ignored \"-Wunused-local-typedefs\"\n#pragma GCC diagnostic ignored \"-Wunused-but-set-label\"\n#pragma GCC diagnostic ignored \"-Wunused-label\"\n#pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"\n#pragma GCC diagnostic ignored \"-Wmissing-braces\"\n#pragma GCC diagnostic ignore \"-Wmaybe-uninitialized\"\n#pragma GCC diagnostic ignored \"-Wmissing-declarations\"\n#pragma GCC target(\"avx2,bmi,bmi2,lzcnt,popcnt\")\n#pragma GCC optimize(\"Ofast\", \"unroll-loops\")\n#ifdef __linux__\n#       include\u003cunistd.h\u003e\n#endif\nusing namespace std;\nusing ll=long long;\nusing ull=unsigned long long;\nusing ld=long double;\nusing str=string;\n#define TRUE 1\n#define FALSE 0\n#define all(x) x.begin(),x.end()\n#define rall(x) x.rbegin(),x.rend()\n#define pb push_back\n#define lb lower_bound\n#define ub upper_bound\n#define eb emplace_back\n#define RANGE(a,b) for(int i=a;i\u003c=b;i++)\n#define PI 3.14159265358979323846\n#ifdef LOCAL_JUDGE_HOST\n#   define __trace(x) cerr\u003c\u003c\"[\"\u003c\u003c__LINE__\u003c\u003c\"] \"\u003c\u003c#x\u003c\u003c\"@\"\u003c\u003c\u0026x\u003c\u003c\"=\"\u003c\u003cx\u003c\u003cendl;\n#else\n#   define __trace(x)\n#endif\nnamespace judge\n{\n        template\u003ctypename T\u003e\n        inline void partial_sum(vector\u003cT\u003e x)\n        {\n                partial_sum(all(x),x.begin());\n        }\n\n        inline void setIO(str name=\"\")\n        {\n                ios_base::sync_with_stdio(false);\n                cin.tie(nullptr);\n                cout.tie(nullptr);\n                if (int(name.size()))\n                {\n                        freopen((name+\".in\").c_str(),\"r\",stdin);\n                        freopen((name+\".out\").c_str(),\"w\",stdout);\n                }\n        }\n        int gcd(int a,int b)\n        {\n                return a==0||a==b?b:b==0||b%a==0?a:a\u003eb?gcd(b,a):gcd(a,b%a);\n        }\n        inline int low_bit(int x)\n        {\n                return x\u0026(-x);\n        }\n#ifdef __linux__\n        ostream\u0026 operator\u003c\u003c(ostream\u0026 os,const __int128_t\u0026 v)\n        {\n                if (!v)\n                        os\u003c\u003c\"0\";\n                __int128_t tmp=v\u003c0?(os\u003c\u003c\"-\",-v):v;\n                string s;\n                while (tmp)\n                {\n                        s+='0'+(tmp%10);\n                        tmp/=10;\n                }\n                return reverse(all(s)),os\u003c\u003cs;\n        }\n        ostream\u0026 operator\u003c\u003c(ostream\u0026 os,const __uint128_t\u0026 v)\n        {\n                if (!v)\n                        os\u003c\u003c\"0\";\n                __uint128_t tmp=v;\n                string s;\n                while (tmp)\n                {\n                        s+='0'+(tmp%10);\n                        tmp/=10;\n                }\n                return reverse(all(s)),os\u003c\u003cs;\n        }\n#endif\n};\nusing namespace judge;\nnamespace generics\n{\n        template\u003ctypename T\u003e\n        class Graph\n        {\n        public:\n                struct Edge\n                {\n                        int from;\n                        int to;\n                        T weight;\n                        Edge(int from,int to,T weight) :from(from),to(to),weight(weight)\n                        {\n                        }\n                };\n                vector\u003cEdge\u003e edges;\n                vector\u003cvector\u003cint\u003e\u003e ver;\n                int n;\n                Graph(int n) :n(n)\n                {\n                        ver.resize(n);\n                }\n                virtual int addEdge(const Edge\u0026 edge)=0;\n        };\n        template\u003ctypename T\u003e\n        class UndirectedGraph :public Graph\u003cT\u003e\n        {\n        public:\n                UndirectedGraph(int n) :Graph\u003cT\u003e(n)\n                {\n                }\n                int addEdge(const typename Graph\u003cT\u003e::Edge\u0026 edge) override\n                {\n                        assert(0\u003c=edge.from\u0026\u0026edge.from\u003cGraph\u003cT\u003e::n\u0026\u00260\u003c=edge.to\u0026\u0026edge.to\u003cGraph\u003cT\u003e::n);\n                        int id=(int)Graph\u003cT\u003e::edges.size();\n                        Graph\u003cT\u003e::ver[edge.from].pb(id);\n                        Graph\u003cT\u003e::g[edge.to].pb(id);\n                        Graph\u003cT\u003e::edges.pb(edge);\n                        return id;\n                }\n        };\n        template\u003ctypename T\u003e\n        class DirectedGraph :public Graph\u003cT\u003e\n        {\n        public:\n                DirectedGraph(int n) :Graph\u003cT\u003e(n)\n                {\n                }\n                int addEdge(const typename Graph\u003cT\u003e::Edge\u0026 edge) override\n                {\n                        assert(0\u003c=edge.from\u0026\u0026edge.from\u003cGraph\u003cT\u003e::n\u0026\u00260\u003c=edge.to\u0026\u0026edge.to\u003cGraph\u003cT\u003e::n);\n                        int id=(int)Graph\u003cT\u003e::edges.size();\n                        Graph\u003cT\u003e::g[edge.from].pb(id);\n                        Graph\u003cT\u003e::edges.pb(edge);\n                        return id;\n                }\n        };\n        struct UnionFind\n        {\n                vector\u003cint\u003e uf;\n                int n;\n                UnionFind(int n) :uf(n,-1),n(n)\n                {\n                }\n                int find(int v)\n                {\n                        return uf[v]\u003c0?v:uf[v]=find(uf[v]);\n                }\n                bool join(int v,int w)\n                {\n                        if ((v=find(v))==(w=find(w)))\n                                return false;\n                        if (uf[v]\u003euf[w])\n                                ::swap(v,w);\n                        uf[v]+=uf[w];\n                        uf[w]=v;\n                        n--;\n                        return true;\n                }\n                bool connected(int v,int w)\n                {\n                        return find(v)==find(w);\n                }\n                int size(int v)\n                {\n                        return -uf[find(v)];\n                }\n        };\n        template\u003cclass T\u003e\n        class BIT\n        {\n                private:\n                        int sz;\n                        vector\u003cT\u003e bit,arr;\n                public:\n                        BIT(int sz):sz(sz),bit(sz+1),arr(sz)\n                        {\n                        }\n\n                        void add(int i,int v)\n                        {\n                                arr[i]+=v;\n                                i++;\n                                for(;i\u003c=sz;i+=low_bit(i))\n                                        bit[i]+=v;\n                        }\n\n                        T psum(int i)\n                        {\n                                i++;\n                                T sum=0;\n                                for(;i\u003e0;i-=low_bit(i))\n                                        sz+=bit[i];\n                                return sum;\n                        }\n\n                        void set(int i,int v)\n                        {\n                                add(i,v-arr[i]);\n                        }\n        };\n};\nsigned main()\n{\n        setIO();\n\n        return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexoad%2Fsandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexoad%2Fsandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexoad%2Fsandbox/lists"}