task_id
stringlengths
18
20
language
stringclasses
1 value
prompt
stringlengths
366
1.93k
test
stringlengths
438
26.2k
entry_point
stringlengths
1
24
canonical_solution
stringclasses
0 values
description
stringlengths
0
1.21k
HumanEval_csharp/0
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Check if in given list of numbers, are any two numbers closer to each other than /// given threshold. /// >>> HasCloseElements([1.0, 2.0, 3.0], 0.5) /// False /// >>> HasCloseElements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) /// True /// /// </summary> public static bool HasCloseElements (List<double> numbers, double threshold) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = HasCloseElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2},0.3); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = HasCloseElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2},0.05); var expected2 = false; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = HasCloseElements(new List<double> {1.0,2.0,5.9,4.0,5.0},0.95); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = HasCloseElements(new List<double> {1.0,2.0,5.9,4.0,5.0},0.8); var expected4 = false; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = HasCloseElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.0},0.1); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = HasCloseElements(new List<double> {1.1,2.2,3.1,4.1,5.1},1.0); var expected6 = true; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = HasCloseElements(new List<double> {1.1,2.2,3.1,4.1,5.1},0.5); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
HasCloseElements
null
Check if in given list of numbers, are any two numbers closer to each other than given threshold. >>> has_close_elements([1.0, 2.0, 3.0], 0.5) False >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) True
HumanEval_csharp/1
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to /// separate those group into separate strings and return the list of those. /// Separate groups are balanced (each open brace is properly closed) and not nested within each other /// Ignore any spaces in the input string. /// >>> SeparateParenGroups('( ) (( )) (( )( ))') /// ['()', '(())', '(()())'] /// /// </summary> public static List<string> SeparateParenGroups (string paren_string) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SeparateParenGroups("(()()) ((())) () ((())()())"); var expected1 = new List<string> {"(()())","((()))","()","((())()())"}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SeparateParenGroups("() (()) ((())) (((())))"); var expected2 = new List<string> {"()","(())","((()))","(((())))"}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SeparateParenGroups("(()(())((())))"); var expected3 = new List<string> {"(()(())((())))"}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SeparateParenGroups("( ) (( )) (( )( ))"); var expected4 = new List<string> {"()","(())","(()())"}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
SeparateParenGroups
null
Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())']
HumanEval_csharp/2
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Given a positive floating point number, it can be decomposed into /// and integer part (largest integer smaller than given number) and decimals /// (leftover part always smaller than 1). /// /// Return the decimal part of the number. /// >>> TruncateNumber(3.5) /// 0.5 /// /// </summary> public static double TruncateNumber (double number) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = TruncateNumber(3.5); var expected1 = 0.5; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = TruncateNumber(1.33); var expected2 = 0.33000000000000007; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = TruncateNumber(123.456); var expected3 = 0.45600000000000307; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
TruncateNumber
null
Given a positive floating point number, it can be decomposed into and integer part (largest integer smaller than given number) and decimals (leftover part always smaller than 1). Return the decimal part of the number. >>> truncate_number(3.5) 0.5
HumanEval_csharp/3
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// You're given a list of deposit and withdrawal operations on a bank account that starts with /// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and /// at that point function should return True. Otherwise it should return False. /// >>> BelowZero([1, 2, 3]) /// False /// >>> BelowZero([1, 2, -4, 5]) /// True /// /// </summary> public static bool BelowZero (List<int> operations) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = BelowZero(new List<int> {}); var expected1 = false; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = BelowZero(new List<int> {1,2,-3,1,2,-3}); var expected2 = false; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = BelowZero(new List<int> {1,2,-4,5,6}); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = BelowZero(new List<int> {1,-1,2,-2,5,-5,4,-4}); var expected4 = false; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = BelowZero(new List<int> {1,-1,2,-2,5,-5,4,-5}); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = BelowZero(new List<int> {1,-2,2,-2,5,-5,4,-4}); var expected6 = true; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} } } }
BelowZero
null
You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True
HumanEval_csharp/4
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// For a given list of input numbers, calculate Mean Absolute Deviation /// around the mean of this dataset. /// Mean Absolute Deviation is the average absolute difference between each /// element and a centerpoint (mean in this case): /// MAD = average | x - x_mean | /// >>> MeanAbsoluteDeviation([1.0, 2.0, 3.0, 4.0]) /// 1.0 /// /// </summary> public static double MeanAbsoluteDeviation (List<double> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0}); var expected1 = 0.6666666666666666; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0,4.0}); var expected2 = 1.0; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0,4.0,5.0}); var expected3 = 1.2; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
MeanAbsoluteDeviation
null
For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the average absolute difference between each element and a centerpoint (mean in this case): MAD = average | x - x_mean | >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) 1.0
HumanEval_csharp/5
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Insert a number 'delimeter' between every two consecutive elements of input list `numbers' /// >>> Intersperse([], 4) /// [] /// >>> Intersperse([1, 2, 3], 4) /// [1, 4, 2, 4, 3] /// /// </summary> public static List<int> Intersperse (List<int> numbers, int delimeter) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Intersperse(new List<int> {},7); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Intersperse(new List<int> {5,6,3,2},8); var expected2 = new List<int> {5,8,6,8,3,8,2}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Intersperse(new List<int> {2,2,2},2); var expected3 = new List<int> {2,2,2,2,2}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
Intersperse
null
Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3]
HumanEval_csharp/6
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Input to this function is a string represented multiple groups for nested parentheses separated by spaces. /// For each of the group, output the deepest level of nesting of parentheses. /// E.g. (()()) has maximum two levels of nesting while ((())) has three. /// /// >>> ParseNestedParens('(()()) ((())) () ((())()())') /// [2, 3, 1, 3] /// /// </summary> public static List<int> ParseNestedParens (string paren_string) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = ParseNestedParens("(()()) ((())) () ((())()())"); var expected1 = new List<int> {2,3,1,3}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = ParseNestedParens("() (()) ((())) (((())))"); var expected2 = new List<int> {1,2,3,4}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = ParseNestedParens("(()(())((())))"); var expected3 = new List<int> {4}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
ParseNestedParens
null
Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3]
HumanEval_csharp/7
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Filter an input list of strings only for ones that contain given substring /// >>> FilterBySubstring([], 'a') /// [] /// >>> FilterBySubstring(['abc', 'bacd', 'cde', 'array'], 'a') /// ['abc', 'bacd', 'array'] /// /// </summary> public static List<string> FilterBySubstring (List<string> strings, string substring) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FilterBySubstring(new List<string> {},"john"); var expected1 = new List<string> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FilterBySubstring(new List<string> {"xxx","asd","xxy","john doe","xxxAAA","xxx"},"xxx"); var expected2 = new List<string> {"xxx","xxxAAA","xxx"}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FilterBySubstring(new List<string> {"xxx","asd","aaaxxy","john doe","xxxAAA","xxx"},"xx"); var expected3 = new List<string> {"xxx","aaaxxy","xxxAAA","xxx"}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = FilterBySubstring(new List<string> {"grunt","trumpet","prune","gruesome"},"run"); var expected4 = new List<string> {"grunt","prune"}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
FilterBySubstring
null
Filter an input list of strings only for ones that contain given substring >>> filter_by_substring([], 'a') [] >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a') ['abc', 'bacd', 'array']
HumanEval_csharp/8
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. /// Empty sum should be equal to 0 and empty product should be equal to 1. /// >>> SumProduct([]) /// (0, 1) /// >>> SumProduct([1, 2, 3, 4]) /// (10, 24) /// /// </summary> public static List<int> SumProduct (List<int> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SumProduct(new List<int> {}); var expected1 = new List<int> {0,1}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SumProduct(new List<int> {1,1,1}); var expected2 = new List<int> {3,1}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SumProduct(new List<int> {100,0}); var expected3 = new List<int> {100,0}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SumProduct(new List<int> {3,5,7}); var expected4 = new List<int> {15,105}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = SumProduct(new List<int> {10}); var expected5 = new List<int> {10,10}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
SumProduct
null
For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. Empty sum should be equal to 0 and empty product should be equal to 1. >>> sum_product([]) (0, 1) >>> sum_product([1, 2, 3, 4]) (10, 24)
HumanEval_csharp/9
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// From a given list of integers, generate a list of rolling maximum element found until given moment /// in the sequence. /// >>> RollingMax([1, 2, 3, 2, 3, 4, 2]) /// [1, 2, 3, 3, 3, 4, 4] /// /// </summary> public static List<int> RollingMax (List<int> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = RollingMax(new List<int> {}); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = RollingMax(new List<int> {1,2,3,4}); var expected2 = new List<int> {1,2,3,4}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = RollingMax(new List<int> {4,3,2,1}); var expected3 = new List<int> {4,4,4,4}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = RollingMax(new List<int> {3,2,3,100,3}); var expected4 = new List<int> {3,3,3,100,100}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
RollingMax
null
From a given list of integers, generate a list of rolling maximum element found until given moment in the sequence. >>> rolling_max([1, 2, 3, 2, 3, 4, 2]) [1, 2, 3, 3, 3, 4, 4]
HumanEval_csharp/10
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Find the shortest palindrome that begins with a supplied string. /// Algorithm idea is simple: /// - Find the longest postfix of supplied string that is a palindrome. /// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. /// >>> MakePalindrome('') /// '' /// >>> MakePalindrome('cat') /// 'catac' /// >>> MakePalindrome('cata') /// 'catac' /// /// </summary> public static string MakePalindrome (string string0) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = MakePalindrome(""); var expected1 = ""; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = MakePalindrome("x"); var expected2 = "x"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = MakePalindrome("xyz"); var expected3 = "xyzyx"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = MakePalindrome("xyx"); var expected4 = "xyx"; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = MakePalindrome("jerry"); var expected5 = "jerryrrej"; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
MakePalindrome
null
Find the shortest palindrome that begins with a supplied string. Algorithm idea is simple: - Find the longest postfix of supplied string that is a palindrome. - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. >>> make_palindrome('') '' >>> make_palindrome('cat') 'catac' >>> make_palindrome('cata') 'catac'
HumanEval_csharp/11
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Input are two strings a and b consisting only of 1s and 0s. /// Perform binary XOR on these inputs and return result also as a string. /// >>> StringXor('010', '110') /// '100' /// /// </summary> public static string StringXor (string a, string b) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = StringXor("111000","101010"); var expected1 = "010010"; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = StringXor("1","1"); var expected2 = "0"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = StringXor("0101","0000"); var expected3 = "0101"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
StringXor
null
Input are two strings a and b consisting only of 1s and 0s. Perform binary XOR on these inputs and return result also as a string. >>> string_xor('010', '110') '100'
HumanEval_csharp/12
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Out of list of strings, return the Longest one. Return the first one in case of multiple /// strings of the same length. Return None in case the input list is empty. /// >>> Longest([]) /// /// >>> Longest(['a', 'b', 'c']) /// 'a' /// >>> Longest(['a', 'bb', 'ccc']) /// 'ccc' /// /// </summary> public static object Longest (List<string> strings) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Longest(new List<string> {}); var expected1 = null; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Longest(new List<string> {"x","y","z"}); var expected2 = "x"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Longest(new List<string> {"x","yyy","zzzz","www","kkkk","abc"}); var expected3 = "zzzz"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
Longest
null
Out of list of strings, return the longest one. Return the first one in case of multiple strings of the same length. Return None in case the input list is empty. >>> longest([]) >>> longest(['a', 'b', 'c']) 'a' >>> longest(['a', 'bb', 'ccc']) 'ccc'
HumanEval_csharp/13
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return a greatest common divisor of two integers a and b /// >>> GreatestCommonDivisor(3, 5) /// 1 /// >>> GreatestCommonDivisor(25, 15) /// 5 /// /// </summary> public static int GreatestCommonDivisor (int a, int b) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = GreatestCommonDivisor(3,7); var expected1 = 1; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = GreatestCommonDivisor(10,15); var expected2 = 5; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = GreatestCommonDivisor(49,14); var expected3 = 7; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = GreatestCommonDivisor(144,60); var expected4 = 12; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
GreatestCommonDivisor
null
Return a greatest common divisor of two integers a and b >>> greatest_common_divisor(3, 5) 1 >>> greatest_common_divisor(25, 15) 5
HumanEval_csharp/14
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return list of all prefixes from shortest to longest of the input string /// >>> AllPrefixes('abc') /// ['a', 'ab', 'abc'] /// /// </summary> public static List<string> AllPrefixes (string string0) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = AllPrefixes(""); var expected1 = new List<string> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = AllPrefixes("asdfgh"); var expected2 = new List<string> {"a","as","asd","asdf","asdfg","asdfgh"}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = AllPrefixes("WWW"); var expected3 = new List<string> {"W","WW","WWW"}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
AllPrefixes
null
Return list of all prefixes from shortest to longest of the input string >>> all_prefixes('abc') ['a', 'ab', 'abc']
HumanEval_csharp/15
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return a string containing space-delimited numbers starting from 0 upto n inclusive. /// >>> StringSequence(0) /// '0' /// >>> StringSequence(5) /// '0 1 2 3 4 5' /// /// </summary> public static string StringSequence (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = StringSequence(0); var expected1 = "0"; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = StringSequence(3); var expected2 = "0 1 2 3"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = StringSequence(10); var expected3 = "0 1 2 3 4 5 6 7 8 9 10"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
StringSequence
null
Return a string containing space-delimited numbers starting from 0 upto n inclusive. >>> string_sequence(0) '0' >>> string_sequence(5) '0 1 2 3 4 5'
HumanEval_csharp/16
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Given a string, find out how many distinct characters (regardless of case) does it consist of /// >>> CountDistinctCharacters('xyzXYZ') /// 3 /// >>> CountDistinctCharacters('Jerry') /// 4 /// /// </summary> public static int CountDistinctCharacters (string string0) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = CountDistinctCharacters(""); var expected1 = 0; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = CountDistinctCharacters("abcde"); var expected2 = 5; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = CountDistinctCharacters("abcdecadeCADE"); var expected3 = 5; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = CountDistinctCharacters("aaaaAAAAaaaa"); var expected4 = 1; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = CountDistinctCharacters("Jerry jERRY JeRRRY"); var expected5 = 5; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
CountDistinctCharacters
null
Given a string, find out how many distinct characters (regardless of case) does it consist of >>> count_distinct_characters('xyzXYZ') 3 >>> count_distinct_characters('Jerry') 4
HumanEval_csharp/17
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Input to this function is a string representing musical notes in a special ASCII format. /// Your task is to parse this string and return list of integers corresponding to how many beats does each /// not last. /// /// Here is a legend: /// 'o' - whole note, lasts four beats /// 'o|' - half note, lasts two beats /// '.|' - quater note, lasts one beat /// /// >>> ParseMusic('o o| .| o| o| .| .| .| .| o o') /// [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4] /// /// </summary> public static List<int> ParseMusic (string music_string) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = ParseMusic(""); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = ParseMusic("o o o o"); var expected2 = new List<int> {4,4,4,4}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = ParseMusic(".| .| .| .|"); var expected3 = new List<int> {1,1,1,1}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = ParseMusic("o| o| .| .| o o o o"); var expected4 = new List<int> {2,2,1,1,4,4,4,4}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = ParseMusic("o| .| o| .| o o| o o|"); var expected5 = new List<int> {2,1,2,1,4,2,4,2}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
ParseMusic
null
Input to this function is a string representing musical notes in a special ASCII format. Your task is to parse this string and return list of integers corresponding to how many beats does each not last. Here is a legend: 'o' - whole note, lasts four beats 'o|' - half note, lasts two beats '.|' - quater note, lasts one beat >>> parse_music('o o| .| o| o| .| .| .| .| o o') [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
HumanEval_csharp/18
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Find how many times a given substring can be found in the original string. Count overlaping cases. /// >>> HowManyTimes('', 'a') /// 0 /// >>> HowManyTimes('aaa', 'a') /// 3 /// >>> HowManyTimes('aaaa', 'aa') /// 3 /// /// </summary> public static int HowManyTimes (string string0, string substring) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = HowManyTimes("","x"); var expected1 = 0; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = HowManyTimes("xyxyxyx","x"); var expected2 = 4; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = HowManyTimes("cacacacac","cac"); var expected3 = 4; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = HowManyTimes("john doe","john"); var expected4 = 1; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
HowManyTimes
null
Find how many times a given substring can be found in the original string. Count overlaping cases. >>> how_many_times('', 'a') 0 >>> how_many_times('aaa', 'a') 3 >>> how_many_times('aaaa', 'aa') 3
HumanEval_csharp/19
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Input is a space-delimited string of numberals from 'zero' to 'nine'. /// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. /// Return the string with numbers sorted from smallest to largest /// >>> SortNumbers('three one five') /// 'one three five' /// /// </summary> public static string SortNumbers (string numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SortNumbers(""); var expected1 = ""; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SortNumbers("three"); var expected2 = "three"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SortNumbers("three five nine"); var expected3 = "three five nine"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SortNumbers("five zero four seven nine eight"); var expected4 = "zero four five seven eight nine"; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = SortNumbers("six five four three two one zero"); var expected5 = "zero one two three four five six"; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
SortNumbers
null
Input is a space-delimited string of numberals from 'zero' to 'nine'. Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. Return the string with numbers sorted from smallest to largest >>> sort_numbers('three one five') 'one three five'
HumanEval_csharp/20
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// From a supplied list of numbers (of length at least two) select and return two that are the closest to each /// other and return them in order (smaller number, larger number). /// >>> FindClosestElements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) /// (2.0, 2.2) /// >>> FindClosestElements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) /// (2.0, 2.0) /// /// </summary> public static List<double> FindClosestElements (List<double> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FindClosestElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2}); var expected1 = new List<double> {3.9,4.0}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FindClosestElements(new List<double> {1.0,2.0,5.9,4.0,5.0}); var expected2 = new List<double> {5.0,5.9}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FindClosestElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.2}); var expected3 = new List<double> {2.0,2.2}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = FindClosestElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.0}); var expected4 = new List<double> {2.0,2.0}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = FindClosestElements(new List<double> {1.1,2.2,3.1,4.1,5.1}); var expected5 = new List<double> {2.2,3.1}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
FindClosestElements
null
From a supplied list of numbers (of length at least two) select and return two that are the closest to each other and return them in order (smaller number, larger number). >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) (2.0, 2.2) >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) (2.0, 2.0)
HumanEval_csharp/21
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Given list of numbers (of at least two elements), apply a linear transform to that list, /// such that the smallest number will become 0 and the largest will become 1 /// >>> RescaleToUnit([1.0, 2.0, 3.0, 4.0, 5.0]) /// [0.0, 0.25, 0.5, 0.75, 1.0] /// /// </summary> public static List<double> RescaleToUnit (List<double> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = RescaleToUnit(new List<double> {2.0,49.9}); var expected1 = new List<double> {0.0,1.0}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = RescaleToUnit(new List<double> {100.0,49.9}); var expected2 = new List<double> {1.0,0.0}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = RescaleToUnit(new List<double> {1.0,2.0,3.0,4.0,5.0}); var expected3 = new List<double> {0.0,0.25,0.5,0.75,1.0}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = RescaleToUnit(new List<double> {2.0,1.0,5.0,3.0,4.0}); var expected4 = new List<double> {0.25,0.0,1.0,0.5,0.75}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = RescaleToUnit(new List<double> {12.0,11.0,15.0,13.0,14.0}); var expected5 = new List<double> {0.25,0.0,1.0,0.5,0.75}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
RescaleToUnit
null
Given list of numbers (of at least two elements), apply a linear transform to that list, such that the smallest number will become 0 and the largest will become 1 >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0]) [0.0, 0.25, 0.5, 0.75, 1.0]
HumanEval_csharp/22
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Filter given list of any python values only for integers /// >>> FilterIntegers(['a', 3.14, 5]) /// [5] /// >>> FilterIntegers([1, 2, 3, 'abc', {}, []]) /// [1, 2, 3] /// /// </summary> public static List<int> FilterIntegers (List<object> values) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FilterIntegers(new List<object> {}); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FilterIntegers(new List<object> {4,new object {},new List<object> {},23.2,9,"adasd"}); var expected2 = new List<int> {4,9}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FilterIntegers(new List<object> {3,"c",3,3,"a","b"}); var expected3 = new List<int> {3,3,3}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
FilterIntegers
null
Filter given list of any python values only for integers >>> filter_integers(['a', 3.14, 5]) [5] >>> filter_integers([1, 2, 3, 'abc', {}, []]) [1, 2, 3]
HumanEval_csharp/23
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return length of given string /// >>> Strlen('') /// 0 /// >>> Strlen('abc') /// 3 /// /// </summary> public static int Strlen (string string0) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Strlen(""); var expected1 = 0; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Strlen("x"); var expected2 = 1; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Strlen("asdasnakj"); var expected3 = 9; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
Strlen
null
Return length of given string >>> strlen('') 0 >>> strlen('abc') 3
HumanEval_csharp/24
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// For a given number n, find the largest number that divides n evenly, smaller than n /// >>> LargestDivisor(15) /// 5 /// /// </summary> public static int LargestDivisor (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = LargestDivisor(3); var expected1 = 1; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = LargestDivisor(7); var expected2 = 1; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = LargestDivisor(10); var expected3 = 5; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = LargestDivisor(100); var expected4 = 50; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = LargestDivisor(49); var expected5 = 7; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
LargestDivisor
null
For a given number n, find the largest number that divides n evenly, smaller than n >>> largest_divisor(15) 5
HumanEval_csharp/25
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return list of prime factors of given integer in the order from smallest to largest. /// Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. /// Input number should be equal to the product of all factors /// >>> Factorize(8) /// [2, 2, 2] /// >>> Factorize(25) /// [5, 5] /// >>> Factorize(70) /// [2, 5, 7] /// /// </summary> public static List<int> Factorize (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Factorize(2); var expected1 = new List<int> {2}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Factorize(4); var expected2 = new List<int> {2,2}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Factorize(8); var expected3 = new List<int> {2,2,2}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Factorize(57); var expected4 = new List<int> {3,19}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Factorize(3249); var expected5 = new List<int> {3,3,19,19}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Factorize(185193); var expected6 = new List<int> {3,3,3,19,19,19}; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Factorize(20577); var expected7 = new List<int> {3,19,19,19}; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = Factorize(18); var expected8 = new List<int> {2,3,3}; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} } } }
Factorize
null
Return list of prime factors of given integer in the order from smallest to largest. Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. Input number should be equal to the product of all factors >>> factorize(8) [2, 2, 2] >>> factorize(25) [5, 5] >>> factorize(70) [2, 5, 7]
HumanEval_csharp/26
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// From a list of integers, remove all elements that occur more than once. /// Keep order of elements left the same as in the input. /// >>> RemoveDuplicates([1, 2, 3, 2, 4]) /// [1, 3, 4] /// /// </summary> public static List<int> RemoveDuplicates (List<int> numbers) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = RemoveDuplicates(new List<int> {}); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = RemoveDuplicates(new List<int> {1,2,3,4}); var expected2 = new List<int> {1,2,3,4}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = RemoveDuplicates(new List<int> {1,2,3,2,4,3,5}); var expected3 = new List<int> {1,4,5}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
RemoveDuplicates
null
From a list of integers, remove all elements that occur more than once. Keep order of elements left the same as in the input. >>> remove_duplicates([1, 2, 3, 2, 4]) [1, 3, 4]
HumanEval_csharp/27
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// For a given string, flip lowercase characters to uppercase and uppercase to lowercase. /// >>> FlipCase('Hello') /// 'hELLO' /// /// </summary> public static string FlipCase (string string0) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FlipCase(""); var expected1 = ""; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FlipCase("Hello!"); var expected2 = "hELLO!"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FlipCase("These violent delights have violent ends"); var expected3 = "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
FlipCase
null
For a given string, flip lowercase characters to uppercase and uppercase to lowercase. >>> flip_case('Hello') 'hELLO'
HumanEval_csharp/28
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Concatenate list of strings into a single string /// >>> Concatenate([]) /// '' /// >>> Concatenate(['a', 'b', 'c']) /// 'abc' /// /// </summary> public static string Concatenate (List<string> strings) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Concatenate(new List<string> {}); var expected1 = ""; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Concatenate(new List<string> {"x","y","z"}); var expected2 = "xyz"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Concatenate(new List<string> {"x","y","z","w","k"}); var expected3 = "xyzwk"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
Concatenate
null
Concatenate list of strings into a single string >>> concatenate([]) '' >>> concatenate(['a', 'b', 'c']) 'abc'
HumanEval_csharp/29
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Filter an input list of strings only for ones that start with a given prefix. /// >>> FilterByPrefix([], 'a') /// [] /// >>> FilterByPrefix(['abc', 'bcd', 'cde', 'array'], 'a') /// ['abc', 'array'] /// /// </summary> public static List<string> FilterByPrefix (List<string> strings, string prefix) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FilterByPrefix(new List<string> {},"john"); var expected1 = new List<string> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FilterByPrefix(new List<string> {"xxx","asd","xxy","john doe","xxxAAA","xxx"},"xxx"); var expected2 = new List<string> {"xxx","xxxAAA","xxx"}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} } } }
FilterByPrefix
null
Filter an input list of strings only for ones that start with a given prefix. >>> filter_by_prefix([], 'a') [] >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a') ['abc', 'array']
HumanEval_csharp/30
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return only positive numbers in the list. /// >>> GetPositive([-1, 2, -4, 5, 6]) /// [2, 5, 6] /// >>> GetPositive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) /// [5, 3, 2, 3, 9, 123, 1] /// /// </summary> public static List<int> GetPositive (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = GetPositive(new List<int> {-1,-2,4,5,6}); var expected1 = new List<int> {4,5,6}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = GetPositive(new List<int> {5,3,-5,2,3,3,9,0,123,1,-10}); var expected2 = new List<int> {5,3,2,3,3,9,123,1}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = GetPositive(new List<int> {-1,-2}); var expected3 = new List<int> {}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = GetPositive(new List<int> {}); var expected4 = new List<int> {}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
GetPositive
null
Return only positive numbers in the list. >>> get_positive([-1, 2, -4, 5, 6]) [2, 5, 6] >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) [5, 3, 2, 3, 9, 123, 1]
HumanEval_csharp/31
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return true if a given number is prime, and false otherwise. /// >>> IsPrime(6) /// False /// >>> IsPrime(101) /// True /// >>> IsPrime(11) /// True /// >>> IsPrime(13441) /// True /// >>> IsPrime(61) /// True /// >>> IsPrime(4) /// False /// >>> IsPrime(1) /// False /// /// </summary> public static bool IsPrime (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = IsPrime(6); var expected1 = false; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = IsPrime(101); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = IsPrime(11); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = IsPrime(13441); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = IsPrime(61); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = IsPrime(4); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = IsPrime(1); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = IsPrime(5); var expected8 = true; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = IsPrime(11); var expected9 = true; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = IsPrime(17); var expected10 = true; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} var actual11 = IsPrime(85); var expected11 = false; var result11 = compareLogic.Compare(actual11, expected11); if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");} var actual12 = IsPrime(77); var expected12 = false; var result12 = compareLogic.Compare(actual12, expected12); if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");} var actual13 = IsPrime(255379); var expected13 = false; var result13 = compareLogic.Compare(actual13, expected13); if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");} } } }
IsPrime
null
Return true if a given number is prime, and false otherwise. >>> is_prime(6) False >>> is_prime(101) True >>> is_prime(11) True >>> is_prime(13441) True >>> is_prime(61) True >>> is_prime(4) False >>> is_prime(1) False
HumanEval_csharp/33
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// This function takes a list l and returns a list l' such that /// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal /// to the values of the corresponding indicies of l, but sorted. /// >>> SortThird([1, 2, 3]) /// [1, 2, 3] /// >>> SortThird([5, 6, 3, 4, 8, 9, 2]) /// [2, 6, 3, 4, 8, 9, 5] /// /// </summary> public static List<int> SortThird (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SortThird(new List<int> {1,2,3}); var expected1 = new List<int> {1,2,3}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SortThird(new List<int> {5,3,-5,2,-3,3,9,0,123,1,-10}); var expected2 = new List<int> {1,3,-5,2,-3,3,5,0,123,9,-10}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SortThird(new List<int> {5,8,-12,4,23,2,3,11,12,-10}); var expected3 = new List<int> {-10,8,-12,3,23,2,4,11,12,5}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SortThird(new List<int> {5,6,3,4,8,9,2}); var expected4 = new List<int> {2,6,3,4,8,9,5}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = SortThird(new List<int> {5,8,3,4,6,9,2}); var expected5 = new List<int> {2,8,3,4,6,9,5}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = SortThird(new List<int> {5,6,9,4,8,3,2}); var expected6 = new List<int> {2,6,9,4,8,3,5}; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = SortThird(new List<int> {5,6,3,4,8,9,2,1}); var expected7 = new List<int> {2,6,3,4,8,9,5,1}; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
SortThird
null
This function takes a list l and returns a list l' such that l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal to the values of the corresponding indicies of l, but sorted. >>> sort_third([1, 2, 3]) [1, 2, 3] >>> sort_third([5, 6, 3, 4, 8, 9, 2]) [2, 6, 3, 4, 8, 9, 5]
HumanEval_csharp/34
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return sorted Unique elements in a list /// >>> Unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) /// [0, 2, 3, 5, 9, 123] /// /// </summary> public static List<int> Unique (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Unique(new List<int> {5,3,5,2,3,3,9,0,123}); var expected1 = new List<int> {0,2,3,5,9,123}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} } } }
Unique
null
Return sorted unique elements in a list >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) [0, 2, 3, 5, 9, 123]
HumanEval_csharp/35
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return maximum element in the list. /// >>> MaxElement([1, 2, 3]) /// 3 /// >>> MaxElement([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) /// 123 /// /// </summary> public static int MaxElement (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = MaxElement(new List<int> {1,2,3}); var expected1 = 3; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = MaxElement(new List<int> {5,3,-5,2,-3,3,9,0,124,1,-10}); var expected2 = 124; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} } } }
MaxElement
null
Return maximum element in the list. >>> max_element([1, 2, 3]) 3 >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) 123
HumanEval_csharp/36
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. /// >>> FizzBuzz(50) /// 0 /// >>> FizzBuzz(78) /// 2 /// >>> FizzBuzz(79) /// 3 /// /// </summary> public static int FizzBuzz (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FizzBuzz(50); var expected1 = 0; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FizzBuzz(78); var expected2 = 2; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FizzBuzz(79); var expected3 = 3; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = FizzBuzz(100); var expected4 = 3; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = FizzBuzz(200); var expected5 = 6; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = FizzBuzz(4000); var expected6 = 192; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = FizzBuzz(10000); var expected7 = 639; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = FizzBuzz(100000); var expected8 = 8026; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} } } }
FizzBuzz
null
Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. >>> fizz_buzz(50) 0 >>> fizz_buzz(78) 2 >>> fizz_buzz(79) 3
HumanEval_csharp/37
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// This function takes a list l and returns a list l' such that /// l' is identical to l in the odd indicies, while its values at the even indicies are equal /// to the values of the even indicies of l, but sorted. /// >>> SortEven([1, 2, 3]) /// [1, 2, 3] /// >>> SortEven([5, 6, 3, 4]) /// [3, 6, 5, 4] /// /// </summary> public static List<int> SortEven (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SortEven(new List<int> {1,2,3}); var expected1 = new List<int> {1,2,3}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SortEven(new List<int> {5,3,-5,2,-3,3,9,0,123,1,-10}); var expected2 = new List<int> {-10,3,-5,2,-3,3,5,0,9,1,123}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SortEven(new List<int> {5,8,-12,4,23,2,3,11,12,-10}); var expected3 = new List<int> {-12,8,3,4,5,2,12,11,23,-10}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
SortEven
null
This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4]
HumanEval_csharp/39
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// PrimeFib returns n-th number that is a Fibonacci number and it's also prime. /// >>> PrimeFib(1) /// 2 /// >>> PrimeFib(2) /// 3 /// >>> PrimeFib(3) /// 5 /// >>> PrimeFib(4) /// 13 /// >>> PrimeFib(5) /// 89 /// /// </summary> public static int PrimeFib (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = PrimeFib(1); var expected1 = 2; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = PrimeFib(2); var expected2 = 3; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = PrimeFib(3); var expected3 = 5; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = PrimeFib(4); var expected4 = 13; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = PrimeFib(5); var expected5 = 89; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = PrimeFib(6); var expected6 = 233; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = PrimeFib(7); var expected7 = 1597; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = PrimeFib(8); var expected8 = 28657; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = PrimeFib(9); var expected9 = 514229; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = PrimeFib(10); var expected10 = 433494437; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} } } }
PrimeFib
null
prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89
HumanEval_csharp/40
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// TriplesSumToZero takes a list of integers as an input. /// it returns True if there are three distinct elements in the list that /// sum to zero, and False otherwise. /// /// >>> TriplesSumToZero([1, 3, 5, 0]) /// False /// >>> TriplesSumToZero([1, 3, -2, 1]) /// True /// >>> TriplesSumToZero([1, 2, 3, 7]) /// False /// >>> TriplesSumToZero([2, 4, -5, 3, 9, 7]) /// True /// >>> TriplesSumToZero([1]) /// False /// /// </summary> public static bool TriplesSumToZero (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = TriplesSumToZero(new List<int> {1,3,5,0}); var expected1 = false; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = TriplesSumToZero(new List<int> {1,3,5,-1}); var expected2 = false; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = TriplesSumToZero(new List<int> {1,3,-2,1}); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = TriplesSumToZero(new List<int> {1,2,3,7}); var expected4 = false; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = TriplesSumToZero(new List<int> {1,2,5,7}); var expected5 = false; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = TriplesSumToZero(new List<int> {2,4,-5,3,9,7}); var expected6 = true; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = TriplesSumToZero(new List<int> {1}); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = TriplesSumToZero(new List<int> {1,3,5,-100}); var expected8 = false; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = TriplesSumToZero(new List<int> {100,3,5,-100}); var expected9 = false; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} } } }
TriplesSumToZero
null
triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False
HumanEval_csharp/41
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// Imagine a road that's a perfectly straight infinitely long line. /// n cars are driving left to right; simultaneously, a different set of n cars /// are driving right to left. The two sets of cars start out being very far from /// each other. All cars move in the same speed. Two cars are said to collide /// when a car that's moving left to right hits a car that's moving right to left. /// However, the cars are infinitely sturdy and strong; as a result, they continue moving /// in their trajectory as if they did not collide. /// /// This function outputs the number of such collisions. /// /// </summary> public static int CarRaceCollision (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = CarRaceCollision(2); var expected1 = 4; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = CarRaceCollision(3); var expected2 = 9; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = CarRaceCollision(4); var expected3 = 16; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = CarRaceCollision(8); var expected4 = 64; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = CarRaceCollision(10); var expected5 = 100; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
CarRaceCollision
null
Imagine a road that's a perfectly straight infinitely long line. n cars are driving left to right; simultaneously, a different set of n cars are driving right to left. The two sets of cars start out being very far from each other. All cars move in the same speed. Two cars are said to collide when a car that's moving left to right hits a car that's moving right to left. However, the cars are infinitely sturdy and strong; as a result, they continue moving in their trajectory as if they did not collide. This function outputs the number of such collisions.
HumanEval_csharp/42
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return list with elements incremented by 1. /// >>> IncrList([1, 2, 3]) /// [2, 3, 4] /// >>> IncrList([5, 3, 5, 2, 3, 3, 9, 0, 123]) /// [6, 4, 6, 3, 4, 4, 10, 1, 124] /// /// </summary> public static List<int> IncrList (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = IncrList(new List<int> {}); var expected1 = new List<int> {}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = IncrList(new List<int> {3,2,1}); var expected2 = new List<int> {4,3,2}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = IncrList(new List<int> {5,2,5,2,3,3,9,0,123}); var expected3 = new List<int> {6,3,6,3,4,4,10,1,124}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
IncrList
null
Return list with elements incremented by 1. >>> incr_list([1, 2, 3]) [2, 3, 4] >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) [6, 4, 6, 3, 4, 4, 10, 1, 124]
HumanEval_csharp/43
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// PairsSumToZero takes a list of integers as an input. /// it returns True if there are two distinct elements in the list that /// sum to zero, and False otherwise. /// >>> PairsSumToZero([1, 3, 5, 0]) /// False /// >>> PairsSumToZero([1, 3, -2, 1]) /// False /// >>> PairsSumToZero([1, 2, 3, 7]) /// False /// >>> PairsSumToZero([2, 4, -5, 3, 5, 7]) /// True /// >>> PairsSumToZero([1]) /// False /// /// </summary> public static bool PairsSumToZero (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = PairsSumToZero(new List<int> {1,3,5,0}); var expected1 = false; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = PairsSumToZero(new List<int> {1,3,-2,1}); var expected2 = false; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = PairsSumToZero(new List<int> {1,2,3,7}); var expected3 = false; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = PairsSumToZero(new List<int> {2,4,-5,3,5,7}); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = PairsSumToZero(new List<int> {1}); var expected5 = false; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = PairsSumToZero(new List<int> {-3,9,-1,3,2,30}); var expected6 = true; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = PairsSumToZero(new List<int> {-3,9,-1,3,2,31}); var expected7 = true; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = PairsSumToZero(new List<int> {-3,9,-1,4,2,30}); var expected8 = false; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = PairsSumToZero(new List<int> {-3,9,-1,4,2,31}); var expected9 = false; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} } } }
PairsSumToZero
null
pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False
HumanEval_csharp/44
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Change numerical base of input number x to base. /// return string representation after the conversion. /// base numbers are less than 10. /// >>> ChangeBase(8, 3) /// '22' /// >>> ChangeBase(8, 2) /// '1000' /// >>> ChangeBase(7, 2) /// '111' /// /// </summary> public static string ChangeBase (int x, int base) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = ChangeBase(8,3); var expected1 = "22"; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = ChangeBase(9,3); var expected2 = "100"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = ChangeBase(234,2); var expected3 = "11101010"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = ChangeBase(16,2); var expected4 = "10000"; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = ChangeBase(8,2); var expected5 = "1000"; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = ChangeBase(7,2); var expected6 = "111"; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = ChangeBase(2,3); var expected7 = "2"; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = ChangeBase(3,4); var expected8 = "3"; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = ChangeBase(4,5); var expected9 = "4"; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = ChangeBase(5,6); var expected10 = "5"; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} var actual11 = ChangeBase(6,7); var expected11 = "6"; var result11 = compareLogic.Compare(actual11, expected11); if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");} var actual12 = ChangeBase(7,8); var expected12 = "7"; var result12 = compareLogic.Compare(actual12, expected12); if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");} } } }
ChangeBase
null
Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111'
HumanEval_csharp/45
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Given length of a side and high return area for a triangle. /// >>> TriangleArea(5, 3) /// 7.5 /// /// </summary> public static double TriangleArea (int a, int h) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = TriangleArea(5,3); var expected1 = 7.5; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = TriangleArea(2,2); var expected2 = 2.0; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = TriangleArea(10,8); var expected3 = 40.0; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} } } }
TriangleArea
null
Given length of a side and high return area for a triangle. >>> triangle_area(5, 3) 7.5
HumanEval_csharp/46
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: /// Fib4(0) -> 0 /// Fib4(1) -> 0 /// Fib4(2) -> 2 /// Fib4(3) -> 0 /// Fib4(n) -> Fib4(n-1) + Fib4(n-2) + Fib4(n-3) + Fib4(n-4). /// Please write a function to efficiently compute the n-th element of the Fib4 number sequence. Do not use recursion. /// >>> Fib4(5) /// 4 /// >>> Fib4(6) /// 8 /// >>> Fib4(7) /// 14 /// /// </summary> public static int Fib4 (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Fib4(5); var expected1 = 4; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Fib4(8); var expected2 = 28; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Fib4(10); var expected3 = 104; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Fib4(12); var expected4 = 386; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
Fib4
null
The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fib4(2) -> 2 fib4(3) -> 0 fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. >>> fib4(5) 4 >>> fib4(6) 8 >>> fib4(7) 14
HumanEval_csharp/47
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return Median of elements in the list l. /// >>> Median([3, 1, 2, 4, 5]) /// 3 /// >>> Median([-10, 4, 6, 1000, 10, 20]) /// 15.0 /// /// </summary> public static object Median (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Median(new List<int> {3,1,2,4,5}); var expected1 = 3; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Median(new List<int> {-10,4,6,1000,10,20}); var expected2 = 8.0; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Median(new List<int> {5}); var expected3 = 5; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Median(new List<int> {6,5}); var expected4 = 5.5; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Median(new List<int> {8,1,3,9,9,2,7}); var expected5 = 7; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
Median
null
Return median of elements in the list l. >>> median([3, 1, 2, 4, 5]) 3 >>> median([-10, 4, 6, 1000, 10, 20]) 15.0
HumanEval_csharp/48
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// Checks if given string is a palindrome /// >>> IsPalindrome('') /// True /// >>> IsPalindrome('aba') /// True /// >>> IsPalindrome('aaaaa') /// True /// >>> IsPalindrome('zbcd') /// False /// /// </summary> public static bool IsPalindrome (string text) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = IsPalindrome(""); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = IsPalindrome("aba"); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = IsPalindrome("aaaaa"); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = IsPalindrome("zbcd"); var expected4 = false; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = IsPalindrome("xywyx"); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = IsPalindrome("xywyz"); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = IsPalindrome("xywzx"); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
IsPalindrome
null
Checks if given string is a palindrome >>> is_palindrome('') True >>> is_palindrome('aba') True >>> is_palindrome('aaaaa') True >>> is_palindrome('zbcd') False
HumanEval_csharp/49
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return 2^n modulo p (be aware of numerics). /// >>> Modp(3, 5) /// 3 /// >>> Modp(1101, 101) /// 2 /// >>> Modp(0, 101) /// 1 /// >>> Modp(3, 11) /// 8 /// >>> Modp(100, 101) /// 1 /// /// </summary> public static int Modp (int n, int p) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Modp(3,5); var expected1 = 3; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Modp(1101,101); var expected2 = 2; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Modp(0,101); var expected3 = 1; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Modp(3,11); var expected4 = 8; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Modp(100,101); var expected5 = 1; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Modp(30,5); var expected6 = 4; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Modp(31,5); var expected7 = 3; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
Modp
null
Return 2^n modulo p (be aware of numerics). >>> modp(3, 5) 3 >>> modp(1101, 101) 2 >>> modp(0, 101) 1 >>> modp(3, 11) 8 >>> modp(100, 101) 1
HumanEval_csharp/51
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// RemoveVowels is a function that takes string and returns string without vowels. /// >>> RemoveVowels('') /// '' /// >>> RemoveVowels("abcdef\nghijklm") /// 'bcdf\nghjklm' /// >>> RemoveVowels('abcdef') /// 'bcdf' /// >>> RemoveVowels('aaaaa') /// '' /// >>> RemoveVowels('aaBAA') /// 'B' /// >>> RemoveVowels('zbcd') /// 'zbcd' /// /// </summary> public static string RemoveVowels (string text) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = RemoveVowels(""); var expected1 = ""; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = RemoveVowels("abcdef\nghijklm"); var expected2 = "bcdf\nghjklm"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = RemoveVowels("fedcba"); var expected3 = "fdcb"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = RemoveVowels("eeeee"); var expected4 = ""; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = RemoveVowels("acBAA"); var expected5 = "cB"; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = RemoveVowels("EcBOO"); var expected6 = "cB"; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = RemoveVowels("ybcd"); var expected7 = "ybcd"; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
RemoveVowels
null
remove_vowels is a function that takes string and returns string without vowels. >>> remove_vowels('') '' >>> remove_vowels("abcdef\nghijklm") 'bcdf\nghjklm' >>> remove_vowels('abcdef') 'bcdf' >>> remove_vowels('aaaaa') '' >>> remove_vowels('aaBAA') 'B' >>> remove_vowels('zbcd') 'zbcd'
HumanEval_csharp/52
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return True if all numbers in the list l are below threshold t. /// >>> BelowThreshold([1, 2, 4, 10], 100) /// True /// >>> BelowThreshold([1, 20, 4, 10], 5) /// False /// /// </summary> public static bool BelowThreshold (List<int> l, int t) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = BelowThreshold(new List<int> {1,2,4,10},100); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = BelowThreshold(new List<int> {1,20,4,10},5); var expected2 = false; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = BelowThreshold(new List<int> {1,20,4,10},21); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = BelowThreshold(new List<int> {1,20,4,10},22); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = BelowThreshold(new List<int> {1,8,4,10},11); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = BelowThreshold(new List<int> {1,8,4,10},10); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} } } }
BelowThreshold
null
Return True if all numbers in the list l are below threshold t. >>> below_threshold([1, 2, 4, 10], 100) True >>> below_threshold([1, 20, 4, 10], 5) False
HumanEval_csharp/53
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Add two numbers x and y /// >>> Add(2, 3) /// 5 /// >>> Add(5, 7) /// 12 /// /// </summary> public static int Add (int x, int y) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Add(0,1); var expected1 = 1; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Add(1,0); var expected2 = 1; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Add(2,3); var expected3 = 5; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Add(5,7); var expected4 = 12; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Add(7,5); var expected5 = 12; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Add(572,725); var expected6 = 1297; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Add(51,804); var expected7 = 855; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = Add(645,96); var expected8 = 741; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = Add(712,853); var expected9 = 1565; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = Add(223,101); var expected10 = 324; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} var actual11 = Add(76,29); var expected11 = 105; var result11 = compareLogic.Compare(actual11, expected11); if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");} var actual12 = Add(416,149); var expected12 = 565; var result12 = compareLogic.Compare(actual12, expected12); if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");} var actual13 = Add(145,409); var expected13 = 554; var result13 = compareLogic.Compare(actual13, expected13); if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");} var actual14 = Add(535,430); var expected14 = 965; var result14 = compareLogic.Compare(actual14, expected14); if (!result14.AreEqual) {throw new Exception("Exception --- test case 13 failed to pass");} var actual15 = Add(118,303); var expected15 = 421; var result15 = compareLogic.Compare(actual15, expected15); if (!result15.AreEqual) {throw new Exception("Exception --- test case 14 failed to pass");} var actual16 = Add(287,94); var expected16 = 381; var result16 = compareLogic.Compare(actual16, expected16); if (!result16.AreEqual) {throw new Exception("Exception --- test case 15 failed to pass");} var actual17 = Add(768,257); var expected17 = 1025; var result17 = compareLogic.Compare(actual17, expected17); if (!result17.AreEqual) {throw new Exception("Exception --- test case 16 failed to pass");} var actual18 = Add(421,677); var expected18 = 1098; var result18 = compareLogic.Compare(actual18, expected18); if (!result18.AreEqual) {throw new Exception("Exception --- test case 17 failed to pass");} var actual19 = Add(802,814); var expected19 = 1616; var result19 = compareLogic.Compare(actual19, expected19); if (!result19.AreEqual) {throw new Exception("Exception --- test case 18 failed to pass");} var actual20 = Add(510,922); var expected20 = 1432; var result20 = compareLogic.Compare(actual20, expected20); if (!result20.AreEqual) {throw new Exception("Exception --- test case 19 failed to pass");} var actual21 = Add(345,819); var expected21 = 1164; var result21 = compareLogic.Compare(actual21, expected21); if (!result21.AreEqual) {throw new Exception("Exception --- test case 20 failed to pass");} var actual22 = Add(895,436); var expected22 = 1331; var result22 = compareLogic.Compare(actual22, expected22); if (!result22.AreEqual) {throw new Exception("Exception --- test case 21 failed to pass");} var actual23 = Add(123,424); var expected23 = 547; var result23 = compareLogic.Compare(actual23, expected23); if (!result23.AreEqual) {throw new Exception("Exception --- test case 22 failed to pass");} var actual24 = Add(923,245); var expected24 = 1168; var result24 = compareLogic.Compare(actual24, expected24); if (!result24.AreEqual) {throw new Exception("Exception --- test case 23 failed to pass");} var actual25 = Add(23,438); var expected25 = 461; var result25 = compareLogic.Compare(actual25, expected25); if (!result25.AreEqual) {throw new Exception("Exception --- test case 24 failed to pass");} var actual26 = Add(565,133); var expected26 = 698; var result26 = compareLogic.Compare(actual26, expected26); if (!result26.AreEqual) {throw new Exception("Exception --- test case 25 failed to pass");} var actual27 = Add(945,925); var expected27 = 1870; var result27 = compareLogic.Compare(actual27, expected27); if (!result27.AreEqual) {throw new Exception("Exception --- test case 26 failed to pass");} var actual28 = Add(261,983); var expected28 = 1244; var result28 = compareLogic.Compare(actual28, expected28); if (!result28.AreEqual) {throw new Exception("Exception --- test case 27 failed to pass");} var actual29 = Add(139,577); var expected29 = 716; var result29 = compareLogic.Compare(actual29, expected29); if (!result29.AreEqual) {throw new Exception("Exception --- test case 28 failed to pass");} var actual30 = Add(763,178); var expected30 = 941; var result30 = compareLogic.Compare(actual30, expected30); if (!result30.AreEqual) {throw new Exception("Exception --- test case 29 failed to pass");} var actual31 = Add(147,892); var expected31 = 1039; var result31 = compareLogic.Compare(actual31, expected31); if (!result31.AreEqual) {throw new Exception("Exception --- test case 30 failed to pass");} var actual32 = Add(436,402); var expected32 = 838; var result32 = compareLogic.Compare(actual32, expected32); if (!result32.AreEqual) {throw new Exception("Exception --- test case 31 failed to pass");} var actual33 = Add(610,581); var expected33 = 1191; var result33 = compareLogic.Compare(actual33, expected33); if (!result33.AreEqual) {throw new Exception("Exception --- test case 32 failed to pass");} var actual34 = Add(103,416); var expected34 = 519; var result34 = compareLogic.Compare(actual34, expected34); if (!result34.AreEqual) {throw new Exception("Exception --- test case 33 failed to pass");} var actual35 = Add(339,990); var expected35 = 1329; var result35 = compareLogic.Compare(actual35, expected35); if (!result35.AreEqual) {throw new Exception("Exception --- test case 34 failed to pass");} var actual36 = Add(130,504); var expected36 = 634; var result36 = compareLogic.Compare(actual36, expected36); if (!result36.AreEqual) {throw new Exception("Exception --- test case 35 failed to pass");} var actual37 = Add(242,717); var expected37 = 959; var result37 = compareLogic.Compare(actual37, expected37); if (!result37.AreEqual) {throw new Exception("Exception --- test case 36 failed to pass");} var actual38 = Add(562,110); var expected38 = 672; var result38 = compareLogic.Compare(actual38, expected38); if (!result38.AreEqual) {throw new Exception("Exception --- test case 37 failed to pass");} var actual39 = Add(396,909); var expected39 = 1305; var result39 = compareLogic.Compare(actual39, expected39); if (!result39.AreEqual) {throw new Exception("Exception --- test case 38 failed to pass");} var actual40 = Add(887,703); var expected40 = 1590; var result40 = compareLogic.Compare(actual40, expected40); if (!result40.AreEqual) {throw new Exception("Exception --- test case 39 failed to pass");} var actual41 = Add(870,551); var expected41 = 1421; var result41 = compareLogic.Compare(actual41, expected41); if (!result41.AreEqual) {throw new Exception("Exception --- test case 40 failed to pass");} var actual42 = Add(422,391); var expected42 = 813; var result42 = compareLogic.Compare(actual42, expected42); if (!result42.AreEqual) {throw new Exception("Exception --- test case 41 failed to pass");} var actual43 = Add(299,505); var expected43 = 804; var result43 = compareLogic.Compare(actual43, expected43); if (!result43.AreEqual) {throw new Exception("Exception --- test case 42 failed to pass");} var actual44 = Add(346,56); var expected44 = 402; var result44 = compareLogic.Compare(actual44, expected44); if (!result44.AreEqual) {throw new Exception("Exception --- test case 43 failed to pass");} var actual45 = Add(36,706); var expected45 = 742; var result45 = compareLogic.Compare(actual45, expected45); if (!result45.AreEqual) {throw new Exception("Exception --- test case 44 failed to pass");} var actual46 = Add(738,411); var expected46 = 1149; var result46 = compareLogic.Compare(actual46, expected46); if (!result46.AreEqual) {throw new Exception("Exception --- test case 45 failed to pass");} var actual47 = Add(679,87); var expected47 = 766; var result47 = compareLogic.Compare(actual47, expected47); if (!result47.AreEqual) {throw new Exception("Exception --- test case 46 failed to pass");} var actual48 = Add(25,303); var expected48 = 328; var result48 = compareLogic.Compare(actual48, expected48); if (!result48.AreEqual) {throw new Exception("Exception --- test case 47 failed to pass");} var actual49 = Add(161,612); var expected49 = 773; var result49 = compareLogic.Compare(actual49, expected49); if (!result49.AreEqual) {throw new Exception("Exception --- test case 48 failed to pass");} var actual50 = Add(306,841); var expected50 = 1147; var result50 = compareLogic.Compare(actual50, expected50); if (!result50.AreEqual) {throw new Exception("Exception --- test case 49 failed to pass");} var actual51 = Add(973,411); var expected51 = 1384; var result51 = compareLogic.Compare(actual51, expected51); if (!result51.AreEqual) {throw new Exception("Exception --- test case 50 failed to pass");} var actual52 = Add(711,157); var expected52 = 868; var result52 = compareLogic.Compare(actual52, expected52); if (!result52.AreEqual) {throw new Exception("Exception --- test case 51 failed to pass");} var actual53 = Add(471,27); var expected53 = 498; var result53 = compareLogic.Compare(actual53, expected53); if (!result53.AreEqual) {throw new Exception("Exception --- test case 52 failed to pass");} var actual54 = Add(714,792); var expected54 = 1506; var result54 = compareLogic.Compare(actual54, expected54); if (!result54.AreEqual) {throw new Exception("Exception --- test case 53 failed to pass");} var actual55 = Add(38,206); var expected55 = 244; var result55 = compareLogic.Compare(actual55, expected55); if (!result55.AreEqual) {throw new Exception("Exception --- test case 54 failed to pass");} var actual56 = Add(907,343); var expected56 = 1250; var result56 = compareLogic.Compare(actual56, expected56); if (!result56.AreEqual) {throw new Exception("Exception --- test case 55 failed to pass");} var actual57 = Add(23,760); var expected57 = 783; var result57 = compareLogic.Compare(actual57, expected57); if (!result57.AreEqual) {throw new Exception("Exception --- test case 56 failed to pass");} var actual58 = Add(524,859); var expected58 = 1383; var result58 = compareLogic.Compare(actual58, expected58); if (!result58.AreEqual) {throw new Exception("Exception --- test case 57 failed to pass");} var actual59 = Add(30,529); var expected59 = 559; var result59 = compareLogic.Compare(actual59, expected59); if (!result59.AreEqual) {throw new Exception("Exception --- test case 58 failed to pass");} var actual60 = Add(341,691); var expected60 = 1032; var result60 = compareLogic.Compare(actual60, expected60); if (!result60.AreEqual) {throw new Exception("Exception --- test case 59 failed to pass");} var actual61 = Add(167,729); var expected61 = 896; var result61 = compareLogic.Compare(actual61, expected61); if (!result61.AreEqual) {throw new Exception("Exception --- test case 60 failed to pass");} var actual62 = Add(636,289); var expected62 = 925; var result62 = compareLogic.Compare(actual62, expected62); if (!result62.AreEqual) {throw new Exception("Exception --- test case 61 failed to pass");} var actual63 = Add(503,144); var expected63 = 647; var result63 = compareLogic.Compare(actual63, expected63); if (!result63.AreEqual) {throw new Exception("Exception --- test case 62 failed to pass");} var actual64 = Add(51,985); var expected64 = 1036; var result64 = compareLogic.Compare(actual64, expected64); if (!result64.AreEqual) {throw new Exception("Exception --- test case 63 failed to pass");} var actual65 = Add(287,149); var expected65 = 436; var result65 = compareLogic.Compare(actual65, expected65); if (!result65.AreEqual) {throw new Exception("Exception --- test case 64 failed to pass");} var actual66 = Add(659,75); var expected66 = 734; var result66 = compareLogic.Compare(actual66, expected66); if (!result66.AreEqual) {throw new Exception("Exception --- test case 65 failed to pass");} var actual67 = Add(462,797); var expected67 = 1259; var result67 = compareLogic.Compare(actual67, expected67); if (!result67.AreEqual) {throw new Exception("Exception --- test case 66 failed to pass");} var actual68 = Add(406,141); var expected68 = 547; var result68 = compareLogic.Compare(actual68, expected68); if (!result68.AreEqual) {throw new Exception("Exception --- test case 67 failed to pass");} var actual69 = Add(106,44); var expected69 = 150; var result69 = compareLogic.Compare(actual69, expected69); if (!result69.AreEqual) {throw new Exception("Exception --- test case 68 failed to pass");} var actual70 = Add(300,934); var expected70 = 1234; var result70 = compareLogic.Compare(actual70, expected70); if (!result70.AreEqual) {throw new Exception("Exception --- test case 69 failed to pass");} var actual71 = Add(471,524); var expected71 = 995; var result71 = compareLogic.Compare(actual71, expected71); if (!result71.AreEqual) {throw new Exception("Exception --- test case 70 failed to pass");} var actual72 = Add(122,429); var expected72 = 551; var result72 = compareLogic.Compare(actual72, expected72); if (!result72.AreEqual) {throw new Exception("Exception --- test case 71 failed to pass");} var actual73 = Add(735,195); var expected73 = 930; var result73 = compareLogic.Compare(actual73, expected73); if (!result73.AreEqual) {throw new Exception("Exception --- test case 72 failed to pass");} var actual74 = Add(335,484); var expected74 = 819; var result74 = compareLogic.Compare(actual74, expected74); if (!result74.AreEqual) {throw new Exception("Exception --- test case 73 failed to pass");} var actual75 = Add(28,809); var expected75 = 837; var result75 = compareLogic.Compare(actual75, expected75); if (!result75.AreEqual) {throw new Exception("Exception --- test case 74 failed to pass");} var actual76 = Add(430,20); var expected76 = 450; var result76 = compareLogic.Compare(actual76, expected76); if (!result76.AreEqual) {throw new Exception("Exception --- test case 75 failed to pass");} var actual77 = Add(916,635); var expected77 = 1551; var result77 = compareLogic.Compare(actual77, expected77); if (!result77.AreEqual) {throw new Exception("Exception --- test case 76 failed to pass");} var actual78 = Add(301,999); var expected78 = 1300; var result78 = compareLogic.Compare(actual78, expected78); if (!result78.AreEqual) {throw new Exception("Exception --- test case 77 failed to pass");} var actual79 = Add(454,466); var expected79 = 920; var result79 = compareLogic.Compare(actual79, expected79); if (!result79.AreEqual) {throw new Exception("Exception --- test case 78 failed to pass");} var actual80 = Add(905,259); var expected80 = 1164; var result80 = compareLogic.Compare(actual80, expected80); if (!result80.AreEqual) {throw new Exception("Exception --- test case 79 failed to pass");} var actual81 = Add(168,205); var expected81 = 373; var result81 = compareLogic.Compare(actual81, expected81); if (!result81.AreEqual) {throw new Exception("Exception --- test case 80 failed to pass");} var actual82 = Add(570,434); var expected82 = 1004; var result82 = compareLogic.Compare(actual82, expected82); if (!result82.AreEqual) {throw new Exception("Exception --- test case 81 failed to pass");} var actual83 = Add(64,959); var expected83 = 1023; var result83 = compareLogic.Compare(actual83, expected83); if (!result83.AreEqual) {throw new Exception("Exception --- test case 82 failed to pass");} var actual84 = Add(957,510); var expected84 = 1467; var result84 = compareLogic.Compare(actual84, expected84); if (!result84.AreEqual) {throw new Exception("Exception --- test case 83 failed to pass");} var actual85 = Add(722,598); var expected85 = 1320; var result85 = compareLogic.Compare(actual85, expected85); if (!result85.AreEqual) {throw new Exception("Exception --- test case 84 failed to pass");} var actual86 = Add(770,226); var expected86 = 996; var result86 = compareLogic.Compare(actual86, expected86); if (!result86.AreEqual) {throw new Exception("Exception --- test case 85 failed to pass");} var actual87 = Add(579,66); var expected87 = 645; var result87 = compareLogic.Compare(actual87, expected87); if (!result87.AreEqual) {throw new Exception("Exception --- test case 86 failed to pass");} var actual88 = Add(117,674); var expected88 = 791; var result88 = compareLogic.Compare(actual88, expected88); if (!result88.AreEqual) {throw new Exception("Exception --- test case 87 failed to pass");} var actual89 = Add(530,30); var expected89 = 560; var result89 = compareLogic.Compare(actual89, expected89); if (!result89.AreEqual) {throw new Exception("Exception --- test case 88 failed to pass");} var actual90 = Add(776,345); var expected90 = 1121; var result90 = compareLogic.Compare(actual90, expected90); if (!result90.AreEqual) {throw new Exception("Exception --- test case 89 failed to pass");} var actual91 = Add(327,389); var expected91 = 716; var result91 = compareLogic.Compare(actual91, expected91); if (!result91.AreEqual) {throw new Exception("Exception --- test case 90 failed to pass");} var actual92 = Add(596,12); var expected92 = 608; var result92 = compareLogic.Compare(actual92, expected92); if (!result92.AreEqual) {throw new Exception("Exception --- test case 91 failed to pass");} var actual93 = Add(599,511); var expected93 = 1110; var result93 = compareLogic.Compare(actual93, expected93); if (!result93.AreEqual) {throw new Exception("Exception --- test case 92 failed to pass");} var actual94 = Add(936,476); var expected94 = 1412; var result94 = compareLogic.Compare(actual94, expected94); if (!result94.AreEqual) {throw new Exception("Exception --- test case 93 failed to pass");} var actual95 = Add(461,14); var expected95 = 475; var result95 = compareLogic.Compare(actual95, expected95); if (!result95.AreEqual) {throw new Exception("Exception --- test case 94 failed to pass");} var actual96 = Add(966,157); var expected96 = 1123; var result96 = compareLogic.Compare(actual96, expected96); if (!result96.AreEqual) {throw new Exception("Exception --- test case 95 failed to pass");} var actual97 = Add(326,91); var expected97 = 417; var result97 = compareLogic.Compare(actual97, expected97); if (!result97.AreEqual) {throw new Exception("Exception --- test case 96 failed to pass");} var actual98 = Add(392,455); var expected98 = 847; var result98 = compareLogic.Compare(actual98, expected98); if (!result98.AreEqual) {throw new Exception("Exception --- test case 97 failed to pass");} var actual99 = Add(446,477); var expected99 = 923; var result99 = compareLogic.Compare(actual99, expected99); if (!result99.AreEqual) {throw new Exception("Exception --- test case 98 failed to pass");} var actual100 = Add(324,860); var expected100 = 1184; var result100 = compareLogic.Compare(actual100, expected100); if (!result100.AreEqual) {throw new Exception("Exception --- test case 99 failed to pass");} var actual101 = Add(945,85); var expected101 = 1030; var result101 = compareLogic.Compare(actual101, expected101); if (!result101.AreEqual) {throw new Exception("Exception --- test case 100 failed to pass");} var actual102 = Add(886,582); var expected102 = 1468; var result102 = compareLogic.Compare(actual102, expected102); if (!result102.AreEqual) {throw new Exception("Exception --- test case 101 failed to pass");} var actual103 = Add(886,712); var expected103 = 1598; var result103 = compareLogic.Compare(actual103, expected103); if (!result103.AreEqual) {throw new Exception("Exception --- test case 102 failed to pass");} var actual104 = Add(842,953); var expected104 = 1795; var result104 = compareLogic.Compare(actual104, expected104); if (!result104.AreEqual) {throw new Exception("Exception --- test case 103 failed to pass");} } } }
Add
null
Add two numbers x and y >>> add(2, 3) 5 >>> add(5, 7) 12
HumanEval_csharp/54
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// /// Check if two words have the same characters. /// >>> SameChars('eabcdzzzz', 'dddzzzzzzzddeddabc') /// True /// >>> SameChars('abcd', 'dddddddabc') /// True /// >>> SameChars('dddddddabc', 'abcd') /// True /// >>> SameChars('eabcd', 'dddddddabc') /// False /// >>> SameChars('abcd', 'dddddddabce') /// False /// >>> SameChars('eabcdzzzz', 'dddzzzzzzzddddabc') /// False /// /// </summary> public static bool SameChars (string s0, string s1) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SameChars("eabcdzzzz","dddzzzzzzzddeddabc"); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SameChars("abcd","dddddddabc"); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SameChars("dddddddabc","abcd"); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SameChars("eabcd","dddddddabc"); var expected4 = false; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = SameChars("abcd","dddddddabcf"); var expected5 = false; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = SameChars("eabcdzzzz","dddzzzzzzzddddabc"); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = SameChars("aabb","aaccc"); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
SameChars
null
Check if two words have the same characters. >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc') True >>> same_chars('abcd', 'dddddddabc') True >>> same_chars('dddddddabc', 'abcd') True >>> same_chars('eabcd', 'dddddddabc') False >>> same_chars('abcd', 'dddddddabce') False >>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc') False
HumanEval_csharp/55
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return n-th Fibonacci number. /// >>> Fib(10) /// 55 /// >>> Fib(1) /// 1 /// >>> Fib(8) /// 21 /// /// </summary> public static int Fib (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Fib(10); var expected1 = 55; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Fib(1); var expected2 = 1; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Fib(8); var expected3 = 21; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Fib(11); var expected4 = 89; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Fib(12); var expected5 = 144; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
Fib
null
Return n-th Fibonacci number. >>> fib(10) 55 >>> fib(1) 1 >>> fib(8) 21
HumanEval_csharp/56
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// brackets is a string of "<" and ">". /// return True if every opening bracket has a corresponding closing bracket. /// /// >>> CorrectBracketing("<") /// False /// >>> CorrectBracketing("<>") /// True /// >>> CorrectBracketing("<<><>>") /// True /// >>> CorrectBracketing("><<>") /// False /// /// </summary> public static bool CorrectBracketing (string brackets) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = CorrectBracketing("<>"); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = CorrectBracketing("<<><>>"); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = CorrectBracketing("<><><<><>><>"); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = CorrectBracketing("<><><<<><><>><>><<><><<>>>"); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = CorrectBracketing("<<<><>>>>"); var expected5 = false; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = CorrectBracketing("><<>"); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = CorrectBracketing("<"); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = CorrectBracketing("<<<<"); var expected8 = false; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = CorrectBracketing(">"); var expected9 = false; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = CorrectBracketing("<<>"); var expected10 = false; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} var actual11 = CorrectBracketing("<><><<><>><>><<>"); var expected11 = false; var result11 = compareLogic.Compare(actual11, expected11); if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");} var actual12 = CorrectBracketing("<><><<><>><>>><>"); var expected12 = false; var result12 = compareLogic.Compare(actual12, expected12); if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");} } } }
CorrectBracketing
null
brackets is a string of "<" and ">". return True if every opening bracket has a corresponding closing bracket. >>> correct_bracketing("<") False >>> correct_bracketing("<>") True >>> correct_bracketing("<<><>>") True >>> correct_bracketing("><<>") False
HumanEval_csharp/57
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return True is list elements are Monotonically increasing or decreasing. /// >>> Monotonic([1, 2, 4, 20]) /// True /// >>> Monotonic([1, 20, 4, 10]) /// False /// >>> Monotonic([4, 1, 0, -10]) /// True /// /// </summary> public static bool Monotonic (List<int> l) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Monotonic(new List<int> {1,2,4,10}); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Monotonic(new List<int> {1,2,4,20}); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Monotonic(new List<int> {1,20,4,10}); var expected3 = false; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Monotonic(new List<int> {4,1,0,-10}); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Monotonic(new List<int> {4,1,1,0}); var expected5 = true; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Monotonic(new List<int> {1,2,3,2,5,60}); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Monotonic(new List<int> {1,2,3,4,5,60}); var expected7 = true; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = Monotonic(new List<int> {9,9,9,9}); var expected8 = true; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} } } }
Monotonic
null
Return True is list elements are monotonically increasing or decreasing. >>> monotonic([1, 2, 4, 20]) True >>> monotonic([1, 20, 4, 10]) False >>> monotonic([4, 1, 0, -10]) True
HumanEval_csharp/58
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return sorted unique Common elements for two lists. /// >>> Common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) /// [1, 5, 653] /// >>> Common([5, 3, 2, 8], [3, 2]) /// [2, 3] /// /// /// </summary> public static List<int> Common (List<int> l1, List<int> l2) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Common(new List<int> {1,4,3,34,653,2,5},new List<int> {5,7,1,5,9,653,121}); var expected1 = new List<int> {1,5,653}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Common(new List<int> {5,3,2,8},new List<int> {3,2}); var expected2 = new List<int> {2,3}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Common(new List<int> {4,3,2,8},new List<int> {3,2,4}); var expected3 = new List<int> {2,3,4}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Common(new List<int> {4,3,2,8},new List<int> {}); var expected4 = new List<int> {}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} } } }
Common
null
Return sorted unique common elements for two lists. >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) [1, 5, 653] >>> common([5, 3, 2, 8], [3, 2]) [2, 3]
HumanEval_csharp/59
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Return the largest prime factor of n. Assume n > 1 and is not a prime. /// >>> LargestPrimeFactor(13195) /// 29 /// >>> LargestPrimeFactor(2048) /// 2 /// /// </summary> public static int LargestPrimeFactor (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = LargestPrimeFactor(15); var expected1 = 5; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = LargestPrimeFactor(27); var expected2 = 3; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = LargestPrimeFactor(63); var expected3 = 7; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = LargestPrimeFactor(330); var expected4 = 11; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = LargestPrimeFactor(13195); var expected5 = 29; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
LargestPrimeFactor
null
Return the largest prime factor of n. Assume n > 1 and is not a prime. >>> largest_prime_factor(13195) 29 >>> largest_prime_factor(2048) 2
HumanEval_csharp/60
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// SumToN is a function that sums numbers from 1 to n. /// >>> SumToN(30) /// 465 /// >>> SumToN(100) /// 5050 /// >>> SumToN(5) /// 15 /// >>> SumToN(10) /// 55 /// >>> SumToN(1) /// 1 /// /// </summary> public static int SumToN (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = SumToN(1); var expected1 = 1; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = SumToN(6); var expected2 = 21; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = SumToN(11); var expected3 = 66; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = SumToN(30); var expected4 = 465; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = SumToN(100); var expected5 = 5050; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
SumToN
null
sum_to_n is a function that sums numbers from 1 to n. >>> sum_to_n(30) 465 >>> sum_to_n(100) 5050 >>> sum_to_n(5) 15 >>> sum_to_n(10) 55 >>> sum_to_n(1) 1
HumanEval_csharp/61
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// brackets is a string of "(" and ")". /// return True if every opening bracket has a corresponding closing bracket. /// /// >>> CorrectBracketing("(") /// False /// >>> CorrectBracketing("()") /// True /// >>> CorrectBracketing("(()())") /// True /// >>> CorrectBracketing(")(()") /// False /// /// </summary> public static bool CorrectBracketing (string brackets) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = CorrectBracketing("()"); var expected1 = true; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = CorrectBracketing("(()())"); var expected2 = true; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = CorrectBracketing("()()(()())()"); var expected3 = true; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = CorrectBracketing("()()((()()())())(()()(()))"); var expected4 = true; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = CorrectBracketing("((()())))"); var expected5 = false; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = CorrectBracketing(")(()"); var expected6 = false; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = CorrectBracketing("("); var expected7 = false; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = CorrectBracketing("(((("); var expected8 = false; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} var actual9 = CorrectBracketing(")"); var expected9 = false; var result9 = compareLogic.Compare(actual9, expected9); if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");} var actual10 = CorrectBracketing("(()"); var expected10 = false; var result10 = compareLogic.Compare(actual10, expected10); if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");} var actual11 = CorrectBracketing("()()(()())())(()"); var expected11 = false; var result11 = compareLogic.Compare(actual11, expected11); if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");} var actual12 = CorrectBracketing("()()(()())()))()"); var expected12 = false; var result12 = compareLogic.Compare(actual12, expected12); if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");} } } }
CorrectBracketing
null
brackets is a string of "(" and ")". return True if every opening bracket has a corresponding closing bracket. >>> correct_bracketing("(") False >>> correct_bracketing("()") True >>> correct_bracketing("(()())") True >>> correct_bracketing(")(()") False
HumanEval_csharp/62
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// xs represent coefficients of a polynomial. /// xs[0] + xs[1] * x + xs[2] * x^2 + .... /// Return Derivative of this polynomial in the same form. /// >>> Derivative([3, 1, 2, 4, 5]) /// [1, 4, 12, 20] /// >>> Derivative([1, 2, 3]) /// [2, 6] /// /// </summary> public static List<int> Derivative (List<int> xs) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Derivative(new List<int> {3,1,2,4,5}); var expected1 = new List<int> {1,4,12,20}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Derivative(new List<int> {1,2,3}); var expected2 = new List<int> {2,6}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Derivative(new List<int> {3,2,1}); var expected3 = new List<int> {2,2}; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Derivative(new List<int> {3,2,1,0,4}); var expected4 = new List<int> {2,2,0,16}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Derivative(new List<int> {1}); var expected5 = new List<int> {}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
Derivative
null
xs represent coefficients of a polynomial. xs[0] + xs[1] * x + xs[2] * x^2 + .... Return derivative of this polynomial in the same form. >>> derivative([3, 1, 2, 4, 5]) [1, 4, 12, 20] >>> derivative([1, 2, 3]) [2, 6]
HumanEval_csharp/63
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: /// Fibfib(0) == 0 /// Fibfib(1) == 0 /// Fibfib(2) == 1 /// Fibfib(n) == Fibfib(n-1) + Fibfib(n-2) + Fibfib(n-3). /// Please write a function to efficiently compute the n-th element of the Fibfib number sequence. /// >>> Fibfib(1) /// 0 /// >>> Fibfib(5) /// 4 /// >>> Fibfib(8) /// 24 /// /// </summary> public static int Fibfib (int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Fibfib(2); var expected1 = 1; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Fibfib(1); var expected2 = 0; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Fibfib(5); var expected3 = 4; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = Fibfib(8); var expected4 = 24; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Fibfib(10); var expected5 = 81; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Fibfib(12); var expected6 = 274; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Fibfib(14); var expected7 = 927; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
Fibfib
null
The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fibfib(0) == 0 fibfib(1) == 0 fibfib(2) == 1 fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). Please write a function to efficiently compute the n-th element of the fibfib number sequence. >>> fibfib(1) 0 >>> fibfib(5) 4 >>> fibfib(8) 24
HumanEval_csharp/64
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Write a function VowelsCount which takes a string representing /// a word as input and returns the number of vowels in the string. /// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a /// vowel, but only when it is at the end of the given word. /// /// Example: /// >>> VowelsCount("abcde") /// 2 /// >>> VowelsCount("ACEDY") /// 3 /// /// </summary> public static int VowelsCount (string s) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = VowelsCount("abcde"); var expected1 = 2; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = VowelsCount("Alone"); var expected2 = 3; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = VowelsCount("key"); var expected3 = 2; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = VowelsCount("bye"); var expected4 = 1; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = VowelsCount("keY"); var expected5 = 2; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = VowelsCount("bYe"); var expected6 = 1; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = VowelsCount("ACEDY"); var expected7 = 3; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
VowelsCount
null
Write a function vowels_count which takes a string representing a word as input and returns the number of vowels in the string. Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a vowel, but only when it is at the end of the given word. Example: >>> vowels_count("abcde") 2 >>> vowels_count("ACEDY") 3
HumanEval_csharp/65
csharp
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using KellermanSoftware.CompareNetObjects; namespace Solution { public class Program { /// <summary> /// You're an expert C# programmer /// Circular shift the digits of the integer x, shift the digits right by shift /// and return the result as a string. /// If shift > number of digits, return digits reversed. /// >>> CircularShift(12, 1) /// "21" /// >>> CircularShift(12, 2) /// "12" /// /// </summary> public static string CircularShift (int x, int shift) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = CircularShift(100,2); var expected1 = "001"; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = CircularShift(12,2); var expected2 = "12"; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = CircularShift(97,8); var expected3 = "79"; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = CircularShift(12,1); var expected4 = "21"; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = CircularShift(11,101); var expected5 = "11"; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} } } }
CircularShift
null
Circular shift the digits of the integer x, shift the digits right by shift and return the result as a string. If shift > number of digits, return digits reversed. >>> circular_shift(12, 1) "21" >>> circular_shift(12, 2) "12"

Multi-HumanEval

multi-humaneval

Dataset Summary

This repository contains data and code to perform execution-based multi-lingual evaluation of code generation capabilities and the corresponding data, namely, a multi-lingual benchmark MBXP, multi-lingual MathQA and multi-lingual HumanEval.
Results and findings can be found in the paper "Multi-lingual Evaluation of Code Generation Models".

Related Tasks and Leaderboards

Languages

The programming problems are written in multiple programming languages and contain English natural text in comments and docstrings.

Dataset Structure

To lookup currently supported datasets

get_dataset_config_names("mxeval/multi-humaneval")
['python', 'csharp', 'go', 'java', 'javascript', 'kotlin', 'perl', 'php', 'ruby', 'scala', 'swift', 'typescript']

To load a specific dataset and language

from datasets import load_dataset
load_dataset("mxeval/multi-humaneval", "python")
DatasetDict({
    test: Dataset({
        features: ['task_id', 'language', 'prompt', 'test', 'entry_point', 'canonical_solution', 'description'],
        num_rows: 164
    })
})

Data Instances

An example of a dataset instance:

{
  "task_id": "HumanEval/0",
  "language": "python",
  "prompt": "from typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n    \"\"\" Check if in given list of numbers, are any two numbers closer to each other than\n    given threshold.\n    >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n    False\n    >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n    True\n    \"\"\"\n",
  "test": "\n\nMETADATA = {\n    \"author\": \"jt\",\n    \"dataset\": \"test\"\n}\n\n\ndef check(candidate):\n    assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\n    assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\n    assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\n    assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == False\n    assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) == True\n    assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True\n    assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False\n\n",
  "entry_point": "has_close_elements",
  "canonical_solution": "    for idx, elem in enumerate(numbers):\n        for idx2, elem2 in enumerate(numbers):\n            if idx != idx2:\n                distance = abs(elem - elem2)\n                if distance < threshold:\n                    return True\n\n    return False\n",
  "description": "Check if in given list of numbers, are any two numbers closer to each other than\n    given threshold.\n    >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n    False\n    >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n    True"
}

Data Fields

  • task_id: identifier for the data sample
  • prompt: input for the model containing function header and docstrings
  • canonical_solution: solution for the problem in the prompt
  • description: task description
  • test: contains function to test generated code for correctness
  • entry_point: entry point for test
  • language: programming lanuage identifier to call the appropriate subprocess call for program execution

Data Splits

  • HumanXEval
    • Python
    • Csharp
    • Go
    • Java
    • Javascript
    • Kotlin
    • Perl
    • Php
    • Ruby
    • Scala
    • Swift
    • Typescript

Dataset Creation

Curation Rationale

Since code generation models are often trained on dumps of GitHub a dataset not included in the dump was necessary to properly evaluate the model. However, since this dataset was published on GitHub it is likely to be included in future dumps.

Personal and Sensitive Information

None.

Social Impact of Dataset

With this dataset code generating models can be better evaluated which leads to fewer issues introduced when using such models.

Execution

Execution Example

Install the repo mbxp-exec-eval to execute generations or canonical solutions for the prompts from this dataset.

>>> from datasets import load_dataset
>>> from mxeval.execution import check_correctness
>>> humaneval_python = load_dataset("mxeval/multi-humaneval", "python", split="test")
>>> example_problem = humaneval_python[0]
>>> check_correctness(example_problem, example_problem["canonical_solution"], timeout=20.0)
{'task_id': 'HumanEval/0', 'passed': True, 'result': 'passed', 'completion_id': None, 'time_elapsed': 9.636878967285156}

Considerations for Using the Data

Make sure to sandbox the execution environment.

Dataset Curators

AWS AI Labs

Licensing Information

LICENSE
THIRD PARTY LICENSES

Citation Information

@article{mbxp_athiwaratkun2022,
  title = {Multi-lingual Evaluation of Code Generation Models},
  author = {Athiwaratkun, Ben and
   Gouda, Sanjay Krishna and
   Wang, Zijian and
   Li, Xiaopeng and
   Tian, Yuchen and
   Tan, Ming
   and Ahmad, Wasi Uddin and
   Wang, Shiqi and
   Sun, Qing and
   Shang, Mingyue and
   Gonugondla, Sujan Kumar and
   Ding, Hantian and
   Kumar, Varun and
   Fulton, Nathan and
   Farahani, Arash and
   Jain, Siddhartha and
   Giaquinto, Robert and
   Qian, Haifeng and
   Ramanathan, Murali Krishna and
   Nallapati, Ramesh and
   Ray, Baishakhi and
   Bhatia, Parminder and
   Sengupta, Sudipta and
   Roth, Dan and
   Xiang, Bing},
  doi = {10.48550/ARXIV.2210.14868},
  url = {https://arxiv.org/abs/2210.14868},
  keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
  publisher = {arXiv},
  year = {2022},
  copyright = {Creative Commons Attribution 4.0 International}
}

Contributions

skgouda@ benathi@

Downloads last month
1,473