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 {
		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;
// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef pair<int, int> PII;
typedef vector<PII> VII;
int main() {
  
  int N;
  bool blank = 0;
  cin >> N;
  rep(_, N) {
    if(blank) cout << endl;
    blank = 1;
    int arr[9][9] = {{}};
    char output[9][20] = {{}};
    VII star;
    rep(i, 9) {
      int used[10] = {};
      rep(j, 9) {
	cin >> arr[i][j];
	used[arr[i][j]] ++;
	output[i][2*j]   = ' ';
	output[i][2*j+1] = (char)('0' + arr[i][j]);
      }
    }
    
    rep(i, 9) {
      int used[10] = {};
      rep(j, 9) used[arr[i][j]] ++;
      rep(j, 9) if(used[arr[i][j]] > 1) output[i][2*j] = '*';
    }
    
    rep(j, 9) {
      int used[10] = {};
      rep(i, 9) used[arr[i][j]] ++;
      rep(i, 9) if(used[arr[i][j]] > 1) output[i][2*j] = '*';
    }
    
    rep(i, 3) {
      rep(j, 3) {
	int used[10] = {};
	rep(k, 3) rep(l, 3) used[arr[i*3+k][j*3+l]] ++;
	rep(k, 3) rep(l, 3) if(used[arr[i*3+k][j*3+l]] > 1) output[(i*3+k)][2*(j*3+l)] = '*';
      }
    }
    
    rep(i, 9) cout << output[i] << endl;
    
  }
  
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main() {
  int w[9][9],h[9][9],g[3][3][9],mp[9][9],n,i,j,f=0;
  cin >> n;
  for (n;n>0;n--) {
	  memset(w,0,sizeof(w)); memset(h,0,sizeof(h)); memset(g,0,sizeof(g));
	  for (i=0;i<9;i++) for (j=0;j<9;j++) {
		  cin >> mp[i][j];
		  mp[i][j]--;
          w[j][mp[i][j]]++; h[i][mp[i][j]]++;
		  g[i/3][j/3][mp[i][j]]++;
	  }
	  if (f==0) f=1; else cout << endl;
	  for (i=0;i<9;i++) { 
		  for (j=0;j<9;j++) {
		  if (w[j][mp[i][j]]>1 || h[i][mp[i][j]]>1 || g[i/3][j/3][mp[i][j]]>1) cout << '*'; else cout << ' ';
		  cout << mp[i][j]+1;
	      }
		  cout << endl;
	  }
  }    
    return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto& e:c)
#define iter(it,c) for(auto it=c.begin(); it!=c.end(); ++it)

int g[9][9];
bool ok[9][9];

void solve(){
    rep(y,9)rep(x,9){
        loop(i,y+1,9){
            if(g[y][x]==g[i][x]){
                ok[i][x]=false;
                ok[y][x]=false;
            }
        }

        loop(j,x+1,9){
            if(g[y][x]==g[y][j]){
                ok[y][j]=false;
                ok[y][x]=false;
            }
        }
    }

    rep(i,3)rep(j,3){
        rep(a,9){
            int x=a%3+i*3;
            int y=a/3+j*3;
            loop(b,a+1,9){
                int xx=b%3+i*3;
                int yy=b/3+j*3;
                if(g[y][x]==g[yy][xx]){
                    ok[yy][xx]=false;
                    ok[y][x]=false;
                }
            }
        }
    }

}

int main(){
    int n;
    cin>>n;
    rep(i,n){
        rep(y,9)rep(x,9){
            ok[y][x]=true;
        }
        rep(y,9)rep(x,9)cin>>g[y][x];
        solve();
        rep(y,9)rep(x,9){
            printf("%c%d",ok[y][x]?' ':'*',g[y][x]);
            if(x+1==9)puts("");
        }
        if(i+1!=n)puts("");
    }
}

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<9;y+=3)for(int x=0;x<9;x+=3){
			int pos[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
			for(int i=y;i<y+3;i++){
				for(int j=x;j<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[i][j]=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<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;
	  }
	}
      }
    }
    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 "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int N;
	cin >> N;
	while (N--) {
		int field[9][9];
		for (int i = 0; i < 9; ++i) {
			for (int j = 0; j < 9; ++j) {
				cin >> field[i][j];
			}
		}
		vector<vector<int>>oks(9, vector<int>(9,true));
		for (int i = 0; i < 9; ++i) {
			for (int j = 0; j < 9; ++j) {
				for (int k = 0; k < 9; ++k) {
					if (j == k)continue;
					if (field[i][j] == field[i][k])oks[i][j] = false;
				}
				for (int k = 0; k < 9; ++k) {
					if (i == k)continue;
					if (field[i][j] == field[k][j])oks[i][j] = false;
				}
				int ax = j / 3;
				int ay = i / 3;
				for (int k = ax * 3; k < ax * 3 + 3; ++k) {
					for (int l = ay * 3; l < ay * 3 + 3; ++l) {
						if (k == j&&l == i)continue;
						if (field[i][j] == field[l][k])oks[i][j] = false;
					}
				}
			}
		}
		for (int i = 0; i < 9; ++i) {
			for (int j = 0; j < 9; ++j) {
				if (oks[i][j])cout << " ";
				else cout << "*";
				cout << field[i][j];
			}
			cout << endl;
		}
		if(N)cout << endl;
		
	}
	return 0;
}