task_id
stringlengths 18
20
| language
stringclasses 1
value | prompt
stringlengths 366
1.93k
| test
stringlengths 438
26.2k
| entry_point
stringlengths 1
24
| canonical_solution
stringclasses 0
values | description
stringlengths 0
1.21k
|
---|---|---|---|---|---|---|
HumanEval_csharp/0 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Check if in given list of numbers, are any two numbers closer to each other than
/// given threshold.
/// >>> HasCloseElements([1.0, 2.0, 3.0], 0.5)
/// False
/// >>> HasCloseElements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
/// True
///
/// </summary>
public static bool HasCloseElements (List<double> numbers, double threshold)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = HasCloseElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2},0.3);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = HasCloseElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2},0.05);
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = HasCloseElements(new List<double> {1.0,2.0,5.9,4.0,5.0},0.95);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = HasCloseElements(new List<double> {1.0,2.0,5.9,4.0,5.0},0.8);
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = HasCloseElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.0},0.1);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = HasCloseElements(new List<double> {1.1,2.2,3.1,4.1,5.1},1.0);
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = HasCloseElements(new List<double> {1.1,2.2,3.1,4.1,5.1},0.5);
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| HasCloseElements | null | Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
|
HumanEval_csharp/1 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
/// separate those group into separate strings and return the list of those.
/// Separate groups are balanced (each open brace is properly closed) and not nested within each other
/// Ignore any spaces in the input string.
/// >>> SeparateParenGroups('( ) (( )) (( )( ))')
/// ['()', '(())', '(()())']
///
/// </summary>
public static List<string> SeparateParenGroups (string paren_string)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SeparateParenGroups("(()()) ((())) () ((())()())");
var expected1 = new List<string> {"(()())","((()))","()","((())()())"};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SeparateParenGroups("() (()) ((())) (((())))");
var expected2 = new List<string> {"()","(())","((()))","(((())))"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SeparateParenGroups("(()(())((())))");
var expected3 = new List<string> {"(()(())((())))"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SeparateParenGroups("( ) (( )) (( )( ))");
var expected4 = new List<string> {"()","(())","(()())"};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| SeparateParenGroups | null | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
|
HumanEval_csharp/2 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Given a positive floating point number, it can be decomposed into
/// and integer part (largest integer smaller than given number) and decimals
/// (leftover part always smaller than 1).
///
/// Return the decimal part of the number.
/// >>> TruncateNumber(3.5)
/// 0.5
///
/// </summary>
public static double TruncateNumber (double number)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = TruncateNumber(3.5);
var expected1 = 0.5;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = TruncateNumber(1.33);
var expected2 = 0.33000000000000007;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = TruncateNumber(123.456);
var expected3 = 0.45600000000000307;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| TruncateNumber | null | Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
|
HumanEval_csharp/3 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// You're given a list of deposit and withdrawal operations on a bank account that starts with
/// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
/// at that point function should return True. Otherwise it should return False.
/// >>> BelowZero([1, 2, 3])
/// False
/// >>> BelowZero([1, 2, -4, 5])
/// True
///
/// </summary>
public static bool BelowZero (List<int> operations)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = BelowZero(new List<int> {});
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = BelowZero(new List<int> {1,2,-3,1,2,-3});
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = BelowZero(new List<int> {1,2,-4,5,6});
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = BelowZero(new List<int> {1,-1,2,-2,5,-5,4,-4});
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = BelowZero(new List<int> {1,-1,2,-2,5,-5,4,-5});
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = BelowZero(new List<int> {1,-2,2,-2,5,-5,4,-4});
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| BelowZero | null | You're given a list of deposit and withdrawal operations on a bank account that starts with
zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
at that point function should return True. Otherwise it should return False.
>>> below_zero([1, 2, 3])
False
>>> below_zero([1, 2, -4, 5])
True
|
HumanEval_csharp/4 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// For a given list of input numbers, calculate Mean Absolute Deviation
/// around the mean of this dataset.
/// Mean Absolute Deviation is the average absolute difference between each
/// element and a centerpoint (mean in this case):
/// MAD = average | x - x_mean |
/// >>> MeanAbsoluteDeviation([1.0, 2.0, 3.0, 4.0])
/// 1.0
///
/// </summary>
public static double MeanAbsoluteDeviation (List<double> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0});
var expected1 = 0.6666666666666666;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0,4.0});
var expected2 = 1.0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = MeanAbsoluteDeviation(new List<double> {1.0,2.0,3.0,4.0,5.0});
var expected3 = 1.2;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| MeanAbsoluteDeviation | null | For a given list of input numbers, calculate Mean Absolute Deviation
around the mean of this dataset.
Mean Absolute Deviation is the average absolute difference between each
element and a centerpoint (mean in this case):
MAD = average | x - x_mean |
>>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])
1.0
|
HumanEval_csharp/5 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
/// >>> Intersperse([], 4)
/// []
/// >>> Intersperse([1, 2, 3], 4)
/// [1, 4, 2, 4, 3]
///
/// </summary>
public static List<int> Intersperse (List<int> numbers, int delimeter)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Intersperse(new List<int> {},7);
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Intersperse(new List<int> {5,6,3,2},8);
var expected2 = new List<int> {5,8,6,8,3,8,2};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Intersperse(new List<int> {2,2,2},2);
var expected3 = new List<int> {2,2,2,2,2};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| Intersperse | null | Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
>>> intersperse([], 4)
[]
>>> intersperse([1, 2, 3], 4)
[1, 4, 2, 4, 3]
|
HumanEval_csharp/6 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
/// For each of the group, output the deepest level of nesting of parentheses.
/// E.g. (()()) has maximum two levels of nesting while ((())) has three.
///
/// >>> ParseNestedParens('(()()) ((())) () ((())()())')
/// [2, 3, 1, 3]
///
/// </summary>
public static List<int> ParseNestedParens (string paren_string)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = ParseNestedParens("(()()) ((())) () ((())()())");
var expected1 = new List<int> {2,3,1,3};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = ParseNestedParens("() (()) ((())) (((())))");
var expected2 = new List<int> {1,2,3,4};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = ParseNestedParens("(()(())((())))");
var expected3 = new List<int> {4};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| ParseNestedParens | null | Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
For each of the group, output the deepest level of nesting of parentheses.
E.g. (()()) has maximum two levels of nesting while ((())) has three.
>>> parse_nested_parens('(()()) ((())) () ((())()())')
[2, 3, 1, 3]
|
HumanEval_csharp/7 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Filter an input list of strings only for ones that contain given substring
/// >>> FilterBySubstring([], 'a')
/// []
/// >>> FilterBySubstring(['abc', 'bacd', 'cde', 'array'], 'a')
/// ['abc', 'bacd', 'array']
///
/// </summary>
public static List<string> FilterBySubstring (List<string> strings, string substring)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FilterBySubstring(new List<string> {},"john");
var expected1 = new List<string> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FilterBySubstring(new List<string> {"xxx","asd","xxy","john doe","xxxAAA","xxx"},"xxx");
var expected2 = new List<string> {"xxx","xxxAAA","xxx"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = FilterBySubstring(new List<string> {"xxx","asd","aaaxxy","john doe","xxxAAA","xxx"},"xx");
var expected3 = new List<string> {"xxx","aaaxxy","xxxAAA","xxx"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = FilterBySubstring(new List<string> {"grunt","trumpet","prune","gruesome"},"run");
var expected4 = new List<string> {"grunt","prune"};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| FilterBySubstring | null | Filter an input list of strings only for ones that contain given substring
>>> filter_by_substring([], 'a')
[]
>>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
['abc', 'bacd', 'array']
|
HumanEval_csharp/8 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
/// Empty sum should be equal to 0 and empty product should be equal to 1.
/// >>> SumProduct([])
/// (0, 1)
/// >>> SumProduct([1, 2, 3, 4])
/// (10, 24)
///
/// </summary>
public static List<int> SumProduct (List<int> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SumProduct(new List<int> {});
var expected1 = new List<int> {0,1};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SumProduct(new List<int> {1,1,1});
var expected2 = new List<int> {3,1};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SumProduct(new List<int> {100,0});
var expected3 = new List<int> {100,0};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SumProduct(new List<int> {3,5,7});
var expected4 = new List<int> {15,105};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SumProduct(new List<int> {10});
var expected5 = new List<int> {10,10};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| SumProduct | null | For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
Empty sum should be equal to 0 and empty product should be equal to 1.
>>> sum_product([])
(0, 1)
>>> sum_product([1, 2, 3, 4])
(10, 24)
|
HumanEval_csharp/9 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// From a given list of integers, generate a list of rolling maximum element found until given moment
/// in the sequence.
/// >>> RollingMax([1, 2, 3, 2, 3, 4, 2])
/// [1, 2, 3, 3, 3, 4, 4]
///
/// </summary>
public static List<int> RollingMax (List<int> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = RollingMax(new List<int> {});
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = RollingMax(new List<int> {1,2,3,4});
var expected2 = new List<int> {1,2,3,4};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = RollingMax(new List<int> {4,3,2,1});
var expected3 = new List<int> {4,4,4,4};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = RollingMax(new List<int> {3,2,3,100,3});
var expected4 = new List<int> {3,3,3,100,100};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| RollingMax | null | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
>>> rolling_max([1, 2, 3, 2, 3, 4, 2])
[1, 2, 3, 3, 3, 4, 4]
|
HumanEval_csharp/10 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Find the shortest palindrome that begins with a supplied string.
/// Algorithm idea is simple:
/// - Find the longest postfix of supplied string that is a palindrome.
/// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
/// >>> MakePalindrome('')
/// ''
/// >>> MakePalindrome('cat')
/// 'catac'
/// >>> MakePalindrome('cata')
/// 'catac'
///
/// </summary>
public static string MakePalindrome (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = MakePalindrome("");
var expected1 = "";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = MakePalindrome("x");
var expected2 = "x";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = MakePalindrome("xyz");
var expected3 = "xyzyx";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = MakePalindrome("xyx");
var expected4 = "xyx";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = MakePalindrome("jerry");
var expected5 = "jerryrrej";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| MakePalindrome | null | Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
|
HumanEval_csharp/11 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Input are two strings a and b consisting only of 1s and 0s.
/// Perform binary XOR on these inputs and return result also as a string.
/// >>> StringXor('010', '110')
/// '100'
///
/// </summary>
public static string StringXor (string a, string b)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = StringXor("111000","101010");
var expected1 = "010010";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = StringXor("1","1");
var expected2 = "0";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = StringXor("0101","0000");
var expected3 = "0101";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| StringXor | null | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
>>> string_xor('010', '110')
'100'
|
HumanEval_csharp/12 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Out of list of strings, return the Longest one. Return the first one in case of multiple
/// strings of the same length. Return None in case the input list is empty.
/// >>> Longest([])
///
/// >>> Longest(['a', 'b', 'c'])
/// 'a'
/// >>> Longest(['a', 'bb', 'ccc'])
/// 'ccc'
///
/// </summary>
public static object Longest (List<string> strings)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Longest(new List<string> {});
var expected1 = null;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Longest(new List<string> {"x","y","z"});
var expected2 = "x";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Longest(new List<string> {"x","yyy","zzzz","www","kkkk","abc"});
var expected3 = "zzzz";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| Longest | null | Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
>>> longest(['a', 'b', 'c'])
'a'
>>> longest(['a', 'bb', 'ccc'])
'ccc'
|
HumanEval_csharp/13 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return a greatest common divisor of two integers a and b
/// >>> GreatestCommonDivisor(3, 5)
/// 1
/// >>> GreatestCommonDivisor(25, 15)
/// 5
///
/// </summary>
public static int GreatestCommonDivisor (int a, int b)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = GreatestCommonDivisor(3,7);
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = GreatestCommonDivisor(10,15);
var expected2 = 5;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = GreatestCommonDivisor(49,14);
var expected3 = 7;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = GreatestCommonDivisor(144,60);
var expected4 = 12;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| GreatestCommonDivisor | null | Return a greatest common divisor of two integers a and b
>>> greatest_common_divisor(3, 5)
1
>>> greatest_common_divisor(25, 15)
5
|
HumanEval_csharp/14 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return list of all prefixes from shortest to longest of the input string
/// >>> AllPrefixes('abc')
/// ['a', 'ab', 'abc']
///
/// </summary>
public static List<string> AllPrefixes (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = AllPrefixes("");
var expected1 = new List<string> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = AllPrefixes("asdfgh");
var expected2 = new List<string> {"a","as","asd","asdf","asdfg","asdfgh"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = AllPrefixes("WWW");
var expected3 = new List<string> {"W","WW","WWW"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| AllPrefixes | null | Return list of all prefixes from shortest to longest of the input string
>>> all_prefixes('abc')
['a', 'ab', 'abc']
|
HumanEval_csharp/15 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
/// >>> StringSequence(0)
/// '0'
/// >>> StringSequence(5)
/// '0 1 2 3 4 5'
///
/// </summary>
public static string StringSequence (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = StringSequence(0);
var expected1 = "0";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = StringSequence(3);
var expected2 = "0 1 2 3";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = StringSequence(10);
var expected3 = "0 1 2 3 4 5 6 7 8 9 10";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| StringSequence | null | Return a string containing space-delimited numbers starting from 0 upto n inclusive.
>>> string_sequence(0)
'0'
>>> string_sequence(5)
'0 1 2 3 4 5'
|
HumanEval_csharp/16 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Given a string, find out how many distinct characters (regardless of case) does it consist of
/// >>> CountDistinctCharacters('xyzXYZ')
/// 3
/// >>> CountDistinctCharacters('Jerry')
/// 4
///
/// </summary>
public static int CountDistinctCharacters (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CountDistinctCharacters("");
var expected1 = 0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CountDistinctCharacters("abcde");
var expected2 = 5;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CountDistinctCharacters("abcdecadeCADE");
var expected3 = 5;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CountDistinctCharacters("aaaaAAAAaaaa");
var expected4 = 1;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CountDistinctCharacters("Jerry jERRY JeRRRY");
var expected5 = 5;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| CountDistinctCharacters | null | Given a string, find out how many distinct characters (regardless of case) does it consist of
>>> count_distinct_characters('xyzXYZ')
3
>>> count_distinct_characters('Jerry')
4
|
HumanEval_csharp/17 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Input to this function is a string representing musical notes in a special ASCII format.
/// Your task is to parse this string and return list of integers corresponding to how many beats does each
/// not last.
///
/// Here is a legend:
/// 'o' - whole note, lasts four beats
/// 'o|' - half note, lasts two beats
/// '.|' - quater note, lasts one beat
///
/// >>> ParseMusic('o o| .| o| o| .| .| .| .| o o')
/// [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
///
/// </summary>
public static List<int> ParseMusic (string music_string)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = ParseMusic("");
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = ParseMusic("o o o o");
var expected2 = new List<int> {4,4,4,4};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = ParseMusic(".| .| .| .|");
var expected3 = new List<int> {1,1,1,1};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = ParseMusic("o| o| .| .| o o o o");
var expected4 = new List<int> {2,2,1,1,4,4,4,4};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = ParseMusic("o| .| o| .| o o| o o|");
var expected5 = new List<int> {2,1,2,1,4,2,4,2};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| ParseMusic | null | Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> parse_music('o o| .| o| o| .| .| .| .| o o')
[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
|
HumanEval_csharp/18 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Find how many times a given substring can be found in the original string. Count overlaping cases.
/// >>> HowManyTimes('', 'a')
/// 0
/// >>> HowManyTimes('aaa', 'a')
/// 3
/// >>> HowManyTimes('aaaa', 'aa')
/// 3
///
/// </summary>
public static int HowManyTimes (string string0, string substring)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = HowManyTimes("","x");
var expected1 = 0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = HowManyTimes("xyxyxyx","x");
var expected2 = 4;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = HowManyTimes("cacacacac","cac");
var expected3 = 4;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = HowManyTimes("john doe","john");
var expected4 = 1;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| HowManyTimes | null | Find how many times a given substring can be found in the original string. Count overlaping cases.
>>> how_many_times('', 'a')
0
>>> how_many_times('aaa', 'a')
3
>>> how_many_times('aaaa', 'aa')
3
|
HumanEval_csharp/19 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Input is a space-delimited string of numberals from 'zero' to 'nine'.
/// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
/// Return the string with numbers sorted from smallest to largest
/// >>> SortNumbers('three one five')
/// 'one three five'
///
/// </summary>
public static string SortNumbers (string numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SortNumbers("");
var expected1 = "";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SortNumbers("three");
var expected2 = "three";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SortNumbers("three five nine");
var expected3 = "three five nine";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SortNumbers("five zero four seven nine eight");
var expected4 = "zero four five seven eight nine";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SortNumbers("six five four three two one zero");
var expected5 = "zero one two three four five six";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| SortNumbers | null | Input is a space-delimited string of numberals from 'zero' to 'nine'.
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
Return the string with numbers sorted from smallest to largest
>>> sort_numbers('three one five')
'one three five'
|
HumanEval_csharp/20 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// From a supplied list of numbers (of length at least two) select and return two that are the closest to each
/// other and return them in order (smaller number, larger number).
/// >>> FindClosestElements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
/// (2.0, 2.2)
/// >>> FindClosestElements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
/// (2.0, 2.0)
///
/// </summary>
public static List<double> FindClosestElements (List<double> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FindClosestElements(new List<double> {1.0,2.0,3.9,4.0,5.0,2.2});
var expected1 = new List<double> {3.9,4.0};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FindClosestElements(new List<double> {1.0,2.0,5.9,4.0,5.0});
var expected2 = new List<double> {5.0,5.9};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = FindClosestElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.2});
var expected3 = new List<double> {2.0,2.2};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = FindClosestElements(new List<double> {1.0,2.0,3.0,4.0,5.0,2.0});
var expected4 = new List<double> {2.0,2.0};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = FindClosestElements(new List<double> {1.1,2.2,3.1,4.1,5.1});
var expected5 = new List<double> {2.2,3.1};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| FindClosestElements | null | From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
|
HumanEval_csharp/21 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Given list of numbers (of at least two elements), apply a linear transform to that list,
/// such that the smallest number will become 0 and the largest will become 1
/// >>> RescaleToUnit([1.0, 2.0, 3.0, 4.0, 5.0])
/// [0.0, 0.25, 0.5, 0.75, 1.0]
///
/// </summary>
public static List<double> RescaleToUnit (List<double> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = RescaleToUnit(new List<double> {2.0,49.9});
var expected1 = new List<double> {0.0,1.0};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = RescaleToUnit(new List<double> {100.0,49.9});
var expected2 = new List<double> {1.0,0.0};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = RescaleToUnit(new List<double> {1.0,2.0,3.0,4.0,5.0});
var expected3 = new List<double> {0.0,0.25,0.5,0.75,1.0};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = RescaleToUnit(new List<double> {2.0,1.0,5.0,3.0,4.0});
var expected4 = new List<double> {0.25,0.0,1.0,0.5,0.75};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = RescaleToUnit(new List<double> {12.0,11.0,15.0,13.0,14.0});
var expected5 = new List<double> {0.25,0.0,1.0,0.5,0.75};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| RescaleToUnit | null | Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
|
HumanEval_csharp/22 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Filter given list of any python values only for integers
/// >>> FilterIntegers(['a', 3.14, 5])
/// [5]
/// >>> FilterIntegers([1, 2, 3, 'abc', {}, []])
/// [1, 2, 3]
///
/// </summary>
public static List<int> FilterIntegers (List<object> values)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FilterIntegers(new List<object> {});
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FilterIntegers(new List<object> {4,new object {},new List<object> {},23.2,9,"adasd"});
var expected2 = new List<int> {4,9};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = FilterIntegers(new List<object> {3,"c",3,3,"a","b"});
var expected3 = new List<int> {3,3,3};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| FilterIntegers | null | Filter given list of any python values only for integers
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', {}, []])
[1, 2, 3]
|
HumanEval_csharp/23 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return length of given string
/// >>> Strlen('')
/// 0
/// >>> Strlen('abc')
/// 3
///
/// </summary>
public static int Strlen (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Strlen("");
var expected1 = 0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Strlen("x");
var expected2 = 1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Strlen("asdasnakj");
var expected3 = 9;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| Strlen | null | Return length of given string
>>> strlen('')
0
>>> strlen('abc')
3
|
HumanEval_csharp/24 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// For a given number n, find the largest number that divides n evenly, smaller than n
/// >>> LargestDivisor(15)
/// 5
///
/// </summary>
public static int LargestDivisor (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = LargestDivisor(3);
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = LargestDivisor(7);
var expected2 = 1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = LargestDivisor(10);
var expected3 = 5;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = LargestDivisor(100);
var expected4 = 50;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = LargestDivisor(49);
var expected5 = 7;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| LargestDivisor | null | For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
|
HumanEval_csharp/25 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return list of prime factors of given integer in the order from smallest to largest.
/// Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
/// Input number should be equal to the product of all factors
/// >>> Factorize(8)
/// [2, 2, 2]
/// >>> Factorize(25)
/// [5, 5]
/// >>> Factorize(70)
/// [2, 5, 7]
///
/// </summary>
public static List<int> Factorize (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Factorize(2);
var expected1 = new List<int> {2};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Factorize(4);
var expected2 = new List<int> {2,2};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Factorize(8);
var expected3 = new List<int> {2,2,2};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Factorize(57);
var expected4 = new List<int> {3,19};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Factorize(3249);
var expected5 = new List<int> {3,3,19,19};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Factorize(185193);
var expected6 = new List<int> {3,3,3,19,19,19};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Factorize(20577);
var expected7 = new List<int> {3,19,19,19};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Factorize(18);
var expected8 = new List<int> {2,3,3};
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| Factorize | null | Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
|
HumanEval_csharp/26 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// From a list of integers, remove all elements that occur more than once.
/// Keep order of elements left the same as in the input.
/// >>> RemoveDuplicates([1, 2, 3, 2, 4])
/// [1, 3, 4]
///
/// </summary>
public static List<int> RemoveDuplicates (List<int> numbers)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = RemoveDuplicates(new List<int> {});
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = RemoveDuplicates(new List<int> {1,2,3,4});
var expected2 = new List<int> {1,2,3,4};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = RemoveDuplicates(new List<int> {1,2,3,2,4,3,5});
var expected3 = new List<int> {1,4,5};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| RemoveDuplicates | null | From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
|
HumanEval_csharp/27 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
/// >>> FlipCase('Hello')
/// 'hELLO'
///
/// </summary>
public static string FlipCase (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FlipCase("");
var expected1 = "";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FlipCase("Hello!");
var expected2 = "hELLO!";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = FlipCase("These violent delights have violent ends");
var expected3 = "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| FlipCase | null | For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case('Hello')
'hELLO'
|
HumanEval_csharp/28 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Concatenate list of strings into a single string
/// >>> Concatenate([])
/// ''
/// >>> Concatenate(['a', 'b', 'c'])
/// 'abc'
///
/// </summary>
public static string Concatenate (List<string> strings)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Concatenate(new List<string> {});
var expected1 = "";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Concatenate(new List<string> {"x","y","z"});
var expected2 = "xyz";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Concatenate(new List<string> {"x","y","z","w","k"});
var expected3 = "xyzwk";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| Concatenate | null | Concatenate list of strings into a single string
>>> concatenate([])
''
>>> concatenate(['a', 'b', 'c'])
'abc'
|
HumanEval_csharp/29 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Filter an input list of strings only for ones that start with a given prefix.
/// >>> FilterByPrefix([], 'a')
/// []
/// >>> FilterByPrefix(['abc', 'bcd', 'cde', 'array'], 'a')
/// ['abc', 'array']
///
/// </summary>
public static List<string> FilterByPrefix (List<string> strings, string prefix)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FilterByPrefix(new List<string> {},"john");
var expected1 = new List<string> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FilterByPrefix(new List<string> {"xxx","asd","xxy","john doe","xxxAAA","xxx"},"xxx");
var expected2 = new List<string> {"xxx","xxxAAA","xxx"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
}
}
}
| FilterByPrefix | null | Filter an input list of strings only for ones that start with a given prefix.
>>> filter_by_prefix([], 'a')
[]
>>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')
['abc', 'array']
|
HumanEval_csharp/30 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return only positive numbers in the list.
/// >>> GetPositive([-1, 2, -4, 5, 6])
/// [2, 5, 6]
/// >>> GetPositive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
/// [5, 3, 2, 3, 9, 123, 1]
///
/// </summary>
public static List<int> GetPositive (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = GetPositive(new List<int> {-1,-2,4,5,6});
var expected1 = new List<int> {4,5,6};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = GetPositive(new List<int> {5,3,-5,2,3,3,9,0,123,1,-10});
var expected2 = new List<int> {5,3,2,3,3,9,123,1};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = GetPositive(new List<int> {-1,-2});
var expected3 = new List<int> {};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = GetPositive(new List<int> {});
var expected4 = new List<int> {};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| GetPositive | null | Return only positive numbers in the list.
>>> get_positive([-1, 2, -4, 5, 6])
[2, 5, 6]
>>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
[5, 3, 2, 3, 9, 123, 1]
|
HumanEval_csharp/31 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return true if a given number is prime, and false otherwise.
/// >>> IsPrime(6)
/// False
/// >>> IsPrime(101)
/// True
/// >>> IsPrime(11)
/// True
/// >>> IsPrime(13441)
/// True
/// >>> IsPrime(61)
/// True
/// >>> IsPrime(4)
/// False
/// >>> IsPrime(1)
/// False
///
/// </summary>
public static bool IsPrime (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsPrime(6);
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsPrime(101);
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsPrime(11);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = IsPrime(13441);
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsPrime(61);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsPrime(4);
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = IsPrime(1);
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = IsPrime(5);
var expected8 = true;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = IsPrime(11);
var expected9 = true;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = IsPrime(17);
var expected10 = true;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = IsPrime(85);
var expected11 = false;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = IsPrime(77);
var expected12 = false;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
var actual13 = IsPrime(255379);
var expected13 = false;
var result13 = compareLogic.Compare(actual13, expected13);
if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");}
}
}
}
| IsPrime | null | Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
False
>>> is_prime(101)
True
>>> is_prime(11)
True
>>> is_prime(13441)
True
>>> is_prime(61)
True
>>> is_prime(4)
False
>>> is_prime(1)
False
|
HumanEval_csharp/33 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// This function takes a list l and returns a list l' such that
/// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
/// to the values of the corresponding indicies of l, but sorted.
/// >>> SortThird([1, 2, 3])
/// [1, 2, 3]
/// >>> SortThird([5, 6, 3, 4, 8, 9, 2])
/// [2, 6, 3, 4, 8, 9, 5]
///
/// </summary>
public static List<int> SortThird (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SortThird(new List<int> {1,2,3});
var expected1 = new List<int> {1,2,3};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SortThird(new List<int> {5,3,-5,2,-3,3,9,0,123,1,-10});
var expected2 = new List<int> {1,3,-5,2,-3,3,5,0,123,9,-10};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SortThird(new List<int> {5,8,-12,4,23,2,3,11,12,-10});
var expected3 = new List<int> {-10,8,-12,3,23,2,4,11,12,5};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SortThird(new List<int> {5,6,3,4,8,9,2});
var expected4 = new List<int> {2,6,3,4,8,9,5};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SortThird(new List<int> {5,8,3,4,6,9,2});
var expected5 = new List<int> {2,8,3,4,6,9,5};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = SortThird(new List<int> {5,6,9,4,8,3,2});
var expected6 = new List<int> {2,6,9,4,8,3,5};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = SortThird(new List<int> {5,6,3,4,8,9,2,1});
var expected7 = new List<int> {2,6,3,4,8,9,5,1};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| SortThird | null | This function takes a list l and returns a list l' such that
l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
to the values of the corresponding indicies of l, but sorted.
>>> sort_third([1, 2, 3])
[1, 2, 3]
>>> sort_third([5, 6, 3, 4, 8, 9, 2])
[2, 6, 3, 4, 8, 9, 5]
|
HumanEval_csharp/34 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return sorted Unique elements in a list
/// >>> Unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
/// [0, 2, 3, 5, 9, 123]
///
/// </summary>
public static List<int> Unique (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Unique(new List<int> {5,3,5,2,3,3,9,0,123});
var expected1 = new List<int> {0,2,3,5,9,123};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
}
}
}
| Unique | null | Return sorted unique elements in a list
>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
[0, 2, 3, 5, 9, 123]
|
HumanEval_csharp/35 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return maximum element in the list.
/// >>> MaxElement([1, 2, 3])
/// 3
/// >>> MaxElement([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
/// 123
///
/// </summary>
public static int MaxElement (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = MaxElement(new List<int> {1,2,3});
var expected1 = 3;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = MaxElement(new List<int> {5,3,-5,2,-3,3,9,0,124,1,-10});
var expected2 = 124;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
}
}
}
| MaxElement | null | Return maximum element in the list.
>>> max_element([1, 2, 3])
3
>>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
123
|
HumanEval_csharp/36 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
/// >>> FizzBuzz(50)
/// 0
/// >>> FizzBuzz(78)
/// 2
/// >>> FizzBuzz(79)
/// 3
///
/// </summary>
public static int FizzBuzz (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = FizzBuzz(50);
var expected1 = 0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = FizzBuzz(78);
var expected2 = 2;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = FizzBuzz(79);
var expected3 = 3;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = FizzBuzz(100);
var expected4 = 3;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = FizzBuzz(200);
var expected5 = 6;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = FizzBuzz(4000);
var expected6 = 192;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = FizzBuzz(10000);
var expected7 = 639;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = FizzBuzz(100000);
var expected8 = 8026;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| FizzBuzz | null | Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
>>> fizz_buzz(50)
0
>>> fizz_buzz(78)
2
>>> fizz_buzz(79)
3
|
HumanEval_csharp/37 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// This function takes a list l and returns a list l' such that
/// l' is identical to l in the odd indicies, while its values at the even indicies are equal
/// to the values of the even indicies of l, but sorted.
/// >>> SortEven([1, 2, 3])
/// [1, 2, 3]
/// >>> SortEven([5, 6, 3, 4])
/// [3, 6, 5, 4]
///
/// </summary>
public static List<int> SortEven (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SortEven(new List<int> {1,2,3});
var expected1 = new List<int> {1,2,3};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SortEven(new List<int> {5,3,-5,2,-3,3,9,0,123,1,-10});
var expected2 = new List<int> {-10,3,-5,2,-3,3,5,0,9,1,123};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SortEven(new List<int> {5,8,-12,4,23,2,3,11,12,-10});
var expected3 = new List<int> {-12,8,3,4,5,2,12,11,23,-10};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| SortEven | null | This function takes a list l and returns a list l' such that
l' is identical to l in the odd indicies, while its values at the even indicies are equal
to the values of the even indicies of l, but sorted.
>>> sort_even([1, 2, 3])
[1, 2, 3]
>>> sort_even([5, 6, 3, 4])
[3, 6, 5, 4]
|
HumanEval_csharp/39 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// PrimeFib returns n-th number that is a Fibonacci number and it's also prime.
/// >>> PrimeFib(1)
/// 2
/// >>> PrimeFib(2)
/// 3
/// >>> PrimeFib(3)
/// 5
/// >>> PrimeFib(4)
/// 13
/// >>> PrimeFib(5)
/// 89
///
/// </summary>
public static int PrimeFib (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = PrimeFib(1);
var expected1 = 2;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = PrimeFib(2);
var expected2 = 3;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = PrimeFib(3);
var expected3 = 5;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = PrimeFib(4);
var expected4 = 13;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = PrimeFib(5);
var expected5 = 89;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = PrimeFib(6);
var expected6 = 233;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = PrimeFib(7);
var expected7 = 1597;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = PrimeFib(8);
var expected8 = 28657;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = PrimeFib(9);
var expected9 = 514229;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = PrimeFib(10);
var expected10 = 433494437;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
}
}
}
| PrimeFib | null |
prime_fib returns n-th number that is a Fibonacci number and it's also prime.
>>> prime_fib(1)
2
>>> prime_fib(2)
3
>>> prime_fib(3)
5
>>> prime_fib(4)
13
>>> prime_fib(5)
89
|
HumanEval_csharp/40 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// TriplesSumToZero takes a list of integers as an input.
/// it returns True if there are three distinct elements in the list that
/// sum to zero, and False otherwise.
///
/// >>> TriplesSumToZero([1, 3, 5, 0])
/// False
/// >>> TriplesSumToZero([1, 3, -2, 1])
/// True
/// >>> TriplesSumToZero([1, 2, 3, 7])
/// False
/// >>> TriplesSumToZero([2, 4, -5, 3, 9, 7])
/// True
/// >>> TriplesSumToZero([1])
/// False
///
/// </summary>
public static bool TriplesSumToZero (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = TriplesSumToZero(new List<int> {1,3,5,0});
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = TriplesSumToZero(new List<int> {1,3,5,-1});
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = TriplesSumToZero(new List<int> {1,3,-2,1});
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = TriplesSumToZero(new List<int> {1,2,3,7});
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = TriplesSumToZero(new List<int> {1,2,5,7});
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = TriplesSumToZero(new List<int> {2,4,-5,3,9,7});
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = TriplesSumToZero(new List<int> {1});
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = TriplesSumToZero(new List<int> {1,3,5,-100});
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = TriplesSumToZero(new List<int> {100,3,5,-100});
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| TriplesSumToZero | null |
triples_sum_to_zero takes a list of integers as an input.
it returns True if there are three distinct elements in the list that
sum to zero, and False otherwise.
>>> triples_sum_to_zero([1, 3, 5, 0])
False
>>> triples_sum_to_zero([1, 3, -2, 1])
True
>>> triples_sum_to_zero([1, 2, 3, 7])
False
>>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])
True
>>> triples_sum_to_zero([1])
False
|
HumanEval_csharp/41 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// Imagine a road that's a perfectly straight infinitely long line.
/// n cars are driving left to right; simultaneously, a different set of n cars
/// are driving right to left. The two sets of cars start out being very far from
/// each other. All cars move in the same speed. Two cars are said to collide
/// when a car that's moving left to right hits a car that's moving right to left.
/// However, the cars are infinitely sturdy and strong; as a result, they continue moving
/// in their trajectory as if they did not collide.
///
/// This function outputs the number of such collisions.
///
/// </summary>
public static int CarRaceCollision (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CarRaceCollision(2);
var expected1 = 4;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CarRaceCollision(3);
var expected2 = 9;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CarRaceCollision(4);
var expected3 = 16;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CarRaceCollision(8);
var expected4 = 64;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CarRaceCollision(10);
var expected5 = 100;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| CarRaceCollision | null |
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's moving left to right hits a car that's moving right to left.
However, the cars are infinitely sturdy and strong; as a result, they continue moving
in their trajectory as if they did not collide.
This function outputs the number of such collisions.
|
HumanEval_csharp/42 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return list with elements incremented by 1.
/// >>> IncrList([1, 2, 3])
/// [2, 3, 4]
/// >>> IncrList([5, 3, 5, 2, 3, 3, 9, 0, 123])
/// [6, 4, 6, 3, 4, 4, 10, 1, 124]
///
/// </summary>
public static List<int> IncrList (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IncrList(new List<int> {});
var expected1 = new List<int> {};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IncrList(new List<int> {3,2,1});
var expected2 = new List<int> {4,3,2};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IncrList(new List<int> {5,2,5,2,3,3,9,0,123});
var expected3 = new List<int> {6,3,6,3,4,4,10,1,124};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| IncrList | null | Return list with elements incremented by 1.
>>> incr_list([1, 2, 3])
[2, 3, 4]
>>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])
[6, 4, 6, 3, 4, 4, 10, 1, 124]
|
HumanEval_csharp/43 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// PairsSumToZero takes a list of integers as an input.
/// it returns True if there are two distinct elements in the list that
/// sum to zero, and False otherwise.
/// >>> PairsSumToZero([1, 3, 5, 0])
/// False
/// >>> PairsSumToZero([1, 3, -2, 1])
/// False
/// >>> PairsSumToZero([1, 2, 3, 7])
/// False
/// >>> PairsSumToZero([2, 4, -5, 3, 5, 7])
/// True
/// >>> PairsSumToZero([1])
/// False
///
/// </summary>
public static bool PairsSumToZero (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = PairsSumToZero(new List<int> {1,3,5,0});
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = PairsSumToZero(new List<int> {1,3,-2,1});
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = PairsSumToZero(new List<int> {1,2,3,7});
var expected3 = false;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = PairsSumToZero(new List<int> {2,4,-5,3,5,7});
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = PairsSumToZero(new List<int> {1});
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = PairsSumToZero(new List<int> {-3,9,-1,3,2,30});
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = PairsSumToZero(new List<int> {-3,9,-1,3,2,31});
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = PairsSumToZero(new List<int> {-3,9,-1,4,2,30});
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = PairsSumToZero(new List<int> {-3,9,-1,4,2,31});
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| PairsSumToZero | null |
pairs_sum_to_zero takes a list of integers as an input.
it returns True if there are two distinct elements in the list that
sum to zero, and False otherwise.
>>> pairs_sum_to_zero([1, 3, 5, 0])
False
>>> pairs_sum_to_zero([1, 3, -2, 1])
False
>>> pairs_sum_to_zero([1, 2, 3, 7])
False
>>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])
True
>>> pairs_sum_to_zero([1])
False
|
HumanEval_csharp/44 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Change numerical base of input number x to base.
/// return string representation after the conversion.
/// base numbers are less than 10.
/// >>> ChangeBase(8, 3)
/// '22'
/// >>> ChangeBase(8, 2)
/// '1000'
/// >>> ChangeBase(7, 2)
/// '111'
///
/// </summary>
public static string ChangeBase (int x, int base)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = ChangeBase(8,3);
var expected1 = "22";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = ChangeBase(9,3);
var expected2 = "100";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = ChangeBase(234,2);
var expected3 = "11101010";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = ChangeBase(16,2);
var expected4 = "10000";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = ChangeBase(8,2);
var expected5 = "1000";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = ChangeBase(7,2);
var expected6 = "111";
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = ChangeBase(2,3);
var expected7 = "2";
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = ChangeBase(3,4);
var expected8 = "3";
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = ChangeBase(4,5);
var expected9 = "4";
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = ChangeBase(5,6);
var expected10 = "5";
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = ChangeBase(6,7);
var expected11 = "6";
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = ChangeBase(7,8);
var expected12 = "7";
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
}
}
}
| ChangeBase | null | Change numerical base of input number x to base.
return string representation after the conversion.
base numbers are less than 10.
>>> change_base(8, 3)
'22'
>>> change_base(8, 2)
'1000'
>>> change_base(7, 2)
'111'
|
HumanEval_csharp/45 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Given length of a side and high return area for a triangle.
/// >>> TriangleArea(5, 3)
/// 7.5
///
/// </summary>
public static double TriangleArea (int a, int h)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = TriangleArea(5,3);
var expected1 = 7.5;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = TriangleArea(2,2);
var expected2 = 2.0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = TriangleArea(10,8);
var expected3 = 40.0;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
}
}
}
| TriangleArea | null | Given length of a side and high return area for a triangle.
>>> triangle_area(5, 3)
7.5
|
HumanEval_csharp/46 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
/// Fib4(0) -> 0
/// Fib4(1) -> 0
/// Fib4(2) -> 2
/// Fib4(3) -> 0
/// Fib4(n) -> Fib4(n-1) + Fib4(n-2) + Fib4(n-3) + Fib4(n-4).
/// Please write a function to efficiently compute the n-th element of the Fib4 number sequence. Do not use recursion.
/// >>> Fib4(5)
/// 4
/// >>> Fib4(6)
/// 8
/// >>> Fib4(7)
/// 14
///
/// </summary>
public static int Fib4 (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Fib4(5);
var expected1 = 4;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Fib4(8);
var expected2 = 28;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Fib4(10);
var expected3 = 104;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Fib4(12);
var expected4 = 386;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| Fib4 | null | The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fib4(0) -> 0
fib4(1) -> 0
fib4(2) -> 2
fib4(3) -> 0
fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.
>>> fib4(5)
4
>>> fib4(6)
8
>>> fib4(7)
14
|
HumanEval_csharp/47 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return Median of elements in the list l.
/// >>> Median([3, 1, 2, 4, 5])
/// 3
/// >>> Median([-10, 4, 6, 1000, 10, 20])
/// 15.0
///
/// </summary>
public static object Median (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Median(new List<int> {3,1,2,4,5});
var expected1 = 3;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Median(new List<int> {-10,4,6,1000,10,20});
var expected2 = 8.0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Median(new List<int> {5});
var expected3 = 5;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Median(new List<int> {6,5});
var expected4 = 5.5;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Median(new List<int> {8,1,3,9,9,2,7});
var expected5 = 7;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| Median | null | Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
|
HumanEval_csharp/48 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// Checks if given string is a palindrome
/// >>> IsPalindrome('')
/// True
/// >>> IsPalindrome('aba')
/// True
/// >>> IsPalindrome('aaaaa')
/// True
/// >>> IsPalindrome('zbcd')
/// False
///
/// </summary>
public static bool IsPalindrome (string text)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsPalindrome("");
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsPalindrome("aba");
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsPalindrome("aaaaa");
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = IsPalindrome("zbcd");
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsPalindrome("xywyx");
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsPalindrome("xywyz");
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = IsPalindrome("xywzx");
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| IsPalindrome | null |
Checks if given string is a palindrome
>>> is_palindrome('')
True
>>> is_palindrome('aba')
True
>>> is_palindrome('aaaaa')
True
>>> is_palindrome('zbcd')
False
|
HumanEval_csharp/49 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return 2^n modulo p (be aware of numerics).
/// >>> Modp(3, 5)
/// 3
/// >>> Modp(1101, 101)
/// 2
/// >>> Modp(0, 101)
/// 1
/// >>> Modp(3, 11)
/// 8
/// >>> Modp(100, 101)
/// 1
///
/// </summary>
public static int Modp (int n, int p)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Modp(3,5);
var expected1 = 3;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Modp(1101,101);
var expected2 = 2;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Modp(0,101);
var expected3 = 1;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Modp(3,11);
var expected4 = 8;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Modp(100,101);
var expected5 = 1;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Modp(30,5);
var expected6 = 4;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Modp(31,5);
var expected7 = 3;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| Modp | null | Return 2^n modulo p (be aware of numerics).
>>> modp(3, 5)
3
>>> modp(1101, 101)
2
>>> modp(0, 101)
1
>>> modp(3, 11)
8
>>> modp(100, 101)
1
|
HumanEval_csharp/51 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// RemoveVowels is a function that takes string and returns string without vowels.
/// >>> RemoveVowels('')
/// ''
/// >>> RemoveVowels("abcdef\nghijklm")
/// 'bcdf\nghjklm'
/// >>> RemoveVowels('abcdef')
/// 'bcdf'
/// >>> RemoveVowels('aaaaa')
/// ''
/// >>> RemoveVowels('aaBAA')
/// 'B'
/// >>> RemoveVowels('zbcd')
/// 'zbcd'
///
/// </summary>
public static string RemoveVowels (string text)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = RemoveVowels("");
var expected1 = "";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = RemoveVowels("abcdef\nghijklm");
var expected2 = "bcdf\nghjklm";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = RemoveVowels("fedcba");
var expected3 = "fdcb";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = RemoveVowels("eeeee");
var expected4 = "";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = RemoveVowels("acBAA");
var expected5 = "cB";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = RemoveVowels("EcBOO");
var expected6 = "cB";
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = RemoveVowels("ybcd");
var expected7 = "ybcd";
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| RemoveVowels | null |
remove_vowels is a function that takes string and returns string without vowels.
>>> remove_vowels('')
''
>>> remove_vowels("abcdef\nghijklm")
'bcdf\nghjklm'
>>> remove_vowels('abcdef')
'bcdf'
>>> remove_vowels('aaaaa')
''
>>> remove_vowels('aaBAA')
'B'
>>> remove_vowels('zbcd')
'zbcd'
|
HumanEval_csharp/52 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return True if all numbers in the list l are below threshold t.
/// >>> BelowThreshold([1, 2, 4, 10], 100)
/// True
/// >>> BelowThreshold([1, 20, 4, 10], 5)
/// False
///
/// </summary>
public static bool BelowThreshold (List<int> l, int t)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = BelowThreshold(new List<int> {1,2,4,10},100);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = BelowThreshold(new List<int> {1,20,4,10},5);
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = BelowThreshold(new List<int> {1,20,4,10},21);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = BelowThreshold(new List<int> {1,20,4,10},22);
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = BelowThreshold(new List<int> {1,8,4,10},11);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = BelowThreshold(new List<int> {1,8,4,10},10);
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| BelowThreshold | null | Return True if all numbers in the list l are below threshold t.
>>> below_threshold([1, 2, 4, 10], 100)
True
>>> below_threshold([1, 20, 4, 10], 5)
False
|
HumanEval_csharp/53 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Add two numbers x and y
/// >>> Add(2, 3)
/// 5
/// >>> Add(5, 7)
/// 12
///
/// </summary>
public static int Add (int x, int y)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Add(0,1);
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Add(1,0);
var expected2 = 1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Add(2,3);
var expected3 = 5;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Add(5,7);
var expected4 = 12;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Add(7,5);
var expected5 = 12;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Add(572,725);
var expected6 = 1297;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Add(51,804);
var expected7 = 855;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Add(645,96);
var expected8 = 741;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = Add(712,853);
var expected9 = 1565;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = Add(223,101);
var expected10 = 324;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = Add(76,29);
var expected11 = 105;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = Add(416,149);
var expected12 = 565;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
var actual13 = Add(145,409);
var expected13 = 554;
var result13 = compareLogic.Compare(actual13, expected13);
if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");}
var actual14 = Add(535,430);
var expected14 = 965;
var result14 = compareLogic.Compare(actual14, expected14);
if (!result14.AreEqual) {throw new Exception("Exception --- test case 13 failed to pass");}
var actual15 = Add(118,303);
var expected15 = 421;
var result15 = compareLogic.Compare(actual15, expected15);
if (!result15.AreEqual) {throw new Exception("Exception --- test case 14 failed to pass");}
var actual16 = Add(287,94);
var expected16 = 381;
var result16 = compareLogic.Compare(actual16, expected16);
if (!result16.AreEqual) {throw new Exception("Exception --- test case 15 failed to pass");}
var actual17 = Add(768,257);
var expected17 = 1025;
var result17 = compareLogic.Compare(actual17, expected17);
if (!result17.AreEqual) {throw new Exception("Exception --- test case 16 failed to pass");}
var actual18 = Add(421,677);
var expected18 = 1098;
var result18 = compareLogic.Compare(actual18, expected18);
if (!result18.AreEqual) {throw new Exception("Exception --- test case 17 failed to pass");}
var actual19 = Add(802,814);
var expected19 = 1616;
var result19 = compareLogic.Compare(actual19, expected19);
if (!result19.AreEqual) {throw new Exception("Exception --- test case 18 failed to pass");}
var actual20 = Add(510,922);
var expected20 = 1432;
var result20 = compareLogic.Compare(actual20, expected20);
if (!result20.AreEqual) {throw new Exception("Exception --- test case 19 failed to pass");}
var actual21 = Add(345,819);
var expected21 = 1164;
var result21 = compareLogic.Compare(actual21, expected21);
if (!result21.AreEqual) {throw new Exception("Exception --- test case 20 failed to pass");}
var actual22 = Add(895,436);
var expected22 = 1331;
var result22 = compareLogic.Compare(actual22, expected22);
if (!result22.AreEqual) {throw new Exception("Exception --- test case 21 failed to pass");}
var actual23 = Add(123,424);
var expected23 = 547;
var result23 = compareLogic.Compare(actual23, expected23);
if (!result23.AreEqual) {throw new Exception("Exception --- test case 22 failed to pass");}
var actual24 = Add(923,245);
var expected24 = 1168;
var result24 = compareLogic.Compare(actual24, expected24);
if (!result24.AreEqual) {throw new Exception("Exception --- test case 23 failed to pass");}
var actual25 = Add(23,438);
var expected25 = 461;
var result25 = compareLogic.Compare(actual25, expected25);
if (!result25.AreEqual) {throw new Exception("Exception --- test case 24 failed to pass");}
var actual26 = Add(565,133);
var expected26 = 698;
var result26 = compareLogic.Compare(actual26, expected26);
if (!result26.AreEqual) {throw new Exception("Exception --- test case 25 failed to pass");}
var actual27 = Add(945,925);
var expected27 = 1870;
var result27 = compareLogic.Compare(actual27, expected27);
if (!result27.AreEqual) {throw new Exception("Exception --- test case 26 failed to pass");}
var actual28 = Add(261,983);
var expected28 = 1244;
var result28 = compareLogic.Compare(actual28, expected28);
if (!result28.AreEqual) {throw new Exception("Exception --- test case 27 failed to pass");}
var actual29 = Add(139,577);
var expected29 = 716;
var result29 = compareLogic.Compare(actual29, expected29);
if (!result29.AreEqual) {throw new Exception("Exception --- test case 28 failed to pass");}
var actual30 = Add(763,178);
var expected30 = 941;
var result30 = compareLogic.Compare(actual30, expected30);
if (!result30.AreEqual) {throw new Exception("Exception --- test case 29 failed to pass");}
var actual31 = Add(147,892);
var expected31 = 1039;
var result31 = compareLogic.Compare(actual31, expected31);
if (!result31.AreEqual) {throw new Exception("Exception --- test case 30 failed to pass");}
var actual32 = Add(436,402);
var expected32 = 838;
var result32 = compareLogic.Compare(actual32, expected32);
if (!result32.AreEqual) {throw new Exception("Exception --- test case 31 failed to pass");}
var actual33 = Add(610,581);
var expected33 = 1191;
var result33 = compareLogic.Compare(actual33, expected33);
if (!result33.AreEqual) {throw new Exception("Exception --- test case 32 failed to pass");}
var actual34 = Add(103,416);
var expected34 = 519;
var result34 = compareLogic.Compare(actual34, expected34);
if (!result34.AreEqual) {throw new Exception("Exception --- test case 33 failed to pass");}
var actual35 = Add(339,990);
var expected35 = 1329;
var result35 = compareLogic.Compare(actual35, expected35);
if (!result35.AreEqual) {throw new Exception("Exception --- test case 34 failed to pass");}
var actual36 = Add(130,504);
var expected36 = 634;
var result36 = compareLogic.Compare(actual36, expected36);
if (!result36.AreEqual) {throw new Exception("Exception --- test case 35 failed to pass");}
var actual37 = Add(242,717);
var expected37 = 959;
var result37 = compareLogic.Compare(actual37, expected37);
if (!result37.AreEqual) {throw new Exception("Exception --- test case 36 failed to pass");}
var actual38 = Add(562,110);
var expected38 = 672;
var result38 = compareLogic.Compare(actual38, expected38);
if (!result38.AreEqual) {throw new Exception("Exception --- test case 37 failed to pass");}
var actual39 = Add(396,909);
var expected39 = 1305;
var result39 = compareLogic.Compare(actual39, expected39);
if (!result39.AreEqual) {throw new Exception("Exception --- test case 38 failed to pass");}
var actual40 = Add(887,703);
var expected40 = 1590;
var result40 = compareLogic.Compare(actual40, expected40);
if (!result40.AreEqual) {throw new Exception("Exception --- test case 39 failed to pass");}
var actual41 = Add(870,551);
var expected41 = 1421;
var result41 = compareLogic.Compare(actual41, expected41);
if (!result41.AreEqual) {throw new Exception("Exception --- test case 40 failed to pass");}
var actual42 = Add(422,391);
var expected42 = 813;
var result42 = compareLogic.Compare(actual42, expected42);
if (!result42.AreEqual) {throw new Exception("Exception --- test case 41 failed to pass");}
var actual43 = Add(299,505);
var expected43 = 804;
var result43 = compareLogic.Compare(actual43, expected43);
if (!result43.AreEqual) {throw new Exception("Exception --- test case 42 failed to pass");}
var actual44 = Add(346,56);
var expected44 = 402;
var result44 = compareLogic.Compare(actual44, expected44);
if (!result44.AreEqual) {throw new Exception("Exception --- test case 43 failed to pass");}
var actual45 = Add(36,706);
var expected45 = 742;
var result45 = compareLogic.Compare(actual45, expected45);
if (!result45.AreEqual) {throw new Exception("Exception --- test case 44 failed to pass");}
var actual46 = Add(738,411);
var expected46 = 1149;
var result46 = compareLogic.Compare(actual46, expected46);
if (!result46.AreEqual) {throw new Exception("Exception --- test case 45 failed to pass");}
var actual47 = Add(679,87);
var expected47 = 766;
var result47 = compareLogic.Compare(actual47, expected47);
if (!result47.AreEqual) {throw new Exception("Exception --- test case 46 failed to pass");}
var actual48 = Add(25,303);
var expected48 = 328;
var result48 = compareLogic.Compare(actual48, expected48);
if (!result48.AreEqual) {throw new Exception("Exception --- test case 47 failed to pass");}
var actual49 = Add(161,612);
var expected49 = 773;
var result49 = compareLogic.Compare(actual49, expected49);
if (!result49.AreEqual) {throw new Exception("Exception --- test case 48 failed to pass");}
var actual50 = Add(306,841);
var expected50 = 1147;
var result50 = compareLogic.Compare(actual50, expected50);
if (!result50.AreEqual) {throw new Exception("Exception --- test case 49 failed to pass");}
var actual51 = Add(973,411);
var expected51 = 1384;
var result51 = compareLogic.Compare(actual51, expected51);
if (!result51.AreEqual) {throw new Exception("Exception --- test case 50 failed to pass");}
var actual52 = Add(711,157);
var expected52 = 868;
var result52 = compareLogic.Compare(actual52, expected52);
if (!result52.AreEqual) {throw new Exception("Exception --- test case 51 failed to pass");}
var actual53 = Add(471,27);
var expected53 = 498;
var result53 = compareLogic.Compare(actual53, expected53);
if (!result53.AreEqual) {throw new Exception("Exception --- test case 52 failed to pass");}
var actual54 = Add(714,792);
var expected54 = 1506;
var result54 = compareLogic.Compare(actual54, expected54);
if (!result54.AreEqual) {throw new Exception("Exception --- test case 53 failed to pass");}
var actual55 = Add(38,206);
var expected55 = 244;
var result55 = compareLogic.Compare(actual55, expected55);
if (!result55.AreEqual) {throw new Exception("Exception --- test case 54 failed to pass");}
var actual56 = Add(907,343);
var expected56 = 1250;
var result56 = compareLogic.Compare(actual56, expected56);
if (!result56.AreEqual) {throw new Exception("Exception --- test case 55 failed to pass");}
var actual57 = Add(23,760);
var expected57 = 783;
var result57 = compareLogic.Compare(actual57, expected57);
if (!result57.AreEqual) {throw new Exception("Exception --- test case 56 failed to pass");}
var actual58 = Add(524,859);
var expected58 = 1383;
var result58 = compareLogic.Compare(actual58, expected58);
if (!result58.AreEqual) {throw new Exception("Exception --- test case 57 failed to pass");}
var actual59 = Add(30,529);
var expected59 = 559;
var result59 = compareLogic.Compare(actual59, expected59);
if (!result59.AreEqual) {throw new Exception("Exception --- test case 58 failed to pass");}
var actual60 = Add(341,691);
var expected60 = 1032;
var result60 = compareLogic.Compare(actual60, expected60);
if (!result60.AreEqual) {throw new Exception("Exception --- test case 59 failed to pass");}
var actual61 = Add(167,729);
var expected61 = 896;
var result61 = compareLogic.Compare(actual61, expected61);
if (!result61.AreEqual) {throw new Exception("Exception --- test case 60 failed to pass");}
var actual62 = Add(636,289);
var expected62 = 925;
var result62 = compareLogic.Compare(actual62, expected62);
if (!result62.AreEqual) {throw new Exception("Exception --- test case 61 failed to pass");}
var actual63 = Add(503,144);
var expected63 = 647;
var result63 = compareLogic.Compare(actual63, expected63);
if (!result63.AreEqual) {throw new Exception("Exception --- test case 62 failed to pass");}
var actual64 = Add(51,985);
var expected64 = 1036;
var result64 = compareLogic.Compare(actual64, expected64);
if (!result64.AreEqual) {throw new Exception("Exception --- test case 63 failed to pass");}
var actual65 = Add(287,149);
var expected65 = 436;
var result65 = compareLogic.Compare(actual65, expected65);
if (!result65.AreEqual) {throw new Exception("Exception --- test case 64 failed to pass");}
var actual66 = Add(659,75);
var expected66 = 734;
var result66 = compareLogic.Compare(actual66, expected66);
if (!result66.AreEqual) {throw new Exception("Exception --- test case 65 failed to pass");}
var actual67 = Add(462,797);
var expected67 = 1259;
var result67 = compareLogic.Compare(actual67, expected67);
if (!result67.AreEqual) {throw new Exception("Exception --- test case 66 failed to pass");}
var actual68 = Add(406,141);
var expected68 = 547;
var result68 = compareLogic.Compare(actual68, expected68);
if (!result68.AreEqual) {throw new Exception("Exception --- test case 67 failed to pass");}
var actual69 = Add(106,44);
var expected69 = 150;
var result69 = compareLogic.Compare(actual69, expected69);
if (!result69.AreEqual) {throw new Exception("Exception --- test case 68 failed to pass");}
var actual70 = Add(300,934);
var expected70 = 1234;
var result70 = compareLogic.Compare(actual70, expected70);
if (!result70.AreEqual) {throw new Exception("Exception --- test case 69 failed to pass");}
var actual71 = Add(471,524);
var expected71 = 995;
var result71 = compareLogic.Compare(actual71, expected71);
if (!result71.AreEqual) {throw new Exception("Exception --- test case 70 failed to pass");}
var actual72 = Add(122,429);
var expected72 = 551;
var result72 = compareLogic.Compare(actual72, expected72);
if (!result72.AreEqual) {throw new Exception("Exception --- test case 71 failed to pass");}
var actual73 = Add(735,195);
var expected73 = 930;
var result73 = compareLogic.Compare(actual73, expected73);
if (!result73.AreEqual) {throw new Exception("Exception --- test case 72 failed to pass");}
var actual74 = Add(335,484);
var expected74 = 819;
var result74 = compareLogic.Compare(actual74, expected74);
if (!result74.AreEqual) {throw new Exception("Exception --- test case 73 failed to pass");}
var actual75 = Add(28,809);
var expected75 = 837;
var result75 = compareLogic.Compare(actual75, expected75);
if (!result75.AreEqual) {throw new Exception("Exception --- test case 74 failed to pass");}
var actual76 = Add(430,20);
var expected76 = 450;
var result76 = compareLogic.Compare(actual76, expected76);
if (!result76.AreEqual) {throw new Exception("Exception --- test case 75 failed to pass");}
var actual77 = Add(916,635);
var expected77 = 1551;
var result77 = compareLogic.Compare(actual77, expected77);
if (!result77.AreEqual) {throw new Exception("Exception --- test case 76 failed to pass");}
var actual78 = Add(301,999);
var expected78 = 1300;
var result78 = compareLogic.Compare(actual78, expected78);
if (!result78.AreEqual) {throw new Exception("Exception --- test case 77 failed to pass");}
var actual79 = Add(454,466);
var expected79 = 920;
var result79 = compareLogic.Compare(actual79, expected79);
if (!result79.AreEqual) {throw new Exception("Exception --- test case 78 failed to pass");}
var actual80 = Add(905,259);
var expected80 = 1164;
var result80 = compareLogic.Compare(actual80, expected80);
if (!result80.AreEqual) {throw new Exception("Exception --- test case 79 failed to pass");}
var actual81 = Add(168,205);
var expected81 = 373;
var result81 = compareLogic.Compare(actual81, expected81);
if (!result81.AreEqual) {throw new Exception("Exception --- test case 80 failed to pass");}
var actual82 = Add(570,434);
var expected82 = 1004;
var result82 = compareLogic.Compare(actual82, expected82);
if (!result82.AreEqual) {throw new Exception("Exception --- test case 81 failed to pass");}
var actual83 = Add(64,959);
var expected83 = 1023;
var result83 = compareLogic.Compare(actual83, expected83);
if (!result83.AreEqual) {throw new Exception("Exception --- test case 82 failed to pass");}
var actual84 = Add(957,510);
var expected84 = 1467;
var result84 = compareLogic.Compare(actual84, expected84);
if (!result84.AreEqual) {throw new Exception("Exception --- test case 83 failed to pass");}
var actual85 = Add(722,598);
var expected85 = 1320;
var result85 = compareLogic.Compare(actual85, expected85);
if (!result85.AreEqual) {throw new Exception("Exception --- test case 84 failed to pass");}
var actual86 = Add(770,226);
var expected86 = 996;
var result86 = compareLogic.Compare(actual86, expected86);
if (!result86.AreEqual) {throw new Exception("Exception --- test case 85 failed to pass");}
var actual87 = Add(579,66);
var expected87 = 645;
var result87 = compareLogic.Compare(actual87, expected87);
if (!result87.AreEqual) {throw new Exception("Exception --- test case 86 failed to pass");}
var actual88 = Add(117,674);
var expected88 = 791;
var result88 = compareLogic.Compare(actual88, expected88);
if (!result88.AreEqual) {throw new Exception("Exception --- test case 87 failed to pass");}
var actual89 = Add(530,30);
var expected89 = 560;
var result89 = compareLogic.Compare(actual89, expected89);
if (!result89.AreEqual) {throw new Exception("Exception --- test case 88 failed to pass");}
var actual90 = Add(776,345);
var expected90 = 1121;
var result90 = compareLogic.Compare(actual90, expected90);
if (!result90.AreEqual) {throw new Exception("Exception --- test case 89 failed to pass");}
var actual91 = Add(327,389);
var expected91 = 716;
var result91 = compareLogic.Compare(actual91, expected91);
if (!result91.AreEqual) {throw new Exception("Exception --- test case 90 failed to pass");}
var actual92 = Add(596,12);
var expected92 = 608;
var result92 = compareLogic.Compare(actual92, expected92);
if (!result92.AreEqual) {throw new Exception("Exception --- test case 91 failed to pass");}
var actual93 = Add(599,511);
var expected93 = 1110;
var result93 = compareLogic.Compare(actual93, expected93);
if (!result93.AreEqual) {throw new Exception("Exception --- test case 92 failed to pass");}
var actual94 = Add(936,476);
var expected94 = 1412;
var result94 = compareLogic.Compare(actual94, expected94);
if (!result94.AreEqual) {throw new Exception("Exception --- test case 93 failed to pass");}
var actual95 = Add(461,14);
var expected95 = 475;
var result95 = compareLogic.Compare(actual95, expected95);
if (!result95.AreEqual) {throw new Exception("Exception --- test case 94 failed to pass");}
var actual96 = Add(966,157);
var expected96 = 1123;
var result96 = compareLogic.Compare(actual96, expected96);
if (!result96.AreEqual) {throw new Exception("Exception --- test case 95 failed to pass");}
var actual97 = Add(326,91);
var expected97 = 417;
var result97 = compareLogic.Compare(actual97, expected97);
if (!result97.AreEqual) {throw new Exception("Exception --- test case 96 failed to pass");}
var actual98 = Add(392,455);
var expected98 = 847;
var result98 = compareLogic.Compare(actual98, expected98);
if (!result98.AreEqual) {throw new Exception("Exception --- test case 97 failed to pass");}
var actual99 = Add(446,477);
var expected99 = 923;
var result99 = compareLogic.Compare(actual99, expected99);
if (!result99.AreEqual) {throw new Exception("Exception --- test case 98 failed to pass");}
var actual100 = Add(324,860);
var expected100 = 1184;
var result100 = compareLogic.Compare(actual100, expected100);
if (!result100.AreEqual) {throw new Exception("Exception --- test case 99 failed to pass");}
var actual101 = Add(945,85);
var expected101 = 1030;
var result101 = compareLogic.Compare(actual101, expected101);
if (!result101.AreEqual) {throw new Exception("Exception --- test case 100 failed to pass");}
var actual102 = Add(886,582);
var expected102 = 1468;
var result102 = compareLogic.Compare(actual102, expected102);
if (!result102.AreEqual) {throw new Exception("Exception --- test case 101 failed to pass");}
var actual103 = Add(886,712);
var expected103 = 1598;
var result103 = compareLogic.Compare(actual103, expected103);
if (!result103.AreEqual) {throw new Exception("Exception --- test case 102 failed to pass");}
var actual104 = Add(842,953);
var expected104 = 1795;
var result104 = compareLogic.Compare(actual104, expected104);
if (!result104.AreEqual) {throw new Exception("Exception --- test case 103 failed to pass");}
}
}
}
| Add | null | Add two numbers x and y
>>> add(2, 3)
5
>>> add(5, 7)
12
|
HumanEval_csharp/54 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
///
/// Check if two words have the same characters.
/// >>> SameChars('eabcdzzzz', 'dddzzzzzzzddeddabc')
/// True
/// >>> SameChars('abcd', 'dddddddabc')
/// True
/// >>> SameChars('dddddddabc', 'abcd')
/// True
/// >>> SameChars('eabcd', 'dddddddabc')
/// False
/// >>> SameChars('abcd', 'dddddddabce')
/// False
/// >>> SameChars('eabcdzzzz', 'dddzzzzzzzddddabc')
/// False
///
/// </summary>
public static bool SameChars (string s0, string s1)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SameChars("eabcdzzzz","dddzzzzzzzddeddabc");
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SameChars("abcd","dddddddabc");
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SameChars("dddddddabc","abcd");
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SameChars("eabcd","dddddddabc");
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SameChars("abcd","dddddddabcf");
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = SameChars("eabcdzzzz","dddzzzzzzzddddabc");
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = SameChars("aabb","aaccc");
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| SameChars | null |
Check if two words have the same characters.
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
True
>>> same_chars('abcd', 'dddddddabc')
True
>>> same_chars('dddddddabc', 'abcd')
True
>>> same_chars('eabcd', 'dddddddabc')
False
>>> same_chars('abcd', 'dddddddabce')
False
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')
False
|
HumanEval_csharp/55 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return n-th Fibonacci number.
/// >>> Fib(10)
/// 55
/// >>> Fib(1)
/// 1
/// >>> Fib(8)
/// 21
///
/// </summary>
public static int Fib (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Fib(10);
var expected1 = 55;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Fib(1);
var expected2 = 1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Fib(8);
var expected3 = 21;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Fib(11);
var expected4 = 89;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Fib(12);
var expected5 = 144;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| Fib | null | Return n-th Fibonacci number.
>>> fib(10)
55
>>> fib(1)
1
>>> fib(8)
21
|
HumanEval_csharp/56 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// brackets is a string of "<" and ">".
/// return True if every opening bracket has a corresponding closing bracket.
///
/// >>> CorrectBracketing("<")
/// False
/// >>> CorrectBracketing("<>")
/// True
/// >>> CorrectBracketing("<<><>>")
/// True
/// >>> CorrectBracketing("><<>")
/// False
///
/// </summary>
public static bool CorrectBracketing (string brackets)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CorrectBracketing("<>");
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CorrectBracketing("<<><>>");
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CorrectBracketing("<><><<><>><>");
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CorrectBracketing("<><><<<><><>><>><<><><<>>>");
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CorrectBracketing("<<<><>>>>");
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = CorrectBracketing("><<>");
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = CorrectBracketing("<");
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = CorrectBracketing("<<<<");
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = CorrectBracketing(">");
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = CorrectBracketing("<<>");
var expected10 = false;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = CorrectBracketing("<><><<><>><>><<>");
var expected11 = false;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = CorrectBracketing("<><><<><>><>>><>");
var expected12 = false;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
}
}
}
| CorrectBracketing | null | brackets is a string of "<" and ">".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing("<")
False
>>> correct_bracketing("<>")
True
>>> correct_bracketing("<<><>>")
True
>>> correct_bracketing("><<>")
False
|
HumanEval_csharp/57 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return True is list elements are Monotonically increasing or decreasing.
/// >>> Monotonic([1, 2, 4, 20])
/// True
/// >>> Monotonic([1, 20, 4, 10])
/// False
/// >>> Monotonic([4, 1, 0, -10])
/// True
///
/// </summary>
public static bool Monotonic (List<int> l)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Monotonic(new List<int> {1,2,4,10});
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Monotonic(new List<int> {1,2,4,20});
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Monotonic(new List<int> {1,20,4,10});
var expected3 = false;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Monotonic(new List<int> {4,1,0,-10});
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Monotonic(new List<int> {4,1,1,0});
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Monotonic(new List<int> {1,2,3,2,5,60});
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Monotonic(new List<int> {1,2,3,4,5,60});
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Monotonic(new List<int> {9,9,9,9});
var expected8 = true;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| Monotonic | null | Return True is list elements are monotonically increasing or decreasing.
>>> monotonic([1, 2, 4, 20])
True
>>> monotonic([1, 20, 4, 10])
False
>>> monotonic([4, 1, 0, -10])
True
|
HumanEval_csharp/58 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return sorted unique Common elements for two lists.
/// >>> Common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
/// [1, 5, 653]
/// >>> Common([5, 3, 2, 8], [3, 2])
/// [2, 3]
///
///
/// </summary>
public static List<int> Common (List<int> l1, List<int> l2)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Common(new List<int> {1,4,3,34,653,2,5},new List<int> {5,7,1,5,9,653,121});
var expected1 = new List<int> {1,5,653};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Common(new List<int> {5,3,2,8},new List<int> {3,2});
var expected2 = new List<int> {2,3};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Common(new List<int> {4,3,2,8},new List<int> {3,2,4});
var expected3 = new List<int> {2,3,4};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Common(new List<int> {4,3,2,8},new List<int> {});
var expected4 = new List<int> {};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| Common | null | Return sorted unique common elements for two lists.
>>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
[1, 5, 653]
>>> common([5, 3, 2, 8], [3, 2])
[2, 3]
|
HumanEval_csharp/59 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Return the largest prime factor of n. Assume n > 1 and is not a prime.
/// >>> LargestPrimeFactor(13195)
/// 29
/// >>> LargestPrimeFactor(2048)
/// 2
///
/// </summary>
public static int LargestPrimeFactor (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = LargestPrimeFactor(15);
var expected1 = 5;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = LargestPrimeFactor(27);
var expected2 = 3;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = LargestPrimeFactor(63);
var expected3 = 7;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = LargestPrimeFactor(330);
var expected4 = 11;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = LargestPrimeFactor(13195);
var expected5 = 29;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| LargestPrimeFactor | null | Return the largest prime factor of n. Assume n > 1 and is not a prime.
>>> largest_prime_factor(13195)
29
>>> largest_prime_factor(2048)
2
|
HumanEval_csharp/60 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// SumToN is a function that sums numbers from 1 to n.
/// >>> SumToN(30)
/// 465
/// >>> SumToN(100)
/// 5050
/// >>> SumToN(5)
/// 15
/// >>> SumToN(10)
/// 55
/// >>> SumToN(1)
/// 1
///
/// </summary>
public static int SumToN (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SumToN(1);
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SumToN(6);
var expected2 = 21;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SumToN(11);
var expected3 = 66;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SumToN(30);
var expected4 = 465;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SumToN(100);
var expected5 = 5050;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| SumToN | null | sum_to_n is a function that sums numbers from 1 to n.
>>> sum_to_n(30)
465
>>> sum_to_n(100)
5050
>>> sum_to_n(5)
15
>>> sum_to_n(10)
55
>>> sum_to_n(1)
1
|
HumanEval_csharp/61 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// brackets is a string of "(" and ")".
/// return True if every opening bracket has a corresponding closing bracket.
///
/// >>> CorrectBracketing("(")
/// False
/// >>> CorrectBracketing("()")
/// True
/// >>> CorrectBracketing("(()())")
/// True
/// >>> CorrectBracketing(")(()")
/// False
///
/// </summary>
public static bool CorrectBracketing (string brackets)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CorrectBracketing("()");
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CorrectBracketing("(()())");
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CorrectBracketing("()()(()())()");
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CorrectBracketing("()()((()()())())(()()(()))");
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CorrectBracketing("((()())))");
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = CorrectBracketing(")(()");
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = CorrectBracketing("(");
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = CorrectBracketing("((((");
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = CorrectBracketing(")");
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = CorrectBracketing("(()");
var expected10 = false;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = CorrectBracketing("()()(()())())(()");
var expected11 = false;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = CorrectBracketing("()()(()())()))()");
var expected12 = false;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
}
}
}
| CorrectBracketing | null | brackets is a string of "(" and ")".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing("(")
False
>>> correct_bracketing("()")
True
>>> correct_bracketing("(()())")
True
>>> correct_bracketing(")(()")
False
|
HumanEval_csharp/62 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// xs represent coefficients of a polynomial.
/// xs[0] + xs[1] * x + xs[2] * x^2 + ....
/// Return Derivative of this polynomial in the same form.
/// >>> Derivative([3, 1, 2, 4, 5])
/// [1, 4, 12, 20]
/// >>> Derivative([1, 2, 3])
/// [2, 6]
///
/// </summary>
public static List<int> Derivative (List<int> xs)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Derivative(new List<int> {3,1,2,4,5});
var expected1 = new List<int> {1,4,12,20};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Derivative(new List<int> {1,2,3});
var expected2 = new List<int> {2,6};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Derivative(new List<int> {3,2,1});
var expected3 = new List<int> {2,2};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Derivative(new List<int> {3,2,1,0,4});
var expected4 = new List<int> {2,2,0,16};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Derivative(new List<int> {1});
var expected5 = new List<int> {};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| Derivative | null | xs represent coefficients of a polynomial.
xs[0] + xs[1] * x + xs[2] * x^2 + ....
Return derivative of this polynomial in the same form.
>>> derivative([3, 1, 2, 4, 5])
[1, 4, 12, 20]
>>> derivative([1, 2, 3])
[2, 6]
|
HumanEval_csharp/63 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
/// Fibfib(0) == 0
/// Fibfib(1) == 0
/// Fibfib(2) == 1
/// Fibfib(n) == Fibfib(n-1) + Fibfib(n-2) + Fibfib(n-3).
/// Please write a function to efficiently compute the n-th element of the Fibfib number sequence.
/// >>> Fibfib(1)
/// 0
/// >>> Fibfib(5)
/// 4
/// >>> Fibfib(8)
/// 24
///
/// </summary>
public static int Fibfib (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Fibfib(2);
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Fibfib(1);
var expected2 = 0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Fibfib(5);
var expected3 = 4;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Fibfib(8);
var expected4 = 24;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Fibfib(10);
var expected5 = 81;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Fibfib(12);
var expected6 = 274;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Fibfib(14);
var expected7 = 927;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| Fibfib | null | The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fibfib(0) == 0
fibfib(1) == 0
fibfib(2) == 1
fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
Please write a function to efficiently compute the n-th element of the fibfib number sequence.
>>> fibfib(1)
0
>>> fibfib(5)
4
>>> fibfib(8)
24
|
HumanEval_csharp/64 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Write a function VowelsCount which takes a string representing
/// a word as input and returns the number of vowels in the string.
/// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
/// vowel, but only when it is at the end of the given word.
///
/// Example:
/// >>> VowelsCount("abcde")
/// 2
/// >>> VowelsCount("ACEDY")
/// 3
///
/// </summary>
public static int VowelsCount (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = VowelsCount("abcde");
var expected1 = 2;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = VowelsCount("Alone");
var expected2 = 3;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = VowelsCount("key");
var expected3 = 2;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = VowelsCount("bye");
var expected4 = 1;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = VowelsCount("keY");
var expected5 = 2;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = VowelsCount("bYe");
var expected6 = 1;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = VowelsCount("ACEDY");
var expected7 = 3;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| VowelsCount | null | Write a function vowels_count which takes a string representing
a word as input and returns the number of vowels in the string.
Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
vowel, but only when it is at the end of the given word.
Example:
>>> vowels_count("abcde")
2
>>> vowels_count("ACEDY")
3
|
HumanEval_csharp/65 | csharp | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using KellermanSoftware.CompareNetObjects;
namespace Solution
{
public class Program
{
/// <summary>
/// You're an expert C# programmer
/// Circular shift the digits of the integer x, shift the digits right by shift
/// and return the result as a string.
/// If shift > number of digits, return digits reversed.
/// >>> CircularShift(12, 1)
/// "21"
/// >>> CircularShift(12, 2)
/// "12"
///
/// </summary>
public static string CircularShift (int x, int shift)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CircularShift(100,2);
var expected1 = "001";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CircularShift(12,2);
var expected2 = "12";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CircularShift(97,8);
var expected3 = "79";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CircularShift(12,1);
var expected4 = "21";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CircularShift(11,101);
var expected5 = "11";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| CircularShift | null | Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
"21"
>>> circular_shift(12, 2)
"12"
|
HumanEval_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 | null | 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
|
HumanEval_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 | null |
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:
fruit_distribution("5 apples and 6 oranges", 19) ->19 - 5 - 6 = 8
fruit_distribution("0 apples and 1 oranges",3) -> 3 - 0 - 1 = 2
fruit_distribution("2 apples and 3 oranges", 100) -> 100 - 2 - 3 = 95
fruit_distribution("100 apples and 1 oranges",120) -> 120 - 100 - 1 = 19
|
HumanEval_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 | null |
"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
|
HumanEval_csharp/69 | 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 are given a non-empty list of positive integers. Return the greatest integer that is greater than
/// zero, and has a frequency greater than or equal to the value of the integer itself.
/// The frequency of an integer is the number of times it appears in the list.
/// If no such a value exist, return -1.
/// Examples:
/// Search([4, 1, 2, 2, 3, 1]) == 2
/// Search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
/// Search([5, 5, 4, 4, 4]) == -1
///
/// </summary>
public static int Search (List<int> lst)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Search(new List<int> {5,5,5,5,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 = Search(new List<int> {4,1,4,1,4,4});
var expected2 = 4;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Search(new List<int> {3,3});
var expected3 = -1;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Search(new List<int> {8,8,8,8,8,8,8,8});
var expected4 = 8;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Search(new List<int> {2,3,3,2,2});
var expected5 = 2;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Search(new List<int> {2,7,8,8,4,8,7,3,9,6,5,10,4,3,6,7,1,7,4,10,8,1});
var expected6 = 1;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Search(new List<int> {3,2,8,2});
var expected7 = 2;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Search(new List<int> {6,7,1,8,8,10,5,8,5,3,10});
var expected8 = 1;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = Search(new List<int> {8,8,3,6,5,6,4});
var expected9 = -1;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = Search(new List<int> {6,9,6,7,1,4,7,1,8,8,9,8,10,10,8,4,10,4,10,1,2,9,5,7,9});
var expected10 = 1;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = Search(new List<int> {1,9,10,1,3});
var expected11 = 1;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = Search(new List<int> {6,9,7,5,8,7,5,3,7,5,10,10,3,6,10,2,8,6,5,4,9,5,3,10});
var expected12 = 5;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
var actual13 = Search(new List<int> {1});
var expected13 = 1;
var result13 = compareLogic.Compare(actual13, expected13);
if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");}
var actual14 = Search(new List<int> {8,8,10,6,4,3,5,8,2,4,2,8,4,6,10,4,2,1,10,2,1,1,5});
var expected14 = 4;
var result14 = compareLogic.Compare(actual14, expected14);
if (!result14.AreEqual) {throw new Exception("Exception --- test case 13 failed to pass");}
var actual15 = Search(new List<int> {2,10,4,8,2,10,5,1,2,9,5,5,6,3,8,6,4,10});
var expected15 = 2;
var result15 = compareLogic.Compare(actual15, expected15);
if (!result15.AreEqual) {throw new Exception("Exception --- test case 14 failed to pass");}
var actual16 = Search(new List<int> {1,6,10,1,6,9,10,8,6,8,7,3});
var expected16 = 1;
var result16 = compareLogic.Compare(actual16, expected16);
if (!result16.AreEqual) {throw new Exception("Exception --- test case 15 failed to pass");}
var actual17 = Search(new List<int> {9,2,4,1,5,1,5,2,5,7,7,7,3,10,1,5,4,2,8,4,1,9,10,7,10,2,8,10,9,4});
var expected17 = 4;
var result17 = compareLogic.Compare(actual17, expected17);
if (!result17.AreEqual) {throw new Exception("Exception --- test case 16 failed to pass");}
var actual18 = Search(new List<int> {2,6,4,2,8,7,5,6,4,10,4,6,3,7,8,8,3,1,4,2,2,10,7});
var expected18 = 4;
var result18 = compareLogic.Compare(actual18, expected18);
if (!result18.AreEqual) {throw new Exception("Exception --- test case 17 failed to pass");}
var actual19 = Search(new List<int> {9,8,6,10,2,6,10,2,7,8,10,3,8,2,6,2,3,1});
var expected19 = 2;
var result19 = compareLogic.Compare(actual19, expected19);
if (!result19.AreEqual) {throw new Exception("Exception --- test case 18 failed to pass");}
var actual20 = Search(new List<int> {5,5,3,9,5,6,3,2,8,5,6,10,10,6,8,4,10,7,7,10,8});
var expected20 = -1;
var result20 = compareLogic.Compare(actual20, expected20);
if (!result20.AreEqual) {throw new Exception("Exception --- test case 19 failed to pass");}
var actual21 = Search(new List<int> {10});
var expected21 = -1;
var result21 = compareLogic.Compare(actual21, expected21);
if (!result21.AreEqual) {throw new Exception("Exception --- test case 20 failed to pass");}
var actual22 = Search(new List<int> {9,7,7,2,4,7,2,10,9,7,5,7,2});
var expected22 = 2;
var result22 = compareLogic.Compare(actual22, expected22);
if (!result22.AreEqual) {throw new Exception("Exception --- test case 21 failed to pass");}
var actual23 = Search(new List<int> {5,4,10,2,1,1,10,3,6,1,8});
var expected23 = 1;
var result23 = compareLogic.Compare(actual23, expected23);
if (!result23.AreEqual) {throw new Exception("Exception --- test case 22 failed to pass");}
var actual24 = Search(new List<int> {7,9,9,9,3,4,1,5,9,1,2,1,1,10,7,5,6,7,6,7,7,6});
var expected24 = 1;
var result24 = compareLogic.Compare(actual24, expected24);
if (!result24.AreEqual) {throw new Exception("Exception --- test case 23 failed to pass");}
var actual25 = Search(new List<int> {3,10,10,9,2});
var expected25 = -1;
var result25 = compareLogic.Compare(actual25, expected25);
if (!result25.AreEqual) {throw new Exception("Exception --- test case 24 failed to pass");}
}
}
}
| Search | null |
You are given a non-empty list of positive integers. Return the greatest integer that is greater than
zero, and has a frequency greater than or equal to the value of the integer itself.
The frequency of an integer is the number of times it appears in the list.
If no such a value exist, return -1.
Examples:
search([4, 1, 2, 2, 3, 1]) == 2
search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
search([5, 5, 4, 4, 4]) == -1
|
HumanEval_csharp/70 | 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 integers, return list in strange order.
/// Strange sorting, is when you start with the minimum value,
/// then maximum of the remaining integers, then minimum and so on.
///
/// Examples:
/// StrangeSortList([1, 2, 3, 4]) == [1, 4, 2, 3]
/// StrangeSortList([5, 5, 5, 5]) == [5, 5, 5, 5]
/// StrangeSortList([]) == []
///
/// </summary>
public static List<int> StrangeSortList (List<int> lst)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = StrangeSortList(new List<int> {1,2,3,4});
var expected1 = new List<int> {1,4,2,3};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = StrangeSortList(new List<int> {5,6,7,8,9});
var expected2 = new List<int> {5,9,6,8,7};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = StrangeSortList(new List<int> {1,2,3,4,5});
var expected3 = new List<int> {1,5,2,4,3};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = StrangeSortList(new List<int> {5,6,7,8,9,1});
var expected4 = new List<int> {1,9,5,8,6,7};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = StrangeSortList(new List<int> {5,5,5,5});
var expected5 = new List<int> {5,5,5,5};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = StrangeSortList(new List<int> {});
var expected6 = new List<int> {};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = StrangeSortList(new List<int> {1,2,3,4,5,6,7,8});
var expected7 = new List<int> {1,8,2,7,3,6,4,5};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = StrangeSortList(new List<int> {0,2,2,2,5,5,-5,-5});
var expected8 = new List<int> {-5,5,-5,5,0,2,2,2};
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = StrangeSortList(new List<int> {111111});
var expected9 = new List<int> {111111};
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| StrangeSortList | null |
Given list of integers, return list in strange order.
Strange sorting, is when you start with the minimum value,
then maximum of the remaining integers, then minimum and so on.
Examples:
strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3]
strange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5]
strange_sort_list([]) == []
|
HumanEval_csharp/71 | 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 the lengths of the three sides of a triangle. Return the area of
/// the triangle rounded to 2 decimal points if the three sides form a valid triangle.
/// Otherwise return -1
/// Three sides make a valid triangle when the sum of any two sides is greater
/// than the third side.
/// Example:
/// TriangleArea(3, 4, 5) == 6.00
/// TriangleArea(1, 2, 10) == -1
///
/// </summary>
public static object TriangleArea (int a, int b, int c)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = TriangleArea(3,4,5);
var expected1 = 6.0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = TriangleArea(1,2,10);
var expected2 = -1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = TriangleArea(4,8,5);
var expected3 = 8.18;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = TriangleArea(2,2,2);
var expected4 = 1.73;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = TriangleArea(1,2,3);
var expected5 = -1;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = TriangleArea(10,5,7);
var expected6 = 16.25;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = TriangleArea(2,6,3);
var expected7 = -1;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = TriangleArea(1,1,1);
var expected8 = 0.43;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = TriangleArea(2,2,10);
var expected9 = -1;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| TriangleArea | null |
Given the lengths of the three sides of a triangle. Return the area of
the triangle rounded to 2 decimal points if the three sides form a valid triangle.
Otherwise return -1
Three sides make a valid triangle when the sum of any two sides is greater
than the third side.
Example:
triangle_area(3, 4, 5) == 6.00
triangle_area(1, 2, 10) == -1
|
HumanEval_csharp/72 | 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 that returns True if the object q will fly, and False otherwise.
/// The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
///
/// Example:
/// WillItFly([1, 2], 5) β False
/// # 1+2 is less than the maximum possible weight, but it's unbalanced.
///
/// WillItFly([3, 2, 3], 1) β False
/// # it's balanced, but 3+2+3 is more than the maximum possible weight.
///
/// WillItFly([3, 2, 3], 9) β True
/// # 3+2+3 is less than the maximum possible weight, and it's balanced.
///
/// WillItFly([3], 5) β True
/// # 3 is less than the maximum possible weight, and it's balanced.
///
/// </summary>
public static bool WillItFly (List<int> q, int w)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = WillItFly(new List<int> {3,2,3},9);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = WillItFly(new List<int> {1,2},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 = WillItFly(new List<int> {3},5);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = WillItFly(new List<int> {3,2,3},1);
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = WillItFly(new List<int> {1,2,3},6);
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = WillItFly(new List<int> {5},5);
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| WillItFly | null |
Write a function that returns True if the object q will fly, and False otherwise.
The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
Example:
will_it_fly([1, 2], 5) β False
# 1+2 is less than the maximum possible weight, but it's unbalanced.
will_it_fly([3, 2, 3], 1) β False
# it's balanced, but 3+2+3 is more than the maximum possible weight.
will_it_fly([3, 2, 3], 9) β True
# 3+2+3 is less than the maximum possible weight, and it's balanced.
will_it_fly([3], 5) β True
# 3 is less than the maximum possible weight, and it's balanced.
|
HumanEval_csharp/73 | 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 arr of integers, find the minimum number of elements that
/// need to be changed to make the array palindromic. A palindromic array is an array that
/// is read the same backwards and forwards. In one change, you can change one element to any other element.
///
/// For example:
/// SmallestChange([1,2,3,5,4,7,9,6]) == 4
/// SmallestChange([1, 2, 3, 4, 3, 2, 2]) == 1
/// SmallestChange([1, 2, 3, 2, 1]) == 0
///
/// </summary>
public static int SmallestChange (List<int> arr)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SmallestChange(new List<int> {1,2,3,5,4,7,9,6});
var expected1 = 4;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = SmallestChange(new List<int> {1,2,3,4,3,2,2});
var expected2 = 1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SmallestChange(new List<int> {1,4,2});
var expected3 = 1;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SmallestChange(new List<int> {1,4,4,2});
var expected4 = 1;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SmallestChange(new List<int> {1,2,3,2,1});
var expected5 = 0;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = SmallestChange(new List<int> {3,1,1,3});
var expected6 = 0;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = SmallestChange(new List<int> {1});
var expected7 = 0;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = SmallestChange(new List<int> {0,1});
var expected8 = 1;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| SmallestChange | null |
Given an array arr of integers, find the minimum number of elements that
need to be changed to make the array palindromic. A palindromic array is an array that
is read the same backwards and forwards. In one change, you can change one element to any other element.
For example:
smallest_change([1,2,3,5,4,7,9,6]) == 4
smallest_change([1, 2, 3, 4, 3, 2, 2]) == 1
smallest_change([1, 2, 3, 2, 1]) == 0
|
HumanEval_csharp/74 | 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 that accepts two lists of strings and returns the list that has
/// total number of chars in the all strings of the list less than the other list.
///
/// if the two lists have the same number of chars, return the first list.
///
/// Examples
/// TotalMatch([], []) β []
/// TotalMatch(['hi', 'admin'], ['hI', 'Hi']) β ['hI', 'Hi']
/// TotalMatch(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) β ['hi', 'admin']
/// TotalMatch(['hi', 'admin'], ['hI', 'hi', 'hi']) β ['hI', 'hi', 'hi']
/// TotalMatch(['4'], ['1', '2', '3', '4', '5']) β ['4']
///
/// </summary>
public static List<string> TotalMatch (List<string> lst1, List<string> lst2)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = TotalMatch(new List<string> {},new List<string> {});
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 = TotalMatch(new List<string> {"hi","admin"},new List<string> {"hi","hi"});
var expected2 = new List<string> {"hi","hi"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = TotalMatch(new List<string> {"hi","admin"},new List<string> {"hi","hi","admin","project"});
var expected3 = new List<string> {"hi","admin"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = TotalMatch(new List<string> {"4"},new List<string> {"1","2","3","4","5"});
var expected4 = new List<string> {"4"};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = TotalMatch(new List<string> {"hi","admin"},new List<string> {"hI","Hi"});
var expected5 = new List<string> {"hI","Hi"};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = TotalMatch(new List<string> {"hi","admin"},new List<string> {"hI","hi","hi"});
var expected6 = new List<string> {"hI","hi","hi"};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = TotalMatch(new List<string> {"hi","admin"},new List<string> {"hI","hi","hii"});
var expected7 = new List<string> {"hi","admin"};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = TotalMatch(new List<string> {},new List<string> {"this"});
var expected8 = new List<string> {};
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = TotalMatch(new List<string> {"this"},new List<string> {});
var expected9 = new List<string> {};
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| TotalMatch | null |
Write a function that accepts two lists of strings and returns the list that has
total number of chars in the all strings of the list less than the other list.
if the two lists have the same number of chars, return the first list.
Examples
total_match([], []) β []
total_match(['hi', 'admin'], ['hI', 'Hi']) β ['hI', 'Hi']
total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) β ['hi', 'admin']
total_match(['hi', 'admin'], ['hI', 'hi', 'hi']) β ['hI', 'hi', 'hi']
total_match(['4'], ['1', '2', '3', '4', '5']) β ['4']
|
HumanEval_csharp/75 | 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 that returns true if the given number is the multiplication of 3 prime numbers
/// and false otherwise.
/// Knowing that (a) is less then 100.
/// Example:
/// IsMultiplyPrime(30) == True
/// 30 = 2 * 3 * 5
///
/// </summary>
public static bool IsMultiplyPrime (int a)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsMultiplyPrime(5);
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsMultiplyPrime(30);
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsMultiplyPrime(8);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = IsMultiplyPrime(10);
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsMultiplyPrime(125);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsMultiplyPrime(105);
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = IsMultiplyPrime(126);
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = IsMultiplyPrime(729);
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = IsMultiplyPrime(891);
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = IsMultiplyPrime(1001);
var expected10 = true;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
}
}
}
| IsMultiplyPrime | null | Write a function that returns true if the given number is the multiplication of 3 prime numbers
and false otherwise.
Knowing that (a) is less then 100.
Example:
is_multiply_prime(30) == True
30 = 2 * 3 * 5
|
HumanEval_csharp/76 | 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
/// Your task is to write a function that returns true if a number x is a simple
/// power of n and false in other cases.
/// x is a simple power of n if n**int=x
/// For example:
/// IsSimplePower(1, 4) => true
/// IsSimplePower(2, 2) => true
/// IsSimplePower(8, 2) => true
/// IsSimplePower(3, 2) => false
/// IsSimplePower(3, 1) => false
/// IsSimplePower(5, 3) => false
///
/// </summary>
public static bool IsSimplePower (int x, int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsSimplePower(16,2);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsSimplePower(143214,16);
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsSimplePower(4,2);
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = IsSimplePower(9,3);
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsSimplePower(16,4);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsSimplePower(24,2);
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = IsSimplePower(128,4);
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = IsSimplePower(12,6);
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = IsSimplePower(1,1);
var expected9 = true;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = IsSimplePower(1,12);
var expected10 = true;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
}
}
}
| IsSimplePower | null | Your task is to write a function that returns true if a number x is a simple
power of n and false in other cases.
x is a simple power of n if n**int=x
For example:
is_simple_power(1, 4) => true
is_simple_power(2, 2) => true
is_simple_power(8, 2) => true
is_simple_power(3, 2) => false
is_simple_power(3, 1) => false
is_simple_power(5, 3) => false
|
HumanEval_csharp/77 | 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 that takes an integer a and returns True
/// if this ingeger is a cube of some integer number.
/// Note: you may assume the input is always valid.
/// Examples:
/// Iscube(1) ==> True
/// Iscube(2) ==> False
/// Iscube(-1) ==> True
/// Iscube(64) ==> True
/// Iscube(0) ==> True
/// Iscube(180) ==> False
///
/// </summary>
public static bool Iscube (int a)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Iscube(1);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Iscube(2);
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Iscube(-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 = Iscube(64);
var expected4 = true;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Iscube(180);
var expected5 = false;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Iscube(1000);
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Iscube(0);
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Iscube(1729);
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| Iscube | null |
Write a function that takes an integer a and returns True
if this ingeger is a cube of some integer number.
Note: you may assume the input is always valid.
Examples:
iscube(1) ==> True
iscube(2) ==> False
iscube(-1) ==> True
iscube(64) ==> True
iscube(0) ==> True
iscube(180) ==> False
|
HumanEval_csharp/78 | 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 have been tasked to write a function that receives
/// a hexadecimal number as a string and counts the number of hexadecimal
/// digits that are primes (prime number, or a prime, is a natural number
/// greater than 1 that is not a product of two smaller natural numbers).
/// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
/// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
/// So you have to determine a number of the following digits: 2, 3, 5, 7,
/// B (=decimal 11), D (=decimal 13).
/// Note: you may assume the input is always correct or empty string,
/// and symbols A,B,C,D,E,F are always uppercase.
/// Examples:
/// For num = "AB" the output should be 1.
/// For num = "1077E" the output should be 2.
/// For num = "ABED1A33" the output should be 4.
/// For num = "123456789ABCDEF0" the output should be 6.
/// For num = "2020" the output should be 2.
///
/// </summary>
public static int HexKey (object num)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = HexKey("AB");
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = HexKey("1077E");
var expected2 = 2;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = HexKey("ABED1A33");
var expected3 = 4;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = HexKey("2020");
var expected4 = 2;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = HexKey("123456789ABCDEF0");
var expected5 = 6;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = HexKey("112233445566778899AABBCCDDEEFF00");
var expected6 = 12;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = HexKey(new List<object> {});
var expected7 = 0;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| HexKey | null | You have been tasked to write a function that receives
a hexadecimal number as a string and counts the number of hexadecimal
digits that are primes (prime number, or a prime, is a natural number
greater than 1 that is not a product of two smaller natural numbers).
Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
So you have to determine a number of the following digits: 2, 3, 5, 7,
B (=decimal 11), D (=decimal 13).
Note: you may assume the input is always correct or empty string,
and symbols A,B,C,D,E,F are always uppercase.
Examples:
For num = "AB" the output should be 1.
For num = "1077E" the output should be 2.
For num = "ABED1A33" the output should be 4.
For num = "123456789ABCDEF0" the output should be 6.
For num = "2020" the output should be 2.
|
HumanEval_csharp/79 | 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 will be given a number in decimal form and your task is to convert it to
/// binary format. The function should return a string, with each character representing a binary
/// number. Each character in the string will be '0' or '1'.
///
/// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
/// The extra characters are there to help with the format.
///
/// Examples:
/// DecimalToBinary(15) # returns "db1111db"
/// DecimalToBinary(32) # returns "db100000db"
///
/// </summary>
public static string DecimalToBinary (int decimal)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = DecimalToBinary(0);
var expected1 = "db0db";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = DecimalToBinary(32);
var expected2 = "db100000db";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = DecimalToBinary(103);
var expected3 = "db1100111db";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = DecimalToBinary(15);
var expected4 = "db1111db";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| DecimalToBinary | null | You will be given a number in decimal form and your task is to convert it to
binary format. The function should return a string, with each character representing a binary
number. Each character in the string will be '0' or '1'.
There will be an extra couple of characters 'db' at the beginning and at the end of the string.
The extra characters are there to help with the format.
Examples:
decimal_to_binary(15) # returns "db1111db"
decimal_to_binary(32) # returns "db100000db"
|
HumanEval_csharp/80 | 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 are given a string s.
/// Your task is to check if the string is happy or not.
/// A string is happy if its length is at least 3 and every 3 consecutive letters are distinct
/// For example:
/// IsHappy(a) => False
/// IsHappy(aa) => False
/// IsHappy(abcd) => True
/// IsHappy(aabb) => False
/// IsHappy(adb) => True
/// IsHappy(xyy) => False
///
/// </summary>
public static bool IsHappy (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsHappy("a");
var expected1 = false;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsHappy("aa");
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsHappy("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 = IsHappy("aabb");
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsHappy("adb");
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsHappy("xyy");
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = IsHappy("iopaxpoi");
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = IsHappy("iopaxioi");
var expected8 = false;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| IsHappy | null | You are given a string s.
Your task is to check if the string is happy or not.
A string is happy if its length is at least 3 and every 3 consecutive letters are distinct
For example:
is_happy(a) => False
is_happy(aa) => False
is_happy(abcd) => True
is_happy(aabb) => False
is_happy(adb) => True
is_happy(xyy) => False
|
HumanEval_csharp/81 | 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
/// It is the last week of the semester and the teacher has to give the grades
/// to students. The teacher has been making her own algorithm for grading.
/// The only problem is, she has lost the code she used for grading.
/// She has given you a list of GPAs for some students and you have to write
/// a function that can output a list of letter grades using the following table:
/// GPA | Letter grade
/// 4.0 A+
/// > 3.7 A
/// > 3.3 A-
/// > 3.0 B+
/// > 2.7 B
/// > 2.3 B-
/// > 2.0 C+
/// > 1.7 C
/// > 1.3 C-
/// > 1.0 D+
/// > 0.7 D
/// > 0.0 D-
/// 0.0 E
///
///
/// Example:
/// grade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-']
///
/// </summary>
public static List<string> NumericalLetterGrade (List<object> grades)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = NumericalLetterGrade(new List<object> {4.0,3,1.7,2,3.5});
var expected1 = new List<string> {"A+","B","C-","C","A-"};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = NumericalLetterGrade(new List<object> {1.2});
var expected2 = new List<string> {"D+"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = NumericalLetterGrade(new List<object> {0.5});
var expected3 = new List<string> {"D-"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = NumericalLetterGrade(new List<object> {0.0});
var expected4 = new List<string> {"E"};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = NumericalLetterGrade(new List<object> {1,0.3,1.5,2.8,3.3});
var expected5 = new List<string> {"D","D-","C-","B","B+"};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = NumericalLetterGrade(new List<object> {0,0.7});
var expected6 = new List<string> {"E","D-"};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| NumericalLetterGrade | null | It is the last week of the semester and the teacher has to give the grades
to students. The teacher has been making her own algorithm for grading.
The only problem is, she has lost the code she used for grading.
She has given you a list of GPAs for some students and you have to write
a function that can output a list of letter grades using the following table:
GPA | Letter grade
4.0 A+
> 3.7 A
> 3.3 A-
> 3.0 B+
> 2.7 B
> 2.3 B-
> 2.0 C+
> 1.7 C
> 1.3 C-
> 1.0 D+
> 0.7 D
> 0.0 D-
0.0 E
Example:
grade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-']
|
HumanEval_csharp/82 | 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 that takes a string and returns True if the string
/// length is a prime number or False otherwise
/// Examples
/// PrimeLength('Hello') == True
/// PrimeLength('abcdcba') == True
/// PrimeLength('kittens') == True
/// PrimeLength('orange') == False
///
/// </summary>
public static bool PrimeLength (string string0)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = PrimeLength("Hello");
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = PrimeLength("abcdcba");
var expected2 = true;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = PrimeLength("kittens");
var expected3 = true;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = PrimeLength("orange");
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = PrimeLength("wow");
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = PrimeLength("world");
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = PrimeLength("MadaM");
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = PrimeLength("Wow");
var expected8 = true;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = PrimeLength("");
var expected9 = false;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = PrimeLength("HI");
var expected10 = true;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
var actual11 = PrimeLength("go");
var expected11 = true;
var result11 = compareLogic.Compare(actual11, expected11);
if (!result11.AreEqual) {throw new Exception("Exception --- test case 10 failed to pass");}
var actual12 = PrimeLength("gogo");
var expected12 = false;
var result12 = compareLogic.Compare(actual12, expected12);
if (!result12.AreEqual) {throw new Exception("Exception --- test case 11 failed to pass");}
var actual13 = PrimeLength("aaaaaaaaaaaaaaa");
var expected13 = false;
var result13 = compareLogic.Compare(actual13, expected13);
if (!result13.AreEqual) {throw new Exception("Exception --- test case 12 failed to pass");}
var actual14 = PrimeLength("Madam");
var expected14 = true;
var result14 = compareLogic.Compare(actual14, expected14);
if (!result14.AreEqual) {throw new Exception("Exception --- test case 13 failed to pass");}
var actual15 = PrimeLength("M");
var expected15 = false;
var result15 = compareLogic.Compare(actual15, expected15);
if (!result15.AreEqual) {throw new Exception("Exception --- test case 14 failed to pass");}
var actual16 = PrimeLength("0");
var expected16 = false;
var result16 = compareLogic.Compare(actual16, expected16);
if (!result16.AreEqual) {throw new Exception("Exception --- test case 15 failed to pass");}
}
}
}
| PrimeLength | null | Write a function that takes a string and returns True if the string
length is a prime number or False otherwise
Examples
prime_length('Hello') == True
prime_length('abcdcba') == True
prime_length('kittens') == True
prime_length('orange') == False
|
HumanEval_csharp/83 | 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 integer n, return the count of the numbers of n-digit
/// positive integers that start or end with 1.
///
/// </summary>
public static int StartsOneEnds (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = StartsOneEnds(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 = StartsOneEnds(2);
var expected2 = 18;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = StartsOneEnds(3);
var expected3 = 180;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = StartsOneEnds(4);
var expected4 = 1800;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = StartsOneEnds(5);
var expected5 = 18000;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| StartsOneEnds | null |
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
|
HumanEval_csharp/84 | 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 integer N, return the total sum of its digits in binary.
///
/// Example
/// For N = 1000, the sum of digits will be 1 the output should be "1".
/// For N = 150, the sum of digits will be 6 the output should be "110".
/// For N = 147, the sum of digits will be 12 the output should be "1100".
///
/// Variables:
/// @N integer
/// Constraints: 0 β€ N β€ 10000.
/// Output:
/// a string of binary number
///
/// </summary>
public static string Solve (int N)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Solve(1000);
var expected1 = "1";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Solve(150);
var expected2 = "110";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Solve(147);
var expected3 = "1100";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Solve(333);
var expected4 = "1001";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Solve(963);
var expected5 = "10010";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| Solve | null | Given a positive integer N, return the total sum of its digits in binary.
Example
For N = 1000, the sum of digits will be 1 the output should be "1".
For N = 150, the sum of digits will be 6 the output should be "110".
For N = 147, the sum of digits will be 12 the output should be "1100".
Variables:
@N integer
Constraints: 0 β€ N β€ 10000.
Output:
a string of binary number
|
HumanEval_csharp/85 | 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 non-empty list of integers lst. Add the even elements that are at odd indices..
///
///
/// Examples:
/// Add([4, 2, 6, 7]) ==> 2
///
/// </summary>
public static int Add (List<int> lst)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Add(new List<int> {4,88});
var expected1 = 88;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Add(new List<int> {4,5,6,7,2,122});
var expected2 = 122;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Add(new List<int> {4,0,6,7});
var expected3 = 0;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Add(new List<int> {4,4,6,8});
var expected4 = 12;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
}
}
}
| Add | null | Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
add([4, 2, 6, 7]) ==> 2
|
HumanEval_csharp/86 | 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 that takes a string and returns an ordered version of it.
/// Ordered version of string, is a string where all words (separated by space)
/// are replaced by a new word where all the characters arranged in
/// ascending order based on ascii value.
/// Note: You should keep the order of words and blank spaces in the sentence.
///
/// For example:
/// AntiShuffle('Hi') returns 'Hi'
/// AntiShuffle('hello') returns 'ehllo'
/// AntiShuffle('Hello World!!!') returns 'Hello !!!Wdlor'
///
/// </summary>
public static string AntiShuffle (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = AntiShuffle("Hi");
var expected1 = "Hi";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = AntiShuffle("hello");
var expected2 = "ehllo";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = AntiShuffle("number");
var expected3 = "bemnru";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = AntiShuffle("abcd");
var expected4 = "abcd";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = AntiShuffle("Hello World!!!");
var expected5 = "Hello !!!Wdlor";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = AntiShuffle("");
var expected6 = "";
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = AntiShuffle("Hi. My name is Mister Robot. How are you?");
var expected7 = ".Hi My aemn is Meirst .Rboot How aer ?ouy";
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| AntiShuffle | null |
Write a function that takes a string and returns an ordered version of it.
Ordered version of string, is a string where all words (separated by space)
are replaced by a new word where all the characters arranged in
ascending order based on ascii value.
Note: You should keep the order of words and blank spaces in the sentence.
For example:
anti_shuffle('Hi') returns 'Hi'
anti_shuffle('hello') returns 'ehllo'
anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor'
|
HumanEval_csharp/87 | 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 are given a 2 dimensional data, as a nested lists,
/// which is similar to matrix, however, unlike matrices,
/// each row may contain a different number of columns.
/// Given lst, and integer x, find integers x in the list,
/// and return list of tuples, [(x1, y1), (x2, y2) ...] such that
/// each tuple is a coordinate - (row, columns), starting with 0.
/// Sort coordinates initially by rows in ascending order.
/// Also, sort coordinates of the row by columns in descending order.
///
/// Examples:
/// GetRow([
/// [1,2,3,4,5,6],
/// [1,2,3,4,1,6],
/// [1,2,3,4,5,1]
/// ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
/// GetRow([], 1) == []
/// GetRow([[], [1], [1, 2, 3]], 3) == [(2, 2)]
///
/// </summary>
public static List<List<int>> GetRow (List<List<int>> lst, int x)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = GetRow(new List<List<int>> {new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,1,6},new List<int> {1,2,3,4,5,1}},1);
var expected1 = new List<List<int>> {new List<int> {0,0},new List<int> {1,4},new List<int> {1,0},new List<int> {2,5},new List<int> {2,0}};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = GetRow(new List<List<int>> {new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6}},2);
var expected2 = new List<List<int>> {new List<int> {0,1},new List<int> {1,1},new List<int> {2,1},new List<int> {3,1},new List<int> {4,1},new List<int> {5,1}};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = GetRow(new List<List<int>> {new List<int> {1,2,3,4,5,6},new List<int> {1,2,3,4,5,6},new List<int> {1,1,3,4,5,6},new List<int> {1,2,1,4,5,6},new List<int> {1,2,3,1,5,6},new List<int> {1,2,3,4,1,6},new List<int> {1,2,3,4,5,1}},1);
var expected3 = new List<List<int>> {new List<int> {0,0},new List<int> {1,0},new List<int> {2,1},new List<int> {2,0},new List<int> {3,2},new List<int> {3,0},new List<int> {4,3},new List<int> {4,0},new List<int> {5,4},new List<int> {5,0},new List<int> {6,5},new List<int> {6,0}};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = GetRow(new List<List<int>> {},1);
var expected4 = new List<List<int>> {};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = GetRow(new List<List<int>> {new List<int> {1}},2);
var expected5 = new List<List<int>> {};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = GetRow(new List<List<int>> {new List<int> {},new List<int> {1},new List<int> {1,2,3}},3);
var expected6 = new List<List<int>> {new List<int> {2,2}};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| GetRow | null |
You are given a 2 dimensional data, as a nested lists,
which is similar to matrix, however, unlike matrices,
each row may contain a different number of columns.
Given lst, and integer x, find integers x in the list,
and return list of tuples, [(x1, y1), (x2, y2) ...] such that
each tuple is a coordinate - (row, columns), starting with 0.
Sort coordinates initially by rows in ascending order.
Also, sort coordinates of the row by columns in descending order.
Examples:
get_row([
[1,2,3,4,5,6],
[1,2,3,4,1,6],
[1,2,3,4,5,1]
], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
get_row([], 1) == []
get_row([[], [1], [1, 2, 3]], 3) == [(2, 2)]
|
HumanEval_csharp/88 | 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 of non-negative integers, return a copy of the given array after sorting,
/// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
/// or sort it in descending order if the sum( first index value, last index value) is even.
///
/// Note:
/// * don't change the given array.
///
/// Examples:
/// * SortArray([]) => []
/// * SortArray([5]) => [5]
/// * SortArray([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5]
/// * SortArray([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0]
///
/// </summary>
public static List<int> SortArray (List<int> array)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = SortArray(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 = SortArray(new List<int> {5});
var expected2 = new List<int> {5};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = SortArray(new List<int> {2,4,3,0,1,5});
var expected3 = new List<int> {0,1,2,3,4,5};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = SortArray(new List<int> {2,4,3,0,1,5,6});
var expected4 = new List<int> {6,5,4,3,2,1,0};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = SortArray(new List<int> {2,1});
var expected5 = new List<int> {1,2};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = SortArray(new List<int> {15,42,87,32,11,0});
var expected6 = new List<int> {0,11,15,32,42,87};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = SortArray(new List<int> {21,14,23,11});
var expected7 = new List<int> {23,21,14,11};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| SortArray | null |
Given an array of non-negative integers, return a copy of the given array after sorting,
you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
or sort it in descending order if the sum( first index value, last index value) is even.
Note:
* don't change the given array.
Examples:
* sort_array([]) => []
* sort_array([5]) => [5]
* sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5]
* sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0]
|
HumanEval_csharp/89 | 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
/// Create a function Encrypt that takes a string as an argument and
/// returns a string Encrypted with the alphabet being rotated.
/// The alphabet should be rotated in a manner such that the letters
/// shift down by two multiplied to two places.
/// For example:
/// Encrypt('hi') returns 'lm'
/// Encrypt('asdfghjkl') returns 'ewhjklnop'
/// Encrypt('gf') returns 'kj'
/// Encrypt('et') returns 'ix'
///
/// </summary>
public static string Encrypt (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Encrypt("hi");
var expected1 = "lm";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Encrypt("asdfghjkl");
var expected2 = "ewhjklnop";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Encrypt("gf");
var expected3 = "kj";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Encrypt("et");
var expected4 = "ix";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Encrypt("faewfawefaewg");
var expected5 = "jeiajeaijeiak";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Encrypt("hellomyfriend");
var expected6 = "lippsqcjvmirh";
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Encrypt("dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh");
var expected7 = "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl";
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Encrypt("a");
var expected8 = "e";
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| Encrypt | null | Create a function encrypt that takes a string as an argument and
returns a string encrypted with the alphabet being rotated.
The alphabet should be rotated in a manner such that the letters
shift down by two multiplied to two places.
For example:
encrypt('hi') returns 'lm'
encrypt('asdfghjkl') returns 'ewhjklnop'
encrypt('gf') returns 'kj'
encrypt('et') returns 'ix'
|
HumanEval_csharp/90 | 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 are given a list of integers.
/// Write a function NextSmallest() that returns the 2nd smallest element of the list.
/// Return None if there is no such element.
///
/// NextSmallest([1, 2, 3, 4, 5]) == 2
/// NextSmallest([5, 1, 4, 3, 2]) == 2
/// NextSmallest([]) == None
/// NextSmallest([1, 1]) == None
///
/// </summary>
public static object NextSmallest (List<int> lst)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = NextSmallest(new List<int> {1,2,3,4,5});
var expected1 = 2;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = NextSmallest(new List<int> {5,1,4,3,2});
var expected2 = 2;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = NextSmallest(new List<int> {});
var expected3 = null;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = NextSmallest(new List<int> {1,1});
var expected4 = null;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = NextSmallest(new List<int> {1,1,1,1,0});
var expected5 = 1;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = NextSmallest(new List<int> {1,1});
var expected6 = null;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = NextSmallest(new List<int> {-35,34,12,-45});
var expected7 = -35;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| NextSmallest | null |
You are given a list of integers.
Write a function next_smallest() that returns the 2nd smallest element of the list.
Return None if there is no such element.
next_smallest([1, 2, 3, 4, 5]) == 2
next_smallest([5, 1, 4, 3, 2]) == 2
next_smallest([]) == None
next_smallest([1, 1]) == None
|
HumanEval_csharp/91 | 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'll be given a string of words, and your task is to count the number
/// of boredoms. A boredom is a sentence that starts with the word "I".
/// Sentences are delimited by '.', '?' or '!'.
///
/// For example:
/// >>> IsBored("Hello world")
/// 0
/// >>> IsBored("The sky is blue. The sun is shining. I love this weather")
/// 1
///
/// </summary>
public static int IsBored (string S)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = IsBored("Hello world");
var expected1 = 0;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = IsBored("Is the sky blue?");
var expected2 = 0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = IsBored("I love It !");
var expected3 = 1;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = IsBored("bIt");
var expected4 = 0;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = IsBored("I feel good today. I will be productive. will kill It");
var expected5 = 2;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = IsBored("You and I are going for a walk");
var expected6 = 0;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| IsBored | null |
You'll be given a string of words, and your task is to count the number
of boredoms. A boredom is a sentence that starts with the word "I".
Sentences are delimited by '.', '?' or '!'.
For example:
>>> is_bored("Hello world")
0
>>> is_bored("The sky is blue. The sun is shining. I love this weather")
1
|
HumanEval_csharp/92 | 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
///
/// Create a function that takes 3 numbers.
/// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
/// Returns false in any other cases.
///
/// Examples
/// AnyInt(5, 2, 7) β True
///
/// AnyInt(3, 2, 2) β False
///
/// AnyInt(3, -2, 1) β True
///
/// AnyInt(3.6, -2.2, 2) β False
///
///
///
///
/// </summary>
public static bool AnyInt (object x, object y, object z)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = AnyInt(2,3,1);
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = AnyInt(2.5,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 = AnyInt(1.5,5,3.5);
var expected3 = false;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = AnyInt(2,6,2);
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = AnyInt(4,2,2);
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = AnyInt(2.2,2.2,2.2);
var expected6 = false;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = AnyInt(-4,6,2);
var expected7 = true;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = AnyInt(2,1,1);
var expected8 = true;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = AnyInt(3,4,7);
var expected9 = true;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = AnyInt(3.0,4,7);
var expected10 = false;
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
}
}
}
| AnyInt | null |
Create a function that takes 3 numbers.
Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
Returns false in any other cases.
Examples
any_int(5, 2, 7) β True
any_int(3, 2, 2) β False
any_int(3, -2, 1) β True
any_int(3.6, -2.2, 2) β False
|
HumanEval_csharp/93 | 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 that takes a message, and Encodes in such a
/// way that it swaps case of all letters, replaces all vowels in
/// the message with the letter that appears 2 places ahead of that
/// vowel in the english alphabet.
/// Assume only letters.
///
/// Examples:
/// >>> Encode('test')
/// 'TGST'
/// >>> Encode('This is a message')
/// 'tHKS KS C MGSSCGG'
///
/// </summary>
public static string Encode (string message)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Encode("TEST");
var expected1 = "tgst";
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Encode("Mudasir");
var expected2 = "mWDCSKR";
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Encode("YES");
var expected3 = "ygs";
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Encode("This is a message");
var expected4 = "tHKS KS C MGSSCGG";
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Encode("I DoNt KnOw WhAt tO WrItE");
var expected5 = "k dQnT kNqW wHcT Tq wRkTg";
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| Encode | null |
Write a function that takes a message, and encodes in such a
way that it swaps case of all letters, replaces all vowels in
the message with the letter that appears 2 places ahead of that
vowel in the english alphabet.
Assume only letters.
Examples:
>>> encode('test')
'TGST'
>>> encode('This is a message')
'tHKS KS C MGSSCGG'
|
HumanEval_csharp/94 | 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 are given a list of integers.
/// You need to find the largest prime value and return the sum of its digits.
///
/// Examples:
/// For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10
/// For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25
/// For lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] the output should be 13
/// For lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] the output should be 11
/// For lst = [0,81,12,3,1,21] the output should be 3
/// For lst = [0,8,1,2,1,7] the output should be 7
///
/// </summary>
public static int Skjkasdkd (List<int> lst)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Skjkasdkd(new List<int> {0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3});
var expected1 = 10;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Skjkasdkd(new List<int> {1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1});
var expected2 = 25;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Skjkasdkd(new List<int> {1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3});
var expected3 = 13;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Skjkasdkd(new List<int> {0,724,32,71,99,32,6,0,5,91,83,0,5,6});
var expected4 = 11;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Skjkasdkd(new List<int> {0,81,12,3,1,21});
var expected5 = 3;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Skjkasdkd(new List<int> {0,8,1,2,1,7});
var expected6 = 7;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Skjkasdkd(new List<int> {8191});
var expected7 = 19;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Skjkasdkd(new List<int> {8191,123456,127,7});
var expected8 = 19;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = Skjkasdkd(new List<int> {127,97,8192});
var expected9 = 10;
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
}
}
}
| Skjkasdkd | null | You are given a list of integers.
You need to find the largest prime value and return the sum of its digits.
Examples:
For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10
For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25
For lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] the output should be 13
For lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] the output should be 11
For lst = [0,81,12,3,1,21] the output should be 3
For lst = [0,8,1,2,1,7] the output should be 7
|
HumanEval_csharp/95 | 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 dictionary, return True if all keys are strings in lower
/// case or all keys are strings in upper case, else return False.
/// The function should return False is the given dictionary is empty.
/// Examples:
/// CheckDictCase({"a":"apple", "b":"banana"}) should return True.
/// CheckDictCase({"a":"apple", "A":"banana", "B":"banana"}) should return False.
/// CheckDictCase({"a":"apple", 8:"banana", "a":"apple"}) should return False.
/// CheckDictCase({"Name":"John", "Age":"36", "City":"Houston"}) should return False.
/// CheckDictCase({"STATE":"NC", "ZIP":"12345" }) should return True.
///
/// </summary>
public static bool CheckDictCase (Dictionary<object, string> dict)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CheckDictCase(new Dictionary<object, string> {{"p", "pineapple"},{"b", "banana"}});
var expected1 = true;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CheckDictCase(new Dictionary<object, string> {{"p", "pineapple"},{"A", "banana"},{"B", "banana"}});
var expected2 = false;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CheckDictCase(new Dictionary<object, string> {{"p", "pineapple"},{5, "banana"},{"a", "apple"}});
var expected3 = false;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CheckDictCase(new Dictionary<object, string> {{"Name", "John"},{"Age", "36"},{"City", "Houston"}});
var expected4 = false;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CheckDictCase(new Dictionary<object, string> {{"STATE", "NC"},{"ZIP", "12345"}});
var expected5 = true;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = CheckDictCase(new Dictionary<object, string> {{"fruit", "Orange"},{"taste", "Sweet"}});
var expected6 = true;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = CheckDictCase(new Dictionary<object, string> {});
var expected7 = false;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| CheckDictCase | null |
Given a dictionary, return True if all keys are strings in lower
case or all keys are strings in upper case, else return False.
The function should return False is the given dictionary is empty.
Examples:
check_dict_case({"a":"apple", "b":"banana"}) should return True.
check_dict_case({"a":"apple", "A":"banana", "B":"banana"}) should return False.
check_dict_case({"a":"apple", 8:"banana", "a":"apple"}) should return False.
check_dict_case({"Name":"John", "Age":"36", "City":"Houston"}) should return False.
check_dict_case({"STATE":"NC", "ZIP":"12345" }) should return True.
|
HumanEval_csharp/96 | 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
/// Implement a function that takes an non-negative integer and returns an array of the first n
/// integers that are prime numbers and less than n.
/// for example:
/// CountUpTo(5) => [2,3]
/// CountUpTo(11) => [2,3,5,7]
/// CountUpTo(0) => []
/// CountUpTo(20) => [2,3,5,7,11,13,17,19]
/// CountUpTo(1) => []
/// CountUpTo(18) => [2,3,5,7,11,13,17]
///
/// </summary>
public static List<int> CountUpTo (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CountUpTo(5);
var expected1 = new List<int> {2,3};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CountUpTo(6);
var expected2 = new List<int> {2,3,5};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CountUpTo(7);
var expected3 = new List<int> {2,3,5};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CountUpTo(10);
var expected4 = new List<int> {2,3,5,7};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CountUpTo(0);
var expected5 = new List<int> {};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = CountUpTo(22);
var expected6 = new List<int> {2,3,5,7,11,13,17,19};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = CountUpTo(1);
var expected7 = new List<int> {};
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = CountUpTo(18);
var expected8 = new List<int> {2,3,5,7,11,13,17};
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
var actual9 = CountUpTo(47);
var expected9 = new List<int> {2,3,5,7,11,13,17,19,23,29,31,37,41,43};
var result9 = compareLogic.Compare(actual9, expected9);
if (!result9.AreEqual) {throw new Exception("Exception --- test case 8 failed to pass");}
var actual10 = CountUpTo(101);
var expected10 = new List<int> {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
var result10 = compareLogic.Compare(actual10, expected10);
if (!result10.AreEqual) {throw new Exception("Exception --- test case 9 failed to pass");}
}
}
}
| CountUpTo | null | Implement a function that takes an non-negative integer and returns an array of the first n
integers that are prime numbers and less than n.
for example:
count_up_to(5) => [2,3]
count_up_to(11) => [2,3,5,7]
count_up_to(0) => []
count_up_to(20) => [2,3,5,7,11,13,17,19]
count_up_to(1) => []
count_up_to(18) => [2,3,5,7,11,13,17]
|
HumanEval_csharp/97 | 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
/// Complete the function that takes two integers and returns
/// the product of their unit digits.
/// Assume the input is always valid.
/// Examples:
/// Multiply(148, 412) should return 16.
/// Multiply(19, 28) should return 72.
/// Multiply(2020, 1851) should return 0.
/// Multiply(14,-15) should return 20.
///
/// </summary>
public static int Multiply (int a, int b)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = Multiply(148,412);
var expected1 = 16;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = Multiply(19,28);
var expected2 = 72;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = Multiply(2020,1851);
var expected3 = 0;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = Multiply(14,-15);
var expected4 = 20;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = Multiply(76,67);
var expected5 = 42;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = Multiply(17,27);
var expected6 = 49;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = Multiply(0,1);
var expected7 = 0;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = Multiply(0,0);
var expected8 = 0;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| Multiply | null | Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
multiply(148, 412) should return 16.
multiply(19, 28) should return 72.
multiply(2020, 1851) should return 0.
multiply(14,-15) should return 20.
|
HumanEval_csharp/98 | 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 s, count the number of uppercase vowels in even indices.
///
/// For example:
/// CountUpper('aBCdEf') returns 1
/// CountUpper('abcdefg') returns 0
/// CountUpper('dBBE') returns 0
///
/// </summary>
public static int CountUpper (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = CountUpper("aBCdEf");
var expected1 = 1;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = CountUpper("abcdefg");
var expected2 = 0;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = CountUpper("dBBE");
var expected3 = 0;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = CountUpper("B");
var expected4 = 0;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = CountUpper("U");
var expected5 = 1;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = CountUpper("");
var expected6 = 0;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = CountUpper("EEEE");
var expected7 = 2;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
}
}
}
| CountUpper | null |
Given a string s, count the number of uppercase vowels in even indices.
For example:
count_upper('aBCdEf') returns 1
count_upper('abcdefg') returns 0
count_upper('dBBE') returns 0
|
HumanEval_csharp/99 | 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
///
/// Create a function that takes a value (string) representing a number
/// and returns the closest integer to it. If the number is equidistant
/// from two integers, round it away from zero.
///
/// Examples
/// >>> ClosestInteger("10")
/// 10
/// >>> ClosestInteger("15.3")
/// 15
///
/// Note:
/// Rounding away from zero means that if the given number is equidistant
/// from two integers, the one you should return is the one that is the
/// farthest from zero. For example ClosestInteger("14.5") should
/// return 15 and ClosestInteger("-14.5") should return -15.
///
/// </summary>
public static int ClosestInteger (string value)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = ClosestInteger("10");
var expected1 = 10;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = ClosestInteger("14.5");
var expected2 = 15;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = ClosestInteger("-15.5");
var expected3 = -16;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = ClosestInteger("15.3");
var expected4 = 15;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = ClosestInteger("0");
var expected5 = 0;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| ClosestInteger | null |
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
Examples
>>> closest_integer("10")
10
>>> closest_integer("15.3")
15
Note:
Rounding away from zero means that if the given number is equidistant
from two integers, the one you should return is the one that is the
farthest from zero. For example closest_integer("14.5") should
return 15 and closest_integer("-14.5") should return -15.
|
HumanEval_csharp/100 | 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 integer n, you have to make a pile of n levels of stones.
/// The first level has n stones.
/// The number of stones in the next level is:
/// - the next odd number if n is odd.
/// - the next even number if n is even.
/// Return the number of stones in each level in a list, where element at index
/// i represents the number of stones in the level (i+1).
///
/// Examples:
/// >>> MakeAPile(3)
/// [3, 5, 7]
///
/// </summary>
public static List<int> MakeAPile (int n)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = MakeAPile(3);
var expected1 = new List<int> {3,5,7};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = MakeAPile(4);
var expected2 = new List<int> {4,6,8,10};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = MakeAPile(5);
var expected3 = new List<int> {5,7,9,11,13};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = MakeAPile(6);
var expected4 = new List<int> {6,8,10,12,14,16};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = MakeAPile(8);
var expected5 = new List<int> {8,10,12,14,16,18,20,22};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
}
}
}
| MakeAPile | null |
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
|
HumanEval_csharp/101 | 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 will be given a string of words separated by commas or spaces. Your task is
/// to split the string into words and return an array of the words.
///
/// For example:
/// WordsString("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
/// WordsString("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
///
/// </summary>
public static List<string> WordsString (string s)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = WordsString("Hi, my name is John");
var expected1 = new List<string> {"Hi","my","name","is","John"};
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = WordsString("One, two, three, four, five, six");
var expected2 = new List<string> {"One","two","three","four","five","six"};
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = WordsString("Hi, my name");
var expected3 = new List<string> {"Hi","my","name"};
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = WordsString("One,, two, three, four, five, six,");
var expected4 = new List<string> {"One","two","three","four","five","six"};
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = WordsString("");
var expected5 = new List<string> {};
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = WordsString("ahmed , gamal");
var expected6 = new List<string> {"ahmed","gamal"};
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
}
}
}
| WordsString | null |
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
|
HumanEval_csharp/102 | 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 two positive numbers x and y and returns the
/// biggest even integer number that is in the range [x, y] inclusive. If
/// there's no such number, then the function should return -1.
///
/// For example:
/// ChooseNum(12, 15) = 14
/// ChooseNum(13, 12) = -1
///
/// </summary>
public static int ChooseNum (int x, int y)
{ |
public static void Main(string[] args)
{
CompareLogic compareLogic = new CompareLogic();
var actual1 = ChooseNum(12,15);
var expected1 = 14;
var result1 = compareLogic.Compare(actual1, expected1);
if (!result1.AreEqual) {throw new Exception("Exception --- test case 0 failed to pass");}
var actual2 = ChooseNum(13,12);
var expected2 = -1;
var result2 = compareLogic.Compare(actual2, expected2);
if (!result2.AreEqual) {throw new Exception("Exception --- test case 1 failed to pass");}
var actual3 = ChooseNum(33,12354);
var expected3 = 12354;
var result3 = compareLogic.Compare(actual3, expected3);
if (!result3.AreEqual) {throw new Exception("Exception --- test case 2 failed to pass");}
var actual4 = ChooseNum(5234,5233);
var expected4 = -1;
var result4 = compareLogic.Compare(actual4, expected4);
if (!result4.AreEqual) {throw new Exception("Exception --- test case 3 failed to pass");}
var actual5 = ChooseNum(6,29);
var expected5 = 28;
var result5 = compareLogic.Compare(actual5, expected5);
if (!result5.AreEqual) {throw new Exception("Exception --- test case 4 failed to pass");}
var actual6 = ChooseNum(27,10);
var expected6 = -1;
var result6 = compareLogic.Compare(actual6, expected6);
if (!result6.AreEqual) {throw new Exception("Exception --- test case 5 failed to pass");}
var actual7 = ChooseNum(7,7);
var expected7 = -1;
var result7 = compareLogic.Compare(actual7, expected7);
if (!result7.AreEqual) {throw new Exception("Exception --- test case 6 failed to pass");}
var actual8 = ChooseNum(546,546);
var expected8 = 546;
var result8 = compareLogic.Compare(actual8, expected8);
if (!result8.AreEqual) {throw new Exception("Exception --- test case 7 failed to pass");}
}
}
}
| ChooseNum | null | This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.
For example:
choose_num(12, 15) = 14
choose_num(13, 12) = -1
|