criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  
  int a, b, k; cin >> a >> b >> k;
  for(int i = 0; i < k; i++){
    if(a % 2 == 1) a--;
    if(b % 2 == 1) b++;
    
    ta = a / 2;
    tb = b / 2;
    a -= ta;
    b -= tb;
    a += tb;
    b += ta;
  }
  
  cout << a << " " << b << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'ta' was not declared in this scope; did you mean 'a'?
   11 |     ta = a / 2;
      |     ^~
      |     a
a.cc:12:5: error: 'tb' was not declared in this scope; did you mean 'b'?
   12 |     tb = b / 2;
      |     ^~
      |     b
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;


int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll a, b, k;cin >> a >> b >> k;
	REP(i, k){
		if(i % 2){
			if(b%2)b--;
			b /= 2;
			a += b;
		}
		else {
			cou = 0;
			if(a%2)a--;
			a /= 2;
			b += a;
		}
	}
	cout << a << " " << b << endl;
		
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: 'cou' was not declared in this scope; did you mean 'cos'?
   34 |                         cou = 0;
      |                         ^~~
      |                         cos
Language: C++

#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cout<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int a,b,k;

main(){
    cin>>a>>b>>k;
	rep(i,k){
		if(a%2)a--;
		if(b%2)b--;
		a/=2;
		b/=2;
		ca=a;
		a+=b;
		b+=ca;
	}
	cout<<a<<' '<<b<<endl;
}



Compiler output:
a.cc:9:9: warning: "INT_MAX" redefined
    9 | #define INT_MAX LLONG_MAX
      |         ^~~~~~~
In file included from /usr/include/c++/14/climits:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38,
                 from a.cc:5:
/usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition
  120 | #define INT_MAX __INT_MAX__
      |         ^~~~~~~
a.cc:47:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:54:17: error: 'ca' was not declared in this scope; did you mean 'a'?
   54 |                 ca=a;
      |                 ^~
      |                 a
Language: C++

#include <iostream>;
#include <vector>;
using namespace std;
int main() {
 int a,b,c,i; string name;
 cin >> a >> b >> k;
 i = 0;
 while (2 * k < 1) {
  if (i = 0) {
   a = (a - (a % 2)) / 2;
   b = b + a;
  }
  else {
   b = (b - (b % 2)) / 2;
   a = a + b;
  }
  i = (i + 1) % 2;
  k=k-1;
 }
 return 0; 
} 

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>;
      |                    ^
a.cc:2:18: warning: extra tokens at end of #include directive
    2 | #include <vector>;
      |                  ^
a.cc: In function 'int main()':
a.cc:6:19: error: 'k' was not declared in this scope
    6 |  cin >> a >> b >> k;
      |                   ^
Language: C++

#include <iostream>;
#include <vector>;
using namespace std;
int main() {
 int a,b,c,i; string name;
 cin >> a >> b >> k;
 i = 0;
 while (2 * k < 1) {
  if (i = 0) {
   a = (a - (a % 2)) / 2;
   b = b + a;
  }
  else {
   b = (b - (b % 2)) / 2;
   a = a + b;
  }
  i = (i + 1) % 2;
  k=k-1
 }
 return 0; 
} 

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>;
      |                    ^
a.cc:2:18: warning: extra tokens at end of #include directive
    2 | #include <vector>;
      |                  ^
a.cc: In function 'int main()':
a.cc:6:19: error: 'k' was not declared in this scope
    6 |  cin >> a >> b >> k;
      |                   ^
Language: Java

import java.util.Scanner;
class Main{
   public static void main(String[] args){
      Scanner sc=new Scanner(System in);
      int A=sc.nextInt();
      int B=sc.nextInt();
      int K=sc.nextInt();
      for(int i=1;i<=K/2;i++){
         A=A/2;
         B=(A+B)/2;
         A=(3A+B)/2;
     }if(K%2==1)
         A=A/2;
         B=A+B;
     }System.out.println(A+" "+B);
  }
}

Compiler output:
Main.java:4: error: ')' or ',' expected
      Scanner sc=new Scanner(System in);
                                   ^
Main.java:4: error: not a statement
      Scanner sc=new Scanner(System in);
                                    ^
Main.java:4: error: ';' expected
      Scanner sc=new Scanner(System in);
                                      ^
Main.java:11: error: ')' expected
         A=(3A+B)/2;
             ^
Main.java:11: error: not a statement
         A=(3A+B)/2;
              ^
Main.java:11: error: ';' expected
         A=(3A+B)/2;
                ^
Main.java:15: error: <identifier> expected
     }System.out.println(A+" "+B);
                        ^
Main.java:15: error: <identifier> expected
     }System.out.println(A+" "+B);
                          ^
