/*  ACR22

    TESTING OF THE ACROSS CLAUSE'.
    DISTRIBUTED ARRAY A(N,M) IS TO HAVE DIFFERENT
    FLOW-DEP-LENGTH ON BOTH SIDES */

#include <math.h>
#include <stdlib.h>
#include <stdio.h>

#define Min(a, b) (((a) < (b)) ? (a) : (b))

static void acr2201();
static void acr2202();
static void acr2203();
static void acr2204();
static void acr2205();
static void acr2206();
static void acr2207();
static void acr2208();
static void acr2209();
static void acr2210();
static void acr2211();
static void acr2212();
static void acr2213();
static void acr2214();
static void acr2215();

static void ansyes(const char tname[]);
static void ansno(const char tname[]);

static int i, j;

int main(int an, char **as)
{
    printf("===START OF ACR22========================\n");
    /* ---------------------------------------- */
    acr2201();
    /* ---------------------------------------- */
    acr2202();
    /* ---------------------------------------- */
    acr2203();
    /* ---------------------------------------- */
    acr2204();
    /* ---------------------------------------- */
    acr2205();
    /* ---------------------------------------- */
    acr2206();
    /* ---------------------------------------- */
    acr2207();
    /* ---------------------------------------- */
    acr2208();
    /* ---------------------------------------- */
    acr2209();
    /* ---------------------------------------- */
    acr2210();
    /* ---------------------------------------- */
    acr2211();
    /* ---------------------------------------- */
    acr2212();
    /* ---------------------------------------- */
    acr2213();
    /* ---------------------------------------- */
    acr2214();
    /* ---------------------------------------- */
    acr2215();
    /* ---------------------------------------- */

    printf("=== END OF ACR22 =========================\n");
    return 0;
}
/* ---------------------------------------------ACR2201*/
void acr2201()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2201 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block]
    int (*A)[M];
    A = (int (*)[M])malloc(N * sizeof(int[M]));
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;

    nloopi = NL;
    nloopj = NL;

    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            C[i][j] = C[i + 1][j] + C[i][j + 1] + C[i - 1][j] + C[i][j - 1];

    #pragma dvm actual(nloopi, nloopj, C)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[1:1][1:1])
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            A[i][j] = A[i + 1][j] + A[i][j + 1] + A[i - 1][j] + A[i][j - 1];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    free(A);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2202*/
void acr2202()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2202 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            C[i][j] = C[i + 1][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:1][0:0])
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            A[i][j] = A[i + 1][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2203*/
void acr2203()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2203 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            C[i][j] = C[i - 1][j] + C[i][j + 1];

    #pragma dvm actual(nloopi, nloopj, C)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[1:0][0:1])
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            A[i][j] = A[i - 1][j] + A[i][j + 1];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2204*/
void acr2204()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2204 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[1:1][0:1]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            C[i][j] = C[i + 1][j] + C[i][j + 1];

    #pragma dvm actual(nloopi, nloopj, C)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:1][0:1])
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            A[i][j] = A[i + 1][j] + A[i][j + 1];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi, nloopj)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2205*/
void acr2205()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2205 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[0:1][1:1]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            C[i][j] = C[i][j - 1] + C[i + 1][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:1][1:0])
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            A[i][j] = A[i][j - 1] + A[i + 1][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2206*/
void acr2206()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2206 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[2:2][2:2]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i + 2][j] + C[i][j + 2] + C[i + 2][j] + C[i - 2][j] + C[i][j - 2];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[2:2][2:2])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i + 2][j] + A[i][j + 2] + A[i + 2][j] + A[i - 2][j] + A[i][j - 2];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2207*/
void acr2207()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2207 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[2:2][2:2]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i + 2][j] + C[i][j + 2] + C[i][j - 2];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:2][2:2])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i + 2][j] + A[i][j + 2] + A[i][j - 2];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2208*/
void acr2208()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2208 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[2:2][2:2]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i - 1][j] + C[i][j - 1] + C[i - 2][j] + C[i + 2][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[2:2][2:0])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i - 1][j] + A[i][j - 1] + A[i - 2][j] + A[i + 2][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2209*/
void acr2209()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2209 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[2:2][0:2]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i][j + 2] + C[i + 1][j] + C[i + 2][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[2:2][0:2])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i][j + 2] + A[i + 1][j] + A[i + 2][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2210*/
void acr2210()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2210 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[3:3][3:3]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            C[i][j] = C[i + 1][j] + C[i][j + 2] + C[i + 3][j] + C[i][j -3 ] + C[i - 2][j] + C[i][j - 1];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[3:3][3:3])
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            A[i][j] = A[i + 1][j] + A[i][j + 2] + A[i + 3][j] + A[i][j - 3] + A[i - 2][j] + A[i][j - 1];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2211*/
void acr2211()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2211 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[3:3][0:3]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i][j] + C[i][j + 1];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:0][0:1])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i][j] + A[i][j + 1];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2212*/
void acr2212()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2212 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[0:3][3:3]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            C[i][j] = C[i][j] + C[i + 1][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[0:1][0:0])
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            A[i][j] = A[i][j] + A[i + 1][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2213*/
void acr2213()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2213 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[3:3][3:0]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            C[i][j] = C[i][j - 3] + C[i + 3][j] + C[i - 3][j];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[3:3][3:0])
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            A[i][j] = A[i][j - 3] + A[i + 3][j] + A[i - 3][j];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2214*/
void acr2214()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "ACR2214 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[3:0][3:3]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            C[i][j] = C[i - 3][j] + C[i][j + 3];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[3:0][3:3])
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            A[i][j] = A[i - 3][j] + A[i][j + 3];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ---------------------------------------------ACR2215*/
void acr2215()
{
    #define NL 1000
    #define N 59
    #define M 59
    char tname[] = "ACR2215 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[block][block], shadow[11:11][11:11]
    int A[N][M];
    int (*C)[M];
    C = (int (*)[M])malloc(N * sizeof(int[M]));
    int NNL = NL;

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            C[i][j] = NNL + i + j;
    nloopi = NL;
    nloopj = NL;

    for (i = 11; i < N - 11; i++)
        for (j = 11; j < M - 11; j++)
            C[i][j] = C[i + 11][j] + C[i][j + 10] + C[i + 9][j] + C[i][j - 11] + C[i - 10][j] + C[i][j - 9];

    #pragma dvm actual(nloopi, nloopj)
    #pragma dvm region
    {
    #pragma dvm parallel([i][j] on A[i][j])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            A[i][j] = NL + i + j;

    #pragma dvm parallel([i][j] on A[i][j]) across(A[10:11][11:10])
    for (i = 11; i < N - 11; i++)
        for (j = 11; j < M - 11; j++)
            A[i][j] = A[i + 11][j] + A[i][j + 10] + A[i + 9][j] + A[i][j - 11] + A[i - 10][j] + A[i][j - 9];
    }
    #pragma dvm get_actual(A)
    #pragma dvm parallel([i][j] on A[i][j]) reduction(min(nloopi), min(nloopj))
    for (i = 11; i < N - 11; i++)
        for (j = 11; j < M - 11; j++)
            if (A[i][j] != C[i][j]) {
                nloopi = Min(nloopi, i);
                nloopj = Min(nloopj, j);
            }

    #pragma dvm get_actual(nloopi)
    if (nloopi == NL)
        ansyes(tname);
    else
        ansno(tname);

    free(C);
    #undef NL
    #undef N
    #undef M
}
/* ----------------------------------------------- */
void ansyes(const char name[])
{
    printf("%s  -  complete\n", name);
}

void ansno(const char name[])
{
    printf("%s  -  ***error\n", name);
}
