Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03061 (python)

Fixed submission:
import functools
import fractions


N = int(input())
a = list(map(int,input().split()))
ans = 1
gcd = functools.reduce(fractions.gcd,a)
s_front = [1]*N
s_back = [1]*N
s_front[0] = a[0]
s_back[0] = a[N-1]

for i in range(N):
	if i > 0:
		s_front[i] = fractions.gcd(s_front[i-1],a[i])
		s_back[i] = fractions.gcd(s_back[i-1],a[N-i-1])
for i in range(N):
	if i == 0:
		gcd_new = s_back[N-2]
	elif i == N-1:
		gcd_new = s_front[N-2]
	else:
		gcd_new = fractions.gcd(s_front[i-1],s_back[N-i-2])
	ans = max(ans,gcd_new)
print(ans)

Buggy submission (verdict: Runtime Error):
import functools
import fraction

N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(N):
	a_new = a[0:i]+a[i+1:N]
	gcd = functools.reduce(math.gcd,a_new)
	ans = max(ans,gcd)

print(ans)

Buggy submission (verdict: Runtime Error):
import functools
import math

N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(N):
	a_new = a[0:i]+a[i+1:N]
	gcd = functools.reduce(math.gcd,a_new)
	ans = max(ans,gcd)

print(ans)
Problem p03074 (python)

Fixed submission:
N,K = list(map(int,input().split()))
s = input()

a = []
b = []

index = 0
length = 0
judge = "0"
for i in range(len(s)):
	if s[i] == judge:
		length += 1
	if s[i] != judge:
		if judge == "0":
			b.append(length)
		if judge == "1":
			a.append(length)
		length = 1
		judge = str((int(judge)+1)%2)
if judge == "0":
	b.append(length)
	a.append(0)
if judge == "1":
	a.append(length)


M = len(a)
if K >= M:
	print(len(s))
	exit()

ans = 0
ans_new = 0
for i in range(K):
	ans += a[i]+b[i]
ans_max = ans
for i in range(M-K):
	if i == 0:
		ans_new = ans-b[0]+b[K]+a[K]
	if i != 0:
		ans_new = ans-a[i-1]-b[i]+b[K+i]+a[K+i]
	ans_max = max(ans_max,ans_new)
	ans = ans_new
print(ans_max)

Buggy submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
s = input()

a = []
b = []

index = 0
length = 0
judge = "0"
for i in range(len(s)):
	if s[i] == judge:
		length += 1
	if s[i] != judge:
		if judge == "0":
			b.append(length)
		if judge == "1":
			a.append(length)
		length = 1
		judge = str((int(judge)+1)%2)
if judge == "0":
	b.append(length)
if judge == "1":
	a.append(length)


if len(a) == len(b):
	M = len(a)
	if K >= M:
		print(len(s))
		exit()
	
	ans = 0
	ans_new = 0
	for i in range(K):
		ans += a[i]+b[i]
	ans_max = ans
	for i in range(M-K):
		if i == 0:
			ans_new = ans-b[0]+b[K]+a[K]
		if i != 0:
			ans_new = ans-a[i-1]-b[i]+b[K+i]+a[K+i]
		ans_max = max(ans_max,ans_new)
		ans = ans_new
	print(ans_max)
	exit()
	
if len(a) < len(b):
	M = len(b)
	if K >= M:
		print(len(s))
		exit()
	
	ans = 0
	for i in range(K):
		ans += a[i]+b[i]
	ans_max = ans
	for i in range(M-K+1):
		if i == 0:
			if M-1 <= K:
				ans_new = ans-b[0]+b[K]
			else:
				ans_new = ans-b[0]+b[K]+a[K]
		if i == M-K:
			ans_new = ans-a[M-K-1]-b[M-K]+b[M-1]
		if i != 0 and i != M-K:
			ans_new = ans-a[i-1]-b[i]+b[K+i]+a[K+i]
		
		ans_max = max(ans_max,ans_new)
		ans = ans_new
	print(ans_max)
	exit()
Problem p03079 (python)

Fixed submission:
a,b,c = list(map(int,input().split()))
if a==b and b == c:
	print("Yes")
	exit()
print("No")

Buggy submission (verdict: Runtime Error):
N,Q = list(map(int,input().split()))
s = input()

t = ["a"]*Q
d = ["b"]*Q
for i in range(Q):
	t[i],d[i] = input().split()
c = [1]*N
flux = [0]*N

