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*****/
#include <iostream>
#include <set>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
/*****変数置き場*****/
	int n;
	int field[11][11];
	bool wrong[10];
	bool fail[11][11];
	int table_x[] = {0,1,2,0,1,2,0,1,2};
	int table_y[] = {0,0,0,1,1,1,2,2,2};
	set <int>appear;
	/*****処理部*****/
	cin >> n;
	while(n>0){
		n--;
		for(int i=0;i<11;i++)
			for(int j=0;j<11;j++){
				field[i][j] = 0;
				fail[i][j] = 0;
			}
		for(int i=0;i<10;i++)
			wrong[i] = false;
		for(int i=1;i<=9;i++)
			for(int j=1;j<=9;j++)
				cin >> field[i][j];
		appear.clear();
		
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(appear.find(field[i][j]) != appear.end()){
					wrong[field[i][j]] = true;
				}else
					appear.insert(field[i][j]);
			}
			appear.clear();
			for(int k=1;k<=9;k++)
				if(wrong[field[i][k]])
					fail[i][k] = true;
			for(int k=0;k<10;k++){
				wrong[k] = false;
			}
		}
		for(int j=1;j<=9;j++){
			for(int i=1;i<=9;i++){
				if(appear.find(field[i][j]) != appear.end()){
					wrong[field[i][j]] = true;
				}else
					appear.insert(field[i][j]);
			}
			appear.clear();
			for(int k=1;k<=9;k++)
				if(wrong[field[k][j]])
					fail[k][j] = true;
			for(int k=0;k<10;k++){
				wrong[k] = false;
			}
		}

		for(int i=1;i<=9;i+=3)
			for(int j=1;j<=9;j+=3){
				for(int k=0;k<9;k++)
					if(appear.find(field[i+table_y[k]][j+table_x[k]]) != appear.end())
						wrong[field[i+table_y[k]][j+table_x[k]]] = true;
					else
						appear.insert(field[i+table_y[k]][j+table_x[k]]);
				appear.clear();
				for(int k=0;k<9;k++)
					if(wrong[field[i+table_y[k]][j+table_x[k]]])
						fail[i+table_y[k]][j+table_x[k]] = true;
				for(int k=0;k<10;k++){
					wrong[k] = false;
				}
			}
			
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(fail[i][j])
					cout << "*";
				else
					cout << " ";
				cout << field[i][j];
			}
			cout << endl;
		}
		//cout << endl;
	}
	/*****処理終了後*****/
	return 0;
}

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

