giulio98/xlcost-single-prompt huggingface dataset:
# euler 's totient function for all numbers smaller than or equal to n | python program for the above approach ; 

import math


def Euler_totient_function(n):
    result = 1
    for i in range(2, n + 1):
        c = 0
        if n % i == 0:
            while (n % i == 0):
                c += 1
                n //= i
        if (c > 0):
            power = math .pow(i, c - 1)
            m = math .pow(i, c - 1) * (i - 1)
            result *= m
    if (n > 1):
        result *= (n - 1)
    return int(result)


for i in range(1, 13):
    print("Euler_totient_function(", i, "): ", end="")
    print(Euler_totient_function(i))

# Expected output:
Euler_totient_function( 1 ): 1
Euler_totient_function( 2 ): 1
Euler_totient_function( 3 ): 2
Euler_totient_function( 4 ): 2
Euler_totient_function( 5 ): 4
Euler_totient_function( 6 ): 2
Euler_totient_function( 7 ): 6
Euler_totient_function( 8 ): 4
Euler_totient_function( 9 ): 6
Euler_totient_function( 10 ): 4
Euler_totient_function( 11 ): 10
Euler_totient_function( 12 ): 4
# check if a number can be expressed as x ^ y ( x raised to power y ) | python3 program to check if a given number can be expressed as power ; returns true if n can be written as x ^ y ; 

import math


def isPower(n):
    p = 0
    if (n <= 1):
        return 1
    for i in range(2, (int)(math .sqrt(n)) + 1):
        p = math .log2(n) / math .log2(i)
        if ((math .ceil(p) == math .floor(p)) and p > 1):
            return 1
    return 0


for i in range(2, 100):
    if isPower(i):
        print(i, end=" ")

# Expected output:
4 8 9 16 25 27 32 36 49 64 81
# sum of all elements between k1 ' th ▁ and ▁ k2' th smallest elements | returns sum between two kth smallest element of array ; sort the given array ; below code is equivalent to ; 
def sumBetweenTwoKth(arr, n, k1, k2):
    arr .sort()
    result = 0
    for i in range(k1, k2 - 1):
        result += arr[i]
    return result


arr = [20, 8, 22, 4, 12, 10, 14]
k1 = 3
k2 = 6
n = len(arr)
print(sumBetweenTwoKth(arr, n, k1, k2))

# Expected output:
26
# puzzle | program to find number of squares in a chessboard | function to return count of squares ; ; better way to write n * ( n + 1 ) * ( 2 n + 1 ) / 6 ; 
def countSquares(n):
    return ((n * (n + 1) / 2) * (2 * n + 1) / 3)


n = 4
print("Count of squares is ", countSquares(n))

# Expected output:
Count of squares is  30.0
# find nth magic number | function to find nth magic number ; go through every bit of n ; if last bit of n is set ; proceed to next bit n >>= 1 or n = n / 2 ; 
def nthMagicNo(n):

    pow = 1
    answer = 0
    while (n):

        pow = pow*5
        if (n & 1):
            answer += pow

        n >>= 1

    return answer


n = 5
print("nth magic number is", nthMagicNo(n))

# Expected output:
nth magic number is 130
# given a number n , count all multiples of 3 and / or 5 in set { 1 , 2 , 3 , ... n } | python program to find count of multiples of 3 and 5 in { 1 , 2 , 3 , . . n } ; add multiples of 3 and 5. since common multiples are counted twice in n / 3 + n / 15 , subtract common multiples ; 
def countOfMultiples(n):
    return (int(n / 3) + int(n / 5) - int(n / 15))


print(countOfMultiples(6))
print(countOfMultiples(16))

# Expected output:
3
7
# program to find gcd or hcf of two numbers | recursive function to return gcd of a and b ; everything divides 0 ; base case ; a is greater ; 
def gcd(a, b):
    if (a == 0):
        return b
    if (b == 0):
        return a
    if (a == b):
        return a
    if (a > b):
        return gcd(a - b, b)
    return gcd(a, b - a)


a = 98
b = 56
if (gcd(a, b)):
    print('GCD of', a, 'and', b, 'is', gcd(a, b))
else:
    print('not found')

