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

import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		String[] rc = br.readLine().split(" ");
		int r = Integer.parseInt(rc[0]);
		int c = Integer.parseInt(rc[1]);
		int sumOfRow, total = 0;
		int[] sumOfCol = new int[c];

		for(int i = 0; i < r; i++) {
			String row = br.readLine();
			String[] elem = row.split(" ");
			sumOfRow = 0;
			for(int j = 0; j < c; j++) {
				sumOfRow += Integer.parseInt(elem[j]);
				sumOfCol[j] += Integer.parseInt(elem[j]);
			}
			total += sumOfRow;
			sb.append(row + " " + sumOfRow + "\n");
		}

		for(int j = 0; j < c; j++) {
			sb.append(sumOfCol[j] + " ");
		}

		System.out.println(sb.append(total));

	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.IOException;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int vecsum(int n, int Data[n+1]){
	int sum = 0;
	for(int i=0; i<=n; i++){
		sum += Data[i];
	}
	return sum;
}

int main(){
	int r, c;
	cin >> r >> c;

	int **Data = new int*[r+2]();
	for(int i=0; i < c+2; i++){
		Data[i] = new int[c+2]();
	}

	int *rowsum = new int[r+2]();
	int *colsum = new int[c+2]();

	// Input Data
	for(int n=1; n<=r; n++){
		for(int m=1; m<=c; m++){
			cin >> Data[n][m];
		}
	}

	// Output Data
	for(int rn=1; rn<=r; rn++){
		for(int cn=1; cn<=c; cn++){
			cout << Data[rn][cn] << " ";
			rowsum[rn] += Data[rn][cn];
			colsum[cn] += Data[rn][cn];
		}
		cout << rowsum[rn] << endl;
	}
	for(int cn=1; cn<=c; cn++){
		cout << colsum[cn] << " ";
	}
	cout << vecsum(r, rowsum) << endl;

	return 0;
}

Compiler output:
a.cc:4:29: error: use of parameter outside function body before '+' token
    4 | int vecsum(int n, int Data[n+1]){
      |                             ^
a.cc: In function 'int vecsum(...)':
a.cc:6:25: error: 'n' was not declared in this scope
    6 |         for(int i=0; i<=n; i++){
      |                         ^
a.cc:7:24: error: 'Data' was not declared in this scope
    7 |                 sum += Data[i];
      |                        ^~~~
Language: C++

#include<iostream>
using namespace std;

int main() {
        int s[101][101], r, c, i, j;
        cin >> r >> c;
        for (i = 0; i < r + 1; i++) {
                for (j = 0; j + 1; j) {
                        s[i][j] = 0;
                }
        }
        for (i = 0; i < r; i++) {
                for (j = 0; j < c; j++) {
                        cin >> s[i][j];
                }
        }
        for (i = 0; i < r; i++) {
                for (j = 0; j < c; j++) {
                        s[i][c] += s[i][j];
                }
        }
        for (i = 0; i < r; i++) {
                for (j = 0; j < c; j++) {
                        s[r][j] += s[i][j];
                }
        }
        for (i = 0; i < r; i++) {
                s[r][c] += s[i][c]
        }
        for (i = 0; i < r + 1; i++) {
                for (j = 0; j < c + 1; j++) {
                        cout << s[i][j] << " ";
                }
                cout << endl;
        }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:35: error: expected ';' before '}' token
   28 |                 s[r][c] += s[i][c]
      |                                   ^
      |                                   ;
   29 |         }
      |         ~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int r, c;
  cin >> r >> c;
  int inputs[r+1][c+1];

  //?????????
  for(int i=0; i<r+1; i++){
    for(int j=0; j<c+1; j++){
      inputs[i][j]=0;
    }
  }

  //??\?????????
  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      cin >> inputs[i][j];
    }
  }

  //?¨??????????
  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      inputs[i][c] += inputs[i][j];
      inputs[r][j] += inputs[i][j];
      inputs[r][c] += inputs[i][j];
    }
  }

  //????????????
  for(int i=0; i<r+1; i++){
    for(int j=0; j<c+1; j++){
      if(j == c){
        cout << inputs[i][j] << endl;
      }else{
        cout << inputs[i][j] << " ";
        
    }
  }
}

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

#include<iostream>
using namespace std;

int main(){
 int r,c;
 cin >> r >> c;
 int table[r+1][c+1]={};

 for(int i=0;i<r;++i){
  for(int j=0;j<c;++j){
   cin >> table[i][j];
  }
 }

 for(int i=0;i<r;++i){
  int sum=0;
  for(int j=0;j<c;++j){
   sum+=table[i][j];
  }
  table[i][c]=sum;
 }


 for(int j=0;j<c;++i){
  int sum1=0;
  for(int i=0;i<r;++j){
   sum1+=table[i][j];
  }
  table[r][j]=sum;
 }


 for(int i=0;i<r;++i){
  for(int j=0;j<c;++j){
   cout << table[i][j] << " ";
  }
  cout << "\" << ;
 }

 return 0;
}

Compiler output:
a.cc:37:11: warning: missing terminating " character
   37 |   cout << "\" << ;
      |           ^
a.cc:37:11: error: missing terminating " character
   37 |   cout << "\" << ;
      |           ^~~~~~~~
a.cc: In function 'int main()':
a.cc:24:20: error: 'i' was not declared in this scope
   24 |  for(int j=0;j<c;++i){
      |                    ^
a.cc:29:15: error: 'sum' was not declared in this scope; did you mean 'sum1'?
   29 |   table[r][j]=sum;
      |               ^~~
      |               sum1
a.cc:38:2: error: expected primary-expression before '}' token
   38 |  }
      |  ^
Language: C++

#include<iostream>
using namespace std;

