Swap Two Values

Easy
2 views 24 Jan 2026
Read two integers a and b. Swap them and output the swapped values. Use Python multiple assignment....

Simple Interest

Easy
2 views 24 Jan 2026
Principal P, rate R (in percent), and time T (in years) are provided. Output simple interest = (P*R*T)/100. If result is integer, output without decimals else output up to 2 decimals....

Temperature Convert

Easy
2 views 24 Jan 2026
Celsius value C is provided. Convert to Fahrenheit F = C*9/5 + 32 and output with 2 decimals....

Last Digit and Sign

Easy
2 views 24 Jan 2026
Read one integer n. Output two things: last digit of |n| and the sign as NEG, ZERO, or POS....

Seconds to HH:MM:SS

Easy
5 views 24 Jan 2026
Total seconds S is provided. Convert it to hh:mm:ss (00 padded) assuming 0 ...

Area of Rectangle

Easy
3 views 24 Jan 2026
Read two numbers length L and width W. Output area L*W. Output without trailing zeros (like Python str())....

Update X with Operations

Easy
2 views 24 Jan 2026
Read two integers x and y. Do these updates in order: x=x+y, y=y+1, x=x-y. Output final x and y....

Count Digits (No Strings)

Easy
3 views 24 Jan 2026
Read one integer n. Count number of digits in |n| without converting to string. For n=0 answer is 1....

Build Full Name

Easy
3 views 24 Jan 2026
First name and last name are provided. Output as 'Last, First'....

Round to Nearest Multiple

Easy
5 views 24 Jan 2026
Input has two integers n and k are provided (k>0). Round n to nearest multiple of k. If exactly middle, round up....

Rotate Three Variables

Medium
3 views 24 Jan 2026
Read three integers a b c. Rotate left once: a...

Parallel Swaps

Medium
5 views 24 Jan 2026
Read n pairs (a,b). For each pair swap them and output. This is to practice variable assignment quickly....

Running Balance

Medium
3 views 24 Jan 2026
Read opening balance B and m operations. Each operation is: ADD x or SUB x. Output final balance....

Min, Max, and Range

Medium
2 views 24 Jan 2026
Read n integers, output min, max, and (max-min). Use variables, one pass....

Second Largest Distinct

Medium
3 views 24 Jan 2026
Read n integers, find the second largest DISTINCT number. If it doesn't exist, output NONE....

Variable Store (SET/ADD/MUL)

Medium
2 views 24 Jan 2026
You will receive q commands on variable x: SET v, ADD v, MUL v. Start x=0. After all commands output x....

Two Variables Calculator

Medium
2 views 24 Jan 2026
You have two variables a and b starting at 0. You get q commands: SETA x, SETB x, ADDA x, ADDB x, SWAP. Output final a and b....

Linear Equation Solver

Medium
2 views 24 Jan 2026
Read a and b for equation a*x + b = 0. Output x as reduced fraction p/q. If no solution output NONE. If infinite solutions output ALL....

Count Assignments to Same Variable

Medium
2 views 24 Jan 2026
You will receive n lines like 'x = value'. Count how many times the same variable name appears again (2nd time onwards). Output count....

Pack and Unpack

Medium
2 views 24 Jan 2026
One line has n and then n integers. Store them into variables: first, middle (all), last. Output first, count of middle elements, last....

Normalize Score to 0..100

Medium
5 views 24 Jan 2026
You will receive integer score. If score is below 0 set to 0, if above 100 set to 100. Output final value....

Integer to Binary with Variables

Medium
2 views 24 Jan 2026
Read one integer n. Output its binary without using bin(). Use repeated division and variables....

Make a Stable ID

Medium
2 views 24 Jan 2026
Read two integers userId and orderId, build an id string as userId-orderId with zero padding of orderId to 6 digits. Output the string....

Integer Remainder Walk

Medium
3 views 24 Jan 2026
Read n and k. Start x=0. Repeat n times: x=(x+1) % k. Output x. This is a small variable-state walk....

Find First Unset Variable

Hard
2 views 24 Jan 2026
You will receive q queries like GET name or SET name value. Maintain variables in a dict. For each GET, output value if present else UNSET....

Mini Scope Shadow Counter

Hard
3 views 24 Jan 2026
Read a tiny language with commands: 'let x', 'block', 'end'. Each block makes a new scope. Count how many times a let shadows a variable from an outer scope....

Dependency Assignments

Hard
2 views 24 Jan 2026
You will receive n assignments like x = y + 5 or x = 10. Variables are single lowercase letters. Compute final values for all variables that appear on left side, assuming missing variables start at 0....

Parallel Assignment Simulator

Hard
2 views 24 Jan 2026
You have two variables a and b. For each step you get newA and newB expressions in terms of old a and b: 'A' means old a, 'B' means old b, or an integer. Apply parallel assignment each step (both upda...

Update With Mod and Big Numbers

Hard
2 views 24 Jan 2026
Read q operations on x starting with 0. Operations are ADD v, MUL v, and MOD m. Values can be large. Use big integers safely and output final x....

Detect Uninitialized Read

Hard
4 views 24 Jan 2026
You will receive n statements in a tiny language: 'set x v' or 'add x y' meaning x = x + y. If add uses a variable that was never set before (for x or y), count it as a bad read. Output badReadCount....

Top K Variables by Value

Hard
2 views 24 Jan 2026
You will receive n variables with values. Output the top k variables by value (desc), tie by name (asc). Each name is a string without spaces....

Rolling Hash Variable

Hard
3 views 24 Jan 2026
Read a string s and integer base B and mod M. Compute rolling hash: h=0; for each char c: h=(h*B+ord(c))%M. Output h....

Multiple Counters Summary

Hard
2 views 24 Jan 2026
Read n words. Maintain two counters: vowelStart and consonantStart. Increment depending on first letter of each word. Output both counts....

Add Minutes on Clock

Medium
2 views 24 Jan 2026
Time is provided as hour (0-23) and minute (0-59). Also an integer k (can be big) is provided. Add k minutes to the time and output the new time in HH:MM format....

Variable X with SNAP and ROLLBACK

Hard
3 views 24 Jan 2026
You have one variable x starting at 0. You get q commands: SET v, ADD v, MUL v, SNAP, ROLLBACK. SNAP saves current x. ROLLBACK restores x to the last saved SNAP and removes that SNAP. If there is no S...