Skip to content

prasoonbatham11/cfcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cool cfcli Logo

Codeforces cli for lazy nerds who don't want to leave their cozy terminals.

License Python

Installation

pip install cfs

OR

git clone https://github.com/prasoonbatham11/cfcli.git
python3 setup.py install

Usage

Use -h or --help to see usage.

cfs -h

View User Details

# Shows basic details of the user specified
cfs -u prasoonbatham

View Rating Graph of User

# Shows Rating change graph of user
cfs -g prasoonbatham

Rating Graph of user is displayed as a gnuplot.

View Contest Details

Contest ID can be found in the url of contest such as: /contest/1137/.

# Shows details of contest specified by contest id
cfs -c 1137

# To view Contests from gym
cfs -c 102134 --gym

Interact With Problemset Subcommand Interface

These commands retrieve the specified problemset (by tag or whole) and open a python cmd sub-terminal where various other actions can be performed.

# Loads all the problems
cfs -p

# Specify a problemset tag
cfs -p --tag dp

The sub-interface has the following commands:

  • View available commands: ?
  • List n Problems (max 15): list n
  • Reset the pointer to list problems: reset
  • List problems of contest id 'cid': listc cid
  • List 10 problems specified by index: listi index
  • View problem details specified by name: listn name
  • View problem details specified by index: prob index
  • View problem statement specified by contestid+index: stat 1133A

Say the following is the output for 8 problems

cf> list 8
0: Circus
1: Sushi for Two
2: Matches Are Not a Child's Play 
3: Train Car Selection
4: Cooperative Game
5: Museums Tour
6: Camp Schedule
7: Skyscrapers
cf> list 8
8: Spanning Tree with One Fixed Degree
9: Spanning Tree with Maximum Degree
10: K Balanced Teams
11: Zero Quantity Maximization
12: Balanced Team
13: Preparation for International Women's Day
14: Middle of the Contest
15: Greedy Subsequences
cf> 

To reset the pointer back to 0 we use reset command.

Similar to list, listc is used to list problems of a particular contest.

cf> listc 1133
8: Spanning Tree with One Fixed Degree
9: Spanning Tree with Maximum Degree
10: K Balanced Teams
11: Zero Quantity Maximization
12: Balanced Team
13: Preparation for International Women's Day
14: Middle of the Contest

In codeforces every problem has an index ('A', 'B', etc.). To view the problems by index use listi. To reset the pointer, again use reset command.

cf> listi B
0: Circus
6: Camp Schedule
13: Preparation for International Women's Day
20: Discounts
27: Draw!
30: Two Cakes
35: Wrong Answer
39: Mike and Children
45: Once in a casino
53: Tanya and Candies

listn and prob are used to view problem details by name and serial number respectively

cf> listn Sushi for Two
        |Problem Details

        |Name            :    Sushi for Two
        |Contest ID      :    1138      
        |Index           :    A         
        |Points          :    500.0     
        |Rating          :    900       
        |Solved By       :    3940      
cf> prob 0
        |Problem Details

        |Name            :    Circus    
        |Contest ID      :    1138      
        |Index           :    B         
        |Points          :    1000.0    
        |Rating          :    1700      
        |Solved By       :    1147 

To view any problem statement use stat command. This opens a paged output where you can see problem statement.

cf> stat 1133A

View A Blog Entry Specified By Blog ID

Blog ID can be found in the url of blog such as: /blog/entry/14565/.

# View blog specified by blog id
cfs -b 14565

The blog is displayed in a paged output with a proper comment thread. The comment thread is hierarchical, i.e., a reply to a comment is separated by one tab space from its parent comment.

View Rating Change For Users In A Contest

# View blog specified by blog id
cfs -rc 1137

# Specify a particular handle
cfs -rc 1137 --handle Petr

Get Blog Entries Of A User

# Get all blog entries of Petr
cfs -bu Petr

The subcommand interface is implemented using cmd python package and has the following commands.

  • View available commands: ?
  • List n Blog Entries (max 15): list n
  • Reset the pointer to list blog entries from: reset
  • View particular blog entry specified by index: vidx 65854
  • View particular blog entry specified by serial no: viewi 13

Say we get the following output by running list 5 for user Petr:

cf> list 5
0: 65854   An oracle week
1: 65574   A WTF week
2: 65328   A snack week
3: 65152   A tourist week
4: 64991   A mumbling week

Running list 5 again will return the next 5 entries.Now an internal pointer idx points to entry 10. To reset it we run reset.

cf> list 5
5: 64854   A Galois week
6: 64669   An anti-library week
7: 64501   A Dilworth week
8: 64349   A Radewoosh week
9: 64346   And the best problem of 2018 is...
cf> reset
cf> list 5
0: 65854   An oracle week
1: 65574   A WTF week
2: 65328   A snack week
3: 65152   A tourist week
4: 64991   A mumbling week
cf> 

To view the entry A galois week we can either run:

cf> viewi 5 

OR

cf> vidx 64854  

Get Submissions For A Specified User

To display all the submissions of the user use:

cfs -us prasoonbatham

You can also specify fr and count arguments to see count number of submissions from a particular index fr.

# Display 10 submissions from 5th index
cfs -us prasoonbatham --fr 5 --count 10

The default values for fr and count are 1 and 10 respectively. If either one of these are specified the other one takes default value.

For instance, if we want to retrieve 10 submissions from 5th index we can write.

# Here count takes the default value 10
cfs -us prasoonbatham --fr 5

Similarly,

# Display 20 submissions from 1st index
cfs -us prasoonbatham --count 20

View Contest Submissions

# Display contest submissions specified by contest id
cfs -cs 1137

Here too you can specify fr and count arguments to see submissions. And it works similar to user submissions.

# Display 100 submissions from index 50
cfs -cs 1137 --fr 50 --count 100

Another optional parameter to specify here is: handle which retrieves submissions only by the user specified.

# Display 10 submissions for user Petr from index 3 in contest 556
cfs -cs 556 --fr 3 --count 10 --handle Petr

Compare Two Users

cfs --compare prasoonbatham Petr

Seriously who am I comparing myself to!

TODO

  • Add Command for submitting a solution.
  • Improve rendering of problem statement.
  • Add proxy support.
  • Add command to recommend problems

Contribute