/*  ACR12

    TESTING OF THE ACROSS CLAUSE'.
    DISTRIBUTED ARRAY A(N, M) IS TO HAVE 1 DISTRIBUTED DIMENSION AND 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 acr1201();
static void acr1202();
static void acr1203();
static void acr1204();
static void acr1205();
static void acr1206();
static void acr1207();
static void acr1208();
static void acr1209();
static void acr1210();
static void acr1211();
static void acr1212();
static void acr1213();
static void acr1214();
static void acr1215();

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 ACR12========================\n");
    /* ---------------------------------------- */
    acr1201();
    /* ---------------------------------------- */
    acr1202();
    /* ---------------------------------------- */
    acr1203();
    /* ---------------------------------------- */
    acr1204();
    /* ---------------------------------------- */
    acr1205();
    /* ---------------------------------------- */
    acr1206();
    /* ---------------------------------------- */
    acr1207();
    /* ---------------------------------------- */
    acr1208();
    /* ---------------------------------------- */
    acr1209();
    /* ---------------------------------------- */
    acr1210();
    /* ---------------------------------------- */
    acr1211();
    /* ---------------------------------------- */
    acr1212();
    /* ---------------------------------------- */
    acr1213();
    /* ---------------------------------------- */
    acr1214();
    /* ---------------------------------------- */
    acr1215();
    /* ---------------------------------------- */

    printf("=== END OF ACR12 =========================\n");
    return 0;
}
/* ---------------------------------------------acr1201*/
void acr1201()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1201 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1202*/
void acr1202()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1202 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1203*/
void acr1203()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1203 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1204*/
void acr1204()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1204 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1205*/
void acr1205()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1205 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1206*/
void acr1206()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1206 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1207*/
void acr1207()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1207 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1208*/
void acr1208()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1208 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1209*/
void acr1209()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1209 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1210*/
void acr1210()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1210 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1211*/
void acr1211()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1211 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1212*/
void acr1212()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1212 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1213*/
void acr1213()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1213 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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
}
/* ---------------------------------------------acr1214*/
void acr1214()
{
    #define NL 1000
    #define N 16
    #define M 16
    char tname[] = "acr1214 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[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
}
/* ---------------------------------------------acr1215*/
void acr1215()
{
    #define NL 1000
    #define N 59
    #define M 59
    char tname[] = "acr1215 ";
    int nloopi, nloopj;
    #pragma dvm array distribute[*][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);
}
