1. Installation
You need to download plug-in and configuration. Plug-in should go to %home_dir%\.IntelliJIdea10\config\plugins (if directory plugins is absent you need to create it), also you should include chelper.jar to class path of your project (Project Structure -> Dependencies -> Add Single Entry Module Library...). After that you need to edit configuration (see next section) and put it in project root. That's it — you are all set. For TopCoder you would need moj plugin for Arena, manual and download link is here

2. Configuration
As a general note, if some property in configuration represents a folder you must enter relative path from project root (using / instead of )
inputClass - full qualified name of class used for input (like java.util.Scanner). This class should implement method next that returns String — next token from input — and it should have constructor that takes InputStream as only argument
outputClass - full qualified name of class used for output (like java.io.PrintWriter). Ouput class shoud has constructor, that take OuputStream and one that take Writer as parameter and also method close.
excludePackages - comma separated list of package prefixes. Classes from such packages would not be inlined but rather imported. In most cases you should leave it as is
outputDirectory - directory where full source code would be stored. Should be under source and in default package (for example, if you create standart idea project, "src" spould be ok)
author - content of @author tag in. If empty no author tag would be created
archiveDirectory - directory where tasks would be archived. Should not be under source
defaultDirectory - direcory where tasks would be created by default. Should be under source in non-default package (for example src/my/package)
topcoderDirectory - directory where moj puts its TopCoder stubs. Should be under source in default package (e.g. src)
enableUnitTests - should be true if you want unit tests to be created and false otherwise
testDirectory - directory where tests would be stored. Shoud be under source
After configuration change you need to reload project for changes to take effect
3. Actions
I would recommend to add following actions on main toolbar (Customize Menus and Toolbars... from context menu of toolbar, actions are in Plug-ins->CHelper): New Task, Edit Tests, Archive Task, Delete Task, Create Codeforces Tasks.


New Task (Alt+F2) — creates new task in defaultDirectory
Edit Tests (Alt+F5) — opens test editor

Archive Task (Alt+F6) — archives task (deletes all it files and stores them in archive, also creates unit tests if configured to do so)
Delete Task - deletes task and all associated files
Parse Contest - creates all tasks for particular contest (currently Codeforces, CodeChef, E-Olimp and Timus are supported).

Parse Task - creates single task.

| Site | Contest ID | Problemset task ID | Contest task ID |
|---|---|---|---|
| Codeforces | contest_id (131) | contest_id letter (131 A) | contest_id letter (131 A) |
| CodeChef | contest_code (NOV11) | problem_code (GCD2) | contest_code problem_code (NOV11 DOMNOCUT) |
| Timus | contest_id (101) | problem_id (1000) | contest_id problem_number (101 1) |
Copy Source (Alt+F8) — copies content of Main.java to clipboard. This is useful for judges that do not support submission of file
4. New Task dialog

Name - task class name
Test type - type of tests — either single test per file, number of tests and then tests themselves or just some tests until some condition is met. You need to throw UnknownError in last case to indicate that there would be no more tests
Input type/Output type - input/output type. Standard — stdin/stdout, Task_id — file input/output with file names %Name%.toLowerCase() + ".in"/".out", Custom — just file input/output, names provided in separate text fields
Heap memory - memory limit
Stack memory - stack size limit (defaults are same as codeforces)
5. Task files
For each task 2 files is creates. In main task class there is one method:
void solve(int testNumber, %input% in, %output% out)
testNumber — 1-based index of test in file
In checker class there are 3 methods:
String check(%input% input, %input% expected, %input% actual)
should return null if answer is correct, non empty string if answer is wrong and empty string to run default checker
double getCertainty()
returns certainty for double comparision in default checker
Collection<? extends Test> generateTests()
additional generated tests
For TopCoder tasks the only class would contain method from problem statement. Task would be created automatically when you opens problem in TopCoder client (if moj properly configured)








