CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	 int i=1;
	 long double n_fac=1;
	repeat(n){
		n_fac*=i;
		i++;
	}

	long double r_fac=1;
	int j=1;
	repeat(r){
	
		r_fac*=j;
		j++;}
	long double nr_fac=1;
	int k=1;
	repeat(n-r){
		nr_fac*=k;
		k++;
	}
	long double n_c_r= (n_fac)/((r_fac)*(nr_fac));
	cout<<n_c_r<<endl;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	int b=n-r;
	long long int factn=1;
	long long int factb=1; 
	long long int factr=1;
	long long int fact;
	while(n>0){
		factn=factn*n;
		n--;
	}
	while(b>0){
                factb=factb*b;
                b--;
        }
	while(r>0){
                factr=factr*r;
                r--;
        }
	fact=factn/(factr*factb);
	cout<<fact;


/*	long double fact=1.0;
	if(b==0){
		cout<<"1";
	}
	else{
		while(n>0){
			fact*=n/(b*r);
			n--;
			b--;
			r--;
			if(b==0)
				b=1;
			if(r==0)
				r=1;
	
	}
	}	
	cout<<fact;*/

}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;cin>>n>>r;
	long double i=1;
	long double k=1;
	for(int a=r+1;a<=n;a++){
		i=i*a;
	}

	for(int c=1;c<=(n-r);c++){
		k=k*c;}
	long double s=i/(k);
	cout<<s;
			












}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	long double res;
	cin >> n;
	cin >> r;
	int k;
	long double t = 1,p = 1;
	if (n-r < r) k = r;
	else k = n - r;
	for(int i = n; i >n- k;i--){
		t = t * i;
	}
	for(int i = 1; i <= k;i++){
		p = p * i;
	}
	res = t/p;
	cout << res;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n, r;
	//cout<<"Enter value:";
	cin>>n>>r; 

	int x=0;
	double a, b;
	long double c=1;
	while(x<r){
		a=(n-x);
		b=(r-x);
		x++;
		c*=a/b;
	}
	cout<<c<<endl;

}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: C
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	 long int i= 1, t= 1, j=1, s=1, k=1,u=1, p;
	 while(i<n)
	 {
		 i=i+1;
		 t=t*i;}
	 while(j<r){
		 j=j+1;
		 s=s*j;}

          while(k<(n-r)){
		  k=k+1;
		  u=u*k;
	  }
	  p=t/(s*u);
	  cout<<p;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	long double m=n;
	long double q=r;
	long double a=m-q+1;
	long double b=1;
	long double p=1;
	repeat(q){
		p=p*a/b;
		a++;
		b++;
	}
	cout<<p;

}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	long double n,r;
	cin>>n>>r;
	long double c=n/r;
	for(long double i=1;i<r;i++){
		c=c*((n-i)/(r-i));
	}
	cout<<c<<endl;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
long double n;
long  double rinput;
	cin>>n>>rinput;
