package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const N = 1002

var T [10][N][N]int16
var LM [N][N]int16
var s, t string
var n, m int16

// from i && j, k strings left
func f(i, j, k int16) int16 {
	if k == 0 || i == n || j == m {
		return 0
	}

	x := T[k-1][i][j]
	if x != 0 {
		return max16(0, x)
	}

	lmij := lm(i, j)
	x = max16(
		max16(
			f(i+1, j+1, k),
			lmij+f(i+lmij, j+lmij, k-1),
		),
		max16(
			f(i, j+1, k),
			f(i+1, j, k),
		))

	T[k-1][i][j] = x
	if x == 0 {
		T[k-1][i][j] = -1
	}
	return x
}

func max16(a int16, b int16) int16 {
	if b > a {
		a = b
	}
	return a
}

func lm(i, j int16) int16 {
	if i >= n || j >= m {
		return 0
	}
	x := LM[i][j]
	if x != 0 {
		return max16(0, x)
	}
	if s[i] == t[j] {
		x = 1 + lm(i+1, j+1)
		LM[i][j] = x
	} else {
		LM[i][j] = -1
		x = 0
	}
	return x
}

func main() {
	n = int16(getInt())
	m = int16(getInt())
	k := int16(getInt())
	s = getWord()
	t = getWord()
	if n > m {
		n, m = m, n
		s, t = t, s
	}
	// s is shorter

	fmt.Println(f(0, 0, k))
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}
func getInt() int {
	globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	globalInput.Scan()
	return globalInput.Text()
}
func getWordOk() (string, bool) {
	ok := globalInput.Scan()
	return globalInput.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func remin(a *int, b int) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax(a *int, b int) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func remin64(a *int64, b int64) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax64(a *int64, b int64) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func reminStr(a *string, b string) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remaxStr(a *string, b string) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

type (
	FLess    func(i, j int) bool
	FSwap    func(i, j int)
	wrapSort struct {
		Length int
		FLess
		FSwap
	}
)

func (w *wrapSort) Len() int           { return w.Length }
func (w *wrapSort) Less(i, j int) bool { return w.FLess(i, j) }
func (w *wrapSort) Swap(i, j int)      { w.FSwap(i, j) }
func wsort(length int, fless func(i, j int) bool, fswap func(i, j int)) {
	sort.Sort(&wrapSort{length, fless, fswap})
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF682D(in io.Reader, out io.Writer) {
	max := func(a, b int) int {
		if a > b {
			return a
		}
		return b
	}
	var n, m, K int
	var s, t []byte
	Fscan(bufio.NewReader(in), &n, &m, &K, &s, &t)
	dp := make([][][][2]int, n)
	for i := range dp {
		dp[i] = make([][][2]int, m)
		for j := range dp[i] {
			dp[i][j] = make([][2]int, K+1)
			for k := range dp[i][j] {
				dp[i][j][k] = [2]int{-1, -1}
			}
		}
	}
	var f func(i, j, k, prevSame int) int
	f = func(i, j, k, prevSame int) (res int) {
		if k > K {
			return -1e9
		}
		if i == n || j == m {
			return
		}
		dv := &dp[i][j][k][prevSame]
		if *dv != -1 {
			return *dv
		}
		defer func() { *dv = res }()
		res = max(f(i+1, j, k, 0), f(i, j+1, k, 0))
		if s[i] == t[j] {
			res = max(res, 1+f(i+1, j+1, k+1-prevSame, 1))
		}
		return
	}
	Fprint(out, f(0, 0, 0, 0))
}

func main() { CF682D(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const N = 1002

var T [10][N][N]int16
var LM [N][N]int16
var s, t string
var n, m int16

// from i && j, k strings left
func f(i, j, k int16) int16 {
	if k == 0 || i == n || j == m {
		return 0
	}

	x := T[k-1][i][j] - 1
	if x >= 0 {
		return x
	}

	lmij := lm(i, j)
	x = max16(
		max16(
			f(i+1, j+1, k),
			lmij+f(i+lmij, j+lmij, k-1),
		),
		max16(
			f(i, j+1, k),
			f(i+1, j, k),
		))

	T[k-1][i][j] = x + 1
	return x
}

func max16(a int16, b int16) int16 {
	if b > a {
		a = b
	}
	return a
}

func lm(i, j int16) int16 {
	if i >= n || j >= m {
		return 0
	}
	x := LM[i][j] - 1
	if x >= 0 {
		return x
	}
	if s[i] == t[j] {
		x = 1 + lm(i+1, j+1)
	} else {
		x = 0
	}
	LM[i][j] = x + 1
	return x
}

func main() {
	n = int16(getInt())
	m = int16(getInt())
	k := int16(getInt())
	s = getWord()
	t = getWord()
	if n > m {
		n, m = m, n
		s, t = t, s
	}
	// s is shorter

	fmt.Println(f(0, 0, k))
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}
func getInt() int {
	globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	globalInput.Scan()
	return globalInput.Text()
}
func getWordOk() (string, bool) {
	ok := globalInput.Scan()
	return globalInput.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func remin(a *int, b int) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax(a *int, b int) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func remin64(a *int64, b int64) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax64(a *int64, b int64) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func reminStr(a *string, b string) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remaxStr(a *string, b string) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

type (
	FLess    func(i, j int) bool
	FSwap    func(i, j int)
	wrapSort struct {
		Length int
		FLess
		FSwap
	}
)

func (w *wrapSort) Len() int           { return w.Length }
func (w *wrapSort) Less(i, j int) bool { return w.FLess(i, j) }
func (w *wrapSort) Swap(i, j int)      { w.FSwap(i, j) }
func wsort(length int, fless func(i, j int) bool, fswap func(i, j int)) {
	sort.Sort(&wrapSort{length, fless, fswap})
}

package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func max(a, b int) int {
	if a > b{
		return a
	}
	return b
}

var dp [1001][1001][11][2] int
func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1005)
	bytes, _, _ := reader.ReadLine()
	strs := strings.Split(string(bytes), " ")
	n, _ := strconv.Atoi(strs[0])
	m, _ := strconv.Atoi(strs[1])
	k, _ := strconv.Atoi(strs[2])
	bytes, _, _ = reader.ReadLine()
	str1 := string(bytes)
	bytes, _, _ = reader.ReadLine()
	str2 := string(bytes)
	for i:=1; i<= n; i++ {
		for j:=1; j<= m; j++ {
			for p := 1; p <= k; p++ {
				dp[i][j][p][0] = max(max(dp[i-1][j][p][0], dp[i-1][j][p][1]), max(dp[i][j-1][p][0], dp[i][j-1][p][1]))
				if str1[i-1] != str2[j-1] {
					dp[i][j][p][1] = -1
				} else {
					dp[i][j][p][1] = max(dp[i][j][p][1], max(dp[i-1][j-1][p-1][0], dp[i-1][j-1][p-1][1]) + 1)
					dp[i][j][p][1] = max(dp[i][j][p][1], dp[i-1][j-1][p][1] + 1)
				}
			}
		}
	}
	fmt.Println(max(dp[n][m][k][0], dp[n][m][k][1]))
}

package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func max(a, b int) int {
	if a > b{
		return a
	}
	return b
}

var dp [1001][1001][11][2] int
func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1005)
	bytes, _, _ := reader.ReadLine()
	strs := strings.Split(string(bytes), " ")
	n, _ := strconv.Atoi(strs[0])
	m, _ := strconv.Atoi(strs[1])
	k, _ := strconv.Atoi(strs[2])
	str1, _, _ := reader.ReadLine()
	str2, _, _ := reader.ReadLine()
	for i:=1; i<= n; i++ {
		for j:=1; j<= m; j++ {
			for p := 1; p <= k; p++ {
				dp[i][j][p][0] = max(max(dp[i-1][j][p][0], dp[i-1][j][p][1]), max(dp[i][j-1][p][0], dp[i][j-1][p][1]))
				if str1[i-1] != str2[j-1] {
					dp[i][j][p][1] = -1
				} else {
					dp[i][j][p][1] = max(dp[i][j][p][1], max(dp[i-1][j-1][p-1][0], dp[i-1][j-1][p-1][1]) + 1)
					dp[i][j][p][1] = max(dp[i][j][p][1], dp[i-1][j-1][p][1] + 1)
				}
			}
		}
	}
	fmt.Println(max(dp[n][m][k][0], dp[n][m][k][1]))
}

package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func max(a, b int) int {
	if a > b{
		return a
	}
	return b
}

var dp [1001][1001][11][2] int
func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1005)
	bytes, _, _ := reader.ReadLine()
	strs := strings.Split(string(bytes), " ")
	n, _ := strconv.Atoi(strs[0])
	m, _ := strconv.Atoi(strs[1])
	k, _ := strconv.Atoi(strs[2])
	bytes, _, _ = reader.ReadLine()
	str1 := string(bytes)
	bytes, _, _ = reader.ReadLine()
	str2 := string(bytes)
	for i:=1; i<= n; i++ {
		for j:=1; j<= m; j++ {
			for p := 1; p <= k; p++ {
				if str1[i-1] != str2[j-1] {
					dp[i][j][p][0] = max(max(dp[i-1][j][p][0], dp[i-1][j][p][1]), max(dp[i][j-1][p][0], dp[i][j-1][p][1]))
					dp[i][j][p][1] = -1
				} else {
					dp[i][j][p][0] = -1
					dp[i][j][p][1] = max(max(dp[i-1][j][p][0], dp[i-1][j][p][1]), max(dp[i][j-1][p][0], dp[i][j-1][p][1]))
					dp[i][j][p][1] = max(dp[i][j][p][1], max(dp[i-1][j-1][p-1][0], dp[i-1][j-1][p-1][1]) + 1)
					dp[i][j][p][1] = max(dp[i][j][p][1], dp[i-1][j-1][p][1] + 1)
				}
				//fmt.Printf("show %d %d %d\n", i, j, p)
				//fmt.Printf("show %d %d %d\n", i, j, p)
			}
		}
	}
	fmt.Println(max(dp[n][m][k][0], dp[n][m][k][1]))
}