# Expected output:
GCD of 98 and 56 is 14
# find xor sum of bitwise and of all pairs from given two arrays | function to calculate the xor sum of all ands of all pairs on a [ ] and b [ ] ; variable to store xor sums of first array and second array respectively . ; xor sum of first array ; xor sum of second array ; required answer ; 
def XorSum(A, B, N, M):
    ans1 = 0
    ans2 = 0
    for i in range(N):
        ans1 = ans1 ^ A[i]
    for i in range(M):
        ans2 = ans2 ^ B[i]
    return (ans1 & ans2)


if __name__ == '__main__':
    A = [3, 5]
    B = [2, 3]
    N = len(A)
    M = len(B)
    print(XorSum(A, B, N, M))

# Expected output:
0
# count levels in a binary tree consisting of node values having set bits at different positions | structure of a node in the binary tree ; function to find total unique levels ; stores count of levels , where the set bits of all the nodes are at different positions ; store nodes at each level of the tree using bfs ; performing level order traversal ; stores count of nodes at current level ; stores prefix xor of all the nodes at current level ; stores prefix or of all the nodes at current level ; check if set bit of all the nodes at current level is at different positions or not ; traverse nodes at current level ; stores front element of the que ; update prefix_or ; update prefix_xor ; if left subtree not null ; if right subtree not null ; if bitwise and is zero ; 

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self .val = val
        self .left = left
        self .right = right


def uniqueLevels(root):
    uniqueLevels = 0
    que = [root]
    while len(que):
        length = len(que)
        prefix_XOR = 0
        prefix_OR = 0
        flag = True
        while length:
            temp = que .pop(0)
            prefix_OR |= temp .val
            prefix_XOR ^= temp .val
            if prefix_XOR != prefix_OR:
                flag = False
            if temp .left:
                que .append(temp .left)
            if temp .right:
                que .append(temp .right)
            length -= 1
        if flag:
            uniqueLevels += 1
    print(uniqueLevels)


if __name__ == '__main__':
    root = TreeNode(5)
    root .left = TreeNode(6)
    root .right = TreeNode(9)
    root .left .left = TreeNode(1)
    root .left .right = TreeNode(4)
    root .right .right = TreeNode(7)
    uniqueLevels(root)

# Expected output:
2
# sum of all elements between k1 ' th ▁ and ▁ k2' th smallest elements | python 3 implementation of above approach ; 

n = 7


def minheapify(a, index):
    small = index
    l = 2 * index + 1
    r = 2 * index + 2
    if (l < n and a[l] < a[small]):
        small = l
    if (r < n and a[r] < a[small]):
        small = r
    if (small != index):
        (a[small], a[index]) = (a[index], a[small])
        minheapify(a, small)