void Rule_Col(int board[][BOARD_LEN], int bad[][BOARD_LEN]){
	for(int i = 0; i < BOARD_LEN; ++i){
		for(int j = 0; j < BOARD_LEN; ++j){
			int t = board[j][i];
			for(int k = 0; k < BOARD_LEN; ++k){
				if( k == j )
					continue;
				if( t == board[k][i] )
					bad[k][i] = 1;
			}
		}
	}
}
void Rule_Row(int board[][BOARD_LEN], int bad[][BOARD_LEN]){
	for(int i = 0; i < BOARD_LEN; ++i){
		for(int j = 0; j < BOARD_LEN; ++j){
			int t = board[i][j];
			for(int k = 0; k < BOARD_LEN; ++k){
				if( k == j )
					continue;
				if( t == board[i][k] )
					bad[i][k] = 1;
			}
		}
	}
}
void Rule_Square(int board[][BOARD_LEN], int bad[][BOARD_LEN]){
	const int ai[] = {1,4,7};
	const int aj[] = {1,4,7};

	for(int i = 0; i < sizeof(ai)/sizeof(*ai); ++i){
		for(int j = 0; j < sizeof(aj)/sizeof(*aj); ++j){
			const int di[] = {-1,0,1,-1,0,1,-1,0,1};
			const int dj[] = {-1,-1,-1,0,0,0,1,1,1};
			for(int k = 0; k < sizeof(di)/sizeof(*di); ++k){
				int t = board[ai[i]+di[k]][aj[j]+dj[k]];
				for(int l = 0; l < sizeof(di)/sizeof(*di); ++l){
					if( k == l )
						continue;
					if( t == board[ai[i]+di[l]][aj[j]+dj[l]] )
						bad[ai[i]+di[l]][aj[j]+dj[l]] = 1;
				}
			}
		}
	}
}
int main(void){
	int n;
	bool bFirst = true;

	cin >> n;
	for(int D = 0; D < n; ++D){
		int bad[BOARD_LEN][BOARD_LEN] ={{0,},};
		int board[BOARD_LEN][BOARD_LEN];

		if( bFirst )
			bFirst = false;
		else
			cout << '\n';

		for(int i = 0; i < sizeof(board)/sizeof(*board); ++i){
			for(int j = 0; j < sizeof(*board)/sizeof(**board); ++j){
				cin >> board[i][j];
			}
		}
		Rule_Col( board, bad );
		Rule_Row( board, bad );
		Rule_Square( board, bad );
		for(int i = 0; i < sizeof(board)/sizeof(*board); ++i){
			for(int j = 0; j < sizeof(*board)/sizeof(**board); ++j){
				if( bad[i][j] )
					cout << '*';
				else
					cout << ' ';
				cout << board[i][j];
			}
			cout << '\n';
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  int n;
  int map[100];

  int wrong[100];
  int check[10];

  int index;

  cin >> n;

  for(int num=0;num<n;num++) {

    //wrongÌú»
    for(int i=0;i<81;i++) {

      wrong[i]=0;

    }

    //pYÌÇÝÝ
    for(int i=0;i<81;i++) {

      cin >> map[i];

    }

    //^eÌñð`FbN
    for(int i=0;i<9;i++) {

      for(int j=0;j<9;j++) check[j]=0;

      for(int j=0;j<9;j++) {

	check[map[9*j+i]-1]++;

      }

      for(int j=0;j<9;j++) {

	if(check[j]>1) {

	  for(int k=0;k<9;k++) {

	    if(map[9*k+i]==j+1) wrong[9*k+i]=1;

	  }

	}

      }
    
    }

    //RÌñð`FbN
    for(int j=0;j<9;j++) {

      for(int i=0;i<9;i++) check[i]=0;

      for(int i=0;i<9;i++) {

	check[map[9*j+i]-1]++;

      }

      for(int i=0;i<9;i++) {

	if(check[i]>1) {

	  for(int k=0;k<9;k++) {

	    if(map[9*j+k]==i+1) wrong[9*j+k]=1;

	  }

	}

      }

    }

    //gÌð`FbN
    for(int i=0;i<3;i++) {

      for(int j=0;j<3;j++) {

	index=27*j+3*i;

	for(int k=0;k<9;k++) check[k]=0;

	for(int k=0;k<3;k++) {

	  for(int l=0;l<3;l++) {

	    check[map[index+9*l+k]-1]++;

	  }

	}

	for(int k=0;k<9;k++) {

	  if(check[k]>1) {

	    for(int l=0;l<3;l++) {

	      for(int m=0;m<3;m++) {

		if(map[index+9*m+l]==k+1) wrong[index+9*m+l]=1;

	      }

	    }

	  }

	}

      }

    }

    for(int j=0;j<9;j++) {

      for(int i=0;i<9;i++) {

	if(wrong[9*j+i]==1) cout << "*";
      
	else cout << " ";

	cout << map[9*j+i];

      }

      cout << endl;

    }

    if(num!=n-1) cout << endl;

  }

  return 0;

}

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

int main(void){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		int lines[9][9];
		int errors[9][9]={0};
		if(i!=0) cout<<endl;
		for(int j=0;j<9;++j){
			for(int k=0;k<9;++k)cin>>lines[j][k];
		}
		for(int j=0;j<9;++j){//yoko
			int count[9]={0};
			for(int k=0;k<9;++k)++count[lines[j][k]-1];
			for(int k=0;k<9;++k){
				if(count[lines[j][k]-1]>1) errors[j][k]=1;
			}
		}
		for(int j=0;j<9;++j){//tate
			int count[9]={0};
			for(int k=0;k<9;++k)++count[lines[k][j]-1];
			for(int k=0;k<9;++k){
				if(count[lines[k][j]-1]>1) errors[k][j]=1;
			}
		}
		for(int j=0;j<3;++j){//3x3
			for(int k=0;k<3;++k){
				int count[9]={0};
				for(int l=0;l<3;++l) for(int m=0;m<3;++m) ++count[lines[j*3+l][k*3+m]-1];
				for(int l=0;l<3;++l) for(int m=0;m<3;++m) if(count[lines[j*3+l][k*3+m]-1]>1) errors[j*3+l][k*3+m]=1;
			}
		}
		for(int j=0;j<9;++j){
			for(int k=0;k<9;++k){
				if(errors[j][k]) cout<<"*";
				else cout<<" ";
				cout<<lines[j][k];
			}
			cout<<endl;
		}
	}
	return 0;
}