giulio98/xlcost-single-prompt huggingface dataset:
# total number of decreasing paths in a matrix | python3 program to count number of decreasing path in a matrix ; function that returns the number of decreasing paths from a cell ( i , j ) ; checking if already calculated ; all possible paths ; counts the total number of paths ; in all four allowed direction . ; new co - ordinates ; checking if not going out of matrix and next cell value is less than current cell value . ; function that returns the answer ; function that counts the total decreasing path in the matrix ; initialising dp [ ] [ ] to - 1. ; calculating number of decreasing path from each cell . ; 

MAX = 100


def CountDecreasingPathsCell(mat, dp, n, x, y):
    if (dp[x][y] != -1):
        return dp[x][y]
    delta = [[0, 1], [1, 0], [-1, 0], [0, -1]]
    newx, newy = 0, 0
    ans = 1
    for i in range(4):
        newx = x + delta[i][0]
        newy = y + delta[i][1]
        if (newx >= 0 and newx < n and newy >= 0 and newy <
                n and mat[newx][newy] < mat[x][y]):
            ans += CountDecreasingPathsCell(mat, dp, n, newx, newy)
    dp[x][y] = ans
    return dp[x][y]


def countDecreasingPathsMatrix(n, mat):
    dp = []
    for i in range(n):
        l = []
        for j in range(n):
            l .append(-1)
        dp .append(l)
    sum = 0
    for i in range(n):
        for j in range(n):
            sum += CountDecreasingPathsCell(mat, dp, n, i, j)
    return sum


n = 2
mat = [[1, 2], [1, 3]]
print(countDecreasingPathsMatrix(n, mat))

# Expected output:
8
# sum of product of consecutive binomial coefficients | python3 program to find sum of product of consecutive binomial coefficient . ; find the binomial coefficient upto nth term ; c [ 0 ] = 1 ; nc0 is 1 ; compute next row of pascal triangle using the previous row ; return the sum of the product of consecutive binomial coefficient . ; finding the sum of product of consecutive coefficient . ; 

MAX = 100


def binomialCoeff(C, n):
    for i in range(1, n + 1):
        for j in range(min(i, n), 0, -1):
            C[j] = C[j] + C[j - 1]
    return C


def sumOfproduct(n):
    sum = 0
    C = [0] * MAX
    C = binomialCoeff(C, n)
    for i in range(n + 1):
        sum += C[i] * C[i + 1]
    return sum


n = 3
print(sumOfproduct(n))

# Expected output:
0
# sum of product of r and rth binomial coefficient ( r * ncr ) | python 3 program to find sum of product of r and rth binomial coefficient i . e summation r * ncr ; return the first n term of binomial coefficient . ; c [ 0 ] = 1 nc0 is 1 ; compute next row of pascal triangle using the previous row ; return summation of r * ncr ; finding the first n term of binomial coefficient ; iterate a loop to find the sum . ; 

MAX = 100


def binomialCoeff(n, C):
    for i in range(1, n + 1):
        for j in range(min(i, n), -1, -1):
            C[j] = C[j] + C[j - 1]


def summation(n):
    C = [0] * MAX
    binomialCoeff(n, C)
    sum = 0
    for i in range(n + 1):
        sum += (i * C[i])
    return sum


if __name__ == "__main__":
    n = 2
    print(summation(n))

# Expected output:
0
# number of arrays of size n whose elements are positive integers and sum is k | return ncr ; c [ 0 ] = 1 ; nc0 is 1 ; compute next row of pascal triangle using the previous row ; return the number of array that can be formed of size n and sum equals to k . ; 
def binomialCoeff(n, k):
    C = [0] * (k + 1)
    for i in range(1, n + 1):
        for j in range(min(i, k), 0, -1):
            C[j] = C[j] + C[j - 1]
    return C[k]


def countArray(N, K):
    return binomialCoeff(K - 1, N - 1)


N = 2
K = 3
print(countArray(N, K))

# Expected output:
0
# partitioning into two contiguous element subarrays with equal sums | class to store the minimum element and its position ; initialize prefix and suffix sum arrays with 0 ; add current element to sum ; add current element to sum ; initialize the minimum element to be a large value ; check for the minimum absolute difference between current prefix sum and the next suffix sum element ; if prefixsum has a greater value then position is the next element , else it 's the same element. ; return the data in class . ; 

