<commit_before>package bj757x.bj7576;

import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created by jsong on 09/04/2017.
 *
 * @hackerrank https://www.hackerrank.com/jsong00505
 * @backjoon https://www.acmicpc.net/user/jsong00505
 * @github https://github.com/jsong00505
 * @linkedin https://www.linkedin.com/in/junesongskorea/
 * @email <EMAIL>
 * @challenge Main
 */
class Point{
  private int x;
  private int y;

  Point(int x, int y) {
    this.x = x;
    this.y = y;
  }

  public int getX() {
    return x;
  }

  public int getY() {
    return y;
  }
}
public class Main {
  static int RIPED = 1;
  static int UNRIPED = 0;
  static int EMPTY = -1;

  static void print(int n, int m, int[][] box) {
    System.out.println("=========START=========");
    for(int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        System.out.print(box[i][j] + " ");
      }
      System.out.println();
    }
    System.out.println("==========END=========");
  }
  static int[][] depthFirstSearch(int n, int m, int[][] box, LinkedList<Point> queue) {
    for(Point p: queue) {
      int x = p.getX();
      int y = p.getY();

      // up
      if(x > 0) {
        if(box[x - 1][y] == UNRIPED) {
          box[x - 1][y] = RIPED;
        }
      }
      // down
      if(x < n - 1) {
        if(box[x + 1][y] == UNRIPED) {
          box[x + 1][y] = RIPED;
        }
      }
      // right
      if(y < m - 1) {
        if(box[x][y + 1] == UNRIPED) {
          box[x][y + 1] = RIPED;
        }
      }
      // left
      if(y > 0) {
        if(box[x][y - 1] == UNRIPED) {
          box[x][y - 1] = RIPED;
        }
      }
    }

    //print(n, m, box);
    return box;
  }
  static int getMinDaysRipedAll(int n, int m, int[][] box, int emptySpots) {
    int days = 1;
    int beforeSpots = 0;
    while(true) {
      LinkedList<Point> queue = new LinkedList<>();
      int ripedSpots = 0;

      for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
          if(box[i][j] == RIPED) {
            queue.add(new Point(i, j));
          }
        }
      }

      // update the box by depth-first search
      box = depthFirstSearch(n, m, box, queue);
      //print(n, m, box);
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
          if(box[i][j] == RIPED) {
            ripedSpots++;
          }
        }
      }

      if(n * m == emptySpots + ripedSpots) {
        break;
      } else if(beforeSpots == ripedSpots) {
        days = -1;
        break;
      } else {
        days++;
        beforeSpots = ripedSpots;
      } // if-else
    } // while

    return days;
  }
  public static void main(String[] args) {
    try (Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out); ) {
      // horizontal
      int m = in.nextInt();
      // vertical
      int n = in.nextInt();

      int emptySpots = 0;
      assert (m >= 2 && m <= 1000 && n >= 2 && n <= 1000);

      int[][] box = new int[n][m];
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          box[i][j] = in.nextInt();

          if(box[i][j] == EMPTY) {
            emptySpots++;
          }
        }
      }

      out.println(getMinDaysRipedAll(n, m, box, emptySpots));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
<commit_msg>chore: fix coding style<commit_after>package bj757x.bj7576;

import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created by jsong on 09/04/2017.
 *
 * @hackerrank https://www.hackerrank.com/jsong00505
 * @backjoon https://www.acmicpc.net/user/jsong00505
 * @github https://github.com/jsong00505
 * @linkedin https://www.linkedin.com/in/junesongskorea/
 * @email <EMAIL>
 * @challenge Main
 */
class Point {
  private int x;
  private int y;

  Point(int x, int y) {
    this.x = x;
    this.y = y;
  }

  public int getX() {
    return x;
  }

  public int getY() {
    return y;
  }
}

public class Main {
  static int RIPED = 1;
  static int UNRIPED = 0;
  static int EMPTY = -1;

  static void print(int n, int m, int[][] box) {
    System.out.println("=========START=========");
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        System.out.print(box[i][j] + " ");
      }
      System.out.println();
    }
    System.out.println("==========END=========");
  }

  static int[][] depthFirstSearch(int n, int m, int[][] box, LinkedList<Point> queue) {
    for (Point p : queue) {
      int x = p.getX();
      int y = p.getY();

      // up
      if (x > 0) {
        if (box[x - 1][y] == UNRIPED) {
          box[x - 1][y] = RIPED;
        }
      }
      // down
      if (x < n - 1) {
        if (box[x + 1][y] == UNRIPED) {
          box[x + 1][y] = RIPED;
        }
      }
      // right
      if (y < m - 1) {
        if (box[x][y + 1] == UNRIPED) {
          box[x][y + 1] = RIPED;
        }
      }
      // left
      if (y > 0) {
        if (box[x][y - 1] == UNRIPED) {
          box[x][y - 1] = RIPED;
        }
      }
    }

    //print(n, m, box);
    return box;
  }

  static int getMinDaysRipedAll(int n, int m, int[][] box, int emptySpots) {
    int days = 1;
    int beforeSpots = 0;
    while (true) {
      LinkedList<Point> queue = new LinkedList<>();
      int ripedSpots = 0;

      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (box[i][j] == RIPED) {
            queue.add(new Point(i, j));
          }
        }
      }

      // update the box by depth-first search
      box = depthFirstSearch(n, m, box, queue);
      //print(n, m, box);
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (box[i][j] == RIPED) {
            ripedSpots++;
          }
        }
      }

      if (n * m == emptySpots + ripedSpots) {
        break;
      } else if (beforeSpots == ripedSpots) {
        days = -1;
        break;
      } else {
        days++;
        beforeSpots = ripedSpots;
      } // if-else
    } // while

    return days;
  }

  public static void main(String[] args) {
    try (Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out); ) {
      // horizontal
      int m = in.nextInt();
      // vertical
      int n = in.nextInt();

      int emptySpots = 0;
      assert (m >= 2 && m <= 1000 && n >= 2 && n <= 1000);

      int[][] box = new int[n][m];
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          box[i][j] = in.nextInt();

          if (box[i][j] == EMPTY) {
            emptySpots++;
          }
        }
      }

      out.println(getMinDaysRipedAll(n, m, box, emptySpots));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

{'fraction_non_alphanumeric': 0.18002958579881656, 'fraction_numerical': 0.020118343195266272, 'mean_word_length': 1.649294670846395, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 19, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, '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': '2538966', 'n_tokens_mistral': 2696, 'n_tokens_neox': 2510, 'n_words': 637}