CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program{

       int year,day,r;
       cin>>year>>day;
           if(year%4==0){
		   if(day==1){
			   cout<<"Month 1:"<<" ";
                             repeat(4){
			     
			     r=day+6;
			     cout<< r<<" ";
			      
			     day+=7;
			     
			     }}
		   else{

			     if(day==2){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day+4;
                             cout<< r<<" ";

                             day+=7;

                             }}
			     else{
			     if(day==3){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day+2;
                             cout<< r<<" ";

                             day+=7;

                             }}
			     else{
			     if(day==4){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day;
                             cout<< r<<" ";

                             day+=7;

                             }}
			     else{
			     if(day==5){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day-2;
                             cout<< r<<" ";

                             day+=7;

                             }}
			     else{
			     if(day==6){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day-4;
                             cout<< r<<" ";

                             day+=7;

                             }
			     }
			     else{
			     if(day==7){
                           cout<<"Month 1:"<<" ";
                             repeat(4){

                             r=day-6;
                             cout<< r<<" ";

                             day+=7;

                             }
                              
		   }
			     }
			     }
			     }
			     }
			     }
		   }
}
























}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program{ int N,d,i;
	cin>>N>>d;
	if((N%4 =0 && N%10!=0)||(N%400=0 && N%10=0))
	{

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include <iostream>
using std::cout;
using std::cin;

int main(){
	int year, day;
	cin >> year >> day;

	bool isleap=true;
	if (year%4==0){
		if (year%100==0){
			if(year%400==0){
				isleap=true;
			}
			else{
				isleap=false;
			}
		}
		else { 
			isleap=true;
		}
	}
	else{
		isleap=false;
	}
	
	int month=1, sun, maxday, newsun=8-day;
	for (month=1; month<=12; month++){
		if (month==2 && isleap==true){
			maxday=29;
		}
		else if (month ==2 && isleap==false){
			maxday=28;
		}
		else if (month==4 || month==6 || month==9 || month==11){
			maxday=30;
		}
		else {
			maxday=31;
		}
		cout << "Month " << month << ": ";
		for (sun=newsun; sun <= maxday; sun+=7){
			cout << sun << " ";
		        newsun=sun;
		}
		newsun=newsun+7-maxday;
		cout << "\n";
	}
	
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program{
	int N,d,c;
	cin>>N>>d;
	
	for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
	for(c=8-d+4;c<=28;c+=7){cout<<c<<" ";}
for(c=8-d+4<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}
for(c=8-d;c<=31;c+=7){cout<<c<<" ";}	

	







}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
int main() {
int y,d;
cin>>y>>d;
cout<<"Month 1: 7 14 21 28"<<endl<<"Month 2: 4 11 18 25"<<endl<<"Month 3: 4 11 18 25:"<<endl<<"Month 4: 1 8 15 22 29"<<endl<<"Month 5: 6 13 20 27"<<endl<<"Month 6: 3 10 17 24"<<endl<<"Month 7: 1 8 15 22 29"<<endl<<"Month 8: 5 12 19 26"<<endl<<"Month 9: 2 9 16 23 30"<<endl<<"Month 10: 7 14 21 28"<<endl<<"Month 11: 4 11 18 25"<<endl<<"Month 12: 2 9 16 23 30"
;
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<iostream>
using namespace std;
int main(){
	int y,d,a=0,m,x;
	cin>>y>>d;
	if(y%100==0){
		if(y%400==0){
			a=1;
		}
		else{a=2;}
	}
	else if(y%4==0){
		a=1;
	}
	else{
		a=2;
	}
	for(int i=1;i>1;i++){
	        x=1;
		m=i;
		while(d!=7){
			d=d+1;
			x=x+1;
		}
		if(m==2){
			if(a==1){
				cout<<"Month"<<i;
		         for(int a=0;a<5;a++){
			cout<<x;
			x=x+7;
			}
			d=29-x;
			}
			else{
			for(int a=0;a<5 ;a++){
                        cout<<x;
                        x=x+7;
			}
                        d=28-x;
			}
		}
		if(m==1|| m==3 || m==5 ||m==7 || m==8 || m==10 || m==12){
			cout<<"Month"<<i;
                        for(int a=0;a<5 ;a++){
                        cout<<x;
                        x=x+7;
			}
                        d=31-x;
		}
		else{
			cout<<"Month"<<i;
                        for(int a=0;a<5 ;a++){
                        cout<<x;
                        x=x+7;
			}
                        d=30-x;
		
		}
	}
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program{
	int y,f,d;
	cin>>y>>f;
	int r=8-f;
	for(int i=1;i<13;i++){
		cout<<"month "<<i<<": ";
		for( ;r>0;r+=7){
			if(i==2){
				if(y%4!=0||y%400!=0) d=28;
				else d=29;
			}
			else if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) d=31;
			else if(i==4||i==6||i==9||i==11) {d=30;}
			if(d-r>=7){
				cout<<r<<" ";
			}
			else {
				break;//cout<<endl;
			}
		}
		cout<<endl;
	}
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program{
	int y, d;
	cin >> y >> d;
	bool isLeap;

	if(y %4 == 0){
		if(y%100 == 0){
			if(y%400 == 0){
				isLeap = true;
			}
			else{
				isLeap = false;
			}
		}
		else{
			isLeap = true;
		}
	}
	//cout << isLeap << endl;
	int month = 1, fs;
	while(month <= 12){
		int dom, date = 1;
		if ( month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){
			dom = 31;
		}
		else if( month == 4 || month == 6 || month ==9 || month == 11){
			dom = 30;
		
		}
		else if(isLeap){
			dom = 29;
		}
		else{
			dom = 28;
		}

		cout << "Month " << month << ":";
		fs = 7 - d + date;
		repeat(dom){
			if( (date-fs)%7 == 0){
				cout << " " << date;
			}
			date++;
			d++;
		}
		cout << endl;
		month++;
	}
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program {
	int N,d;
	cin >> N >> d;
	int m = 1,x=8-d;
	repeat(12)
	{
		if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
		{
			cout << "Month " << m << ": ";
			while(x<=31)
			{
		                cout << x<<" ";
				x = x+7;
			}
		cout<<endl;
		if(x!=31) x = x-31;
		else x = 7;
		}
		else if(m!=2)
		{
			cout << "Month " << m << ": ";
			while(x<=30)
			{
				cout << x<<" ";
				x = x+7;
			}
		cout<<endl;
		if(x!=30) x = x-30;
		else x = 7;
		}
		else
		{
			if(N%100!=0)
			{
				if(N%4==0)
			{
				cout << "Month " << m << ": ";
				while(x<=29)
				{
					cout << x<<" ";
					x = x+7;
				}
			if(x!=29) x = x-29;
			else x = 7;
			}
				else
                        {
                                cout << "Month " << m << ": ";
                                while(x<=28)
                                {
                                        cout << x<<" ";
                                        x = x+7;
                                }
                        if(x!=28) x = x-28;
                        else x = 7;
                        }
			}
			else
			{
				if(N%400==0)
                        {
                                cout << "Month " << m << ": ";
                                while(x<=29)
                                {
                                        cout << x<<" ";
                                        x = x+7;
                                }
                        if(x!=29) x = x-29;
                        else x = 7;
			}
			else
			{
				cout << "Month " << m << ": ";
				while(x<=28)
				{
					cout << x<<" ";
					x = x+7;
				}
			if(x!=28) x = x-28;
			else x = 7;
			}
			}
			
		cout << endl;
		}
	m++;
	}
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include <simplecpp>

main_program{
    int year, d;

    cin>>year>>d;

    int sun;

    if(d == 1){
        sun = 7;
    } else if(d == 2){
        sun = 6;
    } else if(d == 3){
        sun = 5;
    } else if(d == 4){
        sun = 4;
    } else if(d == 5){
        sun = 3;
    } else if(d == 6){
        sun = 2;
    } else{
        sun = 1;
    }

    // now we know when is the first sunday;

    int days;

    

for(int month = 1; month<13; month++){

    if(month == 1){
        days = 31;
    } else if (month == 2){
            if(year%4 == 0){
                if(year%400 == 0){
                    days = 29;
                } else {
                    days = 28;
                }

            } else if(year%4 !=0) { 
                
                days = 28;
            }
    } else if (month == 3){
        days = 31;
    } else if (month == 4){
        days = 30;
    } else if (month == 5){
        days = 31;
    } else if (month == 6){
        days = 30;
    } else if (month == 7){
        days = 31;
    } else if (month == 8){
        days = 31;
    } else if (month == 9){
        days = 30;
    } else if (month == 10){
        days = 31;
    } else if (month == 11){
        days = 30;
    } else if (month == 12){
        days = 31;
    }

    cout<<"Month "<<month<<": ";
    while(sun<= days){

        cout<<sun<<" ";
        sun = sun + 7;
    }

    sun = sun -days;

    cout<<endl;

}


    
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program {
	int = iMonth 1: 7 14 21 28 

Month 2: 4 11 18 25 

Month 3: 4 11 18 25 

Month 4: 1 8 15 22 29 

Month 5: 6 13 20 27 

Month 6: 3 10 17 24 

Month 7: 1 8 15 22 29 

Month 8: 5 12 19 26 

Month 9: 2 9 16 23 30 

Month 10: 7 14 21 28 

Month 11: 4 11 18 25 

Month 12: 2 9 16 23 30 
		repeat(2029 1);Month 1: 4 11 18 25 

Month 2: 1 8 15 22 

Month 3: 1 8 15 22 29 

Month 4: 5 12 19 26 

Month 5: 3 10 17 24 31 

Month 6: 7 14 21 28 

Month 7: 5 12 19 26 

Month 8: 2 9 16 23 30 

Month 9: 6 13 20 27 

Month 10: 4 11 18 25 

Month 11: 1 8 15 22 29 
                    repeat(2026 4);
}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: B