akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

class Bipartite{
public:
    vector<vector<int>> path;
    vector<int> res;
    Bipartite(int n,vector<vector<int>> &path):path(path){
        res.resize(n);
        fill(all(res),-1);
    }
    
    bool judge(){
        return dfs(this->path,this->res,0,0);
    }
    bool dfs(vector<vector<int>>& path,vector<int>&res,int now,int color){
        res[now]=color;
        REP(i,path[now].size()){
            int next=path[now][i];
            if(res[next]==color){
                return false;
            }
            if(res[next]==-1&&!dfs(path,res,next,1-color)){
                return false;
            }
        }
        return true;
    }
};

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    vector<vector<int>> path(n);
    REP(i,m){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        path[a[i]].push_back(b[i]);
        path[b[i]].push_back(a[i]);
    }
    Bipartite bp(n, path);
    if(bp.judge()){
        int cw=0,cb=0;
        REP(i,n){
            if(bp.res[i]==0){
                cw++;
            }else if(bp.res[i]==1){
                cb++;
            }
        }
        put((ll)cw*cb-m);
    }else{
        put((ll)n*(n-1)/2-m);
    }
    return 0;
}


Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int const MAXN=220000;
int N;
int a[MAXN];
unordered_map<int,set<int>> b;

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	cin>>N;
	rep(i,0,N) cin>>a[i];

	rep(i,0,N) b[a[i]].insert(i);

	int res=0;
	per(k,0,31) {
		int x=1<<k;
		rep(i,0,N) if (a[i]!=-1 && a[i]<x && b.count(x-a[i])) {
			b[a[i]].erase(i);

			auto &bb=b[x-a[i]];
			while (!bb.empty() && a[*bb.begin()]==-1) bb.erase(bb.begin());
			if (!bb.empty()) {
				int j=*bb.begin();
				bb.erase(bb.begin());
				a[i]=-1;
				a[j]=-1;
				res++;
			}

			if (a[i]!=-1) b[a[i]].insert(i);
		}
	}
	cout<<res<<"\n";
}


Measured memory_bytes: 28104
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int n=s.nextInt();
		double[] v=new double[n];
		String[] str=new String[n];
		for(int i=0;i<n;i++){
			v[i]=s.nextDouble();
			str[i]=s.next();
		}
		s.close();
		double num=0;
		for(int i=0;i<str.length;i++){
			if(str[i].equals("JPY")){
				num +=v[i];
			}else{
				num +=v[i]*380000.0;
			}
		}
		System.out.println(num);

	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(0,c-(a-b))<<endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;
#define int ll
template<typename T_n>
inline T_n rAccumulate(T_n input) {
    const int l = input.size();
    T_n v(l);
    v[l - 1] = input[l - 1];
    for (int i = l - 2; i >= 0; i--) {
        v[i] = v[i + 1] + input[i];
    }

    return v;
}

