Harryxun/stf_run huggingface dataset:
## 幸福度が変わるかどうかは操作Kによって変更されたl, r番目の人間だけなので、
## 左右l,r番目の人間が幸福であるかどうかを見てゆく
## for(n)回のループでまず「既に 1 + x, 任意の r が幸福であるかどうか」を確認して、
## 幸福度2, 1の順でそのl,rをK回覚える
n, k = map(int, input().split())
humans = list(input())
k_count = 0
last_r = n ## 最後に操作したr(番目)
dev_null = 0

for x in range(n - 1):
  if x == last_r:
    break ## すべての可能性を確認した
  if x == 0:
    continue
  l = r = "n"
  if k_count == k:
    break ## 既にK回試行したのでbreak
  if humans[x] == "L" and humans[x - 1] == "L":
    continue
  elif humans[x] == "R" and humans[x - 1] == "R" and humans[x + 1] == "R":
    continue
  else:
    ## 不幸なので、lを確定
    l = x + 1 ## 不幸な人
    if l == last_r - 1:
      break ## 前に操作したrとlが等しい
    ## rを探す(x + 1からlast_rまで)
    for y in reversed(range(l, last_r)): ## l, l+1, last_r - 1
      if y == n - 1 and humans[x] == "R":
        ## 不幸なので、rを確定
        r = y
        last_r = r
        k_count += 1
        break
      elif humans[y] == "L" and humans[y - 1] == "L":
        dev_null += 1 ## 既に同じ方向を向いてる
      elif humans[y] == "R" and humans[y + 1] == "R":
        dev_null += 1 ## 既に同じ方向を向いてる
      else:
        ## 不幸なので、rを確定
        r = y
        last_r = r
        k_count += 1
        break
    if l != "n" and r != "n":
      ## ともに値があるなら操作Kを実行
      for z in range(l, r + 1):
        if humans[z - 1] == "L":
          humans[z - 1] = "R"
        else:
          humans[z - 1] = "L"

## ポイントを計算
happy_point = 0
for x in range(n):
  if x == 0 and humans[x] == "L":
    ## do nothing
    dev_null += 1
  elif x == n - 1 and humans[x] == "R":
    ## do nothing
    dev_null += 1
  else:
    if humans[x] == "L" and humans[x - 1] == "L":
      happy_point += 1
    elif humans[x] == "R" and humans[x + 1] == "R":
      happy_point += 1
print(happy_point)

### FIXED CODE ###

## 幸福度が変わるかどうかは操作Kによって変更されたl, r番目の人間だけなので、
## 左右l,r番目の人間が幸福であるかどうかを見てゆく
## for(n)回のループでまず「既に 1 + x, 任意の r が幸福であるかどうか」を確認して、
## 幸福度2, 1の順でそのl,rをK回覚える
n, k = map(int, input().split())
humans = list(input())
k_count = 0
last_r = n ## 最後に操作したr(番目)
dev_null = 0

## ポイントを計算
happy_point = 0
for x in range(n - 1):
  if humans[x] == humans[x+1]:
    happy_point += 1
print(min(n-1,happy_point+2*k))
import itertools

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

path = [[False] * n for i in range(n)]

for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
  
ans = 0

#頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n),n):
  #頂点1が始点
  if i[0] == 0:
    #生成した順列の中をさらにループ
    for j in range(n):
      # n-1まで続いたら条件を満たすパスが存在する
      if j == n-1:
        ans += 1
        break
      #i[j]からi[j+1]に行くパスがなければ終了
      if not path[i[j][j+1]]:
        break
        
print(ans)

### FIXED CODE ###

import itertools
 
n,m = map(int,input().split())
 
path = [[False] * n for i in range(n)]
 
for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
  
ans = 0
 
#頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n),n):
  #頂点1が始点
  if i[0] == 0:
    #生成した順列の中をさらにループ
    for j in range(n):
      # n-1まで続いたら条件を満たすパスが存在する
      if j == n-1:
        ans += 1
        break
      #i[j]からi[j+1]に行くパスがなければ終了
      if not path[i[j]][i[j+1]]:
        break
        
