variety-jones's blog

By variety-jones, 3 years ago, In English

Demo, Download Instructions

CF Doctor is a cross-platform, no-code CLI for real-time stress testing. It can help you find the smallest possible counter-example for your failing submission, right from the comfort of your terminal.

It does everything that cfstress does and more.

Features

  • Customizable : It offers the highest level of customization. For example, you can say,

    Give me a counter example containing 273 testcases. Also, for each testcase, the array length should be in the range $$$[23, 35]$$$ and each array value should be in the range $$$[57, 63]$$$.
  • Fast : It can evaluate your code on $$$10, 000$$$ small test cases within $$$60$$$ seconds to generate a counter example.
  • Light Weight : The portable binary is only around $$$12$$$ MB in size.
  • Effective : Out of the $$$5000$$$ requests served so far by cfstress.com, my internal analysis shows that it has a success rate of $$$> 90\%$$$.
  • Cross Platform : Developing on Windows and can't get that bash script to run? We've got you covered.
  • Deterministic : For a fixed set of parameters, the input sequence is fixed. This makes it the equivalent of an online judge that has an infinite stream of fixed system test.
  • Real-time: Built on top of gRPC, CF Doctor establishes a persistent connection to the server to stream the progress of stress testing in real time. It's as if the tests where running on your machine, without you devoting the time and resources for the generator. This leads to faster feedback cycles.

Usage

Just download the binary using the instructions above. After that, just run cfdoc help

Note

1) It only supports contests conducted after 28th January, 2022.
2) While in Beta, concurrency support has been disabled. If you experience a large waiting time during peak hours, you can use cfstress.com which is designed to handle multiple requests.

Full text and comments »

  • Vote: I like it
  • +60
  • Vote: I do not like it

By variety-jones, 3 years ago, In English

TL;DR: I've created a tool using which you can get additional sample input/output (for recent problems), which you can then analyze on paper to help you get closer to the solution. Check it out at cfstress.com

  1. You come up with an approach, and since you are too impatient, start implementing it. Your code passes the sample testcase, but it gets WA on Pretest 2. However, if you'd have 2 or 3 more sample test cases, you would've either abandoned the implementation after spotting the flaw, or you would've been more careful while coding, keeping those extra samples in mind.
  2. You are at a loss of idea, and you turn to the editorial for hints. But not all editorials have hints, and the comment section has spoilers. If you work out more sample testcases on paper, it'd get you a bit closer to the solution idea. (Not true for all problems, but it's a good strategy in general). You just need to have patience.
  3. You read an editorial and instantly comment

    I could not get the editorial of X, can someone explain?

    What helps in this situation, I believe, is to pick up a small testcase, and on paper, go through each step of the editorial. (If it has linked code, dry run that code on the input). Repeat this 3 to 4 times, and you might have a better understanding of the editorial.

To help with the above, I've created a tool which can give you small testcases to work with. It's highly customizable, i.e, you can ask for as specific test case as you want. For example,

Give me a sample where the number of testcases is 3, the array size should be 7, the array elements should be between 3 to 9 and so on...

You can check it out at cfstress.com. Oh, and did I tell you? It can also give you a small failing test case for your WA solution.

Note: It only works for contests that were conducted on or after 22nd January, 2022.

Contribution: I'm planning to make the generator repo for this project open-sourced in a couple of days. If you ever use this tool, and it proves to be helpful, do contribute to the project by adding generators for at least one problem. It'd hardly take you 5 to 10 minutes if you've solved/upsolved the problem.

Full text and comments »

  • Vote: I like it
  • +27
  • Vote: I do not like it

By variety-jones, 3 years ago, In English

cfstress.com

CF Stress is a highly customizable, no-code tool to stress test Codeforces problems.

You control all the parameters of the generator without writing a single line of code. Feeling lazy and want to pin down the error to an array of length 5? You can do that by adjusting the flags passed to the generator. Feeling adventurous and want to test your logic on test cases of length 1000? There's an option for that too. There's also a builtin diff checker for when you want to compare the output of large test cases. You can also seamlessly copy the input/output to your local machine.

Just plug in your submission ID and wait for the ticket to be processed.

It also has support for non-unique answers and interactive problems. The testcases are generated using testlib, the framework that's used to create the original test set.

Note: It only supports C++ and Python submissions for now. (For Java, I could not figure out how to make the name of the file the same as the class name).

A Sample Result

If this proves to be useful, I'll add more features, such as user accounts to view tickets in one place, emailing the user on successful completion of the ticket, better concurrency support to handle multiple tickets, revamped UI, etc.

If you have any feedback/suggestions, or if you'd like to collaborate, please let me know in the comments (or drop me an email).

Full text and comments »

  • Vote: I like it
  • +126
  • Vote: I do not like it

By variety-jones, 3 years ago, In English

cfdebug.org ==> Moved to cfstress.com

Hello everyone, have you ever faced a situation where you get a non-AC verdict on a certain testcase, but you are unable to debug your solution because you can't analyze (or view) that large testcase? or you are pretty close to the the solution, but don't want to look at the editorial yet, and wished you had more (small) testcases to brainstorm on paper? or a situation in which you feel you could've debugged your solution better if you could just run them on the hack-testcases (which are usually placed at the end of the test-set)?

I've created cfdebug.org cfstress.com to help you in the above situations. It's a tool through which you can see all the small/corner testcases for any problem on Codeforces. By defult, it's sorted by input size (so that it's easier to dry run on paper), but if you get WA on, say TC19, you can filter it to remove all smaller testcases with index less than 19. This way, you'll have access to the next smallest testcase for you to debug.(Temporarily removed). You can also copy the input/output to test the program seamlessly on your local environment.

It works best for older problems, where we did not have multiple testcases per input, and the individual inputs were carefully placed later in the test-set.

The workflow is same as before, enter the contest_id (which you can find by looking at the URL of a problem) and problem_index, and click on Stress Test. On the next screen, click on View Hacks to view all the smaller testcases in the test set.

Let me know your feedback/suggestions/feature-requests in the comments.

Full text and comments »

  • Vote: I like it
  • +57
  • Vote: I do not like it

By variety-jones, 3 years ago, In English

It's been around 5 years since Polygon API was released by MikeMirzayanov. However, at the moment, it does not have any official API wrapper for Go (or any other language, for that matter).

Since I needed to work with the API for a specific use-case, I decided to write the library myself. The Go package is published on Github, you can find the detailed package documentation for the library on the Go Package Website and a good number of examples to get familiar with the API and the packages on Github. You can use this in conjunction with Cobra to create command line applications tailored to your needs.

At the moment, it has all the custom objects mentioned in the API documentation, and all but one API method.

Feedback, suggestions and Pull requests are welcome.

Full text and comments »

  • Vote: I like it
  • +27
  • Vote: I do not like it