for i in range(Q):
	flux = [0]*N
	for j in range(N):
		if s[j] == t[i] and d[i] == "R":
			flux[j] += -c[j]
			if j != N-1:
				flux[j+1] += c[j]
		if s[j] == t[i] and d[i] == "L":
			flux[j] = -c[j]
			if j != 0:
				flux[j-1] += c[j]
	for j in range(N):
		c[j] += flux[j]
	#print(c)
ans = sum(c)
print(ans)
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())
a = [list(map(int,input().split())) for i in range(N)]
a.sort(key=lambda x:x[0])
ans = 0
nokori = M
for j in range(N):
	ans += a[j][0]*min(a[j][1],nokori)
	nokori -= a[j][1]
	if nokori <= 0:
		print(ans)
		exit()

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [list(map(int,input().split())) for i in range(N)]

A = [x[0] for x in a]
A_sorted = sorted(A)
ans = 0
nokori = M
for c in A_sorted:
	for j in range(N):
		if c == A[j]:
			ans += A[j]*min(a[1][j],nokori)
			nokori -= min(a[1][j],nokori)
		if nokori <= 0:
			print(ans)
			exit()
Problem p03161 (python)

Fixed submission:
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*N
dp[0] = 0 #initial situation

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

Buggy submission (verdict: Runtime Error):

inf = float("inf")
dp = [inf]*N
dp[0] = 0 #initial situation

for i in range(1,N):
	for k in range(K):
		if i-1-k >= 0:
			dp[i] = min(dp[i],dp[i-1-k] + abs(h[i]-h[i-1-k]))
			
print(dp[N-1])
Problem p03284 (python)

Fixed submission:
N,K = list(map(int,input().split()))

if N % K == 0:
	print("0")
	exit()
print("1")

Buggy submission (verdict: Runtime Error):
N = int(input())

counter = 0
for number_cake in range(0,N):
	for number_donut in range(0,N):
		if(N == number_cake*4+number_donut*7):
			counter += 1

if(counter > 0):
	print("Yes")
else:
	print("No")
Problem p03285 (python)

Fixed submission:
N = int(input())

counter = 0
for number_cake in range(0,N):
	for number_donut in range(0,N):
		if(N == number_cake*4+number_donut*7):
			counter += 1

if(counter > 0):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())

counter = 0
for number_cake in range(0,N):
	if(((N-number_cake*4) % 7 == 0)&&(N >= number_cake*4)):
		counter += 1

if(counter > 0):
	print("Yes")
else:
	print("No")
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

if (N%500) > A:
	 print("No")
else:
	print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(print())
A = int(print())

if (N%500) > A:
	 print("No")
else:
	print("Yes")
Problem p03455 (python)

Fixed submission:
list = input().split()
a = int(list[0])
b = int(list[1])

if (a*b)%2 == 0:
	print("Even")
else:
	print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a*b)%2 == 1:
	print("Even")
else:
	print("Odd")
Problem p03469 (python)

Fixed submission:
s = input()
print("2018"+s[4::])

Buggy submission (verdict: Runtime Error):
print("2018"+s[4:])
Problem p03493 (python)

Fixed submission:
str = input()
list = list(str)

