akhauriyash/Code-Regression huggingface dataset:
def main():
    n = 6
    A = (100, 101, 102, 103, 104, 105)
    M = [10**6]*6
    K = int(input())
    dp = [[-1]*(K+1) for _ in range(n+1)]
    dp[0][0] = 0
    for i in range(n):
        for j in range(K+1):
            if dp[i][j] >= 0:
                dp[i+1][j] = M[i]
            elif j < A[i] or dp[i+1][j-A[i]] <= 0:
                dp[i+1][j] = -1
            else:
                dp[i+1][j] = dp[i+1][j-A[i]] - 1
    if dp[n][K] >= 0:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 44656
#include<iostream>
#include<string>
#include<queue>
using namespace std;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int board[100][100];

void init_board() {
    int i, j;
    for (i=0; i<100; i++) {
        for (j=0; j<100; j++) {
            board[i][j] = 0;
        }
    }
}
void put_block(int c, int d, int x, int y) {
    int i, j;
    int i_stop = d? 2+x: 4+x;
    int j_stop = d? 4+y: 2+y;
    for (i=x; i<i_stop; i++) {
        for (j=y; j<j_stop; j++) {
            board[i][j] = c;
        }
    }
}

string trace(int xs, int ys, int xg, int yg) {
    int x, y, nx, ny, i, c;
    queue<pair<int, int> > q;
    q.push(make_pair(xs, ys));
    c = board[xs][ys];
    if (c == 0) {
        return "NG";
    }
    board[xs][ys] = 0;
    while (q.size() > 0) {
        x = q.front().first;
        y = q.front().second;
        q.pop();
        if (x==xg && y==yg) {
            return "OK";
        }
        for (i=0; i<4; i++) {
            nx = x+dx[i];
            ny = y+dy[i];
            if (nx<0 || ny<0 || nx>=100 || ny>=100) {
                continue;
            }
            if (board[nx][ny] == c) {
                q.push(make_pair(nx, ny));
                board[nx][ny] = 0;
            }
        }
    }
    return "NG";
}

