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 <stdio.h>
int a[9][9];
void check(int x,int y){
    for(int i=0;i<9;i++){
        if(a[i][y]==a[x][y]&&i!=x){
            printf("*%d",a[x][y]);
            return;
        }
    }
    for(int i=0;i<9;i++){
        if(a[x][i]==a[x][y]&&i!=y){
            printf("*%d",a[x][y]);
            return;
        }
    }
    for(int i=x-x%3;i<x-x%3+3;i++){
        for(int j=y-y%3;j<y-y%3+3;j++){
            if(a[i][j]==a[x][y]&&(i!=x||j!=y)){
                printf("*%d",a[x][y]);
                return;
            }
        }
    }
    printf(" %d",a[x][y]);
    return;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        if(i>0)printf("\n");
        for(int j=0;j<9;j++){
            for(int k=0;k<9;k++){
                scanf("%d",&a[j][k]);
            }
        }
        for(int j=0;j<9;j++){
            for(int k=0;k<9;k++){
                check(j,k);
            }
            printf("\n");
        }
    }
}

C++: #include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;

/** Problem0126 : Puzzle **/
int main()
{
	int board[9][9];
	bool wrong[9][9];
	int n;
	
	cin >> n;
	rep(k, n) {
		rep(y, 9) rep(x, 9)  {
			cin >> board[x][y]; board[x][y]--;
			wrong[x][y] = false;
		}

		int use[9];
		
		rep(i, 9) {
			// 横
			fill(use, use+9, -1);
			rep(j, 9) {
				int num = board[j][i];
				if (use[num]>=0) {
					wrong[j][i] = true;
					wrong[use[num]][i] = true;
				} else {
					use[num] = j;
				}
			}
			// 縦
			fill(use, use+9, -1);
			rep(j, 9) {
				int num = board[i][j];
				if (use[num]>=0) {
					wrong[i][j] = true;
					wrong[i][use[num]] = true;
				} else {
					use[num] = j;
				}
			}
			// 斜め
			fill(use, use+9, -1);
			int sx = (i%3)*3, sy = (i/3)*3;
			rep(ii, 3) {
				rep(jj, 3) {
					int num = board[sx+jj][sy+ii];
					if (use[num]>=0) {
						wrong[sx+jj][sy+ii] = true;
						wrong[sx+use[num]%3][sy+use[num]/3] = true;
					} else {
						use[num] = ii*3+jj;
					}
				}
			}
		}
		
		rep(y, 9) {
			rep(x,9) {
				if (wrong[x][y]) {
					cout << '*';
				} else {
					cout << ' ';
				}
				cout << ++board[x][y];
			}
			cout << endl;
		}
		if (k<n-1)
			cout << endl;
	}
	return 0;
}

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

int main(){
	int n, f = 0;
	std::cin >> n;
	while(n--){
		if(f++)std::cout << "\n";
		int sudoku[9][9], map[9][9];
		memset(map, 0, sizeof(map));
		for(int i=0;i<81;i++)
			std::cin >> sudoku[i/9][i%9];
		
		int check[10][2];

		for(int i=0;i<9;i++){
			memset(check, -1, sizeof(check));
			for(int j=0;j<9;j++){
				int x = check[sudoku[i][j]][1],
					y = check[sudoku[i][j]][0];
				if(x != -1){
					map[y][x] = 1;
					map[i][j] = 1;
				}
				
				check[sudoku[i][j]][0] = i;
				check[sudoku[i][j]][1] = j;
			}
		}
		
		for(int i=0;i<9;i++){
			memset(check, -1, sizeof(check));
			for(int j=0;j<9;j++){
				int x = check[sudoku[j][i]][1],
					y = check[sudoku[j][i]][0];
				if(x != -1){
					map[y][x] = 1;
					map[j][i] = 1;
				}
				
			check[sudoku[j][i]][0] = j;
			check[sudoku[j][i]][1] = i;
			}
		}
		
		for(int i=0;i<9;i++){
			int sx = i % 3, sy = i / 3;//¶ãÌî_
			memset(check, -1, sizeof(check));
			for(int j=0;j<3;j++){
				for(int k=0;k<3;k++){
					int x = check[sudoku[sy*3+j][sx*3+k]][1],
						y = check[sudoku[sy*3+j][sx*3+k]][0];
					if(x != -1){
						map[y][x] = 1;
						map[sy*3+j][sx*3+k] = 1;
					}
					
					check[sudoku[sy*3+j][sx*3+k]][0] = sy*3+j;
					check[sudoku[sy*3+j][sx*3+k]][1] = sx*3+k;
				}
			}
		}
		
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				if(map[i][j])
					std::cout << "*" << sudoku[i][j];
				else
					std::cout << " " << sudoku[i][j];
			}
			std::cout << "\n";
		}
	}
        return 0;
}

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

using namespace std;

int pzl[9][9];

bool check(int y, int x)
{
  for(int i = 0; i < 9; i++){
    if(x == i) continue;
    if(pzl[y][x] == pzl[y][i]) return false;
  }
  for(int i = 0; i < 9; i++){
    if(y == i) continue;
    if(pzl[y][x] == pzl[i][x]) return false;
  }
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      if(y == y/3*3+i && x == x/3*3+j) continue;
      if(pzl[y][x] == pzl[y/3*3+i][x/3*3+j]) return false;
    }
  }
  return true;
}

int main()
{
  int n;
  cin >> n;
  for(int l = 0; l < n; l++){
    if(l > 0) cout << endl;
    for(int i = 0; i < 9; i++){
      for(int j = 0; j < 9; j++){
	cin >> pzl[i][j];
      }
    }
    for(int i = 0; i < 9; i++){
      for(int j = 0; j < 9; j++){
	if(check(i, j)) cout << ' '; 
	else cout << '*';
	cout << pzl[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<regex>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int n; cin >> n;
	int m[9][9];
	bool first = true;
	rep(h, 0, n) {
		bool b[9][9] = {};
		if (!first)cout << endl;
		first = false;
		rep(i, 0, 9)rep(j, 0, 9)cin >> m[i][j];

		rep(i, 0, 9) {
			int cnt[10] = {};
			rep(j, 0, 9)cnt[m[i][j]]++;
			rep(j, 0, 9) {
				if (cnt[m[i][j]] >= 2)b[i][j] = true;
			}
		}
		rep(j, 0, 9) {
			int cnt[10] = {};
			rep(i, 0, 9)cnt[m[i][j]]++;
			rep(i, 0, 9) {
				if (cnt[m[i][j]] >= 2)b[i][j] = true;
			}
		}
		for (int i = 0; i < 9; i += 3) {
			for (int j = 0; j < 9; j += 3) {
				int cnt[10] = {};
				rep(I, i, i + 3)rep(J, j, j + 3) {
					cnt[m[I][J]]++;
				}
				rep(I, i, i + 3)rep(J, j, j + 3) {
					if (cnt[m[I][J]] >= 2)b[I][J] = true;
				}
			}
		}
		rep(i, 0, 9) {
			rep(j, 0, 9) {
				if (b[i][j])cout << "*";
				else cout << " ";
				cout << m[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}