signed main() {
    int N; cin >> N;
    vi A(N), B(N), C(N);

    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    sort(ALL(A)); sort(ALL(B)); sort(ALL(C));

    //dptable作る Bについてのみで良い　累積和取る
    vi dp(N);

    for (int i = 0; i < N; i++) {
        //B[i]をベースにC[i]についてUpperBoundかける
        auto iter = upper_bound(ALL(C), B[i]);
        if (iter == C.end()) {
            dp[i] = 0;
        }
        else {
            int dist = distance(iter, C.end());
            dp[i] = dist;
        }
    }
    dp = rAccumulate(dp);
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        auto iter = upper_bound(ALL(B), A[i]);
        if (iter == B.end()) {
            ans += 0;
        }
        else {
            int index = distance(B.begin(), iter);
            ans += dp[index];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4992
// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
    
int main()
{
  	int Nmax = 100000;
    char S[4];
    char T[4];
    int N;
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;

/*  
    // int型スタック
    stack<int> stack;   
    stack.push(777);
    stack.push(778);
    stack.push(779);
  
	int tmpsl = stack.top();  // LAST要素の参照
 // 	int tpmsf = stack.back(); // FIRST要素の参照
 //	printf("%d %d \n",tmpsl,tmpsf);
    stack.pop();// LAST要素の削除（取出しではない）
 // 	if( stack.empty() == true) printf("empty stack\n");
     
    // int型キュー
    queue<int> que;
  	que.push(999);
  	que.push(998);   
  	que.push(997);    
  	int tmpqs = que.front(); // FIRST要素の参照
  	int tmpqe = que.back();  // LAST要素の参照
 //	printf("%d %d \n",tmpqs,tmpqe);
  	que.pop();  // FIRST要素の削除（取出しではない）
  //	if( que.empty() == true) printf("empty que\n");
    
    // ２次元座標を扱うキュー
    queue<XY> xyque; // ２次元座標型変数のキュー
  	XY p; 
  	xyque.pop();	// FIRST要素の削除。キューが空のときは削除が予約されて次のPOPが即削除される
  	xyque.push( XY(5,5) );
    xyque.push( XY(5,5) );
   	p = xyque.front();  // FIRST要素からのコピー
 // 	printf("%d %d\n", p.first, p.second);
  	
    
  que.back();
  //  sort(&(que.front()), &(que.back()));
  */  
      
    // 入力読込
    // 文字列
 //   scanf("%s", S);   
//    scanf("%s", T);   
    
    
    
    // 数字
    int A,B;
    scanf("%d %d", &A,&B);

    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
    int total = 1;
    int count = 0;
    while(total < B){
        total = (total + A) - 1;
        count++;    
    }
    
    
  
    
    
   printf("%d",count);
    
  
  return 0;
   
}

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

int main(){
    char field[6][11];
    char a='a';
    for(int i=1; i < 7; i++){
        for(int j=1; j < 6; j++){
            field[j][i] = a;
            a++;
        }
    }
    field[2][6] = '.'; field[3][6] = '?'; field[4][6] = '!'; field[5][6] = ' ';

    string input;
    while(cin >> input){
        string ans;
        bool isCorrect = true;
        if(input.size()%2 == 1) {
            isCorrect = false;
        }
        else {
            for(int i=0; i < input.size(); i+=2){
                int n = atoi(input.substr(i, 1).c_str());
                int m = atoi(input.substr(i+1, 1).c_str());
                if(!(1 <= m && m <= 5 && 1 <= n && n <= 6)) isCorrect = false;
                ans += field[m][n];
            }
        }
        if(isCorrect) cout << ans << endl;
        else cout << "NA" << endl;
    }
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <unordered_map>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<pair<T, T> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

bool is_palindrome(string &s) {
	int i = 0; 
	int j = s.size() - 1;
	while (i < j) {
		if (s[i] != s[j]) {
			return false;
		}

		++i;
		--j;
	}

	return true;
}

int main() {

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

	string s;
	cin >> s;

	int sz = s.size();
	string sub1 = s.substr(0, (sz - 1) / 2);
	string sub2 = s.substr((sz + 3) / 2 - 1, sz - (sz + 3) / 2 + 1);
	
	if (is_palindrome(s) && is_palindrome(sub1) && is_palindrome(sub2)) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);

    for (int i = 0; i < m; ++i) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    auto it = lower_bound(a.begin(), a.end(), x);
    int p = distance(a.begin(), it);
    cout << min({p, m-p}) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

struct SegmentTree{
	private:
		int n;
		vector<int> node;

	public:
		SegmentTree(vector<int> v){
			int sz = v.size();
			n = 1;while(n < sz)n *= 2;
			node.resize(2 * n - 1,INF);

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

		void update(int x, int val){
			x += n - 1;
			node[x] = val;
			while(x > 0){
				x = (x - 1) / 2;
				node[x] = min(node[2 * x + 1],node[2 * x + 2]);
			}
		}
		//要求区間[a,b)中の要素の最小値
		int getmin(int a,int b,int k = 0,int l = 0,int r = -1){
			if(r < 0)r = n;
			if(r <= a || b <= l)return INF;
			if(a <= l && r <= b)return node[k];

			int vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
			int vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
			return min(vl,vr);
		}
		void print(){
			for(int i = n - 1; i < 2 * n - 1; i++) {
				cout << i - n - 1 << " " << node[i] << endl;
			}
		}

};

int main(){
	int n,m;cin>>n>>m;
	string s;cin>>s;
	vector<int> x(n + 2,-1);
	SegmentTree seg(vector<int> (n + 2,INF));
	seg.update(n,0);
	for(int i = n - 1; i >= 0; i--) {
		if(s[i] == '1')continue;
		int t = seg.getmin(i + 1,min(n + 1,i + m + 1));
		seg.update(i,t + 1);
	}
	// seg.print();
	vector<int> dist;
	for(int i = 0; i <= n; i++) {
		dist.pb(seg.getmin(i,i + 1));
	}
	int pos = dist[0];
	int tmp = 1;
	vector<int> ans;
	if(pos >= INF){
		cout << -1 << endl;
		return 0;
	}
	for(int i = 1; i <= n; i++) {
		if(pos > dist[i]){
			ans.pb(tmp);
			pos = dist[i];
			tmp = 1;
		}
		else{
			tmp++;
		}
	}
	for(int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}

	
	return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000003
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >

ll mulmod(ll, ll);
ll fastpower(ll, ll);
void getprime(vector<bool>&);
void getfact(vector<ll>&, vector<ll>&);
ll ncr(ll, ll, vector<ll>&, vector<ll>&);

void solve()
{
    ll n, m, k, res = 0;
    string s, t;
    cin>>s>>t;
    for(ll i=0;i<t.size();i++)
    {
        if(s[i] != t[i])
            res++;
    }
    cout<<res;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();        
    }
    return 0;
}

ll mulmod(ll a, ll b)
{
    ll res = 0; 
    a = a % MOD;
    while(b > 0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
 
        a = (a * 2) % MOD; 
        b /= 2;
    } 
    return res % MOD; 
}

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a = (a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
    fact[0] = 1;
    ifact[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
    {
        fact[i] = (fact[i-1] * i)%MOD;
        ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
    }
}

ll ncr(ll n, ll r, vector<ll>&fact, vector<ll>&ifact)
{
    ll res;
    res = (((fact[n] * ifact[r]) % MOD) * ifact[n-r]) % MOD;
    return res;
}


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

using namespace std;

const int INF = 1e9;
const int N = 1e4;
const int MOD = 998244353;
const double EPS = 1e-6;

const double PI = acos(-1);




int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    long long a, b, c;
    cin >> a >> b >> c;
    long long x = c * c - 2 * c * (a + b) + (a + b) * (a + b);
    if (c <= a + b) {
        cout << "No";
        return 0;
    }
    if (x > 4 * a * b)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque

N,M=map(int, sys.stdin.readline().split())
#edge=[ map(int, sys.stdin.readline().split()) for _ in range(M) ]   #辺
al=[ [] for _ in range(N+1) ]   #隣接リスト
rev_al=[ [] for _ in range(N+1) ]   #戻りを調べる用の隣接リスト
edge=[] #辺の集合
for _ in range(M):
    a,b,c=map(int, sys.stdin.readline().split())
    al[a].append(b)
    rev_al[b].append(a) #逆向きにも辺を張る
    edge.append((a,b,c))


go=[0 for _ in range(N+1)]
back=[0 for _ in range(N+1)]

#頂点１からNに行くまでに使用する頂点を調べる
q=deque()
q.append(1) #スタート地点
go[1]=1

while q:
    fro=q.popleft()
    for to in al[fro]:
        if go[to]==0:
            go[to]=1
            q.append(to)


#頂点Nから1に戻る際に使用する頂点を調べる
q=deque()
q.append(N) #スタート地点
back[N]=1

while q:
    fro=q.popleft()
    for to in rev_al[fro]:
        if back[to]==0:
            back[to]=1
            q.append(to)


new_edge=[]     #有効な辺のみ抽出

for a,b,c in edge:
    if go[a]==1 and back[b]==1:
        new_edge.append((a,b,c))


#ベルマンフォード
dp=[ float("-inf") for _ in range(N+1) ]
dp[1]=0

for i in range(N):
    for fro,to,cost in new_edge:
        alt=dp[fro]+cost
        if dp[to]<alt:
            if i==N-1:
                print float("inf")
                quit()
            dp[to]=alt

print dp[N]

Measured memory_bytes: 34024
/*
*@Author  Chand Vachhani
*/

#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define vi          vector<int>
#define vii         vector<vector<int>>
#define pii         pair<int,int>
#define mii         map<int,int>
#define pb          push_back
#define pf          push_front
#define mp(a,b)          make_pair((a),(b))
#define vpii        vector<pair<int,int>>
#define fo(i,l,n)   for(int i{l}; i<n; i++)
#define rf(s)       for(auto &c : s)
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define PI          3.141592653589
#define sz(x)       (int)x.size()
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007  

using namespace std;

int dp[3005][3005];

signed main(){
    tezz
   
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int L=n-1; L>=0; L--){
        for(int R=L; R<n; R++){
            if(L==R)dp[L][R]=a[L];
            else dp[L][R]=max(a[L]-dp[L+1][R] , a[R]-dp[L][R-1]);
        }
    }
    // for(int i=0; i<n; i++){
    //     for(int j=0; j<n; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << dp[0][n-1] ;
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    vector<ll> a(3*n);
    rep(i,3*n) cin>>a[i];
    sort(all(a));
    ll ans=0;
    for(int i=n;i<3*n;i+=2) ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

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

#define REP(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define REPE(i, n) for (int i = (int)(0); i <= (int)(n); ++i)
#define REPR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define REPRE(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using ll = long long;

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

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

    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n,m;
int sum[5003][5003];
int x[5003],y[5003];
vector<int> comp(int *a) {
    vector<int> vec;
    rep(i,n) vec.pb(a[i]);
    sort(all(vec));
    vec.erase(unique(all(vec)),vec.end());

    return vec;
}
int conv(vector<int> &vec,int x) {
    return lower_bound(all(vec),x)-vec.begin();
}
int main() {
    cin>>n>>m;
    rep(i,n) {
        cin>>x[i]>>y[i];
    }
    vector<int> comp_x=comp(x);
    vector<int> comp_y=comp(y);

    rep(i,n) {
        //printf("%d %d -> ",y[i],x[i]);
        int nx=conv(comp_x,x[i]);
        int ny=conv(comp_y,y[i]);
        //printf("%d %d\n",ny,nx);
        sum[ny+1][nx+1]++;
    }

    rep(i,comp_y.size()+1) rep(j,comp_x.size()+1) if(i&&j) {
        sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
    }

    rep(i,m) {
        int x1,x2;
        int y1,y2;
        cin>>x1>>y1>>x2>>y2;
        x1=conv(comp_x,x1);
        x2=conv(comp_x,x2+1);
        y1=conv(comp_y,y1);
        y2=conv(comp_y,y2+1);
        printf("%d\n",sum[y2][x2]-sum[y2][x1]-sum[y1][x2]+sum[y1][x1]);
    }

    return 0;
}

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

using namespace std;
const int OO = 0x3f3f3f3f;
//const long long OO = (long long) 5e18+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(long long i = a ; i < n ; ++i)
#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)
#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef   long long ll;
typedef   unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

using namespace std;
ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);


int N;
vi h;
int mem[100005];






int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
//#ifndef ONLINE_JUDGE
//   freopen( "output.txt" , "w" , stdout ) ;
//   freopen( "input.txt" , "r" , stdin ) ;
//#endif

    cin >> N;
    h.resize(N);
    lp(i,0,N) cin >> h[i];
    --N;
    lp(i,0,N) mem[i] = 1000000000;
    mem[N] = 0;
    lpr(i,N,1){
        if(i>0){
            mem[i-1] = min(mem[i-1],abs(h[i]-h[i-1])+mem[i]);
        }
        if(i>1){
            mem[i-2] = min(mem[i-2],abs(h[i]-h[i-2])+mem[i]);
        }

    }
    cout << mem[0];


    return 0;
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

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

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

    int N;
    cin >> N;
    vector<int> a(N + 1);
    FOR(i, 1, N + 1) cin >> a[i];

    vector<int> x(N + 1);
    vector<int> b;
    RFOR(i, 1, N + 1) {
        int s = 0;
        for (int j = 2 * i; j <= N; j += i) {
            s += x[j];
        }
        x[i] = (a[i] + s) % 2;
        if (x[i]) {
            b.push_back(i);
        }
    }
    int M = b.size();
    cout << M << endl;
    REP(i, M) {
        cout << b[i] << (i == M - 1 ? '\n' : ' ');
    }
    cout << flush;
    return 0;
}



Measured memory_bytes: 3192
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>
#include<x86intrin.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nDigit,int N){      //nDigitは想定される最大桁数
    char *buf,*ptr;

    buf=(char*)malloc( (N*(nDigit+2)) * sizeof(char) );
    my_gets(buf,N*(nDigit+2),stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int CmpInt(const void *a, const void *b){        //b-aを返す(qsortなら降順)
    return *((int*)b)- *((int*)a);
}

#define MAXOF(a,b)  ( ((a)>(b)) ? (a) : (b) )
#define MINOF(a,b)  ( ((a)<(b)) ? (a) : (b) )

#define ISDBG 0

void MoveChild(const int *BeforeState, int *AfterState, const char *S){
    int N=strlen(S);

    memset(AfterState, 0, N*sizeof(int));
    for(int j=0; j<N; j++){
        if(S[j] == 'L'){
            AfterState[j-1] += BeforeState[j];
        }
        else if(S[j] == 'R'){
            AfterState[j+1] += BeforeState[j];
        }
    }
}


int main(){
    int N;
    char S[100000+1];
    int ChildState[3][100000]={{0}, {0}, {0}};
    int Answer[100000]={0};

    my_gets(S, sizeof(S)/sizeof(char), stdin);
    N = strlen(S);

    int mode='R';
    int cnt=0;
    for(int i=0;i<N;){
        int l_cnt=0,r_cnt=0,p;

        while(S[i] == 'R'){r_cnt++; i++;}
        p=i;
        while(S[i] == 'L'){l_cnt++; i++;}
        Answer[p] = r_cnt/2 + (l_cnt - (l_cnt/2));
        Answer[p-1]   = l_cnt/2 + (r_cnt - (r_cnt/2));
    }

    for(int i=0;i<N;i++)
        printf("%d ",Answer[i]);
    puts("");

    return 0;
}

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

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

using namespace std;

typedef pair<int,int> Paint;

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007


/*
確認ポイント
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
length(),size()に括弧をつけ忘れてないか;
sort()が使える型//vector,string...
YesNo大文字小文字間違えてないか
cout << fixed << 小数計算//正しい小数表記になる(基本6桁)(e記法回避にも使える)
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
*/
int main(){
  int n;cin>>n;
  vector<int> a(n);
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  int nw = 1;
  int mx = 0;
  for(int i = 1; n > i; i++){
    if(a[i-1] >= a[i]){
      nw++;
    }else{
      mx = max(nw,mx);
      nw = 1;
    }
    //cout << nw << " " << mx << endl;
  }
  mx = max(nw,mx);
  cout << mx-1 << endl;
}




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

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<float>> x(n, vector<float>(d));

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < d; j++) {
            cin >> x.at(i).at(j);
        }
    }

    int count = 0;

    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            float dis = 0;
            for ( int k = 0; k < d; k++)
            {
                dis += pow(x.at(i).at(k) - x.at(j).at(k), 2);
            }
            dis = sqrt(dis);
            if(dis == int(dis)){
                count++;
            }

        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N, M;
  cin >> N >> M;
  vector<int> ok(N);
  int ans1 = 0;
  vector<int> memo(N);
  int ans2 = 0;
  for (int i = 0; i < M; i++) {
    int a;
    string b;
    cin >> a >> b;
    if (ok.at(a - 1) == 0 && b == "WA") {
      memo.at(a - 1)++;
    }
    else if (ok.at(a - 1) == 0 && b == "AC") {
      ans1++;
      ans2 += memo.at(a - 1);
      ok.at(a - 1) = 1;
    }
  }
  cout << ans1 << " " << ans2 << endl;
}
     

Measured memory_bytes: 4008
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(n)]
li = sorted(li, key=lambda x:x[0])
cnt = 0
coin = 0
for a,b in li:
    c_cnt = cnt + b
    if c_cnt < m:
        cnt += b
        coin += a*b
    else:
        cnt += b-(c_cnt - m)
        coin += a*(b-(c_cnt-m))
        break