int main() {
    int w, h, xs, ys, xg, yg, n, c, d, x, y, i;
    while (true) {
        cin >> w >> h;
        if (w==0 && h==0) {
            break;
        }
        cin >> xs >> ys;
        cin >> xg >> yg;
        cin >> n;
        init_board();
        for (i=0; i<n; i++) {
            cin >> c >> d >> x >> y;
            put_block(c, d, x, y);
        }
        cout << trace(xs, ys, xg, yg) << endl;
    }

    return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int A, B;
string S;

int main(){
    cin >> A >> B >> S;

    string ans = "Yes";
    for(int i=0;i<A;i++){
        if(S[i] < '0' || '9' < S[i]){
            ans = "No";
            break;
        }
    }

    if(S[A] != '-') ans = "No";

    for(int i=A+2;i<A+B;i++){
        if(S[i] < '0' || '9' < S[i]){
            ans = "No";
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
ll d[5000][5000];

int main(){
    ll n,m;
    cin>>n>>m;
    rep(i,n)rep(j,n){
        if(i==j) d[i][j]=0;
        else d[i][j] = -INF;
    }
    ll a,b,c;
    rep(i,m){
        cin>>a>>b>>c;
        a--;
        b--;
        d[a][b]=c;
        // d[b][a]=c;
    }
    rep(k,n)rep(i,n)rep(j,n) d[i][j] = max(d[i][j],d[i][k]+d[k][j]);

    if(d[0][0]>0) cout<<"inf"<<endl;
    else cout<<d[0][n-1]<<endl;
    return 0;
}

Measured memory_bytes: 39936
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int N;
  cin >> N;

  int A[N+1];
  for(int i=0; i<N; ++i) {
    cin >> A[i];
  }

  sort(A, A+N);

  cout << A[N-1]-A[0] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  set<int> st;
  REP(i, N){
    cin >> A[i];
    st.insert(A[i]);
  }
  
  cout << st.size() << endl;
}

Measured memory_bytes: 3636
/* #                          */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
int x, y, a, b, c;
void sol() {
    cin >> x >> y >> a >> b >> c;
    vi A(a);
    vi B(b);
    vi C(c);
    for (auto& x : A)
        cin >> x;
    for (auto& x : B)
        cin >> x;
    for (auto& x : C)
        cin >> x;

    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());

    //for (auto& x : A)
    //    cout << x << " ";
    //cout << '\n';
    //for (auto& x : B)
    //    cout << x << " ";
    //cout << '\n';
    //for (auto& x : C)
    //    cout << x << " ";

    int Aidx(x - 1), Bidx(y - 1);
    for (int i = 0; i < c; i++) {
        char op;
        if (Aidx < 0 && Bidx < 0) break;
        else if (Aidx < 0) op = 'B';
        else if (Bidx < 0) op = 'A';
        else {
            if (A[Aidx] > B[Bidx]) op = 'B';
            else op = 'A';
        }

        if (op == 'B') {
            if (B[Bidx] < C[i]) {
                B[Bidx] = C[i];
                Bidx--;
            }
            else break;
        }
        else {
            if (A[Aidx] < C[i]) {
                A[Aidx] = C[i];
                Aidx--;
            }
            else break;
        }
    }

    ll sum(0);
    for (int i = 0; i < x; i++) sum += A[i];
    for (int i = 0; i < y; i++) sum += B[i];
    cout << sum << '\n';

}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);
    int T(1);
    while (T--)
        sol();


    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <time.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> > 
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

#define deb1(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
    FAST;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll c=0;
    ll cc=0;
    for(ll i=0;i<n;i++)
    {
        if(s[i]=='R')
            c++;
        else
            cc++;
    }
    if(c>cc)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

char s[101];


int main(){
  scanf("%s", s);

  for (int i = 0; s[i]; ++i)
  {
      s[i] = 'x';
      
  }

  puts(s);
  
   
  return 0;
}


Measured memory_bytes: 256
/*input
3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ld l; cin >> l;
    cout << fixed;
    cout << setprecision(20);
    cout << (l * l * l)/27;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    char c;
    vector<char> vow={'a','e','i','o','u'};
    cin>>c;
    if (find(vow.begin(),vow.end(),c)!=vow.end())
        cout<<"vowel\n";
    else
        cout<<"consonant\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e16;

lint dpL[200001][3], dpR[200001][3];
lint dp2[200001][3];
lint N, cnt = 0;
string s;
lint dp3[200001];

lint dfs(lint i) {
	if (dp3[i] != INF) return dp3[i];
	lint b_cnt = 0, curr = i;
	while (curr != 0) {
		if (curr % 2 == 1) b_cnt++;
		curr /= 2;
	}
	return dp3[i] = dfs(i % b_cnt) + 1;
}

int main() {
	cin >> N;
	cin >> s;
	REP(i, N) {
		if (s[i] == '1') cnt++;
	}
	
	REP(i, 3) {
		dpL[0][i] = 0;
		dpR[N][i] = 0;
	}
	REP(i, N) {
		if(cnt > 1) dpL[i + 1][0] = (dpL[i][0] * 2 + (s[i] - '0')) % (cnt - 1);
		dpL[i + 1][2] = (dpL[i][2] * 2 + (s[i] - '0')) % (cnt + 1);
	}
	if(cnt > 1) dp2[N][0] = 1 % (cnt - 1);
	dp2[N][2] = 1 % (cnt + 1);
	IREP(i, N) {
		if (cnt > 1) dp2[i][0] = (dp2[i + 1][0] * 2) % (cnt - 1);
		dp2[i][2] = (dp2[i + 1][2] * 2) % (cnt + 1);
	}
	IREP(i, N) {
		if (cnt > 1) dpR[i][0] = (dpR[i + 1][0] + (s[i] - '0') * dp2[i + 1][0]) % (cnt - 1);
		dpR[i][2] = (dpR[i + 1][2] + (s[i] - '0') * dp2[i + 1][2]) % (cnt + 1);
	}
	
	REP(i, N) {
		dp3[i] = INF;
	}
	
	dp3[0] = 0;
	REP(i, N + 1) {
		dfs(i);
	}
	REP(i, N) {
		if (s[i] == '0') {
			int a = (dpL[i + 1][2] * dp2[i+1][2] + dp2[i + 1][2] + dpR[i + 1][2]) % (cnt + 1);
			cout << dp3[a] + 1 << endl;
		}
		else {
			if (cnt == 1) {
				cout << 0 << endl;
			}
			else {
				int a = (dpL[i][0] * dp2[i][0] + dpR[i + 1][0]) % (cnt - 1);
				cout << dp3[a] + 1 << endl;
			}
		}
	}
}


Measured memory_bytes: 19332
N,M=map(int,input().split())
ans=[0]*N
SC=[0]*N
flag=0
flag2=0
for i in range(M):
    s,c=map(int,input().split())
    if s-1==0:
        flag2=1
    if SC[s-1]==1:
        if ans[s-1]!=c:
            flag=1
    else:
        SC[s-1]=1
        ans[s-1]=c

if flag2==0 and N!=1:
    ans[0]=1

if ans[0]==0 and N!=1:
    flag=1

if flag==0:
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <utility>
using namespace std;

int main(){
	long long N, K;
	cin >> N >> K;
	vector<long long> t(N);
	vector<long long> d(N);
	for(int i=0;i<N;i++){
		cin >> t[i] >> d[i];
	}
	vector<pair<long long, long long>> point(N);
	for(int i=0;i<N;i++){
		point[i].first = d[i];
		point[i].second = t[i];
	}
	sort(point.rbegin(), point.rend());
	vector<long long> used(N+1,0);
	long long ans = 0;
	long long sum = 0;
	long long count = 0;
	vector<long long> same;
	for(int i=0; i<K;i++){
		sum += point[i].first;
		if(!used[point[i].second]){
			used[point[i].second] = 1;
			++count;
		}
		else{
			same.push_back(point[i].first);
		}
	}
	ans = sum + count * count;
	for(int i = K;i<N && same.size();i++){
		if(used[point[i].second]) continue;
		used[point[i].second] = 1;
		count++;
		sum -= same.back();
		same.pop_back();
		sum += point[i].first;
		ans = max(ans, sum + count * count);
	}
	cout << ans << endl;
}

Measured memory_bytes: 4860
#include<bits/stdc++.h>
using namespace std;

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;



  
int main() {
  int N;
  cin >> N;
  int counter = 0;
  bool x = false;
  rep(i,N){
    int a,b;
    cin >> a>>b;
    if(a==b){
      counter++;
    }
    else{
      counter = 0;
    }
    
    if(counter==3){
      x = true;
    }
  }
  
  if(x){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
      
       





      
       







Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
const int MN = 101234;

int sz[MN], par[MN], sum[MN];
pair <int, int> d[MN];

int32_t main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d[i].F;
		d[i].S = i;
	}
	for (int i = 0; i < n; i++)
		sz[i] = 1;
	sort(d, d + n);
	for (int i = n - 1; i >= 1; i--) {
//		cerr << d[i].F << ' ' << d[i].F - n + 2 * sz[i] << endl;
		int pr = lower_bound(d, d + n, (pair <int, int>){d[i].F - n + 2 * sz[i], 0ll}) - d;
		if (pr >= i || pr == n || d[pr].F != d[i].F - n + 2 * sz[i])
			return cout << -1, 0;
		sz[pr] += sz[i];
		sum[pr] += sum[i] + sz[i];
		par[d[i].S] = d[pr].S;
	}
	if (sum[0] != d[0].F)
		return cout << -1, 0;
	for (int i = 1; i < n; i++)
		cout << par[d[i].S] + 1 << ' ' << d[i].S + 1 << endl;
}


Measured memory_bytes: 7496
#include<bits/stdc++.h>
using namespace std;
int main() 
{
	int n,q;
	cin>>n>>q;
    string s;
    cin>>s;
    vector<int> frq(n + 1, 0);
    for (int i = 0; i < n - 1; i++) 
    {
	    frq[i + 2] = frq[i + 1];
	    if (s[i] == 'A' && s[i + 1] == 'C') frq[i + 2]++;
	}
	  for (int i = 0; i < q; i++) 
      {
	    int l, r;
	    cin >> l >> r;
	    cout << frq[r] - frq[l] << '\n';
	  }
    
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    int n;
    cin >> n;
    vint a(n+2);
    a[0] = 0;
    FOR(i,1,n+1) cin >> a[i];
    a[n+1] = 0;

    int sum=0;
    REP(i,n+1){
        sum += abs(a[i]-a[i+1]);
    }
    FOR(i,1,n+1){
        // 123 321
        if((a[i-1]<=a[i] && a[i]<=a[i+1]) || (a[i+1]<=a[i] && a[i]<=a[i-1])){
            cout << sum << endl;
        // 132 231
        }else if((a[i-1]<=a[i+1] && a[i+1]<=a[i]) || (a[i]<=a[i+1]&&a[i+1]<=a[i-1])){
            cout << sum-2*abs(a[i]-a[i+1]) << endl;
        // 213 312
        }else{
            cout << sum-2*abs(a[i]-a[i-1]) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1664
N = int(input())
hs = [int(n) for n in input().split()]
# print(N, hs)

def mkgrp(level, hl):
    # is_in_grp = False
    grps = []
    grp_start = None
    for i, h in enumerate(hl):
        if grp_start == None:
            if h >= level:
                grp_start = i
        if grp_start != None:
            if h >= level:
                pass
            else:
                grps.append((grp_start, i-1))
                grp_start = None
    if grp_start != None:
        grps.append((grp_start, i))
    return grps

def ma():
    ans = 0
    for i in range(1, max(hs)+1):
        grps = mkgrp(i, hs)
        ans += len(grps)
    return ans

print(ma())


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    string s;
    Int k;
    cin >> s >> k;
    Int last = (Int)s.size() - 1;
    for (Int i = 0; i < last; i++) {
        char c = s[i];
        long diff = 'z' + 1 - c;
        if (c != 'a' && k >= diff) {
            cout << 'a';
            k -= diff;
        } else {
            cout << c;
        }
    }
    char c = s[last];
    Int x = c - 'a';
    c = (char)((x + k) % 26) + 'a';
    cout << c << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void) {
	int N;
	scanf("%d", &N);
	if (65 <= N && N <= 90) {
		printf("1\n");
	}
	else if (97 <= N && N <= 122) {
		printf("2\n");
	}
	else {
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v)  (v).begin() (v).end()
ll n, k;
bool check(ll x, std::vector<ll> &v)
{
    ll  moves = 0;
    for(auto i : v)
    {
        moves += i / x - (i % x == 0);
    }

    return moves <= k;

}
void solve()
{
    cin >> n >> k;
    std::vector<ll> v(n);
    ll ans = 0, mid, l = 1, r = 1e9;

    for(auto &i : v) cin >> i, ans = max(ans, i);
    r = ans + 1;
    while(l <= r)
    {
        mid = l + r >> 1;
        if(check(mid, v))
            ans = mid, r = mid - 1;
        else
            l = mid + 1;

    }
    cout << ans;

}



int main()
{


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    for(int i = 0; i < t; i++)
    {
        solve();
    }

}

Measured memory_bytes: 4724
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;


int main () {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d) cout << "Yes" << endl;
  else if (abs(a - b) <= d && abs(b - c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3640
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

num = []
prime_numbers = []

n = int(input())

for _ in range(n):
    i = int(input())
    num.append(i)

for i in num:
    if is_prime(i):
        prime_numbers.append(i)

print(len(prime_numbers))

Measured memory_bytes: 7952
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int start, end;
		boolean flag;
		String s;
		
		start = sc.nextInt();
		end = sc.nextInt();
		s = "";
		while (start + end != 0) {
			flag = true;
			System.out.print(s);
			for (int i = start; i <= end; i++) {
				if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
					System.out.println(i);
					flag = false;
				}
			}
			if (flag) {
				System.out.println("NA");
			}
			
			start = sc.nextInt();
			end = sc.nextInt();
			s = "\n";
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int k,x;
  cin >>k>>x;
  int i;
  cout << x-k+1;
  for( i=x-k+2; i<x+k; i++){
  	cout <<" "<< i ;
  }
  cout << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
a = list(map(int, input().split()))
anstable = [0] * (10 ** 6 + 1)
d = defaultdict(int)
for i in a:
    d[i] += 1

u = []
for i, v in d.items():
    if v == 1:
        u.append(i)
a = set(a)
for i in a:
    for j in range(i * 2, 10 ** 6 + 1, i):
        anstable[j] += 1

cnt = 0
for i in u:
    if anstable[i] == 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 169044
N = gets.to_i
a = gets.chomp.split
a_bubble = a.dup
a_select = a.dup
def bubble_sort(ary,num)
  flag = 1
  while flag == 1
    flag = 0
    for j in 1..num-1
      if ary[num-j][1] < ary[num-j-1][1]
        i = ary[num-j-1]
        ary[num-j-1] = ary[num-j]
        ary[num-j] = i
        flag = 1
      end
    end
  end
end
def selection_sort(ary,num)
  for i in 0..num-1
    minj = i
    for j in i..num-1
      if ary[j][1] < ary[minj][1]
        minj = j
      end
    end
    if minj != i
      k = ary[minj]
      ary[minj] = ary[i]
      ary[i] = k
    end
  end
end
def stable?(ary,s_ary)
  i = 1
  while i<= 9
    stack1 = []
    stack2 = []
    for j in 0..ary.length-1
      if ary[j][1] == "#{i}"
        stack1.push(ary[j])
      end
      if s_ary[j][1] == "#{i}"
        stack2.push(s_ary[j])
      end
    end
    if stack1 != stack2
      return "Not stable"
    end
    i += 1
  end
  "Stable"
end
bubble_sort(a_bubble,N)
selection_sort(a_select,N)
puts a_bubble.join(" ")
puts stable?(a,a_bubble)
puts a_select.join(" ")
puts stable?(a,a_select)

Measured memory_bytes: 8844
#include<iostream>

using namespace std;

int main(int argc, char* argv[])
{
  char a[1200];
    cin.getline(a, sizeof(a));
    for(int i=0;i<sizeof(a);i++)
    {
      if(a[i]=='\0')
      {
        cout << endl;
        break;
      } 
      if(islower(a[i])) a[i]=toupper(a[i]);
      else if(isupper(a[i])) a[i]=tolower(a[i]);
      cout << a[i];
  }
}

Measured memory_bytes: 3096
//https://atcoder.jp/contests/abc144/tasks/abc144_b
#include<bits/stdc++.h>
using namespace std;
#define aakriti long long int
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        aakriti a, flag = 0 ;
        cin >> a ;
        for(int i = 1 ; i < 10 ; i++)
        {
                for(int j = 1 ; j < 10 ; j++)
                {
                        if(i * j == a) flag = 1 ;
                }
        }
        if(flag) cout << "Yes\n";
        else cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> leng(n);
  for (int i=0;i<n;i++){
    cin >> leng[i];
  }
  int ans=0;
  for (int i=0;i<n;i++){
    for (int j=0;j<n;j++){
      for (int k=0;k<n;k++){
        if( leng[i] < leng[j]+leng[k] && leng[j] < leng[i]+leng[k] && leng[k] < leng[i]+leng[j] && leng[i] != leng[j] && leng[i] != leng[k] && leng[j] != leng[k]) ans++;
      }
    }
  }
  cout << ans/6 << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

const int mod = 1e9+7;
const long double pi = acos(-1);

// FOR DEBUGGING
// vector<string> vec_splitter(string s) {
// 	s += ',';
// 	vector<string> res;
// 	while(!s.empty()) {
// 		res.push_back(s.substr(0, s.find(',')));
// 		s = s.substr(s.find(',') + 1);
// 	}
// 	return res;
// }

// void debug_out(
// vector<string> __attribute__ ((unused)) args,
// __attribute__ ((unused)) int idx, 
// __attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
// template <typename Head, typename... Tail>
// void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
// 	if(idx > 0) cerr << ", ";
// 	else cerr << "Line(" << LINE_NUM << ") ";
// 	stringstream ss; ss << H;
// 	cerr << args[idx] << " = " << ss.str();
// 	debug_out(args, idx + 1, LINE_NUM, T...);
// }

// #ifndef XOX
// #define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
// #else
// #define debug(...) 42
// #endif

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int n;
	cin >> n;
	vector <int> cnt(n+1,0);
	rep0(i,n-1){
		int x;
		cin >> x;
		cnt[x]++;
	}
	rep1(i,n) cout << cnt[i] << "\n";

	return;
}

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
#define int long long 
using namespace std;
int read()
{
	char c;
	int w=1;
	while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
	int ans=c-'0';
	while((c=getchar())>='0'&&c<='9')ans=(ans<<1)+(ans<<3)+c-'0';
	return ans*w;
}
int a,b;
int c[1000005];
signed main(){
	a=read();
	b=read();
	for(int i=1;i<=b;i++)
	{
		c[i]=read();
	}
	sort(c+1,c+b+1);
	int maxx=0;
	for(int i=2;i<=b;i++)
	{
		maxx=max(maxx,c[i]-c[i-1]);
	}
	maxx=max(maxx,c[1]+a-c[b]);
	cout<<a-maxx<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
using namespace std;

#define MOD 1000000007

int n,d,s;
char k[10005];
int dp[10005][105];

int main(){

    cin>>(k+1)>>d;

    n=strlen(k+1);

    for(int i=1;i<=n;i++)
        k[i]-='0';

    for(int i=1;i<=n;i++){

        for(int r=0;r<d;r++){

            for(int c=0;c<10;c++){

                int rPred=(r-c+10*d)%d;

                dp[i][r]=(dp[i][r]+dp[i-1][rPred])%MOD;

            }

            for(int c=0;c<k[i];c++)
                if((s+c)%d==r)
                    ++dp[i][r];

        }

        s=(s+k[i])%d;
    }

    cout<<(dp[n][0]+(s==0)-1+MOD)%MOD;

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";

int main(){
    int h,w,k;
    std::cin >> h >> w >> k;
    std::vector<std::string> stage;
    rep(i,h){
        std::string s;
        std::cin >> s;
        stage.push_back(s);
    }

    int ans = 0;
    for(int bi=0; bi<(1<<h); bi++){
        for(int bj=0; bj<(1<<w); bj++){

            std::vector<std::string> s = stage;
            for(int i=0; i<h; i++){
                if(bi&(1<<i)){
                    for(int j=0; j<w; j++) s[i][j] = 'r';
                }
            }

            for(int j=0; j<w; j++){
                if(bj&(1<<j)){
                    for(int i=0; i<h; i++) s[i][j] = 'r';
                }
            }

            int cnt = 0;
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if(s[i][j]=='#') cnt++;
                }
            }

            if(cnt == k) ans++;
        }
    }

    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3600
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		h, _ := nextInt()
		w, _ := nextInt()

		if h == 0 || w == 0 {
			break
		}

		rectStr := ""
		for i := 0; i < h; i++ {
			if i == 0 || i == h-1 {
				rectStr += strings.Repeat("#", w) + "\n"
			} else {
				rectStr += "#" + strings.Repeat(".", w-2) + "#\n"
			}
		}
		fmt.Println(rectStr)
	}
}



Measured memory_bytes: 4952
#include <bits/stdc++.h>

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 200010;
const int Limit = 200000;
const int MOD = 1000000007;

int H, W;
int fac[MAXN], inv[MAXN];

int power(int x, int y)
{
	int ret = 1;
	while (y) {
		if (y & 1) ret = 1ll * ret * x % MOD;
		x = 1ll * x * x % MOD;
		y >>= 1;
	}
	return ret;
}

int C(int x, int y)
{
	if (x < y) return 0;
	return fac[x] * 1ll * inv[y] % MOD * inv[x - y] % MOD;
}

int main()
{
	fac[0] = 1;
	FOR(i, 1, Limit) fac[i] = 1ll * fac[i - 1] * i % MOD;

	inv[Limit] = power(fac[Limit], MOD - 2);
	DNF(i, Limit - 1, 0) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;

	in(H); in(W);
	int A, B; in(A); in(B);

	A = H - A + 1;

	int ans = 0;
	FOR(i, 1, A - 1)
		ans = (ans + C(B - 1 + i - 1, i - 1) * 1ll * C(H - i + W - B - 1, H - i)) % MOD;

	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;
int n;
string S[100];
int H[100], B[100];
string str;
set<string> se;
void func(int pos, int used) {
  if (pos == 4) {
    bool f = 1;
    REP(i, n) {
      int h=0,b=0;
      REP(j,4) {
        if (S[i][j]==str[j]) h++;
        if (used>>(S[i][j]-'0')&1) b++;
      }
      b -= h;
      if (H[i] != h || B[i] != b) {
        f = 0;
        break;
      }
    }
    if (f) se.insert(str);
    return;
  }
  REP(i, 10) {
    if (used>>i&1) continue;
    str[pos] = '0'+i;
    func(pos+1, used|1<<i);
  }
}
bool table[4][4];
bool func2(int pos, int used) {
  if (pos == 4) {
    memset(table, 0, sizeof(table));
    FOR(it, se) {
      int h=0,b=0;
      string t = *it;
      REP(j,4) {
        if (t[j]==str[j]) h++;
        if (used>>(t[j]-'0')&1) b++;
      }
      b -= h;
      if (table[h][b]) return 0;
      table[h][b] = 1;
    }
    return 1;
  }
  REP(i, 10) {
    if (used>>i&1) continue;
    str[pos] = '0'+i;
    if (func2(pos+1, used|1<<i)) return 1;
  }
  return 0;
}



int main() {
  while(cin >> n, n) {
    REP(i, n) {
      cin >> S[i] >> H[i] >> B[i];
    }
    se.clear();
    str = "0000";
    func(0,0);
    
    if(se.size() == 1) {
      cout << *se.begin() << endl;
    } else if(se.size() >= 2 && func2(0, 0)) {
      cout << str << endl;
    } else {
      cout << "????" << endl;
    }
    
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main(){
  int n;
  string s;
  cin >> n >> s;
  int cnt = 0;
  for(int i = 0;i<n-2;++i){
    if(s[i] =='A'){
      if(s[i+1] == 'B'){
        if(s[i+2] == 'C')  ++cnt;
      }
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    int n; cin >> n;
    map<string, int> mp;
    rep(i,n) {
        string s; cin >> s;
        mp[s]++;
    }

    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3636
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

vector<int> le, chan;
vector<II> res;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    if (n % 2) {
        FOR(i,1,n/2) res.push_back(II(i, n-i));
    }
    else {
        for (int i = 1; i < n / 2; i += 2) le.push_back(i);
        for (int i = 2; i < n / 2; i += 2) chan.push_back(i);

        int root = 1;
        FORE(i,SZ(le)-1,0) {
            res.push_back(II(root, root+le[i]));
            root++;
        }
        root = SZ(le) * 2 + 1;
        FORE(i,SZ(chan)-1,0) {
            res.push_back(II(root, root+chan[i]));
            root++;
        }
    }
    FOR(i,0,m-1) cout << res[i].FI << ' ' << res[i].SE << "\n";
    return 0;
}


Measured memory_bytes: 4528
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>


using namespace std;

int n;
int a[500000];

vector<long long> rad;

struct keks{
    int LR, p, id;
};

vector<keks> suffQ;
vector<keks> prefQ;

void res(int A, int B)
{
    int g = __gcd(A, B);
    if (A == B + g)
    {
        if (A + B < n)
            return;
    }
    int D = A - B;
    suffQ.push_back({A, D, rad.size()});
    prefQ.push_back({n - A, D, rad.size()});
    rad.push_back(0);
    long long ans = 0;
    int pos = 0;
}


long long sums[500000];
long long smus[500000];

int main()
{
    cin >> n;
    n--;
    for (int i = 0; i < n + 1; i++) cin >> a[i];
    for (int B = 1; B <= n; B++)
    {
        int x = n - B;
        for (int d = 1; d * d <= x; d++)
        {
            if (x % d == 0)
            {
                int amb = d;
                int A = amb + B;

                if (A > B)
                    res(A, B);

                amb = x / d;
                A = amb + B;

                if (A > B)
                    res(A, B);
            }
        }
    }
    sort(prefQ.begin(), prefQ.end(), [&](keks a, keks b) {
             return a.LR < b.LR;
         });
    sort(suffQ.begin(), suffQ.end(), [&](keks a, keks b) {
             return a.LR > b.LR;
         });
    /*for (int i = 0; i < prefQ.size(); i++)
    {
        cout << prefQ[i].LR << " " << prefQ[i].p << " " << prefQ[i].id << endl;
    }
    cout << endl;
    for (int i = 0; i < suffQ.size(); i++)
    {
        cout << suffQ[i].LR << " " << suffQ[i].p << " " << suffQ[i].id << endl;
    }
    cout << endl;*/
    int iq = 0;
    for (int i = 0; i < n + 1; i++)
    {
        for (int j = 1; j * j <= i; j++)
        {
            if (i % j == 0)
            {
                sums[j] += a[i];
                if (j * j != i)
                {
                    sums[i / j] += a[i];
                }
            }
        }
        while (iq < prefQ.size() && prefQ[iq].LR == i)
        {
            rad[prefQ[iq].id] += sums[prefQ[iq].p];
            iq++;
        }
    }
    iq = 0;
    for (int i = n; i > 0; i--)
    {
        for (int j = 1; j * j <= (n - i); j++)
        {
            if ((n - i) % j == 0)
            {
                smus[j] += a[i];
                if (j * j != (n - i))
                {
                    smus[(n - i) / j] += a[i];
                }
            }
        }
        while (iq < suffQ.size() && suffQ[iq].LR == i)
        {
            rad[suffQ[iq].id] += smus[suffQ[iq].p];
            iq++;
        }
    }
    cout << *max_element(rad.begin(), rad.end());
}


