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{
	long double n,r,m;
	cin>>n>>r;
	m=n/((n-r)*r);

	for(int i=n-1;i>=1;i--){
		m=m*i;
	}

	for(int i=r-1;i>=1;i--){
		m=m*(1.0/i);
	}

	for(int i=n-r-1;i>=1;i--){
		m=m*(1.0/i);
	}
	/*if(a>b){
		while(b!=1){
			m=m*(1.0/(a*b));
			a--;
			b--;
		}
		 while(a!=1){
			 m=m/a;
		 }
	}

	else{
		while(a!=1){
			m=m*(1.0/(a*b));
			a--;
			b--;
		}
		while(b!=1){
			m=m/b;
		}
	}*/



	cout<<m;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 a, n,r,i=1,f=1,e=1;
cin>>n>>r;
a=n-r;

for(i=1;i<=n;i=i+1){
f=f*i;}
for(i=i;i<=r;i=i+1){
e=e*i;}
for(i=1;i<=a;i=i+1){
a=a*i;}
cout<<f/(a*e);}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;
	long double c = 1;
	cin >> n >> r;
	int i = 1;
	repeat(r) {
		c=c*(n-i+1);
		c=c/i;
		i++;
	}
	cout << c;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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,r,c,d;
    long double s=1.00;
    cin>>n>>r;
    c=n;
    d=r;
    repeat(c-d){
    long double e = (n/(c-r));
    s=s*e;
    n=n-1;
    r=r+1;
    }
    cout<<s;
    
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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,r,x=1,i=1,y=1,j=1,k=1,z=1;

	cin>>n>>r;
	if(r<=n&&r>=1){
		if(n>=1&&n<=35000){
			while(i<=n){
				x=x*i;
				i++;}
			
	
	while(j<=r){
		  y=y*j;
 		   j++;}
	

	while(k<=(n-r)){
		z=z*k;
		k++;}


	cout<<(x/(y*z));
	
		}
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;
	if((1<=n && n<=35000)){
	int i=n;
	long double count=1.0;
		for(int j=0;j<r;j++){
			count=(count*(((i-j)*1.0)/(j+1)));
		}
		cout<<count;
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 r,n;long double p=1;
cin>>n>>r;
int r2=r;
if(n>=1 && n<=35000 && r<=n)
{
while(r2<n)
{p*=((1.0*(r2+1))/(1.0*(r2+1-r)));
r2++;
}
cout<<p;
}
else
cout<<"Invalid Input";
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 c;
	cin>>n>>r;
	i=1;j=1;
	do(i<<n && j<<r)
		c=fac_n/(fac_r*(n-r));
	i=i+1;
	j=j+1;
	while(i<<n && j<<r)
		     T=c*i/r*(n-r);
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;
long double num=1,denom=1,res;
cin>>n>>r;
int a=n;
while(n>r){
num=num*n;
n--;
}
int c=a-r;
while(c>1){
denom=denom*(c);
c--;
}
res=num/denom;
cout<<res;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 , r ;
	cin >> n >> r ;
	
	long double ans = n ;

	int i = 1 ;
	while(i <= r-1){
		ans = ans*(n-i)*1.0/(r-i+1) ;
		i++ ;
	}

	cout << ans ;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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; 
	int r;
	cin >> n >> r;
	long double  num = 1;
	long double deno = 1;
	long double ans = 1;
	int copy = n;

	while (copy>r){
		num = num * copy ;
		copy = copy-1;}

	r = n-r;
	while(r > 0){
		deno = deno * r;
		r =r-1;
	
	}
	ans = 1.0*num/deno;
cout << ans;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;int r;
		cin>>n>>r;
	long double num=1;long double den=1;int n_=n;int i=1;
	repeat(n-r){num=num*n_;n_--;}
        repeat(n-r){den=den*i;i++;}
        cout<<num/den;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 <iostream>
using namespace std;
int main(){
int n,r;
cin>>n>>r;
long  double a,b,c;

a=1;
b=1;
c=1;
for(int i=r+1;i<=n;i++){

a*=i;
}
//for(int i=1; i<=r;i++){

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

c*=i;
}
cout<<a/(b*c);
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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, r;
	cin>>n>>r;
	long double k = 0, nCr = 1;
	if ((2*r) <= n){
		for(k = 0; k < r; k++){
			nCr = nCr * ((n-k)/(k+1));
		}
	}
	else{
		for(k = 0; k < (n - r); k++){
			nCr = nCr * ((n-k)/(k+1));
		}
	}

	cout<<nCr<<endl;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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,y,l,i=1,a=0,q;
	cin>>n>>r;
	 long double  prod=1.0,p;
	if(r<(n-r)){
		q=r;
	}
	else{
		q=n-r;
	}
	repeat(q){
		y=n-a;
		l=i;
		p=(1.0*y)/l;
		prod=prod*p;
		i++;
		a++;
	}
	cout<<prod;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 a , n ,r ,b,c;
	cin>>n>>r;
	if(r<(n-r)){
	a =1;
	b = 1;
	repeat(r){
		c = n/b;
		a*=c;
		n--;
		b++;
			
	}}
	else{
	r = n-r;
	a =1;
        b = 1;
        repeat(r){
                c = n/b;
                a*=c;
                n--;
                b++;

	}}
	cout<<a<<endl;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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{

	float n;
	float r;
	cin>>n>>r;
	float a=1;
	if((n>=1&&n<=3500)&&(r>=1&&r<=n)){
		long double factorial=1;
		while(a<=r){
			factorial=factorial*(n/a);
			n--;
			a++;
		}
		cout<<factorial;
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 n1=n,r1=r,num=1,deno=1;
	for(int i=1;i<=n-r;i++)
	{
		num*=r1+i;
		deno*=i;
	}
	cout<<num/deno;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;
	int i=0,j=n-r;
	long double C=1;
	repeat(r+1){
	if(i!=0){
              C=C*j/i;}
	      j++;
	      i++;}
	cout<<C;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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,r,t,u,a,b;
          cin>>n>>r;
          t=1;
          u=1;
          while(true){
            u=u*++t;
           if(t==n) break;
       }
        n=u;
         a=1;
          b=1;
          while(true){
            b=b*++a;
           if(a==n-r) break;
	   r=b;
       }

}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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{
unsigned int n,r,b,c,d;
        cin>>n>>r;
	 long double a;
	long double p;
	long double q;
        long double facn;
        long double facr;
          long double facnr;
  long double op;	  
	 if(n>=1&&r>=1&&r<=n){
	a=n;
	b=n-1;
	while(b>=1){
		a=a*b;
		b--;}
	facn = a; 
        p=r;
        c=r-1;
        while(c>=1){
                p=p*c;
                c--;}
        facr = p;
	q=n-r;
        d=n-r-1;
        while(d>=1){
                q=q*d;
                d--;}
        facnr =q; }
       op=facn/(facr*facnr);
       cout<<op;}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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 ;

int nfac = 1 ;
int i = 1 ;
while(i<=n)
        {
	nfac = nfac*i ;
	i++ ;
        }

int rfac = 1 ;
int j = 1 ;
while(j<=r)
        {
	rfac = rfac*j ;
	j++ ;
	}

int n_rfac = 1 ;
int k = 1 ;
while(k<=(n-r))
{
	n_rfac = n_rfac*k ;
	k++ ;
}

int nCr = 1 ;
nCr = nfac / (rfac * n_rfac) ;

cout <<nCr ;
}
/*

int num ;
if(n%2==0)
{
 num = n/2 +1 ;
}
	else if ( n%2 != 0)
{
 num =( n+1)/2 ;
}

float N = 1.00000 ;
int i = N ;
while(N<= (n-r))
{
	N = N*i ;
	i-- ;
}
if(r>num/2)
{
r = n-r ;
}
 float r = 1.00000 ;


cout << nCr ;
}
*/

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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>
using namespace std ;

main_program
{
	int n , r ;
	cin >> n >> r ;
	
	int n_r = n - r ;
	
	if ( n_r > r )
	{
		long double numerator = 1 ;
		for ( int i = n_r+1 ; i <= n ; i++ )
		{
			numerator *= i ;
		}
		long double denominator = 1 ;
		for ( int i = 1 ; i <= r ; i++ )
		{
			denominator *= i ;
		}
		
		cout << numerator/denominator ;
	}
	else if ( n_r <= r )
	{
		long double numerator = 1 ;
		for ( int i = r+1 ; i <= n ; i++ )
		{
			numerator *= i ;
		}
		long double denominator = 1 ;
		for ( int i = 1 ; i <= n_r ; i++ )
		{
			denominator *= i ;
		}
		
		cout << numerator/denominator ;
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
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;

	 int r;
	  cin>>n>>r;
	  double p=n-r;
	 long  double  a=1;
	  
	 long  double c=1;
	  if((n>=1 && n<=35000) && (r>=1 && r<=n)){
	  repeat(n-r){
		  a=a*n;
		  n=n-1;
	  }
	 
		
	  
	  repeat(p){
		  c=c*p;
		  p=p-1;
	  }
	  cout<<(a/c)<<endl;
	  }
	  else cout<<"invalid input"<<endl;
  }

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C