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 {

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

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

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,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: 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=1;
	 long double n_fac=1;
	repeat(n){
		n_fac*=i;
		i++;
	}

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

Grading criterion: 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 b=n-r;
	long long int factn=1;
	long long int factb=1; 
	long long int factr=1;
	long long int fact;
	while(n>0){
		factn=factn*n;
		n--;
	}
	while(b>0){
                factb=factb*b;
                b--;
        }
	while(r>0){
                factr=factr*r;
                r--;
        }
	fact=factn/(factr*factb);
	cout<<fact;


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

}

Grading criterion: 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 i=1;
	long double k=1;
	for(int a=r+1;a<=n;a++){
		i=i*a;
	}

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












}

Grading criterion: 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 res;
	cin >> n;
	cin >> r;
	int k;
	long double t = 1,p = 1;
	if (n-r < r) k = r;
	else k = n - r;
	for(int i = n; i >n- k;i--){
		t = t * i;
	}
	for(int i = 1; i <= k;i++){
		p = p * i;
	}
	res = t/p;
	cout << res;
}

Grading criterion: 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