Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n,a,b,c,d; cin >>n>>a>>b>>c>>d;
    a--;
    b--;
    c--;
    d--;
    string s; cin >> s;

    if (c < d) {
        
        for (int i = b+1; i < d+1; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                cout << "No" << endl;
                return 0;
            } 
        }
        for (int i = a+1; i < c+1; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                cout << "No" << endl;
                return 0;
            } 
        }
        cout << "Yes" << endl;
        return 0;

    } else {

        //bがdまでいけない
        for (int i = b+1; i <= d; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                cout << "No" << endl;
                return 0;
            } 
        }

        //aの前にbを動かすとき
        bool flag1 = true;
        int mx = 0;
        for (int i = b; i <= d;) {
            int j = i;
            int count = 0;
            if (s[j] == '.') {
                while (s[j] == '.') {
                j++;
                count++;
                }
            } else {
                j++;
            } 
            mx = max(mx, count);
            i = j;
        }
        //bを置く所あるかどうか
        if (mx < 3) {
            flag1 = false;
            if (mx == 2 && b+2<n && s[b-1] == '#' && s[b+1] == '.' && s[b+2] == '.') {
                flag1 = true;
            } 
        }
        //aがcまでいけない
        for (int i = a+1; i <= c; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                flag1 = false;
            }
        }

        //bの前にaを動かすとき
        bool flag2 = true;
        //aがcまでいけない
        s[b] = '#';
        for (int i = a+1; i <= c; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                flag2 = false;
            }
        }

        if (flag2 || flag1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }

        return 0;
    }
}



        }
        //aがcまでいけない
        for (int i = a+1; i <= c; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                flag1 = false;
            }
        }

        //bの前にaを動かすとき
        bool flag2 = true;
        //aがcまでいけない
        s[b] = '#';
        for (int i = a+1; i <= c; i++) {
            char c = s[i];
            if (s[i+1] == '#' && c == '#') {
                flag2 = false;
            }
        }

        if (flag2 || flag1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }

        return 0;
    }
}




Compiler output:
a.cc:117:9: error: expected declaration before '}' token
  117 |         }
      |         ^
a.cc:119:9: error: expected unqualified-id before 'for'
  119 |         for (int i = a+1; i <= c; i++) {
      |         ^~~
a.cc:119:27: error: 'i' does not name a type
  119 |         for (int i = a+1; i <= c; i++) {
      |                           ^
a.cc:119:35: error: 'i' does not name a type
  119 |         for (int i = a+1; i <= c; i++) {
      |                                   ^
a.cc:129:9: error: 's' does not name a type
  129 |         s[b] = '#';
      |         ^
a.cc:130:9: error: expected unqualified-id before 'for'
  130 |         for (int i = a+1; i <= c; i++) {
      |         ^~~
a.cc:130:27: error: 'i' does not name a type
  130 |         for (int i = a+1; i <= c; i++) {
      |                           ^
a.cc:130:35: error: 'i' does not name a type
  130 |         for (int i = a+1; i <= c; i++) {
      |                                   ^
a.cc:137:9: error: expected unqualified-id before 'if'
  137 |         if (flag2 || flag1) {
      |         ^~
a.cc:139:11: error: expected unqualified-id before 'else'
  139 |         } else {
      |           ^~~~
a.cc:143:9: error: expected unqualified-id before 'return'
  143 |         return 0;
      |         ^~~~~~
a.cc:144:5: error: expected declaration before '}' token
  144 |     }
      |     ^
a.cc:145:1: error: expected declaration before '}' token
  145 | }
      | ^