Harryxun/stf_run huggingface dataset:
A = [[0] * 3] * 3

for i in range(3):
    a, b, c = map(int, input().split())
    A[i][0], A[i][1], A[i][2] = a, b, c

N = int(input())
B = [0] * N
for i in range(N):
    B[i] = int(input())

# input ここまで
import itertools
def flatten_list(l):
    return list(itertools.chain.from_iterable(l))

mark_list = [False] * 9

flatten_A = flatten_list(A)
for b in B:
    if not b in flatten_A: continue
    # 選ばれた数が自分のビンゴに含まれている
    for i in range(9):
        if flatten_A[i] == b:
            mark_list[i] = True

"""
[0, 1, 2], [3, 4, 5], [6, 7, 8]
[0, 3, 6], [1, 4, 7], [2, 5, 8]
[0, 4, 8], [2, 4, 6]
"""
def judge_bingo(l):
    yes = "Yes"
    no = "No"
    if l.count(True) < 3:
        return no
    if l[0] == 1:
        if (l[1] and l[2]) or (l[3] and l[6]) or (l[4] and l[8]):
            return yes
    if l[3] and l[4] and l[5]:
        return yes
    if l[1] and l[4] and l[7]:
        return yes
    if l[2]:
        if l[4] and l[6]: return yes
        if l[5] and l[8]: return yes
    if l[6] and l[7] and l[8]:
        return yes
    return no
        

ans = judge_bingo(mark_list)
print(ans)


### FIXED CODE ###

from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
# import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7


def inp(): return int(sys.stdin.readline())


def inp_list(): return list(map(int, sys.stdin.readline().split()))


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


N, M = inp_list()
s = [0] * M
c = [0] * M
for i in range(M): s[i], c[i] = inp_list()

if M == 0:
    if N == 1:
        print(0)
        exit()
    else:
        print(10 ** (N - 1))
        exit()


# N 桁の整数 10 ** (N - 1) ~ 10 ** N - 1 を全探索
for i in range(10 ** (N - 1) - 1, 10 ** N):
    if N != 1 and i == 10 ** (N - 1) - 1: continue
    i_str = str(i)
    for m in range(M):
        if i_str[s[m] - 1] != str(c[m]):
            break
        if m == M - 1:
            print(i)
            exit()
print(-1)
var = [int(e) for e in input().split()]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)

### FIXED CODE ###

var = [int(input()) for i in range(4)]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)
A,B = map(int,input().split())
start = time.time()
if 0 <= A <= B <= 10**12:
    #A,B = bin(A),bin(B)
    total = A
    a,b,c = A+1,B+1,1
    for i in range(a,b,c):
        total ^= i
    print(total)

### FIXED CODE ###

def xor(x):
    res = [x,1,x+1,0]
    return res[x%4]

A,B = map(int,input().split())
print(xor(A-1)^xor(B))
# -*- coding:utf-8 -*-

n = int(input())
command = [input().split() for i in range(n)]
ans = []
for i in range(n):
    if command[i][0] == "insert":
        ans.insert(0, command[i][1])
    elif command[i][0] == "delete":
        ans.remove(command[i][1])
    elif command[i][0] == "deleteFirst":
        ans.pop(0)
    else:
        ans.pop()

print (' '.join(ans))

### FIXED CODE ###

# -*- coding:utf-8 -*-
import collections
n = int(input())
ans = collections.deque()

for i in range(n):
    command = input().split()
    if command[0] == "insert":
        ans.appendleft(command[1])
    elif ans == []:
        continue
    elif command[0] == "delete":
        try:
            ans.remove(command[1])
        except:
            pass
    elif command[0] == "deleteFirst":
        ans.popleft()
    else:
        ans.pop()

print (' '.join(ans))
A=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
   'P','Q','R','S','T','U','V','W','X','Y','Z']
N=int(input())
X=input()
for i in range(0,len(X)):
  n=(A.index(i)+N)%26
  X[i]=A[n]
print(X)


### FIXED CODE ###

A=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
   'P','Q','R','S','T','U','V','W','X','Y','Z']
N=int(input())
x=input()
X=[j for j in x]
for i in range(0,len(X)):
  n=(A.index(X[i])+N)%26
  X[i]=A[n]
