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

import numpy as np

n=int(input())
X=[]
Y=[]
P=np.ndarray((0,2))
for i in range(n):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(Y)
    P=np.vstack((P,[x+y,x-y]))
    
ans = max(max(P[:,0])-min(P[:,0]),max(P[:,1])-min(P[:,1]))

print(int(ans+0.5))

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
#P=np.ndarray((0,2))
for i in range(n):
    x,y = map(int,input().split())
    X.append(x+y)
    Y.append(x-y)

    
ans = max(max(X)-min(X),max(Y)-min(Y))

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

n, k = map(int, input().strip().split())
h = list(map(int, input().strip().split()))

dp=[10**9]*n

dp[0]=0
for i in range(n):
    for j in range(1,k+1):
        if i+j>n-1:
            break
        dp[i+j]=min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
print(dp[-1])

### FIXED CODE ###

n, k = map(int, input().strip().split())
h = list(map(int, input().strip().split()))

dp=[10**9]*n

dp[0]=0
for i in range(n):
    # for j in range(1,k+1):
    #     if i+j>n-1:
    #         break
    for j in range(1,min(k+1,n-i)):
        dp[i+j]=min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
print(dp[-1])
### BUGGY CODE ###

import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    d = dict()
    for i in range(1, n + 1):
        d[i] = input_int_list()[::-1]
    day = 0
    matches = 0
    while True:
        played = set()
        for a, v in d.items():
            if d[a]:
                b = d[a][-1]
                if d[b] and a == d[b][-1] and a not in played and b not in played:
                    d[a].pop()
                    d[b].pop()
                    played.add(a)
                    played.add(b)
                    matches += 1
        if not played:
            break
        day += 1

    if matches == (n * (n - 1)) // 2:
        print(day)
    else:
        print(-1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    d = dict()
    for i in range(1, n + 1):
        d[i] = input_int_list()[::-1]
    day = 0
    candi = set(range(1, n + 1))
    rest = (n * (n - 1)) // 2
    while rest:
        played = set()
        for a in candi:
            if d[a] and d[d[a][-1]][-1] and a == d[d[a][-1]][-1]:
                played.add(a)
                played.add(d[a][-1])

        if not played:
            break

        candi.clear()

        rest -= len(played) // 2
        for a in played:
            candi.add(a)
            d[a].pop()
            if d[a]:
                candi.add(d[a][-1])
        day += 1

    if rest == 0:
        print(day)
    else:
        print(-1)


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

lu = [2, 1]

def l(x):
  if len(lu) > x:
    return lu[x]
  else:
    return l(x-1) + l(x-2)
  
print(l(int(input())))

### FIXED CODE ###

lu = [2, 1]
x = int(input())
for i in range(2, x+1):
    lu.append(lu[i-1] + lu[i - 2])  
print(lu[x])
### BUGGY CODE ###

from collections import deque
q = deque([])

def bfs(i):
    t = []
    q.append(i)
    c = [0] * n
    u = q.popleft()
    if G[u] != 0:
        for j in G[u]:
            if not c[j] != 0:
                q.append(j)
    c[u] = 1
    while len(q) != 0:
        u = q.popleft()
        c[u] = 1   
        if G[u] != 0:
            for j in G[u]:
                if c[j] == 0 and not i in G[j] and not j in t:
                    q.append(j)
                    t.append(j)
                elif c[j] == 0 and not j in t:    
                    q.append(j)   
    s = 0
    if not H[i] == 0:
        for j in t:
            if j in H[i]:
                s += 1                    
    return len(t) - s   

n, m, k = map(int, input().split())
G = [0] * n
H = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    if G[a - 1] == 0:
        G[a - 1] = [b - 1]
    else:
        G[a - 1].append(b - 1)
    if G[b - 1] == 0:
        G[b - 1] = [a - 1]
    else:
        G[b - 1].append(a - 1)
for _ in range(k):
    a, b = map(int, input().split())
    if H[a - 1] == 0:
        H[a - 1] = [b - 1]
    else:
        H[a - 1].append(b - 1)
    if H[b - 1] == 0:
        H[b - 1] = [a - 1]
    else:
        H[b - 1].append(a - 1)
for i in range(n - 1):
    print(bfs(i), end = " ")
print(bfs(n - 1))

### FIXED CODE ###

def get_root(s):
    if s != root[s]:
        root[s] = get_root(root[s])
        return root[s]
    return s

def unite(s, t):
    root_s = get_root(s)
    root_t = get_root(t)
    if not root_s == root_t:
        if rank[s] == rank[t]:
            root[root_t] = root_s
            rank[root_s] += 1
            union_count[root_s] += union_count[root_t]
        elif rank[s] > rank[t]:
            root[root_t] = root_s
            union_count[root_s] += union_count[root_t]
        else:
            root[root_s] = root_t
            union_count[root_t] += union_count[root_s]

def same(s, t):
    if get_root(s) == get_root(t):
        return True
    else:
        return False

n, m, k = map(int, input().split())
root = [i for i in range(n)]
rank = [1 for _ in range(n)]
union_count = [1 for _ in range(n)]
friend_count = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)
    friend_count[a - 1] += 1
    friend_count[b - 1] += 1
