Harryxun/stf_run huggingface dataset:
n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * n

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]

print(dp[-1])


### FIXED CODE ###

n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

mod = 10**9+7
dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * (2*10**5+10)

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]
        dp[i] %= mod

print(dp[-1])
n=input()
for i in range(0,n):
 a=input()
 b=input()
 s=str(a+b)
 if(len(s)<=80): print str(a+b)
 else print "overflow"
 

### FIXED CODE ###

n=input()
for i in range(0,n):
 a=input()
 b=input()
 s=str(a+b)
 if(len(s)<=80): print a+b
 else: print "overflow"
N = int(input())
A = map(int,input())
x =0
for a in A:
  x+=1/A
print("{:,5f}".format(1/x))

### FIXED CODE ###

N = int(input())
A = map(int,input().split())
x =0
for a in A:
  x+=1/a
x=1/x
print("{}".format(x))
import math
a,b = map(int,input().split())

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

print(lcm(a,b))

### FIXED CODE ###

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

def lcm(a,b):
    import math
    return (a*b) // fractions.gcd(a,b)

print(lcm(a,b))
S=map(int,input())
h=(int)(S/3600)
m=(int)(S%3600/60)
s=(int)(S%3600%60)
print(f"{h}:{m}:{s}")


### FIXED CODE ###

S=int(input())
h=S//3600
m=S%3600//60
s=S%3600%60
print(f"{h}:{m}:{s}")
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long llint;
llint inf = 1000000007;

llint a = 0;
llint b = 0;
llint c = 0;
llint r = 1;

string s;

int main() {
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        switch (s[i]) {
        case 'A':
            a = (a + r) % inf;
            break;
        case 'B':
            b = (b + a) % inf;
            break;
        case 'C':
            c = (c + b) % inf;
            break;
        default:
            c = (c * 3 + b) % inf;
            b = (b * 3 + a) % inf;
            a = (a * 3 + r) % inf;
            r = (r * 3) % inf;
        }
    }
    cout << c << endl;
    return 0;
}

### FIXED CODE ###

inf = 1000000007
 
a = 0
ab = 0
abc = 0
r = 1
 
s = input()
 
for c in s:
    if c == "A":
        a += r
    elif c == "B":
        ab += a
    elif c == "C":
        abc += ab
    else:
        abc = abc * 3 + ab
        ab = ab * 3 + a
        a = a * 3 + r
        r *= 3
        
    a %= inf
    ab %= inf
    abc %= inf
    r %= inf

print(abc)
N,L=input().split()
N=int(N)
L=int(L)
A=0
B=[]
for j in range(1,N+1):
    A+=L+j-1
