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 <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

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

const int INF = 10000000;
using namespace std;
typedef long long  ll;

/** Problem0126 : Puzzle **/
int main()
{
	int board[9][9];
	bool wrong[9][9];
	int n;
	
	cin >> n;
	rep(k, n) {
		rep(y, 9) rep(x, 9)  {
			cin >> board[x][y]; board[x][y]--;
			wrong[x][y] = false;
		}

		int use[9];
		
		rep(i, 9) {
			// 横
			fill(use, use+9, -1);
			rep(j, 9) {
				int num = board[j][i];
				if (use[num]>=0) {
					wrong[j][i] = true;
					wrong[use[num]][i] = true;
				} else {
					use[num] = j;
				}
			}
			// 縦
			fill(use, use+9, -1);
			rep(j, 9) {
				int num = board[i][j];
				if (use[num]>=0) {
					wrong[i][j] = true;
					wrong[i][use[num]] = true;
				} else {
					use[num] = j;
				}
			}
			// 斜め
			fill(use, use+9, -1);
			int sx = (i%3)*3, sy = (i/3)*3;
			rep(ii, 3) {
				rep(jj, 3) {
					int num = board[sx+ii][sy+jj];
					if (use[num]>=0) {
						wrong[sx+ii][sy+jj] = true;
						wrong[sx+use[num]%3][sy+use[num]/3] = true;
					} else {
						use[num] = ii*3+jj;
					}
				}
			}
		}
		
		rep(y, 9) {
			rep(x,9) {
				if (wrong[x][y]) {
					cout << '*';
				} else {
					cout << ' ';
				}
				cout << ++board[x][y];
			}
			cout << endl;
		}
		if (k<n-1)
			cout << endl;
	}
	return 0;
}

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;
    }
    cout << endl;
  }
}

C++: #include<iostream>

using namespace std;

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

	for(int k=0;k<n;k++){
		if(k>0)	cout<<endl;

		int cel[9][9];
		bool chk[9][9];
		for(int i=0;i<9;i++)for(int j=0;j<9;j++)cin>>cel[i][j],chk[i][j]=false;

		for(int i=0;i<9;i++){
			int pos[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
			for(int j=0;j<9;j++){
				if(pos[cel[i][j]]==-1)	pos[cel[i][j]]=j;
				else{
					chk[i][pos[cel[i][j]]]=true;
					chk[i][j]=true;
				}
			}
		}

		for(int j=0;j<9;j++){
			int pos[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
			for(int i=0;i<9;i++){
				if(pos[cel[i][j]]==-1)	pos[cel[i][j]]=i;
				else{
					chk[pos[cel[i][j]]][j]=true;
					chk[i][j]=true;
				}
			}
		}

		for(int y=0;y<3;y++)for(int x=0;x<3;x++){
			int pos[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
			for(int i=3*y;i<3*y+3;i++){
				for(int j=3*x;j<3*x+3;j++){
					if(pos[cel[i][j]]==-1)	pos[cel[i][j]]=i*10+j;
					else{
						chk[pos[cel[i][j]]/10][pos[cel[i][j]]%10]=true;
						chk[pos[cel[i][j]]/10][pos[cel[i][j]]%10]=true;
					}
				}
			}
		}

		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				cout<<(chk[i][j]?'*':' ')<<cel[i][j];
			}
			cout<<endl;
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

static inline int in(){ int x; scanf("%d", &x); return x; }

int main()
{
  int n = in();
  for (int i = 0; i < n; i++){
    int sudoku[9][9];
    for (int j = 0; j < 9; j++){
      for (int k = 0; k < 9; k++){
        sudoku[j][k] = in() - 1;
      }
    }
    int col[9][9] = {};
    int row[9][9] = {};
    int blk[9][9] = {};
    for (int j = 0; j < 9; j++){
      for (int k = 0; k < 9; k++){
        row[j][sudoku[j][k]]++;
        col[k][sudoku[j][k]]++;
        blk[j/3*3+k/3][sudoku[j][k]]++;
      }
    }
    if (i) puts("");
    for (int j = 0; j < 9; j++){
      for (int k = 0; k < 9; k++){
        if (row[j][sudoku[j][k]] > 1 ||
            col[k][sudoku[j][k]] > 1 ||
            blk[j/3*3+k/3][sudoku[j][k]] > 1){
          printf("*");
        }
        else printf(" ");
        printf("%d", sudoku[j][k] + 1);
      }
      puts("");
    }
  }
  return 0;
}