akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ii pair<int ,int >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1(x,n) for(int x = 1; x <= n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}


string ans="";
int dp[(int)(3001)][(int)3001];

void lcs(string& s1,string& s2, int i, int j)
{
	if(i==0||j==0)
		ans="";
	else if(s1[i-1]==s2[j-1])
	{
		lcs(s1,s2,i-1,j-1);
		ans.pb(s1[i-1]);
	}
	else
	{
		dp[i-1][j]==dp[i][j]?lcs(s1,s2,i-1,j):lcs(s1,s2,i,j-1);
	}
}
int main(){
	IOS
 	
 	
	string s1,s2;
	cin>>s1>>s2;
	int n1 = s1.size();
	int n2 = s2.size();

	for(int i=0;i<=s1.size();i++)
	{
		for(int j=0;j<=s2.size();j++)
		{
			if(i==0||j==0)
				dp[i][j]=0;
			else if(s1[i-1]==s2[j-1])
				dp[i][j] = 1+dp[i-1][j-1];
			else
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}
	//cout<<dp[n1][n2];

 	lcs(s1,s2,n1,n2);
 	cout<<ans;
	return 0;	
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,k,x,y,memo[50],ans=INF;
vector<pair<int,int>> v;

signed main() {
    cin >> n >> k;
    rep(i,n) cin >> x >> y,v.pb(mp(x,y))
    rep(i,n) rep(j,n) rep(x,n) rep(y,n) {
        int x_min,x_max,y_min,y_max,cnt=0;
        x_min = min(min(v[i].fi,v[j].fi),min(v[x].fi,v[y].fi));
        x_max = max(max(v[i].fi,v[j].fi),max(v[x].fi,v[y].fi));
        y_min = min(min(v[i].se,v[j].se),min(v[x].se,v[y].se));
        y_max = max(max(v[i].se,v[j].se),max(v[x].se,v[y].se));
        rep(z,n) if (x_min <= v[z].fi && v[z].fi <= x_max && y_min <= v[z].se && v[z].se <= y_max) cnt++;
        if (k <= cnt) ans = min(ans,(x_max-x_min)*(y_max-y_min));
    }
    cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string n;
  cin>>n;
  
  cout<<"ABC"<<n;
  
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 1000000000000000000

int main() {
	long long a, b, c, N;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &N);
	if (b - a > MAX || a - b > MAX) {
		printf("Unfair\n");
	}
	else if (N % 2 == 1) {
		printf("%lld\n", b - a);
	}
	else printf("%lld\n", a - b);


	return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int q; cin >> q;
    VS X(q), Y(q); REP(i,q) cin >> X[i] >> Y[i];

    REP(k,q){
        int dp[X[k].size()+1][Y[k].size()+1]; REP(i,X[k].size()+1)REP(j,Y[k].size()+1) dp[i][j] = 0;
        REP(i,X[k].size())REP(j,Y[k].size()){
            if(X[k][i] == Y[k][j]) dp[i+1][j+1] = dp[i][j] + 1;
            else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
        }
        cout << dp[X[k].size()][Y[k].size()] << endl;
    }
    return 0;
}


Measured memory_bytes: 7116
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC105C
int main(void) {
  long long bit[100], n, k=2, i, cou=0, tmp=1, flag=0;
  scanf("%lld", &n);

  for(i=0; i<33; i++)
    bit[i]=0;

  if(n>0){
    if(n%2==1) bit[0]=1;
    for(i=1; i<16; i++){
      k*=2;
      n-=tmp, tmp*=4;
      if(n<=0) break;
      bit[2*i-1]=(n-1)%k>=(k/2) ? 0 : 1;
      k*=2;
      bit[2*i]=(n-1)%k>=(k/2) ? 0 : 1;
    }
  }else if(n<0){
    n*=-1;
    tmp=2;
    for(i=0; i<16; i++){
      //printf("i=%lld n=%lld k=%lld\n", i, n, k);
      bit[2*i]=(n-1)%k>=(k/2) ? 0 : 1;
      k*=2;
      bit[2*i+1]=(n-1)%k>=(k/2) ? 0 : 1;
      k*=2;
      n-=tmp, tmp*=4;
      if(n<=0) break;
    }
  }else{
    printf("0");
    return 0;;
  }

  for(i=32; i>=0; i--){
    if(flag==0&&bit[i]==0) continue;
    else{
      flag=1;
      printf("%lld", bit[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 128
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int a[100], b[100], c[100];
int main()
{
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d", a + i);
  for (int i = 0; i < n; i++)
    scanf("%d", b + i);
  for (int i = 0; i < n - 1; i++)
    scanf("%d", c + i);
  for (int i = 0; i < n; i++)
  {
    if (i >= 1)
    {
      if (a[i] - a[i - 1] == 1)
        ans += c[a[i - 1] - 1];
    }
    ans += b[a[i] - 1];
  }
  printf("%d\n", ans);
}

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

size_t N;
constexpr size_t sz = 100010;

struct StrangeBank{
    int_fast32_t val[sz];
    size_t c[12] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};

    constexpr StrangeBank() : val(){
        val[0] = 0;
        for(size_t i = 1, j = 1; i < sz; ++i){
            val[i] = 9999999;
            while(j < 12 && c[j] <= i)++j;
            for(size_t k = 0; k < j; ++k){
                val[i] = min(val[i], val[i - c[k]] + 1);
            }
        }
    }
};

constexpr StrangeBank sb = StrangeBank();

int main(){
    scanf("%d", &N);
    printf("%d", sb.val[N]);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)
#define l_ength size

ll sq(ll x){
	return x*x;
}

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

bool isvowel(char c){
	int i;
	string v="aeiou";
	for(i = (v.size()-1); i>=0; --i){
		if(c == v[i]){
			return true;
		}
	}
	return false;
}

int main(void){
	int n,m,a,b,i,ans=0,prev;
	bool path[10][10],flag;
	vector<int> v;
	fill(path[0],path[10],false);
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> a >> b;
		a--;
		b--;
		path[a][b] = true;
		path[b][a] = true;
	}
	for(i=1; i<n; ++i){
		v.push_back(i);
	}
	do{
		prev = 0;
		flag = true;
		for(i=(v.size()-1); i>=0; --i){
			if(!path[prev][v[i]]){
				flag = false;
				break;
			}
			prev = v[i];
		}
		if(flag){
			ans++;
		}
	}while(next_permutation(v.begin(), v.end()));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int dp[80001][11];//[i][mod]
int ans[11];
int main() {
	char str[80001];
	while (1) {
		for (int i = 0; i < 80001; i++) {
			for (int j = 0; j < 11; j++) {
				dp[i][j] = 0;
			}
		}
		for (int i = 0; i < 11; i++) {
			ans[i] = 0;
		}
		scanf("%s", str);
		if (strcmp(str, "0")==0)break;
		int length = strlen(str);
		dp[1][str[0] - '0']++;
		for (int i = 2; i <= length; i++) {
			int digit = str[i - 1] - '0';
			for (int mod = 0; mod <= 10; mod++) {
				dp[i][((mod * 10) + digit) % 11] = dp[i - 1][mod];
			}
			if(digit!=0)dp[i][digit]++;
			
			for (int mod = 0; mod <= 10; mod++) {
				ans[mod] += dp[i][mod];
			}
		}
		printf("%d\n", ans[0]);
	}
	return 0;
}


Measured memory_bytes: 5308
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////

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

	vll L(N + 1, 0), R(N + 1, 0);
	repn(i, N) cin >> L[i] >> R[i];

	sort(L.begin(), L.end());
	sort(R.begin(), R.end(), greater<ll>());

	ll ans = 0;
	rep(i, N+1) {
		if (L[i] > R[i]) { ans += (L[i] - R[i]) * 2; }
	}

	cout << ans << endl;
}

Measured memory_bytes: 4788
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
constexpr ll MOD = 1e9 + 7;

vector<vector<vector<ll>>> way(ll D) {
	// 桁数 -> 末尾数字 -> D除算の余り -> 場合の数
	vector<vector<vector<ll>>> dp(1e4 + 3, vector<vector<ll>>(10, vector<ll>(D, 0)));
	rep(i, 10)dp[0][i][i%D]++;

	// 桁数 -> ソースの末尾数字 -> ソースのD除算余り -> 次の末尾数字
	rep(e, 1e4 + 2)rep(num, 10)rep(d, D)rep(add, 10) {
		(dp[e + 1][add][(d + add) % D] += dp[e][num][d]) %= MOD;
	}
	return dp;
}

int main()
{
	ll D;
	string N;
	cin >> N >> D;
	auto dp = way(D);

	ll res = 0;
	ll left = 0;
	rep(i, N.size() - 1) {
		ll pos = N.size() - i - 1;
		ll top = N[i] - '0';
		rep(j, top) {
			(res += dp[pos][j][(D * 10000 - left) % D]) %= MOD;
		}
		(left += top) %= D;
	}
	rep(i, N.back() - '0' + 1)if ((left + i) % D == 0)res++;
	res = (res - 1 + MOD) % MOD;
	cout << res % MOD << endl;

	return 0;
}


Measured memory_bytes: 83328
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
using namespace std;
#define ll long long

int main () {
  ll n;
  cin >> n;
  ll p[n];
  for (ll i = 0; i < n; i++) {
    cin >> p[i];  
  }
  sort(p, p + n);
  ll sum = 0;
  for (ll i = 0; i < n - 1; i++) {
    sum = sum + p[i];    
  }
  sum = sum + p[n - 1] / 2;
  cout << sum << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a1: usize = read();
    let a2: usize = read();
    let a3: usize = read();
    if a1 + a2 + a3 >= 22 {
        println!("bust");
    } else {
        println!("win");
    }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <array>
#include <utility>
#include <valarray>

using namespace std;

int main()
{
    int N, M;
    scanf("%d %d\n", &N, &M);
    vector<unordered_set<int>> edges(N);
    for (int i = 0; i < M; ++i){
        int ai, bi;
        scanf("%d %d\n", &ai, &bi); --ai; --bi;
        edges[ai].emplace(bi);
        edges[bi].emplace(ai);
    }
    int result = 0;
    function<void(vector<int>)> countResult = [&](vector<int> v){
        if (v.size() == N){
            ++result;
        }
        int now = v.back();
        for (auto& next : edges[now]){
            bool flag = true;
            for (auto& vi : v){
                if (vi == next){
                    flag = false;
                    break;
                }
            }
            if (!flag) continue;
            v.emplace_back(next);
            countResult(v);
            v.pop_back();
        }
    };
    countResult({0});
    printf("%d\n", result);
}


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

int main(){
	
	int n, current;
	cin >> n;
	vector<int> v(n);
	for (int i=0; i<n; i++){
		cin >> current;
		v[current - 1] = i + 1;
	}
	for (int x: v){
		cout << x << " ";
	}  
		
		
}


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

int x, n;
int p[200];

int main( int argc, char *argv[] )
{
    int ppp;

    scanf( "%d %d", &x, &n );
    for( int i=0; i<n; i++ ) {
        scanf( "%d", &ppp );
        p[ppp] = 1;
    }

    for( int i=0; i<100; i++ ) {
        if( p[x-i] == 0 ) {
            printf( "%d\n", x-i );
            exit(0);
        } else if( p[x+i] == 0 ) {
            printf( "%d\n", x+i );
            exit(0);
        }
    }
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 1e9
typedef long long ll;
typedef pair<int, int> P;

int n;
int A, B, C;
vector<int> l;
int dfs(int cnt, int a, int b, int c) {
    if (cnt == n) {
        return (a*b*c == 0 ? INF : abs(a-A) + abs(b-B) + abs(c-C) - 30); //初手の追加で+10*3してる分を引く
    }
    int tmp0 = dfs(cnt+1, a, b, c);
    int tmp1 = dfs(cnt+1, a+l[cnt], b, c) + 10;
    int tmp2 = dfs(cnt+1, a, b+l[cnt], c) + 10;
    int tmp3 = dfs(cnt+1, a, b, c+l[cnt]) + 10;
    return min(tmp0, min(tmp1, min(tmp2, tmp3)));
}

int main() {
    cin >> n >> A >> B >> C;
    l.resize(n);
    rep(i, n) cin >> l[i];

    int ans = dfs(0, 0, 0, 0);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	while(true)
	{
		int n, x;
		cin >> n >> x;
		if( 0 == n && 0 == x)
			break;
	
		int t = 0;
		int s = (x - 3)/3;
		for(int i = 1; i <= n - 2 && i <= s; ++i){
			for( int j = i + 1; j <= n -1; ++j){
				int k = x - i - j;
				if( k > n )  continue;
				if( k <= j ) break;
				++t;
			}
		}

		cout << t << "\n";
	}

	return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int32 dx[4] = {-1, 1, 0, 0};
int32 dy[4] = {0, 0, 1, -1};
int32 dir[1000] = {};

int main(void){
	int32 n, r;
	dir['N']=2; dir['E']=1; dir['W']=0; dir['S'] = 3;
	while(cin >> n && n){
		int32 cnt = n;
		bool f[30][30] = {};
		int32 y = 10, x = 10;
		REP(i, n){
			int32 a, b;
			cin >> a >> b;
			f[b][a] = 1;
			if(a == 10 && b == 10){
				f[b][a] = 0; cnt--;
			}
		}
		int32 q;
		cin >> q;
		REP(i, q){
			char c; int32 dis;
			cin >> c >> dis;
			REP(j, dis){
				y = y+dy[dir[c]]; x = x+dx[dir[c]];
				if(f[y][x]){
					f[y][x] = 0; cnt--;
				}
			}
		}
		cout << (cnt ? "No" : "Yes") << endl;
	}
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n, m;
    cin >> n >> m;
    vector<P> a(m);
    for(int i = 0; i < m; i++) cin >> a[i].second >> a[i].first;
    sort(a.begin(), a.end());
    int mi = 0;
    int ans = 0;
    for(int i = 0; i < m; i++) {
        int p = a[i].second;
        int q = a[i].first;
        if(p >= mi) {
            ans++;
            mi = q;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;
const int INF=1001001001;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a + b - c >= 0) cout <<  "Yes" << endl;
	else cout << "No" << endl;


	return 0;

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
#define M 1000000007
#define pi acos(-1)
ll dis[2001][2001];
/*ll power(ll a,ll b)
{
    ll res = 1;
    while(b > 0)
    {
        if(b & 1)
            res = (res*a)%M;
        a = (a*a)%M;
        b = b >> 1;
    }
    return res;
}*/
/*ll modinv(ll a)
{
   return power(a,M - 2); 
}*/
/*vector<ll> primes(ll n)
{
    bool *sieve = new bool[n + 1];
    ll i,j;
    vector<ll> v;
    for(i = 3; i <= n; i+=2)
        sieve[i] = true;
    sieve[2] = true;
    for(i = 3; i*i <= n; i+=2)
    {
        if(sieve[i])
            for(j = i*i; j <= n; j+=i)
                sieve[j] = false;
    }
    if(n >= 2)
    {
        v.pb(2);
        for(i = 3; i <= n; i+=2)
        {
            if(sieve[i])
                v.pb(i);
        }
    }
    return v;
}*/

class graph{
public:
    vector<ll> *g;
    ll n;
    graph(ll v)
    {
        n = v + 1;
        g = new vector<ll> [n];
    }
    void addedge(ll f,ll s)
    {
        g[f].pb(s);
        g[s].pb(f);
    }
    void dfs(bool *visited,ll sv)
    {
        visited[sv] = true;
        for(auto x: g[sv])
        {
            if(!visited[x])
            {
                dfs(visited,x);
            }
        }
    }
    void bfs(ll sv){
       queue<ll> q;
       bool visited[n] = {};
       q.push(sv);
       dis[sv][sv] = 0;
       visited[sv] = true;
       while(!q.empty())
       {
           ll node = q.front();
           q.pop();
           for(auto x : g[node])
           {
               if(!visited[x])
               {
                   dis[sv][x] = dis[sv][node] + 1;
                   visited[x] = true;
                   q.push(x);
               }
           }
       }
    }
};
int main()
{
  fast;
    ll i,j,t,n,x,y;
    cin >> n >> x >> y;
    graph g(n);
    ll count[n] = {};
    for(i = 1; i < n; i++)
        g.addedge(i,i + 1);
    g.addedge(x,y);
    memset(dis,0,sizeof(dis));
    for(i = 1; i <= n; i++)
        g.bfs(i);
    for(i = 1; i <= n; i++)
    {
        for(j = 1; j <= n; j++)
            count[dis[i][j]]++;
    }
    for(i = 1; i < n; i++)
        cout<<count[i]/2<<"\n";
    return 0;
}



Measured memory_bytes: 31744
#define judge
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int inf = 0x3f3f3f3f;
const int ninf = 0xcfcfcfcf;
const double pi = acos(-1.0);
static int faster_iostream = []() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return 0;
}();

int main() {
#ifndef judge
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  string s;
  cin >> s;
  int tag = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != s[s.size() - i - 1]) {
      tag = 1;
      break;
    }
  }
  if (tag) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}

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

using namespace std;

int main(){
    long long a, b, c;
    scanf("%lld %lld %lld", &a, &b, &c);

    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) printf("0");
    else printf("%lld", min(a * b, min(b * c, c * a)));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int ans=0;
    int n,l,r;
    cin >>n;
    for range(i,n){
        cin >> l >> r;
        ans+=r-l+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 1005
 
int main()
{ 
  int t, m, n, i, j, c[MAX][MAX];
  char a[MAX], b[MAX];
 
  scanf("%d", &t);
 
  while(t--){
    scanf("%s", a);
    scanf("%s", b);
    m = strlen(a);
    n = strlen(b);
    for(i=1; i<=m; i++){
      c[i][0] = 0;
    }
    for(j=0; j<=n; j++){
      c[0][j] = 0;
    }
    for(i=1; i<=m; i++){
      for(j=1; j<=n; j++){
		if(a[i-1] == b[j-1]){
		  c[i][j] = c[i-1][j-1] + 1;
		}
		else{
		  if(c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
		  else c[i][j] = c[i][j-1];
		}
      }
    }
    printf("%d\n", c[m][n]);
  }

  return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

int main() {
	lli K;
	cin >> K;
	lli ans = 0;
	for (lli i = 1; i <= K; i++) {
		for (int j = 1; j <= K; j++) {
			lli p = gcd(i, j);
			for (int k = 1; k <= K; k++) {
				ans += gcd(p, k);
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3636
# include <iostream>
# include <cstring>

const int MAX=16;

int w,h;
int n;

int dp[MAX][MAX];

int main(){
	while(1){
		std::cin>>w>>h;
		if(w+h==0)
			break;
		for(int i=0;i<h;++i){
			for(int j=0;j<w;++j)
				dp[i][j]=1;
		}
		std::cin>>n;
		int x,y;
		for(int i=0;i<n;++i){
			std::cin>>x>>y;
			--x;
			--y;
			dp[y][x]=0;
		}
		bool flag=false;
		for(int i=0;i<w;++i){
			if(flag)
				dp[0][i]=0;
			else if(!dp[0][i])
				flag=true;
		}
		flag=false;
		for(int i=0;i<h;++i){
			if(flag)
				dp[i][0]=0;
			else if(!dp[i][0])
				flag=true;
		}

		for(int i=1;i<h;++i){
			for(int j=1;j<w;++j){
				if(!dp[i][j])
					dp[i][j]=0;
				else
					dp[i][j]=dp[i-1][j]+dp[i][j-1];
			}
		}
		std::cout<<dp[h-1][w-1]<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;



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

	cin >> N;
	while (N) {
		vector<int>num(N);
		for (int i = 0; i < N; i++) {
			cin >> num[i];
		}
		string s;
		cin >> s;
		K = s.size();
		for (int i = 0; i < K; i++) {
			for (int j = 0; j < num[i%N]; j++) {
				s[i]--;
				if (s[i] == char('a' - 1)) {
					s[i] = 'Z';
				}
				if (s[i] == char('A' - 1)) {
					s[i] = 'z';
				}
			}
			cout << s[i];
		}
		cout << endl;
		cin >> N;
	}
	return 0;
}

Measured memory_bytes: 3224
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    vector<ll> sum(n+1, 0), cnt(n+1, 0);
    cnt[0] = 3;
    for(int i=0; i<n; i++){
        sum[a[i]]++;
    }

    ll ans = 1;
    for(int i=0; i<n; i++){
        cnt[a[i]]++;
        ans *= (cnt[a[i] - 1] - cnt[a[i]] + 1);
        ans %= MOD;
        // cnt[a[i] - 1]--;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  
  int ans=0;
  for(int i=0;i<k;i++){
    ans += a.at(i);
  }
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 3600
/// Thank you tanakh!!!
///  https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(n: usize, x: usize, a: [usize; n],);
    let mut a: Vec<usize> = a.clone();
    a.sort();
    let mut x = x;
    let mut ans = 0;
    for (i, &a) in a.iter().enumerate() {
        if i < n - 1 && a <= x {
            x -= a;
            ans += 1;
        } else if a == x {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  string input;
  cin>>input;
  for(auto c:input){
    if(c=='7'){
      cout<<"Yes"<<"\n";  
      return 0;
    }
  }
  cout<<"No"<<"\n";  
 
  
  return 0;
}

Measured memory_bytes: 3632
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    bool solve() {
        int n, m; readf("%d %d\n", &n, &m);
        if (n == 0 && m == 0) return false;
        auto as = readln.chomp.split(" ").map!(to!int).array;
        int ans = 0;
        foreach (i, a; as) {
            foreach (j, b; as[i + 1 .. $]) {
                if (a + b <= m) {
                    ans = max(ans, a + b);
                }
            }
        }
        if (ans == 0) {
            writeln("NONE");
        } else {
            writeln(ans);
        }
        return true;
    }
    while (solve()) {}
}

Measured memory_bytes: 2904
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

A = inputIL()

print(max(A)-min(A))

Measured memory_bytes: 63980
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6+10;
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9+7;
void add(int &a,int b) {a+=b; if(a>=mod) a-=mod;}
void dec(int &a,int b) {a-=b; if(a<0) a+=mod;}
int main()
{
    int K ;
    cin >> K;
    int ans = 0;
    FOR(A,1,K+1)
    FOR(B,1,K+1)
    FOR(C,1,K+1)ans+=gcd(gcd(A,B),C);
    cout << ans << endl;
    
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

bool g[700][700];
int color[700];
int n, m;

void dfs(int u, vector<int> &vs) { 
  vs.push_back(u);
  for (int v = 0; v < n; v++) {
    if (!g[u][v]) continue;
    if (color[v] == -1) {
      color[v] = color[u] ^ 1;
      dfs(v, vs);
    } else if (color[v] != color[u] ^ 1) {
      puts("-1");
      exit(0);
    }
  }
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      g[i][j] = true;
    }
    g[i][i] = false;
    color[i] = -1;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u][v] = false;
    g[v][u] = false;
  }
  bitset<701> dp;
  dp[0] = true;
  for (int i = 0; i < n; i++) {
    if (color[i] == -1) {
      color[i] = 0;
      vector<int> vs;
      dfs(i, vs);
      int w = 0;
      int b = 0;
      for (int v : vs) {
        if (color[v] == 0) {
          w++;
        } else {
          b++;
        }
      }
      dp = (dp << w) | (dp << b);
    }
  }
  int ans = 1e9;
  for (int i = 0; i <= 700; i++) {
    if (dp[i]) {
      ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H1, M1, H2, M2, K, Ans;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  Ans = (H2-H1)*60+(M2-M1)-K;
  cout << Ans << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
int main(void)
{
    int l,r;
    int i,j;
    int imod;
    int iminmod = 2020; 
     0 <= l < 2000000000;
    0 < r <= 2000000000;

    scanf("%d%d",&l,&r);

    i = l;
    if(r-l>=2019){
        printf("%d\n",0);
        return 0;
    }
    else{
    for(j =i+1; j<=r; j++ ){
        for(i = l; i<=j-1;i++){
            imod=(i%2019)*(j%2019)%2019;
            if(imod < iminmod){
                iminmod = imod;               
            }
        }
    }
    }
       
     printf("%d\n",iminmod);
     return 0;
     }


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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> a;
    for (int i = 0; i < n; ++i) {
        int f;
        cin>>f;
        a.emplace_back(f,i+1);
    }
    vector<int> ans;
    for (int j = 0; j < a.size(); ++j) {
        for (int k = a.size()-1; k >= 0; --k) {
            if(a[k].second<0)continue;
            if(a[k].first==a[k].second){
                ans.emplace_back(a[k].first);
                a[k].second=-1;
                break;
            }
            else{
                --a[k].second;
            }
        }
    }
    for(auto i:a){
        if(i.second>=0){
            cout<<-1<<endl;
            return 0;
        }
    }
    reverse(ans.begin(),ans.end());
    for(auto i:ans)printf("%d\n",i);
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
    input = input.split("\n");
    var N = parseInt(input[0], 10);
    var H = input[1].split(" ").map(Number).reverse();
    
    var ans = "Yes";
    for (var i = 1; i < N; i++){
        if (H[i] - H[i - 1] > 1) {
            ans = "No";
            break;
        }
        
        if (H[i] - H[i - 1] === 1) {
            H[i] -= 1;
        }
    }

  	//出力
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 17816
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ll x;
    cin >> x;
    ll m = 100;
    int cnt = 0;
    while (m < x)
    {
        m = m + m * 0.01;
        cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
//ユークリッド
ll gcd(ll a,ll b){
	ll t;
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	if(a%b==0)return b;
	return gcd(b,a%b);
}
//階乗
ll Factorial(ll a){
	ll b=1;
	for(ll i=a;i>=1;i--){
		b=b*i;
	}
	return b;
}
//素数判定
bool prime(ll n){
	for(ll i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}
int main()
{
	ll H,W;
	string ANS="Yes";
	cin>>H>>W;
	vector<vector<char>>V(H+2,vector<char>(W+2,'.'));
	for(ll i=1;i<=H;i++){
		for(ll j=1;j<=W;j++){
			char t;
			cin>>t;
			V[i][j]=t;
		}
	}
	for(ll i=1;i<=H;i++){
		for(ll j=1;j<=W;j++){
			if(V[i][j]=='#'&&V[i+1][j]!='#'&&V[i-1][j]!='#'&&V[i][j-1]!='#'&&V[i][j+1]!='#'){
				ANS="No";
			}
		}
	}
	cout<<ANS<<endl;
}

Measured memory_bytes: 256
a,v = list(map(int, input().split()))
b,w = list(map(int, input().split()))
t = int(input())

diff = abs(a-b)
V = v-w
if V <= 0:
    print('NO')
else:
    if diff<=V*t:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9180
#include <stdio.h>
int n;
int C[10001];
void CountingSort(int A[],int B[],int k){
    int i,j;
    for(i=0;i<k;i++){
        C[i]=0;
    }
    for(j=1;j<=n;j++){
        C[A[j]]++;
    }
    for(i=1;i<=k;i++){
        C[i]=C[i]+C[i-1];
    }
    for(j=n;j>=1;j--){
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }
}
int main(){
    int i,MAX=0;
    int *A,*B;
    scanf("%d",&n);
    A = malloc(sizeof(int)*n+1);
    B = malloc(sizeof(int)*n+1);
    for(i=1;i<=n;i++){
        scanf("%d",&A[i]);
        if(MAX<A[i]){
            MAX=A[i];
        }
    }
    CountingSort(A,B,MAX);
    for(i=1;i<=n-1;i++){
        printf("%d ",B[i]);
    }
    printf("%d\n",B[i]);
}


Measured memory_bytes: 17464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 2019;


//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}


int main(){
    ll N; cin >> N;
    vector<ll> A(N); rep(i, N) cin >> A[i];
    vector<ll> GCDL(N), GCDR(N); GCDL[0] = A[0], GCDR[N-1] = A[N-1];
    ll ans = 0;
    for(int i = 1; i < N; i++) GCDL[i] = gcd(GCDL[i-1], A[i]);
    for(int i = N-2; i >= 0; i--) GCDR[i] = gcd(GCDR[i+1], A[i]);

    for(int i = 0; i < N; i++){
        if(i == 0) ans = max(ans, GCDR[1]);
        else if(i == N-1) ans = max(ans, GCDL[N-2]);
        else ans = max(ans, gcd(GCDL[i-1], GCDR[i+1]));
    }
    cout << ans << endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#include <tuple>
#include <string>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
#define FORk(N) for(int k=0;k<N;++k)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
void swap(ll &a,ll &b){
  ll tmp=a;
  a=b;
  b=tmp;
}
int main(){
  ll N,A,B,C,D;
  string S;
  cin>>N>>A>>B>>C>>D>>S;
  for(int i=A-1;i+1<C;++i){
    if(S[i]=='#'&&S[i+1]=='#'){
      putYN(false);
      return 0;
    }
  }
  for(int i=B-1;i+1<D;++i){
    if(S[i]=='#'&&S[i+1]=='#'){
      putYN(false);
      return 0;
    }
  }
  if(A<C&&C<B&&B<D){
    putYN(true);
  }else if(A<B&&B<C&&C<D){
    putYN(true);
  }else{
    int flag=false;
  	for(int i=B-1-1;i+2<=D;++i){
      if(S[i]=='.'&&S[i+1]=='.'&&S[i+2]=='.'){
        flag=true;
        break;
      }
    }
    putYN(flag);
  }
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
# define ll long long int
#define mp	make_pair
#define pb	push_back
ll mod=1000000007;

int main() {
   
   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll n;
	cin>>n;
	int h[n+1][3];
	for(int i=1;i<=n;i++){
	   cin>>h[i][0]>>h[i][1]>>h[i][2];
	}
	int dp[n+1][3];
	dp[0][0]=0;dp[0][1]=0;dp[0][2]=0;
	dp[1][0]=h[1][0];dp[1][1]=h[1][1];dp[1][2]=h[1][2];
	for(int i=2;i<=n;i++){
	   dp[i][0]=h[i][0]+max(dp[i-1][1],dp[i-1][2]);
	   dp[i][1]=h[i][1]+max(dp[i-1][0],dp[i-1][2]);
	   dp[i][2]=h[i][2]+max(dp[i-1][1],dp[i-1][0]);
	}
	int ans=max(dp[n][0],max(dp[n][1],dp[n][2]));
	cout<<ans;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
ll getdiff(string a, string b)
{
	ll i,cnt=0;
	for(i=0;i<a.length();i++)
	{
		if(a[i]!=b[i])
			cnt++;
	}
	return cnt;
}
int main()
{
	ios_base::sync_with_stdio(false);
	string s,t;
	cin>>s>>t;
	ll n=s.length(), m = t.length();
	string ss = s.substr(0, m);
	ll ans = getdiff(ss, t);
	ll i=1;
	while(i+m<n)
	{
		ss = s.substr(i, m);
		ans = min(ans, getdiff(ss, t));
		i++;
	}
	cout<<ans<<nl;
	return 0;
}

Measured memory_bytes: 3652
main = do
    l <- getLine
    let (a:b:[]) = map read $ words l :: [Int]
    putStrLn $ a `compare'` b
compare' :: Int -> Int -> String
compare' a b
    | ordering == LT = "a < b"
    | ordering == EQ = "a == b"
    | ordering == GT = "a > b"
    where ordering = a `compare` b

Measured memory_bytes: 3452
def calc(lhs, op, rhs)
  if op == '+'
    lhs + rhs
  else
    lhs - rhs
  end
end

def main
  nums = ARGF.gets.chars.map(&:to_i)
  # puts nums

  ['+', '-'].each do |op1|
    ans1 = calc(nums[0], op1, nums[1])

    ['+', '-'].each do |op2|
      ans2 = calc(ans1, op2, nums[2])

      ['+', '-'].each do |op3|
        ans3 = calc(ans2, op3, nums[3])

        if ans3 == 7
          puts "#{nums[0]}#{op1}#{nums[1]}#{op2}#{nums[2]}#{op3}#{nums[3]}=7"
          return
        end
      end
    end
  end

  puts 'error'  # 問題の前提上、ありえない
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 1788
from collections import defaultdict
from typing import DefaultDict

from collections import defaultdict

N = int(input())
A = [int(i) for i in input().split()]
di_A = defaultdict(int)

for a in A:
    di_A[a] += 1

Q = int(input())
now_sum = sum(A)
ans = []
for _ in range(Q):
    b, c = [int(i) for i in input().split()]
    cnt = di_A[b]
    now_sum += cnt * (c-b) 
    di_A[b] = 0
    di_A[c] += cnt
    ans.append(now_sum)

for a in ans:
    print(a)




Measured memory_bytes: 27508
from math import factorial as fct
def main():
    MOD = 10**9 + 7
    N, K = map(int, input().split())
    b = K
    r = N - K
    for i in range(1, K+1):
        p_blue = (fct((b-i)+(i-1)) // fct(b-i) // fct(i-1)) % MOD
        if r >= i-1:
            p_red = (fct((r-(i-1))+i) // fct(r-(i-1)) // fct(i)) % MOD
        else:
            p_red = 0
        print((p_blue * p_red) % MOD)
main()

Measured memory_bytes: 3316
#include<stdio.h>
#include<math.h>

int main(){
  double a,b,x,v,h,w;
  scanf("%lf %lf %lf",&a,&b,&x);
  v=a*a*b;
  if(x/v>=0.5){
  	h=(1-x/v)*b*2.0;
  	printf("%.10lf",atan(h/a)*180/M_PI);
  }else{
  	w=2.0*x*a/v;
    printf("%.10lf",atan(b/w)*180/M_PI);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define reps(i, s, n) for(int i = (int)s; i < (int)n; i++)
#define in(i) std::cin >> i;
#define print(i) std::cout << i;
#define println(i) std::cout << i << std::endl;

int main() {
    int x;
    in(x)
    if(x >= 30)print("Yes")
    else print("No")
    return 0;
}

Measured memory_bytes: 3000
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,ans;
  cin >> n;
  vector<int>a(n);
  for(int i;i<n;i++){
    cin >> a.at(i);
  }
  int p=a.at(0);
  ans=0;
  for(int i;i<n;i++){
    if(p<=a.at(i)){
      ans+=1;
      p=a.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256