long double nCr=1;
long double r =0;
if(rinput>n/2.0){ rinput= n-rinput;}
repeat(rinput){
    nCr=(n-r)*1.0/(r+1)*nCr;
    r=r+1;
}
cout<< nCr;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: A
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int r;
	cout<<"enter r number:";
	cin>>r;
	int n;
	cout<<"enter n number:";
	cin>>n;
	{
		if(1<=r<=n; && 1<=n<=3500)
			cout"

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: C
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>

main_program{
	int n,r;
	cin>>n>>r;

	long double k=0;
	long double output=1;

	if(r>n/2){
		r= n-r;
	}

	while(k<r){
		output*= (n-k)/(k+1);
		k++;
	}

	cout<<output;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
long double n,r,b=1,c=1,z,d=1, factorial;
cin>>n>>r;
repeat(n-1){
	b=b*n;
	n=n-1;}
repeat(r-1){
c=c*r;
r=r-1;}

repeat(n-r-1){z=n-r;
	d=d*z;
	z=z-1;}
factorial=b/(c*d);
cout<<factorial;}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	long double n, r, i = 1;
	cin>>n>>r;
	long double c = 1;
	repeat(r){
		c = (c/i)*(n-i+1.0);
		i++;
	}
	cout<<c;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
int n;
cout<<"enter a number n:";
cin>>n;
int r;
cout<<"enter a number r:";
cin>>r;
int a=1;
for(int i=1;i<=n;i++){
a=a*i;
}

int b=1;
for(int i=1;i<=r;i++){
b=b*i;
}
int c=1;
for(int i=1;i<=n-r;i++){
c=c*i;
}
cout<<(a/(b*c));
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include <simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	long double t=1;
	for (int i=n;i>=(r+1);i--){
		t=t*i/(n-i+1);}
	cout<<t<<endl;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
using namespace std;
main_program{
       long double n,r,ans=1;
	cin>>n;
	cin>>r;
	long double i=1;
		repeat(r){
		ans*=((n-i+1)/i*1.0);
		i++;
	}
	cout<<ans;	
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include <simplecpp>
main_program{
int n,r;
cin >> n >> r;
int d = n-r; //Difference
long double t1 = d+1,t2 = 1; //Repeating terms
int i = 1;
while(i != r){
t2 = t1*d/(i+1);
t1 = t1 + t2;
i++;
}
cout << t1;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include <iostream>
using namespace std;
int main(){
    int n,r;
    cin>>n>>r;
    long double factorial1,factorial2, factorial3, output;
    output=1;
    long double i=r+1;
    long double j=1;
    
    for(i=r+1, j=1; i<=n && j<=(n-r); i++, j++){
        output*=(i/j);
    }

    cout<<output<<endl;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
  float n,r,j,k,l;
  cin>>n>>r;
  int i=n;
  while(i>0){
        j=n*i;
        i--;
  } 
   i=r;
  while(i>0){
      k=r*i;
      i--;
  } 
   i=(n-r);
  while(i>0){
       l=(n-r)*i;
       i--;
  }    
    cout<<j/k*l;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: C
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	float x=1.0,y=1.0,z=1.0;
	int i=1,j=1,k=1;
        float d=1.0;
	
	cin>>n>>r;
	int m=n-r;
	float ans;
	
	if(n>0&&n<35001&&r>0&&r<(n+1))
	{
	while(i<n)
	{
		x=x*i;
		i++;
	}
	x=x*n;

	while(j<r)
	{
		y=y*j;
		j++;
	}
	y=y*r;

	while(k<m)
	{
		z=z*k;
		k++;
	}
        z=z*m;
	d=y*z;
	ans=x/d;
	}
	cout<<ans;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{long  double a,b,n,r,c,d,e;
	
	a=1;
	     cin>>n>>r;
	     b=n-r;
	     c=n;
	     repeat(b-1){c=c-1;
			n=n*c;}
	     e=b;
	while(a<b){e=e*a;
	   	a=a+1;}
	d=n/e;
	cout<<d;

	     
	    


}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	long double c=1;
	long double r,n;
	int t=1;
	cin>>n>>r;
	while(t<=r){
		c*=(n-t+1)/t;
		t++;
	}
	cout<<c;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;

	float i=0;
	//float n;
	if(n>=1 && n<=35000 && r<=n)
	{
	
	repeat(r){
		n=n*(n-i+1)/i;
	i++;
	}
	

	cout<<n;
	}
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	int n,r;
	cin>>n>>r;
	if(n>0&&n<35001&&r>0&&r<=n){
	long double c=1,i=1,j=n-r+1;
	repeat(r){
		c=c*j/i;
		j++;
		i++;
	}
	cout<<c;
	}
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: C
Problem: accept n and r from the user, compute nCr, and print the result. A naive approach would be to calculate the factorial of n, factorial of r, and factorial of n-r and then finally compute the result as given in the formulae above. However, calculating the factorial of a large number can be tricky, and the result may overflow due to the limitation of the size of data type. you are free to use other data types, including long double. you are free to use other data types, including long double.

Constraints:1 <= r <= n1 <= n <= 35000

Student submission:
#include<simplecpp>
main_program{
	long double n;
	cin>>n;
	int r;
       cin>>r;
       long double fac=1;
       
       for(int i=r;i>0;i--){
	       fac=fac*n/i;
	       

	       n--;
	       
       }
       cout<<fac;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok variable names
Rating C: poor variable names
Rating D: 0
Assigned grade: B