I. 1.
    a. !( (z > y) || (t < x ))
    I. 2.
    a. 0
    b. 1230
    c.

                                        
                                            cnt <- 0
                                            CAT TIMP n >= 10 EXECUTA
                                                n <- n - 10
                                                cnt <- cnt + 1
                                            n <- cnt
                                        
                                    

    d.
                                        
                                            #include <iostream>
                                            using namespace std;
    
                                            int n, x, m, s, y;
    
                                            int main(){
                                                cin>>n;
                                                x = n % 10;
                                                m = 1;
                                                s = 1;
                                                while(n > 9){
                                                    n = n / 10;
                                                    y = n % 10;
                                                    if( (y - x) * m < 0 ){
                                                        if(m > 0){
                                                            m = -1;
                                                        }
                                                        else{
                                                            s = 0;
                                                        }
                                                    }
                                                    x = y;
                                                }
                                                
                                                cout<<s;
                                                return	0;
                                            }
                                        
                                    

    II. 1.
    c. 4.
    II. 2.
    c. 2014.
    II. 3.
                                        
                                            #include <iostream>
                                            #include <cstring>
                                            using namespace std;
    
                                            void convert_char(char ch, int cod[10]){
                                                int k = (int)(ch);
                                                int v[10];
                                                int it = 0;
                                                while(it < 8){
                                                    v[it] = k % 2;
                                                    k /= 2;
                                                    it++;
                                                }
                                                for(int i = 0; i < 8; i++)
                                                    cod[i] = v[7 - i];
                                            }
    
                                            void convert_string(char s[105], int a[105][10]){
                                                int n = strlen(s);
                                                int cod[10];
                                                for(int i = 0; i < n; i++){
                                                    convert_char(s[i], cod);
                                                    for(int j = 0; j < 8; j++)
                                                        a[i][j] = cod[j];
                                                }
                                            }
    
                                            void submatrix_size(int a[105][10], int n, int m){
                                                int k = min(n, m);
                                                bool g = false;
                                                for(int p = k; p >= 1; p --)
                                                    for(int i = 0; i <= (n - p) && g == false; i ++)
                                                        for(int j = 0; j <= (n - p) && g == false; j ++){
                                                            int el = a[i][j];
                                                            bool ok = true;
                                                            for(int x = i; x <= (i + p - 1) && ok == true; x ++)
                                                                for(int y = j; y <= (j + p - 1) && ok == true; y ++)
                                                                    if(el != a[x][y])
                                                                        ok = false;
                                                            if(ok == true){
                                                                g = true;
                                                                cout<<p;
                                                            }
                                                        }
                                            }
    
                                            int main(){
                                                char s[105];
                                                int m[105][10];
                                                cin>>s;
                                                convert_string(s, m);
                                                submatrix_size(m, strlen(s), 8);
    
                                                return 0;
                                            }
                                        
                                    

    II. 4.
                                        
                                            #include <iostream>
                                            using namespace std;
                                            
                                            int A[105], szA, B[105], szB;
                                            int AP[105], szAP, BP[105], szBP;
                                            int n, p;
                                            
                                            int main(){
                                                cin>>n>>p;
                                                if(n >= 4 && n % 4 == 0 && p >= 1 && p <= n / 2){
                                                    for(int i = 1; i <= n / 2; i++)
                                                        if(i % 2 == 1)
                                                            A[++szA] = i, A[++szA] = n - i + 1;
                                                        else
                                                            B[++szB] = i, B[++szB] = n - i + 1;
                                                        cout<<"A : ";
                                                        for(int i = 1; i <= szA; i++)
                                                            cout<<A[i]<<" ";
                                                        cout<<"\n";
                                                        cout<<"B : ";
                                                        for(int i = 1; i <= szB; i++)
                                                            cout<<B[i]<<" ";
                                                        cout<<"\n";
                                            
                                                        if(p % 2 == 1){
                                                            cout<<"partitie inexistenta";
                                                        }
                                                        else{
                                                            if(p / 2 % 2 == 1){
                                                                for(int i = 1; i <= n / 2; i++){
                                                                 if(i % 2 == 1)
                                                                            AP[++szAP] = n - i + 1;
                                                                     else
                                                                            if(i % 2 == 0)
                                                                            BP[++szBP] = n - i + 1;
                                                                    if(i != p){
                                                                       
                                                                        if(i == p / 2){
                                                                            BP[++szBP] = i;
                                                                        }
                                                                        else
                                                                            if(i % 2 == 0)
                                                                                BP[++szBP] = i;
                                                                        else
                                                                            if(i != p / 2 && i % 2 == 1)
                                                                                AP[++szAP] = i;
                                                                    }
                                                                }
                                                            }
                                                            else{
                                                                for(int i = 1; i <= n / 2; i++) {
                                                                    if(i % 2 == 1)
                                                                            AP[++szAP] = n - i + 1;
                                                                        else
                                                                            if(i % 2 == 0)
                                                                            BP[++szBP] = n - i + 1;
                                                                    if(i != p){
                                                                        if(i == 1 || i == (p / 2 + 1))
                                                                            BP[++szBP] = i;
                                                                        else
                                                                            if(i % 2 == 0 && i != p / 2)
                                                                                BP[szBP] = i;
                                                                        else
                                                                            if(i == p / 2)
                                                                                AP[++szAP] = i;
                                                                        else
                                                                            if(i % 2 == 1)
                                                                                AP[++szAP] = i;
                                                                    }
                                                                }
                                                            }
                                                            cout<<"A prim : ";
                                                            for(int i = 1; i <= szAP; i++)
                                                                cout<<AP[i]<<" ";
                                                            cout<<"\n";
                                                            cout<<"B prim : ";
                                                            for(int i = 1; i <= szBP; i++)
                                                                cout<<BP[i]<<" ";
                                            
                                                        }
                                                }
                                                else{
                                                    cout<<"date invalide";
                                                }
                                            }
                                        
                                    

    III. 1.
    b. 35
    III. 2.
    F1(34) = 74
    III. 3.
    a.
                                        
                                            -2  1  0  0 
    1 1 0 0
    0 0 1 1
    0 0 1 -2

    b.
                                        
                                            void B(int p[105][105], int n, int m, int a[105][105]){
                                                int di[] = {-1, -1, -1, 0, 1, 1, 1, 0};
                                                int dj[] = {-1, 0, 1, 1, 1, 0, -1, -1};
                                            
                                                for(int i = 0; i < n; i ++)
                                                    for(int j = 0; j < m; j ++){
                                                        if(p[i][j] == -1)
                                                            a[i][j] = -1;
                                                        else{
                                                            bool g = false;
                                                            for(int k = 0; k < 8; k ++){
                                                                int iv = i + di[k], jv = j + dj[k];
                                            
                                                                if(iv >= 0 && iv < n && jv >= 0 && jv < m)
                                                                    if(p[iv][jv] == -1)
                                                                        g = true;
                                                            }
                                                            if(g == true)
                                                                a[i][j] = 1;
                                                            else
                                                                a[i][j] = 0;
                                                        }
                                                    }
                                            }
                                        
                                    

    c.
                                        
                                            void C(int p[105][105], int n, int m, int sol[105][105], int l, int c){
                                                if(p[l][c] == -1){
                                                    for(int i = 0; i < n; i ++)
                                                        for(int j = 0; j < m; j ++)
                                                            sol[i][j] = p[i][j];
                                                }
                                                else{
                                                    int a[105][105];
                                                    B(p, n, m, a);
                                                    int di[] = {-1, -1, -1, 0, 1, 1, 1, 0};
                                                    int dj[] = {-1, 0, 1, 1, 1, 0, -1, -1};
                                            
                                                    if(a[l][c] == 1){
                                                        int cnt = 0;
                                                        for(int k = 0; k < 8; k ++){
                                                            int iv = l + di[k], jv = c + dj[k];
                                            
                                                            if(iv >= 0 && iv < n && jv >= 0 && jv < m)
                                                                if(p[iv][jv] == -1)
                                                                    cnt ++;
                                                        }
                                            
                                                        sol[l][c] = cnt;
                                            
                                                        for(int i = 0; i < n; i ++)
                                                            for(int j = 0; j < m; j ++)
                                                                if(i == l && j == c)	
                                                                    continue;
                                                                else
                                                                    sol[i][j] = -2;
                                                    }
                                                    else{
                                                        for(int i = 0; i < n; i ++)
                                                            for(int j = 0; j < m; j ++)
                                                                sol[i][j] = p[i][j];
                                            
                                                        struct P{
                                                            int lin, col;
                                                        }q[n * m + 5];
                                            
                                                        int st = 1, dr = 1;
                                            
                                                        q[st].lin = l, q[dr].col = c;
                                            
                                                        while(st <= dr){
                                                            int x = q[st].lin, y = q[st].col;
                                                            st ++;
                                            
                                                            for(int k = 0; k < 8; k ++){
                                                                int iv =  x + di[k], jv = y + dj[k];
                                                                if(iv >= 0 && iv < n && jv >= 0 && jv < m){
                                                                    if(sol[iv][jv] == 0 && a[iv][jv] == 0){
                                                                        q[++dr].lin = iv;
                                                                        q[dr].col = jv;
                                                                        sol[iv][jv] = -3;
                                                                    }
                                                                    else
                                                                        if(a[iv][jv] == 1){
                                                                            int cnt = 0;
                                                                            for(int z = 0; z < 8; z ++){
                                                                                int xv = iv + di[z], yv = jv + dj[z];
                                            
                                                                                if(xv >= 0 && xv < n && yv >= 0 && yv < m){
                                                                                    if(a[xv][yv] == -1)
                                                                                        cnt ++;
                                                                                }
                                                                            }
                                                                            sol[iv][jv] = cnt;
                                                                        }
                                                                }
                                                            }
                                                        }
                                            
                                                        for(int i = 0; i < n; i ++)
                                                            for(int j = 0; j < m; j ++)
                                                                if(sol[i][j] == -3)
                                                                    sol[i][j] = 0;
                                                                else
                                                                    if(sol[i][j] == 0 || sol[i][j] == -1)
                                                                        sol[i][j] = -2;
                                                    }
                                                }
                                            }