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 n, r;
	cin>>n;
	cin>>r;
	long a=n; 
	long b=r;
	double long adi=1;
	double long adi2=1;

	repeat(r){

		adi=adi*a*1.0/(b);
		a--;
		b--;
	}

	b=r;

	repeat(n-r){

		adi2=adi2*a*1.0/(n-b);
		a--;
		b++;
	}

	cout<<adi*adi2;
}

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 b=n;
	long double d=n-r;
	long double a=1;
	long double c=1;
	for(int i=1; i<=n-r; i++)
	{
		a=a*b;
		--b;
		c=c*d;
		--d;
	}
	long double ans=(a/c);
	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 c=1;
long double n,r;
int t=1;
while(t==r){
c*=(n-t+1)/t;
t=t+1
}
}

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;
	long double output=1;
	cin>>n>>r;
	long double a=n-r;

	while(n!=r){
	output*=(n/a);
	n--;
	a--;
	}
	cout<<output;
}

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 binom=1;
	
	if(r<n/2)
		r=n-r;
	
	int i=n-r;
	while(i>0){
		binom*=(n-i);
		binom/=(i);
		
		i--;
	}
	binom=(binom*n)/r;

	cout<<binom;// this code can only handle a difference in inputs of about // 3600 or so,after that it overflows into inf.
}

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,b=1,r,n;
	cin>>n>>r;
	while(b<r){
		n=n*(n-b);
		b++;}
	b=r-1;
a=r;
	while(b>0&&b<=r-1){
		a=a*b;
		b--;}
	cout<<n/a;
}

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>
long double c=1 ;
int n,r,a ;

main_program{
	cin>>n >>r ;
	for(a=1;a<=r;a++){
	        c=c/a;
		c=sqrt(c*(n-a+1));
//did this to keep c minimum

	        c=c*c;}
		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 long unsigned  int n,r,k=1;

 cin>>n>>r;
if(1<=n && n<=3500 & 1<=r && r<=n){
while(r>0){
k=(k*(n-r+1)/r);
r--;


}
cout<<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, j =1;
long double result = 1;

cin >> n >> r;

while(j <= r){
result = result * ((n - r + j)/j);
j++;
}
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{
	long double n,r;
	cin>>n>>r;
	long double a=n-r;
	long double b=1;
	while(n!=r){
		b=b*n;
		n--;
	}
	long double c=1;
	while(a!=1){
		c=c*a;
		a--;
	}
	cout<<(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{
	double n,r;
	cin>>n>>r;
	long double show=1;
	if(r<=n/2){
	for(int i=0;i<r;i++){
		long double div=(n-i)/(i+1);
		show=show*div;}}
	else{
	for(int i=0;i<n-r;i++){
		long double div=(n-i)/(i+1);
		show=show*div;}}
	
	
	
	cout<<show;
}

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 unsigned int n;
	long long unsigned int r;
	cin >> n >> r;
	long double num = 1;
	long double denom = 1;
	if(r>=n/2){
		r = n-r;
	}
	for(long long unsigned int i=n;i>=n-r+1;i--){
		num *= i;
	}
	for(long long unsigned int i=1;i<=r;i++){
		denom *= i;
	}
	long double ncr =num/denom;
	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,p=1;
	cin>>n>>r;
	int t=n-r;
	repeat(t){
		p=n/t*p;
		n--;
		t--;
	}
	cout<<p;
}

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 mult=1 ,fac=1,r ,n,ncr;
	cin>>n>>r;
	long double a=n,diff=(n-r);
	repeat(n-r)
	{
		mult=mult*a;
		a--;
	}

	repeat(n-r)
	{
		fac=fac*diff;
		diff--;
	}

	ncr= mult/fac;
	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, r;
    cin>>n>>r;
    long double ans = 1.0;
    if(r>n-r) {
        r = n-r;
    }

    for (int i = 0; i < r; i++){
        ans *= 1.0*(n-i)/(i+1);
    }
    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 x=1,n,r,i=0;
	cin>>n>>r;
	repeat(r){
		x=x*(n-i)/(r-i);
		i=i+1;
	}
	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{
    long double n, r;
    cin>>n>>r;

    long double nCr=1;

    for( int i=0 ; i<=r-1 ; i++ ){

        nCr=nCr*(1+((n-r)/(r-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, r;
	cin >> n >> r;
	
	long double deno = 1;

	for(int times = n - r; times != 0; times--){
	
		deno *= times;
	
	}

	long double nume = 1;

	for(; n != r; n--){
	
		nume *= n;
	
	}

	cout << nume / 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 (r<=n/2){
                long double p=1;
                long double cnt=0;
                repeat(r){
                        p*=(n-cnt)/(cnt + 1);
                        cnt++;
                }
                cout<<p;
        }
        else {
                long double P=1;
                long double CNT=0;
                repeat(n-r){
                        P*=(n-CNT)/(CNT + 1);
                        CNT++;
                }
                cout<<P;
        }
}

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 a,x=1,y=1;
	a=n-r;
	if(r>a){
		for(n;n>r;n--){
			x=x*n;
		}
		for(int i=1; i<=a;i++){
			y=y*i;
		}
		cout<<x/y;
	}
	else{
		for(n;n>a;n--){
			x=x*n;
		}
		for(int i;i<=r;i++){
			y=y*i;
		}
		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{
	long double n, r, factorial1 = 1, factorial2 = 1, n_minus_r;
	cin >> n >> r;
	n_minus_r = n-r;
	if (n >= 1 && n <= 35000 && r >= 1 && n >= r ) {
		repeat (n_minus_r - 1){
			factorial1 = factorial1 * (n_minus_r);
			n_minus_r --;
			}
		while  (r < n){
			factorial2 = factorial2 * (r+1);
			r ++;
		}
		cout << factorial2/factorial1;
	}
	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 n,r;
	cin>>n>>r;
	double  p,k,z;
	    p=n;
	    k=r;
	    z=1;
	    while(p>0&&k>0){
                z=z*p/k;
	        p--;
	        k--;}
 
	    cout<<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{
	long double n,r,a;
	cin>>n>>r;

	if(n>=1&&n<=35000;){
		for(a=n;n--;)
	n = n*a;
	
}
//	while(r>=1&&r<=n){
//		r*=r-1;}
//	while(n>=1&&n<=35000){
//		(n-1)*=(n-2);
//	}
	cout<<n<<endl;
//	cout<<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{
	long double n,r;
	cin >> n >> r;
	
	int p;
	long double q=1;
	p=n-r;
	for(int a =p;a>=n; a++){
		q= q*p;
	}

			
		


	long double j;
	long double factoriala=1;
	j=n-r;
	for(int p=1;p<=j;p++){
		factoriala= factoriala*p;
	}
	cout <<q/factoriala;
}

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