class Data:
    def __init__(self):
        self .element = -1
        self .position = -1


def findMinElement(arr, n):
    result = Data()
    prefixSum = [0] * n
    suffixSum = [0] * n
    prefixSum[0] = arr[0]
    for i in range(1, n):
        prefixSum[i] = prefixSum[i - 1] + arr[i]
        suffixSum[n - 1] = arr[n - 1]
    for i in range(n - 2, -1, -1):
        suffixSum[i] = suffixSum[i + 1] + arr[i]
    mini = suffixSum[0]
    pos = 0
    for i in range(n - 1):
        if abs(suffixSum[i + 1] - prefixSum[i]) < mini:
            mini = abs(suffixSum[i + 1] - prefixSum[i])
            if suffixSum[i + 1] < prefixSum[i]:
                pos = i + 1
            else:
                pos = i
    result .element = mini
    result .position = pos
    return result


if __name__ == "__main__":
    arr = [10, 1, 2, 3, 4]
    n = len(arr)
    values = Data()
    values = findMinElement(arr, n)
    print("Minimum element :", values .element, "Position:", values .position)

# Expected output:
Minimum element : 0 Position: 0
# number of circular tours that visit all petrol pumps | python 3 program to find the number of circular tour that visits all petrol pump ; return the number of pumps from where we can start the journey . ; making circular array . ; for each of the petrol pump . ; if tank is less than 0. ; if starting pump is greater than n , return ans as 0. ; for each of the petrol pump ; finding the need array ; if need is 0 , increment the count . ; 

N = 100


def count(n, c, a, b):
    need = [0 for i in range(N)]
    for i in range(0, n, 1):
        a[i + n] = a[i]
        b[i + n] = b[i]
    s = 0
    tank = 0
    for i in range(0, 2 * n, 1):
        tank += a[i]
        tank = min(tank, c)
        tank -= b[i]
        if (tank < 0):
            tank = 0
            s = i + 1
    if (s >= n):
        return 0
    ans = 1
    need[s + n] = 0
    for i in range(1, n, 1):
        id = s + n - i
        need[id] = max(0, need[id + 1] + b[id] - min(a[id], c))
        if (need[id] == 0):
            ans += 1
    return ans


if __name__ == '__main__':
    n = 3
    c = 3
    a = [3, 1, 2, 0, 0, 0]
    b = [2, 2, 2, 0, 0, 0]
    print(count(n, c, a, b))

# Expected output:
2
# print equal sum sets of array ( partition problem ) | set 2 | python3 program to print equal sum sets of array . ; function to print equal sum sets of array . ; finding sum of array elements ; check sum is even or odd . if odd then array cannot be partitioned . print - 1 and return . ; divide sum by 2 to find sum of two possible subsets . ; boolean dp table to store result of states . dp [ i ] [ j ] = true if there is a subset of elements in first i elements of array that has sum equal to j . ; if number of elements are zero , then no sum can be obtained . ; sum 0 can be obtained by not selecting any element . ; fill the dp table in bottom up manner . ; excluding current element . ; including current element ; required sets set1 and set2 . ; if partition is not possible print - 1 and return . ; start from last element in dp table . ; if current element does not contribute to k , then it belongs to set 2. ; if current element contribute to k then it belongs to set 1. ; print elements of both the sets . ; 

import numpy as np


def printEqualSumSets(arr, n):
    sum_array = sum(arr)
    if (sum_array & 1):
        print("-1")
        return
    k = sum_array >> 1
    dp = np .zeros((n + 1, k + 1))
    for i in range(1, k + 1):
        dp[0][i] = False
    for i in range(n + 1):
        dp[i][0] = True
    for i in range(1, n + 1):
        for currSum in range(1, k + 1):
            dp[i][currSum] = dp[i - 1][currSum]
            if (arr[i - 1] <= currSum):
                dp[i][currSum] = (dp[i][currSum] or dp[i - 1]
                                  [currSum - arr[i - 1]])
    set1, set2 = [], []
    if (not dp[n][k]):
        print("-1")
        return
    i = n
    currSum = k
    while (i > 0 and currSum >= 0):
        if (dp[i - 1][currSum]):
            i -= 1
            set2 .append(arr[i])
        elif (dp[i - 1][currSum - arr[i - 1]]):
            i -= 1
            currSum -= arr[i]
            set1 .append(arr[i])
    print("Set 1 elements:", end=" ")
    for i in range(len(set1)):
        print(set1[i], end=" ")
    print("Set2elements:",  end="")
    for i in range(len(set2)):
        print(set2[i], end=" ")