print(ans)
N=int(input())
a=list(map(int,input().split()))
b=0
c=N//2

for i in range(c+1):
  if (a[2*i] %2 !=0):
    b +=1

print(b)

### FIXED CODE ###

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

if (N%2 == 0):
  c=N//2
else:
  c=N//2 + 1

for i in range(c):
  if (a[2*i] %2 !=0):
    b +=1

print(b)
n = int(input())
if n[-1] == "3":
  print("bon")
elif n[-1] == ["0","1","6","8"]:
  print("pon")
else:
  print("hon")

### FIXED CODE ###

n = input()
if n[-1] == "3":
  print("bon")
elif n[-1] in ["0","1","6","8"]:
  print("pon")
else:
  print("hon")
File Edit Options Buffers Tools Python YASnippet Help                           
import sys
import collections

l = map(int, raw_input().split())
a=[]
for n in range(l[0]):
    x = map(int, raw_input().split())
    a.extend(x[1:])

c = collections.Counter(a)
values, counts = zip(*c.most_common())
print(counts.count(l[0]))

### FIXED CODE ###

import sys
import collections

a=[]
l = map(int, raw_input().split())
for n in range(l[0]):
    x = map(int, raw_input().split())
    a.extend(x[1:])

c = collections.Counter(a)
values, counts = zip(*c.most_common())
print(counts.count(l[0]))
n,m = input()

if m == n:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if m == n:
  print('Yes')
else:
  print('No')
N=int(input())
S=list(map(int,input().split(" ")))
jisho={}
for i in S:
    a=S.index(i)+1
    jisho[a]=i
jisho=sorted(jisho.items(), key=lambda x:x[1])
for i in range(0,len(jisho)):
    print(jisho[i][0],end=" ")

### FIXED CODE ###

input_line=input().rstrip()
kisuu=0
for number in range(1,int(input_line)+1):
  if number%2==1:
    kisuu=kisuu+1
possi=kisuu/int(input_line)
print(possi)
def read_int():
    return int(input())


def read_ints():
    return map(int, input().split(' '))


x, n = read_ints()
p = list(read_ints())
ans = -1
delta = 1000
for i in range(102):
    ok = True
    for j in p:
        if p == i:
            ok = False
            break
    if ok:
        d = abs(x - i)
        if d < delta:
            ans = i
print(ans)


### FIXED CODE ###

def read_int():
    return int(input())


def read_ints():
    return map(int, input().split(' '))


x, n = read_ints()
p = []
if n > 0:
    p = list(read_ints())
ans = -1
delta = 1000
for i in range(-1, 102):
    ok = True
    for j in p:
        if j == i:
            ok = False
            break
    if ok:
        d = abs(x - i)
        if d < delta:
            ans = i
            delta = d
print(ans)
N K =map(int, input().split())

print(N-K+1)

### FIXED CODE ###

N,K =map(int, input().split())
 
print(N-K+1)
N = int(input())
B = [0]*N
for i in range(N-1):
    x, y, a = map(int, input().split())
    B[x] ^= a
    B[y] ^= a
D = {}
for b in B:
    D[b] = D.get(b, 0) + 1
D[0] = 0
ans = 0
first = 0
for b in D:
    ans += D[b]//2
    if D[b]%2:
        first |= 1 << b

A = [0]*(1 << 15)
for i in range(1, 1<<15):
    bit = i & -i
    l = len(bin(bit))-3
    A[i] = A[i ^ bit] ^ l

memo = {0: 0}
def dfs(state):
    if state in memo:
        return memo[state]
    cur = state
    res = 10**9+7
    while cur:
        if A[cur] == 0:
            res = min(res, dfs(state ^ cur) + bin(cur).count('1')-1)
        cur -= 1
        cur &= state
    memo[state] = res
    return res
ans += dfs(first)
print(ans)


### FIXED CODE ###

N = int(input())
B = [0]*N
for i in range(N-1):
    x, y, a = map(int, input().split())
    B[x] ^= a
    B[y] ^= a
D = {}
for b in B:
    D[b] = D.get(b, 0) + 1
