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;
#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]) + ATA[i][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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 8  
  compute_matrixtranpose_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++){
     cin>>A[i][j]>>" ";
     }
     cout<<endl;
     }
     int i,j
    int AT[i][j]=0;
     for( i=0;i<m;i++){
     for( j=0;j<n;j++){
      int temp=i;
       i=j;
       j=i;
       int tranpose =AT[i][j];
       }
       }
       
   for(int i=0;i<m;i++){
   for(int  j=0;j<n;j++){
     int ATA=[i][j];
     for(int k=0;k<n;k++){
     ATA[i][j]+=A[i][k]*A[k][j];
     }
     }
     }
     
        
  int main(){
  int m,n;
  cin>>m>>n;
  cout<<compute_matrixtranspose_matrix_product(A[][MAX],m,n,ATA[][MAX]);
  }

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 8
using namespace std;


void get_matrix(int A[][MAX], int m, int n) //inputs matrix
{
    for(int i=0; i<m; i++)
    {
        for(int j=0; j<n; j++)
        {
            cin>>A[i][j];
        }
    }
}

void transpose(int A[][MAX], int m, int n, int AT[][MAX]) //stores transpose of A in AT
{
    for(int i=0; i<m; i++)
    {
        for(int j=0; j<n; j++)
        {
            AT[j][i] = 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<<endl;
    }
}

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX])
{
    int AT[n][MAX];
    transpose(A, m, n, AT);
    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;
    cin>>n;
    int A[m][MAX];
    get_matrix(A, m, n);

    int result[n][MAX];

    compute_matrixtranspose_matrix_product(A, m, n, result);

    display_matrix(result, n, n);








return 0;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 = new int*[n]; 
	for(int i=0;i<n;i++){
		At[i] =  new int [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];
			}
		}
	}
	for(int i=0;i<n;i++) delete [] At[i];
delete [] At;
}
void get_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 display(int AtA[][MAX],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;
	cin>> m >> n;
	int A[m][MAX],AtA[n][MAX];
	get_input(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,AtA);
	display(AtA,n);
	return 0;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 product(int a[][8],int b[][8],int c[][8],int m,int n){
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++){
c[i][j]=0;
for(int k=0;k<m;k++)c[i][j]+=b[i][k]*a[k][j];
}
}
}
int main(){
int m,n;cin>>m>>n;
int a[m][8],b[n][8],c[n][8];
for(int i=0;i<m;i++)for(int j=0;j<n;j++)cin>>a[i][j];
product(a,b,c,m,n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)cout<<c[i][j]<<" ";
cout<<endl;
}
return 0;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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>
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]+=A[k][i]*A[k][j];
  }
}
}
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 AtA[MAX][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;	
}
cout<<endl;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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<m;i++){
 for(int j=0;j<n;j++){
 if(i!=j)ATA[j][i]=A[i][j];
 else ATA[i][j]=A[i][j];
 }}
int C[MAX][MAX];
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];
} 
} 
}
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];
for(int i=0;i<m;i++){ 
for(int j=0;j<n;j++){
cin>>a[i][j];}}
int t[MAX][MAX];
compute_matrixtranspose_matrix_product(a,m,n,t);}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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;
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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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][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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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 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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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>
#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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
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: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: C