package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func max(a, b int) int {
	if a > b{
		return a
	}
	return b
}

var dp [1001][1001][11][2] int
func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1005)
	bytes, _, _ := reader.ReadLine()
	strs := strings.Split(string(bytes), " ")
	n, _ := strconv.Atoi(strs[0])
	m, _ := strconv.Atoi(strs[1])
	k, _ := strconv.Atoi(strs[2])
	str1, _, _ := reader.ReadLine()
	str2, _, _ := reader.ReadLine()
	for i:=1; i<= n; i++ {
		for j:=1; j<= m; j++ {
			for p := 1; p <= k; p++ {
				dp[i][j][p][0] = max(max(dp[i-1][j][p][0], dp[i-1][j][p][1]), max(dp[i][j-1][p][0], dp[i][j-1][p][1]))
				if str1[i-1] == str2[j-1] {
					dp[i][j][p][1] = max(dp[i][j][p][1], max(dp[i-1][j-1][p-1][0], dp[i-1][j-1][p-1][1]) + 1)
					dp[i][j][p][1] = max(dp[i][j][p][1], dp[i-1][j-1][p][1] + 1)
				}
			}
		}
	}
	fmt.Println(max(dp[n][m][k][0], dp[n][m][k][1]))
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF682D(in io.Reader, out io.Writer) {
	max := func(a, b int) int {
		if a > b {
			return a
		}
		return b
	}
	var n, m, K int
	var s, t []byte
	Fscan(bufio.NewReader(in), &n, &m, &K, &s, &t)
	dp := make([][][]int, n)
	for i := range dp {
		dp[i] = make([][]int, m)
		for j := range dp[i] {
			dp[i][j] = make([]int, K+1)
			for k := range dp[i][j] {
				dp[i][j][k] = -1
			}
		}
	}
	var f func(i, j, k int) int
	f = func(i, j, k int) (res int) {
		if k > K {
			return -1e9
		}
		if i == n || j == m {
			return
		}
		dv := &dp[i][j][k]
		if *dv != -1 {
			return *dv
		}
		defer func() { *dv = res }()
		res = max(f(i+1, j, k), f(i, j+1, k))
		if s[i] == t[j] {
			if i > 0 && j > 0 && s[i-1] != t[j-1] {
				k++
			}
			res = max(res, 1+f(i+1, j+1, k))
		}
		return
	}
	Fprint(out, f(0, 0, 0))
}

func main() { CF682D(os.Stdin, os.Stdout) }


// 348A
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, x, c, rem, max, ans int64
	in := bufio.NewReader(os.Stdin)
	fmt.Scan(&n)
	max, rem = 0, 0
	for i := int64(0); i < n; i++ {
		fmt.Fscan(in, &x)
		rem = rem + x
		if max < x {
			max = x
		}
	}
	if rem%(n-1) == 0 {
		c = 0
	} else {
		c = 1
	}
	ans = rem/(n-1) + c
	if max < ans {
		fmt.Println(ans)
	} else {
		fmt.Println(max)
	}
}

// 348A-mic
package main

import (
    "fmt"
    "math"
    "bufio"
    "os"
)

func main() {
    var n, i, max, sum, x, y float64
    z := bufio.NewReader(os.Stdin)
    fmt.Scan(&n)
    for i = 0; i < n; i++ {
        fmt.Fscan(z, &x)
        if x > max {
            max = x
        }
        sum += x
    }
    y = math.Ceil(sum / (n - 1))
    if y < max {
        fmt.Println(int64(max))
    } else {
        fmt.Println(int64(y))
    }
}

package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	//"unicode"
	//"strings"
	//"math"
)

func max(a,b int64) int64{
	if a>b {
		return a
	} else {
		return b
	}
}

func main() {
    var n,i,x,m,s int64
    s=0
    fmt.Scan(&n)
    input := bufio.NewScanner(os.Stdin)
    input.Split(bufio.ScanWords)
    for i=1;i<=n;i++ {
    	input.Scan()
    	aa,_:=strconv.ParseInt(input.Text(),0,64)
    	x=aa
    	m=max(m,x)
    	s+=x
    	//fmt.Scan(&arr[i])
    }
    fmt.Println(max(m,(s-1)/(n-1)+1))
}

//348A
package main
import (
	"os"
	"bufio"
	"strconv"
)

func main() {
	var i int
	var x, min int64
	var a[1000000]int64
	r:=bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	i, _ = strconv.Atoi(r.Text())
	for j:=0; j<i; j++ {
		r.Scan()
		a[j], _ = strconv.ParseInt(r.Text(), 0, 64)
		if a[j]>min {
			min=a[j]
		}
	}
	for j:=0; j<i; j++ {
		x=x+(min-a[j])
	}

	if x>min {
		w.WriteString(strconv.FormatInt(min, 10)+"\n")
	} else {
		for x=x; x<min; x+=int64(i) {
			min++
		}
		w.WriteString(strconv.FormatInt(min, 10)+"\n")
	}
	w.Flush()
}

package main

import (
    "fmt"
    "bufio"
    "os"
    "strconv"
    "math"
)

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    total, max := int64(0), int64(0)
    for i := 0; i < n; i++ {
        scanner.Scan()
        a, _ := strconv.Atoi(scanner.Text())
        total += int64(a)
        if max < int64(a) { max = int64(a) }
    }
    ans := int64(math.Ceil(float64(total)/float64(n-1)))
    if ans < max { ans = max }
    fmt.Println(ans)
}

package main
import (
	"os"
	"bufio"
	"strconv"
)

func main() {
	var i, x, min int
	var a[100000]int
	r:=bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	i, _ = strconv.Atoi(r.Text())
	for j:=0; j<i; j++ {
		r.Scan()
		a[j], _ = strconv.Atoi(r.Text())
		if a[j]>min {
			min=a[j]
		}
	}
	for j:=0; j<i; j++ {
		x=x+(min-a[j])
	}

	if x>min {
		w.WriteString(strconv.Itoa(min)+"\n")
	} else {
		for x=x; x<min; x+=i {
			min++
		}
		w.WriteString(strconv.Itoa(min)+"\n")
	}
	w.Flush()
}

package main
import (
	"fmt"
	"os"
	"bufio"
	"strconv"
)