Main.java:17: error: class, interface, enum, or record expected
}
^
9 errors
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int main() {
	int A, B, K;
    cin>>A>>B>>K;
	int C=A+B;
	int t=0;
	if(t==K){
		count <<A<<" "<<B<<endl;
	}
	else{
	if (t%2==0){
		A%=2;
		B=C-A;
		t++;
	} 
	else {
		B%=2;
		A=C-B;
		t++;
	}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |                 count <<A<<" "<<B<<endl;
      |                 ~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int main() {
	int A, B, K;
    cin>>A>>B>>K;
	int C=A+B;
	int t=0;
	if(t==K){
		count <<A<<” ”<<B<<endl;
	}
	else{
	if (t%2==0){
		A%=2;
		B=C-A;
		t++;
	} 
	else {
		B%=2;
		A=C-B;
		t++;
	}
	}
}


Compiler output:
a.cc:15:28: error: extended character ” is not valid in an identifier
   15 |                 count <<A<<” ”<<B<<endl;
      |                            ^
a.cc:15:30: error: extended character ” is not valid in an identifier
   15 |                 count <<A<<” ”<<B<<endl;
      |                              ^
a.cc: In function 'int main()':
a.cc:15:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |                 count <<A<<” ”<<B<<endl;
      |                 ~~~~~~^~~
a.cc:15:28: error: '\U0000201d' was not declared in this scope
   15 |                 count <<A<<” ”<<B<<endl;
      |                            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int main() {
	int A, B, K;
    cin>>A>>B>>K;
	int C=A+B;
	int t=0;
	if(t==K){
		count <<A<<“ ”<<B<<endl;
	}
	else{
	if (t%2==0){
		A%=2;
		B=C-A;
		t++;
	} 
	else {
		B%=2;
		A=C-B;
		t++;
	}
	}
}


Compiler output:
a.cc:15:28: error: extended character “ is not valid in an identifier
   15 |                 count <<A<<“ ”<<B<<endl;
      |                            ^
a.cc:15:30: error: extended character ” is not valid in an identifier
   15 |                 count <<A<<“ ”<<B<<endl;
      |                              ^
a.cc: In function 'int main()':
a.cc:15:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |                 count <<A<<“ ”<<B<<endl;
      |                 ~~~~~~^~~
a.cc:15:28: error: '\U0000201c' was not declared in this scope
   15 |                 count <<A<<“ ”<<B<<endl;
      |                            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int main() {
	int A, B, K;
    cin>>A>>B>>K;
	int C=A+B;
	int t=0;
	if(t==K){
		count <<A<<“ “<<B<<endl;
	}
	else{
	if (t%2==0){
		A%=2;
		B=C-A;
		t++;
	} 
	else {
		B%=2;
		A=C-B;
		t++;
	}
	}
}


Compiler output:
a.cc:15:28: error: extended character “ is not valid in an identifier
   15 |                 count <<A<<“ “<<B<<endl;
      |                            ^
a.cc:15:30: error: extended character “ is not valid in an identifier
   15 |                 count <<A<<“ “<<B<<endl;
      |                              ^
a.cc: In function 'int main()':
a.cc:15:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |                 count <<A<<“ “<<B<<endl;
      |                 ~~~~~~^~~
a.cc:15:28: error: '\U0000201c' was not declared in this scope
   15 |                 count <<A<<“ “<<B<<endl;
      |                            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int main() {
	int A, B, K;
    cin>>A>>B>>K;
	int C=A+B;
	Int t=0;
	If(t==K){
		count <<A<<“ “<<B<<endl;
	}
	else{
	If (t%2==0){
		A%=2;
		B=C-A;
		t++;
	} 
	else {
		B%=2;
		A=C-B;
		t++;
	}
	}
}


Compiler output:
a.cc:15:28: error: extended character “ is not valid in an identifier
   15 |                 count <<A<<“ “<<B<<endl;
      |                            ^
a.cc:15:30: error: extended character “ is not valid in an identifier
   15 |                 count <<A<<“ “<<B<<endl;
      |                              ^
a.cc: In function 'int main()':
a.cc:13:9: error: 'Int' was not declared in this scope; did you mean 'int'?
   13 |         Int t=0;
      |         ^~~
      |         int
a.cc:14:12: error: 't' was not declared in this scope
   14 |         If(t==K){
      |            ^
a.cc:14:9: error: 'If' was not declared in this scope
   14 |         If(t==K){
      |         ^~
a.cc:17:9: error: 'else' without a previous 'if'
   17 |         else{
      |         ^~~~
a.cc:23:9: error: 'else' without a previous 'if'
   23 |         else {
      |         ^~~~
Language: C++

#include<stdio.h>
using namespace std ;
int main( ){
int a, b, k;
scanf(”%d%d%d ”,&a,&b,&k);
for(int i = 0; i < k; i++){
if(i % 2 == 0) b += a/2 , a /= 2;
else a += b / 2 , b /= 2;
}
printf(”%d %d\n ”, a , b );
}


Compiler output:
a.cc:5:7: error: extended character ” is not valid in an identifier
    5 | scanf(”%d%d%d ”,&a,&b,&k);
      |       ^
a.cc:5:15: error: extended character ” is not valid in an identifier
    5 | scanf(”%d%d%d ”,&a,&b,&k);
      |               ^
a.cc:10:8: error: extended character ” is not valid in an identifier
   10 | printf(”%d %d\n ”, a , b );
      |        ^
a.cc:10:14: error: stray '\' in program
   10 | printf(”%d %d\n ”, a , b );
      |              ^
a.cc:10:17: error: extended character ” is not valid in an identifier
   10 | printf(”%d %d\n ”, a , b );
      |                 ^
a.cc: In function 'int main()':
a.cc:5:7: error: '\U0000201d' was not declared in this scope
    5 | scanf(”%d%d%d ”,&a,&b,&k);
      |       ^
a.cc:5:9: error: 'd' was not declared in this scope
    5 | scanf(”%d%d%d ”,&a,&b,&k);
      |         ^
Language: C++

/**
 *      purpose : Tenka1 Programmer Beginner Contest B
 *      author  : kyomukyomupurin
 *      created : 2018-11-02 22:59:32
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int A, B, K; cin >> A >> B >> K;

    for (int i = 1; i <= K; ++i) {
        if (i % 2 == 1){
            if (A % 2 == 1){
                --A; B += (A / 2); A /= 2;
            }
            else if (A % 2 == 0) {
                B += (A / 2); A /= 2;
            }
        }
        else if (i % 2 == 0){
            if (B % 2 == 1){
                --B; A += (B / 2); B /= 2;
            }
            else if (B % 2 == 0){
                A += (B / 2); B /= 2;
            }
        }

    cout << A << " " << B << '\n';
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

/**
 *      purpose : Tenka1 Programmer Beginner Contest B
 *      author  : kyomukyomupurin
 *      created : 2018-11-02 22:59:32
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int A, B, K; cin >> A >> B >> K;

    for (int i = 1; i <= K; ++i) {
        if (K % 2 == 1){
            if (A % 2 == 1){
                --A; B += (A / 2); A /= 2;
            }
            else if (A % 2 == 0) {
                B += (A / 2); A /= 2;
            }
        }
        else if (K % 2 == 0){
            if (B % 2 == 1){
                --B; A += (B / 2); B /= 2;
            }
            else if (B % 2 == 0){
                A += (B / 2); B /= 2;
            }
        }

    cout << A << " " << B << '\n';
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C

#include<stdio.h>
int main(){
int a,b,k,d,j,xx=0;

scanf("%d %d %d",&a,&b,&k);



for(j=0;j<k;j++){
a=a/2;
b=b+a;
}
 
if(k%2==1){
b=b/2;
a=a+b;
}

}

printf("%d %d",&a,&b);
return 0;
}










Compiler output:
main.c:21:8: error: expected declaration specifiers or '...' before string constant
   21 | printf("%d %d",&a,&b);
      |        ^~~~~~~
main.c:21:16: error: expected declaration specifiers or '...' before '&' token
   21 | printf("%d %d",&a,&b);
      |                ^
main.c:21:19: error: expected declaration specifiers or '...' before '&' token
   21 | printf("%d %d",&a,&b);
      |                   ^
main.c:22:1: error: expected identifier or '(' before 'return'
   22 | return 0;
      | ^~~~~~
main.c:23:1: error: expected identifier or '(' before '}' token
   23 | }
      | ^
Language: C

#include<stdio.h>
int main(){
int a,b,k,d,n,j=0;

scanf("%d %d %d",&a,&b,&k);

if(k%2==1){
n=(k-1)/2;
d++;
}else{
n=k/2;
}


for(j=0;j<=n;j++){

if(a%2==1){
a=(a-1)/2;
b=b+a;
}else{
a=a/2;
b=b+a;
}

if(b%2==1){
b=(b-1)/2;
a=a+b;
}else{
b=b/2;
a=a+b;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=(a-1)/2;
b=b+a;
}else{
a=a/2;
b=b+a;
}}
printf("%d %d",&a,&b);
return 0;
}







Compiler output:
main.c: In function 'main':
main.c:37:1: error: 'xx' undeclared (first use in this function)
   37 | xx=(a-1)/2;
      | ^~
main.c:37:1: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
int a,b,k,d,n,xx=0;

scanf("%d %d %d",&a,&b,&k);

if(k%2==1){
n=(k-1)/2;
d++;
}else{
n=k/2;
}


for(j=0;j<=n;j++){

if(a%2==1){
xx=(a-1)/2;
a=a-1-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}

if(b%2==1){
xx=(b-1)/2;
b=b-1-xx;
a=a+xx;
}else{
xx=a/2;
b=b-xx;
a=a+xx;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=a-1-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}}
printf("%d %d",&a,&b);
return 0;
}





Compiler output:
main.c: In function 'main':
main.c:15:5: error: 'j' undeclared (first use in this function)
   15 | for(j=0;j<=n;j++){
      |     ^
main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  int A,B,K;
  cin>>A>>B>>K;
  for(int i=0;i<K;i++){
    if(K%2){
      if(B%2)B--;
      A+=B/2;
      B/=2;
    }
    else{
      if(A%2)A--;
      B+=A/2;
      A/=2;
    }
  cout<<A<<" "<<B<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:5:14: note: to match this '{'
    5 | signed main(){
      |              ^
Language: C

#include<stdio.h>
int main()
{
 long int x,y;
 int z;
 scanf("%ld,%ld,%d",&x ,&y ,&z);
 for(int turns=1;turns<=z;++z)
 {
   if(turns%2!=0)
    {
       if(x%2==0){
        y=y+x/2;
       }
        else if(x%2!=0)
           {
              x=x-1;
              y=y+x/2;
            }
     }
     else if(turns%2==0)
      {
         if(y%2==0)
            {
               x=x+y/2;
            }
          else if(y%2!=0)
           {
              y=y-1;
               x=x+y/2;
           }
       }
      printf("%ld %ld",x,y);
       return 0;
}    

Compiler output:
main.c: In function 'main':
main.c:34:1: error: expected declaration or statement at end of input
   34 | }
      | ^
Language: C++

let rec fold_n n f a k = if n <= 0 then k a else fold_n (n-1) f (f a) k
let f (a, b) = (b + a/2, a/2)
let _ = Scanf.scanf "%d %d %d" (fun a b n ->
  fold_n n f (a, b) (fun (x,y) -> [|(x,y); (y,x)|].(n mod 2)))


Compiler output:
a.cc:1:1: error: 'let' does not name a type
    1 | let rec fold_n n f a k = if n <= 0 then k a else fold_n (n-1) f (f a) k
      | ^~~
a.cc:4:46: error: expected ')' before ',' token
    4 |   fold_n n f (a, b) (fun (x,y) -> [|(x,y); (y,x)|].(n mod 2)))
      |                                            ~ ^
      |                                              )
a.cc:4:48: error: expected constructor, destructor, or type conversion before ')' token
    4 |   fold_n n f (a, b) (fun (x,y) -> [|(x,y); (y,x)|].(n mod 2)))
      |                                                ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int N;
vector<int> A;


int dp[10100];

int solve(){
	vector<int> ansv;
	long long ans=0;

	sort(A.begin(),A.end());

	int small = 0;
	int large = N-1;

	ans += A[N-1]-A[0];
	for(int i=0; i<N/2-1; i++){
		ans += abs( A[large] - A[small+1] );
		ans += abs( A[small] - A[large-1] );		
		small++; large--;
	}

	if(n%2==1) ans+=max(abs(A[N/2]-A[N/2+1]), abs(A[N/2]-A[N/2-1]));

	cout << ans << endl;
	return 0;
}


int main(){
	cin >> N;
	A.resize(N);
	for(int i=0;i<N;i++){
		cin >> A[i];
	}

	solve();
	return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:28:12: error: 'n' was not declared in this scope
   28 |         if(n%2==1) ans+=max(abs(A[N/2]-A[N/2+1]), abs(A[N/2]-A[N/2-1]));
      |            ^
Language: C++

#include <iostream>

using namespace std;

int main(){
  int a,b,k
  cin >> a >> b >>k;
  for ( int i = 1 ; i<= k; i++){
	if ( i % 2 == 1){
      if( a % 2 == 0){
        a = a/2;
        b += a;
      }
      else{
        a = (a-1)/2; 
        b += a;
      }
    }
    else{
      if ( b % 2 == 0){
        b = b/2;
        a += b;
      }
      else{
        b = (b-1)/2;
        a += b;
      }
    }
  }
  cout << a << b << endl;
  return 0;
}
        

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
    7 |   cin >> a >> b >>k;
      |   ^~~
a.cc:8:25: error: 'k' was not declared in this scope
    8 |   for ( int i = 1 ; i<= k; i++){
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,N;
  if(N %2 == 0){
    for(int i = 0;i<N/2:i++){
      if(A %2 == 1){
        A = A - 1;
      }
      A = A/2;
      B = A + B;
      if(B %2 == 1){
        B = B - 1;
      }
      B = B / 2;
      A = A + B;
    }
  }
  else{
    for(int i = 0;i<N/2:i++){
      if(A %2 == 1){
        A = A - 1;
      }
      A = A/2;
      B = A + B;
      if(B %2 == 1){
        B = B - 1;
      }
      B = B / 2;
      A = A + B;
    }
    if(A %2 == 1){
      A = A - 1;
    }
    A = A/2;
    B = A + B;
  }
  cout << A << " " << B << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    6 |     for(int i = 0;i<N/2:i++){
      |                   ^
a.cc:6:24: error: expected ';' before ':' token
    6 |     for(int i = 0;i<N/2:i++){
      |                        ^
      |                        ;
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
a.cc:17:6: error: expected ';' before '}' token
   17 |     }
      |      ^
      |      ;
   18 |   }
      |   ~   
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
a.cc:17:6: error: expected ')' before '}' token
   17 |     }
      |      ^
      |      )
   18 |   }
      |   ~   
a.cc:6:8: note: to match this '('
    6 |     for(int i = 0;i<N/2:i++){
      |        ^
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
a.cc:20:19: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   20 |     for(int i = 0;i<N/2:i++){
      |                   ^
a.cc:20:24: error: expected ';' before ':' token
   20 |     for(int i = 0;i<N/2:i++){
      |                        ^
      |                        ;
a.cc:32:5: error: expected primary-expression before 'if'
   32 |     if(A %2 == 1){
      |     ^~
a.cc:31:6: error: expected ';' before 'if'
   31 |     }
      |      ^
      |      ;
   32 |     if(A %2 == 1){
      |     ~~
a.cc:32:5: error: expected primary-expression before 'if'
   32 |     if(A %2 == 1){
      |     ^~
a.cc:31:6: error: expected ')' before 'if'
   31 |     }
      |      ^
      |      )
   32 |     if(A %2 == 1){
      |     ~~
a.cc:20:8: note: to match this '('
   20 |     for(int i = 0;i<N/2:i++){
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B;
int K;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>K;
	FOR(i,K) {
			B+=A/2;
			A/=2;
		}
		else {
			A+=B/2;
			B/=2;
		}
	}
	cout<<A<<" "<<B<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:26:17: error: 'else' without a previous 'if'
   26 |                 else {
      |                 ^~~~
a.cc: At global scope:
a.cc:31:9: error: 'cout' does not name a type
   31 |         cout<<A<<" "<<B<<endl;
      |         ^~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k;
  cin>>a>>b>>k;
  for(int i=1;i<=k;i++){
    if(i%2){
      if(a%2)a--;
      else b+=a/2,a/=2;
    }
    else{
      if(b%2)b--;
      else a+=b/2,b/=2;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C

#include<stdio.h>
int main(){
int a,b,k,n,d,xx=0;

scanf("%d %d %d",&a,&b,&k);

if(k%2==1){
n=(k-1)/2;
d=1;
}else{
n=k/2
}


for(j=0;j<=n;j++){

if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}

if(b%2==1){
xx=(b-1)/2;
b=b-xx;
a=a+xx;
}else{
xx=a/2;
b=b-xx;
a=a+xx;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}}
printf("%d %d",&a,&b);
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:11:6: error: expected ';' before '}' token
   11 | n=k/2
      |      ^
      |      ;
   12 | }
      | ~     
main.c:15:5: error: 'j' undeclared (first use in this function)
   15 | for(j=0;j<=n;j++){
      |     ^
main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
int a,b,k,n,d,xx=0;

scanf("%d %d %d",a,b,k);

if(k%2==1){
n=(k-1)/2;
d=1;
}else{
n=k/2
}


for(j=0;j<=n;j++){

if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}

if(b%2==1){
xx=(b-1)/2;
b=b-xx;
a=a+xx;
}else{
xx=a/2;
b=b-xx;
a=a+xx;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}}
printf("%d %d",a,b);
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:11:6: error: expected ';' before '}' token
   11 | n=k/2
      |      ^
      |      ;
   12 | }
      | ~     
main.c:15:5: error: 'j' undeclared (first use in this function)
   15 | for(j=0;j<=n;j++){
      |     ^
main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
int a,b,k,n,d,xx=0;

scanf("%d %d %d",a,b,k)

if(k%2==1){
n=(k-1)/2;
d=1;
}else{
n=k/2
}


for(j=0;j<=n;j++){

if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}

if(b%2==1){
xx=(b-1)/2;
b=b-xx;
a=a+xx;
}else{
xx=a/2;
b=b-xx;
a=a+xx;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}}
printf("%d %d",a,b);
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:5:24: error: expected ';' before 'if'
    5 | scanf("%d %d %d",a,b,k)
      |                        ^
      |                        ;
    6 | 
    7 | if(k%2==1){
      | ~~
Language: C

#include<stdio.h>
int main(){
int a,b,k,n,d,xx;

scanf("%d %d %d",a,b,k)

if(k%2==1){
n=(k-1)/2;
d=1;
}else{
n=k/2
}


for(j=0;j<=n;j++){

if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}

if(b%2==1){
xx=(b-1)/2;
b=b-xx;
a=a+xx;
}else{
xx=a/2;
b=b-xx;
a=a+xx;
}

}

if(d==1){
if(a%2==1){
xx=(a-1)/2;
a=a-xx;
b=b+xx;
}else{
xx=a/2;
a=a-xx;
b=b+xx;
}}
printf("%d %d",a,b);
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:5:24: error: expected ';' before 'if'
    5 | scanf("%d %d %d",a,b,k)
      |                        ^
      |                        ;
    6 | 
    7 | if(k%2==1){
      | ~~
Language: C++

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
	int a = 0, b = 0, k = 0;
	int p, q, r;
	for (int i = 1; i <= k/2; i++) {
		if (a % 2 == 0, b % 2 == 0) {
			p = a / 2;
			q = (b + a / 2) / 2;
			r = a / 2 + (b + a / 2) / 2;
		}
		else if (a % 2 == 1, b % 2 == 0) {
			p = (a - 1) / 2;
			q = (b + (a - 1) / 2) / 2;
			r = a / 2 + (b + (a - 1) / 2) / 2;
		}
		else if (a % 2 == 0, b % 2 == 1) {
			p = a / 2;
			q = (b - 1 + a / 2) / 2;
			r = a / 2 + (b - 1 + a / 2) / 2;
		}
		else if (a % 2 == 1, b % 2 == 1) {
			p = (a - 1) / 2;
			q = (b - 1 + (a - 1) / 2) / 2;
			r = a / 2 + (b - 1 + (a - 1) / 2) / 2;
		}


	}
	cout << q << " " << r << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	int A;
	int B;
	int K;
	int i;

	Scanner sc = new Scanner(System.in);

	System.err.print("A = ");
	A = sc.nextInt();

	System.err.print("B = ");
	B = sc.nextInt();

	System.err.print("K =");
	K = sc.nextInt();


	while(i = 0 &&  i <= K; ) {
	    if ( A % 2 == 1){
		A = A - 1;
		A = A - A / 2;
		B = B + A / 2;
		i++;
	    }
	    else if ( A % 2 == 0){
		A = A - A / 2;
		B = B + A / 2;
		i++;
		
	    }

	    if ( B % 2 == 1 && i <= K){
		B = B - 1;
		B = B - B / 2;
		A = A + B / 2;
		i++;
		
	    }

	    else if ( B % 2 == 0 && i <= K ){
		B = B - B / 2;
		A = A + B / 2;
		i++;
	    }
	}

	System.out.println("A = " + A);
	System.out.println("B = " + B);
    }
}


Compiler output:
Main.java:22: error: ')' expected
	while(i = 0 &&  i <= K; ) {
	                      ^
Main.java:22: error: illegal start of expression
	while(i = 0 &&  i <= K; ) {
	                        ^
2 errors
Language: C++

#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<cctype>


using namespace std;

addnum(int num,int num2){
	int i;
	i=num/2;
	return num2+i;
}
subnum(int hoge,int hoge2){
	int j;
	j=hoge/2;
	return hoge2-j;

}


int main(){

int a,b,k;
	cin>>a>>b>>k;
	int i=0;
	for(i=0;i<k/2;i++){
		if(a%2==1){
			b=addnum(a-1,b);
			a=subnum(a-1,a-1);
		}else{
			b=addnum(a,b);
			a=subnum(a,a);
		}
		
		if(b%2==1){
			a=addnum(b-1,a);
			b=subnum(b-1,b-1);
		
		}else{
			a=addnum(b,a);
			b=subnum(b,b);
		}
	}
	
	if(k%2==1){
	if(a%2==1){
			b=addnum(a-1,b);
			a=subnum(a-1,a-1);
		}else{
			b=addnum(a,b);
			a=subnum(a,a);
		}
	}
	
	
	
cout<<a<<" "<<b<<endl;

return 0;
}


Compiler output:
a.cc:10:1: error: ISO C++ forbids declaration of 'addnum' with no type [-fpermissive]
   10 | addnum(int num,int num2){
      | ^~~~~~
a.cc:15:1: error: ISO C++ forbids declaration of 'subnum' with no type [-fpermissive]
   15 | subnum(int hoge,int hoge2){
      | ^~~~~~
Language: C

#include <stdio.h>
int main(){
  
    int A,B,K,i,a,b:
  
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &K);
  
    for(i = 0; i < K; ++i){
      if(A % 2 == 0 && B % 2 == 1){
        B -= 1;
      }
      else if(A % 2 == 1 && B % 2 == 0){
        A -= 1;
      }
      else if(A % 2 == 1 && B % 2 == 1){
        A -= 1;
        B -= 1;
      }
      a = A / 2;
      b = B / 2;
      A = A + b;
      B = B + a;
    }
  
    printf("%d %d \n", A, B);
  
    return 0;
}
        

Compiler output:
main.c: In function 'main':
main.c:4:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    4 |     int A,B,K,i,a,b:
      |                    ^
main.c:22:7: error: 'b' undeclared (first use in this function)
   22 |       b = B / 2;
      |       ^
main.c:22:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<stdio.h>
#include<string.h>

int main()
{
	int a,b,k;
	scanf("%d %d %d",&a,&b,&k);
	for(int i=1;i<=k;i++)
	{	
		if(i==1||i%2!=0)
		{	
			if(a%2==0)
			{	
				b+=a/2;
				a=a/2;
			}
			else
			{	
				b+=(a-1)/2;
				a=(a-1)/2;
			}
		}
		else
		{	
			if(b%2==0)
			{	
				a+=b/2;
				b=b/2;
			}
			else
			{	
				a+=(b-1)/2;
				b=(b-1)/2;
			}
	}
			

		printf("%d,%d\n",a,b);
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: Java

import java.util.*;
public class Main
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int N = sc.nextInt();
    int count = 0;
    while(count < N){
      if(count %2 == 0){
        if(A %2 != 0){
          A = A - 1;
        }
        int halfA = A / 2;
        A -= halfA;
        B += halfA;
        count++;
      }else{
        if(B %2 != 0){
          B = B - 1;
        }
        int halfB = B / 2;
        B -= halfB;
        A += halfB;
        count++;
      }
    }
    System.out.println(A + " " + B);
  }
}


Compiler output:
Main.java:2: error: '{' expected
public class Main
                 ^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
  public static void main(String[] args){
                ^
  (use --enable-preview to enable unnamed classes)
Main.java:30: error: class, interface, enum, or record expected
}
^
3 errors
Language: C++

#include<stdio.h>
void main()
{
	unsigned int A, B, K;
	scanf("%d%d%d", &A, &B, &K);
	for( ; K>0 ; ){
		if( A%2!=0 ){
			A = ( A-1 )/2;
			B += A;
			K--;
			if(K==0) goto end;
			if( B%2!=0 ){
				B = ( B-1 )/2;
				A += B;
				K--;
			}else{
				B = B/2;
				A = A+B;
				K--;
				if(K==0) goto end;
			}
		}else{
			A = A/2;
			B += A;
			K--;
			if(K==0) goto end;
			if( B%2!=0 ){
				B = ( B-1 )/2;
				A += B;
				K--;
			}else{
				B = B/2;
				A = A+B;
				K--;
				if(K==0) goto end;
			}
		}
	}
	end : printf("%d %d", A, B);
} 

Compiler output:
a.cc:2:1: error: '::main' must return 'int'
    2 | void main()
      | ^~~~
Language: C++

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
	int a=0, b=0, k=0;
	int p, q,r;
	for (int i=1; i <= k; i++) {
		if (a % 2 == 0, b % 2 == 0) {
			p = a / 2;
			q = (b + a / 2) / 2;
			r = a / 2 + (b + a / 2) / 2;
		}
		else if (a % 2 == 1,b % 2 == 0) {
			p = (a - 1) / 2;
			q = (b + (a - 1) / 2) / 2;
			r = a / 2 + (b + (a - 1) / 2) / 2;
		}
		else if (a % 2 == 0,b % 2 == 1) {
			p = a / 2;
			q = (b-1 + a/ 2)/ 2;
			r = a / 2 + (b-1 + a / 2) / 2;
		}
		else if(a%2==1,b%2==1) {
			p = (a-1) / 2;
			q = (b - 1 +( a -1)/ 2) / 2;
			r = a / 2 + (b - 1 +( a-1) / 2) / 2;
		}


	}
	cout << q << " " << r << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

import javafx.collections.SetChangeListener.Change;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        for(int i = 0; i < k; i++){
           if(i%2 == 0){
               if(a%2 == 1){
                    a = a - 1;
                    int[] array = change(a,b,i);
                    a = array[0];
                    b = array[1];
               }else{
                   int[] array = change(a,b,i);
                   a = array[0];
                   b = array[1];
               }
           }else{
               if(b%2 == 1){
                   b = b - 1;
                   int[] array = change(a,b,i);
                   a = array[0];
                   b = array[1];
               }else{
                   int[] array = change(a,b,i);
                   a = array[0];
                   b = array[1];
               }
           }
        }
        System.out.print(a);
        System.out.print(b);
    }
    public static int[] change(int ac,int bc,int i){
        if(i%2 == 0){
            int aa = ac/2;
            ac = aa;
            bc = bc + aa;
            int[] array = {ac,bc};
            return array;
            
        }else{
            int bb = bc/2;
            ac = ac + bb;
            bc = bb;
            int[] array = {ac,bc};
            return array;
        }
    }
}

Compiler output:
Main.java:3: error: package javafx.collections.SetChangeListener does not exist
import javafx.collections.SetChangeListener.Change;
                                           ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a, b, k;
int f(int n, int m) {
  if(n % 2 == 1){
    n -= 1;
    n /= 2;
    m += n;
    if(n < 0 || m < 0) break;
  } else {
    n /= 2;
    m += n/2;
    if(n < 0 || m < 0) break;
  }
}


int main(){
  cin >> a >> b >> k;
  if(k % 2 == 0){
    for(int i = 0; i <= k/2; i++){
      f(a, b);
      if(a < 0 || b < 0) break;
      f(b, a);
      if(a < 0 || b < 0) break;
    }
  } else {
    for(int j = 0; j <= (k - 1)/2; j++){
      f(a, b);
      f(b, a);
    }
    f(a, b);
  }
  cout << a << b << endl;
}


Compiler output:
a.cc: In function 'int f(int, int)':
a.cc:9:24: error: break statement not within loop or switch
    9 |     if(n < 0 || m < 0) break;
      |                        ^~~~~
a.cc:13:24: error: break statement not within loop or switch
   13 |     if(n < 0 || m < 0) break;
      |                        ^~~~~
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

void operation(vector<int>& regs){
    regs[2]--;
    int temp;
    if(regs[0]%2 != 1)
        temp = --regs[0];
    // swap included
    regs[0]= regs[1] + temp;
    regs[1]= temp;

    return regs;
}

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    vector<int> regs = {A, B, K};
    
    while(regs[2] >0){
        operation(regs);
    }
    if(K%2==0)
    cout << regs[0] << regs[1] << endl;
    else
    cout << regs[1] << regs[0] << endl;
}

Compiler output:
a.cc: In function 'void operation(std::vector<int>&)':
a.cc:13:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |     return regs;
      |            ^~~~
Language: C

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm> 
#include<map>
#include<queue>
using namespace std;
int  main()
{
	long long n,m;
	float a,b;
	int k;
	scanf("%f%f%d",&a,&b,&k);
	for(int i=1;i<=k;i++)
	{
		if(i%2==0)
		{  n=b;  
			if(n%2==0)
			{  b=b/2; a+=b;  }
			else {b=(b-1)/2; a+=b;}
		}
		else 
		{
		   
		   m=a;
			if(m%2==0)
			{ a=a/2;  b+=a;}
			else { a=(a-1)/2; b+=a;}
		}
	}
	printf("%.0f %.0f",a,b);
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
void main()
{
	unsigned int A, B, K;
	scanf("%d%d%d", &A, &B, &K);
	for( ; K>0 ; ){
		if( A%2!=0 ){
			A = ( A-1 )/2;
			B += A;
			K--;
			if( B%2!=0 ){
				B = ( B-1 )/2;
				A += B;
				K--;
			}else{
				B = B/2;
				A = A+B;
				K--;
			}
		}else{
			A = A/2;
			B += A;
			K--;
			if( B%2!=0 ){
				B = ( B-1 )/2;
				A += B;
				K--;
			}else{
				B = B/2;
				A = A+B;
				K--;
			}
		}
	}
	printf("%d %d", A, B);
} 

Compiler output:
a.cc:2:1: error: '::main' must return 'int'
    2 | void main()
      | ^~~~
Language: C++

int main(){
	int A, B, K;
	int M = 0;

cin >> A >> B >> K;
for (int i = 0; i <= K; ++i) {
	if (A % 2 == 1)--A;
		M = A;
		A = A / 2;
		B = B + M / 2;
	if (B % 2 == 1)--B;
	M = B;
		B = B / 2;
		A = A + M / 2;
}
	cout << A << " " << B;
	cin >> A;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope
    5 | cin >> A >> B >> K;
      | ^~~
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout << A << " " << B;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

vector<int> operation(vector<int> regs){
    regs[2]--;
    int temp;
    if(regs[0]%2 != 1)
        temp = --regs[0]
    // swap included
    regs[0]= regs[1] + temp;
    regs[1]= temp;

    return regs
}

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    vector<int> regs = {A, B, K};
    
    while(regs[2] >0){
        operation(regs);
    }
    if(K%2==0)
    cout << regs[0] << regs[1] << endl;
    else
    cout << reg[1] << reg[0] << endl;
}

Compiler output:
a.cc: In function 'std::vector<int> operation(std::vector<int>)':
a.cc:8:25: error: expected ';' before 'regs'
    8 |         temp = --regs[0]
      |                         ^
      |                         ;
    9 |     // swap included
   10 |     regs[0]= regs[1] + temp;
      |     ~~~~                 
a.cc:13:16: error: expected ';' before '}' token
   13 |     return regs
      |                ^
      |                ;
   14 | }
      | ~               
a.cc: In function 'int main()':
a.cc:27:13: error: 'reg' was not declared in this scope; did you mean 'regs'?
   27 |     cout << reg[1] << reg[0] << endl;
      |             ^~~
      |             regs
Language: C++

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
	int a, b, k;
	int p, q,r;
	for (int i=1; i <= k; i++) {
		if (a % 2 == 0, b % 2 == 0) {
			p = a / 2;
			q = (b + a / 2) / 2;
			r = a / 2 + (b + a / 2) / 2;
		}
		else if (a % 2 == 1,b % 2 == 0) {
			p = (a - 1) / 2;
			q = (b + (a - 1) / 2) / 2;
			r = a / 2 + (b + (a - 1) / 2) / 2;
		}
		else if (a % 2 == 0,b % 2 == 1) {
			p = a / 2;
			q = (b-1 + a/ 2)/ 2;
			r = a / 2 + (b-1 + a / 2) / 2;
		}
		else if(a%2==1,b%2==1) {
			p = (a-1) / 2;
			q = (b - 1 +( a -1)/ 2) / 2;
			r = a / 2 + (b - 1 +( a-1) / 2) / 2;
		}


	}
	cout << q << " " << r << endl;
}


Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

using namespace std;

int main(){
	int A, B, K;
	int M = 0;

cin >> A >> B >> K;
for (int i = 0; i <= K; ++i) {
	if (A % 2 == 1){
		--A;
		M = A;
		A = A / 2;
		B = B + M / 2;
	}
	if (B % 2 == 1){
		--B;
		M = B;
		B = B / 2;
		A = A + M / 2;
	}
}
	cout << A << " " << B;
	cin >> A;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'cin' was not declared in this scope
    7 | cin >> A >> B >> K;
      | ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << A << " " << B;
      |         ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		int k = sc.nextInt();
		while(k>0){
		 if(a%2==0){
			 a = a/2;
			 b += a;
		 }
		 else{
			 a--;
			 a = a/2;
			 b += a;
		 }
		 if(b%2==0){
			 b = b/2;
			 a+=b;
		 }
		 else
			 {
			 b--;
			 b = b/2;
			 a+=b;
			 }
		 k--;
		}
		System.out.println(a+" "+b);
	}

}

Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
using namespace std;

static int32_t lnCookie[2];
int main() {
            int8_t nCnt = 0;
            cin >> lnCookie[0] >> lnCookie[1] >> nCnt;
            do {
                operation(0);
                operation(1);
            } while (--nCnt);
            return 0;
        }
        int operation(int who) {
            if (lnCookie[who] % 2) --lnCookie[who];
            lnCookie[who] /= 2;
            lnCookie[who?0:1] += lnCookie[who];
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'operation' was not declared in this scope
    9 |                 operation(0);
      |                 ^~~~~~~~~
a.cc: In function 'int operation(int)':
a.cc:18:9: warning: no return statement in function returning non-void [-Wreturn-type]
   18 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;

main(){
  int a,b,k,i;
  cin >> a >> b >> k;
  for (i=0;i<k;i++){
    if (a%2=1) a-=1;
    a/=2;
    b+=a;
  }
  cout << a << b << endl;
}


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:10: error: lvalue required as left operand of assignment
    8 |     if (a%2=1) a-=1;
      |         ~^~
Language: C

#include <stdio.h>
int main(void){
    int a,b,k,i;
    scanf("%d%d%d",&a,&b,&k);
    fot(i=0;i<k;i++){
        if(i%2==0){
            if(a%2 != 0){
                a--;
                b+= a/2;
                a=a/2;
            }else{
                b+= a/2;
                a=a/2;
            }
        }else{
            if(b%2 != 0){
                b--;
                a+= b/2;
                b=b/2;
            }else{
                a+= b/2;
                b=b/2;
            }
        }
    }
    printf("%d%d",a,b);
}


Compiler output:
main.c: In function 'main':
main.c:5:5: error: implicit declaration of function 'fot' [-Wimplicit-function-declaration]
    5 |     fot(i=0;i<k;i++){
      |     ^~~
main.c:5:12: error: expected ')' before ';' token
    5 |     fot(i=0;i<k;i++){
      |        ~   ^
      |            )
main.c:5:21: error: expected ';' before '{' token
    5 |     fot(i=0;i<k;i++){
      |                     ^
      |                     ;
Language: Java

import java.util.Scanner;

public class Main1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		int k = sc.nextInt();
		while(k>0){
		 if(a%2==0){
			 a = a/2;
			 b += a;
		 }
		 else{
			 a--;
		 }
		 if(b%2==0){
			 b = b/2;
			 a+=b;
		 }
		 else
			 b--;
		}
		System.out.println(a+" "+b);
	}

}


Compiler output:
Main.java:3: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
int a, b, k;
int n, m;
int f(n, m) {
  if(n % 2 == 1){
    n -= 1;
    m += a/2;
    n /= 2;
  } else {
    m += a/2;
    n /= 2;
  }
}


int main(){
  cin >> a >> b >> k;
  if(k % 2 == 0){
    for(int i = 0; i < k/2; i++){
      f(a, b);
      f(b, a);
    }
  } else {
    for(int j = 0; j < k/2; j++){
      f(a, b);
      f(b, a);
    }
    f(a, b);
  }
  cout << a << b << endl;  
}

Compiler output:
a.cc:7:11: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | int f(n, m) {
      |           ^
a.cc:7:13: error: expected ',' or ';' before '{' token
    7 | int f(n, m) {
      |             ^
a.cc: In function 'int main()':
a.cc:23:8: error: 'f' cannot be used as a function
   23 |       f(a, b);
      |       ~^~~~~~
a.cc:24:8: error: 'f' cannot be used as a function
   24 |       f(b, a);
      |       ~^~~~~~
a.cc:28:8: error: 'f' cannot be used as a function
   28 |       f(a, b);
      |       ~^~~~~~
a.cc:29:8: error: 'f' cannot be used as a function
   29 |       f(b, a);
      |       ~^~~~~~
a.cc:31:6: error: 'f' cannot be used as a function
   31 |     f(a, b);
      |     ~^~~~~~