Harryxun/stf_run huggingface dataset:
import math

n, m = map(int, input().split())
s = input()
t = input()

cnt = 1
ns = 1
nt = 1
ss = 0
tt = 0
fail = False

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

ll = lcm(n,m)
l = ll

while l <= n * m:
    fail = False
    while not( ns >= l or nt >= l):
        while not(ns <= nt):
            nt += l / m 
            tt += 1

        if(ns == nt) and (s[ss] != t[tt]):
            fail = True
            break

        ns += l / n
        ss += 1
    if not(fail): 
        break
    cnt += 1
    l = ll * cnt

if(fail):
    print(-1)
else:
    print(l)

### FIXED CODE ###


n, m = map(int, input().split())
s = input()
t = input()

cnt = 1
ns = 1
nt = 1
ss = 0
tt = 0
fail = False


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


ll = (n * m) // gcd(n, m)
l = ll

while l <= n * m:
    fail = False
    while not(ns > l or nt > l):
        while not(ns <= nt):
            nt += l / m
            tt += 1

        if(ns == nt) and (s[ss] != t[tt]):
            fail = True
            break

        ns += l / n
        ss += 1
    if not(fail):
        break
    cnt += 1
    l = ll * cnt

if(fail):
    print(-1)
else:
    print(l)
n = int(input())
if n in "9":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
print("Yes" if "9" in n else "No")
data = [int(i) for i in input().split()]

data.sort()
print("{0} {1} {2}".format(data[0],data[2]))

### FIXED CODE ###

data = [int(i) for i in input().split()]
 
data.sort()
print("{0} {1} {2}".format(data[0], data[1], data[2]))
a = list(map(int, input().split()))
ds = [abs(e - max(a)) for e in a if e-max(a) != 0]

if ds:
    base = min(ds) - 1
    rem = max(ds) - base
    if rem == 1:
        print(base + 1)
    elif rem % 2 == 0:
        res = base + (rem - 2) // 2 + 3
    elif rem % 2 != 0:
        res = base + (rem - 1) // 2 + 1
else:
    res = 0

print(res)

### FIXED CODE ###

a = list(map(int, input().split()))
ds = [abs(e - max(a)) for e in a if e-max(a) != 0]

if len(ds) == 1:
    if ds[0] % 2 == 0:
        res = ds[0] // 2
    else:
        res = (ds[0]-1) // 2 + 2
elif len(ds) > 1:
    base = min(ds) - 1
    rem = max(ds) - base
    if rem == 1:
        res = base + 1
    elif rem % 2 == 0:
        res = base + (rem - 2) // 2 + 3
    elif rem % 2 != 0:
        res = base + (rem - 1) // 2 + 1
else:
    res = 0

print(res)
# 190928 D
from fractions import gcd
import sympy as sym

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table

A,B = list(map(int,input().split()))
koyaku = gcd(A,B)
solist = [i for i in sym.primerange(1, koyaku)]
kotable = sym.divisors(koyaku)
output = []
for i in range(len(kotable)):
    if kotable[i] in solist:
        output.append(kotable[i])

print(len(output)+1)


### FIXED CODE ###

# 190928 D

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = list(map(int,input().split()))
soA = prime_factorize(A)
soB = prime_factorize(B)
output = []
for i in range(len(soA)):
    if soA[i] in soB:
        output.append(soA[i])

print(len(list(set(output))) + 1)
MOD = (10 ** 9) + 7

f_list = [1] * 100000
f_r_list = [1] * 100000

for i in range(99999):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % MOD), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % MOD)

f_r_list[-1] = power(f_list[-1], MOD - 2)

for i in range(2, 100001):
	f_r_list[-i] = int((f_r_list[-i + 1] * (100002 - i)) % MOD)

def comb(n, r):
	if n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

n = int(input())
a = list(map(int, input().split()))
a_r = list(reversed(a))


doubled = sum(a) - n * (n + 1) / 2
x = a.index(doubled)
y = a_r.index(doubled)
num = x + y

print(n)

for i in range(2, n + 2):
	if num >= i - 1:
		print(comb(n + 1, i) - comb(num, i - 1))
	else:
		print(comb(n + 1, i))

### FIXED CODE ###

MOD = (10 ** 9) + 7

f_list = [1] * 100001
f_r_list = [1] * 100001

for i in range(100000):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % MOD), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % MOD)

f_r_list[-1] = power(f_list[-1], MOD - 2)

for i in range(2, 100002):
	f_r_list[-i] = int((f_r_list[-i + 1] * (100003 - i)) % MOD)

