Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	table := [9][9]int{}
	check := [9][9]bool{}
	n, _ := strconv.Atoi(scanner.Text())
	for n > 0 {
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				table[i][j] = nextInt()
			}
		}
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				ok := true
				for k := 0; k < 9; k++ {
					if table[i][j] == table[i][k] && j != k {
						ok = false
					}
				}
				for k := 0; k < 9; k++ {
					if table[i][j] == table[k][j] && i != k {
						ok = false
					}
				}
				seci := i / 3
				secj := j / 3
				for k := 0; k < 3; k++ {
					for l := 0; l > 3; l++ {
						if table[seci*3+k][secj*3+l] == table[i][j] && seci*3+k != i && secj*3+l != j {
							ok = false
						}
					}
				}
				if !ok {
					check[i][j] = true
				}
			}
		}
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				if check[i][j] {
					fmt.Print("*")
				} else {
					fmt.Print(" ")
				}
				fmt.Print(table[i][j])
			}
			fmt.Println()
		}
		if n != 0 {
			fmt.Println()
		}
		n--
	}
}

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	int n;
	
	cin >> n;
	
	int map[10][10];
	
	bool check[10][10];
	
	int chec[10];
	
	for(int loop = 0; loop < n; loop++){
		
		if(loop != 0){
			cout << endl;
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				cin >> map[i][j];
				check[i][j] = false;
			}
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j <= 9; j++){
				chec[j] = 0;
			}
			
			for(int j = 0; j < 9; j++){
				chec[map[j][i]]++;
			}
			
			for(int j = 1; j <= 9; j++){
				if(chec[j] > 1){
					for(int k = 0; k < 9; k++){
						if(map[k][i] == j){
							check[k][i] = true;
						}
					}
				}
			}
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j <= 9; j++){
				chec[j] = 0;
			}
			
			for(int j = 0; j < 9; j++){
				chec[map[i][j]]++;
			}
			
			for(int j = 1; j <= 9; j++){
				if(chec[j] > 1){
					for(int k = 0; k < 9; k++){
						if(map[i][k] == j){
							check[i][k] = true;
						}
					}
				}
			}
		}
		
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 3; k++){
					for(int l = 0; l <= 3; l++){
						chec[k * 3 + l] = 0;
					}
				}
				
				for(int k = 0; k < 3; k++){
					for(int l = 0; l < 3; l++){
						chec[map[i * 3 + k][j * 3 + l]]++;
					}
				}
				
				for(int k = 1; k <= 9; k++){
					if(chec[k] > 1){
						for(int m = 0; m < 3; m++){
							for(int l = 0; l < 3; l++){
								if(map[i * 3 + m][j * 3 + l] == k){
									check[i * 3 + m][j * 3 + l] = true;
								}
							}
						}
					}
				}
				
			}
		}
		
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				if(check[i][j]){
					cout << "*";
				}else{
					cout << " ";
				}
				cout << map[i][j];
			}
			cout << endl;
		}
	}
	
	return 0;
}

C++: #include<cstdio>
#include<cstring>

using namespace std;

int n;
int fie[9][9];
int used[10];
bool ok[9][9];

bool check(){
	memset(ok,false,sizeof(ok));
	for(int i=0;i<9;i++){
		memset(used,0,sizeof(used));
		for(int j=0;j<9;j++)used[fie[j][i]]++;
		for(int j=0;j<9;j++)if(used[fie[j][i]]>=2)ok[j][i]=true;
	}
	
	for(int i=0;i<9;i++){
		memset(used,0,sizeof(used));
		for(int j=0;j<9;j++)used[fie[i][j]]++;
		for(int j=0;j<9;j++)if(used[fie[i][j]]>=2)ok[i][j]=true;
	}
	
	for(int i=0;i<9;i++){
		int x=i%3*3;
		int y=i/3*3;
		memset(used,0,sizeof(used));
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				used[fie[x+j][y+k]]++;
			}
		}
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(used[fie[x+j][y+k]]>=2)ok[x+j][y+k]=true;
			}
		}
	}
}

int main(void){
	scanf("%d",&n);
	for(int data=0;data<n;data++){
		if(data!=0)printf("\n");
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++)scanf("%d",&fie[j][i]);
		}
		check();
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++)printf("%c%d",ok[j][i]?'*':' ',fie[j][i]);
			printf("\n");
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
using namespace std;

int N;
struct Pos {
	int x, y;
};