int main(){
 int r,c;
 cin >> r >> c;
 int table[r+1][c+1]={};

 for(int i=0;i<r;++i){
  for(int j=0;j<c;++j){
   cin >> table[i][j];
  }
 }

 for(int i=0;i<r;++i){
  int sum=0;
  for(int j=0;j<c;++j){
   sum+=table[i][j];
  }
  table[i][c]=sum;
 }


 for(int j=0;j<c;++j){
  int sum1=0;
  for(int i=0;i<r;++i){
   sum1+=table[i][j];
  }
  table[r][j]=sum;
 }


 for(int i=0;i<r;++i){
  for(int j=0;j<c;++j){
   cout << table[i][j] << " ";
  }
  cout << "\n";
 }

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'sum' was not declared in this scope; did you mean 'sum1'?
   29 |   table[r][j]=sum;
      |               ^~~
      |               sum1
Language: C++

#include<iostream>
using namespace std;

int main(){
 int r,c;
 cin >> r >> c;
 int table[r+1][c+1]={};

 for(int i=0;i<r;++i){
  for(int j=0;j<c;++j){
   cin >> table[i][j];
  }
 }

 for(int i=0;i<r;++i){
  int sum=0;
  for(int j=0;j<c;++j){
   sum+=table[i][j];
   cout << table[i][j] << " ";
  }
  cout << sum << endl;
 }

 int sum2=0
 for(int j=0;j<c;++j){
  int sum1=0;
  for(int i=0;i<r;++i){
   sum1+=table[i][j];
  }
  cout << sum1 << " ";
  sum2+=sum1
 }
 cout << sum2 << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected ',' or ';' before 'for'
   25 |  for(int j=0;j<c;++j){
      |  ^~~
a.cc:25:14: error: 'j' was not declared in this scope
   25 |  for(int j=0;j<c;++j){
      |              ^
Language: C++

int main(void){
  int r,c,i,j;
  scanf("%d%d",&r,&c);
  int a[100][100]={};
  for(i=0;i<r;i++){
      for(j=0;j<c;j++){
          scanf("%d",&a[i][j]);
          a[i][c]+=a[i][j];
          a[r][j]+=a[i][j];
          a[r][c]+=a[i][j];
        }
  }
  for(i=0;i<=r;i++){
      printf("%d",a[i][0]);
      for(j=1;j<=c;j++){
          
          printf(" %d",a[i][j]);
          
      }
      printf("\n");
  }
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%d%d",&r,&c);
      |   ^~~~~
a.cc:14:7: error: 'printf' was not declared in this scope
   14 |       printf("%d",a[i][0]);
      |       ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
Language: C++

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

int main(int argc, char const *argv[])
{
  int r, c;
  cin >> r >> c;
  vector< vector<int> > matrix(r+1, vector<int>(c+1));

  for(int i = 0; i < r; i++)
  {
    for(int j = 0; j < c; j++)
      cin >> matrix[i][j];
  }

  for(int i = 0; i < r; i++)
  {
    int row = 0;
    for(int j = 0; j < c; j++)
    {
      row += matrix[i][j];
    }
    matrix[i][c] = row;
  }

  for(int j = 0; j < c; i++)
  {
    int column = 0;
    for(int i = 0; i < r; j++)
    {
      column += matrix[i][j];
    }
    matrix[r][j] = column;
  }

  for(int i = 0; i < r+1; i++)
  {
    for(int j = 0; j < c+1; j++)
    {
      if(j != 0)
      {
        cout << " " << flush;
      }
      cout << matrix[i][j] << flush;
    }
    cout << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:26:25: error: 'i' was not declared in this scope
   26 |   for(int j = 0; j < c; i++)
      |                         ^
Language: C++

import java.util.*;
import java.lang.StringBuilder;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int c = 0;
		String[] st = sc.nextLine().split(" ");
		int h = Integer.parseInt(st[0]);
		int w = Integer.parseInt(st[1]);
		int[] t = new int[h];
		int[][] n = new int [h][w];
		for(int i = 0;i < h;i++){
			st = sc.nextLine().split(" ");
			for(int k = 0;k < w;k++){
				n[i][k] = Integer.parseInt(st[k]);
			}
		}
		for(int i = 0;i < h;i++){
			for(int k = 0;k < w;k++){
				sb.append(" "+n[i][k]);
				t[i] = c += n[i][k];
			}
			sb.append(" "+c+"\n");
			t[i] = c;
			c = 0;
		}
		for(int i = 0;i < w;i++){
			for(int k = 0;k < h;k++){
				c += n[k][i];
			}
			sb.append(" "+c);
			c = 0;
		}
		for(int i = 0;i < h;i++){
			c += t[i];
		}
		sb.append(" " +c);
		System.out.print(sb);
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.lang.StringBuilder;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>


using namespace std;


int main() 
{
	int r, c;
	int arr[100 + 1][100 + 1] = {};

	cin >> r >> c;

	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> arr[i][j];
		}
	}

	for (int i = 0; i < r; i++)
	{
		int sum = 0;
		for (int j = 0; j < c; j++)
		{ 
			sum += arr[i][j];
		}
		arr[i][c] = sum;
	}

	for (int i = 0; i < c; i++)
	{
		int sum = 0;
		for (int j = 0; j < r; j++)
		{
			sum += arr[j][i];
		}
		arr[r][i] = sum;
	}

	for (int i = 0; i < r; i++)
	{
		arr[r][c] += arr[i][c];
	}

	cout << endl;

	for (int i = 0; i <= r; i++)
	{
		for (int j = 0; j <= c; j++)
			cout << arr[i][j] <<  " ";
		cout << endl;

	

	

	return 0;
}

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

#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>


using namespace std;


int main() 
{
	int r, c;
	int arr[100 + 1][100 + 1] = {};

	cin >> r >> c;

	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> arr[i][j];
		}
	}

	for (int i = 0; i < r; i++)
	{
		int sum = 0;
		for (int j = 0; j < c; j++)
		{ 
			sum += arr[i][j];
		}
		arr[i][c] = sum;
	}

	for (int i = 0; i < c; i++)
	{
		int sum = 0;
		for (int j = 0; j < r; j++)
		{
			sum += arr[j][i];
		}
		arr[r][i] = sum;
	}

	for (int i = 0; i < r; i++)
	{
		arr[r][c] += arr[i][c];
	}

	cout << endl;

	for (int i = 0; i <= r; i++)
	{
		for (int j = 0; j <= c; j++)
			cout << arr[i][j] <<  " ";
		cout << endl;
	}


	

	

	return 0;
}

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

#include<iostream>
using namespace std;

// #include<cstdio>

int main(){
  int r, c;
  int m[101][101]={};
  cin >> r >> c;
  for (int i=0; i<r; i++){
    for (int j=0; j<c; j++){
      cin >> m[i][j];
      m[i][c]+=m[i][j];
      m[r][j]+=m[i][j];
      m[r][c]+=m[i][j];
    }
  }
  

  for (int i=0; i<=r; i++){
    for (int j=0; j<=c; j++){
      cout << m[i][j];
      if (j==c) continue;
      cout << ' ';
    }
    cout << "\n";
  }

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

#include<iostream>
using namespace std;
??
int main(){
int r,c,T[101][101];
cin >>r >>c;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> T[i][j];
}
}
for(int i=0;i<=r;i++) T[i][c]=0;
for(int j=0;j<=c;j++) T[r][j]=0;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
T[i][c]=T[i][c]+T[i][j];
T[r][j]=T[r][j]+T[i][j];
T[r][c]=T[r][c]+T[i][j];
}
}
for(int i=0;i<=r;i++){
for(int j=0;j<=c;j++){
if(j) cout <<" ";
cout <<T[i][j] <<endl;
}
}
return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ??
      | ^
Language: C++

#include<iostream>
using namespace std;
??
int main(){
int r,c,T[101][101];
cin >>r >>c;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> T[i][j];
}
}
for(int i=0;i<=r;i++) T[i][c]=0;
for(int j=0;j<=c;j++) T[r][j]=0;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
T[i][c]=T[i][c]+T[i][j];
T[r][j]=T[r][j]+T[i][j];
T[r][c]=T[r][c]+T[i][j];
}
}
for(int i=0;i<=r;i++){
for(int j=0;j<=c;j++){
if(j) cout <<" ";
cout <<T[i][j];
}
cout <<endl;
}
return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ??
      | ^