func main() {
	var i, x, min int
	var a[100000]int
	r:=bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	r.Scan()
	i, _ = strconv.Atoi(r.Text())
	for j:=0; j<i; j++ {
		r.Scan()
		a[j], _ = strconv.Atoi(r.Text())
		if a[j]>min {
			min=a[j]
		}
	}
	for j:=0; j<i; j++ {
		x=x+(min-a[j])
	}

	if x>min {
		fmt.Println(min)
	} else {
		for x=x; x<min; x+=i {
			min++
		}
		fmt.Println(min)
	}
}

package main

import (
    "fmt"
    "bufio"
    "os"
    "strconv"
    "math"
)

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    total := int64(0)
    for i := 0; i < n; i++ {
        scanner.Scan()
        a, _ := strconv.Atoi(scanner.Text())
        total += int64(a)
    }
    fmt.Println(int64(math.Ceil(float64(total)/float64(n-1))))
}

// 348A-mic_rizal
package main

import (
    "fmt"
    "math"
)

func main() {
    var n, i, max, sum, x, y float64
    fmt.Scan(&n)
    for i = 0; i < n; i++ {
        fmt.Scan(&x)
        if x > max {
            max = x
        }
        sum += x
    }
    y = math.Ceil(sum / (n - 1))
    if y < max {
        fmt.Println(max)
    } else {
        fmt.Println(y)
    }
}


package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct {
		v int64
		e int
	}

	primeFactorization := func(x int64) (factors []pair) {
		for i := int64(2); i*i <= x; i++ {
			e := 0
			for ; x%i == 0; x /= i {
				e++
			}
			if e > 0 {
				factors = append(factors, pair{i, e})
			}
		}
		if x > 1 {
			factors = append(factors, pair{x, 1})
		}
		return
	}
	solve := func(Case int) {
		var n int64
		Fscan(in, &n)
		fs := primeFactorization(n)
		mxI := 0
		for i, f := range fs {
			if f.e > fs[mxI].e {
				mxI = i
			}
		}
		p := fs[mxI]
		Fprintln(out, p.e)
		for i := 0; i < p.e-1; i++ {
			Fprint(out,p.v," " )
			n/=p.v
		}
		Fprintln(out, n)
	}

	var t int
	Fscan(in, &t)
	for Case := 1; Case <= t; Case++ {
		solve(Case)
	}
}

func main() { run(os.Stdin, os.Stdout) }

package main

import (
	"fmt"
	"bufio"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func solve() {
	var n int64
	scanf("%d\n", &n)
	mxdeg := 1
	val := n
	m := n
	for i := int64(2); i * i <= m && n > 1; i++ {
		if n % i == 0 {
			curr := 0
			for ; n % i == 0; curr++ {
				n /= i
			}
			if curr > mxdeg {
				mxdeg = curr
				val = i
			}
		}
	}
	printf("%d\n", mxdeg)
	rest := m
	for i := 0; i < mxdeg - 1; i++ {
		printf("%d ", val)
		rest /= val
	}
	printf("%d\n", rest)
}

func main() {
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func factorize(n int64) (primeFactors map[int64]int64, maxPower int64, remainder int64) {
	primeFactors = make(map[int64]int64)
	maxPower = 1
	remainder = n

	// calculate prime factors
	for i := int64(2); i*i <= n; i++ {
		if i%2 == 0 && i > 2 {
			continue
		}
		for remainder%i == 0 {
			primeFactors[i]++
			remainder = remainder / i
		}
		if v, ok := primeFactors[i]; ok && (v > maxPower) {
			maxPower = v
		}
	}

	// check if n is prime
	if len(primeFactors) == 0 {
		primeFactors[n]++
		remainder = 1
	}

	return primeFactors, maxPower, remainder
}

func main() {
	in := bufio.NewReader(os.Stdin)

	var t, n int64
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)

		primeFactors, maxPower, remainder := factorize(n)

		result := make([]int64, maxPower)
		for i := range result {
			result[i] = 1
		}
		result[maxPower-1] *= remainder

		for k, v := range primeFactors {
			baseMultiplier := int64(1)
			for i := int64(0); i < v/maxPower; i++ {
				baseMultiplier *= k
			}
			for i := int64(0); i < maxPower; i++ {
				result[i] *= baseMultiplier
				if i > maxPower-1-v%maxPower {
					result[i] *= k
				}
			}
		}

		fmt.Println(maxPower)
		for i := range result {
			fmt.Printf("%d ", result[i])
		}
		fmt.Println()
	}
}

package main

import(

	"fmt"
	."fmt"
	"bufio"
	"os"
)

const hell int = 1000000007
const N int = 1000005

var sp [N]int

func seive(){
	for i := 2;i<N;i++{
		for j := i;j<N;j+=i{
			if(sp[j]==0){
				sp[j]=i
			}
		}
	}
}

func max(x,y int)int{
	if x>y{
		x,y = y,x
	}
	return y
}

func solve(n int64){

	ans := 1
	val := n

	for i := int64(1);i*i<=n;i++{
		if n%i==0{
			f1,f2 := i,n/i
			if ans < count_freq(n,f1){
				ans = count_freq(n,f1)
				val = f1
			}
			if ans < count_freq(n,f2){
				ans = count_freq(n,f2)
				val = f2
			}
		}
	}

	v := []int64{}
	pdt := int64(1)

	for i:=0;i<ans;i++{
		v = append(v,val)
		pdt *= val
	}

	v[len(v)-1] *= (n/pdt)

	fmt.Println(ans)
	for _,val:= range v{
		fmt.Printf("%v ",val)
	}
	fmt.Println()
}

func count_freq(n,factor int64)int{
	ct := 0
	if factor>=1000005 || sp[int(factor)]!=int(factor){
		return ct
	}

	for ;n%factor==0;{
		ct+=1
		n/=factor
	}
	return ct
}

func main(){
	var TESTS int
	in := bufio.NewReader(os.Stdin)

	Fscan(in,&TESTS)

	seive()

	for ;TESTS>0;TESTS--{
		var n int64
		Fscan(in,&n)
		solve(n)
	}
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func solve() {
	var n int64
	scanf("%d\n", &n)
	mxdeg := 1
	val := n
	m := n
	for i := int64(2); i * i < m && n > 1; i++ {
		if n % i == 0 {
			curr := 0
			for ; n % i == 0; curr++ {
				n /= i
			}
			if curr > mxdeg {
				mxdeg = curr
				val = i
			}
		}
	}
	printf("%d\n", mxdeg)
	rest := m
	for i := 0; i < mxdeg - 1; i++ {
		printf("%d ", val)
		rest /= val
	}
	printf("%d\n", rest)
}

func main() {
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func factorize(n int64) (primeFactors map[int64]int64, maxPower int64) {
	primeFactors = make(map[int64]int64)
	maxPower = 1

	// calculate prime factors
	remainder := n
	for i := int64(2); i*i <= n; i++ {
		if i%2 == 0 && i > 2 {
			continue
		}
		for remainder%i == 0 {
			primeFactors[i]++
			remainder = remainder / i
		}
		if v, ok := primeFactors[i]; ok && (v > maxPower) {
			maxPower = v
		}
	}

	// check if n is prime
	if len(primeFactors) == 0 {
		primeFactors[n]++
	}

	return primeFactors, maxPower
}

func main() {
	in := bufio.NewReader(os.Stdin)

	var t, n int64
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)

		primeFactors, maxPower := factorize(n)

		result := make([]int64, maxPower)
		for i := range result {
			result[i] = 1
		}

		for k, v := range primeFactors {
			baseMultiplier := int64(1)
			for i := int64(0); i < v/maxPower; i++ {
				baseMultiplier *= k
			}
			for i := int64(0); i < maxPower; i++ {
				result[i] *= baseMultiplier
				if i > maxPower-1-v%maxPower {
					result[i] *= k
				}
			}
		}

		fmt.Println(maxPower)
		for i := range result {
			fmt.Printf("%d ", result[i])
		}
		fmt.Println()
	}
}


package main

import (
	"fmt"
	"bufio"
	"os"
)

