Code Marathon Platform
Complete User Documentation & Guide
Platform Overview
Code Marathon is a platform to conduct virtual coding competitions and games: as of now we have 2 games on it Bug Killer for hands‑on coding tasks with automated judging, and Radio Box for timed quizzes with multiple question types.
🐛 Bug Killer
Create coding challenges, attach test cases, assign participants, and auto‑grade solutions.
📋 Radio Box
Build quizzes with radio, checkbox, and image options, set points and duration, and deliver instantly.
💻 Code Editor
Run and test C/C++ code with terminal IO, syntax highlighting, and task-aware testing.
👥 Management
Bulk import/export users, bulk import tasks/quizzes, and customize branding.
User Roles
Getting Started
Login
- Launch the application.
- Enter your username and password (admins should change default (username: admin, password: admin) credentials on first login - preferred).
- Proceed to the dashboard to see available content.
Dashboard Areas
🏠 Home
View active tasks and quizzes assigned to you.
🎮 Playground
Create and manage Bug Killer tasks and Radio Box quizzes. Admin have access to create/edit the tasks
👥 Users
Add, edit, delete, bulk import, and export users (admin only).
⚙️ Settings
Customize home title, upload logo, and check updates (admin only).
User Management Admin
Add Single User
- Go to Users.
- Click “Add User,” fill Full Name, Username, Password.
- Click “Save” to create the account.
Bulk Import Users
- Click “Bulk Import.”
- Upload a .txt file or paste lines in the box.
- Click “Import Users” and review success/errors.
Format: name,username,password
John Doe,johndoe,password123 Jane Smith,janesmith,secure456 Bob Wilson,bobw,pass789 Alice Brown,aliceb,secret012 Charlie Davis,charlied,mypass345
- Invalid format: commas missing or extra columns
- Duplicate username: username already exists
- Empty fields: name, username, or password blank
Export Users
- Click “Export Users.”
- Choose a location and save the .txt.
Bug Killer (Tasks) Admin
Create a Task
- Open Playground and choose Bug Killer.
- Click “Add Task.”
- Fill basic info: Title, Duration, Description.
- Paste or write Code Template (optional but recommended).
- Open “Test Cases” tab and add test cases. (optional)
- Select participants (or leave empty to target all users if supported by your build).
- Save the task.
Example Task Setup
Title: Calculator Functions (Sum & Product)
Duration: 45 minutes
Description: Implement add() and multiply().
Template:
#include <iostream>
using namespace std;
int add(int a,int b){ /* TODO */ }
int multiply(int a,int b){ /* TODO */ }
int main(){ return 0; }
Test Cases Guide
There are three automated test case types: Standard I/O, Function Return, and Print Output.
1) Standard I/O
Example
Input:
5
3
Expected Output:
8
Participant Code:
#include <iostream>
using namespace std;
int main(){
int a,b; cin>>a>>b;
cout << (a+b) << endl;
return 0;
}
2) Function Return (supports multiple arguments)
Calculator Suite
Tests:
- add(15,25) -> 40
- subtract(50,18) -> 32
- multiply(7,8) -> 56
- average(10,20,30) -> 20
- power(2,10) -> 1024
- max3(45,23,67) -> 67
Solution:
#include <iostream>
using namespace std;
int add(int a,int b){ return a+b; }
int subtract(int a,int b){ return a-b; }
int multiply(int a,int b){ return a*b; }
double average(int a,int b,int c){ return (a+b+c)/3.0; }
int power(int base,int exp){ int r=1; for(int i=0;i<exp;i++) r*=base; return r; }
int max3(int a,int b,int c){ int m=a; if(b>m)m=b; if(c>m)m=c; return m; }
int main(){ return 0; }
Strings with Multiple Arguments
Tests:
- concat("Hello","World") -> "HelloWorld"
- repeat("AB",3) -> "ABABAB"
- slice("Programming",0,7) -> "Program"
Template:
#include <iostream>
#include <string>
using namespace std;
string concat(string a,string b){ /* TODO */ }
string repeat(string s,int n){ /* TODO */ }
string slice(string s,int start,int len){ /* TODO */ }
int main(){ return 0; }
- Arguments are comma-separated; strings should be quoted.
- Edge cases matter: negatives, zeros, and large values.
- Set a reasonable timeout (commonly 5 seconds).
Example Program
Tests:
1) Invalid Greet : This checks if it's outside the valid 24-hour clock range.
When the hour falls outside this valid range (0-23), it returns "Invalid hour!" as an error message.
Type Function Return: greet(-10) -> "Invalid hour!"
2) Good Morning Time Range : This checks good morning time range. When the hour
falls within this period (3 to 11), it returns "Good Morning" as the appropriate greeting.
Type Function Return: greet(6) -> "Good Morning"
3) Good Afternoon Time Range : This checks if the hour is between 12 and 16 to determine
the good afternoon time range. When the hour falls within this period,
it returns "Good Afternoon" as the appropriate greeting
Type Function Return: greet(13) -> "Good Afternoon"
4) Good Evening Time Range : This checks the good evening time range. When the hour falls
within this period (17 to 20), it returns "Good Evening" as the appropriate greeting.
Type Function Return: greet(18) -> "Good Evening"
5) Default Good Night Return : This handles all remaining hours not covered by the
previous conditions (morning, afternoon, evening ranges).
When the hour falls outside the other time periods (hours 0-2 and 21-23),
it returns "Good Night" as the default greeting
Type Function Return: greet(22) -> "Good Night"
6) hidden Type Function Return: greet(26) -> "Invalid hour!"
7) hidden Type Function Return: greet(3) -> "Good Morning"
8) hidden Type Function Return: greet(12) -> "Good Afternoon"
9) hidden Type Function Return: greet(17) -> "Good Evening"
10) hidden Type Function Return: greet(0) -> "Good Night"
11) String Variable Declaration and Assignment : This declares a string variable named "type"
and assigns it the value "Private". The string variable stores text data that
can be used to represent the office type classification in the program.
Type Function Return: myOffice.type -> "Private"
12) hidden Type Function Return: myOffice.WorkingHours -> "The working hours are from 9 to 17."
13) On-Time Employee Check : This checks when the employee arrives at or before the
start time (9 AM), it returns a message stating that the named employee is on time
Type Function Return: emp.checkPunctuality(8,"John") -> "John is on time."
14) Late but Present Employee Check : This checks if the employee arrived late but
still within working hours. When the employee arrives after the start time but before
the end time (17:00), it returns a message stating that the named employee is late but present
Type Function Return: emp.checkPunctuality(10,"Emma") -> "Emma is late but present."
15) Missed Working Hours Check : This handles all remaining cases where the employee's
login time is at or after the office end time (17:00). When the employee arrives after
working hours have ended, it returns a message stating that the
named employee missed the working hours entirely
Type Function Return: emp.checkPunctuality(18,"Mike") -> "Mike missed the working hours."
16) No Remaining Hours Check : This checks if the employee's login time is greater than or equal
to the office end time (17:00) to determine if there are any remaining work hours.
When the employee arrives at or after the office closes,
it returns 0 because there are no work hours left in the day
Type Function Return: emp.remainingHours(17) -> 0
17) hidden Type Function Return: emp.remainingHours(9) -> 8
18) Invalid Worked Hours : This checks when a negative number is entered for worked hours,
it returns "Invalid worked hours!" because time cannot be negative in real-world scenarios.
Type Function Return: emp.checkWorkedHours(-5) -> "Invalid worked hours!"
19) Leave Approval Threshold Check : This checks when the employee has worked at least 40 hours
(typically representing a full work week), it returns "Leave approved for" followed by the employee's name.
Type Function Return: mgr.approveLeave(45,"Sophia") -> "Leave approved for Sophia."
20) Leave Denied for Insufficient Hours : This checks if the employee has worked fewer than 40 hours.
When the worked hours are below this threshold, it returns "Leave denied for" followed by the employee's name,
Type Function Return: mgr.approveLeave(35,"David") -> "Leave denied for David."
21) No Bonus for Low Performance : This checks if the performance score is below 50.
When the score is less than 50, it returns 0.0, indicating that no bonus is awarded due to low performance.
Type Function Return: mgr.bonusCalculation(60000,35) -> 0.0
22) hidden Type Function Return: mgr.bonusCalculation(80000, 100) -> 16000
23) hidden Type Function Return: mgr.bonusCalculation(60000, 50) -> 3000
24) 10% Bonus for Good Performance : This checks if the performance score is between 75 and 89 (inclusive).
When the score falls within this range, it returns 10% of the salary as the bonus amount,
Type Function Return: mgr.bonusCalculation(70000,80) -> 7000.0
Working Template:
#include
#include
#include
#include
using namespace std;
struct KeyValue {
string key;
string value;
};
// Greet user based on hour (0–23)
string greet(int hour) {
if (hour < 0 || hour > 23)
return "Invalid hour!";
else if (hour >= 3 && hour < 12)
return "Good Morning";
else if (hour >= 12 && hour < 17)
return "Good Afternoon";
else if (hour >= 17 && hour < 21)
return "Good Evening";
else
return "Good Night";
}
class Office
{
public:
string name = "Tech Corp";
string type = "Private";
string industry = "Information Technology";
int startTime = 9;
int endTime = 17;
string WorkingHours = "The working hours are from 9 to 17.";
vector address = {
{"address" , "123 Tech Street"},
{"city" , "Chennai"},
{"country" , "India"}
};
void printOfficeInfo() {
cout << "Office Name: " << name << endl;
cout << "Type: " << type << endl;
cout << "Industry: " << industry << endl;
cout << WorkingHours << endl;
cout << "Address: " << endl;
for (auto &kv : address) {
cout << " " << kv.key << ": " << kv.value << endl;
}
}
};
class Employee : public Office {
public:
// Check punctuality
string checkPunctuality(int loginTime, string empName) {
if (loginTime <= startTime)
return empName + " is on time.";
else if (loginTime < endTime)
return empName + " is late but present.";
else
return empName + " missed the working hours.";
}
// Calculate remaining work hours
int remainingHours(int loginTime) {
if (loginTime >= endTime) return 0;
return endTime - loginTime;
}
// Print employee details
void printEmployeeInfo(string empName, int empId, int loginTime) {
cout << "Employee Name: " << empName << endl;
cout << "Employee ID: " << empId << endl;
cout << checkPunctuality(loginTime, empName) << endl;
cout << "Remaining Work Hours: " << remainingHours(loginTime) << endl;
}
};
class Manager : public Office {
public:
// Calculate average team productivity
double calculateTeamProductivity(vector teamHours) {
if (teamHours.empty()) return 0.0;
int sum = 0;
for (int h : teamHours) sum += h;
return (double)sum / teamHours.size();
}
// Approve leave if employee has worked enough hours
string approveLeave(int workedHours, string empName) {
if(workedHours < 0)
return "Invalid worked hours!";
else if (workedHours >= 40)
return "Leave approved for " + empName + ".";
else
return "Leave denied for " + empName + ". Not enough hours worked.";
}
// Calculate bonus based on performance score (0–100)
double bonusCalculation(double salary, int performanceScore) {
if (performanceScore >= 90) return salary * 0.20;
else if (performanceScore >= 75) return salary * 0.10;
else if (performanceScore >= 50) return salary * 0.05;
else return 0.0;
}
// Print manager details and logic
void printManagerInfo(string mgrName, int mgrId, vector teamHours, double salary, int score) {
cout << "Manager Name: " << mgrName << endl;
cout << "Manager ID: " << mgrId << endl;
double avgProd = calculateTeamProductivity(teamHours);
cout << "Average Team Productivity: " << avgProd << " hours/day" << endl;
cout << approveLeave(42, "Alice") << endl; // example check
double bonus = bonusCalculation(salary, score);
cout << "Performance Score: " << score << endl;
cout << "Bonus Earned: " << bonus << endl;
}
};
// For test cases results (!Do not modify)
Office myOffice;
Employee emp;
Manager mgr;
bool getValidatedIntInput(int& input) {
cin >> input;
if (cin.fail()) {
cin.clear(); // clear error flags
cin.ignore(numeric_limits::max(), '\n'); // discard invalid input
return false;
}
return true;
}
int main() {
string empName, mgrName;
int hour, empId, loginTime, mgrId, score;
double salary;
int choice;
cout << "Welcome Admin to " << myOffice.name << " System!";
cout << "\n-----------------------------------\n";
do {
cout << "\n===== Admin Menu =====\n";
cout << "1. View Office Info\n";
cout << "2. Analyse Manager Details\n";
cout << "3. Analyse Employee Details\n";
cout << "4. Exit\n";
cout << "Enter your choice: ";
if (!getValidatedIntInput(choice)) {
cout << "Invalid input! Please enter a numeric choice.\n";
continue; // skip to next iteration
}
switch (choice) {
case 1: {
cout << "\n---- Office Info ----\n";
myOffice.printOfficeInfo();
cout << "\n-----------------------------------\n";
break;
}
case 2: {
cout << "\n---- Manager Section ----\n";
cout << "Enter Manager Name: ";
cin >> mgrName;
cout << "Enter Manager ID: ";
if (!getValidatedIntInput(mgrId)) {
cout << "Invalid input! Manager ID must be numeric.\n";
break;
}
cout << "Enter Salary: ";
cin >> salary; // double input, no validation here for simplicity
cout << "Enter Performance Score (0-100): ";
if (!getValidatedIntInput(score)) {
cout << "Invalid input! Performance score must be numeric.\n";
break;
}
vector teamHours = {8, 7, 9, 6, 8};
mgr.printManagerInfo(mgrName, mgrId, teamHours, salary, score);
cout << "\n-----------------------------------\n";
break;
}
case 3: {
cout << "\n---- Employee Section ----\n";
cout << "Enter Employee Name: ";
cin >> empName;
cout << "Enter Employee ID: ";
if (!getValidatedIntInput(empId)) {
cout << "Invalid input! Employee ID must be numeric.\n";
break;
}
cout << "Enter Login Time (0-23): ";
if (!getValidatedIntInput(loginTime)) {
cout << "Invalid input! Login time must be numeric.\n";
break;
}
emp.printEmployeeInfo(empName, empId, loginTime);
cout << "\n-----------------------------------\n";
break;
}
case 4:
cout << "Exiting system... Goodbye Admin!\n";
break;
default:
cout << "Invalid choice! Please try again.\n";
}
cout << "\n-----------------------------------\n";
} while (choice != 4);
return 0;
}
3) Print Output
Pattern Lines
Expected:
*
**
***
Participant Code:
#include <iostream>
using namespace std;
int main(){
cout << "*" << endl;
cout << "**" << endl;
cout << "***" << endl;
return 0;
}
Radio Box (Quizzes) Admin
Create a Quiz
- Go to Playground and choose Radio Box.
- Click “Add Quiz,” then set Title, Description, Duration.
- Add questions: choose type (Radio/Checkbox/Image).
- Add options and mark correct answer(s), set points.
- Select participants and save.
Single-Answer (Radio) Example
Question: What is the output of: cout << 5 + 3; Options: ○ 53 ● 8 (correct) ○ 5 + 3 ○ Compilation Error Points: 10
Multiple-Answer (Checkbox) Example
Question: Select valid C++ data types (select all that apply) Options: ☑ int (correct) ☑ string (correct) ☐ boolean ☑ char (correct) Points: 10
Single-Answer (Radio) with image Example
Question: What is the logo of python? Options: ○ image 1 ● image 2 (correct) ○ image 3 ○ image 4 Points: 10
Code Editor
Syntax Highlighting
Readable C/C++ with visual cues for keywords, types, and strings.
Line Numbers
Quick navigation and error tracking aligned with compiler output.
Auto‑Indent
Consistent 4‑space indentation and brace-aware formatting.
Terminal
Compilation logs, program output, and test results.
Run and Test
- Write or paste your solution in the editor.
- Click “Run Code” (or press F5) to compile and execute.
- If your program needs input, type it in the terminal when prompted.
- In tasks, use “Run All Tests” to execute attached test cases.
Terminal Indicators
| Status | Meaning |
|---|---|
| ✅ PASSED | Output or return value matched; points awarded. |
| ❌ FAILED | Mismatched output/return; check expected vs actual. |
| 🔧 COMPILE_ERROR | Fix syntax and type errors first. |
| ⚠️ ERROR | Runtime error; inspect logic, bounds, and types. |
| ⏱️ TIMEOUT | Exceeded limit; check loops and complexity. |
Bulk Import (Both Games)
Import Bug Killer tasks and Radio Box quizzes together in one JSON file by specifying “gametype” on each item.
gametype set to bugkiller or radiobox.Mixed JSON Import (Tasks + Quizzes)
[
{
"gametype": "bugkiller",
"title": "Array Operations",
"duration": 2700,
"description": "Implement array utilities",
"template": "#include <iostream>\\nusing namespace std;\\nint main(){return 0;}",
"participants": ["johndoe","janesmith"],
"testCases": [
{
"name": "Max of Array",
"type": "functionReturn",
"functionName": "findMax",
"functionArgs": ["[5,2,9,1,7]", "5"],
"expectedReturn": "9",
"points": 15,
"timeoutSeconds": 5,
"isHidden": false
},
{
"name": "Negatives",
"type": "functionReturn",
"functionName": "findMax",
"functionArgs": ["[-5,-2,-9,-1]", "4"],
"expectedReturn": "-1",
"points": 15,
"timeoutSeconds": 5,
"isHidden": true
}
]
},
{
"gametype": "bugkiller",
"title": "Sum of Two Numbers",
"duration": 1800,
"description": "Read two integers, print sum",
"template": "#include <iostream>\\nusing namespace std;\\nint main(){return 0;}",
"participants": [],
"testCases": [
{
"name": "Basic",
"type": "standardIO",
"inputData": "5\\n3",
"expectedOutput": "8",
"points": 10,
"timeoutSeconds": 5,
"isHidden": false
},
{
"name": "Large",
"type": "standardIO",
"inputData": "1000\\n2000",
"expectedOutput": "3000",
"points": 10,
"timeoutSeconds": 5,
"isHidden": false
}
]
},
{
"gametype": "radiobox",
"title": "C++ Basics Quiz",
"duration": 1800,
"description": "Fundamentals of C++",
"participants": ["johndoe","janesmith"],
"questions": [
{
"questiontext": "Which prints Hello World in C++?",
"questiontype": "radio",
"points": 5,
"options": [
{ "optiontext": "cout << \"Hello World\";", "iscorrect": true },
{ "optiontext": "print(\"Hello World\")", "iscorrect": false },
{ "optiontext": "System.out.println(\"Hello World\")", "iscorrect": false }
]
},
{
"questiontext": "Valid C++ types (select all)",
"questiontype": "checkbox",
"points": 10,
"options": [
{ "optiontext": "int", "iscorrect": true },
{ "optiontext": "string", "iscorrect": true },
{ "optiontext": "boolean", "iscorrect": false },
{ "optiontext": "char", "iscorrect": true }
]
}
]
}
]
JSON Field Reference
| Field | Type | Description | Required |
|---|---|---|---|
| gametype | string | "bugkiller" or "radiobox" | Yes |
| title | string | Task/Quiz name | Yes |
| duration | number | Seconds (e.g., 1800=30min) | Yes |
| description | string | Instructions shown to user | No |
| participants | array | Usernames (empty = all users if supported) | No |
| template (Bug Killer) | string | Starter code for Participants | No |
| testCases (Bug Killer) | array | List of test case objects | No |
| questions (Radio Box) | array | List of question objects | No |
Test Case Types (Bug Killer)
- standardIO: requires inputData and expectedOutput
- functionReturn: requires functionName, functionArgs, expectedReturn
- printOutput: requires expectedPrintLines (array)
Question/Option Fields (Radio Box)
- questiontext: text of the question
- questiontype: "radio", "checkbox", or "image"
- points: numeric points per question
- options: array of { optiontext, iscorrect }
Participant Workflow
Completing a Task
- Start the task from Home; timer begins when you confirm.
- Write code, use Run Code to compile and execute.
- Use Run All Tests to validate against test cases.
- Submit when satisfied; auto-submit occurs on timeout.
Taking a Quiz
- Start the quiz and watch the timer.
- Answer each question; for checkboxes, select all correct answers.
- Submit to finish; results are recorded immediately.
- 10% read and plan, 65% coding, 20% testing, 5% final review
- Save code frequently (Ctrl+S)
- Match output format exactly (spaces/newlines)
Settings (Branding & Updates)
Home Title
- Open Settings tab.
- Update Home Title (e.g., “Welcome to Programming Lab”).
- Save; the title updates on Home immediately.
Logo
- Click “Choose Logo,” select PNG/JPG.
- Confirm and check header/login visuals.
Updates
- Check Current Version and Latest Version.
- If available, download the new version, close the app, install, relaunch.
FAQ
Can I edit a task after Participants start?
Yes, but changes do not affect in‑progress attempts; Participants who haven’t started will see updates.
Can Participants reattempt a task?
Not by default; admins can reactivate tasks to permit another attempt if desired.
Do Participants see test cases?
Only non‑hidden tests are visible; hidden tests are useful for grading edge cases.
What languages are supported?
C and C++ using GCC/G++; ensure your compiler tools are set up properly before running code.
Troubleshooting
Install MinGW‑w64 and ensure the toolchain path matches your configuration; restart the app.
Check for infinite loops or blocking input; add clear termination conditions; verify timeouts.
Confirm exact formatting, function names/signatures, and edge cases; compare expected vs actual carefully.
Validate JSON/CSV structure, ensure required fields, and remove duplicate usernames.
