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

from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    ans += bisect_left(l[j+1:], l[i]+l[j])
print(ans)


### FIXED CODE ###

from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    ans += bisect_left(l, l[i]+l[j]) - j - 1
print(ans)
### BUGGY CODE ###

a, b, n = map(int, input().split())
ans = 0
for i in range(n, 1, -1):
    ans = max(ans, ((a*i//b) - a*(i//b)))
print(ans)


### FIXED CODE ###

a, b, n = map(int, input().split())
if n < b - 1:
    print(a*(n%b)//b)
else:
    print(a*((b-1)%b)//b)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  s=i+a[i]
  for j in range(s+1,n):
    if j-s==a[j]:
      ans=ans+1
print(ans)

### FIXED CODE ###

import collections
n=int(input())
a=list(map(int,input().split()))
l=[]
r=[]
for i in range(n):
  l.append(i+a[i]+1)
  r.append(i-a[i]+1)
cl=collections.Counter(l)
cr=collections.Counter(r)
ans=0
for k,v in cl.items():
  ans+=v*cr[k]
print(ans)
### BUGGY CODE ###

from functools import reduce

n=int(input())
anums=list(map(int,input().split()))
res=reduce(lambda x,y:x*y,anums,1)
print(res if res<=10**18 else -1)



### FIXED CODE ###

def main():
  n=int(input())
  anums=list(map(int,input().split()))
  res=1
  if 0 in anums:
    return 0
  for anum in anums:
    res*=anum
    if res>10**18:
      return -1
  return res
print(main())
### BUGGY CODE ###

h, w, m =  map(int, input().split())
bom_list = []
h_list = [0] * h
w_list = [0] * w

for i in range(m):
    a, b =  map(int, input().split())
    bom_list.append([a - 1, b - 1])
    h_list[a - 1] += 1
    w_list[b - 1] += 1

max_h = max(h_list)
max_h_list = [i for i, x in enumerate(h_list) if x == max_h]
max_w = max(w_list)
max_w_list = [i for i, x in enumerate(w_list) if x == max_w]
ans = max_h + max_w
count = 0

for i in range(len(max_h_list)):
    for j in range(len(max_w_list)):
        if [max_h_list[i], max_w_list[j]] in bom_list:
            count += 1

if len(max_h_list) * len(max_w_list) == count:
    ans -= 1

print(ans)


### FIXED CODE ###

h, w, m =  map(int, input().split())
bom_list = []
h_list = [0] * h
w_list = [0] * w

for i in range(m):
    a, b =  map(int, input().split())
    bom_list.append([a - 1, b - 1])
    h_list[a - 1] += 1
    w_list[b - 1] += 1

max_h = max(h_list)
max_w = max(w_list)
ans = max_h + max_w
count = 0

for bom in bom_list:
    if h_list[bom[0]] == max_h and w_list[bom[1]] == max_w:
        count += 1

if h_list.count(max_h) * w_list.count(max_w) == count:
    ans -= 1

print(ans)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
A = sorted(LI())
B = sorted(LI())
C = sorted(LI())
ans = 0
X = []
for b in B:
    X.append(len(C[bisect_right(C, b):]))
X.reverse()
Acc = list(accumulate(X))
Acc.reverse()
for a in A:
    tmp = bisect_right(B, a)
    if tmp < len(Acc):
        ans += Acc[tmp]
print(ans)


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
A = sorted(LI())
B = sorted(LI())
C = sorted(LI())

ans = 0
for b in B:
    a = bisect_left(A, b)
    c = bisect_right(C, b)
    ans += a*(n-c)
print(ans)
### BUGGY CODE ###

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

A = sorted([a for a in A if a < K])
N = len(A)
S = sum(A)

l, r = -1, N
while r - l > 1:
    m = (l + r) // 2
    B = A[:m] + A[m + 1:]

    if S - A[m] < K - A[m]:
        l = m
        continue

    dp = [False] * (K + 1)
    dp[0] = True
    flg= False

    for i in range(N - 1):
        for j in range(K + 1)[::-1]:
            if B[i] > j:
                continue
            else:
                dp[j] = dp[j - B[i]]

            if dp[j] and K-A[m] <= j < K:
                r = m
                flg = True
                break
        if flg:
            flg = False
            break
    else:
        l = m

print(r)


### FIXED CODE ###

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

A = sorted([a for a in A if a < K])
N = len(A)
S = sum(A)

# あああああああああああああああああああ＼(＾o＾)／
if S < K:
    print(N)
    exit()
elif S - A[0] < N:
    print(0)
    exit()

l, r = -1, N
while r - l > 1:
    m = (l + r) // 2
    B = A[:m] + A[m + 1:]

    if S - A[m] < K - A[m]:
        l = m
        continue

    dp = [False] * (K + 1)
    dp[0] = True
    flg= False

    for i in range(N - 1):
        for j in range(K + 1)[::-1]:
            if B[i] > j:
                continue
            else:
                dp[j] = dp[j - B[i]]

            if dp[j] and K-A[m] <= j < K:
                r = m
                flg = True
                break
        if flg:
            flg = False
            break
    else:
        l = m

print(r)
### BUGGY CODE ###

N = int(input())
S = []
for x in range(N):
    S.append(input())
S_label_n = []
S_label = list(set(S))
for x in S_label:
    S_label_n.append(S.count(x))
max_n =max(S_label_n)
maxIndex = [i for i, x in enumerate(S_label_n) if x ==max_n ]
ans_list = []
for x in maxIndex:
    ans_list.append(S_label[x])
ans_list.sort()
for x in ans_list:
    print(x)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
dictS = {}
for x in range(N):
    tmp = input().rstrip()
    if tmp in dictS:
        dictS[tmp] = dictS[tmp]+1
    else:
        dictS[tmp]=1
        
max_n =max(dictS.values())
maxIndex = [x for x in dictS.items() if x[1] ==max_n ]
ans_list = []
for x in maxIndex:
    ans_list.append(x[0])
ans_list.sort()
for x in ans_list:
    print(x)
### BUGGY CODE ###

N, Y = map(int, input().split())
Y /= 1000
x = 10
y = 5
z = 1
res = [-1, -1, -1]
for i in reversed(range(int(Y/x)+1)):
    for j in reversed(range(int((Y-i)/y)+1)):
        if x*i+y*j <= Y:
            if Y-x*i-y*j+i+j == N:
                res = [i, j, int(N-i-j)]
                print(res[0], res[1], res[2])
                exit(0)
print(-1, -1, -1)


### FIXED CODE ###

N, Y = map(int, input().split())
Y /= 1000
x = 10
y = 5
z = 1
for i in range(N+1):
    for j in range(N+1):
        if x*i+y*j+(N-i-j) == Y and i+j <= N:
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)
### BUGGY CODE ###

import collections
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(input())
A = list(map(int, input().split()))
Ay = list(set(A))
c = collections.Counter(A)
cnt = 0
ansx = []
ansy = []
for i in Ay:
    for x, y in c.items():
        if i == x and y >= 3:
            cnt += combinations_count(y - 1, 2)
        elif i != x and y >= 2:
            cnt += combinations_count(y, 2)
    ansx.append(i)
    ansy.append(cnt)
    cnt = 0


for i in A:
    print(ansy[ansx.index(i)])


### FIXED CODE ###

import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0


sumall = 0
for x, y in c.items():
    sumall += (y*(y-1)//2)

for i in range(N):
    print(sumall - c[A[i]] + 1)
### BUGGY CODE ###

N=int(input())
X=input()
for i in range(N):
    x=''
    for j in range(N):
        if i == j:
            x+='1'
        else:
            x+='0'
    y=int(X,2) ^ int(x,2)
    ans = 0
    while y!=0:
        y = y % bin(y).count('1')
        ans += 1
    print(ans)

### FIXED CODE ###

N=int(input())
X=input()
popcount=X.count('1')
bi1=[]
bi0=[]
Xnum1 = 0
Xnum0 = 0
if popcount != 1:
    for i in range(N):
        if i==0: bi1.append(1)
        else: bi1.append(bi1[i-1]*2%(popcount-1))
        Xnum1 = (Xnum1 + int(X[N-i-1])*bi1[i])%(popcount-1)
for i in range(N):
    if i==0: bi0.append(1)
    else: bi0.append(bi0[i-1]*2%(popcount+1))
    Xnum0 = (Xnum0 + int(X[N-i-1])*bi0[i])%(popcount+1)
for i in range(N):
    if popcount==1 and X[i]=='1':
        print(0)
        continue
    if X[i]=='1':
        Xi = (Xnum1 - bi1[N-i-1])%(popcount-1)
    else:
        Xi = (Xnum0 + bi0[N-i-1])%(popcount+1)
    ans = 1
    while Xi!=0:
        Xi = Xi % bin(Xi).count('1')
        ans += 1
    print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
L=[]
B=set(A)
for i in B:
  x=A.count(i)
  L.append(x)
L.sort(reverse=True)
S=sum(L[0:K:1])
print(N-S)

### FIXED CODE ###

from collections import Counter
N,K=map(int,input().split())
A=list(map(int,input().split()))
x=Counter(A)
l=x.most_common(K)
s=0
for i in range(len(l)):
  s+=l[i][1]
  
print(N-s)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
for idx, i in enumerate(a):
    if i in a[idx+1:]:
        print('NO')
        break
if idx == n - 1:
    print('YES')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
flag = True
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        flag= False
        break
if flag:
    print('YES')
### BUGGY CODE ###

x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors

for i in make_divisors(x):
    for a in range(i + 1):
        b = a - i
        if a ** 5 - b ** 5 == x:
            print(str(a) + ' ' + str(b))
            break


### FIXED CODE ###

x = int(input())
for a in range(-500, 500):
    for b in range(-500, 500):
        n = a ** 5 - b ** 5
        if n == x:
            print(a, end=" ")
            print(b)
            break
    else:
        continue
    break
### BUGGY CODE ###

# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

# lst_A = list(range(N))
lst_B = list(range(N))

ans = 0

# for i in range(N):
#    for j in range(N):
#        if B[j] > A[i]:
#            for k in range(N):
#                if C[k] > B[j]:
#                    ans += N - k
#                    break

j, k = 0, 0

for i in range(N):
    while j < N and C[j] <= B[i]:
        j += 1
    lst_B[i] = N - j

for i in range(N):
    while k < N and B[k] <= A[i]:
        k += 1
    if k == N:
        ans += 0
    else:
        for l in range(k, N):
            ans += lst_B[l]

print(ans)


### FIXED CODE ###

import bisect as bi

# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

count = 0

for b in B:
    i = bi.bisect_left(A, b) # A[0],...,A[i - 1] < b
    k = bi.bisect_right(C, b) # b < C[k],...C[N-1]
    count += i * (N - k)

print(count)
### BUGGY CODE ###

import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))

    lcm = a[0]

    for i in range(1, n):
        lcm = (a[i] * lcm) // fractions.gcd(a[i], lcm)

    ans = 0

    for ai in a:
        ans += lcm // ai
        ans %= 10 ** 9 + 7

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))
    sa = set(a)

    lcm = 1

    for ai in sa:
        lcm = (ai * lcm) // fractions.gcd(ai, lcm)

    ans = 0

    for ai in a:
        ans += lcm // ai
    ans %= 10 ** 9 + 7

    print(ans)


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

n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
  if min(p[:i+1]) == p[i]:
    cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
cnt = 0
p_min = n+1
for i in range(n):
  if p_min > p[i]:
    cnt += 1
    p_min = p[i]
print(cnt)
### BUGGY CODE ###

from collections import Counter

N = int(input())
X = input()
x = []
for i in range(N):
    x.append(X[i])

def f(n):
    cnt = 0
    while n != 0:
        n %= Counter(bin(n))['1']
        cnt += 1
    return cnt

for i in range(N):
    if x[i] == '1':
        tmp = '1'
        x[i] = '0'
    else:
        tmp = '0'
        x[i] = '1'
    n = ''.join(x)
    x[i] = tmp
    print(f(int(n, 2)))

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def pop_cnt(n):
    return bin(n).count('1')


def f(n):
    cnt = 0
    while n != 0:
        n = n % pop_cnt(n)
        cnt += 1
    return cnt
 
n = int(readline())
x2 = list(readline().decode().rstrip())
x10 = int(''.join(x2), 2)

c = x2.count('1')
mod1 = x10 % (c + 1)
mod2 = x10 % (c - 1) if c-1 != 0 else 0

for i in range(n):
    ans = 0
    if x2[i] == '0':
        t = (mod1 + pow(2, n-i-1, c+1)) % (c+1)
    else:
        if c-1 != 0:
            t = (mod2 - pow(2, n-i-1, c-1)) % (c-1)
        else:
            print(0)
            continue
    
    ans = f(t) + 1
    print(ans)
### BUGGY CODE ###

from collections import defaultdict


def prime_decomposition(n):
    table = defaultdict(int)

    i = 2
    while n % i == 0:
        n //= i
        table[i] += 1

    i = 3
    while i * i <= n:
        while n % i == 0:
            n //= i
            table[i] += 1
        i += 2

    if n > 1:
        table[n] += 1

    return table


def main():
    mod = 10 ** 9 + 7

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

    lcm_d = defaultdict(int)
    pds = []
    for x in a:
        pd = prime_decomposition(x)
        pds.append(pd)
        for prime, power in pd.items():
            lcm_d[prime] = max(lcm_d[prime], power)

    ret = 0
    for pd in pds:
        curr = 1
        for prime, power in lcm_d.items():
            for _ in range(power - pd[prime]):
                curr = (curr * prime) % mod
        ret = (ret + curr) % mod

    print(ret)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from functools import reduce

    def gcd(a, b):
        return a if b == 0 else gcd(b, a % b)

    def lcm(a, b):
        return a * b // gcd(a, b)

    mod = 10 ** 9 + 7

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

    L = reduce(lcm, a)

    ret = 0
    for x in a:
        ret = (ret + pow(x, mod - 2, mod)) % mod
    ret = ret * L % mod
    print(ret)


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

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

ans = []
for i in range(n - 1):
    if s[i] == "A" and s[i + 1] == "C":
        ans.append("ac")
    else:
        ans.append("no")

for i in lr:
    cnt = ans[i[0]-1:i[1]-1].count("ac")
    print(cnt)

### FIXED CODE ###

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

ans = [0] * n
for i in range(n - 1):
    if s[i] == "A" and s[i + 1] == "C":
        ans[i + 1] = ans[i] + 1
    else:
        ans[i + 1] = ans[i]

for i in lr:
    print(ans[i[1]-1]-ans[i[0]-1])
### BUGGY CODE ###


def calc(A, b):
    retval = 0
    for a in A:
        retval += abs(a - b)
    return retval


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] -= (i + 1)

    left = min(A)
    right = max(A)

    while left < right:
        c1 = (left + left + right) // 3       # floor
        c2 = -(-(left + right + right) // 3)  # ceil
        if calc(A, c1) <= calc(A, c2):
            right = c2 - 1
        else:
            left = c1 + 1
    print(calc(A, left))


if __name__ == "__main__":
    main()


### FIXED CODE ###


def calc(A, b):
    retval = 0
    for a in A:
        retval += abs(a - b)
    return retval


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] -= (i + 1)

    print(calc(A, sorted(A)[(N)//2]))

#    left = min(A)
#    right = max(A)
#
#    while left < right:
#        c1 = (left + left + right) // 3       # floor
#        c2 = -(-(left + right + right) // 3)  # ceil
#        if calc(A, c1) <= calc(A, c2):
#            right = c2 - 1
#        else:
#            left = c1 + 1
#    print(calc(A, left))


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

import bisect
n,m,q=map(int,input().split())
train=[[] for i in range(n)]
for i in range(m):
    l,r=map(int,input().split())
    train[l-1].append(r-1)
for i in range(n):
    train[i].sort()
for i in range(q):
    p,q=map(int,input().split())
    ans=0
    for i in range(p-1,q):
        ans+=bisect.bisect_right(train[i],q-1)
    print(ans)



### FIXED CODE ###

n,m,q=map(int,input().split())
train=[[0]*n for i in range(n)]
for i in range(m):
    l,r=map(int,input().split())
    train[l-1][r-1]+=1
for i in range(n):
    for j in range(n-1):
        train[i][j+1]+=train[i][j]
for i in range(q):
    p,q_=map(int,input().split())
    ans=0
    for j in range(p-1,q_):
        ans+=train[j][q_-1]
    print(ans)
### BUGGY CODE ###

def main():
    import sys
    sys.setrecursionlimit(10 ** 7)

    K, S = map(int, input().split())

    def dfs(cur, s=0):
        if cur == 3:
            return int(s == S)

        ret = 0
        for r in range(min(K, S - s) + 1):
            ret += dfs(cur + 1, s + r)
        return ret

    ans = dfs(0)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

k, s = map(int, input().split())
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if (0 <= z) and (z <= k):
            cnt += 1
print(cnt)
### BUGGY CODE ###

import numpy as np
n, k, q = map(int, input().split())
points = np.full(n, k)
for i in range(q):
    a = int(input())
    points = points - 1
    points[a - 1] += 1
for point in points:
    if point > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

import numpy as np
n, k, q = map(int, input().split())
points = np.full(n, k)
z = np.full(n, 0)
points = points - q
for i in range(q):
    a = int(input())
    z[a - 1] += 1
points = points + z
for point in points:
    if point > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(m):
    b,c=map(int,input().split())
    a+=[c]*b
    
a.sort(reverse=True)
print(sum(a[:n]))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
k=[[i,1] for i in a]

for i in range(m):
    b,c=map(int,input().split())
    k+=[[c,b]]
    


kli=sorted(k,reverse=True)
count=0
for i in kli:
    if n-i[1]>=0:
        count+=i[0]*i[1]
        n+=-i[1]
    else:
        count+=i[0]*n
        n=0
    if n==0:
        break


print(count)
### BUGGY CODE ###

import math,itertools
INFTY = 10**8
N,M,R = map(int,input().split())
R = list(map(int,input().split()))
G = {}
for _ in range(M):
    A,B,C = map(int,input().split())
    if A not in G:
        G[A] = []
    G[A].append((B,C))
    if B not in G:
        G[B] = []
    G[B].append((A,C))
D = [[INFTY for j in range(N+1)] for i in range(N+1)]
for i in range(1,N+1):
    if i in G:
        for x in G[i]:
            D[i][x[0]] = x[1]
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            D[i][j] = min(D[i][j],D[i][k]+D[k][j])
dmin = INFTY
for r in itertools.permutations(R,len(R)):
    d = 0
    for i in range(1,len(r)):
        d += D[r[i]][r[i-1]]
    dmin = min(dmin,d)
print(dmin)

### FIXED CODE ###

from itertools import permutations
INFTY = 10**8
N,M,R = map(int,input().split())
A = list(map(int,input().split()))
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b,c = map(int,input().split())
    G[a].append((b,c))
    G[b].append((a,c))
d = {i:[INFTY for _ in range(N+1)] for i in range(N+1)}
for i in G:
    d[i][i] = 0
    for x in G[i]:
        d[i][x[0]] = x[1] 
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])
dmin = INFTY
for x in permutations(range(R),R):
    cnt = 0
    for i in range(R-1):
        cnt += d[A[x[i]]][A[x[i+1]]]
    dmin = min(dmin,cnt)
print(dmin)
### BUGGY CODE ###

k,s = map(int,input().split())

ans = 0
b = []
for i in range(k+1):
    for j in range(k+1):
        if i + j <= s:
            b.append(i+j)

for i in b:
    for j in range(k+1):
        if i + j == s:
            ans += 1
            break
print(ans)

### FIXED CODE ###

k,s = map(int,input().split())

ans = 0
for i in range(k+1):
    for j in range(k+1):
        l = s - i - j
        if l <= k and l >= 0:
            ans += 1

print(ans)
### BUGGY CODE ###

S = list(input())
N = len(S)


l = [0] * 2019
index = 0
temp = 0
for i in range(N-1, -1, -1):
    temp += int(S[i]) * 10**index
    l[temp%2019] += 1
    index += 1

ans = l[0]

for i in range(1, 2019):
    ans += l[i] * (l[i]-1) // 2

print(ans)

### FIXED CODE ###

S = list(input())
N = len(S)

l = [0] * 2019
temp = 0
e = 1
for i in range(N-1, -1, -1):
    temp += int(S[i]) * e
    temp %= 2019
    l[temp] += 1
    e *= 10
    e %= 2019

ans = l[0]

for i in range(0, 2019):
    ans += l[i] * (l[i]-1) // 2

print(ans)
### BUGGY CODE ###

N = int(input())

def make_divisors(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1
    return divisors

ans = 0
for i in range(1,N+1):
    ans +=  i*make_divisors(i)

print(ans)

### FIXED CODE ###

def solve(n):
    ans=0
    for d in range(1,n+1):
        c=n//d
        ans+=(c+1)*c//2*d
    return ans
 
n=int(input())
print(solve(n))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import re
# 入力された文字列
string = input()

raw_length = len(string)

# 削除があった場合True
del_flg = True

# 削除文字がなくなるまでループする
while del_flg and len(string) != 0:
    del_flg = False
    before_length = len(string)
    string = re.sub('01|10', '', string)
    after_length = len(string)
    
    if before_length != after_length:
        del_flg = True

print((raw_length - len(string)))

### FIXED CODE ###

# -*- coding: utf-8 -*-

string = input()

red_count  = string.count('0')
blue_count = string.count('1')

print(min(red_count, blue_count) * 2)