<commit_before>t = gets.to_i
t.times do 
    (a,b,x) = gets.split(" ").map{|x| x.to_i}
    num_to_find = a**b
    high = x
    low = high
        
    while high < a**b
        low = high
        high += x
    end
    
    diff_low = (num_to_find - low).abs
    diff_high = (high - num_to_find).abs
    diff_zero = (num_to_find).abs
    
    if diff_zero < diff_low && diff_zero < diff_high
        puts "0"
    elsif diff_low < diff_zero && diff_low < diff_high
        puts low
    else
        puts high
    end
      
end<commit_msg>refactor closest_number<commit_after>t = gets.to_i
t.times do 
    (a,b,x) = gets.split(" ").map{|x| x.to_i}
    num_to_find = a**b
    low = 0
    high = x
    
    while high < num_to_find
        low = high
        high += x
    end
    
    diff_low = (num_to_find - low).abs
    diff_high = (high - num_to_find).abs

    puts diff_low < diff_high ? low : high
end
{'fraction_non_alphanumeric': 0.11160220994475138, 'fraction_numerical': 0.0022099447513812156, 'mean_word_length': 1.8401253918495297, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 3, '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': '4082318', 'n_tokens_mistral': 354, 'n_tokens_neox': 351, 'n_words': 83}