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 input_array_values(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<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<<'\n';}
}
int main(){
int m,n;
cin>>m>>n;
int A[max][max],ATA[max][max];
input_array_values(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 maxim=8;
void compute_transposematrix_matrix_product(int A[maxim][maxim],int m,int n,int ata[maxim][maxim])
{
 int B[maxim][maxim];
 for(int i=0;i<n;i++)
 for(int j=0;j<m;j++)
 B[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]+=B[i][k]*A[k][j];
        }
    }
 }
}
void print_matrix(int ata[maxim][maxim],int n)
{
 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;
int A[maxim][maxim],B[maxim][maxim],ata[maxim][maxim];
cin>>m>>n;
for(int i=0;i<m;i++)
for(int j=0;j<n;j++)
cin>>A[i][j];
compute_transposematrix_matrix_product(A,m,n,ata);
print_matrix(ata,n);
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 1000

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

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

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;
}
}

int main(){
f();
return 0;
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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[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];}
}

}

}

void input(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 output(int A[MAX][MAX],int m,int n)
{
for(int i=0;i<m;i++)
{for(int j=0;j<n;j++)
{if (i==m-1 && j==n-1) cout<<A[i][j];
else {cout<<A[i][j]<<" ";}}
cout<<endl;}
}

int main()
{
int m,n;
cin>>m>>n;

int A[MAX][MAX],ATA[MAX][MAX];

input(A,m,n);

compute_matrixtranspose_matrix_product(A,m,n,ATA);

output(ATA,n,n);

}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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])
{
	int AT[MAX][MAX];
	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]; // 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)
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cout<<ATA[i][j];if(j-n+1)cout<<" ";
		}
		if(i-n+1)cout<<endl;
	}
}

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

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 order(int &m, int &n){
	cin >> m >> n;
}

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 print(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;
	}
}

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++){
			int k = 0;
			for(int l=0; l<m; l++) k += A[l][i]*A[l][j];
			ATA [i][j] = k;
		}
	}
	print(ATA, n, n);
}

int main(){
	int m, n;
	order (m, n);
	int A[m][MAX], ATA[n][MAX];
	input(A, m , n);
	compute_matrixtranspose_matrix_product (A, m, n, ATA);
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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  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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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 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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D