Y=''
for i in X:
  Y+=i
print(Y)
first, second = [input().split()]
print(second+first)

### FIXED CODE ###

first, second = input().split()
print(second+first)
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pi = 0
qi = 0
ri = 0
pl = len(p)
ql = len(q)
rl = len(r)
scr = 0
for j in range(X+Y):
  mx = max(p[pi],q[qi],r[ri])
  scr += mx
  if mx == p[pi]:
    A -= 1
    if pi >= pl or A == 0:
      p.append(0)
      pi = -1
    else:
      pi += 1
  elif mx == q[qi]:
    B -= 1
    if qi >= ql or B == 0:
      q.append(0)
      qi = -1
    else:
      qi += 1
  else:
    if ri < rl:
      ri += 1
    else:
      r.append(0)
      ri = -1
      
print(scr)


### FIXED CODE ###

X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pi = 0
qi = 0
ri = 0
pl = len(p)
ql = len(q)
rl = len(r)
R = 1
scr = 0
for j in range(X+Y):
  mx = max(p[pi],q[qi],r[ri])
  scr += mx
  if mx == p[pi]:
    X -= 1
    if pi+1 >= pl or X <= 0:
      p.append(0)
      pi = -1
      X = 0
    else:
      pi += 1
  elif mx == q[qi]:
    Y -= 1
    if qi+1 >= ql or Y <= 0:
      q.append(0)
      qi = -1
      Y = 0
    else:
      qi += 1
  else:
    if ri+1 >= rl or R <= 0:
      r.append(0)
      ri = -1
      R = 0
    else:
      ri += 1
      
print(scr)
def q1(s):
    #reverse
    return s[::-1]
def q2(s,f,char):
    if int(f) == 1:
        s = char + s
    else:
        s= s + char
    return s


s = input()
q = int(input())
for i in range(q):
    query = input().split()
    if len(query)==1:
        s=q1(s)
    else:
        s=q2(s,query[1],query[2])
print(s)

### FIXED CODE ###

s=input()
if s == 'AAA' or s == 'BBB':
    ans = 'No'
else:
    ans = 'Yes'
print(ans)
n,m=map(int, input().split())
print(n*(n-1)//2+m(m-1)//2)

### FIXED CODE ###

n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)
n = int(input())
h = list(map(int, input().split()))


dp =[ [-2] * 2 for i in [1]*n]


def f(index, is_sub):
    if(dp[index][is_sub] != -2):
        return dp[index][is_sub]

    v = h2[index][is_sub]
    if(index == 0):
        dp[index][is_sub] = h2[index][is_sub]
        #print(dp)
        return dp[index][is_sub]

    pre_v = f(index-1, 0)
    dp[index][is_sub] = -2
    if(pre_v != -1 and pre_v <= v):
        dp[index][is_sub] = v
        #print("set value",index,is_sub,pre_v,v)
    pre_v = f(index-1, 1)
    if(pre_v != -1 and pre_v <= v):
        dp[index][is_sub] = v
        #print("set value",index,is_sub,pre_v,v)

    if(dp[index][is_sub]!=v):
        #print("set value",index,is_sub,"NO")
        dp[index][is_sub] = -1
    
    #print(dp)
    return dp[index][is_sub]


h2 = [[i,i-1] for i in h]
#print(dp)
if(f(n-1,1)!=-1 or f(n-1,0)!=-1):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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


h[0] = h[0] -1
for i in range(1,n):
    if(h[i-1] < h[i]):
        h[i] = h[i]-1

flag = True
for i in range(1,n):
    if(h[i-1]>h[i]):
        flag = False

if(flag):
    print("Yes")
else:
    print("No")
from itertools import chain
import numpy as np
import pandas as pd


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

P = [0] * N
Q = [None] * M

for m in range(M):
    p, y    = map(int, input().split())
    P[p-1] += 1
    Q[m]    = p, y

D = pd.DataFrame(Q)
D = D.sort_values(by=[0, 1])

D[2] = list(chain.from_iterable([list(range(1, p+1)) for p in P]))

D = D.sort_index()

X = D[0].values.tolist()
Y = D[2].values.tolist()

for i in range(M):
    print('%06d%06d' % (X[i], Y[i]))