Measured memory_bytes: 51640
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = 99999999;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)

int main() {
    while(1){
        int m,nmin,nmax,p[201];
        cin >> m >> nmin >> nmax;
        if(m==0)break;
        for(int i=0;i<m; i++){
            cin >> p[i];
        }
        int ans=nmin,dmax=0;
        for(int i=nmin;i<=nmax;i++){
            if(p[i-1]-p[i]>=dmax){
                ans = i;
                dmax = p[i-1]-p[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3108
n=int(input())
sumt=(1+n)*n//2

def sum(x):
    xn=n//x
    if xn==0:
        return 0
    elif xn==1:
        return x
    else:
        return (x+x*xn)*xn//2

print(sumt-(sum(3)+sum(5)-sum(15)))

Measured memory_bytes: 9180
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int s1 = in.nextInt() - 1;
            int s2 = in.nextInt() - 1;
            int t1 = in.nextInt() - 1;
            int t2 = in.nextInt() - 1;
            String s = in.next();
            if (t1 == t2) {
                out.println("No");
                return;
            }
            if (!canMove(s, s1, t1) || !canMove(s, s2, t2)) {
                out.println("No");
                return;
            }
            if (t1 > t2) {
                if (!s.substring(s2 - 1, t2 + 2).contains("...")) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

        private boolean canMove(String s, int s1, int t1) {
            return !s.substring(s1, t1 + 1).contains("##");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25940
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

vector<vector<int>> G(4);
bool used[4];

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

bool flag = false;
void dfs(int v)
{

    bool f = false;
    for (int i = 0; i < (int)G[v].size(); ++i)
    {
        if (!used[G[v][i]])
        {
            used[G[v][i]] = true;
            dfs(G[v][i]);
            used[G[v][i]] = false;
            f = true;
        }
    }
    if (!f)
    {
        for (int i = 0; i < 4; ++i)
        {
            if (!used[i])
                return;
        }
        flag = true;
        return;
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    //cout << fixed << setprecision(15);

    for (int i = 0; i < 3; ++i)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    for (int i = 0; i < 4; ++i)
    {
        for (int i = 0; i < 4; ++i)
            used[i] = false;
        dfs(i);
    }
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {

  int H,W;
  cin >> H >> W;

  /* input data */
  char A[H][W];
  char OUT[H+2][W+2];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> A[i][j];
    }
  }
  
  /* make picture frame */
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      if((i>0)&&(i<H+1)&&(j>0)&&(j<W+1))
        OUT[i][j] = A[i-1][j-1];
      else
        OUT[i][j]='#'; 
    }
  }
  
  /* output data */
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      cout << OUT[i][j];
    }
    cout << endl;
  }  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int R[200000];
  for (int i = 0; i < n; i++) {
    cin >> R[i];
  }

  int maxv = -1000000000;
  int minv = R[0];
  for (int j = 1; j < n; j++) {
    maxv = R[j] - minv > maxv ? R[j] - minv : maxv;
    minv = R[j] < minv ? R[j] : minv;
  }

  cout << maxv << endl;

  return 0;
}


Measured memory_bytes: 3876
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<string, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> p(n);
    vector<P> v;
    for (int i = 0; i < n; i++)
    {
        cin >> s[i] >> p[i];
        p[i] *= -1;
        v.push_back(P(s[i], p[i]));
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (v[i].first == s[j] && v[i].second == p[j])
            {
                cout << j + 1 << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
C=[]
A=[]
for _ in range(N):
    c, *a = map(int, input().split())
    C.append(c)
    A.append(a)

ans=10**5*N+1
for maskN in range(1<<N):
  cost=0
  level=[0]*M
  for n in range(N):
    if (maskN>>n&1):
      cost+=C[n]
      for m in range(M):
        level[m] += A[n][m]
  for l in level:
    if l < X:
      break
  else:
    ans=min(ans, cost)
print(f'{ans if ans!=10**5*N+1 else "-1"}')


Measured memory_bytes: 9184
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0; i<n-2; i++){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m[100]={0},i,j,temp,k,a,b,x,y,z,p[100]={0};
	scanf("%d",&n);
	scanf("%d %d",&a,&b);
	scanf("%d",&k);
	for(i=0;i<n;i++){
		scanf("%d",&m[i]);
	}
	for(i=0;i<n;i++){
		for(j=n;j>i;j--){
			if(m[i]<m[j]){
				temp=m[i];
				m[i]=m[j];
				m[j]=temp;
			}
		}
	}
	x=k;
	z=a;
	for(i=0;i<n;i++){
		x=x+m[i];
		z=z+b;
		p[i]=x/z;
	}
		for(i=0;i<n;i++){
		for(j=n;j>i;j--){
			if(p[i]<p[j]){
				temp=p[i];
				p[i]=p[j];
				p[j]=temp;
			}
		}
	}
		printf("%d\n",p[0]);
return 0;
}

Measured memory_bytes: 596
N = int(input())
x = []
u = []
for i in range(N):
  X, U = map(str,input().split())
  x.append(float(X))
  u.append(U)
  
rate = 380000.0
ans = 0
  
for i in range(N):
  if u[i] == 'JPY':
    ans += x[i]
  else:
    ans += x[i] * rate
    
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;

const int MAX_SIZE = 2000000;
int A[MAX_SIZE];
int B[MAX_SIZE];
int C[MAX_SIZE];

void coutingSort(int a[], int n, int b[], int k) {
  int C[k];
  for (int i = 0; i < k; i++) {
    C[i] = 0;
  }

  for (int i = 0; i < n; i++) {
    C[a[i]]++;
  }

  for (int i = 1; i < k; i++) {
    C[i] += C[i-1];
  }

  for (int i = 0; i < n; i++) {
    b[C[a[i]]] = a[i];
    C[a[i]]--;
  }
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  coutingSort(A, n, B, 10000);
  for (int i = 1; i <= n; i++) {
    if (i > 1) cout << " ";
    cout << B[i];
  }
  cout << endl;
}



Measured memory_bytes: 18740