CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
#define MAX 1000
using namespace std;
void inpts(int a[MAX][MAX],int m,int n){
for (int i=0;i<m;i++){for(int j=0;j<n;j++){cin>>a[i][j];}}

}
void compute_matrixtranspose_matrix_product (int A[MAX][MAX], int m, int n, int ATA[MAX][MAX]){
for (int i=0;i<MAX;i++){for(int j=0;j<MAX;j++){ATA[i][j]=0;}}
for(int i=0;i<n;i++){for(int k=0;k<n;k++){for (int j=0;j<m;j++){ATA[i][k]+=A[j][i]*A[j][k];}}}
for (int i=0;i<n;i++){for (int j=0;j<n;j++){cout<<ATA[i][j]<<" ";}cout<<endl;}}

int main(){
int m, n;
cin>>m>>n;
int a[MAX][MAX];
inpts(a,m,n);
int ata[MAX][MAX];
 compute_matrixtranspose_matrix_product(a,m,n,ata);

}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
#define max 100
using namespace std;
void input(int a[][max],int m,int n)
{
for(int i=0;i<m;i++)
{
	for(int j=0;j<n;j++)
	{
	cin>>a[i][j];
	}
}
}
void output(int a[][max],int m,int n)
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cout<<a[i][j];
if(j!=n-1){cout<<" ";}
}
cout<<endl;
}
}
void transpose(int a[][max] ,int b[][max],int m,int n)
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
	b[j][i]=a[i][j];
}
}
}
void multiply(int a[][max],int b[][max],int c[][max],int m,int n)
{
for(int i=0;i<n;i++)
{
	for(int j=0;j<n;j++)
	{c[i][j]=0;
	for(int k=0;k<m;k++)
		{
		c[i][j]=c[i][j]+(b[i][k]*a[k][j]);
		}
	}
}
}
int main(){
int m,n;
cin>>m>>n;
int a[m][max];
input(a,m,n);
int b[n][max];
transpose(a,b,m,n);
int c[n][max];
multiply(a,b,c,m,n);
output(c,n,n);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
#include<cmath>
#define mx 100
using namespace std;
void display(int a[][mx],int n){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
}
void compute_matrixtranspose_matrix_product (int a[][mx], int n1, int n2, int b[][mx]){
	int i,j,k;
for(i=0;i<n2;i++) {
for(j=0;j<n2;j++){
			b[i][j] = 0;
	for(k=0;k<n1;k++){
			b[i][j] += a[k][i]*a[k][j];
			} 
                } 
                 } 
}
int main(){
	int n1,n2;
	cin>>n1>>n2;
	int a[n1][mx],b[n2][mx];
	for(int i=0;i<n1;i++){
		for(int j=0;j<n2;j++){
			cin>>a[i][j];
		}
	}
	compute_matrixtranspose_matrix_product(a,n1,n2,b);
	display(b,n2);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
void transpose(int  A[][100] ,int B[][100],int n1,int n2 ){
for(int p=0;p<n1;p++){
for(int q=0;q<n2;q++){
B[q][p]=A[p][q];
}
}
}
void  matrixmultiply(int A[][100],int B[][100],int C[][100],int m,int n){
int i,j,k;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
C[i][j]=0;
for(k=0;k<m;k++){
C[i][j]+=B[i][k]*A[k][j];
}
}
}
}

void display(int C[][100],int n1,int n2){
for(int i=0;i<n1;i++){
for(int j=0;j<n2;j++){
cout<<" "<<C[i][j];
if(j==n2-1)cout << endl << endl;
}
}
}


void compute_matrixtranspose_matrix_product(int A[][100],int m,int n,
int C[][100]){
int B[n][100];
transpose(A,B,m,n);
matrixmultiply(A,B,C,m,n);
}

int main(){
int m,n;
cin>>m;
cin>>n;
int A[m][100];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>A[i][j];
}
}
int C[m][100];
compute_matrixtranspose_matrix_product(A,m,n,C);
display(C,n,n);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 8


void displayMatrix(int A[][MAX], int n1, int n2){
	for(int i = 0; i<n1; i++){
		for(int j = 0; j<n2; j++){
			cout << A[i][j] << " ";
		}
		cout << "\n";
	}
}

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
	int B[MAX][MAX];
	for(int i = 0; i < m; i++){
		for(int j = 0; j<n; j++){
			B[j][i] = A[i][j];
		}
	}
	for(int i = 0; i<m; i++){
		for(int j = 0; j<m; j++){
			ATA[i][j] = 0;
			for(int k = 0; k<n; k++){
				ATA[i][j]+=A[i][k]*B[k][j];
			}
		}
	}
}

int main(){
	int r; int c;
	cin >> c >> r;
	int A[MAX][MAX];
	for(int i = 0; i<c; i++){
		for(int j = 0; j<r; j++){
	 		cin >> A[j][i];
		}
	}
	int AtA[MAX][MAX];
	compute_matrixtranspose_matrix_product(A, r, c, AtA);
	displayMatrix(AtA, r, r);


}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
#include<cmath>

