/**
 * Given four integers a, b, c, and d, find the XOR of all numbers in the ranges [a, b] and [c, d].
 *
 * @param a The start point of the first range.
 * @param b The end point of the first range.
 * @param c The start point of the second range.
 * @param d The end point of the second range.
 * @return The XOR of all numbers in the two ranges.
 *
 * Example:
 * xorRanges(1, 5, 3, 7) -> 6
 * xorRanges(10, 15, 8, 12) -> 1
 */
fun xorRanges(a: Int, b: Int, c: Int, d: Int): Int {

    var xorResult = 0

    for (i in a..b) {
        xorResult = xorResult xor i
    }

    for (j in c..d) {
        xorResult = xorResult xor j
    }

    return xorResult
}
/**
 * Given four integers a, b, c, and d, find the XOR of all numbers in the ranges [a, b] and [c, d].
 *
 * @param a The start point of the first range.
 * @param b The end point of the first range.
 * @param c The start point of the second range.
 * @param d The end point of the second range.
 * @return The XOR of all numbers in the two ranges.
 *
 * Example:
 * xorRanges(1, 5, 3, 7) -> 6
 * xorRanges(10, 15, 8, 12) -> 1
 */
fun xorRanges(a: Int, b: Int, c: Int, d: Int): Int {
/**
 * Given four integers a, b, c, and d, find the XOR of all numbers in the ranges [a, b] and [c, d].
 *
 * @param a The start point of the first range.
 * @param b The end point of the first range.
 * @param c The start point of the second range.
 * @param d The end point of the second range.
 * @return The XOR of all numbers in the two ranges.
 *
 * Example:
 * xorRanges(1, 5, 3, 7) -> 6
 * xorRanges(10, 15, 8, 12) -> 1
 */
fun xorRanges(a: Int, b: Int, c: Int, d: Int): Int {

    var xorResult = 0

    for (i in a..b) {
        xorResult = xorResult xor i
    }

    for (j in c..d) {
        xorResult = xorResult xor j
    }

    return xorResult
}