int main() {
	scanf(" %d", &N);
	for(int i = 0; i < N; i++) {
		if(i != 0) {
			puts("");
		}
		// arr[y][x]
		int arr[9][9];
		bool fail[9][9];
		memset(fail, 0, sizeof fail);

		for(int y = 0; y < 9; y++) {
			for(int x = 0; x < 9; x++) {
				scanf(" %d", &arr[y][x]);
			}
		}
		for(int x = 0; x < 9; x++) {
			int count[10];
			memset(count, 0, sizeof count);
			for(int y = 0; y < 9; y++) {
				count[arr[y][x]]++;
			}
			for(int i = 1; i <= 9; i++) {
				if(count[i] != 1) {
					for(int y = 0; y < 9; y++) {
						if(arr[y][x] == i)
							fail[y][x] = true;
					}
				}
			}
		}

		for(int y = 0; y < 9; y++) {
			int count[10];
			memset(count, 0, sizeof count);
			for(int x = 0; x < 9; x++) {
				count[arr[y][x]]++;
			}
			for(int i = 1; i <= 9; i++) {
				if(count[i] != 1) {
					for(int x = 0; x < 9; x++) {
						if(arr[y][x] == i)
							fail[y][x] = true;
					}
				}
			}
		}

		Pos p[9] = {{1, 1}, {1, 4}, {1, 7}, {4, 1}, {4, 4}, {4, 7}, {7, 1}, {7, 4}, {7, 7}};
		for(int i = 0; i < 9; i++) {
			int cx = p[i].x;
			int cy = p[i].y;
			int count[10];
			memset(count, 0, sizeof count);
			for(int x = -1; x <= 1; x++) {
				for(int y = -1; y <= 1; y++) {
					int nx = cx + x;
					int ny = cy + y;
					count[arr[ny][nx]]++;
				}
			}
			for(int j = 1; j <= 9; j++) {
				if(count[j] != 1) {
					for(int x = -1; x <= 1; x++) {
						for(int y = -1; y <= 1; y++) {
							int nx = cx + x;
							int ny = cy + y;
							if(arr[ny][nx] == j) {
								fail[ny][nx] = true;
							}
						}
					}
				}
			}
		}

		for(int y = 0; y < 9; y++) {
			for(int x = 0; x < 9; x++) {
				putchar(fail[y][x] ? '*' : ' ');
				printf("%d", arr[y][x]);
			}
			puts("");
		}
	}

	return 0;
}

C++: #include <cstdio>
using namespace std;

int main() {
  int n;
  int a[9][9];
  bool b[9][9];
  int c[10];
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    for (int j=0; j<9; j++) {
      for (int k=0; k<9; k++) {
        scanf("%d", &a[j][k]);
      }
    }
    for (int j=0; j<9; j++) {
      for (int k=0; k<9; k++) {
        b[j][k] = false;
      }
    }
    for (int j=0; j<9; j++) {
      for (int k=1; k<=9; k++) c[k] = 0;
      for (int k=0; k<9; k++) {
        ++c[a[j][k]];
      }
      for (int k=0; k<9; k++) {
        if (c[a[j][k]]>1) b[j][k] = true;
      }
    }
    for (int j=0; j<9; j++) {
      for (int k=1; k<=9; k++) c[k] = 0;
      for (int k=0; k<9; k++) {
        ++c[a[k][j]];
      }
      for (int k=0; k<9; k++) {
        if (c[a[k][j]]>1) b[k][j] = true;
      }
    }
    for (int j=0; j<3; j++) {
      for (int jj=0; jj<3; jj++) {
        for (int k=1; k<=9; k++) c[k] = 0;
        for (int k=0; k<3; k++) {
          for (int kk=0; kk<3; kk++) {
            int p = 3*j+k;
            int q = 3*jj+kk;
            ++c[a[p][q]];
          }
        }
        for (int k=0; k<3; k++) {
          for (int kk=0; kk<3; kk++) {
            int p = 3*j+k;
            int q = 3*jj+kk;
            if (c[a[p][q]]>1) b[p][q] = true;
          }
        }
      }
    }

    if (i) {
      printf("\n");
    }
    for (int j=0; j<9; j++) {
      for (int k=0; k<9; k++) {
        if (b[j][k]) {
          putchar('*');
        } else {
          putchar(' ');
        }
        printf("%d", a[j][k]);
      }
      putchar('\n');
    }
  }

  return 0;
}