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 results3,701 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Fibonacci Number 7Compute the n-th Fibonacci number modulo 1,000,000,007 for n up to one million. | Medium6 | Dynamic programmingMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Pepper WreathGiven a tree whose vertices carry non-negative weights and a cap k, find the minimum number of edges to cut so every resulting component has total weight at most k. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Python syntaxGiven a string of for and execute statements, count the valid Python indentation schemes modulo 1,000,000,007. | Medium6 | Dynamic programmingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Taming the HerdGiven a log of N counter readings, find for each possible number of breakouts the minimum number of entries that disagree with some valid breakout sequence that starts with a breakout on day 1. | Medium6 | Dynamic programmingImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Talent ShowChoose a group of cows with total weight at least W maximizing the ratio of total talent to total weight, and print floor(1000A). | Medium6 | Dynamic programmingBinary search+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sejin VirusGiven a directed graph of facilities and pipes, find the minimum number of starting nodes from which all nodes are reachable. | Medium6 | GraphDFS+1 | No attempts yet | 1s | 512 MB | Judgeable |
| You on That DayGiven measured environmental factors and one-operation definitions, compute each factor's partial derivative of HAPPY and print it as a reduced fraction. | Medium6 | Dynamic programmingDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Eli's Curious ExperimentCount the maximal independent sets of a path on N vertices that have size at least two, for many N up to 76, labeled by test case number. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Super BallChoose a factory for each layer in the production order and again in the recycling order, minimizing layer costs plus transfer costs C whenever consecutive layers use different factories. | Medium6 | Dynamic programmingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Pseudo-Banana StringsGiven a string of B, A, N, find the minimum number of character replacements that turn it into a concatenation of blocks of the form B+ANANA(NA)*. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Building a SpaceshipPartition the ordered parts into contiguous groups, paying for each group the product of its maximum weight and maximum energy; minimize the total cost. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hyunwook Is the Parenthesis King!!Given a string of parentheses, find the length of the longest contiguous substring that forms a correct parenthesis string. | Medium6 | StackString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 1, 2, 3 Sum 6Count the compositions of n into parts 1, 2, and 3 that read the same forwards and backwards, modulo 1,000,000,009. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 1, 2, 3 Sum 8For each n, count the ordered compositions of n into parts 1, 2, 3, reporting the number using an odd count of terms and the number using an even count, each modulo 1,000,000,009. | Medium6 | Dynamic programmingMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| BracketGiven a bracket pattern with some fixed brackets and some dots, count the ways to fill the dots so the whole string is a balanced bracket sequence. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Lush GearsPick one model per gear type so the total cost is as close to C as possible without exceeding it, and report the leftover coins. | Medium6 | Dynamic programmingArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Commuting MathematiciansGiven a subway network of lines with travel times, find a route from F to D that minimizes total time, then minimizes line transfers among fastest routes. | Medium6 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subset Equal PartitionCount the ways to split the set {1,...,N} into two subsets with equal sums, or print 0 if no split exists. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Noodle Team ContestGiven each member's pot time and seasoning time, order the members to minimize the total time until all noodles are finished. | Medium6 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Palapa NumberCount N-digit numbers (no leading zero) where the first two digits sum to an even value or the last two digits form a prime, modulo 9973. | Medium6 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Medicine DeliveryFind the fastest route from one settlement to the other along roads, pausing 5 minutes at equipment stations to wash whenever 100 minutes of driving would otherwise be exceeded. | Medium6 | Shortest pathGraph+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Prime CurrencyCount the unordered ways to make N with unlimited primes, using a coin-change DP, and print the count modulo 123,456,789. | Medium6 | Dynamic programmingNumber theory+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Chick's Transformation Is Not GuiltyEach chick lays one egg daily and each egg hatches K days later. Find the chick count after N days modulo 100000007. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 512 MB | Judgeable |
| SequencesCount non-decreasing length-n sequences over 1 to m where each integer appears at most k times. Use DP over the largest value and its count. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ChainFor each position, repeatedly jump to the first strictly greater element on its right and report the length of that chain. | Medium6 | StackDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Left-Right-WinFor players seated in a circle, compute how much of a $100 pot each should pay, given the spinner probabilities of moving left, moving right, or winning. | Medium6 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Good, the Great, and the SuperbGiven a sequence of digits, find the minimum number of elements to change so the sequence becomes Good, Great, or Superb, where Superb is constant, Great has adjacent gaps at most 1, and Good splits into Great or Superb blocks. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Ebony and IvoryAssign fingers 1 to 5 to a monophonic piano passage given four ergonomic transition tables and output the minimum total difficulty of all adjacent intervals. | Medium6 | Dynamic programmingImplementation | No attempts yet | 2s | 512 MB | Judgeable |
| MatriceCount all triangular regions cut from squares by one diagonal whose cells all hold the same character. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 512 MB | Judgeable |
| JackRabbit SlimGiven sorted distinct carrot positions on a line, Slim repeatedly jumps to the nearest remaining carrot, breaking ties to the right; find the sum of total distances over all possible starting carrots. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Arithmetic ProgressionsGiven up to 5000 distinct numbers, find the length of the longest subset that forms an arithmetic progression. | Medium6 | ArrayHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Circle Cross StampsGiven a row of O and X marks printed by single circles, single crosses, and two-mark circle-cross stamps in either orientation, find the largest possible count of circle-cross stamps. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| PalaceCount ways to place N non-attacking palace pieces (rook plus king moves) on an N by N board, modulo 1,000,000,007, for up to 1,000,000 test cases with N up to 10,000,000. | Medium6 | MathCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ball on a ChessboardEach cell of an R by C board holds a distinct number; every ball rolls to the smallest neighbor until it reaches a local minimum, and we must count how many balls stop on each cell. | Medium6 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Traveling Salesman 3Find the minimum-length round trip that visits all N cities exactly once and returns to the start, where N is at most 16. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cow PoetryCount the ways to fill M lines of exactly K syllables with given words, where equal rhyme-scheme letters must share a rhyme class, modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| SličiceGiven current counts of unique cards per team and a nondecreasing points array, choose K additional cards to maximize total points. | Medium6 | Dynamic programmingGreedy | No attempts yet | 1s | 512 MB | Judgeable |
| Moving a Pipe 1Count the ways to push a two-cell pipe (horizontal, vertical, or diagonal) across an N by N grid of walls until one end reaches (N, N). | Medium6 | Dynamic programmingSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Candy GameCount the number of nondecreasing sequences of length n where the i-th value is at most x[i], multiply by n, and report the result modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Comparing StringsGiven two lowercase strings, align them by repeating characters of either string, keeping order, and minimize the sum of absolute alphabet-position differences over aligned pairs. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Space ProbeGiven travel times between N planets and a start planet, find the shortest route that visits every planet, with no need to return to the start. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SnakesSplit the sequence into K+1 contiguous segments, set each segment's net size to its maximum, and minimize the total sum of segment maxima minus the sum of all group sizes. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Scoring HackStarting from 0, each turn adds a or b points or doubles the total, and the game must end with score below n+a while using at most 10% doublings. Find the minimum number of turns. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Team SelectionPick five of n candidates and assign each a distinct role among A to E so the total skill summed over roles is as large as possible. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Almost-K Increasing SubsequenceFind the longest subsequence of a given sequence that has at most K positions where consecutive elements decrease. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Curse of the MeetingCount the ways N people around a round table can pair up and shake hands simultaneously without any arms crossing, modulo 987654321. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Life in WartimeGiven N distinct cities (all below 250) in an infinite binary heap tree, count cities that either host a unit or lie on the unique path between two units. | Medium6 | TreeHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number of Sequences Related to PalindromesCount length-N sequences with values up to M such that every length-K window is a palindrome, modulo 1e9+7. | Medium6 | CombinatoricsMath+2 | No attempts yet | 0.25s | 512 MB | Judgeable |
| RGB Street 2Paint N houses in a cycle with three colors so that every adjacent pair differs, minimizing total cost. | Medium6 | Dynamic programmingImplementation+2 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Count of Increasing SubsequencesCount the strictly increasing subsequences of length K in a sequence of N distinct values, reported modulo 1e9+7. | Medium6 | Dynamic programmingBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Jinwoo's Moon Trip (Small)Given an N by M grid of fuel costs with N, M at most 6, find the minimum cost path from any cell in the top row to any cell in the bottom row, where each step moves downward and no two consecutive steps use the same direction. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Feeding the CatsStarting at (0,0), visit all N cats on a grid, moving in Manhattan steps, and return to (0,0) in the shortest time. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Stealing Snacks from JuniorsChoose a subset of snacks whose total fullness reaches M, minimizing total satisfaction, or report that it is impossible. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Balanced StringCount binary strings of length n where every prefix has at most one more 0 than 1 or one more 1 than 0, modulo 16769023. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Byte CoinGiven n up to 15 days of Byte Coin prices and initial cash W, buy and sell whole coins each day to maximize the cash held after selling everything on day n. | Medium6 | Dynamic programmingBrute force+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Star TrekFind the minimum travel time from planet 1 to planet n, where you may switch ships at intermediate planets, paying a preparation time plus pace times distance for each leg. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Two MachinesAssign each of n tasks to machine A or B, minimizing the maximum total load across the two machines. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Getting ConfidenceGiven an N by N matrix of confidence values, assign each of N ornaments to a distinct position so that the product of the chosen values is maximized, and output the assignment. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Deceptive DiceGiven an n-sided die and at most k rolls, find the maximum expected final score when you may stop rolling at any point. | Medium6 | Dynamic programmingProbability+2 | No attempts yet | 1s | 512 MB | Judgeable |
| StrapsChoose a set of straps forming a rooted tree: each strap occupies one port of its parent, one strap hangs from the phone, and total happiness is maximized. | Medium6 | Dynamic programmingTree+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Beer BarrelsCount occurrences of digit C across all K-digit strings made only of digits A and B, modulo 1e9+7. | Medium6 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pass the BuckGiven a graph where each holder moves to a random neighbor or wins with probability 1/(d+1), find the win probability of a target player from a given start. | Medium6 | ProbabilityGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus PlanningSplit n kids (n up to 17) into the fewest groups so no two enemies share a group and each group has at most c kids, then output one valid grouping. | Medium6 | Bit manipulationDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HaikuGiven a set of syllables, decide whether the three input phrases can each be split into syllables so their syllable counts are 5, 7, and 5. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SubwayEach station belongs to company A or B; find the route from station 0 to M that minimizes transfers first, then travel time, and report both. | Medium6 | GraphShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| I Can Feel My Grade in the Flying Test PapersSplit an array into K contiguous groups; maximize the minimum group sum. | Medium6 | Binary searchGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sculptural ProjectGiven a string of work and market days, cancel the fewest days so materials never run out and end at zero. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hard Sculptural ProjectGiven a string of 'w' (work, consume 1) and 'o' (rest, gain 1), delete the fewest characters so every prefix has more gains than work and the total balances, then count the ways. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gluing PicturesGiven a city string C, find for each friend name the fewest substrings of C that concatenate to form it, or -1 if impossible. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| Improve SPAMGiven nested mailing lists, count how many messages reach client emails before deduplication and how many distinct emails are reached, both modulo 1e9+7. | Medium6 | GraphDFS+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| BoulderingOn a grid of holds with grip costs, find the minimum total Euclidean path length from the bottommost hold to the topmost hold, where consecutive holds must be within reach r and total cost stays at most s. | Medium6 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary Number GameGiven two binary strings, find the minimum number of single-bit flips (never the leading bit), increments, and decrements to turn the start number into the target. | Medium6 | BFSDynamic programming+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Give Me Back My Binary Tree!!!Count the number of distinct binary trees with exactly E edges, where mirror images count as different trees, modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Fast ForwardingFind the minimum time to reach position t on a tape when speed can be tripled or divided by three once per second, and playback must end at normal speed. | Medium6 | BFSDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 2xN Pretty TilingTile a 2xN grid with at most A dominoes and at most B 2x2 squares, rotating tiles freely, to maximize the sum of tile prettiness values. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Team PracticeCount assignments of N ordered problems to solvers A, B, C where A's count is a multiple of K, B never solves two in a row, and C solves at least one. | Medium6 | Dynamic programmingCombinatorics | No attempts yet | 1s | 512 MB | Judgeable |
| Splitting DNAGiven the lengths of N fragments in order, find the minimum total energy to split the original chain, where each cut costs the current chain length. | Medium6 | Dynamic programmingIntervals+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Time is MooneyFind a closed walk starting and ending at city 1 in a directed graph that maximizes collected city rewards minus C times the square of the number of days. | Medium6 | Dynamic programmingGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gold RushGiven c Oshloobs and the gold price for each of n days, find the maximum Oshloobs at the end of day n, buying and selling gold each day and cashing out at the end. | Medium6 | Dynamic programmingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| DISHFor each pair of strings, output a shortest string that contains both input strings as substrings. | Medium6 | StringDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JourneyCount binary strings of length N with no run of equal symbols longer than K, modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Man in the middleFind the lexicographically smallest uppercase string of length L whose polynomial hash mod 10007 equals H, or report that none exists. | Medium6 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Football HooliganismPartition a 2 by N grid of team labels into non-overlapping rectangles so that every rectangle is monochromatic, minimizing the number of 1 by 1 rectangles. | Medium6 | Dynamic programmingImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Team AssignmentAssign each participant to team A (scoring their attack) or team B (scoring their defense) so the team sizes differ by at most k, maximizing the total. | Medium6 | GreedySorting+2 | No attempts yet | 0.7s | 256 MB | Judgeable |
| Amazing SushiGiven counts of n sushi types and an allowed piece range for each person, decide whether every piece can be split so each type is shared evenly (one extra allowed) and both stay in range. | Medium6 | GreedyMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bubble Bucket SortPartition n bubble sizes into at most b buckets to minimize the sum of squared differences between the largest and smallest size in each bucket. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Day of Going to the Training CampCount sequences of length N over values 1..M that avoid any local peak (a[i-1] < a[i] > a[i+1]), modulo 998244353. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Autumn Cleaning (16 MiB ML!)Count the k-element subsets of n item prices whose sum is divisible by r, modulo 10^6+3. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 16 MB | Judgeable |
| Arithmetic SequencesGiven a set of distinct integers, find the size of the largest subset that can be ordered as an arithmetic sequence. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| ElevatorGiven passenger arrival times and destination floors, choose when to dispatch the elevator to minimize the time it finally returns to floor 0. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| DivisorGiven up to 5000 positive integers, change the fewest of them to any positive integers so that every pair is in a divisor-multiple relationship. | Medium6 | SortingDynamic programming+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Hotel Room AssignmentCount the ways to place any number of guests on N floors of two rooms each so that no two guests share a floor or sit vertically adjacent, modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Meeting Room Scheduling 2Given N meetings that overlap only with their immediate neighbors in the list, choose a non-overlapping subset maximizing total attendees. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Meeting Room Scheduling 3Choose non-overlapping meetings, where each meeting's time overlaps only its immediate neighbors in the input order, to maximize the total attendee count. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| How to Fail at Programming ContestGennady picks the order of problems he solves, never starting one he cannot finish, to minimize total points scored within T minutes. | Medium6 | Dynamic programmingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| The Tower of PisaGiven n disks stacked on the first of three rods, where the second rod lets you move a group of top disks together, find the minimum moves to shift all disks to the third rod. | Medium6 | Dynamic programmingRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ExpeditionEach candidate forbids at most one other candidate; choose the largest subset where no included candidate's forbidden partner is also included. | Medium6 | GraphGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HomeworkGiven a DAG of assignments with durations, remove one vertex to minimize the makespan of the remaining precedence-constrained schedule. | Medium6 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Let's Kill the Monster!Each skill takes 1 second to cast, then deals its damage; after casting you must wait out its cooldown. Find the earliest time the monster's HP reaches zero. | Medium6 | Brute forceSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Moving 5Find the maximum candy sum along a monotone path from (1,1) to (N,M) in an N by M grid where room (i,j) holds A_i*10^9 + B_j. | Medium6 | GreedyMath+1 | No attempts yet | 1s | 512 MB | Judgeable |