ans = [-1] * n
for _ in range(k):
    c, d = map(int, input().split())
    if same(c - 1, d - 1):
        ans[c - 1] -= 1
        ans[d - 1] -= 1
for i in range(n):
    r = get_root(i)
    ans[i] += union_count[r] - friend_count[i]
print(" ".join(map(str, ans)))
### BUGGY CODE ###

# AtCoder Regular Contest 065
# D - 連結 / Connectivity
# https://atcoder.jp/contests/arc065/tasks/arc065_b
import sys
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, *KL = map(int, input().split())
    uf = [UnionFind(N) for _ in range(2)]
    for i in range(2):
        for j in range(KL[i]):
            p, q = map(int, input().split())
            uf[i].union(p-1, q-1)

    d = defaultdict(int)
    for i in range(N):
        d[(uf[0].find(i), uf[1].find(i))] += 1

    for i in range(N):
        print(d[(uf[0].find(i), uf[1].find(i))], end = " ")
    print("")

if __name__ == "__main__":
    sys.setrecursionlimit(10**6)
    main()


### FIXED CODE ###

# AtCoder Regular Contest 065
# D - 連結 / Connectivity
# https://atcoder.jp/contests/arc065/tasks/arc065_b
import sys
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, *KL = map(int, input().split())
    uf = [UnionFind(N) for _ in range(2)]
    for i in range(2):
        for j in range(KL[i]):
            p, q = map(int, input().split())
            uf[i].union(p-1, q-1)

    d = defaultdict(int)
    for i in range(N):
        d[(uf[0].find(i), uf[1].find(i))] += 1

    for i in range(N):
        print(d[(uf[0].find(i), uf[1].find(i))], end = " ")
    print("")

if __name__ == "__main__":
    sys.setrecursionlimit(10**6)
    main()
### BUGGY CODE ###

from collections import defaultdict

N = int(input())
A = [int(input()) for _ in range(N)]
S = sum(A)

DP = [defaultdict(int)]
DP[0][0] = 2
DP[0][A[0]] = 1
DP2 = [defaultdict(int)]  # R=G=S/2, B=0
DP2[0][0] = 1
DP2[0][A[0]] = 1
for i in range(1, N):
    curr = defaultdict(int)
    curr2 = defaultdict(int)
    for (key, val) in DP[-1].items():
        curr[key] += val*2  # B,G
        curr[key+A[i]] += val  # R
    for (key, val) in DP2[-1].items():
        curr2[key] += val  # G
        curr2[key+A[i]] += val  # R
    DP.append(curr)
    DP2.append(curr2)
# print(DP)
# print(DP2)

ans = 3**N
for (key, val) in DP[-1].items():
    if key >= S/2:
        ans -= 3*val

