<commit_before>#!/usr/bin/env python2

import time

N = 10000000

h = [None] * N

def pushDown(pos, n):
    while 2*pos + 1 < n:
        j = 2*pos + 1
        if (j+1 < n) and (h[j+1] > h[j]):
            j += 1
        if h[pos] >= h[j]:
            break
        h[pos], h[j] = h[j], h[pos]
        pos = j

def main():
    start = time.clock()

    for i in range(N):
        h[i] = i

    for i in range(N//2, -1, -1):
        pushDown(i, N)

    n = N
    while n > 1:
        h[0], h[n-1] = h[n-1], h[0]
        n -= 1
        pushDown(0, n)

    for i in range(N):
        if h[i] != i:
            raise Exception("h[i] != i")
<commit_msg>Using xrange instead of range for Python 2<commit_after>#!/usr/bin/env python2

import time

N = 10000000

h = [None] * N

def pushDown(pos, n):
    while 2*pos + 1 < n:
        j = 2*pos + 1
        if (j+1 < n) and (h[j+1] > h[j]):
            j += 1
        if h[pos] >= h[j]:
            break
        h[pos], h[j] = h[j], h[pos]
        pos = j

def main():
    start = time.clock()

    for i in xrange(N):
        h[i] = i

    for i in xrange(N//2, -1, -1):
        pushDown(i, N)

    n = N
    while n > 1:
        h[0], h[n-1] = h[n-1], h[0]
        n -= 1
        pushDown(0, n)

    for i in xrange(N):
        if h[i] != i:
            raise Exception("h[i] != i")

{'fraction_non_alphanumeric': 0.18099547511312217, 'fraction_numerical': 0.03996983408748114, 'mean_word_length': 1.4127272727272728, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1251974', 'n_tokens_mistral': 593, 'n_tokens_neox': 551, 'n_words': 163}