xalanq / cf-tool Goto Github PK
View Code? Open in Web Editor NEW:bar_chart: Codeforces CLI (Submit, Parse, Test, etc.). Support Contests, Gym, Groups, acmsguru, Windows, macOS, Linux, 7 MB
License: MIT License
:bar_chart: Codeforces CLI (Submit, Parse, Test, etc.). Support Contests, Gym, Groups, acmsguru, Windows, macOS, Linux, 7 MB
License: MIT License
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...
[]$ 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.
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模式访问),请问有改善的方式吗?
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
.
Why this shows when I run "cf race #(some contest id)"
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)
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)
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(' ')]
######################################################
The system cannot move the file to a different disk drive
Solution: https://stackoverflow.com/questions/50740902/move-a-file-to-a-different-drive-with-go
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.
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?
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.
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.
:~/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
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.
It would be extremely usefull if you make a vscode extension. Many users use vscode for cp and integrating this tool in the vscode framework would save time for a lot of them.
一闪而过,根本写不了啊
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.
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
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.
Line 127 in d172e3f
Something like:
ansi.Printf(" link: %v\n", "https:codeforces.com/contest/<contest-id>/submission/<submission-id>")
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.
国内访问 https://codeforces.com
相对较慢,希望能够加入 https://codeforc.es
。
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.
Although it's able to use global proxy, it's better to be able to set proxy for cf-tool.
Is it legal?
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!
Just change contest
-> gym
in URL
I use company wifi. I cannot set proxy of the cf client. Can you add this feature?
I know this is trivial, but can a bash completion script be made for this?
Is there any way to just open the complete problems set but not all the problems when "cf race xxx" is processed?(I know nothing about go)
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.
Line 178 in 55bbcf0
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.
Line 111 in 1d2bc16
Thoughts?
I got a red message below:
x509: certificate has expired or is not yet valid
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.
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.
目前使用 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.
I'll try to make it as same as Codeforces.
Can a default option be added to pull only AC solutions from a given contest?
Steps to reproduce:
cf test
. The diff in expected output and recieved output is printed.cf test
. It hangs on compiling.cf test
on some other code. It works fine.This is my compiler command : g++-8 -g -O2 $%file%$.cpp -o $%file%$.out
例子:
388/1207 Error in 1131|50410105: Too many requests. Waiting for 500 seconds to continue.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.