// TEMPLATE
type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}
var bufferIO BufferIO = BufferIO{
	bufio.NewReader(os.Stdin),
	bufio.NewWriter(os.Stdout),
}
func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}
func printf(format string, params ...interface{}) {
	fmt.Fprintf(bufferIO.writer, format, params...)
}
func flush() {
	bufferIO.writer.Flush()
}
func main() {
	mainn()
	flush()
}
// END OF TEMPLATE

var A [200100]int
var cnt [400100]int

func main1() {
	var N int
	scanf("%d\n", &N)

	var u int
	OFFSET := 200050

	ans := int64(0)
	for i := 0; i < N; i++ {
		scanf("%d", &u)
		A[i] = u
		ans += int64(cnt[u - i + OFFSET])
		cnt[u - i + OFFSET]++
	}

	scanf("\n")

	printf("%d\n", ans)

	for i := 0; i < N; i++ {
		cnt[A[i] - i + OFFSET]--
	}
}

func mainn() {
	var T int

	scanf("%d\n", &T)

	for i := 0; i < T; i++ {
		main1()
	}
}

package main

import (
    "fmt"
    "sort"
    "bufio"
    "os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }
func scan(a ...interface{}) { fmt.Fscan(reader, a...) }

const MAXN = 201 * 1000

func count_pairs(arr []int) int64 {
    sort.Ints(arr)
    var ans int64 = 0
    var cnt int64 = 1

    for i := 1; i < len(arr); i++ {
        if arr[i] == arr[i - 1] {
            cnt++
        } else {
            ans += (cnt * (cnt - 1)) / 2
            cnt = 1
        }
    }
    ans += (cnt * (cnt - 1)) / 2
    return ans
}

func main() {
    defer writer.Flush()
    var buf[MAXN]int
    var n_tasks int
    scan(&n_tasks)
    for i := 0; i < n_tasks; i++ {
        var n int
        scan(&n)
        for j := 0; j < n; j++ {
            scan(&buf[j])
            buf[j] -= j
        }
        printf("%d\n", count_pairs(buf[:n]))
    }
}

package main

import (
	"bufio"
	"os"
	"fmt"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)

		a := make([]int, n)

		for j := 0; j< n; j++ {
			fmt.Fscan(r, &a[j])
		}

		fmt.Println(solve(a, n))
	}
}

//aj−ai=j−i .

//3 4 4 2 7

//3 4 1 2 3 5

// a[j] - a[i] == j - i
// a[j] - j == a[i] - i