I have some problems with your CHelper - plugin :-?
deleted
To Egor,
Your plugin have a few "bugs" with Topcoder SRM Task :D. I've used it on SRM 530 and 531 and found some issues :D
CHelper can't "parse" the task. When I open a task, there is only moj created code file and it isn't parsed into CHelper's TopCoder Task. I had this issue with task UnsortedSequence (SRM 531 — Div 2 — 250 Task), another tasks just work fine :)
Wrong example input/output parsed. I'm not sure it's CHelper's problem or just moj's :-?. Had this issue with task GogoXCake (SRM 530 — Div 2 — 500 Task), another tasks just work fine :)
Just a "report" for you :D, hope you will see and fix them soon :D
Again, thanks for such an useful plugin :D
I'll look into it
I too faced the same problem in 531 Div2 -250.
For SRM 531 D2 250 empty arrays were handled incorrectly. I will fix this ASAP As SRM 530 currently unavailable I'll look into that later
There is problem on creating ,parsing contest,none function work from toolbar
Please help me
Nothing is working or only contest parsing?
Now contest parsing work ,how will it generate automatically Main file,it is not working
This is my chelper.properties file inputClass = java.util.Scanner outputClass = java.io.PrintWriter excludePackages = java.,javax.,com.sun. outputDirectory = src author = Vikash archiveDirectory = archive/unsorted defaultDirectory = src/My topcoderDirectory = topcoder testDirectory = lib/test enableUnitTests = false
It should generate the Main file when you run or debug created configuration
When I select contest id 131(or any) in codeforces it doesn't generate any thing in default directory
Hi Egor, Can you tell me how the inline functions work...I cannot figure it out..Suppose I have a method isPrime(int) that returns whether the number is prime or not.I want to use it directly and not write the whole thing everytime.I think the inline code does exactly this.But I dont know how to use it.Could you tell me or better demonstrate it with an example???
You need to create some class, like IntegerUtils and create static method isPrime. Then you can use it in your solutions
And where do I have to save that class??
Anywhere it will be visible fromyour solution
I created a class algorithms in src and a static method isPrime(Object a) in that.Then I compiled it. After that when I go to a Task and write boolean check=algorithms.isPrime((Object)a) ,then it is shown in red .i.e. it cannot compile...What should I do...Should I have to restart??
Are you sure your method was public?
Yes it is public...Do I have to change something in the properties file or put the class in a directory under the src??
Well, it should be somewhere under source — just like for any Java project
Ok. now its working .When I created a new directory under src and put the class in it.Thanks for the replies and your time:-) The thing I dont like in this is that it is showing all the methods in that class even if it is not called but some other method of that class is called ..Can this be changed??
In the created source (the one you will submit to the server) all unused methods will be removed
When I submitted a problem in topcoder SRM 535 using IntegerUtils class it gave an error regarding too much unused code.I think that inline code is not working..Its definatley not working on codechef where I can see my submitted solution
That is bug in TopCoder algorithm, I receive that warning quite regular, but never had my submission judged as UCR violation after I started to use Java. Can you point to your codechef submit where inlining/unused code removal had not worked?
I have messaged it to you.
Check emotionalBlind's comment at the bottom, maybe you have same problem
I was solving a problem of Light OJ, but seems unused codes are not removed in my Main File.
Here is my code: http://ideone.com/gsgDb
Here readLong is not removed, which is actually unused.
Strange, not repetable on my computer By the way, you can use Test Type: MULTI_TEST, that's exactly why that type was created
Did you mean MULTI_NUMBER?
BTW, do you suggest me to do anything to make unused code remove working? I'm using chelper2.33.
Yes
It seems for whatever reason Idea considers readLong method as used. Could you open your created source (i.e. Main.java) in Idea and see if method name is grayed out as unused or not?
Yes, it was grayed out.
But problem is resolved now.
I changed outputDirectory = src from outputDirectory = src/output
And now it's working. Sorry, I think I didn't read the instructions carefully.
Thanks for this awesome software.
I changed the properties file and it does work for codeforces and codechef. And when I see my code at the topcoder practise arena it does indeed have the unused codes+every time I run the code for topcoder problems it gives a warning "OutPut directory should be under source and in defualt package " for only topcoder problems but then it runs...What should be done??
I had the same problem but it seems I had not configured my directories correctly. Now, it's ok. My directories in properties are: outputDirectory = src, archiveDirectory = archive/unsorted, defaultDirectory = src/mypackage, topcoderDirectory = src And make sure moj outputs to your src directory. Thanks for the great plugin, Egor!
Thank you for your plugin. It's great.
Thank you for your great work! But I can't find the "%home_dir%.IntelliJIdea10configplugins" means, so I can't continue to set up this plugin in my PC corrcetly.. Help! Thank you!
Launch IntelliJ and choose
File -> Settings -> Plugins -> Install plugin from disk -> path_to_chelper2.41.jarThank you for your reply! But I mean I don't know where to mkdir the IntelliJIdea10configplugins, that means I don't what "“%home_dir%" mean. Is it the Home directory "~/"? Thank you!
I fixed path that got broken after markdown introduction
Yes, that's home directory
Oh, got it! Thanks all~
BTW, in the Checker file, there are some imports I can not find in the project.. They are "import net.egork.chelper.task.Test; import net.egork.chelper.tester.Verdict;" And my config is " inputClass = lozy.InputReader outputClass = java.io.PrintWriter excludePackages = java.,javax.,com.sun. outputDirectory = src author = Lozy archiveDirectory = archive/unsorted defaultDirectory = src/cf topcoderDirectory = topcoder testDirectory = lib/test enableUnitTests = false " Is there any problem in my config file or should I do some other works? Thanks a lot!
"...also you should include chelper.jar to class path of your project (Project Structure -> Dependencies -> Add Single Entry Module Library…)"
Sorry for my carelessness... I didn't see the word "also"... Thank you for your reply and your time!
how can i use chelper in eclipse IDE ?
Idea plugins are incompatible with Eclipse