### FIXED CODE ###

from itertools import chain


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

P = [0] * N

I = list(range(M))

Q = [None] * M
Y = [None] * M

for m in range(M):
    Q[m], Y[m] = map(int, input().split())
    P[Q[m]-1] += 1

D = zip(I, Q, Y)
D = sorted(D, key=lambda x: [x[1], x[2]])
I, Q, Y = map(list, zip(*D))

P = list(chain.from_iterable([list(range(1, p+1)) for p in P]))

D = zip(I, Q, Y, P)
D = sorted(D, key=lambda x: x[0])
I, Q, Y, P = map(list, zip(*D))

for i in range(M):
    print('%06d%06d' % (Q[i], P[i]))
alpha='abcdefghijklmnopqrstuvwxyz'
S=input()
K=int(input())
ans=''
for s in S:
    idx=alpha.index(s)
    if idx==0 or 26-idx>K:
        ans+=s
        continue
    else:
        K-=26-idx
        ans+='a'
if K>0:
    tar=ans[-1]
    idx=alpha.index(tar)
    ans=ans[:-1]+alpha[idx+K]
print(ans)

### FIXED CODE ###

#CODEFESTIVAL2016qualA
alpha='abcdefghijklmnopqrstuvwxyz'
S=input()
K=int(input())
ans=''
for s in S:
    idx=alpha.index(s)
    if idx==0 or 26-idx>K:
        ans+=s
        continue
    else:
        K-=26-idx
        ans+='a'
if K>0:
    tar=ans[-1]
    idx=alpha.index(tar)
    ans=ans[:-1]+alpha[(idx+K)%26]
print(ans)
import sys
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


X = ni()
l = get_primenumber(10 ** 5)
idx = bisect.bisect_left(l, X)
print(l[idx])


### FIXED CODE ###

import sys
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


X = ni()
l = get_primenumber(10 ** 5 +10)
idx = bisect.bisect_left(l, X)
print(l[idx])
s = input()

ans = True

while len(s) > 0:
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()

ans = True

while len(s) > 0:
    if len(s) == 1:
        print('No')
        exit(0)
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')
N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()

E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)
rgb = input()
print("YES" if int(rgb) % 4 == 0 else "NO")

### FIXED CODE ###

r, g, b = input().split()
print("YES" if int(r+g+b) % 4 == 0 else "NO")
# coding: utf-8

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