if S % 2 == 0:
    ans += 3*DP2[-1][S//2]

print(ans % 998244353)


### FIXED CODE ###

from collections import defaultdict

N = int(input())
A = [int(input()) for _ in range(N)]
S = sum(A)

DP = [[0]*(S+1) for _ in range(2)]
DP[0][0] = 2
DP[0][A[0]] = 1

# R=G=S/2, B=0
DP2 = [[0]*(S+1) for _ in range(2)]
DP2[0][0] = 1
DP2[0][A[0]] = 1


max_A = A[0]
for i in range(1, N):
    a = A[i]
    max_A += a
    curr_dp = DP[i % 2]
    prev_dp = DP[(i+1) % 2]
    curr_dp2 = DP2[i % 2]
    prev_dp2 = DP2[(i+1) % 2]
    for r in range(max_A+1):
        if r >= a:
            curr_dp[r] = prev_dp[r]*2 + prev_dp[r-a]
            curr_dp2[r] = prev_dp2[r] + prev_dp2[r-a]
        else:
            curr_dp[r] = prev_dp[r]*2
            curr_dp2[r] = prev_dp2[r]
        curr_dp[r] %= 998244353
        curr_dp2[r] %= 998244353
# print(DP)
# print(DP2)

half_S = (S+1)//2
ans = pow(3, N, 998244353)
ans -= 3*sum(DP[(N-1) % 2][half_S:])
if S % 2 == 0:
    ans += 3*DP2[(N-1) % 2][S//2]

print(ans % 998244353)
### BUGGY CODE ###

h,w = map(int,input().split())
s = []
for i in range(h):
    s1 = list(input())
    s.append(s1)
p = []
q = []
r = []
t = []
l = []
for i in range(h):
    count1 = 0
    count2 = 0
    p1 = []
    q1 = []
    for j in range(w):
        if s[i][j] == ".":
            count1 = count1 + 1
            p1.append(count1)
        elif s[i][j] == "#":
            count1 = 0
            p1.append(count1)
        if s[i][w-j-1] == ".":
            count2 = count2 + 1
            q1.append(count2)
        elif s[i][w-j-1] == "#":
            count2 = 0
            q1.append(count2)
    p.append(p1)
    q.append(q1)
for i in range(w):
    count1 = 0
    count2 = 0
    r1 = []
    t1 = []
    for j in range(h):
        if s[j][i] == ".":
            count1 = count1 + 1
            r1.append(count1)
        elif s[j][i] == "#":
            count1 = 0
            r1.append(count1)
        if s[h-j-1][i] == ".":
            count2 = count2 + 1
            t1.append(count2)
        elif s[h-j-1][i] == "#":
            count2 = 0
            t1.append(count2)
    r.append(r1)
    t.append(t1)
for i in range(h):
    for j in range(w):
        l.append(p[i][j]+q[i][w-j-1]+r[j][i]+t[j][h-i-1])
print(max(l)-3)

### FIXED CODE ###

h,w = map(int,input().split())
s = []
for i in range(h):
    s1 = list(input())
    s.append(s1)
p = []
q = []
r = []
t = []
l = 0
for i in range(h):
    count1 = 0
    count2 = 0
    p1 = []
    q1 = []
    for j in range(w):
        if s[i][j] == ".":
            count1 = count1 + 1
            p1.append(count1)
        elif s[i][j] == "#":
            count1 = 0
            p1.append(count1)
        if s[i][w-j-1] == ".":
            count2 = count2 + 1
            q1.append(count2)
        elif s[i][w-j-1] == "#":
            count2 = 0
            q1.append(count2)
    p.append(p1)
    q.append(q1)
for i in range(w):
    count1 = 0
    count2 = 0
    r1 = []
    t1 = []
    for j in range(h):
        if s[j][i] == ".":
            count1 = count1 + 1
            r1.append(count1)
        elif s[j][i] == "#":
            count1 = 0
            r1.append(count1)
        if s[h-j-1][i] == ".":
            count2 = count2 + 1
            t1.append(count2)
        elif s[h-j-1][i] == "#":
            count2 = 0
            t1.append(count2)
    r.append(r1)
    t.append(t1)
for i in range(h):
    for j in range(w):
        l1 = p[i][j]+q[i][w-j-1]+r[j][i]+t[j][h-i-1]
        if l < l1:
            l = l1
print(l-3)
### BUGGY CODE ###

N, K, Q, *A = map(int, open(0).read().split())
ans = ("Yes" if Q < K + A.count(a)
       else "No" for a in range(1, N + 1))
print("\n".join(ans))


### FIXED CODE ###

from sys import stdin
from collections import Counter

lines = stdin.readlines()

N, K, Q = map(int, lines[0].split())
ans = [0] * N
A = Counter((int(i) - 1 for i in lines[1:]))
for k in A.keys():
    ans[k] += A[k]
print("\n".join(("Yes" if Q < K + a
                 else "No" for a in ans)))
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[0]*(n+2)
num=10**9+7
dp[0]=1
for i in range(n):
    if i in a:
        dp[i]=0
    else:
        dp[i]=dp[i]%num
        if i<n:
            dp[i+1]+=dp[i]
            dp[i+2]+=dp[i]
print(dp[-2]%num)

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[1]*(n+1)
for i in a:
    dp[i]=0
    
k=10**9+7
for i in range(2,n+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])%k
        
print(dp[-1])
### BUGGY CODE ###

N, M = map(int, input().split())
a = []
b = []
if M == 0:
    for i in range(1,(2*N)+1):
        if i%2==0 and i>0:
            a.append(i)
elif N == 0:
    for i in range(1,(2*M)+1):
        if i%2==1:
            b.append(i)
else:
    for i in range(1,(2**N)+1):
        if i%2==0 and i>0:
            a.append(i)
        else:
            b.append(i)
c = a[:N] + b[:M]
l = []
num = 1
for i in range(len(c)-1):
    for j in range(num,len(c)):
        res = c[i] + c[j]
        l.append(res)
    num+=1

k=[i for i in l if i%2==0]
print(len(k))

### FIXED CODE ###

N, M = map(int, input().split())
a = []
b = []
if M == 0:
    for i in range(1,(2*N)+1):
        if i%2==0 and i>0:
            a.append(i)
elif N == 0:
    for i in range(1,(2*M)+1):
        if i%2==1:
            b.append(i)
else:
    for i in range(1,501):
        if i%2==0 and i>0:
            a.append(i)
        else:
            b.append(i)
c = a[:N] + b[:M]
l = []
num = 1
for i in range(len(c)-1):
    for j in range(num,len(c)):
        res = c[i] + c[j]
        l.append(res)
    num+=1

k=[i for i in l if i%2==0]
print(len(k))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())
S = list(str(input()))

