█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 1153

Problema 0xe1 - Cuadrado mágico

  • Autor: EduardoVega
  • Fecha: 2020-10-11 03:19:23 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#2
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#3
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#4
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#5
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#6
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#7
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#8
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#9
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#10
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#11
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#12
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#13
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#14
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#15
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#16
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#17
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#18
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#19
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
#20
Error de compilación
                      main.c:47:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:49:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:55:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:62:9: error: use of undeclared identifier 'tmp'
        tmp += matrix[i][j];
        ^
main.c:64:9: error: use of undeclared identifier 'tmp'
    if (tmp != suma)
        ^
main.c:70:5: error: use of undeclared identifier 'tmp'
    tmp = 0;   
    ^
main.c:77:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j]; 
    ^
main.c:80:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
main.c:86:3: error: use of undeclared identifier 'tmp'
  tmp = 0;
  ^
main.c:92:5: error: use of undeclared identifier 'tmp'
    tmp += matrix[i][j];
    ^
main.c:95:7: error: use of undeclared identifier 'tmp'
  if (tmp != suma)
      ^
11 errors generated.

                    
Puntos totales: 0 / 100

Código

/* Code by Eduardo Vega */
#include <stdio.h>
#include <stdlib.h>

/* Free function for the allocated matrix */
void my_free(int **matrix, int size)
{
  int i, j;

  for (i = 0; i < size; i++)
      free(matrix[i]);
  
  free(matrix);   
} 

int main()
{ 
  int suma = 0, counter = 0, size = 0, num = 0, 
  i, j;
  int **matrix = NULL;

  scanf("%d", &size);

  /* Matrix is allocated using double pointer */
  matrix = malloc(sizeof(int *) * size);
  for (i = 0; i < size; i++)  
      matrix[i] = malloc(sizeof(int) * size);

  /* Fill the matrix with the input numbers */
  for (i = 0; i < size; i++)
  {
    for (j = 0; j < size; j++)
    {
      scanf("%d", &num);
      matrix[i][j] = num; 
      
      /* Get the sum of the first row */ 
      if (i == 0)
          suma += num;
    }
  } 
  
  /* Check matrix horizontally and compare */
  for (i = 0; i < size; i++)
  {
    for (j = 0; j < size; j++)    
        tmp += matrix[i][j];

    if (tmp != suma)
    { 
      printf("No\n");
      my_free(matrix, size);
      return 0;
    }
    tmp = 0;   
  }
  
  /* Check matrix vertically and compare */
  for (j = 0; j < size; j++)
  {
    for (i = 0; i < size; i++)    
        tmp += matrix[i][j];

    if (tmp != suma)
    { 
      printf("No\n");
      my_free(matrix, size);
      return 0;
    } 
    tmp = 0;   
  }
  
  /* Check first diagonal and compare */
  j = 0;
  for (i = 0; i < size; i++)
  {    
    tmp += matrix[i][j]; 
    j++;
  } 
  if (tmp != suma)
  { 
    printf("No\n");
    my_free(matrix, size);
    return 0;
  } 
  tmp = 0;

  /* Check second diagonal and compare */ 
  j = size - 1;
  for (i = size - 1; i >= 0; i--)
  {
    tmp += matrix[i][j];
    j--;
  }
  if (tmp != suma)
  { 
    printf("No\n");
    my_free(matrix, size);
    return 0;
  } 

  printf("Yes\n");
  my_free(matrix, size);
  return 0;
}