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>
using namespace std;
int  m,n;
cin>>m>>n;
int A[m][n];
for(int i=o;i<m;i++){
for(int j=0;j<n;j++)
cin>>A[i][j];
}
A[0][0];

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>

using namespace std;

int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
	{
	cin>>a[i];
	}
int c[n];
for(int i=0;i<n;i++)
	{
	c[i]=1;
	}
for(int i=0;i<n;i++)
	{
	for(int j=(i+1);j<n;j++)
		{
		if(a[i]==a[j])
		{
		c[i]++;
		}
		}
	}
int max=0;
for(int i=1;i<n;i++)
	{
	if(c[max]<c[i]){max=i;}
	}

cout<<a[max]<<" "<<c[max];
return 0;
}

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 matrixmultiply(int ATA[][max],int A[][max],int C[][max],int n,int m){
  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]+=ATA[i][k]*A[k][j];
        }
       }
      }
}        
void compute_matrixtranspose_matrix_product(int A[][max],int m,int n,int ATA[][max]){
  int C[n][max];
 for(int i=0;i<n;i++){
   for(int j=0;j<m;j++){
     ATA[i][j]=A[j][i];}}
  matrixmultiply(ATA,A,C,n,m);
  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[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 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 input_matrix(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 display_matrix(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 <<'\n';
	}
}

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][j]*A[k][i];
		}
	}
}

int main() {
	int m,n;
	cin >> m >> n;
	int A[MAX][MAX],ATA[MAX][MAX];
	input_matrix(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	display_matrix(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: 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>
#define max 8
using namespace std;
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];
			}
		}
	}
}
int main ()
{
	int m,n;
	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);
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			cout << ata[i][j] << " ";
		}
		cout << "\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: 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>
#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<n;i++)
{    for(int j=0;j<n;j++)
     {     ATA[i][j]=0;
           for(int p=0;p<m;p++)
           ATA[i][j]+=A[p][i]*A[p][j];
     }
}
}
int main()
{
int m,n;
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);
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: 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 8

void compute_matrixtranspose_matrix_product(int A[][MAX], int m, int n, int AtA[][MAX])
{
	//transposing the matrix
	for(int i =0; i < m; i++)
		for(int j = 0;j < n; j++)
			AtA[j][i] = A[i][j];

	//product of matrix
	int product[n][n];
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n;j++)
		{
			int sum = 0;
			for(int k = 0;k < m;k++)
				sum += AtA[i][k]*A[k][j];
			product[i][j] = sum;
		}
	//display the product
	for(int i = 0; i <n;i++)
	{
		for(int j =0; j < n; j++)
			cout<< product[i][j] << " ";
		cout << '\n';
	}
}
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: 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 compute_matrixtranspose_matrix_product(int a[][max],int ata[][max],int m,int n)
{
	int i,j,k;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
		 for(k=0;k<m;k++)
		{
			ata[i][j]+=a[k][i]*a[k][j];
		}
		}
	}
}
int main()
{
int m,n;
cin>>m;
cin>>n;
int a[max][max];
int i,j;
int ata[max][max];
for(i=0;i<n;i++)
{
	for(j=0;j<n;j++)
	{
	ata[i][j]=0;
	}
}
for(i=0;i<m;i++)
{
	for(j=0;j<n;j++)
	{
	 cin>>a[i][j];
	}
}
compute_matrixtranspose_matrix_product(a,ata,m,n);
for(i=0;i<n;i++)
{
	for(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;
void displayMatrix(int matrix[][100], int n1, int n2) {
    for (int i = 0; i < n1; i++) {
        for (int j = 0; j < n2; j++) {
	    cout << matrix[i][j] << " ";
        }
        cout << endl;
    }
}


void transpose(int A[][100], int At[][100], int n1, int n2) {
    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[][100], int At[][100], int AtA[][100], int m,n){
transpose(A,At,m,n);

int i,j,k;
for(i=0;i<m;i++) {
for(j=0;j<n;j++){
			AtA[i][j] = 0;
	for(k=0;k<n;k++){
			AtA[i][j] += A[i][k]*At[k][j];
			}
}
}
}

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

compute_matrixtranspose_matrix_product(A,At,AtA,m,n);
displayMatrix(AtA,m,m);
return 0;
}

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;
const int MAX = 100;

void take_matrix(int a[][MAX], int n1, int n2){
    for(int i = 0; i<n1; i++){
        for(int j = 0; j<n2;j++){
            cin>>a[i][j];
        }
    }
}

void print_matrix(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 transpose (int a[][MAX], int aTranspose[][MAX], int n1, int n2){
    for(int i = 0; i<n1; i++){
        for(int j = 0; j<n2;j++){
            aTranspose[j][i] = a[i][j];
        }
    }
}

void compute_matrixtranspose_matrix_product (int a[][MAX], int n1, int n2, int ata[][MAX]){
    int aTranspose[MAX][MAX];
    transpose(a,aTranspose, n1,n2);
    int s =0;
    for(int i = 0; i<n2; i++){
        for(int j =0; j<n2; j++){
            s = 0;
            for(int k = 0; k<n1;k++){
                s += aTranspose[i][k]*a[k][j];
            }
            ata[i][j] = s;
        }
    }
}

int main(){
    int n1, n2;
    cin>>n1>>n2;
    int a[MAX][MAX], ata[MAX][MAX];
    take_matrix(a, n1, n2);
    compute_matrixtranspose_matrix_product(a, n1, n2, ata);
    print_matrix(ata, n2, 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;
#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];}
  
  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[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);
  for(int i=0;i<n;i++){
  for(int j=0;j<n;j++) {
    cout<<ata[i][j];
  if(j<n-1) cout<<" ";
  else 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 100

void tranpose(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];
			}
		}
	}
	
	
void matrix_mult(int a[][max],int m,int n,int ata[][max]){
	
	int b[n][max];
	tranpose(a,b,m,n);
	
	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]+=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 n,m;cin>>m>>n;
 
 int a[m][max];
 int ata[n][max];
 
 for(int i=0;i<m;i++){
 	for(int j=0;j<n;j++){
 		cin>>a[i][j];
 		}
 	}

matrix_mult(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>
using namespace std;
#define MAX 100

void compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX])
{
	int ATranspose[n][m];
	for(int i=0;i<m;i++)
        {
                for(int j=0;j<n;j++)ATranspose[j][i]=A[i][j];
	}
	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] += ATranspose[i][k]*A[k][j];
			}
		}
	}
	for(i=0;i<n;i++)
        {
                for(j=0;j<n;j++)cout << ATA[i][j] << " ";
		cout << endl;
	}
}

