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/biweekly/78/c
    
    the code of the file until where you have to start completion: package main

import "sort"

// github.com/EndlessCheng/codeforce
    
func maximumWhiteTiles(tiles [][]int, carpetLen int) (ans int) {
	sort.Slice(tiles, func(i, j int) bool { return tiles[i][0] < tiles[j][0] })
	cover, left := 0, 0
	for _, t := range tiles {
		tl, tr := t[0], t[1]
		cover += tr - tl + 1
		for tiles[left][1]+carpetLen-1 < tr {
			cover -= tiles[left][1] - tiles[left][0] + 1
			left++
		}
		ans = max(ans, cover-max(tr-carpetLen+1-tiles[left][0], 0)) // 0 表示毯子左端点不在瓷砖内的情况
	}
	return
}