# define MAX 100

using namespace std;

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){

int B[n][m];

for (int s=0;s<n;s++){
for (int k=0;k<m;k++){
B[s][k]=A[k][s];
}}

int i,j,k;
for(i=0;i<m;i++) {
for(j=0;j<m;j++){
			ATA[i][j] = 0;
	for(k=0;k<m;k++){
			ATA[i][j] += B[i][k]*A[k][j]; // dot product of i-th row of A and j-th column of B
			}


}}}

int main(){
int m,n;
cin>>m>>n;
int Matrix[MAX][MAX];

for (int i=0;i<m;i++){
for (int j=0;j<n;j++){
cin>>Matrix[i][j];
}}

int multiplied[MAX][MAX];

compute_matrixtranspose_matrix_product (Matrix, m, n, multiplied);
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
cout<<multiplied[i][j]<<" ";
}
cout<<" "<<endl;
}

}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<simplecpp>
#define MAX 100
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int C[MAX][MAX];
cin>>m;
cin>>n;
for(int i=0;i<m;i++){for(int j=0;j<n;j++)
{cin>>A[i][j];}
}
for(int k=0;k<n;k++){for(int l=0;l<m;l++){ATA[k][l]=A[l][k];}}
int a,b,c;
for(a=0;a<n;a++){
for(b=0;b<n;b++){C[a][b]=0;
for(c=0;c<m;c++){C[a][b]+=ATA[a][c]*A[c][b];}}}
for(int i=0;i<n;i++){for(int j=0;j<n;j++){cout<<C[i][j]<<" ";}cout<<endl;}
}
main_program{
int n,m; int A[MAX][MAX];int ATA[MAX][MAX];
 compute_matrixtranspose_matrix_product (A,  m,  n,  ATA);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 100
void compute_matrixtranspose(int A[][MAX],int m,int n,int B[][MAX])
	{
	  for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){B[i][j]=A[j][i];}  }
	  int C[MAX][MAX];
          for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){C[i][j]=0; 
						     for(int k=0;k<m;k++)
                                   {   C[i][j]=C[i][j]+B[i][k]*A[k][j];}}}
	  for(int i=0;i<n;i++)
		{
		  for(int j=0;j<n;j++){cout<<C[i][j]<<" ";} cout<<endl;}
	}
int main(){
    int m,n;
cin>>m>>n;
int A[MAX][MAX];
int B[MAX][MAX];
for(int i=0;i<m;i++){
			for(int j=0;j<n;j++){cin>>A[i][j];}  }
compute_matrixtranspose(A,m,n,B);

}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
void compute_matrixtranspose_matrix_product (int A[][8], int m, int n, int ATA[][8]){
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			ATA[i][j]=0;
			for(int k=0;k<m;k++){
				ATA[i][j] +=A[k][i]*A[k][j];
			}ATA[j][i]=ATA[i][j];
		}
	}
}
int main(){
	int m,n;cin>>m>>n;int A[8][8],ATA[8][8];
	for (int i=0;i<m;i++){
		for (int j=0;j<n;j++){
			cin>>A[i][j];
		}
	}compute_matrixtranspose_matrix_product(A,m,n,ATA);
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			cout<<ATA[i][j]<<" ";
		}cout<<endl;
	}
}/*
6 2  6 4 8
4 1  2 1 3
8 3
*/

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#include<cmath>
#define MAX 100
void compute_matrixtranspose_matrix_product(int A[][MAX], int m, int n, int ATA[][MAX])
{
int i,j,k;
for(i=0 ; i<n;i++){
for(j=0; j<m; j++){
ATA[i][j]=0;
for(k=0; k<n; k++){
ATA[i][j] +=A[k][i]*A[k][j];
}
}
}
}
void get2Darray (int A[][MAX], int m, int n){
int i,j;
for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cin >> A[i][j];
		}
}
}
void print2Darray (int A[][MAX], int m, int n){
int i,j;
for(i=0;i<m;i++){
		for(j=0;j<m;j++){
			cout << A[i][j] << " ";
		}
		cout << endl;
}
}
int main() {
	int A[MAX][MAX], ATA[MAX][MAX];
	int n, m;
	cin >> n >> m;
	get2Darray(A,m,n);
        compute_matrixtranspose_matrix_product(A,m,n,ATA);
        print2Darray(ATA,m,n);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
void compute_matrixtranspose_matrix_product(int A[100][100],int m,int n,int ATA[100][100]){
        int AT[100][100];
        for(int i=0;i<n;i++){
           for(int j=0;j<m;j++){
           AT[i][j]=A[j][i];
           }}
        for(int i=0;i<n;i++){
          for(int j=0;j<n;j++){
          ATA[i][j]=0;
           for(int k=0;k<m;k++){
             ATA[i][j]+=AT[i][k]*A[k][j];
          }
        }
       }
}
int main(){
      int m,n;
      cin>>m>>n;
      int A[100][100],ATA[100][100];
      for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
         cin>>A[i][j];}}
      compute_matrixtranspose_matrix_product(A,m,n,ATA);
     for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        cout<<ATA[i][j]<<" ";
       }
     cout<<endl;
}
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;
#define MAX 100
void get2Darray (int A[][MAX], int m, int n){
int i,j;
for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			cin >> A[i][j];
		}
}
}
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
	int AT[MAX][MAX];
	for(int i=0;i<m;i++){
		for (int j = 0; j < n; j++)
		{
			AT[i][j]=A[j][i];
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			ATA[i][j]=0;
			for (int k = 0; k < m; k++)
			{
				ATA[i][j]=ATA[i][j]+AT[i][k]*A[k][j];
			}
		}
	}
}
void print2Darray (int A[][MAX], int m, int n){
int i,j;
for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			cout << A[i][j] << " ";
		}
		cout << endl;
}
}
int main(){
	int m,n;
	cin>>m>>n;
	int A[MAX][MAX];
	get2Darray(A,m,n);
	int ATA[MAX][MAX];
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	print2Darray(ATA,n,n);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
void compute_matrixtranspose_matrix_product(int A[][8],int m,int n,int ATA[][8]){
int B[8][8];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
B[j][i]=A[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
ATA[i][j]=0;
for(int k=0;k<m;k++){
ATA[i][j]=ATA[i][j]+B[i][k]*A[k][j];
}
}

}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<ATA[i][j]<<" ";

}cout<<endl;
}


}