print(coin)

Measured memory_bytes: 29796
a5=[i**5 for i in range(300)]
x=int(input())
flag=0
for i in range(300):
  for j in range(300):
    if flag==0 and a5[i]-a5[j]==x:
      print(str(i)+" "+str(j))
      flag=1
    if flag==0 and a5[i]+a5[j]==x:
      print(str(i)+" -"+str(j))
      flag=1
      

Measured memory_bytes: 9192
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>vector<T> vec(int len, T elem) { return vector<T>(len, elem); } // auto dp = vec(52, vec(103, vec(103, INF)));
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>inline int popcount(T a) {return __builtin_popcount(a);}
template<class T>inline T emod(T a, T p) { return (a%p + p) % p;}
//-------------------
int h, w;
vector<string> s;
constexpr int MX = 3005;

int V;
struct Edge {
    int to;
    int cost;
};

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


int main() {
    cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15);
    cin >> h >> w;

    int C[2]; cin >> C[0] >> C[1]; C[0]--; C[1]--;
    int D[2]; cin >> D[0] >> D[1]; D[0]--; D[1]--;

    s.assign(h, "");
    rep(i, h) {
        cin >> s[i];
    }

    auto onfield = [&](int y, int x) {
        bool ans = true;
        if(y < 0 or h <= y) ans = false;
        if(x < 0 or w <= x) ans = false;
        return ans;
    };

    auto dp = vec(h, vec(w, INF));
    deque<pair<PII, int>> dq;
    dq.push_front({{C[0], C[1]}, 0});

    while(!dq.empty()) {
        auto [at, d] = dq.front(); dq.pop_front();
        if(dp[at.first][at.second]!=INF) continue;
        dp[at.first][at.second] = d;

        for(int i=-2; i<=2; i++) {
            for(int j=-2; j<=2; j++) {
                if(i==0 and j==0) continue;
                auto ni = at.first + i, nj = at.second + j;
                if(onfield(ni, nj) and s[ni][nj]=='.') {
                    if(abs(i)+abs(j) <= 1) {
                        dq.push_front({{ni, nj}, d});
                    } else {
                        dq.push_back({{ni, nj}, d+1});
                    }
                }
                
            }
        }
    }

    if(dp[D[0]][D[1]]!=INF) cout << dp[D[0]][D[1]] << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 9504
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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やllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  vector<string> S(2);
  for(int i=0; i<2; i++){
    cin >> S[i];
  }
  int now = 0;
  bool side;
  ll ans = 0;
  if(S[0][now] != S[1][now]){
    now += 2;
    ans = 6;
    side = true;
  }else{
    now++;
    ans = 3;
    side = false;
  }
  while(now<N){
    if(S[0][now] != S[1][now]){
      if(side){
        ans *= 3;
      }else{
        ans *= 2;
      }
      ans %= mod;
      side = true;
      now += 2;
    }else{
      if(!side){
        ans *= 2;
        ans %= mod;
      }
      side = false;
      now++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int len = Integer.parseInt(sc.nextLine());
		int sum = 0;
		String s = sc.nextLine();
		for(int i = 0; i <= len - 2; i++) {
			//System.out.println(i);
			//System.out.println(s.substring(i, i + 1));
			//System.out.println(s.substring(i + 1, i + 2));
			if(s.substring(i, i + 1).equals(s.substring(i + 1, i + 2))) {
				sum += 1;
			}
		}
		System.out.println(len - sum);

	}

}

