nodes: 0, module; 1, function_definition; 2, function_name:fast_combine_pairs; 3, parameters; 4, block; 5, identifier:files; 6, identifier:force_single; 7, identifier:full_name; 8, identifier:separators; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, comment:# for each file, save the longest pair it is in; 16, for_statement; 17, comment:# keep only unique pairs; 18, expression_statement; 19, comment:# ensure filenames are R1 followed by R2; 20, return_statement; 21, comment:"""
      assume files that need to be paired are within 10 entries of each other, once the list is sorted
      """; 22, assignment; 23, assignment; 24, assignment; 25, assignment; 26, assignment; 27, identifier:pair; 28, identifier:pairs; 29, block; 30, assignment; 31, list_comprehension; 32, identifier:files; 33, call; 34, identifier:chunks; 35, call; 36, identifier:pairs; 37, list_comprehension; 38, identifier:pairs; 39, list_comprehension; 40, identifier:longest; 41, call; 42, for_statement; 43, identifier:longest; 44, set_comprehension; 45, call; 46, for_in_clause; 47, identifier:sort_filenames; 48, argument_list; 49, attribute; 50, argument_list; 51, call; 52, for_in_clause; 53, identifier:y; 54, for_in_clause; 55, for_in_clause; 56, identifier:defaultdict; 57, argument_list; 58, identifier:file; 59, identifier:pair; 60, block; 61, call; 62, for_in_clause; 63, identifier:sort_filenames; 64, argument_list; 65, identifier:x; 66, identifier:longest; 67, identifier:files; 68, identifier:tz; 69, identifier:sliding_window; 70, integer:10; 71, identifier:files; 72, identifier:combine_pairs; 73, argument_list; 74, identifier:chunk; 75, identifier:chunks; 76, identifier:x; 77, identifier:pairs; 78, identifier:y; 79, identifier:x; 80, identifier:list; 81, if_statement; 82, identifier:tuple; 83, argument_list; 84, identifier:x; 85, call; 86, call; 87, identifier:chunk; 88, identifier:force_single; 89, identifier:full_name; 90, identifier:separators; 91, comparison_operator:len(longest[file]) < len(pair); 92, block; 93, call; 94, attribute; 95, argument_list; 96, identifier:list; 97, argument_list; 98, call; 99, call; 100, expression_statement; 101, identifier:sort_filenames; 102, argument_list; 103, identifier:longest; 104, identifier:values; 105, identifier:x; 106, identifier:len; 107, argument_list; 108, identifier:len; 109, argument_list; 110, assignment; 111, identifier:x; 112, subscript; 113, identifier:pair; 114, subscript; 115, identifier:pair; 116, identifier:longest; 117, identifier:file; 118, identifier:longest; 119, identifier:file
code: def fast_combine_pairs(files, force_single, full_name, separators):
      """
      assume files that need to be paired are within 10 entries of each other, once the list is sorted
      """
      files = sort_filenames(files)
      chunks = tz.sliding_window(10, files)
      pairs = [combine_pairs(chunk, force_single, full_name, separators) for chunk in chunks]
      pairs = [y for x in pairs for y in x]
      longest = defaultdict(list)
      # for each file, save the longest pair it is in
      for pair in pairs:
          for file in pair:
              if len(longest[file]) < len(pair):
                  longest[file] = pair
      # keep only unique pairs
      longest = {tuple(sort_filenames(x)) for x in longest.values()}
      # ensure filenames are R1 followed by R2
      return [sort_filenames(list(x)) for x in longest]