task_id
stringlengths
8
10
language
stringclasses
1 value
prompt
stringlengths
366
1.93k
test
stringlengths
438
26.2k
entry_point
stringlengths
1
24
stop_tokens
sequencelengths
1
1
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
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
[ "\n }\n" ]
csharp_66
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 /// Task /// Write a function that takes a string as input and returns the sum of the upper characters only' /// ASCII codes. /// /// Examples: /// DigitSum("") => 0 /// DigitSum("abAB") => 131 /// DigitSum("abcCd") => 67 /// DigitSum("helloE") => 69 /// DigitSum("woArBld") => 131 /// DigitSum("aAaaaXa") => 153 /// /// </summary> public static int DigitSum (string s) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = DigitSum(""); var expected1 = 0; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = DigitSum("abAB"); var expected2 = 131; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = DigitSum("abcCd"); var expected3 = 67; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = DigitSum("helloE"); var expected4 = 69; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = DigitSum("woArBld"); var expected5 = 131; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = DigitSum("aAaaaXa"); var expected6 = 153; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = DigitSum(" How are yOu?"); var expected7 = 151; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = DigitSum("You arE Very Smart"); var expected8 = 327; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} } } }
DigitSum
[ "\n }\n" ]
csharp_67
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 /// /// In this task, you will be given a string that represents a number of apples and oranges /// that are distributed in a basket of fruit this basket contains /// apples, oranges, and mango fruits. Given the string that represents the total number of /// the oranges and apples and an integer that represent the total number of the fruits /// in the basket return the number of the mango fruits in the basket. /// for examble: /// FruitDistribution("5 apples and 6 oranges", 19) ->19 - 5 - 6 = 8 /// FruitDistribution("0 apples and 1 oranges",3) -> 3 - 0 - 1 = 2 /// FruitDistribution("2 apples and 3 oranges", 100) -> 100 - 2 - 3 = 95 /// FruitDistribution("100 apples and 1 oranges",120) -> 120 - 100 - 1 = 19 /// /// </summary> public static int FruitDistribution (string s, int n) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = FruitDistribution("5 apples and 6 oranges",19); var expected1 = 8; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = FruitDistribution("5 apples and 6 oranges",21); var expected2 = 10; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = FruitDistribution("0 apples and 1 oranges",3); var expected3 = 2; var result3 = compareLogic.Compare(actual3, expected3); if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");} var actual4 = FruitDistribution("1 apples and 0 oranges",3); var expected4 = 2; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = FruitDistribution("2 apples and 3 oranges",100); var expected5 = 95; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = FruitDistribution("2 apples and 3 oranges",5); var expected6 = 0; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = FruitDistribution("1 apples and 100 oranges",120); var expected7 = 19; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} } } }
FruitDistribution
[ "\n }\n" ]
csharp_68
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 an array representing a branch of a tree that has non-negative integer nodes /// your task is to Pluck one of the nodes and return it. /// The Plucked node should be the node with the smallest even value. /// If multiple nodes with the same smallest even value are found return the node that has smallest index. /// /// The Plucked node should be returned in a list, [ smalest_value, its index ], /// If there are no even values or the given array is empty, return []. /// /// Example 1: /// Input: [4,2,3] /// Output: [2, 1] /// Explanation: 2 has the smallest even value, and 2 has the smallest index. /// /// Example 2: /// Input: [1,2,3] /// Output: [2, 1] /// Explanation: 2 has the smallest even value, and 2 has the smallest index. /// /// Example 3: /// Input: [] /// Output: [] /// /// Example 4: /// Input: [5, 0, 3, 0, 4, 2] /// Output: [0, 1] /// Explanation: 0 is the smallest value, but there are two zeros, /// so we will choose the first zero, which has the smallest index. /// /// Constraints: /// * 1 <= nodes.length <= 10000 /// * 0 <= node.value /// /// </summary> public static List<int> Pluck (List<int> arr) {
public static void Main(string[] args) { CompareLogic compareLogic = new CompareLogic(); var actual1 = Pluck(new List<int> {4,2,3}); var expected1 = new List<int> {2,1}; var result1 = compareLogic.Compare(actual1, expected1); if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");} var actual2 = Pluck(new List<int> {1,2,3}); var expected2 = new List<int> {2,1}; var result2 = compareLogic.Compare(actual2, expected2); if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");} var actual3 = Pluck(new List<int> {}); 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 = Pluck(new List<int> {5,0,3,0,4,2}); var expected4 = new List<int> {0,1}; var result4 = compareLogic.Compare(actual4, expected4); if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");} var actual5 = Pluck(new List<int> {1,2,3,0,5,3}); var expected5 = new List<int> {0,3}; var result5 = compareLogic.Compare(actual5, expected5); if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");} var actual6 = Pluck(new List<int> {5,4,8,4,8}); var expected6 = new List<int> {4,1}; var result6 = compareLogic.Compare(actual6, expected6); if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");} var actual7 = Pluck(new List<int> {7,6,7,1}); var expected7 = new List<int> {6,1}; var result7 = compareLogic.Compare(actual7, expected7); if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");} var actual8 = Pluck(new List<int> {7,9,7,1}); var expected8 = new List<int> {}; var result8 = compareLogic.Compare(actual8, expected8); if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");} } } }
Pluck
[ "\n }\n" ]

This dataset contains a viewer-friendly version of the dataset at mxeval/multi-humaneval with language-specific stop tokens added in. It is made available separately for the convenience of the vllm-code-harness package.

Downloads last month
48
Edit dataset card