Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
s = input()

rgb = 'RGB'
ans = 0
for i in range(0, n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]: continue
        k = rgb.replace(s[i], '')
        k = k.replace(s[j], '')
        r = s[j+1:2*j-i] + s[2*j-i+1:]
        ans += r.count(k)
print(ans)

### FIXED CODE ###

n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

count = 0
#count second conditions satisfied
for i in range(n):
    for j in range(i+1,n):
        #search j - i = k - j ⇔ k = 2 * j - i
        k = 2 * j - i
        if k >= n: break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]: count += 1
print((r * g * b) - count)
### BUGGY CODE ###

n = input()

# 上の段:その桁をピッタリ払った, 下の段:その桁を払わなかった(上の桁で1多く払った)
dp = [[0 for i in range(len(n))] for j in range(2)]

dp[0][0] = int(n[0])
dp[1][0] = 1 + 10 - int(n[0])

for i in range(1, len(n)):
    dp[0][i] = min(dp[0][i-1], dp[1][i-1]) + int(n[i])
    dp[1][i] = min(dp[0][i-1]+1+10-int(n[i]), dp[1][i-1]-1+10-int(n[i]))

print(min(dp[0][len(n)-1], dp[1][len(n)-1]))

### FIXED CODE ###

n = input()

# 上の段:その桁をピッタリ払った, 下の段:その桁を払わなかった(上の桁で1多く払った)
dp = [[0 for i in range(len(n))] for j in range(2)]

dp[0][0] = int(n[0])
dp[1][0] = 1 + 10 - int(n[0])

for i in range(1, len(n)):
    dp[0][i] = min(dp[0][i-1], dp[1][i-1]) + int(n[i])
    dp[1][i] = min(dp[0][i-1]+1+10-int(n[i]), dp[1][i-1]-1+10-int(n[i]))