def comb(n, r):
	if n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

n = int(input())
a = list(map(int, input().split()))
a_r = list(reversed(a))


doubled = sum(a) - n * (n + 1) / 2
x = a.index(doubled)
y = a_r.index(doubled)
num = x + y

print(n)

for i in range(2, n + 2):
	if num >= i - 1:
		print(int((comb(n + 1, i) - comb(num, i - 1)) % MOD))
	else:
		print(comb(n + 1, i))
# coding: utf-8
# Your code here!
def pin(type=int):
    return map(type,input().split())


N, =pin()
m = list(pin())

import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(m))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions
from functools import reduce
def pin(type=int):
    return map(type,input().split())


N, =pin()
m = list(pin())




def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

print(gcd_list(m))
n,m = map(int,input().split()) #nがカードの数、mがBの数
a = list(map(int, input().split()))
b = [list(map(int,input().split())) for i in range(m)]

print(a,b)
'''for i in range(m):
  a.extend([b[i][1]]*b[i][0])
a.sort(reverse=True)
ans = 0
for i in range(n):
  ans += a[i]
print(ans)'''

### FIXED CODE ###

a, b = map(int,input().split())
if a > 12:
  print(b)
elif a < 13 and a > 5:
  print(int(b/2))
else:
  print(0)
n,k=map(int,input().split())
lists=list(map(int,input().split()))
a=format(k,"b")
length=max(len(a),len(format(max(lists),"b")))
uselists=[0]*length
for some in lists:
    check=format(some,"0%ib"%length)
    for i in range(length):
        if check[i]=="1":
            uselists[length-1-i]+=1         
if k>=1:
  	order=0
    for i in range(length):
        if  2**i<=k<2**(i+1):
            order=i
            break            
    ans1=0
    ans2=0
    for j in range(order):
        ans1+=(2**j)*max(uselists[j],n-uselists[j])
        
    for j in range(order+1,length):
        ans2+=(2**j)*uselists[j]
    ans2+=(2**order)*(n-uselists[order])
    bigger=0
    newlist=[0]*(k-2**order+1)
    for g in range(0,k-2**order+1):
        some=format(g,"0%ib"%order)
        newlist[g]=some
    for some in newlist:
        checker=0
        for i in range(order):
            if some[i]=="1":
                checker+=(2**(order-1-i))*(n-uselists[i])
            else:
                checker+=(2**(order-1-i))*uselists[i]
        bigger=max(bigger,checker)  
    ans2=ans2+bigger
    print(max(ans1,ans2))
    
elif k==0:
    ans=0
    for i in range(length):
        if uselists[i]=="1":
            ans+=(2**i)*(n-uselists[i])
        else:
            ans+=(2**i)*uselists[i]     
    print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
k2=format(k+1,"0%ib"%40)
lists=list(map(int,input().split()))
countlist=[0]*40
for j in lists:
    c=format(j,"0%ib"%40)
    for i in range(40):
        if c[i]=="1":
            countlist[i]+=1

emptylist=[]
for i in range(40):
    if k2[i]=="1":
        emptylist.append(i)
if k>=1:
    ans=0
    for i in emptylist:
        subing=0
        for j in range(40):
            if j<i:
                if k2[j]=="1":
                    subing+=(2**(39-j))*(n-countlist[j])
                elif k2[j]=="0":
                    subing+=(2**(39-j))*countlist[j]
            if j==i:
                subing+=(2**(39-i))*countlist[i]
            
            if j>i:
                subing+=(2**(39-j))*max(countlist[j],n-countlist[j])
        ans=max(ans,subing)
    print(ans)
elif k==0:
    ans=0
    for i in range(40):
        ans+=(2**(39-i))*countlist[i]
    print(ans)
N = int(input())
 
ans = [0 for _ in range(10050)]
for x in range(1,int(N**0.5)):
  for y in range(1,int(N**0.5)):
    for z in range(1,int(N**0.5)):
      n = x**2 + y**2 + z**2 + x*y + y*z + z*x;
      ans[n] += 1

for i in range(N):
  print(ans[i+1])

### FIXED CODE ###

n = int(input())
a = [0]*(n+1)
for i in range(1, 102):
    for j in range(1, 102):
        for k in range(1, 102):
            if (i*i + j*j + k*k + i*j + j*k + i*k) <= n:
                a[i*i + j*j + k*k + i*j + j*k + i*k] +=1
                
for x in a[1:]:
    print(x)
A,B=map(int,input().split())
import fraction
print(int((A*B)/fraction.gcd(A,B)))

### FIXED CODE ###

