You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: c.go
    path of file: ./repos/codeforces-go/leetcode/weekly/302/c
    
    the code of the file until where you have to start completion: package main

import (
	"math"
	"sort"
)

// https://space.bilibili.com/206214
func smallestTrimmedNumbers(nums []string, queries [][]int) (an
    
func smallestTrimmedNumbers2(nums []string, queries [][]int) []int {
	ans := make([]int, len(queries))
	type pair struct {
		s string
		i int
	}
	ps := make([]pair, len(nums))
	for i, q := range queries {
		for j, s := range nums {
			ps[j] = pair{s[len(s)-q[1]:], j}
		}
		// 也可以用稳定排序，但是要慢一些 sort.SliceStable(ps, func(i, j int) bool { return ps[i].s < ps[j].s })
		sort.Slice(ps, func(i, j int) bool { a, b := ps[i], ps[j]; return a.s < b.s || a.s == b.s && a.i < b.i })
		ans[i] = ps[q[0]-1].i
	}
	return ans
}