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 <bits/stdc++.h>
using namespace std;
 
int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  bool first = true;
  while(N--){
    if(first) first = false;
    else cout << endl;
    int f[9][9];
    for(int i = 0; i < 9; i++){
      for(int j = 0; j < 9; j++){
        cin >> f[i][j];
        f[i][j]--;
      }
    }
    vector< vector<bool> > wrong(9, vector<bool>(9, false));
    vector<bool> used(9, false);
    //columm
    for(int i = 0; i < 9; i++){
      used = vector<bool>(9, false);
      list<int> t;
      for(int j = 0; j < 9; j++){
        if(used[ f[i][j] ] == true){
          t.push_back(f[i][j]);
        }else{
          used[ f[i][j] ] = true;
        }
      }
      for(int j = 0; j < 9; j++){
        for(list<int>::iterator it = t.begin(); it != t.end(); it++){
          if(f[i][j] == *it){
            wrong[i][j] = true;
          }
        }
      }
    }
 
    //row
    for(int j = 0; j < 9; j++){
      used = vector<bool>(9, false);
      list<int> t;
      for(int i = 0; i < 9; i++){
        if(used[ f[i][j] ] == true){
          t.push_back(f[i][j]);
        }else{
          used[ f[i][j] ] = true;
        }
      }
      for(int i = 0; i < 9; i++){
        for(list<int>::iterator it = t.begin(); it != t.end(); it++){
          if(f[i][j] == *it){
            wrong[i][j] = true;
          }
        }
      }
    }
 
    //sp area
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
 
        used = vector<bool>(9, false);
        list<int> t;
        for(int k = 0; k < 3; k++){
          for(int l = 0; l < 3; l++){
            if(used[ f[i*3+k][j*3+l] ] == true){
              t.push_back(f[i*3+k][j*3+l]);
            }else{
              used[ f[i*3+k][j*3+l] ] = true;
            }
          }
        }
        for(int k = 0; k < 3; k++){
          for(int l = 0; l < 3; l++){
            for(list<int>::iterator it = t.begin(); it != t.end(); it++){
              if(f[i*3+k][j*3+l] == *it){
                wrong[i*3+k][j*3+l] = true;
              }
            }
          }
        }
      }
    }
 
    for(int i = 0; i < 9; i++){
      for(int j = 0; j < 9; j++){
        if(wrong[i][j]) cout << "*";
        else cout << " ";
        cout << f[i][j]+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[9];

  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++: #define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,vector<T>(w)))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,vector<T>(w,i)))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll n = in();
	REP(i, n) {
		if (i != 0)cout << endl;
		int inpt[9][9]; REP(j, 9)REP(k, 9)inpt[j][k] = in();
		bool dpl[9][9]; REP(j, 9)REP(k, 9)dpl[j][k] = false;
		REP(j, 9) {
			int cnt[9] = { 0,0,0,0,0,0,0,0,0 };
			REP(k, 9)++cnt[inpt[j][k] - 1];
			REP(k, 9)if (cnt[inpt[j][k] - 1] > 1)dpl[j][k] = true;
		}
		REP(k, 9) {
			int cnt[9] = { 0,0,0,0,0,0,0,0,0 };
			REP(j, 9)++cnt[inpt[j][k] - 1];
			REP(j, 9)if (cnt[inpt[j][k] - 1] > 1)dpl[j][k] = true;
		}
		REP(j, 3) {
			REP(k, 3) {
				int cnt[9] = { 0,0,0,0,0,0,0,0,0 };
				for (ll l = j * 3; l < j * 3 + 3; ++l) for (ll m = k * 3; m < k * 3 + 3; ++m) ++cnt[inpt[l][m] - 1];
				for (ll l = j * 3; l < j * 3 + 3; ++l) for (ll m = k * 3; m < k * 3 + 3; ++m) if (cnt[inpt[l][m] - 1] > 1)dpl[l][m] = true;
			}
		}
		REP(j, 9) {
			REP(k, 9) cout << (dpl[j][k] ? '*' : ' ') << inpt[j][k];
			cout << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
bool a[9][9];
int c[9][9];
int main() {
	int n;
	cin >> n;
	string b;
	getline(cin, b);
	for (int x = 0; x < n; x++) {
		int d[10];
		int k;
		for (int i = 0; i < 9; i++) {
			getline(cin, b);
			for (int j = 0; j < b.length(); j+=2) {
				c[i][j / 2] = (int)b[j] - '0';
				a[i][j] = false;
			}
			if (i == 0) k = c[0][0];
			fill(d, d + 10, 0);
			for (int j = 0; j < 9; j++) 
				d[c[i][j]]++;
			for (int j = 0; j < 9; j++) {
				if (d[c[i][j]] > 1) 
					a[i][j] = true;
			}
		}
		c[0][0] = k;
		for (int i = 0; i < 9; i++) {
			fill(d, d + 10, 0);
			for (int j = 0; j < 9; j++)
				d[c[j][i]]++;
			for (int j = 0; j < 9; j++) {
				if (d[c[j][i]]>1)
					a[j][i] = true;
			}
		}
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				if (a[i][j])
					cout << "*" << c[i][j];
				else
					cout << " " << c[i][j];
			}
			cout << endl;
		}
		if (x < n-1) {
			cout << endl;
		}
	}
}

C++: 2
2 1 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 4 5 6 7 8 9 1
5 6 7 8 9 1 2 3 4
8 9 1 2 3 4 5 6 7
3 4 5 6 7 8 9 1 2
6 7 8 9 1 2 3 4 5
9 1 2 3 4 5 6 7 8
2 1 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 4 5 6 7 8 9 1
5 6 7 8 9 1 2 3 4
8 9 1 2 3 4 5 6 7
3 4 5 6 7 8 9 1 2
6 7 8 9 1 2 3 4 5
9 1 2 3 4 5 6 7 8