func solve(a []int, n int) int64 {

	var cnt int64

	mp := make(map[int]int)

	for i := 0; i < n ; i++ {
		if v, ok := mp[a[i] - i]; ok {
			cnt += int64(v)
		}

		mp[a[i] - i]++
	}

	return cnt
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func scanString(s *string) { fmt.Fscanln(reader, s) }

var arr [200007]int

func test_case() {
	var n int
	scanf("%d\n", &n)

	var cnt = map[int]int{}
	for i := 0; i < n; i++ {
		if i + 1 < n {
		    scanf("%d ", &arr[i])
		} else {
		    scanf("%d\n", &arr[i])
		}

	}

	// arr[j] - arr[i] = j - i
	// arr[j] - j = arr[i] - i
	var ans int64 = 0
	for i := 0; i < n; i++ {
		ans += int64(cnt[arr[i] - i])
		cnt[arr[i] - i]++
	}

	println(ans)
}

func main() {
	defer writer.Flush()
	var t int

	scanf("%d\n", &t)
	for t > 0 {
		test_case()
		t--
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)

	var t, n, a int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		m := make(map[int]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			m[a-i-1]++
		}
		cnt := int64(0)
		for _, v := range m {
			cnt += (v - 1) * v / 2
		}

		fmt.Println(cnt)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

/*
4
1
1
2
1 2
3
1 2 3
4
1 2 3 4
---
0
1
3
6
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	bld := strings.Builder{}

	var t int
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)

		numToCnt := make(map[int]int)

		for i := 1; i <= n; i++ {
			var num int
			scanf("%d", &num)

			num = num - i

			numToCnt[num]++
		}
		scanf("\n")

		pairCnt := int64(0)

		for _, cnt := range numToCnt {
			cnt64 := int64(cnt)
			pairCnt += cnt64 * (cnt64 - 1) / 2
		}

		fmt.Fprintf(&bld, "%d\n", pairCnt)
	}

	printf("%s", bld.String())
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

//goland:noinspection GoUnusedType
type pair struct {
	fst int
	snd int
}

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//goland:noinspection GoUnusedFunction
func printf(f string, a ...interface{}) {
	if _, err := fmt.Fprintf(writer, f, a...); err != nil {
		panic(err)
	}
}

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func solve(n int, a []int) int64 {
	var (
		c int64
		b = make(map[int]int)
	)
	for i, x := range a {
		b[x-i]++
	}
	for i := range b {
		c += int64(b[i]) * (int64(b[i] - 1)) / 2
	}
	return c
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func scanString(s *string)              { fmt.Fscanln(reader, s) }

var arr [200005]int

func test_case() {
	var n int
	scanf("%d\n", &n)
	var cnt = map[int]int{}
	for i := 0; i < n; i++ {
		if i+1 < n {
			scanf("%d ", &arr[i])
		} else {
			scanf("%d\n", &arr[i])
		}
	}
	var ans int64 = 0
	for i := 0; i < n; i++ {
		ans += int64(cnt[arr[i]-i])
		cnt[arr[i]-i]++
	}
	println(ans)
}
func main() {
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	for t > 0 {
		test_case()
		t--
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		cnt := map[int]int{}
		ans := int64(0)
		for i := range a {
			Fscan(in, &a[i])
			v := a[i]-i
			ans+=int64(cnt[v])
			cnt[v]++
		}
		Fprintln(out, ans)
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

func main() { run(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 4096)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 4096)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int64
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				res += int64(int64(val) * int64(val-1) / 2)
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 4096)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 4096)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int64
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 2 {
				res += int64(int64(val) * int64(val-1) / 2)
			} else if val == 2 {
				res++
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type key struct {
	n, r int
}

var nCrMemoi map[key]uint64 = map[key]uint64{}

func nCr(n, r int) uint64 {
	if r == 0 {
		return 1
	}

	if n == r {
		return 1
	}

	var answer uint64
	k := key{n, r}

	if val, ok := nCrMemoi[k]; ok {
		answer = val
	} else {
		answer = nCr(n-1, r-1) + nCr(n-1, r)
		nCrMemoi[k] = answer
	}

	return answer
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j
			hashmap[subtraction]++
		}

		var result uint64
		for _, val := range hashmap {
			if val > 1 {
				result += nCr(val, 2)
			}
		}

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	r := NewReader(os.Stdin)

	t := r.ReadInt()

	for k := 0; k < t; k++ {
		n := r.ReadInt()

		mp := make([]int, n * 2 + 1)

		var ans int64

		for i := 0; i < n; i++ {
			m := r.ReadInt() + n - i
			ans += int64(mp[m])
			mp[m] += 1
		}

		fmt.Println(ans)
	}
}

type Reader struct {
	s *bufio.Scanner
}

func NewReader(r io.Reader) *Reader {
	reader := &Reader{s: bufio.NewScanner(r)}
	reader.s.Split(bufio.ScanWords)
	return reader
}

func (r *Reader) ReadInt() int {
	r.s.Scan()
	v, _ := strconv.Atoi(r.s.Text())
	return v
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

// READ WRITE TEMPLATE
type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}
var bufferIO BufferIO = BufferIO{
	bufio.NewReader(os.Stdin),
	bufio.NewWriter(os.Stdout),
}
func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}
func printf(format string, params ...interface{}) {
	fmt.Fprintf(bufferIO.writer, format, params...)
}
func flush() {
	bufferIO.writer.Flush()
}
// END OF READ WRITE TEMPLATE

var A [200100]int
var cnt [400100]int

func main1() {
	var N int
	scanf("%d\n", &N)

	var u int
	OFFSET := 200050

	ans := int64(0)
	for i := 0; i < N; i++ {
		scanf("%d", &u)
		A[i] = u
		ans += int64(cnt[u - i + OFFSET])
		cnt[u - i + OFFSET]++
	}

	scanf("\n")

	printf("%d\n", ans)

	for i := 0; i < N; i++ {
		cnt[A[i] - i + OFFSET]--
	}
}

func main() {
	var T int

	scanf("%d\n", &T)

	for i := 0; i < T; i++ {
		main1()
	}

	flush()
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

// READ WRITE TEMPLATE
type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}
var bufferIO BufferIO
func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}
func printf(format string, params ...interface{}) {
	fmt.Fprintf(bufferIO.writer, format, params...)
}
func flush() {
	bufferIO.writer.Flush()
}
// END OF READ WRITE TEMPLATE

var A [200100]int
var cnt [400100]int

func main1() {
	var N int
	scanf("%d\n", &N)

	var u int
	OFFSET := 200050

	ans := int64(0)
	for i := 0; i < N; i++ {
		scanf("%d", &u)
		A[i] = u
		ans += int64(cnt[u - i + OFFSET])
		cnt[u - i + OFFSET]++
	}

	scanf("\n")

	printf("%d\n", ans)

	for i := 0; i < N; i++ {
		cnt[A[i] - i + OFFSET]--
	}
}

func main() {
	bufferIO = BufferIO{
		bufio.NewReader(os.Stdin),
		bufio.NewWriter(os.Stdout),
	}
	var T int

	scanf("%d\n", &T)

	for i := 0; i < T; i++ {
		main1()
	}

	flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var stdin = bufio.NewReader(os.Stdin)

func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n int
	fmt.Fscan(stdin, &n)

	cnt := make(map[int]int64, n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(stdin, &a)
		cnt[a-i]++
	}

	var sum int64 = 0
	for _, c := range cnt {
		if c == 1 {
			continue
		}
		c--
		sum += (1 + c) * c / 2
	}
	fmt.Println(sum)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for	Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)

		var ans int64
		mp := make([]int, 2 * n + 1)
		for i := 0; i < n; i++ {
			var num int
			Fscan(in, &num)
			ans += int64(mp[num - i + n])
			mp[num - i + n]++
		}

		Fprintln(out, ans)
	}
}

func main() { run(os.Stdin, os.Stdout) }

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for	Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)

		mp := make([]int, 2 * n + 1)
		for i := 0; i < n; i++ {
			var num int
			Fscan(in, &num)
			mp[num - i + n]++
		}

		var ans int64
		for _, val := range mp {
			if val > 0 {
				ans += (int64(val) * int64(val - 1)) >> 1
			}
		}
		Fprintln(out, ans)
	}
}

func main() { run(os.Stdin, os.Stdout) }

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for	Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)

		mp := make(map[int]int)
		for i := 0; i < n; i++ {
			var num int
			Fscan(in, &num)
			mp[num - i]++
		}

		var ans int64
		for _, val := range mp {
			ans += (int64(val) * int64(val - 1)) >> 1
		}
		Fprintln(out, ans)
	}
}

func main() { run(os.Stdin, os.Stdout) }

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	for oi := 0; oi < k; oi++ {
		pnum,_ := Readln(reader)
		num, _ := strconv.Atoi(pnum)
		b := make([] int, num)
		pEntries, _ := Readln(reader)
		entries := strings.Split(pEntries, " ")
		for i:= range entries {
			b[i],_ = strconv.Atoi(entries[i])
		}
		a := make(map [int64] int64)
		for i:= 0; i< num; i++ {
			a[int64(b[i]-i)]++
		}

		res:= int64(0)
		for _,v := range a {
			res+= (v * (v-1)) /2
		}

		fmt.Println(res)

	}

}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan(n *int64) {
	b := bytes[l]
	*n = 1
	for b < 48 || b > 57 {
		if b == 0x2d {
			*n = -1
		}
		l++
		b = bytes[l]
	}

	result := int64(0)
	for 47 < b && b < 58 {
		result = int64(result << 3) + int64(result << 1) + int64(b-48)

		l++
		if l > max {
			*n *= result
			return
		}
		b = bytes[l]
	}
	*n *= result
}

func init() {
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
}

func main(){
	var t int64
	fastScan(&t)
	for ; t > 0; t-- {
		var n, a int64
		fastScan(&n)
		mp := map[int64]int64{}
		for i:=int64(0); i<n;i++{
			fastScan(&a)
			mp[a-i]++
		}
		sm := int64(0)
		for _, v := range mp{
			sm += ((v*(v-1))/2)
		}
		fmt.Println(sm)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	MOD int = int(1e9 + 7)
)

func main() {
	_r := bufio.NewReader(os.Stdin)
	_w := bufio.NewWriter(os.Stdout)
	defer _w.Flush()

	var t int
	fmt.Fscan(_r, &t)

	for q := 0; q < t; q++ {
		var l int
		fmt.Fscan(_r, &l)
		mp := make(map[int]int)
		var ans int64
		for i := 0; i < l; i++ {
			var a int
			fmt.Fscan(_r, &a)
			a -= i
			ans += int64(mp[a])
			mp[a]++
		}
		fmt.Fprintf(_w, "%d\n", ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

// func factorial(n int) int {
// 	result := 1

// 	for i := 1; i <= n; i++ {
// 		result *= i
// 	}

// 	return result
// }

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		var result int64
		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j

			if v, ok := hashmap[subtraction]; ok {
				result += int64(v)
			}

			hashmap[subtraction]++
		}

		// var result int
		// for _, val := range hashmap {
		// 	if val > 1 {
		// 		result += factorial(val) / (factorial(2) * factorial(val-2))
		// 	}
		// }

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t, n int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d\n", &n)
		var a int
		var ans int64
		set := make(map[int]int64, n)

		for i := 1; i <= n; i++ {
			if i == n {
				fmt.Fscanf(reader, "%d\n", &a)
			} else {
				fmt.Fscanf(reader, "%d ", &a)
			}

			ans += set[a-i]
			set[a-i] = set[a-i] + 1
		}

		fmt.Println(ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func findPairs(arr []int) int64 {
	nPairs := int64(0)
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return nPairs
}
func combinatorics(spaceSize int, choiceSize int) int64 {
	return int64(spaceSize) * int64(spaceSize-1) / 2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, 2048*2048)
	scanner.Buffer(buffer, len(buffer))
	var nTests int
	scanner.Scan()
	nTests, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < nTests; i++ {
		var size int
		scanner.Scan()
		size, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		arrStr := scanner.Text()
		arrStr = strings.TrimSuffix(arrStr, "\r\n")
		arrStr = strings.TrimSuffix(arrStr, "\n")
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/*
func main() {
	arr := make([]int, 200000)
	for i, _ := range arr {
		arr[i] = i + 1
	}
	fmt.Println(findPairs(arr))
} */

// https://codeforces.com/problemset/problem/1520/D

// 1520D - Same Differences

// You are given an array a of n integers. Count the number of pairs of indices (i, j) such that i < j and aj − ai = j − i.

// Input
// The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.
// The first line of each test case contains one integer n (1 ≤ n ≤ 2⋅10^5).
// The second line of each test case contains n integers a1, a2, …, an (1 ≤ ai ≤ n) — array a.
// It is guaranteed that the sum of n over all test cases does not exceed 2⋅10^5.

// Output
// For each test case output the number of pairs of indices (i, j) such that i < j and aj − ai = j − i.

// Example
// input
// 4
// 6
// 3 5 1 4 6 6
// 3
// 1 2 3
// 4
// 1 3 3 4
// 6
// 1 6 3 4 5 6
// output
// 1
// 3
// 3
// 10

// Tutorial

// Let's rewrite the original equality a bit:
// aj − ai = j − i,
// aj − j = ai − i
// Let's replace each ai with bi = ai − i. Then the answer is the number of pairs (i, j) such that i < j and bi = bj. To calculate this value you can use map or sorting.

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, n, x, ans, i uint
	var a []uint

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &n)
			a = make([]uint, 2*n+1)
			ans = 0

			for i = 0; i < n; i++ {
				fmt.Fscan(reader, &x)
				x += n - i
				ans += a[x]
				a[x]++
			}

			fmt.Fprintln(writer, ans)
		}
	}

	writer.Flush()
}

// https://codeforces.com/problemset/problem/1520/D

// 1520D - Same Differences