Measured memory_bytes: 34636
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>

bool f(std::vector<intmax_t>& a) {
  std::sort(a.rbegin(), a.rend());
  intmax_t n = a.size();
  a[0] -= n;
  for (size_t i = 1; i < a.size(); ++i) ++a[i];
  std::sort(a.begin(), a.end());

  return !std::all_of(a.begin(), a.end(), [=](auto x) { return x < n; });
}

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<intmax_t> a(n);
  for (auto& ai: a) scanf("%jd", &ai);

  if (std::all_of(a.begin(), a.end(), [=](auto x) { return x < intmax_t(n); }))
    return puts("0"), 0;

  intmax_t res = 0;
  while (true) {
    intmax_t s = 0;
    for (size_t i = 0; i < n; ++i)
      s += a[i] / n;

    auto b = a;
    for (size_t i = 0; i < n; ++i) {
      b[i] += (s-b[i]/n) - (b[i]/n)*n;
    }

    if (std::any_of(a.begin(), a.end(), [=](auto x) { return x >= intmax_t(n); })) {
      a = std::move(b);
      res += s;
    } else {
      break;
    }
  }

  if (std::any_of(a.begin(), a.end(), [=](auto x) { return x >= intmax_t(n); })) {
    while (f(a)) ++res;
  }
  printf("%jd\n", res);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a,b) ((a)>(0)?(a):-(a))

