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 results1,798 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Walking RouteGiven N vectors forming a walking route, output the total displacement and the minimum distance from the start after removing exactly one segment.Easy3ArrayMath+1No attempts yet1s128 MBJudgeable
LukaSimulate a walker's path on a grid and output every time step when the walker is within Chebyshev distance 1 of a fixed point.Easy3SimulationArrayNo attempts yet1s128 MBJudgeable
Sum of Two NumbersCount pairs of distinct integers in an array that sum exactly to a given value x.Easy3Hash mapTwo pointers+1No attempts yet1s128 MBJudgeable
DECODEBuild a substitution cipher table from a key word placed at a given offset, then decode a given ciphertext using it.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable
Whitespace King: Aligning ColumnsReformat text lines so that words in each column line up to a width equal to the longest word in that column, with single spaces separating columns.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Water Main BreakGiven several water main breaks with start, end, and flow rate, sum the gallons leaked during each second of a given query interval.Easy3ArraySimulation+1No attempts yet1s128 MBJudgeable
Building a Swimming PoolCompute the minimum cost to convert a grid into grass/hole cells, forcing the border to be grass and charging per boundary edge between grass and hole.Easy3ArrayGreedy+1No attempts yet2.5s128 MBJudgeable
Control PointsGiven sorted coordinates of control points, find the minimum number of length-1 half-open intervals needed to cover all points using a greedy sweep.Easy3GreedySorting+1No attempts yet1s128 MBJudgeable
Gray AreaCompute weighted ink used by a histogram where each bar contributes its normalized height times a linearly decreasing darkness, plus a fixed constant.Easy3ArraySimulation+1No attempts yet1s128 MBJudgeable
Roll CakeGiven N interval requests over pieces 1..L, find the member with the largest requested length, then the member who actually receives the most pieces when earlier requests get priority.Easy3SimulationArray+1No attempts yet1s128 MBJudgeable
WindowsGiven windows in opening order, answer clicks by returning the most recently opened window covering each click point, or background if none does.Easy3ArrayBrute force+2No attempts yet1s128 MBJudgeable
LCRSimulate the dice game LCR turn by turn with the given rolls, then print the final chip counts for each player and the center.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
ProfitGiven a sequence of daily profits, find the maximum total over any non-empty stretch of consecutive days, across several test cases.Easy3ArrayDynamic programming+1No attempts yet1s256 MBJudgeable
Subset SumGiven up to 20 bag sizes and a target n, pick each bag at most once to reach at least n with the smallest possible total.Easy3Brute forceBit manipulation+1No attempts yet1s128 MBJudgeable
Exact ChangeGiven a price and a multiset of up to 100 coin values, pick a subset summing to at least the price; minimize the sum first, then the number of coins.Easy3Dynamic programmingArray+1No attempts yet1s128 MBJudgeable
Snakes and LaddersSimulate a Snakes and Ladders game with a players and a list of die rolls, applying snakes and ladders after each move, and print each token's final square.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Conformity PrizeCanonicalize each frosh's five courses, count how many frosh share each set, then output the total over all sets with the maximum count.Easy3Hash mapSorting+2No attempts yet1s128 MBJudgeable
To and FroDecode a message written row by row in alternating left-to-right and right-to-left order back into column-major plaintext.Easy3StringSimulation+2No attempts yet1s128 MBJudgeable
Traditional BINGOFor each card, find how many announced numbers are needed before some row, column, or diagonal of five spaces is fully marked, with the center free.Easy3SimulationArray+2No attempts yet1s128 MBJudgeable
ForestsCount how many distinct nonempty sets of trees appear among the (person, tree) pairs; people who heard nothing are excluded.Easy3Hash mapSorting+2No attempts yet1s128 MBJudgeable
Stack 'em UpApply a sequence of fixed 52-card permutation shuffles to a new deck, printing the deck after each shuffle.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Jolly JumpersFor each sequence, check whether the absolute differences of adjacent elements are exactly the set 1 to n-1.Easy3ArrayHash map+2No attempts yet1s128 MBJudgeable
MinesweeperGiven an n×n mine layout and which cells are currently opened, print the board: mine counts for opened safe cells, asterisks for all mines if any mine was opened, and dots elsewhere.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
ElectionCount the votes each candidate receives in one riding, ignore unknown names, and report the winner's party or independent, or tie if there is no strict winner.Easy3Hash mapImplementation+2No attempts yet1s128 MBJudgeable
Queue RearrangementGiven a queue of m items and n simultaneous move operations, apply all moves at once and print the resulting queue order.Easy3ArraySimulationNo attempts yet1s128 MBJudgeable
Mad ScientistRecover a non-decreasing sequence of measurements from its cumulative counts P(j), the number of measurements at most j, for each j from 1 to k.Easy3ArrayPrefix sum+1No attempts yet1s128 MBJudgeable
Symmetric OrderGiven a list of names sorted by length, rearrange them so shorter names sit at the top and bottom and longer ones in the middle, pairing names from the start.Easy3ArrayImplementation+2No attempts yet1s128 MBJudgeable
Flow LayoutPlace rectangles left to right into rows under a max width, wrap when one does not fit, and report the final window width and total height.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Loansome Car BuyerSimulate monthly depreciation and payments on a car loan, and report the first month when the amount owed drops below the car's value.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Booklet PrintingFor each page count, print which page numbers (or Blank) go on each side of every sheet in fold-over booklet order.Easy3ArrayImplementation+1No attempts yet1s128 MBJudgeable
Self NumbersPrint all self numbers up to 10000, that is, numbers with no generator under d(n) = n + digit sum of n.Easy3ImplementationMath+2No attempts yet1s256 MBJudgeable
Counting PagesGiven a document's page count and a comma-separated list of page ranges, count the distinct pages that are actually printed, ignoring empty ranges and pages past the end.Easy3ImplementationString+2No attempts yet1s256 MBJudgeable
Tetromino Maximum SumGiven an N x N grid of integers, place one of the five tetrominoes (with rotations, not flips) so the four covered cells have the largest sum.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Equal Total ScoresFind one card from each person to swap so their total scores match, choosing the pair with the smallest sum, or print -1.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Hanafuda ShuffleCards 1 to n start from the bottom, and each cut moves a contiguous block of c cards starting at position p to the top; report the top card after all cuts.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
The God of ParkingGiven shop coordinates on a line, pick an integer parking spot and visit all shops, returning to the car, to minimize total walking distance.Easy3MathGreedy+2No attempts yet1s128 MBJudgeable
Hostel NightsFor each week, apply five nights of elimination rules to 20 rooms and list the students who survive the most nights, ordered by room number.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Air Old ZeelandFor each customer, sum the prices of requested products whose shipping delay fits the wait limit, flag customers who miss any product, and count them.Easy3ImplementationArray+2No attempts yet1s128 MBJudgeable
Postman JoeSimulate Joe's walk on 20 houses, flag any out-of-range or repeated house as illegal, else list the houses with no delivery.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
TargetGiven all solution words of a letter puzzle, recover the 9 grid letters and place the letter common to every word in the middle.Easy3ArrayHash map+1No attempts yet1s128 MBJudgeable
AlarmistGiven n samples and a window size w, compute the floor of each window average and report the difference between the largest and smallest average.Easy3Sliding windowArray+1No attempts yet1s128 MBJudgeable
Weird CurrencyGiven a chain of denomination conversion rates, convert each vendor's price to the smallest unit and report the difference between the highest and lowest price.Easy3MathImplementation+1No attempts yet1s128 MBJudgeable
Subway FaresGiven a per-stop fare table and an ordered list of station names, find the number of stops between two stations and print the corresponding fare.Easy3ArrayString+2No attempts yet1s128 MBJudgeable
LobbyingSum each lawmaker's donations made within 1000 days before the vote, then weight each no vote by 1/(1+D/10000) and add up both sides.Easy3ImplementationMath+2No attempts yet1s128 MBJudgeable
Gadget PurchasesCount how many visits demand each machine, cap each count at its usage limit, and report the machines whose revenue beats purchase plus usage cost.Easy3ArrayImplementation+2No attempts yet1s128 MBJudgeable
A Fistful of DollarsGiven transaction totals for s people, find the person whose spending exceeds twice that of every other person, or report none.Easy3ImplementationArray+1No attempts yet1s128 MBJudgeable
FingerprintsFor each of K query 5x5 bitmaps, find the database bitmap with the smallest Hamming distance and print all tied indices in increasing order.Easy3ArrayBit manipulation+2No attempts yet1s128 MBJudgeable
FundraisingGiven a sequence of donation transactions, aggregate the amount each donor gave to each candidate and in total, then report every donor whose per-candidate total exceeds $2100 or whose overall total exceeds $40000. The core task is grouping and summing values by keys, then applying two threshold checks.Easy3Hash mapArray+1No attempts yet1s128 MBJudgeable
Global WarmingGiven a small land/sea grid, mark every land cell with three or more sea neighbours as sea simultaneously, then print the tight bounding box of the remaining land.Easy3ArraySimulation+2No attempts yet1s128 MBJudgeable
SambaGiven the school IDs of n dancers, find the single school whose total dancer count is not a multiple of k.Easy3Hash mapArrayNo attempts yet1s64 MBJudgeable
Coin RowGiven rows of coin values, pick non-adjacent coins to maximize the total collected in each row.Easy3Dynamic programmingArrayNo attempts yet1s128 MBJudgeable
MusicCount length-m windows whose max minus min is at most c, across several small arrays.Easy3Sliding windowArrayNo attempts yet1s128 MBJudgeable
DecoderEach word contributes one letter: the first letter of the first word, then the k-th letter of each word where k is the previous word's length; spaces appear when the previous word is too long.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Escape RouteFor each grid, find the ship and the planet nearest to it, breaking ties by row-major order, and print both coordinates with the distance to two decimals.Easy3ArrayImplementation+2No attempts yet1s128 MBJudgeable
Secret LetterGiven a ciphertext, undo a 90-degree clockwise rotation of a square grid to recover the original letter.Easy3ImplementationArray+2No attempts yet1s128 MBJudgeable
POIEach problem's value is the count of contestants who missed it; report Philip's total score and his rank using the four tiebreak terms.Easy3ImplementationArray+2No attempts yet1s256 MBJudgeable
NumbersGiven N positive integers, find the value with the highest frequency, breaking ties by choosing the smallest value.Easy3ArrayHash map+1No attempts yet1s128 MBJudgeable
UniqueFor each of three rounds, a player scores the number written only if no one else wrote it, and totals are printed in input order.Easy3ArrayHash map+1No attempts yet1s128 MBJudgeable
TilesFor each of K tiles in an N x N ring-colored square, find which concentric ring holds it and output the ring's color.Easy3MathImplementation+1No attempts yet1s128 MBJudgeable
The TravelerGiven gaps between n towns and a walk of m east/west jumps, find the total distance covered, reported mod 100000.Easy3Prefix sumArray+2No attempts yet1s128 MBJudgeable
Card Captor SanggeunSimulate a two-player card game where each player always plays the smallest legal card, and report the final scores.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Maximum SumGiven n integers and a window size k, find the largest sum of any k consecutive terms.Easy3ArraySliding window+1No attempts yet1s128 MBJudgeable
Card RearrangementStarting from the stack 1, 2, ..., 2n, apply a sequence of cuts and riffle shuffles and print the final order of the cards.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Commute RouteCount monotone east/north lattice paths from (1,1) to (a,b) that avoid n blocked intersections, with a and b at most 16.Easy3Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
School Trip Destination RankingCount how many of n students want each of m destinations, then print destination numbers by descending count with ties broken by ascending number.Easy3ArraySorting+1No attempts yet1s128 MBJudgeable
Rolling a DieSimulate rolling a die through a list of moves and sum the top face value after each move.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Line of Best FitGiven n points in the plane, compute the slope and intercept of the least squares regression line and print each rounded to three decimals.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
Bingo!Given a set of balls, decide whether every value from 0 to N appears as the absolute difference of some ordered pair of balls in the set.Easy3Brute forceMath+2No attempts yet1s128 MBJudgeable
ElectricityGiven dated meter readings sorted by date, count pairs on consecutive calendar days and report how many such days exist plus the total consumption between them.Easy3ImplementationMath+2No attempts yet1s128 MBJudgeable
He is offside!Given distances of attackers and defenders to the goal line, decide whether any attacker is offside, meaning nearer to the goal than the second-last defender.Easy3ImplementationSorting+2No attempts yet1s128 MBJudgeable
Grandpa is Famous!Given weekly ranking lists, count how many times each player appears, then print the players with the second-highest count in ascending order.Easy3Hash mapSorting+2No attempts yet1s256 MBJudgeable
Fake TicketsGiven N genuine ticket numbers and a list of M collected ticket numbers, count how many distinct values appear more than once in the list.Easy3ArrayHash map+1No attempts yet1s128 MBJudgeable
Find the CowCount ordered pairs of indices (x, y) with x < y where an "((" starts at x and a "))" starts at y in a parenthesis string.Easy3StringPrefix sum+2No attempts yet1s128 MBJudgeable
Hay BalesGiven N piles of hay with possibly unequal heights, find the minimum number of bales to move so all piles have equal height.Easy3ArrayMath+1No attempts yet1s128 MBJudgeable
ProfitsGiven a sequence of N daily profits, find the maximum sum over any contiguous stretch of days.Easy3ArrayDynamic programming+2No attempts yet1s128 MBJudgeable
The Robot PlowGiven up to 200 axis-aligned rectangles on a grid at most 240 by 240, count the number of unit squares covered by at least one rectangle.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Lonesome PartnersGiven N points, find the 1-based indices of the two points with the largest Euclidean distance, guaranteed unique.Easy3Brute forceGeometry+2No attempts yet1s128 MBJudgeable
Plumbing the PondGiven a grid of depth readings, find the largest positive value that appears in at least two cells adjacent horizontally, vertically, or diagonally.Easy3ArrayImplementation+2No attempts yet1s128 MBJudgeable
The Perfect CowGiven an odd N by N grid, take the median of each row, then return the median of those N row medians.Easy3SortingArray+1No attempts yet1s128 MBJudgeable
Good GrassFind the 3x3 subgrid with the largest sum in a grid of milk values and report that sum with the upper-left corner, breaking ties by smallest row then column.Easy3ArrayPrefix sum+2No attempts yet1s128 MBJudgeable
BookshelfGiven cow heights and a shelf height B, find the smallest number of cows whose heights sum to at least B.Easy3GreedySorting+2No attempts yet1s128 MBJudgeable
Costume PartyCount pairs of cows whose lengths sum to at most S.Easy3SortingTwo pointers+1No attempts yet1s128 MBJudgeable
Best GrassCount clumps of # cells in a grid, where each clump is one cell or two orthogonally adjacent cells and different clumps never touch.Easy3ArraySimulation+2No attempts yet1s128 MBJudgeable
Going to the MoviesGiven a truck capacity C and up to 16 cow weights, pick a subset whose total weight is as large as possible without exceeding C.Easy3Brute forceBacktracking+2No attempts yet1s128 MBJudgeable
Serious Cow TagSimulate the elimination game where each active cow tags her nearest remaining cow, and report the last cow standing.Easy3SimulationGeometry+2No attempts yet1s128 MBJudgeable
Making ChangeGiven a target amount and up to 10 coin denominations, find the fewest coins that sum exactly to the target.Easy3Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
Balloon GameGiven N slots and Q arithmetic progressions, mark the slots each pass would fill (skipping already filled ones), then count the empty slots.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Blowing FusesSimulate toggling devices on and off, tracking the running total power and whether it ever exceeds the fuse capacity.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Box of BricksGiven stack heights whose total is divisible by n, find how many bricks must move so every stack reaches the equal target height.Easy3ArrayGreedy+2No attempts yet1s128 MBJudgeable
Set MeGiven tableaus of Set cards, print each tableau and then every triple of cards that forms a valid set, in index order.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Clock PatienceSimulate Clock Patience on several decks: deal cards into 13 piles, flip cards following rank-to-pile moves, and report how many cards were exposed and the last card.Easy3SimulationArray+1No attempts yet1s128 MBJudgeable
Prime CutsFor each N and C, build the primes from 1 to N and print the middle C*2 or C*2-1 of them, or the whole list if that many do not exist.Easy3MathNumber theory+2No attempts yet1s128 MBJudgeable
Evaluating Simple C ExpressionsEvaluate a sequence of simple C expressions with +, -, and prefix or postfix ++/--, printing the expression value and the final values of used variables.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Ambiguous PermutationsFor each permutation, decide whether it equals its own inverse, meaning position of value i equals the value at position i.Easy3ArrayImplementationNo attempts yet1s128 MBJudgeable
Polygon Programming with EaseGiven the midpoints of the edges of a polygon with an odd number of vertices, recover the original vertex coordinates using an alternating sum and forward substitution.Easy3MathGeometry+2No attempts yet1s128 MBJudgeable
Error CorrectionFor each square 0/1 matrix, report OK if every row and column sum is even, the single bit that fixes the parity if exactly one row and one column are odd, or Corrupt otherwise.Easy3ImplementationArray+2No attempts yet1s128 MBJudgeable
Bridge HandsDeal a 52-card deck to four bridge players from a given dealer, sort each 13-card hand by suit and rank, and print the hands in a fixed card-table format.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Absolutely AcidicCount the frequency of readings in the range 1 to 1000, then apply tie-breaking rules to find which two readings to subtract.Easy3ArrayImplementation+1No attempts yet2s512 MBJudgeable
Up and DownTwo walkers repeat a forward/backward step cycle; after s steps, report whose distance from the start is greater, or Tied.Easy3SimulationMath+2No attempts yet2s512 MBJudgeable
GPS Text EntryGiven a fixed 5x6 letter grid, compute the total cursor moves to type a string starting from 'A' and then reach 'enter'.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable