Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	for scanner.Scan() {
		table := [9][9]int{}
		check := [9][9]bool{}
		n, _ := strconv.Atoi(scanner.Text())
		for n > 0 {
			n--
			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()
			}
		}
	}
}

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

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

int main(){
  int n;
  int p[9][9];
  char map[9][9];
  int check[9];

  cin >> n;
  while(n){
    n--;

    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin >> p[i][j];
	map[i][j] = ' ';
      }
    }

    for(int i=0;i<9;i++){
      for(int j=1;j<10;j++)check[j] = 0;
      for(int j=0;j<9;j++)check[p[i][j]]++;
      for(int j=0;j<9;j++){
	if(check[p[i][j]]>1)map[i][j] = '*';
      }
    }

    for(int i=0;i<9;i++){
      for(int j=1;j<10;j++)check[j] = 0;
      for(int j=0;j<9;j++)check[p[j][i]]++;
      for(int j=0;j<9;j++){
	if(check[p[j][i]]>1)map[j][i] = '*';
      }
    }

    for(int i=0;i<9;i+=3){
      for(int j=0;j<9;j+=3){
	for(int k=1;k<10;k++)check[k] = 0;
	for(int k=i;k<3;k++){
	  for(int l=j;l<3;l++)check[p[i+k][j+l]]++;
	  for(int l=0;l<3;l++){
	    if(check[p[i+k][j+l]]>1)map[i+k][j+l] = '*';
	  }
	}
      }
    }
 
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cout << map[i][j] << p[i][j];
      }
      cout << endl;
    }
    cout << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main()
{
	int p[9][9]={},s[9][9]={},a;
	cin>>a;
	for(int v=0;v<a;v++){
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			cin>>p[i][j];
		}
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			for(int k=0;k<9;k++){
				if(p[i][j]==p[i][k]&&j!=k){
					s[i][j]=1;
				}
		}
		}
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			for(int k=0;k<9;k++){
				if(p[j][i]==p[k][i]&&j!=k){
					s[j][i]=1;
				}
			}
		}
	}
	int x=0,y=0;
	for(;;){
		for(int i=y;i<y+3;i++){
			for(int j=x;j<x+3;j++){
				for(int k=y;k<y+3;k++){
					for(int l=x;l<x+3;l++){
						if(p[i][j]==p[k][l]&&i!=k&&j!=l){
							s[j][i]=1;
						}
					}
				}
			}
		}
		if(x==6&&y==6)
			break;
		if(x==6){
			x=0;
			y+=3;
		}
		else
			x+=3;
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			if(s[i][j]==1)
				cout<<"*";
			else
				cout<<" ";
			cout<<p[i][j];
		}
		cout<<"\n";
	}
	int s[9][9]={};
	}
	return 0;
}

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

int puzzle[9][9];
 
void field(int x, int &to, int &from)
{
    if (0 <= x && x < 3) {
	to = 0;
	from = 3;
    } else if (3 <= x && x < 6) {
	to = 3;
	from = 6;
    } else {
	to = 6;
	from = 9;
    }
}
 
bool check1(int x, int y)
{
    for (int i = x-1; i >= 0; i--) {
	if (puzzle[x][y] == puzzle[i][y]) return 0;
    }
    for (int i = x+1; i < 9; i++) {
	if (puzzle[x][y] == puzzle[i][y]) return 0;
    }
    return 1;
}
 
bool check2(int x, int y)
{
    for (int i = y-1; i >= 0; i--) {
	if (puzzle[x][y] == puzzle[x][i]) return 0;
    }
    for (int i = y+1; i < 9; i++) {
	if (puzzle[x][y] == puzzle[x][i]) return 0;
    }
    return 1;
}
 
bool check3(int x, int y)
{
    int sx, tx, sy, ty;
 
    field(x, sx, tx);
    field(y, sy, ty);
    for (int i = sx; i < tx; i++) {
	for (int j = sy; j < ty; j++) {  
	    if (x == i && y == j) continue;
	    if (puzzle[x][y] == puzzle[i][j]) return 0;
	}
    }
    return 1;
}
 
int main()
{
    int T;
 
    cin >> T;
    for (int t = 0; t < T; t++) {
	if(t) cout << endl;
	for (int i = 0; i < 9; i++) {
	    for (int j = 0; j < 9; j++) {
		cin >> puzzle[i][j];
	    }
	}
 	char ch[9][9];
	for (int i = 0; i < 9; i++) {
	    for (int j = 0; j < 9; j++) {
		ch[i][j] = ' ';
	    }
	}
 	for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
		if (check1(i, j) && check2(i, j) && check3(i, j)) continue;
		ch[i][j] = '*';
	    }
	}
        for (int i = 0; i < 9; i++) {
	    for (int j = 0; j < 9; j++) {
		cout << ch[i][j] << puzzle[i][j];
	    }
	    cout << endl;
	}
    }
    return 0;
}

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

int main(){

	int n, row[10][10], colume[10][10], m[10][10], block[3][3][9];

	cin >> n;
	
	for(int i=0; i<n; i++){
	
		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				row[j][k] = 0;
				colume[j][k] = 0;
  		  }
   		for(int k=0; k<3; k++){
	      for(int l=0; l<3; l++){
    			block[k][l][j] = 0;
    		}
  	  }
    }

		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				scanf("%d", &m[j][k]);
				row[j][m[j][k]]++;
				colume[k][m[j][k]]++;
				block[((j-1)-(j-1)%3)/3][((k-1)-(k-1)%3)/3][m[j][k]]++;
			}
		}

		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				if(row[j][m[j][k]] == 1 && colume[k][m[j][k]] == 1 && block[((j-1)-(j-1)%3)/3][((k-1)-(k-1)%3)/3][m[j][k]] == 1){
					cout << " ";
				}
				else{
					cout << "*";
				}
				cout << m[j][k];
			}
			cout << endl;
		}
		
		if(i!=n-1) cout << endl;
		
	}

	return 0;

}