int main(void){
    int N,M,X,B,C;
    B =0 ;
    C =0 ;
    scanf("%d %d %d",&N,&M,&X);
    for(int i =0; i<M;i++){
        int A[i];
        scanf("%d",&A[i]);
        if(A[i]>X){
            B++;
        }else{C ++;
        }}
        printf("%d",MIN(B,C));
    
    
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#define maxn 200100
#define INF 100000000
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	int s=1;
	int ans=0;
	while(s<b)
	{
		s+=a-1;
		ans++;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define rep2(x,from,to) for(int (x)=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
int ans;
int a[3];
int main()
{
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    while(a[0]<a[2]-1||a[1]<a[2]-1)
    {
        if(a[0]<a[2]-1)
        {
            a[0]+=2;
            ans++;
        }
        if(a[1]<a[2]-1)
        {
            a[1]+=2;
            ans++;
        }
    }
    if(a[0]==a[2]&&a[1]==a[2])cout<<ans<<endl;
    else if(a[0]!=a[2]&&a[1]!=a[2])cout<<ans+1<<endl;
    else cout<<ans+2<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
    String[] S  = new String[N];
    for (int i = 0; i < N; i++){
      S[i] = sc.next().strip();
    }
    int ans = 1;
    Arrays.sort(S);
    for(int i = 0; i < N-1;i++){
      if (!S[i].equals(S[i+1])){
        ans++;
      }
    }

    System.out.println(ans);

    
    
  }
}

Measured memory_bytes: 70080
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;


int main (){
    long long x,a,b;
    scanf("%lld %lld %lld",&x,&a,&b);
    if(0 >=  b-a){
        printf("delicious\n");
    }else if(b-a < x+1){
        printf("safe\n");
    }else{
        printf("dangerous\n");
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b=0;
  cin>>a;
  if(a==1)
    out(4);
    else if(a==2)
      out(4);
      else{
  rep1(i,1000010){
  if(a%2==0)
    a/=2;
    else
      a=3*a+1;
   if(a==1){
     b=i+2;
     break;
   }
   
  }
  out(b);
      }
}


Measured memory_bytes: 256
// Aizu Vol-1 0167: Bubble Sort
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);
char buf[100];

int a[105], *p1, *p2;

int main()
{
	int i, j, n, k, t;
	
	while (1) {
		gets(buf);
		if (!(n = atoi(buf))) break;
		for (i = 0, p1 = a; i < n; i++) { gets(buf); *p1++ = atoi(buf);	}
		for (k = 0, i = n-1; i > 0; i--) {
			for (j = 0, p1 = a, p2 = p1 + 1; j < i; j++, p1++, p2++) {
				if (*p1 > *p2) t = *p1, *p1 = *p2, *p2 = t, k++;
			}
		}
		printf("%d\n", k);
	}
	return 0;
}

Measured memory_bytes: 524
include Math

if __FILE__==$0
	inf=Float::INFINITY
	
	readln_i=lambda{|dl|gets.chomp.split(dl).map(&:to_i)}
	read_i=lambda{fp.gets.chomp.to_i}
	readln_s=lambda{|dl|fp.gets.chomp.split(dl)}
	read_s=lambda{fp.gets.chomp}
	
	num=readln_i[" "]
	a=(num[0]-num[1]).abs
	b=(num[0]-num[2]).abs
	if a<=b
		puts "A"
	else
		puts "B"
	end
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;



int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s,t;
        cin >> s >> t;
        int dp[1010][1010];
        for(int i = 0; i < 1010; i++){
            for(int j = 0; j < 1010; j++){
                dp[i][j] = 0;
            }
        }

        for(int i = 0; i < s.size(); i++){
            for(int j = 0; j < t.size(); j++){
                if(s[i] == t[j]){
                    dp[i+1][j+1] = dp[i][j] + 1;
                }else{
                    dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
                }
            }
        }
        cout << dp[s.size()][t.size()] << endl;

    }
}


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