A,B=map(int,input().split())
import fractions
print(int((A*B)/fractions.gcd(A,B)))
a=input()
print(["No","Yes"][a[0]==a[1]==a[2]or[a[3]==a[1]==a[2]])

### FIXED CODE ###

a=input()
print(["No","Yes"][a[0]==a[1]==a[2] or a[3]==a[1]==a[2]])
import sys
read = sys.stdin.buffer.read

K, N, *A = map(int, read.split())

max_distance = K + (A[0] - A[-1])
 
for i in range(1, N):
  max_distance = max(max_distance, A[i] - A[i - 1])
  
print(K - max_distance)

### FIXED CODE ###

K, N = map(int, input().split())
A = list(map(int, input().split()))
 
max_distance = K + (A[0] - A[-1])
 
for i in range(1, N):
  max_distance = max(max_distance, A[i] - A[i - 1])
  
print(K - max_distance)
print((lambda x:(int(x[1])+(100*(10 - (10 if x[0]>=10 else x[0])))))(input().split()))

### FIXED CODE ###

print((lambda x:(int(x[1])+(100*(10 - (10 if int(x[0])>=10 else int(x[0]))))))(input().split()))
a,b,c = (int(i) for i in input().split())
print(a+b+c)

### FIXED CODE ###

a = list(input())
for i in range(3):
    a[i] = int(a[i])
print(a[0]+a[1]+a[2])
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
L = l[0,n-K+1]
L_sum = sum(L)
print(L_sum)

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
if len(l) > k:
    print(sum(l[:n-k]))
else:
    print(0)
a, b, c = map(int, input().split())

if a+b >= c
    print("Yes")
else:
    print("No")

### FIXED CODE ###

c1 = input()
c2 = input()
c3 = input()

print(c1[0]+c2[1]+c3[2])
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
N = int(input())
n = N
divs = []
a = 1
b = N


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


Ps = primes(10 ** 6)
Ps.reverse()

for P in Ps:
    x, y = divmod(n, P)
    while y == 0:
        n = x
        divs.append(P)
        x, y = divmod(n, P)
if divs == [] or len(divs) == 1:
    print(N - 1)
    exit()
else:
    length = len(divs)
    for i in range(2 ** length):
        a1 = 1
        s = format(i, '020b')
        for j in range(length):
            #print("s[-j-1]:" + s[-j - 1])
            #print("divs[j]:" + str(divs[j]))
            if s[-j - 1] == '1':
                a1 = a1 * divs[j]
                #print("divs[j]" + str(divs[j]))
                #print("a1:" + str(a1))
        b1 = N // a1
        #print("a1:" + str(a1))
        if a1 + b1 < a + b:
            a = a1
            b = b1
# print(divs)
#print("str:" + s)
print(a+b-2)


### FIXED CODE ###

N = int(input())
ans = N-1
for i in range(int(N ** 0.5), 1, -1):
    x, y = divmod(N, i)
    if y == 0:
        print(i+x-2)
        exit()
print(ans)
import numpy as np

R = int(input())

print(2 * R *np.pi)

### FIXED CODE ###

import numpy as np

R = int(input())

print(2 * R *np.pi)
L, R = map(int, input().split())
from itertools import combinations
 
mod = 2019
mini = mod - 1
for i, j in combinations(range(L, R+1), 2):
    x, y = i%mod, j%mod
    mini = min(mini, x*y % mod)
    if mini == 0:
        break
print(mini)

### FIXED CODE ###

L, R = map(int, input().split())
from itertools import combinations

mod = 2019

if R - L >= mod:
    print(0)
else:
    mini = mod - 1
    for i, j in combinations(range(L, R+1), 2):
        mini = min(mini, i*j % mod)
        if mini == 0:
            break
    print(mini)
n=int(input())
s=list(input())
dic={"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}
di={1:"A",2:"B",3:"C",4:"D",5:"E",6:"F",7:"G",8:"H",9:"I",10:"J",11:"K",12:"L",13:"M",14:"N",15:"O",16:"P",17:"Q",18:"R",19:"S",20:"T",21:"U",22:"V",23:"W",24:"X",25:"Y",26:"Z"}
li=[]
t=len(s)
for i in range(0,t):
  k=s[i]
  m=dic[k]
  a=(m+n)%26
  b=di[a]
  li.append(b)
print("".join(li))

### FIXED CODE ###

n=int(input())
s=list(input())
dic={"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,"X":23,"Y":24,"Z":25}
di={1:"A",2:"B",3:"C",4:"D",5:"E",6:"F",7:"G",8:"H",9:"I",10:"J",11:"K",12:"L",13:"M",14:"N",15:"O",16:"P",17:"Q",18:"R",19:"S",20:"T",21:"U",22:"V",23:"W",24:"X",25:"Y",26:"Z"}
li=[]
t=len(s)
for i in range(0,t):
  k=s[i]
  m=dic[k]
  a=(m+n)%26+1
  b=di[a]
  li.append(b)
print("".join(li))
a = int(input("a: "))
b = int(input("b: "))

AB = a*b
if AB%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

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

if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
N = int(input())
L = [list(map(str, input().split())) for i in range(N)]

from collections import Counter
def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s.replace(' ', ''))
    if get_counter(first_word) == get_counter(second_word):
        return True
    else:
        return False

cnt=0
for i in range(N):
    for k in range(N):
        if k+1>len(L):
            continue
        if verify_anagrams(L[i],L[k+1]):
            cnt+=1

print(num)


### FIXED CODE ###

N=int(input())
A=[]
D={}
cnt=0
for i in range(N):
    A.append(str(sorted(input())))

for sortstr in A:
    if sortstr in D:
        cnt+=D[sortstr]
        D[sortstr]+=1
    else:
        D[sortstr]=1
print(cnt)
n = int(input())
        a = list(map(int, input().split()))
        from collections import Counter
        x=Counter(a)
        for i in range(1,n+1):
          print(x[i])

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
from collections import Counter
x=Counter(a)
for i in range(1,n+1):
  print(x[i])
import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial
import collections

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    #mng = [][]
    sl = []
    for _ in range(N):
        sl.append(str(sorted(sys.stdin.readline().rstrip())))

    c = collections.Counter(sl)
    ans = 0
    for n in c.values():
        r = 2
        if n > 1:
            ans += factorial(n) / factorial(r) / factorial(n - r)

    print(int(ans))


### FIXED CODE ###

import math
import sys
import itertools
import queue
from fractions import gcd

import sys
sys.setrecursionlimit(10000)

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

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial
import collections

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    #mng = [][]
    sl = []
    for _ in range(N):
        tmp = sorted(sys.stdin.readline().rstrip())
        #print(''.join(tmp))
        sl.append(''.join(tmp))
    #print(sl)
    c = collections.Counter(sl)
    ans = 0
    for n in c.values():
        r = 2
        if n > 1:
            ans += factorial(n) // (factorial(n - r) * factorial(r))

    print(int(ans))
x, k, d = map(int, input().split())
x = abs(x)
if x > k*d:
    print(x-k*d)
else:
    p = x//d
    if p == 1:
          for i in range(1,k+1):
            p2 = x-i*d
            c = k-i
            if p2 <= 0:
                if c%2 != 0:
                    print(abs(d+p2))
                    break
                elif c%2 == 0:
                    print(abs(p2))
                    break
    elif k%p == 0:
        print(abs(x-p*d))
    else:
        print(abs(d*(p+1)-x))

### FIXED CODE ###

x, k, d = map(int, input().split())
x = abs(x)
if x > k*d:
    print(x-k*d)
else:
    p = x//d
    c = k-p
    if p == 0 or p==1:
          for i in range(1,k+1):
            p2 = x-i*d
            c = k-i
            if p2 <= 0:
                if c%2 != 0:
                    print(abs(d+p2))
                    break
                elif c%2 == 0:
                    print(abs(p2))
                    break
    elif (c%2 == 0):
        print(abs(x-p*d))
    else:
        print(abs(d-abs(x-p*d)))
pen = list(map(str,input().split()))

print(collections.Counter(pen))

### FIXED CODE ###

import collections

pen = list(map(str,input().split()))

print(len(collections.Counter(pen)))
import bisect

x, y, a, b, c = map(int, input().split())
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
r = [int(_) for _ in input().split()]

p.sort()
q.sort()
r.sort()

x_list = p[-x:]
y_list = q[-y:]

while (min(x_list[0], y_list[0]) < r[-1]):
    if x_list[0] > y_list[0]:
        i = bisect.bisect_left(r, y_list[0])
        y_list.pop(0)
        target = r.pop(i)
        bisect.insort(y_list, target)
    else:
        i = bisect.bisect_left(r, x_list[-1])
        x_list.pop(0)
        target = r.pop(i)
        bisect.insort(x_list, target)

    if len(r) == 0:
        break

print(sum(x_list) + sum(y_list))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
r = [int(_) for _ in input().split()]
 
p.sort()
q.sort()
r.sort()
 
x_list = p[-x:]
y_list = q[-y:]
all_apple = x_list + y_list + r
all_apple.sort()
 
print(sum(all_apple[-(x+y):]))
import collections

N = int(input())
a = list(map(int,input().split()))
b = collections.Counter(a)
dp = [0] * (max(a)+1)
dp[0] = b[0] + b[1]
dp[1] = dp[0] + b[2]
for i in range(2, max(a)+1):
    dp[i] = dp[i-1] + b[i+1] - b[i-2]
print(max(dp))


### FIXED CODE ###

import collections

N = int(input())
a = list(map(int,input().split()))
b = collections.Counter(a)
dp = [0] * (max(a)+1)
if len(b) == 1 and a[0] == 0:
    print(N)
    exit()
dp[0] = b[0] + b[1]
dp[1] = dp[0] + b[2]

for i in range(2, max(a)+1):
    dp[i] = dp[i-1] + b[i+1] - b[i-2]
print(max(dp))
N = int(input())
A = sorted(map(int, input().split())) 

A_even = [i for i in A if i % 2 == 0]

A_even_35 = [i for i in A_even if i % 3 != 0and i%5!=0]
if len(A_even_35)==0:
  print("APPROVED")
else:
  print("DENIED")

### FIXED CODE ###

A,B,C= map(int, input().split()) 

if A==B and B==C:
  print("No")
elif A!=B and B!=C and A!=C:
  print("No")
else:
  print("Yes")
n = int(input())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	

if (sumA <= sumB) and (diffNum <= sumB - sumA) and ((sumB - sumA) % diffNum) % 2 == 0:
	print("Yes")
else:
	print("No")

# 14 20

### FIXED CODE ###

n = int(input())
numbersA = input().split()
numbersB = input().split()
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += diff[i]
	else:
		plusTotal += diff[i] // 2



if plusTotal >= abs(minousTotal):
	print("Yes")
else:
	print("No")
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x+1, 1, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)

### FIXED CODE ###

N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)
N, Q = map(int,input().split())

