Prompt:
import std.math;
import std.typecons;
/*
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
*/
bool any_int(float x, float y, float z)

unittest
{
    alias candidate = any_int;

    assert(candidate(2L, 3L, 1L) == true);
    assert(candidate(2.5, 2L, 3L) == false);
    assert(candidate(1.5, 5L, 3.5) == false);
    assert(candidate(2L, 6L, 2L) == false);
    assert(candidate(4L, 2L, 2L) == true);
    assert(candidate(2.2, 2.2, 2.2) == false);
    assert(candidate(-4L, 6L, 2L) == true);
    assert(candidate(2L, 1L, 1L) == true);
    assert(candidate(3L, 4L, 7L) == true);
    assert(candidate(3.0, 4L, 7L) == false);
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
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:
*/
string encode(string message)

unittest
{
    alias candidate = encode;

    assert(candidate("TEST") == "tgst");
    assert(candidate("Mudasir") == "mWDCSKR");
    assert(candidate("YES") == "ygs");
    assert(candidate("This is a message") == "tHKS KS C MGSSCGG");
    assert(candidate("I DoNt KnOw WhAt tO WrItE") == "k dQnT kNqW wHcT Tq wRkTg");
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
You are given a list of integers.
You need to find the largest prime value and return the sum of its digits.
Examples:
*/
long skjkasdkd(long[] lst)


Prompt:
import std.math;
import std.typecons;
/*
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:
*/
bool check_dict_case(Nullable!(string[string]) dict)

unittest
{
    alias candidate = check_dict_case;

    assert(candidate(["p": "pineapple", "b": "banana"].nullable) == true);
    assert(candidate(["p": "pineapple", "A": "banana", "B": "banana"].nullable) == false);
    assert(candidate(["p": "pineapple", "5": "banana", "a": "apple"].nullable) == false);
    assert(candidate(["Name": "John", "Age": "36", "City": "Houston"].nullable) == false);
    assert(candidate(["STATE": "NC", "ZIP": "12345"].nullable) == true);
    assert(candidate(["fruit": "Orange", "taste": "Sweet"].nullable) == true);
    assert(candidate(Nullable!(string[string]).init) == false);
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
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:
*/
long[] count_up_to(long n)


Prompt:
import std.math;
import std.typecons;
/*
Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
*/
long multiply(long a, long b)

unittest
{
    alias candidate = multiply;

    assert(candidate(148L, 412L) == 16L);
    assert(candidate(19L, 28L) == 72L);
    assert(candidate(2020L, 1851L) == 0L);
    assert(candidate(14L, -15L) == 20L);
    assert(candidate(76L, 67L) == 42L);
    assert(candidate(17L, 27L) == 49L);
    assert(candidate(0L, 1L) == 0L);
    assert(candidate(0L, 0L) == 0L);
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
Given a string s, count the number of uppercase vowels in even indices.
For example:
*/
long count_upper(string s)

unittest
{
    alias candidate = count_upper;

    assert(candidate("aBCdEf") == 1L);
    assert(candidate("abcdefg") == 0L);
    assert(candidate("dBBE") == 0L);
    assert(candidate("B") == 0L);
    assert(candidate("U") == 1L);
    assert(candidate("") == 0L);
    assert(candidate("EEEE") == 2L);
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
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
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.
*/
long closest_integer(string value)

unittest
{
    alias candidate = closest_integer;

    assert(candidate("10") == 10L);
    assert(candidate("14.5") == 15L);
    assert(candidate("-15.5") == -16L);
    assert(candidate("15.3") == 15L);
    assert(candidate("0") == 0L);
}
void main(){}


Prompt:
import std.math;
import std.typecons;
/*
 From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
*/
long[] rolling_max(long[] numbers)

unittest
{
    alias candidate = rolling_max;

    assert(candidate([]) == []);
    assert(candidate([1L, 2L, 3L, 4L]) == [1L, 2L, 3L, 4L]);
    assert(candidate([4L, 3L, 2L, 1L]) == [4L, 4L, 4L, 4L]);
    assert(candidate([3L, 2L, 3L, 100L, 3L]) == [3L, 3L, 3L, 100L, 100L]);
}
void main(){}