/*

question is can we add some edges to get an connected graph
length n, k of the odd part
there will be (n-k)/2+k set after connected by a
we can at most add n/2 edges by b

so  n+k/2 <= n/2 + 1 so k<=2

if k=1 we always place the odd to the leftmost 
if k=2 1 leftmost 1 rightmost

we can generate b
a[0]+1, a[1] ... a[m-2], a[m-1]-1

*/

const int M=1e5+5;
const int MM=105;
int a[MM];


int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int cnt=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]&1) cnt++;
	}
	if(m==1)
	{
		if(n==1)
			printf("1\n1\n1\n");
		else
			printf("%d\n2\n%d %d\n",n,1,n-1);
		return 0;
	}
	if(cnt>=3)
	{
		printf("Impossible\n");
		return 0;
	}
	for(int i=0;i<m;i++)
	{
		if(a[i]&1)
		{
			swap(a[0],a[i]);
			break;
		}
	}
	for(int i=1;i<m;i++)
	{
		if(a[i]&1)
		{
			swap(a[i],a[m-1]);
			break;
		}
	}
	vector<int> vec;
	vec.push_back(a[0]+1);
	for(int i=1;i<m-1;i++)
		vec.push_back(a[i]);
	if(a[m-1]>1)
		vec.push_back(a[m-1]-1);
	for(int i=0;i<m;i++)
		printf("%d%c",a[i],i==m-1?'\n':' ');
	printf("%d\n",vec.size());
	m=vec.size();
	for(int i=0;i<m;i++)
		printf("%d%c",vec[i],i==m-1?'\n':' ');
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	long long ans=0,res=0;
	for(int i=0;i<s.length();i++)
	{
	   // cout<<s[i]<<'\n';
	    if(s[i]=='B')
	    {
	        ans++;
	    }
	    else{
	        res+=ans;
	       // ans=0;
	    }
	}
    cout<<res;
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f // -Wall
using namespace std;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