if __name__ == "__main__":
    arr = [5, 5, 1, 11]
    n = len(arr)
    printEqualSumSets(arr, n)

# Expected output:
Set 1 elements: 1 5 5 Set2elements:11
# maximum average sum partition of an array | python3 program for maximum average sum partition ; storing prefix sums ; for each i to n storing averages ; 
def largestSumOfAverages(A, K):
    n = len(A)
    pre_sum = [0] * (n + 1)
    pre_sum[0] = 0
    for i in range(n):
        pre_sum[i + 1] = pre_sum[i] + A[i]
    dp = [0] * n
    sum = 0
    for i in range(n):
        dp[i] = (pre_sum[n] - pre_sum[i]) / (n - i)
    for k in range(K - 1):
        for i in range(n):
            for j in range(i + 1, n):
                dp[i] = max(dp[i], (pre_sum[j] - pre_sum[i]) / (j - i) + dp[j])
    return int(dp[0])


A = [9, 1, 2, 3, 9]
K = 3
print(largestSumOfAverages(A, K))

# Expected output:
20
# find maximum sum array of length less than or equal to m | n and m to define sizes of arr , dp , current_arr and maxsum ; inf to define min value ; function to find maximum sum ; dp array of size n x m ; current_arr of size m ; maxsum of size m ; if we have 0 elements from 0 th array ; compute the cumulative sum array ; calculating the maximum contiguous array for every length j , j is from 1 to lengtn of the array ; every state is depending on its previous state ; computation of dp table similar approach as knapsack problem ; now we have done processing with the last array lets find out what is the maximum sum possible ; 

N = 105
M = 1001
INF = -1111111111


def maxSum(arr):
    dp = [[-1 for x in range(M)]for y in range(N)]
    current_arr = [0] * M
    maxsum = [0] * M
    current_arr[0] = 0
    dp[0][0] = 0
    for i in range(1, 6):
        len = arr[i - 1][0]
        for j in range(1, len + 1):
            current_arr[j] = arr[i - 1][j]
            current_arr[j] += current_arr[j - 1]
            maxsum[j] = INF
        j = 1
        while j <= len and j <= 6:
            for k in range(1, len + 1):
                if (j + k - 1 <= len):
                    maxsum[j] = max(maxsum[j],
                                    current_arr[j + k - 1] - current_arr[k - 1])
            j += 1
        for j in range(7):
            dp[i][j] = dp[i - 1][j]
        for j in range(1, 7):
            cur = 1
            while cur <= j and cur <= len:
                dp[i][j] = max(dp[i][j], dp[i - 1][j - cur] + maxsum[cur])
                cur += 1
    ans = 0
    for i in range(7):
        ans = max(ans, dp[5][i])
    return ans


if __name__ == "__main__":
    arr = [[3, 2, 3, 5], [2, 7, -1], [2, 8, 10],
           [4, 5, 2, 6, 1], [3, 2, 3, -2]]
    print("Maximum sum can be obtained", "is : ", maxSum(arr))

