Dataset Viewer
Auto-converted to Parquet Duplicate
name
stringlengths
2
82
description
stringlengths
42
10.5k
private_tests
sequence
public_tests
sequence
generated_tests
sequence
tf01
An established group of scientists are working on finding solution to NP hard problems. They claim Subset Sum as an NP-hard problem. The problem is to determine whether there exists a subset of a given set S whose sum is a given number K. You are a computer engineer and you claim to solve this problem given that all...
{ "input": [], "output": [] }
{ "input": [ "2\n5 10\n3 4 6 1 9\n3 2\n1 3 4" ], "output": [ "1\n0" ] }
{ "input": [], "output": [] }
1170_E. Sliding Doors
Imagine that you are the CEO of a big old-fashioned company. Unlike any modern and progressive company (such as JetBrains), your company has a dress code. That's why you have already allocated a spacious room for your employees where they can change their clothes. Moreover, you've already purchased an m-compartment war...
{ "input": [], "output": [] }
{ "input": [ "3 10\n2 3 2\n6\n1 5\n2 1 10\n2 2 9\n2 5 6\n3 1 7 8\n4 1 2 3 4\n" ], "output": [ "\nYES\nYES\nNO\nNO\nYES\nNO\n" ] }
{ "input": [], "output": [] }
1250_B. The Feast and the Bus
Employees of JebTrains are on their way to celebrate the 256-th day of the year! There are n employees and k teams in JebTrains. Each employee is a member of some (exactly one) team. All teams are numbered from 1 to k. You are given an array of numbers t_1, t_2, ..., t_n where t_i is the i-th employee's team number. J...
{ "input": [], "output": [] }
{ "input": [ "6 3\n3 1 2 3 2 3\n", "10 1\n1 1 1 1 1 1 1 1 1 1\n", "12 4\n1 2 3 1 2 3 4 1 2 1 2 1\n" ], "output": [ "\n6\n", "\n10\n", "\n12\n" ] }
{ "input": [], "output": [] }
188_G. Array Sorting
Sorting arrays is traditionally associated with high-level languages. How hard can it be in Roco? Sort the given array in non-descending order. Input The first line of input contains an integer n (1 ≤ n ≤ 100) — the size of the array. The following n lines contain the elements of the array, one per line. Each element...
{ "input": [ "3 3 1 2\n", "7 12 2 3 44 5 60 2\n", "10\n60\n1\n60\n1\n60\n1\n60\n1\n60\n1\n" ], "output": [ "1 2 3 \n", "2 2 3 5 12 44 60 \n", "1 1 1 1 1 60 60 60 60 60 \n" ] }
{ "input": [ "5\n7\n1\n9\n7\n3\n", "10\n100\n1\n100\n1\n100\n1\n100\n1\n100\n1\n" ], "output": [ "1 3 7 7 9 \n", "1 1 1 1 1 100 100 100 100 100 \n" ] }
{ "input": [], "output": [] }
470_F. Pairwise Sums
You are given an array of n integers. For each element output the sum of itself and the previous element. For the first element, output the sum of the first and the last elements of the array. Input The input consists of a single line of space-separated integers. The first number is n (2 ≤ n ≤ 50) — the size of the a...
{ "input": [], "output": [] }
{ "input": [ "4 1 2 3 4\n", "5 5 46 372 81 9\n" ], "output": [ "5 3 5 7 ", "14 51 418 453 90 " ] }
{ "input": [], "output": [] }
820_D. Mister B and PR Shifts
Some time ago Mister B detected a strange signal from the space, which he started to study. After some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investigation Mister B need some basis, that's why he decided to choose cyclic shift of this permutation whi...
{ "input": [ "4\n1 2 4 3\n", "4\n2 1 4 3\n", "10\n1 2 10 9 7 4 8 3 6 5\n", "10\n1 7 10 6 5 2 3 8 9 4\n", "4\n4 3 2 1\n", "4\n2 1 3 4\n", "10\n1 10 9 5 3 2 4 7 8 6\n", "4\n2 3 1 4\n", "4\n2 4 3 1\n", "10\n1 5 10 8 4 3 9 2 7 6\n", "4\n1 4 3 2\n", "10\n1 8 10 6 2 4 9 3 7 5...
{ "input": [ "3\n3 2 1\n", "3\n1 2 3\n", "3\n2 3 1\n" ], "output": [ "2 1\n", "0 0\n", "0 1\n" ] }
{ "input": [], "output": [] }
p02613 AtCoder Beginner Contest 173 - Judge Status Summary
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
{ "input": [], "output": [] }
{ "input": [ "6\nAC\nTLE\nAC\nAC\nWA\nTLE", "10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC" ], "output": [ "AC x 3\nWA x 1\nTLE x 2\nRE x 0", "AC x 10\nWA x 0\nTLE x 0\nRE x 0" ] }
{ "input": [], "output": [] }
dbyz15t
Problem Desrcription Shil likes to play with trees a lot.He is playing with an undirected tree containing N nodes.He wants to find out total number of unordered triplets (A,B,C) such that A is not connected to B, B is not connected to C and A is not connected to C by a direct edge (No two of A, B, C are mutually conne...
{ "input": [], "output": [] }
{ "input": [ "5\n1 2\n1 3\n3 4\n2 5" ], "output": [ "1" ] }
{ "input": [], "output": [] }
ig01
This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush! Given the names of two people, cancel out the common letters (repeated occurrence of a letter is treated separately, so 2A's in one name and one A in the other would cancel one A in each name), coun...
{ "input": [], "output": [] }
{ "input": [ "2\nSHILPA\nAAMIR\nMATT\nDENISE" ], "output": [ "ENEMIES\nLOVE" ] }
{ "input": [], "output": [] }
1211_I. Unusual Graph
Ivan on his birthday was presented with array of non-negative integers a_1, a_2, …, a_n. He immediately noted that all a_i satisfy the condition 0 ≤ a_i ≤ 15. Ivan likes graph theory very much, so he decided to transform his sequence to the graph. There will be n vertices in his graph, and vertices u and v will prese...
{ "input": [], "output": [] }
{ "input": [ "4 4\n1 2\n2 3\n3 4\n4 1\n", "3 0\n" ], "output": [ "\n0 1 0 1 \n", "\n0 0 0 \n" ] }
{ "input": [], "output": [] }
1297_E. Modernization of Treeland
Treeland consists of n cities and n-1 two-way roads connecting pairs of cities. From every city, you can reach every other city moving only by the roads. You are right, the system of cities and roads in this country forms an undirected tree. The government has announced a program for the modernization of urban infrast...
{ "input": [], "output": [] }
{ "input": [ "4\n10 4\n4 5\n5 2\n2 1\n1 3\n1 9\n9 10\n2 7\n7 8\n5 6\n4 3\n1 2\n2 3\n3 4\n5 3\n1 2\n1 3\n1 4\n1 5\n4 1\n1 2\n2 4\n2 3\n" ], "output": [ "\nYes\n9\n1 2 4 5 6 7 8 9 10 \nNo\nYes\n4\n1 3 4 5 \nYes\n1\n4 \n" ] }
{ "input": [], "output": [] }
1402_A. Fancy Fence
Everybody knows that Balázs has the fanciest fence in the whole town. It's built up from N fancy sections. The sections are rectangles standing closely next to each other on the ground. The ith section has integer height h_i and integer width w_i. We are looking for fancy rectangles on this fancy fence. A rectangle is ...
{ "input": [], "output": [] }
{ "input": [ "2\n1 2\n1 2\n" ], "output": [ "\n12\n" ] }
{ "input": [], "output": [] }
433_A. Kitahara Haruki's Gift
Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends. Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equal ...
{ "input": [ "9\n100 100 100 200 100 100 200 100 200\n", "3\n100 100 100\n", "7\n200 200 200 100 200 200 200\n", "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 200 100 100 100 100 100...
{ "input": [ "4\n100 100 100 200\n", "3\n100 200 100\n" ], "output": [ "NO\n", "YES\n" ] }
{ "input": [], "output": [] }
class-homework
Ramesh and Suresh were in the same class and got home work from their mathematics teacher. The Homework consists of N strings and each string consists of only digits. The task which they need to perform is that they need to divide the string into 4 integers such that their sum is maximum. Note: Each integer should be...
{ "input": [ "100\n04\n9\n02163\n003000\n08041479\n80750340926070052\n90056\n11680\n90\n09020809009020989\n00460224000800\n0606\n6402000040\n3918080\n31052060072050\n41\n00070775690\n8000780240500799004\n66\n040934020028\n00241600300023700065\n3\n09964639222895002000\n2903002053708649009\n000050995\n0510000\n3000...
{ "input": [ "3\n4251\n52310\n00006\n\nSAMPLE" ], "output": [ "12\n56\nunlucky" ] }
{ "input": [], "output": [] }
even-from-end-1
Problem Description Given a list of integers, find and display all even numbers from the end of the list. Input Format Each line of input begins with an integer N indicating the number of integer n that follow which comprises a list. Output Format All even numbers from the end of the list, each separated by a sin...
{ "input": [ "21 3 -3 3 -3 3 -3 19 3 -3 3 -3 3 -3 19 3 -3 3 -3 3 -3 19", "2 8 -100\n5 -1000 5 1000 500 250\n10 -1000 5 1000 500 250 -1000 5 1000 500 250\n7 3 -3 3 -3 3 -3 19\n5 44 7 11 -999 20", "5 10 25 12 4 1 \n3 16 28 100" ], "output": [ "None to display", "-100 8 \n250 500 1000 -1000 \n250...
{ "input": [ "5 10 25 12 4 1 \n3 16 28 100\n\nSAMPLE" ], "output": [ "4 12 10 \n100 28 16" ] }
{ "input": [], "output": [] }
sherlock-and-kgb
The russian intelligence agency KGB make an encryption technique to send their passwords. Originally the password is of 3 characters. After encryption the password is converted into 3 numbers A-B-C. Now, Sherlock wants to decrypt the password encryption technique of KGB. Sherlock knows that every number has only 2 po...
{ "input": [ "5\n81 125 16\n19683 15625 8192\n59049 15630 32768\n59050 78125 131072\n177147 390625 131073" ], "output": [ "K-G-B \nK-G-B \nK-Y-B \nX-G-B \nK-G-Z" ] }
{ "input": [ "2\n27 25 4\n25 26 16\n\nSAMPLE" ], "output": [ "K-G-B\nX-Y-B" ] }
{ "input": [], "output": [] }
p01123 Let's Move Tiles!
<!-- Problem G --> Let's Move Tiles! You have a framed square board forming a grid of square cells. Each of the cells is either empty or with a square tile fitting in the cell engraved with a Roman character. You can tilt the board to one of four directions, away from you, toward you, to the left, or to the right, ...
{ "input": [], "output": [] }
{ "input": [ "4\n..E.\n.AD.\nB...\n..C.\nD\n4\n..E.\n.AD.\nB...\n..C.\nDR\n3\n...\n.A.\nBC.\n((URD)3L)2R\n5\n...P.\nPPPPP\nPPP..\nPPPPP\n..P..\nLRLR(LR)12RLLR\n20\n....................\n....................\n.III..CC..PPP...CC..\n..I..C..C.P..P.C..C.\n..I..C....P..P.C....\n..I..C....PPP..C....\n..I..C....P....C.....
{ "input": [], "output": [] }
colarr
Chef had a hard time arguing with his friend, and after getting a great old kick Chef saw a colored array with N cells, numbered from 1 to N. The kick was so strong that Chef suddenly understood the rules of the game. Each cell is painted with a color. Here the colors are numbered from 1 to M. For any cell i, Chef c...
{ "input": [], "output": [] }
{ "input": [ "1\n4 2 1\n1 1 2 2\n1 1\n1 1\n1 1\n3 1\n0 1\n0 1\n1 0\n1 0" ], "output": [ "5" ] }
{ "input": [], "output": [] }
1170_B. Bad Days
Every day Kotlin heroes analyze the statistics of their website. For n days, they wrote out n numbers a_1, a_2, ..., a_n, where a_i is the number of visits on the i-th day. They believe that a day is bad if there are at least 2 days before it with a strictly greater number of visits. For example, if n=8 and a=[3, 1, 4...
{ "input": [], "output": [] }
{ "input": [ "8\n3 1 4 1 5 9 2 6\n", "5\n1 1 1 1 1\n", "13\n2 7 1 8 2 8 1 8 2 8 4 5 9\n" ], "output": [ "\n2\n", "\n0\n", "\n6\n" ] }
{ "input": [], "output": [] }
153_E. Euclidean Distance
You are given a multiset of points on the plane with integer coordinates. Find the maximum distance between two points from this multiset. Input The first line of input contains the number of points n (2 ≤ n ≤ 50). Next, n pairs of lines follow, each describing a single point: the first line contains x-coordinate, th...
{ "input": [], "output": [] }
{ "input": [ "3\n0\n1\n2\n3\n4\n5\n", "3\n10\n12\n-5\n8\n10\n12\n" ], "output": [ "5.656854249\n", "15.5241747\n" ] }
{ "input": [], "output": [] }
188_D. Asterisks
You are given a number n. Print n lines, i-th line should consist of i characters "*". Lines' indices are 1-based. Input The only line of input contains an integer n (1 ≤ n ≤ 50). Output Output the described pattern. Examples Input 3 Output * ** *** Input 6 Output * ** *** **** ***** ******
{ "input": [], "output": [] }
{ "input": [ "3\n", "6\n" ], "output": [ "*\n**\n***\n", "*\n**\n***\n****\n*****\n******\n" ] }
{ "input": [], "output": [] }
470_C. Eval
You are given a simple arithmetic expression of the form a?b, where a and b are integer constants, and ? can be one of the following operations: '+' (addition), '-' (subtraction), '*' (multiplication), '/' (integer division) or '%' (modulo operation). Output the result of evaluation of this expression. Input The inp...
{ "input": [], "output": [] }
{ "input": [ "123+456\n", "192/5\n", "945%19\n" ], "output": [ "579\n", "38\n", "14\n" ] }
{ "input": [], "output": [] }
digital-numbers
Bosky is a very curious child who turned 13 yesterday. His parents gifted him a digital watch which he really liked. He was amazed to see how each number can be represented inside one cell only by switching different edges on and off. Today, while he was in his home alone, getting bored looking at his watch, an idea p...
{ "input": [ "5\n1 14\n1 50\n4 28\n5 700\n3 147" ], "output": [ "1\n10\n3\n32491\n739" ] }
{ "input": [ "4\n1 14\n1 50\n4 28\n5 700\n\nSAMPLE" ], "output": [ "1\n10\n3\n32491" ] }
{ "input": [], "output": [] }
give-me-my-test-monk
Professor just has checked all the N students tests. Everything was fine but then he realised that none of the students had signed their papers, so he doesn't know which test belongs to which student. But it's definitely not professors's job to catch every student and asked him to find his paper! So he will hand out...
{ "input": [ "60 0 58", "7 3 7" ], "output": [ "630738177", "195634923" ] }
{ "input": [ "3 1 3\n\nSAMPLE" ], "output": [ "833333340" ] }
{ "input": [], "output": [] }
lexicographically-preceding-permutation
Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given permutation is the lexicographically least permutation, then print the input permutation itself. Input Format: First line is the test c...
{ "input": [], "output": [] }
{ "input": [ "1\n3\n1 3 2\n\nSAMPLE" ], "output": [ "1 2 3" ] }
{ "input": [], "output": [] }
chsparr
Chef has a an array A consisting of N elements. He wants to add some elements into the array as per the below mentioned process. After each minute, Chef iterates over the array in order from left to right, and takes every two neighbouring pair of elements, say x and y, he adds a new element x + y in the middle of eleme...
{ "input": [], "output": [] }
{ "input": [ "2\n3 1 1 5\n1 6 9\n3 2 6 7\n1 6 9" ], "output": [ "38\n36" ] }
{ "input": [], "output": [] }
etmx05
Middle Strings Miss Roma has got a new job in a computer agency. To test her skills the manager has appointed her with a small project. She will get a string of any length but of ODD length and what she has to do is finding a center string of length 3 in the original string. For Example: She gets a string 'CANDY' the...
{ "input": [], "output": [] }
{ "input": [ "CANDY", "SOLVING" ], "output": [ "AND", "LVI" ] }
{ "input": [], "output": [] }
stadium
The bustling town of Siruseri has just one sports stadium. There are a number of schools, colleges, sports associations, etc. that use this stadium as the venue for their sports events. Anyone interested in using the stadium has to apply to the Manager of the stadium indicating both the starting date (a positive inte...
{ "input": [], "output": [] }
{ "input": [ "4\n2 5\n9 7\n15 6\n9 3" ], "output": [ "3" ] }
{ "input": [], "output": [] }
1431_I. Cyclic Shifts
You are given a matrix consisting of n rows and m columns. The matrix contains lowercase letters of the Latin alphabet. You can perform the following operation any number of times you want to: choose two integers i (1 ≤ i ≤ m) and k (0 < k < n), and shift every column j such that i ≤ j ≤ m cyclically by k. The shift i...
{ "input": [], "output": [] }
{ "input": [ "3 5 4\nabacc\nccbba\nccabc\nabacc\nacbbc\nababa\nacbbc\n", "6 4 4\ndaac\nbcba\nacad\ncbdc\naaaa\nbcbb\ndcdd\nacba\nbbbb\ndbcd\n", "5 10 5\nltjksdyfgg\ncbhpsereqn\nijndtzbzcf\nghgcgeadep\nbfzdgxqmqe\nibgcgzyfep\nbbhdgxqmqg\nltgcgxrzep\nljnpseldgn\nghhpseyzcf\n" ], "output": [ "\n0\n2\...
{ "input": [], "output": [] }
abc-garfield
Garfield the cat likes candies A LOT. He always keeps a huge stock of it at his home. Today John, his owner, brought home three types of candies. He brought A pieces of Red candy, B pieces of Green candy and C pieces of Blue candy. Garfield is really happy. But the problem is that John won’t allow him to eat all of it ...
{ "input": [], "output": [] }
{ "input": [ "3\n2 1 2 3\n1 1 1 1\n2 1 0 1\n\nSAMPLE" ], "output": [ "9\n4\n4" ] }
{ "input": [], "output": [] }
jumping-frog
There is a frog known as "CHAMELEON" because he has a special feature to change its body's color similar to stone's color on which he sits. There are N colorful stones lying in a row, but of only 1 to 100 different colors. Frog can hopp on another stone if the stone has same color as its body or (i-1)th stone if it is ...
{ "input": [ "541\n54 98 68 63 83 94 55 35 12 63 30 17 97 62 96 26 63 76 91 19 52 42 55 95 8 97 6 18 96 3 46 21 55 88 14 27 65 8 94 93 52 39 40 52 12 94 89 39 38 6 24 92 88 40 89 12 40 8 86 41 66 15 61 91 11 32 33 59 77 24 46 51 97 17 6 58 16 40 84 28 51 28 56 46 60 17 51 72 74 16 67 75 38 93 56 81 4 61 9 82 30 8...
{ "input": [ "6\n2 3 1 3 2 4\n2\n1 0 4\n2 3 5\n\nSAMPLE" ], "output": [ "2\n-1" ] }
{ "input": [], "output": [] }
p01046 Yu-kun Likes a lot of Money
Background The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves money as much as programming. Yu-kun visited the island where treasures sleep to make money today. Yu-kun has obtained a map of the treasure in advanc...
{ "input": [], "output": [] }
{ "input": [ "3 3 1 10\n@#b\n.#.\n.#.\nb 100", "3 3 1 20\n@*C\n..*\n...\nC 10", "3 3 1 10\n@0.\n...\n...\n0 100" ], "output": [ "0", "0", "100" ] }
{ "input": [], "output": [] }
p01179 Cousin's Aunt
Sarah is a girl who likes reading books. One day, she wondered about the relationship of a family in a mystery novel. The story said, * B is A’s father’s brother’s son, and * C is B’s aunt. Then she asked herself, “So how many degrees of kinship are there between A and C?” There are two possible relationships bet...
{ "input": [], "output": [] }
{ "input": [ "7\nC is A’s father’s brother’s son’s aunt\nC is A’s mother’s brother’s son’s aunt\nC is A’s son’s mother’s mother’s son\nC is A’s aunt’s niece’s aunt’s niece\nC is A’s father’s son’s brother\nC is A’s son’s son’s mother\nC is A" ], "output": [ "5 3\n5 1\n2 2\n6 0\n2 0\n1 1\n0 0" ] }
{ "input": [], "output": [] }
p01797 Kimagure Cleaner
Example Input 2 -3 4 L 2 5 ? 3 5 Output 2 L 4 L 3
{ "input": [], "output": [] }
{ "input": [ "2 -3 4\nL 2 5\n? 3 5" ], "output": [ "2\nL 4\nL 3" ] }
{ "input": [], "output": [] }
p02069 Universal and Existential Quantifiers
Problem Statement You are given a list of $N$ intervals. The $i$-th interval is $[l_i, r_i)$, which denotes a range of numbers greater than or equal to $l_i$ and strictly less than $r_i$. In this task, you consider the following two numbers: * The minimum integer $x$ such that you can select $x$ intervals from the gi...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
acdemy
Sherlock Holmes has decided to start a new academy to some of the young lads. He has conducted several tests and finally selected N equally brilliant students.Now he don't know whether to train all the N students or not. Now since Holmes was in a confusion, Watson came up with an idea. He wanted to test the obedience o...
{ "input": [], "output": [] }
{ "input": [ "2\n5\n2 3 5 1 2\n3\n1 2 3" ], "output": [ "3\n3" ] }
{ "input": [], "output": [] }
seg003
Problem description. The problem statement is simple , you are given an array and you have to perform two types of operation on it. Type 1 : update the value of array at the given index. Type 2 : find the maximum sum you can obtained in the given range ( L , R ) by taking any two index i and j , such that ( L <=...
{ "input": [], "output": [] }
{ "input": [ "5 3 \n1 2 3 4 5\n2 1 5\n1 2 5\n2 1 5" ], "output": [ "9 \n10" ] }
{ "input": [], "output": [] }
319_B. Psychos in a Line
There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step. You're given the initial arrangeme...
{ "input": [ "2\n1 2\n", "100\n61 96 25 10 50 71 38 77 76 75 59 100 89 66 6 99 2 13 3 23 91 93 22 92 4 86 90 44 39 31 9 47 28 95 18 54 1 73 94 78 60 20 42 84 97 83 16 81 67 64 74 46 82 5 88 80 14 48 53 79 30 11 62 21 41 70 63 58 51 56 57 17 87 72 27 85 68 49 52 8 12 98 43 37 35 69 55 32 26 40 29 65 19 24 34 3...
{ "input": [ "6\n1 2 3 4 5 6\n", "10\n10 9 7 8 6 5 3 4 2 1\n" ], "output": [ "0\n", "2\n" ] }
{ "input": [], "output": [] }
530_C. Diophantine equation
You are given an equation A * X + B * Y = C, A, B, C are positive integer coefficients, X and Y are variables which can have positive integer values only. Output the number of solutions of this equation and the solutions themselves. Input The only line of input contains integers A, B and C (1 ≤ A, B, C ≤ 1000), separ...
{ "input": [], "output": [] }
{ "input": [ "3 5 35\n", "3 35 5\n" ], "output": [ "2\n5 4\n10 1\n", "0\n" ] }
{ "input": [], "output": [] }
556_C. Case of Matryoshkas
Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art. The main exhibit is a construction of n matryoshka dolls that can be nested one into another. The matryoshka dolls are numbered from 1 to n. A matryoshka with a smaller number can be ...
{ "input": [ "100 3\n45 1 2 3 4 5 6 7 8 9 19 21 24 27 28 30 34 35 37 39 40 41 42 43 46 47 48 51 52 55 58 59 61 63 64 66 69 71 76 80 85 86 88 89 94 99\n26 10 11 15 18 23 29 31 33 36 38 44 49 54 56 60 62 65 75 78 82 83 84 95 96 97 98\n29 12 13 14 16 17 20 22 25 26 32 45 50 53 57 67 68 70 72 73 74 77 79 81 87 90 91 ...
{ "input": [ "3 2\n2 1 2\n1 3\n", "7 3\n3 1 3 7\n2 2 5\n2 4 6\n" ], "output": [ "1\n", "10\n" ] }
{ "input": [], "output": [] }
bhavanas-and-bhuvanas-bet
Bhavana and Bhuvana place bet every time they see something interesting that can occur with a probability 0.5. Both of them place a bet for a higher amount which they don’t posses at that time. But when one wins she demands other for the bet amount. For example if Bhuvana wins she asks bhavana for the bet amount. But...
{ "input": [], "output": [] }
{ "input": [ "2\n3\n10" ], "output": [ "1\n3" ] }
{ "input": [], "output": [] }
259_B. Little Elephant and Magic Square
Little Elephant loves magic squares very much. A magic square is a 3 × 3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figure below shows the magic square, the sum of integers in all its rows, columns and diagonals equals 15...
{ "input": [ "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "0 99626 99582\n99766 0 99258\n99442 99398 0\n", "0 6361 2304\n1433 0 8103\n7232 3175 0\n", "0 28 10\n12 0 24\n26 8 0\n", "0 97 56\n69 0 71\n84 43 0\n", "0 4 4\n4 0 4\n4 4 0\n", "0 9 2\n3 0 7\n8 1 0\n", "0 99978 99920\...
{ "input": [ "0 1 1\n1 0 1\n1 1 0\n", "0 3 6\n5 0 5\n4 7 0\n" ], "output": [ "1 1 1\n1 1 1\n1 1 1\n", "6 3 6\n5 5 5\n4 7 4\n" ] }
{ "input": [], "output": [] }
661_D. Maximal Difference
You are given an array of integers ai. Find the largest absolute value of difference between adjacent elements of the array max(abs(ai - ai + 1)). Input The only line of the input contains a list of space-separated integers ai (1 ≤ ai ≤ 100) — elements of the array. The size of the array is between 2 and 10, inclusiv...
{ "input": [], "output": [] }
{ "input": [ "2 10 4 8 6 12\n", "3 3\n" ], "output": [ "8\n", "0\n" ] }
{ "input": [], "output": [] }
72_I. Goofy Numbers
The non-negative integer a is a divisor of the non-negative integer b if and only if there exists a positive integer c such that a × c = b. Some numbers are really interesting. Commander Surena defines some interesting properties for non-negative integers: * An integer is happy if it is divisible by at least one o...
{ "input": [], "output": [] }
{ "input": [ "99\n", "29994\n", "23\n" ], "output": [ "happier\n", "happy\n", "upset\n" ] }
{ "input": [], "output": [] }
p01516 Milky Way
Milky Way Milky Way English text is not available in this practice contest. The Milky Way Transportation Corporation is a travel agency that plans and manages interstellar travel tours. The Milky Way Transportation Corporation is planning a project called "Milky Way Crossing Orihime Hikoboshi Experience Tour". This ...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
cb03
The problem is very simple. For every string given as input, you need to tell us the number of subsequences of it that are palindromes (need not necessarily be distinct). Note that the empty string is not a palindrome. For example, the palindromic subsequences of "aab" are: "a", "a", "b", "aa", and the method returns...
{ "input": [], "output": [] }
{ "input": [ "3\naab\ndddd\nthisisapalindromeemordnilapasisiht" ], "output": [ "4\n15\n814157" ] }
{ "input": [], "output": [] }
mes
Problem description One of the Engineer friends of John, Mr. Dev tried to develop an encryption algorithm which can send strings of words wirelessly between two devices connected through Wi-Fi. On completing the design of algorithm, John decides to test his algorithm on real devices. To test his algorithm on device, De...
{ "input": [], "output": [] }
{ "input": [ "2\nHe is a good programmer\nhp is a pool Probgrammer\nProgram\nprpgreamp" ], "output": [ "4\n3" ] }
{ "input": [], "output": [] }
reciicha
Help Saurabh with his Chemistry Assignment. Saurabh has been given a chemistry assignment by Ruby Mam. Though the assignment is simple but Saurabh has to watch India vs Pakistan Match and he has no time to do the assignment by himself. So Saurabh wants you to do his assignment so that he doesn’t get scolded by Ruby Mam...
{ "input": [], "output": [] }
{ "input": [ "2\n1 2\n2 1" ], "output": [ "2\n2" ] }
{ "input": [], "output": [] }
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
{ "input": [ "100 1\n85 75 55 65 39 26 47 16 9 11 3 4 70 23 56 64 36 34 16 13 18 28 32 80 8 79 76 4 21 75 93 51 85 86 100 88 91 71 97 28 66 22 47 87 91 95 3 56 81 53 88 90 21 30 74 45 58 73 36 40 70 51 28 75 20 54 69 52 14 48 52 53 91 81 32 68 16 48 60 66 91 32 55 42 93 51 3 46 23 64 39 1 30 42 20 83 99 29 35 59\...
{ "input": [ "3 3\n15 8 10\n" ], "output": [ "9\n" ] }
{ "input": [], "output": [] }
618_B. Guess the Permutation
Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n. Bob gave you all the values of ai, j that he wro...
{ "input": [ "10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\n", "4\n0 1 3 2\n1 0 1 1\n3 1 0 2\n2 1 2 0\n", "13\n0 5 5 2 5 4 5 5 3 5 5 5 1\n...
{ "input": [ "2\n0 1\n1 0\n", "5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n" ], "output": [ "1 2 ", "2 4 5 1 3 " ] }
{ "input": [], "output": [] }
attack-or-be-attacked
You are given an NxM chessboard. Find the number of pairs of different positions of a bishop and a PQ-knight where they don't attack each other modulo 10^9 + 7. A bishop can move to square if it's on the same diagonal with it. A PQ-knight with given integers P and Q (P doesn't equals Q) can move to the square if the ...
{ "input": [ "92891 8181 398 787", "1 10 3 4" ], "output": [ "353972355", "90" ] }
{ "input": [ "2 5 1 2\n\nSAMPLE" ], "output": [ "62" ] }
{ "input": [], "output": [] }
little-stuart-and-evil-hackers-2
Evil hackers are trying to hack the database of HackerEarth.com. After a lot of work they figure out that the encryption key used by HackerEarth to securely store the data is really just a random large number. After a bit more work they figure out that the key is in form of a^b( a power b). So now they call in the evil...
{ "input": [ "1000\n73004 67426\n91627 69478\n61297 68278\n24234 83945\n47637 96401\n94242 97144\n85353 14705\n99269 44776\n88928 91446\n52876 40296\n37601 12385\n93013 8451\n18937 66949\n7883 75710\n6581 60221\n4664 95936\n43998 12643\n65414 5294\n80920 5999\n5590 44908\n18751 99831\n58403 4103\n30888 57671\n652...
{ "input": [ "4\n1 2\n1 1\n2 1\n2 3\n\nSAMPLE" ], "output": [ "6\n2\n4\n400" ] }
{ "input": [], "output": [] }
mystery-12
Lets think of an infinite series of numbers such that the difference between any two consecutive numbers is d. Let the first number in the sequence be a. Now your task is to find the multiple that occurs first in the sequence of a given number n and print its index in the output. Input 1st line T denoting test cases....
{ "input": [ "10\n844452700697263162 119646220083568392\n617\n624716331013886830 420232882599498616\n263\n371747750780382310 31328662274583882\n151\n155589359406144136 349833477687741817\n263\n890649303306320035 470504750916794312\n509\n172858306891107873 404374317528704778\n179\n486897312988741400 23233560323142...
{ "input": [ "2\n5 6\n7\n4 9\n11\n\nSAMPLE" ], "output": [ "5\n2" ] }
{ "input": [], "output": [] }
exebit01
Pratyush, a six year old kid has just learnt how to write 1 through 1000 in decimal number system(DNS). Being a very curious kid, he made some modifications in DNS and removed the digits 0 through 3 and 7 through 9. So the only digits remaining to be used are 4, 5 and 6. He started enumerating numbers with these digits...
{ "input": [], "output": [] }
{ "input": [ "5\n3\n13\n45\n64\n1000000000" ], "output": [ "6\n444\n4456\n4664\n5446456455646565564" ] }
{ "input": [], "output": [] }
lastride
Problem description. Toretto has no friends. He has got family, and now they need him. His bitter enemy, Ian Shaw, has captured Toretto's beloved Letty and evil cooks in his head. All Toretto has is the algorithmic message Shaw left before leaving- Letty(n): L = an empty list while n > 0: find the larg...
{ "input": [], "output": [] }
{ "input": [ "2\n1 2\n3 10" ], "output": [ "3\n25" ] }
{ "input": [], "output": [] }
pd32
Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n ≥ 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a,b]. Input The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is...
{ "input": [], "output": [] }
{ "input": [ "10 100\n1234567890 9876543210\n0 0" ], "output": [ "5\n4" ] }
{ "input": [], "output": [] }
162_A. Pentagonal numbers
Pentagonal numbers are figurate numbers which can be calculated using the formula pn = (3n2 - n) / 2 (always integer). You are given n; calculate n-th pentagonal number. Input The only line of input contains an integer n (1 ≤ n ≤ 100). Output Output the n-th pentagonal number. Examples Input 2 Output 5 Inpu...
{ "input": [ "3\n", "6\n" ], "output": [ "15\n", "66\n" ] }
{ "input": [ "2\n", "5\n" ], "output": [ "5\n", "35\n" ] }
{ "input": [], "output": [] }
minimum-coins
Ram has to pay Shyam R rupees and but the coins which he has got is of limited denomination .Assuming he has a limited knowledge of the mathematics and has unlimited number of coins of each denomination.Write a code to help Ram to pay the money using minimum number of coins .Suppose Ram has coins of {1,2} denomination ...
{ "input": [ "9\n{10}", "-19\n{10}", "79\n{2,8}" ], "output": [ "ERROR", "ERROR", "ERROR" ] }
{ "input": [ "24\n{1,7,3}\n\nSAMPLE" ], "output": [ "Rupee 1 coin 0\nRupee 3 coin 1\nRupee 7 coin 3" ] }
{ "input": [], "output": [] }
p02074 N-by-M grid calculation
Problem Statement Have you experienced $10$-by-$10$ grid calculation? It's a mathematical exercise common in Japan. In this problem, we consider the generalization of the exercise, $N$-by-$M$ grid calculation. In this exercise, you are given an $N$-by-$M$ grid (i.e. a grid with $N$ rows and $M$ columns) with an addit...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
aba15f
Problem description. “Murphy’s Law doesn’t meant that something bad will happen. It means that whatever can happen, will happen.” —Cooper While traveling across space-time,the data sent by NASA to "The Endurance" spaceship is sent in the format of, For...
{ "input": [], "output": [] }
{ "input": [ "5\n100\n23\n4\n1000\n5" ], "output": [ "68\n21\n4\n320\n5" ] }
{ "input": [], "output": [] }
nfeb4
Buffalo Marketing Gopal wants to make some money from buffalos, but in a quite a different way. He decided that his future lay in speculating on buffalos. In the market in his village, buffalos were bought and sold everyday. The price fluctuated over the year, but on any single day the price was always the same. ...
{ "input": [], "output": [] }
{ "input": [ "2\n3\n1 2 90\n4\n1 3 1 2" ], "output": [ "177\n 3" ] }
{ "input": [], "output": [] }
64_C. Table
The integer numbers from 1 to nm was put into rectangular table having n rows and m columns. The numbers was put from left to right, from top to bottom, i.e. the first row contains integers 1, 2, ..., m, the second — m + 1, m + 2, ..., 2 * m and so on. After it these numbers was written on the paper in another order: ...
{ "input": [], "output": [] }
{ "input": [ "3 4 11\n", "20000 10000 200000000\n" ], "output": [ "8\n", "200000000\n" ] }
{ "input": [], "output": [] }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5