// You are given an array a of n integers. Count the number of pairs of indices (i, j) such that i < j and aj − ai = j − i.

// Input
// The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.
// The first line of each test case contains one integer n (1 ≤ n ≤ 2⋅10^5).
// The second line of each test case contains n integers a1, a2, …, an (1 ≤ ai ≤ n) — array a.
// It is guaranteed that the sum of n over all test cases does not exceed 2⋅10^5.

// Output
// For each test case output the number of pairs of indices (i, j) such that i < j and aj − ai = j − i.

// Example
// input
// 4
// 6
// 3 5 1 4 6 6
// 3
// 1 2 3
// 4
// 1 3 3 4
// 6
// 1 6 3 4 5 6
// output
// 1
// 3
// 3
// 10

// Tutorial

// Let's rewrite the original equality a bit:
// aj − ai = j − i,
// aj − j = ai − i
// Let's replace each ai with bi = ai − i. Then the answer is the number of pairs (i, j) such that i < j and bi = bj. To calculate this value you can use map or sorting.

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, n, ans, i, j uint
	var a []uint

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &n)
			a = make([]uint, n)
			ans = 0

			for i = 0; i < n; i++ {
				fmt.Fscan(reader, &a[i])
				a[i] -= i
			}

			sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })

			for i = 0; i < n; i = j {
				for j = i + 1; j < n && a[i] == a[j]; j++ {
				}
				ans += (j - i) * (j - i - 1) / 2
			}

			fmt.Fprintln(writer, ans)
		}
	}

	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

const MAXN = 1e2 + 5

func Solve() {
	n := ri()
	a := make([]int64, 2*n+5)
	ans := int64(0)
	for i := 1; i <= n; i++ {
		x := ri()
		ans += a[i-x+n]
		a[i-x+n]++
	}
	fmt.Println(ans)
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	result := 1

	for i := 1; i <= n; i++ {
		result *= i
	}

	return result
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	if n == 10000 {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				if i == 254 {
					fmt.Fprintf(out, "%d ", val)

					subtraction := val - j
					hashmap[subtraction]++
				}
			}

			if i == 254 {
				fmt.Fprintln(out, "------")
				fmt.Fprintln(out, hashmap)

				var result int
				for _, val := range hashmap {
					if val > 1 {
						val1 := factorial(val)
						fmt.Fprintf(out, "val1 -> %d\n", val1)
						val2 := factorial(2)
						fmt.Fprintf(out, "val2 -> %d\n", val2)
						val3 := factorial(val - 2)
						fmt.Fprintf(out, "val3 -> %d\n", val3)
						val4 := factorial(2) * factorial(val-2)
						fmt.Fprintf(out, "val4 -> %d\n", val4)

						result += factorial(val) / (factorial(2) * factorial(val-2))
					}
					fmt.Fprintf(out, "result -> %d\n", result)
				}
			}
		}
	} else {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			var result int64
			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				subtraction := val - j

				if v, ok := hashmap[subtraction]; ok {
					result += int64(v)
				}

				hashmap[subtraction]++
			}

			fmt.Fprintln(out, result)
		}
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	result := 1

	for i := 1; i <= n; i++ {
		result *= i
	}

	return result
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	if n == 10000 {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				if i == 254 {
					fmt.Fprintf(out, "%d ", val)

					subtraction := val - j
					hashmap[subtraction]++
				}
			}

			if i == 254 {
				fmt.Fprintln(out, "------")
				fmt.Fprintln(out, hashmap)

				var result int
				for _, val := range hashmap {
					if val > 1 {
						result += factorial(val) / (factorial(2) * factorial(val-2))
					}
					fmt.Fprintf(out, "result -> %d\n", result)
				}
			}
		}
	} else {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			var result int64
			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				subtraction := val - j

				if v, ok := hashmap[subtraction]; ok {
					result += int64(v)
				}

				hashmap[subtraction]++
			}

			fmt.Fprintln(out, result)
		}
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	result := 1

	for i := 1; i <= n; i++ {
		result *= i
	}

	return result
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	if n == 10000 {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				if i == 254 {
					fmt.Fprintf(out, "%d ", val)
					fmt.Fprintln(out, "------")

					subtraction := val - j
					hashmap[subtraction]++
				}
			}

			if i == 254 {
				fmt.Fprintln(out, hashmap)

				var result int
				for _, val := range hashmap {
					fmt.Fprintf(out, "result -> %d", result)
					if val > 1 {
						result += factorial(val) / (factorial(2) * factorial(val-2))
					}
				}
			}
		}
	} else {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			var result int64
			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				subtraction := val - j

				if v, ok := hashmap[subtraction]; ok {
					result += int64(v)
				}

				hashmap[subtraction]++
			}

			fmt.Fprintln(out, result)
		}
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	result := 1

	for i := 1; i <= n; i++ {
		result *= i
	}

	return result
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	if n == 10000 {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				if i == 254 {
					fmt.Fprintf(out, "%d ", val)
					fmt.Fprintln(out, "------")

					subtraction := val - j
					hashmap[subtraction]++
				}
			}

			fmt.Fprintln(out, hashmap)

			var result int
			for _, val := range hashmap {
				fmt.Fprintf(out, "result -> %d", result)
				if val > 1 {
					result += factorial(val) / (factorial(2) * factorial(val-2))
				}
			}
		}
	} else {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			var result int64
			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				subtraction := val - j

				if v, ok := hashmap[subtraction]; ok {
					result += int64(v)
				}

				hashmap[subtraction]++
			}

			fmt.Fprintln(out, result)
		}
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

// func factorial(n int) int {
// 	result := 1

// 	for i := 1; i <= n; i++ {
// 		result *= i
// 	}

// 	return result
// }

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	if n == 10000 {
		for i := 0; i < n; i++ {
			var size int
			fmt.Fscan(in, &size)

			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				if i == 254 {
					fmt.Fprintf(out, "%d ", val)
				}
			}
		}
	} else {
		for i := 0; i < n; i++ {
			hashmap := map[int]int{}
			var size int
			fmt.Fscan(in, &size)

			var result int64
			for j := 0; j < size; j++ {
				var val int
				fmt.Fscan(in, &val)

				subtraction := val - j

				if v, ok := hashmap[subtraction]; ok {
					result += int64(v)
				}

				hashmap[subtraction]++
			}

			// var result int
			// for _, val := range hashmap {
			// 	if val > 1 {
			// 		result += factorial(val) / (factorial(2) * factorial(val-2))
			// 	}
			// }

			fmt.Fprintln(out, result)
		}
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

// func factorial(n int) int {
// 	result := 1

// 	for i := 1; i <= n; i++ {
// 		result *= i
// 	}

// 	return result
// }

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		var result int
		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j

			if v, ok := hashmap[subtraction]; ok {
				result += v
			}

			hashmap[subtraction]++
		}

		// var result int
		// for _, val := range hashmap {
		// 	if val > 1 {
		// 		result += factorial(val) / (factorial(2) * factorial(val-2))
		// 	}
		// }

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	result := 1

	for i := 1; i <= n; i++ {
		result *= i
	}

	return result
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j
			hashmap[subtraction]++
		}

		var result int
		for _, val := range hashmap {
			if val > 1 {
				result += factorial(val) / (factorial(2) * factorial(val-2))
			}
		}

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	if n == 1 || n == 0 {
		return 1
	}

	return n * factorial(n-1)
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j
			hashmap[subtraction]++
		}

		var result int
		for _, val := range hashmap {
			if val > 1 {
				result += factorial(val) / (factorial(2) * factorial(val-2))
			}
		}

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorial(n int) int {
	if n == 1 || n == 0 {
		return 1
	}

	return n * factorial(n-1)
}

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		hashmap := map[int]int{}
		var size int
		fmt.Fscan(in, &size)

		for j := 0; j < size; j++ {
			var val int
			fmt.Fscan(in, &val)

			subtraction := val - j
			hashmap[subtraction]++
		}

		var result int
		for _, val := range hashmap {
			if i == n-1 {
				fmt.Println(val)
			}

			if val > 1 {
				result += factorial(val) / (factorial(2) * factorial(val-2))
			}
		}

		fmt.Fprintln(out, result)
	}
}

