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;

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>
#include<queue>
using namespace std;
typedef pair<int,int> P;
main(){
  int n;
  int num[10][10]={0};
  int yoko=0;
  int tate=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int mondai[10][10]={0};
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	cin>>num[j][k];
      }
    }
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	if(mondai[j][k]!=1){
	  for(int a=1;a<=9;a++){
	    if(a!=k&&num[j][a]==num[j][k]){
	      mondai[j][a]=1;
	      mondai[j][k]=1;
	    }
	    if(a!=j&&num[a][k]==num[j][k]){
	      mondai[a][k]=1;
	      mondai[j][k]=1;
	    }
	  }
	  if(j<=3){
	    tate=0;
	  }
	  else if(j<=6){
	    tate=3;
	  }
	  else{
	    tate=6;
	  }
	  if(k<=3){
	    yoko=0;
	  }
	  else if(k<=6){
	    yoko=3;
	  }
	  else{
	    yoko=6;
	  }
	  for(int a=1;a<=3;a++){
	    for(int b=1;b<=3;b++){
	      if(num[tate+a][yoko+b]==num[j][k]&&(tate+a!=j||yoko+b!=k)){
		mondai[j][k]==1;
		mondai[tate+a][yoko+b]==1;
	      }
	    }
	  }
		
	}
      }
    }
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	if(mondai[j][k]==1){
	  cout<<"*"<<num[j][k];
	}
	else{
	  cout<<" "<<num[j][k];
	}
      }
      cout<<endl;
    }
    if(i!=n-1){
      cout<<endl;
    }
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n;
    cin >> n;
    rep(q, n){
        vii v; vbb b;
        rep(i, 9){
            vi r; vb l;
            rep(j, 9){
                int m; cin >> m; r.pb(m); l.pb(true);
            }
            v.pb(r); b.pb(l);
        }
        rep(i, 9){
            pair<bool, pair<int, int> > p[11];
            rep(j, 11) p[i].first = false;
            rep(j, 9){
                if(!p[v[i][j]].first){p[v[i][j]].first = true; p[v[i][j]].second = mp(i, j);}
                else {b[i][j] = false; pii x = p[v[i][j]].second; b[x.first][x.second] = false;}
            }
        }
        rep(i, 9){
            pair<bool, pair<int, int> > p[11];
            rep(j, 11) p[j].first = false;
            rep(j, 9){
                if(!p[v[j][i]].first){p[v[j][i]].first = true; p[v[j][i]].second = mp(j, i);}
                else {b[j][i] = false; pii x = p[v[j][i]].second; b[x.first][x.second] = false;}
            }
        }
        rep(i, 3)rep(j, 3){
            pair<bool, pair<int, int> > p[11];
            rep(l, 11) p[l].first = false;
            rep(k, 3)rep(l, 3){
                if(!p[v[i*3+k][j*3+l]].first){p[v[i*3+k][j*3+l]].first = true; p[v[i*3+k][j*3+l]].second = mp(i*3+k, j*3+l);}
                else {b[i*3+k][j*3+l] = false; pii x = p[v[i*3+k][j*3+l]].second; b[x.first][x.second] = false;  }
            }
        }

        rep(i, 9){
            rep(j, 9){
                cout << (b[i][j]?" ":"*") << v[i][j];
            }
            cout << endl;
        }
        if(q != n-1) cout << endl;
    }
}

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

int puzzle[9][9];
bool right(int y,int x){
  for(int i=0;i<9;i++){
    if(y!=i){
      if(puzzle[y][x]==puzzle[i][x]) return false;
    }
    if(x!=i){
      if(puzzle[y][x]==puzzle[y][i]) return false;
    }
  }

  int a=y,b=x;
  while(1){
    if(a%3==0) break;
    a--;
  }
  while(1){
    if(b%3==0) break;
    b--;
  }

  for(int i=a;i<a+3;i++){
    for(int j=b;j<b+3;j++){
      if(i!=y && j!=x){
	if(puzzle[i][j]==puzzle[y][x]){
	  return false;
	}
      }
    }
  }
  return true;
}


int main(){
  int n;
  cin>> n;
  while(n--){
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin>> puzzle[i][j];
      }
    }

    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(right(i,j)){
	  cout<< " "<< puzzle[i][j];
	}
	else {
	  cout<< '*'<< puzzle[i][j];
	}
      }
      cout<< endl;
    }
  }
}