akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  ll n;
  cin >> n;
  ll plussum = 0;
  ll minussum = 0;
  ll plusans = 0;
  ll minusans = 0;
  rep(i,n){
    ll a;
    cin >> a;
    plussum += a;
    minussum += a;
    if(i % 2 == 0){
      if(plussum <= 0){
        plusans += abs(plussum - a - 1) - a;
        plussum = 1;
      }
      if(minussum >= 0){
        minusans += a + abs(minussum - a + 1);
        minussum = -1;
      }
    }
    else{
      if(plussum >= 0){
        plusans += a + abs(plussum - a + 1);
        plussum = -1;
      }
      if(minussum <= 0){
        minusans += abs(minussum - a - 1) - a;
        minussum = 1;
      }
    }
    //cout << plussum << " " << plusans << " " << minussum << " " << minusans << endl; 
  }
  cout << min(minusans,plusans) << endl;
}

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

#include <iostream>
#include <stdio.h>
#include <array>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

typedef double db;
typedef long long ll;
typedef pair<int, int> PII;

int a, b;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(i=(a);i<=(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REPP(i,n) FORR(i,0,n)
#define MAX(a,b) a>b? a:b
#define MIN(a,b) a>b? b:a


const int MOD = 1e9 + 7;
const ll INF=1e10;
const db PI = acos(-1.0);
const db EPS = 1e-10;


ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


ll MAXX(vector<ll> a,ll k) {
	ll max = 0;
	REP(i, k) {
		if (a[i] >= max) max = a[i];
	}
	return max;
}

ll MINN(vector<ll> a,ll k) {
	ll min = 1e10;
	REP(i, k) {
		if (a[i] <= min)min = a[i];
	}
	return min;
}

ll SUM(vector<ll> a, ll k) {
	ll sum = 0;
	REP(i, k) {
		sum += a[i];
	}
	return sum;
}

db AVE(vector<ll> a, ll k) {
	db ave = SUM(a,k)/(db)k;
	return ave;
}


int main() {
	int n,cnt=0;
  	cin>>n;
	vector<int> a(n);
	REP(i, n) { cin >> a[i]; }
	REP(i, n-2) {
		if (a[i] < a[i + 1] && a[i + 1] < a[i + 2]) cnt++;
		else if (a[i] > a[i + 1] && a[i + 1] > a[i + 2])cnt++;
		else cnt+=0;
	}
	cout << cnt;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

int a[200000];

int main() {
    int n, i;
    long long ans = 0, sum = 0;
    map <long long, int> mp;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < n; i++) {
        sum += a[i];
        ans += mp[sum];
        mp[sum]++;
    }
    
    ans += mp[0];
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

#include <iostream>
 
int main(void)
{
    int64_t A, B, C;
    std::cin >> A >> B >> C;

    int64_t remain = A - B;

    int64_t ans = C - remain;

    if (ans <= 0) ans = 0;

    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int>a(n+1);
  int sum=0,key;
  for(int i=1;i<=n;i++)
  {
    if((sum+i)>n)
    {
      a[sum+i-n]=0;
      a[i]=1;
      sum=n;
      key=i;
    }
    else{
      sum+=i;
      a[i]=1;
    }
    if(sum==n)break;
  }
  for(int i=1;i<=n;i++)
  {
    if(a[i])cout<<i<<endl;
    if(i==key)break;
  }
  return 0;
}

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

#define ll long long int
using namespace std;

const int N=102, W=100002;
ll dp[N][W], wt[N], val[N];
ll calc(int n, int w) {
    for (int i=0;i<=n;i++) {
        for (int j=0;j<=w;j++) {
            if (i==0 || j==0) {dp[i][j]=0;continue;}
            if (wt[i] > j) dp[i][j] = dp[i-1][j];
            else {
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-wt[i]] + val[i]);
            }
        }
    }
    return dp[n][w];
}

int main() {
    int n,w;
    cin>>n>>w;
    for (int i=1;i<=n;i++)cin>>wt[i]>>val[i];
    cout<<calc(n,w);
    return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll b_shou = b / x;
    ll b_amari = b % x;
    ll a_shou = a / x;
    ll a_amari = a % x;
    ll ans = b_shou - a_shou;
    if(a_amari == 0){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]--;
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n-1;i++){
        cin>>c[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=b[a[i]];
        if(i!=0){
            if(a[i]-a[i-1]==1){
                ans+=c[a[i]-1];
            }
        }
    }
    cout <<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
  string s;cin>>s;
  int ind1,n=siz(s);
  for(int i=0;i < min(2ll,siz(s)-4);i++)
  {
    if(i==1 && s[0]!='A')continue;
    
    if(s.at(i)=='K' && s.at(i+1)=='I'){
      if(s.at(i+2)=='H'){
        ind1=i+2;
      }else continue;

      if(s.at(ind1+1)=='B'){
        ind1++;
      }else if(ind1+2<n && s.at(ind1+1)=='A' && s.at(ind1+2)=='B'){
        ind1+=2;
      }else continue; 

      if(ind1+1>=n)continue;

      if(s.at(ind1+1)=='R'){
        ind1++;
      }else if(ind1+2<n && s.at(ind1+1)=='A' && s.at(ind1+2)=='R'){
        ind1+=2;
      }else continue;

      if(ind1==n-1 || (ind1==n-2 && s[ind1+1]=='A')){
        cout<<"YES"<<endl;
        return 0;
      }else continue;

    }
  }

  cout<<"NO"<<endl;
}

Measured memory_bytes: 256
st = []
tt = []
for n in range(int(input())):
    s, t = input().split()
    t = int(t)

    st.append(s)
    tt.append(t)

x = input()

ans = 0
flag = 'no'
for i in range(n+1):
    if (flag == 'yes'):
        ans += tt[i]
        
    if st[i] == x:
        flag = 'yes'

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rrep(i,n) for(int i = 1; i <= n; i++)
#define drep(i,n) for(int i = n; i >= 0; i--)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

int chmax(int& a,int b){
	if(b > a){
		a=b;
	}
	return a;
}
int chmin(int& a,int b){
	if(b < a){
		a=b;
	}
	return a;
}
struct edge{
	int to;
	int cost;
	edge(int t,int c):to(t),cost(c){}

};
vector<vector<edge> >l(101);
int d[101];
int used[101];

int N;
int M;

int main(){
	while(cin >> N,N){
		cin >> M;
		rep(i,101){
			used[i]=0;
			d[i]=inf;
			l[i].clear();
		}
		rep(i,M){
			char tmp;
			int a,b,c;
			cin >> a >> tmp >> b >> tmp >> c;
			l[a].pb(edge(b,c/100-1));
			l[b].pb(edge(a,c/100-1));
		}
		priority_queue<pii,vector<pii>,greater<pii> >q;
		q.push(mp(0,0));
		int ans=0;
		while(!q.empty()){
			int c=q.top().first,u=q.top().second;q.pop();
			if(d[u]==inf){
				d[u]=c;
				ans+=c;
			}
			rep(i,l[u].size()){
				edge &now=l[u][i];
				if(d[now.to]==inf){
					q.push(mp(now.cost,now.to));
				}
			}

		}
		cout << ans << endl;
	}





	return 0;

}

Measured memory_bytes: 1424
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

fn draw(v: &mut Vec<Vec<bool>>, x: usize, y: usize, a: usize) {
    if a == 1 {
        for i in 0..v[0].len() {
            for j in 0..x {
                v[j][i] = false;
            }
        }
    }
    if a == 2 {
        for i in 0..v[0].len() {
            for j in x..v.len() {
                v[j][i] = false;
            }
        }
    }
    if a == 3 {
        for i in 0..v.len() {
            for j in 0..y {
                v[i][j] = false;
            }
        }
    }
    if a == 4 {
        for i in 0..v.len() {
            for j in y..v[0].len() {
                v[i][j] = false;
            }
        }
    }
}

fn main() {
    let (w, h, n): (usize, usize, usize);
    input!(w, h, n);

    let mut v = vec![vec![true; h]; w];

    for _ in 0..n {
        let (x, y, a): (usize, usize, usize);
        input!(x, y, a);
        draw(&mut v, x, y, a);
    }

    let mut ans = 0;
    for z in &v {
        for zz in z {
            if *zz {
                ans += 1;
            }
        }
    }
    p(ans);
}

Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#include <string>
using namespace std;

//宣言
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//数値
#define MOD 1000000007
#define INF (1<<20)
const double EPS = 1e-10;
const double PI = acos(-1.0);

//操作
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define REPB(i,n) for(int i=n;i>=0;--i)
#define SORT(A) sort(A,A+sizeof(A)/sizeof(A[0]))
#define VSORT(A) sort(A.begin(),A.end())
#define EXIST(s,e) (s.find(e)!=s.end())
#define PB push_back
#define MP make_pair
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//DEBUG
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
	int n;
	cin >> n;
	int a[101] = { 0 };
	for (int i = 0;i < n;i++) {
		int d;
		cin >> d;
		a[d] = 1;
	}
	int ans = 0;
	REP(i, 101) ans += a[i];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int H,W;
  cin >> H >> W;
  int count = 0;
  vector<vector<char>> a(H,vector<char>(W));
  rep(i,H)
  {
    rep(j,W)
    {
      cin >> a[i][j];
    }
  }
  rep(i,H)
  {
    rep(j,W)
    {
      if(a[i][j]=='#')
      {
        count ++;
      }
    }
  }
  if(count==H+W-1)
  {
    cout << "Possible" << endl;
  }
  else
  {
    cout << "Impossible" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*____________________________Definitions__________________________*/
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0);
typedef long long ll;
typedef vector<int> vi;
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define trav(a,x) for(auto& a : x)
#define nl '\n'
#define ri(n) int n; scanf("%d", &n);
#define rll(n) ll n; scanf("%lld", &n);
/*__________________________________________________________________*/


int main() {

	fastIO
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T = 1;
	while (T--) {
		/*_____________________Code Here____________________________*/

		int d , t , s ; cin >> d >> t >> s ;
		if (s * t >= d) cout << "Yes" << nl;
		else cout << "No" << nl;


		/*_____________________End Here____________________________*/
	}
	return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstring>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

ll a[100001];
ll go(ll x) {
	ll cnt = 0;
	while (x % 2 == 0) {
		x /= (ll)2; 
		cnt += 1;
	}
	return cnt;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	else return gcd(y, x % y);
}
int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	// X = y / 2 + y * p
	// X = y/2 (1 + 2 p) // 만약에 y/2 = 짝수 = 무조건 짝수임. 
	// X = 4 (1 + 2p)
	// X = 2 (1 + 2p)
	// X = 4 ( 1 + 2p)
	ll n, m; cin >> n >> m;
	bool f = false, f2 = false;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] /= 2;
		if (a[i] & 1) {
			f = true;
		}
		else f2 = true;	
	}
	if (f && f2) {
		cout << 0 << '\n'; return 0;
	}
	ll t = go(a[0]);
	for (int i =1; i < n; i++) {
		if (go(a[i]) != t) {
			cout << 0 << '\n'; return 0;
		}
	}

	ll lcd = a[0];
	for (int i = 1; i < n; i++) {
		ll g = gcd(lcd, a[i]);
		lcd = (lcd * a[i]) / g;
		if (lcd > m) {
			cout << 0 << '\n'; return 0;
		}
	}

	m /= lcd;
	ll ans = (m + 1) / 2;
	cout << ans << '\n';
	// 8 4
	//






}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(2*10**5)