func main() {
	logic(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func findPairs(arr []int) int64 {
	nPairs := int64(0)
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return nPairs
}
func combinatorics(spaceSize int, choiceSize int) int64 {
	return int64(spaceSize) * int64(spaceSize-1) / 2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, 1024*1024)
	scanner.Buffer(buffer, len(buffer))
	var nTests int
	scanner.Scan()
	nTests, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < nTests; i++ {
		var size int
		scanner.Scan()
		size, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		arrStr := scanner.Text()
		arrStr = strings.TrimSuffix(arrStr, "\r\n")
		arrStr = strings.TrimSuffix(arrStr, "\n")
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("1 6 3 4 5 6", 6))
} */

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func findPairs(arr []int) int {
	nPairs := 0
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return int(nPairs)
}
func combinatorics(spaceSize int, choiceSize int) int {
	return (spaceSize) * (spaceSize - 1) / 2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, 1024*1024)
	scanner.Buffer(buffer, len(buffer))
	var nTests int
	scanner.Scan()
	nTests, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < nTests; i++ {
		var size int
		scanner.Scan()
		size, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		arrStr := scanner.Text()
		arrStr = strings.TrimSuffix(arrStr, "\r\n")
		arrStr = strings.TrimSuffix(arrStr, "\n")
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("1 6 3 4 5 6", 6))
} */

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func findPairs(arr []int) int {
	nPairs := 0
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return int(nPairs)
}
func combinatorics(spaceSize int, choiceSize int) int {
	return (spaceSize) * (spaceSize - 1) / 2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	//buffer := make([]byte, 1024*1024)
	//scanner.Buffer(buffer, len(buffer))
	var nTests int
	scanner.Scan()
	nTests, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < nTests; i++ {
		var size int
		scanner.Scan()
		size, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		arrStr := scanner.Text()
		arrStr = strings.TrimSuffix(arrStr, "\r\n")
		arrStr = strings.TrimSuffix(arrStr, "\n")
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("1 6 3 4 5 6", 6))
} */

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func findPairs(arr []int) int {
	nPairs := int64(0)
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(int64(v), 2)
		}
	}
	return int(nPairs)
}
func combinatorics(spaceSize int64, choiceSize int64) int64 {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int64) int64 {
	return factorialMem(n, make(map[int64]int64))
}

func factorialMem(n int64, mem map[int64]int64) int64 {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := n * factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		reader := bufio.NewReader(os.Stdin)
		arrStr, _ := reader.ReadString('\n')
		arrStr = strings.TrimSuffix(arrStr, "\r\n")
		arrStr = strings.TrimSuffix(arrStr, "\n")
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("1 6 3 4 5 6", 6))
} */

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func findPairs(arr []int) int {
	nPairs := int64(0)
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(int64(v), 2)
		}
	}
	return int(nPairs)
}
func combinatorics(spaceSize int64, choiceSize int64) int64 {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int64) int64 {
	return factorialMem(n, make(map[int64]int64))
}

func factorialMem(n int64, mem map[int64]int64) int64 {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := n * factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		reader := bufio.NewReader(os.Stdin)
		line, _, _ := reader.ReadLine()
		arrStr := string(line)
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("347 219 326 624 250 250 251 340 807 674 882 793 774 150 776 45 66 828 780 26 223 803 850", 23))
} */

package main

import (
	"fmt"
	"strconv"
)

func findPairs(arr []int) int {
	nPairs := int64(0)
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(int64(v), 2)
		}
	}
	return int(nPairs)
}
func combinatorics(spaceSize int64, choiceSize int64) int64 {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int64) int64 {
	return factorialMem(n, make(map[int64]int64))
}

func factorialMem(n int64, mem map[int64]int64) int64 {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := n * factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		var arrStr string
		fmt.Scanln("%s", &arrStr)
		arr := strToIntArr(arrStr, size)
		fmt.Println(findPairs(arr))
		fmt.Scanf("\n")
	}
}

func strToIntArr(str string, size int) []int {
	nStart := 0
	arr := make([]int, size)
	arrPos := 0
	for i, c := range str {
		if i == len(str)-1 || str[i+1] == ' ' {
			arr[arrPos], _ = strconv.Atoi(str[nStart : i+1])
			arrPos++
		}
		if c == ' ' {
			nStart = i + 1
			continue
		}
	}
	return arr
}

/* func main() {
	fmt.Println(strToIntArr("347 219 326 624 250 250 251 340 807 674 882 793 774 150 776 45 66 828 780 26 223 803 850", 23))
} */

package main

import "fmt"

func findPairs(arr []int) int {
	nPairs := 0
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return nPairs
}
func combinatorics(spaceSize int, choiceSize int) int {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int) int {
	return factorialMem(n, make(map[int]int))
}

func factorialMem(n int, mem map[int]int) int {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := n * factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		arr := make([]int, size)
		for j := 0; j < size; j++ {
			fmt.Scanf("%d", &arr[j])
		}
		fmt.Println(findPairs(arr))
		fmt.Scanf("\n")
	}
}

/* func main() {
	findPairs([]int{1, 6, 3, 4, 5, 6})
} */

package main

func findPairs(arr []int) int {
	nPairs := 0
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[arr[i]-i]++
	}
	for _, v := range counts {
		if v > 1 {
			nPairs += combinatorics(v, 2)
		}
	}
	return nPairs
}
func combinatorics(spaceSize int, choiceSize int) int {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int) int {
	return factorialMem(n, make(map[int]int))
}

