Problem: Check if Array has at least M non-overlapping Subarray with gcd G
Given an array A[] and M, the task is to check whether there exist M non-overlapping subarrays(non-empty) of A for which the average of the GCD of those subarrays equals G where G denotes the gcd of all the numbers in the array A.

Sample Input: A[] = {6, 12, 18, 24}
Sample Output: No

Solution (python):
# Python code to implement the approach

# Function to find gcd of two numbers
def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

# Function to find check whether
# non-overlapping subarray exists
def find(arr, n, m):
    G = 0
    g = 0
    count = 0
    for i in range(n):
        G = gcd(G, arr[i])

    for i in range(n):
        g = gcd(g, arr[i])
        if (g == G):
            count += 1
            g = 0

    if (count >= m):
        return "Yes"
    return "No"

# Driver code
if __name__ == "__main__":
    A = [1, 2, 3, 4, 5]
    N = 5
    K = 3
    
    # Function call
    print(find(A, N, K))