Safe Integer Parse

Easy
2 views 24 Jan 2026
Input is a single token. If it can be converted to integer, output it. Otherwise output 0....

Sum Two Numbers Safely

Easy
3 views 24 Jan 2026
Read two tokens. If both are integers, output their sum. If any is missing or not an integer, output ERROR....

Safe Integer Division

Easy
2 views 24 Jan 2026
Read two integers a and b. Output a//b. If b is 0 output DIVIDE BY ZERO. If input is not valid, output ERROR....

Safe Modulo

Easy
2 views 24 Jan 2026
Read two integers a and b. Output a%b. If b is 0 output DIVIDE BY ZERO. If input is invalid, output ERROR....

Pick Element By Index

Easy
3 views 24 Jan 2026
Read n integers and an index i (0-based). Output a[i]. If i is outside range or input is invalid, output OUT OF RANGE....

Parse HH:MM to Minutes

Easy
2 views 24 Jan 2026
Time string is provided in HH:MM. Output minutes since 00:00. If format is wrong or values are out of range, output INVALID....

Character At Position

Easy
2 views 24 Jan 2026
String s and position p are provided (0-based). Output character at that position. If p is not integer or out of range, output INVALID....

Perfect Square Check Safely

Easy
4 views 24 Jan 2026
Input is a single token. If it is a non-negative integer and perfect square output YES else NO. If input is invalid output NO....

Safe Power (Non-negative Exponent)

Easy
4 views 24 Jan 2026
Read two integers a and b. Output a^b modulo 1000000007. If b is negative or input invalid, output ERROR....

Safe Float Print

Easy
2 views 24 Jan 2026
Input is a single token. If it is a number, output it with 2 decimals. Else output 0.00....

One Operator Calculator

Medium
2 views 24 Jan 2026
Expression is provided as: a op b (space-separated). op can be + - * / %. Division is integer division. If op is invalid or division by zero happens, output ERROR....

Count Valid Integers

Medium
3 views 24 Jan 2026
Read n tokens (may contain junk). Count how many tokens are valid integers and output the count....

Sum of Valid Integers

Medium
2 views 24 Jan 2026
Read n tokens. Add only those tokens that are valid integers. Output the sum (0 if none valid)....

Multiply Valid Integers (Mod)

Medium
4 views 24 Jan 2026
Read n tokens. Multiply only valid integers and take modulo 1000000007. If no valid integers, output 0....

Base to Decimal Safely

Medium
2 views 24 Jan 2026
Read a string num and base b (2 to 36). Convert num to decimal and output it. If conversion fails, output INVALID....

Validate IPv4 Address

Medium
4 views 24 Jan 2026
Read a string, check if it is a valid IPv4 like A. B.C.D where each part is 0 to 255 and no empty parts. Output YES or NO....

Safe Range Sum Queries

Medium
2 views 24 Jan 2026
Read n numbers and q queries l r (0-based inclusive). For each query output sum. If query is out of range or invalid, output ERROR for that query....

Stop At First Bad Number

Medium
2 views 24 Jan 2026
Read a list of tokens ending with END. Start sum=0. Add each token as integer. If a token is not integer (and not END), output BAD and stop. If all good, output sum....

Command Processor With Errors

Medium
3 views 24 Jan 2026
You will receive q commands: ADD x, SUB x, MUL x. Start value=0. If any command has invalid number or unknown op, output ERROR at line i (1-based) and stop. Else output final value....

Recover Missing Matrix Cells

Medium
3 views 24 Jan 2026
Read r c and then r lines of matrix. Some lines may have less than c numbers. Treat missing cells as 0. Output sum of each column....

Parse Phone Number Digits

Medium
2 views 24 Jan 2026
A phone number string is provided. Extract only digits and output them. If there are no digits, output INVALID....

Safe Average of Integers

Medium
2 views 24 Jan 2026
Read n tokens. Consider only valid integers, compute average and output floor value. If no valid integer, output 0....

Key Value Store (Ignore Bad Lines)

Medium
3 views 24 Jan 2026
Read n lines with format key=value. Some lines may not have '=' or may be empty, ignore them. Then q queries keys. For each query output value or NOT FOUND....

Validate Date dd-mm-yyyy

Medium
4 views 24 Jan 2026
Date string is provided as dd-mm-yyyy. Output VALID if it is a real date (with leap year rules) else INVALID....

Decode Simple RLE

Medium
3 views 24 Jan 2026
Read string like a2b3c1 meaning aa bbb c. Output decoded string. If format is invalid (missing count or non-digit count), output ERROR....

Mini Calculator With Parentheses

Hard
3 views 24 Jan 2026
Expression contains integers, + - * / and parentheses. Division is integer division. If expression is invalid or division by zero occurs, output ERROR, else output result....

Transaction Store With Rollback

Hard
2 views 24 Jan 2026
You will receive q commands: BEGIN, COMMIT, ROLLBACK, SET k v, GET k. Implement nested transactions. GET prints value or NOT FOUND. If COMMIT/ROLLBACK is invalid, output ERROR and stop....

Total Amount and Bad Lines

Hard
2 views 24 Jan 2026
Read n lines, each should be 'name amount'. amount must be integer. Sum valid amounts and count bad lines. Output total and badCount....

Robust Component Count

Hard
3 views 24 Jan 2026
Read n m and then m edges. Some edge lines may be broken or have nodes out of range. Ignore invalid edges. Output number of connected components in resulting graph....

Safe Polynomial Parser

Hard
3 views 24 Jan 2026
Read expression like 'a0 a1 a2... an | x'. Left side are ints separated by spaces. If any coefficient is invalid, output ERROR. Else evaluate polynomial at x using Horner and output....

Batch Division With Line Errors

Hard
2 views 24 Jan 2026
First line q. Next q lines have a b. For each line output a//b. If b is 0 or parsing fails, output ERROR for that line....

Strict Brackets Validator

Hard
2 views 24 Jan 2026
Read a string containing brackets only: ()[]{}. If any other char is present, output ERROR. Else if brackets are balanced output YES else NO....

Validate and Fix Coordinates

Hard
2 views 24 Jan 2026
Read n coordinate pairs. Each line should contain x y integers. If a line is invalid, treat it as 0 0. Output total distance travelled from (0,0) visiting points in order (Manhattan)....

Top K Sum From Mixed Tokens

Hard
2 views 24 Jan 2026
Read n tokens and integer k. Consider only tokens that are valid integers. If there are less than k valid integers, output ERROR. Else output sum of k largest valid integers....

Deque Commands With Errors

Hard
3 views 24 Jan 2026
You will receive q commands: PUSHFRONT x, PUSHBACK x, POPFRONT, POPBACK. Start empty. On POP when empty, output ERROR and stop. Else after all commands output final deque as space-separated or EMPTY....