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 100
using namespace std;
void InputMatrix(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 TransposeMatrix(int A[][MAX],int AT[][MAX],int m,int n) {
	for (int i=0;i<m;i++) {
		for (int j=0;j<n;j++) {
			AT[j][i]=A[i][j];
		}
	}
}
void compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX]) {
	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]+=A[k][i]*A[k][j];
			}
		}
	}
}
void DisplayMatrix(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]<<" ";
		}
		cout<<endl;
	}
}
int main() {
	int A[MAX][MAX],ATA[MAX][MAX],m,n;
	cin>>m>>n;
	InputMatrix(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	DisplayMatrix(ATA,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 10
void compute_matrixtranspose_matrix_product (int A[][MAX], int n, int m, int ATA[][MAX]){
	int p[MAX][MAX];
	for(int i=0;i<m;i++){
	for(int j=0;j<n;j++){
		ATA[i][j]=A[j][i];
	}
	}
	for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
		p[i][j]=0;for(int x=0;x<m;x++) p[i][j]+=A[i][x]*ATA[x][j];
	}
	}
	for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
		cout<<p[i][j]<<" ";
	}
	cout<<endl;
	}
}
void input(int A[][MAX],int n,int m){
	for(int j=0;j<m;j++){
	for(int i=0;i<n;i++){
	cin>>A[i][j];
	}
	}
}
int main(){
int A[MAX][MAX],ATA[MAX][MAX],m,n;
cin>>m>>n;
input(A,n,m);
compute_matrixtranspose_matrix_product (A,n,m,ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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;
const int 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 i,j; int AT[n][m];
for(i=0;i<n;i++){
                for(j=0;j<m;j++){
                        AT[i][j]=A[j][i];
                }
}
for(i=0;i<n;i++){
                for(j=0;j<n;j++){
                        ATA[i][j]=0;
                }
}	
	for(i=0;i<n;i++){
                for(j=0;j<n;j++){
					for (int k=0; k<m; k++)
                        ATA[i][j]+=AT[i][k]*A[k][j];
                }

}
}

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

	int main()
	{
		int m,n;
		cin >> m >> n;
		int A [m][MAX]; int ATA [n][MAX];
		get2Darray ( A, m,n);
		compute_matrixtranspose_matrix_product(A,m,n,ATA);
		print2Darray (ATA,n,n);
	}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 transpose(int A[100][100], int At[100][100], int m, int n)
{
   for(int i=0; i<m; i++ )
   {
      for(int j=0; j<n; j++ )
      {
         At[j][i] = A[i][j];
      }
   }
}
void product_of_matrices( int A[100][100], int B[100][100], int pAB[100][100], int mA, int nA, int mB, int nB)
{
   if(nA!=mB) {cout << "Incorrect order"; return;}
   for(int i=0; i<mA; i++)
   {
      for(int j=0; j<nB; j++) pAB[i][j] = 0;
   }
   for(int i=0; i<mA; i++)
   {
      for(int j=0; j<nB; j++)
      {
         for(int k=0; k<nA; k++) pAB[i][j] += A[i][k] * B[k][j];
      }
   }
}
void display_matrix( int A[100][100], int m, int n)
{
   for( int i=0; i<m; i++)
   {
      for( int j=0; j<n; j++)
      {
         cout << A[i][j] << " ";
      }
      cout << endl;
   }
}
void input_matrix( int A[100][100], 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[100][100], int m, int n, int AtA[100][100] )
{
   int At[100][100];
   transpose( A, At, m, n);
   product_of_matrices( At, A, AtA, n, m, m, n );
}
int main()
{
   int m,n;
   cin >> m >> n;
   int A[100][100], AtA[100][100];
   input_matrix( A, m, n );
   compute_matrixtranspose_matrix_product( A, m, n, AtA);
   display_matrix( AtA, n, n );
   return 0;
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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])
{
	int x[n][m];
	for(int i = 0;i < n;i++)
		{
			for(int j = 0;j < m;j++)
				{
					x[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 u = 0;u < m;u++)
						{
							ATA[i][j] = ATA[i][j] + A[u][i]*x[i][u];
						}
				}
		}
	return 0;
}
int main()
{
	int m,n;
	cin >> m >> n;
	int A[MAX][MAX];
	int ans[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,ans);
	for(int i = 0;i < n;i++)
	{
		for(int j = 0;j < n;j++)
		{
			cout << A[i][j] <<" ";
		}
		cout << endl;
	}
	
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
#define MAX 100
using namespace std;

void compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX])
{
 for(int i=0;i<m;i++){
  for(int j=0;j<n;j++){
    ATA[j][i]=A[i][j];}
}
int v[n][n];
for(int k=0;k<n;k++){
 for(int l=0;l<n;l++){
   v[k][l]=0;
  for(int p=0;p<m;p++){
     v[k][l] += ATA[k][p] * A[p][l];
}
}
}
for(int k=0;k<n;k++){
 for(int l=0;l<n;l++){
   cout<<v[k][l]<<" ";}
  cout<<endl;
}
}
int main(){
int n,m;
cin>>m>>n;
int A[m][MAX],ATA[n][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 and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
using namespace std;
#define MAX 100
void put_in(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 trans(int A[][MAX], int AT[][MAX], int m, int n){
int x=max(m,n);
    for(int i=0;i<x;i++){
        for(int j=0;j<x;j++){
        AT[i][j] = A[j][i];
        }
    }
}

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

void put_out(int A[][MAX], int n){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout << A[i][j] << " " ;
		}
		cout << endl;
	}
}

int main(){
	int m,n;
	cin >> m >>n;
	int A[MAX][MAX];
	put_in(A,m,n);
	int ATA[MAX][MAX];
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	put_out(ATA,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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]){
    for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
            for(int k=0;k<n;k++){
                ATA[i][j]=ATA[i][j]+ A[i][k]*A[j][k];
            }
        }
    }
}
int main(){
    int m,n;
    cin>>m>>n;
    int a[m][MAX]; int at[n][MAX]; int p[m][MAX];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }}
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            p[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            at[i][j]=a[j][i];

        }
    }

    compute_matrixtranspose_matrix_product(at,n,m,p);

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

        }
        cout<<endl;
    }

    }

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
using namespace std;
#define max 100
int sum(int i,int j,int a[][max],int m){
int sum=0;
for(int k=0;k<m;k++)
{
sum+=a[k][i]*a[k][j];
}
return sum;
}

