<commit_before>#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdio>
using namespace std;

const int GRID_SIZE = 9;
const int SUB_GRID_SIZE = 3;
typedef vector<vector<int> > Grid;

bool IsSafe(const Grid& grid, int x, int y, int num);
bool FindEmptyCell(const Grid& grid, int& x, int& y);
bool Sudoku(Grid& grid);
void PrintSolution(const Grid& grid);

int main()
{
	freopen("sudoku.in", "r", stdin);	
	vector<vector<int> > grid(GRID_SIZE, vector<int>(GRID_SIZE, 0));
	for (int i = 0; i < GRID_SIZE; ++i)
	{
		for (int j = 0; j < GRID_SIZE; ++j)
		{
			cin >> grid[i][j];
		}
	}

	if (Sudoku(grid))
	{
		cout << "Find Solution " << endl;
		PrintSolution(grid);
		cout << endl;
	}<commit_msg>add comments<commit_after>#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdio>
using namespace std;

// Base Case: if cannot find any empty cell, return true
// Find an unsigned cell (x, y)
// for digit from 1 to 9
// 	   if there is not conflict for digit at (x, y)
//     assign (x, y) as digit and Recursively check if this lead to a solution
//     if success, return true
//     else remove the digit at (x, y) and try another digit
// if all digits have been tried and still have not worked out, return false to trigger backtracking

const int GRID_SIZE = 9;
const int SUB_GRID_SIZE = 3;
typedef vector<vector<int> > Grid;

bool IsSafe(const Grid& grid, int x, int y, int num);
bool FindEmptyCell(const Grid& grid, int& x, int& y);
bool Sudoku(Grid& grid);
void PrintSolution(const Grid& grid);

int main()
{
	freopen("sudoku.in", "r", stdin);	
	vector<vector<int> > grid(GRID_SIZE, vector<int>(GRID_SIZE, 0));
	for (int i = 0; i < GRID_SIZE; ++i)
	{
		for (int j = 0; j < GRID_SIZE; ++j)
		{
			cin >> grid[i][j];
		}
	}

	if (Sudoku(grid))
	{
		cout << "Find Solution " << endl;
		PrintSolution(grid);
		cout << endl;
	}
{'fraction_non_alphanumeric': 0.1462409886714727, 'fraction_numerical': 0.006179196704428424, 'mean_word_length': 4.020671834625323, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5317502', 'n_tokens_mistral': 752, 'n_tokens_neox': 705, 'n_words': 250}