Coder Social home page Coder Social logo

xalanq / cf-tool Goto Github PK

View Code? Open in Web Editor NEW
1.3K 10.0 218.0 2.7 MB

:bar_chart: Codeforces CLI (Submit, Parse, Test, etc.). Support Contests, Gym, Groups, acmsguru, Windows, macOS, Linux, 7 MB

License: MIT License

Go 100.00%
codeforces golang cross-platform cli

cf-tool's People

Contributors

bbbob avatar gaurangtandon avatar gnojus avatar lucifer1004 avatar tribleave avatar user202729 avatar xalanq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cf-tool's Issues

Clone someone's AC codes

There is a easy way to clone ourselves codes by this bash script

for((i=1;i<=2000;i++)); do cf pull ac $i; done

But it cannot clone other's codes and seems like not good.
So, I decide to add a new command clone for cloning someone's codes.

Race only works on virtual contests

What does race actually do? Is it intended to work on contests that are yet to be held?
In my observation, cf race command works well for a virtual contest. However, for a real-time contest that is going to be held, cf race gives a message Cant find countdown. I tested this on the global round yesterday, and it gave the above message...

Pull my latest code submitted.

Would you like to add a new function?
For example, I have been trying to solve a hard problem for a long while, but not succeed.
However, there are too many versions of code on my computer and on the Codeforces.
So I think if I can pull my latest code from Codeforces, the situation will be improved.

Navigate to created directory on parse

Navigating to the problem code folder on parsing individual problems, and to the contest folder on contest parse would be very helpful. Almost always I execute cd <contest code>/<problem code>/ when parsing individual problems, and cd <contest code>/while parsing an entire contest.

Wrong error message for PDF based problem statements

The message on trying cf parse 180 a is very confusing:

Failed 180 a
Not logged. Try to login
Login sigma_g...
Succeed!!
Failed 180 a
Not logged in

Note that 180A is not available as a webpage but as a PDF, perhaps that is what contributes to the error.

So, could the error message be fixed?

cannot set proxy

I use company wifi. I cannot set proxy of the cf client. Can you add this feature?

watch 指令增加查看某一道题的提交记录的功能

目前使用 watch 指令可以查看某一场比赛的提交记录,已经非常实用了。不过在某些情况下我希望只查看某一题的历史记录,希望能够增加一下这个功能。

It's very useful to use watch to search my previous submissions in a single contest, but sometimes I want to check my submissions on a single problem, hope you can add this feature.

Can the password be moved to a separate file?

I'm thinking about using git to store my configuration files online, however from my reading of the source code, given a .cfconfig file it's possible to get the plain text password.

Is it possible to move the password to a separate file (for example .cfcredential)? For reference, git supports storing password indefinitely, but the password is stored (in plain text) in the ~/.git-credentials file.

Warn of non standard IO while running cf test

Consider this question: https://codeforces.com/problemset/problem/35/D It uses non-standard IO.

Far too many times I find myself running cf submit immediately after cf test passes. It would be useful if cf test would warn me that the problem requires non-standard IO, so that I would add the corresponding freopen statements to my C++ source code before submitting the code instead of getting a RE on test 1.

Open the combined problem list on cf parse

Instead of opening all problems in seperate tabs while parsing, the combined list can be viewed by opening link : https://codeforces.com/contest/<contest-id>/problems.

submit的bug

:~/codeforces/1161/f$ cf submit
There are multiple language match the file.
  0: GNU G++11 5.1.0
  1: GNU G++11 5.1.0
Please choose one(index): 
1
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/xalanq/cf-tool/cmd.getOneCode(0xc000075830, 0xc00000a5a0, 0x1, 0x4, 0x0, 0x1, 0xb, 0x15, 0x0)
	C:/project/go-project/src/github.com/xalanq/cf-tool/cmd/cmd.go:169 +0x58e
github.com/xalanq/cf-tool/cmd.Submit(0xc000075830, 0x0, 0x0)
	C:/project/go-project/src/github.com/xalanq/cf-tool/cmd/submit.go:27 +0x116