print(int(list[0])+int(list[1])+int(list[2]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
A_unique = list(set(A))
N_unique = len(A_unique)

a = [A.count(A_unique[i]) for i in range(N_unique)]
a_sort = sorted(a)

M = N_unique-K
if M <= 0:
	print(0)
	exit()

ans = 0
for i in range(0,M):
	ans += a_sort[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
A_unique = list(set(A))
N_unique = len(A_unique)

a_sort = sorted([A.count(A_unique[i]) for i in range(N_unique))])

M = A_unique-K
if M <= 0:
	print(0)
	exit()

ans = 0
for i in range(0,M):
	ans += a_sort[i]
print(ans)
Problem p02909 (python)

Fixed submission:
"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

S = input()

if S == 'Sunny':
  ans = 'Cloudy'
elif S == 'Cloudy':
  ans = 'Rainy'
else:
  ans ='Sunny'
  
print(ans)

Buggy submission (verdict: Runtime Error):
"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

S = input()

if S == 'Sunny':
  ans = 'Cloudy'
elif S == 'Cloudy':
  ans = Rainy
else:
  ans ='Sunny'
  
print(ans)
Problem p03087 (python)

Fixed submission:
import numpy as np

N, Q = map(int,input().split())
S = str(input())
A = [list(map(int,input().split())) for i in range(Q)]

"""
import random
base_list = ['A', 'T', 'C', 'G']
S = ''
N = int(1e5)
Q = 1
A = [[100, 900]]
for i in range(N):
  S += random.choice(base_list)
"""

L_cnt = np.zeros(N-1)
R_cnt = np.zeros(N-1)

for i in range(N-2):
  L_cnt[i+1] = (S[i:i+2] == 'AC')
  R_cnt[i+1] = (S[N-2-i:N-i] == 'AC')

#print(L_cnt)
#print(R_cnt)
  
n_whole = S.count('AC')
L_cumsum = np.array(L_cnt).cumsum()
R_cumsum = np.array(R_cnt).cumsum()
for i in range(Q):
  ans = n_whole - (L_cumsum[A[i][0]-1] + R_cumsum[N-A[i][1]])
  print(int(ans))
  




"""
## 題意を愚直に表したもの（~10^10の計算量）
for i in range(Q):
  word = S[A[i][0]-1:A[i][1]]
  word_remove = word.replace('T', '').replace('G', '')
  ans = word_remove.count('AC')
  print(ans)
"""

Buggy submission (verdict: Runtime Error):
import numpy as np

N, Q = map(int,input().split())
S = str(input())
A = [list(map(int,input().split())) for i in range(Q)]

L_cnt = np.zeros(N-1)
L_cnt[0] = 0
L_str = S[0]
R_cnt = np.zeros(N-1)
R_cnt[0] = 0
R_str = S[N-1]

for i in range(N-2):
  L_str = L_str + S[i+1]
  L_cnt[i+1] = L_cnt[i] + (L_str[-2:] == 'AC')
  R_str = S[N-2-i] + R_str
  R_cnt[i+1] = R_cnt[i] + (R_str[:2] == 'AC')
  #print(i, L_str)
  #print(i, R_str)

#print(L_cnt)
#print(R_cnt)
  
n_whole = S.count('AC')
for i in range(Q):
  ans = n_whole - (L_cnt[A[i][0]-1] + R_cnt[N-A[i][1]])
  print(int(ans))
  




"""
## 題意を愚直に表したもの（~10^10の計算量）
for i in range(Q):
  word = S[A[i][0]-1:A[i][1]]
  word_remove = word.replace('T', '').replace('G', '')
  ans = word_remove.count('AC')
  print(ans)
"""
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]

xyh_hNonzero = sorted(xyh, reverse=True, key=lambda x:x[2])[0]

for cx in range(101):
  for cy in range(101):
    h = abs(xyh_hNonzero[0] - cx) + abs(xyh_hNonzero[1] - cy) + xyh_hNonzero[2]
    for i in range(N):
      if xyh[i][2] == 0:
        if abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) < h:
          break
      elif abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2] != h:
        break
    else:
      print(' '.join(map(str, [cx,cy,h])))
      exit()
else:
  raise Exception('aaa!!!')

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]

xyh_hNonzero = sorted(xyh, reverse=True, key=lambda x:x[2])[0]

for cx in range(101):
  for cy in range(101):
    h = abs(xyh_hNonzero[0] - cx) + abs(xyh_hNonzero[1] - cy) + xyh_hNonzero[2]
    for i in range(N):
      if xyh[i][2] == 0 and abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) < h:
        break
      if abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2] != h:
        break
    else:
      print(' '.join(map(str, [cx,cy,h])))
      exit()
else:
  raise Exception('aaa!!!')

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]

for cx in range(101):
  for cy in range(101):
    h = abs(xyh[0][0] - cx) + abs(xyh[0][1] - cy) + xyh[0][2]
    for i in range(1, N):
      if abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2] != h:
        break
    else:
      print(' '.join(map(str, [cx,cy,h])))
      exit()
else:
  raise Exception('aaa!!!')
Problem p03436 (python)

Fixed submission:
from copy import deepcopy
from collections import deque
from itertools import chain

dire = [(0,1),(1,0),(0,-1),(-1,0)]

H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(list(input()))
S_initial = deepcopy(S)

    
def bfs():
    S[0][0] = "#"
    dq = deque() ## (y, x, dist from start)
    dq.append((0,0,0))
    while dq:
        y,x,d = dq.popleft()
        if d > H*W:
          break
        for dy,dx in dire:
            ny = y + dy; nx = x + dx
            if ny < 0 or ny > H-1 or nx < 0 or nx > W-1:
                continue
            if (ny,nx) == (H-1,W-1):
                return d+1
            if S[ny][nx] == ".":
                dq.append((ny,nx,d+1))
                S[ny][nx] = "#"
    return -1

dist = bfs()
if dist == -1:
  print(-1)
else:
  S_flatten = list(chain.from_iterable(S_initial))
  cnt_dot = S_flatten.count('.') - (dist+1)
  print(cnt_dot)

Buggy submission (verdict: Runtime Error):
from copy import deepcopy
from collections import deque
from itertools import chain

