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,i,j,nCr=1;
cin>>n>>r;
i = r;
j = n;

while(i>=1){

	nCr = nCr*(j/i);
	j = j - 1;
	i = i - 1;

}

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>
main_program
{
	long double n,r;
	cin>>n>>r;
	int i=0;
	long double s=1;
	long double num=n,den=r;
	/*while(i<=r-1)
	{
		s=s*((num)/(den));
		num = n-i;
		den= r-i;
		i++;
		cout<<i<<"\n"<<s<<"\n";
	}*/
	while(i<=r-1)
	{
		num=num*(n-i);
		den=den*(r-i);
		i++;
		cout<<i<<"\n"<<num<<"\n";

	}
	s=num/den;


	cout<<s;




}

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 product =1.0;

	for(long double i = 0; i < r; i++){
		product *= (n-i)/(r-i);
	}

	cout << product;

}

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;
	long double denominator=1;
	long double numerator;
	long double product;
	long double i=1;

	cin >> n >> r;

	product = n;

	while (i<n-r){
		product = product*(n-i);
		i = i+1;
	}

	numerator = product;

	for(int k=1;k<=n-r;k++){
		denominator = denominator*k;
	}

	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:
k

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 m=1;
        long double q=1;
        if(r>n/2){r=n-r;}
        while(q<=r){
                m=m*((n-q+1)/q);
                q=q+1;

        }
        cout<<m;
}

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 c=n-r;
	long double prod1=1,prod2=1;
	if(c>(n/2)){
	repeat(r){
		prod1*=n;
		n--;
	}
	repeat(r){
		prod2*=r;
		r--;
	}
	}
	else{
	repeat(c){
		prod1*=n;
		n--;
	}
	repeat(c){
		prod2*=c;
		c--;
	}
	}
	cout<<prod1/prod2<<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;
	cin>>n>>r;
	int k=min(r,(n-r));
        int q=k;
	//int i=n;
	//int j=k;
	double result=1;
	repeat(q)
	{
		result*=n*1.0/k;
		n--;
		k--;
	}
	cout<<result;
}

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

int n,r;
cin>>n>>r;

long double n1=n;

long double r1=r;
long double fact=1.0;
long double i1=1.0;
for(int i=1; i<=r;i++)
{
	i1=i;
	fact=fact*((n1-r1+i1)/i1);

}
cout<<fact;





}

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 num = 1;
long double denom = 1;
if(r > n-r){
for(int i = n; i > r; i--){
num *= i;
}
for(int j = 1; j <=n-r; j++){
denom *= j;
}
cout << num/denom;
}

else{
for(int i = n; i > n-r; i--){
num *= i;
}
for(int j = 1; j <= r; j++){
denom *= j;}
cout << num/denom;
}
}

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 long int n, r;
	cin >> n >> r;
	long double ans = 1;
	if(r <= n - r){
		for(long long int i = 1; i <= r; i++){
			ans *= (n + 1 - i);
			ans /= i;
		}
	}else{
		for(long long int i = 1; i <= n - r; i++){
			ans *= (n + 1 - i);
			ans /= i;
		}
	}
	cout << ans << "\n";
}

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 ans = 1;
	int ctr=1;
	int numy=n-r+1;

	repeat(r) {
		ans = ans * (numy*1.0/ctr*1.0);
		numy++;
		ctr++;

	}

	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{
long double n,r;
cin>>n>>r;
long double x=1;
int i=r+1,j=1;
while(j<=(n-r )){

x=x/j;
j++;

}

while(i<=n ){

x=x*i;
i++;

}

cout<<x;

}

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 p,i,j,k,a=1.00,b=1.00,c=1.00,result;

       	
	cin>>n>>r;
	p=n-r;
	for(i=1;i<=n;i++)
	{ a=a*i;}
	  for(j=1;j<=r;j++)
	  { b=b*j;
	  }
	  for(k=1;k<=p;k++)
	  { c=c*k;
	  }
	  result=a/(b*c);
	  cout<<result;
}

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 c=1;

	cin >> n >> r;

	if(n*0.5<=r )
		r=n-r;

	repeat(r){
		c=c*n*1.0/r;
		n--;
	       	r--;
	}
	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;
	cin >> n >> r;
	long double tot = 1;
	if(r<n/2){
		r = n-r;}
	for(long double i=0;i<(n-r);i++){
		tot *= (n-i)/(i+1);}
	cout << tot;
}

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 >> r ; 

	long double answer = 0 ;

	long double a =  r + 1 ;
       	long double b = 1 ; 
//	float double c = 1 ; 	
		
	long double numerator ; long double denominator ; 

	for( int i =(  r + 1)  ; i <= n ; i++ ) {
		
		numerator = a ; 
		 
	//	cout << numerator << endl ;	

		a = a *( i + 1) ; 

	
	}

	for(int i = 1 ; i <=( n - r) ; i++ ){
		
		denominator = b ;  
	        
		b = b *( i + 1 ) ; 	
	}
	
	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{
	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: 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 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: 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 c = 1;
	cin >> n >> r;
	int i = 1;
	repeat(r) {
		c=c*(n-i+1);
		c=c/i;
		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,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: 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,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: 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;
	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: 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