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 {
		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>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
  bool error[10][10];
  int puzzle[10][10];
  
  int T;
  cin >> T;
  while(T--){
    for(int i = 0 ; i < 9 ; i++){
      for(int j = 0 ; j < 9 ; j++){
	cin >> puzzle[i][j];
      }
    }
    
    memset(error, 0, sizeof(error));
    int check1[10];
    int check2[10];
    
    for(int i = 0 ; i < 9 ; i++){
      memset(check1, 0, sizeof(check1));
      memset(check2, 0, sizeof(check2));
      for(int j = 0 ; j < 9 ; j++){
	check1[puzzle[i][j]]++;
	check2[puzzle[j][i]]++;
	
	if(check1[puzzle[i][j]] >= 2){
	  for(int k = 0 ; k < 9 ; k++){
	    if(puzzle[i][k] == puzzle[i][j]) error[i][k] = true;
	  }
	}
	
	if(check2[puzzle[j][i]] >= 2){
	  for(int k = 0 ; k < 9 ; k++){
	    if(puzzle[k][i] == puzzle[j][i]) error[k][i] = true;
	  }
	}
	
      }
    }

    for(int k = 0 ; k < 9 ; k+=3){
      for(int l = 0 ; l < 9 ; l+=3){
	memset(check1, 0, sizeof(check1));
	memset(check2, 0, sizeof(check2));
	for(int i = k ; i < k+3 ; i++){
	  for(int j = l ; j < l+3 ; j++){
	    check1[puzzle[i][j]]++;
	    if(check1[puzzle[i][j]] >= 2){
	      for(int _i = k ; _i < k+3 ; _i++){
		for(int _j = l ; _j < l+3 ; _j++){
		  if(puzzle[i][j] == puzzle[_i][_j]) error[_i][_j] = true;
		}
	      }
	    }
	  }
	}
      }
    }
    
    for(int i = 0 ; i < 9 ; i++){
      for(int j = 0 ; j < 9 ; j++){
	cout << ((error[i][j]) ? '*' : ' ') << puzzle[i][j];
      }
      cout << endl;
    }
    if(T)cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <map>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	cin >> n;

	int f[9][9];
	bool flag[9][9];
	map<int,int> ma;
	bool first = true;
	
	while(n--)
	{
		memset(f,0,sizeof(f));

		rep(i,9)
		{
			rep(j,9)
			{
				flag[i][j] = false;
			}
		}

		rep(i,9)
		{
			rep(j,9)
			{
				cin >> f[i][j];
			}
		}

		rep(i,9)
		{
			ma.clear();
			rep(j,9)
			{
				ma[f[i][j]-1]++;
			}

			rep(j,9)
			{
				if(ma[f[i][j]-1] > 1)
				{
					flag[i][j] = true;
				}
			}
		}
		
		
		rep(i,9)
		{
			ma.clear();
			
			rep(j,9)
			{
				ma[f[j][i]-1]++;
			}

			rep(j,9)
			{
				if(ma[f[j][i]-1] > 1)
				{
					flag[j][i] = true;
				}
			}
		}

		int count = 0;
		int x = 0,y = 0;
		while(count != 9)
		{
			ma.clear();
			REP(i,x,x+3)
			{
				REP(j,y,y+3)
				{
					ma[f[i][j]-1]++;
				}
			}

			REP(i,x,x+3)
			{
				REP(j,y,y+3)
				{
					if(ma[f[i][j]-1] > 1)
					{
						flag[i][j] = true;
					}
				}
			}

			if(x+2 == 8)
			{
				if(y+2 == 8)
				{
					break;
				}
				x = 0;
				y += 3;
			}
			else
			{
				x += 3;
			}
		}

		if(first)
		{
			first = false;
		}
		else
		{
			cout << endl;
		}

		rep(i,9)
		{
			rep(j,9)
			{
				if(flag[i][j])
				{
					cout << "*" << f[i][j];
				}
				else
				{
					cout << " " << f[i][j];
				}
			}
			cout << endl;
		}
	}

	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(){
  int n,m[9][9];
  char c[9][9];
  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",&m[j][k]);
	c[j][k] = ' ';
      }
    }
    int dx[9] = {0,1,2,0,1,2,0,1,2};
    int dy[9] = {0,0,0,1,1,1,2,2,2};
    for(int l=0;l<9;l++){
      for(int j=0;j<8;j++){
	for(int k = j+1;k<9;k++){
	  if(m[l][j] == m[l][k]){
	    c[l][j] = '*';
	    c[l][k] = '*';
	  }
	  if(m[j][l] == m[k][l]){
	    c[j][l] = '*';
	    c[k][l] = '*';
	  }
	}
      }
    }
    
    for(int j=0;j<=6;j+=3){
      for(int k=0;k<=6;k+=3){
	for(int l=0;l<8;l++){
	  for(int o=l+1;o<9;o++){
	    if(m[j+ dy[l]][k+ dx[l]] == m[j+ dy[o]][k+ dx[o]]){
	      c[j+ dy[l]][k+ dx[l]] = '*';
	      c[j+ dy[o]][k+ dx[o]] = '*';
	    }
	  }
	}
      }
    }

    for(int j=0;j<9;j++){
      for(int k=0;k<9;k++){
	printf("%c%d",c[j][k],m[j][k]);
      }
      putchar('\n');
    }
    putchar('\n');
  }
  return (0);
}

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

int main(){
    int N;
    for(scanf("%d", &N); N--;){
        char pz[9][12] = {};
        char res[9][12] = {};
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                scanf(" %c", &pz[i][j]);
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                bool flg = true;
                for(int k = 0; k < 9; k++){
                    if(i == k) continue;
                    if(pz[i][j] == pz[k][j]) flg = 0;
                }
                for(int k = 0; k < 9; k++){
                    if(j == k) continue;
                    if(pz[i][j] == pz[i][k]) flg = 0;
                }
                int r = i/3, c = j/3;
                for(int k = 0; k < 3; k++){
                    for(int l = 0; k < 3; l++){
                        if(r + k == i && c + l == j) continue;
                        if(pz[i][j] == pz[r+k][c+l]) flg = 0;
                    }
                }
                if(flg){
                    res[i][j] = ' ';
                }else{
                    res[i][j] = '*';
                }
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                printf("%c", res[i][j]);
                printf("%c", pz[i][j]);
            }
            puts("");
        }
        if(N>=1) puts("");
    }
    return 0;
}