void compute_matrixtranspose_matrix_product (int a[][max], int m, int n, int pro[][max])
{
for(int i=0;i<n;i++)
	{
	for(int j=0;j<n;j++){
	pro[i][j]=sum(i,j,a,m);
	}
	}
for(int i=0;i<n;i++)
{ 
for(int j=0;j<n;j++){ 
cout<<pro[i][j]<<" ";
}cout<<endl;
}
}

int main(){
int m,n;cin>>m>>n;
int a[max][max],pro[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,pro);
return 0;
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
#define MAX 100
using namespace std;

void compute_matrixtranspose_matrix_product(int a[][MAX],int b[][MAX],int m,int n){
	for(int i = 0;i<n;i++){
		for(int j = 0;j<m;j++){
			b[i][j] = a[j][i];
		}
	}
	int c[n][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];
			}
		}
	}
	for(int r = 0;r<n;r++){
		for(int s = 0;s<n;s++){
			cout<<c[r][s]<<" ";
		}
		cout<<endl;
	}
}

int main(){
	int m,n;
	cin>>m>>n;
	int arr1[m][MAX],arr2[n][MAX];
	for(int i = 0;i<m;i++){
		for(int j = 0;j<n;j++){
			cin>>arr1[i][j];
		}
	}
	compute_matrixtranspose_matrix_product(arr1,arr2,m,n);
	
	return 0;
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 transpose(int A[][100], int AT[][100], int n1,int n2)
{ int i,j;
	for(int i=0;i<n1;i++)
    for(int j=0;j<n2;j++)
    	AT[j][i]=A[i][j];

}


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

int i,j,k;

for(i=0;i<m;i++) {
for(j=0;j<m;j++){
			ATA[i][j] = 0;
for(k=0;k<n;k++){
			ATA[i][j] += A[i][k]*AT[k][j];
		}
	}
}
}

void matrix_multiply (int A[][MAX], int B[][MAX], int C[][MAX], int nr1, int nc1, int nr2, int nc2){
if (nc1 != nr2) { cout << "dimension mismatch"; return;}
int i,j,k;
for(i=0;i<nr1;i++) {
for(j=0;j<nc2;j++){
			C[i][j] = 0;
	for(k=0;k<nc1;k++){
			C[i][j] += A[i][k]*B[k][j]; // dot product of i-th row of A and j-th column of B
			} // close innermost for loop (on k)
} // close middle for loop (on j)
} // close outer for loop (on i)
}





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







int main(){

int m,n;
cin>>m>>n;
int a[MAX][MAX];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{	cin>>a[i][j];
}
}
int at[n][MAX];
transpose(a,at,m,n);


int ata[n][MAX];
matrix_multiply(at,a,ata,n,m,m,n);
print2Darray (ata,n,n);












}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
#define MAX 100
using namespace std;
void arr(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 compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX]){
int AT[MAX][MAX];
for(int p=0;p<n;p++){
for(int q=0;q<m;q++){
AT[p][q]=A[q][p];}}
for(int x=0;x<n;x++){
for(int y=0;y<n;y++){
ATA[x][y]=0;
for(int i=0;i<m;i++){
ATA[x][y]+=(AT[x][i]*A[i][y]);
}}}
for(int a=0;a<n;a++){
for(int b=0;b<n;b++){
cout<<ATA[a][b]<<" ";
}
cout<<endl;
}}
int main(){
int A[MAX][MAX];int m;int n;int ATA[MAX][MAX];
cin>>m>>n;
arr(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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])
{
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<n;j++){
 ATA[i][j]=0;
 for(int k=0;k<m;k++){
 ATA[i][j] += AT[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[MAX][MAX];
int 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 and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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]){
int AT[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
AT[i][j]=A[j][i];}}
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] += AT[i][k]*A[k][j];}}}}
void print2Darray (int A[][MAX], int n1, int n2){
int i,j;
for(i=0;i<n1;i++){
		for(j=0;j<n2;j++){
			cout << A[i][j] <<" ";
		}
		cout << endl;
}
}
int main(){
int m,n;
cin>>m>>n;
int A[MAX][MAX];
int 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);
print2Darray(ATA,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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]){
	int AT[MAX][MAX];
	for(int i=0; i< MAX; i++){
		for(int j=0; j< MAX; j++){
			AT[MAX][MAX] = 0;
		}
	}
	for(int i=0; i<m; i++){
		for(int j=0; j<n; j++){
			AT[j][i] = A[i][j];
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			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[MAX][MAX];
	int ATA[MAX][MAX];
	for(int i=0; i<MAX; i++){
		for(int j=0; j<MAX; j++){
			ATA[i][j] = 0;
			A[i][j] = 0;
		}
	}
	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 and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
Rating D: 0
Assigned grade: C