github.com/xalanq/cf-tool/cmd.Eval(0xc000075830, 0xc000075830, 0x7a0e85)
	C:/project/go-project/src/github.com/xalanq/cf-tool/cmd/cmd.go:24 +0x637
main.main()
	C:/project/go-project/src/github.com/xalanq/cf-tool/cf.go:122 +0x1e9

这里选0会正常提交,但是选1会报错

系统:ubuntu 18.04

Direct link to submission after cf submit

It would be helpful to provide a direct link to a submission after cf submit. This can be especially helpful if I get non-AC verdict and wish to investigate further the particular test case.

I think we need to add one more line around the display function.

func (s *Submission) display(first bool, maxWidth *int) {

Something like:

ansi.Printf(" link: %v\n", "https:codeforces.com/contest/<contest-id>/submission/<submission-id>")

Print more descriptive error on cf parse

For some unknown reason since today I had been unable to parse any problem. After few minutes fiddling with it I finally figured out I was logged out. I do not understand why I got logged out in the first place, but even if I was, a simple error message could have helped me resolve the issue quicker.

From the code it is clear the code already knows the problem that leads to an error (the variable err). So, I think we only need to display that error along side the Failed message here.

color.Red("Failed %v %v", contestID, problem.ID)

Thoughts?

Way to add new tests of our own to a problem

Hi, thanks for the wonderful tool! I have a feature request.

Before submitting the problem, I usually do a few sample tests of my own too. Currently, I maintain an input file, so once I've thought and written a test, I won't have to retype it again.

With your setup, I feel I could be more productive in doing so. So, basically, I'll run a command like cf add-test. Then you'll prompt me for the input and the output, and then put them into files inK.txt and ansK.txt (K = integer) inside my working directory. So, that the next time I run cf test, these files will also be checked for correctness.

Thoughts? I don't know much golang but if you need help I'll be more than happy to help out.

Make `cf parse` accept URL [enhancement]

[]$ cf parse 1251 f
Parsed 1251 f with 2 samples

[]$ cf parse https://codeforces.com/contest/1251/problem/F
Get statis in gym https://codeforces.com/contest/1251/problem/F
Not logged. Try to login
Login user202729_...
Succeed!!
Get statis in gym https://codeforces.com/contest/1251/problem/F
Not logged in

It would be more convenient if cf parse accepts URL, so it's easier to copy the problem link from the browser.

Pressing Ctrl-C on cf submit disables recurring status updates?

I have noticed that ever since yesterday, when I had pressed Ctrl-C to prevent an accidental submission, I have not been getting recurrent updates to the status text. So, the text of cf submit remains stuck at the following even after one or two minutes when it has changed to Accepted on Codeforces:

Submit 1176 C GNU G++14 6.4.0
Current user: sigma_g
Submitted
      #: 55360388
   when: 01:09:46
   prob: C - Lose it!
   lang: GNU C++14
 status: Running on test 1
   time: 0 ms
 memory: 0 B

I have tested this during and outside a contest, my solution took hardly took a half a minute to judge, so I am really not sure what's the issue here. I am using v0.5.3

Bug in command[Pull]

When I use command [pull] to pull my code from contest 1156 problem b.

The code I got is the code in the problem statement instead of the code I submitted.

[Feature needed] Problem solving statistics

I guess most of users use this tool to do exercise on codeforces. So I hope this tool has the feature.
The command "cf stats" returns statistics of user's problem solving statistics. Like solved&unsolved problems number, AC ratio, solved&unsolved problem in some tags(like string, math, etc). I think this feature can make users have a better knowledge of their problem solving status in codeforces.

cf tool logs out daily

Every day, the cf tool logs out and I have to login again. Any fix for this?
This didn't occur in the previous revisions(I think 5 revisions back)

submit not working

Everything was working all right today and suddenly I started getting this:

Submit 1186 A Haskell GHC 8.6.3
Not logged. Try to login
Login lmno...
Succeed!!
Submit 1186 A Haskell GHC 8.6.3
Not logged in

And it exits

I was already logged in, and even if I log in again (which goes fine), I get the same when submitting.

Codeforces Tool (cf) v0.8.2

Thank you!

cf test doesnt work on recieving WA verdict

Steps to reproduce:

  1. Make a custom input test file along with some wrong answer.
  2. Execute the command cf test. The diff in expected output and recieved output is printed.
  3. Rerun cf test. It hangs on compiling.
  4. Try cf test on some other code. It works fine.

This is my compiler command : g++-8 -g -O2 $%file%$.cpp -o $%file%$.out

How can we speed up the submit feedback?

I find that when i use "cf submit" command to submit my solution then the cmd need much long time to get feedback about result,sometime it will error because of "net/http: TLS handshake timeout".By the way,I use shadowsocks global proxy mode to open codeforces in China.
我发现在我使用cf submit 命令后 往往需要很长时间才能获得提交的反馈,而且如果不用ss的全局模式无法访问codeforces(我平时使用PAC模式访问),请问有改善的方式吗?

Show memory usage of the program on `cf test`

Is it possible to show memory consumption of program alongside the verdicts...

Passed #1 .... 0.002s/192K
Passed #2 .... 0.002s/192K
Passed #3 .... 0.002s/192K
Passed #4 .... 0.030s/10M

and highlight in red if it exceeds the memory limit mentioned on the problem page? I am asking because I recently overran memory by accidentally using a 5000x5000 long long int 2D vector, and got an MLE later.

Bash aliases in the before_script and after_script

I have defined a custom bash alias gww that is basically a wrapper for g++ with lots of warning flags added.

I wish to use gww in the before_script parameter of my .cfconfig template.

However, it fails with:

gww f.cpp -o f -g
exec: "gww": executable file not found in $PATH

I even tried

source ~/.bash_aliases && gww f.cpp -o f -g
exec: "source": executable file not found in $PATH

Could you suggest any alternatives? (apart from having to create a gww executable andn adding it to path)

Cf parse should attempt to login instead of failing directly

Hi, sorry for spamming with so many requests. This isn't really urgent so feel free to take your time :)

I have noticed that if I perform cf parse without being logged in (and I have no idea why I always get logged out after a day or two), it just fails. See #11.

However, if I perform cf submit, it tries to log me back in if I am logged out.

Submit 1169 C GNU G++14 6.4.0
Not logged. Try to login
Login sigma_g...
Succeed!!
Submit 1169 C GNU G++14 6.4.0

Could similar feature be added for cf parse? I looked up the code and it seems the `loginAgain function is needed somehow.

func loginAgain(cfg *config.Config, cln *client.Client, err error) error {

cf gen should be executed automatically

cf gen and cf parse should go hand in hand, atleast while parsing individual problems.
Running cf parse should also run cf gen in the respective directories.

`cf test` runs "inx.txt" instead of my code

Hi, thanks for this great tool! On Archlinux, I copy cf into my ~/bin. Then do cf config add and add my template (python). Then cf parse 456 a and cd 456/a. Manually create pr.py file. And on cf test it fails with this:

[art@arch-pc a]$ ls
ans1.txt  in1.txt  pr.py

[art@arch-pc a]$ cf test
  File "<stdin>", line 2
    1 2
      ^
SyntaxError: invalid syntax
Runtime Error #1 ... exit status 1

Config: cat ~/.cfconfig:

[art@arch-pc a]$ cat ~/.cfconfig 
{
  "username": "xxx",
  "password": "xxxx",
  "template": [
    {
      "alias": "py",
      "lang": "31",
      "path": "/home/art/.codeforces/template.py",
      "suffix": [
        "py"
      ],
      "before_script": "",
      "script": "python3",
      "after_script": ""
    }
  ],
  "default": 0
}

Template:

[art@arch-pc a]$ cat ~/.codeforces/template.py 
#!python3

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest


def read_int():
    return int(input().strip())


def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.