Language: C++

#include <iostream>
#include <string>

using namespace std;

class Num{

	//string s0;
	//int inum;
	int N0;
	//int icase;
	int icount;
	int* pn;
	int isign;
	int isign0;
	__int64 itotal;
	
	
	
public:
	Num(int);
	Num();
	
	void output() const;
	void input();
	
	int checksign();
	
	int getsign0() const;
	int getN0() const;
	void sort0();
	void test() const;
	int add(int);
	__int64 add0();
	__int64 add1();
	
	~Num();
};



Num::Num(int itemp){N0=itemp;pn=new int[N0];}
Num::Num(){}


void Num::input(){
	//cout<<"inum?"<<endl;
	//cin>>inum;
	for(icount=0;icount<N0;icount++){

	//cout<<"icount="<<icount<<endl;
	cin>>pn[icount];
}

}

void Num::output() const{
	for(int icount1=0;icount1<N0;icount1++){

	//itemp=pn[icount].output();
	//cout<<"itemp="<<itemp<<endl;
	cout<<"pn["<<icount1<<"]="<<pn[icount1]<<endl;
}
	//return inum;

}	

int Num::checksign(){
	isign=0;
	isign0=0;
	
	for(icount=0;icount<N0;icount++){
		if(pn[icount]<0){isign++;}
		else if(pn[icount]==0){isign0++;}
									}
	return isign;
}

void Num::test() const{cout<<"hogehoge"<<endl;}

void Num::sort0(){
				bool b0=1;
			while(b0==1){
				b0=0;
				//cout<<"ho0ge"<<endl;
				for(icount=0;icount<N0-1;icount++){
					if(abs(pn[icount])>abs(pn[icount+1])){
												int itemp0=pn[icount];
												pn[icount]=pn[icount+1];
												pn[icount+1]=itemp0;
												b0=1;
												
												
												}
					else{}
					
				}//end for
				
				//output();
				//cout<<"b0="<<b0<<endl;
				//cout<<"-----"<<endl;
				
				}//end while
					//return 0;
					}//end function
					
					
int Num::add(int itemp){
				itotal=0;
				for(icount=itemp;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}

__int64 Num::add0(){
				itotal=0;
				for(icount=0;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}//end add0

__int64 Num::add1(){
				itotal=0;
				for(icount=1;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				itotal=itotal-abs(pn[0]);
				return itotal;

}//end add1

int Num::getsign0() const{return isign0; }
int Num::getN0() const{return N0; }		

Num::~Num(){delete [] pn;}




void main(){
	//int i0=12;
	int N0;
	//int icount;
	//int itemp;
	int isign,isign0;
	__int64 itotal0;
	//int isign0;
	
	
	//cout<<"N0?"<<endl;
	cin>>N0;
	
	Num n0(N0);
	n0.input();
	//n0.output();
	isign=n0.checksign();
	isign0=n0.getsign0();
	//isign0=n0.checksign0();
	
	//cout<<"isign="<<isign<<endl;
	//cout<<"isign0="<<isign0<<endl;
	//cout<<"N0="<<n0.getN0()<<endl;



	n0.sort0();
	//n0.test();
	//n0.output();
	
if(isign0!=0){

				itotal0=n0.add0();
}
else if(isign%2==1){

				itotal0=n0.add1();
}

else {

				itotal0=n0.add0();
}


			//cout<<"itotal="<<itotal0<<endl;
			cout<<itotal0<<endl;
}

Compiler output:
a.cc:16:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 |         __int64 itotal;
      |         ^~~~~~~
      |         __int64_t
a.cc:34:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   34 |         __int64 add0();
      |         ^~~~~~~
      |         __int64_t
a.cc:35:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   35 |         __int64 add1();
      |         ^~~~~~~
      |         __int64_t
a.cc: In member function 'int Num::add(int)':
a.cc:109:33: error: 'itotal' was not declared in this scope
  109 |                                 itotal=0;
      |                                 ^~~~~~
a.cc: At global scope:
a.cc:119:1: error: '__int64' does not name a type; did you mean '__int64_t'?
  119 | __int64 Num::add0(){
      | ^~~~~~~
      | __int64_t
a.cc:130:1: error: '__int64' does not name a type; did you mean '__int64_t'?
  130 | __int64 Num::add1(){
      | ^~~~~~~
      | __int64_t
a.cc:150:1: error: '::main' must return 'int'
  150 | void main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:156:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
  156 |         __int64 itotal0;
      |         ^~~~~~~
      |         __int64_t
a.cc:182:33: error: 'itotal0' was not declared in this scope
  182 |                                 itotal0=n0.add0();
      |                                 ^~~~~~~
a.cc:182:44: error: 'class Num' has no member named 'add0'; did you mean 'add'?
  182 |                                 itotal0=n0.add0();
      |                                            ^~~~
      |                                            add
a.cc:186:33: error: 'itotal0' was not declared in this scope
  186 |                                 itotal0=n0.add1();
      |                                 ^~~~~~~
a.cc:186:44: error: 'class Num' has no member named 'add1'; did you mean 'add'?
  186 |                                 itotal0=n0.add1();
      |                                            ^~~~
      |                                            add
a.cc:191:33: error: 'itotal0' was not declared in this scope
  191 |                                 itotal0=n0.add0();
      |                                 ^~~~~~~
a.cc:191:44: error: 'class Num' has no member named 'add0'; did you mean 'add'?
  191 |                                 itotal0=n0.add0();
      |                                            ^~~~
      |                                            add
a.cc:196:31: error: 'itotal0' was not declared in this scope
  196 |                         cout<<itotal0<<endl;
      |                               ^~~~~~~