D[0] = 0
ans = 0
first = 0
for b in D:
    ans += D[b]//2
    if D[b]%2:
        first |= 1 << b

A = [0]*(1 << 16)
for i in range(1, 1<<16):
    bit = i & -i
    l = len(bin(bit))-3
    A[i] = A[i ^ bit] ^ l

memo = {0: 0}
def dfs(state):
    if state in memo:
        return memo[state]
    cur = state
    res = 10**9+7
    while cur:
        if A[cur] == 0:
            res = min(res, dfs(state ^ cur) + bin(cur).count('1')-1)
        cur -= 1
        cur &= state
    memo[state] = res
    return res
ans += dfs(first)
print(ans)
import math


def chmax(a, b):
    if a >= b:
        return a
    return b


def chmin(a, b):
    if a <= b:
        return a
    return b


def main():
    nn = int(input())
    hh = list(map(int, input().split()))

    dp = [math.inf]*nn
    dp[0] = 0
    dp[1] = chmin(dp[1],dp[0]+abs(hh[1]-hh[0]))
    for i in range(2,nn):
        dp[i] = chmin(dp[i],dp[i-1]+abs(hh[i]-hh[i-1]))
        dp[i] = chmin(dp[i],dp[i-2]+abs(hh[i]-hh[i-2]))

    print(dp[nn-1])


main()


### FIXED CODE ###

import math


def chmax(a, b):
    if a >= b:
        return a
    return b


def chmin(a, b):
    if a <= b:
        return a
    return b


def main():
    nn = int(input())
    arr = [list(map(int, input().split())) for l in range(nn)]
    dp = [[0] * 3 for i in range(nn+1)]

    for i in range(nn):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i+1][j] = chmax(dp[i+1][j],dp[i][k]+arr[i][k])

    print(max(dp[nn][0],dp[nn][1],dp[nn][2]))


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

count = 0
for i in range(N):
    sumv = 0
    for k in range(i, N):
        sumv += As[k]
        if sumv >= K:
            count += N - k
            break

print(count)

### FIXED CODE ###


X, A = list(map(int, input().split()))
if X < A:
    print(0)
else:
    print(10)
N = int(input())
x = [0] * N
u = [0] * N
for i in range(N):
    u[i],x[i] = map(str, input().split())
    x[i] = float(x[i])

sum = 0

for i in range(N):
    if (u[i] == 'JPY'):
        sum += x[i]
    elif (u[i] == 'BTC'):
        sum += x[i] * 380000
    else:
        break
print(sum)

### FIXED CODE ###

N = int(input())
x = [0] * N
u = [0] * N
for i in range(N):
    x[i],u[i] = map(str, input().split())
    x[i] = float(x[i])

sum = 0

for i in range(N):
    if (u[i] == 'JPY'):
        sum += x[i]
    elif (u[i] == 'BTC'):
        sum += x[i] * 380000
    else:
        break
print(sum)
T_list = input()
T = list(T_list)
nT = [0]*len(T)
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
nT=''.join(nT)              
print(nT)       

### FIXED CODE ###

T_list = input()
T = list(T_list)
nT = [0]*len(T)
if T[len(T)-1] == '?':
    T[len(T)-1] = 'D'
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i and i<len(T)-1:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
            else:
                nT[i] = 'D'
                T[i] = 'D'
        else:
            if i<len(T)-1:
                if T[i+1] == 'D':
                    nT[i] = 'P'
                    T[i] = 'P'
                elif T[i+1] == '?':
                    nT[i] = 'P'
                    T[i] = 'P'
                else:
                    nT[i] = 'D'
                    T[i] = 'D'
nT=''.join(nT)              
print(nT)
T=input()
ans=''
i=0
N=len(T)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:    
    if ans[-1]=='P':
      ans=ans+'D'
    if i<N-1 and T[i+1]=='D':
      ans=ans+'P'
    if i<N-1 and T[i+1]=='?':
      ans=ans+'PD'
      i+=1
  i+=1
print(ans)

### FIXED CODE ###

