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
Returning HomeReverse a short list of turn directions and street names, flipping each left or right turn, to produce the route from school back home.Easy3ImplementationSimulation+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
Babbling BrooksSimulate a sequence of splits and joins on a list of streams and print the resulting flows after each split divides flow by a percentage and each join merges neighbors.Easy3ImplementationSimulation+1No attempts yet1s128 MBJudgeable
Card GameSimulate a 52-card game where players alternate turning cards; award points when a high card is followed by enough non-high cards, then print each score.Easy3SimulationImplementation+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
Arithmetic SequenceGiven a sequence, decide whether consecutive differences are equal and, if so, print the next five terms in the exact required format.Easy3ImplementationMath+1No attempts yet1s128 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
MõttemeisterGiven a secret four-digit number and N guesses, print for each guess the count of correct digits (A) and the count of digits in the correct position (B).Easy3ImplementationArray+2No attempts yet1s1024 MBJudgeable
Harmony: Parallel FifthsGiven N pairs of simultaneous two-voice pitches, list every position i where the voices form a perfect fifth (interval 5 mod 12) at both i and i+1 and both voices move.Easy3ImplementationArray+2No attempts yet3s1024 MBJudgeable
HarmonyGiven K voices over N note rows, list every pair of consecutive rows and voice pair that forms a parallel fifth (both voices move and stay 7 semitones apart mod 12).Easy3ImplementationBrute force+2No attempts yet7s1024 MBJudgeable
Alien SocksGiven counts of socks in s colors, find the smallest number of socks to draw to guarantee k socks of one color, or -1 if impossible.Easy3MathGreedy+1No attempts yet1s1024 MBJudgeable
Attendance CheckGiven a permutation forming one cycle, find the student who responds last when the calling chain starts at student k.Easy3ImplementationSimulation+2No attempts yet1s1024 MBJudgeable
FishingFind the starting day among the first N days whose window of k consecutive days contains the most rainy days, choosing the smallest index on a tie.Easy3Sliding windowArray+1No attempts yet1s1024 MBJudgeable
SledSimulate a sled whose speed changes by a_i on each segment and drops by 1 at junctions whenever it exceeds S; report the final speed.Easy3SimulationImplementation+1No attempts yet1s1024 MBJudgeable
LaundryGiven colors partitioned into washable groups and counts of clothes per color, find how many machine loads of capacity M are needed.Easy3MathImplementation+2No attempts yet1s1024 MBJudgeable
BusTrack how many passengers are on the bus after each stop and report the largest number of them that exceeds the seat count K.Easy3ImplementationSimulation+1No attempts yet1s1024 MBJudgeable
Scrabble ScoringScore each Scrabble play by parsing its start square and direction, applying letter and word bonus multipliers from the fixed 15x15 board.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Currency ExchangeGiven a 5x5 exchange-rate table where every conversion rounds to the nearest hundredth, simulate each trip and report the final dollar amount rounded to cents.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Easy TradingGiven daily prices, compute moving averages over the last m and n days and print a buy or sell signal whenever the trend between them reverses.Easy3ArrayPrefix sum+2No attempts yet2s128 MBJudgeable
Prehistoric Operating SystemsCount binary strings of length n with no two adjacent D's, where D means DOORS and O means any other brand, for up to 40 test values of n.Easy3Dynamic programmingCombinatorics+2No 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
Ancient PlatesApply given PERM and SHIFT rules to lines, words, or characters of a block of text, then print the result.Easy3ImplementationSimulation+1No attempts yet1s128 MBJudgeable
Body Size RankingFor each person, count how many others are both heavier and taller, and print that count plus one.Easy3ArrayBrute forceNo attempts yet1s128 MBJudgeable
Noughts & CrossesReplay each game from its recorded moves and report the winner (X or O) or Draw, ignoring moves after the win.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
OutfitsGiven two wardrobes numbered from opposite ends with at most one removal each, report for each day whether both girls picked the same physical outfit.Easy3ArrayImplementation+1No attempts yet1s128 MBJudgeable
ScrabbleGiven up to 1000 short dictionary words and a set of letter and blank tiles, count how many words the tiles can spell.Easy3ArrayString+2No attempts yet1s128 MBJudgeable
ElectionSimulate instant-runoff voting over at most 5 candidates and 20 preference groups, eliminating the lowest scorer each round.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
In QueriesMaintain a 5-column table with seeded initial rows and process insert, remove, max, min, and range-count queries over the columns.Easy3ArrayImplementation+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
Very Simple ProblemFind problems that more than half of the jury rated with its minimum score and that no jury member rated with its maximum score.Easy3ImplementationArrayNo attempts yet1s128 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
Intelligence TestGiven a fixed sequence and several queries, decide for each query sequence whether it is a subsequence of the fixed sequence.Easy3ArrayTwo pointers+1No attempts yet3s512 MBJudgeable
SticksGiven stick lengths, repeatedly merge pairs of equal length into doubled sticks and report how many distinct sticks remain.Easy3Hash mapArray+1No attempts yet1s128 MBJudgeable
PostcardCount the contiguous segments that keep at least one mountain of height m or more after trimming both ends.Easy3CombinatoricsArrayNo attempts yet1s512 MBJudgeable
The TapeFind the largest distance between two positions holding different values in each test case, printing BRAK if all values are equal.Easy3GreedyArrayNo attempts yet1s512 MBJudgeable
ListAfter moving the last k numbers of 1 to n to the front, sum the entries from position i to position j.Easy3MathArrayNo attempts yet1s512 MBJudgeable
Passing CarsCount pairs of cars moving toward each other where an eastbound car stands west of a westbound car.Easy3Prefix sumArrayNo attempts yet1s128 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
DividersCount the positions where the first k entries hold exactly 1 to k by tracking the running maximum.Easy3ArrayGreedyNo attempts yet1s128 MBJudgeable
Weight LossFind the largest weight drop from an earlier day to a later day over all contiguous stretches.Easy3ArrayGreedyNo attempts yet1s128 MBJudgeable
PermutationCheck whether n given integers contain each number from 1 to n exactly once and print TAK or NIE.Easy3ArrayHash mapNo attempts yet1s128 MBJudgeable
Cutting the TapeSplit the row of integers into two nonempty parts so the absolute difference of the two part sums is as small as possible.Easy3Prefix sumArrayNo attempts yet1s128 MBJudgeable
Crossing Out NumbersCross out as few numbers as possible so the numbers left behind read 1 to k in order.Easy3GreedyArrayNo attempts yet1s128 MBJudgeable
Consecutive GirlsFind the fewest boys to remove so that k girls stand side by side in a row of n boys and girls.Easy3Sliding windowPrefix sum+1No attempts yet1s128 MBJudgeable
CordsPartition the row of cords into the maximum number of contiguous groups with total length at least w.Easy3GreedyArrayNo attempts yet1s128 MBJudgeable
The Score ChartGiven a sequence of 0s, 1s, and 2s, find the length of the longest subsequence that never decreases.Easy3Dynamic programmingArrayNo attempts yet1s128 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
Perfect MemorySplit an even-length integer sequence into a palindrome and an antipalindrome that add up to it, or print NIE when parity forbids it.Easy3MathArrayNo attempts yet2s128 MBJudgeable
Recovering the Input NumbersReconstruct the original array that produces the given output when replayed through the circular skip-and-zero traversal.Easy3SimulationArrayNo attempts yet1s32 MBJudgeable
Work at a Library Is ToughCount the fewest swaps of out-of-order book pairs that arrange each test case's call numbers in ascending order.Easy3Brute forceArrayNo attempts yet1s128 MBJudgeable
The Candy-Sharing GameEach round passes half of each candy pile to the right and tops odd counts to even until every child holds the same number.Easy3SimulationArrayNo attempts yet1s128 MBJudgeable
Number That CountApply the digit-inventory operation up to 15 times and report whether the number is self-inventorying, reaches one, loops, or stays unclassified.Easy3SimulationArrayNo attempts yet1s128 MBJudgeable
Wiretap DeviceFind the one device whose received power exceeds six times the background noise plus every other device's power, or print NOISE.Easy3MathArrayNo attempts yet1s128 MBJudgeable
It Is ColdFrom the farthest fan inward, add matching flows and subtract opposing ones, resetting on outward flow, to find the speed reaching the team.Easy3SimulationArrayNo attempts yet1s128 MBJudgeable
Padovan SequenceFor each test case, compute the Nth Padovan number defined by the spiral of equilateral triangles.Easy3Dynamic programmingArrayNo 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
Charles Babbage's Difference EngineGiven the first values of a low-degree polynomial, extend its finite-difference table forward and report the value at x = 50.Easy3SimulationMath+1No attempts yet1s128 MBJudgeable
Pair SumCount pairs in a sorted distinct array that sum to a target M for each test case.Easy3Two pointersArrayNo attempts yet1s128 MBJudgeable
Range Sum QueryAnswer many inclusive range sum queries on a static integer list using precomputed prefix sums.Easy3Prefix sumArrayNo attempts yet1s128 MBJudgeable
Color Change of Go StonesRepeat k times the rule that replaces each circular gap with the xor of its two neighbors, then count the white stones.Easy3SimulationArrayNo attempts yet1s128 MBJudgeable
Best Machine Rental ProfitEach record maps letters to profits, and the task asks for the largest sum over any contiguous block, or zero when every block loses money.Easy3Dynamic programmingArrayNo attempts yet2s512 MBJudgeable
Reordering the CowsGiven the current and target cow orders, count the permutation cycles longer than one and report the longest cycle length.Easy3ArraySimulationNo attempts yet1s128 MBJudgeable
Maximum Subarray SumFor each test case, find the maximum sum over all contiguous subarrays of the given integer array.Easy3Dynamic programmingArrayNo attempts yet1s256 MBJudgeable
MemoryPlay Memory with 50 face-down cards (25 letter pairs) by calling faceup(C); find each matching pair so Jack collects all 25 candies.Easy3SimulationImplementation+2No attempts yet1s256 MBJudgeable
Maximal SumFind the contiguous block of edge weights with the largest sum and print its endpoints, or print no good path when the best sum is not positive.Easy3Dynamic programmingArrayNo attempts yet1s64 MBJudgeable
Islands in the Data StreamCount the contiguous blocks strictly above both bordering values in each 12-number sequence with zeros at both ends.Easy3Brute forceArrayNo attempts yet1s256 MBJudgeable
Rolling EncryptionEncrypt a lowercase string by leaving the first k letters unchanged and shifting each later letter by the most frequent of the k original letters before it.Easy3Sliding windowArray+1No attempts yet1s256 MBJudgeable
Skyscraper SilhouetteRebuild the skyline picture from N ground-based rectangles, mark the border cells, and report the perimeter without the ground side.Easy3SimulationArray+1No attempts yet1s32 MBJudgeable
Marathon 1Run checkpoints 1 to N in order while skipping exactly one middle checkpoint to minimize the total Manhattan distance.Easy3GreedyArray+1No attempts yet1s256 MBJudgeable
Cow JogCount how many groups remain when faster cows behind slow down to match the slowest cow ahead of them.Easy3GreedyArrayNo attempts yet1s256 MBJudgeable
HamzaFind the shortest prefix of the category list that contains every distinct category appearing in the whole list.Easy3Hash mapArrayNo attempts yet1s256 MBJudgeable
Largest Stock Price DeclineGiven up to a million prices from a sine-cosine formula, find the largest drop from an earlier price to a later one.Easy3ArrayGreedy+1No attempts yet5s256 MBJudgeable
Sorting Numbers 3Sort up to 10,000,000 integers no greater than 10,000 in ascending order, one per line.Easy3SortingArrayNo attempts yet5s8 MBJudgeable
Largest Sum Increasing SubsequencePick elements in order so each is larger than the last and their sum is as large as possible.Easy3Dynamic programmingArrayNo attempts yet1s256 MBJudgeable
Broken Vending MachinePress each snack position through its cheapest button and keep only the snacks whose market price beats that press cost.Easy3GreedyArrayNo attempts yet1s256 MBJudgeable
Folding a Paper StripeSimulate the K given half-folds of a 2^K-cell stripe and print the cell numbers from top to bottom.Easy3SimulationArrayNo attempts yet1s256 MBJudgeable
StockCompute the largest profit from daily prices when you may buy one share per day and sell any number of held shares on any day.Easy3GreedyArrayNo attempts yet5s256 MBJudgeable
Physical MusicGiven a permutation of chart positions, list the download-chart positions of entries that a later single outranks, in ascending order.Easy3ArraySortingNo attempts yet5s256 MBJudgeable
Range sum queriesAnswer many inclusive range-sum queries over a fixed list by precomputing prefix sums.Easy3Prefix sumArrayNo attempts yet1s256 MBJudgeable
Merging Two Sorted ArraysMerge two sorted arrays into one sorted sequence with a two-pointer walk.Easy3Two pointersArrayNo attempts yet1.5s256 MBJudgeable
Mastering MastermindGiven a secret code and a guess of colored pegs, count exact position matches and remaining color-only matches.Easy3ArrayStringNo attempts yet1s256 MBJudgeable
ColliderMove the particle at position i to position j on each exposure and report the particle type at position k for each query.Easy3ArraySimulationNo attempts yet2s256 MBJudgeable
Breed CountingGiven the breed of each cow in a row, report the count of each of the three breeds inside every query interval.Easy3Prefix sumArrayNo attempts yet2s512 MBJudgeable
Bookshelf SortingSeparate books into odd and even worths, sort the odds up and the evens down, then refill each position with the matching owner.Easy3SortingArrayNo attempts yet5s512 MBJudgeable
Sorting the BookshelfSeparate the books by odd and even worth, sort the odd ones increasingly and the even ones decreasingly, then put each back on its owner labeled spots.Easy3SortingArrayNo attempts yet5s512 MBJudgeable
Ocean View (Small)Destroy the fewest houses so the heights of the houses that remain strictly increase from the lake eastward.Easy3Brute forceArrayNo attempts yet5s512 MBJudgeable
Store CreditGiven a credit C and a list of item prices, find the two positions whose prices sum exactly to C and print them in increasing order.Easy3ArrayHash map+2No attempts yet5s512 MBJudgeable
Store Credit (Large)For each test case, find the two item positions whose prices sum to the credit C, and print the smaller position first.Easy3Hash mapArrayNo attempts yet5s512 MBJudgeable
Who is the final winner?Each of N players holds M cards; every round all players play their largest remaining card and whoever plays the highest value scores a point. Report the player(s) with the most points.Easy3SortingSimulation+2No attempts yet1s128 MBJudgeable
Will the Second IUPC Go Well?Given the pen counts of N members, find the fewest members whose pens total at least M*K, or print STRESS if the total falls short.Easy3GreedySorting+2No attempts yet1s128 MBJudgeable
Peter and the TextbookSimulate a textbook where tearing out page i also removes page n-i+1, and answer which page sits at position p among the pages still present.Easy3SimulationImplementation+1No attempts yet2s256 MBJudgeable
Household Ledger (Easy)Maintain a ledger over N days with point additions and range-sum queries, printing the sum of entries from day p to day q.Easy3Prefix sumArrayNo attempts yet1s512 MBJudgeable
Sweet part-time jobJunsu can work at most m consecutive days out of n days with given daily wages; find the maximum total pay for such a window.Easy3Sliding windowPrefix sum+1No attempts yet1s512 MBJudgeable
Hongjun likes FFTGenerate permutations a and b with the given pseudocode, then compute c[i] = max over valid j of a[j]*b[i-j].Easy3ArraySimulation+1No attempts yet2s512 MBJudgeable
Range Sum QueriesGiven a fixed array and m range queries, print the sum of elements between two given indices for each query.Easy3Prefix sumArrayNo attempts yet2s512 MBJudgeable
Bitcoin investmentGiven a list of daily bitcoin prices, buy on one day and sell on that day or later to maximize the selling price minus the buying price.Easy3ArrayGreedy+1No attempts yet2s512 MBJudgeable
Longest non-decreasing subsegmentFind the longest contiguous non-decreasing run in a list and output its length and the sum of its elements, breaking ties by earliest start.Easy3ArrayImplementation+2No attempts yet2s512 MBJudgeable
Selection of Participants of an ExperimentGiven a list of student scores, find the smallest absolute difference between any two of them.Easy3SortingArrayNo attempts yet2s512 MBJudgeable
Look for the Winner!Given votes counted in order, report the earliest prefix after which one candidate's lead cannot be overtaken from remaining votes, or TIE.Easy3ArraySimulation+1No attempts yet2s512 MBJudgeable