func factorialMem(n int, mem map[int]int) int {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := n * factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

/* func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		arr := make([]int, size)
		for j := 0; j < size; j++ {
			fmt.Scanf("%d", &arr[j])
		}
		fmt.Println(findPairs(arr))
		fmt.Scanf("\n")
	}
} */

func main() {
	findPairs([]int{1, 6, 3, 4, 5, 6})
}

package main

import (
	"fmt"
)

func findPairs(arr []int) int {
	nPairs := 0
	counts := make(map[int]int)
	for i := 0; i < len(arr); i++ {
		counts[i-arr[i]]++
	}
	for _, v := range counts {
		nPairs += combinatorics(v, 2)
	}
	return nPairs
}
func combinatorics(spaceSize int, choiceSize int) int {
	return factorial(spaceSize) / (factorial(choiceSize) * factorial(spaceSize-choiceSize))
}

func factorial(n int) int {
	return factorialMem(n, make(map[int]int))
}

func factorialMem(n int, mem map[int]int) int {
	if n < 2 {
		return 1
	}
	if v, ok := mem[n]; ok {
		return v
	}
	fac := factorialMem(n-1, mem)
	mem[n] = fac
	return fac
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var size int
		fmt.Scanf("%d\n", &size)
		arr := make([]int, size)
		for j := 0; j < size; j++ {
			fmt.Scanf("%d", &arr[j])
		}
		fmt.Println(findPairs(arr))
		fmt.Scanf("\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 4096)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 4096)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int64
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 2 {
				res += int64(val * (val - 1) / 2)
			} else if val == 2 {
				res++
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 4096)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 4096)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 2 {
				res += val * (val - 1) / 2
			} else if val == 2 {
				res++
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 65536)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 65536)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += a / (b * 2)
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 32768)
var writer *bufio.Writer = bufio.NewWriterSize(os.Stdout, 32768)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += a / (b * 2)
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReaderSize(bufio.NewReader(os.Stdin), 16384)
var writer *bufio.Writer = bufio.NewWriterSize(bufio.NewWriter(os.Stdout), 16384)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int64
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += int64(a / (b * 2))
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int64
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += int64(a / (b * 2))
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int
		count := make(map[int]int)
		for i, val := range arr {
			count[i-val]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += a / (b * 2)
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var testCase int
	scanf("%d\n", &testCase)
	for ; testCase > 0; testCase-- {

		var arrLen int
		scanf("%d\n", &arrLen)
		var arr []int
		for i := 0; i < arrLen; i++ {
			var val int
			scanf("%d ", &val)
			arr = append(arr, val)
		}
		scanf("\n")

		var res int
		count := make(map[int]int)
		for i, val := range arr {
			count[val-i]++
		}

		for _, val := range count {
			if val > 1 {
				a, b := 1, 1
				for i := 1; i <= val; i++ {
					if i <= val-2 {
						b *= i
					}
					a *= i
				}
				res += a / (b * 2)
			}
		}

		printf("%d\n", res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type Reader struct {
	s *bufio.Scanner
}

func NewReader(r io.Reader) *Reader {
	reader := &Reader{s: bufio.NewScanner(r)}
	reader.s.Split(bufio.ScanWords)
	return reader
}

func (r *Reader) ReadInt() int {
	r.s.Scan()
	v, _ := strconv.Atoi(r.s.Text())
	return v
}

func main() {
	r := NewReader(os.Stdin)

	t := r.ReadInt()

	for k := 0; k < t; k++ {
		n := r.ReadInt()

		mp := make([]int, n * 2 + 1)

		var ans int

		for i := 0; i < n; i++ {
			m := r.ReadInt() + n - i
			ans += mp[m]
			mp[m] += 1
		}

		fmt.Println(ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var stdin = bufio.NewReader(os.Stdin)

func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n int
	fmt.Fscan(stdin, &n)

	cnt := make(map[int]int, n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(stdin, &a)
		cnt[a-i]++
	}

	sum := 0
	for _, c := range cnt {
		if c == 1 {
			continue
		}
		c--
		sum += (1 + c) * c / 2
	}
	fmt.Println(sum)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for	Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)

		mp := make(map[int]int)
		for i := 0; i < n; i++ {
			var num int
			Fscan(in, &num)
			mp[num - i]++
		}

		var ans int64
		for _, val := range mp {
			ans += int64(val * (val - 1) / 2)
		}
		Fprintln(out, ans)
	}
}

func main() { run(os.Stdin, os.Stdout) }

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	for oi := 0; oi < k; oi++ {
		pnum,_ := Readln(reader)
		num, _ := strconv.Atoi(pnum)
		b := make([] int, num)
		pEntries, _ := Readln(reader)
		entries := strings.Split(pEntries, " ")
		for i:= range entries {
			b[i],_ = strconv.Atoi(entries[i])
		}
		a := make(map [int] int)
		for i:= 0; i< num; i++ {
			a[b[i]-i]++
		}

		res:= 0
		for _,v := range a {
			res+= (v * (v-1)) /2
		}

		fmt.Println(res)

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	for oi := 0; oi < k; oi++ {
		pnum,_ := Readln(reader)
		num, _ := strconv.Atoi(pnum)
		a := make(map [int] int)
		for i:= 0; i< num; i++ {
			a[i] = i
		}
		b := make([] int, num)
		pEntries, _ := Readln(reader)
		entries := strings.Split(pEntries, " ")
		for i:= range entries {
			b[i],_ = strconv.Atoi(entries[i])
		}
		pres := 0
		for i:= range a {
			if a[i]+1 == b[i] {
				pres++
			}
		}

		if pres < 2{
			fmt.Println(0)
		} else {
			fmt.Println( (pres * (pres-1))/2 )
		}

	}

}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan(n *int64) {
	b := bytes[l]
	*n = 1
	for b < 48 || b > 57 {
		if b == 0x2d {
			*n = -1
		}
		l++
		b = bytes[l]
	}

	result := int64(0)
	for 47 < b && b < 58 {
		result = int64(result << 3) + int64(result << 1) + int64(b-48)

		l++
		if l > max {
			*n *= result
			return
		}
		b = bytes[l]
	}
	*n *= result
}

func init() {
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
}

func main(){
	var t int64
	fastScan(&t)
	for ; t > 0; t-- {
		var n, a int64
		fastScan(&n)
		mp := map[int64]int{}
		for i:=int64(0); i<n;i++{
			fastScan(&a)
			mp[a-i]++
		}
		sm := int64(0)
		for _, v := range mp{
			sm += int64((v*(v-1))/2)
		}
		fmt.Println(sm)
	}
}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan(n *int) {
	b := bytes[l]
	*n = 1
	for b < 48 || b > 57 {
		if b == 0x2d {
			*n = -1
		}
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			*n *= result
			return
		}
		b = bytes[l]
	}
	*n *= result
}

func init() {
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
}

func main(){
	var t int
	fastScan(&t)
	for ; t > 0; t-- {
		var n, a int
		fastScan(&n)
		mp := map[int]int{}
		for i:=0; i<n;i++{
			fastScan(&a)
			mp[a-i]++
		}
		sm := 0
		for _, v := range mp{
			sm += (v*(v-1))/2
		}
		fmt.Println(sm)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	MOD int = int(1e9 + 7)
)

func main() {
	_r := bufio.NewReader(os.Stdin)
	_w := bufio.NewWriter(os.Stdout)
	defer _w.Flush()

	var t int
	fmt.Fscan(_r, &t)

	for q := 0; q < t; q++ {
		var l int
		fmt.Fscan(_r, &l)
		mp := make(map[int]int)
		ans := 0
		for i := 0; i < l; i++ {
			var a int
			fmt.Fscan(_r, &a)
			a -= i
			ans += mp[a]
			mp[a]++
		}
		fmt.Fprintf(_w, "%d\n", ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	MOD int = int(1e9 + 7)
)

func main() {
	_r := bufio.NewReader(os.Stdin)
	_w := bufio.NewWriter(os.Stdout)
	defer _w.Flush()

	var t int
	fmt.Fscan(_r, &t)

	for q := 0; q < t; q++ {
		var l int
		fmt.Fscan(_r, &l)
		mp := make(map[int]int)
		for i := 0; i < l; i++ {
			var a int
			fmt.Fscan(_r, &a)
			mp[a-i]++
		}
		ans := 0
		for _, v := range mp {
			ans += COMB(v, 2)
		}
		fmt.Fprintf(_w, "%d\n", ans)
	}
}

func COMB(n, m int) int {
	ret := 1
	for i := 1; i <= m; i++ {
		ret *= n + 1 - i
		ret /= i
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t, n int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d\n", &n)
		var a, ans int
		set := make(map[int]int, n)

		for i := 1; i <= n; i++ {
			if i == n {
				fmt.Fscanf(reader, "%d\n", &a)
			} else {
				fmt.Fscanf(reader, "%d ", &a)
			}

			ans += set[a-i]
			set[a-i] = set[a-i] + 1
		}

		fmt.Println(ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

const MAXN = 1e2 + 5

func Solve() {
	n := ri()
	a := make([]int, 2*n+5)
	ans := 0
	for i := 1; i <= n; i++ {
		x := ri()
		ans += a[i-x+n]
		a[i-x+n]++
	}
	fmt.Println(ans)
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}

package main

import (
	"bufio"
	"os"
	"fmt"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)

		a := make([]int, n)

		for j := 0; j< n; j++ {
			fmt.Fscan(r, &a[j])
		}

		fmt.Println(solve(a, n))
	}
}

//aj−ai=j−i .

//3 4 4 2 7

//
// a[j] - a[i] == j - i
// a[j] - j == a[i] - i

func solve(a []int, n int) int {

	var cnt int

	mp := make(map[int]int)

	for i := 0; i < n ; i++ {
		if v, ok := mp[a[i] - i]; ok {
			cnt += v
		}

		mp[a[i] - i]++
	}

	return cnt
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func scanString(s *string) { fmt.Fscanln(reader, s) }

var arr [200007]int

func test_case() {
	var n int
	scanf("%d\n", &n)

	var cnt = map[int]int{}
	for i := 0; i < n; i++ {
		scanf("%d ", &arr[i])

	}

	// arr[j] - arr[i] = j - i
	// arr[j] - j = arr[i] - i
	var ans int64 = 0
	for i := 0; i < n; i++ {
		ans += int64(cnt[arr[i] - i])
		cnt[arr[i] - i]++
	}

	println(ans)
}

func main() {
	defer writer.Flush()
	var t int

	scanf("%d\n", &t)
	for t > 0 {
		test_case()
		t--
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)

	var t, n, a int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		m := make(map[int]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			m[a-i-1]++
		}
		cnt := 0
		for _, v := range m {
			cnt += (v - 1) * v / 2
		}

		fmt.Println(cnt)
	}
}