i = 0
k1 = 3
k2 = 6
a = [20, 8, 22, 4, 12, 10, 14]
ans = 0
for i in range((n // 2) - 1, -1, -1):
    minheapify(a, i)
k1 -= 1
k2 -= 1
for i in range(0, k1 + 1):
    a[0] = a[n - 1]
    n -= 1
    minheapify(a, 0)
for i in range(k1 + 1, k2):
    ans += a[0]
    a[0] = a[n - 1]
    n -= 1
    minheapify(a, 0)
print(ans)

# Expected output:
26
# construct a list using the given q xor queries | function to return required list after performing all the queries ; store cumulative bitwise xor ; initialize final list to return ; perform each query ; the initial value of 0 ; sort the list ; return final list ; 
def ConstructList(Q):
    xor = 0
    ans = []
    for i in range(len(Q) - 1, -1, -1):
        if (Q[i][0] == 0):
            ans .append(Q[i][1] ^ xor)
        else:
            xor ^= Q[i][1]
    ans .append(xor)
    ans .sort()
    return ans


Q = [[0, 6], [0, 3], [0, 2], [1, 4], [1, 5]]
print(ConstructList(Q))

# Expected output:
[1, 2, 3, 7]
# bitwise operations on subarrays of size k | function to convert bit array to decimal number ; function to find maximum values of each bitwise or operation on element of subarray of size k ; maintain an integer array bit of size 32 all initialized to 0 ; create a sliding window of size k ; function call ; perform operation for removed element ; perform operation for added_element ; taking maximum value ; return the result ; 
def build_num(bit):
    ans = 0
    for i in range(32):
        if (bit[i] > 0):
            ans += (1 << i)
    return ans


def maximumOR(arr, n, k):
    bit = [0] * 32
    for i in range(k):
        for j in range(32):
            if ((arr[i] & (1 << j)) > 0):
                bit[j] += 1
    max_or = build_num(bit)
    for i in range(k, n):
        for j in range(32):
            if ((arr[i - k] & (1 << j)) > 0):
                bit[j] -= 1
        for j in range(32):
            if ((arr[i] & (1 << j)) > 0):
                bit[j] += 1
        max_or = max(build_num(bit), max_or)
    return max_or


if __name__ == '__main__':
    arr = [2, 5, 3, 6, 11, 13]
    k = 3
    n = len(arr)
    print(maximumOR(arr, n, k))

# Expected output:
15
# Maximum XOR path of a Binary Tree | Binary tree node ; Function to create a new node ; Function calculate the value of max - xor ; Updating the xor value with the xor of the path from root to the node ; Check if node is leaf node ; Check if the left node exist in the tree ; Check if the right node exist in the tree ; Function to find the required count ; Recursively traverse the tree and compute the max_xor ; Return the result ; Create the binary tree

class Node:
    def __init__(self, data):
        self .data = data
        self .left = None
        self .right = None


def Solve(root, xr, max_xor):
    xr = xr ^ root .data
    if (root .left is None and root .right is None):
        max_xor[0] = max(max_xor[0], xr)
    if root .left is not None:
        Solve(root .left, xr, max_xor)
    if root .right is not None:
        Solve(root .right, xr, max_xor)
    return


def findMaxXor(root):
    xr, max_xor = 0, [0]
    Solve(root, xr, max_xor)
    return max_xor[0]


root = Node(2)
root .left = Node(1)
root .right = Node(4)
root .left .left = Node(10)
root .left .right = Node(8)
root .right .left = Node(5)
root .right .right = Node(10)
print(findMaxXor(root))

# Expected output:
12
# xor of every element of an array with a given number k | function to construct new array ; traverse the array and compute xor with k ; print new array ; 
def constructXORArray(A, n, K):
    B = [0] * n
    for i in range(n):
        B[i] = A[i] ^ K
    for i in range(n):
        print(B[i], end=" ")
    print()


if __name__ == '__main__':
    A = [2, 4, 1, 3, 5]
    K = 5
    n = len(A)
    constructXORArray(A, n, K)
    B = [4, 75, 45, 42]
    K = 2
    n = len(B)
    constructXORArray(B, n, K)

# Expected output:
7 1 4 6 0 
6 73 47 40
# bitwise and of all the elements of array | function to calculate bitwise and ; initialise ans variable is arr [ 0 ] ; traverse the array compute and ; return ans ; 
def find_and(arr):
    ans = arr[0]
    for i in range(1, len(arr)):
        ans = ans & arr[i]
    return ans


if __name__ == '__main__':
    arr = [1, 3, 5, 9, 11]
    print(find_and(arr))

# Expected output:
1
# construct xor tree by given leaf nodes of perfect binary tree | python3 implementation of the above approach ; maximum size for xor tree ; allocating space to xor tree ; a recursive function that constructs xor tree for vector array [ start ... . . end ] . x is index of current node in xor tree ; if there is one element in vector array , store it in current node of xor tree ; cout << xor_tree [ x ] << " ▁ x " ; for left subtree ; for right subtree ; for getting the middle index from corner indexes . ; build the left and the right subtrees by xor operation ; merge the left and right subtrees by xor operation ; function to construct xor tree from the given vector array . this function calls construct_xor_tree_util ( ) to fill the allocated memory of xor_tree vector array ; 

from math import ceil, log
maxsize = 100005
xor_tree = [0] * maxsize


def construct_Xor_Tree_Util(current, start, end, x):
    if (start == end):
        xor_tree[x] = current[start]
        return
    left = x * 2 + 1
    right = x * 2 + 2
    mid = start + (end - start) // 2
    construct_Xor_Tree_Util(current, start, mid, left)
    construct_Xor_Tree_Util(current, mid + 1, end, right)
    xor_tree[x] = (xor_tree[left] ^ xor_tree[right])


def construct_Xor_Tree(arr, n):
    construct_Xor_Tree_Util(arr, 0, n - 1, 0)


if __name__ == '__main__':
    leaf_nodes = [40, 32, 12, 1, 4, 3, 2, 7]
    n = len(leaf_nodes)
    construct_Xor_Tree(leaf_nodes, n)
    x = (ceil(log(n, 2)))
    max_size = 2 * pow(2, x) - 1
    print("Nodes of the XOR Tree:")
    for i in range(max_size):
        print(xor_tree[i], end=" ")
    root = 0
    print("Root:", xor_tree[root])

# Expected output:
Nodes of the XOR Tree:
7 5 2 8 13 7 5 40 32 12 1 4 3 2 7 Root: 7
# maximize distance between any two consecutive 1 ' s ▁ after ▁ flipping ▁ m ▁ 0' s | function to return the count ; flipping zeros at distance " d " ; function to implement binary search ; check for valid distance i . e mid ; 
def check(arr, n, m, d):
    i = 0
    while (i < n and m > 0):
        m -= 1
        i += d
    if m == 0:
        return True
    return False


def maximumDistance(arr, n, m):
    low = 1
    high = n - 1
    ans = 0
    while (low <= high):
        mid = (low + high) // 2
        flag = check(arr, n, m, mid)
        if (flag):
            ans = mid
            low = mid + 1
        else:
            high = mid - 1
    return ans


n = 5
m = 3
arr = [0] * n
print(maximumDistance(arr, n, m))

# Expected output:
2
# maximum xor value of maximum and second maximum element among all possible subarrays | function to return the maximum possible xor ; to store the final answer ; borward traversal ; backward traversal ; 
def maximumXor(arr: list, n: int) -> int:
    sForward, sBackward = [], []
    ans = -1
    for i in range(n):
        while len(sForward) > 0 and arr[i] < arr[sForward[-1]]:
            ans = max(ans, arr[i] ^ arr[sForward[-1]])
            sForward .pop()
        sForward .append(i)
        while len(sBackward) > 0 and arr[n - i - 1] < arr[sBackward[-1]]:
            ans = max(ans, arr[n - i - 1] ^ arr[sBackward[-1]])
            sBackward .pop()
        sBackward .append(n - i - 1)
    return ans


if __name__ == "__main__":
    arr = [8, 1, 2]
    n = len(arr)
    print(maximumXor(arr, n))

# Expected output:
9
# minimum count of full binary trees such that the count of leaves is n | function to return the minimum count of trees required ; to store the count of set bits in n ; 
def minTrees(n):
    count = 0
    while (n):
        n &= (n - 1)
        count += 1
    return count


if __name__ == '__main__':
    n = 7
    print(minTrees(n))

# Expected output:
3
# count number of steps to cover a distance if steps can be taken in powers of 2 | function to count the minimum number of steps ; bin ( k ) . count ( "1" ) is a python3 function to count the number of set bits in a number ; 
def getMinSteps(K):
    return bin(K).count("1")


n = 343
print(getMinSteps(n))

# Expected output:
6
# game theory in balanced ternary numeral system | ( moving 3 k steps at a time ) | function that returns true if the game cannot be won ; 
def isDefeat(s1, s2, n):
    for i in range(n):
        if ((s1[i] == '0' and s2[i] == '1') or (
                s1[i] == '1' and s2[i] == '0')):
            continue
        elif ((s1[i] == '0' and s2[i] == 'Z') or (s1[i] == 'Z' and s2[i] == '0')):
            continue
        else:
            return True
    return False


s1 = "01001101ZZ"
s2 = "10Z1001000"
n = 10
if (isDefeat(s1, s2, n)):
    print("Defeat")
else:
    print("Victory")

# Expected output:
Victory
# check if matrix a can be converted to b by changing parity of corner elements of any submatrix | python 3 implementation of the above approach ; boolean function that returns true or false ; traverse for all elements ; if both are not equal ; change the parity of all corner elements ; check if a is equal to b ; not equal ; 

N = 3
M = 3


def check(a, b):
    for i in range(1, N, 1):
        for j in range(1, M, 1):
            if (a[i][j] != b[i][j]):
                a[i][j] ^= 1
                a[0][0] ^= 1
                a[0][j] ^= 1
                a[i][0] ^= 1
    for i in range(N):
        for j in range(M):
            if (a[i][j] != b[i][j]):
                return False
    return True


if __name__ == '__main__':
    a = [[0, 1, 0], [0, 1, 0], [1, 0, 0]]
    b = [[1, 0, 0], [1, 0, 0], [1, 0, 0]]
    if (check(a, b)):
        print("Yes")
    else:
        print("No")

# Expected output:
Yes
# position of the k | function that returns the kth set bit ; traverse in the binary ; check if the last bit is set or not ; check if count is equal to k then return the index ; increase the index as we move right ; right shift the number by 1 ; 
def FindIndexKthBit(n, k):
    cnt, ind = 0, 0
    while n > 0:
        if n & 1:
            cnt += 1
        if cnt == k:
            return ind
        ind += 1
        n = n >> 1
    return -1


if __name__ == "__main__":
    n, k = 15, 3
    ans = FindIndexKthBit(n, k)
    if ans != -1:
        print(ans)
    else:
        print("No k-th set bit")

# Expected output:
2
# check if the binary representation of a number has equal number of 0 s and 1 s in blocks | function to check ; converting integer to its equivalent binary number ; if adjacent character are same then increase counter ; 
def hasEqualBlockFrequency(N):
    S = bin(N).replace("0b", "")
    p = set()
    c = 1
    for i in range(len(S) - 1):
        if (S[i] == S[i + 1]):
            c += 1
        else:
            p .add(c)
            c = 1
        p .add(c)
    if (len(p) == 1):
        print("Yes")
    else:
        print("No")


N = 5
hasEqualBlockFrequency(N)

# Expected output:
Yes
# distance between two nodes of binary tree with node values from 1 to n | python 3 program to find minimum distance between two nodes in binary tree ; function to get minimum path distance ; find the 1 st dis - similar bit count bit length of n1 and n2 ; find bit difference and maxbit ; calculate result by formula ; 

from math import log2


def minDistance(n1, n2):
    bitCount1 = int(log2(n1)) + 1
    bitCount2 = int(log2(n2)) + 1
    bitDiff = abs(bitCount1 - bitCount2)
    maxBitCount = max(bitCount1, bitCount2)
    if (bitCount1 > bitCount2):
        n2 = int(n2 * pow(2, bitDiff))
    else:
        n1 = int(n1 * pow(2, bitDiff))
    xorValue = n1 ^ n2
    if xorValue == 0:
        bitCountXorValue = 1
    else:
        bitCountXorValue = int(log2(xorValue)) + 1
    disSimilarBitPosition = (maxBitCount - bitCountXorValue)
    result = (bitCount1 + bitCount2 - 2 * disSimilarBitPosition)
    return result


if __name__ == '__main__':
    n1 = 12
    n2 = 5
    print(minDistance(n1, n2))

# Expected output:
5
# remove one bit from a binary number to get maximum value | function to find the maximum binary number ; traverse the binary number ; try finding a 0 and skip it ; 
def printMaxAfterRemoval(s):
    flag = False
    n = len(s)
    for i in range(0, n):
        if s[i] == '0' and flag == False:
            flag = True
            continue
        else:
            print(s[i], end="")


if __name__ == "__main__":
    s = "1001"
    printMaxAfterRemoval(s)

# Expected output:
101
# find position of left most dis | python3 program to find the leftmost position of first dis - similar bit ; function to find first dis - similar bit ; return zero for equal number ; find the 1 st dis - similar bit count bit length of n1 and n ; find bit difference and maxbit ; 

from math import floor, log2


def bitPos(n1, n2):
    if n1 == n2:
        return 0
    bitCount1 = floor(log2(n1)) + 1
    bitCount2 = floor(log2(n2)) + 1
    bitDiff = abs(bitCount1 - bitCount2)
    maxBitCount = max(bitCount1, bitCount2)
    if (bitCount1 > bitCount2):
        n2 *= pow(2, bitDiff)
    else:
        n1 *= pow(2, bitDiff)
    xorValue = n1 ^ n2
    bitCountXorValue = floor(log2(xorValue)) + 1
    disSimilarBitPosition = (maxBitCount - bitCountXorValue + 1)
    return disSimilarBitPosition


if __name__ == "__main__":
    n1, n2 = 53, 55
    print(bitPos(n1, n2))

# Expected output:
5
# number of pairs with bitwise or as odd number | function to count pairs with odd or ; count total even numbers in array ; even pair count ; total pairs ; return odd pair count ; 
def countOddPair(A, N):
    count = 0
    for i in range(0, N):
        if (A[i] % 2 != 1):
            count += 1
    evenPairCount = count * (count - 1) / 2
    totPairs = N * (N - 1) / 2
    return (int)(totPairs - evenPairCount)


A = [5, 6, 2, 8]
N = len(A)
print(countOddPair(A, N))

# Expected output:
3
# replace every array element by bitwise xor of previous and next element | python3 program to update every array element with sum of previous and next numbers in array ; nothing to do when array size is 1 ; store current value of arr [ 0 ] and update it ; update rest of the array elements ; store current value of next interaction ; update current value using previous value ; update previous value ; update last array element separately ; 
def ReplaceElements(arr, n):
    if n <= 1:
        return
    prev = arr[0]
    arr[0] = arr[0] ^ arr[1]
    for i in range(1, n - 1):
        curr = arr[i]
        arr[i] = prev ^ arr[i + 1]
        prev = curr
    arr[n - 1] = prev ^ arr[n - 1]


arr = [2, 3, 4, 5, 6]
n = len(arr)
ReplaceElements(arr, n)
for i in range(n):
    print(arr[i], end=" ")

# Expected output:
1 6 6 2 3
# find triplets in an array whose and is maximum | python3 program to find triplet with maximum bitwise and . ; flag array initially set to true for all numbers ; 2d array for bit representation of all the numbers . initially all bits are set to 0. ; finding bit representation of every number and storing it in bits array . ; checking last bit of the number ; dividing number by 2. ; maximum and number initially 0. ; traversing the 2d binary representation . 0 th index represents 32 th bits while 32 th index represents 0 th bit . ; if cnt greater than 3 then ( 32 - i ) th bits of the number will be set . ; setting flags of the numbers whose ith bit is not set . ; counting the numbers whose flag are true . ; 
def maxTriplet(a, n):
    f = [True for i in range(n)]
    bits = [[0 for i in range(33)]for i in range(n)]
    for i in range(n):
        num = a[i]
        j = 32
        while (num):
            if (num & 1):
                bits[i][j] = 1
            j -= 1
            num >>= 1
    ans = 0
    for i in range(33):
        cnt = 0
        for j in range(n):
            if (bits[j][i] and f[j]):
                cnt += 1
        if (cnt >= 3):
            ans += pow(2, 32 - i)
            for j in range(n):
                if (bits[j][i] == False):
                    f[j] = False
    cnt = 0
    for i in range(n):
        if (f[i]):
            cnt += 1
    NumberOfTriplets = (cnt * (cnt - 1) * (cnt - 2)) // 6
    print(NumberOfTriplets, ans)


a = [4, 11, 10, 15, 26]
n = len(a)
maxTriplet(a, n)

# Expected output:
4 10
# find bitwise or of all possible sub | function to return or of sub - arrays ; 
def OR(a, n):
    ans = a[0]
    for i in range(1, n):
        ans |= a[i]
    return ans


if __name__ == '__main__':
    a = [1, 4, 6]
    n = len(a)
    print(OR(a, n))

# Expected output:
7
# maximum set bit sum in array without considering adjacent elements | function to count total number of set bits in an integer ; maximum sum of set bits ; calculate total number of set bits for every element of the array ; find total set bits for each number and store back into the array ; current max excluding i ; current max including i ; return max of incl and excl ; 
def bit(n):
    count = 0
    while (n):
        count += 1
        n = n & (n - 1)
    return count


def maxSumOfBits(arr, n):
    for i in range(n):
        arr[i] = bit(arr[i])
    incl = arr[0]
    excl = 0
    for i in range(1, n):
        if incl > excl:
            excl_new = incl
        else:
            excl_new = excl
        incl = excl + arr[i]
        excl = excl_new
    if incl > excl:
        return incl
    else:
        return excl


if __name__ == "__main__":
    arr = [1, 2, 4, 5, 6, 7, 20, 25]
    n = len(arr)
    print(maxSumOfBits(arr, n))

# Expected output:
9
# increment a number without using ++ or + | function that increment the value . ; invert bits and apply negative sign ; 
def increment(i):
    i = -(~ord(i))
    return chr(i)


n = 'a'
print(increment(n))

# Expected output:
b