T=input()
ans=''
i=0
N=len(T)
if N==1 and T=='?':
  print('D')
  exit(0)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:
    if i>0 and i<N-1:
      if ans[-1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='D':
        ans=ans+'P'
      elif ans[-1]=='D' and T[i+1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='?':
        ans=ans+'PD'
        i+=1
    elif i==0:
      if T[i+1]=='D':
        ans=ans+'P'
      elif T[i+1]=='?':
        ans=ans+'PD'
        i+=1
      else:
        ans=ans+'D'
    elif i==N-1:
      ans=ans+'D'

        
  i+=1
print(ans)
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
score = {"r":P, "s":R, "p":S} 
m = {"r":"p", "s":"r", "p":"s"}
command= []
mm = []
ans = 0

for i, t in enumerate(T):
    if t == "r":
      c = "p"
      point = P
    elif t == "s":
      cc ="r" 
      point = R
    elif t == "p":
      c = "s"
      point = P
    
    if (i - K >= 0) and (command[i - K] == c):
        c = ""
        point = 0
    
    ans += point
    command.append(c)
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())


ans = 0
commands = [''] * N
for i, t in enumerate(T):
    if t == 'r':
        command = 'p'
        point = P

    elif t == 's':
        command = 'r'
        point = R

    elif t == 'p':
        command = 's'
        point = S

    if (i - K >= 0) and (commands[i -  K] == command):
        command = ''
        point = 0

    ans += point
    commands[i] = command

print(ans)
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10
	
X, Y, A, B, C = MAP()
p = deque(sorted(LIST(), reverse=True))
q = deque(sorted(LIST(), reverse=True))
r = deque(sorted(LIST(), reverse=True))

x = 0
y = 0
z = 0
ans = 0
while x+y+z < X+Y:
	compare = (p[0], q[0], r[0])

	if p[0] == max(compare):
		x += 1
		ans += p.popleft()
		if x == X:
			p = [0]
	elif q[0] == max(compare):
		y += 1
		ans += q.popleft()
		if y == Y:
			q = [0]
	else:
		z += 1
		ans += r.popleft()

print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10
	
X, Y, A, B, C = MAP()
p = deque(sorted(LIST(), reverse=True) + [0])
q = deque(sorted(LIST(), reverse=True) + [0])
r = deque(sorted(LIST(), reverse=True) + [0])

x = 0
y = 0
z = 0
ans = 0
while x+y+z < X+Y:
	compare = (p[0], q[0], r[0])

	if p[0] == max(compare):
		x += 1
		ans += p.popleft()
		if x == X:
			p = [0]
	elif q[0] == max(compare):
		y += 1
		ans += q.popleft()
		if y == Y:
			q = [0]
	else:
		z += 1
		ans += r.popleft()

print(ans)
n = int(input())
sum = 0
for i in range(0,n):
    x,u = input().split()
    if u == 'BTC':
        x = x *380000
    sum = sum + x
print (sum)


### FIXED CODE ###

n = int(input())
sum = 0
for i in range(0,n):
    x,u = input().split()
    x = float(x)
    if u == 'BTC':
        x = x *380000
    sum = sum + x
print (sum)
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
ans=float('inf')
ok=False
for i in range(n):
  if ct[i][1]<=t:
    ans=min(ans,ct[i][0])
    ok=True
if ok:
  print(ans)
else:
  print('TLE')


### FIXED CODE ###

n=int(input())
if n==1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
#Grid Repainting 2

#初期化
S = []
p = []
flag = True

#入力
H,W = map(int, input().split())
for i in range(W):
	s = input()
	s_list = list(s)
	S.append(s_list)

#計算
for i in range(0, H-1, 1):
	for j in range(1, W-1, 1):
		if S[i][j] == "#" and S[i+1][j] == "." and S[i][j+1] == "."  and S[i-1][j] == "." and S[i][j-1] == "." :
			flag = False
		

#出力
if flag == True:
	print("Yes")

else:
	print("No")

### FIXED CODE ###

#Day of Takahashi

#入力
a, b = map(int, input().split())

#計算
if a > b:
	ans = a-1

if a <= b:
	ans = a

#出力
print("{}".format(ans))
prunt(input()[:-8])

### FIXED CODE ###

print(input()[:-8])
N, M = map(int,(input().split()))
table = [input().split() for l in range(M)]
ans = 0
array1 = []
array2 = []
array3 = []
keta1 = -1
keta2 = -1
keta3 = -1
s1 = 0
s2 = 0
s3 = 0
for k in range(M):
    for j in range(2):
        table[k][j] = int(table[k][j])

for k in range(M):
    if table[k][0] == 1:
        if table[k][1] == 0 or (not(table[k][1] in array1) and s1 == 1):
            keta1 = -1
        else:
            keta1 = table[k][1]
        s1 = 1
        array1.append(table[k][1])

    elif table[k][0] == 2:
        if not(table[k][1] in array2) and s2 ==1:
            keta2 = -1
        else:
            keta2 = table[k][1]
        s2 = 1
        array2.append(table[k][1])
    else:
        if not(table[k][1] in array3) and s3 == 1:
            keta3 = -1
        else:
            keta3 = table[k][1]
        s3 = 1
        array3.append(table[k][1])

if s1 != 1:
    keta1 = 1
if s2 != 1:
    keta2 = 0
if s3 != 1:
    keta3 = 0

if keta1 == -1 or keta2 == -1 or keta3 == -1:
    ans = -1
else:
    ans = keta1 * 100 + keta2 * 10 + keta3

print(ans)

### FIXED CODE ###

N = int(input())
n = 0

if N % 2 == 0:
    n = N / 2
else:
    n = (N + 1)/2

print(int(n))
d = {}

i = int(input())

for m in range(i):
	word = input()
	d[m] = word
for n in range(1, i):
	h = n - 1
	a = d[h]
	b = d[n]
	if a[-1] == b[0]:
		continue
	else:
		print('No')
		exit()
for x in range (i - 1):
	for j in range (x + 1, i):
		if d[x] == d[j]:
			print('No')
			exit()
print('Yes')


### FIXED CODE ###

a, b = map(int, input().split())
X = a*b
if X == 2 or X ==4 or X==6:
	print('No')
else:
	print('Yes')
import numpy as np
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

# kごとに、
# 異なる数がいくつあるかを調べる
# (2以上要素が存在する)異なる数ごとに、
# (要素数)C2を解く。

np_A = np.array(A)

# 辞書作成
dic = {}

for k in range(N):
    before = A[:k]
    after = A[k+1:]

    before.extend(after)
    tmp_k = np.array(before)
    # print("tmp_k", tmp_k)   # k以上
    # print(np.unique(np_A))

    # 同じ組み合わせのケースを排除する。
    # (num, 要素数)の組み合わせを辞書かで作る

    k_unique = np.unique(tmp_k)
    ans = 0

    # k_uniqueをstr化
    # str_unique = [str(i) for i in k_unique]
    maped_num = map(str, k_unique) #格納される数値を文字列にする
    str_unique = "".join(maped_num.tolist())
    # print("str_unique", str_unique)

    # 要素数リストを作成
    count_u_list = []
    for u in k_unique:
        count_u = np.count_nonzero(tmp_k==u)
        count_u_list.append(count_u)
    # 要素数リストをstr化
    maped_num = map(str, count_u_list) #格納される数値を文字列にする
    str_count = "".join(maped_num.tolist())
    # str_count = "".join(count_u_list)
    # print("str_count", str_count)

    key = str_unique+str_count

    if key in dic.keys():
        print(dic[key])
        continue
    else:
        for count_u in count_u_list:
            if count_u < 2:
                continue
            # (count_u) C 2
            tmp = comb(count_u,2)
            ans += tmp

    # 値の更新
    dic[key] = ans
    print(ans)


### FIXED CODE ###

import numpy as np
from collections import Counter


N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
np_A = np.array(A)

# 全体を求める
tmp_all = np.array(A)
unique = np.unique(tmp_all)
# print("unique:", unique)
ans_all = 0
for u in unique:
    count_u = c[u]
    # print(f"u:{u}, count_u:{count_u}")
    if count_u < 2:
        continue
    # (count_u) C 2
    tmp = int(count_u*(count_u-1)/2)
    ans_all += tmp
# print("all", ans_all)


# kごとのケースを求めて、全体から引く
for i in A:
    print(ans_all - c[i] + 1)
from collections import Counter
s = input()
c,x = Counter(s).most_common(),len(s)
if any(c[i][1]-x//3-1 for i in range(x%3)) or any(c[i][1]-x//3 for i in range(x%3,3)): print("NO")
else: print("YES")

### FIXED CODE ###

from collections import Counter
s = input()
c,x = Counter(s).most_common(),len(s)
if any(c[i][1]-x//3-1 for i in range(x%3)) or any(c[i][1]-x//3 for i in range(x%3,len(c))): print("NO")
else: print("YES")
S = input()
r, ans = 3, 0
for l in range(len(S)):
    while r < len(S):
        if int(S[0:l]) % 2019 == 0:
            ans += 1
            break
        if int(S[l:r+1]) % 2019 == 0:
            ans += 1
            break
        if int(S[r+1:len(S)]) % 2019 == 0:
            ans += 1
            break
        r += 1
    r = l + 3
print(ans)


### FIXED CODE ###

import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)
# maintain overall min 
# iterate over two loops 
# find the absolute distance and before exiting the first maintain overall min
# also check the distance of last and first house
def findDistBetween(i,j):
    return abs(i - j)

def minDistfindDistBetweenLastAndFirstHouse(i,j):
    dist = findDistBetween(i, j)
    return K - dist 

K, N = input().split()
As = input().split()

K = int(K)
N = int(N)

# print ("As is")
# print (As)
# print (As.split())
A = [0] * len(As)
for i in range(len(As)):
    A[i] = int(As[i])
    
# A = list(map(lambda x: int(x), As))
# print (A)
# overAllMin = float('inf')
# minDist = 0 
# for i in range(N):
#     minDist = 0
#     for j in range(N):
#         # print (i, j)
#         minDist += findDistBetween(A[i], A[j])
#     # find the dist b/w last and first house
#     # minDist2 = minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
#     # minDist = min(minDist, minDist2)
#     print ("Min dist", minDist)
#     # print ("min dist2", minDist2)
#     overAllMin = min(overAllMin, minDist)

# print (overAllMin)
overAllMin = float('inf')
Arev = list(reversed(A))
dist1 = 0 
dist2 = 0
prevHouse = -1
for i in range(N):
    # print ("PRev house", prevHouse)
    # print ("Next house", A[i])

    dist1 = max(findDistBetween(A[i], prevHouse), dist1)
    prevHouse = A[i]
    

ma = max(dist1, minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1]))
print (K - ma)
# for i in range(N):
#     count = 0
#     curHouse = A[i]
#     j = i
#     flag0 = 0 
#     flag1 = 0
#     dist1 = 0 
#     dist2 = 0
#     while count < N:
#         if flag0 is 0:
#             dist1 += findDistBetween(curHouse, A[j])
#         curHouse = A[j]
#         j += 1
#         flag0 = 0
#         count += 1

#         if j == N and count < N: 
#             print ("in condition")
#             j = 0
#             dist1 += minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
#             flag0 = 1
        
        # count += 1

        # print ("dist1", dist1)

    # count = 0
    # curHouse = A[i]
    # j = i
    # while count < N:
    #     if flag1 is 0:
    #         dist2 += findDistBetween(curHouse, A[j])
    #     curHouse = A[j]
    #     j -= 1
    #     count += 1
    #     flag1 = 0
    #     if j == -1 and count < N: 
    #         j = N - 1 
    #         dist2 += minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
    #         flag1 = 1
    #     # count += 1 
# overAllMin = min(dist1, K - findDistBetween(A[0], A[-1]), overAllMin)
# print (dist1,  K - findDistBetween(A[0], A[-1]), overAllMin)
        
# print (overAllMin)    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
     
    
    




### FIXED CODE ###

S = input()

if len(S) >= 6:
    if S[2] is S[3] and S[4] is S[5]:
        print ("Yes")
        exit()
print ("No")