{"id":17143788,"url":"https://github.com/harttle/oj.h","last_synced_at":"2025-10-10T10:22:49.921Z","repository":{"id":66077768,"uuid":"49050159","full_name":"harttle/oj.h","owner":"harttle","description":"oj.h is a Online Judge Toolkit to speed-up your problem solving.","archived":false,"fork":false,"pushed_at":"2016-03-29T11:48:50.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-26T01:25:52.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"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/harttle.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":"2016-01-05T07:39:34.000Z","updated_at":"2018-06-11T07:28:46.000Z","dependencies_parsed_at":"2023-04-22T12:30:13.867Z","dependency_job_id":null,"html_url":"https://github.com/harttle/oj.h","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harttle/oj.h","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harttle%2Foj.h","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harttle%2Foj.h/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harttle%2Foj.h/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harttle%2Foj.h/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harttle","download_url":"https://codeload.github.com/harttle/oj.h/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harttle%2Foj.h/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003529,"owners_count":26083595,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-14T20:42:19.169Z","updated_at":"2025-10-10T10:22:49.882Z","avatar_url":"https://github.com/harttle.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OJ.H\n\noj.h is a Online Judge Toolkit to speed-up your problem solving.\n\n`oj.h` is a template library containing a batch of basic algrithms and data structures with `cin`/`cout` support (for debug purpose).\n\n## Basic Usage\n\nDonwload this repo and include `oj.h` in your program,\nAll OJ templates are available in `oj` namespace. \nFor example, vector reading and printing:\n\n```cpp\n#include \"oj.h\"\nusing namespace oj;\n\nint main() {\n    vector\u003cint\u003e v;\n    // input: 2 1 3 4\n    cin \u003e\u003e v;\n    // output: [2,1,3,4]\n    cout \u003c\u003c v \u003c\u003c endl;\n    return 0;\n}\n```\n\n\u003e All functionalities are provided via C++ template, \n\u003e so there's no need to build this lib.\n\n## CIN Utility\n\nWith `oj.h`, you can declare and read-in a variable in a single line.\n\n```cpp\n// equivalent to: int x; cin\u003e\u003ex;\nint x = get\u003cint\u003e();\n// equivalent to: int str; cin\u003e\u003estr;\nstring str = get\u003cstring\u003e();\n```\n\n## Vector\n\n`vector` template is provided by STL. \nWhile `oj.h` provides `cin` and `cout`:\n\n```cpp\nvector\u003cint\u003e v;\n// input: 1 3 2\ncin \u003e\u003e v;\n// output: [1,3,2]\ncout \u003c\u003c v \u003c\u003c endl;\n```\n\n## Pair\n\n`cin` and `cout` for `pair`:\n\n```cpp\npair\u003cint, char\u003e p;\n// input: 1 a\ncin \u003e\u003e p;\n// output: \u003c1,a\u003e\ncout \u003c\u003c p \u003c\u003c endl;\n```\n\n## Map\n\n`cin` and `cout` for `map`:\n\n```cpp\nmap\u003cint, char\u003e mp;\n// input: 1 a 2 b 3 c\ncin \u003e\u003e mp;\n// output: {\u003c1,a\u003e,\u003c2,b\u003e,\u003c3,c\u003e}\ncout \u003c\u003c mp \u003c\u003c endl;\n```\n\n## Set\n\n`cin` and `cout` for `set`:\n\n```cpp\nset\u003cint\u003e st;\n// input: 2 3 1\ncin \u003e\u003e st;\n// output: {1,2,3}\ncout \u003c\u003c st \u003c\u003c endl;\n```\n\n## Link List\n\n`LinkList` is a basic link list implementation with `cout` support. \n\n```cpp\nLinkList\u003cint\u003e* head = new LinkList\u003cint\u003e();\nhead-\u003enext = new LinkList\u003cint\u003e(1);\nhead-\u003enext-\u003enext = new LinkList\u003cint\u003e(2);\n\n// output: 0-\u003e1-\u003e2\ncout \u003c\u003c head \u003c\u003c endl;\n```\n\n## Tree\n\n`Tree` is a basic binary tree implementation.\n\n\u003e cout of tree nodes follows DFS order, `#` indicates `NULL`.\n\n```cpp\nTree\u003cint\u003e* root = new Tree\u003cint\u003e();\nroot-\u003eleft = new Tree\u003cint\u003e(1);\nroot-\u003eright = new Tree\u003cint\u003e(2);\nroot-\u003eright-\u003eleft = new Tree\u003cint\u003e(3);\nroot-\u003eright-\u003eright = new Tree\u003cint\u003e(4);\n// output: 0 1 # # 2 3 # # 4 # #\ncout \u003c\u003c *root \u003c\u003c endl;\n```\n\n## Algrithms\n\n`algos/` directory contains basic algrithms:\n\n* `quicksort`: Quick sort, random pivot enhanced.\n* `mergesort`: Merge sort.\n\n## Run Test\n\nGo to `test/` directory and run `make`. \nAll test cases will be compiled and executed with corresponding input.\n\n## Contribute\n\nAll contributions are welcome. You can either provide more algrithms in `algos/` directory, or provide additional functionalities in `lib/` directory.\n\n\u003e All OJ functionalities should be in `oj` namespace.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharttle%2Foj.h","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharttle%2Foj.h","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharttle%2Foj.h/lists"}