messages
list
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "We have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Did George Mason’s contribution to American history extend beyond his philosophical writings and ideas?" }, { "role": "assistant", "content": "Yes, George Mason's contribution to American h...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Little Bob comes to you for candies as you are his favorite coder! He wants X candies. You have N bags and the i^th bag contains A[i] candies.\n\nYou can give him a set of one or more bags such that th...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the s...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Tyson can swim at a speed of 3 miles per hour in a lake and 2.5 mph in an ocean. This season, half his races happened in lakes and half his races happened in the ocean. He had ten total races, each of ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a function that takes in a dictionary and returns a new dictionary that contains only the key-value pairs where the value is less than 10.\n{\n\"a\": 1,\n\"b\": 2,\n\"c\": 11,\n\"d\": 12,\n\"e\":...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You are an AI assistant tasked with solving command-line tasks in a Linux environment. You will be given a task description and the output from previously executed commands. Your goal is to solve the t...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "problem\n\nN students from JOI High School are lined up in a row from east to west. The i-th student from the western end of the column is student i. Each student has a bib with one integer. Initially,...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Awesomeness of a string is defined by a pair of a character C and an integer F, satisfying the following conditions :\n\n C must belong to the given string S and there must be a substring subS of S h...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given the text: On Tuesday, Nov 20th, we will be retiring the Artists section on CBCMusic.ca.\nWhen we first launched the artist pages over a decade ago we did not know how much of an impact it would h...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The GCD table G of size n Γ— n for an array of positive integers a of length n is defined by formula \n\n<image>\n\nLet us remind you that the greatest common divisor (GCD) of two positive integers x an...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.\n\nAbout every day we know exam for which one of m subjects can be pass...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a Python function that accepts a string and returns the number of uppercase letters and lowercase letters.\n\"Hello, World!\"" }, { "role": "assistant", "content": "<think>\nOkay, I n...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Okay. Before we begin, a hint : This one's taken from somewhere. Word to word. Google comes to mind, doesn't it? Here goes: \nFor the heck of it, we define a new sequence as the infinite sequence of a...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "-" }, { "role": "assistant", "content": "<think>\nOkay, let's see. The problem is to find the probability that after drawing the third card from the third deck, we have three consecutive nu...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "For a given string of binary number bi. Find the two’s complement of it.\nExample 1:\nInput: bi = 00000101\nOutput: 11111011\nExplaination: 2's complement is reversing all \nthe bits of the given numbe...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a function that takes a list of integers as input and returns the index of the largest number which is at least twice as large as every other number in the list. If no such number exists, return ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "There are 18 green leaves on each of the 3 tea leaf plants. One-third of them turn yellow and fall off on each of the tea leaf plants. How many green leaves are left on the tea leaf plants? Let's writ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Dezider is making a game board for the game of Convexity. He drilled a bunch of holes in a piece of wood. As the name of the game suggests the holes were on the boundary of a convex polygon. After turn...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bob is playing a game called \"Dungeon 2\" which is the sequel to the popular \"Dungeon\" released last year. The game is played on a map consisting of $N$ rooms and $N-1$ roads connecting them. The ro...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "There are n parrots standing in a circle. Each parrot has a certain level of respect among other parrots, namely r_i. When a parrot with respect level x starts chattering, x neighbours to the right and...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can you summarize the article on Valparaiso's local market and the photos taken by Brendan? Answer according to: They say that Valparaiso, Chile is a photographer’s dream destination. It is lined with ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can you use Instagram's insights tool to analyze specific demographics of your audience, such as age, gender, and location, to determine content that is most engaging to them, and then adjust your ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Example\nInput\n\n3 9\n6 3\n5 2\n3 1\n2\n2\n2\n\n\nOutput\n\n2" }, { "role": "assistant", "content": "<think>\nOkay, let's see. I need to solve this programming problem. Let's read the inpu...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "-" }, { "role": "assistant", "content": "<think>\nOkay, let's tackle this problem. So, we need to find out which prisoner gets the last candy, which is the bad one. Hmm. Let me think about ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Sample testcase 3 has a mistake, so we erased this case and rejudged all solutions of this problem. (21:01)\n\nSnuke got a sequence $a$ of length $n$ from AtCoder company. All elements in $a$ are disti...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a python function to find the maximum value in a sliding window of size k.\n\nSolve the problem starting with the provided function header.\n\nFunction header:\n```\nclass Solution:\n\tdef find_m...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Alf and Beata were two kids who lived long ago, during the time before you could spend Halloween participating in programming competitions. As such, their lives were much more boring than the lives of ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "2. Convert the string to lowercase to make it case-insensitive." }, { "role": "assistant", "content": "To convert a string to lowercase in Python, you can use the `lower()` method. Here's a...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Greg has an array a = a1, a2, ..., an and m operations. Each operation looks as: li, ri, di, (1 ≀ li ≀ ri ≀ n). To apply operation i to the array means to increase all array elements with numbers li, l...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The diagonal of a square is 4 ?2 cm. What will be the diameter of another square if their area is double that of the first square?\nAnswer Choices: (A) 8cm (B) 9cm (C) 10cm (D) 11cm (E) 12cm" }, { ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ibis is fighting with a monster.\n\nThe health of the monster is H.\n\nIbis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.\n\...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Nastya is a competitive programmer, but she is only studying now. Recently, Denis told her about the way to check if the string is correct bracket sequence. After that, unexpectedly, Nastya came up wit...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bitoholic is an inhabitant of the planet Neo in a galaxy far far away. Their civilization is studies an advanced form of mathematics. However, rules of calculus are a bit different there. On his planet...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The magic hourglass is a mysterious artifact that divides the plane into colored regions based on its intricate pattern. The hourglass can be represented as an infinite Cartesian plane with the origin ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How does the wine from the Mendoza region in Argentina compare to other wine regions in the world?" }, { "role": "assistant", "content": "It's difficult to make a direct comparison between ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The Bandu of the Hackers' community had a very urgent job to do. He needs to diffuse all the bombs placed by Poker. Poker is extremely clever and cruel. He selected a region of 1000 X 1000 points, chos...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "This problem differs from the next problem only in constraints.\n\nPetya decided to visit Byteland during the summer holidays. It turned out that the history of this country is quite unusual.\n\nInitia...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings s1 and s2 from two different frequencies as signals. They are suspecting that these...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Problem\n\nGaccho owns a field separated by W horizontal x H vertical squares. The cell in the x-th column and the y-th row is called the cell (x, y). Only one plant with a height of 0 cm is planted on...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "AltF4 and CtrlF4 again started playing games. This time they drew a N x N matrix and filled number in each of the cells randomly. The game is played in turns (AltF4 always starts first, as his name co...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bear Limak prepares problems for a programming competition. Of course, it would be unprofessional to mention the sponsor name in the statement. Limak takes it seriously and he is going to change some w...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A parentheses string is a non-empty string consisting only of '(' and ')'. It is valid if any of the following conditions is true: You are given a parentheses string s and a string locked, both of leng...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "After rejecting 10^{100} data structure problems, Errorgorn is very angry at Anton and decided to kill him.\n\nAnton's DNA can be represented as a string a which only contains the characters \"ANTON\" ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "β€” Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me? \n\nβ€” Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night? \n\nAt this ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Artsem is on vacation and wants to buy souvenirs for his two teammates. There are n souvenir shops along the street. In i-th shop Artsem can buy one souvenir for ai dollars, and he cannot buy more than...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2, j2), ..., (im, jm). Each good pair (ik, jk) meets the following co...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "There are n positive integers written on the blackboard. Also, a positive number k β‰₯ 2 is chosen, and none of the numbers on the blackboard are divisible by k. In one operation, you can choose any two ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Today s kilometer long auto race takes place in Berland. The track is represented by a straight line as long as s kilometers. There are n cars taking part in the race, all of them start simultaneously ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Alice, Bob, and Clara are eating at a new restaurant today. They’re having trouble deciding what to order, so Alice proposes that they each pick some items from the menu, and then they will order the i...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "-" }, { "role": "assistant", "content": "<think>\nOkay, I need to solve this problem where I have to find the maximum value of mat[c][d] - mat[a][b] such that c > a and d > b. Hmm. Let's th...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The mobile application store has a new game called \"Subway Roller\".\n\nThe protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a re...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ever since Mr. Ikra became the chief manager of his office, he has had little time for his favorites, programming and debugging. So he wants to check programs in trains to and from his office with prog...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Rodrick mixes a martini that has a volume of 'n' ounces having 38% Vermouth and 60% Gin by volume. He wants to change it so that the martini is 25% Vermouth by volume. How many ounces of Gin must he ad...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a program that prints the first 10 Fibonacci numbers using a generator." }, { "role": "assistant", "content": "<think>\nOkay, I need to write a Python program that prints the first 10...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ramesh and Suresh's previous attempt to decide who is smarter of them turned out to be indecisive. There was a tie in that too. Turns out they are more similar than they thought, which frustrates them ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You have two positive integers a and b.\n\nYou can perform two kinds of operations:\n\n * a = ⌊ a/b βŒ‹ (replace a with the integer part of the division between a and b) \n * b=b+1 (increase b by 1) \n...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Heidi is now just one code away from breaking the encryption of the Death Star plans. The screen that should be presenting her with the description of the next code looks almost like the previous one, ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can you summarize the emerging consumer trends in Indian households according to Kantar Worldpanel's monthly tracking of purchasing habits?: Indians are shopping on promotion. This recent development i...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You are given a string s, consisting of lowercase Latin letters. While there is at least one character in the string s that is repeated at least twice, you perform the following operation: \n\n * you ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a function to generate the Collatz sequence for a given starting number. The Collatz sequence is defined for a given number n as follows: If n is even, the next number in the sequence is n / 2. I...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Last week Tom had 74 dollars . He washed cars over the weekend and now has 86 dollars. He made _____ money washing cars . Please write a program to solve it" }, { "role": "assistant", "cont...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Implement a function that takes a string as input and returns a list of all the uppercase characters in the string." }, { "role": "assistant", "content": "<think>\nOkay, I need to write a P...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write function isPalindrome that checks if a given string (case insensitive) is a palindrome.\n\n```racket\nIn Racket, the function is called palindrome?\n\n(palindrome? \"nope\") ; returns #f\n(palind...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You are given an array a consisting of n integer numbers.\n\nLet instability of the array be the following value: max_{i = 1}^{n} a_i - min_{i = 1}^{n} a_i.\n\nYou have to remove exactly one element fr...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Create a Python function that checks if a given list of integers can be rearranged into a sequence of consecutive numbers, considering the presence of wildcards represented by the number 0. The functio...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "-" }, { "role": "assistant", "content": "<think>\nOkay, so I need to solve this problem where I have to calculate the score of an XML document. The score is the sum of the number of attribu...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "-" }, { "role": "assistant", "content": "<think>\nOkay, I need to solve this problem where I have to calculate the absolute difference between the sums of the two diagonals of a square matr...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Pam has 10 bags of apples. Each of her bags has as many apples as 3 of Gerald's bags. If Gerald's bags have 40 apples each, how many apples does Pam have?" }, { "role": "assistant", "conten...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was tal...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "# Task\nConsider an array of integers `a`. Let `min(a)` be its minimal element, and let `avg(a)` be its mean.\n\nDefine the center of the array `a` as array `b` such that:\n\n```\n- b is formed from a ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You have $N$ items that you want to put them into a knapsack. Item $i$ has value $v_i$, weight $w_i$ and limitation $m_i$.\n\nYou want to find a subset of items to put such that:\n\n* The total value o...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You are given a character parenthesis array and an integer array.\nYou need to find the maximum sum sub-array in the integer array such that the corresponding sub-array in the character array has balan...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks. Luckily, a service lan...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Create a 30-second jingle for a new sports drink brand that appeals to high-performance athletes. The jingle should highlight the benefits of the sports drink, such as increased hydration, energy, and ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given a string `s` and an array of integers `indices`, return a string that is the same as `s`, except that the characters at the indices specified in `indices` have been replaced with the character `'...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A sum of money at simple interest amounts to Rs. 2240 in 2 years and to Rs. 2600 in 5 years. What is the principal amount\nAnswer Choices: (A) 1000 (B) 1500 (C) 2000 (D) 2500 (E) 3500" }, { "ro...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A bakery sells pies at 5 dollars each and tarts at 9 dollars each. Determine if it's possible to purchase a combination of pies and tarts for exactly M dollars, where you must buy at least one of each ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A salesman has to visit 5 cities and return to his starting point. The cost of traveling between each city is given in the following table:\n\n| City | 1 | 2 | 3 | 4 | 5 |\n| --- | --- | --- | --- | --...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Solve the system of linear equations:\n2x + 3y = 11\n4x - 5y = -13" }, { "role": "assistant", "content": "To solve the system of linear equations, we can use the method of substitution or e...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "For given two segments s1 and s2, print the coordinate of the cross point of them.\n\ns1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.\n\nConstraints\n\n* 1 ≀ q ≀ 1000\n*...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the last position...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A person can row 750 metres against the stream in 11 ΒΌ minutes and returns in 7 Β½ minutes. Then the speed of the person in in still water is :\nAnswer Choices: (A) 2 km/hr (B) 3 km/hr (C) 4 km/hr (D) 5...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The surprise ingredient, instant vanilla pudding, helps form the filling for this spiced pie.\nIn a large saucepan, cook potatoes in enough boiling water to cover for 20 to 25 minutes or until very ten...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The chess knight has a **unique movement**, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an **L*...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hyakugoku has just retired from being the resident deity of the South Black Snail Temple in order to pursue her dream of becoming a cartoonist. She spent six months in that temple just playing \"Cat's ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given anΒ integer n, add a dot (\".\")Β as the thousands separator and return it inΒ string format.\nΒ \nExample 1:\nInput: n = 987\nOutput: \"987\"\n\nExample 2:\nInput: n = 1234\nOutput: \"1.234\"\n\nExa...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "This code snippet is written in Java:\n```java String s = \"Hello\"; for (int i = 0; i < s.length(); i++) { System.out.print(s.charAt(i)); }\n```\nRe-write it in Python while maintaining the same funct...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Chef is playing a game on a sequence of N positive integers, say A1, A2, ... AN. The game is played as follows.\n\nIf all the numbers are equal, the game ends.\nOtherwise\n\nSelect two numbers which ar...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of n computers and m cables that connect some pairs of computers. In other...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Your task is the exact same as for the easy version. But this time, the marmots subtract the village's population P from their random number before responding to Heidi's request.\n\nAlso, there are now...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a descriptive and immersive narrative, in the third person or first person point of view, about a protagonist who unexpectedly uncovers a mysterious and secretive society that has been hiding wit...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given two integers A and B, the task is to find an integer X such that (X XOR A) is minimum possible and the count of set bit in X is equal to the count of set bits in B.\nExample 1:\nInput: \nA = 3, B...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a function `reverse_string_words(sentence: str) -> str` that takes a sentence as input and returns the sentence with the order of the words reversed. Note that you should preserve the original sp...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "*You are a composer who just wrote an awesome piece of music. Now it's time to present it to a band that will perform your piece, but there's a problem! The singers vocal range doesn't stretch as your ...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Given an array S consisting of N numbers, find the sum of difference between last and first element of each subset.\nExample 1:\nInput:\nS = [5,8]\nOutput: \n3\nExplanation: There are 3 subsets possibl...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "A string is called a balanced k-string if it can be divided into k non-empty substrings of equal length, where all substrings are permutations of each other. For example, \"ababab\" is a balanced 3-str...
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a 500-word story in third person point of view about a dedicated humanitarian who, amidst a global crisis that has impacted millions of lives, must take action to alleviate the suffering of the a...