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>
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 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 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 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 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: 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 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: 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;
	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: 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;
	cin>>n>>r;
	long double factn=1;
	long double factr=1;
	long double factnmr=1;
	long double factn1=1;
	long double factr1=1;
	//long double factnmr1=1;

	if (n < 1000 && r<1000){
		for(int i=1;i<=n;i++){
			factn = factn * i;
		}	
		for(int  i=1;i<=r;i++){
                	factr = factr * i; 
        	}
		for(int i=1;i<=(n-r);i++){
                	factnmr = factnmr * i;
        	}
		//cout<<factn<<"\n";
		long double result = factn /(factr * factnmr);
		cout<<result;
	}
	else if(n>=2000 && r>=1500 && n<=30000 && r<=30000){
		for(int i=1;i<(n-1500);i++){
                        factn = factn * i;
                }
		for(int i=(n-1500);i<=n;i++){
                        factn1 = factn1 * i;
                }
		for(int i=1;i<(r-1100);i++){
                        factr = factr * i;
                }
                for(int i=(r-1100);i<=r;i++){
                        factr1 = factr1 * i;
                }
		for(int i=1;i<=(n-r);i++){
                        factnmr = factnmr * i;

		}
		long double result = (factn) /(factr * factnmr);
                long double result1 = (factn1)/factr1;
		cout<<result*result1;
	}
	else if(n>=30000 && r>=30000){
                for(int i=1;i<(n-29100);i++){
                        factn = factn * i;
                }
                for(int i=(n-29100);i<(n-28200);i++){
                        factn1 = factn1 * i;
                }
		for(int i=(n-29100);i<=n;i++){
                        factn1 = factn1 * i;
		}
                for(int i=1;i<(r-1100);i++){
                        factr = factr * i;
                }
                for(int i=(r-1100);i<=r;i++){
                        factr1 = factr1 * i;
                }
                for(int i=1;i<=(n-r);i++){
                        factnmr = factnmr * i;

                }
                long double result = (factn) /(factr * factnmr);
                long double result1 = (factn1)/factr1;
                cout<<result*result1;
        }
}

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 ,nfactorial=1 , rfactorial=1 , f=1 ;
 cin >> n >> r;
 b=n;
 repeat(n-r){
 nfactorial=nfactorial*b;
 b--;
 }
 b=1;
// repeat(r){
// rfactorial=rfactorial*b;
// b++;
//}
 b=1;
 repeat(n-r){
 f=f*b;
 b++;
 }
// c=rfactorial*f;
 cout<<nfactorial/f;

}

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, r;
	cin >> n >> r;
	long double p = 2*r;
	long double e, f;
	e = n;
	f = n;
	long double fact = 1, facto = 1, k = 1, l = 1;
	if(n < p){
		repeat(n-r){
			fact *= (e/k);
			e--;
			k++;
		}
		cout << fact;
	}
	if(n>=p){
		repeat(r){
			facto *= (f/l);
			f--;
			l++;
		}
		cout << facto;
	}
}

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;
cin>>n;
long double r;
cin>>r;


int i=0;
int j=0;
int k=0;
long double nfact=1.0;
long double rfact=1.0;
long double dfact=1.0;
long double ans;
long double mf= n-r;

while(i<n){

nfact=nfact*(n-i);
i++;
}

while(j<r){

rfact=rfact*(r-j);
j++;
}


while(k<mf){

dfact=dfact*(mf-k);
k++;
}

ans=nfact/(dfact*rfact);

