CodeGraderBench/CodeGraderBench huggingface dataset:
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>

int main() {
    float xl = 0, xr = PI/2;
    float xm = (xl + xr)/2;
    float y;
    cin >> y;
    while((xr - xl) > 0.00001) {
        if ((sin(xm) - y) > 0) {
            xr = xm;
            xm = (xl + xr)/2;
        } else {
            xl = xm;
            xm = (xl + xr)/2;
        }
    }
    cout << fixed; // uses fixed floating point representation
    cout.precision(3); // print three digits after the decimal point
    cout << xm << endl;
}

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
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 y;
	double x=1;
	cin>>y;
	while(abs(y-sin(x))>10E-100){
		x=x-(sin(x)-y)/(sqrt(1-(sin(x)*sin(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
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{
	float y;
	cin>>y;

	float term=y,ans=y;
	int k=1;
	repeat(20){
		term=term*(2*k-1)*(2*k-1)*y*y/((2*k+1)*k*2);
		ans=ans+term;
	}
cout<<fixed;
cout.precision(3);
	cout<<ans;
}

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: B
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 y;
	cin>>y;
	float epsilon=1.0E-20;
	double x=0;
	while(0<=x&&x<=PI/2){
		if(y==sine(x)){
			cout<<fixed;
		        cout.precision(3);
			cout<<x<<endl;}
		else x=x+epsilon;

	}
}

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 y;
cin>>y;
for(double i=0.0;i<=1.571;i=i+0.00000001){
	if ((sin(i)*1000)/10==y*100)cout<<i;
	else continue;
}
}

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,y;cin>>y;
	
	}
	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: 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{
	long double x,y;
	cin>>y;
	x=0.0;
	while(true){
		long double e;
		e=(sin(x)) -y;
		if(e<0.0000001 && e>-0.000000001) break;
		x=x+0.0000001;}
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
	
}

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>
double sinx_inverse(double x){
        double sinx_inverse;
        sinx_inverse=x+x*x*x/6+x*x*x*x*x*x*3/40+x*x*x*x*x*x*x*5/84+x*x*x*x*x*x*x*x*x*35/144+x*x*x*x*x*x*x*x*x*x*x*63/(4*64*11)+x*x*x*x*x*x*x*x*x*x*x*x*x*7*99/(4*64*12*13);
        return sinx_inverse;
}
main_program{
        double x;
       cin>>x;
cout<<fixed;
cout.precision(3);
cout<<sinx_inverse(x)<<endl;
}

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
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 y;
cin>>y;
double term=y,sum=y;
int i=1;
while(abs(sin(sum)-y)>0.0000001){
	term=term*(y*y)*((2*i)-1)*((2*i)-1)/(((2*i)+1)*(2*i));
	sum=sum+term;
        i++;
}
cout<<sum<<endl;
}

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 y,x;
	cin>>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 y;
	cin>>y;
	double x= PI/4;//chosing any arbitory value for initialization
	while (abs(sin(x)-y)>1.0E-20) {
		x = x - ((sin(x)-y)/cos(x));
	}
	if ( x>PI/2) {
		while(x>PI/2) {
			x = x - 2*PI;
		}
	}
	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
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 y;
	long double x=1;
	cin>>y;
	repeat(5000){
		x=x-(sin(x)-y)/cos(x);
	}
	x=x+0.0002;
	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
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 y;
	cin>>y;
	double x=PI/4;
	repeat(5000){
		x= x -tan(x) + y/cos(x) ;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
}

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
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 y;
		cin<<y;
		
		double sum=0,t=y
		t=t*(-1)*y*y(2)*(+1)
	cout<<y;
	cout<<fixed;
	cout.precision(3)
	}

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,y;cin>>y;
	repeat(700){
		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
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 y,x=1;
	cin>>y;
	repeat(100){
		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
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{
	long double y;
	long double x=0;
	cin>>y;
	float dx = 0.00001;
	float i = 0;
	while (i <=y)
	{
		x = x + 0.00001/pow(1-i*i,0.5);
		i = i + dx;
	}
	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: B
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, y, orig_y_square; cin>>y;
	bool y_greater_than_pi_by_4 = false; //If y is greater than sin(pi/4), we can just find the value of arccos(y) and subtract it from pi/2
	if(y > sqrt(0.5)){
		y_greater_than_pi_by_4 = true;
		y = sqrt(1-y*y);
	}
	orig_y_square = y*y;
	x=y; // the first term of the taylor polynomial of arcsin(y) is y;
	for(unsigned int i=3, coeff=1, denom =2; i <= 15; coeff*=(i-2),  i+=2, denom*=2){
		//cout << (float) (i*denom)/coeff << endl;	
		y*=orig_y_square;
		x+=(y*coeff)/(i*denom);	//We are adding to x the a suitable term of the taylor polynomial of y, until the value needed to maintain accuracy of the result
	}
	cout << fixed;
	cout.precision(3);
	if (y_greater_than_pi_by_4) cout << PI/2 - x;
	else 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
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 y;
	cin>>y;
	double w,i,x;
	w=y/100000000; //width taken to be small but with fixed number of partitions
	i=1;
	x=0;
	repeat(99999999){
		x+=(1/(sqrt(1-(i*w*i*w))))*w; //computing x as a sum of area through reimann integration
		i++;
	}
	cout<<fixed; //uses fixed floating point representation
	cout.precision(3); //print three digits after the decimal point
	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
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 y;
	cin >> y;
	double xL=0, xR=PI/2;
	double xM;
	while(xR-xL>0.00001){
		xM=(xL+xR)/2;
		if(sin(xM)-y<0){ xL=xM;}
		else {xR=xM; }
	}
	cout << fixed; // uses fixed floating point representation
        cout.precision(3); // print three digits after the decimal point
	cout << xL;
}

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
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,y;
cin>>y;
x= y+y*y*y*(0.333)+y*y*y*y*y*(0.238);
cout << fixed; // uses fixed floating point representation
cout.precision(3); // print three digits after the decimal point
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
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 y ;
	cin >> y ;
	
	cout << fixed ; 
       cout.precision(3) ; 	
	 long double  x ;
      long double  epsilon = 0.000001 ; 	 
	      for ( x= 0 ; abs(sin(x)- y)>epsilon ;x =  x + 0.000001 ) { 
	      } 
	      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: 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>

int main()
{ float x=1.0 , y ;
	cin>>y;


	repeat(20)
	{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
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 y;
	cin>>y;
	double xl=0,xr=PI/2;
	while(xr-xl>0.0005)          //for 3 decimal accuracy
	{
		if((sin((xl+xr)/2)-y)<0){
			xl=(xl+xr)/2;           // bisection method
		} 
		else xr=(xl+xr)/2;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<xr;
}

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

	float y;
	cin>>y;

        
	for(double i=0;i<=1.571;i=i+0.001){
		if( sin(i)==y){
			cout<<i;
			break;
			}
		else{
			continue;
		}
	}
}

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