<commit_before>package leetcode

/**
 * https://leetcode.com/problems/minimum-rounds-to-complete-all-tasks/
 */
class Problem2244 {
    fun minimumRounds(tasks: IntArray): Int {
        TODO()
    }
}

fun main() {
    val prob = Problem2244()
    println(prob.minimumRounds(intArrayOf(2,2,3,3,2,4,4,4,4,4))) // 4
    println(prob.minimumRounds(intArrayOf(4,4,2,3,3,2,4,4,4,2))) // 4
    println(prob.minimumRounds(intArrayOf(2,3,3))) // -1
}<commit_msg>Solve problem 2244<commit_after>package leetcode

/**
 * https://leetcode.com/problems/minimum-rounds-to-complete-all-tasks/
 */
class Problem2244 {
    fun minimumRounds(tasks: IntArray): Int {
        val map = mutableMapOf<Int, Int>()
        for (task in tasks) {
            map[task] = (map[task] ?: 0) + 1
        }
        var answer = 0
        for (count in map.values) {
            if (count < 2) {
                return -1
            }
            answer += if (count % 3 == 0) {
                count / 3
            } else if (count % 3 == 1) {
                (count / 3) - 1 + 2
            } else { // count % 3 == 2
                (count / 3) + 1
            }
        }
        return answer
    }
}
{'fraction_non_alphanumeric': 0.15306122448979592, 'fraction_numerical': 0.050170068027210885, 'mean_word_length': 1.756440281030445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '7136411', 'n_tokens_mistral': 448, 'n_tokens_neox': 403, 'n_words': 81}