{"id":13484708,"url":"https://github.com/online-judge-tools/oj","last_synced_at":"2025-05-15T02:06:35.293Z","repository":{"id":37652642,"uuid":"78140919","full_name":"online-judge-tools/oj","owner":"online-judge-tools","description":"Tools for various online judges. Downloading sample cases, generating additional test cases, testing your code, and submitting it.","archived":false,"fork":false,"pushed_at":"2024-05-03T09:59:05.000Z","size":1945,"stargazers_count":1077,"open_issues_count":29,"forks_count":95,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-14T00:57:31.945Z","etag":null,"topics":["atcoder","automation","codeforces","competitive-programming","programming-contests","scraping","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/online-judge-tools.png","metadata":{"files":{"readme":"README.ja.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2017-01-05T19:15:41.000Z","updated_at":"2025-04-13T10:20:10.000Z","dependencies_parsed_at":"2024-01-13T19:18:22.387Z","dependency_job_id":"bce9ca2b-7bf7-47cb-a0f9-29e1d68cec3b","html_url":"https://github.com/online-judge-tools/oj","commit_stats":{"total_commits":1255,"total_committers":31,"mean_commits":"40.483870967741936","dds":0.2788844621513944,"last_synced_commit":"39458251dfc98e44a98920ed3b7e9c0cab2ed22a"},"previous_names":["kmyk/online-judge-tools"],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-judge-tools%2Foj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-judge-tools%2Foj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-judge-tools%2Foj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-judge-tools%2Foj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/online-judge-tools","download_url":"https://codeload.github.com/online-judge-tools/oj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259370,"owners_count":22040819,"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":["atcoder","automation","codeforces","competitive-programming","programming-contests","scraping","testing"],"created_at":"2024-07-31T17:01:30.996Z","updated_at":"2025-05-15T02:06:35.277Z","avatar_url":"https://github.com/online-judge-tools.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# online-judge-tools/oj\n\n[![test](https://github.com/online-judge-tools/oj/workflows/test/badge.svg)](https://github.com/online-judge-tools/oj/actions)\n[![PyPI](https://img.shields.io/pypi/v/online-judge-tools.svg)](https://pypi.python.org/pypi/online-judge-tools)\n[![Downloads](https://pepy.tech/badge/online-judge-tools)](https://pepy.tech/project/online-judge-tools)\n[![PyPI](https://img.shields.io/pypi/l/online-judge-tools.svg)](https://github.com/kmyk/online-judge-tools/blob/master/LICENSE)\n[![Join the chat at https://gitter.im/online-judge-tools/community](https://badges.gitter.im/online-judge-tools/community.svg)](https://gitter.im/online-judge-tools/community)\n\n[English version of `README.md`](https://github.com/online-judge-tools/oj/blob/master/README.md)\n\n`oj` コマンドは様々なオンラインジャッジの問題を解くことを助けるツールです。\nこのコマンドは、サンプルケースの取得、追加のテストケースの生成、テストの実行、コードの提出などを自動化します。\n\n## Screencast\n\n![screencast](https://user-images.githubusercontent.com/2203128/34708715-568b13c0-f557-11e7-97ef-9f6b646e4776.gif)\n\n## Features\n\n-   サンプルケースを取得\n-   システムケースを取得\n-   ログイン\n-   コードを提出\n-   テストを実行\n-   リアクティブ問題のテストを実行\n-   テストケース生成器からテストケースの入力を生成\n-   テストケースの入力と愚直解からテストケースの出力を生成\n\n詳しいドキュメントは [docs/getting-started.ja.md](https://github.com/online-judge-tools/oj/blob/master/docs/getting-started.ja.md) にあります。\n\n様々なオンラインジャッジ (Codeforces, AtCoder, HackerRank など) をサポートしています。\nその完全なリストには [the table of online-judge-tools/api-client](https://github.com/online-judge-tools/api-client#supported-websites) を見てください。\n\n## How to install\n\nPython package は \u003chttps://pypi.python.org/pypi/online-judge-tools\u003e [![PyPI](https://img.shields.io/pypi/v/online-judge-tools.svg)](https://pypi.python.org/pypi/online-judge-tools) です。\n\n```console\n$ pip3 install online-judge-tools\n```\n\nより詳しい説明には [docs/INSTALL.ja.md](https://github.com/online-judge-tools/oj/blob/master/docs/INSTALL.ja.md) を読んでください。\n\n\n## How to use\n\n```console\n$ oj download [--system] URL\n$ oj login URL\n$ oj submit [URL] FILE\n$ oj test [-c COMMAND] [TEST...]\n$ oj test-reactive [-c COMMAND] JUDGE_COMMAND\n$ oj generate-input GENERATOR_COMMAND\n$ oj generate-output [-c COMMAND] [TEST...]\n```\n\n詳細は `$ oj --help` を見てください。\n\n## Example\n\n```console\n$ oj download http://agc001.contest.atcoder.jp/tasks/agc001_a\n[INFO] online-judge-tools 11.2.0 (+ online-judge-api-client 10.8.0)\n[INFO] load cookie from: /home/user/.local/share/online-judge-tools/cookie.jar\n[NETWORK] GET: https://atcoder.jp/contests/agc001/tasks/agc001_a\n[NETWORK] 200 OK\n\n[INFO] sample 0\n[INFO] input: sample-1\n2\n1 3 1 2\n\n[SUCCESS] saved to: test/sample-1.in\n[INFO] output: sample-1\n3\n\n[SUCCESS] saved to: test/sample-1.out\n\n[INFO] sample 1\n[INFO] input: sample-2\n5\n100 1 2 3 14 15 58 58 58 29\n\n[SUCCESS] saved to: test/sample-2.in\n[INFO] output: sample-2\n135\n\n[SUCCESS] saved to: test/sample-2.out\n\n$ cat \u003c\u003cEOF \u003e main.py\n#!/usr/bin/env python3\nn = int(input())\na = list(map(int, input().split()))\nans = max(a)\nprint(ans)\nEOF\n\n$ oj t -c \"python3 main.py\"\n[INFO] online-judge-tools 11.2.0 (+ online-judge-api-client 10.8.0)\n[INFO] 2 cases found\n\n[INFO] sample-1\n[INFO] time: 0.043601 sec\n[SUCCESS] AC\n\n[INFO] sample-2\n[INFO] time: 0.043763 sec\n[FAILURE] WA\ninput:\n5\n100 1 2 3 14 15 58 58 58 29\n\noutput:\n3\n\nexpected:\n135\n\n\n[INFO] slowest: 0.043763 sec  (for sample-2)\n[INFO] max memory: 10.064000 MB  (for sample-2)\n[FAILURE] test failed: 1 AC / 2 cases\n```\n\n## FAQ\n\n-   私は C++ でなく Python (あるいは Rust, D, Java, F#, Haskell など) を使っています。それでも利用できますか？\n    -   はい。必要なら `--command` (`-c`) オプションを利用してください。たとえば Python なら `$ oj t -c \"python3 main.py\"` のようにします。\n-   私はいつもひとつのコンテストごとにひとつのディレクトリを使っています。このスタイルのままでも利用できますか？\n    -   はい。`--directory` (`-d`) オプションや `$ rm -rf test/` コマンドを利用してください。しかし、レートの最大化のためには追加のテストケースを自分で生成するべきであり、それをする上ではひとつの問題ごとにひとつのディレクトリを使う方がよいでしょう。\n-   コンテストごとに一括でサンプルケースを取得できませんか？\n    -   いいえ、`oj` コマンドではできません。代わりに [kmyk/online-judge-template-generator](https://github.com/kmyk/online-judge-template-generator) の `oj-prepare` コマンドを利用してください。\n-   テストの前に自動でコードをコンパイルするようにはできますか？\n    -   はい。シェルの機能を使ってください。`$ g++ main.cpp \u0026\u0026 oj t` のように実行してください。\n-   テストが通ったら自動で提出するようにはできますか？\n    -   はい。シェルの機能を使ってください。`$ oj t \u0026\u0026 oj s main.cpp` のように実行してください。ところで、サンプルケースがあまり強くない問題の存在には注意が必要です。\n-   提出の際のディレイや `[y/N]` の確認をなしにできますか？\n    -   はい。`--wait=0` オプションや `--yes` オプションを利用してください。しかしこれは推奨されません。これらの機能は安全性のためにあるものです。たとえば、もし 3 秒速く提出できていれば順位が 3 位上がるような状況を考えてみましょう。そのような状況で提出ミスをして 5 分のペナルティを受ければ、順位は 300 位は下がるでしょう。\n-   入力したパスワードは保存されますか？\n    -   いいえ。パスワードはどのファイルにも保存されません。セッショントークンなど (ただしこれも機密情報です) のみを保存します。必要であれば [`onlinejudge/_implementation/command/login.py`](https://github.com/kmyk/online-judge-tools/blob/master/onlinejudge/_implementation/command/login.py) などを読んで確認してください。\n-   設定ファイルはありますか？\n    -   いいえ。シェルの `.bashrc` (あるいはそれに相当するファイル) を利用してください。[man bash](https://linux.die.net/man/1/bash) を読み、シェル alias やシェル関数を書いてください。たとえば、もしテストの実行の際に Python をデフォルトで使いたいのなら `alias oj-test-python='oj t -c \"python3 main.py\"'` と `.bashrc` に書いて `$ oj-test-python` と実行してください。\n\nここにない質問には [Gitter](https://gitter.im/online-judge-tools/community) [![Join the chat at https://gitter.im/online-judge-tools/community](https://badges.gitter.im/online-judge-tools/community.svg)](https://gitter.im/online-judge-tools/community) やその他の SNS を使ってください。\n\n## Resources\n\n### Articles\n\n-   [online-judge-toolsを導入しよう！ \u0026#183; ますぐれメモ](https://blog.masutech.work/posts/compro/oj-introduction/)\n-   [online-judge-toolsをVimから呼んで楽をする - Leverage Copy](https://maguroguma.hatenablog.com/entry/2020/08/19/090000)\n-   [VSCodeでAtCoderのサンプルケースをサクッとテストする - Qiita](https://qiita.com/danpe919/items/7c5697df25fb567f1e71)\n\n### Related Tools\n\n競合:\n\n-   [jmerle/competitive-companion](https://github.com/jmerle/competitive-companion)\n-   [kyuridenamida/atcoder-tools](https://github.com/kyuridenamida/atcoder-tools)\n-   [xalanq/cf-tool](https://github.com/xalanq/cf-tool)\n-   [nodchip/OnlineJudgeHelper](https://github.com/nodchip/OnlineJudgeHelper)\n\n非競合:\n\n-   [shivawu/topcoder-greed](https://github.com/shivawu/topcoder-greed) for Topcoder Single Round Match\n\nkmyk/online-judge-tools と連携するツール:\n\n-   [kmyk/online-judge-template-generator](https://github.com/kmyk/online-judge-template-generator) は競プロの問題を解析して解法コードの入出力部分などを自動生成します\n-   [kmyk/online-judge-verify-helper](https://github.com/kmyk/online-judge-verify-helper) は競プロライブラリの verify とドキュメントの生成を自動化します\n-   [Tatamo/atcoder-cli](https://github.com/Tatamo/atcoder-cli) は AtCoder に特化した `oj` コマンドの薄い wrapper です\n-   [kjnh10/pcm](https://github.com/kjnh10/pcm) は内部で `oj` コマンドを利用しています\n-   [fukatani/rujaion](https://github.com/fukatani/rujaion) は Rust で競プロをすることに特化した IDE です\n\n## Maintainers\n\n-   current maintainers\n    -   [@kmyk](https://github.com/kmyk) (AtCoder: [kimiyuki](https://atcoder.jp/users/kimiyuki), Codeforces: [kimiyuki](https://codeforces.com/profile/kimiyuki)) (original author)\n-   maintainers who are not working now\n    -   [@fukatani](https://github.com/fukatani) (AtCoder: [ryoryoryo111](https://atcoder.jp/users/ryoryoryo111))\n    -   [@kawacchu](https://github.com/kawacchu) (AtCoder: [kawacchu](https://atcoder.jp/users/kawacchu))\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonline-judge-tools%2Foj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonline-judge-tools%2Foj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonline-judge-tools%2Foj/lists"}