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 results2,994 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Gooseberry Tart BASICImplement a fast interpreter for a small BASIC subset with LET, GOTO, IF, FOR/NEXT, OUT, and COMMENT, printing each program's output.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Standing PinsGiven fallen wires specified by endpoints, reconstruct the unique grid of pin heights, or report no solution when zero or multiple height assignments exist.Medium7GraphBrute force+2No attempts yet1s128 MBJudgeable
The God DelusionOn a tiny grid each atom holds one numbered electron except a blank; slide electrons into empty neighbours to send each to its own atom in the fewest moves.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Functional Programming CountsImplement an interpreter for a tiny functional language with variables, single-parameter functions, and call-count profiling per definition line.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Martian PitsOn a grid with pits, command a rover that moves at speed 0 to 5 to reach the destination stopped in the fewest seconds.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Emergency RoomSimulate patients taking the lowest free seat on arrival, track who sits within 2 metres for 20 consecutive minutes, and count infections spreading one day later.Medium7SimulationImplementation+1No attempts yet1s128 MBJudgeable
Health Plan ComparisonParse free-text health plan descriptions to extract premiums and copay rules, then compute each plan's total yearly cost across the given visits.Medium7StringImplementation+2No attempts yet1s128 MBJudgeable
Hermit CrabsSimulate hermit crabs that outgrow shells over time and fight for larger unoccupied shells, then list survivors at time T.Medium7SimulationSorting+2No attempts yet1s128 MBJudgeable
Walking the PlankSimulate pirates crossing a one-at-a-time plank to ferry N items, honoring side-priority, FIFO queues, and ties broken by slowest pirate.Medium7SimulationQueue+1No attempts yet1s128 MBJudgeable
SnookerGiven the sequence of potted ball values in a valid snooker game with hidden scores, find the earliest shot after which the trailing player can no longer win.Medium7SimulationGreedy+2No attempts yet1s128 MBJudgeable
RoadGiven a road with passing places and a matrix describing where each eastbound car passes each westbound car, compute the minimum total time to realize that schedule. Cars drive at 12.5 m/s or wait, and cars in the same direction keep 25 m apart.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
MinotaurGiven a grid maze, Theseus, and a deterministic twice-as-fast Minotaur, find the minimum number of Theseus turns needed to reach the exit, or 0 if impossible.Medium7BFSSimulation+2No attempts yet1s128 MBJudgeable
Two-Stacks SolitaireGiven a stock pile dealt in order, decide whether the top card can be moved to intermediate pile 1 or 2 or popped to the foundation so all cards end non-decreasing.Medium7Dynamic programmingStack+2No attempts yet1s128 MBJudgeable
What's Up With GravityOn a grid with two gravity directions, find the minimum number of gravity flips to move from C to D, where falling is forced downward and you can step sideways only when blocked below.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
MirrorsGiven N small mirrors tilted at 45 degrees, find the first mirror whose flip lets a horizontal ray from the origin reflect to reach point (a,b).Medium7GeometrySimulation+2No attempts yet1s128 MBJudgeable
Unlocking BlocksThree connected polyomino pieces slide one unit at a time on a small grid; decide whether they can be moved so their bounding boxes are pairwise disjoint.Medium7BFSSimulation+2No attempts yet1s128 MBJudgeable
Wrong DirectionsGiven a command string of F, L, and R, count the distinct final positions reachable by changing exactly one character to a different one.Medium7SimulationHash map+2No attempts yet1s128 MBJudgeable
Cows on IceBessie slides on ice until a rock stops her; find the minimum number of pushes to move from her start cell to the goal cell.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Chocolate EatingSchedule N chocolates, eaten in fixed order over D days, to maximize the smallest bedtime happiness, where happiness halves each night and rises by eaten values.Medium7Binary searchGreedy+2No attempts yet1s128 MBJudgeable
Watering Plan CheckDecide whether a grid plan groups every non-scarecrow cell into connected triples with matching letters, then count the fence holes, or print -1.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Maximum FlowCompute the maximum flow from node A to node Z through a network of pipes with given capacities, using series and parallel reductions.Medium7GraphImplementation+2No attempts yet1s128 MBJudgeable
Pumps and PipesPlace the fewest pumps along a 20 m per pipe water line so pressure stays within limits, choosing the lexicographically smallest position set.Medium7Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Moon MooingStarting from an initial value, repeatedly apply two monotone linear-floor functions to all generated values and report the N-th smallest distinct value.Medium7HeapMath+2No attempts yet1s128 MBJudgeable
Crisis on the FarmGiven up to 1000 stacks of 30 cows and 1000 haystacks on a grid, choose K whistle moves (all stacks shift together) maximizing cows lifted onto haystacks, then output the lexicographically smallest best sequence.Medium7Brute forceSimulation+1No attempts yet1s128 MBJudgeable
Time PlannerGiven each of up to 20 members' busy intervals, output every maximal window of length at least one hour where at most one member is absent throughout.Medium7IntervalsSorting+2No attempts yet1s128 MBJudgeable
Moving Object RecognitionFind the largest connected white blob in each image, track its centroid over time, and report the average per-second velocity in x and y, each to two decimals.Medium7BFSSimulation+2No attempts yet1s128 MBJudgeable
WonderTeamFor each n, find the largest possible rank a team can reach while strictly leading the league in wins, goals scored, and fewest goals conceded in a double round-robin.Medium7GreedyMath+2No attempts yet1s128 MBJudgeable
Calculating Taxi FareGiven a sequence of streets with lengths and per-kilometer times, compute a passenger's fare between two streets using tiered per-kilometer pricing plus night and traffic surcharges.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
Left LabyrinthsSimulate a wall-following walker that always keeps its left hand on the wall and report whether it reaches the wider central courtyard.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
MBoneSimulate a multicast network of routers and hosts: process join, leave, and send events, propagating each packet along tunnels with TTL thresholds, and report the highest remaining TTL each host receives.Medium7GraphSimulation+2No attempts yet1s128 MBJudgeable
WordApply a cyclic cellular rewriting rule s times to a binary word of length n, then print the lexicographically smallest rotation.Medium7StringSimulation+2No attempts yet1s128 MBJudgeable
TimeGiven two valid dates and a period such as 3 months or 2 days, count how many whole periods aligned to unit boundaries fit between them using Gregorian leap year rules.Medium7MathImplementation+2No attempts yet1s128 MBJudgeable
GossipingGiven bus loops with drivers moving in lockstep, decide whether every driver eventually meets every other driver's news.Medium7SimulationMath+2No attempts yet1s128 MBJudgeable
RobotA circular robot on a grid of tracks must go from a start crossing with a given facing to a target crossing, moving 1 to 3 meters per GO and turning 90 degrees per TURN, each command costing one second; find the minimum time, or -1.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Follow My LogicParse ASCII circuit diagrams made of wires, junctions, AND/OR gates, and inversions, then evaluate the output for each given input assignment.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
EnigmaGiven a partial Enigma key and plaintext with a few unknowns, complete the decryption of the ciphertext.Medium7Brute forceSimulation+2No attempts yet1s128 MBJudgeable
Eeny MeenyFor each range of tribe sizes, find the smallest position that survives the 15-syllable counting-out for every size and both directions, or report that none exists.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
Calculator LanguageEvaluate expressions in a tiny language with right-associative equal-precedence operators, assignment, and right-to-left operand evaluation, then report changed variables.Medium7ImplementationRecursion+2No attempts yet1s128 MBJudgeable
Gears on a BoardDetermine each gear's rotation direction and speed from the motor, propagating through same-level ring contacts, and report overlap or conflicting rotation errors.Medium7GraphBFS+2No attempts yet1s128 MBJudgeable
String DecodingGiven a string, a permutation, and a large repetition count m, recover the string that the permutation maps to the given encoded string.Medium7MathImplementation+2No attempts yet1s128 MBJudgeable
Josephus, Once More!People are selected around a circle by the rule f(x)=(a x^2+b) mod N, starting at 0; each drinks on the second selection, and on the third everyone leaves. Count how many never drink.Medium7SimulationMath+1No attempts yet2s128 MBJudgeable
FractranGiven a list of fractions and a start value, repeatedly apply the first fraction that keeps the value an integer, and report the first m exponents of powers of two that appear.Medium7SimulationMath+2No attempts yet1s128 MBJudgeable
Hall of FountainsGiven n fountains inside n rooms, each periodically on/off with period 2p and offset q, find the earliest time to walk from before room 1 to past room n using one-second steps, entering a room only while its fountain is off.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Euro Cup 2000Given partial soccer standings and at most ten remaining games, find each team's best and worst possible final rank under the points and tiebreak rules.Medium7Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Analog Clock DisplayGiven times in HH:MM form, draw fixed-size ASCII analog clock faces with the hour and minute hands rasterized as line segments, following exact character rules.Medium7GeometrySimulation+2No attempts yet1s128 MBJudgeable
Bus SchedulesFor each test case, count the days of a given year that satisfy at least one weekday/holiday specifier and also fall inside a comma-separated list of dates and date ranges.Medium7ImplementationSimulation+2No attempts yet2s128 MBJudgeable
Japan Plotter DriverEmulate a plotter's POINT, TEXT, LINE, CLEAR, and PRINT commands on an ASCII grid, merging overlapping characters by fixed rules, and frame each finished picture.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
Traffic JamOn a 6x6 grid of sliding cars and trucks, find the minimum number of slides to drive vehicle x off the right edge, or report that it is impossible.Medium7BFSSimulation+2No attempts yet1s128 MBJudgeable
DefragmentationGiven K files scattered across N disk clusters, find the minimum number of cluster moves to pack them consecutively in file order.Medium7GraphSimulation+1No attempts yet1s128 MBJudgeable
Lazy and Strict EvaluationGiven function definitions in a small Lisp-like language, count how many times each arithmetic operation runs under lazy (memoized) versus strict evaluation, skipping non-terminating tests.Medium7ImplementationRecursion+2No attempts yet1s128 MBJudgeable
Simplified λ-evaluationsEvaluate simplified lambda-calculus expressions by substitution, stopping after 1000 applications and printing unterminated if it does not finish.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Odd Loving BakersSimulate monthly celebrations where bakers with an odd chalk count win and add marks to their favorite bakers; find the number of winners at celebration t up to 1e9.Medium7Bit manipulationMath+2No attempts yet1s128 MBJudgeable
TourneyMaintain a single-elimination bracket of 2^N players under point updates, and answer queries about the winner's position and how many rounds a given player wins.Medium7TreeSegment tree+2No attempts yet2s512 MBJudgeable
ParadeMaintain a list of N perimeter-rotation commands on a 4x4 grid under Q cumulative point updates, printing the resulting grid after each update.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
S and KGiven binary trees written with S and K, repeatedly apply the two rewrite rules until no rule fires, then print the final tree string.Medium7ImplementationSimulation+2No attempts yet3s128 MBJudgeable
A Knightly PursuitGiven board size and starting squares for a pawn and a knight, decide whether the knight can win, force a stalemate, or loses, and report the minimum knight moves.Medium7BFSSimulation+2No attempts yet1s128 MBJudgeable
HoppersFind the minimum number of hops from S to F on a grid, where each hop changes the velocity by at most 1 per component and lands only on empty squares.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Ent NumbersSimulate a Goodstein-like sequence where each step subtracts one, then raises the base while keeping digits, and report the base where the term first hits 0 or that it exceeds 2^60.Medium7ImplementationMath+1No attempts yet1s128 MBJudgeable
BSP TreesBuild a BSP tree by inserting p slanted planes into the xz-plane, assign n polygons to leaf regions, then print objects in the drawing order the tree induces.Medium7GeometryTree+2No attempts yet1s128 MBJudgeable
Biased DiceSimulate dropping biased dice one by one onto a grid and count which numbers show on the top faces of the final pile.Medium7SimulationImplementation+2No attempts yet1s128 MBJudgeable
Packing RectanglesGiven four rectangles, find every smallest enclosing axis-parallel rectangle that fits all four without overlap, using the six basic layouts.Medium7Brute forceGeometry+2No attempts yet1s512 MBJudgeable
PuzzleGiven an n by n permutation board, decide whether row and column cyclic shifts can turn it into the target board where cell (i,j) holds (i-1)*n+j.Medium7MathImplementation+2No attempts yet1s128 MBJudgeable
House ConstructionFind the minimum number of days to build L houses given that factories cost Y planks and occupy plot space, produce 10 planks per day, and planks expire nightly.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Obstacle CourseFind the minimum number of one-second straight-line moves for a puck starting at rest at the origin, where each flick changes a velocity component by 1 m/s up to 7, avoiding stick obstacles and ending exactly on the target point.Medium7BFSGeometry+2No attempts yet2s128 MBJudgeable
VangOn a polygonal grid yard, a guard moving twice per turn chases a prisoner who can move or wait; report the guard turn when capture happens.Medium7BFSGraph+2No attempts yet1s1024 MBJudgeable
FeatherA feather drifts across a windy grid where whirlwind directions rotate clockwise each second; determine whether it lands, exits the island, or drifts forever, and report the relevant cell.Medium7SimulationGraph+2No attempts yet1s1024 MBJudgeable
Griddy HobbyStarting from a boundary point, draw a 45-degree diagonal, then perpendicular segments until the path closes or stalls; count the minimal rectangles carved out.Medium7SimulationGeometry+2No attempts yet1s128 MBJudgeable
Wiping WordsRepeatedly blank out any word whose column has no support in the next line, or that appears in the last line, until no more words can be wiped.Medium7SimulationImplementation+1No attempts yet1s128 MBJudgeable
Afshung Pizza DeliveryGiven an ASCII street map with rotating traffic lights at intersections, find the minimum travel time from S to D, or report impossible.Medium7Shortest pathGraph+2No attempts yet1s128 MBJudgeable
Illusive ChaseGiven a grid with obstacles and a log of chase trips, each recorded as a range of steps in one direction, count the possible starting cells consistent with the whole sequence.Medium7ArrayBrute force+2No attempts yet1s128 MBJudgeable
The GameGiven N and a count M of 'I don't know' answers, find all pairs the master could have chosen in the sum-product guessing game.Medium7SimulationMath+2No attempts yet1s128 MBJudgeable
Computer DialogueGiven file names split into name and extension parts, simulate the alternating 'I don't know' messages between two clients and list files still possible after M messages.Medium7SimulationHash map+2No attempts yet1s128 MBJudgeable
UFO Cubes in RoswellGiven a cube with mirrors at integer points, trace every downward light ray and report how many exit each face and how many deflections they took.Medium7SimulationImplementation+2No attempts yet2s1024 MBJudgeable
Pixel ShuffleGiven a permutation of an n by n pixel grid built from at most 32 named transformations, find the smallest positive power that returns the image to its original state.Medium7MathImplementation+2No attempts yet2s1024 MBJudgeable
ArtinalsInterpret a small language over hereditarily finite sets, evaluating assignments, expressions and relations, and print reduced canonical set representations.Medium7StringImplementation+2No attempts yet1s512 MBJudgeable
Hexaroman NumbersParse and output hexadecimal Roman numerals, choosing the shorter of additive or subtractive notation per digit, then evaluate +, -, and * expressions.Medium7StringImplementation+2No attempts yet1s128 MBJudgeable
PalindromesFor each number in a small interval written in base b, apply reverse-and-add up to l times and count how many do not reach a palindrome.Medium7SimulationMath+2No attempts yet1s128 MBJudgeable
Fighting for TrianglesOn a triangular board with some edges already drawn, two players alternate adding edges, claiming a unit triangle when their edge completes it. Decide the winner with optimal play.Medium7Game theoryGraph+2No attempts yet2s512 MBJudgeable
FuturamaGiven M distinct mind swaps among N customers, find the minimum number of additional swaps, using two extra bodies, to return every mind to its own body.Medium7GraphGreedy+2No attempts yet1s128 MBJudgeable
Fruit BowlGiven a V-shaped bowl with left and right wall angles and height H, simulate greedily dropping unit circles to find how many fit below the rim.Medium7GeometrySimulation+1No attempts yet1s128 MBJudgeable
CardsFind the initial deck order that makes the shuffle, driven by the primes, output cards N down to 1.Medium7SimulationMath+2No attempts yet1s16 MBJudgeable
CocktailA cube is lowered into a vessel holding two immiscible liquids of different densities; some liquid may spill. Find the final liquid height using Archimedes' principle.Medium7MathImplementation+2No attempts yet1s128 MBJudgeable
Counting Satisfying AssignmentsParse one logical formula and count how many of the 4096 assignments to twelve variables make it true.Medium7ImplementationSimulation+2No attempts yet2s256 MBJudgeable
Jakarta Traffic JamFind the fastest travel time between two intersections where each street is driven at half speed during its own daily rush hour, and you never stop to wait. Each test case gives up to 20 nodes; report the minimum minutes to two decimals.Medium7GraphShortest path+2No attempts yet1s128 MBJudgeable
Toy CarsBelady's caching: given a sequence of toy cars a child will request, minimize the number of times a car must be fetched from the shelf when at most k can be on the floor.Medium7GreedyHeap+1No attempts yet3s128 MBJudgeable
TreasureGiven clockwise-ordered corridors between vaults and guards following the right-hand rule, find which guards eventually collect all pieces of information.Medium7GraphSimulation+2No attempts yet3s128 MBJudgeable
ShuffleGiven a permutation b and an integer l, count the permutations a whose l-th iterate equals b, modulo 1e9+7.Medium7CombinatoricsMath+2No attempts yet3s128 MBJudgeable
RobinsonGiven an n by n grid with a boat shape, water, and obstacles, find the minimum number of unit translations in four directions to slide the boat completely off the map.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
TrainsAfter each of m car swaps, track the largest number of trains that ever shared each train's exact colour string.Medium7Hash mapString+1No attempts yet1s128 MBJudgeable
Ball Boxesn boxes in a row hold equal red and green balls with two adjacent empties; repeatedly move two balls into those empties and output a sequence that groups all reds before all greens.Medium7GreedySimulation+2No attempts yet1s128 MBJudgeable
BilliardsDecide which of six table pockets a frictionless bouncing ball reaches, or report that it never falls in.Medium7MathNumber theory+2No attempts yet1s128 MBJudgeable
Physical EducationJasio can skip up to k duels where he is the left student; find the leftmost final position he can reach.Medium7ArrayDynamic programming+2No attempts yet1s128 MBJudgeable
MechagodzillaAfter each swap of two program letters, decide if the automaton run from the start state ends in a battle state.Medium7Segment treeSimulationNo attempts yet1s128 MBJudgeable
CylindersTwo identical cylinders with the same n scale marks start empty; find the minimum number of fill, drain, and pour actions to leave exactly l millilitres in one cylinder, or report it impossible.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Number of PeanutsSimulate a squirrel that toggles peanuts on a grid while turning left or right, and count the peanuts after t seconds with t up to 1e9.Medium7SimulationImplementation+1No attempts yet1s128 MBJudgeable
PushPushPush rocks one cell at a time across a grid map to walk from the entrance to the treasure.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable
Aquarium 1Given a stepped aquarium bottom with drain holes, compute the volume of water that stays trapped after drainage.Medium7SimulationGeometry+1No attempts yet1s128 MBJudgeable
Bulletin boardsArrange ordered framed pictures into consecutive strips with shared frames and centering to fit the smallest area rectangle.Medium7Dynamic programmingSimulationNo attempts yet1s128 MBJudgeable
Counting ponorksCount unit steps to walk a right-angled wall route where steps cut straight across corners and a final partial step of at least half a unit counts as one.Medium7GeometrySimulation+1No attempts yet1s128 MBJudgeable
Baffled!The program reads a baffled grid tank and reports how much water fits before trapped air stops filling.Medium7BFSGraph+2No attempts yet1s128 MBJudgeable