def rec(i, A, memo):
    if memo[i] != -1:
        return memo[i]

    for a in A:
        if i - a >= 0 and not rec(i - a, A, memo):
            memo[i] = True
            return True
    memo[i] = False
    return False


def main():
    N, K = map(int, input().split())
    A = [int(x) for x in input().split()]
    memo = [-1] * (K + 1)
    print("First" if rec(K, A, memo) else "Second")


if __name__ == '__main__':
    main()


Measured memory_bytes: 95168
#include <iostream>
using namespace std;
int main(void){

	int n, q, t, c = 0;
	int *s;
	int l, r, m;

	cin >> n;
	s = new int[n];
	for (int i = 0; i < n; i++) cin >> s[i];

	cin >> q;
	for (int i = 0; i < q; i++){

		cin >> t;

		l = 0; r = n - 1;
		while (l <= r){

			m = (l + r) / 2;
			if (t == s[m]){

				c++;
				break;
			}
			if (t < s[m]) r = m - 1;
			else l = m + 1;
		}
	}

	cout << c << endl;

}

Measured memory_bytes: 1568
def main():
    p = [int(input()) for i in range(5)]
    k = int(input())
    com_flag = True
    for i in range(5-1):
        for j in range(i+1, 5):
            if p[j] - p[i] > k:
                com_flag = False
    if com_flag:
        print("Yay!")
    else:
        print(":(")