# Expected output:
Maximum sum can be obtained is :  39
# maximize array elements upto given number | function to find maximum possible value of number that can be obtained using array elements . ; variable to represent current index . ; variable to show value between 0 and maxlimit . ; table to store whether a value can be obtained or not upto a certain index 1. dp [ i , j ] = 1 if value j can be obtained upto index i . 2. dp [ i , j ] = 0 if value j cannot be obtained upto index i . ; check for index 0 if given value val can be obtained by either adding to or subtracting arr [ 0 ] from num . ; 1. if arr [ ind ] is added to obtain given val then val - arr [ ind ] should be obtainable from index ind - 1. 2. if arr [ ind ] is subtracted to obtain given val then val + arr [ ind ] should be obtainable from index ind - 1. check for both the conditions . ; if either of one condition is true , then val is obtainable at index ind . ; find maximum value that is obtained at index n - 1. ; if no solution exists return - 1. ; 
def findMaxVal(arr, n, num, maxLimit):
    ind = -1
    val = -1
    dp = [[0 for i in range(maxLimit + 1)]for j in range(n)]
    for ind in range(n):
        for val in range(maxLimit + 1):
            if (ind == 0):
                if (num - arr[ind] == val or num + arr[ind] == val):
                    dp[ind][val] = 1
                else:
                    dp[ind][val] = 0
            else:
                if (val - arr[ind] >= 0 and val + arr[ind] <= maxLimit):
                    if (dp[ind - 1][val - arr[ind]] ==
                            1 or dp[ind - 1][val + arr[ind]] == 1):
                        dp[ind][val] = 1
                elif (val - arr[ind] >= 0):
                    dp[ind][val] = dp[ind - 1][val - arr[ind]]
                elif (val + arr[ind] <= maxLimit):
                    dp[ind][val] = dp[ind - 1][val + arr[ind]]
                else:
                    dp[ind][val] = 0
    for val in range(maxLimit, -1, -1):
        if (dp[n - 1][val] == 1):
            return val
    return -1


if __name__ == '__main__':
    num = 1
    arr = [3, 10, 6, 4, 5]
    n = len(arr)
    maxLimit = 15
    print(findMaxVal(arr, n, num, maxLimit))