Language: C++

r, c = map(int, input().split())

matrix = [list(map(int, input().split())) for _ in range(r)]

for i in range(r):
    matrix[i].append(sum(matrix[i]))

matrix.append(list(map(sum, zip(*matrix))))

for m in matrix:
    print(' '.join(str(e) for e in m))

Compiler output:
a.cc:1:1: error: 'r' does not name a type
    1 | r, c = map(int, input().split())
      | ^
Language: C++

#include <iostream>
#define	N 101
using namespace	std;

int main()
{
  int r,c,A[N][N],col=0,row=0;
  cin >> r >> c;

  for(int i=0;i<r;i++)
    {
      for(int j=0;j<c;j++)
	{
          cin >> A[i][j];
        }
    }   

  for(int i=0;i<r;i++)
    {
      col=0;
      for(int j=0;j<c;j++)
	{
          if(i) cout <<	" ";
          col+=A[i][j];
          cout << A[i][j];
        }
      cout << col << endl;
    }   
  for(int i=0;i<c;i++)
    {
      for(int j=0;j<r;j++)
	{
          if(i) cout << " ";
          row+=A[j][0];
        }   
      cout << row << " ";
      int sum+=row;
    }
  cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: expected initializer before '+=' token
   37 |       int sum+=row;
      |              ^~
a.cc:39:11: error: 'sum' was not declared in this scope
   39 |   cout << sum << endl;
      |           ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int T[101][101];
	int r, c;
	int i, j;
	cin >> r >> c;
	for( i=0; i<r; i++ )
		for( j=0; j<c; j++ ) cin >> T[i][j];

	for( i=0; i<=r; i++ ) T[i][c] = 0;
	for( j=0; j<=c; j++ ) T[r][j] = 0;

	for( i=0; i<r; i++ ){
		for( j=0; j<c; j++ ){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for( i=0; i<=r; i++ ){
		for( j=0; j<=c j++ ){
			if(j)cout << " ";
			cout << T[i][j];
		}
		cout << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:31: error: expected ';' before 'j'
   24 |                 for( j=0; j<=c j++ ){
      |                               ^~
      |                               ;
Language: C++

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

int main(){
	int T[101][101],r,c;

	cin >> r >> c;
	for(int i = 0 ; i < r ; i++)
		for(int j = 0 ; j < c ; j++)cin >> T[i][j];

	for(int i = 0; i <= r ; i++ ) T[i][j] = 0;
	for(int j = 0; j <= c ; j++ ) T[r][j] = 0;

	for(int i = 0; i <= r ; i++ ){
		for( int j = 0; j < c ; j++){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for(int i = 0; i <= r ; i++){
		for(int j = 0;j <= c ; j++){
			if(j)cout << " ";
		}
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:44: error: 'j' was not declared in this scope
   11 |         for(int i = 0; i <= r ; i++ ) T[i][j] = 0;
      |                                            ^
Language: C++

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

int main(){
	int T[101][101],r,c,;

	cin >> r >> c;
	for( int i = 0; i < r; i++)
		for(int j = 0; j < c; j++)
			cin >> T[i][j];

	for(int i = 0;i <= r; i++)T[i][c]=0;
	for(int j = 0;j <= c; j++)T[r][j]=0;

	for(int i = 0;i < c;i++){
		for(int j = 0; j < c ; j++){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for(int i = 0; i <= r ; i++){
		for(int j = 0; j <= c;j++){
			if(j)cout << " ";
		}
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:29: error: expected unqualified-id before ';' token
    5 |         int T[101][101],r,c,;
      |                             ^
Language: C++

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

int main(){
	int T[101][101],r,c,;

	cin >> r >> c;
	for( int i = 0; i < r; i++)
		for(int j = 0; j < c; j++)
			cin >> T[i][j];

	for(int i = 0;i <= r; i++)T[i][c]=0;
	for(int j = 0;j <= c; j++)T[r][j]=0;

	for(int i = 0;i < r;i++){
		for(int j = 0; j < c ; j++){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for(int i = 0; i <= r ; i++){
		for(int j = 0; j <= c;j++){
			if(j)cout << " ";
			cout << T[i][j];
		}
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:29: error: expected unqualified-id before ';' token
    5 |         int T[101][101],r,c,;
      |                             ^
Language: C++

#include<bits/stdc++>
using namespace std;
int main(){
int r, c, w[101][101];
cin >> r >> c;
for( int A = 0; A < r; A++ )
 for( int B = 0; B < c; B++ ) cin >> w[A][B] 

for( int A = 0; A < r; A++ ) w[i][c] = 0;
 for( int B = 0; B < c; B++ ) w[r][j] = 0;

for ( int i = 0; i < r; i++ ){
 for ( int j = 0; j < c; j++ ){
  w[i][c] += w[i][j];
  w[r][j] += w[i][j];
  w[r][c] += w[i][j];
 }
}
for ( int i = 0; i <=r; i++ ){
 for ( int j = 0; j <= c; j++){
  if ( j ) cout << " ";
  cout << w[i][j];
 }
 cout << endl;
}
return 0;
}

Compiler output:
a.cc:1:9: fatal error: bits/stdc++: No such file or directory
    1 | #include<bits/stdc++>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int r, c, w[101][101];
cin >> r >> c;
for( int A = 0; A < r; A++ )
 for( int B = 0; B < c; B++ ) cin >> w[A][B] 

for( int A = 0; A < r; A++ ) w[i][c] = 0;
 for( int B = 0; B < c; B++ ) w[r][j] = 0;

for ( int i = 0; i < r; i++ ){
 for ( int j = 0; j < c; j++ ){
  w[i][c] += w[i][j];
  w[r][j] += w[i][j];
  w[r][c] += w[i][j];
 }
}
for ( int i = 0; i <=r; i++ ){
 for ( int j = 0; j <= c; j++){
  if ( j ) cout << " ";
  cout << w[i][j];
 }
 cout << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:45: error: expected ';' before 'for'
    7 |  for( int B = 0; B < c; B++ ) cin >> w[A][B]
      |                                             ^
      |                                             ;
    8 | 
    9 | for( int A = 0; A < r; A++ ) w[i][c] = 0;
      | ~~~                                          
a.cc:9:17: error: 'A' was not declared in this scope
    9 | for( int A = 0; A < r; A++ ) w[i][c] = 0;
      |                 ^
a.cc:10:36: error: 'j' was not declared in this scope
   10 |  for( int B = 0; B < c; B++ ) w[r][j] = 0;
      |                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int r, c, w[101][101];
cin >> r >> c;
for( int i = 0; i < r; i++ )
 for( int j = 0; j < c; j++ ) cin >> w[i][j] 

for( int i = 0; i < r; i++ ) w[i][c] = 0;
 for( int j = 0; j < c; j++ ) w[r][j] = 0;

for ( int i = 0; i < r; i++ ){
 for ( int j = 0; j < c; j++ ){
  w[i][c] += w[i][j];
  w[r][j] += w[i][j];
  w[r][c] += w[i][j];
 }
}
for ( int i = 0; i <=r; i++ ){
 for ( int j = 0; j <= c; j++){
  if ( j ) cout << " ";
  cout << w[i][j];
 }
 cout << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:45: error: expected ';' before 'for'
    7 |  for( int j = 0; j < c; j++ ) cin >> w[i][j]
      |                                             ^
      |                                             ;
    8 | 
    9 | for( int i = 0; i < r; i++ ) w[i][c] = 0;
      | ~~~                                          
a.cc:9:17: error: 'i' was not declared in this scope
    9 | for( int i = 0; i < r; i++ ) w[i][c] = 0;
      |                 ^
Language: C++

#include <iostream>

using namespace std;


int main(void){
  
  int r,c;
  cin >> r >> c;
  int A[r][c];
  int R[r + 1] = {0};
  int C[c] = {0};

  for(int i=0; i<r; i++){
     for(int j=0; j<c; j++){
        cin >> A[[i][j];
     }
  }

  for(int i=0; i<r; i++){
     for(int j=0; j<c; j++){
        C[i] += A[i][j];
        R[j] += A[i][j];
        cout << A[i][j] << " ";
     }
     cout << C[i] << endl;
  }
  for(int i=0; i<c; i++){
     cout << R[i] << " ";
     R[c] += R[i];
  }
     cout << R[c];

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: two consecutive '[' shall only introduce an attribute before '[' token
   16 |         cin >> A[[i][j];
      |                 ^
Language: C++

#include <iostream>

using namespace std;


int main(void){
  
  int r,c;
  int countC = 0;
  cin >> r >> c;
  int countR[c + 1] = {0};
 
  for(int i=0; i<r; i++){
     int number;
     for(int j=0; j<c; j++){
       cin >> number;
       cout << number << " ";
       countC += number;
       countR[j] += number;
     }
     cout << countC << endl;
  }
???
  for(int i=0; i<c; i++){
     cout << countR[i] << " "; 
     countR[c] += countR[i];
  }
  cout << R[c];
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:1: error: expected primary-expression before '?' token
   23 | ???
      | ^
a.cc:23:2: error: expected primary-expression before '?' token
   23 | ???
      |  ^
a.cc:23:3: error: expected primary-expression before '?' token
   23 | ???
      |   ^
a.cc:24:3: error: expected primary-expression before 'for'
   24 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:23:4: error: expected ':' before 'for'
   23 | ???
      |    ^
      |    :
   24 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:24:3: error: expected primary-expression before 'for'
   24 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:23:4: error: expected ':' before 'for'
   23 | ???
      |    ^
      |    :
   24 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:24:3: error: expected primary-expression before 'for'
   24 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:23:4: error: expected ':' before 'for'
   23 | ???
      |    ^
      |    :
   24 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:24:3: error: expected primary-expression before 'for'
   24 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:16: error: 'i' was not declared in this scope
   24 |   for(int i=0; i<c; i++){
      |                ^
a.cc:28:11: error: 'R' was not declared in this scope
   28 |   cout << R[c];
      |           ^
Language: C++

#include <iostream>

using namespace std;


int main(void){
  
  int r,c;
  int countC = 0;
  int *countR;
  cin >> r >> c;
  countR = new int[c];
 
  for(int i=0; i<r; i++){
     int number;
     for(int j=0; j<c; j++){
       cin >> number;
       cout << number << " ";
       countC += number;
       countR[j] += number;
     }
     cout << countC << endl;
  }
???
  for(int i=0; i<c; i++){
     cout << countR[i] << " "; 
     countR[c] += countR[i];
  }
  cout << R[c];
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:1: error: expected primary-expression before '?' token
   24 | ???
      | ^
a.cc:24:2: error: expected primary-expression before '?' token
   24 | ???
      |  ^
a.cc:24:3: error: expected primary-expression before '?' token
   24 | ???
      |   ^
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:25:16: error: 'i' was not declared in this scope
   25 |   for(int i=0; i<c; i++){
      |                ^
a.cc:29:11: error: 'R' was not declared in this scope
   29 |   cout << R[c];
      |           ^
Language: C++

#include <iostream>

using namespace std;


int main(void){
  
  int r,c;
  int countC = 0;
  int *countR;
  cin >> r >> c;
  countR = new int[c];
 
  for(int i=0; i<r; i++){
     int number;
     for(int j=0; j<c; j++){
       cin >> number;
       cout << number << " ";
       countC += number;
       countR[j] += number;
     }
     cout << countC << endl;
  }
???
  for(int i=0; i<c; i++){
     cout << countR[i] << " "; 
     countR[c] += countR[i];
  }
  cout << countR[c];
 delete[] countR;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:1: error: expected primary-expression before '?' token
   24 | ???
      | ^
a.cc:24:2: error: expected primary-expression before '?' token
   24 | ???
      |  ^
a.cc:24:3: error: expected primary-expression before '?' token
   24 | ???
      |   ^
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:24:4: error: expected ':' before 'for'
   24 | ???
      |    ^
      |    :
   25 |   for(int i=0; i<c; i++){
      |   ~~~
a.cc:25:3: error: expected primary-expression before 'for'
   25 |   for(int i=0; i<c; i++){
      |   ^~~
a.cc:25:16: error: 'i' was not declared in this scope
   25 |   for(int i=0; i<c; i++){
      |                ^
Language: C++

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

int main() {
  int r,c;
  cin >> r >> c;
  int table[101][101] = {0};
  for(int a = 0; a < r; ++a) {
    for(int b = 0; b < c; ++b) {
      cin >> table[a][b];
    }
  }
 for (int tate = 0; tate < r; ++tate) {
  for (int yoko = 0; yoko < c; ++yoko) {
    table[tate][c] += table[tate][yoko];
    table[r][yoko] += table[tate][yoko];
  }
  table[r][c] += table[tate][c];
 }
 for(int tate = 0; tate <= r; ++tate) {
   for(int yoko = 0; yoko < c; ++yoko) {
     cout << table[tate][yoko] << " ";
   }
   cout << table[i][c] << endl;
 }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: 'i' was not declared in this scope
   24 |    cout << table[i][c] << endl;
      |                  ^
Language: C++

#include <iostream>

int main(void)
{
	using namespace std;

	int r,c;

	cin >> r;
	cin >> c;

	int Mat[r][c];
	int sums_row[r] = {0}; sums_colmn[c] = {0}; sums_all = 0;

	for(int i=0; i<r; i++){
		for(int j=0; j<c; j++){
			cin >> Mat[i][j];
			sums_row[i] += Mat[i][j];
		}
	}

	for(int j=0; j<c ;j++){
		for(int i=0; i<r; i++)	sums_colmn[j] += Mat[i][j];
		sums_all += sums_colmn[j];
	}

	for(int i=0; i<r; i++){
		for(int j=0; j<c; j++)	cout << Mat[i][j] << " ";
		cout << sums_row[i] <<endl;
	}
	for(int j=0; j<c; j++)	cout << sums_colmn << " ";
	cout << sums_all << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: 'sums_colmn' was not declared in this scope; did you mean 'sums_row'?
   13 |         int sums_row[r] = {0}; sums_colmn[c] = {0}; sums_all = 0;
      |                                ^~~~~~~~~~
      |                                sums_row
a.cc:13:53: error: 'sums_all' was not declared in this scope
   13 |         int sums_row[r] = {0}; sums_colmn[c] = {0}; sums_all = 0;
      |                                                     ^~~~~~~~
Language: C++

#include <stdio.h.>
int main(){
int n,m,temp;
scanf("%d%d",&n,&m);
int a[n+1][m+1];
for(int i=0;i<n;i++){
temp=0;
for(int j=0;j<m;j++){
scanf("%d",&a[i][j]);
temp+=a[i][j];
}
a[i][m]=temp;
}
for(int j=0;j<=m;j++){
temp=0;
for(int i=0;i<n;i++){
temp+=a[i][j];
}
a[n][j]=temp;
}
for(int i=0;i<=n;i++){
printf("%d",a[i][0]);
for(int j=1;j<=m;j++){
printf(" %d",a[i][j]);
}
printf("\n");
}

}

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

#include<stdio.h>

int main(){
  int x,y;
  int i,j;
  scanf("%d %d",&y,&x);
  int num[y+1][x+1],sumy[x+1]=0;

  for(i=0;i<y;i++){
    int sumx=0;
    for(j=0;j<x;j++){
      scanf("%d",&num[i][j]);
      sumx += num[i][j];
      sumy[j] += num[i][j];
    }
    num[i][j]=sumx;
    sumy[x+1] += sumx;
  }
  for(j=0;j<x+1;j++){
    num[y+1][j]=sumy[j];
  }
  for(i=0;i<y+1;i++){
    for(j=0;j<x+1;j++){
      printf("%d ",num[i][j]);
    }
    printf("\n");
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:31: error: array must be initialized with a brace-enclosed initializer
    7 |   int num[y+1][x+1],sumy[x+1]=0;
      |                               ^
Language: C++

#include <stdio.h>
int r,c,i,j,p;
int main(){
  scanf("%d %d",&r,&c);
  int A[r][c];
  int S[r][1];
  int s[1][c];
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&A[i][j]);
    }
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      S[i][0]+=A[i][j];
      s[0][j]+=A[j][i];
    }
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      printf("%d ",A[i][j]);
    }
    printf("%d\n",S[i][0]);
  }
  for(j=0;j<c;j++){
    printf("%d ",s[0][j]);
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      p=S[i][0]+s[0][j];
    }
  }
  printf("%d\n",p)
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: expected ';' before 'return'
   33 |   printf("%d\n",p)
      |                   ^
      |                   ;
   34 |   return 0;
      |   ~~~~~~
Language: C++

#include <stdio.h>
int r,c,i,j,p,q,s;
int main(){
  int A[100][100];
  int S[100][1];
  int s[1][100];
  scanf("%d %d",&r,&c);
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf(" %d",&A[i][j]);
    }
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      S[i][0]+=A[i][j];
    }
  }
  for(i=0;i<c;i++){
    for(j=0;j<r;j++){
      s[0][i]+=A[j][i];
    }
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      printf("%d ",A[i][j]);
    }
    printf("%d\n",S[i][0]);
  }
  for(j=0;j<c;j++){
    printf("%d ",s[0][j]);
  }
  for(i=0;i<r;i++){
    p+=S[i][0];
    }
  for(j=0;j<c;j++){
    q+=s[0][j];
  }
  s=p+q;
  printf("%d\n",s);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:4: error: incompatible types in assignment of 'int' to 'int [1][100]'
   38 |   s=p+q;
      |   ~^~~~
Language: C++

#include <iostream>

int main() {
  int r;
  int c;
  std::cin >> r >> c;

  int *sheet = new int[r * c] = {};
  int *rsum = new int[r] = {};
  int *csum = new int[c] = {};
  int sum = 0;
  for(int i = 0; i < r; ++i) {
    for(int j = 0; j < c; ++j) {
      std::cin >> sheet[i * c + j];
      csum[j] += sheet[i * c + j];
      sum += sheet[i * c + j];
    }
    rsum[i] += sheet[i * c];
  }

  for(int i = 0; i <= r; ++i) {
    for(int j = 0; j <= c; ++j) {
      if(i == r && j == c) {
        std::cout << sum << std::endl;
      }
      else if(i == r) {
        std::cout << csum[j] << " ";
      }
      else if(j == c) {
        std::cout << rsum[i] << std::endl;
      }
      else {
        std::cout << sheet[i * c + j] << " ";
      }
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: lvalue required as left operand of assignment
    8 |   int *sheet = new int[r * c] = {};
      |                ^~~~~~~~~~~~~~
a.cc:9:15: error: lvalue required as left operand of assignment
    9 |   int *rsum = new int[r] = {};
      |               ^~~~~~~~~~
a.cc:10:15: error: lvalue required as left operand of assignment
   10 |   int *csum = new int[c] = {};
      |               ^~~~~~~~~~
Language: C++

// AOJ.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
const int M = 100000;
const double pi = 3.141592653589;

int main(){
	int r, c;
	int a[1000][1000] = { 0 };
	cin >> r >> c;
	for (int i = 0; i < r; i++) {
		for (int k = 0; k < c; k++) {
			cin >> a[i][k];
		}
	}
	for (int i = 0; i < r; i++) {
		for (int k = 0; k < c; k++) {
			a[i][c] += a[i][k];
		}
	}
	for (int i = 0; i <= c; i++) {
		for (int k = 0; k < r; k++) {
			a[r][i] += a[k][i];
		}
	}

	for (int i = 0; i <= r; i++) {
		for (int k = 0; k <= c; k++) {
			cout << a[i][k];
			if (k == c)cout << endl;
			else cout << " ";
		}
	}

	return 0;
}

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

#include<iostream>
#include<vector>


int main(void){
    int r,c;
    std::cin>>r>>c;
    std::vector<std::vector<int>> data(r,std::vector<int>(c,0));
    int i,j;
    for(i=0;i<r;i++){
        int sum=0;
        for(j=0;j<c;j++){
            std::cin>>data[i][j];
            sum+=data[i][j];
        }
        data[i].push_back(sum);
    }
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            std::cout<<data[i][j]<<" ";
        }
        std::cout<<std::endl;
    }
    for(i=0;i<c;i++){
        sum=0;
        for(j=0;j<r;j++){
            sum+=data[j][i];
        }
        std::cout<<sum<<" ";
    }
    std::cout<<std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'sum' was not declared in this scope
   25 |         sum=0;
      |         ^~~
Language: C++

#include<iostream>
#include<cmath>
#include<string>
#include<cstdlib>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<string.h>

using namespace std;




int main()
{
	int a[105][105],b[105][105];//r??????c??????
	int c,r,count=0;
	while(cin>>r>>c)
	{
		int sum=0;
		memset(b,0,105*105*sizeof(int));
		for(int i=1;i<=r;i++)
			for(int j=1;j<=c;j++)
				cin>>a[i][j];
		for(int i=1;i<=r;i++)
			for(int j=1;j<=c;j++)
			{	b[i][j]=a[i][j];
		
			
			sum+=a[i][j];
			if(j==c)
				{
					b[i][j+1]=sum;
					
			sum=0;
			continue;
			}
		
		
		}
		for(int j=1;j<=c;j++)
			for(int i=1;i<=r;i++)
			{	
		
			
			sum+=a[i][j];
			if(i==r)
				{
					b[i+1][j]=sum;
					count+=sum;
			sum=0;
			continue;
			}
		
		
		}
			b[r+1][c+1]=count;
			for(int i=1;i<=r+1;i++)
				{
					for(int j=1;j<=c+1;j++)
					{
						cout<<b[i][j];
						if(j!=c+1)
							cout<<" ";
			if(j==c+1)
				cout<<endl;
					}
			}





	
	
	
	
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:10: error: expected '}' at end of input
   79 |         }
      |          ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int r, c;
	int buf, sum;
	vector<int> tmp;
	vector<vector<int>> mat;

	cin >> r >> c;

	for(int i = 0;i < r;i++) {
		sum = 0;

		for(int j = 0;j < c;j++) {
			cin >> buf;

			tmp.push_back(buf);
			sum += buf;
		}

		tmp.push_back(sum);
		mat.push_back(tmp);

		tmp.clear();
	}

	for(int i = 0;i < c + 1;i++) {
		sum = 0;

		for(int j = 0;j < r;j++) {
			sum += mat[j][i];
		}

		tmp.push_back(sum);
	}

	mat.push_back(tmp);

	for(int i = 0;i < r + 1;i++) {
		for(int j = 0;j < c + 1;j++) {
			cout << mat[i][j];

			if(j < c)
				cout << " ";
		}

		cout << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> tmp;
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> tmp;
      |                ^~~
a.cc:10:23: error: expected primary-expression before 'int'
   10 |         vector<vector<int>> mat;
      |                       ^~~
a.cc:20:25: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   20 |                         tmp.push_back(buf);
      |                         ^~~
      |                         tm
a.cc:24:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   24 |                 tmp.push_back(sum);
      |                 ^~~
      |                 tm
a.cc:25:17: error: 'mat' was not declared in this scope
   25 |                 mat.push_back(tmp);
      |                 ^~~
a.cc:34:32: error: 'mat' was not declared in this scope
   34 |                         sum += mat[j][i];
      |                                ^~~
a.cc:37:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   37 |                 tmp.push_back(sum);
      |                 ^~~
      |                 tm
a.cc:40:9: error: 'mat' was not declared in this scope
   40 |         mat.push_back(tmp);
      |         ^~~
a.cc:40:23: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   40 |         mat.push_back(tmp);
      |                       ^~~
      |                       tm
Language: C++

package main

import "fmt"

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_&Alang=jp>
 */

func init() {
}

func main() {
	var r, c int
	fmt.Scanf("%d %d", &r, &c)
	sheet := make([][]int, r+1)
	for i := 0; i <= r; i++ {
		sheet[i] = make([]int, c+1)
	}

	for i := 0; i < r; i++ {
		for j := 0; j < c; j++ {
			fmt.Scanf("%d", &sheet[i][j])
			sheet[r][j] += sheet[i][j]
			sheet[i][c] += sheet[i][j]
			sheet[r][c] += sheet[i][j]
		}
	}

	for i := 0; i <= r; i++ {
		for j := 0; j <= c; j++ {
			fmt.Print(sheet[i][j])
			if j != c{
				fmt.Print(" ")
			}
		}
		fmt.Println("")
	}
}

Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:12:1: error: 'func' does not name a type
   12 | func main() {
      | ^~~~
Language: C++

fun main(args: Array<String>) {
    val (r, c) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val matrix = Array(r, { intArrayOf() })
    val rowList = arrayListOf<Int>()
    for (i in 0 until r) {
        val elements = readLine()?.split(" ")?.map { it.toInt() }?.toMutableList() ?: return
        rowList.add(elements.sum())
        matrix[i] = elements.toIntArray()
    }
    val builder = StringBuilder()
    val colSumList = arrayListOf<Int>()
    for ((i, row) in matrix.withIndex()) {
        row.forEachIndexed { j, element ->
            if (colSumList.size < c) {
                colSumList.add(element)
            } else {
                colSumList[j] += element
            }
        }
        builder.append(row.joinToString(" "))
                .append(" ${rowList.get(i)}")
                .appendln()
    }
    builder.append(colSumList.joinToString(" "))
            .append(" ${colSumList.filterNotNull().sum()}")
    println(builder.toString())
}


Compiler output:
a.cc:1:1: error: 'fun' does not name a type
    1 | fun main(args: Array<String>) {
      | ^~~
Language: C++

#include <iostream>
using namespace std;
int main() {
    int n, m, p;
    cin >> n >> m;
    int array[n][m] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> p;
            array[i][j] = p;
        }
    }

    int array2[n+1][m+1] = {};
    int ysum = 0;
    int xsum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
                array2[i][j] = array[i][j];

            }
        }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m + 1; j++) {
            ysum += array2[i][j];
            if (j == m) {
                array2[i][j] = ysum;
            }
        } ysum = 0;
    }

    for (int i = 0; i < m + 1 5; i++) {
        for (int j = 0; j < n + 1; j++) {
            xsum += array2[j][i];
            if (j == n) {
                array2[j][i] = xsum;
            }
        } xsum = 0;
    }

    for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < m + 1; j++) {

            cout << array2[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: expected ';' before numeric constant
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |                              ^~
      |                              ;
a.cc:32:32: error: expected ')' before ';' token
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |         ~                      ^
      |                                )
a.cc:32:34: error: 'i' was not declared in this scope
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |                                  ^
Language: C++

#include <iostream>
using namespace std;
int main() {
    int n, m, p;
    cin >> n >> m;
    int array[n][m] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> p;
            array[i][j] = p;
        }
    }

    int array2[n+1][m+1] = {};
    int ysum = 0;
    int xsum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
                array2[i][j] = array[i][j];

            }
        }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m + 1; j++) {
            ysum += array2[i][j];
            if (j == m) {
                array2[i][j] = ysum;
            }
        } ysum = 0;
    }

    for (int i = 0; i < m + 1 5; i++) {
        for (int j = 0; j < n + 1; j++) {
            xsum += array2[j][i];
            if (j == n) {
                array2[j][i] = xsum;
            }
        } xsum = 0;
    }

    for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < m + 1; j++) {
            if (j == m) {
                cout << array2[i][j] << endl;
            }
            cout << array2[i][j] << " ";
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: expected ';' before numeric constant
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |                              ^~
      |                              ;
a.cc:32:32: error: expected ')' before ';' token
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |         ~                      ^
      |                                )
a.cc:32:34: error: 'i' was not declared in this scope
   32 |     for (int i = 0; i < m + 1 5; i++) {
      |                                  ^
Language: C++

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
			int r=scan.nextInt();
			int c=scan.nextInt();
			int a[][] = new int[101][101];
			int sum1[] = new int[101];
			int sum[] =new int[101];
			int sum2=0;
			for(int i=0;i<r;i++) {
				for(int j=0;j<c;j++) {
					a[i][j]=scan.nextInt();
					sum[i] +=a[i][j];
					sum1[j] +=a[i][j];
					if(i == r-1) {
						a[r][j] = sum1[j];
					}
				}
				a[i][c] =sum[i];
				sum2 += sum[i];
				if(i == r-1) {
					a[r][c] = sum2;
				}
			}
			for(int i=0;i<=r;i++) {
				for(int j=0;j<=c;j++) {
					System.out.printf(a[i][j]+" ");
				}
				System.out.println();
			}
		scan.close();
}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Test {
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,c;
  cin >> r >> c;
  int a[101][101] = {};

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) cin >> a[i][j];

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) a[r][c] += a[i][j];

  for(int i=0; i<r; i++){
    int sum = 0;
    for(int j=0; j<c; j++) {
        sum += a[i][j];
    }
    a[i][c] = sum;
  }

  for(int i=0; i<r; i++){
    int sum = 0;
    for(int j=0; j<c; j++){
        sum += a[i][j];
    }
    a[r][j] = sum;
  }

 for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
	if(j) cout << " ";
	cout << a[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'j' was not declared in this scope
   27 |     a[r][j] = sum;
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,c;
  cin >> r >> c;
  int a[101][101] = {};

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) cin >> a[i][j];

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) a[r][c] += a[i][j];

  for(int i=0; i<r; i++){
    int sum = 0;
    for(int j=0; j<c; j++) {
        sum += a[i][j];
    }
    a[i][c] = sum;
  }

  for(int j=0; j<r; j++){
    int sum = 0;
    for(int j=0; j<c; j++){
        sum += a[i][j];
    }
    a[r][j] = sum;
  }

 for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
	if(j) cout << " ";
	cout << a[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: 'i' was not declared in this scope
   25 |         sum += a[i][j];
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,c;
  cin >> r >> c;
  int a[101][101] = {};

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) cin >> a[i][j];

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) a[r][c] += a[i][j];

  for(int i=0; i<r; i++){
    int sum = 0;
    for(int j=0; j<c; j++) {
        sum += a[i][j];
    }
    a[i][c] = sum;
  }

  for(int j=0; j<c; j++){
    int sum = 0;
    for(int j=0; j<c; j++){
        sum += a[i][j];
    }
    a[r][j] = sum;
  }

 for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
	if(j) cout << " ";
	cout << a[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: 'i' was not declared in this scope
   25 |         sum += a[i][j];
      |                  ^
Language: C++

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

int main(){
    r,c;
    cin>>r>>c;
    
    int num[101][101]={};
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++) cin>>num[i][j];
        
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++) num[r][c]+=num[i][j]
        
    for(int i=0;i<r;i++){
        int sum=0;
        for(int j=0;j<c;j++) sum=+num[i][j];
        num[i][j]=sum;
    }
    
    for(int j=0;j<c;j++){
        int sum=0;
        for(int i=0;i<r;i++) sum+=num[i][j];
        num[r][j]=sum;
    }
    
    for(int i=0;i<=r;i++){
        for(int j=0;j<=c;j++){
            if(j) cout<<num[i][j];
        }
        cout<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'r' was not declared in this scope
    5 |     r,c;
      |     ^
a.cc:5:7: error: 'c' was not declared in this scope
    5 |     r,c;
      |       ^
a.cc:15:17: error: 'i' was not declared in this scope
   15 |     for(int i=0;i<r;i++){
      |                 ^