id
stringlengths
36
64
content
stringlengths
278
9.76k
multipl-e_mbpp-cpp_data_mbpp_435_last_Digit
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the last digit of a given number. long last_Digit(long n) { } int main() { auto candidate = last_Digit; assert(candidate((123)) == (3)); assert(candidate((25)) == (5)); assert(candidate((30)) == (0)); }
multipl-e_mbpp-cpp_data_mbpp_436_neg_nos
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to return the negative numbers in a vector. std::vector<long> neg_nos(std::vector<long> list1) { } int main() { auto candidate = neg_nos; assert(candidate((std::vector<long>({(long)-1, (long)4, (long)5, (long)-6}))) == (std::vector<long>({...
multipl-e_mbpp-cpp_data_mbpp_437_remove_odd
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove odd characters in a string. std::string remove_odd(std::string str1) { } int main() { auto candidate = remove_odd; assert(candidate(("python")) == ("yhn")); assert(candidate(("program")) == ("rga")); assert(candidate(("language")...
multipl-e_mbpp-cpp_data_mbpp_438_count_bidirectional
#include<assert.h> #include<bits/stdc++.h> // Write a function to count bidirectional tuple pairs. long count_bidirectional(std::vector<std::tuple<long, long>> test_list) { } int main() { auto candidate = count_bidirectional; assert(candidate((std::vector<std::tuple<long, long>>({(std::tuple<long, long>)std::...
multipl-e_mbpp-cpp_data_mbpp_439_multiple_to_single
#include<assert.h> #include<bits/stdc++.h> // Write a function to join a vector of multiple integers into a single integer. long multiple_to_single(std::vector<long> L) { } int main() { auto candidate = multiple_to_single; assert(candidate((std::vector<long>({(long)11, (long)33, (long)50}))) == (113350)); ...
multipl-e_mbpp-cpp_data_mbpp_440_find_adverb_position
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the first adverb and their positions in a given sentence. std::tuple<long, long, std::string> find_adverb_position(std::string text) { } int main() { auto candidate = find_adverb_position; assert(candidate(("clearly!! we can see the sky"))...
multipl-e_mbpp-cpp_data_mbpp_441_surfacearea_cube
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the surface area of a cube of a given size. long surfacearea_cube(long l) { } int main() { auto candidate = surfacearea_cube; assert(candidate((5)) == (150)); assert(candidate((3)) == (54)); assert(candidate((10)) == (600)); }
multipl-e_mbpp-cpp_data_mbpp_442_positive_count
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the ration of positive numbers in a vector of integers. float positive_count(std::vector<long> nums) { } int main() { auto candidate = positive_count; assert(candidate((std::vector<long>({(long)0, (long)1, (long)2, (long)-1, (long)-5, (lon...
multipl-e_mbpp-cpp_data_mbpp_443_largest_neg
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the largest negative number from the given vector. long largest_neg(std::vector<long> list1) { } int main() { auto candidate = largest_neg; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)-4, (long)-6}))) == (...
multipl-e_mbpp-cpp_data_mbpp_444_trim_tuple
#include<assert.h> #include<bits/stdc++.h> // Write a function to trim each vector by k in the given vectors. std::vector<std::vector<long>> trim_tuple(std::vector<std::vector<long>> test_list, long K) { } int main() { auto candidate = trim_tuple; assert(candidate((std::vector<std::vector<long>>({(std::vector...
multipl-e_mbpp-cpp_data_mbpp_445_index_multiplication
#include<assert.h> #include<bits/stdc++.h> // Write a function to perform index wise multiplication of vector elements in the given two vectors. std::vector<std::vector<long>> index_multiplication(std::vector<std::vector<long>> test_tup1, std::vector<std::vector<long>> test_tup2) { } int main() { auto candidate =...
multipl-e_mbpp-cpp_data_mbpp_446_count_Occurrence
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to count the occurence of all elements of vector in a tuple. long count_Occurrence(std::any tup, std::vector<std::any> lst) { } int main() { auto candidate = count_Occurrence; assert(candidate(std::make_tuple("a", "a", "c", "b", "d"), (std...
multipl-e_mbpp-cpp_data_mbpp_447_cube_nums
#include<assert.h> #include<bits/stdc++.h> // Write a function to find cubes of individual elements in a vector. std::vector<long> cube_nums(std::vector<long> nums) { } int main() { auto candidate = cube_nums; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5, (long)6, (long)7, ...
multipl-e_mbpp-cpp_data_mbpp_448_cal_sum
#include<assert.h> #include<bits/stdc++.h> // Write a function to calculate the sum of perrin numbers. long cal_sum(long n) { } int main() { auto candidate = cal_sum; assert(candidate((9)) == (49)); assert(candidate((10)) == (66)); assert(candidate((11)) == (88)); }
multipl-e_mbpp-cpp_data_mbpp_450_extract_string
#include<assert.h> #include<bits/stdc++.h> // Write a function to extract specified size of strings from a given vector of string values. std::vector<std::string> extract_string(std::vector<std::string> str, long l) { } int main() { auto candidate = extract_string; assert(candidate((std::vector<std::string>({...
multipl-e_mbpp-cpp_data_mbpp_451_remove_whitespaces
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove all whitespaces from the given string. std::string remove_whitespaces(std::string text1) { } int main() { auto candidate = remove_whitespaces; assert(candidate((" Google Flutter ")) == ("GoogleFlutter")); assert(candidate((" Googl...
multipl-e_mbpp-cpp_data_mbpp_452_loss_amount
#include<assert.h> #include<bits/stdc++.h> // Write a function that gives loss amount on a sale if the given amount has loss else return 0. long loss_amount(long actual_cost, long sale_amount) { } int main() { auto candidate = loss_amount; assert(candidate((1500), (1200)) == (0)); assert(candidate((100), ...
multipl-e_mbpp-cpp_data_mbpp_453_sumofFactors
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the sum of even factors of a number. long sumofFactors(long n) { } int main() { auto candidate = sumofFactors; assert(candidate((18)) == (26)); assert(candidate((30)) == (48)); assert(candidate((6)) == (8)); }
multipl-e_mbpp-cpp_data_mbpp_454_text_match_wordz
#include<assert.h> #include<bits/stdc++.h> // Write a function that matches a word containing 'z'. bool text_match_wordz(std::string text) { } int main() { auto candidate = text_match_wordz; assert(candidate(("pythonz.")) == (true)); assert(candidate(("xyz.")) == (true)); assert(candidate((" lang ."...
multipl-e_mbpp-cpp_data_mbpp_455_check_monthnumb_number
#include<assert.h> #include<bits/stdc++.h> // Write a function to check whether the given month number contains 31 days or not. bool check_monthnumb_number(long monthnum2) { } int main() { auto candidate = check_monthnumb_number; assert(candidate((5)) == (true)); assert(candidate((2)) == (false)); ass...
multipl-e_mbpp-cpp_data_mbpp_456_reverse_string_list
#include<assert.h> #include<bits/stdc++.h> // Write a function to reverse each string in a given vector of string values. std::vector<std::string> reverse_string_list(std::vector<std::string> stringlist) { } int main() { auto candidate = reverse_string_list; assert(candidate((std::vector<std::string>({(std::s...
multipl-e_mbpp-cpp_data_mbpp_457_Find_Min
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the subvector having minimum length. std::vector<std::any> Find_Min(std::vector<std::vector<std::any>> lst) { } int main() { auto candidate = Find_Min; assert(candidate((std::vector<std::vector<std::any>>({(std::vector<long>)std::v...
multipl-e_mbpp-cpp_data_mbpp_458_rectangle_area
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the area of a rectangle. long rectangle_area(long l, long b) { } int main() { auto candidate = rectangle_area; assert(candidate((10), (20)) == (200)); assert(candidate((10), (5)) == (50)); assert(candidate((4), (2)) == (8)); }
multipl-e_mbpp-cpp_data_mbpp_459_remove_uppercase
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove uppercase substrings from a given string. std::string remove_uppercase(std::string str1) { } int main() { auto candidate = remove_uppercase; assert(candidate(("cAstyoUrFavoRitETVshoWs")) == ("cstyoravoitshos")); assert(candidate(("wA...
multipl-e_mbpp-cpp_data_mbpp_460_Extract
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to get the first element of each subvector. std::vector<long> Extract(std::vector<std::vector<long>> lst) { } int main() { auto candidate = Extract; assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(l...
multipl-e_mbpp-cpp_data_mbpp_461_upper_ctr
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to count the upper case characters in a given string. long upper_ctr(std::string str) { } int main() { auto candidate = upper_ctr; assert(candidate(("PYthon")) == (1)); assert(candidate(("BigData")) == (1)); assert(candidate(("prog...
multipl-e_mbpp-cpp_data_mbpp_462_combinations_list
#include<assert.h> #include<bits/stdc++.h> union Union_std_vector_std_nullopt__std_vector_std_string_{ std::vector<std::nullopt> f0; std::vector<std::string> f1; Union_std_vector_std_nullopt__std_vector_std_string_(std::vector<std::nullopt> _f0) : f0(_f0) {} Union_std_vector_std_nullopt__std_vector_std_s...
multipl-e_mbpp-cpp_data_mbpp_463_max_subarray_product
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the maximum product subvector of the given vector. long max_subarray_product(std::vector<long> arr) { } int main() { auto candidate = max_subarray_product; assert(candidate((std::vector<long>({(long)1, (long)-2, (long)-3, (long)0, (long)7,...
multipl-e_mbpp-cpp_data_mbpp_464_check_value
#include<assert.h> #include<bits/stdc++.h> // Write a function to check if all values are same in a map. bool check_value(std::map<std::string,long> dict, long n) { } int main() { auto candidate = check_value; assert(candidate((std::map<std::string,long>({{"Cierra Vega", 12}, {"Alden Cantrell", 12}, {"Kierra ...
multipl-e_mbpp-cpp_data_mbpp_465_drop_empty
#include<assert.h> #include<bits/stdc++.h> // Write a function to drop empty items from a given map. std::map<std::string,std::string> drop_empty(std::map<std::string,std::optional<std::string>> dict1) { } int main() { auto candidate = drop_empty; assert(candidate(std::map<std::string,std::string>({{"c1", "Re...
multipl-e_mbpp-cpp_data_mbpp_468_max_product
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that vector. long max_product(std::vector<long> arr) { } int main() { auto candidate = max_product; assert(candidate((std::vector<long>({(long)3, (long)100, ...
multipl-e_mbpp-cpp_data_mbpp_470_add_pairwise
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the pairwise addition of the neighboring elements of the given tuple. std::tuple<long, long, long, long> add_pairwise(std::tuple<long, long, long, long, long> test_tup) { } int main() { auto candidate = add_pairwise; assert(candidate((std:...
multipl-e_mbpp-cpp_data_mbpp_471_find_remainder
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the product of the vector multiplication modulo n. long find_remainder(std::vector<long> arr, long n) { } int main() { auto candidate = find_remainder; assert(candidate((std::vector<long>({(long)100, (long)10, (long)5, (long)25, (l...
multipl-e_mbpp-cpp_data_mbpp_472_check_Consecutive
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to check whether the given vector contains consecutive numbers or not. bool check_Consecutive(std::vector<long> l) { } int main() { auto candidate = check_Consecutive; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4...
multipl-e_mbpp-cpp_data_mbpp_474_replace_char
#include<assert.h> #include<bits/stdc++.h> // Write a function to replace characters in a string. std::string replace_char(std::string str1, std::string ch, std::string newch) { } int main() { auto candidate = replace_char; assert(candidate(("polygon"), ("y"), ("l")) == ("pollgon")); assert(candidate(("ch...
multipl-e_mbpp-cpp_data_mbpp_475_sort_counter
#include<assert.h> #include<bits/stdc++.h> // Write a function to sort a map by value. std::vector<std::tuple<std::string, long>> sort_counter(std::map<std::string,long> dict1) { } int main() { auto candidate = sort_counter; assert(candidate((std::map<std::string,long>({{"Math", 81}, {"Physics", 83}, {"Chemis...
multipl-e_mbpp-cpp_data_mbpp_476_big_sum
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the sum of the largest and smallest value in a given vector. long big_sum(std::vector<long> nums) { } int main() { auto candidate = big_sum; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (4)); assert(can...
multipl-e_mbpp-cpp_data_mbpp_477_is_lower
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to convert the given string to lower case. std::string is_lower(std::string string) { } int main() { auto candidate = is_lower; assert(candidate(("InValid")) == ("invalid")); assert(candidate(("TruE")) == ("true")); assert(candidat...
multipl-e_mbpp-cpp_data_mbpp_478_remove_lowercase
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove lowercase substrings from a given string. std::string remove_lowercase(std::string str1) { } int main() { auto candidate = remove_lowercase; assert(candidate(("PYTHon")) == ("PYTH")); assert(candidate(("FInD")) == ("FID")); asser...
multipl-e_mbpp-cpp_data_mbpp_479_first_Digit
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the first digit of a given number. long first_Digit(long n) { } int main() { auto candidate = first_Digit; assert(candidate((123)) == (1)); assert(candidate((456)) == (4)); assert(candidate((12)) == (1)); }
multipl-e_mbpp-cpp_data_mbpp_554_Split
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function which takes a vector of integers and only returns the odd ones. std::vector<long> Split(std::vector<long> list) { } int main() { auto candidate = Split; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5, (lon...
multipl-e_mbpp-cpp_data_mbpp_555_difference
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the difference between the sum of cubes of the first n natural numbers and the sum of the first n natural numbers. long difference(long n) { } int main() { auto candidate = difference; assert(candidate((3)) == (30)); assert(can...
multipl-e_mbpp-cpp_data_mbpp_556_find_Odd_Pair
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to count the number of pairs whose xor value is odd. long find_Odd_Pair(std::vector<long> A, long N) { } int main() { auto candidate = find_Odd_Pair; assert(candidate((std::vector<long>({(long)5, (long)4, (long)7, (long)2, (long)1})), (5))...
multipl-e_mbpp-cpp_data_mbpp_557_toggle_string
#include<assert.h> #include<bits/stdc++.h> // Write a function to toggle the case of all characters in a string. std::string toggle_string(std::string string) { } int main() { auto candidate = toggle_string; assert(candidate(("Python")) == ("pYTHON")); assert(candidate(("Pangram")) == ("pANGRAM")); as...
multipl-e_mbpp-cpp_data_mbpp_558_digit_distance_nums
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the sum of the per-digit difference between two integers. long digit_distance_nums(long n1, long n2) { } int main() { auto candidate = digit_distance_nums; assert(candidate((1), (2)) == (1)); assert(candidate((23), (56)) == (6)...
multipl-e_mbpp-cpp_data_mbpp_559_max_sub_array_sum
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the sum of the largest contiguous subvector in the given vector. long max_sub_array_sum(std::vector<long> a, long size) { } int main() { auto candidate = max_sub_array_sum; assert(candidate((std::vector<long>({(long)-2, (long)-3, (long)4, ...
multipl-e_mbpp-cpp_data_mbpp_560_union_elements
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the union of the elements of two given vectors and output them in sorted order. std::vector<long> union_elements(std::vector<long> test_tup1, std::vector<long> test_tup2) { } int main() { auto candidate = union_elements; assert(candidate((...
multipl-e_mbpp-cpp_data_mbpp_562_Find_Max_Length
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the length of the longest subvectors. long Find_Max_Length(std::vector<std::vector<long>> lst) { } int main() { auto candidate = Find_Max_Length; assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long...
multipl-e_mbpp-cpp_data_mbpp_563_extract_values
#include<assert.h> #include<bits/stdc++.h> // Write a function to extract values between quotation marks from a string. std::vector<std::string> extract_values(std::string text) { } int main() { auto candidate = extract_values; assert(candidate((""Python", "PHP", "Java"")) == (std::vector<std::string>({(std::...
multipl-e_mbpp-cpp_data_mbpp_564_count_Pairs
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function which takes a vector of integers and counts the number of possible unordered pairs where both elements are unequal. long count_Pairs(std::vector<long> arr, long n) { } int main() { auto candidate = count_Pairs; assert(candidate((std::vecto...
multipl-e_mbpp-cpp_data_mbpp_565_split
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to split a string into characters. std::vector<std::string> split(std::string word) { } int main() { auto candidate = split; assert(candidate(("python")) == (std::vector<std::string>({(std::string)"p", (std::string)"y", (std::string)"t", (...
multipl-e_mbpp-cpp_data_mbpp_566_sum_digits
#include<assert.h> #include<bits/stdc++.h> // Write a function to get the sum of the digits of a non-negative integer. long sum_digits(long n) { } int main() { auto candidate = sum_digits; assert(candidate((345)) == (12)); assert(candidate((12)) == (3)); assert(candidate((97)) == (16)); }
multipl-e_mbpp-cpp_data_mbpp_567_issort_list
#include<assert.h> #include<bits/stdc++.h> // Write a function to check whether a specified vector is sorted or not. bool issort_list(std::vector<long> list1) { } int main() { auto candidate = issort_list; assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)6, (long)8, (long)10, (long)12, (l...
multipl-e_mbpp-cpp_data_mbpp_568_empty_list
#include<assert.h> #include<bits/stdc++.h> // Write a function to create a vector of N empty dictionaries. std::vector<std::map<std::nullopt,std::nullopt>> empty_list(long length) { } int main() { auto candidate = empty_list; assert(candidate((5)) == (std::vector<std::map<std::nullopt,std::nullopt>>({(std::ma...
multipl-e_mbpp-cpp_data_mbpp_569_sort_sublists
#include<assert.h> #include<bits/stdc++.h> // Write a function to sort each subvector of strings in a given vector of vectors. std::vector<std::vector<std::string>> sort_sublists(std::vector<std::vector<std::string>> list1) { } int main() { auto candidate = sort_sublists; assert(candidate((std::vector<std::ve...
multipl-e_mbpp-cpp_data_mbpp_572_two_unique_nums
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to remove duplicate numbers from a given number of vectors. std::vector<long> two_unique_nums(std::vector<long> nums) { } int main() { auto candidate = two_unique_nums; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)...
multipl-e_mbpp-cpp_data_mbpp_573_unique_product
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to calculate the product of the unique numbers in a given vector. long unique_product(std::vector<long> list_data) { } int main() { auto candidate = unique_product; assert(candidate((std::vector<long>({(long)10, (long)20, (long)30, (long)4...
multipl-e_mbpp-cpp_data_mbpp_574_surfacearea_cylinder
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the surface area of a cylinder. float surfacearea_cylinder(long r, long h) { } int main() { auto candidate = surfacearea_cylinder; assert(candidate((10), (5)) == (942.45f)); assert(candidate((4), (5)) == (226.18800000000002f)); ass...
multipl-e_mbpp-cpp_data_mbpp_576_is_Sub_Array
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to check whether a vector is subvector of another or not. bool is_Sub_Array(std::vector<long> A, std::vector<long> B) { } int main() { auto candidate = is_Sub_Array; assert(candidate((std::vector<long>({(long)1, (long)4, (long)3, (long)5})...
multipl-e_mbpp-cpp_data_mbpp_577_last_Digit_Factorial
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the last digit in factorial of a given number. long last_Digit_Factorial(long n) { } int main() { auto candidate = last_Digit_Factorial; assert(candidate((4)) == (4)); assert(candidate((21)) == (0)); assert(candidate((30)) ...
multipl-e_mbpp-cpp_data_mbpp_578_interleave_lists
#include<assert.h> #include<bits/stdc++.h> // Write a function to interleave 3 vectors of the same length into a single flat vector. std::vector<long> interleave_lists(std::vector<long> list1, std::vector<long> list2, std::vector<long> list3) { } int main() { auto candidate = interleave_lists; assert(candidat...
multipl-e_mbpp-cpp_data_mbpp_579_find_dissimilar
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the dissimilar elements in the given two tuples. std::tuple<long, long, long, long> find_dissimilar(std::tuple<long, long, long, long> test_tup1, std::tuple<long, long, long, long> test_tup2) { } int main() { auto candidate = find_dissimilar; ...
multipl-e_mbpp-cpp_data_mbpp_580_extract_even
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove uneven elements in the nested mixed tuple. std::any extract_even(std::tuple<long, long, std::tuple<long, long, std::tuple<long, long>>, long, long> test_tuple) { } int main() { auto candidate = extract_even; assert(candidate((std::make_t...
multipl-e_mbpp-cpp_data_mbpp_581_surface_Area
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the surface area of a square cppramid with a given base edge and height. long surface_Area(long b, long s) { } int main() { auto candidate = surface_Area; assert(candidate((3), (4)) == (33)); assert(candidate((4), (5)) == (56))...
multipl-e_mbpp-cpp_data_mbpp_583_catalan_number
#include<assert.h> #include<bits/stdc++.h> // Write a function which returns nth catalan number. long catalan_number(long num) { } int main() { auto candidate = catalan_number; assert(candidate((10)) == (16796)); assert(candidate((9)) == (4862)); assert(candidate((7)) == (429)); }
multipl-e_mbpp-cpp_data_mbpp_584_find_adverbs
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the first adverb ending with ly and its positions in a given string. std::string find_adverbs(std::string text) { } int main() { auto candidate = find_adverbs; assert(candidate(("Clearly, he has no excuse for such behavior.")) == ("0-7: Cl...
multipl-e_mbpp-cpp_data_mbpp_585_expensive_items
#include<assert.h> #include<bits/stdc++.h> union Union_std_string_float{ std::string f0; float f1; Union_std_string_float(std::string _f0) : f0(_f0) {} Union_std_string_float(float _f1) : f1(_f1) {} ~Union_std_string_float() {} bool operator==(std::string f) { return f0 == f ; } bo...
multipl-e_mbpp-cpp_data_mbpp_586_split_Arr
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to split a vector at the nth eelment and add the first part to the end. std::vector<long> split_Arr(std::vector<long> l, long n) { } int main() { auto candidate = split_Arr; assert(candidate((std::vector<long>({(long)12, (long)10, (long)5,...
multipl-e_mbpp-cpp_data_mbpp_587_list_tuple
#include<assert.h> #include<bits/stdc++.h> // Write a function to convert a vector to a tuple. std::any list_tuple(std::vector<long> listx) { } int main() { auto candidate = list_tuple; assert(candidate((std::vector<long>({(long)5, (long)10, (long)7, (long)4, (long)15, (long)3}))) == std::make_tuple(5, 10, 7,...
multipl-e_mbpp-cpp_data_mbpp_588_big_diff
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the difference between largest and smallest value in a given vector. long big_diff(std::vector<long> nums) { } int main() { auto candidate = big_diff; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == (...
multipl-e_mbpp-cpp_data_mbpp_589_perfect_squares
#include<assert.h> #include<bits/stdc++.h> // Write a function to find perfect squares between two given numbers. std::vector<long> perfect_squares(long a, long b) { } int main() { auto candidate = perfect_squares; assert(candidate((1), (30)) == (std::vector<long>({(long)1, (long)4, (long)9, (long)16, (long)2...
multipl-e_mbpp-cpp_data_mbpp_591_swap_List
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to interchange the first and last elements in a vector. std::vector<long> swap_List(std::vector<long> newList) { } int main() { auto candidate = swap_List; assert(candidate((std::vector<long>({(long)12, (long)35, (long)9, (long)56, (long)2...
multipl-e_mbpp-cpp_data_mbpp_592_sum_Of_product
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the sum of the product of consecutive binomial co-efficients. long sum_Of_product(long n) { } int main() { auto candidate = sum_Of_product; assert(candidate((3)) == (15)); assert(candidate((4)) == (56)); assert(candidate((1...
multipl-e_mbpp-cpp_data_mbpp_593_removezero_ip
#include<assert.h> #include<bits/stdc++.h> // Write a function to remove leading zeroes from an ip address. std::string removezero_ip(std::string ip) { } int main() { auto candidate = removezero_ip; assert(candidate(("216.08.094.196")) == ("216.8.94.196")); assert(candidate(("12.01.024")) == ("12.1.24"));...
multipl-e_mbpp-cpp_data_mbpp_594_diff_even_odd
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the difference of the first even and first odd number of a given vector. long diff_even_odd(std::vector<long> list1) { } int main() { auto candidate = diff_even_odd; assert(candidate((std::vector<long>({(long)1, (long)3, (long)5, (long)7, ...
multipl-e_mbpp-cpp_data_mbpp_595_min_Swaps
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to count minimum number of swaps required to convert one binary number represented as a string to another. std::any min_Swaps(std::string str1, std::string str2) { } int main() { auto candidate = min_Swaps; assert(candidate(("1101"), ("111...
multipl-e_mbpp-cpp_data_mbpp_597_find_kth
#include<assert.h> #include<bits/stdc++.h> // Write a function to find kth element from the given two sorted vectors. long find_kth(std::vector<long> arr1, std::vector<long> arr2, long k) { } int main() { auto candidate = find_kth; assert(candidate((std::vector<long>({(long)2, (long)3, (long)6, (long)7, (long...
multipl-e_mbpp-cpp_data_mbpp_598_armstrong_number
#include<assert.h> #include<bits/stdc++.h> // Write a function to check whether the given number is armstrong or not. bool armstrong_number(long number) { } int main() { auto candidate = armstrong_number; assert(candidate((153)) == (true)); assert(candidate((259)) == (false)); assert(candidate((4458))...
multipl-e_mbpp-cpp_data_mbpp_599_sum_average
#include<assert.h> #include<bits/stdc++.h> // Write a function to find sum and average of first n natural numbers. std::tuple<long, float> sum_average(long number) { } int main() { auto candidate = sum_average; assert(candidate((10)) == (std::make_tuple(55, 5.5f))); assert(candidate((15)) == (std::make_tu...
multipl-e_mbpp-cpp_data_mbpp_600_is_Even
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to check whether the given number is even or not. bool is_Even(long n) { } int main() { auto candidate = is_Even; assert(candidate((1)) == (false)); assert(candidate((2)) == (true)); assert(candidate((3)) == (false)); }
multipl-e_mbpp-cpp_data_mbpp_602_first_repeated_char
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find the first repeated character in a given string. std::optional<std::string> first_repeated_char(std::string str1) { } int main() { auto candidate = first_repeated_char; assert(candidate(("abcabc")) == "a"); assert(candidate(("ab...
multipl-e_mbpp-cpp_data_mbpp_603_get_ludic
#include<assert.h> #include<bits/stdc++.h> // Write a function to get all lucid numbers smaller than or equal to a given integer. std::vector<long> get_ludic(long n) { } int main() { auto candidate = get_ludic; assert(candidate((10)) == (std::vector<long>({(long)1, (long)2, (long)3, (long)5, (long)7}))); ...
multipl-e_mbpp-cpp_data_mbpp_604_reverse_words
#include<assert.h> #include<bits/stdc++.h> // Write a function to reverse words seperated by spaces in a given string. std::string reverse_words(std::string s) { } int main() { auto candidate = reverse_words; assert(candidate(("python program")) == ("program python")); assert(candidate(("java language")) ...
multipl-e_mbpp-cpp_data_mbpp_605_prime_num
#include<assert.h> #include<bits/stdc++.h> // Write a function to check if the given integer is a prime number. bool prime_num(long num) { } int main() { auto candidate = prime_num; assert(candidate((13)) == (true)); assert(candidate((7)) == (true)); assert(candidate((-1010)) == (false)); }
multipl-e_mbpp-cpp_data_mbpp_606_radian_degree
#include<assert.h> #include<bits/stdc++.h> // Write a function to convert degrees to radians. float radian_degree(long degree) { } int main() { auto candidate = radian_degree; assert(candidate((90)) == (1.5707963267948966f)); assert(candidate((60)) == (1.0471975511965976f)); assert(candidate((120)) ==...
multipl-e_mbpp-cpp_data_mbpp_607_find_literals
#include<assert.h> #include<bits/stdc++.h> // Write a function to search a string for a regex pattern. The function should return the matching subtring, a start index and an end index. std::tuple<std::string, long, long> find_literals(std::string text, std::string pattern) { } int main() { auto candidate = find_l...
multipl-e_mbpp-cpp_data_mbpp_608_bell_Number
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to find nth bell number. long bell_Number(long n) { } int main() { auto candidate = bell_Number; assert(candidate((2)) == (2)); assert(candidate((3)) == (5)); assert(candidate((4)) == (15)); }
multipl-e_mbpp-cpp_data_mbpp_610_remove_kth_element
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function which takes a vector and returns a vector with the same elements, but the k'th element removed. std::vector<long> remove_kth_element(std::vector<long> list1, long L) { } int main() { auto candidate = remove_kth_element; assert(candidate((s...
multipl-e_mbpp-cpp_data_mbpp_611_max_of_nth
#include<assert.h> #include<bits/stdc++.h> // Write a function which given a matrix represented as a vector of vectors returns the max of the n'th column. long max_of_nth(std::vector<std::vector<long>> test_list, long N) { } int main() { auto candidate = max_of_nth; assert(candidate((std::vector<std::vector<l...
multipl-e_mbpp-cpp_data_mbpp_612_merge
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function which takes a vector of vectors, where each subvector has two elements, and returns a vector of two vectors where the first vector has the first element of each subvector and the second one has the second. std::vector<std::vector<std::any>> merge(st...
multipl-e_mbpp-cpp_data_mbpp_614_cummulative_sum
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the cumulative sum of all the values that are present in the given vector of vectors. long cummulative_sum(std::vector<std::vector<long>> test_list) { } int main() { auto candidate = cummulative_sum; assert(candidate((std::vector<std::vect...
multipl-e_mbpp-cpp_data_mbpp_615_average_tuple
#include<assert.h> #include<bits/stdc++.h> // Write a function which takes a vectors of vectors and returns the average value for each subvector as a vector. std::vector<float> average_tuple(std::vector<std::vector<long>> nums) { } int main() { auto candidate = average_tuple; assert(candidate((std::vector<std...
multipl-e_mbpp-cpp_data_mbpp_616_tuple_modulo
#include<assert.h> #include<bits/stdc++.h> // Write a function which takes two tuples of the same length and performs the element wise modulo. std::tuple<long, long, long, long> tuple_modulo(std::tuple<long, long, long, long> test_tup1, std::tuple<long, long, long, long> test_tup2) { } int main() { auto candidate...
multipl-e_mbpp-cpp_data_mbpp_617_min_Jumps
#include<assert.h> #include<bits/stdc++.h> // Write a function to check for the number of jumps required of given length to reach a point of form (d, 0) from origin in a 2d plane. float min_Jumps(std::tuple<long, long> steps, long d) { } int main() { auto candidate = min_Jumps; assert(candidate((std::make_tup...
multipl-e_mbpp-cpp_data_mbpp_618_div_list
#include<assert.h> #include<bits/stdc++.h> // Write a function to divide two vectors element wise. std::vector<float> div_list(std::vector<long> nums1, std::vector<long> nums2) { } int main() { auto candidate = div_list; assert(candidate((std::vector<long>({(long)4, (long)5, (long)6})), (std::vector<long>({(l...
multipl-e_mbpp-cpp_data_mbpp_619_move_num
#include<assert.h> #include<bits/stdc++.h> // Write a function to move all the numbers to the end of the given string. std::string move_num(std::string test_str) { } int main() { auto candidate = move_num; assert(candidate(("I1love143you55three3000thousand")) == ("Iloveyouthreethousand1143553000")); asser...
multipl-e_mbpp-cpp_data_mbpp_622_get_median
#include<assert.h> #include<bits/stdc++.h> // Write a function to find the median of two sorted vectors of same size. float get_median(std::vector<long> arr1, std::vector<long> arr2, long n) { } int main() { auto candidate = get_median; assert(candidate((std::vector<long>({(long)1, (long)12, (long)15, (long)2...
multipl-e_mbpp-cpp_data_mbpp_623_nth_nums
#include<assert.h> #include<bits/stdc++.h> // Write a function to compute the n-th power of each number in a vector. std::vector<long> nth_nums(std::vector<long> nums, long n) { } int main() { auto candidate = nth_nums; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5, (long)6,...
multipl-e_mbpp-cpp_data_mbpp_624_is_upper
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to convert a given string to uppercase. std::string is_upper(std::string string) { } int main() { auto candidate = is_upper; assert(candidate(("person")) == ("PERSON")); assert(candidate(("final")) == ("FINAL")); assert(candidate((...
multipl-e_mbpp-cpp_data_mbpp_625_swap_List
#include<assert.h> #include<bits/stdc++.h> // Write a cppthon function to interchange the first and last element in a given vector. std::vector<long> swap_List(std::vector<long> newList) { } int main() { auto candidate = swap_List; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (std::ve...