Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(n)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 1000000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)

Fixed submission:
n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(m)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 1000000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(n)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 100000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)

Fixed submission:
n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(m)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 1000000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python3
from math import gcd
import sys
input = lambda: sys.stdin.readline().strip()

n = int(input())
indet = 0
d = {}
for i in range(n):
    a, b = [int(x) for x in input().split()]
    if b < 0:
        a *= -1
        b *= -1
    if a == 0 and b == 0:
        indet += 1
    elif b == 0:
        p = (0, 0)
    else:
        g = gcd(a, b)
        p = (a // g, b // g)
    d[p] = d.get(p, 0) + 1

sizes = []
ignore = set()
for p, size in d.items():
    if p not in ignore:
        a, b = -p[1], p[0]
        if b < 0:
            a *= -1
            b *= -1
        if (a, b) in d:
            ignore.add((a, b))
            sizes.append((size, d[(a, b)]))
        else:
            sizes.append((size, 0))
M = 10**9 + 7
ans = 1
for n1, n2 in sizes:
    ans *= (pow(2, n1, M) + pow(2, n2, M) - 1)
    ans %= M
print((indet + ans - 1) % M)

Fixed submission:
#!/usr/bin/python3
from math import gcd
import sys
input = lambda: sys.stdin.readline().strip()

n = int(input())
indet = 0
d = {}
for i in range(n):
    a, b = [int(x) for x in input().split()]
    if b < 0:
        a *= -1
        b *= -1
    if a == 0 and b == 0:
        indet += 1
        continue
    elif a == 0:
        p = (0, 1)
    elif b == 0:
        p = (-1, 0)
    else:
        g = gcd(a, b)
        p = (a // g, b // g)
    d[p] = d.get(p, 0) + 1

sizes = []
ignore = set()
for p, size in d.items():
    if p not in ignore:
        a, b = -p[1], p[0]
        if b < 0:
            a *= -1
            b *= -1
        if (a, b) in d:
            ignore.add((a, b))
            sizes.append((size, d[(a, b)]))
        else:
            sizes.append((size, 0))
M = 10**9 + 7
ans = 1
for n1, n2 in sizes:
    ans *= (pow(2, n1, M) + pow(2, n2, M) - 1)
    ans %= M
print((indet + ans - 1) % M)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
h, w = [int(x) for x in input().split()]
g = [input() for i in range(h)]
dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs]
for d, dire in enumerate(dirs):
    di, dj = dire
    for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1
print(max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#'))

Fixed submission:
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
h, w = [int(x) for x in input().split()]
g = [input() for i in range(h)]
dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs]
for d, dire in enumerate(dirs):
    di, dj = dire
    for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1
print(max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#'))
Buggy python submission (verdict: Runtime Error):
r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - D
  print(x)

Fixed submission:
r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - d
  print(x)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate

n, m = [int(x) for x in input().split()]
a = [0 for i in range(m + 2)]
for i in range(n):
	l, r = [int(x) for x in input().split()]
    a[l] += 1
    a[r + 1] -= 1
a = list(accumulate(a))
print(a.count(m))

Fixed submission:
from itertools import accumulate

n, m = [int(x) for x in input().split()]
a = [0 for i in range(n + 2)]
for i in range(m):
    l, r = [int(x) for x in input().split()]
    a[l] += 1
    a[r + 1] -= 1
a = list(accumulate(a))
print(a.count(m))
Buggy python submission (verdict: Runtime Error):
m, k = [int(x) for x in input().split()]
if m == 1:
    if k == 0:
        print(0, 0, 1, 1)
    else:
        print(-1)
else:
    if k < 1 << m:
        print(*(i for i in range(1 << m) if i != k), k, *reversed([i for i in range(1 << m) if i != k]), k)
    else:
        print(-1)


Fixed submission:
m, k = [int(x) for x in input().split()]
if m == 1:
    if k == 0:
        print(0, 0, 1, 1)
    else:
        print(-1)
else:
    if k < 1 << m:
        a = [str(i) for i in range(1 << m) if i != k]
        print(' '.join(a), k, ' '.join(reversed(a)), k)
    else:
        print(-1)
Buggy python submission (verdict: Runtime Error):
  print({'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}[input()])

Fixed submission:
print({'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}[input()])
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = [chr(ord('a') + i) for i in range(26)]

m = n
i=1
while True:
    if m <= 26**i:
        break

    else:
        m -= 26**i
        i += 1

ans = []

for j in range(i-1, -1, -1):
    s1 = n // (26**j)
    if s1 == 0:
        ans.append(lis[s1])
    else:
        ans.append(lis[s1-1])
    n -= (26**j) * s1

print(''.join(ans))

Fixed submission:
n = int(input())
lis = [chr(ord('a') + i) for i in range(26)]

i=1
while True:
    if n <= 26**i:
        break

    else:
        n -= 26**i
        i += 1

ans = []

for j in range(i-1, -1, -1):
    s1 = n // (26**j)
    s2 = n % (26**j)
    if s2 == 0:
        s1 -= 1
    if j > 0:
        if s1 >= 26:
            s1 = 25
            ans.append(lis[-1])
        else:
            ans.append(lis[s1])
        n -= (26**j) * s1
    elif j == 0:
        ans.append(lis[n-1])

print(''.join(ans))

Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = [chr(ord('a') + i) for i in range(26)]

m = n
i=1
while True:
    if m <= 26**i:
        break

    else:
        m -= 26**i
        i += 1

ans = []

for j in range(i-1, -1, -1):
    s1 = n // 26**j
    if s1 == 0:
        ans.append(list[s1])
    else:
        ans.append(lis[s1-1])
    n -= (26**j) * s1

print(''.join(ans))

Fixed submission:
n = int(input())
lis = [chr(ord('a') + i) for i in range(26)]

i=1
while True:
    if n <= 26**i:
        break

    else:
        n -= 26**i
        i += 1

ans = []

for j in range(i-1, -1, -1):
    s1 = n // (26**j)
    s2 = n % (26**j)
    if s2 == 0:
        s1 -= 1
    if j > 0:
        if s1 >= 26:
            s1 = 25
            ans.append(lis[-1])
        else:
            ans.append(lis[s1])
        n -= (26**j) * s1
    elif j == 0:
        ans.append(lis[n-1])

print(''.join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = a[0]
for i in range(1, n, 1):
    ans = ans * a[i]
if ans > 1e+18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

if min(a) == 0:
    print(0)
    exit()
else:
    ans = a[0]
    for i in range(1, n, 1):
        ans = ans * a[i]
        if ans > 1e+18:
            print(-1)
            exit()
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools
n, k = map(int, input().split())
a = list(map(int, input().split()))

now = 1
town_list = [0]*n
town_list[0] = 1
tn_list = [1]

while(1):
    next = a[now-1]
    now = next
    if town_list[now-1] == 0:
        town_list[now-1] = 1
        tn_list.append(now)

    else:
        idx = tn_list.index(now)
        initial = tn_list[:idx]
        cycle = tn_list[idx:]
        break

if k > len(initial):
    end_idx = (k-len(initial))%len(cycle)
    print(cycle[end_idx])
else:
    print(initial[k])

Fixed submission:
import numpy as np
import itertools
n, k = map(int, input().split())
a = list(map(int, input().split()))

now = 1
town_list = [0]*n
town_list[0] = 1
tn_list = [1]

while(1):
    next = a[now-1]
    now = next
    if town_list[now-1] == 0:
        town_list[now-1] = 1
        tn_list.append(now)

    else:
        idx = tn_list.index(now)
        initial = tn_list[:idx]
        cycle = tn_list[idx:]
        break

if k >= len(initial):
    end_idx = (k-len(initial))%len(cycle)
    print(cycle[end_idx])
else:
    print(initial[k])
Buggy python submission (verdict: Runtime Error):
import math

x = int(input())

end = math.floor(x**0.2)

for i in range(1, x+1):
    if x % i == 0:
        for a in range(i//2,end,1):
            b = a - i
            if a**5 - b**5 == x:
                print(a, b)
                break

Fixed submission:
n, m = map(int, input().split())

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

way_list = []
for i in range(m):
    org = list(map(int, input().split()))
    org.sort()
    way_list.append(org)

bad = []

for j in range(m):
    way = way_list[j]
    if h_list[way[0]-1] > h_list[way[1]-1]:
        bad.append(way[1])
    elif h_list[way[0]-1] < h_list[way[1]-1]:
        bad.append(way[0])
    else:
        bad.append(way[0])
        bad.append(way[1])

bad = list(set(bad))
print(n - len(bad))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

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

way_list = []
for i in range(m):
    org = list(map(int, input().split()))
    org.sort()
    way_list.append(org)

good = list(range(1,n+1,1))

for j in range(m):
    way = way_list[j]
    if h_list[way[0]-1] > h_list[way[1]-1]:
        if way[1] in good:
            good.remove(way[1])
    elif h_list[way[0]-1] < h_list[way[1]-1]:
        if way[0] in good:
            good.remove(way[0])
    else:
        if way[0] in good:
            good.remove(way[0])
        if way[1] in good:
            good.remove(way[1])

print(len(good))


Fixed submission:
n, m = map(int, input().split())

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

way_list = []
for i in range(m):
    org = list(map(int, input().split()))
    org.sort()
    way_list.append(org)

bad = []

for j in range(m):
    way = way_list[j]
    if h_list[way[0]-1] > h_list[way[1]-1]:
        bad.append(way[1])
    elif h_list[way[0]-1] < h_list[way[1]-1]:
        bad.append(way[0])
    else:
        bad.append(way[0])
        bad.append(way[1])

bad = list(set(bad))
print(n - len(bad))
Buggy python submission (verdict: Time Limit Exceeded):
import math

x = int(input())


for i in range(1, x+1):
    if x % i == 0:
        for a in range(i//2,x,1):
            b = a - i
            if a**5 - b**5 == x:
                print(a, b)
                break
            elif a**5 - b**5 > x:
                break


Fixed submission:
import math

x = int(input())

divisors = []

for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        divisors.append(i)

        if i != x//i:
            divisors.append(x//i)


for i in divisors:
    for a in range(i//2,x,1):
        b = a - i
        if a**5 - b**5 == x:
            print(a, b)
            break
        elif a**5 - b**5 > x:
            break

Buggy python submission (verdict: Time Limit Exceeded):
import math

x = int(input())

end = math.floor(x**0.2)

for i in range(1, x+1):
    if x % i == 0:
        for a in range(0,end,1):
            b = a - i
            if a**5 - b**5 == x:
                print(a, b)
                break

Fixed submission:
import math

x = int(input())

divisors = []

for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        divisors.append(i)

        if i != x//i:
            divisors.append(x//i)


for i in divisors:
    for a in range(i//2,x,1):
        b = a - i
        if a**5 - b**5 == x:
            print(a, b)
            break
        elif a**5 - b**5 > x:
            break
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())
finish = False

while not finish:
    for i in range(2):
        if i==0:
            c -= b
        elif i==1:
            a-= d
        if a == 0 or c == 0:
            finish = True
            break

if a==0 and c!=0:
    print('No')
elif a!=0 and c==0:
    print('Yes')

Fixed submission:
a,b,c,d = map(int, input().split())

taka1 = a//d
taka2 = a%d
aoki1 = c//b
aoki2 = c%b

if a%d != 0:
    taka1 += 1
if c%b != 0:
    aoki1 += 1

if taka1 >= aoki1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
vote = list(map(int, input().split()))

vote.sort(reverse=True)
popular = vote[0:m]
sum = sum(vote)

yes = True
print('sum=', sum, sum/(4*m))
print('list=', popular)

for win in popular:
    if win < sum / (4*m):
        print('No')
        yes = False
        break

print(yes)

if yes:
    print('Yes')

Fixed submission:
x,y,z = map(int, input().split())

x1, y1, z1 = y, x, z
x2, y2, z2 = z1, y1, x1

print(x2, y2, z2)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
vote = list(map(int, input().split()))

vote.sort(reverse=True)
popular = vote[0:m-1]
sum = sum(vote)

yes = True

for win in popular:
    if win < sum / (4*m):
        print('No')
        yes = False
        stop

if yes:
    print('Yes')

Fixed submission:
n, m = map(int, input().split())
vote = list(map(int, input().split()))

vote.sort(reverse=True)
popular = vote[0:m]
sum = sum(vote)

yes = True

for win in popular:
    if win < sum / (4*m):
        print('No')
        yes = False
        break


if yes:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_list = list(map(int, input().split()))

cnt = 0
for i in range(n):
    if p_list[i] == min(p_list[:i+1]):
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
p_list = list(map(int, input().split()))

cnt = 0
minn = p_list[0]
for i in range(n):
    minn = min(p_list[i], minn)
    if p_list[i] == minn:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
print(a * b // math.gcd(a,b))

Fixed submission:
import sys
import fractions

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
print(a * b // fractions.gcd(a,b))
Buggy python submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
d_list = []
cnt_list = collections.defaultdict(lambda:1)
for i in range(n):
    s = str(input())
    
    d = collections.Counter(s)

    if i >= 1:
        if d in list(d_list):
            idx = d_list.index(d)
            cnt_list[idx] += 1
        else:
            d_list.append(d)
    else:
        d_list.append(d)

ans = 0
cnt_list = list(cnt_list.values())
for i in range(len(cnt_list)):
    ans += comb(cnt_list[i], 2, exact=True)
print(ans)

Fixed submission:

from collections import Counter

N = int(input())
S = [''.join(map(str,(sorted(str(input()))))) for i in range(N)]
counter = Counter(S)

answer = sum(x*(x-1)//2 for x in counter.values())
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
d_list = []
cnt = 0
for i in range(n):
    s = str(input())
    
    d = collections.Counter(s)

    if i >= 1:
        if d in d_list:
            cnt += d_list.count(d)
    d_list.append(d)
    
print(cnt)


Fixed submission:

from collections import Counter

N = int(input())
S = [''.join(map(str,(sorted(str(input()))))) for i in range(N)]
counter = Counter(S)

answer = sum(x*(x-1)//2 for x in counter.values())
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s_list = []
d_list = []
cnt = 0
for i in range(n):
    s_list.append(str(input()))
    
    d = defaultdict(int)
    for j in range(len(s_list[i])):
        d[s_list[i][j]] += 1

    if i >= 1:
        if d in d_list:
            cnt += d_list.count(d)
    d_list.append(d)
    
print(cnt)


Fixed submission:

from collections import Counter

N = int(input())
S = [''.join(map(str,(sorted(str(input()))))) for i in range(N)]
counter = Counter(S)

answer = sum(x*(x-1)//2 for x in counter.values())
print(answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s1 = str(input())
s2 = str(input())

cnt = 1

for i in range(n):
    if i == 0:
        if s1[i] == s2[i]:
            cnt = cnt * 3
            previous = 'tate'
        else:
            cnt = cnt * 6
            previous = 'yoko1'
    else:
        if s1[i] == s2[i]:   #tate
            if previous == 'tate':
                cnt = cnt * 2
            elif previous == 'yoko2':
                cnt = cnt * 3
        else:   #yoko
            if previous = 'tate':
                cnt = cnt * 2
            elif previous = 'yoko2':
                cnt = cnt * 3
print(cnt%1000000007)

Fixed submission:
n = int(input())
s1 = str(input())
s2 = str(input())

cnt = 1

for i in range(n):
    if i == 0:
        if s1[i] == s2[i]:
            cnt = cnt * 3
            previous = 'tate'
        else:
            cnt = cnt * 6
            previous = 'yoko1'
    else:
        if s1[i] == s2[i]:   #tate
            if previous == 'tate':
                cnt = cnt * 2
            elif previous == 'yoko2':
                cnt = cnt * 1
                previous = 'tate'
        else:   #yoko
            if previous == 'tate':
                cnt = cnt * 2
                previous = 'yoko1'
            elif previous == 'yoko2':
                cnt = cnt * 3
                previous = 'yoko1'
            elif previous == 'yoko1':
                previous = 'yoko2'
        
print(cnt%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

cnt = 0
for x in range(0,k+1,1):
    for y in range(0,k+1,1):
        for z in range(0,k+1,1):
            if x + y + z == s:
                cnt += 1
print(cnt)

Fixed submission:
k, s = map(int, input().split())

cnt = 0
for x in range(0,k+1,1):
    for y in range(0,k+1,1):
        if s - x - y >= 0 and s - x - y <= k:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = sys.stdin.buffer.readline().decode().rstrip()
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')


Fixed submission:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()
ok =S[2] == S[3] and S[4] == S[5]
if ok:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = sys.stdin.buffer.readline().decode().rstrip()
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')


Fixed submission:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()
ok =S[2] == S[3] and S[4] == S[5]
if ok:
    print('Yes')
else:
    print('No')