cout<<ans<<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 int n,r;
long double product;
cin >> n >> r;
long int i;
i = r;
product =1; 
repeat(r){
	product=product*n/i;
	n= n-1;
	i= i-1;
}
cout << product;
}

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:
//Gokula
#include <simplecpp>
main_program{
	int n,r,a,b,c;
	cin>>n>>r;
	a = n;
	b = r;
	c = n-r;
	if ((n>=1)&&(n<=35000)&&(r>=1)&&(r<=n)){
		long double t=1;
		while (true){
			t *= (((1.0*a)/(1.0*b*c)));
			//cout<<t<<endl;
			a = a-1;
			if (a==1){
				break;
			}
			if ((b>1)){
				b = b-1;
			}
			if ((c>1)){
				c = c-1;
			}	
			}
		cout<<t;
		}
			
	
	}

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>
int main(){
 int n,r;
cin>>n>>r;
  int a=1;
 long double pro=1;
  while(a<=n){
   pro=pro*a;
   a++;}
  
    
int b=1;
  long double pro2=1;
 while(b<=r){
   pro2=pro2*b;
  b++;}
   
   
  int c=1;
 int d=n-r;
  long double pro3=1;
   while(c<=d){
   pro3=pro3*c;
  c++;}
  
 long double y;
  y=pro/(pro2*pro3);
    cout<<y;}

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 p=n-r;
	if(p<r){r=p;}
	long double b=n, c=r;
	repeat(r-1){n--;
		b=b*n;
		r--;
		c=c*r;
		long double q=b/c;
		long double s=1;
		s=s*q;
		s=q;
		if(r>1)continue;
	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: 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,b,c,d;
	long double x,y;
	x=1;
	y=1;
	c=1;
	cin >> a >> b;
	d=a-b;
	if(b>d){
		repeat(d){
			x*=(b+1);
			b+=1;
		}
		repeat(d){
			y*=c;
			c+=1;
		}
	}
	else{
		repeat(b){
			x*=(d+1);
			d+=1;
		}
		repeat(b){
			y*=c;
			c+=1;
		}
	}
	cout << x/y;
}

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,x,;
	cin>>n;
	cin>>r;
	while((1<=n<=35000)&&(1<=r<=n)){
      x=n-r;
	
		n*=n-1;
		r*=r-1;
		x*=(x-1);
		if(n==1&&r==1&&x==1) break;}
             float e= n/(r*x);	
	cout<<e<<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 int n, r;
	long double ncr=1;
	cin>>n>>r;
	if (1<=n && 1<=r && n<=35000 && r<=n)	{
		for (float i=n-r, j=n; i>=1; i--, j--)
			ncr *= j/i;
		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: 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=0.0,r=0.0;
cin>>n>>r;
long double res=1.0;
for(int i=1;i<=r;i++)
{
res*=(n-i+1)/i;
}
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{
	 long double  n,t,i,r,ncr,nfac,rfac,l,tfac,m;
	nfac=1;
	rfac=1;
	l=1;
	m=1;
	tfac=1;
	cin >> n >> r;
	i=n;
	repeat(n-r){
		nfac=nfac*i;
		i=i-1;}
	repeat(r){
		rfac=rfac*l;
		l=l+1;
	}
	repeat(n-r){
		tfac=tfac*m;
		m=m+1;
	}
	t=(rfac*tfac);
	ncr=nfac/tfac;
	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: 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;
int p;
int q;
int     s;
int g;
int a=1;
int b=1;
 cin>>n;
 cin>>r;
 g=(n-r);
 
 repeat(r-1){
	p=(n); 
	 n--;
	 
         a=a*p;
 }
 repeat(r-1){
	 q=r;
	 r--;
	 b=b*q;
 }

s=(g*a)/b;

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: 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,s1=1,s2=1,i=1,j=2;
int r;

cin>>n>>r;

if(r%2==0){

repeat(r/2){

s1=s1*(n-i+1)/i;

i=i+2;
}

repeat(r/2){

s2=s2*(n-j+1)/j;

j=j+2;
}
}
else{

repeat((r+1)/2){

s1=s1*(n-i+1)/i;

i=i+2;
}

repeat((r-1)/2){

s2=s2*(n-j+1)/j;

j=j+2;
}
}

cout<<s1*s2;
}

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,t=1; cin >>n>>r;
 

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

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,i,j,k;
	long double fac_n,fac_r,fac_nr;
	float c;
	cin>>n>>r;
         i=1;
	 j=1;
		 k=1;
		 fac_r=1;
		 fac_nr=1;
         fac_n = 1;

	repeat(n){
		fac_n=fac_n*i;
		i++;
	}
	repeat(r){
		fac_r=fac_r*j;
		j++;
	}
	repeat((n-r)){
		fac_nr=fac_nr*k;
		k++;
	}
	c=fac_n/(fac_r*fac_nr);
	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