# Expected output:
9
# moser | function to generate nth term of moser - de bruijn sequence ; s ( 0 ) = 0 ; s ( 1 ) = 1 ; s ( 2 * n ) = 4 * s ( n ) ; s ( 2 * n + 1 ) = 4 * s ( n ) + 1 ; generating the first ' n ' terms of moser - de bruijn sequence ; 
def gen(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    elif n % 2 == 0:
        return 4 * gen(n // 2)
    elif n % 2 == 1:
        return 4 * gen(n // 2) + 1


def moserDeBruijn(n):
    for i in range(n):
        print(gen(i), end=" ")


n = 15
print("First", n, "terms of ", "Moser-de Bruijn Sequence:")
moserDeBruijn(n)

# Expected output:
First 15 terms of  Moser-de Bruijn Sequence:
0 1 4 5 16 17 20 21 64 65 68 69 80 81 84
# minimum sum path in a triangle | util function to find minimum sum for a path ; for storing the result in a 1 - d array , and simultaneously updating the result . ; for the bottom row ; calculation of the remaining rows , in bottom up manner . ; return the top element ; 
def minSumPath(A):
    memo = [None] * len(A)
    n = len(A) - 1
    for i in range(len(A[n])):
        memo[i] = A[n][i]
    for i in range(len(A) - 2, -1, -1):
        for j in range(len(A[i])):
            memo[j] = A[i][j] + min(memo[j], memo[j + 1])
    return memo[0]


A = [[2], [3, 9], [1, 6, 7]]
print(minSumPath(A))

# Expected output:
6
# minimum removals from array to make max | python program to find minimum removals to make max - min <= k ; function to check all possible combinations of removal and return the minimum one ; base case when all elements are removed ; if condition is satisfied , no more removals are required ; if the state has already been visited ; when amax - amin > d ; minimum is taken of the removal of minimum element or removal of the maximum element ; to sort the array and return the answer ; sort the array ; fill all stated with - 1 when only one element ; 

MAX = 100
dp = [[0 for i in range(MAX)]for i in range(MAX)]
for i in range(0, MAX):
    for j in range(0, MAX):
        dp[i][j] = -1


def countRemovals(a, i, j, k):
    global dp
    if (i >= j):
        return 0
    elif ((a[j] - a[i]) <= k):
        return 0
    elif (dp[i][j] != -1):
        return dp[i][j]
    elif ((a[j] - a[i]) > k):
        dp[i][j] = 1 + min(countRemovals(a, i + 1, j, k),
                           countRemovals(a, i, j - 1, k))
    return dp[i][j]


def removals(a, n, k):
    a .sort()
    if (n == 1):
        return 0
    else:
        return countRemovals(a, 0, n - 1, k)


a = [1, 3, 4, 9, 10, 11, 12, 17, 20]
n = len(a)
k = 4
print(removals(a, n, k))

# Expected output:
5
# minimum removals from array to make max | function to find rightmost index which satisfies the condition arr [ j ] - arr [ i ] <= k ; initialising start to i + 1 ; initialising end to n - 1 ; binary search implementation to find the rightmost element that satisfy the condition ; check if the condition satisfies ; store the position ; make start = mid + 1 ; make end = mid ; return the rightmost position ; function to calculate minimum number of elements to be removed ; sort the given array ; iterate from 0 to n - 1 ; find j such that arr [ j ] - arr [ i ] <= k ; if there exist such j that satisfies the condition ; number of elements to be removed for this particular case is ( j - i + 1 ) ; return answer ; 
def findInd(key, i, n, k, arr):
    ind = -1
    start = i + 1
    end = n - 1
    while (start < end):
        mid = int(start + (end - start) / 2)
        if (arr[mid] - key <= k):
            ind = mid
            start = mid + 1
        else:
            end = mid
    return ind


def removals(arr, n, k):
    ans = n - 1
    arr .sort()
    for i in range(0, n):
        j = findInd(arr[i], i, n, k, arr)
        if (j != -1):
            ans = min(ans, n - (j - i + 1))
    return ans


a = [1, 3, 4, 9, 10, 11, 12, 17, 20]
n = len(a)
k = 4
print(removals(a, n, k))

# Expected output:
5
# number of ordered pairs such that ( ai & aj ) = 0 | naive function to count the number of ordered pairs such that their bitwise and is 0 ; check for all possible pairs ; add 2 as ( i , j ) and ( j , i ) are considered different ; 
def countPairs(a, n):
    count = 0
    for i in range(0, n):
        for j in range(i + 1, n):
            if (a[i] & a[j]) == 0:
                count += 2
    return count


a = [3, 4, 2]
n = len(a)
print(countPairs(a, n))

# Expected output:
4
# number of ordered pairs such that ( ai & aj ) = 0 | python program to calculate the number of ordered pairs such that their bitwise and is zero ; efficient function to count pairs ; stores the frequency of each number ; initialize 0 to all ; count the frequency of every element ; iterate for al possible values that a [ i ] can be ; if the last bit is on ; else : is the last bit is off ; iterate till n ; if mask 's ith bit is set ; else : if mask 's ith bit is not set ; iterate for all the array element and count the number of pairs ; return answer ; 

N = 15


def countPairs(a, n):
    Hash = {}
    dp = [[0 for i in range(N + 1)]for j in range(1 << N)]
    for i in range(n):
        if a[i]not in Hash:
            Hash[a[i]] = 1
        else:
            Hash[a[i]] += 1
    mask = 0
    while (mask < (1 << N)):
        if mask not in Hash:
            Hash[mask] = 0
        if (mask & 1):
            dp[mask][0] = Hash[mask] + Hash[mask ^ 1]
            dp[mask][0] = Hash[mask]
        for i in range(1, N + 1):
            if (mask & (1 << i)):
                dp[mask][i] = dp[mask][i - 1] + dp[mask ^ (1 << i)][i - 1]
                dp[mask][i] = dp[mask][i - 1]
        mask += 1
    ans = 0
    for i in range(n):
        ans += dp[((1 << N) - 1) ^ a[i]][N]
    return ans


a = [5, 4, 1, 6]
n = len(a)
print(countPairs(a, n))

# Expected output:
0
# print fibonacci series in reverse order | python 3 program to print fibonacci series in reverse order ; assigning first and second elements ; storing sum in the preceding location ; printing array in reverse order ; 
def reverseFibonacci(n):
    a = [0] * n
    a[0] = 0
    a[1] = 1
    for i in range(2, n):
        a[i] = a[i - 2] + a[i - 1]
    for i in range(n - 1, -1, -1):
        print(a[i], end=" ")


n = 5
reverseFibonacci(n)

# Expected output:
3 2 1 1 0
# check if it is possible to transform one string to another | function to check if a string can be converted to another string by performing following operations ; calculates length ; mark 1 st position as true ; traverse for all dpi , j ; if possible for to convert i characters of s1 to j characters of s2 ; if upper_case ( s1 [ i ] ) == s2 [ j ] is same ; if not upper then deletion is possible ; 
def check(s1, s2):
    n = len(s1)
    m = len(s2)
    dp = ([[False for i in range(m + 1)]for i in range(n + 1)])
    dp[0][0] = True
    for i in range(len(s1)):
        for j in range(len(s2) + 1):
            if (dp[i][j]):
                if ((j < len(s2) and (s1[i].upper() == s2[j]))):
                    dp[i + 1][j + 1] = True
                if (s1[i].isupper() == False):
                    dp[i + 1][j] = True
    return (dp[n][m])


if __name__ == '__main__':
    s1 = "daBcd"
    s2 = "ABC"
    if (check(s1, s2)):
        print("YES")
    else:
        print("NO")

# Expected output:
YES
# probability of reaching a point with 2 or 3 steps at a time | returns probability to reach n ; 
def find_prob(N, P):
    dp = [0] * (n + 1)
    dp[0] = 1
    dp[1] = 0
    dp[2] = P
    dp[3] = 1 - P
    for i in range(4, N + 1):
        dp[i] = (P) * dp[i - 2] + (1 - P) * dp[i - 3]
    return dp[N]


n = 5
p = 0.2
print(round(find_prob(n, p), 2))

# Expected output:
0.32
# minimum number of deletions to make a string palindrome | set 2 | python3 program to find minimum deletions to make palindrome . ; find reverse of input string ; create a dp table for storing edit distance of string and reverse . ; find edit distance between input and revinput considering only delete operation . ; go from bottom left to top right and find the minimum ; 

INT_MAX = 99999999999


def getLevenstein(inpt):
    revInput = inpt[::-1]
    n = len(inpt)
    dp = [[-1 for _ in range(n + 1)]for __ in range(n + 1)]
    for i in range(n + 1):
        dp[0][i] = i
        dp[i][0] = i
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if inpt[i - 1] == revInput[j - 1]:
                dp[i][j] = dp[i - 1][j - 1]
            else:
                dp[i][j] = 1 + min(dp[i - 1][j], dp[i][j - 1])
    res = INT_MAX
    i, j = n, 0
    while i >= 0:
        res = min(res, dp[i][j])
        if i < n:
            res = min(res, dp[i + 1][j])
        if i > 0:
            res = min(res, dp[i - 1][j])
        i -= 1
        j += 1
    return res


if __name__ == "__main__":
    inpt = "myfirstgeekarticle"
    print(getLevenstein(inpt))

# Expected output:
12
# number of ways to form a heap with n distinct integers | dp [ i ] = number of max heaps for i distinct integers ; nck [ i ] [ j ] = number of ways to choose j elements form i elements , no order ; log2 [ i ] = floor of logarithm of base 2 of i ; to calculate nck ; calculate l for give value of n ; number of elements that are actually present in last level ( hth level ) ( 2 ^ h - 1 ) ; if more than half - filled ; return ( 1 << h ) - 1 ( 2 ^ h ) - 1 ; find maximum number of heaps for n ; function to initialize arrays ; for each power of two find logarithm ; 

MAXN = 105
dp = [0]*MAXN
nck = [[0 for i in range(MAXN)] for j in range(MAXN)]
log2 = [0]*MAXN


def choose(n, k):
    if (k > n):
        return 0
    if (n <= 1):
        return 1
    if (k == 0):
        return 1

    if (nck[n][k] != -1):
        return nck[n][k]

    answer = choose(n - 1, k - 1) + choose(n - 1, k)
    nck[n][k] = answer
    return answer


def getLeft(n):
    if (n == 1):
        return 0

    h = log2[n]
    numh = (1 << h)
    last = n - ((1 << h) - 1)
    if (last >= (numh // 2)):
        return (1 << h) - 1
    else:
        return (1 << h) - 1 - ((numh // 2) - last)


def numberOfHeaps(n):
    if (n <= 1):
        return 1

    if (dp[n] != -1):
        return dp[n]

    left = getLeft(n)
    ans = (choose(n - 1, left) * numberOfHeaps(left)) * \
        (numberOfHeaps(n - 1 - left))
    dp[n] = ans
    return ans


def solve(n):
    for i in range(n+1):
        dp[i] = -1

    for i in range(n+1):
        for j in range(n+1):
            nck[i][j] = -1

    currLog2 = -1
    currPower2 = 1
    for i in range(1, n+1):
        if (currPower2 == i):
            currLog2 += 1
            currPower2 *= 2
        log2[i] = currLog2
    return numberOfHeaps(n)


n = 10
print(solve(n))

# Expected output:
3360