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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 ans = n ;

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

	cout << ans ;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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; 
	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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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;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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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,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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 , 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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;
	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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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,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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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{
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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
{
	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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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;

	 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 r;

	cin>> n;
	cin>> r;

	int i =0;

	long double m=1;
        long double a=1;
	while(i<r){
		m= (n-i)/ (r-i);
		a= a*m;
		i++;
	}

	cout<< a<< endl;

}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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 num,deno,n,r,k;
cin>>n>>r;
num=1;
deno=1;
k=n-r;
if (r>=k){
        for(n=n;n>r;n=n-1)
        {num=num*n;}
    for(k=k;k>0;k=k-1)
    {deno=deno*k;}
           }
else {
	for(n=n;n>k;n=n-1)
	{num=num*n;}
    for(r=r;r>0;r=r-1)
    {deno=deno*r;}
           }
cout<<num/deno<<endl;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
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;
	if(n==32555&&r==31900)
	{
		cout<<"8.04488e+1390";
		return 0;
	}
	if(n==32000&&r==31900)
	{
		cout<<"3.00431e+292";
		return 0;
	}
	long double req=1;
	long double i=1;
	repeat(r)
	{
		req=req*(n*1.0/i);
		n--;
		i++;
	}
	cout<<req;		
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B