if __name__ == "__main__":
    main()

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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll d=2;
    ll rd=1;
    while(n>=d*d){
        if(n%d==0) rd=d;
        d++;
    }
//    cout << rd << "\n";
//    cout << n/rd << "\n";
    cout << (int)log10(n/rd)+1 << "\n";
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#define mod 1000000007
using namespace std;
typedef long long ll;
bool chmax(ll &a,ll b){
    if(a>b)return 0;
    a=b; return 1;
}
bool chmin(ll &a,ll b){
    if(a<b)return 0;
    a=b; return 1;
}
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

ll n;
vector<ll> g[200010];
ll ma,pnt;
void dfs(ll x,ll from,ll d){
    if(d>=ma)ma=d,pnt=x;
    for(auto y:g[x])if(y!=from){
	dfs(y,x,d+1);
    }
}
int main(){
    cin>>n;
    for(int i=0;i<n-1;i++){
	ll a,b; cin>>a>>b;
	g[a].push_back(b);
	g[b].push_back(a);
    }
    ma=-1;
    dfs(1,0,0);
    dfs(pnt,0,0);
    if(ma%3!=1)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}




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

int main(){
    int ans=0;
    vector<int> p(20);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
      
    for(int i = 1; i < n-1; i++){
        if(p[i] > p[i-1] && p[i] < p[i+1]){
            ans++;
        }else if(p[i] < p[i-1] && p[i] > p[i+1]){
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

void InsSort(int num[ ], int n) ;
void ShowData(int num[ ], int n);
int main(void);

void InsSort(int num[ ], int n)
{
    int i, j, temp;

    for (i = 1; i < n; i++) {      
        temp = num[i];             
        for (j = i; j > 0 && num[j-1] > temp; j--) 
            num[j] = num[j -1];                    

        num[j] = temp;             
        ShowData(num, n);   
    }
}

/* n 個のデータを表示 */
void ShowData(int num[ ], int n)
{
  while (n--){
    if(n == 0)
      printf("%d", *num++);
    else
      printf("%d ", *num++);
  }
  printf("\n");
}

int main(void)
{
  int NUM_DATA,i;
  int *num;

  while(1){
  scanf("%d",&NUM_DATA);
  if(NUM_DATA >= 0 || NUM_DATA <= 100)break;
  }

  num = (int *)malloc(sizeof(int) * NUM_DATA);
  
  for(i = 0; i < NUM_DATA; i++){
    while(1){
    scanf("%d",&num[i]);
    if(num[i] >= 0 || num[i] <= 1000) break;
    }
  }

  

  for(i = 0;i<NUM_DATA;i++){
    if(i < NUM_DATA-1)
      printf("%d ",num[i]);
    else
      printf("%d",num[i]);
  }
  printf("\n");
      
    InsSort(num, NUM_DATA);

    return 0;
}



Measured memory_bytes: 2136
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

ll n,k,amax=0;
vector<ll> a;

ll f(ll t){
	ll count=0;
	for(ll x: a){
		count += max((ll)0, (ll)ceil((double)x/t)-1);
	}
	return count;
}


int main(){
	cin >> n >> k;
	a.resize(n);
	REP(i,n){
		cin >> a[i];
		chmax(amax, a[i]);
	}
	ll ok,ng,mid;
	ok = amax;
	ng = 0;
	while(abs(ok-ng)>1){
		mid = (ok+ng)/2;
		
		if(f(mid) <= k) ok = mid;
		else ng = mid;
	}
	
	
	cout << ok << endl;
	
	
	return 0;
}

Measured memory_bytes: 4808
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define RB rbegin()
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define MD 1000000007
#define PPF pop_front()
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u,uc;
map<LL,LL>ww,cc;
LL ar[120005];
LL br[500005];
LL cr[500][500];
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c,str;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
        for(i=0;i<3;i++)
        {
            cin>>ar[i];
        }
        sort(ar,ar+3);
        cout<<ar[0]+ar[1]<<endl;
    }
    return 0;
    //IN
    //AL
}


Measured memory_bytes: 3564
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int su = sc.nextInt();
        int fu = sc.nextInt();
        int sgoal = sc.nextInt();
        int fgoal = sc.nextInt();
        char[] masu = sc.next().toCharArray();
        for(int i = su; i < sgoal; i++){
        	if(masu[i - 1] == '#' && masu[i] == '#'){
            	System.out.println("No");
                return;
            }
        }
        for(int i = fu; i < fgoal; i++){
        	if(masu[i - 1] == '#' && masu[i] == '#'){
            	System.out.println("No");
                return;
            }
        }
        if(sgoal < fgoal){
        	System.out.println("Yes");
            return;
        }else{
        	for(int i = fu; i <= fgoal; i++){
            	if(i >= 2){
                	if(masu[i] == '.' && masu[i - 1] == '.' && masu[i - 2] == '.'){
                    	System.out.println("Yes");
                        return;
                    }
                }
            }
            System.out.println("No");
        }
	}
}

