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 <bits/stdc++.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 <cstring>
using namespace std;

int board[9][9];
bool ok[9][9];

void check() {
    int cnt[10] = {};
    for(int i=0; i<9; ++i) {
        memset(cnt, 0, sizeof(cnt));
        for(int j=0; j<9; ++j) cnt[board[i][j]]++;
        for(int j=0; j<9; ++j)
            if(cnt[board[i][j]] > 1) ok[i][j] = false;

        memset(cnt, 0, sizeof(cnt));
        for(int j=0; j<9; ++j) cnt[board[j][i]]++;
        for(int j=0; j<9; ++j)
            if(cnt[board[j][i]] > 1) ok[j][i] = false;
    }

    for(int i=0; i<3; ++i)
        for(int j=0; j<3; ++j) {
            memset(cnt, 0, sizeof(cnt));
            for(int k=0; k<3; ++k)
                for(int l=0; l<3; ++l)
                    cnt[board[i*3+k][j*3+l]]++;

            for(int k=0; k<3; ++k)
                for(int l=0; l<3; ++l)
                    if(cnt[board[i*3+k][j*3+l]] > 1) ok[i*3+k][j*3+l] = false;
        }
}

int main() {
    int n;
    cin>>n;
    while(n--) {
        for(int i=0; i<9; ++i)
            for(int j=0; j<9; ++j)
                cin>>board[i][j];
        memset(ok, true, sizeof(ok));
        check();

        for(int i=0; i<9; ++i) {
            for(int j=0; j<9; ++j)
                cout<<((ok[i][j])?" ":"*")<<board[i][j];
            cout<<endl;
        }
        cout<<endl;
    }
}

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

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

  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<i+3;k++){
	  for(int l=j;l<j+3;l++)check[p[k][l]]++;
	}
	for(int k=i;k<i+3;k++){
	  for(int l=j;l<j+3;l++){
	    if(check[p[k][l]]>1)map[k][l] = '*';
	  }
	}
      }
    }
 
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cout << map[i][j] << p[i][j];
      }
      cout << endl;
    }
    if(n)cout << endl;
  }
}

C++: #include "bits/stdc++.h"

using namespace std;

#define rep(a,b) for(int (a)=0; (a)<b;(a)++)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

int main(){
	int n;
	cin>>n;
	int c=0;
	rep(loop,n){
		if(c!=0)cout<<endl;
		c++;
		int data[9][9];
		bool isOK[9][9];
		rep(i,9)rep(j,9)cin>>data[i][j];

		rep(i,9)rep(j,9)isOK[i][j]=true;

		rep(i,9){
			int used[10]={};
			rep(j,9){
				used[ data[i][j] ]++;
			}
			for(int j=1;j<10;j++){
				if( used[j]>=2 ){
					rep(k,9)
						if(data[i][k]==j)
							isOK[i][k]=false;
				}
			}
		}

		rep(j,9){
			int used[10]={};
			rep(i,9){
				used[ data[i][j] ]++;
			}
			for(int i=1;i<10;i++){
				if( used[i]>=2 ){
					rep(k,9)
						if(data[k][j]==i)
							isOK[k][j]=false;
				}
			}
		}

		rep(I,3){
			rep(J,3){
				int used[10]={};
				rep(i,3){
					rep(j,3){
						used[ data[I*3+i][J*3+j] ] ++;
					}
				}
				for(int k=1;k<10;k++){
					if(used[k]>=2){
						rep(i,3){
							rep(j,3){
								if(data[I*3+i][J*3+j]==k)
									isOK[I*3+i][J*3+j]=false;
							}
						}
					}
				}
			}
		}

		rep(i,9){
			rep(j,9){
				if(isOK[i][j]==true)cout<<" ";
				else cout<<"*";
				cout<<data[i][j];
			}
			cout<<endl;
		}
	}
	return 0;
}