Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    RishabhDeep Singh
    @rishabhdeepsingh
    oj-api login-service https://codeforces.com | jq .result 
    INFO:root:online-judge-api-client 10.2.1
    INFO:root:sleep 1.000000 sec
    INFO:onlinejudge._implementation.logging:[-] unknown problem: https://codeforces.com
    INFO:onlinejudge._implementation.logging:[-] unknown contest: https://codeforces.com
    INFO:onlinejudge._implementation.logging:[x] service recognized: CodeforcesService.from_url('https://codeforces.com/'): https://codeforces.com
    INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
    INFO:onlinejudge._implementation.logging:[x] GET: https://codeforces.com/enter
    INFO:onlinejudge._implementation.logging:[x] 200 OK
    INFO:onlinejudge._implementation.logging:[x] POST: https://codeforces.com/enter
    INFO:onlinejudge._implementation.logging:[x] 200 OK
    INFO:onlinejudge._implementation.logging:[-] Invalid handle or password.
    ERROR:root:Invalid handle or password.
    Traceback (most recent call last):
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/main.py", line 279, in main
        result = login_service.main(service, username=parsed.username, password=parsed.password, check_only=parsed.check, session=session)
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/login_service.py", line 40, in main
        service.login(get_credentials=get_credentials, session=session)
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/codeforces.py", line 55, in login
        raise LoginError('Invalid handle or password.')
    onlinejudge.type.LoginError: Invalid handle or password.
    null
    Kimiyuki Onaka
    @kmyk
    @rishabhdeepsingh The command works on my environment. Did you specify your handle and your password correctly?
    Gaurang Tandon
    @GaurangTandon
    Hi, I want to ask if it is possible to change the browser, which opens with the submission page after i run oj submit?
    I had Chrome earlier, but now my system default browser is FF, but the submission page still opened in Chrome
    I couldn't find this in the FAQ on the github readme
    Kimiyuki Onaka
    @kmyk
    @GaurangTandon You can set $BROWSER envvar, e.g. $ BROWSER=firefox oj submit ... or export BROWSER=firefox in your .bashrc. We use Python's webbrowser module and the document is https://docs.python.org/3/library/webbrowser.html#:~:text=If%20the%20environment%20variable,the%20platform%20defaults.
    Gaurang Tandon
    @GaurangTandon
    I see, thanks @kmyk !
    RishabhDeep Singh
    @rishabhdeepsingh
    @kmyk Yes they are correct.
    RishabhDeep Singh
    @rishabhdeepsingh
    Why are we using the system default USERNAME parameter? I think that is where I am getting conflicted. whenever I export USERNAME='rds__98' it sets back again to the default one.
    RishabhDeep Singh
    @rishabhdeepsingh
    After logging in I am getting you are not logged in?
    oj-api login-service https://codeforces.com | jq .result 
    INFO:root:online-judge-api-client 10.2.1
    INFO:root:sleep 1.000000 sec
    INFO:onlinejudge._implementation.logging:[-] unknown problem: https://codeforces.com
    INFO:onlinejudge._implementation.logging:[-] unknown contest: https://codeforces.com
    INFO:onlinejudge._implementation.logging:[x] service recognized: CodeforcesService.from_url('https://codeforces.com/'): https://codeforces.com
    INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
    INFO:onlinejudge._implementation.logging:[x] GET: https://codeforces.com/enter
    INFO:onlinejudge._implementation.logging:[x] redirected: https://codeforces.com/profile/rds__98
    INFO:onlinejudge._implementation.logging:[x] 200 OK
    INFO:onlinejudge._implementation.logging:[*] You have already signed in.
    INFO:onlinejudge._implementation.logging:[x] save cookie to: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
    {
      "loggedIn": true
    }
    
    competitive/Cpp/output on  master [!?] via 🅒 base took 3s 
    ➜ oj-api submit-code https://atcoder.jp/contests/abc173/tasks/abc173_c --file main.cpp --language 3023 | jq .result
    INFO:root:online-judge-api-client 10.2.1
    INFO:root:sleep 1.000000 sec
    INFO:onlinejudge._implementation.logging:[x] problem recognized: AtCoderProblem.from_url('https://atcoder.jp/contests/abc173/tasks/abc173_c'): https://atcoder.jp/contests/abc173/tasks/abc173_c
    INFO:onlinejudge._implementation.logging:[x] contest recognized: <onlinejudge.service.atcoder.AtCoderContest object at 0x7f9b6228f970>: https://atcoder.jp/contests/abc173/tasks/abc173_c
    INFO:onlinejudge._implementation.logging:[x] service recognized: AtCoderService.from_url('https://atcoder.jp/'): https://atcoder.jp/contests/abc173/tasks/abc173_c
    INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
    INFO:onlinejudge._implementation.logging:[x] GET: https://atcoder.jp/contests/abc173/tasks/abc173_c
    INFO:onlinejudge._implementation.logging:[x] 200 OK
    ERROR:onlinejudge._implementation.logging:[ERROR] not logged in
    ERROR:root:login required
    Traceback (most recent call last):
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/main.py", line 285, in main
        result = submit_code.main(problem, file=parsed.file, language_id=parsed.language, session=session)
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/submit_code.py", line 31, in main
        submission = problem.submit_code(code, language_id=language_id, filename=str(file), session=session)
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/atcoder.py", line 884, in submit_code
        assert language_id in [language.id for language in self.get_available_languages(session=session)]
      File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/atcoder.py", line 874, in get_available_languages
        raise NotLoggedInError
    onlinejudge.type.NotLoggedInError: login required
    null
    Kimiyuki Onaka
    @kmyk
    @rishabhdeepsingh for conflict of envvar, use env command (https://man7.org/linux/man-pages/man1/env.1.html) or the standard feature of your shell (https://man7.org/linux/man-pages/man1/bash.1.html#SIMPLE_COMMAND_EXPANSION)
    @rishabhdeepsingh oj-api login-service https://codeforces.com logs in to Codeforces and oj-api submit-code https://atcoder.jp/contests/abc173/tasks/abc173_c submits to AtCoder. AtCoder is not Codeforces, so you need to login AtCoder.
    Kimiyuki Onaka
    @kmyk
    BTW, oj-api command is a utility for developers. If you are just a competitor, please use a wrapper for end-users, e.g. oj command https://github.com/online-judge-tools/oj
    RishabhDeep Singh
    @rishabhdeepsingh
    Ohh So I might be using the wrong one
    RishabhDeep Singh
    @rishabhdeepsingh
    I submitted the code It was successfully submitted but Why I am getting submission failed
    [x] both GCC and Clang are available for C++ compiler
    [x] use: GCC
    [*] chosen language: 61 (GNU G++17 9.2.0 (64 bit, msys 2))
    [!] the problem "https://codeforces.com/problemset/problem/1375/D" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
    [x] sleep(3.00)
    Are you sure? Please type "D" D
    [-] submission failed
    Kimiyuki Onaka
    @kmyk
    @rishabhdeepsingh The feature to logging in Codeforces doesn't work by the issue online-judge-tools/api-client#73. The feature to submit may the same. It's quite difficult issue, so please wait until the issue is resolved. thx
    Kimiyuki Onaka
    @kmyk
    @rishabhdeepsingh The submission failed didn't happen on my environment. I guess that your failure may be affected by online-judge-tools/api-client#73 and removing the cookie (the path is printed in the log output) and re-login may solve the issue.
    RishabhDeep Singh
    @rishabhdeepsingh
    Thanks a lot will try that.
    Blue edge
    @blueedgetechno
    How can i prevent oj from opening the browser after submission
    Blue edge
    @blueedgetechno
    I got my answer
    ryo-n
    @ryo-n
    はじめまして。online-judge-toolsの出力結果って標準出力ではなく標準エラー出力されていると思うのですが何か理由あるのでしょうか
    ryo-n
    @ryo-n
    デフォがstderrだからですかね。https://docs.python.org/ja/3/library/logging.handlers.html#logging.StreamHandler
    ryo-n
    @ryo-n
    @kmyk 一応メンションしておきます。標準出力が適切でしたら、PR作っておきます。
    Kimiyuki Onaka
    @kmyk
    @ryo-n 標準エラー出力であるのにあまり深い理由はなく、「logging のデフォルトが stderr だからたまたまそうなっている」という予想は正しいです。
    Kimiyuki Onaka
    @kmyk
    どちらかといえば標準出力の方がよさそうだとは思います。しかしいまさら変えるとそれなりの破壊的変更になってしまうという問題があります。ちょうどメジャーバージョンを上げるのでこれがマージされるまでにプルリクを貰えればマージします (online-judge-tools/oj#817 )。これを過ぎると「なぜ変更する必要性があるか説明する」とか「変更しても他の oj と連携しているツールは壊れないことを確認してまわる (atcoder-cli と oj-verify だけ見れば十分だとは思うけど)」みたいな作業が必要になります
    ryo-n
    @ryo-n
    download_historyの仕様を変えたいな と思いました。atcoder-cliのcontest.acc.jsonみたいな感じでProblemディレクトリ毎にあっても良いのかなと思いました。
    (自分がgithubでソースコードを管理し、複数マシンで競プロやったりすることがあるので保存先がCacheディレクトリだと同期されず不便)
    ただojはatcoder-cliに比べディレクトリ構成が柔軟だと思うので、あまり良い配置場所は分かっていないです。もう少しojの仕様を調べようと思います。
    Kimiyuki Onaka
    @kmyk
    download_history をディレクトリごとに置くのは避けたいと考えています。「(ユーザにとっての分かりやすさとメンテの楽さのために) 挙動をできる限り単純にする」という基本方針があり、その実現手段のひとつに「設定ファイルは作らない」があります。これより強い要求「ペナルティを発生させない (URL を手で指定すると提出先ミスによる WA に繋がるのでよくない)」 により例外として作られたのが download_history です。このような背景の下で「複数マシンで競プロをするときに不便である」はこの方針に対する例外を増やす理由として十分ではないように感じられるためです。
    「提出ファイル中に URL が書かれていたらそれを利用する」なら可能であるように感じますが、現在の download_history との整合性やライブラリを貼り付けたときの安全性などについての検討が必要です。コンテスト中の提出ミスは即ペナルティなので用心が必要です
    Kimiyuki Onaka
    @kmyk
    (oj の機能はどれも「便利にするため」ではなく「コンテストの順位を上げるため」にある (例: 提出ミスを防ぐ) ことに注意してください)
    ryo-n
    @ryo-n
    背景説明ありがとうございます。コンテスト中に複数マシンを使うということは無さそうなので適した変更ではないこと理解しました。
    takizee
    @takizee
    can i generate additional strong test cases for a given problem ??
    Kimiyuki Onaka
    @kmyk
    Yeah, we can generate additional test cases. However, you need to write a test case generator for a given problem by yourself.
    There is a oj-template command in https://github.com/online-judge-tools/template-generator for this purpose. This command can generate a template of the test case generator of a given problem. Please try this!
    takizee
    @takizee
    thanks @kmyk i'm gonna check it out
    @kmyk
    but this seems like it generate a template code for the problem , it does not generate test cases
    Kimiyuki Onaka
    @kmyk
    It can also generate a generator of test cases. You can generate test cases by the generator. Please run oj-template -t generate.py https://judge.yosupo.jp/problem/staticrmq for example
    Dibyojyo
    @Dibyojyo
    Hello I had a question, for running the tests what if I want to skip some tests, how should I do it??
    But don't wanna delete those cases
    Kimiyuki Onaka
    @kmyk
    You can use only some test cases with specifying via command line arguments. For example, $ oj t test/sample-{1,2}.* runs tests against the sample 1 and 2, and ignores other tests even if they exist.
    yyykt
    @yyykt
    はじめまして.
    template-generator の v4.8.0 ( online-judge-tools/template-generator#77 ) から,常にstd::がつくように変更されていますが,何か理由があるのでしょうか.
    data["config"]["using_namespace_std"]のオプションでstd::の有無のスタイルを切り替えられること自体は(どちらがdefaultかはさておき)いい仕様だったように思うのですが.
    Kimiyuki Onaka
    @kmyk
    常に std:: を付けるようにしたのは内部の実装を単純にするのが目的です。自動生成されるコードに std:: が付くか付かないかを気にする人は少ないだろうと考え、コードの整理の際に邪魔だったのでついでに消したという記憶があります。
    Kimiyuki Onaka
    @kmyk
    ユーザにとっての機能として見たときにはあって邪魔になるものではないので、もし復活させるプルリクを送ってくれればマージします
    yyykt
    @yyykt
    回答いただきありがとうございます.そういった経緯だったのですね.
    実際大した問題ではないのですが,自動生成されたコードと自分で書いた部分とで統一感が無いのが少し気になったもので.
    プルリク作成しておきます.
    Kimiyuki Onaka
    @kmyk
    This error comes from Python 3.5 (sorry for confusing error message...). Please upgrade your Python interpreter to the version 3.6 or later.
    Python 3.5 is enough old, 7 years old now, and already reached its end-of-life (see https://endoflife.date/python). The recent versions of oj don't support it.
    Vikram Mathur
    @iamathur_twitter
    @kmyk thanks you. I install in conda env. and it working now. thanks for you support.
    Koura
    @Koushi-i
    C#を利用することはできますか?
    また、テストのコマンド(C#)は何ですか?
    Kimiyuki Onaka
    @kmyk
    C# も利用できます。C# のプログラムを普通に実行するときのコマンドを -c オプションに渡して $ oj -c COMMAND のように実行してください
    Nalin Abrol
    @nalinabrol

    Hi, Im unable to login to codeforces using oj command

    oj login https://codeforces.com ─╯
    [INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.0)
    [NETWORK] GET: https://codeforces.com/enter
    [NETWORK] 200 OK
    [FAILURE] You are not signed in.
    [ERROR] Selenium is not installed. Please run $ pip3 install selenium
    [WARNING] Switch to use CUI-based login instead of Selenium
    [NETWORK] GET: https://codeforces.com/enter
    [NETWORK] 200 OK
    Username: testKJ2
    Password:
    [ERROR]
    Traceback (most recent call last):
    File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge_command/subcommand/login.py", line 195, in run
    login_with_password(service, username=args.username, password=args.password, session=session)
    File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge_command/subcommand/login.py", line 49, in login_with_password
    service.login(get_credentials=get_credentials, session=session)
    File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge/service/codeforces.py", line 46, in login
    form = utils.FormSender(form, url=resp.url)
    File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge/_implementation/utils.py", line 77, in init
    assert isinstance(form, bs4.Tag)
    AssertionError
    [INFO] save cookie to: /Users/vibhorabrol/Library/Application Support/online-judge-tools/cookie.jar