Problem:
 Score : 400 points    Problem Statement There are N squares arranged in a row, numbered 1, 2, ..., N from left to right.
You are given a string S of length N consisting of . and # . If the i -th character of S is # , Square i contains a rock; if the i -th character of S is . , Square i is empty.  In the beginning, Snuke stands on Square A , and Fnuke stands on Square B .  You can repeat the following operation any number of times:   Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.   You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D .  Determine whether this is possible.      Constraints  4 \leq N \leq 200\ 000  S is a string of length N consisting of . and # .  1 \leq A, B, C, D \leq N  Square A , B , C and D do not contain a rock.  A , B , C and D are all different.  A < B  A < C  B < D         Input Input is given from Standard Input in the following format:  N  A  B  C  D  S       Output Print Yes if the objective is achievable, and No if it is not.        Sample Input 1 7 1 3 6 7
.#..#..      Sample Output 1 Yes  The objective is achievable by, for example, moving the two persons as follows. ( A and B represent Snuke and Fnuke, respectively.)  A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB       Sample Input 2 7 1 3 7 6
.#..#..      Sample Output 2 No       Sample Input 3 15 1 3 15 13
...#.#...#.#...      Sample Output 3 Yes

Solution (Python):

def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    A = int(buflist[1])-1
    B = int(buflist[2])-1
    C = int(buflist[3])-1
    D = int(buflist[4])-1
    buf = input()
    S = buf
    if D < C:
        space = 0
        for i in range(B-1, min(D+2, N)):
            if S[i] == '.':
                space += 1
                if space >= 3:
                    break
            else:
                space = 0
        if space < 3:
            print('No') 
            return
    rock_count = 0
    for i in range(A, max(C, D)+1):
        if S[i] == '
            rock_count += 1
            if rock_count >= 2:
                break
        else:
            rock_count = 0
    if rock_count >= 2:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Solution (Python):
N, A, B, C, D =  map(int, input().split())
S = input()
S = [False] + [s == '.' for s in S] + [False]
def check(s, t):
    i = s
    for _ in range(s, t+1):
        if i + 1 == t or i + 2 == t:
            return True
        if S[i+2]:
            i += 2
            continue
        if S[i+1]:
            i += 1
            continue
        return False

def checki(s, t):
    for i in range(s, t+1):
        if S[i-1] and S[i] and S[i+1]:
            return True
    return False



if A < B < D < C:
    if not check(B, D) or not check(A, C):
        print('No')
    elif checki(B, D):
        print('Yes')
    else:
        print('No')
else:
    if check(A, C) and check(B, D):
        print('Yes')
    else:
        print('No')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()

if C < D:
    flag = 1
    for i in range(A-1, C-1):
        if S[i+1] == "
            flag = 0
            break
    for i in range(B-1, D-1):
        if S[i+1] == "
            flag = 0
            break

else:
    flag = 1
    for i in range(A-1, C-1):
        if S[i+1] == "
            flag = 0
            break
    for i in range(B-1, D-1):
        if S[i+1] == "
            flag = 0
            break

    if flag == 1:
        flag = 0
        for i in range(B-2, D-1):
            if S[i+2] == "." and S[i+1] == "." and S[i] == ".":
                flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
	n,a,b,c,d = map(int,input().split())
	s = input()
	ans = ""
	if c < d:
		if s.count("
			ans = "No"
		else:
			ans = "Yes"
	else:
		if s.count("
			ans = "No"
		else:
			ans = "Yes"
	print(ans)
	return
main()

Solution (Python):
n,a,b,c,d=map(int,input().split())
s="."+input()
if(c>d):
    if("..." in s[b-1:d+2] and not "
        print("Yes")
    else:
        print("No")
else:
    if("
        print("No")
    else:
        print("Yes")

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    n,a,b,c,d = LI_()
    n += 1
    s = S()
    if d < c:
        f = 0
        for i in range(max(0,b-1), min(min(n-1,d), c-1)):
            if s[i:i+3] == '...':
                f = 1
                break
        if f == 0:
            return 'No'

    for i in range(a+1,c-1):
        if s[i:i+2] == '
            return 'No'
    for i in range(b+1,d-1):
        if s[i:i+2] == '
            return 'No'


    return 'Yes'


print(main())

Solution (Python):

(N,A,B,C,D) = (int(i) for i in input().split(" "))
S = input()

if "
	print("No")
else:
	if C < D:
		print("Yes")
	else:
		if "..." in S[max(0,B-2):min(D+1,N)]:
			print("Yes")
		else:
			print("No")

Solution (Python):
N, A, B, C, D = map(int, raw_input().split())
A -= 1
B -= 1
C -= 1
D -= 1
S = raw_input()

f1 = True
for i in range(A, C-1):
  if S[i]=="
    f1 = False

f2 = True
for i in range(B, D-1):
  if S[i]=="
    f2 = False

if C<D:
  f3 = True
else:
  f3 = False
  for i in range(B-1, D):
    if S[i]=="." and S[i+1]=="." and S[i+2]==".":
      f3 = True

if f1 and f2 and (C<D or f3):
  print "Yes"
else:
  print "No"

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if C == D:
    print("No")
elif C < D:
    for i in range(B, D):
        if S[i:i+2] == "
            print("No")
            exit()
    for i in range(A, C):
        if S[i:i+2] == "
            print("No")
            exit()
    print("Yes")
else:
    for i in range(B, D):
        if S[i:i+2] == "
            print("No")
            exit()
    for i in range(A, C):
        if S[i:i+2] == "
            print("No")
            exit()
    for i in range(B-2, D-1):
        if S[i:i+3] == "...":
            print("Yes")
            exit()
    print("No")

Solution (Python):
def solve(a, b, c, d, s):
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    ss = s[a:c + 1]
    fs = s[b:d + 1]
    if '
        return False

    if c < d:
        return True

    fs2 = s[b - 1:d + 2]
    if '...' in ss and '...' in fs2:
        return True

    return False


n, a, b, c, d = list(map(int, input().split()))
s = input()
print('Yes' if solve(a, b, c, d, s) else 'No')

Solution (Python):
def solve():
    N, A, B, C, D = map(int, input().split())
    S = input()
    for i in range(A - 1, C - 1):
        if S[i] == '
            return "No"
    for i in range(B - 1, D - 1):
        if S[i] == '
            return "No"
    if C < D:
        return "Yes"
    for i in range(B - 2, D - 1):
        if S[i] == '.' and S[i + 1] == '.' and S[i + 2] == '.':
            return "Yes"
    return "No"
print(solve())

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1
if "
    print('No')
else:
    if C<D:
        print('Yes')
    else:
        if "..." in S[B-1:D+2]:
            print('Yes')
        else:
            print('No')