akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;


int main(){
    
    ll x,y; cin>>x>>y;
    
    if(x==0){
        if(y>0)cout<<y<<endl;
        else cout<<abs(y)+1<<endl;
        return 0;
    }
    
    if(y==0){
        if(x>0)cout<<x+1<<endl;
        else cout<<abs(x)<<endl;
        return 0;
    }
    
    if(x>y&&x>=0&&y>=0){
        cout<<abs(abs(x)-abs(y))+2<<endl;
    }else if(y>x&&x>=0&&y>=0){
        cout<<abs(x-y)<<endl;
    }else if(x>=0&&y<=0){
        cout<<abs(abs(y)-abs(x))+1<<endl;
    }else if(x<=0&&y>=0){
        cout<<abs(abs(y)-abs(x))+1<<endl;
    }else if(y>x&&y<=0&&x<=0){
        cout<<abs(y-x)<<endl;
    }else if(x>y&&x<=0&&y<=0){
        cout<<abs(abs(y)-abs(x))+2<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
    for(ll i : x) {
        cout << i << " ";
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vl A, B;
void input() {
    cin >> n;
    rep(i, n) {
        cin >> x;
        if(i % 2 == 0 && x % 2 == 1)
            ans++;
    }
}
void solve() { print(ans); }
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}

Measured memory_bytes: 3624
include Math

a, b, h, m = gets.to_s.split.map{|e|e.to_f}

r_k = h * 30 + 30 * (m / 60.0)
r_s = m * 6
r = (r_k - r_s).abs
r = [360, 360 -r].min

ans = ( a ** 2 + b ** 2 - 2 * a * b * cos( PI * r /180.0) ) ** 0.5

puts ans

Measured memory_bytes: 14816
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string S, T;
  cin >> S >> T;
  int NS = S.size();
  int NT = T.size();
  int answer = NT;
  rep(i, NS - NT + 1) {
    int same = 0;
    rep(j, NT) {
      if (S[i + j] == T[j]) same++;
    }
    answer = min(answer, NT - same);
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(b-a<=k && c-a<=k && d-a<=k && e-a<=k && c-b<=k && d-b<=k && d-c<=k && e-b<=k && e-c<=k && e-d<=k )
      cout<<"Yay!";
    else
        cout<<":(";
}



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

typedef long long ll;

const int N = 3e3 + 10;
ll a[N], dp[N][N][2];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++)
	{
		dp[i][i][0] = a[i];
		dp[i][i][1] = -a[i];
	}
	for (int t = 2; t <= n; t++)
	{
		for (int l = 1; l + t - 1 <= n; l++)
		{
			int r = l + t - 1;
			dp[l][r][0] = max(a[l] + dp[l + 1][r][1], a[r] + dp[l][r - 1][1]);
			dp[l][r][1] = min(-a[l] + dp[l + 1][r][0], -a[r] + dp[l][r - 1][0]);
		}
	}
	cout << dp[1][n][0];
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    ll N, K;
    cin >> N >> K;
    ll a[N];
    REP(i, N) cin >> a[i];
    ll b[N+1];
    b[0] = 0;
    REP(i, N) b[i+1] = b[i] + a[i];
    ll c[N+1];
    REP(i, N) c[i+1] = c[i] + max(a[i], 0ll);
    ll res = 0;
    REP(i,N-K+1){
        res = max(res, c[i]-c[0] + b[i+K]-b[i] + c[N] - c[i+K]);
        res = max(res, c[i]-c[0] + c[N] - c[i+K]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
char str[11000];
char in[11000];
int main(){
	int T;scanf("%d",&T);gets(in);
	while(T--){
		for(int i=0;i<11000;i++)str[i]=0;
		gets(str);
		int a;scanf("%d",&a);gets(in);
		int at=0;
		for(int i=0;i<a;i++){
			gets(in);
			if(in[0]=='f'){
				if(in[8]=='c'){
					if(str[at])at++;
				}else{
					while(str[at]==' ')at++;
					while(str[at]!=' '&&str[at])at++;
				}
			}
			if(in[0]=='b'){
				if(in[9]=='c'){
					at=max(0,at-1);
				}else{
					while(at&&str[at-1]==' ')at--;
					while(at&&str[at-1]!=' ')at--;
				}
			}
			if(in[0]=='i'){
				int n=strlen(str);
				int t=strlen(in)-9;
				for(int i=n;i>=at;i--){
					str[i+t]=str[i];
				}
				for(int i=0;i<t;i++)str[at+i]=in[8+i];
				at+=t;
			}
			if(in[0]=='d'){
				if(in[7]=='c'){
					if(str[at]){
						int n=strlen(str);
						for(int i=at;i<n;i++)str[i]=str[i+1];
					}
				}else{
					if(str[at]){
						int t=at;
						while(str[t]==' ')t++;
						while(str[t]!=' '&&str[t])t++;
						if(str[t-1]==' ')continue;
						int len=t-at;
						for(int i=0;str[at+i];i++){
							str[at+i]=str[at+len+i];
						}
					}
				}
			}
		/*	for(int j=0;j<at;j++)printf("%c",str[j]);
			printf("^");
			for(int j=at;str[j];j++)printf("%c",str[j]);
			printf("\n");*/
		}
		for(int i=0;i<at;i++)printf("%c",str[i]);
		printf("^");
		for(int i=at;str[i];i++)printf("%c",str[i]);
		printf("\n");
	}
}

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

int main()
{
    int n; long long total=0;
    cin>>n; long long pa,pb;
    for(int i=0; i<n; i++)
    {
        long long a,b;
        cin>>a>>b;
        if(total==0)
        {
            total+=a+b;
            pa=a; pb=b;
        }
        else
        {
            long long c=a,d=b;
            long long x=pa/a; if(pa%a!=0) x++;
            long long y=pb/b; if(pb%b!=0) y++;
            long long z=max(x,y);
            a=z*a; b=z*b;
            pa=a; pb=b;
        }
    }
    cout<<pa+pb<<endl;
    return 0;
}


Measured memory_bytes: 256
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

const int MNN = 333;

int a[MAXN];
int b[MAXN];
//int ans[MNN][MNN];
/*
int get(int a, int b, int c) {
	int sum = a + b + c;
	return sum - min({a, b, c}) - max({a, b, c});
}
*/
int tot;
int n;
bool f(int x) {
	for (int i = 0; i < tot; i++) {
		b[i] = (a[i] <= x ? 1 : 0);
	}
	int kek = n - 1;
	int l = kek;
	int r = kek;
	int dl = 0;
	int dr = 0;
	while(l > 0 && b[l] != b[l - 1]) {
		l--;
		dl++;
	}	
	while(r + 1 < tot && b[r] != b[r + 1]) {
		r ++;
		dr++;
	}
	if (l == 0 && r == tot - 1) {
		return ((n - 1) % 2) ^ b[kek];
	}
	if (dl < dr) {
		return b[l];
	} else {
		return b[r];
	}
}

int main() {
	#ifdef IZI_KATKA
	freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    n = readInt();
    tot = 2 * n - 1;
    for (int i = 0; i < tot; i++) {
    	a[i] = readInt() - 1;
    }
    int l = 0;
    int r = tot - 1;
	while(l < r) {
	cerr << l << r;
		int m = (l + r) / 2;
		if (f(m)) {
			r = m;
		} else {
			l = m + 1;
		}
	}
	cout << l + 1;
    return 0;
}

Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, s;

            var word = Console.ReadLine().Split(' ');

            N = int.Parse(word[0]);

            s = 0;

            for (int i = 1; i <= N; i++)
            {
                s += i;
            }

            Console.WriteLine(s);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
# -*- coding: utf-8 -*-
S = input()

max_raindays_in_row = 0
raindays_in_row = 0

for s in S:
    if s == 'R':
        raindays_in_row += 1
    else:
        if max_raindays_in_row < raindays_in_row:
            max_raindays_in_row = raindays_in_row
        raindays_in_row = 0
else:
    if max_raindays_in_row < raindays_in_row:
        max_raindays_in_row = raindays_in_row

print(max_raindays_in_row)

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

int main()
{
	int n,i,f,s=0;
	cin>>n;
	int a[n];
	
	for(i=1;i<=n;i++) cin>>a[i];
	
	do{
		f=0;
		for(i=1;i<=n;i++)
		{	
			if(a[i]%2==0)
			{			
				a[i]/=2;
			} 
			else
			{
				f=1;
				break;
			}
		}
		if(f==0) s++;
    }while(f==0);
    
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
  "use strict";
	const lines = input.split("\n");
  const line1 = lines[0].split(" ");
  let nums = line1.map(s => parseInt(s, 10));
  let a = nums.pop();
  let b = nums.pop();

  let n = 0;
  for (let i = 0; i < 2; i++) {
      n += a >= b ? a-- : b--;
  }
  console.log( n)
}
// Exec
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

char grid[2][3];

int main() {
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 3; j++) cin >> grid[i][j];
    }
    for (int i = 0; i < 3; i++) {
        if (grid[0][i] != grid[1][2 - i]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;


int dp[101][4][4][4];

int main() {
	int N;
	cin >> N;
	
	//長さ0の文字列は1である。
	//0,1,2に関する制約しかないので、
	//Sは、333Sと考えても問題がない。
	dp[0][3][3][3] = 1;

	int mod = 1'000'000'007;

	//文字列の文字数
	for (int len = 0; len < N; len++)
	{
		//最後から1文字目の文字
		for (int c1 = 0; c1 < 4; c1++)
		{
			//最後から2文字目の文字
			for (int c2 = 0; c2 < 4; c2++)
			{
				//最後から3文字目の文字
				for (int c3 = 0; c3 < 4; c3++)
				{
					//条件に当てはまるものがない場合はcontinue;
					if (dp[len][c1][c2][c3] == 0) continue;

					//新しく追加する文字
					for (int a = 0; a < 4; a++)
					{
						//ダメな5つの条件をカットする
						if (a == 2 && c1 == 1 && c2 == 0) continue;
						if (a == 2 && c1 == 0 && c2 == 1) continue;
						if (a == 1 && c1 == 2 && c2 == 0) continue;
						if (a == 2 && c1 == 1 && c3 == 0) continue;
						if (a == 2 && c2 == 1 && c3 == 0) continue;

						//ダメな条件を抜けたら、aを足した文字列が作れる

						// S = ...... c3 c2 c1
						// nextS = ...... c2 c1 a

						dp[len + 1][a][c1][c2] += dp[len][c1][c2][c3];
						dp[len + 1][a][c1][c2] %= mod;
					}
				}
			}
		}
	}

	int ans = 0;

	//長さNの全部の答えを纏める
	//最後から1文字目の文字
	for (int c1 = 0; c1 < 4; c1++)
	{
		//最後から2文字目の文字
		for (int c2 = 0; c2 < 4; c2++)
		{
			//最後から3文字目の文字
			for (int c3 = 0; c3 < 4; c3++)
			{
				ans += dp[N][c1][c2][c3];
				ans %= mod;
			}
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>


int n,q;

class Segtree{
  int size;//ノードのサイズ
  int n;//区間のサイズ
  vector<int>node;
  int INF;

public:
  void init(int n_){

    n=1;
    INF=(1<<31)-1;

    while(n<n_)n*=2;
    size=n*2-1;
    node.resize(size);

    rep(i,n)node[n-1+i]=INF;
    //cout<<n<<" "<<size<<endl;

    for(int i=n-2;i>=0;i--){
      node[i]=min(node[i*2+1],node[i*2+2]);
    }

  }

  Segtree(int n){
    init(n);
  }

  void update(int k,int x){
    k+=n-1;
    node[k]=x;
    while(k>0){
      k=(k-1)/2;
      node[k]=min(node[k*2+1],node[k*2+2]);
    }
    //cout<<endl;
    //rep(i,size){if(node[i]==INF)cout<<"NA ";else cout<<node[i]<<" ";}
    //cout<<endl;
  }

  int query(int a,int b,int l,int r,int k){
    if(r<=a || l>=b)
      return INF;
    if(l<=a&&b<=r)
      return node[k];

      int left=query(a,(a+b)/2,l,r,k*2+1);
      int right=query((a+b)/2,b,l,r,k*2+2);

      return min(left,right);
  }

  int find(int l,int r){
    return query(0,n,l,r,0);
  }

};

int main(){
  cin>>n>>q;
  Segtree seg(n);

  rep(i,q){
    int com,x,y;
    cin>>com>>x>>y;
    if(com==0){
      seg.update(x,y);
    }
    if(com==1){
      cout<<seg.find(x,y+1)<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3904
#include <iostream>
#include <algorithm>
using namespace std;
int n, m, v[100], w[100], dp[10007];
int main() {
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> v[i] >> w[i];
	for(int i = 1; i <= m; i++) {
		for(int j = 0; j < n; j++) {
			if(i >= w[j]) dp[i] = max(dp[i], dp[i - w[j]] + v[j]);
		}
	}
	cout << dp[m] << endl;
}

Measured memory_bytes: 3140
#include <stdio.h>
#include <string.h>
#include <math.h>


int main(void)
{
	int i,j,k;
	int n,m,p = 0,a[10000] = {0};

	scanf("%d", &n);
	
	for(i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}

	for(i = 0; i < n; i++)
	{
		if (a[i] == 2)
		{
			p++;

		}else if (a[i] % 2 != 0)
		{
			m = (int) ceil( sqrt(a[i]) );
		

			for(j = 2; j <= m; j++)
			{
				if (a[i] % j == 0)
				{
					break;

				}else if (j == m)
				{
					p++;
				}
			}
		}
	}

	printf("%d\n", p);


	return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main() {
    int a, b;
    cin >> a >> b;
 
    if ( (0 < a && a < 10) && (0 < b && b < 10) ) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int aa,bb,cc;
    aa=max({a,b,c});
    cc=max({a,b,c});
    bb=a+b+c-aa-cc;
    if((bb-cc)%2==0){
        cout<<(bb-cc)/2+(aa-bb)<<endl;
    }
    else{
        cout<<(bb-cc+1)/2+(aa-bb)+1<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{

  int a, b;
  
  scanf("%d %d", &a, &b);

  if(a < b){
    printf("a < b\n");
  } else if(a > b){
    printf("a > b\n");
  } else {
    printf("a == b\n");
  }

  return 0;
}
  

Measured memory_bytes: 580
from math import *
x,n=map(int,input().split())
p=[]
if n>0:
	p=[int(i) for i in input().split()]
mn=float('inf')
ans=-1
for i in range(-1,102):
	if not i in p:
		if abs(x-i) < mn:
			ans=i
			mn=abs(x-i)
print(ans)


Measured memory_bytes: 9184
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(min(a, x // 500) + 1):
    for j in range(min(b, (x - 500 * i) // 100) + 1):
        if c >= (x - 500 * i - 100 * j) // 50:
            ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

ll SGT[2097154];
ll s, t;

void Rupd(ll c, int k, int l, int r) {
	if (s <= l && r <= t) {
		SGT[k] = c;
		return;
	}
	if (t < l || r < s) {
		return;
	}

	Rupd(c, k * 2, l, (l + r) / 2);
	Rupd(c, k * 2 + 1, (l + r) / 2 + 1, r);
}

ll get1(int x) {
	if (x == 0)return SGT[x];
	return min(SGT[x], get1(x / 2));
}

int main() {
	ll N, Q, S, T, X, D, C = 0;
	for (int i = 0;i < 2097154;i++)SGT[i] = LLONG_MAX / 2;
	cin >> N >> Q;
	vector<ll> Za, VD(Q);
	vector<tuple<ll, ll, ll>> VX(N);
	for (int i = 0;i < N;i++) {
		cin >> S >> T >> X;
		Za.push_back(S - X);
		Za.push_back(T - X - 1);
		VX[i] = make_tuple(X, S - X, T - X - 1);
	}
	for (int i = 0;i < Q;i++) {
		cin >> D;
		Za.push_back(D);
		VD[i] = D;
	}
	sort(all(Za));
	map<ll, ll> Ma;
	Ma.insert({ Za[0],0 });
	for (int i = 1;i < Za.size();i++) {
		if (Za[i] != Za[i - 1]) {
			C++;
			Ma.insert({ Za[i],C });
		}
	}
	sort(all(VX));
	for (int i = N - 1;i >= 0;i--) {
		tie(X, s, t) = VX[i];
		s = Ma[s];
		t = Ma[t];
		//cout << X << " " << s << " " << t << endl;
		Rupd(X, 1, 0, 1048575);
	}
	for (int i = 0;i < Q;i++) {
		D = Ma[VD[i]];
		X = get1(D + 1048576);
		if (X == LLONG_MAX / 2)cout << -1 << endl;
		else cout << X << endl;
	}
}

Measured memory_bytes: 67944
#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 reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int d, n;
  cin >> d >> n;

  if (n == 100) {
    ll ans = pow(100, d) * n + pow(100, d);
    cout << ans << endl;
  } else {
    ll ans = pow(100, d) * n;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3784
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int[][] a = new int[N+1][];
		a[0]= new int[]{0,0,0};
		for(int i=1;i<a.length;i++){
			a[i]=nextInts();
		}

		String ans = "Yes";
		for(int i=1;i<a.length;i++){
			int rem=(a[i][0]-a[i-1][0]) -(Math.abs(a[i-1][1]-a[i][1]) + Math.abs(a[i-1][2]-a[i][2]));
			//iに到着した時の残りが偶数の場合は到着可能
			if(rem < 0 || rem%2==1){
				ans = "No";
				break;
			}
		}
		System.out.println(ans);
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 47392
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    set<string> s;
    string prev = "";
    //bool flag = true;
    vector<string> a;
    for(int i=0;i<n;i++){
        string x;
        cin>>x;
        a.push_back(x);
    }
    for(int i=0;i<n;i++){
        string x = a[i];
        
        if(i==0){
            s.insert(x);
            prev = x;
        }
        else{
            if(s.count(x)){
                cout<<"No\n";
                return 0;
            }
            int pl = prev.length();
            if(prev[pl-1]!=x[0]){
                cout<<"No\n";
                return 0;
            }
            prev = x;
            s.insert(x);
        }
    }
    cout<<"Yes\n";
    return 0;
}



Measured memory_bytes: 256
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N = input()

YesNo("7" in N)


Measured memory_bytes: 65540
import Data.List (transpose)
import Control.Applicative
import Control.Monad
mult :: Num a => [[a]] -> [[a]] -> [[a]]
mult a b' = let b = transpose b' in
    map (\l ->  map (sum . zipWith (*) l) b ) a

readMatrix :: Int -> IO [[Int]]
readMatrix n = map (map read .words) <$> replicateM n getLine

main = do
    [n,m,l] <- map read . words <$> getLine
    a <- readMatrix n
    b <- readMatrix m
    mapM_ (putStrLn . unwords . map show) $ mult a b

Measured memory_bytes: 12172
drops = {
    1: ((0,0,0,0,0), (0,0,1,0,0), (0,1,1,1,0), (0,0,1,0,0), (0,0,0,0,0)),
    2: ((0,0,0,0,0), (0,1,1,1,0), (0,1,1,1,0), (0,1,1,1,0), (0,0,0,0,0)),
    3: ((0,0,1,0,0), (0,1,1,1,0), (1,1,1,1,1), (0,1,1,1,0), (0,0,1,0,0))}

paper = [[0 for i in xrange(14)] for j in xrange(14)]

def solve(x, y, size):
    for i in xrange(5):
        for j in xrange(5):
            if drops[size][i][j] == 1:
                paper[y+i][x+j] += 1

while True:
    try:
        line = raw_input()
    except EOFError:
        break
    x, y, size = map(int, line.split(','))
    solve(x, y, size)

s = c = 0
for i in range(2, 12):
    for j in range(2, 12):
        if paper[i][j] == 0:
            c += 1
        if s < paper[i][j]:
            s = paper[i][j]

print c
print s

Measured memory_bytes: 5016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  vector<int> t(N);
  rep(i, N) cin >> s[i] >> t[i];
  string X;
  cin >> X;

  bool hoge = false;
  int ans = 0;
  rep(i, N) {
    if (hoge) {
      ans += t[i];
    } else if (s[i] == X) {
      hoge = true;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 764
main = do
    [n,k] <- ((fmap read . words) <$> getLine) :: IO [Int]
    _ <- getLine
    if k==2
        then print $ n-1
        else if n`mod`(k-1)==1
            then print $ n `div` (k-1)
            else print $ ceiling $ fromIntegral n/fromIntegral (k-1)


Measured memory_bytes: 18812
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
#define int long long
int gi() {
    char cc = getchar() ; int cn = 0, flus = 1 ;
    while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
    while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
    return cn * flus ;
}
const int P = 998244353 ; 
const int N = 400 + 5 ; 
int n, A[N], a[N][N], B[N], SA, SB, inv[N], fac[N], dp[N][N][N] ;
int fpow( int x, int k ) {
    int ans = 1, base = x ; 
    while( k ) {
        if( k & 1 ) ans = 1ll * ans * base % P ; 
        base = 1ll * base * base % P, k >>= 1 ; 
    } return ans % P ; 
}
int Dec( int x, int y ) {
    return ( x - y + P ) % P ; 
} 
signed main() 
{
    n = gi() ; 
    rep( i, 1, n ) A[i] = gi(), B[i] = gi() ; 
    rep( i, 1, n ) SA += A[i], SB += B[i] ; 
    fac[0] = inv[0] = 1 ; 
    rep( i, 1, SB ) fac[i] = fac[i - 1] * i % P, inv[i] = fpow( fac[i], P - 2 ) ;
    rep( i, 1, n ) rep( j, 0, SB ) a[i][j] = ( j == 0 ) ? 1 : a[i][j - 1] * A[i] % P ;
    dp[0][0][0] = -1 ; 
    rep( i, 1, n ) rep( j, 0, SA ) rep( k, 0, SB ) {
        dp[i][j][k] = dp[i - 1][j][k] ; 
        for( re int l = 0; l < B[i]; ++ l ) if( A[i] <= j && l <= k ) 
        dp[i][j][k] = Dec( dp[i][j][k], 1ll * dp[i - 1][j - A[i]][k - l] * a[i][l] % P * inv[l] % P ) ;
    }
    int Ans = 0 ;
    rep( j, 0, SA ) rep( k, 0, SB ) 
    Ans = ( Ans + SA * fpow( fpow( j, P - 2 ), k + 1 ) % P * dp[n][j][k] % P * fac[k] % P ) % P ;
    cout << Ans << endl ; 
    return 0 ; 
}

Measured memory_bytes: 515200
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

int main() {
    int n, tmp;
    cin >> n;
    int a[9];
    fill(a, a+9, 0);
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        if (tmp >= 3200) a[8]++;
        else a[tmp/400]++;
    }

    int ans = 0;
    for (int i = 0; i < 8; i++) {
        if (a[i] > 0) ans++;
    }

    if (ans == 0) {
        cout << 1 << " " << a[8] << endl;
    } else {
        cout << ans << " " << ans + a[8] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m,c[4002],k,i,j,x[2002];
	scanf("%d%d",&n,&m);
	for(i=1;i<=n*2;i++) c[i]=i; 
	for(i=1;i<=m;i++){
		scanf("%d",&k);
		if(k==0){
			for(j=1;j<=n*2;j++) x[j]=c[j];
			for(j=1;j<=n*2;j++){
				if(j%2==1) c[j]=x[j/2+1];
			}
			for(j=1;j<=n*2;j++){
				if(j%2==0) c[j]=x[n+j/2];
			}
		}
		if(k!=0){
			for(j=1;j<=k;j++) c[n*2+j]=c[j];
			for(j=k+1;j<=n*2+k;j++) c[j-k]=c[j];
		}
	}
	for(i=1;i<=n*2;i++) printf("%d\n",c[i]);
	return 0;
}

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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;
#define maxn 100

char image[maxn][maxn];

int main() {
    int h, w;
    cin >> h >> w;

    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            cin >> image[i][j];
        }
    }

    for(int i = 1; i <= 2 * h; ++i) {
        int ind = floor((ld)(i + 1) / 2);
        for(int j = 1; j <= w; ++j) {
            cout << image[ind][j];            
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,j,n) for (int i = j; n<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N,na,nb,cnt=0;cin>>N;
  vector<int> a(N),b(N),c(N);
  REP(i,0,N)cin>>a[i];
  REP(i,0,N)cin>>b[i];
  iota(c.begin(), c.end(), 1);
  //REP(i,0,N)print(c[i])
  do{
    cnt++;
    if(c==a)na=cnt;
    if (c==b)nb=cnt;
  }while(next_permutation(c.begin(), c.end()));
  print(abs(na-nb))

}


Measured memory_bytes: 256
from collections import defaultdict


def main():
    N = int(input())
    A = list(map(int, input().split()))
    cnt = defaultdict(int)
    ans = 0
    for i in range(N):
        ans += cnt[i - A[i]]
        cnt[A[i] + i] += 1
    print(ans)


if __name__ == "__main__":
    main()


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

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

    int M, K; cin >> M >> K;

    int M2 = 1 << M; // 2**M

    if (K >= M2 || (M == 1 && K == 1)) {
        cout << "-1" << endl;
        return 0;
    }
    if (M == 1 && K == 0) {
        cout << "0 0 1 1" << endl;
        return 0;
    }

    for (int a = 0; a < M2; a++) {
        if (a == K) continue;
        cout << a << " ";
    }
    cout << K << " ";
    for (int a = M2-1; a >= 0; a--) {
        if (a == K) continue;
        cout << a << " ";
    }
    cout << K << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
typedef long long llong;
using namespace std;

int main() {
	string s;
	cin>>s;
	
	llong ans=0,now=0;
	REP(i,(1<<(s.size()-1))){
		now=s[0]-'0';
		REP(j,s.size()-1){
			if(1&(i>>j)){
				ans+=now;
				now=s[j+1]-'0';
			}else{
				now*=10;
				now+=s[j+1]-'0';
			}
		}
		ans+=now;
	}
	
	cout<<ans<<endl;
}//解答参考.bit全探索.

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
 
typedef struct node * Node;
 
Node root;
void insert(int);
 
void inorder (Node);
void preorder (Node);
 
 
int main(){
 
  int n,num,i;
  char command[10];
 
  scanf("%d",&n);
 
  root = NULL;
  for(i = 0 ; i < n ; i++){
 
    scanf("%s",command);
 
    if(command[0] == 'i'){//insert
      scanf("%d",&num);
      insert(num);
    }
 
    else if(command[0] == 'p'){//print
      inorder(root);
      printf("\n");
 
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}
 
 
void insert( int z){
 
  Node y = NULL;
  Node x = root;
  Node k;
 
  k = malloc(sizeof(struct node));
 
  k -> key = z;
  k -> left = NULL;
  k -> right = NULL;
 
 
  while(x != NULL){
    y = x;
    if(k -> key < x->key){
      x = x->left;
    }
    else {
      x = x->right;
    }
  }
    k->parent = y;
    if(y == NULL)root = k;
    else if(k->key < y->key)y->left = k;
    else y->right = k;
}
 
 
void inorder (Node o){
  if(o->left != NULL)inorder(o->left);
  printf(" %d",o->key);
 
  if(o->right != NULL)inorder(o->right);
}
 
 
 
 
void preorder(Node o){
  printf(" %d",o->key);
 
  if(o->left != NULL)preorder(o->left);
  if(o->right != NULL)preorder(o->right);
}



Measured memory_bytes: 25208
// ADITYA JAIN

#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define nl printf("\n")
#define sp printf(" ")

typedef long long int lld;
typedef long double ldb;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

map <char, lld> mpp;

main(){
    lld n;
    cin >> n;
    string str;
    for(int i = 0; i < n; ++i){
        cin >> str;
        mpp[str[0]]++;
    }
    lld ans = 0;
    lld m = mpp['M'];
    lld a = mpp['A'];
    lld r = mpp['R'];
    lld c = mpp['C'];
    lld h = mpp['H'];
    vector <lld> vct = {m,a,r,c,h};
    for(int i = 0; i < vct.size(); ++i){
        for(int j = i+1; j < vct.size(); ++j){
            for(int k = j+1; k < vct.size(); ++k){
                ans += vct[i]*vct[j]*vct[k];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>
#include <boost/dynamic_bitset.hpp>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	int a, b, c;
	cin >> a >> b >> c;

	if (b - a == c - b) {
		cout << "YES" << "\n";
		return 0;
	}
	cout << "NO" << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
	string s;
	getline(cin, s);

	if (s.size() == 0) {
		getline(cin, s);
	}

	for_each(begin(s), end(s), [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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


	int N;
	cin >> N;

	int kari;
	for (int i = N; i > 0; i--) {
		kari = sqrt(i);
		if (kari * kari == i) break;
	}

	co(kari * kari);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//~ #define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7; 
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}


signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	
	int n, mod; cin >> n >> mod;
	n *= 3;
	
	static int dp[6010][10010] = {};
	const int md = 6005;
	
	auto inc = [&](int &a, int b) {
		a += b;
		if (a >= mod) a -= mod;
	};
	
	auto mul = [&](int64_t a, int64_t b) {
		return a*b%mod;
	};
	
	dp[n][md] = 1;
	for (int i = n-1; i >= 0; --i) {
		int le = -(n-i), ri = (n-i)/2;
		for (int j = le; j <= ri; ++j) {
			// cluster 1
			inc(dp[i][j+md], dp[i+1][j+md+1]);
			// cluster 2
			inc(dp[i][j+md], mul(dp[i+2][j+md-1], i+1));
			// cluster 3
			inc(dp[i][j+md], mul(dp[i+3][j+md], (i+1) * (i+2)));
		}
	}
	
	int ans = 0;
	for (int i = 0; i <= md; ++i) {
		inc(ans, dp[0][i]);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 233856
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count =0;
		int max =0;
		for (int i=0;i<s.length();i++) {
			if (s.charAt(i)=='A'||s.charAt(i)=='C'||s.charAt(i)=='G'||s.charAt(i)=='T') {
				count ++;
				if (max<count) {
					max = count;
				}
			} else {
				count =0;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 35616
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 400100;

int n, a, b, c, d;
char s[N];
bool can[4][N];

void bfs(int id, int start) {
	for (int i = 0; i < n; i++) {
		can[id][i] = false;
	}
	can[id][start] = true;
	for (int i = 0; i < n; i++) {
		if (s[i] == '#') {
			continue;
		}
		if (i - 1 >= 0) {
			can[id][i] |= can[id][i - 1];
		}
		if (i - 2 >= 0) {
			can[id][i] |= can[id][i - 2];
		}
	}
}

int main() {

	scanf("%d %d %d %d %d %s", &n, &a, &b, &c, &d, s);

	a--;
	b--;
	c--;
	d--;

	bfs(0, a);
	bfs(1, b);

	for (int i = 0; i < n; i++) {
		can[2][i] = false;
		can[3][i] = false;
	}

	can[2][c] = true;
	can[3][d] = true;

	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '#') {
			continue;
		}
		if (i + 1 < n) {
			can[2][i] |= can[2][i + 1];
			can[3][i] |= can[3][i + 1];
		}
		if (i + 2 < n) {
			can[2][i] |= can[2][i + 2];
			can[3][i] |= can[3][i + 2];
		}
	}

	if (!can[0][c] || !can[1][d]) {
		puts("No");
		exit(0);
	}

	if (d > c) {
		puts("Yes");
		exit(0);
	}

	for (int i = b + 1; i < n; i++) {
		if (i - 2 >= 0 && s[i] == '.' && s[i - 1] == '.' && s[i - 2] == '.' && can[1][i - 1] && can[0][i - 2] && can[2][i] && can[3][i - 1]) {
			puts("Yes");
			exit(0);
		}
	}

	puts("No");

	return 0;

}

Measured memory_bytes: 2600
#include <iostream>
#include<cstdio>

using namespace std;;

int main(void){
	for(int i = 1; i < 10; i++){
		for(int j = 1; j < 10; j++){
				printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 1096
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

using LL = long long;


signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int x;
    cin >> x;
    cout << x * 360 / __gcd(x, 360) / x << endl;
    

    return 0;
}

Measured memory_bytes: 3580
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
 
    public  static void main(String[] args)   throws Exception, IOException{
     
        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
     
        // int n=sc.nextInt();
        long N=sc.nextLong();
        
        lp:for (long n=1;n<=3500; n++) {
            for (long h=1;h<=3500; h++) {
                if( (4*h*n>N*(h+n)) && (N*n*h % (4*h*n-N*(h+n))) ==0){
                    long k=N*n*h / (4*h*n-N*(h+n));
                    out.println(n+" "+h+" "+k);
                    break lp;
                }
            }
        }

        // out.println(ans);
        out.flush();
    }
     
    static void db(Object... os){
     
        System.err.println(Arrays.deepToString(os));
     
    }
     
    static boolean validpos(int x,int y,int r, int c){
        
        return x<r && 0<=x && y<c && 0<=y;
        
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}
 
class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void init();
void insert(int);
int delete(int);
void deleteLast();
void deleteFirst();

typedef struct Node {
    int key;
    struct Node *next;
    struct Node *pre;
} Node;

Node *head;

int main() {
    int n;
    int size = 0;
    char command[15];
    int key;
    int i;

    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s", command);

        if (command[0] == 'i') {
            scanf("%d", &key);
            insert(key);
            size++;
        } else if (command[0] == 'd') {
            if(strlen(command) <= 6) {
                scanf("%d", &key);
                size -= delete(key);
            } else if (command[6] == 'F') {
                deleteFirst();
                size--;
            } else if (command[6] == 'L') {
                deleteLast();
                size--;
            }
        }
    }

    Node *node = head->next;
    while (1) {
        printf("%d", node->key);
        node = node->next;

        if (node == head) {
            printf("\n");
            break;
        } else {
            printf(" ");
        }
    }

    return 0;
}

void init() {
    head = (Node *)malloc(sizeof(Node));
    head->next = head;
    head->pre = head;
}

void insert(int key) {
    Node *node = (Node *)malloc(sizeof(Node));
    node->key = key;
    node->next = head->next;
    head->next->pre = node;
    head->next = node;
    node->pre = head;
}

int delete(int key) {
    Node *node = head->next;
    while (node != head && node->key != key) {
        node = node->next;
    }

    if (node == head) {
      return 0;
    }

    node->pre->next = node->next;
    node->next->pre = node->pre;
    free(node);
    return 1;
}

void deleteFirst() {
    Node *node = head->next;
    head->next = head->next->next;
    head->next->pre = head;
    free(node);
}

void deleteLast() {
    Node *node = head->pre;
    head->pre = head->pre->pre;
    head->pre->next = head;
    free(node);
}



Measured memory_bytes: 32972
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int main(){
    ll K,N;
    cin >> K >> N;
    vector<ll> a(N);
    REP(i,N){
        cin >> a[i];
    }
    ll b[2*N];
    sort(a.begin(),a.end());
    REP(i,2*N){
        if(i<N){
            b[i] =  a[i] - K;
        }
        else{
            b[i] = a[i-N];
        }
    }

    ll dist = INF;
    
    REP(i,N + 1){
        if(dist > b[i+N-1] - b[i]){
            dist = b[i+N-1] - b[i];
        }
    }
    cout << dist << endl;


}

Measured memory_bytes: 4992
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();



int32_t main(){
  fast;

  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);

  int n,x,y;
  cin >> n >> x >> y;
  vector<int>ans(n,0);

  FOR(i,1,n) {
    FOR(j,i+1,n) {
      int dis = min(j - i, abs(i - x) + 1 + abs(j - y));
      ans[dis]++;
    }
  }

  FOR(i,1,n-1)cout << ans[i] << "\n"; 


  time_p=clock()-time_p;
  cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define INF 1e9+7

int main() {
	string s;
	long long int k;
	long long int a=0;
	char c;
	cin >> s >> k;
	for (char i : s) {
		if (i == '1')
			a++;
		else {
			c = i;
			break;
		}
	}
	if (a >= k)
		cout << 1;
	else {
		cout << c;
	}

}


Measured memory_bytes: 256