print(max(A+B, A-B, A*B)

### FIXED CODE ###

# coding: utf-8
 
A, B = list(map(int, input().split()))
 
print(max(A+B, A-B, A*B))
while True:
    try:
        d = int(raw_input())
    except EOFError:
        break
    print reduce(lambda x,y:x+y,map(lambda x:d*x*x,range(d, 600, d)))

### FIXED CODE ###

while True:
    try:
        d = int(raw_input())
    except EOFError:
        break
    if d == 600:
        print 0
    else:
        rects = map(lambda x:d*x*x,range(d, 600, d))
        print reduce(lambda x,y:x+y,rects)
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("POSSIBLE")
    elif q == 0:print("IMPOSSIBLE")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n = ip()                                     #入力整数1つ
n,m,x,y= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!

print((n*m)/2,end =' ')
if n 2*x or m == y*2:
    print(1)
else: print(0)


### FIXED CODE ###

import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("POSSIBLE")
    elif q == 0:print("IMPOSSIBLE")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n = ip()                                     #入力整数1つ
n,m,x,y= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!

print((n*m)/2,end =' ')
if n == 2*x and m == y*2:
    print(1)
else: print(0)
# -*- coding:utf-8 -*-

def solve():
    N, M = list(map(int, input().split()))
    A = []
    B = []

    for i in range(N):
        A.append(list(input()))
    for i in range(M):
        B.append(list(input()))
    
    # 左上から順に走査する
    for i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == B[0][0]:
                is_contained = True
                for k in range(i, i+M):
                    for l in range(j, j+M):
                        if A[k][l] != B[k][l]:
                            is_contained = False
                            break
                    if not is_contained: break
                if is_contained:
                    print("Yes")
                    return
    print("No")


if __name__ == "__main__":
    solve()


### FIXED CODE ###

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

def solve():
    N, M = list(map(int, input().split()))
    A = []
    B = []

    for i in range(N):
        A.append(list(input()))
    for i in range(M):
        B.append(list(input()))
    
    # 左上から順に走査する
    for i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == B[0][0]:
                is_contained = True
                for k in range(0, M):
                    for l in range(0, M):
                        if A[i+k][j+l] != B[k][l]:
                            is_contained = False
                            break
                    if not is_contained: break
                if is_contained:
                    print("Yes")
                    return
    print("No")


if __name__ == "__main__":
    solve()
n = input()
a = ""
for i in range(n):
  if i =="0":
    a+=i
  elif i =="1":
    a+=i
  elif i =="B":
    a = a[:-1]
print(a)

### FIXED CODE ###

n = input()
a = ""
for i in n:
  if i =="0":
    a+=i
  elif i =="1":
    a+=i
  elif i =="B":
    a = a[:-1]
print(a)
n = int(input())
score = 0
i = 0
ans_list = []

while score < n:
    i += 1
    score += i
    ans_list.append(i)


ans_list.remove(score - n)
for k in range(len(ans_list)):
    print(ans_list[k])

### FIXED CODE ###

n = int(input())
score = 0
i = 0
ans_list = []

while score < n:
    i += 1
    score += i
    ans_list.append(i)

if score == n:
    for k in range(len(ans_list)):
        print(ans_list[k])
else:
    ans_list.remove(score - n)
    for k in range(len(ans_list)):
        print(ans_list[k])
n = int(input())
a = list(map(int,input().split()))
res = 0
flg = True
i = 1
while i < n+1:
    if a[i-1] == i:
        res += 1
        while a[i-1] == i:
            res+=1
            i+=1
        res -= 1
    i+=1
print(res)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
res = 0
i = 1
while i < n+1:
    if a[i-1] == i:
        res += 1
        i+=2
    else:
        i+=1
print(res)
from collections import deque
p = 10**9+7
x,y = map(int,input().split())
x += 1 ; y += 1
map_a=[[0]*y for _ in range(x)]
d = [(2,1),(1,2)]
que = deque()
que.append((0,0))

map_a[0][0] = 1

while que:
    a,b = que.popleft()
    for u,v in d:
        m = a + u ; n = b + v
        if 0<=m<x and 0<=n<y:
            map_a[m][n] += map_a[a][b]%p
            que.append((m,n))

print(map_a[-1][-1])


### FIXED CODE ###

x,y = map(int,input().split())
m = 10**9+7
if not((x+y)%3== 0 and abs(x-y)<=(x+y)//3):
    print(0);exit()

def comb(n,k):
    #if 2 * k > n:
        #k = n - k
    a = 1
    for i in range(1,k+1):
        a *= (n - ( i - 1)) * pow(i,m-2,m)
        a = a%m
    return a

n = (x+y)//3
k = x-n
print(comb(n,k))
import functools
import math

def slcm(numbers):
	return functools.reduce((lambda x,y:x*y//math.gcd(x, y)), numbers)
	
input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))


### FIXED CODE ###

import functools
import fractions

def blcm(x, y):
	return (x*y)//fractions.gcd(x, y)

def slcm(numbers):
	return functools.reduce(blcm, numbers)
	
input()
numbers=list(map(int, input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))
import math

rawUsrInput = input()
usrInput = rawUsrInput.split()

a = int(usrInput[0])
b = int(usrInput[1])
x = int(usrInput[2])

print(str(((math.degrees(math.acos((b)/(math.sqrt(4*x*x/(a*a*b*b)+b*b))))))))

### FIXED CODE ###

usrInput = input()
splitedInput = usrInput.split()
clearFlag = []

for i in range(2):
    if int(splitedInput[i]) < 10:
        clearFlag.append(True)
    else:
        clearFlag.append(False)

if bool(clearFlag[0]) == True and bool(clearFlag[1]) == True:
    print(int(splitedInput[0]) * int(splitedInput[1]))
else:
    print(-1)
import sys
import numpy as np
S = sys.stdin.buffer.readline().decode('utf-8').rstrip()
S = np.array([int(d) for d in S[::-1]], dtype=np.int32)

def solve(S):
	M = 2019
	t = 1
	ans = 0
	c = np.zeros(M, dtype=np.int64)
	c[0] = 1
	r = 0
	for d in S:
		r = (d * t + r) % M
		ans += c[r]
		c[r] += 1
		t = t * 10 % M
	return ans



def cc_export():
	from numba.pycc import CC
	cc = CC('my_module')
	cc.export('solve', numba.i8(numba.typeof(S)))(solve)
	cc.compile()

if __name__ == '__main__':
	import sys
	if sys.argv[-1] == 'ONLINE_JUDGE':
		cc_export()
		exit(0)
	from my_module import solve
	print(solve(S))


### FIXED CODE ###

import sys

M = 2019
S = sys.stdin.readline().rstrip()
N = len(S)

dmod = [0] * (N + 1)
amod = [0] * (N + 1)
tenmod = 1
prev_amod = 0
mcnt = [0] * 2019
ans = 0
for i in range(N, -1, -1):
    d = ord(S[i]) - ord("0") if i < N else 0
    dmod[i] = d * tenmod % M
    amod[i] = (dmod[i] + prev_amod) % M
    ans += mcnt[amod[i]]
    mcnt[amod[i]] += 1
    tenmod = tenmod * 10 % M
    prev_amod = amod[i]
print(ans)
A, B = map(int, input())
print((A + B) // 2 if abs(A - B) % 2 == 0 else 'IMPOSSIBLE')


### FIXED CODE ###

A, B = map(int, input().split())
print((A + B) // 2 if abs(A - B) % 2 == 0 else 'IMPOSSIBLE')
a,b,k=[int(i) for i in input().split()]
c=list(range(a,b+1))

d=c[:k]+c[::-1][:k]
e=list(set(d))
e.sort()
for i in e:
    print(i)

### FIXED CODE ###

a,b,k=[int(i) for i in input().split()]

if b-a+1>=2*k:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
n=int(input())
A=list(map(int,input().split()))
ans=1
qq=A[0]
for i in range(n):
  if qq<A[i+1]:
    qq=A[i+1]
    continue
  else:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=1
qq=A[0]
for i in range(n-1):
  if qq<A[i+1]:
    continue
  if qq>=A[i+1]:
    qq=A[i+1]
    ans+=1
print(ans)
n = int(input())
b_list = []
for i in range(n):
    ba_tmp = list(map(int, input().split()))
    ba_list.append([ba_tmp[1], [ba_tmp[0]])
ba_list.sort()
now_time = 0
for i in range(n):
    now_time += ba_list[i][1]
    if now_time > ba_list[i][0]:
        print('No')
        exit()
print('Yes')

### FIXED CODE ###

n = int(input())
ba_list = []
for i in range(n):
    ba_tmp = list(map(int, input().split()))
    ba_list.append(ba_tmp[::-1])
ba_list.sort()
now_time = 0
for i in range(n):
    now_time += ba_list[i][1]
    if now_time > ba_list[i][0]:
        print('No')
        exit()
print('Yes')
M,K=map(int,input().split())
if 2**M<=K:
  print(-1)
  exit()
if K==0:
  ans=[]
  for i in range(2**M):
    ans.append(str(i))
    ans.append(str(i))
  print(" ".join(ans))
  exit()
if N==1:
  print(-1)
  exit()
ans=["0"]
for i in range(1,2**M):
  if i!=K:
    ans.append(str(i))
ans.append("0")
ans.append(str(K))
for i in range(1,2**M)[::-1]:
  if i!=K:
    ans.append(str(i))
ans.append(str(K))
print(" ".join(ans))

### FIXED CODE ###

M,K=map(int,input().split())
if 2**M<=K:
  print(-1)
  exit()
if K==0:
  ans=[]
  for i in range(2**M):
    ans.append(str(i))
    ans.append(str(i))
  print(" ".join(ans))
  exit()
if M==1:
  print(-1)
  exit()
ans=["0"]
for i in range(1,2**M):
  if i!=K:
    ans.append(str(i))
ans.append("0")
ans.append(str(K))
for i in range(1,2**M)[::-1]:
  if i!=K:
    ans.append(str(i))
ans.append(str(K))
print(" ".join(ans))