CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
while(n>0){
if(n%10==0){n=n/10;}
if (n%10!=0){
cout<<(n%10);
n= (n-(n%10))/10;}
}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
#include <cmath>

using namespace std;

int main() {

	int n;

	cin >> n;

	int nrev = 0, nc = n;

	int d = 0;

	while (nc > 0) {

		d++;
		nc /= 10;

	}

	for (int i = 0; i < d; i++) {

		nrev += (n % 10) * pow(10, d - i - 1);
		n /= 10;

	}

	cout << nrev;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
  using namespace std;
 int main(){
 int n,x,y;
 cin>>n;
  int a=n/1000;
  int b=(n/100)%10;
  int c=(n/10)%100 ;
  int d=n%10;
  cout<<d;
  if(c>0) cout<<c;
  if(b>0) cout<<b;
  if(a>0) cout<<a;







}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int y=1,i,n,m,x=10;
cin>>n;
m=n%10;

while((n/10)!=0){
y++;
}
for(i=1;i<y;i++){
x=x*10;
m=m*10+((m%x)/x)*10;
}
cout<<m;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <simplecpp>
main_program{
int n,m,i;
cin>>n;
i=0;
bool flag1;
m=n;
while(n>0){
flag1 = m%10==i;
if(!flag1) break;
m=m/10;}

n=m;
for(i=n;i>0;i=i/10){
int a;
a= n%10;
cout<<a;
n=n/10;};
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>

using namespace std;

int main()
{

 int n,m=0;
 cin>>n;

 int d;

 while(n>0)
 {
   d=n%10;
   m=m*10 +d;
   n=n/10;
 }

 cout<<m;
 return 0;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;

int main(){
 int n,reverse=0,rem;
cin>>n;
while(n!=0){
     rem=n%10;
     reverse=reverse*10+rem;
     n/=10;}
     cout<< reverse<< endl;
     return 0;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>
main_program{
	int a,b=0;
	cin >> a;
	while(a!=0){
		b=b*10 + (a%10);
		a=a/10;
	}
	cout << b;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,m=0,d=0,p=1;
cin>>n;
for(int digits=0;n/(int)(pow(10,digits))>=1;digits++){d=digits;};
while(p<d+1){
m=n/(int)pow(10,d);
m=m+(n/(int)pow(10,d-p)*10-(n/(int)pow(10,d-p+1))*(int)pow(10,p));
p++;
}
cout<<m;}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
while(n%10==0){n=n/10;}
int m=0;
while(n>0){
int k;
k=n%10;
m=m*10+k;
n=n/10;}
cout<<m;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n,d=1,r=1,dig;
	cin>>n;
	if(n==1) cout<<d;
	for(int i=1;d<=n;i++){
			d=pow(10,i);
			r=pow(10,i-1);
			dig=(n%d-n%r)/(pow(10,i-1));
			if(dig!=0)cout<< dig;
			}
	
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,m,k;
int r; cin>>n;r=n%10;
if(r!=0){
while(n>0){
r=n%10;
n=n/10;
cout<<r;
}
}
if(r==0){
while(r==0){
m=n=n/10;
k=r=n%10;}
while(m>0){
k=m%10;
m=m/10;
cout<<k;}


}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;

int main() {
	int n; cin >> n;
	int j = n;
	int m = 0;
	while (j!=0) {
		m = m*10 + j%10;
		j/=10;
	}
	cout << m;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int m =(n/10);
 int q =(n-m);
int a=n/100;
int b=(n-a)/10;
int c=n-(a+b);
int d=n/1000;
int e=(n-d)/100;
int f=(n-(d+e))/10;
int g=n-(d+e+f);
 if (n<10)
 cout<<n;

 else if (n<100) 
 cout<<q<<m;

 else if (n<1000) 
cout<<c<<b<<a;

else if (n<10000) 
cout<<g<<f<<e<<d;

return 0;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>
main_program{


int m,rem,reverse_number=0;
cin>>m;

while(m!=0){
rem=m%10;
  if(rem==0)
  cout<<"";
  if(rem!=0){
  reverse_number=reverse_number*10+rem;
  }
m=m/10;
} 

cout<<reverse_number;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;

int main(){

int n;
cin>>n;
int y=n;
int m=0;
int i=0;
while(n>0){
		n=(n-n%10)/10;
		i++;    }
int x=i;
int k=1;
n=y;
while(k<=x){
		m=m+(n%10)*pow(10,i-1);
		n=(n-n%10)/10;
		i--; k++;     }

cout<<m;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>
main_program{
	//declearing variables and taking input
	int n,m=0,digit=0;
	cin>>n;
	while (n>0){
		if (n%10 !=0){
			digit = n%10;
			m = m*10 +digit ;
			n /=10;
		}else{
			n /=10;
			continue;
		}
	}//output
	cout<<m;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n;
m = left(n);
cout<<"m";
return 0;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
  int n,m=0,rem;
  cin>>n;
  while(n/10>0){
    rem=n%10;
    m=m*10+rem;
    n=n/10;
   }
  cout<<m*10+n;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <simplecpp>
main_program {
	int n,m=0,nd=1; cin>>n;
	for(int i=n;i>0;i=i/10){
		nd=nd*10;
	}
	nd=nd/10;
	for(int i=n;i>0;i=i/10){
		int d=n%10;
		n=n/10;
		m=m+d*nd;
		nd=nd/10;
	}
	cout<<m;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n;
m=0;
while(n>0){
m=10*m+(n%10);
n=n/10;


}
cout<<m;

}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int m;
m=0;
int r;
r=n;
while(r>0)
{
m=m*10+r%10;
r=r/10;
}
cout<<m;
return 0;}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n,k=0,m=0,b=0;cin>>n;
  k=log10(n)+1;
  for(int i=0;i<k;i++){
  b=n%10;if(b!=0){cout<<b;}
  m=m+b*(pow(10,n-i-1));
  n=n/10;}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
using namespace std;

int main(){
int k;
cin>>k;

while(k%10 == 0){
    k=k/10;
}
int digit,number=0,m=1,n=10;
while(k/n != 0){
    n=10*n;
    m++;
}

for(int i=1; i<=m; i++)
{
    digit=k%10;
    k=k/10;
    number=number*10+digit;
}
cout<<number;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,m=0,digit;
cin>>n;
while(n>0)
{
 digit=n%10;
 n=n/10;
 if (m==0)
{
  if(digit==0) continue;
}
 m=m*10+digit;
}
cout<<m;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
	
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
int main(){
int n;
std::cin>>n;
while(n%10==0){n=n/10;}
while(n>0){std::cout<<n%10;n=n/10;}}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A