-
Notifications
You must be signed in to change notification settings - Fork 13
/
e-learner.sql
308 lines (270 loc) · 127 KB
/
e-learner.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 19, 2020 at 11:30 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `e-learner`
--
-- --------------------------------------------------------
--
-- Table structure for table `answer`
--
CREATE TABLE `answer` (
`a_id` int(11) NOT NULL,
`a_solution` varchar(5000) NOT NULL,
`q_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`a_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `answer`
--
INSERT INTO `answer` (`a_id`, `a_solution`, `q_id`, `user_id`, `a_date`) VALUES
(1, '#include<stdio.h>\r\nvoid main{\r\nprintf(\"Hello World\");\r\n}', 1, 3, '2020-09-18'),
(2, '#include<iostream.h>', 2, 3, '2020-09-18'),
(3, 'Hey Shwtz', 1, 3, '2020-09-18'),
(4, 'Hey Shwtz', 1, 3, '2020-09-18'),
(5, ' ', 1, 3, '2020-09-18'),
(6, 'Hello, World. Hello, Java.', 11, 3, '2020-09-18'),
(7, 'hello', 11, 3, '2020-09-19'),
(8, 'hello', 11, 3, '2020-09-19'),
(9, ' ', 1, 3, '2020-09-19');
-- --------------------------------------------------------
--
-- Table structure for table `help`
--
CREATE TABLE `help` (
`h_id` int(11) NOT NULL,
`h_tech` varchar(20) NOT NULL,
`h_ques` varchar(500) NOT NULL,
`h_dec` varchar(1000) NOT NULL,
`h_ans` varchar(1000) NOT NULL,
`h_link` varchar(500) NOT NULL,
`q_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`h_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `help`
--
INSERT INTO `help` (`h_id`, `h_tech`, `h_ques`, `h_dec`, `h_ans`, `h_link`, `q_id`, `user_id`, `h_date`) VALUES
(1, 'Python', 'print something', 'sdkbhaksdb', 'gsad', 'https://www.instagram.com/p/CD6gejjhFkG/?igshid=13vgr8pxeuibv', 1, 3, '2020-09-20'),
(2, 'Java', 'print something', 'sdkbhaksdb', 'qwqwq', 'https://www.instagram.com/p/CD6gejjhFkG/?igshid=13vgr8pxeuibv', 1, 3, '2020-09-20'),
(3, 'Python', 'zdcasdc', 'sdkbhaksdb', 'qwqwq', 'https://www.instagram.com/p/CD6gejjhFkG/?igshid=13vgr8pxeuibv', 1, 3, '2020-09-20'),
(4, 'Java', 'print something', 'asdsadasd', 'faasfasdf', 'https://www.instagram.com/p/CD6gejjhFkG/?igshid=13vgr8pxeuibv', 1, 3, '2020-09-20'),
(5, 'Python', 'zdcasdc', 'sdkbhaksdb', 'qwqwq', 'https://www.instagram.com/p/B7blj9AHgNM/?igshid=mmq9o2qclex0', 1, 3, '2020-09-20'),
(6, 'Python', 'zdcasdc', 'sdkbhaksdb', '', '', 1, 3, '2020-09-20'),
(7, 'Python', 'zdcasdc', 'sdkbhaksdb', '', '', 1, 3, '2020-09-20');
-- --------------------------------------------------------
--
-- Table structure for table `question`
--
CREATE TABLE `question` (
`q_id` int(11) NOT NULL,
`q_language` varchar(30) NOT NULL,
`q_info` varchar(200) NOT NULL,
`q_info_type` varchar(100) NOT NULL,
`q_statement` varchar(10000) NOT NULL,
`q_state_code` varchar(5000) NOT NULL,
`q_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `question`
--
INSERT INTO `question` (`q_id`, `q_language`, `q_info`, `q_info_type`, `q_statement`, `q_state_code`, `q_date`) VALUES
(1, 'C', '\"Hello World!\" in C\r\n\r\n', 'Easy', 'Objective\r\n\r\nIn this challenge, we will learn some basic concepts of C that will get you started with the language. You will need to use the same syntax to read input and write output in many C challenges. As you work through these problems, review the code stubs to learn about reading from stdin and writing to stdout.\r\n\r\nTask\r\n\r\nThis challenge requires you to print \"Hello World\" on a single line, and then print the already provided input string to stdout. If you are not familiar with C, you may want to read about the printf() command.\r\n\r\nExample\r\ns=\"Life is beautiful\"\r\n\r\nThe required output is:\r\n', 'Hello, World! \r\nLife is beautiful ', '2020-09-16'),
(2, 'C', 'Playing With Characters\r\n\r\n', 'Easy', 'Objective\r\n\r\nThis challenge will help you to learn how to take a character, a string and a sentence as input in C.\r\n\r\nTo take a single character as input, you can use scanf(\"%c\", &ch ); and printf(\"%c\", ch) writes a character specified by the argument char to stdout\r\n\r\nchar ch;\r\nscanf(\"%c\", &ch);\r\nprintf(\"%c\", ch);\r\nThis piece of code prints the character .\r\n\r\nYou can take a string as input in C using scanf(“%s”, s). But, it accepts string only until it finds the first space.\r\n\r\nIn order to take a line as input, you can use scanf(\"%[^\\n]%*c\", s); where is defined as char s[MAX_LEN] where is the maximum size of . Here, [] is the scanset character. ^\\n stands for taking input until a newline isn\'t encountered. Then, with this %*c, it reads the newline character and here, the used * indicates that this newline character is discarded.\r\n\r\nNote: The statement: scanf(\"%[^\\n]%*c\", s); will not work because the last statement will read a newline character, \\n, from the previous line. This can be handled in a variety of ways. One way is to use scanf(\"\\n\"); before the last statement.\r\n\r\nTask\r\n\r\nYou have to print the character, , in the first line. Then print in next line. In the last line print the sentence, .\r\n\r\nInput Format\r\n\r\nFirst, take a character, as input.\r\nThen take the string, as input.\r\nLastly, take the sentence as input.\r\n\r\nConstraints\r\n\r\nStrings for and will have fewer than 100 characters, including the newline.\r\n\r\nOutput Format\r\n\r\nPrint three lines of output. The first line prints the character, .\r\nThe second line prints the string, .\r\nThe third line prints the sentence, .\r\n\r\n', 'Sample Input 0\r\n\r\nC\r\nLanguage\r\nWelcome To C!!\r\nSample Output 0\r\n\r\nC\r\nLanguage\r\nWelcome To C!!\r\n', '2020-09-16'),
(3, 'C', 'For Loop in C\r\n\r\n', 'Easy', 'Objective\r\n\r\nIn this challenge, you will learn the usage of the for loop, which is a programming language statement which allows code to be repeatedly executed.\r\n\r\nThe syntax for this is\r\n\r\nfor ( <expression_1> ; <expression_2> ; <expression_3> )\r\n <statement>\r\nexpression_1 is used for intializing variables which are generally used for controlling the terminating flag for the loop.\r\nexpression_2 is used to check for the terminating condition. If this evaluates to false, then the loop is terminated.\r\nexpression_3 is generally used to update the flags/variables.\r\nA sample loop will be\r\n\r\nfor(int i = 0; i < 10; i++) {\r\n ...\r\n}\r\nTask\r\n\r\nFor each integer in the interval (given as input) :\r\n\r\nIf , then print the English representation of it in lowercase. That is \"one\" for , \"two\" for , and so on.\r\nElse if and it is an even number, then print \"even\".\r\nElse if and it is an odd number, then print \"odd\".\r\nInput Format\r\n\r\nThe first line contains an integer, .\r\nThe seond line contains an integer, .\r\n\r\nConstraints\r\n\r\n\r\nOutput Format\r\n\r\nPrint the appropriate english representation,even, or odd, based on the conditions described in the \'task\' section.\r\n\r\nNote: \r\n\r\n', 'Sample Input\r\n\r\n8\r\n11\r\nSample Output\r\n\r\neight\r\nnine\r\neven\r\nodd', '2020-09-16'),
(4, 'C', 'Printing Pattern using Loops\r\n\r\n', 'Medium', 'In this problem, you need to print the pattern of the following form containing the numbers from to .\r\n\r\n 4 4 4 4 4 4 4 \r\n 4 3 3 3 3 3 4 \r\n 4 3 2 2 2 3 4 \r\n 4 3 2 1 2 3 4 \r\n 4 3 2 2 2 3 4 \r\n 4 3 3 3 3 3 4 \r\n 4 4 4 4 4 4 4 \r\nInput Format\r\n\r\nThe input will contain a single integer .\r\n\r\nConstraints\r\n\r\n\r\nOutput Format\r\n\r\nPrint the pattern mentioned in the problem statement.\r\n\r\n', 'Sample Input 0\r\n\r\n2\r\nSample Output 0\r\n\r\n2 2 2\r\n2 1 2\r\n2 2 2\r\nSample Input 1\r\n\r\n5\r\nSample Output 1\r\n\r\n5 5 5 5 5 5 5 5 5 \r\n5 4 4 4 4 4 4 4 5 \r\n5 4 3 3 3 3 3 4 5 \r\n5 4 3 2 2 2 3 4 5 \r\n5 4 3 2 1 2 3 4 5 \r\n5 4 3 2 2 2 3 4 5 \r\n5 4 3 3 3 3 3 4 5 \r\n5 4 4 4 4 4 4 4 5 \r\n5 5 5 5 5 5 5 5 5\r\nSample Input 2\r\n\r\n7\r\nSample Output 2\r\n\r\n7 7 7 7 7 7 7 7 7 7 7 7 7 \r\n7 6 6 6 6 6 6 6 6 6 6 6 7 \r\n7 6 5 5 5 5 5 5 5 5 5 6 7 \r\n7 6 5 4 4 4 4 4 4 4 5 6 7 \r\n7 6 5 4 3 3 3 3 3 4 5 6 7 \r\n7 6 5 4 3 2 2 2 3 4 5 6 7 \r\n7 6 5 4 3 2 1 2 3 4 5 6 7 \r\n7 6 5 4 3 2 2 2 3 4 5 6 7 \r\n7 6 5 4 3 3 3 3 3 4 5 6 7 \r\n7 6 5 4 4 4 4 4 4 4 5 6 7 \r\n7 6 5 5 5 5 5 5 5 5 5 6 7 \r\n7 6 6 6 6 6 6 6 6 6 6 6 7 \r\n7 7 7 7 7 7 7 7 7 7 7 7 7 \r\n', '2020-09-16'),
(5, 'C', 'Array Reversal', 'Medium', 'Given an array, of size , reverse it.\r\n\r\nExample: If array, , after reversing it, the array should be, .\r\n\r\nInput Format\r\n\r\nThe first line contains an integer, , denoting the size of the array. The next line contains space-separated integers denoting the elements of the array.\r\n\r\nConstraints\r\n\r\n\r\n, where is the element of the array.\r\n\r\nOutput Format\r\n\r\nThe output is handled by the code given in the editor, which would print the array.\r\n\r\n', 'Sample Input 0\r\n\r\n6\r\n16 13 7 2 1 12 \r\nSample Output 0\r\n\r\n12 1 2 7 13 16 \r\nExplanation 0\r\n\r\nGiven array, = . After reversing the array, = \r\n\r\nSample Input 1\r\n\r\n7\r\n1 13 15 20 12 13 2 \r\nSample Output 1\r\n\r\n2 13 12 20 15 13 1 \r\nSample Input 2\r\n\r\n8\r\n15 5 16 15 17 11 5 11 \r\nSample Output 2\r\n\r\n11 5 11 17 15 16 5 15 \r\n', '2020-09-16'),
(6, 'C', 'Dynamic Array in C', 'Medium', 'Snow Howler is the librarian at the central library of the city of HuskyLand. He must handle requests which come in the following forms:\r\n\r\n1 x y : Insert a book with pages at the end of the shelf.\r\n\r\n2 x y : Print the number of pages in the book on the shelf.\r\n\r\n3 x : Print the number of books on the shelf.\r\n\r\nSnow Howler has got an assistant, Oshie, provided by the Department of Education. Although inexperienced, Oshie can handle all of the queries of types 2 and 3.\r\n\r\nHelp Snow Howler deal with all the queries of type 1.\r\n\r\nOshie has used two arrays:\r\n\r\nint* total_number_of_books;\r\n/*\r\n * This stores the total number of books on each shelf.\r\n */\r\n\r\nint** total_number_of_pages;\r\n/*\r\n * This stores the total number of pages in each book of each shelf.\r\n * The rows represent the shelves and the columns represent the books.\r\n */\r\nInput Format\r\n\r\nThe first line contains an integer , the number of shelves in the library.\r\nThe second line contains an integer , the number of requests.\r\nEach of the following lines contains a request in one of the three specified formats.\r\n\r\nConstraints\r\n\r\nFor each query of the second type, it is guaranteed that a book is present on the shelf at index.\r\nBoth the shelves and the books are numbered starting from 0.\r\nMaximum number of books per shelf .\r\nOutput Format\r\n\r\nWrite the logic for the requests of type 1. The logic for requests of types 2 and 3 are provided.\r\n\r\n', 'Sample Input 0\r\n\r\n5\r\n5\r\n1 0 15\r\n1 0 20\r\n1 2 78\r\n2 2 0\r\n3 0\r\nSample Output 0\r\n\r\n78\r\n2\r\nExplanation 0\r\n\r\nThere are shelves and requests, or queries.\r\n- 1 Place a page book at the end of shelf .\r\n- 2 Place a page book at the end of shelf .\r\n- 3 Place a page book at the end of shelf .\r\n- 4 The number of pages in the book on the shelf is 78.\r\n- 5 The number of books on the shelf is 2.\r\n\r\n', '2020-09-16'),
(7, 'C', 'Small Triangles, Large Triangles\r\n\r\n', 'Medium', 'You are given triangles, specifically, their sides , and . Print them in the same style but sorted by their areas from the smallest one to the largest one. It is guaranteed that all the areas are different.\r\n\r\nThe best way to calculate a volume of the triangle with sides , and is Heron\'s formula:\r\n\r\n where .\r\n\r\nInput Format\r\n\r\nFirst line of each test file contains a single integer . lines follow with , and on each separated by single spaces.\r\n\r\nConstraints\r\n\r\n, and \r\nOutput Format\r\n\r\nPrint exactly lines. On each line print integers separated by single spaces, which are , and of the corresponding triangle.\r\n\r\n', 'Sample Input 0\r\n\r\n3\r\n7 24 25\r\n5 12 13\r\n3 4 5\r\nSample Output 0\r\n\r\n3 4 5\r\n5 12 13\r\n7 24 25\r\nExplanation 0\r\n\r\nThe square of the first triangle is . The square of the second triangle is . The square of the third triangle is . So the sorted order is the reverse one.\r\n\r\n', '2020-09-16'),
(8, 'C', 'Sorting Array of Strings\r\n\r\n', 'Hard', 'To sort a given array of strings into lexicographically increasing order or into an order in which the string with the lowest length appears first, a sorting function with a flag indicating the type of comparison strategy can be written. The disadvantage with doing so is having to rewrite the function for every new comparison strategy.\r\n\r\nA better implementation would be to write a sorting function that accepts a pointer to the function that compares each pair of strings. Doing this will mean only passing a pointer to the sorting function with every new comparison strategy.\r\n\r\nGiven an array of strings, you need to implement a function which sorts the strings according to a comparison function, i.e, you need to implement the function :\r\n\r\nvoid string_sort(const char **arr,const int cnt, int (*cmp_func)(const char* a, const char* b)){\r\n \r\n}\r\nThe arguments passed to this function are:\r\n\r\nan array of strings : \r\nlength of string array: \r\npointer to the string comparison function: \r\nYou also need to implement the following four string comparison functions:\r\n\r\n to sort the strings in lexicographically non-decreasing order.\r\n\r\n to sort the strings in lexicographically non-increasing order.\r\n\r\n to sort the strings in non-decreasing order of the number of distinct characters present in them. If two strings have the same number of distinct characters present in them, then the lexicographically smaller string should appear first.\r\n\r\n to sort the strings in non-decreasing order of their lengths. If two strings have the same length, then the lexicographically smaller string should appear first.\r\n\r\nInput Format\r\n\r\nYou just need to complete the function string\\_sort and implement the four string comparison functions.\r\n\r\nConstraints\r\n\r\n No. of Strings \r\n Total Length of all the strings \r\nYou have to write your own sorting function and you cannot use the inbuilt function\r\nThe strings consists of lower-case English Alphabets only.\r\nOutput Format\r\n\r\nThe locked code-stub will check the logic of your code. The output consists of the strings sorted according to the four comparsion functions in the order mentioned in the problem statement.', 'Sample Input 0\r\n\r\n4\r\nwkue\r\nqoi\r\nsbv\r\nfekls\r\nSample Output 0\r\n\r\nfekls\r\nqoi\r\nsbv\r\nwkue\r\n\r\nwkue\r\nsbv\r\nqoi\r\nfekls\r\n\r\nqoi\r\nsbv\r\nwkue\r\nfekls\r\n\r\nqoi\r\nsbv\r\nwkue\r\nfekls\r\n', '2020-09-16'),
(9, 'C', 'Querying the Document\r\n\r\n', 'Hard', 'A document is represented as a collection paragraphs, a paragraph is represented as a collection of sentences, a sentence is represented as a collection of words and a word is represented as a collection of lower-case ([a-z]) and upper-case ([A-Z]) English characters.\r\n\r\nYou will convert a raw text document into its component paragraphs, sentences and words. To test your results, queries will ask you to return a specific paragraph, sentence or word as described below.\r\n\r\nAlicia is studying the C programming language at the University of Dunkirk and she represents the words, sentences, paragraphs, and documents using pointers:\r\n\r\nA word is described by .\r\nA sentence is described by . The words in the sentence are separated by one space (\" \"). The last word does not end with a space(\" \").\r\nA paragraph is described by . The sentences in the paragraph are separated by one period (\".\").\r\nA document is described by . The paragraphs in the document are separated by one newline(\"\\n\"). The last paragraph does not end with a newline.\r\nFor example:\r\n\r\nLearning C is fun.\r\nLearning pointers is more fun.It is good to have pointers.\r\n\r\nThe only sentence in the first paragraph could be represented as:\r\nchar** first_sentence_in_first_paragraph = {\"Learning\", \"C\", \"is\", \"fun\"};\r\nThe first paragraph itself could be represented as:\r\nchar*** first_paragraph = {{\"Learning\", \"C\", \"is\", \"fun\"}};\r\nThe first sentence in the second paragraph could be represented as:\r\nchar** first_sentence_in_second_paragraph = {\"Learning\", \"pointers\", \"is\", \"more\", \"fun\"};\r\nThe second sentence in the second paragraph could be represented as:\r\nchar** second_sentence_in_second_paragraph = {\"It\", \"is\", \"good\", \"to\", \"have\", \"pointers\"};\r\nThe second paragraph could be represented as:\r\nchar*** second_paragraph = {{\"Learning\", \"pointers\", \"is\", \"more\", \"fun\"}, {\"It\", \"is\", \"good\", \"to\", \"have\", \"pointers\"}};\r\nFinally, the document could be represented as:\r\nchar**** document = {{{\"Learning\", \"C\", \"is\", \"fun\"}}, {{\"Learning\", \"pointers\", \"is\", \"more\", \"fun\"}, {\"It\", \"is\", \"good\", \"to\", \"have\", \"pointers\"}}};\r\nAlicia has sent a document to her friend Teodora as a string of characters, i.e. represented by not . Help her convert the document to form by completing the following functions:\r\n\r\n to return the document represented by .\r\n to return the paragraph.\r\n to return the sentence in the paragraph.\r\n to return the word in the sentence of the paragraph.\r\nInput Format\r\n\r\nThe first line contains the integer .\r\nEach of the next lines contains a paragraph as a single string.\r\nThe next line contains the integer , the number of queries.\r\nEach of the next lines or groups of lines contains a query in one of the following formats:\r\n\r\n1 The first line contains :\r\n\r\nThe next line contains an integer , the number of sentences in the paragraph.\r\nEach of the next lines contains an integer , the number of words in the sentence.\r\nThis query corresponds to calling the function .\r\n2 The first line contains :\r\n\r\nThe next line contains an integer , the number of words in the sentence of the paragraph.\r\nThis query corresponds to calling the function \r\n3 The only line contains :\r\n\r\nThis query corresponds to calling the function \r\nConstraints\r\n\r\nThe text which is passed to the has words separated by a space (\" \"), sentences separated by a period (\".\") and paragraphs separated by a newline(\"\\n\").\r\nThe last word in a sentence does not end with a space.\r\nThe last paragraph does not end with a newline.\r\nThe words contain only upper-case and lower-case English letters.\r\n number of characters in the entire document \r\n number of paragraphs in the entire document \r\nOutput Format\r\n\r\nPrint the paragraph, sentence or the word corresponding to the query to check the logic of your code.', 'Sample Input 0\r\n\r\n2\r\nLearning C is fun.\r\nLearning pointers is more fun.It is good to have pointers.\r\n3\r\n1 2\r\n2\r\n5\r\n6\r\n2 1 1\r\n4\r\n3 1 1 1\r\nSample Output 0\r\n\r\nLearning pointers is more fun.It is good to have pointers.\r\nLearning C is fun\r\nLearning\r\nExplanation 0\r\n\r\nThe first query corresponds to returning the second paragraph with sentences of lengths and words.\r\nThe second query correspond to returning the first sentence of the first paragraph. It contains words.\r\nThe third query corresponds to returning the first word of the first sentence of the first paragraph.\r\n\r\n', '2020-09-16'),
(10, 'C', 'Post Transition\r\n\r\n', 'Hard', 'We live in a big country. This country has towns in it. Each town has some post offices in which packages are stored and transferred.\r\n\r\nPost offices have different inner structure. Specifically, each of them has some limitations on the packages it can store - their weight should be between and inclusively, where and are fixed for each office.\r\n\r\nPackages are stored in some order in the office queue. That means, that they are processed using this order when sending and receiving.\r\n\r\nSometimes two post offices, even in different towns, may organize the following transaction: the first one sends all its packages to the second one. The second one accepts the packages that satisfy the weight condition for the second office and rejects all other ones. These rejected packages return to the first office back and are stored in the same order they were stored before they were sent. The accepted packages move to the tail of the second office\'s queue in the same order they were stored in the first office.\r\n\r\nYou should process several queries in your program. You\'ll be provided with structures , and . in order to complete this task, you should fill the following functions:\r\n\r\n - given the town , print all packages in this town. They should be printed as follows:\r\n\r\nTown_name:\r\n 0:\r\n id_0\r\n id_1\r\n ...\r\n 1:\r\n id_2\r\n id_3\r\n ...\r\n ...\r\nwhere , etc are the numbers of post offices and , ... are the ids of packages from the th post office in the order of its queue, , are from the st one etc. There should be one \'\\t\' symbol before post office numbers and two \'\\t\' symbols before the ids.\r\n\r\n - given the towns and and post office indices and , manage the transaction described above between the post office # in town and the post office # in town .\r\n\r\n - given all towns, find the one with the most number of packages in all post offices altogether. If there are several of them, find the first one from the collection .\r\n\r\n - given all towns and a string , find the town with the name . It\'s guaranteed that the town exists.\r\n\r\nInput Format\r\n\r\nFirst line of the input contains a single integer . blocks follow, each describing a town.\r\n\r\nEvery town block contains several lines. On the first line there is a string - the name of the town. On the second line there is an integer - the number of the offices in the town. blocks follow then, each describing an office.\r\n\r\nEvery office block also contains several lines. On the first line there are three integers separated by single spaces: (the number of packages in the office), and (described above). blocks follow, each describing a package.\r\n\r\nEvery package block contains exactly two lines. On the first line there is a string which is an id of the package. On the second line there is an integer which is the weight of the package.\r\n\r\nThen, there is a single integer on the line which is the number of queries. blocks follow, each describing a query.\r\n\r\nEvery query block contains several lines. On the first line there is an integer , or . If this integer is , on the second line there is a string - the name of town for which all packages should be printed. If this integer is , on the second line there are string , integer , string and integer separated by single spaces. That means transactions between post office # in the town and post office # in the town should be processed.\r\n\r\nIf the integer is , no lines follow and the town with the most number of packages should be found.\r\n\r\nConstraints\r\n\r\nAll integer are between and \r\n, .\r\nAll strings have length \r\nAll towns\' names have only uppercase english letters and are unique.\r\nAll packages\' ids have only lowercase english letters and are unique.\r\nFor each post office, .\r\nAll queries are valid, that means, towns with the given names always exist, post offices with the given indices always exist.\r\nOutput Format\r\n\r\nFor queries of type , print all packages in the format provided in the problem statement. For queries of type , print \"Town with the most number of packages is \" on a separate line.', 'Sample Input 0\r\n\r\n2\r\nA\r\n2\r\n2 1 3\r\na 2\r\nb 3\r\n1 2 4\r\nc 2\r\nB\r\n1\r\n4 1 4\r\nd 1\r\ne 2\r\nf 3\r\nh 4\r\n5\r\n3\r\n2 B 0 A 1\r\n3\r\n1 A\r\n1 B\r\nSample Output 0\r\n\r\nTown with the most number of packages is B\r\nTown with the most number of packages is A\r\nA:\r\n 0:\r\n a\r\n b\r\n 1:\r\n c\r\n e\r\n f\r\n h\r\nB:\r\n 0:\r\n d\r\nExplanation 0\r\n\r\nBefore all queries, town B has packages in total, town has . But after transaction all packages from B\'s th post office go to the st post office of A, except package d because it\'s too light.\r\n\r\n', '2020-09-16'),
(11, 'Java', 'Welcome to Java!', 'Easy', 'Welcome to the world of Java! In this challenge, we practice printing to stdout.\r\n\r\nThe code stubs in your editor declare a Solution class and a main method. Complete the main method by copying the two lines of code below and pasting them inside the body of your main method.\r\n\r\nSystem.out.println(\"Hello, World.\");\r\nSystem.out.println(\"Hello, Java.\");\r\nInput Format\r\n\r\nThere is no input for this challenge.\r\n\r\nOutput Format\r\n\r\nYou must print two lines of output:\r\n\r\nPrint Hello, World. on the first line.\r\nPrint Hello, Java. on the second line.', 'Sample Output\r\n\r\nHello, World.\r\nHello, Java.', '2020-09-16'),
(12, 'Java', 'Java Stdin and Stdout 1', 'Easy', 'Most HackerRank challenges require you to read input from stdin (standard input) and write output to stdout (standard output).\r\n\r\nOne popular way to read input from stdin is by using the Scanner class and specifying the Input Stream as System.in. For example:\r\n\r\nScanner scanner = new Scanner(System.in);\r\nString myString = scanner.next();\r\nint myInt = scanner.nextInt();\r\nscanner.close();\r\n\r\nSystem.out.println(\"myString is: \" + myString);\r\nSystem.out.println(\"myInt is: \" + myInt);\r\nThe code above creates a Scanner object named and uses it to read a String and an int. It then closes the Scanner object because there is no more input to read, and prints to stdout using System.out.println(String). So, if our input is:\r\n\r\nHi 5\r\nOur code will print:\r\n\r\nmyString is: Hi\r\nmyInt is: 5\r\nAlternatively, you can use the BufferedReader class.\r\n\r\nTask\r\nIn this challenge, you must read integers from stdin and then print them to stdout. Each integer must be printed on a new line. To make the problem a little easier, a portion of the code is provided for you in the editor below.\r\n\r\nInput Format\r\n\r\nThere are lines of input, and each line contains a single integer.\r\n\r\nSample Input\r\n\r\n42\r\n100\r\n125', 'Sample Output\r\n\r\n42\r\n100\r\n125', '2020-09-16'),
(13, 'Java', 'Java If-Else', 'Easy', 'In this challenge, we test your knowledge of using if-else conditional statements to automate decision-making processes. An if-else statement has the following logical flow:\r\n\r\nWikipedia if-else flow chart\r\n\r\nSource: Wikipedia\r\n\r\nTask\r\nGiven an integer, , perform the following conditional actions:\r\n\r\nIf is odd, print Weird\r\nIf is even and in the inclusive range of to , print Not Weird\r\nIf is even and in the inclusive range of to , print Weird\r\nIf is even and greater than , print Not Weird\r\nComplete the stub code provided in your editor to print whether or not is weird.\r\n\r\nInput Format\r\n\r\nA single line containing a positive integer, .\r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint Weird if the number is weird; otherwise, print Not Weird.\r\n\r\nSample Input 0\r\n\r\n3\r\nSample Output 0\r\n\r\nWeird\r\nSample Input 1\r\n\r\n24', 'Sample Output 1\r\n\r\nNot Weird', '2020-09-16'),
(14, 'Java', 'Java Stdin and Stdout II\r\n\r\n', 'Easy', 'In this challenge, you must read an integer, a double, and a String from stdin, then print the values according to the instructions in the Output Format section below. To make the problem a little easier, a portion of the code is provided for you in the editor.\r\n\r\nNote: We recommend completing Java Stdin and Stdout I before attempting this challenge.\r\n\r\nInput Format\r\n\r\nThere are three lines of input:\r\n\r\nThe first line contains an integer.\r\nThe second line contains a double.\r\nThe third line contains a String.\r\nOutput Format\r\n\r\nThere are three lines of output:\r\n\r\nOn the first line, print String: followed by the unaltered String read from stdin.\r\nOn the second line, print Double: followed by the unaltered double read from stdin.\r\nOn the third line, print Int: followed by the unaltered integer read from stdin.\r\nTo make the problem easier, a portion of the code is already provided in the editor.\r\n\r\nNote: If you use the nextLine() method immediately following the nextInt() method, recall that nextInt() reads integer tokens; because of this, the last newline character for that line of integer input is still queued in the input buffer and the next nextLine() will be reading the remainder of the integer line (which is empty).\r\n\r\nSample Input\r\n\r\n42\r\n3.1415\r\nWelcome to HackerRank\'s Java tutorials!', 'Sample Output\r\n\r\nString: Welcome to HackerRank\'s Java tutorials!\r\nDouble: 3.1415\r\nInt: 42', '2020-09-16'),
(15, 'Java', 'Java Regex', 'Medium', 'Write a class called MyRegex which will contain a string pattern. You need to write a regular expression and assign it to the pattern such that it can be used to validate an IP address. Use the following definition of an IP address:\r\n\r\nIP address is a string in the form \"A.B.C.D\", where the value of A, B, C, and D may range from 0 to 255. Leading zeros are allowed. The length of A, B, C, or D can\'t be greater than 3.\r\nSome valid IP address:\r\n\r\n000.12.12.034\r\n121.234.12.12\r\n23.45.12.56\r\nSome invalid IP address:\r\n\r\n000.12.234.23.23\r\n666.666.23.23\r\n.213.123.23.32\r\n23.45.22.32.\r\nI.Am.not.an.ip\r\nIn this problem you will be provided strings containing any combination of ASCII characters. You have to write a regular expression to find the valid IPs.\r\n\r\nJust write the MyRegex class which contains a String . The string should contain the correct regular expression.\r\n\r\n(MyRegex class MUST NOT be public)\r\n\r\nSample Input\r\n\r\n000.12.12.034\r\n121.234.12.12\r\n23.45.12.56\r\n00.12.123.123123.123\r\n122.23\r\nHello.IP', 'Sample Output\r\n\r\ntrue\r\ntrue\r\ntrue\r\nfalse\r\nfalse\r\nfalse', '2020-09-16'),
(16, 'Java', 'Java Regex 2 - Duplicate Words', 'Medium', 'In this challenge, we use regular expressions (RegEx) to remove instances of words that are repeated more than once, but retain the first occurrence of any case-insensitive repeated word. For example, the words love and to are repeated in the sentence I love Love to To tO code. Can you complete the code in the editor so it will turn I love Love to To tO code into I love to code?\r\n\r\nTo solve this challenge, complete the following three lines:\r\n\r\nWrite a RegEx that will match any repeated word.\r\nComplete the second compile argument so that the compiled RegEx is case-insensitive.\r\nWrite the two necessary arguments for replaceAll such that each repeated word is replaced with the very first instance the word found in the sentence. It must be the exact first occurrence of the word, as the expected output is case-sensitive.\r\nNote: This challenge uses a custom checker; you will fail the challenge if you modify anything other than the three locations that the comments direct you to complete. To restore the editor\'s original stub code, create a new buffer by clicking on the branch icon in the top left of the editor.\r\n\r\nInput Format\r\n\r\nThe following input is handled for you the given stub code:\r\n\r\nThe first line contains an integer, , denoting the number of sentences.\r\nEach of the subsequent lines contains a single sentence consisting of English alphabetic letters and whitespace characters.\r\n\r\nConstraints\r\n\r\nEach sentence consists of at most English alphabetic letters and whitespaces.\r\nOutput Format\r\n\r\nStub code in the editor prints the sentence modified by the replaceAll line to stdout. The modified string must be a modified version of the initial sentence where all repeat occurrences of each word are removed.\r\n\r\nSample Input\r\n\r\n5\r\nGoodbye bye bye world world world\r\nSam went went to to to his business\r\nReya is is the the best player in eye eye game\r\nin inthe\r\nHello hello Ab aB', 'Sample Output\r\n\r\nGoodbye bye world\r\nSam went to his business\r\nReya is the best player in eye game\r\nin inthe\r\nHello Ab', '2020-09-16'),
(17, 'Java', 'Java Regex 2 - Duplicate Words', 'Medium', 'In this challenge, we use regular expressions (RegEx) to remove instances of words that are repeated more than once, but retain the first occurrence of any case-insensitive repeated word. For example, the words love and to are repeated in the sentence I love Love to To tO code. Can you complete the code in the editor so it will turn I love Love to To tO code into I love to code?\r\n\r\nTo solve this challenge, complete the following three lines:\r\n\r\nWrite a RegEx that will match any repeated word.\r\nComplete the second compile argument so that the compiled RegEx is case-insensitive.\r\nWrite the two necessary arguments for replaceAll such that each repeated word is replaced with the very first instance the word found in the sentence. It must be the exact first occurrence of the word, as the expected output is case-sensitive.\r\nNote: This challenge uses a custom checker; you will fail the challenge if you modify anything other than the three locations that the comments direct you to complete. To restore the editor\'s original stub code, create a new buffer by clicking on the branch icon in the top left of the editor.\r\n\r\nInput Format\r\n\r\nThe following input is handled for you the given stub code:\r\n\r\nThe first line contains an integer, , denoting the number of sentences.\r\nEach of the subsequent lines contains a single sentence consisting of English alphabetic letters and whitespace characters.\r\n\r\nConstraints\r\n\r\nEach sentence consists of at most English alphabetic letters and whitespaces.\r\nOutput Format\r\n\r\nStub code in the editor prints the sentence modified by the replaceAll line to stdout. The modified string must be a modified version of the initial sentence where all repeat occurrences of each word are removed.\r\n\r\nSample Input\r\n\r\n5\r\nGoodbye bye bye world world world\r\nSam went went to to to his business\r\nReya is is the the best player in eye eye game\r\nin inthe\r\nHello hello Ab aB', 'Sample Output\r\n\r\nGoodbye bye world\r\nSam went to his business\r\nReya is the best player in eye game\r\nin inthe\r\nHello Ab', '2020-09-16'),
(18, 'Java', 'Tag Content Extractor', 'Medium', 'In a tag-based language like XML or HTML, contents are enclosed between a start tag and an end tag like <tag>contents</tag>. Note that the corresponding end tag starts with a /.\r\n\r\nGiven a string of text in a tag-based language, parse this text and retrieve the contents enclosed within sequences of well-organized tags meeting the following criterion:\r\n\r\nThe name of the start and end tags must be same. The HTML code <h1>Hello World</h2> is not valid, because the text starts with an h1 tag and ends with a non-matching h2 tag.\r\n\r\nTags can be nested, but content between nested tags is considered not valid. For example, in <h1><a>contents</a>invalid</h1>, contents is valid but invalid is not valid.\r\n\r\nTags can consist of any printable characters.\r\n\r\nInput Format\r\n\r\nThe first line of input contains a single integer, (the number of lines).\r\nThe subsequent lines each contain a line of text.\r\n\r\nConstraints\r\n\r\nEach line contains a maximum of printable characters.\r\nThe total number of characters in all test cases will not exceed .\r\nOutput Format\r\n\r\nFor each line, print the content enclosed within valid tags.\r\nIf a line contains multiple instances of valid content, print out each instance of valid content on a new line; if no valid content is found, print None.\r\n\r\nSample Input\r\n\r\n4\r\n<h1>Nayeem loves counseling</h1>\r\n<h1><h1>Sanjay has no watch</h1></h1><par>So wait for a while</par>\r\n<Amee>safat codes like a ninja</amee>\r\n<SA premium>Imtiaz has a secret crush</SA premium>', 'Sample Output\r\n\r\nNayeem loves counseling\r\nSanjay has no watch\r\nSo wait for a while\r\nNone\r\nImtiaz has a secret crush', '2020-09-16'),
(19, 'Java', 'Java Stack', 'Hard', 'A string containing only parentheses is balanced if the following is true: 1. if it is an empty string 2. if A and B are correct, AB is correct, 3. if A is correct, (A) and {A} and [A] are also correct.\r\n\r\nExamples of some correctly balanced strings are: \"{}()\", \"[{()}]\", \"({()})\"\r\n\r\nExamples of some unbalanced strings are: \"{}(\", \"({)}\", \"[[\", \"}{\" etc.\r\n\r\nGiven a string, determine if it is balanced or not.\r\n\r\nInput Format\r\n\r\nThere will be multiple lines in the input file, each having a single non-empty string. You should read input till end-of-file.\r\n\r\nThe part of the code that handles input operation is already provided in the editor.\r\n\r\nOutput Format\r\n\r\nFor each case, print \'true\' if the string is balanced, \'false\' otherwise.\r\n\r\nSample Input\r\n\r\n{}()\r\n({()})\r\n{}(\r\n[]', 'Sample Output\r\n\r\ntrue\r\ntrue\r\nfalse\r\ntrue', '2020-09-16'),
(20, 'Java', 'Java MD5', 'Hard', 'MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a -bit hash value. Here are some common uses for MD5:\r\n\r\nTo store a one-way hash of a password.\r\nTo provide some assurance that a transferred file has arrived intact.\r\nMD5 is one in a series of message digest algorithms designed by Professor Ronald Rivest of MIT (Rivest, ); however, the security of MD5 has been severely compromised, most infamously by the Flame malware in . The CMU Software Engineering Institute essentially considers MD5 to be \"cryptographically broken and unsuitable for further use\".\r\n\r\nGiven an alphanumeric string, , denoting a password, compute and print its MD5 encryption value.\r\n\r\nInput Format\r\n\r\nA single alphanumeric string denoting .\r\n\r\nConstraints\r\n\r\nString consists of English alphabetic letters (i.e., and/or decimal digits (i.e., through ) only.\r\nOutput Format\r\n\r\nPrint the MD5 encryption value of on a new line.\r\n\r\nSample Input 0\r\n\r\nHelloWorld\r\nSample Output 0\r\n\r\n68e109f0f40ca72a15e05cc22786f8e6\r\nSample Input 1\r\n\r\nJavarmi123', 'Sample Output 1\r\n\r\n2da2d1e0ce7b4951a858ed2d547ef485', '2020-09-16'),
(21, 'Python', 'Say \"Hello, World!\" With Python', 'Easy', 'Here is a sample line of code that can be executed in Python:\r\n\r\nprint(\"Hello, World!\")\r\nYou can just as easily store a string as a variable and then print it to stdout:\r\n\r\nmy_string = \"Hello, World!\"\r\nprint(my_string)\r\nThe above code will print Hello, World! on your screen. Try it yourself in the editor below!\r\n\r\nInput Format\r\n\r\nYou do not need to read any input in this challenge.\r\n\r\nOutput Format\r\n\r\nPrint Hello, World! to stdout.', 'Sample Output 0\r\n\r\nHello, World!', '2020-09-16'),
(22, 'Python', 'Python If-Else', 'Easy', 'Given an integer, , perform the following conditional actions:\r\n\r\nIf is odd, print Weird\r\nIf is even and in the inclusive range of to , print Not Weird\r\nIf is even and in the inclusive range of to , print Weird\r\nIf is even and greater than , print Not Weird\r\nInput Format\r\n\r\nA single line containing a positive integer, .\r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint Weird if the number is weird. Otherwise, print Not Weird.\r\n\r\nSample Input 0\r\n\r\n3', 'Sample Output 0\r\n\r\nWeird\r\nExplanation 0\r\n\r\n\r\n is odd and odd numbers are weird, so print Weird.', '2020-09-16'),
(23, 'Python', 'Arithmetic Operators', 'Easy', 'Task\r\nThe provided code stub reads two integers from STDIN, and . Add code to print three lines where:\r\n\r\nThe first line contains the sum of the two numbers.\r\nThe second line contains the difference of the two numbers (first - second).\r\nThe third line contains the product of the two numbers.\r\nExample\r\n\r\n\r\nPrint the following:\r\n\r\n8\r\n-2\r\n15\r\nInput Format\r\n\r\nThe first line contains the first integer, .\r\nThe second line contains the second integer, .\r\n\r\nConstraints\r\n\r\n\r\n\r\nOutput Format\r\n\r\nPrint the three lines as explained above.\r\n\r\nSample Input 0\r\n\r\n3\r\n2', 'Sample Output 0\r\n\r\n5\r\n1\r\n6', '2020-09-16'),
(24, 'Python', 'The Minion Game', 'Medium', 'Kevin and Stuart want to play the \'The Minion Game\'.\r\n\r\nGame Rules\r\n\r\nBoth players are given the same string, .\r\nBoth players have to make substrings using the letters of the string .\r\nStuart has to make words starting with consonants.\r\nKevin has to make words starting with vowels.\r\nThe game ends when both players have made all possible substrings.\r\n\r\nScoring\r\nA player gets +1 point for each occurrence of the substring in the string .\r\n\r\nFor Example:\r\nString = BANANA\r\nKevin\'s vowel beginning word = ANA\r\nHere, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points.\r\n\r\nFor better understanding, see the image below:\r\n\r\nbanana.png\r\n\r\nYour task is to determine the winner of the game and their score.\r\n\r\nInput Format\r\n\r\nA single line of input containing the string .\r\nNote: The string will contain only uppercase letters: .\r\n\r\nConstraints\r\n\r\n\r\n\r\nOutput Format\r\n\r\nPrint one line: the name of the winner and their score separated by a space.\r\n\r\nIf the game is a draw, print Draw.\r\n\r\nSample Input\r\n\r\nBANANA', 'Sample Output\r\n\r\nStuart 12', '2020-09-16'),
(25, 'Python', 'Find Angle MBC', 'Medium', 'Therefore, .\r\n\r\nPoint is the midpoint of hypotenuse .\r\n\r\nYou are given the lengths and .\r\nYour task is to find (angle , as shown in the figure) in degrees.\r\n\r\nInput Format\r\n\r\nThe first line contains the length of side .\r\nThe second line contains the length of side .\r\n\r\nConstraints\r\n\r\n\r\nLengths and are natural numbers.\r\nOutput Format\r\n\r\nOutput in degrees.\r\n\r\nNote: Round the angle to the nearest integer.\r\n\r\nExamples:\r\nIf angle is 56.5000001°, then output 57°.\r\nIf angle is 56.5000000°, then output 57°.\r\nIf angle is 56.4999999°, then output 56°.\r\n\r\n\r\nSample Input\r\n\r\n10\r\n10', 'Sample Output\r\n\r\n45°', '2020-09-16'),
(26, 'Python', 'Tuple', 'Medium', 'Task\r\nGiven an integer, , and space-separated integers as input, create a tuple, , of those integers. Then compute and print the result of .\r\n\r\nNote: hash() is one of the functions in the __builtins__ module, so it need not be imported.\r\n\r\nInput Format\r\n\r\nThe first line contains an integer, , denoting the number of elements in the tuple.\r\nThe second line contains space-separated integers describing the elements in tuple .\r\n\r\nOutput Format\r\n\r\nPrint the result of .\r\n\r\nSample Input 0\r\n\r\n2\r\n1 2', 'Sample Output 0\r\n\r\n3713081631934410656', '2020-09-16'),
(27, 'Python', 'Find a string', 'Medium', 'In this challenge, the user enters a string and a substring. You have to print the number of times that the substring occurs in the given string. String traversal will take place from left to right, not from right to left.\r\n\r\nNOTE: String letters are case-sensitive.\r\n\r\nInput Format\r\n\r\nThe first line of input contains the original string. The next line contains the substring.\r\n\r\nConstraints\r\n\r\n\r\nEach character in the string is an ascii character.\r\n\r\nOutput Format\r\n\r\nOutput the integer number indicating the total number of occurrences of the substring in the original string.\r\n\r\nSample Input\r\n\r\nABCDCDC\r\nCDC', 'Sample Output\r\n\r\n2', '2020-09-16'),
(28, 'Python', 'Maximize It!\r\n\r\n', 'Hard', 'You are given a function . You are also given lists. The list consists of elements.\r\n\r\nYou have to pick one element from each list so that the value from the equation below is maximized:\r\n\r\n%\r\n\r\n denotes the element picked from the list . Find the maximized value obtained.\r\n\r\n denotes the modulo operator.\r\n\r\nNote that you need to take exactly one element from each list, not necessarily the largest element. You add the squares of the chosen elements and perform the modulo operation. The maximum value that you can obtain, will be the answer to the problem.\r\n\r\nInput Format\r\n\r\nThe first line contains space separated integers and .\r\nThe next lines each contains an integer , denoting the number of elements in the list, followed by space separated integers denoting the elements in the list.\r\n\r\nConstraints\r\n\r\n\r\n\r\n\r\n\r\nOutput Format\r\n\r\nOutput a single integer denoting the value .\r\n\r\nSample Input\r\n\r\n3 1000\r\n2 5 4\r\n3 7 8 9 \r\n5 5 7 8 9 10 ', 'Sample Output 0\r\n\r\n20013', '2020-09-16'),
(29, 'Python', 'Validating Postal Codes', 'Hard', 'A valid postal code have to fullfil both below requirements:\r\n\r\n must be a number in the range from to inclusive.\r\n must not contain more than one alternating repetitive digit pair.\r\nAlternating repetitive digits are digits which repeat immediately after the next digit. In other words, an alternating repetitive digit pair is formed by two equal digits that have just a single digit between them.\r\n\r\nFor example:\r\n\r\n121426 # Here, 1 is an alternating repetitive digit.\r\n523563 # Here, NO digit is an alternating repetitive digit.\r\n552523 # Here, both 2 and 5 are alternating repetitive digits.\r\nYour task is to provide two regular expressions regex_integer_in_range and regex_alternating_repetitive_digit_pair. Where:\r\n\r\nregex_integer_in_range should match only integers range from to inclusive\r\n\r\nregex_alternating_repetitive_digit_pair should find alternating repetitive digits pairs in a given string.\r\n\r\nBoth these regular expressions will be used by the provided code template to check if the input string is a valid postal code using the following expression:\r\n\r\n(bool(re.match(regex_integer_in_range, P)) \r\nand len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2)\r\nInput Format\r\n\r\nLocked stub code in the editor reads a single string denoting from stdin and uses provided expression and your regular expressions to validate if is a valid postal code.\r\n\r\nOutput Format\r\n\r\nYou are not responsible for printing anything to stdout. Locked stub code in the editor does that.\r\n\r\nSample Input 0\r\n\r\n110000', 'Sample Output 0\r\n\r\nFalse', '2020-09-16'),
(30, 'Python', 'Matrix Script', 'Hard', 'Neo has a complex matrix script. The matrix script is a X grid of strings. It consists of alphanumeric characters, spaces and symbols (!,@,#,$,%,&).\r\n\r\nCapture.JPG\r\n\r\nTo decode the script, Neo needs to read each column and select only the alphanumeric characters and connect them. Neo reads the column from top to bottom and starts reading from the leftmost column.\r\n\r\nIf there are symbols or spaces between two alphanumeric characters of the decoded script, then Neo replaces them with a single space \'\' for better readability.\r\n\r\nNeo feels that there is no need to use \'if\' conditions for decoding.\r\n\r\nAlphanumeric characters consist of: [A-Z, a-z, and 0-9].\r\n\r\nInput Format\r\n\r\nThe first line contains space-separated integers (rows) and (columns) respectively.\r\nThe next lines contain the row elements of the matrix script.\r\n\r\nConstraints\r\n\r\n\r\nNote: A score will be awarded for using \'if\' conditions in your code.\r\n\r\nOutput Format\r\n\r\nPrint the decoded matrix script.\r\n\r\nSample Input 0\r\n\r\n7 3\r\nTsi\r\nh%x\r\ni #\r\nsM \r\n$a \r\n#t%\r\nir!', 'Sample Input 0\r\n\r\n7 3\r\nTsi\r\nh%x\r\ni #\r\nsM \r\n$a \r\n#t%\r\nir!', '2020-09-16'),
(31, 'Ruby', 'Ruby Tutorial - Hello HackerRank!', 'Easy', 'Let\'s get started with Ruby!\r\n\r\nGo ahead and type the following code in the code-editor:\r\n\r\nprint \"Hello HackerRank!!\"', 'Hello HackerRank!!', '2020-09-16'),
(32, 'Ruby', 'Ruby Tutorial - Object Methods', 'Easy', 'Each object in Ruby may have methods associated with it. To demonstrate this, we want you to print whether a number is even or odd. A number has an even? method associated with it, which returns true or false based on the parity of the number.\r\n\r\nAssuming a variable number is already defined, check whether a given number is even or not.\r\n\r\nHint\r\n\r\nType in the code-editor\r\n\r\nreturn number.even?\r\nor\r\n\r\nnumber.even?\r\nInput Format\r\n\r\nThe first line of input contains an integer . The next contains one integer in each line.', 'Output Format\r\n\r\nThe output is handled by the code written in the editor.', '2020-09-16'),
(33, 'Ruby', 'Ruby Tutorial - Object Method Parameters', 'Easy', 'A method may take zero or more parameters as input. To demonstrate this, we look at the asserts we use on HackerRank. Sometimes, we have to check whether a given number a is within the range b and c (where b c, and both inclusive ).\r\n\r\nThree variables a, b, and c are already defined. Your task is to write code that checks whether a is within the range of b and c by calling the method range? (which we have defined for you as a method for this example) on a and passing b and c as arguments.', 'Hint\r\n\r\na.range?(b, c)\r\nor\r\n\r\nreturn a.range?(b, c)\r\nor\r\n\r\na.range? b, c\r\nor\r\n\r\nreturn a.range? b, c\r\n\r\na.range?(b, c)\r\nor\r\n\r\nreturn a.range?(b, c)\r\nor\r\n\r\na.range? b, c\r\nor\r\n\r\nreturn a.range? b, c', '2020-09-16'),
(34, 'Ruby', 'Ruby Control Structures - Case (Bonus Question)', 'Medium', 'This is a bonus question. Feel free to skip to the next challenge.\r\n\r\nHackerRank is written in RoR and we have various classes defined in it. Some of them are\r\n\r\nHacker\r\nSubmission\r\nTestCase\r\nContest\r\netc.\r\n\r\nYou have been given a function where an object which may or may not be of the above mentioned type is sent as an argument. You have to use the case control structure in Ruby to identify the class to which the object belongs and print the following output:\r\n\r\nif Hacker, output \"It\'s a Hacker!\"\r\nif Submission, output \"It\'s a Submission!\"\r\nif TestCase, output \"It\'s a TestCase!\"\r\nif Contest, output \"It\'s a Contest!\"\r\nfor any other object, output \"It\'s an unknown model\"', 'Note\r\n\r\nuse case (switch statement of Ruby)\r\nuse puts for printing\r\nRuby Docs on case', '2020-09-16'),
(35, 'Ruby', 'Lazy Evaluation', 'Medium', 'Lazy evaluation is an evaluation strategy that delays the assessment of an expression until its value is needed.\r\n\r\nRuby introduced a lazy enumeration feature. Lazy evaluation increases performance by avoiding needless calculations, and it has the ability to create potentially infinite data structures.\r\n\r\nExample:\r\n\r\npower_array = -> (power, array_size) do \r\n 1.upto(Float::INFINITY).lazy.map { |x| x**power }.first(array_size) \r\nend\r\n\r\nputs power_array.(2 , 4) #[1, 4, 9, 16]\r\nputs power_array.(2 , 10) #[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\r\nputs power_array.(3, 5) #[1, 8, 27, 64, 125]\r\nIn this example, lazy avoids needless calculations to compute power_array.\r\nIf we remove lazy from the above code, then our code would try to compute all ranging from to Float::INFINITY.\r\nTo avoid timeouts and memory allocation exceptions, we use lazy. Now, our code will only compute up to first(array_size).\r\n\r\nTask\r\n\r\nYour task is to print an array of the first palindromic prime numbers.\r\nFor example, the first palindromic prime numbers are .\r\n\r\nInput Format\r\n\r\nA single line of input containing the integer .\r\n\r\nConstraints\r\n\r\nYou are not given how big is.\r\n\r\nOutput Format\r\n\r\nPrint an array of the first palindromic primes.\r\n\r\nSample Input\r\n\r\n5', 'Sample Output\r\n\r\n[2, 3, 5, 7, 11]', '2020-09-16'),
(36, 'Ruby', 'Ruby - Enumerable - Introduction\r\n\r\n', 'Medium', 'In control structures tutorial, we learned about various methods to iterate over a collection like unless, loop and the most commonly used each method.\r\n\r\nRuby, however, provides an Enumerable module which packages a bunch of methods which can be used with any other class by including it (referred to as mixing in). That means that programmers don\'t have to write all those methods many different times for different objects. As long as the custom object defines an each method and includes Enumerable module, it can get access to all of its magic.', 'In this challenge, you have been provided with a custom object called colors that defines its own each method. You need to iterate over the items and return an Array containing the values.', '2020-09-16');
INSERT INTO `question` (`q_id`, `q_language`, `q_info`, `q_info_type`, `q_statement`, `q_state_code`, `q_date`) VALUES
(37, 'Ruby', 'Ruby - Strings - Encoding', 'Medium', 'In Ruby, strings are objects of the String class, which defines a powerful set of operations and methods for manipulating text (e.g., indexing, searching, modifying, etc.). Here are a few easy ways to create Strings:\r\n\r\nmy_string = \"Hello.\" # create a string from a literal\r\nmy_empty_string = String.new # create an empty string\r\nmy_copied_string = String.new(my_string) # copy a string to a new variable\r\nUntil Ruby , Strings were nothing but a collection of bytes. Data was indexed by byte count, size was in terms of number of bytes, and so on. Since Ruby , Strings have additional encoding information attached to the bytes which provides information on how to interpret them. For example, this code:\r\n\r\nstr = \"With ?!\"\r\nprint(\"My String\'s encoding: \", str.encoding.name) \r\nprint(\"\\nMy String\'s size: \", str.size)\r\nprint(\"\\nMy String\'s bytesize: \", str.bytesize)\r\nproduces this output:\r\n\r\nMy String\'s encoding: UTF-8\r\nMy String\'s size: 7\r\nMy String\'s bytesize: 9\r\nYou can make the following observations about the above code:\r\n\r\nThe string literal creates an object which has several accessible methods.\r\nThe string has attached encoding information indicating it\'s an UTF-8 string.\r\nA String\'s size corresponds to the umber of characters we see.\r\nA String\'s bytesize corresponds to the actual space taken by the characters in memory (the ? symbol requires bytes instead of ).\r\nAlthough is the most popular (and recommended) encoding style for content, Ruby supports other encodings (try for the full list). With this in mind, we should learn how to convert between different encodings.\r\n\r\nTask\r\nIn this challenge, we practice setting the encoding information for some string of text using Ruby\'s Encoding methods. Write a function named transcode which takes a encoded string as a parameter, converts it to an encoded string, and returns the result.\r\n\r\nInput Format\r\n\r\nOur hidden code checker will call your function, passing it an encoded string as an argument.\r\n\r\nConstraints\r\n\r\nYour function must be named transcode.', 'Output Format\r\n\r\nYour function must return an encoded string.', '2020-09-16'),
(38, 'Ruby', 'Block', 'Hard', 'Higher order functions are one of the key components of functional programming.\r\n\r\nA higher order function is a tool that takes other functions as parameters or returns them as a result.\r\n\r\nBlocks are nameless methods that can be passed to another method as a parameter.\r\nPassing a block to a method is a great way of data abstraction.\r\n\r\nBlocks can either be defined with a keyword do ... end or curly braces { ... }.\r\n\r\nExample:\r\n\r\na). Passing a block to a method that takes no parameter\r\n\r\nCODE\r\n\r\ndef call_block\r\n puts \"Start of method.\"\r\n yield\r\n puts \"End of method.\"\r\nend \r\ncall_block do \r\n puts \"I am inside call_block method.\"\r\nend', 'OUTPUT\r\n\r\nStart of method.\r\nI am inside call_block method.\r\nEnd of method.\r\nIn this example, a block is passed to the call_block method.\r\nTo invoke this block inside the method, we used a keyword, yield.\r\nCalling yield will execute the code within the block that is provided to the method.', '2020-09-16'),
(39, 'Ruby', 'Procs', 'Hard', 'Passing blocks is one way to pass functions as arguments to other functions.\r\n\r\nBlocks are one of the very few exceptions to the \"everything is an object\" rule in Ruby. Blocks are not objects, and they can\'t be saved to variables.\r\n\r\nProc objects are blocks of code that can be bound to a set of local variables. You can think of a proc object as a \"saved\" block.\r\n\r\nProcs are a great way of keeping your code DRY. DRY stands for Do not Repeat Yourself.\r\n\r\nExample:\r\n\r\nCODE\r\n\r\ndef foo(a, b, my_proc)\r\n my_proc.call(a, b)\r\nend\r\n\r\nadd = proc {|x, y| x + y}\r\n\r\nputs foo(15, 10, add)', 'OUTPUT\r\n\r\n25\r\nIn this example, we have created the proc add, which adds two numbers.\r\nThe proc add is passed as a parameter to the method foo.\r\nIn the method foo, my_proc.call(a, b) executes the proc.', '2020-09-16'),
(40, 'Ruby', 'Ruby - Methods - Keyword Arguments', 'Hard', 'In our previous challenge, we explored one way to pass a variable number of arguments to our methods. While it may seem handy feature to have, except few circumstances, you are never going to use that many variables for your method. Also, if your are passing several different types of variables to the method which then will be assigned to the array, it can be difficult for the programmer invoking the method to remember the proper order for those arguments.\r\n\r\nRuby allows you to (partially) mitigate this problem by passing a Hash as an argument or one of the arguments. For example, you have a method that takes a URI to download a file and another argument containing a Hash of other named options (proxy, timeout, active-connections etc.,)\r\n\r\ndef fetch_file(uri, options)\r\n if options.has_key?(:proxy)\r\n # do something\r\n end\r\nend\r\nThe main problem with this technique, however, is that you cannot easily set default value for arguments (Read more). Since this construct is highly useful, Ruby 2 introduced keyword arguments which allows you to write -\r\n\r\ndef foo(x, str: \"foo\", num: 424242)\r\n [x, str, num]\r\nend\r\n\r\nfoo(13) #=> [13, \'foo\', 424242]\r\nfoo(13, str: \'bar\') #=> [13, \'bar\', 424242]\r\nAlso, introducing the double splat (**) which similar to it\'s counterpart collects all the extra named keywords as a hash parameter.\r\n\r\ndef foo(str: \"foo\", num: 424242, **options)\r\n [str, num, options]\r\nend\r\n\r\nfoo #=> [\'foo\', 424242, {}]\r\nfoo(check: true) # => [\'foo\', 424242, {check: true}]', 'In this challenge, your task is to write a method convert_temp that helps in temperature conversion. The method will receive a number as an input (temperature), a named parameter input_scale (scale for input temperature), and an optional parameter output_scale (output temperature scale, defaults to Celsius) and return the converted temperature. It should perform interconversion between Celsius, Fahrenheit and Kelvin scale.\r\n\r\nFor example,\r\n\r\n> convert_temp(0, input_scale: \'celsius\', output_scale: \'kelvin\')\r\n=> 273.15 \r\n> convert_temp(0, input_scale: \'celsius\', output_scale: \'fahrenheit\')\r\n=> 32.0\r\nNote that the input values are lowercase version of corresponding scales.', '2020-09-16'),
(41, 'Data Structures', '2D Array - DS', 'Easy', 'Given a 2D Array, :\r\n\r\n1 1 1 0 0 0\r\n0 1 0 0 0 0\r\n1 1 1 0 0 0\r\n0 0 0 0 0 0\r\n0 0 0 0 0 0\r\n0 0 0 0 0 0\r\nAn hourglass in is a subset of values with indices falling in this pattern in \'s graphical representation:\r\n\r\na b c\r\n d\r\ne f g\r\nThere are hourglasses in . An hourglass sum is the sum of an hourglass\' values. Calculate the hourglass sum for every hourglass in , then print the maximum hourglass sum. The array will always be .\r\n\r\nExample\r\n\r\n\r\n-9 -9 -9 1 1 1 \r\n 0 -9 0 4 3 2\r\n-9 -9 -9 1 2 3\r\n 0 0 8 6 6 0\r\n 0 0 0 -2 0 0\r\n 0 0 1 2 4 0\r\nThe hourglass sums are:\r\n\r\n-63, -34, -9, 12, \r\n-10, 0, 28, 23, \r\n-27, -11, -2, 10, \r\n 9, 17, 25, 18\r\nThe highest hourglass sum is from the hourglass beginning at row , column :\r\n\r\n0 4 3\r\n 1\r\n8 6 6\r\nNote: If you have already solved the Java domain\'s Java 2D Array challenge, you may wish to skip this challenge.\r\n\r\nFunction Description\r\n\r\nComplete the function hourglassSum in the editor below.\r\n\r\nhourglassSum has the following parameter(s):\r\n\r\nint arr[6][6]: an array of integers\r\nReturns\r\n\r\nint: the maximum hourglass sum\r\nInput Format\r\n\r\nEach of the lines of inputs contains space-separated integers .\r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint the largest (maximum) hourglass sum found in .\r\n\r\nSample Input\r\n\r\n1 1 1 0 0 0\r\n0 1 0 0 0 0\r\n1 1 1 0 0 0\r\n0 0 2 4 4 0\r\n0 0 0 2 0 0\r\n0 0 1 2 4 0', 'Sample Output\r\n\r\n19', '2020-09-16'),
(42, 'Data Structures', 'Arrays - DS', 'Easy', 'An array is a type of data structure that stores elements of the same type in a contiguous block of memory. In an array, , of size , each memory location has some unique index, (where ), that can be referenced as or .\r\n\r\nReverse an array of integers.\r\n\r\nNote: If you\'ve already solved our C++ domain\'s Arrays Introduction challenge, you may want to skip this.\r\n\r\nExample\r\n\r\nReturn .\r\n\r\nFunction Description\r\n\r\nComplete the function reverseArray in the editor below.\r\n\r\nreverseArray has the following parameter(s):\r\n\r\nint A[n]: the array to reverse\r\nReturns\r\n\r\nint[n]: the reversed array\r\nInput Format\r\n\r\nThe first line contains an integer, , the number of integers in .\r\nThe second line contains space-separated integers that make up .\r\n\r\nConstraints\r\n\r\nSample Input 1\r\n\r\nCopyDownload\r\nArray: arr\r\n1\r\n4\r\n3\r\n2\r\n\r\n ', 'Sample Output 1\r\n\r\n2 3 4 1', '2020-09-16'),
(43, 'Data Structures', 'Dynamic Array', 'Easy', 'Create a list, , of empty sequences, where each sequence is indexed from to . The elements within each of the sequences also use -indexing.\r\nCreate an integer, , and initialize it to .\r\nThere are types of queries that can be performed on the list of sequences:\r\nQuery: 1 x y\r\nFind the sequence, , at index in .\r\nAppend integer to sequence .\r\nQuery: 2 x y\r\nFind the sequence, , at index in .\r\nFind the value of element in (where is the size of ) and assign it to .\r\nPrint the new value of on a new line\r\nNote: is the bitwise XOR operation, which corresponds to the ^ operator in most languages. Learn more about it on Wikipedia. is the modulo operator.\r\n\r\nFunction Description\r\n\r\nComplete the dynamicArray function below.\r\n\r\ndynamicArray has the following parameters:\r\n- int n: the number of empty sequences to initialize in \r\n- string queries[q]: an array of query strings\r\n\r\nReturns\r\n\r\nint[]: the results of each type 2 query in the order they are presented\r\nInput Format\r\n\r\nThe first line contains two space-separated integers, (the number of sequences) and (the number of queries), respectively.\r\nEach of the subsequent lines contains a query in the format defined above, .\r\n\r\nConstraints\r\n\r\nIt is guaranteed that query type will never query an empty sequence or index.\r\nSample Input\r\n\r\n2 5\r\n1 0 5\r\n1 1 7\r\n1 0 3\r\n2 1 0\r\n2 1 1', 'Sample Output\r\n\r\n7\r\n3', '2020-09-16'),
(44, 'Data Structures', 'Left Rotation', 'Medium', 'A left rotation operation on an array of size shifts each of the array\'s elements unit to the left. Given an integer, , rotate the array that many steps left and return the result.\r\n\r\nExample\r\n\r\n\r\nAfter rotations, .\r\n\r\nFunction Description\r\n\r\nComplete the rotateLeft function in the editor below.\r\n\r\nrotateLeft has the following parameters:\r\n\r\nint d: the amount to rotate by\r\nint arr[n]: the array to rotate\r\nReturns\r\n\r\nint[n]: the rotated array\r\nInput Format\r\n\r\nThe first line contains two space-separated integers that denote , the number of integers, and , the number of left rotations to perform.\r\nThe second line contains space-separated integers that describe .\r\n\r\nConstraints\r\n\r\nSample Input\r\n\r\n5 4\r\n1 2 3 4 5', 'Sample Output\r\n\r\n5 1 2 3 4', '2020-09-16'),
(45, 'Data Structures', 'Cycle Detection', 'Medium', 'A linked list is said to contain a cycle if any node is visited more than once while traversing the list. Given a pointer to the head of a linked list, determine if it contains a cycle. If it does, return . Otherwise, return .\r\n\r\nExample\r\n\r\n refers to the list of nodes \r\n\r\nThe numbers shown are the node numbers, not their data values. There is no cycle in this list so return .\r\n\r\n refers to the list of nodes \r\n\r\nThere is a cycle where node 3 points back to node 1, so return .\r\n\r\nFunction Description\r\n\r\nComplete the has_cycle function in the editor below.\r\n\r\nIt has the following parameter:\r\n\r\nSinglyLinkedListNode pointer head: a reference to the head of the list\r\nReturns\r\n\r\nint: if there is a cycle or if there is not\r\nNote: If the list is empty, will be null.\r\n\r\nInput Format\r\n\r\nThe code stub reads from stdin and passes the appropriate argument to your function. The custom test cases format will not be described for this question due to its complexity. Expand the section for the main function and review the code if you would like to figure out how to create a custom case.\r\n\r\nConstraints\r\n\r\nSample Input\r\n\r\nReferences to each of the following linked lists are passed as arguments to your function:', 'Sample Output\r\n\r\n0\r\n1', '2020-09-16'),
(46, 'Data Structures', 'Tree: Huffman Decoding', 'Medium', 'Huffman coding assigns variable length codewords to fixed length input characters based on their frequencies. More frequent characters are assigned shorter codewords and less frequent characters are assigned longer codewords. All edges along the path to a character contain a code digit. If they are on the left side of the tree, they will be a 0 (zero). If on the right, they\'ll be a 1 (one). Only the leaves will contain a letter and its frequency count. All other nodes will contain a null instead of a character, and the count of the frequency of all of it and its descendant characters.\r\n\r\nFor instance, consider the string ABRACADABRA. There are a total of characters in the string. This number should match the count in the ultimately determined root of the tree. Our frequencies are and . The two smallest frequencies are for and , both equal to , so we\'ll create a tree with them. The root node will contain the sum of the counts of its descendants, in this case . The left node will be the first character encountered, , and the right will contain . Next we have items with a character count of : the tree we just created, the character and the character . The tree came first, so it will go on the left of our new root node. will go on the right. Repeat until the tree is complete, then fill in the \'s and \'s for the edges. The finished graph looks like:\r\n\r\nimage\r\n\r\nInput characters are only present in the leaves. Internal nodes have a character value of ? (NULL). We can determine that our values for characters are:\r\n\r\nA - 0\r\nB - 111\r\nC - 1100\r\nD - 1101\r\nR - 10\r\nOur Huffman encoded string is:\r\n\r\nA B R A C A D A B R A\r\n0 111 10 0 1100 0 1101 0 111 10 0\r\nor\r\n01111001100011010111100\r\nTo avoid ambiguity, Huffman encoding is a prefix free encoding technique. No codeword appears as a prefix of any other codeword.\r\n\r\nTo decode the encoded string, follow the zeros and ones to a leaf and return the character there.\r\n\r\nYou are given pointer to the root of the Huffman tree and a binary coded string to decode. You need to print the decoded string.\r\n\r\nFunction Description\r\n\r\nComplete the function decode_huff in the editor below. It must return the decoded string.\r\n\r\ndecode_huff has the following parameters:\r\n\r\nroot: a reference to the root node of the Huffman tree\r\ns: a Huffman encoded string\r\nInput Format\r\n\r\nThere is one line of input containing the plain string, . Background code creates the Huffman tree then passes the head node and the encoded string to the function.\r\n\r\nConstraints\r\n\r\n\r\nOutput Format\r\n\r\nOutput the decoded string on a single line.\r\n\r\nSample Input\r\n\r\nimage\r\n\r\ns=\"1001011\"', 'Sample Output\r\n\r\nABACA', '2020-09-16'),
(47, 'Data Structures', 'Queue using Two Stacks', 'Hard', 'A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed.\r\n\r\nA basic queue has the following operations:\r\n\r\nEnqueue: add a new element to the end of the queue.\r\nDequeue: remove the element from the front of the queue and return it.\r\nIn this challenge, you must first implement a queue using two stacks. Then process queries, where each query is one of the following types:\r\n\r\n1 x: Enqueue element into the end of the queue.\r\n2: Dequeue the element at the front of the queue.\r\n3: Print the element at the front of the queue.\r\nInput Format\r\n\r\nThe first line contains a single integer, , denoting the number of queries.\r\nEach line of the subsequent lines contains a single query in the form described in the problem statement above. All three queries start with an integer denoting the query , but only query is followed by an additional space-separated value, , denoting the value to be enqueued.\r\n\r\nConstraints\r\n\r\nIt is guaranteed that a valid answer always exists for each query of type .\r\nOutput Format\r\n\r\nFor each query of type , print the value of the element at the front of the queue on a new line.\r\n\r\nSample Input\r\n\r\n10\r\n1 42\r\n2\r\n1 14\r\n3\r\n1 28\r\n3\r\n1 60\r\n1 78\r\n2\r\n2', 'Sample Output\r\n\r\n14\r\n14', '2020-09-16'),
(48, 'Data Structures', 'Components in a graph', 'Hard', 'There are values to represent nodes in a graph. They are divided into two sets and . Each set has exactly values. Set is represent by . can contain any value between to (inclusive). Set is represented by . can contain any value between to (inclusive). Same value can be chosen any number of times.\r\n\r\nHere represents the edges of the graph.\r\n\r\nYour task is to print the number of vertices in the smallest and the largest connected components of the graph.\r\n\r\nNote Single nodes should not be considered in the answer.\r\n\r\nFor more clarity look at the following figure.\r\n\r\nAlt text\r\n\r\nFor the above graph smallest connected component is 7 and largest connected component is 17.\r\n\r\nInput Format\r\n\r\nFirst line contains an integer .\r\nEach of the next lines contain two space-separated integers, line contains and .\r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint two space separated integers, the number of vertices in the smallest and the largest components.\r\n\r\nSample Input\r\n\r\n5\r\n1 6 \r\n2 7\r\n3 8\r\n4 9\r\n2 6', 'Sample Output\r\n\r\n2 4', '2020-09-16'),
(49, 'Data Structures', 'Castle on the Grid', 'Hard', 'You are given a square grid with some cells open (.) and some blocked (X). Your playing piece can move along any row or column until it reaches the edge of the grid or a blocked cell. Given a grid, a start and an end position, determine the number of moves it will take to get to the end position.\r\n\r\nFor example, you are given a grid with sides described as follows:\r\n\r\n...\r\n.X.\r\n...\r\nYour starting position so you start in the top left corner. The ending position is . The path is . It takes moves to get to the goal.\r\n\r\nFunction Description\r\nComplete the minimumMoves function in the editor. It must print an integer denoting the minimum moves required to get from the starting position to the goal.\r\n\r\nminimumMoves has the following parameter(s):\r\n\r\ngrid: an array of strings representing the rows of the grid\r\nstartX: an integer\r\nstartY: an integer\r\ngoalX: an integer\r\ngoalY: an integer\r\nInput Format\r\n\r\nThe first line contains an integer , the size of the array grid.\r\nEach of the next lines contains a string of length .\r\nThe last line contains four space-separated integers, \r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint an integer denoting the minimum number of steps required to move the castle to the goal position.\r\n\r\nSample Input\r\n\r\n3\r\n.X.\r\n.X.\r\n...\r\n0 0 0 2', 'Sample Output\r\n\r\n3', '2020-09-16'),
(50, 'Data Structures', 'Mr. X and His Shots', 'Hard', 'A cricket match is going to be held. The field is represented by a 1D plane. A cricketer, Mr. X has favorite shots. Each shot has a particular range. The range of the shot is from i to i. That means his favorite shot can be anywhere in this range. Each player on the opposite team can field only in a particular range. Player can field from i to i. You are given the favorite shots of Mr. X and the range of players.\r\n\r\n represents the strength of each player i.e. the number of shots player can stop.\r\nYour task is to find:\r\n\r\n.\r\n\r\nGame Rules: A player can stop the shot if the range overlaps with the player\'s fielding range.\r\n\r\nFor more clarity about overlapping, study the following figure:\r\n\r\nL.png\r\n\r\nInput Format\r\n\r\nThe first line consists of two space separated integers, and .\r\nEach of the next lines contains two space separated integers. The line contains and .\r\nEach of the next lines contains two integers. The line contains integers and .\r\n\r\nOutput Format\r\n\r\nYou need to print the sum of the strengths of all the players: .\r\n\r\nConstraints:\r\n\r\n\r\n\r\nSample Input\r\n\r\n4 4 \r\n1 2 \r\n2 3\r\n4 5\r\n6 7\r\n1 5\r\n2 3\r\n4 7\r\n5 7 ', 'Sample Output\r\n\r\n9', '2020-09-16'),
(51, 'cplusplus', 'Say \"Hello, World!\" With C++\r\n\r\n', 'Easy', 'Objective\r\nThis is a simple challenge to help you practice printing to stdout. You may also want to complete Solve Me First in C++ before attempting this challenge.\r\n\r\nWe\'re starting out by printing the most famous computing phrase of all time! In the editor below, use either printf or cout to print the string to stdout.\r\n\r\nInput Format\r\n\r\nYou do not need to read any input in this challenge.\r\n\r\nOutput Format\r\n\r\nPrint to stdout.', 'Sample Output\r\n\r\nHello, World!', '2020-09-17'),
(52, 'cplusplus', 'Input and Output', 'Easy', 'Objective\r\nIn this challenge, we\'re practicing reading input from stdin and printing output to stdout.\r\n\r\nIn C++, you can read a single whitespace-separated token of input using cin, and print output to stdout using cout. For example, let\'s say we declare the following variables:\r\n\r\nstring s;\r\nint n;\r\nand we want to use cin to read the input \"High 5\" from stdin. We can do this with the following code:\r\n\r\ncin >> s >> n;\r\nThe above code reads the first word (\"High\") from stdin and saves it as string , then reads the second word (\"\") from stdin and saves it as integer . If we want to print these values to stdout, we write the following code:\r\n\r\ncout << s << \" \" << n << endl;\r\nThe above code prints the contents of string , which is the word \"High\". Then it prints a single space (), followed by the contents of integer . Because we also want to ensure that nothing else is printed on this line, we end our line of output with a newline via endl. This results in the following output:\r\n\r\nHigh 5\r\nTask\r\nRead numbers from stdin and print their sum to stdout.\r\n\r\nNote: If you plan on completing this challenge in C instead of C++, you\'ll need to use format specifiers with printf and scanf.\r\n\r\nInput Format\r\n\r\nA single line containing space-separated integers: , , and .\r\n\r\nConstraints\r\n\r\nOutput Format\r\n\r\nPrint the sum of the three numbers on a single line.', 'Sample Input\r\n\r\n1 2 7\r\nSample Output\r\n\r\n10', '2020-09-17'),
(53, 'cplusplus', 'Basic Data Types', 'Easy', 'Some C++ data types, their format specifiers, and their most common bit widths are as follows:\r\n\r\nInt (\"%d\"): 32 Bit integer\r\nLong (\"%ld\"): 64 bit integer\r\nChar (\"%c\"): Character type\r\nFloat (\"%f\"): 32 bit real value\r\nDouble (\"%lf\"): 64 bit real value\r\nReading\r\nTo read a data type, use the following syntax:\r\n\r\nscanf(\"`format_specifier`\", &val)\r\nFor example, to read a character followed by a double:\r\n\r\nchar ch;\r\ndouble d;\r\nscanf(\"%c %lf\", &ch, &d);\r\nFor the moment, we can ignore the spacing between format specifiers.\r\n\r\nPrinting\r\nTo print a data type, use the following syntax:\r\n\r\nprintf(\"`format_specifier`\", val)\r\nFor example, to print a character followed by a double:\r\n\r\nchar ch = \'d\';\r\ndouble d = 234.432;\r\nprintf(\"%c %lf\", ch, d);\r\nNote: You can also use cin and cout instead of scanf and printf; however, if you are taking a million numbers as input and printing a million lines, it is faster to use scanf and printf.\r\n\r\nInput Format\r\n\r\nInput consists of the following space-separated values: int, long, char, float, and double, respectively.\r\n\r\nOutput Format\r\n\r\nPrint each element on a new line in the same order it was received as input. Note that the floating point value should be correct up to 3 decimal places and the double to 9 decimal places.\r\n\r\nSample Input\r\n\r\n3 12345678912345 a 334.23 14049.30493', 'Sample Output\r\n\r\n3\r\n12345678912345\r\na\r\n334.230\r\n14049.304930000', '2020-09-17'),
(54, 'cplusplus', 'Variable Sized Arrays', 'Medium', 'Consider an -element array, , where each index in the array contains a reference to an array of integers (where the value of varies from array to array). See the Explanation section below for a diagram.\r\n\r\nGiven , you must answer queries. Each query is in the format i j, where denotes an index in array and denotes an index in the array located at . For each query, find and print the value of element in the array at location on a new line.\r\n\r\nClick here to know more about how to create variable sized arrays in C++.\r\n\r\nInput Format\r\n\r\nThe first line contains two space-separated integers denoting the respective values of (the number of variable-length arrays) and (the number of queries).\r\nEach line of the subsequent lines contains a space-separated sequence in the format k a[i]0 a[i]1 … a[i]k-1 describing the -element array located at .\r\nEach of the subsequent lines contains two space-separated integers describing the respective values of (an index in array ) and (an index in the array referenced by ) for a query.\r\n\r\nConstraints\r\n\r\nAll indices in this challenge are zero-based.\r\nAll the given numbers are non negative and are not greater than \r\nOutput Format\r\n\r\nFor each pair of and values (i.e., for each query), print a single integer denoting the element located at index of the array referenced by . There should be a total of lines of output.\r\n\r\nSample Input\r\n\r\n2 2\r\n3 1 5 4\r\n5 1 2 8 9 3\r\n0 1\r\n1 3', 'Sample Output\r\n\r\n5\r\n9', '2020-09-17'),
(55, 'cplusplus', 'Attribute Parser\r\n\r\n', 'Medium', 'We have defined our own markup language HRML. In HRML, each element consists of a starting and ending tag, and there are attributes associated with each tag. Only starting tags can have attributes. We can call an attribute by referencing the tag, followed by a tilde, \'~\' and the name of the attribute. The tags may also be nested.\r\n\r\nThe opening tags follow the format:\r\n\r\n<tag-name attribute1-name = \"value1\" attribute2-name = \"value2\" ...>\r\n\r\nThe closing tags follow the format:\r\n\r\n</tag-name>\r\n\r\nFor example:\r\n\r\n<tag1 value = \"HelloWorld\">\r\n<tag2 name = \"Name1\">\r\n</tag2>\r\n</tag1>\r\nThe attributes are referenced as:\r\n\r\ntag1~value \r\ntag1.tag2~name\r\nYou are given the source code in HRML format consisting of lines. You have to answer queries. Each query asks you to print the value of the attribute specified. Print \"Not Found!\" if there isn\'t any such attribute.\r\n\r\nInput Format\r\n\r\nThe first line consists of two space separated integers, and . specifies the number of lines in the HRML source program. specifies the number of queries.\r\n\r\nThe following lines consist of either an opening tag with zero or more attributes or a closing tag.There is a space after the tag-name, attribute-name, \'=\' and value.There is no space after the last value. If there are no attributes there is no space after tag name.\r\n\r\n queries follow. Each query consists of string that references an attribute in the source program.More formally, each query is of the form ~ where and are valid tags in the input.\r\n\r\nConstraints\r\n\r\nEach line in the source program contains, at max, characters.\r\nEvery reference to the attributes in the queries contains at max characters.\r\nAll tag names are unique and the HRML source program is logically correct.\r\nA tag can have no attributes as well.\r\nOutput Format\r\n\r\nPrint the value of the attribute for each query. Print \"Not Found!\" without quotes if there is no such attribute in the source program.\r\n\r\nSample Input\r\n\r\n4 3\r\n<tag1 value = \"HelloWorld\">\r\n<tag2 name = \"Name1\">\r\n</tag2>\r\n</tag1>\r\ntag1.tag2~name\r\ntag1~name\r\ntag1~value', 'Sample Output\r\n\r\nName1\r\nNot Found!\r\nHelloWorld', '2020-09-17'),
(56, 'cplusplus', 'StringStream\r\n\r\n', 'Medium', 'stringstream is a stream class to operate on strings. It basically implements input/output operations on memory (string) based streams. stringstream can be helpful in different type of parsing. The following operators/functions are commonly used here\r\n\r\nOperator >> Extracts formatted data.\r\nOperator << Inserts formatted data.\r\nMethod str() Gets the contents of underlying string device object.\r\nMethod str(string) Sets the contents of underlying string device object.\r\nIts header file is sstream.\r\n\r\nOne common use of this class is to parse comma-separated integers from a string (e.g., \"23,4,56\").\r\n\r\nstringstream ss(\"23,4,56\");\r\nchar ch;\r\nint a, b, c;\r\nss >> a >> ch >> b >> ch >> c; // a = 23, b = 4, c = 56\r\nYou have to complete the function vector parseInts(string str). str will be a string consisting of comma-separated integers, and you have to return a vector of int representing the integers.\r\n\r\nNote If you want to know how to push elements in a vector, solve the first problem in the STL chapter.\r\n\r\nInput Format\r\n\r\nThe first and only line consists of n integers separated by commas.\r\n\r\nOutput Format\r\n\r\nPrint the integers after parsing it.\r\n\r\nP.S.: I/O will be automatically handled. You need to complete the function only.\r\n\r\nSample Input\r\n\r\n23,4,56', 'Sample Output\r\n\r\n23\r\n4\r\n56', '2020-09-17'),
(57, 'cplusplus', 'Pointer', 'Medium', 'A pointer in C is a way to share a memory address among different contexts (primarily functions). They are primarily used whenever a function needs to modify the content of a variable, of which it doesn\'t have ownership.\r\n\r\nIn order to access the memory address of a variable, , we need to prepend it with sign. E.g., &val returns the memory address of .\r\n\r\nThis memory address is assigned to a pointer and can be shared among various functions. E.g. will assign the memory address of to pointer . To access the content of the memory to which the pointer points, prepend it with a *. For example, *p will return the value reflected by and any modification to it will be reflected at the source ().\r\n\r\nvoid increment(int *v) {\r\n (*v)++;\r\n}\r\n\r\nint main() {\r\n int a;\r\n scanf(\"%d\", &a);\r\n increment(&a);\r\n printf(\"%d\", a);\r\n return 0;\r\n} \r\nYou have to complete the function void update(int *a,int *b), which reads two integers as argument, and sets with the sum of them, and with the absolute difference of them.\r\n\r\nInput Format\r\n\r\nInput will contain two integers, and , separated by a newline.\r\n\r\nOutput Format\r\n\r\nYou have to print the updated value of and , on two different lines.\r\n\r\n\r\nP.S.: Input/ouput will be automatically handled. You only have to complete the void update(int *a,int *b) function.\r\n\r\nSample Input\r\n\r\n4\r\n5', 'Sample Output\r\n\r\n9\r\n1', '2020-09-17'),
(58, 'cplusplus', 'Inherited Code', 'Medium', 'You inherited a piece of code that performs username validation for your company\'s website. The existing function works reasonably well, but it throws an exception when the username is too short. Upon review, you realize that nobody ever defined the exception.\r\n\r\nThe inherited code is provided for you in the locked section of your editor. Complete the code so that, when an exception is thrown, it prints Too short: n (where is the length of the given username).\r\n\r\nInput Format\r\n\r\nThe first line contains an integer, , the number of test cases.\r\nEach of the subsequent lines describes a test case as a single username string, .\r\n\r\nConstraints\r\n\r\nThe username consists only of uppercase and lowercase letters.\r\nOutput Format\r\n\r\nYou are not responsible for directly printing anything to stdout. If your code is correct, the locked stub code in your editor will print either Valid (if the username is valid), Invalid (if the username is invalid), or Too short: n (where is the length of the too-short username) on a new line for each test case.\r\n\r\nSample Input\r\n\r\n3\r\nPeter\r\nMe\r\nArxwwz', 'Sample Output\r\n\r\nValid\r\nToo short: 2\r\nInvalid', '2020-09-17'),
(59, 'cplusplus', 'Print Pretty\r\n\r\n', 'Hard', 'Your manager gave you a text file with many lines of numbers to format and print. For each row of space-separated doubles, format and print the numbers using the specifications in the Output Format section below.\r\n\r\nInput Format\r\n\r\nThe first line contains an integer, , the number of test cases.\r\nEach of the subsequent lines describes a test case as space-separated floating-point numbers: , , and , respectively.\r\n\r\nConstraints\r\n\r\nEach number will fit into a double.\r\nOutput Format\r\n\r\nFor each test case, print lines containing the formatted , , and , respectively. Each , , and must be formatted as follows:\r\n\r\n: Strip its decimal (i.e., truncate it) and print its hexadecimal representation (including the prefix) in lower case letters.\r\n: Print it to a scale of decimal places, preceded by a or sign (indicating if it\'s positive or negative), right justified, and left-padded with underscores so that the printed result is exactly characters wide.\r\n: Print it to a scale of exactly nine decimal places, expressed in scientific notation using upper case.\r\nSample Input\r\n\r\n1 \r\n100.345 2006.008 2331.41592653498', 'Sample Output\r\n\r\n0x64 \r\n_______+2006.01 \r\n2.331415927E+03', '2020-09-17'),
(60, 'cplusplus', 'Deque-STL', 'Hard', 'Double ended queue or Deque(part of C++ STL) are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back). The member functions of deque that are mainly used are:\r\n\r\nDeque Template:\r\n\r\nstd::deque<value_type>\r\nDeclaration:\r\n\r\ndeque<int> mydeque; //Creates a double ended queue of deque of int type\r\nSize\r\n\r\nint length = mydeque.size(); //Gives the size of the deque\r\nPush\r\n\r\nmydeque.push_back(1); //Pushes element at the end\r\nmydeque.push_front(2); //Pushes element at the beginning\r\nPop\r\n\r\nmydeque.pop_back(); //Pops element from the end\r\nmydeque.pop_front(); //Pops element from the beginning\r\nEmpty\r\n\r\nmydeque.empty() //Returns a boolean value which tells whether the deque is empty or not\r\nTo know more about deque, click here\r\n\r\nGiven a set of arrays of size and an integer , you have to find the maximum integer for each and every contiguous subarray of size for each of the given arrays.\r\n\r\nInput Format\r\n\r\nFirst line of input will contain the number of test cases T. For each test case, you will be given the size of array N and the size of subarray to be used K. This will be followed by the elements of the array Ai.\r\n\r\nConstraints\r\n\r\n\r\n\r\n , where is the element in the array .\r\n\r\n', 'Sample Output\r\n\r\n4 6 6 4\r\n8 8 8 10', '2020-09-17'),
(61, 'SQL', 'Higher Than 75 Marks', 'Easy', 'Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.\r\n\r\nInput Format\r\n\r\nThe STUDENTS table is described as follows: The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.', 'Sample Output\r\n\r\nAshley\r\nJulia\r\nBelvet', '2020-09-17'),
(62, 'SQL', 'Employee Salaries', 'Easy', 'Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than per month who have been employees for less than months. Sort your result by ascending employee_id.\r\n\r\nInput Format\r\n\r\nThe Employee table containing employee data for a company is described as follows:\r\n\r\n\r\n\r\nwhere employee_id is an employee\'s ID number, name is their name, months is the total number of months they\'ve been working for the company, and salary is the their monthly salary.\r\n\r\nSample Input\r\n\r\n', 'Sample Output\r\n\r\nAngela\r\nMichael\r\nTodd\r\nJoe', '2020-09-17'),
(63, 'SQL', '15 Days of Learning SQL', 'Easy', 'Julia conducted a days of learning SQL contest. The start date of the contest was March 01, 2016 and the end date was March 15, 2016.\r\n\r\nWrite a query to print total number of unique hackers who made at least submission each day (starting on the first day of the contest), and find the hacker_id and name of the hacker who made maximum number of submissions each day. If more than one such hacker has a maximum number of submissions, print the lowest hacker_id. The query should print this information for each day of the contest, sorted by the date.\r\n\r\nInput Format\r\n\r\nThe following tables hold contest data:\r\n\r\nHackers: The hacker_id is the id of the hacker, and name is the name of the hacker.\r\n\r\nSubmissions: The submission_date is the date of the submission, submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, and score is the score of the submission. \r\n\r\nSample Input\r\n\r\nFor the following sample input, assume that the end date of the contest was March 06, 2016.\r\n\r\nHackers Table: Submissions Table: \r\n\r\n', 'Sample Output\r\n\r\n2016-03-01 4 20703 Angela\r\n2016-03-02 2 79722 Michael\r\n2016-03-03 2 20703 Angela\r\n2016-03-04 2 20703 Angela\r\n2016-03-05 1 36396 Frank\r\n2016-03-06 1 20703 Angela', '2020-09-17'),
(64, 'SQL', 'The PADS', 'Medium', 'Generate the following two result sets:\r\n\r\nQuery an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example: AnActorName(A), ADoctorName(D), AProfessorName(P), and ASingerName(S).\r\nQuery the number of ocurrences of each occupation in OCCUPATIONS. Sort the occurrences in ascending order, and output them in the following format:\r\n\r\nThere are a total of [occupation_count] [occupation]s.\r\nwhere [occupation_count] is the number of occurrences of an occupation in OCCUPATIONS and [occupation] is the lowercase occupation name. If more than one Occupation has the same [occupation_count], they should be ordered alphabetically.\r\n\r\nNote: There will be at least two entries in the table for each type of occupation.\r\n\r\nInput Format\r\n\r\nThe OCCUPATIONS table is described as follows: Occupation will only contain one of the following values: Doctor, Professor, Singer or Actor.\r\n\r\nSample Input\r\n\r\nAn OCCUPATIONS table that contains the following records:\r\n\r\n', 'Sample Output\r\n\r\nAshely(P)\r\nChristeen(P)\r\nJane(A)\r\nJenny(D)\r\nJulia(A)\r\nKetty(P)\r\nMaria(A)\r\nMeera(S)\r\nPriya(S)\r\nSamantha(D)\r\nThere are a total of 2 doctors.\r\nThere are a total of 2 singers.\r\nThere are a total of 3 actors.\r\nThere are a total of 3 professors.', '2020-09-17'),
(65, 'SQL', 'Occupations', 'Medium', 'Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, Singer, and Actor, respectively.\r\n\r\nNote: Print NULL when there are no more names corresponding to an occupation.\r\n\r\nInput Format\r\n\r\nThe OCCUPATIONS table is described as follows:\r\n\r\n\r\n\r\nOccupation will only contain one of the following values: Doctor, Professor, Singer or Actor.\r\n\r\nSample Input\r\n\r\n', 'Sample Output\r\n\r\nJenny Ashley Meera Jane\r\nSamantha Christeen Priya Julia\r\nNULL Ketty NULL Maria', '2020-09-17'),
(66, 'SQL', 'New Companies', 'Medium', 'Amber\'s conglomerate corporation just acquired some new companies. Each of the companies follows this hierarchy: \r\n\r\nGiven the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code.\r\n\r\nNote:\r\n\r\nThe tables may contain duplicate records.\r\nThe company_code is string, so the sorting should not be numeric. For example, if the company_codes are C_1, C_2, and C_10, then the ascending company_codes will be C_1, C_10, and C_2.\r\nInput Format\r\n\r\nThe following tables contain company data:\r\n\r\nCompany: The company_code is the code of the company and founder is the founder of the company. \r\n\r\nLead_Manager: The lead_manager_code is the code of the lead manager, and the company_code is the code of the working company. \r\n\r\nSenior_Manager: The senior_manager_code is the code of the senior manager, the lead_manager_code is the code of its lead manager, and the company_code is the code of the working company. \r\n\r\nManager: The manager_code is the code of the manager, the senior_manager_code is the code of its senior manager, the lead_manager_code is the code of its lead manager, and the company_code is the code of the working company. \r\n\r\nEmployee: The employee_code is the code of the employee, the manager_code is the code of its manager, the senior_manager_code is the code of its senior manager, the lead_manager_code is the code of its lead manager, and the company_code is the code of the working company. \r\n\r\nSample Input\r\n\r\nCompany Table: Lead_Manager Table: Senior_Manager Table: Manager Table: Employee Table: ', 'Sample Output\r\n\r\nC1 Monika 1 2 1 2\r\nC2 Samantha 1 1 2 2', '2020-09-17'),
(67, 'SQL', 'Ollivander\'s Inventory', 'Medium', 'Harry Potter and his friends are at Ollivander\'s with Ron, finally replacing Charlie\'s old broken wand.\r\n\r\nHermione decides the best way to choose is by determining the minimum number of gold galleons needed to buy each non-evil wand of high power and age. Write a query to print the id, age, coins_needed, and power of the wands that Ron\'s interested in, sorted in order of descending power. If more than one wand has same power, sort the result in order of descending age.\r\n\r\nInput Format\r\n\r\nThe following tables contain data on the wands in Ollivander\'s inventory:\r\n\r\nWands: The id is the id of the wand, code is the code of the wand, coins_needed is the total number of gold galleons needed to buy the wand, and power denotes the quality of the wand (the higher the power, the better the wand is). \r\n\r\nWands_Property: The code is the code of the wand, age is the age of the wand, and is_evil denotes whether the wand is good for the dark arts. If the value of is_evil is 0, it means that the wand is not evil. The mapping between code and age is one-one, meaning that if there are two pairs, and , then and .\r\n\r\nSample Input\r\n\r\nWands Table: Wands_Property Table: ', 'Sample Output\r\n\r\n9 45 1647 10\r\n12 17 9897 10\r\n1 20 3688 8\r\n15 40 6018 7\r\n19 20 7651 6\r\n11 40 7587 5\r\n10 20 504 5\r\n18 40 3312 3\r\n20 17 5689 3\r\n5 45 6020 2\r\n14 40 5408 1', '2020-09-17'),
(68, 'SQL', 'The Report\r\n\r\n', 'Hard', 'You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks.\r\n\r\n\r\n\r\nGrades contains the following data:\r\n\r\n\r\n\r\nKetty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn\'t want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there is more than one student with the same grade (8-10) assigned to them, order those particular students by their name alphabetically. Finally, if the grade is lower than 8, use \"NULL\" as their name and list them by their grades in descending order. If there is more than one student with the same grade (1-7) assigned to them, order those particular students by their marks in ascending order.\r\n\r\nWrite a query to help Eve.\r\n\r\nSample Input\r\n\r\n', 'Sample Output\r\n\r\nMaria 10 99\r\nJane 9 81\r\nJulia 9 88 \r\nScarlet 8 78\r\nNULL 7 63\r\nNULL 7 68', '2020-09-17'),
(69, 'SQL', 'Symmetric Pairs', 'Hard', 'You are given a table, Functions, containing two columns: X and Y.\r\n\r\n\r\n\r\nTwo pairs (X1, Y1) and (X2, Y2) are said to be symmetric pairs if X1 = Y2 and X2 = Y1.\r\n\r\nWrite a query to output all such symmetric pairs in ascending order by the value of X. List the rows such that X1 ? Y1.\r\n\r\nSample Input\r\n\r\n', 'Sample Output\r\n\r\n20 20\r\n20 21\r\n22 23', '2020-09-17'),
(70, 'SQL', 'Print Prime Numbers', 'Hard', 'Write a query to print all prime numbers less than or equal to . Print your result on a single line, and use the ampersand () character as your separator (instead of a space).\r\n\r\nFor example, the output for all prime numbers would be:', '2&3&5&7', '2020-09-17'),
(71, 'Linux', 'Looping with Numbers', 'Easy', 'Use a for loop to display the natural numbers from to .\r\n\r\nInput Format\r\n\r\nThere is no input', 'Output Format\r\n\r\n1\r\n2\r\n3\r\n4\r\n5\r\n.\r\n.\r\n.\r\n.\r\n.\r\n50', '2020-09-17'),
(72, 'Linux', 'The World of Numbers', 'Easy', 'Given two integers, and , find their sum, difference, product, and quotient.\r\n\r\nInput Format\r\n\r\nTwo lines containing one integer each ( and , respectively).\r\n\r\nConstraints\r\n\r\n\r\n\r\nOutput Format\r\n\r\nFour lines containing the sum (), difference (), product (), and quotient (), respectively.\r\n(While computing the quotient, print only the integer part.)\r\n\r\nSample Input\r\n\r\n5\r\n2', 'Sample Output\r\n\r\n7\r\n3\r\n10\r\n2', '2020-09-17'),
(73, 'Linux', 'Comparing Numbers', 'Easy', 'Given two integers, and , identify whether or or .\r\n\r\nExactly one of the following lines:\r\n- X is less than Y\r\n- X is greater than Y\r\n- X is equal to Y\r\n\r\nInput Format\r\n\r\nTwo lines containing one integer each ( and , respectively).\r\n\r\nConstraints\r\n\r\n-\r\n\r\nOutput Format\r\n\r\nExactly one of the following lines:\r\n- X is less than Y\r\n- X is greater than Y\r\n- X is equal to Y', 'Sample Input 1\r\n\r\n5 \r\n2 \r\nSample Input 2\r\n\r\n2\r\n2 \r\nSample Input 3\r\n\r\n2\r\n3 ', '2020-09-17'),
(74, 'Linux', 'Getting started with conditionals', 'Medium', 'Read in one character from STDIN.\r\nIf the character is \'Y\' or \'y\' display \"YES\".\r\nIf the character is \'N\' or \'n\' display \"NO\".\r\nNo other character will be provided as input.\r\n\r\nInput Format\r\n\r\nOne character\r\n\r\nConstraints\r\n\r\nThe character will be from the set .\r\n\r\nOutput Format\r\n\r\necho YES or NO to STDOUT.', 'Sample Input\r\n\r\ny \r\nSample Output\r\n\r\nYES', '2020-09-17'),
(75, 'Linux', 'More on Conditionals', 'Medium', 'Given three integers (, , and ) representing the three sides of a triangle, identify whether the triangle is scalene, isosceles, or equilateral.\r\n\r\nIf all three sides are equal, output EQUILATERAL.\r\nOtherwise, if any two sides are equal, output ISOSCELES.\r\nOtherwise, output SCALENE.\r\nInput Format\r\n\r\nThree integers, each on a new line.\r\n\r\nConstraints\r\n\r\n\r\nThe sum of any two sides will be greater than the third.\r\n\r\nOutput Format\r\n\r\nOne word: either \"SCALENE\" or \"EQUILATERAL\" or \"ISOSCELES\" (quotation marks excluded).', 'Sample Output 1\r\n\r\nSCALENE', '2020-09-17'),
(76, 'Linux', 'Arithmetic Operations', 'Medium', 'A mathematical expression containing +,-,*,^, / and parenthesis will be provided. Read in the expression, then evaluate it. Display the result rounded to decimal places.\r\n\r\nConstraints\r\n\r\nAll numeric values are <= 999.\r\n\r\nSample Input\r\n\r\nSample Input 1\r\n\r\n5+50*3/20 + (19*2)/7\r\nSample Input 2\r\n\r\n-105+50*3/20 + (19^2)/7\r\nSample Input 3\r\n\r\n(-105.5*7+50*3)/20 + (19^2)/7', 'Sample Output\r\n\r\nSample Output 1\r\n\r\n17.929\r\nSample Output 2\r\n\r\n-45.929', '2020-09-17');
INSERT INTO `question` (`q_id`, `q_language`, `q_info`, `q_info_type`, `q_statement`, `q_state_code`, `q_date`) VALUES
(77, 'Linux', 'Cut #8', 'Medium', 'Given a sentence, identify and display its first three words. Assume that the space (\' \') is the only delimiter between words.\r\n\r\nInput Format\r\n\r\nA text file with lines of ASCII text only. Each line has exactly one sentence.\r\n\r\nConstraints\r\n\r\n\r\n(N is the number of lines of text in the input file)\r\n\r\nOutput Format\r\n\r\nThe output should contain N lines. For each input sentence, identify and display its first three words. Assume that the space (\' \') is the only delimiter between words.\r\n\r\nSample Input\r\n\r\nNew York is a state in the Northeastern and Mid-Atlantic regions of the United States. \r\nNew York is the 27th-most extensive, the third-most populous populated of the 50 United States. \r\nNew York is bordered by New Jersey and Pennsylvania to the south.\r\nAbout one third of all the battles of the Revolutionary War took place in New York.\r\nHenry Hudson\'s 1609 voyage marked the beginning of European involvement with the area.', 'Sample Output\r\n\r\nNew York is\r\nNew York is\r\nNew York is\r\nAbout one third\r\nHenry Hudson\'s 1609', '2020-09-17'),
(78, 'Linux', 'Middle of a Text File', 'Hard', 'Display the lines (from line number 12 to 22, both inclusive) of a given text file.\r\n\r\nInput Format\r\n\r\nA text file\r\n\r\nOutput Format\r\n\r\nDisplay the lines (from line number 12 to 22, both inclusive) for the input file.\r\n\r\nSample Input\r\n\r\nFrom fairest creatures we desire increase,\r\nThat thereby beauty\'s rose might never die,\r\nBut as the riper should by time decease,\r\nHis tender heir might bear his memory:\r\nBut thou contracted to thine own bright eyes,\r\nFeed\'st thy light\'s flame with self-substantial fuel,\r\nMaking a famine where abundance lies,\r\nThy self thy foe, to thy sweet self too cruel:\r\nThou that art now the world\'s fresh ornament,\r\nAnd only herald to the gaudy spring,\r\nWithin thine own bud buriest thy content,\r\nAnd tender churl mak\'st waste in niggarding:\r\nPity the world, or else this glutton be,\r\nTo eat the world\'s due, by the grave and thee.\r\nWhen forty winters shall besiege thy brow,\r\nAnd dig deep trenches in thy beauty\'s field,\r\nThy youth\'s proud livery so gazed on now,\r\nWill be a tattered weed of small worth held:\r\nThen being asked, where all thy beauty lies,\r\nWhere all the treasure of thy lusty days;\r\nTo say within thine own deep sunken eyes,\r\nWere an all-eating shame, and thriftless praise.\r\nHow much more praise deserved thy beauty\'s use,\r\nIf thou couldst answer \'This fair child of mine\r\nShall sum my count, and make my old excuse\'', 'Sample Output\r\n\r\nAnd tender churl mak\'st waste in niggarding:\r\nPity the world, or else this glutton be,\r\nTo eat the world\'s due, by the grave and thee.\r\nWhen forty winters shall besiege thy brow,\r\nAnd dig deep trenches in thy beauty\'s field,\r\nThy youth\'s proud livery so gazed on now,\r\nWill be a tattered weed of small worth held:\r\nThen being asked, where all thy beauty lies,\r\nWhere all the treasure of thy lusty days;\r\nTo say within thine own deep sunken eyes,\r\nWere an all-eating shame, and thriftless praise.', '2020-09-17'),
(79, 'Linux', 'Sort Command #1', 'Hard', 'In this challenge, we practice using the sort command to sort input in text or TSV formats.\r\n\r\nGiven a text file, order the lines in lexicographical order.\r\n\r\nInput Format\r\n\r\nA text file.\r\n\r\nOutput Format\r\n\r\nOutput the text file with the lines reordered in lexicographical order.\r\n\r\nSample Input\r\n\r\nDr. Rajendra Prasad January 26, 1950 May 13, 1962\r\nDr. S. Radhakrishnan May 13, 1962 May 13, 1967\r\nDr. Zakir Hussain May 13, 1967 August 24, 1969\r\nShri Varahagiri Venkata Giri August 24, 1969 August 24, 1974\r\nShri Fakhruddin Ali Ahmed August 24, 1974 February 11, 1977\r\nShri Neelam Sanjiva Reddy July 25, 1977 July 25, 198', 'Sample Output\r\n\r\nDr. Rajendra Prasad January 26, 1950 May 13, 1962\r\nDr. S. Radhakrishnan May 13, 1962 May 13, 1967\r\nDr. Zakir Hussain May 13, 1967 August 24, 1969\r\nShri Fakhruddin Ali Ahmed August 24, 1974 February 11, 1977\r\nShri Neelam Sanjiva Reddy July 25, 1977 July 25, 198\r\nShri Varahagiri Venkata Giri August 24, 1969 August 24, 1974', '2020-09-17'),
(80, 'Linux', 'A Personalized Echo', 'Hard', 'Write a Bash script which accepts as input and displays a greeting: \"Welcome (name)\"\r\n\r\nInput Format\r\n\r\nOne line, containing a .\r\n\r\nOutput Format\r\n\r\nOne line: \"Welcome (name)\" (quotation marks excluded).\r\nThe evaluation will be case-sensitive.\r\n\r\nSample Input 0\r\n\r\nDan ', 'Sample Output 0\r\n\r\nWelcome Dan ', '2020-09-17'),
(81, 'Artificial Intelligence', 'Battleship 1 Player ', 'Easy', 'Battleship is a popular 2 player game that takes place on a 10 x 10 board. Ships of various sizes are placed on the 10 x 10 board either horizontally or vertically. The position of the ships are hidden to the user. Your task is to sink all the ships.\r\n\r\nShips of the following size are given to each player.\r\n\r\nSubmarine (1 x 1) - 2 units\r\nDestroyer (2 x 1) - 2 units\r\nCruiser (3 x 1) - 1 unit\r\nBattleship(4 x 1) - 1 unit\r\nCarrier (5 x 1) - 1 unit\r\nIn this version of the game, you will be playing solo. A testcase has a configuration of ship positions and your task is to destroy all the ships using the minimum number of moves.\r\n\r\nInput Format\r\n\r\nThe first line contains N that denotes the size of the board. N lines follow, each containing 10 characters.\r\nIf a cell is hit, it is denoted by character h (ascii value: 104).\r\nIf a cell is a miss it is denoted by character m (ascii value: 109).\r\nIf all the positions of a ship are destroyed, each of its position on the board is denoted by character d (ascii value: 100).\r\nIf a cell is not attacked by the player, it is denoted by character - (ascii value: 45).\r\n\r\nThe board is indexed according to Matrix Convention.\r\n\r\nConstraints\r\n\r\nN = 10\r\n\r\nNote\r\nBattleships can be touching each other.\r\n\r\nOutput Format\r\n\r\nOutput the cell to be hit in your current move. The output consists of two space separated integers R and C.\r\n\r\nSample Input\r\n\r\n10\r\n----------\r\n----------\r\n--------m-\r\n----------\r\n--d-----m-\r\n---m-m----\r\n------m---\r\n-m---mm-h-\r\n--m-------\r\n------m---', 'Sample Output\r\n\r\n7 9', '2020-09-17'),
(82, 'Artificial Intelligence', ' Click-o-Mania', 'Easy', 'Clickomania is a 1-player game consisting of a rectangular grid of square blocks, each colored in one of k colors. Adjacent blocks horizontally and vertically of the same color are considered to be a part of the same group. A move selects a group containing at least two blocks and removes those blocks, followed by two \"falling\" rules;\r\n\r\nAny blocks remaining above the holes created, fall down through the same column.\r\nAny empty columns are removed by sliding the succeeding columns left.\r\nSample illustration\r\n\r\nClickoMania\r\n\r\nIn this game, you have to code a bot such that it eliminates as many possible blocks from the grid. The top left of the grid is indexed (0,0) and the bottom right of the grid is indexed (rows-1,columns-1).\r\n\r\nInput Format\r\nThe first line of the input is 3 space separated integers, x y k where x and y are the row index and the column index of the grid respectively, and k is the number of colors the grid has.\r\n\r\nAn empty cell in the grid will be denoted by \'-\'.\r\n\r\nOutput Format\r\nOutput 2 space separated integers that represent the co-ordinates of the block you choose to remove from the grid. You can output any one of the nodes of the group which you choose to remove.\r\n\r\nConstraints\r\n1 ? k ? 7\r\nEach color can be any of \'V\',\'I\',\'B\',\'G\',\'Y\',\'O\',\'R\' (VIBGYOR)\r\n\r\nSample Input\r\n\r\n20 10 2\r\nBBRBRBRBBB\r\nRBRBRBBRRR\r\nRRRBBRBRRR\r\nRBRBRRRBBB\r\nRBRBRRRRBB\r\nRBBRBRRRRR\r\nBBRBRRBRBR\r\nBRBRBBRBBB\r\nRBBRRRRRRB\r\nBBRBRRBBRB\r\nBBBRBRRRBB\r\nBRBRRBRRBB\r\nBRRBBBBBRB\r\nRRBBRRBRRR\r\nRRRBRRRBBB\r\nRRRRRBBBRR\r\nBRRRBRRRBB\r\nBBBBRBRRRB\r\nBRBBBBBRBB\r\nRRRRRBBRRR', 'Sample Output\r\n0 1', '2020-09-17'),
(83, 'Artificial Intelligence', ' Checkers', 'Easy', 'Checkers or Draughts is a popular 2 player board game where the opponent discs are captured by jumping over them. The objective of the game is to capture as many discs of the opponent as possible or if the opponent has no valid moves left to make.\r\n\r\nThe game takes place on an 8 * 8 chess board as shown below.\r\n\r\ndraughts\r\n\r\nEach player occupies one of the 2 sides of the chess board where the pawns are placed. Black goes first.\r\n\r\nRules\r\n\r\nEach player begins with 12 colored discs.\r\nThe discs are positioned such that each player has a light square on the right side corner closest to him or her.\r\nEach player places his or her discs on the 12 dark squares closest to him or her.\r\nBlack moves first and players alternate henceforth.\r\nMoves are allowed only on the dark squares, so the discs always move diagonally. discs are always limited to forward moves ( toward the opponent ).\r\nThere are 2 kinds of moves - Capturing and Non-Capturing moves. In both types of moves, player can only move/jump to a vacant position.\r\nNon-Capturing moves may move only one square.\r\nIf more than 1 Non-Capturing moves exist, any of the moves can be played.\r\nA disc making a Capturing move leaps over one of the opponent\'s discs that is 1 square away from itself and lands in a straight diagonal line, which is 2 squares away from itself. A jump can make only 1 capture, but the same disc can capture multiple opponent discs by doing multiple jumps in a single move.\r\nA captured disc is removed from the board.\r\nIf a Capturing move exists, the jump has to be made. If more than one capture exists, a choice can be made.\r\nA player reaching the opponent\'s side of the board is crowned as a King. King\'s move is similar to that of a regular disc\'s move but restriction of forward only moves are lifted for the King\'s move. Multiple King\'s may exist.\r\nWhite discs are present at the bottom of the board and the black discs are present at the top of the board.\r\nBlack discs are represented by character \'b\' (ascii value 98) and white discs are represented by character \'w\' (ascii value 119). King\'s of respective discs are represented by \'B\' (ascii value 66) and \'W\' (ascii value 87). Empty squares are represented by character \'_\' ( ascii value 95)\r\n\r\nInput Format\r\n\r\nThe first line of the input contains the player\'s character \'b\' or \'w\' indicating the player\'s turn.\r\nThe second line contains the size of the board (L).\r\nL lines follow each containing L characters as mentioned above.', 'Sample Output: Non-Capturing\r\n\r\n1\r\n1 0\r\n2 1', '2020-09-17'),
(84, 'Artificial Intelligence', 'PacMan - BFS', 'Medium', 'In the previous game, you performed DFS on the PacMan grid. It was seen that DFS might not always give the shortest path between the source and the destination.\r\n\r\nIn this game, PacMan is positioned in a grid. PacMan has to find the food using Breadth First Search (BFS), provided the grid is completely observable, perform a BFS on the grid and then print the path obtained by BFS from the PacMan to the food.\r\n\r\nInput Format\r\n\r\nThe first line contains 2 space separated integers which is the position of the PacMan.\r\nThe second line contains 2 space separated integers which is the position of the food.\r\nThe third line of the input contains 2 space separated integers. Indicating the size of the rows and columns respectively.\r\nThis is followed by row (r) lines each containing column (c) characters. A wall is represented by the character \'%\' ( ascii value 37 ), PacMan is represented by UpperCase alphabet \'P\' ( ascii value 80 ), empty spaces which can be used by PacMan for movement is represented by the character \'-\' ( ascii value 45 ) and food is represented by the character \'.\' ( ascii value 46 )\r\n\r\nThe top left of the grid is indexed (0,0) and the bottom right of the grid is indexed (r-1,c-1)\r\n\r\nThe grid is indexed as per matrix convention\r\n\r\nPopulating Queue\r\n\r\nIn order to maintain uniformity across submissions, please follow the below mentioned order in pushing nodes to queue. If a node has all the 4 adjacent neighbors. Then,\r\n\r\nUP\r\nLEFT\r\nRIGHT\r\nDOWN\r\nUP goes first into the queue, followed by LEFT, followed by RIGHT and then by DOWN.\r\n\r\nso, if (1,1) has all its neighbors not visited, (0,1), (1,0), (1,2), (2,1) then,\r\n\r\n(0,1) - UP\r\n(1,0) - LEFT\r\n(1,2) - RIGHT\r\n(2,1) - DOWN\r\nSo, (0,1) is the first to be popped from the queue.', 'Sample Output\r\n\r\nsample output\r\n\r\nIn this example, PacMan is at the position (3,9) and the food is at the position (5,1). BFS tree is printed starting from (3,9) until the food node is expanded. The BFS path length between (3,9) and (5,1) is 32. All the nodes encountered between (3,9) and (5,1) both included is printed in the next 33 lines.', '2020-09-17'),
(85, 'Artificial Intelligence', 'Backgammon', 'Medium', 'Backgammon is a two player game played on a board consisting of 24 narrow triangles called points. The triangles alternate in color and are grouped into four quadrants of six triangles each. The quadrants are referred to as a player\'s home board and outer board, and the opponent\'s home board and outer board. The home and outer boards are separated from each other by a ridge down the center of the board called the bar.Each point is numbered as shown in the figure below\r\n\r\nAdd a figure here\r\n\r\nThe bottom right point starts with 1 and increases left-ward. The top-right point is numbered 24. Each player has fifteen checkers of his own color. The initial arrangement of checkers is:\r\n\r\nFor the 1st player, 2 on first point, 5 on twelve and ninteen point, and 3 on seventeen point.\r\nFor the 2nd player, 2 on twenty-fourth point, 5 on thirteen and sixth point, and 3 on eigth point.\r\nIn this game, there is no doubling cube and white always goes first. Two games are played with each player playing as white once.\r\n\r\nThe objective of the game is move all your checkers into your own home board and then bear them off. The first player to bear off all of their checkers wins the game.\r\n\r\nAdd the figure 2 here\r\n\r\nMovement of Checkers\r\n\r\nEach player is allowed to roll two 6 sided dice. The points on the dice indicates the total number of triangles a player can move his checkers. A checker can always be moved close to its home board and not away from it. A checker movement has the following rules.\r\n\r\nA checker can move only to an open point. An open point is defined as a point which has checkers of the same player or less than 2 checkers of the opponent.\r\nIf a player rolls a 4, 6, then he may move one checker 4 spaces to an open point and another checker 6 spaces to an open point. Or move one checker a total of 10 spaces such that the intermediate point (4th or the 6th space) is open.\r\nIf a player rolls a double ( both dices having the same number ), he gets to play the number rolled on the dice twice in whatever combination he chooses to.\r\nA player must use all the numbers rolled by the dice if its legally possible. If only 1 number is possible, that number must be played.\r\nIf no dice rolls are possible, the move is automatically skipped.\r\nHitting and Entering\r\n\r\nA point occupied by only 1 checker of either color is called a blot. If an opponent\'s coin is placed on the same point, then its called a hit and the existing checker is moved to the bar.\r\nIf a player has one or more checkers of his on the bar, his immediate objective is to enter his checkers into the opponent\'s home board (1-6) for the 1st player and (19-24) for the 2nd player.\r\nThe movement follows the same rules as regular movement of checkers. A checker can be placed on open points only.\r\nNo other moves are possible until all the checkers are removed from the bar.\r\nA player looses his turn if neither of the points are open.\r\nAfter the last checker from the bar has entered the board, unused moves can be played in a regular manner.', 'Sample Output\r\n\r\n1 5\r\n12 17', '2020-09-17'),
(86, 'Artificial Intelligence', 'Mancala ', 'Medium', 'Mancala is a family of board games played around the world, which are also called \"count-and-capture\" games. In this challenge you will code a bot to play Mancala against other bots in the hackathon.\r\n\r\nAn illustration of the mancala board is given below.\r\n\r\nimg1.jpg\r\n\r\nGame Rules\r\n\r\nThe goal is to collect more marbles (in your mancala) than your opponent does.\r\n\r\nThe Mancala \'board\' is made up of 2 rows of 6 holes each.\r\n4 marbles are placed in each of the 12 holes. The color of the marble is irrelevant.\r\nEach player has an empty \'mancala\' to the right side of the Mancala board.\r\nThe game begins with one player picking up all of the marbles in any one of the non-empty holes on his side.\r\nMoving counter-clockwise, the player deposits one of the marbles in each hole he runs into until the marbles run out.\r\nIf you run into your own mancala, deposit one marble in it. If you run into your opponent\'s mancala, skip it.\r\nIf the last marble you drop is in your own mancala, you get a free turn. If the last marble you drop is in an empty hole on your side, you empty all marbles on the hole directly opposite to your hole and put it in your hole.\r\nThe game ends when all the 6 holes on one side of the Mancala board are empty.\r\nThe Player who still has marbles on his side of the board when the game ends captures all of those marbles and places it in his mancala.\r\nCount all the marbles in each mancala. The winner is the Player with the most marbles.\r\npicture alt\r\n\r\nAs shown in illustration 2, Player B has moved the one marble from his hole B2 into the empty hole B3. He will now take that marble and the marbles in A4 and place all those marbles in B3. His turn will then end and the next player goes.\r\n\r\nInput Format\r\n\r\nThe 1st line contains the Player id 1 or 2 indicating Player A and Player B respectively.\r\nThe 2nd line contains the Mancala count for Player1.\r\nThe 3rd line contains 6 single spaced integers each indicating the number of marbles in the 1st Player\'s hole from left to right with respect to player1.\r\nThe 4th line contains the Mancala count for player2.\r\nThe 5th line contains 6 single spaced integers each indicating the number of marbles in the 2nd player\'s hole from left to right with respect to Player2.', 'Output Format\r\n\r\nEach turn, output the number (1-6) of the hole you wish to empty.\r\n\r\nSample Input/Output:\r\n\r\nInput for Player1:\r\n\r\n1\r\n0\r\n4 4 4 4 4 4\r\n0\r\n4 4 4 4 4 4\r\nPlayer1 output:\r\n\r\n5', '2020-09-17'),
(87, 'Artificial Intelligence', ' Tic tac toe', 'Hard', 'Tic-tac-toe is a pencil-and-paper game for two players, X (ascii value 88) and O (ascii value 79), who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game. Empty space is represented by _ (ascii value 95), and the X player goes first.\r\n\r\nHere is an example game won by the first player, X:\r\n\r\npicture alt\r\n\r\nThe function nextMove takes in a char player, and the 3x3 board as an array. Complete the function to print 2 space separated integers r and c which denote the row and column that will be marked in your next move. The top left position is denoted by (0,0).\r\n\r\nHow does it work?\r\nYour code is run alternately with the opponent bot for every move.\r\n\r\nExample input:\r\n\r\nX \r\n___ \r\n___ \r\n_XO ', 'Example output:\r\n\r\n1 0 ', '2020-09-17'),
(88, 'Artificial Intelligence', ' Amazons', 'Hard', 'Amazons is a 2 player abstract strategy games that takes place on a chess board of size 10x10. Each player has 4 amazons (represented as Queens of Chess) as shown in the board below.\r\n\r\namazons-board\r\n\r\nA player is either white or black with white moving first. Each move consists of 2 parts: one of the current player\'s amazon is moved from its current position to a new empty square in a straight line (orthogonally or diagonally) not crossing any non-empty square (similar to a Queen\'s movement in Chess). The second part consists of the amazon shooting an arrow from its new square to an empty square in a straight line (orthogonally or diagonally) not crossing any non-empty square. The amazon can also shoot an arrow in the direction it traveled. The last player to make a move wins.\r\n\r\nInput Format\r\n\r\nThe board is indexed \'a\' (ascii value 97) to \'j\' (ascii value 106) from left to right and \'0\' ( ascii value 48 ) to \'9\' (ascii value 57) from bottom to top as shown in the figure above. White amazons are represented by the character \'W\' (ascii value 87) and the Black amazons are represented by the character \'B\' ( ascii value 66). Empty squares are represented by \'-\' (ascii value 45) and the squares where arrows land are represented by \'.\' (ascii value 46).\r\n\r\nThe first line of the input is either \'W\' or \'B\' representing the 1st or the 2nd player. The 2nd line has 10 10 which is the row/column size of the board. 10 lines follow each line having 10 characters representing a row in the board.', 'Sample Output\r\n\r\nh1 j1 i1', '2020-09-17'),
(89, 'Artificial Intelligence', ' Bot saves princess', 'Hard', 'Princess Peach is trapped in one of the four corners of a square grid. You are in the center of the grid and can move one step at a time in any of the four directions. Can you rescue the princess?\r\n\r\nInput format\r\n\r\nThe first line contains an odd integer N (3 <= N < 100) denoting the size of the grid. This is followed by an NxN grid. Each cell is denoted by \'-\' (ascii value: 45). The bot position is denoted by \'m\' and the princess position is denoted by \'p\'.\r\n\r\nGrid is indexed using Matrix Convention\r\n\r\nOutput format\r\n\r\nPrint out the moves you will take to rescue the princess in one go. The moves must be separated by \'\\n\', a newline. The valid moves are LEFT or RIGHT or UP or DOWN.\r\n\r\nSample input\r\n\r\n3\r\n---\r\n-m-\r\np--', 'Sample output\r\n\r\nDOWN\r\nLEFT', '2020-09-17'),
(90, 'Artificial Intelligence', ' Camelot', 'Hard', 'Camelot is a strategic board game played by 2 players.\r\n\r\nThe game is played on a board of 160 squares, which is roughly rectangular (12×14), with three squares removed from each of the four corners, and four extra squares extending outside the main rectangle, two each at the top and bottom of the board. These two-square areas are called the castles. Each player starts the game with fourteen pieces: four knights and ten men, set up as shown (see diagram).\r\n\r\ncamelot board\r\n\r\nBoth knights and men can move either horizontally, vertically, or diagonally in three ways, as follows:\r\n\r\nOne space in any direction (like a king in chess). This is called a plain move.\r\nA leaping move (called cantering) over an adjacent friendly piece to a vacant space immediately beyond. Multiple leaps over a player\'s own pieces are permitted. Cantering is always optional (never obligatory).\r\nA jumping move over an adjacent enemy piece to a vacant space immediately beyond. The enemy piece is captured and removed from the board. As in checkers, multiple jumps are allowed, and capturing is obligatory whenever it is possible.\r\nMen may make any of the three moves, but only one type of move per turn. Knights have a fourth option: a combination move consisting of a canter immediately followed by a jump (capture). This is called the knight\'s charge. The knight may, in this single move, perform multiple canters (or just one), followed by multiple jumps (or just one); but the canter(s) must precede the jump(s). A knight may not combine a plain move with a canter or a jump.', 'Sample Output\r\n\r\nB4 B6 D6 F4 H4', '2020-09-17');
-- --------------------------------------------------------
--
-- Table structure for table `sign_up`
--
CREATE TABLE `sign_up` (
`user_id` int(11) NOT NULL,
`user_firstname` varchar(50) NOT NULL,
`user_lastname` varchar(50) NOT NULL,
`user_email` varchar(40) NOT NULL,
`user_password` varchar(40) NOT NULL,
`user_date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `sign_up`
--
INSERT INTO `sign_up` (`user_id`, `user_firstname`, `user_lastname`, `user_email`, `user_password`, `user_date`) VALUES
(1, '', '', '', '', '2020-09-03'),
(2, 'asasas', 'dasfa', '[email protected]', 'sasasasd', '2020-09-03'),
(3, 'sahil', 'phalle', '[email protected]', '12345678', '2020-09-03'),
(12, 'Sahil', 'Phalle', '[email protected]', '1234', '2020-09-05'),
(13, 'Sahil', 'Phalle', '[email protected]', 'sahil', '2020-09-05'),
(14, 'xyz', 'php', '[email protected]', 'Sahil@123', '2020-09-05'),
(15, 'xyz', 'php', '[email protected]', 'Sahil@123', '2020-09-05'),
(17, 'premraj', 'zambre', '[email protected]', 'Prem@123', '2020-09-06');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `answer`
--
ALTER TABLE `answer`
ADD PRIMARY KEY (`a_id`),
ADD KEY `FK_qid_in_answer` (`q_id`),
ADD KEY `FK_uid_in_answer` (`user_id`);
--
-- Indexes for table `help`
--
ALTER TABLE `help`
ADD PRIMARY KEY (`h_id`),
ADD KEY `FK_qid_in_help` (`q_id`),
ADD KEY `FK_uid_in_help` (`user_id`);
--
-- Indexes for table `question`
--
ALTER TABLE `question`
ADD PRIMARY KEY (`q_id`);
--
-- Indexes for table `sign_up`
--
ALTER TABLE `sign_up`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `answer`
--
ALTER TABLE `answer`
MODIFY `a_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `help`
--
ALTER TABLE `help`
MODIFY `h_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `question`
--
ALTER TABLE `question`
MODIFY `q_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=91;
--
-- AUTO_INCREMENT for table `sign_up`
--
ALTER TABLE `sign_up`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `answer`
--
ALTER TABLE `answer`
ADD CONSTRAINT `FK_qid_in_answer` FOREIGN KEY (`q_id`) REFERENCES `question` (`q_id`),
ADD CONSTRAINT `FK_uid_in_answer` FOREIGN KEY (`user_id`) REFERENCES `sign_up` (`user_id`);
--
-- Constraints for table `help`
--
ALTER TABLE `help`
ADD CONSTRAINT `FK_qid_in_help` FOREIGN KEY (`q_id`) REFERENCES `question` (`q_id`),
ADD CONSTRAINT `FK_uid_in_help` FOREIGN KEY (`user_id`) REFERENCES `sign_up` (`user_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;