Problems

Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.

Total results288 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Postfix Expression Evaluation 2Evaluate a postfix expression using given operand values and print the result rounded to two decimal places.Easy3StackString+1No attempts yet2s128 MBJudgeable
Hal's CalculatorSimulate a stack-like list of expressions under six commands (HASH, DOLLAR, SWAP, DROP, DUP, ROT), enforcing size and availability constraints, and output the final list or ERROR.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
Bug KingRepeatedly remove all occurrences of the substring "BUG" from each input line, using a stack-like scan since removals can form new matches, until none remain.Easy3StackStringNo attempts yet1s128 MBJudgeable
Working at the RestaurantSimulate a two-pile plate stacking strategy that always drops on pile 2 and serves from pile 1, moving plates when pile 1 runs out, and output the exact operation transcript.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
Car RacingGiven the order in which cars arrive, decide whether a single FIFO bypass lane can reorder them to increasing order.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
A Balanced WorldFor each line ending in a period, decide whether its round and square brackets are properly matched and nested, printing yes or no.Easy3StackString+1No attempts yet1s128 MBJudgeable
Cow CotillionGiven strings of '<' and '>', decide for each whether every character can be paired as a properly nested '><' bow, i.e. whether the brackets are balanced.Easy3StackString+2No attempts yet1s128 MBJudgeable
BFedInterpret a Brainfuck program read from stdin up to '#', supporting the seven pointer, arithmetic, loop, and output commands on a 30000-cell byte tape.Easy3SimulationStack+2No attempts yet1s128 MBJudgeable
Web NavigationSimulate browser back and forward navigation using two stacks, printing the current URL after each command.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
BracketsFor each line of code until the '#' line, decide whether its round, square, and curly brackets are matched and correctly nested.Easy3StackStringNo attempts yet1s128 MBJudgeable
ProgramCheck whether the bracket string is correct and print its maximum nesting depth, or NIE when it is not.Easy3StackNo attempts yet1s512 MBJudgeable
Stock PriceFor each position find the index of the first later price that is higher, or -1 when no such price exists.Easy3StackArrayNo attempts yet2s128 MBJudgeable
ParenthesesDecide for each parenthesis string of length 2 to 50 whether its brackets match correctly and print YES or NO.Easy3StackNo attempts yet1s128 MBJudgeable
Islands in the Data StreamCount the nested islands, contiguous blocks higher than both neighbors, in each 15-number stream that starts and ends at zero.Easy3SimulationStackNo attempts yet1s128 MBJudgeable
LVMSimulate the stack machine program and print the value shown by the first DONE instruction.Easy3SimulationStackNo attempts yet2s512 MBJudgeable
The Geneva ConfectionDecide if cars arriving top to bottom can be released in order 1 to N using a side branch as a stack.Easy3StackNo attempts yet1s256 MBJudgeable
Even Up SolitaireRepeatedly remove adjacent card pairs with an even sum so that as few cards as possible remain.Easy3StackGreedyNo attempts yet2s256 MBJudgeable
Zero StackNumbers are pushed onto a ledger and each zero erases the most recent entry, so report the sum of the remaining numbers.Easy3StackNo attempts yet1s256 MBJudgeable
Iron BarsGiven a parenthesis string encoding bars and lasers, count the total bar pieces cut by the lasers.Easy3StackNo attempts yet1s256 MBJudgeable
StackProcess push, pop, size, empty, and top commands on an integer stack and print each result.Easy3StackNo attempts yet0.5s256 MBJudgeable
Simple ArithmeticEvaluate single-digit expressions with usual precedence and floor division, printing WRONG INPUT for bad forms or division by zero.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
Hydraulic ArmDecide whether each given box sequence can reach the right belt in increasing height using one shelf as a stack.Easy3StackSimulationNo attempts yet1s256 MBJudgeable
Boolean PostfixEvaluate each postfix Boolean formula with AND, OR, XOR, and NOT using a stack and print 1 for true and 0 for false.Easy3StackNo attempts yet1s256 MBJudgeable
Padding a bracket stringAdd the fewest opening brackets at the front and closing brackets at the back to turn the given parenthesis string into a correct bracket sequence.Easy3StackGreedyNo attempts yet1s32 MBJudgeable
Pretty printing arraysReprint the given brace array so each word and brace sits on its own line with two-space indent per nesting level.Easy3StackSimulationNo attempts yet1s64 MBJudgeable
Resistor CircuitCompute the equivalent resistance of a nested series-parallel resistor circuit described by a bracketed string.Easy3StackMathNo attempts yet1s64 MBJudgeable
Magicka (Small)Simulate invocations in order, combining the last two list elements when a rule matches and clearing the whole list when opposed elements meet.Easy3SimulationStackNo attempts yet5s512 MBJudgeable
Magicka Element CombiningInvoke each base element in order, merging the last two entries when they combine and clearing the list when opposed elements meet, then report the final list.Easy3SimulationStackNo attempts yet5s512 MBJudgeable
Game of ThrownsTrack a token around a circle of children through clockwise or counterclockwise throws, undoing the last m throws on command.Easy3StackSimulation+1No attempts yet2s512 MBJudgeable
Star in ParenthesesGiven balanced parentheses with one star, count the matching pairs that enclose the star's position.Easy3StackString+1No attempts yet2s512 MBJudgeable
The Deeper, The BetterGiven a correct bracket string with digits inside, score each digit by the brackets enclosing it and print the highest score.Easy3StackString+1No attempts yet1s256 MBJudgeable
Circuit MathEvaluate a valid postfix boolean circuit over up to 26 variables and print T or F for the given input assignment.Easy3StackString+1No attempts yet1s1024 MBJudgeable
SticksGiven the heights of N sticks in a row, count how many sticks are visible when the row is viewed from the right, where a stick is visible only if it is strictly taller than every stick to its right.Easy3ArrayImplementation+2No attempts yet1s512 MBJudgeable
Text EditorSimulate a line editor with cursor movement, character deletion, and insertion commands, printing the final string.Medium4StackSimulation+2No attempts yet0.3s512 MBJudgeable
Decompressed String LengthCompute the total length of a string after fully expanding nested K(Q) compression patterns, where K is a single digit repeat count.Medium4StackString+1No attempts yet2s128 MBJudgeable
Stack SequenceDetermine if a target permutation of 1 to n can be produced by a stack pushing values in increasing order, and output the push/pop sequence if possible.Medium4StackSimulation+1No attempts yet2s128 MBJudgeable
Postfix NotationConvert a fully parenthesized-or-not infix arithmetic expression with single-letter operands into its postfix notation.Medium4StackStringNo attempts yet2s128 MBJudgeable
Chemical Formula MassParse a chemical formula with nested parentheses and digit multipliers to compute the total atomic mass using H=1, C=12, O=16.Medium4StackString+1No attempts yet2s128 MBJudgeable
TowersFor each tower in a line, find the nearest tower to its left with height at least as large, using a monotonic stack approach.Medium4StackArrayNo attempts yet1.5s128 MBJudgeable
Bracket ValueParse a bracket string with two bracket types and compute its defined nested value, or output 0 if it is invalid.Medium4StackString+1No attempts yet1s128 MBJudgeable
Brainf*ck InterpreterImplement a Brainfsck interpreter that parses a program per test case, checks bracket matching, and executes it printing output or a compile error.Medium4StackSimulation+1No attempts yet1s128 MBJudgeable
Make the Largest NumberGiven an N-digit number, remove exactly K digits while keeping relative order to form the largest possible remaining number.Medium4StackGreedyNo attempts yet1s128 MBJudgeable
Molecular MassParse a nested chemical formula with parentheses and repeat counts, then compute the total molecular mass from atomic weights.Medium4StackRecursion+1No attempts yet1s128 MBJudgeable
A Smart Brain is a Tasty BrainParse each of up to 10000 Boolean expressions, evaluate it, and report whether the brain's given answer matches.Medium4StringStack+2No attempts yet1s128 MBJudgeable
Tree GraftingGiven a depth-first traversal string of an ordered tree, report its height and the height after converting it to a left-child/right-sibling binary tree.Medium4TreeStack+2No attempts yet1s128 MBJudgeable
Stable StringGiven a string of braces, find the minimum number of single-character flips that make all brackets correctly balanced.Medium4StackGreedy+2No attempts yet1s128 MBJudgeable
Web PagesFor each line of HTML-looking text, decide whether every opening tag has a matching closing tag and all tags nest properly.Medium4StackString+2No attempts yet1s128 MBJudgeable
Look UpFor each cow, find the smallest index j > i with H_j > H_i, or print 0 if none exists.Medium4StackArray+1No attempts yet1s128 MBJudgeable
Matrix Chain MultiplicationGiven matrices with dimensions and fully parenthesized products, report the elementary multiplication count or an error if dimensions mismatch.Medium4StackRecursion+1No attempts yet1s128 MBJudgeable
From Prefix to PostfixTranslate each prefix arithmetic expression over + and - into its equivalent postfix form, stopping at the terminating 0.Medium4StackTree+2No attempts yet1s128 MBJudgeable
LotteryInsert parentheses into arithmetic expressions so that multiplication is grouped before addition and subtraction, keeping the original spaces.Medium4StringImplementation+2No attempts yet1s128 MBJudgeable
Chemical ReactionsParse chemical formulas with nested parentheses and multipliers, then compare element counts between the left side and each candidate right side.Medium4StringStack+1No attempts yet1s128 MBJudgeable
BankerSimulate deposits stacked as envelopes and withdrawals taken from the top of the pile, then report the final till and remaining pile totals.Medium4StackSimulationNo attempts yet1s128 MBJudgeable
Single Digit AdderEvaluate each line as an arithmetic expression of single digits with plus, minus, and parentheses.Medium4StackRecursionNo attempts yet1s128 MBJudgeable
Uncompressing Compressed WordsExpand each nested compressed word by concatenating its parts and repeating the group n times.Medium4RecursionStack+1No attempts yet1s256 MBJudgeable
ShipuraEvaluate expressions that combine floor division by powers of two with squaring modulo 1,000,000,007 and nested brackets.Medium4StackRecursion+1No attempts yet8s512 MBJudgeable
Robotic EncryptionSimulate a robot that runs nested-loop command lines on a character grid and read the square it stops on after each line to decode the message.Medium4SimulationStackNo attempts yet1s256 MBJudgeable
Ignore all my comments (Small)Remove every nested /* */ comment block from the document with a single left to right scan and print the rest unchanged.Medium4StackString+1No attempts yet5s512 MBJudgeable
Ignore all my comments (Large)Remove every nested /* */ comment block from the document in a single left-to-right pass and print the remaining text unchanged.Medium4StackString+1No attempts yet5s512 MBJudgeable
Wolves and Proper WordsGiven a word of w, o, l, f, decide whether it is a concatenation of blocks w^n o^n l^n f^n for n >= 1.Medium4StackGreedyNo attempts yet2s512 MBJudgeable
Battle SimulationRead a monster attack string and output the mech's counters, merging each earliest triple of R, B, L into one C.Medium4StackString+1No attempts yet2s512 MBJudgeable
OvertimeGiven timestamped enter and leave records, count overtime as unmatched leaves plus unmatched enters per name after pairing.Medium4Hash mapStack+2No attempts yet2s512 MBJudgeable
Railway StationDecide for each target permutation whether coaches arriving as 1..N can leave a single dead-end siding in that order.Medium4StackSimulationNo attempts yet10s512 MBJudgeable
Genius mathematician SeongpilEvaluate a postfix expression of single digits and the operators +, -, *, / with no spaces.Medium4StackImplementationNo attempts yet1s128 MBJudgeable
Lining UpGiven N lines of 5 people each, decide whether everyone can pass through a single LIFO waiting area in increasing ticket order.Medium4StackSimulation+2No attempts yet1s512 MBJudgeable
Homework Never Ends!Each minute either adds homework (value A, work time T) or nothing; a new task preempts the current one, and finished tasks are submitted at the minute they finish. Sum the values of tasks completed within N minutes.Medium4StackSimulation+2No attempts yet2s256 MBJudgeable
Parliamentary ProcedureGiven a record of Add and Vote events for 26 parties, decide whether the events can be ordered consistently with a stack-like bill discussion rule.Medium4StackSimulation+1No attempts yet2s512 MBJudgeable
Nasty CalculationsEvaluate a postfix arithmetic formula modulo B for up to 100000 given base-B values of x and print only the last digit each time.Medium5StackMath+1No attempts yet1s128 MBJudgeable
GoStackSimulate a custom stack-based virtual machine with arithmetic operations and specific division rules, detecting errors and printing results for many inputs.Medium5StackSimulation+1No attempts yet1s128 MBJudgeable
EquationEvaluate a postfix expression containing at most one occurrence of variable X as a linear function a*x+b, then solve a*x+b=0 for x as a reduced fraction, handling no-solution and infinite-solution cases.Medium5StackMath+1No attempts yet1s128 MBJudgeable
Good WordsA word of A's and B's is good when its letters can be paired by equal letters with non-crossing arcs; count how many of the given words are good.Medium5StackString+2No attempts yet1s256 MBJudgeable
Reverse Roman NotationSimulate a stack calculator where operands are Roman numerals; parse and print them, and handle underflow, division by zero, and out-of-range errors.Medium5ImplementationStack+2No attempts yet1s128 MBJudgeable
KeyloggerA log of typed keys, arrow moves, and backspaces in a text field must be replayed to recover the final password.Medium5Linked listSimulation+1No attempts yet1s256 MBJudgeable
RBY Pop!Change exactly one ball's color, then repeatedly remove any run of 4 or more equal adjacent balls; minimize the number left.Medium5SimulationImplementation+2No attempts yet1s128 MBJudgeable
Arranging Go StonesStones are added one by one; each even-indexed stone of a new color replaces the trailing run of the opposite color, and we count the white stones that remain.Medium5StackSimulation+2No attempts yet1s128 MBJudgeable
Clumsy CowsGiven an even-length string of parentheses, find the minimum number of characters to flip so the string becomes balanced.Medium5GreedyString+2No attempts yet1s128 MBJudgeable
Cleaning the DishesSimulate two stacks where each wash or dry command reverses the order of the dishes it moves, then print the final cleaned pile top to bottom.Medium5SimulationStack+2No attempts yet1s128 MBJudgeable
Best ParenthesisGiven a balanced parenthesis string encoded as 0/1 values, compute its recursively defined score modulo 12345678910.Medium5StackRecursion+2No attempts yet1s256 MBJudgeable
FriendsEvaluate set expressions over uppercase letters using union, intersection, and difference, where * binds tighter than + and - and equal operators left-associate.Medium5StringStack+2No attempts yet1s128 MBJudgeable
Parentheses Encoding ConversionGiven the P-sequence encoding of a well-formed parenthesis string, compute its W-sequence encoding.Medium5StackSimulation+1No attempts yet1s128 MBJudgeable
Take-outA white block is 'b' and a black block is 'c'. Scan a row of blocks with a stack; whenever the top k+1 blocks hold k white and one black, pop and record them, then print the recorded groups in reverse order.Medium5StackSimulation+1No attempts yet1s128 MBJudgeable
SawmillsGiven a string of g and t points along a line, pair every g with a distinct t using non-crossing north-side arcs so the summed distance is minimal, or report NIE.Medium5GreedyStack+2No attempts yet1s128 MBJudgeable
Triangular MatricesEvaluate a postfix expression over triangular matrices with custom addition and template-match multiplication, or report an invalid expression.Medium5SimulationStack+1No attempts yet1s128 MBJudgeable
CarpetFind the largest area axis-aligned rectangle covering only clear cells in a grid with pillars.Medium5StackMatrixNo attempts yet2s1024 MBJudgeable
String ExplosionRepeatedly delete every occurrence of the explosion string until none remains, printing FRULA when nothing is left.Medium5StackString matchingNo attempts yet2s128 MBJudgeable
Senior PostmenThe program replays the given stack walk on the street graph and prints each cycle it extracts in order.Medium5SimulationGraph+2No attempts yet1s256 MBJudgeable
Salad BarFind the longest contiguous block of apples and oranges where oranges never fall behind apples when added from either end.Medium5Prefix sumStack+1No attempts yet3s256 MBJudgeable
Preorder TraversalsDecide whether each given number list is the preorder traversal of some binary search tree.Medium5StackTreeNo attempts yet1s256 MBJudgeable
Follower of I 1Sum, over every distinct ordering of the push, add, and multiply cards, the entries in the top K stack positions after evaluating the RPN process.Medium5Brute forceStack+1No attempts yet3s256 MBJudgeable
CensoringRepeatedly delete the first occurrence of T from S, including matches formed by earlier deletions, and print what remains.Medium5String matchingStackNo attempts yet1s256 MBJudgeable
CensoringRepeatedly delete the first occurrence of pattern T from string S until none remains and print the result.Medium5StackString matchingNo attempts yet1s256 MBJudgeable
Maximal AreaGiven N column heights, find the area of the largest rectangle formed by whole unit squares.Medium5StackArrayNo attempts yet2s256 MBJudgeable
Building a House (Small)Find the area of the largest axis-aligned rectangle containing only grass and shrub cells on each grid map.Medium5StackMatrixNo attempts yet5s512 MBJudgeable
Doki Doki Snack HandoutGiven a queue of numbered students, check whether they can be passed out in order 1 to N using one last-in-first-out holding spot.Medium5StackSimulationNo attempts yet1s128 MBJudgeable
Erasing and WinningGiven an N-digit number and D, erase exactly D digits so the remaining digits, in order, form the largest possible number. Multiple test cases until 0 0.Medium5GreedyStack+2No attempts yet2s512 MBJudgeable
Broadcast TowerPlace a tower of height H in a row of buildings; a building west of it receives its signal if no taller building blocks the path. Maximize receivers.Medium5StackArrayNo attempts yet2s512 MBJudgeable
Archers of the Geumgang RangeEach archer's dragon moves right and eats peaks lower than its start until it meets a taller peak; find the largest count any archer can eat.Medium5StackArray+2No attempts yet2s256 MBJudgeable
PPAPDecide whether a length-1000000 string of P and A is generated from P by replacing a P with PPAP at each step.Medium5StackString+1No attempts yet1s512 MBJudgeable
GCC Min Max ExpressionEvaluate an expression containing the <? (min) and >? (max) operators plus + and -, respecting precedence, left associativity, and parentheses.Medium5StackImplementation+2No attempts yet1s1024 MBJudgeable
Passport ControlDecide whether a given exit permutation can arise from a FIFO arrival line feeding k desk queues, each holding an arrival-ordered subsequence.Medium5QueueStack+2No attempts yet0.2s512 MBJudgeable