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,730 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Word AmalgamationFor each scrambled word, print all dictionary words that are anagrams of it in alphabetical order, or NOT A VALID WORD.Easy3Hash mapSorting+2No attempts yet1s128 MBJudgeable
Losers Are WinnersGroup contestants into teams of two, compute each team's percentage of combined weight lost, and print the winner with one decimal place.Easy3Hash mapImplementation+2No attempts yet1s128 MBJudgeable
I-SoarGiven building intervals along a highway, find the total length of the highway not covered by any building.Easy3IntervalsSortingNo attempts yet1s128 MBJudgeable
Beautiful TriangleGiven three vertices, classify the triangle by side lengths and by angles, or report that the points are collinear.Easy3GeometryMath+2No attempts yet1s128 MBJudgeable
Post OfficeSort each item's three dimensions into length, height, and thickness, then apply the postal size rules to print one of four classes.Easy3ImplementationMath+2No attempts yet1s128 MBJudgeable
Bridge BiddingFor each 13-card bridge hand, compute high card points and suit lengths, then print the first applicable opening bid rule.Easy3ImplementationSimulation+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
ShirtsMerge two already sorted lists of shirts and print one merged list ordered by size, then by colour letter. Multiple scenarios end with a 0.Easy3SortingTwo pointers+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
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
Pirates On ParadeSort pirates by height, then pair each shortest remaining pirate with the next one if their heights differ by at most 2 inches, and drop the rest.Easy3SortingGreedy+1No attempts yet1s128 MBJudgeable
Duplicate SSNRead a list of Social Security numbers until the sentinel 000-00-0000, then print every number that appears more than once in ascending order.Easy3Hash mapSorting+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
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
Common DivisorsGiven 2 or 3 numbers up to 1e8, print every positive integer that divides all of them, in increasing order.Easy3MathNumber theory+2No attempts yet1s256 MBJudgeable
Reversed-Element SortReverse the digits of each of n positive integers, drop leading zeros, then print the reversed values in ascending order.Easy3SortingMath+1No 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
Magic TrickGiven four cards in the order shown, decode the hidden fifth card using the suit of the first card and the permutation of the last three.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
Race ResultsSort N finish times given as hours, minutes, and seconds in ascending order and print each on its own line.Easy3SortingImplementationNo attempts yet1s128 MBJudgeable
Theater SeatingAssign each seat a priority by Euclidean distance to the middle of row 1, breaking ties by row then by seat number, and print rows back to front.Easy3SortingMath+1No 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
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
Unix ls Column FormattingSort filenames by ASCII value and lay them out in column-major order with fixed-width padding, as few rows as fit in 60 characters.Easy3SortingImplementation+2No attempts yet1s128 MBJudgeable
Soccer TournamentRead team lists and played games, then print a result grid and a standings table sorted by points, goal difference, goals, wins, and reverse input order.Easy3ImplementationSortingNo attempts yet1s128 MBJudgeable
Read the ChessboardGiven an ASCII-art chessboard, list each side's pieces in standard notation, grouped by type in a fixed order and sorted by position rules.Easy3ImplementationString+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
Fix-Free CheckFor each triple of words, decide whether no word is a prefix or suffix of another, printing Yes or No.Easy3StringBrute force+2No attempts yet1s128 MBJudgeable
TopYodellerCompute each yodeller's cumulative score after every round, find who ends with the highest total, and report their worst rank.Easy3ArraySimulation+1No attempts yet1s128 MBJudgeable
The Students' Council BreakfastGiven four ticket prices and a target amount, list every non-negative count combination that hits the target, count them, and report the fewest tickets needed.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
SentencesGiven lists of subjects, verbs, and objects, print every subject-verb-object sentence in alphabetical order, with a blank line between datasets.Easy3Brute forceSorting+2No attempts yet1s128 MBJudgeable
Train SwappingFor each test case, count the inversions of a permutation of 1..L, the minimum number of adjacent swaps needed to sort the train.Easy3ArraySorting+2No attempts yet1s128 MBJudgeable
Trimmed and Corrected MeanGiven N judge scores and an integer K, sort the scores, then output the trimmed mean that drops K from each end and the corrected mean that replaces those extremes with the nearest kept value, both rounded to two decimals.Easy3SortingPrefix sum+2No attempts yet1s256 MBJudgeable
Milk and HoneyEach field holds either cows up to its cow limit or bees up to its bee limit; assign each field one animal type to maximize happiness from milk and honey.Easy3GreedySorting+2No attempts yet1s1024 MBJudgeable
AnimalsGiven N active time intervals, find whether they share a common moment and, if so, the longest interval when all animals are active.Easy3IntervalsImplementation+2No attempts yet1s1024 MBJudgeable
SortingA full comparison table between two hidden permutations of 1..N is given; recover the value on every card.Easy3SortingImplementationNo attempts yet1s1024 MBJudgeable
ElevatorRusnė goes from floor 0 to floor N using the elevator for at most K segments; minimize the total height of the segments she climbs on foot.Easy3GreedySorting+1No attempts yet1s1024 MBJudgeable
Ancient KeyboardSimulate a keyboard where each of up to 26 keys toggles an LED at two given times, and output the letter matching the LED count at each time step until all intervals end.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Ride My BicycleCompute the ratio of each of the 21 front and back gear pairs, round to two decimals, and print them sorted by ratio then chain ring.Easy3SortingImplementation+1No attempts yet1s128 MBJudgeable
BoxGiven six rectangles that can be rotated, decide whether they form the three pairs of opposite faces of a rectangular box.Easy3ImplementationSorting+1No attempts yet2s128 MBJudgeable
Kick-TippGiven each participant's predicted scores and the actual results over several rounds, compute total points, award round dots to top scorers, and print the sorted standings.Easy3ImplementationSorting+1No attempts yet1s128 MBJudgeable
StampsGiven a needed stamp count and each friend's offer, find the fewest friends whose offers sum to at least the needed amount, or report impossible.Easy3GreedySorting+2No attempts yet1s128 MBJudgeable
StrategiesGiven contest time and problem times, simulate three orderings (input, ascending, descending) and pick the winner by problems solved, then score, then Steve.Easy3SimulationSorting+1No attempts yet1s128 MBJudgeable
AnagramsGiven several word lists, print the first word in each list that has the most anagrams, along with that count.Easy3Hash mapString+1No attempts yet1s128 MBJudgeable
Matryoshka DollsGiven doll heights, nest each doll inside a strictly taller doll, each holding at most one, to minimize the number of outermost dolls.Easy3GreedySorting+1No attempts yet1s128 MBJudgeable
The Chosen Sub MatrixFor each N x N matrix, find the M x M sub matrix with the fewest distinct values, breaking ties by larger descending value lists, then by smaller top-left row and column.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Email from the ProfessorWrite each message row by row into a grid of width k, then read columns in the order given by a permutation key, dropping padding cells.Easy3ImplementationArray+2No attempts yet1s128 MBJudgeable
ACM Rank TableAggregate each team's runs under ACM penalty rules, then sort teams by solved count, total time, and team number.Easy3SortingImplementation+1No attempts yet2s128 MBJudgeable
SupermarketFind the k-th smallest value among n amounts spent, with values bounded by 100000.Easy3SortingArray+2No attempts yet1s128 MBJudgeable
IntervalsGiven n closed intervals, merge all overlapping or touching ones and print the resulting disjoint intervals in ascending order.Easy3SortingIntervals+2No attempts yet1s128 MBJudgeable
TablesGiven box screw counts, find the fewest boxes whose screws total at least s*k.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
Binary ScaleSort the given (reading, precision) pairs by reading divided by 2 to the precision, breaking ties by smaller reading.Easy3SortingNo attempts yet1s128 MBJudgeable
Sorting the JewelrySort up to 150 lowercase strings by increasing length, breaking ties in lexicographic order.Easy3SortingNo attempts yet1s512 MBJudgeable
The BetTurn the fewest dice so exactly k of the six faces appear, keeping the most frequent faces and adding missing ones.Easy3GreedySorting+1No attempts yet1s128 MBJudgeable
NailsLower at most k nails to match a chosen height and maximize how many nails share that height.Easy3SortingGreedyNo attempts yet1s128 MBJudgeable
TapsClose the fewest flowing taps so the average temperature of the water still flowing reaches at least w.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
CircuitsPick the most cables whose total battery voltage does not exceed their total wire tolerance.Easy3SortingGreedy+1No attempts yet1s128 MBJudgeable
IntervalsCount the integers covered by at least one of N closed intervals in each test set.Easy3IntervalsSortingNo attempts yet2s128 MBJudgeable
PasswordFind the K-th password in lexicographic order whose letters appear in the same column of both 6 by 5 grids, or print NO.Easy3CombinatoricsSorting+1No attempts yet1s128 MBJudgeable
HunterCount animals within range L of a firing position on the x-axis under distance |x - a| + b.Easy3Binary searchSortingNo attempts yet1s128 MBJudgeable
6174For each four-digit number, repeat the Kaprekar digit-sort subtraction until 6174 appears and report the step count.Easy3SimulationSortingNo attempts yet1s128 MBJudgeable
ICPC RankingSimulate the ICPC log to score each team by solved problems and penalty time, then print the ordered ranking with ties marked.Easy3SimulationSorting+1No attempts yet1s128 MBJudgeable
Inviting the Village ChiefPlant one tree per day in the best order and report the earliest day after all trees have finished growing.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
EligibilityCount distinct contest years per contestant after dropping duplicate records and print names with four or fewer in lexicographic order.Easy3Hash mapSortingNo attempts yet1s128 MBJudgeable
Sort MeThe program sorts each dataset of up to 20 words by the given custom alphabet and prints the ordered list.Easy3SortingStringNo attempts yet1s128 MBJudgeable
Ballot Analyzing DeviceCount ballots with exactly one mark as votes, rank candidates by votes keeping ballot order on ties, and print each percentage plus the invalid share.Easy3ImplementationSorting+1No attempts yet2s256 MBJudgeable
PoliticsOrder supporters by the listed candidate order, keep original order within each candidate, and group unlisted candidates at the end by first appearance.Easy3SortingHash mapNo attempts yet15s256 MBJudgeable
FootballDistribute at most G bought goals across N finished matches to maximize total points, with 3 for a win and 1 for a draw.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
Between the MountainsPick one altitude from each mountain so the absolute difference between the two is as small as possible.Easy3Two pointersSortingNo attempts yet1s128 MBJudgeable
Goldilocks and the N CowsChoose an integer barn temperature that maximizes total milk when each cow yields X if cold, Y if inside its range, and Z if hot.Easy3SortingIntervalsNo attempts yet1s128 MBJudgeable
Meeting Room ArrangementPick the largest set of non-overlapping events in each test case from given start and finish times.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
The Sultan's ChapatiFollow the prescribed flip procedure to sort each stack largest on the bottom and print the flip positions ending with 0.Easy3SimulationArray+1No attempts yet1s128 MBJudgeable
Sharkovski's OrderingSort each test case of up to 255 integers into Sharkovski ordering and print them space-separated on one line.Easy3SortingMathNo attempts yet2s128 MBJudgeable
Straight FlushFind the longest run of consecutive ranks sharing one suit after merging duplicate cards.Easy3SortingHash mapNo attempts yet5s512 MBJudgeable
Unlock My SafeThe program prints the sorted permutation of digits 1 to N at index floor(N factorial / 3) for each N.Easy3CombinatoricsSorting+1No attempts yet1s128 MBJudgeable
Boiled EggsSort the eggs by weight and boil the lightest ones while the count stays within P and the total weight stays within Q.Easy3GreedySortingNo attempts yet1s128 MBJudgeable
Damage Over TimePick up to M abilities to maximize total damage per second, breaking ties by longest shared duration, and report both numbers.Easy3SortingGreedyNo attempts yet1s128 MBJudgeable
Olympic Games RankingSort up to 250 nations by gold, silver, then bronze medals and print competition ranks with totals, breaking ties alphabetically.Easy3SortingImplementationNo attempts yet1s128 MBJudgeable
Another Word SortingSort up to 1000 lowercase words by letter-value totals plus a bonus for each adjacent equal pair, breaking ties alphabetically.Easy3SortingStringNo attempts yet1s128 MBJudgeable
Cabric NumberSimulate the Kaprekar digit routine to 6174 or 0 for each input and print every subtraction step.Easy3SimulationSortingNo attempts yet1s128 MBJudgeable
Selecting the Ten Best TeachersTally valid ballots into weighted place scores and print the top ten teachers with vote breakdowns in fixed-width columns.Easy3SimulationSorting+1No attempts yet1s128 MBJudgeable
PaintDo n paint jobs one per day, highest daily price rise first, to minimize base prices plus accumulated surcharges.Easy3GreedySortingNo attempts yet2s512 MBJudgeable
Record KeepingCount how many times the most repeated unordered group of three cow names appears in N lines.Easy3Hash mapSortingNo attempts yet1s128 MBJudgeable
Bree's pantrySort the cans by height with a case-insensitive code tiebreak, then place them alternately left and right from the middle and print the row.Easy3SortingSimulationNo attempts yet1s128 MBJudgeable
Does This Make Me Look Fat?Sort each group of dieters by current weight, computed as starting weight minus days on the diet, heaviest first.Easy3SortingImplementationNo attempts yet1s128 MBJudgeable
BuffcraftPick at most k direct and percentage buffs so the boosted base times the percentage multiplier is as large as possible.Easy3SortingGreedy+1No attempts yet2s256 MBJudgeable
The Cost of MovingSort each list of unique product names alphabetically and sum how far every item moves from its original slot.Easy3SortingHash mapNo attempts yet3s256 MBJudgeable
Rank OrderCompare two judges' score lists by ranked order and report the highest place where the ranked competitors differ, or agree when all match.Easy3SortingNo attempts yet3s256 MBJudgeable
Let's make some spaceList in increasing order every room width obtainable by raising any subset of the given partition positions.Easy3Brute forceSortingNo attempts yet1s256 MBJudgeable
Ideal ScoreboardTrack contest solves in time order and report the interval during which every team and every problem has a solve but none has all.Easy3SimulationSortingNo attempts yet2s256 MBJudgeable
Multiple of 30Rearrange all digits of N into the largest number divisible by 30, or print -1 when impossible.Easy3SortingMathNo attempts yet1s256 MBJudgeable
CompoCount the pairs of contests whose inclusive time ranges overlap in each test case.Easy3SortingIntervalsNo attempts yet1s256 MBJudgeable
JerseysEach player wants one numbered jersey in a minimum size, and the goal is to satisfy as many players as possible.Easy3GreedySortingNo attempts yet1s256 MBJudgeable
Sort by AgeSort N members by increasing age, keeping earlier join order for equal ages.Easy3SortingNo attempts yet3s256 MBJudgeable
Korean, English, mathSort N students by Korean score descending, English ascending, math descending, then name in ASCII order and print the names.Easy3SortingNo attempts yet1s256 MBJudgeable
Sort without duplicatesSort N integers in ascending order and print each distinct value once, separated by spaces.Easy3SortingNo attempts yet1s256 MBJudgeable
Heading to World FinalsRank all teams by solved problems, then penalty, and print the best team from each of the top K universities.Easy3SortingHash mapNo attempts yet1s128 MBJudgeable