CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include <simplecpp>
<iomanip>
std :: cout << std :: setprecision(6) << std :: fixed << ans
main_program{
    int n;
    cin >> n;
    cout << 1/n ;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
main_program
{
    int n,fac=1;
    float s=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        fac=fac*i;
        s=s- pow(-1,i)*((1.0)/fac);
    }
    std::cout<<std::fixed<<std::setprecision(6)<<s;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
# include <simplecpp>

float fac (int x) {
	float p=1;
	for (int i = x; i >=1; i--) {
		p = p*i;
	}
	return p;
}

main_program {
	int n; cin >> n;
	float sum = 0;
	for (int i = 1; i <= n; i++) {
		sum = sum + (pow(-1,(i+1)))/fac(i);
	}
	cout << sum << endl;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include <simplecpp>

int fact(int l){
    int c=1;
    for(int i=1; i<=l; i++){
       c=c*i;

    }
    return c;
}

int exp(int m, int n){
     int tmp=m;
    for(int i=1; i<n; i++){
      m*=tmp;

    }
    return m;
}

main_program{
int n;
int sum=0;
cin>> n;
for(int i=1; i<n; i++){
    sum = sum + (exp(-1,n+1))/(fact(i));

}
cout<<sum;
 

}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
main_program{
int n;
cin>>n;
float ans=0;
float y=1;    
for( int i= 1; i<=n ; i++){
y=y*i;

if(i%2 ==0){
    ans = ans - 1/y ;
}
else ans=ans+1/y;

}
std::cout<<std::setprecision(6)<<std::fixed<<ans;

}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
main_program
{
    float sum,fact;
    int N,i,c;
    cin>>N;
    for(c=1;c<=N;c++)
    {
        fact=1;
        for(i=c;i>=1;i--)
        {
            fact=fact*i;
        }
        if(c%2==0)
        sum = sum - (1/fact);
        else
        sum = sum + (1/fact);
    }
    cout<<sum;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
int ftrl(int a){
    int b=1;
    for (int i=1;i<=a;i++){
        b*=i;
    }
    return b;
}
main_program{
    int n;
    cin>>n;
    float sum=0;
    for (int j=1;j<=n;j++){
        sum=sum+(pow(-1,j-1)*(1.0/ftrl(j)));
    }
    cout << std::setprecision(6) << std::fixed << sum;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>

main_program{
float sum=0,term=1;
int  n;
cin>>n;
for (int i=1;i<=n;i++){
term=term*1/i;
sum=sum+pow(-1,i+1)*term;
}
std::cout<<std::setprecision(6)<<std::fixed<<sum;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include <simplecpp>
double factorial(int n);
double factorial(int n)
{
    double prod=1;
    for(int i=1; i<=n; i++)
    {
        prod*=i;
    } return prod;
}
main_program{
    double s=0;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        if(i%2==0)
        s-=1.0/factorial(i);
        else s+=1.0/factorial(i);
    }
    cout<<s;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
main_program{
    int n;
    cin>>n;
    float result;
    for(int i=1;i<=n;i++){
        int mul=1;
        for(int j=1;j<=i;j++){
            mul=mul*j;
        }
        float mul2=1.0/mul;
        if((i%2==0))
            result=result-mul2;
        else
            result=result+mul2;
    }
    cout<<fixed<<setprecision(6)<<result;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<iostream>
#include<iomanip>
int main(){
    int N,frac=1;float ans=0,sign=1;std::cin>>N;
    for(int i=1;i<=N;i++){
        frac*=i;
        ans+=sign/frac;
        sign*=-1;
    }
    std::cout<<std::setprecision(6)<<std::fixed<<ans;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>

int fact(int a){
    if(a==1) return 1;
    int f=1;
    for(int k=2;k<=a;k++) f=f*k;
    return f;
}
main_program {
    int n,j=1;
    cin >> n;
    float s=0.0;
    for(int i=1;i<=n;i++){
        s=s+1.0/fact(i)*j;
        j=j*-1;
    }
    cout << setprecision(6) << fixed << s;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
main_program {
    float n;
    cin >> n;
    float r=0;
    int q=1;
    while(n>0){
        float factorial=1,p=n,a=1;
        while(p>0){
            factorial=factorial*p;
            p--;
        }
        r=r+((a/factorial)*q);
        q=q*(-1);
        p++;
        n--;
    }
    std::cout << std::setprecision(6) << std::fixed << r;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>


float fac(int a) {
    int f=1;
    for(int i=1;i<=a;i++) {
        f=f*i;
    }
    return f;
}
main_program {
    int n;cin>>n;
    float ans=0.0;
    float b;

    for (int i=1;i<=n;i++) {
        b=pow(-1,i-1)*(1.0/fac(i));
        ans=ans+b;

    }
    std::cout<<std::setprecision(6)<<std::fixed<<ans;

}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
int factorial(int& n){
        int x , y;
        for (x=1,y=1;x<=n;x++){
                y=y*x;}
        return y;
}
main_program{
        int n,a;
        cin >> n;
        double ans=0;
        for(a=1;a<=n;a++){
                ans = ans + pow(-1,a+1)/(factorial(a)) ;
        }
        std::cout << std::setprecision(6) << std::fixed << ans;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
main_program
{
    int n;
    double term=1.0,sum=1.0;
    cin >> n;
    if(n == 1) cout << term << endl;
    else{
        for(int i =1;i <=(n-1);++i)
        {
            int tp;
            tp = i+1;
            term = term * (-1)/tp;
            sum = sum +term;
        }
        cout << sum << endl;
        }
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>
double factorial( int a){
    float fact=1;
    while(a!=0){
        fact=fact* a;
        a--;
    }
    return fact;
}

double sum(int &n){
    double ans=0;
    int temp=n;
    for(int i=1; i<=n && temp!=0; i++ , temp--){
        double b= factorial(temp);
        ans= ans + pow(-1, i+1)* 1/(b) ;
    }
    return ans;
}
main_program{
 int n;
 cin>>n;
 std::cout<<std::setprecision(6)<<std::fixed<< sum(n);
 
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
main_program{
    int n,sum=0;
    cin>>n;
    if(1<=n<=15){
      for(int i=1;i<=n;i++) {
        sum= sum +((-1)^n)/n!
      }
    }
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
#include<iomanip>

float factorial(int a)
{
    float f=1;
  for(int j=1;j<=a;j++)
  {
    f=f/j;
  }
 return f;
}

main_program
{
    int N;
    cin>>N;
    float ans=0;
    for(int i=1;i<=N;i++)
    {   
     
        if(i%2==1)
        {
        ans=ans+factorial(i);
        }
        else
        {
            ans=ans-factorial(i);
        }
    }
    std::cout << std::setprecision(6) << std::fixed << ans;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: You are given an infinite alternating series:
1-1/2!+1/3!-1/4!+1/5!  ... 
Your task is to compute the sum of the first N terms of this series. The series alternates in sign, with each term involving the reciprocal of a factorial.

Example: If n = 1, the n terms of the series is just 1. Hence, answer is 1.000000

Input Format: A single positive integer N where 1 ≤ N ≤ 15.

Output Format
	A single floating-point number representing the sum of the first N terms of the series, rounded to exactly 6 decimal places. 
	To print exactly six digits after the decimal point, write std::cout << std::setprecision(6) << std::fixed << ans;. Here we assume that the answer is stored in variable ans.

Student submission:
#include<simplecpp>
main_program{
    int n,k= -1, fact=1;
    double p,t=0;
    cin>>n;
for(int i=1; i<=n; i++){
    fact *= i;
    p=1.0/fact;
    repeat(n-1){p*=k;}
    t += p;
}
cout<<t;
}

Grading criterion: Computation of factorial
Rating A: correctly computes factorial
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A