int main()
{
	int m,n;
	cin >> m >> n;
	if(m>8 || n>8)
	{
		cout << "Invalid input";
		return 0;
	}
	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: 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;
 int main(){
 	
 	int row;int col;
 	cin>>row>>col;
 	
 	int **a= new int*[row];
 	for(int i=0; i<row; i++){
 	a[i]=new int [col];
 	}
 	
 	for(int i=0; i<row; i++){
 	for(int j=0; j<col; j++){
 	cin>>a[i][j];
 	}
 	}
 	for(int i=0; i<col; i++){
 	for(int j=0; j<row; j++){
 	cout<<a[j][i];
 	}

 	}
 	return 0;
 	}

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<simplecpp>

using namespace std;
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX])
	
	cin>> A[m][n];
	cout<<m<<endl<<n<<endl<<ATA[][MAX]<<endl;
	
int main(){
	int m,n;
	
	void compute_matrixtranspose_matrix_product()
	

}
return 0;

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>
#define MAX 100
using namespace std;
void create_2D_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 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++){
			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];
create_2D_arr(A,m,n);
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<simplecpp>
#define max 100
void product(int a[][max],int m,int n,int at[][max],int ata[][max]);


main_program{
int a[max][max];
int i,j,n,m;
cin>>m>>n;
for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
int at[max][max],ata[max][max];
for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			at[i][j]=a[j][i];
		}
	}
product(a,m,n,at,ata);	
for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			cout<<ata[i][j]<<" ";
		}
		cout<<endl;
	}

}

void product(int a[][max],int m,int n,int at[][max],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]+=at[i][k]*a[k][j];
			}
		}
	}
}

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 20
using namespace std;
void transpose(int A[][MAX],int B[][MAX],int m,int n){
for(int i=0;i<=m-1;i++){
for(int j=0;j<=n-1;j++){
B[j][i]=A[i][j];}}}
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int B[n][MAX];transpose(A,B,m,n);
for(int i=0;i<=n-1;i++){
for(int j=0;j<=n-1;j++){int sum=0;
for(int k=0;k<=m-1;k++){
sum=sum+(B[i][k])*(A[k][j]);}
ATA[i][j]=sum;}}}
int main(){
int m,n;
cin>>m>>n;
int A[m][MAX];
for(int i=0;i<=m-1;i++){
for(int j=0;j<=n-1;j++){
cin>>A[i][j];}}
int ATA[n][MAX];
compute_matrixtranspose_matrix_product(A,m,n,ATA);
for(int i=0;i<=n-1;i++){int j=0;
for( j=0;j<=n-2;j++){
cout<<ATA[i][j]<<" ";}
cout<<ATA[i][j]<<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