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 field[9][9];

bool check(int x, int y) {
	int count = 0;
	for (int i = 0; i < 9; i++) {
		if (field[x][i] == field[x][y]) count++;
		if (field[i][y] == field[x][y]) count++;
	}
	int ofx = x / 3;
	int ofy = y / 3;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (field[ofx * 3 + i][ofy * 3 + j] == field[x][y]) count++;
		}
	}
	return count == 3;
}

int main() {
	int n;
	bool flg = true;
	cin >> n;
	for (int i = 0; i < n ; i++) {
		if (flg) {
			flg = false;
		}
		else {
			cout << endl;
		}
		for (int j = 0; j < 9; j++) {
			for (int k = 0; k < 9; k++) {
				cin >> field[j][k];
			}
		}
		for (int j = 0; j < 9; j++) {
			for (int k = 0; k < 9; k++) {
				char c = ' ';
				if (!check(j, k)) {
					c = '*';
				}
				cout << c << field[j][k];
			}
			cout << endl;
		}
	}
}

C++: //31
#include<iostream>

#define BY(I,J) ((I)/3*3+(J)/3)
#define BX(I,J) ((I)%3*3+(J)%3)

using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    int g[9][9];
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin>>g[i][j];
      }
    }
    bool dup[9][9]={{}};
    for(int i=0;i<9;i++){
      int cn[10]={};
      for(int j=0;j<9;j++){
	cn[g[i][j]]++;
      }
      for(int j=0;j<9;j++){
	dup[i][j]|=cn[g[i][j]]>1;
      }
    }
    for(int i=0;i<9;i++){
      int cn[10]={};
      for(int j=0;j<9;j++){
	cn[g[j][i]]++;
      }
      for(int j=0;j<9;j++){
	dup[j][i]|=cn[g[j][i]]>1;
      }
    }
    for(int i=0;i<9;i++){
      int cn[10]={};
      for(int j=0;j<9;j++){
	cn[g[BY(i,j)][BX(i,j)]]++;
      }
      for(int j=0;j<9;j++){
	dup[BY(i,j)][BX(i,j)]|=cn[g[BY(i,j)][BX(i,j)]]>1;
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cout<<((dup[i][j])?'*':' ')<<g[i][j];
      }
      cout<<endl;
    }
    if(n){
      cout<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef pair<int,int> p;
int cen[]={1,4,7};
int main()
{
    int n;
	cin>>n;
	while(n--){
		int a[9][9];
		bool cor[9][9];
		
		for(int i=0;i<9;i++)
			for(int j=0;j<9;j++){
				cin>>a[i][j];
				cor[i][j]=true;
			}
		for(int i=0;i<9;i++){
			int check[9]={};
			for(int j=0;j<9;j++)check[a[i][j]-1]++;
			for(int j=0;j<9;j++)if(check[a[i][j]-1]!=1)cor[i][j]=false;
		}
		for(int i=0;i<9;i++){
			int check[9]={};
			for(int j=0;j<9;j++)check[a[j][i]-1]++;
			for(int j=0;j<9;j++)if(check[a[j][i]-1]!=1)cor[j][i]=false;
		}
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++){
				int check[9]={};
				for(int kx=-1;kx<=1;kx++)
					for(int ky=-1;ky<=1;ky++){
						int nx=cen[i]+kx,ny=cen[j]+ky;
						check[a[nx][ny]-1]++;
					}
				for(int kx=-1;kx<=1;kx++)
					for(int ky=-1;ky<=1;ky++){
						int nx=cen[i]+kx,ny=cen[j]+ky;
						if(check[a[nx][ny]-1]!=1)cor[i][j]=false;
					}
			}
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				printf(cor[i][j]?" %d":"*%d",a[i][j]);
			}
			cout<<endl;
		}
		if(n!=0)cout<<endl;
	}
    return 0;
}

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){
	  error[i][j] = 1;
	  for(int k = 0 ; k < 9 ; k++){
	    if(puzzle[i][k] == puzzle[i][j]) error[i][k] = 1;
	  }
	}
	  
	if(check2[puzzle[j][i]] >= 2){
	  error[j][i] = 1;
	  for(int k = 0 ; k < 9 ; k++){
	    if(puzzle[k][i] == puzzle[j][i]) error[k][i] = 1;
	  }
	}
	
      }
    }
    
    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>
using namespace std;

void check(int g[9][9],bool f[9][9],int y,int x){
	for(int i=0; i<9; ++i){
		if(i!=y&&g[y][x]==g[i][x]){
			f[y][x]=false;
			f[i][x]=false;
			return;
		}
		if(i!=x&&g[y][x]==g[y][i]){
			f[y][x]=false;
			f[y][i]=false;
			return;
		}
	}
	int dy,dx;
	if(y<3) dy=0;
	else if(y<6) dy=3;
	else dy=6;
	if(x<3) dx=0;
	else if(x<6) dx=3;
	else dx=6;
	for(int i=0; i<3; ++i){
		for(int j=0; j<3; ++j){
			if(!(i+dy==y&&j+dx==x)&&g[y][x]==g[dy+i][dx+j]){
				f[y][x]=false;
				f[dy+i][dx+j]=false;
				return;
			}
		}
	}
}

int main(){
	int N;
	cin >> N;
	for(int i=0; i<N; ++i){
		int grids[9][9];
		bool ok[9][9];
		for(int j=0; j<9; ++j){
			for(int k=0; k<9; ++k){
				cin >> grids[j][k];
				ok[k][j]=true;
			}
		}
		for(int j=0; j<9; ++j){
			for(int k=0; k<9; ++k){
				if(ok[j][k]) check(grids,ok,j,k);
				if(!ok[j][k]) cout << '*';
				else cout << ' ';
				cout << grids[j][k];
				if(k==8) cout << endl;
			}
		}
		if(i!=N-1) cout << endl;
	}
	return 0;
}