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];
char afield[9][19];

void search(int x,int y) {
  bool check=true;
  int temp = field[x][y];

  for(int i=0;i<9;i++) { //tate
    if(field[i][y] == temp && i != x){
      check = false;
    }
  }

  for(int i=0;i<9;i++) { //yoko
    if(field[x][i] == temp && i != y){
      check = false;
    }
  }

  for(int i=(x/3)*3;i<(x/3)*3+3;i++) { // 3*3 square
    for(int j=(y/3)*3;j<(y/3)*3+3;j++) {
      if((field[i][j] == temp) && (i != x) && (j != y)) {
	check = false;
      }
    }
  }

  if(check) {
    afield[x][y] = ' ';
  }
  else {
    afield[x][y] = '*';
  }
}

void solve() {
  for(int i=0;i<9;i++) {
    for(int j=0;j<9;j++) {
      search(i,j);
    }
  }
}

int main() {
  int n;
  string str;
  bool r=false;
  cin >> n;
  while(n--) {
    if(r) cout << endl;
    for(int i=0;i<9;i++) {
      for(int j=0;j<9;j++) {
	cin >> field[i][j];
      }
    }
    solve();
    for(int i=0;i<9;i++) {
      for(int j=0;j<9;j++) {
	cout << afield[i][j] << field[i][j];
      }
      cout << endl;
    }
    r = true;
  }
}

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

int puzzle[9][9];
bool ast[9][9];

void check() {
    for (int i=0; i<9; ++i) {
        for (int j=0; j<9; ++j) {
            for (int k=0; k<9; ++k) {
                if (i != k && puzzle[i][j] == puzzle[k][j]) {
                    ast[i][j] = true;
                    break;
                }
                if (j != k && puzzle[i][j] == puzzle[i][k]) {
                    ast[i][j] = true;
                    break;
                }
            }
            for (int k=(i/3)*3; k<(i/3)*3+3; ++k) {
                for (int l=(j/3)*3; l<(j/3)*3+3; ++l) {
                    if ((i != k || j != l) && puzzle[i][j] == puzzle[k][l]) {
                        ast[i][j] = true;
                        break;
                    }
                }
            }
        }
    }
}

int main() {
    int n;
    bool lf = false;
    cin >> n;
    for (int k=0; k<n; ++k) {
        if (lf) {
            cout << endl;
        }
        memset(ast, false, sizeof ast);
        for (int i=0; i<9; ++i) {
            for (int j=0; j<9; ++j) {
                cin >> puzzle[i][j];
            }
        }
        check();
        for (int i=0; i<9; ++i) {
            for (int j=0; j<9; ++j) {
                cout << (ast[i][j] ? "*" : " ") << puzzle[i][j];
            }
            cout << endl;
        }
        lf = true;
    }
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
#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)

ll const inf = 1<<28;
double const pi = acos(-1);

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

int main(){

	int n, l[10][10], a[10][10];
	int m[10][10] = {0};

	cin >> n;
	
	for(int i=0; i<n; i++){
		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				l[j][k] = 0;
				a[j][k] = 0;
			}
		}
//		fill(l, l+9*9, 0);
//		fill(a, a+9*9, 0);

		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				scanf("%d", &m[j][k]);
				l[j][m[j][k]]++;
				a[k][m[j][k]]++;
			}
		}

		for(int j=1; j<10; j++){
			for(int k=1; k<10; k++){
				if(l[j][m[j][k]] == 1 && a[k][m[j][k]] == 1){
					cout << " ";
				}
				else{
					cout << "*";
				}
				cout << m[j][k];
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
	int n;
	cin>>n;
	bool h=false;
	rep(w,n){
	if(h)cout<<endl;
		int in[9][9]={0};
		rep(j,9)rep(k,9)cin>>in[j][k];
		int out[9][9]={0};
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[i][k]==j+1)co++;
				if(co>1)rep(k,9)if(in[i][k]==j+1)out[i][k]=1;
			}
		}
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[k][i]==j+1)co++;
				if(co>1)rep(k,9)if(in[k][i]==j+1)out[k][i]=1;
			}
		}
		rep(i,3)rep(j,3){
			map<int,int>m;
			rep(a,3)rep(b,3)m[in[3*i+a][3*j+b]]++;
			rep(k,9)if(m[k]>=2)rep(a,3)rep(b,3)if(in[3*i+a][3*j+b]==k)out[3*i+a][3*j+b]=1;
		}
		rep(i,9){
			rep(j,9)
				if(out[i][j]==0)cout<<" "<<in[i][j];
				else cout<<"*"<<in[i][j];
			cout<<endl;
		}
		h=true;
	}
}