Queries to calculate GCD of an array after multiplying first or last K elements by X

#include
using namespace std;

void findGCDQueries(int arr[], int N,
                    int Queries[][3],
                    int Q)
{
    
    
    int prefix[N], suffix[N];

    prefix[0] = arr[0];
    suffix[N – 1] = arr[N – 1];

    
    for (int i = 1; i < N; i++) {         prefix[i] = __gcd(prefix[i - 1],                           arr[i]);     }          for (int i = N - 2; i >= 0; i–) {
        suffix[i] = __gcd(suffix[i + 1],
                          arr[i]);
    }

    
    for (int i = 0; i < Q; i++) {         int a = Queries[i][0];         int K = Queries[i][1];         int X = Queries[i][2];                           if (K == N) {             cout