# 添字を1からにしたいのでN+1
graph = [[] for _ in range(N+1)]
counter = [0] * (N+1)

# 各頂点に隣接する頂点
for _ in range(N-1):
  a,b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)


# 各頂点に点数を足す
for _ in range(Q):
  p,x = map(int, input().split())
  counter[p] += x

def shori(pa,c,val):
  val += counter[c]
  counter[c] = val
  for i in graph[c]:
    if i == pa:
      continue
    shori(c,i,val)
  
shori(0,1,0)
  

print(" ".join(map(str, counter[1:])))



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

# AB = [[int(x) for x in input().split()] for _ in range(N-1)]

# print(AB)

# 添字を1からにしたいのでN+1
graph = [[] for _ in range(N+1)]

# 各頂点に隣接する頂点
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

# print(graph)
counter = [0] * (N+1)

# print(counter)

# PX = [[int(x) for x in input().split()] for _ in range(Q)]

# 各頂点に点数を足す
for _ in range(Q):
  p, x = map(int, input().split())
  counter[p] += x


def shori(pa,c,val):
  val += counter[c]
  counter[c] = val
  for i in graph[c]:
    if i == pa:
      continue
    shori(c,i,val)
  
shori(0,1,0)
  

print(" ".join(map(str, counter[1:])))
import numpy as np
n,m=[int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [0] * (2 * 10 ** 5 + 1)
for i in a:
    b[i] += 1
b = np.fft.fft(b)
b = np.fft.ifft(b*b)

c = 0
f = 0
for i in reversed(range(2 * 10 ** 5 + 1)):
    if f + b[i] > m:
        c += (m - f) * i
        break
    else:
        c += i * b[i]
        f += b[i]
print(int(round(c.real)))

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
b = [0]
for i in reversed(a):
    b.append(b[-1] + i)


def search(i):
    if a[-1] < i:
        return 0
    mi = 0
    ma = n - 1
    while mi != ma:
        m = (mi + ma) // 2
        if a[m] >= i:
            ma = m
        else:
            mi = m + 1
    return n-mi

def countmax(i):
    ans = 0
    for j in a:
        ans += search(i - j)
    return ans

mi = 0
ma = a[-1] * 2
while mi != ma:
    md = (mi + ma) // 2 + 1
    #print(md, countmax(md))
    if countmax(md) > m:
        mi = md
    else:
        ma = md - 1

ans = 0
for j in a:
    i = search(mi + 1 - j)
    ans+=b[i]+i*j
ans += (m-countmax(mi+1))*mi
print(ans)