const int N = 100000 + 5;

int n, m, top;
LL a[N], b[N], c[N], t[N];

int getpos(int l, int r, LL x) {
	int ans = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (b[m] <= x) {
			ans = m;
			l = m + 1;
		} else r = m - 1;
	}
	return ans;
}

int main() {
	read(m), read(n);
	for (int i = 1; i <= n; i++) read(a[i]);
	b[top = 1] = m;
	for (int i = 1; i <= n; i++) {
		while (top && b[top] > a[i]) top--;
		b[++top] = a[i];
	}
	n = top;
	t[n] = 1;
	//for (int i = 1; i <= n; i++) printf("%d ", b[i]); printf("\n");
	for (int i = n; i > 1; i--) {
		LL k = b[i], pos = i;
		for (;;) {
			pos = getpos(1, pos - 1, k);
			if (pos == 0) break;
			t[pos] += (k / b[pos]) * t[i];
			k %= b[pos];
		}
		c[1] += t[i];
		c[k + 1] -= t[i];
	}
	c[0] = t[1];
	for (int i = 1; i <= m; i++) c[i] += c[i - 1];
	LL pos = min(b[1], (LL)m);
	for (int i = 1; i <= pos; i++) printf("%lld\n", c[i]);
	for (int i = pos + 1; i <= m; i++) puts("0");
	return 0;
}

Measured memory_bytes: 4864