C = ["#" for _ in range(N)]

minN = sys.maxsize
for i in range(N+1) :
  cnt = 0
  for j in range(N) :
    if S[j] != C[j] :
      cnt += 1
  minN = min(minN, cnt)
  if i < N :
    C[i] = "."

print (minN)

### FIXED CODE ###

# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())
S = list(str(input()))

b = 0
w = 0
for i in range(N) :
  if S[i] == "." :
    w += 1

minN = w
for j in range(N) :
  if S[j] == "#" :
    b += 1
  else :
    w -= 1
  minN = min(minN, b+w)
print (minN)
### BUGGY CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


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


def ex(s):
    n = int(s)
    return sum(list(range(1, n+1))) / n

# main
N, K = mis()
exs = list(map(ex, input().split()))

if N == K:
    print(sum(exs))
    exit(0)

ex_max = 0

for i in range(K):
    ex_max += exs[i]

left = 0
ex_temp = ex_max
for i in range(K, N):
    ex_temp = ex_temp - exs[left] + exs[i]
    left += 1
    if ex_max < ex_temp:
        ex_max = ex_temp

print('{:.7f}'.format(ex_max))


### FIXED CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


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


def ex(s):
    n = int(s)
    nn = (n+1) * (n/2)
    return nn / n

# main
N, K = mis()
exs = list(map(ex, input().split()))

if N == K:
    print(sum(exs))
    exit(0)

ex_max = 0

for i in range(K):
    ex_max += exs[i]

left = 0
ex_temp = ex_max
for i in range(K, N):
    ex_temp = ex_temp - exs[left] + exs[i]
    left += 1
    if ex_max < ex_temp:
        ex_max = ex_temp

print('{:.7f}'.format(ex_max))
### BUGGY CODE ###

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

a.sort()

result = 0
mod = 10**9+7

def solve(x, y):
    if x == 0:
        return 1
    else:
        x = min(x, y-x)
        r = 1
        for i in range(y-x+1, y+1):
            r = (r*i)%mod
        for i in range(1, x+1):
            r = r//i
        return r

s, l = 0, 0

for i in range(n-k+1):
    for j in range(i+k-1, n):
        x = solve(k-2, j-i-1)%mod
        s = s+(a[i]*x)%mod
        l = l+(a[j]*x)%mod
print((l-s)%mod)

### FIXED CODE ###

N, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

result = 0
mod = 10**9+7

 
def cmb(n, r, mod=mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


if k==1:
    print(0)
else:
    result = 0
    for i in range(N-k+1):
        result += (a[N-i-1]-a[i])*cmb(N-1-i, k-1)
        result %= mod

    print(result%mod)
### BUGGY CODE ###

n = int(input())
num = 0

for i in range(n):
    num = num + i

print(num)


### FIXED CODE ###

n = int(input())

num = 0

num = n*(n-1)//2

print(num)
### BUGGY CODE ###

n = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())

dp1 = [0] * (n + 1)
if n > 5001:
    for i in range(1, 5001):
        feat = [i]
        if i - ga >= 0:
            feat.append(dp1[i-ga]+gb)
        if i - sa >= 0:
            feat.append(dp1[i-sa]+sb)
        if i - ba >= 0:
            feat.append(dp1[i-ba]+bb)
        dp[i] = max(feat)
    for i in range(5001, n+1):
        dp1[i] = max(i, dp1[i-ga]+gb, dp1[i-sa]+sb, dp1[i-ba]+bb)