dire = [(0,1),(1,0),(0,-1),(-1,0)]

H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(list(input()))
S_initial = deepcopy(S)

    
def bfs():
    S[0][0] = "#"
    dq = deque() ## (y, x, dist from start)
    dq.append((0,0,0))
    while dq:
        y,x,d = dq.popleft()
        for dy,dx in dire:
            ny = y + dy; nx = x + dx
            if ny < 0 or ny > H-1 or nx < 0 or nx > W-1:
                continue
            if (ny,nx) == (H-1,W-1):
                return d+1
            if S[ny][nx] == ".":
                dq.append((ny,nx,d+1))
                S[ny][nx] = "#"

dist = bfs()
S_flatten = list(chain.from_iterable(S_initial))
cnt_dot = S_flatten.count('.') - (dist+1)
print(cnt_dot)
Problem p03472 (python)

Fixed submission:
import numpy as np

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

swing = sorted([AB[i][0] for i in range(N)], reverse=True)
throw = sorted([AB[i][1] for i in range(N)], reverse=True)

cnt = 0

if throw[0] > swing[0]:  ## 投げて強いものは（最後に）投げる
  big_throw = [throw[i] for i in range(N) if throw[i] > swing[0]]
  throw_cumsum = np.array(big_throw).cumsum()
  for i in range(len(big_throw)):
    if H - throw_cumsum[i] <= 0:
      print(i+1)
      exit()
  else:
    cnt += len(throw_cumsum)
    H -= throw_cumsum[-1]

## 残りは全部（最初に）切る
cnt += ((H + (swing[0]-1)) // swing[0])
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

swing = sorted([AB[i][0] for i in range(N)], reverse=True)
throw = sorted([AB[i][1] for i in range(N)], reverse=True)

## 投げて強いものは（最後に）投げる
big_throw = [throw[i] for i in range(N) if throw[i] > swing[0]]
throw_cumsum = np.array(big_throw).cumsum()
for i in range(len(big_throw)):
  if H - throw_cumsum[i] <= 0:
    print(i+1)
    exit()
else:
  cnt = len(throw_cumsum)
  H -= throw_cumsum[-1]

## 残りは全部（最初に）切る
cnt += ((H + (swing[0]-1)) // swing[0])
print(cnt)
Problem p03480 (python)

Fixed submission:
S = input()

## 0を基準として、0と1の境目を調べる
boundary = []
pre_state = '0'
for i in range(len(S)):
  if S[i] != pre_state:
    boundary.append(i)
    pre_state = S[i]
else:
  if S[-1] == '1':
    boundary.append(len(S))
    
if len(boundary) == 0:
  print(len(S))
  exit()
    
## 答えは、端から一番遠い境目
lst = []
for i in range(len(boundary)):
  lst.append(max(boundary[i], len(S)-boundary[i]))
ans = min(lst)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()

## 0を基準として、0と1の境目を調べる
boundary = []
pre_state = '0'
for i in range(len(S)):
  if S[i] != pre_state:
    boundary.append(i)
    pre_state = S[i]
else:
  if S[-1] == '1':
    boundary.append(len(S))
    
## 答えは、端から一番遠い境目
lst = []
for i in range(len(boundary)):
  lst.append(max(boundary[i], len(S)-boundary[i]))
ans = min(lst)
print(ans)
Problem p03485 (python)

Fixed submission:
###==================================================
### import
import bisect
from collections import Counter, deque, defaultdict
from copy import deepcopy
from fractions import gcd
from functools import reduce
from heapq import heappush, heappop
import itertools
import math
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout

### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
###---------------------------------------------------


a, b = iInM()
ans = math.ceil((a + b) / 2)
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = math.ceil((a + b) / 2)
print(ans)
Problem p03501 (python)

Fixed submission:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N, A, B = iInM()

ans = min(A * N, B)

print(ans)

Buggy submission (verdict: Runtime Error):
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N, A, B = iInM()

ans = min(A * N, B)

pritn(ans)
Problem p03555 (python)

Fixed submission:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

C = sInLV(2)

b1 = C[0][0] == C[1][2]
b2 = C[0][1] == C[1][1]
b3 = C[0][2] == C[1][0]

ans = 'YES' if b1 and b2 and b3 else 'NO'

print(ans)

Buggy submission (verdict: Runtime Error):
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

C = sInLD(2)

b1 = C[0][0] == C[1][2]
b2 = C[0][1] == C[1][1]
b3 = C[0][2] == C[1][0]

ans = 'YES' if b1 and b2 and b3 else 'NO'