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

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: 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 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: 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 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: 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;
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: 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[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: 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 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: 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 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: 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;
 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: 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<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: 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>
#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: 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<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: 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 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: 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 m ,int n,int ATA[][MAX]){
	int c[m][m];
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				ATA[j][i]= A[i][j];
			}
		}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
			c[i][j]=0;
			for(int k=0;k<n;k++){
			c[i][j]+= ATA[i][k]*A[k][j];
			}
			cout<<c[i][j]<<" ";
		}
		cout<<"\n";
	}
	}
int main(){
	int n,m;
	cin>>n>>m;
	int A[MAX][MAX];
	int ATA[MAX][MAX];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;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: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>

main_program{
	double x;
	cin >> x;

        double y=0;
	while(sin(y)<x && y<=PI/2){
		y+=0.0001;
	}
	cout << fixed;
	cout.precision(3);
	cout << y;
}

Grading criterion: Implementation of binary search, gradient descent or any appropriate iterative method.
Rating A: Correctly using binary search correct query / Correct iterative update
Rating B: Slight mistake in update of binary search / iterative method
Rating C: Used linear search or completely incorrect search
Rating D: 0
Assigned grade: C
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double x=PI/4;
	double y;
	cin>>y;
	while(((sin(x)-y)>0.00000001)||((sin(x)-y)<-0.00000001)){
		x=x-(sin(x)-y)/cos(x);
	}
	cout << fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Implementation of binary search, gradient descent or any appropriate iterative method.
Rating A: Correctly using binary search correct query / Correct iterative update
Rating B: Slight mistake in update of binary search / iterative method
Rating C: Used linear search or completely incorrect search
Rating D: 0
Assigned grade: A