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>
#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: Traversing of the loop
Rating A: correctly traverses the loop n times
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: Traversing of the loop
Rating A: correctly traverses the loop n times
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: Traversing of the loop
Rating A: correctly traverses the loop n times
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: Traversing of the loop
Rating A: correctly traverses the loop n times
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: Traversing of the loop
Rating A: correctly traverses the loop n times
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 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: Traversing of the loop
Rating A: correctly traverses the loop n times
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: Traversing of the loop
Rating A: correctly traverses the loop n times
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 fac(int n){
    int fact=1;
    for( ;n>0;n--){
        fact=fact*n;
    }
    return fact;
}
main_program{
    unsigned int N;
    cin>>N;
    double ans=1;
    for(int i=2;i<=N;i++){
        ans=ans-pow(-1,i)*(1.0/fac(i));
    }
    std::cout<<std::setprecision(6)<<std::fixed<<ans;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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 term1;
    for (int i<=1 i=0 i++){
        
    }
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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<iomanip>
#include<simplecpp>
main_program {
    int n;
    cin >> n;
    int fact=1;
    double ans=0;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=i;j++) {
            fact *=j;
        }
        if(i%2==0) 
            ans += -1/fact;
            else
            ans+= 1/fact;

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

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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 fact(int n){
    float f=1;
    for(int i=1;i<=n;i++){
        f*=i;
    }return f;
}
main_program{
    int n;
    cin>>n;
    double s=0;
    for(int i=1;i<=n;i++){
        double term=1.0/(pow(-1,i+1)*fact(i));
        s+=term;
        
    }
    cout<<setprecision(6)<<fixed<<s<<endl;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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;
    if (n==1)
   std::cout<<std::setprecision(6)<<std::fixed<<1.000000;
   else if (n==2)
   std::cout<<std::setprecision(6)<<std::fixed<<1-1/2;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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 <iomanip>
    cin >> int N;
    cout << std::setprecision(6) << std:: fixed << ans;
    if (N=1) { ans == 1;}
    else if (N=2) { ans== 1%2}
    else if (N=3) { ans == 2%3;}
    else if (N=4) { ans== 5%8;} 
    else if (N=5) { ans== 19%30}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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>
float ft(float a){
    float k=1;
    while(a>0){
        k=k*a;
        a=a-1;
    }
    return k;
}
float pw(float a){
    float p=pow(-1,a+1);
    return p;
}
main_program{
    float N;
    cin>>N;
    float s=0;
    while(N!=0){
        float f=ft(N);
        s=s+(pw(N))/f;
        N=N-1;
    }
    cout<<s;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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{
    unsigned int N,s=1,t=1;
    float ans=1;
    cin>>N;
    for (int i=1; i<=N;i++){
        while(i%2==0){
            for(int a=1; a<=i;a++){
                s=s*a;}
               break;
            }
        while(i%2!=2){
            for(int b=1;b<=i;b++){
                    t=t*b;}
                break;
            }
            ans=ans-1/s+1/t;
        } 
        std::cout << std::setprecision(6) << std::fixed<<ans;
    }

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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<iomanip>
std::cout<<std::setprecision(6)<<std::fixed<<ans;
main_program
{
    int n;
    float a;
    int i;
    for(i=2;i<=15;i++)
    repeat(n)
    a=1/i(i-1)
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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,i;
    cin>>n;
    double x;
    double t;
    float p;
    for(i=1,x=0;i<=n; i++){
        for(p=1;p<=i;p++)
            { p=1*p;}
     if(i%2==0){t=-(1/p);}
     if(i%2!=0){t=(1/p);}
      x= x+t;
}
std::cout<<std::setprecision(6)<<std::fixed<<x;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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 factorial(const int& n){
    int k=1;
    for(int i=1;i<=n;i++){
        k=k*i;
    }
    return k;
}
main_program{
    int n;
    cin>>n;
    float k;
    k=0;
    for(int i=1;i<=n;i++){
        float m=factorial(i);
        m=1/m;
        k=k+((m)*pow(-1,i-1));
    }
    std::cout<<std::setprecision(6)<<std::fixed<<k;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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 k=1;
    int i=1;
    for(;i<=n;i++){
        k = k*i;
    }
    return k;
}
main_program{
    int n;
    double k=0;
    cin>>n;
    for (int i=1 ;i<=n;i++){
        int x;
        x = factorial(i);
        k = k +pow(x,-1)*pow(-1,i+1);
    }
    std::cout<<std::setprecision(6)<<std::fixed<<k;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
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>
using namespace std;
int main() {
    int n, s=1; cin >> n;
    float sum=0;
    for (int i=1;i<=n;sum+=float((i%2)*2-1)/s, s*=++i);
    cout << fixed << setprecision(6) << sum << "\n";
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A