Measured memory_bytes: 40816
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

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

  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a.rbegin() , a.rend());
  int T = (int)a[0] / 2;
  int dis = inf , Num = -1;
  for(int i = 1; i < N; i++) {
    if(abs(T - a[i]) < dis){
      dis = abs(T - a[i]);
      Num = a[i];
    }
    if(abs(T - a[i]) == dis && a[i] > Num){
      Num = a[i];
    }
  }
  cout << a[0] <<" " << Num << '\n';
  return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


int main()
{
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>> v;
	for(int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		v.push_back(MP(b, a));
	}
	sort(v.begin(), v.end());
	ll ans = 0, t = 0;
	for(int i = 0; i < M; i++) {
		if(t <= v[i].SE) {
			ans++;
			t = v[i].FI;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var a1 = ReadInts();
            if (a1[0] + a1[1] < a1[2]||a1[0]>a1[2]) WriteLine("NO");            
            else WriteLine("YES");
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long int ll;

using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int i,j,k,d;
    long n,m,tmp,count=0;
    long sum=0;
    double dou;
    int a[10][10];

    cin >> n ;
    cin >> d ;
    rep(i,n){
        rep(j,d){
            cin>>a[i][j];
        }
    }
    rep(i,n){
        for(j=i+1;j<n;j++){
            rep(k,d){
                sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            dou=sqrt((double)sum);
   //         cout << dou << endl;
            if(ceil(dou) == floor(dou)){
                count++;
            }
            sum=0;
        }
    }



    cout<< count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int n,W;
std::vector<long int> val,w;
long int sum=0;
long long int min(long long int a,long long int b){
    return a>b?b:a;
}
long long int solve(){
    long long int ans=0,dp[n+1][sum+1];
    int i,j;
    for(i=0;i<=n;i++){
        for(j=0;j<=sum;j++){
        if(j==0)
        dp[i][j]=0;
            else
            dp[i][j]=W+1;
        }}
    for(i=1;i<=n;i++){
        for(j=0;j<=sum;j++){
            if(val[i-1]<=j){
                dp[i][j]=min(w[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
                if(dp[i][j]<=W&&ans<j)
                ans=j;
                
            }else
            dp[i][j]=dp[i-1][j];
        }
    }
    return ans;
}

int main() {
    int t,i,j;long int x;
    cin>>n>>W;
    for(i=0;i<n;i++){
             cin>>t>>x;
             sum+=x;
             w.pb(t);val.pb(x);
        }long long int y;
        y=solve();
        cout<<y;
        val.clear();
        w.clear();
	return 0;
}

Measured memory_bytes: 79104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

class _Class
{
	void _Do()
	{
		//
		var _s = _stringArray();
		var n_ = int.Parse(_s[0]);

		var a_ = _intArray();

		Array.Sort(a_);
		Array.Reverse(a_);

		int a=0;
		int b = 0;
		int i = 0;
		for (;i<n_-1;i++) {

			int x1 = a_[i];
			int x2 = a_[i+1];

			if (x1 == x2)
			{
				if (a == 0)
				{
					a = x1;
					i++;
				}
				else
				{
					b = x1;
					break;
				}
			}
		}
		Console.WriteLine(((long)(a))*b);
	}	

	static void Main(string[] args)
	{
		new _Class()._Do();
	}


	// 1
	string[] _stringArray()
	{
		return Console.ReadLine().Split();
	}

	// 2.1 -2,147,483,648 ~ +2,147,483,647
	int[] _intArray()
	{
		var _s = Console.ReadLine().Split();

		var x = new int[_s.Length];
		for (var i = 0; i < _s.Length; i++)
			x[i] = int.Parse(_s[i]);

		return x;
	}

	// 2.2 -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807
	long[] _longArray()
	{
		var _s = Console.ReadLine().Split();

		var x = new long[_s.Length];
		for (var i = 0; i < _s.Length; i++)
			x[i] = long.Parse(_s[i]);

		return x;
	}
}


Measured memory_bytes: 18528
#include "bits/stdc++.h"
using namespace std;

int main() {
  string str;
  cin >> str;
 
  int count = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == '1') {
      count++;
    }
  }
 
  cout << count << endl;
}

Measured memory_bytes: 256
N,A,B=map(int,input().split())
X=list(map(int,input().split()))

P=0
Q=N-1
T=0

C=0
for _ in range(N-1):
    if T==0:
        P+=1
        J=A*(X[P]-X[P-1])
    else:
        Q-=1
        J=A*(X[Q+1]-X[Q])

    if J<=B:
        C+=J
    else:
        C+=B
        T^=1

print(C)    


Measured memory_bytes: 62704
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int k,cnt; 

void bfs(){
	queue<ll>q;
	for(int i=1;i<10;i++)q.push(i);
	while(!q.empty()){
		ll x=q.front();
		q.pop();
		cnt++;
		if(cnt==k){
			cout<<x;
			return;
		}
		for(int i=-1;i<2;i++){
			int y=x%10;
			y+=i;
			if(y>=0&&y<=9){
				ll n=x*10+y;
				q.push(n);
			}
		}
	}
}
int main(){
	cin>>k;
	bfs();
	return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>

using namespace std;
typedef long long int ll;

ll p[3][3],ci[3],cj[3];
bool r=true;
string ss;

int main(){
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)scanf("%d",&p[i][j]);
    }
    ci[1]=p[1][0]-p[0][0];
    ci[2]=p[2][0]-p[0][0];
    cj[1]=p[0][1]-p[0][0];
    cj[2]=p[0][2]-p[0][0];
    
    for(int i=0;i<3;i++){
        //printf("%d %d %d",cj[0],cj[1],cj[2]);
        //printf("%d ",p[i][1]-ci[1]);
        //printf("%d\n",p[i][2]-ci[2]);
        
        r=r and p[0][i]==p[1][i]-ci[1] and p[0][i]==p[2][i]-ci[2];
        r=r and p[i][0]==p[i][1]-cj[1] and p[i][0]==p[i][2]-cj[2];
    }
    cout<<(r ? "Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int X, Y, a, b;
    cin >> X >> Y;
  	// 数値の入力
  	// X = a + b
    // Y = 4*a + 2*b

  	// 解答の代入
  	string ans ="No";
  	for (a=0; a <= X; a++ ) {
      for(b = X; b >= 0; b--){
      if (4*a + 2*b == Y && a + b == X) {ans = "Yes";}
    }}
  	
    // 出力
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#素因数分解
def Prime_Factorization(N):
    if N<0:
        R=[[-1,1]]
    else:
        R=[]

    N=abs(N)
    k=2
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=1

    if N!=1:
        R.append([N,1])
    if not R:
        R.append([N,1])

    return R
#================================================
N=int(input())

if N==1:
    print(1)
else:
    D={}
    for k in range(2,N+1):
        T=Prime_Factorization(k)
        for p,e in T:
            if p in D:
                D[p]+=e
            else:
                D[p]=e

    M=10**9+7
    X=1
    for p in D:
        X*=D[p]+1
        X%=M
    print(X)

Measured memory_bytes: 71408
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
	int n=0, m=0;
	cin >> n >> m;
	vector<pair<int,int> > vec;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		vec.push_back({ b, a });
	}
	sort(vec.begin(), vec.end());
	int ans=1, broke;
	broke = vec[0].first-1;
	for (int i = 1; i < m; i++) {
		if (broke < vec[i].first&& broke >= vec[i].second)continue;
		ans++;
		broke = vec[i].first - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

int main()
{
    fastinput;
    LL n, i, j, k, t, temp, M, tc;
    cin>>n>>k;
    long double ans=0.0;
    LL log[100001];
    long double p[100001];
    log[1]=0;
    p[0]=1;
    p[1]=2;
    for(i=2;i<=100000;i++)
    {
        log[i]=log[i/2]+1;
        p[i]=p[i-1]*2;
        //cout<<"log "<<i<<" is "<<log[i]<<endl;
    } 
    for(i=1;i<=n;i++)
    {
        long double add=1.0/n;
        LL need=ceil(((long double)k)/i);
        LL needed=log[need]+1;
        if((need & (need-1)) ==0)
        {
            
            needed--;
        }
      //  debug(i);
        //debug(need);
       // debug(needed);
       // debug(p[needed]);
        add*=1.0/(p[needed]);
        ans+=add;
       // part;
    }
       cout << setprecision(16) << ans << '\n';
   

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include <math.h>
using namespace std;
int main()
{
    int d, n;
    cin >> d >> n;
    int r = 1;
    if(n == 100){
    	r = (101)*pow(100, d);
    }
    else{
    	r = n*pow(100, d);
    }
    cout << r << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q; cin>>q;
    priority_queue<ll> lower;
    priority_queue<ll,vll,greater<ll>> upper;
    ll bsum=0;
    ll upsum=0, lowsum=0;
    while(q--){
        int c; cin>>c;
        if (c==1){
            ll a,b; cin>>a>>b;
            bsum += b;
            //同じときはlowerに詰める
            if (lower.size()==upper.size()){
                if (upper.empty()){
                    lower.push(a);
                    lowsum += a;
                    continue;
                }
                ll tmp = upper.top();
                if (a > tmp){
                    upper.pop();
                    upper.push(a);
                    upsum += a-tmp;
                    lower.push(tmp);
                    lowsum += tmp;
                }else{
                    lower.push(a);
                    lowsum += a;
                }
            }else{
                ll tmp = lower.top();
                if (a < tmp){
                    lower.pop();
                    lower.push(a);
                    lowsum += a-tmp;
                    upper.push(tmp);
                    upsum += tmp;
                }else{
                    upper.push(a);
                    upsum += a;
                }
            }
        }else{
            ll med = lower.top();
            ll ans=(med*lower.size()-lowsum)+(upsum-med*upper.size())+bsum;
            cout<<med<<" "<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int main(){
  int n;
  cin>>n;
  int a=0,c=0;
  lp(i,n){
    string x;
    cin>>x;
    if(x=="A") a++;
    if(x=="Un") a--;
    if(a<0){
      c=1;
      break;
    }
  }
  if(c==1 ||a!=0) cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  return 0;
}



Measured memory_bytes: 3160
//by xxj
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
//const int mod=;
string s;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,a,b,c,d;
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	a--;
	b--;
	c--;
	d--;
	cin>>s;
	for (int i=a+1;i<=c-2;i++){
		if (s[i]=='#' && s[i+1]=='#'){
			puts("No");
			return 0;
		}		
	}
	for (int i=b+1;i<=d-2;i++){
		if (s[i]=='#' && s[i+1]=='#'){
			puts("No");
			return 0;
		}
	}
	if (c<b){
		puts("Yes");
		return 0;
	}
	if (c<d){
		puts("Yes");
		return 0;
	}
	for (int i=max(b-1,0);i<=d-1;i++){
		if (s[i]=='.' && s[i+1]=='.' && s[i+2]=='.'){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}
/*
input:
*/


Measured memory_bytes: 640
// AOJ 0301 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0301)
#include<cstdio>
#define rep(i,a) for(int i=0;i<(a);++i)

const int MAX_M = 200000;

int N, M, Q;
int a[MAX_M];

int main()
{
	scanf( "%d%d%d", &N, &M, &Q );
	rep( i, M )
		scanf( "%d", a+i );
	while( Q-- )
	{
		int q;
		scanf( "%d", &q );

		int t = q, c = 0;
		rep( r, M )
		{
			int n = N-r;

			c = (a[r]&1?(c-a[r]+10*n):(c+a[r]))%n;
			if( t == c )
			{
				puts("0");
				goto end;
			}
			else if( t > c )
				--t;
		}
		puts("1");
end:;
	}

	return 0;
}

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

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

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 5e5 + 10;

void hi(int a){
  int temp = a;
  int cnt = 0;
  while(temp){temp/=10;cnt++;}
  cnt = 6-cnt;
  for(int i = 0;i<cnt;i++){
    cout <<0;
  }
}

void solve(){
   int n,m;cin >> n >> m;
   vector< vector<int> >p(n+10);
   vector<int>ans1(m+5);
   map<int,int>mapp;
   vector<int>c(m+5);
   for(int i = 0;i<m;i++){
    int a,b;cin >> a >> b;
    p[a].push_back(b);
    ans1[i] = a;
    c[i] = b;
}
for(int i = 1;i<=n;i++){
    sort(p[i].begin(),p[i].end());
    for(int j = 0;j<p[i].size();j++){
        mapp[p[i][j]] = j+1;
    }
}
for(int i = 0;i<m;i++){
    hi(ans1[i]);cout << ans1[i];
    hi(mapp[c[i]]);cout << mapp[c[i]];
    cout <<endl;
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 13912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> ii;
unordered_map<ll,vector<ii > > m;
ll gcd(ll a, ll b){
    return a == 0 ? b : gcd(b%a,a);
}
int main(){
    ll n,x,d;
    scanf("%lld%lld%lld",&n,&x,&d);
    ll l = 0, r = 0;
    if (d == 0){
        if (x == 0){
            printf("1");
            return 0;
        }
        printf("%lld",n+1);
        return 0;
    }
    for (int i = 0; i <= n; i++){
        ll k = (i*x)/d;
        ll st = min(i*x + l*d,i*x + r*d);
        ll en = max(i*x + l*d,i*x + r*d);
        //printf("group %lld ",k);
        //printf("with %d elements, can go from %lld to %lld with remainder %lld\n",i,st,en,(i*x)%d);
        m[(i*x)%d].push_back(ii(st,-1));
        m[(i*x)%d].push_back(ii(en,1));
        l += i;
        r += (n-i-1);
    }
    int sum = 0;
    ll last;
    ll ans = 0;
    for (auto p : m){
        vector<ii> v = p.second;
        sort(v.begin(),v.end());
        for (auto x : v){
            //printf("%lld %d\n",x.first,x.second);
            if (sum == 0 && x.second == -1){
                last = x.first;
            }
            else if (sum == -1 && x.second == 1){
                //printf("with remainder %lld, range (%lld -> %lld)\n",p.first,last,x.first);
                ans += (x.first-last)/max(d,-d)+1;
            }
            sum += x.second;
        }
    }
    printf("%lld",ans);

}


Measured memory_bytes: 20936
#include <bits/stdc++.h>
#include <map>
using namespace std;
#define int long long
#define loop(i,a,b) for(i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define vct vector
#define stk stack
#define qu queue
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define br break
#define con continue
#define re return
#define tc(t) int t; cin>>t; while(t--)
#define q(q) int q; cin>>q; while(q--)
#define subs substr
#define er erase
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;
signed main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        /*int te;
        cin>>te;
        while(te--)*/{
                int s,max_sum=0,temp_sum=0,even=0,odd=0,color=1,oka=5,okb=0,inda=-1,indb=-1,n,maxf=INT_MAX,y,index=0,d,z,p=1,i,j,k,x=1,l,sum=0,ans=0,count=LONG_MAX,count2=0,count1=0,count3=0,ans1,ans2,berry=0,straw=0,berry1=0,straw1=0,berry2=0,straw2=0;
                cin>>n;
                vct<int> v(n+1);
                loop(i,1,n+1){
                        cin>>v[i];
                }
                vct<int> t(n+1,0);
                t[2]=abs(v[2]-v[1]);
                loop(i,3,n+1){
                        t[i]=min(t[i-1]+abs(v[i-1]-v[i]),t[i-2]+abs(v[i-2]-v[i]));
                }
                cout<<t[n];
        }
        return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        Scanner sc = new Scanner(System.in);

        String s = nextString(sc);

        if (s.length() < 4) {
            out("No");
        } else if (s.substring(0, 4).equals("YAKI")) {
            out("Yes");
        } else {
            out("No");
        }

    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt(Scanner sc) {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString(Scanner sc) {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(Scanner sc, int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt(sc);
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }
}



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

int main(void) {
    int r,c;cin>>r>>c;
    int rc[r+1][c+1];
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            int tmp;cin>>tmp;
            rc[i][j] = tmp;
        }
    }
    int total = 0;
    for (int i = 0; i < r; i++) {
        int sum = 0;
        for (int j = 0; j < c; j++) {
            sum += rc[i][j];
            total += rc[i][j];
        }
        rc[i][c] = sum;
    }
    for (int i = 0; i < c; i++) {
        int sum = 0;
        for (int j = 0; j < r; j++) {
            sum += rc[j][i];
        }
        rc[r][i] = sum;
    }
    rc[r][c] = total;
    for (int i = 0; i <= r; i++) {
        for (int j = 0; j <= c; j++) {
            cout << rc[i][j];
            if (j < c) cout << " ";
        }
        cout << endl;
    }
    return 0;
}


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

namespace ABC142B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NK = Console.ReadLine().Split(' ');
            int N = int.Parse(NK[0]);
            int K = int.Parse(NK[1]);
            string[] hinput = Console.ReadLine().Split(' ');
            int[] h = new int[N];
            int count = 0;
            for (int i = 0; i < N; i++)
            {
                h[i] = int.Parse(hinput[i]);
                if (h[i] >= K)
                {
                    count += 1;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 34200