else:
    for i in range(1, n+1):
        feat = [i]
        if i - ga >= 0:
            feat.append(dp1[i-ga]+gb)
        if i - sa >= 0:
            feat.append(dp1[i-sa]+sb)
        if i - ba >= 0:
            feat.append(dp1[i-ba]+bb)
        dp1[i] = max(feat)

B = dp1[-1]
dp2 = [0] * (B + 1)
if B > 5001:
    for i in range(1, 5001):
        feat = [i]
        if i - gb >= 0:
            feat.append(dp2[i-gb]+ga)
        if i - sb >= 0:
            feat.append(dp2[i-sb]+sa)
        if i - bb >= 0:
            feat.append(dp2[i-bb]+ba)
        dp2[i] = max(feat)

    for i in range(5001, B+1):
        dp2[i] = max(i, dp2[i-gb]+ga, dp2[i-sb]+sa, dp2[i-bb]+ba)
else:
    for i in range(1, B+1):
        feat = [i]
        if i - gb >= 0:
            feat.append(dp2[i-gb]+ga)
        if i - sb >= 0:
            feat.append(dp2[i-sb]+sa)
        if i - bb >= 0:
            feat.append(dp2[i-bb]+ba)
        dp2[i] = max(feat)

print(dp2[-1])


### FIXED CODE ###

n = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())

dp1 = [0] * (n + 1)
if n > 5001:
    for i in range(1, 5001):
        feat = [i]
        if i - ga >= 0:
            feat.append(dp1[i-ga]+gb)
        if i - sa >= 0:
            feat.append(dp1[i-sa]+sb)
        if i - ba >= 0:
            feat.append(dp1[i-ba]+bb)
        dp[i] = max(feat)
    for i in range(5001, n+1):
        dp1[i] = max(i, dp1[i-ga]+gb, dp1[i-sa]+sb, dp1[i-ba]+bb)
else:
    for i in range(1, n+1):
        feat = [i]
        if i - ga >= 0:
            feat.append(dp1[i-ga]+gb)
        if i - sa >= 0:
            feat.append(dp1[i-sa]+sb)
        if i - ba >= 0:
            feat.append(dp1[i-ba]+bb)
        dp1[i] = max(feat)

B = dp1[-1]
dp2 = [0] * (B + 1)
if B > 5001:
    for i in range(1, 5001):
        feat = [i]
        if i - gb >= 0:
            feat.append(dp2[i-gb]+ga)
        if i - sb >= 0:
            feat.append(dp2[i-sb]+sa)
        if i - bb >= 0:
            feat.append(dp2[i-bb]+ba)
        dp2[i] = max(feat)

    for i in range(5001, B+1):
        dp2[i] = max(i, dp2[i-gb]+ga, dp2[i-sb]+sa, dp2[i-bb]+ba)
else:
    for i in range(1, B+1):
        feat = [i]
        if i - gb >= 0:
            feat.append(dp2[i-gb]+ga)
        if i - sb >= 0:
            feat.append(dp2[i-sb]+sa)
        if i - bb >= 0:
            feat.append(dp2[i-bb]+ba)
        dp2[i] = max(feat)

print(dp2[-1])
### BUGGY CODE ###

s = input()[::-1]

counts = [0] * 2019

num, d = 0, 1

for char in s:
    num += int(char) * d
    counts[num % 2019] += 1
    d *= 10

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

ans += counts[0]

print(ans)

### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
### BUGGY CODE ###


import fractions as fr
import functools as ft
#import math as fr


prime = 10**9+7

n = int(input())
an = list( map( int, input().split() ))

an.sort()


lcm_ = 1
for a in an :
    lcm_ = a*lcm_ // fr.gcd(a, lcm_)
#    print(lcm_)
    
#ans = 0
#for a in an:
#    ans += lcm_ // a
#    ans = ans % prime if ans >= prime else ans

ans = ft.reduce(lambda x,y: (x + lcm_//y)%(prime*10000), an ,0 )

print(ans%prime)

### FIXED CODE ###


import fractions as fr
import functools as ft
#import math as fr


prime = 10**9+7

n = int(input())
an = list( map( int, input().split() ))

an.sort()


lcm_ = 1
for a in an :
    lcm_ = a*lcm_ // fr.gcd(a, lcm_)
#    print(lcm_)
    
#ans = 0
#for a in an:
#    ans += lcm_ // a
#    ans = ans % prime if ans >= prime else ans

ans = ft.reduce(lambda x,y: (x + lcm_//y), an ,0 )

print(ans%prime)