int main(){
int m,n;cin>>m>>n;
int A[m][8];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>A[i][j];
}

}
int ATA[8][8];
compute_matrixtranspose_matrix_product(A,m,n,ATA);


}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 20
void compute_matrixtranspose_matrix_product (int A[][MAX] , int m, int n, int ATA[][MAX])
{
int i,j,k;
for(i=0; i<n; i++)
{ 
for(j=0; j<n; j++)
{
ATA[i][j]=0;
for(k=0; k<m; k++)
{ATA[i][j]=ATA[i][j]+A[k][i]*A[k][j];}
}
}
}
int main()
{
int m,n;
cin>>m;
cin>>n;
int A[m][20];
int ATA[n][20];
for(int a=0; a<m; a++)
{for(int b=0; b<n; b++)
{cin>>A[a][b];
}
}

compute_matrixtranspose_matrix_product (A, m, n, ATA);
for(int k=0; k<n; k++)
{for (int l=0; l<n; l++)
{cout<<ATA[k][l]<<" ";
}
cout<<endl;
}
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define max 10000
void transpose(int a[][max],int b[][max],int n,int m)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
b[i][j]=a[j][i];
}
}

}

void compute_matrixtranspose_matrix_product (int a[][max], int n, int m, int b[][max],int c[][max])
{
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
c[i][j]=0;
for(int k=0;k<n;k++)
{
c[i][j]+=b[i][k]*a[k][j];
}
}
}

}





int main()
{
int n,m;cin>>n>>m;
int a[n][max];int c[n][max];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
int at[m][max];
transpose(a,at,n,m);
compute_matrixtranspose_matrix_product(a,n,m,at,c);
for(int i=0;i<m;i++)
{
for(int j=0;j<m;j++)
{
cout<<c[i][j]<<" ";
}
cout<<endl;
}
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;








int main(){
int n1,n2;
int MAX;
cin>>n1>>n2;
int A[n1][n2];
int ATA[n2][n1];

for (int i=0;i<n1;i++){

for (int j=0;j<n2;j++){
cin>>A[i][j];
}
}
for (int i=0;i<n1;i++)
{
for (int j=0;j<n2;j++)
{
 ATA[j][i]=A[i][j];
}
}


for (int i=0;i<n2;i++){

for (int j=0;j<n1;j++){
cout<<ATA[i][j]<<" ";
}
cout<<endl;

}
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 100
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
  if(m<=8&&n<=8&&m>0&&n>0)
  {
  int AT[MAX][MAX];
  
  for(int i=0;i<n;i++)
{ 
    for(int j=0;j<m;j++)
    {
       AT[i][j]=A[j][i];
    }
    
}
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<m;j++)
      {
        cout<<AT[i][j]<<' ';
     
      }
      cout<<"\n";
      }  
  
  
  
  
  for(int i=0;i<m;i++)
  {
    for(int j=0;j<m;j++)
    {
    ATA[i][j]=0;
      for(int k=0;k<n;k++)
      {
    
      ATA[i][j]=ATA[i][j]+A[i][k]*AT[k][j];
      }
    }
  }
     for(int i=0;i<m;i++)
    {
      for(int j=0;j<m;j++)
      {
        cout<<ATA[i][j]<<' ';
     
      }
      cout<<"\n";
   }
   
      
  }  
  else{
    return ;
  }
}
int main(){
int m,n;

cin>>m>>n;
int A[MAX][MAX],ATA[MAX][MAX];
for(int i=0;i<m;i++)
    {
      for(int j=0;j<n;j++)
      {
        cin>>A[i][j];
     
      }
    }
compute_matrixtranspose_matrix_product (A,m,n,ATA);
}

Grading criterion: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: B