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

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

#ifndef _DVMH
#define dvmh_get_num_procs(X) 1
#endif

static void distr21();
static void distr22();
static void distr23();
static void distr24();
static void distr25();
static void distr26();
static void distr27();
static void distr28();
static void distr29();
static void distr210();
static void distr211();
static void distr212();
static void distr213();
static void distr214();
static void distr215();
static void distr216();
static void distr217();
static void distr218();
static void distr219();
static void distr220();
static void distr221();
static void distr222();
static void distr223();
static void distr224();
static void distr225();
static void ansyes(const char tname[]);
static void ansno(const char tname[]);
static int ER = 10000;
static int erri, i, j, k;

int main(int an, char **as) {
    printf("=== START OF DELDISTR2 ===================\n");
    distr21();
    distr22();
    distr23();
    distr24();
    distr25();
    distr26();
    distr27();
    distr28();
    distr29();
    distr210();
    distr211();
    distr212();
    distr213();
    distr214();
    distr215();
    distr216();
    distr217();
    distr218();
    distr219();
    distr220();
    distr221();
    distr222();
    distr223();
    distr224();
    distr225();
    printf("=== END OF DELDISTR2 ===================\n");
    return 0;
}

static int myRand() {
    const unsigned a = 1103515245U;
    const unsigned c = 12345U;
    const unsigned m = ((unsigned)RAND_MAX) + 1U;
    static unsigned prev = 5;
    prev = (a * prev + c) % m;
    return prev;
}

static void genBlocksAxis(const int procCount, const int weight, const int withoutZero, int **blocks) {
    *blocks = (int *)malloc(procCount * sizeof(int));
    int restWeight = weight, i, zeroind = -1;
    if (!withoutZero && procCount != 1)
        zeroind = myRand() % (procCount - 1);
    for (i = 0; i < (procCount - 1); i++) {
        if (i == zeroind)
            (*blocks)[i] = 0;
        else
            (*blocks)[i] = 1 * withoutZero + myRand() % (restWeight - (procCount - (i + 1)));
        restWeight -= (*blocks)[i];
    }
    (*blocks)[i] = restWeight;
}

void distr21()
{
    #define AN1 8
    #define AN2 8
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr21";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[*][*])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr22()
{
    #define AN1 8
    #define AN2 8
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr22";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[block][block])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr23()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    int* BS2;
    genBlocksAxis(dvmh_get_num_procs(2), AN2, 1, &BS2);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr23";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[genblock(BS1)][genblock(BS2)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(BS2);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr24()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    double wb2[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr24";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[wgtblock(wb1, 8)][wgtblock(wb2, 8)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr25()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    int m2 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr25";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[multblock(m1)][multblock(m2)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr26()
{
    #define AN1 8
    #define AN2 8
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr26";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[*][block])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr27()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr27";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[*][genblock(BS1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr28()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr28";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[*][wgtblock(wb1, 8)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr29()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr29";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[*][multblock(m1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr210()
{
    #define AN1 8
    #define AN2 8
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr210";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[block][*])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr211()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(2), AN2, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr211";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[block][genblock(BS1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr212()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr212";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[block][wgtblock(wb1, 8)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr213()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr213";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[block][multblock(m1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr214()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr214";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[genblock(BS1)][*])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr215()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr215";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[genblock(BS1)][block])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr216()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr216";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[genblock(BS1)][wgtblock(wb1, 8)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr217()
{
    #define AN1 8
    #define AN2 8
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(1), AN1, 1, &BS1);
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr217";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[genblock(BS1)][multblock(m1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr218()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr218";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[wgtblock(wb1, 8)][*])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr219()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr219";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[wgtblock(wb1, 8)][block])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr220()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(2), AN2, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr220";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[wgtblock(wb1, 8)][genblock(BS1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr221()
{
    #define AN1 8
    #define AN2 8
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr221";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[wgtblock(wb1, 8)][multblock(m1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr222()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr222";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[multblock(m1)][*])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr223()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr223";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[multblock(m1)][block])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr224()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    int* BS1;
    genBlocksAxis(dvmh_get_num_procs(2), AN2, 1, &BS1);
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr224";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[multblock(m1)][genblock(BS1)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(BS1);
    free(A2);
    #undef AN1
    #undef AN2
}
void distr225()
{
    #define AN1 8
    #define AN2 8
    int m1 = 4;
    double wb1[8] = {1.0, 2., 2., 3.0, 1., 1., 1.5, 2.};
    #pragma dvm array
    int (*A2)[AN2];
    char tname[] = "distr225";
    erri = ER;
    A2 = malloc(AN1 * AN2 * sizeof(int));
    #pragma dvm redistribute(A2[multblock(m1)][wgtblock(wb1, 8)])
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                A2[i][j] = i * 10 + j;
    }
    #pragma dvm region
    {
        #pragma dvm parallel([i][j] on A2[i][j]) reduction(min(erri)), cuda_block(256)
        for (i = 0; i < AN1; i++)
            for (j = 0; j < AN2; j++)
                if (A2[i][j] != i * 10 + j)
                    erri = Min(erri, i * 10 + j);
    }
    #pragma dvm get_actual(erri)
    if (erri == ER)
        ansyes(tname);
    else
        ansno(tname);
    free(A2);
    #undef AN1
    #undef AN2
}
void ansyes(const char name[]) {
    printf("%s  -  complete\n", name);
}
void ansno(const char name[]) {
    printf("%s  -  ***error\n", name);
}
