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

class Point {
public:
  int x, y;
  bool exist;
  Point(int x = -1, int y = -1, bool exist = false) : x(x), y(y), exist(exist) {}
};

int main() {
  int n;
  cin >> n;
  bool first = true;
  for(int i = 0; i < n; i++) {
    int data[9][9];
    for(int y = 0; y < 9; y++) {
      for(int x = 0; x < 9; x++) {
	cin >> data[y][x];
      }
    }

    char judge[9][9];
    fill(&judge[0][0], &judge[8][8]+1, ' ');

    Point number[10];
    for(int y = 0; y < 9; y++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int x = 0; x < 9; x++) {
	if(!number[data[y][x]].exist) {
	  number[data[y][x]].exist = true;
	  number[data[y][x]].x = x;
	  number[data[y][x]].y = y;
	} else {
	  judge[y][x] = '*';
	  judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	}
      }
    }

    for(int x = 0; x < 9; x++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int y = 0; y < 9; y++) {
	if(!number[data[y][x]].exist) {
	  number[data[y][x]].exist = true;
	  number[data[y][x]].x = x;
	  number[data[y][x]].y = y;
	} else {
	  judge[y][x] = '*';
	  judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	}
      }
    }

    for(int j = 0; j < 9; j++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int k = 0; k < 3; k++) {
	for(int l = 0; l < 3; l++) {
	  int x = (j%3)*3+l;
	  int y = (j/3)*3+k;
	  if(!number[data[y][x]].exist) {
	    number[data[y][x]].exist = true;
	    number[data[y][x]].x = x;
	    number[data[y][x]].y = y;
	  } else {
	    judge[y][x] = '*';
	    judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	  }
	}
      }
    }


    if(!first) {
      cout << endl;
    } else {
      first = false;
    }
    for(int y = 0; y < 9; y++) {
      for(int x = 0; x < 9; x++) {
	cout << judge[y][x] << data[y][x];
      }
      cout << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  int mapp[9][9];
  int koteiyoko,koteitate;
  cin>>n;
  for(int mawa=0;mawa<n;mawa++){
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin>>mapp[i][j];
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	koteiyoko=mapp[i][j];
	koteitate=mapp[j][i];
	for(int k=0;k<9;k++){
	  if(koteiyoko==mapp[i][k] && k!=j){
	    mapp[i][k]=mapp[i][k]+10;
	    mapp[i][j]=mapp[i][j]+10;
	  }
	  if(koteitate==mapp[k][i] && k!=j){
	    mapp[k][i]=mapp[k][i]+10;
	    mapp[j][i]=mapp[j][i]+10;
	  }
	}
      }
    }
    int block[3][3][10]={0};
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	block[i/3][j/3][mapp[i][j]%10]++;
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(block[i/3][j/3][mapp[i][j]%10]>1){
	  mapp[i][j]+=10;
	}
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(mapp[i][j]>=10){
	  cout<<'*'<<mapp[i][j]%10;
	}else{
	  cout<<' '<<mapp[i][j];
	}
      }
      cout<<endl;
    }
  }
}

C++: #include<iostream>
int main()
{
        //field : ????????°??¬?????¶???
        //used : ???????????????????????????????????????????????°?????????????????????
	int field[10][10], used[10];
        //judge : ??°??¬???????????£???????????¨?????????true???
	bool judge[10][10];

	int num;
	cin >> num;
	while(num--)
	{
		memset(judge, false, sizeof(judge));

		for(int i = 0; i < 9; i++)
		{
			for(int j = 0; j< 9; j++)
			{
				cin >> field[i][j];
			}
		}
		for(int i = 0; i < 9; i++)
		{
			memset(used, 0, sizeof(used));
			for(int j = 0; j < 9; j++)
			{
				used[field[i][j]]++;
			}
			for(int j = 1; j <=9; j++)
			{
				if(used[j] >= 2)
				{
					for(int k = 0; k < 9; k++)
					{
						if(field[i][k] == j)
						{
							judge[i][k] = true;
						}
					}
				}
			}
			memset(used, 0, sizeof(used));
			for(int j = 0; j < 9; j++)
			{
				used[field[j][i]]++;
			}
			for(int j = 1; j<= 9; j++)
			{
				if(used[j] >= 2)
				{
					for(int k = 0; k < 9; k++)
					{
						if(field[k][i] == j)
						{
							judge[k][i] = true;
						}
					}
				}
			}
		}

		for(int l = 0; l < 9; l+=3)
		{
			for(int m = 0; m < 9; m+=3)
			{
				memset(used, false, sizeof(used));
				for(int i = 0; i < 3; i++)
				{
					for(int j = 0; j < 3; j++)
					{
						used[field[i+l][j+m]]++;
					}
				}

				for(int n = 1; n <=9; n++)
				{
					if(used[n] >= 2)
					{
						for(int i = 0; i < 3; i++)
						{
							for(int j = 0; j < 3; j++)
							{
								if(field[i+l][j+m] == n)
								{
									judge[i+l][j+m] = true;
								}
							}
						}
					}
				}
			}
		}

		for(int i = 0; i < 9; i++)
		{
			for(int j = 0; j < 9; j++)
			{
				printf("%s%d",(judge[i][j])?"*":" " ,field[i][j]);
			}
			puts("");
		}
		if(num != 0)
		{
			puts("");
		}
	}
}

C++: #include <iostream>
using namespace std;
int fld[9][9];

bool judge(int x, int y){
	for(int i = 0; i < 9; ++i){
		if(i != x){
			if(fld[i][y] == fld[x][y]){
				return false;
			}
		}
	}
	
	for(int i = 0; i < 9; ++i){
		if(i != y){
			if(fld[x][i] == fld[x][y]){
				return false;
			}
		}
	}
	
	int _x = (x / 3) * 3;
	int _y = (y / 3) * 3;
	
	for(int i = 0; i < 3; ++i){
		for(int j = 0; j < 3; ++j){
			if(_x + i != x || _y + j != y){
				if(fld[_x + i][_y + j] == fld[x][y]){
					return false;
				}
			}
		}
	}
	
	return true;
}

int main(){
	int n;
	
	
	cin >> n;
	for(int i = 0; i < n; ++i){
		
		for(int x = 0; x < 9; ++x){
			for(int y = 0; y < 9; ++y){
				cin >> fld[x][y];
			}
		}
		
		if(i) cout << endl;
		for(int x = 0; x < 9; ++x){
			for(int y = 0; y < 9; ++y){
				cout << (judge(x, y) ? " " : "*") << fld[x][y];
			}
			cout << endl;
		}
	}
	
	return 0;
}