for i in range(1,N+1):
    B.append(abs(A-(L+i-1))
print(max(B))
             

### FIXED CODE ###

N,L=map(int,input().split())
A=[]
B=[]
for i in range(1,N+1):
    A.append(L+i-1)
for j in range(1,N+1):
    B.append(abs(L+j-1))
idx=B.index(min(B))
print(sum(A)-A[idx])
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x, y = map(int, input().split())
if ((x + y) % 3 != 0):
	print("0")
elif (x > 2*y || y > 2_x):
	print("0")
else:
	n_x = (2 * x - y) // 3
	n_y = (2 * y - x) // 3
	n_xy = (x + y) // 3
	print(cmb(n_xy,n_x)%1000000007)


### FIXED CODE ###

import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x, y = map(int, input().split())
if ((x + y) % 3 != 0):
	print("0")
elif (x > 2*y or y > 2*x):
	print("0")
else:
	n_x = (2 * x - y) // 3
	n_y = (2 * y - x) // 3
	n_xy = (x + y) // 3
	print(cmb(n_xy,n_x)%1000000007)
r = []
for i in input():
    if 'B' == i:
        if r:
            r.pop()
    else:
        r.append(i)
print(''.join(r)

### FIXED CODE ###

r = []
for i in input():
    if 'B' == i:
        if r:
            r.pop()
    else:
        r.append(i)
print(''.join(r))
n = int(input())
for i in range(n):
    k = input().split()
    if k[0] == 'S':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                s = list()
                s.append(i)
                s.sort()
                sl = len(s)
    if k[0] == 'H':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                h = list()
                h.append(i)
                h.sort()
                hl = len(h)
    if k[0] == 'C':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                c = list()
                c.append(i)
                c.sort()
                cl = len(c)
    if k[0] == 'D':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                d = list()
                d.append(i)
                d.sort()
                dl = len(d)
                
for i in range(1,sl+1):
    print('S {0}'.format(s[i]))
    
for i in range(1,hl+1):
    print('H {0}'.format(h[i]))
 
for i in range(1,dl+1):
    print('D {0}'.format(d[i])) 

for i in range(1,cl+1):
    print('C {0}'.format(c[i]))


### FIXED CODE ###

n = int(input())
S = [1,2,3,4,5,6,7,8,9,10,11,12,13]
C = [1,2,3,4,5,6,7,8,9,10,11,12,13]
H = [1,2,3,4,5,6,7,8,9,10,11,12,13]
D = [1,2,3,4,5,6,7,8,9,10,11,12,13]

for i in range(n):
    variations,number = input().split()
    if variations == 'S':
        S.remove(int(number))
    if variations == 'C':
        C.remove(int(number))
    if variations == 'H':
        H.remove(int(number))
    if variations == 'D':
        D.remove(int(number))

for i in range(len(S)):
    print('{} {}'.format('S',S[i]))

for i in range(len(H)):
    print('{} {}'.format('H',H[i]))

for i in range(len(C)):
    print('{} {}'.format('C',C[i]))

for i in range(len(D)):
    print('{} {}'.format('D',D[i]))
k=input()
print(k*"ACL")

### FIXED CODE ###

k=int(input())
print(k*"ACL")
class UnionFind:
	def __init__(self,node):
		self.par=[x for x in range(node)]
		self.rank=[1]*(node)
	def find(self,x):
		if self.par[x]==x:
			return x
		else:
			self.par[x]==self.find(self.par[x])
			return self.par[x]
	def unite(self,x,y):
		rx=self.find(x)
		ry=self.find(y)
		if rx==ry:
			return False
		else:
			if self.rank[rx]<self.rank[ry]:
				self.par[rx]==ry
			else:
				self.par[ry]==rx
				if self.rank[rx]==self.rank[ry]:
					self.rank[rx]+=1
		return True
def main(self):
	n,q=map(int,input().split())
	li=[]
	sol=self.UnionFind(n)
	for _ in [0]*q:
		j,a,b=map(int input().split())
		if t==0:
			sol.unite(a,b)
		else:
			li.append("Yes" if sol.find(a)==sol.find(b) else "No")
	return "\n".join(li)
print(main())


### FIXED CODE ###

from collections import defaultdict
import sys
sdin = sys.stdin.readline

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
        else:
            self.par[ry] = rx
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)

    

        
N, M = map(int, sdin().split())
P = list(map(int, sdin().split()))
XY = []
for i in range(M):
    XY.append(list(map(int, sdin().split())))


root_node = defaultdict(list)

uf = UnionFind(N)
for x,y in XY:
    x -= 1
    y -= 1
    uf.unite(x,y)

for i in range(N):
    uf.find(i)
    
par = uf.par

for i,root in enumerate(par):
    root_node[root].append(i)
    
ans = 0
for node_list in root_node.values():
    num_list = []
    for i in node_list:
        num_list.append(P[i]-1)
    
    ans += len(set(node_list)&set(num_list))
            
print(ans)
A = input()
B = input()
C = input()
X = input()
count = 0
c = np.array([500,100,50])
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if (a == 0 and b == 0 and c == 0) or (a+b+c)>50:
        break
      else:
        if (np.array([a,b,c]) * c).sum() == X:
          count += 1
print(count)

### FIXED CODE ###

import numpy as np
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
coin = np.array([500,100,50])
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a + b + c == 0:
        continue
      else:
        if X == coin.dot(np.array([a,b,c])):
            count += 1
print(count)
#複数の入力
input_list = input().split( )
input_list = input_list.sort()
print(input_list[0],input_list[1],input_list[2])


### FIXED CODE ###

#複数の入力
input_list = input().split( )
print(input_list[2],input_list[0],input_list[1])
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []
    for i in range(a - b):
        cnt = 0
        S_1 = S_[i:i + b + 1]
        for i in range(b):
            if S_1[i] == T[i]:
                cnt += 1
        cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()




### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []

    for i in range(a - b + 1):
        cnt = 0
        S_1 = S_[i:i + b]
        for j in range(b):
            if S_1[j] == T[j]:
                cnt += 1
        cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()
a,b = list(map(int, input().split()))
print(int(a*b))


### FIXED CODE ###

import math
a,b = input().split()
B = int(str(b).replace(".",""))
A = int(a)
print(A*B//100)
from collections import defaultdict

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

relation_dict = {}
for person1, person2 in friend_info:
    add_flag = False
    for k, v in relation_dict.items():
        if((person1 in v) or (person2 in v)):
            relation_dict[k].add(person1)
            relation_dict[k].add(person2)
            add_flag = True
            break
    if(add_flag == False):
        new_key = str(len(relation_dict)+1)
        relation_dict[new_key] = {person1, person2}

max_group = max([len(relation) for relation in relation_dict.values()])

print(max_group)


### FIXED CODE ###

D, T, S = map(int, input().split())
if S * T >= D:
    print("Yes")
else:
    print("No")
mi = lambda: map(int, input().split())
n, k = mi()
sushis = [list(mi()) for _ in range(n)]
types = set()
sushis.sort(key = lambda x: x[1], reverse = True)
bp = tp = sp = 0
exts = []
for t, d in sushis[:k]:
    bp += d
    if t in types:
        exts += d,
    else:
        types.add(t)
        tp += 1
sp = bp+tp**2
for t, d in sushis[k:]:
    if t not in types:
        types.add(t)
        bp += d-exts.pop()
        tp += 1
        sp = max(sp, bp+tp**2)
print(sp)

### FIXED CODE ###

mi = lambda: map(int, input().split())
n, k = mi()
sushis = [list(mi()) for _ in range(n)]
types = set()
sushis.sort(key = lambda x: x[1], reverse = True)
bp = tp = sp = 0
exts = []
for t, d in sushis[:k]:
    bp += d
    if t in types:
        exts += d,
    else:
        types.add(t)
        tp += 1
sp = bp+tp**2
for t, d in sushis[k:]:
    if not exts: break
    if t not in types:
        types.add(t)
        bp += d-exts.pop()
        tp += 1
        sp = max(sp, bp+tp**2)
print(sp)
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(2,int(math.sqrt)):
      if x % i == 0:
        return False
    return True

table=[0]*50000
for i in range(1,50001):
  if sosuu(2*i - 1) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
    
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[(r+1)//2] - table[(l+1)//2]
for i in range(Q):
  print(ans[i])
  

### FIXED CODE ###

import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*50001
for i in range(1,50001):
  if sosuu(2*i - 1) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
    
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[(r+1)//2] - table[(l+1)//2 - 1]
  
for i in range(Q):
  print(ans[i])
n,m=map(int,input().split())
a=[]
b=[0]*(n+1)
b[0]=0
b[1]=1
b[2]=2

for i in range(0,m):
  a.append(int(input()))
  
if 1 in a:
  b[1]=0
  if 2 in a:
    b[2]=0
  else:
    b[2]=1
  
for j in range(3,n+1):
  if j in a:
    b[j]=0
  else:
    b[j]=b[j-1]+b[j-2]
    
print(b[n]%(10**9+7))    
    
  
  
  



### FIXED CODE ###

n,m=map(int,input().split())
mod=10**9+7
a=[0]*(n+1)
dp=[0]*(n+1)
dp[0]=1
for i in range(m):
    a[int(input())]=1
    
if a[1]==1:
    dp[1]=0
else:
    dp[1]=1
    
for j in range(2,n+1):
    if a[j]==0:
        dp[j]=dp[j-1]+dp[j-2] 
                  
print(dp[n]%mod)
from collections import Counter, defaultdict, deque


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

al = list(map(int, input().split()))

if n == 1 and al[0] == 0:
    print(1)
elif n == 2:
    if 0 not in al:
        print(2)
    else:
        print(0)

if n % 2 == 0:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n-x-1,x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** (n / 2)) % ((10 ** 9) + 7))
    else:
        print(0)
else:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n - x - 1, x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** ((n - 1) / 2)) % ((10 ** 9) + 7))
    else:
        print(0)


