<commit_before>-- https://www.hackerrank.com/challenges/2d-array/problem

import Control.Monad (replicateM, liftM2)
import Data.Maybe (fromJust)

type HourGlass = [Int]


squareSide = 6
hourGlassSide = 3


getIntSquareMatrix :: Int -> IO([[Int]])
getIntSquareMatrix rows = do
  lines <- replicateM rows squareSide
  let intMatrix = (map . map) read $ map words lines
  return intMatrix


getAllCoordinates :: Int -> [(Int, Int)]
getAllCoordinates side = LiftM2 (,) [0..side] [0..side]


buildHourGlass :: [[Int]] -> (Int, Int) -> Maybe HourGlass
buildHourGlass matrix (row, col) = do
  HourGlass [ matrix !! row !! col
            , matrix !! row !! col + 1
            , matrix !! row !! col + 2
            , matrix !! row + 1 !! col + 1<commit_msg>Fix bug while reading input<commit_after>-- https://www.hackerrank.com/challenges/2d-array/problem

import Control.Monad (replicateM, liftM2)
import Data.Maybe (fromJust)

type HourGlass = [Int]


squareSide = 6
hourGlassSide = 3


getIntSquareMatrix :: Int -> IO([[Int]])
getIntSquareMatrix rows = do
  lines <- replicateM rows getLine
  let intMatrix = (map . map) read $ map words lines
  return intMatrix


getAllCoordinates :: Int -> [(Int, Int)]
getAllCoordinates side = LiftM2 (,) [0..side] [0..side]


buildHourGlass :: [[Int]] -> (Int, Int) -> Maybe HourGlass
buildHourGlass matrix (row, col) = do
  HourGlass [ matrix !! row !! col
            , matrix !! row !! col + 1
            , matrix !! row !! col + 2
            , matrix !! row + 1 !! col + 1
{'fraction_non_alphanumeric': 0.14011896893588896, 'fraction_numerical': 0.014540647719762063, 'mean_word_length': 3.102981029810298, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6398527', 'n_tokens_mistral': 535, 'n_tokens_neox': 502, 'n_words': 149}