print(min(dp[0][len(n)-1], dp[1][len(n)-1]))
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a1 = [a[x*2] for x in range(n//2+n%2)]
a2 = [a[x*2+1] for x in range(n//2)]
a1set = []
a2set = []

for k in set(a1):
    a1set.append([k,a1.count(k)])
for k in set(a2):
    a2set.append([k,a2.count(k)])

a1set.sort(key=lambda x:x[1],reverse=True)
a2set.sort(key=lambda x:x[1],reverse=True)

if a1set[0][0] != a2set[0][0]:
    print(n-a1set[0][1]-a2set[0][1])
elif len(a1set) > 1 and len(a2set) > 1:
    if a1set[0][1] + a2set[1][1] > a2set[0][1] + a1set[1][1]:
        print(n - a2set[2][1] - a1set[0][1])
    else:
        print(n - a2set[0][1] - a1set[1][1])
elif len(a1set) > 1:
    print(n - a2set[0][1] - a1set[1][1])
elif len(a2set) > 1:
    print(n - a2set[2][1] - a1set[0][1])
else:
    print(n - a1set[0][1])


### FIXED CODE ###

from collections import Counter
n = int(input())
el = [int(i) for i in input().split()]
odd_l = Counter(el[::2])
even_l = Counter(el[1::2])
a1, b1 = odd_l.most_common(1)[0]
a2, b2 = even_l.most_common(1)[0]
if a1 != a2:
    ans = n - b1 - b2
else:
    if len(odd_l) > 1:
        b3 = odd_l.most_common(2)[1][1]
    else:
        b3 = 0
    if len(even_l) > 1:
        b4 = even_l.most_common(2)[1][1]
    else:
        b4 = 0
    ans = min(n - b1 - b4, n - b3 - b2)
print(ans)
### BUGGY CODE ###

import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    N = sc.intarr()[0]
    S = sc.strarr()[0]

    count = 0

    for i in range(1000):
        # print("--------")
        lucky = "000"
        Flag_j = -1
        Flag_m = -1
        Flag_n = -1
        # print("check001")
        if i < 10:
            lucky = "00" + str(i)
        elif i < 100:
            lucky = "0" + str(i)
        else:
            lucky = str(i)

        for j in range(N-2):
            if S[j] == lucky[0]:
                Flag_j = j
                break
        # print("check002")
        if Flag_j == -1:
            continue
        # print("check003")

        for m in range(Flag_j+1, N-1):
            if S[m] == lucky[1]:
                Flag_m = m
                break
        # print("check004")
        if Flag_m == -1:
            continue
        # print("check005")

        for n in range(Flag_m+1, N):
            if S[n] == lucky[2]:
                Flag_n = n
                break
        # print("check006")
        if Flag_n == -1:
            continue
        # print("check007")
        count += 1

    print(count)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()


### FIXED CODE ###

import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    _ = sc.intarr()[0]
    S = sc.strarr()[0]

    count = 0

    for i in range(1000):
        # print("--------")
        lucky = format_str(i)
        first = S.find(lucky[0])
        third = S.rfind(lucky[2])

        if first == -1 or third == -1:
            continue
        elif first < third:
            if lucky[1] in S[first + 1:third]:
                count += 1
    print(count)


def format_str(num):
    if num < 10:
        return "00" + str(num)
    elif num < 100:
        return "0" + str(num)
    else:
        return str(num)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()
### BUGGY CODE ###

n=int(input())

import math
result=0
for i in range(1,n+1):
    for ii in range(1,n+1):
        for iii in range(1,n+1):
            temp=math.gcd(i,ii)
            result+=math.gcd(temp,iii)
print(result)


### FIXED CODE ###

n=int(input())

import math
result=0
for i in range(1,n+1):
    for ii in range(1,n+1):
        for iii in range(1,n+1):
            temp=math.gcd(i,ii)
            result+=math.gcd(temp,iii)
print(result)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
b = set(a)

ans = 0
for x in b:
    if a.count(x) % 2 == 1:
       ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
b = set(a)
d = {i: 0 for i in b}

for i in a:
    d[i] += 1

ans = 0
for v in d.values():
    if v%2 == 1:
        ans += 1
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	N = int(input())
	A = input().split()
	A = [int(s) for s in A]

	base = -1
	for i, val in enumerate(A):
		if i == 0:
			base == val
			continue
		base = gcd(val, base)

	ans = base
	for i, val in enumerate(A):
		tmp = -1
		for j, vol in enumerate(A):
			if i == j:
				continue
 
			if tmp == -1:
				tmp = vol
				continue
 
			tmp = gcd(vol, tmp)
			if tmp <= base:
				break
 
		if tmp > ans:
			ans = tmp
 
	print(ans)
 
 
 
def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
if __name__ == "__main__":
	main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	N = int(input())
	A = list(map(int, input().split(" ")))
	
	L = []
	for i, val in enumerate(A):
		if i == 0:
			L.append(val)
			continue
		tmp = gcd(val, L[i-1])
		L.append(tmp)
		
	R = []
	for i, val in enumerate(reversed(A)):
		if i == 0:
			R.append(val)
			continue
		tmp = gcd(val, R[i-1])
		R.append(tmp)
		
	ans = 0
	for i, val in enumerate(A):
		if i == 0:
			tmp = R[len(A)-2]
		elif i == len(A)-1:
			tmp = L[len(A)-2]
		else:
			tmp = gcd(L[i-1], R[len(A)-i-2])
			
		if tmp > ans:
			ans = tmp
		
	print(ans)
	
def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
if __name__ == "__main__":
	main()
### BUGGY CODE ###

import copy

S=input()

N=len(S)
M=[]
for s in S:
    if s == 'R':
        M.append(1)
    else:
        M.append(-1)


def move(C):
    D=[0] * N
    for i,c in enumerate(C):
        D[i+M[i]] += c
    return D



c=[1] * N
d=[0] * N

even_c = [0] * N

i=0
while True:
    d = move(c)
    if c == even_c:
        break
    if i % 2 == 0:
        even_c = copy.deepcopy(c)
    c = d
    i+=1

for c in even_c:
    print(str(c)+' ',end='')
print()

### FIXED CODE ###

S=input()

N=len(S)
RLs=[]
Rs=[]
Ls=[]

rlen=0
llen=0
for i in range(N):

    if S[i]=='R':
        rlen+=1
        if S[i:i+2] == 'RL':
            RLs.append(i)
            Rs.append(rlen)
            rlen=0
    elif S[i]=='L':
        llen+=1
        if i==N-1 or S[i:i+2] == 'LR':
            Ls.append(llen)
            llen=0

ans = [0]*N
for i,rlpos in enumerate(RLs):
    rr=-(-Rs[i]//2)
    rl=Rs[i]//2

    lr=Ls[i]//2
    ll=-(-Ls[i]//2)

    ans[rlpos]+=rr+lr
    ans[rlpos+1]+=rl+ll

for a in ans:
    print(str(a)+' ',end='')
print()
### BUGGY CODE ###

import sys
from collections import deque


input = lambda: sys.stdin.readline().rstrip()


if __name__ == "__main__":
    H, W = map(int, input().split())
    ch, cw = map(lambda x: int(x)-1, input().split())
    dh, dw = map(lambda x: int(x)-1, input().split())
    maze = [list(input()) for _ in range(H)]
    INF = 10**8
    mc = [[INF]*W for _ in range(H)]
    mc[ch][cw] = 0
    walk = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    warp = [(y, x) for x in range(-2, 3) for y in range(-2, 3) if abs(y) + abs(x) > 1]
    que = deque()
    que.append((ch, cw, 0))
    while que:
        y, x, w = que.popleft()
        for dy, dx in walk:
            ny = y + dy
            nx = x + dx
            if H > ny >= 0 and W > nx >= 0 and mc[ny][nx] > w and maze[ny][nx] == ".":
                mc[ny][nx] = w
                que.appendleft((ny, nx, w))
        for dy, dx in warp:
            ny = y + dy
            nx = x + dx
            if H > ny >= 0 and W > nx >= 0 and mc[ny][nx] > w+1 and maze[ny][nx] == ".":
                mc[ny][nx] = w + 1
                que.append((ny, nx, w+1))
    if mc[dh][dw] == INF:
        print(-1)
    else:
        print(mc[dh][dw])


### FIXED CODE ###

import sys
from collections import deque


input = lambda: sys.stdin.readline().rstrip()


if __name__ == "__main__":
    H, W = map(int, input().split())
    ch, cw = map(lambda x: int(x)-1, input().split())
    dh, dw = map(lambda x: int(x)-1, input().split())
    maze = [list(input()) for _ in range(H)]
    INF = 10**8
    mc = [[INF]*W for _ in range(H)]
    mc[ch][cw] = 0
    walk_que = deque()
    walk_que.append((ch, cw, 0))
    while walk_que:
        y, x, w = walk_que.popleft()
        for ny, nx in [(y+1, x), (y-1, x), (y, x+1), (y, x-1)]:
            if H > ny >= 0 and W > nx >= 0 and mc[ny][nx] > w and maze[ny][nx] == ".":
                mc[ny][nx] = w
                walk_que.appendleft((ny, nx, w))
        for dy in range(-2, 3):
            ny = y + dy
            for dx in range(-2, 3):
                nx = x + dx
                if H > ny >= 0 and W > nx >= 0 and mc[ny][nx] > w+1 and maze[ny][nx] == ".":
                    mc[ny][nx] = w + 1
                    walk_que.append((ny, nx, w+1))
    if mc[dh][dw] == INF:
        print(-1)
    else:
        print(mc[dh][dw])
### BUGGY CODE ###

def main():
  s=input()
  q=int(input())
  tmp=[]
  for i in s:
      tmp.append(i)

  for _ in [0]*q:
      query = input()
      try:
          t = int(query)
          tmp = tmp[::-1]
      except ValueError:
          t,f,c = map(str,query.split())
          if f == "1":
              tmp = [c] + tmp
          if f == "2":
              tmp.append(c)
  print(''.join(tmp))
main()

### FIXED CODE ###

def main():
  from collections import deque
  s=input()
  q=int(input())
  turn = 2
  d=deque(s)

  for _ in [0]*q:
      query = input()
      if query[0] == "1":
          t = int(query)
          turn = 3 - turn
      else:
          t,f,c = map(str,query.split())
          if (int(f) + turn)% 2  == 0:
              d.append(c)
          else:
              d.appendleft(c)
  if turn == 2:
      print("".join(d))
  else:
      print("".join(list(d)[::-1]))
main()
### BUGGY CODE ###

n, a, b = map(int ,input().split())

def inv(k):
    return pow(k, mod - 2, mod)

def comb(n, k):
    bunshi = 1
    bunbo = 1
    for i in range(k):
        bunshi *= (n - i) % mod
        bunbo *= (i + 1) % mod
    return bunshi * inv(bunbo) % mod

mod = 1000000007
all_num = pow(2, n, mod)

ans = all_num - 1 - comb(n, a) - comb(n, b)
print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
mod = 1000000007
def inv(y, mod):
    return pow(y, mod - 2, mod)

def comb(n, a, mod):
    x = 1
    y = 1
    for i in range(a):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    return (x * inv(y, mod)) % mod
    
print((pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)
### BUGGY CODE ###

times = int(input())
numbers = list(map(int, input().split()))
result = 0
for i in range(times):
  for j in range(i+1, times):
    result += numbers[i] * numbers[j]
print(result % (10 ** 9 + 7))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(' ')))

mod = 10 ** 9 +7
amount = sum(A)
calc = []
for i in range(N - 1):
  amount = amount - A[i]
  calc.append(amount)

for i in range(N - 1):
  calc[i] *= A[i]

print(sum(calc) % mod)
### BUGGY CODE ###

n = int(input())
a_list = list(map(int, input().split()))
a_list2 = a_list

c = a_list2.count(1)
a_list2 = [i for i in a_list2 if i != 1]
print(c)

for i in range(n-1):
    a_buka = a_list[i] + 1
    count = a_list2.count(a_buka)
    a_list2 = [j for j in a_list2 if j != a_buka]
    print(count)


### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
ans = [0] * n

for a in a_list:
    ans[a-1] += 1

for i in ans:
    print(i)
### BUGGY CODE ###

H, N = map(int, input().split())

# AB = [list(map(int, input().split())) for _ in range(N)]

AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))

d = [0] + [10 ** 18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




### FIXED CODE ###

import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)

print(d[H])
### BUGGY CODE ###

s = [char for char in input()]
cnt = int(input())
for _ in range(cnt):
    item = input().split()
    if item[0] == "1":
        s.reverse()
    elif item[0] == "2":
        if item[1] == "1":
            s = [item[2]] + s
        else:
            s.append(item[2])
print("".join(s))

### FIXED CODE ###

from collections import deque
s = input().split()
sd = deque()
for i in s:
    sd.append(i)
N = int(input())
S = []
order = 1
for _ in range(N):
    res = input().split()
    if res[0] == "1":
        order = order * - 1
    elif res[1] == "1":
        if order == 1:
            sd.appendleft(res[2])
        else:
            sd.append(res[2])
    else:
        if order == 1:
            sd.append(res[2])
        else:
            sd.appendleft(res[2])

sd_str="".join(list(sd))
if order == -1:
    print(sd_str[::-1])
else:
    print(sd_str)
### BUGGY CODE ###

#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

    _ = int(input())
    A = [int(x) for x in input().split()]
    Q = int(input())

    lst = [0 for _ in [0] * (10 ** 5 + 1)]
    sum_lst = 0
    for n in range(10 ** 5 + 1):
        lst[n] = A.count(n)
        sum_lst += n * lst[n]

    for _ in range(Q):
        B, C = map(int, input().split())

        sum_lst += (C - B) * lst[B]
        print(sum_lst)
        lst[C] += lst[B]
        lst[B] = 0


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

    _ = int(input())
    lst = [0 for _ in [0] * (10 ** 5 + 1)]
    sum_lst = 0
    for a in [int(x) for x in input().split()]:
        sum_lst += a
        lst[a] += 1
    Q = int(input())

    for _ in range(Q):
        B, C = map(int, input().split())

        sum_lst += (C - B) * lst[B]
        print(sum_lst)
        lst[C] += lst[B]
        lst[B] = 0


if __name__ == '__main__':
    main()
### BUGGY CODE ###

def main():
    import heapq
    n, m, *abc = map(int, open(0).read().split())
    a = sorted(abc[:n])
    *bc, = zip(*[iter(abc[n:])] * 2)
    bc = sorted(bc, key=lambda x: x[1], reverse=True)
    b = []
    l = 0
    for i, j in bc:
        b += [j] * i
        l += i
        if i > n:
            break

    c = heapq.merge(a, b)

    print(sum(heapq.nlargest(n, c)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    n, m, *abc = map(int, open(0).read().split())
    a = Counter(abc[:n])
    bc = abc[n:]
    for i, j in zip(*[iter(bc)] * 2):
        a[j] += i

    cnt = n
    ans = 0
    keys = list(a.keys())
    keys.sort(reverse=True)

    for k in keys:
        m = a[k]
        if m <= cnt:
            ans += k * m
            cnt -= m
        else:
            ans += k * cnt
            break

    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

string = input()

while "ST" in string:
    string = string.replace("ST","")

print(len(string))


### FIXED CODE ###

string = input()
stack = ""

for i in string:
    if i == "S":
        stack += i
    elif i == "T" and (stack == "" or stack[-1] == "T"):
        stack += i
    else:
        stack = stack[0:-1]

print(len(stack))
### BUGGY CODE ###

n=int(input())
s=input()
count=0
for i in range(0,n-3):
    s1=s[i]
    for j in range(i+1,n-1):
        s2=s[j]
        if s1!=s2:
            if s1=="R" and s2=="G":
                s3="B"
            elif s1=="G" and s2=="R":
                s3="B"
            elif s1=="R" and s2=="B":
                s3="G"
            elif s1=="B" and s2=="R":
                s3="G"
            elif s1=="B" and s2=="G":
                s3="R"
            elif s1=="G" and s2=="B":
                s3="R"
            count=count+s[j+1:].count(s3)
            if j+j-i+1<=n: 
                if s[j+j-i]==s3:
                    count=count-1
print(count)

### FIXED CODE ###

n=int(input())
s=input()
count=0
A=[[0,0,0]for i in range(n)]
for i in range(0,n):
    if s[n-i-1]=="R":
        A[n-i-2][0]=A[n-i-1][0]+1
        A[n-i-2][1]=A[n-i-1][1]
        A[n-i-2][2]=A[n-i-1][2]
    if s[n-i-1]=="G":
        A[n-i-2][0]=A[n-i-1][0]
        A[n-i-2][1]=A[n-i-1][1]+1
        A[n-i-2][2]=A[n-i-1][2]
    if s[n-i-1]=="B":
        A[n-i-2][0]=A[n-i-1][0]
        A[n-i-2][1]=A[n-i-1][1]
        A[n-i-2][2]=A[n-i-1][2]+1
for i in range(0,n-3):
    s1=s[i]
    for j in range(i+1,n-1):
        s2=s[j]
        if s1!=s2:
            if s1=="R" and s2=="G":
                s3="B"
            elif s1=="G" and s2=="R":
                s3="B"
            elif s1=="R" and s2=="B":
                s3="G"
            elif s1=="B" and s2=="R":
                s3="G"
            elif s1=="B" and s2=="G":
                s3="R"
            elif s1=="G" and s2=="B":
                s3="R"
            if s3=="R":
                s4=0
            if s3=="G":
                s4=1
            if s3=="B":
                s4=2
            count=count+A[j][s4]
            if j+j-i+1<=n: 
                if s[j+j-i]==s3:
                    count=count-1
print(count)
### BUGGY CODE ###

n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
total = r * g * b
subs = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k <= n - 1:
            if s[i] == s[j]:
                continue
            elif s[j] == s[k]:
                continue
            elif s[k] == s[i]:
                continue
            else:
                subs += 1
        else:
            continue
ans = total - subs
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
r = 0
g = 0
b = 0
for letter in s:
    if letter == "R":
        r +=1
    elif letter == "G":
        g +=1
    elif letter == "B":
        b +=1
total = r * g * b
subs = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k <= n - 1:
            if s[i] == s[j]:
                continue
            elif s[j] == s[k]:
                continue
            elif s[k] == s[i]:
                continue
            else:
                subs += 1
        else:
            break
ans = total - subs
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b_c = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
  b = b_c[i][0]
  c = b_c[i][1]
  b_count = a.count(b)
  a = [i for i in a if i != b]
  for i in range(b_count):
    a.append(c)
  print(sum(a))

### FIXED CODE ###

import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b_c = [list(map(int,input().split())) for i in range(q)]

summ = sum(a)
cc = collections.Counter(a)
for i in range(q):
  b = b_c[i][0]
  c = b_c[i][1]
  if b in cc:
    buf = cc[b]
    cc[b] = 0
    if c in cc:
      cc[c] = cc[c] + buf
    else:
      cc[c] = buf
    summ = summ - b*buf + c*buf
    print(summ)
  else:
    print(summ)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
a1 = set(a)
l = []
default = 0
for i in a1:
    l.append(a.count(i))
for j in l:
    default += j * (j - 1) // 2
for k in a:
    print(default - (a.count(k) - 1))

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
cnt = 0
for i in c.values():
    cnt += i * (i - 1) // 2
for i in a:
    print(cnt - c[i] + 1)
### BUGGY CODE ###

def solve():
  while True:
    n,m = map(int,input().split())
    if not n and not m: break
    lst = []
    lst2 = []
    for i in range(n):
      lst.append(int(input()))
    for i in lst:
      for j in lst:
        lst2.append(i + j)
    lst2 = lst2 + lst
    lst2.sort()
    ans = 0
    def search(x, l, r):
      y = len(l)
      if y == 0:
        return r
      elif y == 1:
        if x >= l[0]:
          return l[0]
        else:
          return r
      elif l[y//2] == x:
        return x
      elif l[y//2] > x:
        return search(x, l[:y//2], r)
      elif l[y//2] < x:
        r = l[y//2]
        return search(x, l[y//2 + 1:], r)
    for i in lst2:
      if i <= m:
        ans = max(ans, i + search(m - i, lst2, 0))
      else:
        break
    print(ans)
solve()




### FIXED CODE ###

def solve():
  while True:
    n,m = map(int,input().split())
    if not n and not m: break
    
    lst = [int(input()) for _ in range(n)]
    lst.append(0)
    lst = sorted(lst)
    lst2 = [i + j for i in lst for j in lst if i <= j]
    lst2 = sorted(lst2)
    A = []
    index = len(lst2) - 1
    for i in lst2:
      if i + lst2[-1] <= m:
        A.append(i + lst2[-1])
      elif i <= m:
        while True:
          if i + lst2[index] <= m:
            break
          index -= 1
        A.append(i + lst2[index])
      else:
        break
    print(max(A))
solve()
### BUGGY CODE ###

N=int(input())
ans=0
for i in range(1,N+1):
  for j in range(i,N+1,i):
    ans+=j
print(ans)    


### FIXED CODE ###

N=int(input())
ans=0
for i in range(1,N+1):
  for j in range(i,N+1,i):
    ans=ans+j
print(ans)