### FIXED CODE ###

from collections import Counter

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

c_al = Counter(al)

if n % 2 == 0:
    for k,v in c_al.items():
        if v != 2:
            print(0)
            exit()
    print(pow(2, n // 2, 10 ** 9 + 7))

elif n % 2 != 0:
    for k, v in c_al.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        elif v != 2:
            print(0)
            exit()
    print(pow(2, n // 2, 10 ** 9 + 7))
A,B,C,D,E,F =map(int,input().split())

amax = F//(100*A)
bmax = F//(100*B)
cmax = F//C
dmax = F//D
concmx =0

for a in range(amax,-1,-1):
    for b in range(bmax,-1,-1):
        cmax = (F-100*A*a-100*B*b)//C
        dmax = (F-100*A*a-100*B*b)//D
        for c in range(cmax,-1,-1):
            for d in range(dmax,-1,-1):
                sugar =C*c+D*d
                whole = 100*A*a+100*B*b+sugar
                if whole ==0:
                    break
                elif sugar/whole <= E/(100+E) and whole <=F:
                    if sugar/whole > concmx:
                        concmx =sugar/whole
                        sugarmx = sugar
                        wholemx =whole
                    
                   
print(str(wholemx)+" "+str(sugarmx))
                    

### FIXED CODE ###

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

amax = F//(100*A)
bmax = F//(100*B)

concmx =0
wholemx =0
sugarmx =0

for a in range(amax,-1,-1):
    for b in range(bmax,-1,-1):
        cmax = (F-100*A*a-100*B*b)//C
        dmax = (F-100*A*a-100*B*b)//D
        for c in range(cmax,-1,-1):
            for d in range(dmax,-1,-1):
                sugar =C*c+D*d
                whole = 100*A*a+100*B*b+sugar
                if whole ==0:
                    break
                elif sugar/whole <= E/(100+E) and whole <=F:
                    if sugar/whole >= concmx:
                        concmx =sugar/whole
                        sugarmx = sugar
                        wholemx =whole
                    
                   
print(str(wholemx)+" "+str(sugarmx))
l = input();

ans = (l / 3) ^ 3;

print(ans);


### FIXED CODE ###

l = int(input());

ans = (l / 3) ** 3;

print(ans);
A,B,T = map(int(input().split()))

print((T//A)*B)

### FIXED CODE ###

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

print((T//A)*B)
a, b, k = map(int, input().split())

if a > k:
    c = a - k
else:
    c = 0
    d = a + b - k

print(c, d)


### FIXED CODE ###

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

if a > k:
    c = a - k
    d = b
elif a + b > k:
    c = 0
    d = a + b - k
else:
    c = 0
    d = 0

print(c, d)
H,W,N = [int(input()) for i in range(3)]
o = []
a = N / o
for o in range(1,10000):
  if H < W and a <= W:
    print(o)
    break
  elif H> W and a<=H:
    print(o)
    break
    
  
  

   
    
    
    





	

  
  
  



### FIXED CODE ###

H,W,N = [int(input()) for i in range(3)]
for o in range(1,10000):
  if H <= W and N / o <= W:
    break
  elif H >= W and N / o <= H:
    break
print(o)
N,M = map(int, input().split())
print(abs(N-2) * ans(M-2))

### FIXED CODE ###

N, M = map(int, input().split())
print(abs(N-2)*abs(M-2))
x,a,b=map(int,input().split())
print((x-a)%b)

### FIXED CODE ###

x=int(input())
a= int(input())
b = int(input())
print((x-a)%b)
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n+1)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1])
  lists[pairs[i][1]-1].append(pairs[i][0])
for i in range(len(lists)):
  lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)

### FIXED CODE ###

import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1]-1)
  lists[pairs[i][1]-1].append(pairs[i][0]-1)
for i in range(len(lists)):
  lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)
N, K, Q =　map(int, input().split(" "))
 
pointlist = [K for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  for j in range(N):
    if j+1 != Aperson:
      pointlist[j] -= 1

for i in range(N):
  if pointlist[i] <= 0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

N,K,Q = map(int,input().split())
judgepoint = Q - K

anslist = [0 for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  anslist[Aperson -1] += 1

for i in range(N):
  if anslist[i] <= judgepoint:
    print("No")
  else:
    print("Yes")
c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    a0, b0=map(int,raw_input().split())
    prev_a, prev_b=a0, b0
    tmp=0
    for i in range(n):
        a, b=map(int,raw_input().split())
        tmp+=(a-prev_a)**2+(b-prev_b)**2
        prev_a, prev_b=a, b
    tmp+=(prev_a-a0)**2+(prev_b-b0)**2
    print c, tmp**0.5
    
   

### FIXED CODE ###

c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    x0, y0=map(int,raw_input().split())
    prev_x, prev_y=x0, y0
    tmp=0
    for i in range(n-1):
        x,y=map(int,raw_input().split())
        tmp+=prev_x*y - prev_y*x
        prev_x, prev_y=x, y
    tmp+=prev_x*y0 - prev_y*x0
    print c, 0.5*abs(tmp)
    skip=raw_input()
# -*- coding: utf-8 -*-

import numpy as np
import sys
import os

def solve():

    N, M = list(map(int, input().split()))
    graph = [[] for i in range(N)]

    for i in range(M):
        A, B = list(map(int, input().split()))
        graph[A-1].append(B-1)
        graph[B-1].append(A-1)

    result = []
    finish = [0 for i in range(N)]
    out_num = [0 for i in range(N)]

    loop = True
    while loop:
        loop = False
        for i in range(N):
            if len(graph[i]) == 0:
                continue
            if len(graph[i])==2:
                for g in graph[i]:
                    result.append([i,g])
                    graph[g].remove(i)
                    out_num[i] += 1
                else:
                    graph[i] = []
                    loop = True


    for g in graph:
        if len(g) != 0:
            print("-1")
            return

    for r in result:
        print(str(r[0]+1) + " " +str(r[1]+1))


solve()

### FIXED CODE ###

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

import numpy
import sys
import os

def solve():
    num = int(input())
    camels = [int(i) for i in input().split()]

    if len(camels) % 3 != 0:
        for c in camels:
            if c !=0:
                print("No")
                return(0)

        print("Yes")
        return

    camels.sort()
    length = len(camels)

    for i in range(3):
        for j in range(int(i*length/3), int((i+1)*length/3)):
            if camels[int(i*length/3)] != camels[j]:
                print("No")
                return(0)

    if camels[0] ^ camels[int(num/3)] != camels[int(num/3)*2]:
        print("No")
        return(0)

    print("Yes")

solve()
import sys
input = sys.stdin.readline
S=int(input())
K=len(str(S))
lst= [x for x in list(str(S))]
A=[[0 for v in range(2019)] for j in range(2019)]
A[int(lst[0])][0]+=1
for i in range(1,K):
 c=int(lst[i])
 A[c][i]+=1
 for k in range(2019):
  d=(k*10+c)%2019
  A[d][i]+=A[k][i-1]
print(sum(A[0]))

### FIXED CODE ###

S=input()
T=len(S)
a=0
d=1
mod=[0]*2019
mod[0]+=1
for i in range(T):
 a+=(int(S[T-i-1])*(d))%2019
 b=a%2019
 mod[b]+=1
 d*=10
 d%=2019
c=0
for i in range(2019):
 if mod[i]>=2:
  c+= mod[i]*(mod[i]-1)/2
print(int(c))