akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

/*
ifstream ifs("in.txt");
ofstream ofs("out.txt");
#define cin ifs
#define cout ofs
//*/

int N, K, Q;
int A[2200];
signed main() {
    cin >> N >> K >> Q;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ans = 1145141919810LL;
    for (int i = 0; i < N; i++) {
        vint vec;
        priority_queue<int, vint, greater<int> > pq;
        for (int j = 0; j < N; j++) {
            if (A[j] < A[i]) {
                while (pq.size() >= K) {
                    vec.push_back(pq.top());
                    pq.pop();
                }
                while (!pq.empty()) {
                    pq.pop();
                }
            } else {
                pq.push(A[j]);
            }
        }

        while (pq.size() >= K) {
            vec.push_back(pq.top());
            pq.pop();
        }
        sort(vec.begin(), vec.end());
        if (vec.size() < Q) continue;
        if (vec[0] != A[i]) continue;
        ans = min(ans, vec[Q - 1] - A[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  for(int i=1;i<=3500;i++){
    for(int j=1;j<=3500;j++){
      ll s = 4*i*j - n*(i+j);
      if(s>0&&(n*i*j)%s==0){
        std::cout << i << " " << j << " " << (n*j*i)/s << '\n';
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 888
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 k: u32 = read();
    let x: u32 = read();
    let mut ans = "No".to_string();
    if 500 * k >= x {
        ans = "Yes".to_string();
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>

using namespace std;
int a,b,c,d;

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


    return 0;
}


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

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

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

int main(){

    int a,b,c;

    cin >> a >> b >> c;

    ll u=lcm(a,b);

    ll t=a;

    while(t<=u){
        if(t%b==c){
            cout << "YES" << endl;
            return 0;
        }
        t+=a;
    }

    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    for(auto&i:p) cin>>i,--i;
    vector<ll> c(n),q(n+1);
    for(auto&i:c) cin>>i;
    ll ans{LLONG_MIN};
    fr(i,n){
        int t{0},j{p[i]};
        q[0]=0;
        for(;j!=i;j=p[j]){
            ++t;
            q[t]=q[t-1]+c[j];
        }
        ++t;
        q[t]=q[t-1]+c[j];
        ll tmp{LLONG_MIN};
        if(t>k){
            Fr(l,k) chmax(tmp,q[l]);
        }
        else if(q[t]<0){
            Fr(l,t) chmax(tmp,q[l]);
        }
        else{
            Fr(l,t) chmax(tmp,q[t]*(k/t-1)+q[l]);
            Fr(l,k-k/t*t) chmax(tmp,q[t]*(k/t)+q[l]);
        }
        chmax(ans,tmp);
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 3760
from collections import Counter
n = int(input())
V = list(map(int, input().split()))
x = len(set(V))
if x == 1:
    print(n // 2)
else:
    A = list()
    B = list()
    for i, v in enumerate(V):
        if i & 1:
            A.append(v)
        else:
            B.append(v)
    A = Counter(A).most_common()
    B = Counter(B).most_common()
    a = A[0]
    b = B[0]
    if a[0] == b[0]:
        if len(A) == 1:
            b = B[1]
        elif len(B) == 1:
            a = A[1]
        else:
            if A[1][1] >= B[1][1]:
                a = A[1]
            else:
                b = B[1]
    print(n - a[1] - b[1])


Measured memory_bytes: 25500
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    int ans=0;
    string s;
    cin>>s;
    string t=s;
    reverse(t.begin(),t.end());
    for(unsigned int i=0;i<s.size()/2;i++)
    {
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3612
A, B, C, X, Y = map(int, input().split())
cost = 0
xy = min(X, Y)
cost += min(A + B, 2 * C) * xy
X -= xy
Y -= xy
D = 0
if max(X, Y) == X:
  D = A
else:
  D = B
print(cost + (min(D, 2 * C) *  max(X, Y)))

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MaxSize = 100 + 5;
LL const MOD = 1e9 + 7;
LL const BASE = 256;

/*
 bsearch on the right most can leave thing
 bsearhc on the left most can leave thing
 for each letter

 26 * 2 * 2e5

 */

int N, Q;
string s;
vector<PII> ins;
const int CS = 26;
SAL cis;

int run(int i) {

	int curI = i;
	LP(qi, 0, Q)
	{
		if (ins[qi].first != (s[curI] - 'A')) {
			continue;
		}

		//cout << qi << " " << curI << endl;

		if (ins[qi].second) {
			curI--;
			if (curI < 0)
				return -1;
		} else {
			curI++;
			if (curI >= N)
				return 1;
		}
	}

	return 0;
}

int findToR(int c) {

	int subN = cis[c].size();
	int low = 0;
	int high = subN - 1;

	while (low < high) {
		int mid = (low + high) / 2;

		int res = run(cis[c][mid]);

		if (res == 1) {
			high = mid;
		} else {
			low = mid + 1;
		}
	}

	if (low == high) {
		int res = run(cis[c][low]);
		if (res == 1) {
			return subN - low;
		}
	}

	return 0;
}

int findToL(int c) {
	int subN = cis[c].size();
	if(subN == 0)
		return 0;
	int low = 0;
	int high = subN - 1;

	while (low < high) {
		int mid = (low + high) / 2;

		int res = run(cis[c][mid]);

		if (res == -1) {
			if (run(cis[c][mid + 1]) == -1) {
				low = mid + 1;
			} else {
				return mid + 1;
			}
		} else {
			high = mid;
		}
	}

	//cout << c << " " << low << " " << cis[c][low] << " "<< high << endl;

	if (low == high) {
		int res = run(cis[c][low]);
		if (res == -1) {

//	cout << c << " " << low << " " << cis[c][low] << " "<< high << endl;
			return low + 1;
		}
	}

	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);
	cin >> N >> Q >> s;

	cis = SAL(CS + 1);
	LP(i, 0, Q)
	{
		char c, dir;
		cin >> c >> dir;
		ins.push_back(PII(c - 'A', dir == 'L' ? 1 : 0));
	}

	LP(i, 0, N)
	{
		cis[s[i] - 'A'].push_back(i);
	}

	int ans = N;

	LP(i, 0, CS)
	{
		int toR = findToR(i);
		int toL = findToL(i);


		int removed = min(toR + toL, (int) cis[i].size());
		ans -= removed;
	}

	//cout << run(1) << endl;

	cout << ans;

	return 0;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
	fast;
	ll n;
	cin>>n;
	double x,sum=0;
	for(int i=1;i<=n;i++){
		cin>>x;
		sum+=(1/x);
	}
	cout<<1/sum<<endl;
	return 0;
}/*『你强归你强，我永不示弱』*/


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main () {
	int n;
	cin >> n; 
	int mn;
	cin >> mn;
	int ans = 1;
	for(int i = 1; i < n; i++) {
		int cur; 
		cin >> cur;
		if(cur <= mn) {
			ans += 1;
		}
		mn = min(mn, cur);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3604
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int n;
    cin >> n;
    cout << 48 - n << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)

n, m=map(int, input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
g=[list() for i in range(1+n)]
#print(g)

par=[i for i in range(n)]
cnt_con=[1 for i in range(n)]

def root(x):
    if x==par[x]:
        return x
    else:
        par[x]=root(par[x])
        return par[x]
def connect(x,y):
    #par[x]=root(x)
    #par[y]=root(y)
    if root(x)==root(y):
        0
    else:
        cnt_con[root(y)]+=cnt_con[root(x)]
        par[root(x)]=root(y)      
    return

for i in range(m):
    a[i], b[i]=map(int, input().split())
    a[i], b[i]=a[i]-1, b[i]-1


tmp=int(n*(n-1)/2)
ans=[0]*m
ans[-1]=tmp
#ans[0]=0
#print('a,b=',a,b)
for i in range(m-1,-1,-1):
    ans[i]=tmp
    if root(a[i])==root(b[i]):
        0
    else:
        tmp-=cnt_con[root(a[i])]*cnt_con[root(b[i])]
    connect(a[i],b[i])
    #print('i,tmp',i,(a[i],b[i]),ans[i],tmp,par,cnt_con)
    

    
for i in range(m):
    print(ans[i])



Measured memory_bytes: 38080
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;

using namespace std;

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    ll count = 0;
    count += min(a, k);
    k -= min(a, k);
    k -= min(b, k);
    count -= min(c, k);

    cout << count << "\n";

    return 0;
}

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

int main() {
  string c;
  cin >> c;
  
  if (c == "a" || c=="e" || c=="i" || c=="u" || c=="o"){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" <<endl;
  }
}


Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  string N;
  cin>>N;
  int len=N.length()-1;
  char n=N[len];
  if(n=='3'){
    cout<<"bon";
  }else if(n=='0'||n=='1'||n=='6'||n=='8'){
    cout<<"pon";
  }else{
    cout<<"hon";
  }

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
struct UnionFind
{
  vector< int > data;
  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }
  int find(int x)
  {
    if(data[x] < 0) return(x);
    return(data[x] = find(data[x]));
  }
  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return(false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return(-data[x] == data.size());
  }
};
  
struct edge
{
  int u, v, cost;
  bool operator<(const edge& e) const
  {
    return(cost < e.cost);
  }
};

int main()
{
  int N, M;
  while(cin >> N >> M, N) {
    vector< edge > edges;
    for(int i = 0; i < M; i++) {
      int u, v, w;
      cin >> u >> v >> w;
      --u, --v;
      edges.push_back((edge){u, v, w});
    }
    sort(edges.begin(), edges.end());
    int ret = INF;
    for(int i = 0; i <= M - N + 1; i++) {
      UnionFind uf(N);
      for(int j = i; j < M; j++) {
        if(uf.unite(edges[j].u, edges[j].v)) {
          ret = min(ret, edges[j].cost - edges[i].cost);
          break;
        }
      }
    }
    if(ret == INF) cout << -1 << endl;
    else cout << ret << endl;
  }
}

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

int D;
long long G;
vector<long long> p, c;

int main() {
  cin >> D >> G;
  p.resize(D); c.resize(D);
  for (int i = 0; i < D; ++i) cin >> p[i] >> c[i];

  long long res = 1<<29;
  for (int bit = 0; bit < (1<<D); ++bit) {
    long long sum = 0;
    long long num = 0;
    for (int i = 0; i < D; ++i) {
      if (bit & (1<<i)) sum += c[i] + p[i] * 100 * (i+1), num += p[i];
    }
    if (sum >= G) res = min(res, num);
    else {
      for (int i = D-1; i >= 0; --i) {
        if (bit & (1<<i)) continue;
        for (int j = 0; j < p[i]; ++j) {
          if (sum >= G) break;
          sum += 100 * (i+1);
          ++num;
        }
      }
      res = min(res, num);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3544
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 100005;
const double mm = 1e+30;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
void solve()
{
    ll h,n;
    cin>>h>>n;
    ll xx=0;
    rep0(i,n){
        ll t;
        cin>>t;
        xx+=t;
    }
    if(h<=xx) cout<<"Yes";
    else cout<<"No";
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

#define INF (1<<25)

int ladj[205][205];
int sadj[205][205];

int main()
{
	int N, M;
	while(cin >> N >> M, (N||M))
	{
		int x,y,s;
		char l;
		for(int i=0; i<=N; i++)
		for(int j=0; j<=N; j++)
		{
			if(i==j)
			{
				ladj[i][j]=0;
				sadj[i][j]=0;
			}
			else
			{
				ladj[i][j]=INF;
				sadj[i][j]=INF;
			}
		}
		for(int i=0; i<M; i++)
		{
			cin >> x >> y >> s >> l;
			if(l=='L')
			{
				ladj[x][y]=min(ladj[x][y], s);
				ladj[y][x]=min(ladj[y][x], s);
			}
			else
			{
				sadj[x][y]=min(sadj[x][y], s);
				sadj[y][x]=min(sadj[y][x], s);
			}
		}
		
		for(int k=1; k<=N; k++)
		for(int y=1; y<=N; y++)
		for(int x=1; x<=N; x++)
		{
			int d=ladj[x][k]+ladj[k][y];
			if(d<ladj[x][y]) ladj[x][y]=d;
			
			    d=sadj[x][k]+sadj[k][y];
			if(d<sadj[x][y]) sadj[x][y]=d;
		}
		
		int R[1005],RN;
		cin >> RN;
		for(int i=0; i<RN; i++)
			cin >> R[i];
			
		int dp[1005][202];
		for(int i=0; i<RN; i++)
		for(int j=0; j<=N; j++)
			dp[i][j]=INF;
			
		dp[0][R[0]]=0;
		
		for(int i=1; i<RN; i++)
		for(int j=1; j<=N; j++)
		{
			dp[i][j]=min(dp[i][j], dp[i-1][j]+ladj[R[i-1]][R[i]]);
			for(int k=1; k<=N; k++)
			{
				dp[i][k]=min(dp[i][k], dp[i-1][j]+ladj[R[i-1]][j]+sadj[j][k]+ladj[k][R[i]]);
			}
		}
		
		int ans=INF;
		for(int i=1; i<=N; i++)
			ans=min(ans,dp[RN-1][i]);
		cout <<ans<< endl;

	}
}

Measured memory_bytes: 1988
#include<bits/stdc++.h>
#define LLI long long int
#define pii pair<int,int>
#define fst first
#define sec second
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

int main()
{
    int i,j;
    int N,R;

    scanf("%d %d", &N, &R);
    if( N >= 10)
        printf("%d\n", R);
    else
    {
        printf("%d\n", R + 1000 - 100*N);
    }

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


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

int main() {
    int m,d;
    cin >> m >> d;
    int ans = 0;
    for(int i = 1; i <= m; i++) {
        for(int j = 1; j <= d; j++) {
            int ten = j / 10;
            int one = j % 10;
            if(ten < 2 || one < 2) {
                continue;
            }
            if(ten * one == i) {
                ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int s = 0;
    int m = n;
    while (m)
        s += m % 10, m /= 10;
    cout << (n % s == 0 ? "Yes" : "No");
}


Measured memory_bytes: 256
import java.io.*;class Main{
public static void main(String a[])throws Exception{
int i,j;
boolean f;
float l[]=new float[8];
BufferedReader B=new BufferedReader(new InputStreamReader(System.in));
for(String s;(s=B.readLine())!=null;System.out.println(f?"NO":"YES")){
a=s.split(",");
f=false;
for(j=0;j<2;j++){
for(i=0;i<8;i++)l[i]=Float.valueOf(a[(4*j+i)%8]);
f|=
((l[0]-l[2])*(l[5]-l[1])+(l[1]-l[3])*(l[0]-l[4]))*
((l[0]-l[2])*(l[7]-l[1])+(l[1]-l[3])*(l[0]-l[6]))<0;
}
}
}
}


Measured memory_bytes: 24564
#include<stdio.h>

int main(){
  int from, to, target;
  int i;
  int cnt = 0;
  
  scanf("%d %d %d", &from, &to, &target);

  for(i = from; i <= to; i++){
    if(target % i == 0){
      cnt++;
    }
  }

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



Measured memory_bytes: 2120
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    A = NLI()
    
    cnt = 0
    minimum_abs = 10**9
    ans = 0
    flag = 0
    
    for n in range(N):
        ans += abs(A[n])
        minimum_abs = min(abs(A[n]),minimum_abs)
        if A[n] < 0:
            cnt += 1
        elif A[n] == 0:
          flag = 1

                
    if cnt % 2 == 0 or flag == 1:
        print(ans)
    else:
        print(ans - minimum_abs * 2)
            


if __name__ == '__main__':
    main()

Measured memory_bytes: 20564
#include<iostream>
#include<algorithm>
#include<vector>
#include <numeric>
#include  <string>
using namespace std;
int main(int argc, char const *argv[]) {
    int y,m,d;
    string S,tmp;
    std::cin >> S;

    tmp = S.substr(0,  4);
    y = atoi(tmp.c_str());
    tmp = S.substr(  5,   2);
    m = atoi(tmp.c_str());
    tmp = S.substr(  9,   2);
    d = atoi(tmp.c_str());
    if(y>=2019&&m>=5){
        std::cout << "TBD" << '\n';
    }else{
        std::cout << "Heisei" << '\n';
    }

    return 0;
}


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

int n,a[21];

int solve(int i,int m){
  if(m==0) return true;
  if(i==n) return false;
  return solve(i+1,m)||solve(i+1,m-a[i]);
}

int main(){
  cin >> n;
  for(int i=0;i<n;i++) cin >> a[i];
  int q; cin >>q;
  int m[q];
  for(int i=0;i<q;i++){
    cin >> m[i];
    if(solve(0,m[i])) cout << "yes" << endl;
    else cout << "no" << endl;
  }
}

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

int main(int argc, char *argv[]) {
        char lower_input;
        std::cin >> lower_input;

        if (lower_input == 'a'
        || lower_input == 'e'
        || lower_input == 'i'
        || lower_input == 'o'
        || lower_input == 'u') {
                std::cout << "vowel" << std::endl;
        } else {
                std::cout << "consonant" << std::endl;
        }

        return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
 
 
public class Main{
	
	public static boolean is_leading_zero(String str){
		if(str.length() == 0){
			return false;
		}else{
			return str.charAt(0) == '0';
		}
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	
    	final int a = sc.nextInt();
    	
    	String input = Integer.toString(a);
    	
    	int count = 0;
    	for(int pos = 0; pos <= input.length(); pos++){
    		String fst = input.substring(0, pos);
    		String snd = input.substring(pos);
    		
    		if(is_leading_zero(fst) || is_leading_zero(snd)){
    			continue;
    		}
    		
    		if(fst.equals("")){
    			fst = "0";
    		}
    		if(snd.equals("")){
    			snd = "0";
    		}
    		
    		final int sub = Integer.parseInt(fst);
    		final int add = Integer.parseInt(snd);
    		
    		if((add + sub) % 2 != 0){
    			continue;
    		}
    		final int x = (add + sub) / 2;
    		final int y = add - x;
    		
    		if(x < 0 || y < 0){
    			continue;
    		}
    		
    		//System.out.println(x + " : " + y);
    		
    		count++;
    	}
    	System.out.println(count);
    }
     
}

Measured memory_bytes: 17304
#include<stdio.h>
int main(void){
  int a,b;
  int x,i,N;
  
  scanf("%d%d",&a,&b);
  if(a>=1 && a<=1000000000 && b>=1 && b<=1000000000){
    if(a<=b){
      x=b%a;
      for(i=1;i<=x;i++){
	if(a%i==0 && x%i==0)N=i;
      }
      if(x==0)N=a;
    }
  
    else {
      x=a%b;
      for(i=1;i<=x;i++){
	if(b%i==0 && x%i==0)N=i;
      }
      if(x==0)N=b;
    }
  }
  printf("%d\n",N); 
  return 0; 
}

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

using namespace std;

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

    string w;
    cin >> w;
    int n = w.size();
    vector<int> cnt(26);
    for(int i = 0; i < n; i++)
        cnt[w[i] - 'a']++;
    for(int i = 0; i < 26; i++)
    {
        if(cnt[i] & 1)
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);

    while (true) {
      int H = scan.nextInt();
      int W = scan.nextInt();

      if ((H == 0) && (W == 0)) {
        break;
      }
      
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          System.out.print("#");
        }
        System.out.println();
      }
      
      System.out.println();
    }

  }
}


Measured memory_bytes: 35272
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>

//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
map<LL, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, s, t, ans, cnt, sum, a[210000], dp[210000];
string str;
bool f[110000];
//char c;
int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i];
		f[a[i]-1] = 1;
	}
	dp[0] = 1;
	rep(i, n + 1) {
		if (f[i] == 0)
			dp[i + 1] += dp[i];
		if (f[i + 1] == 0)
			dp[i + 2] += dp[i];
		dp[i + 1] %= MOD;
		dp[i + 2] %= MOD;
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 1920
n = int(input())
a = list(map(int, input().split()))

l = []
a.sort()

num = 1
for i in range(len(a)-1):
    if a[i+1] == a[i]:
        num += 1
    else:
        l.append(num)
        num = 1
l.append(num)

count = 0
for i in range(len(l)):
    if l[i] % 2 == 1:
        l[i] = 1
    else:
        count += 1
        l[i] = 1

if count % 2 == 0:
    print(sum(l))
else:
    print(sum(l) - 1)

Measured memory_bytes: 14396
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        int m = 0;
        for (int i = 1; i <= n; i++)
        {
            if (i % 2 == 1)
            {
                m++;
            }
        }

        var rate = m / (double)n;
        Console.WriteLine(rate);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = (int)1e5 + 10;

int n, a[N];
vector<P> v[N];

void dfs(int s, int p, int dist){
   if(dist % 2 == 0){
      a[s] = 0;
   }
   else{
      a[s] = 1;
   }
   for(auto i: v[s]){
      if(i.F != p){
         dfs(i.F, s, dist+i.S);
      }
   }
}

int32_t main(){_

   cin>>n;

   for (int i = 0; i < n-1; ++i)
   {
      int x, y, d;
      cin>>x>>y>>d;
      v[x].pb({y, d});
      swap(x, y);
      v[x].pb({y, d});
   }

   dfs(1, -1, 0);

   for (int i = 1; i <= n; ++i)
   {
      cout<<a[i]<<'\n';
   }

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 10240
// AOJ Volume 1 Problem 0107

#include <stdio.h>

int main(void)
{
	int d, w, h, r;
	int n;
	int i;
	
	while (1){
		scanf("%d%d%d", &d, &w, &h);
		if (d == 0 && w == 0 && h == 0){
			break;
		}
		
		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d", &r);
			
			if (4 * r * r > d * d + w * w ||
			    4 * r * r > d * d + h * h ||
				4 * r * r > h * h + w * w){
				
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
#include<stdio.h>
int main(void)
{
    int i,a,b,c,d;
    scanf("%d %d",&a,&b);

    for(i=0;i<10000;i++){
        c=i*0.08;
        d=i*0.1;
        if(c==a && d==b){
            printf("%d\n",i); return 0;
        }
    }
    printf("-1\n");
    return 0;
}

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

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for (int i = 0; i < N; i++) {
        cin >> L.at(i);
    }
    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum = sum + L.at(i);
        if (sum > X) {
            cout << i + 1 << endl;
            return 0;
        }
    }

    cout << N + 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;
int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    long double ax,ay,arad;
    long double bx,by,brad;
    brad = 2*M_PI*m/60;
    arad = 2*M_PI*(h*60.0+m)/720;
    ax = cosl(arad)*a;
    ay = sinl(arad)*a;
    bx = cosl(brad)*b;
    by = sinl(brad)*b;
    long double d;
    d = sqrtl((ax-bx)*(ax-bx) + (ay-by)*(ay-by));
    cout << setprecision(15) << d << endl;
}

Measured memory_bytes: 4164
#include <stdio.h>

int main(void)
{
	float height, weight;
	float bmi;
	int num;
	int i = 0;
	int ans[100] = { 0 };
	
	while (scanf("%d,%f,%f", &num, &weight, &height) != EOF){
		bmi = weight / (height * height);
		if (25 <= bmi){
			ans[i] = num;
			i++;
		}
	}
	
	for (i = 0; ans[i] != 0; i++){
		printf("%d\n", ans[i]);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
    int d, i;
    long int s;

    while(~scanf("%d", &d)) {
        s = 0;
        for(i=d; i<=(600-d); i+=d) {
            s += d*i*i;
        }

        printf("%ld\n", s);
    }

    return (0);
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio> 
#include <map>
using namespace std;

int main(){
    long long n;
    cin >> n;

    
    map<long long, long long> T;
    for(long long i = 0; i < n; i++){
        long long a;
        cin >> a;

        if(T.find(a) == T.end()){
            T[a] = 1;
        }
        else{
            T[a] += 1;
        }
       
    }
    if(T.size() == 3){
        if(n % 3 == 0){
            map<long long, long long>::iterator it;
            long long sum = 0;
            bool flag = true;
            for(it = T.begin(); it != T.end(); it++){
                sum = sum ^ it->first;
                if(it->second != n/3){
                    flag = false;
                }
            }
            if(sum == 0 and flag == true){
                printf("Yes\n");
                return 0;
            }
        }
        printf("No\n");
    }
    else if(T.size() == 2){    
        if(n % 3 == 0 and T.find(0) != T.end() and T[0] == n/3){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    else if(T.size() == 1){
        if(T.find(0) != T.end()){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 1000000007
int32_t main()
{
    fast;
    int n;
    cin >> n;
    int f = 1;
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {

        if ((i % 3 != 0) and (i % 5 != 0))
        {
            //cout << i << " ";
            ans += i;
        }
    }
    cout << ans;
    // while (n)
    // {
    //     if (f % 3 != 0 and f % 5 != 0) {
    //         ans += f;
    //         n--;
    //     }
    //     f++;
    // }
    // cout << ans;



}

Measured memory_bytes: 3648
from datetime import datetime

S = input()
ans = [ 'NA','YYMM', 'MMYY', 'AMBIGUOUS']
flags = 0b0

# 判定[YYMM]
try:
	date_dt = datetime.strptime(S, "%y%m")
except:
	flags -= flags & 1
else:
	flags |= 1

# 判定[MMYY]
try:
	date_dt = datetime.strptime(S, "%m%y")
except:
	flags -= flags & 2
else:
	flags |= 2

print(ans[flags])


Measured memory_bytes: 4456
using System;
using System.Linq;

namespace DPL1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = scan;
            int n = a[0];
            int w = a[1];
            var dp = new int[w + 1];
            for (int i = 0; i < n; i++)
            {
                var k = scan;
                for (int j = k[1]; j <= w ; j++)
                {
                    dp[j] = Math.Max(dp[j], dp[j - k[1]] + k[0]);
                }
            }
            Console.WriteLine(dp[w]);
        }

        static int[] scan
        {
            get { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
        }
    }
}

Measured memory_bytes: 9656
#include <stdio.h>

int main(){
  int i,l,a,b,c,d,k,s;
  int count = 0;
  scanf("%d %d %d %d %d", &l, &a, &b, &c, &d);
  for(i =1; i < l; i++){
    k = a - c;
    a -= c;
    s = b - d;
    b -= d;
    count++;
    if(k <= 0 && s <= 0)break;
  }
  printf("%d\n", l - count);
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    solve();
	}
    }

    public static void solve(){
	int n = kbd.nextInt();
	int i, j, k;
	int cnt=0;
	for(i=0; i<10; i++){
	    for(j=i; j<10; j++){
		for(k=j; k<10; k++){
		    int x = n-i-j-k;
		    if(x<=i && x>=0) {
			// 4つ等しい
			if(i==j && j==k && k==x){
			    cnt += fac(4)/fac(4);
			}
			// 3つ等しい
			else if((x==i && i==j)||(i==j && j==k)){
			    cnt += fac(4)/(fac(3)*fac(1));
			}
			// 2つずつ等しい
			else if(x==i && j==k){
			    cnt += fac(4)/(fac(2)*fac(2));
			}
			// 2つ等しい
			else if(x==i || i==j || j==k){
			    cnt += fac(4)/(fac(2)*fac(1)*fac(1));
			}
			// 全て違う
			else cnt += fac(4);			
		    }
		}
	    }
	}
	System.out.println(cnt);
    }

    public static int fac(int n){
	if(n==1) return 1;
	return n*fac(n-1);
    }
}

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

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

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

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

    int ans = a[0];
    for(int i = 0; i < a.size() - 1; i++) ans = lcm(ans, a[i + 1]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 998244353;
const ll mod1 = 2e18 + 7;
const double tiaohe = 0.57721566490153286060651209;
const int inf = 0x3f3f3f3f;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 1e4 + 5;
int t;
int a[N], b[N];
int main()
{
	//freopen("in.txt", "r", stdin);
	string s;
	while (cin >> s)
	{
		f(i, 1, s.size())cout << "x";
	}
	return 0;
}

Measured memory_bytes: 3644
n,m=gets.split.map &:to_i
h=Hash.new 0
n.times do
  g = gets.chomp
  m.times do |i|
    h[g[i]]+=1
  end
end
hh=Hash.new 0
h.each do |e,v|
  hh[v%4]+=1
end
if hh[3]==1
  hh[2]+=1
  hh[1]+=1
end
if n%2==0 && m%2 == 0
  puts hh[1]==0 && hh[2]==0 ? :Yes : :No
elsif n%2 == 1 && m%2 == 1
 puts hh[1]==1 && hh[2]<=(n-1)/2 + (m-1)/2 ? :Yes : :No
else
  if n%2 == 0
    puts hh[1]==0 && hh[2]<=n/2 ? :Yes : :No
  else
    puts hh[1]==0 && hh[2]<=m/2 ? :Yes : :No
  end
end


Measured memory_bytes: 1788
H,W = map(int,input().split())
ans = []
board = []
for _ in range(H):
    row = list(input())
    board.append(row)
for i in range(H):
    row = ""
    for q in range(W):
        neighbor = []
        if q > 0: #左側
            neighbor.append(board[i][q-1]) #真左
            if i > 0:
                neighbor.append(board[i-1][q-1]) #左上
            if i < (H - 1):
                neighbor.append(board[i+1][q-1]) #左下
        if i > 0: #真上
            neighbor.append(board[i-1][q])
        if q < (W - 1): #右側
            neighbor.append(board[i][q+1]) #真右
            if i > 0:
                neighbor.append(board[i-1][q+1]) #右上
            if i < (H - 1):
                neighbor.append(board[i+1][q+1]) #右下
        if i < (H - 1): #真下
            neighbor.append(board[i+1][q])
        if board[i][q] == "#":
            row += board[i][q]
        else:
            row += str(neighbor.count("#"))
    print(row)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int n = 0;
    cin >> n;
    int A[100];
    for(int i = 0; i < 100; i++){
        A[i] = 0;
    }
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    int count = 0;
    int flag = 1;
    while(flag != 0){
        for(int i = n-1; i > 0; i--){
            if(A[i] < A[i-1]){
                int temp = A[i];
                A[i] = A[i-1];
                A[i-1] = temp;
                flag++;
                count++;
            }
        }
        if(flag == 1){
            flag = 0;
        }
        else{
            flag = 1;
        }
    }
    for(int i = 0; i < n-1; i++){
        cout << A[i] << " ";
    }
    cout << A[n-1] << endl;
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3104
def make_divisors(n):
    res = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.add(i)
            res.add(n // i)
    return res


N = int(input())
s = make_divisors(N)
# print(s)
ans = 0
for ss in s:
    ss -= 1
    if ss <= 1: continue
    k, r = divmod(N, ss)
    if r == 0: continue
    if k >= ss: continue
    ans += ss
print(ans)


Measured memory_bytes: 39664
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
ll minn(ll x, ll y){
    if(x<y)
        return x;
    return y;
}
ll maxx(ll x, ll y){
    if(x>y)
        return x;
    return y;
}
ll dp[409][409],a[409],tot[409][409],z;
ll get(int x,int y){
    if(x==y){
        dp[x][y]=a[x];
        tot[x][y] = 0;
    }
    if(dp[x][y]!=0)
        return dp[x][y];
    dp[x][y] = get(x,x) + get(x+1,y);
    tot[x][y] = tot[x][x] + tot[x+1][y] + dp[x][y];  
    for(int i=x+1;i<y;i++){
        z = get(x,i) + get(i+1,y);
        if(tot[x][y]> tot[x][i] + tot[i+1][y] + z){
            dp[x][y] = z;
            tot[x][y] = tot[x][i] + tot[i+1][y] + z;
        }
    }
    return dp[x][y];
}
int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    get(1,n);
    // cout<<endl;
    // for(int i=0; i<=n;i++){
    //     for(int j=0; j<=n;j++)
    //         cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    cout<<tot[1][n];
    // cout<<endl;
    // for(int i=0; i<=n;i++){
    //     for(int j=0; j<=n;j++)
    //         cout<<tot[i][j]<<" ";
    //     cout<<endl;
    // }
}


Measured memory_bytes: 2816
N = int(input())
answer = 0

for i in range(N):
    if (i + 1 >= 10 and i + 1 <= 99) or (i + 1 >= 1000 and i + 1 <= 9999) or i + 1 == 100000:
        pass
    else:
        answer += 1

print(answer)


Measured memory_bytes: 2940
# 木によってLISを作り、dfsで抜けるときにLISをその前の状態まで復元する

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina1(x):
    return int(x) - 1


def read_ints(mina=None):
    ret = map(int, read().split())
    if mina == None:
        return list(ret)
    else:
        return list(map(lambda x: x - mina, ret))


def read_a_int():
    return int(read())


from bisect import bisect_left, bisect_right
from collections import defaultdict
N = read_a_int()
A = read_ints()
tree = defaultdict(lambda: [])
for _ in ra(N - 1):
    u, v = read_ints(mina=1)
    tree[u].append(v)
    tree[v].append(u)

LIS = []
ans = [0] * N  # 各ノードのlen(LIS)を記録


def dfs(now, p):  # 現在のノード、親
    a = A[now]
    # LISの更新
    idx = bisect_left(LIS, a)
    is_append = False
    if idx == len(LIS):
        LIS.append(a)
        is_append = True
    else:
        old = LIS[idx]   # なんの値だったか持っておく
        LIS[idx] = a  # aに更新

    ans[now] = len(LIS)  # 答えを記録
    # 次のノードを探索
    for to in tree[now]:
        if to == p:
            continue
        dfs(to, now)

    # 抜けるときにLISを復元
    if is_append:
        del LIS[idx]
    else:
        LIS[idx] = old


dfs(0, -1)
print(*ans, sep='\n')


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

int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    
    int n,i;
    long long c;
    
    cin>>n;
    cin>>c;
    
	long long j,k;
	map<long long ,long long>mp;
	mp[0]=0;
	for(i=1;i<=n;i++)
	{
	    cin>>j>>k;
	    mp[j]=k;
	}
	
	long long a[n+1],b[n+1],ax[n+1],bx[n+1];
	ax[0]=0;
	bx[n]=0;
	
	j=0;k=0;
	i=0;
	for(auto d:mp)
	{
	    j=j+d.second;
	    k=max(k,j-d.first);
	    
	    a[i]=k;
	    if(i!=0)
	    {
	        if(a[i]!=a[i-1])
	        ax[i]=d.first;
	        else
	        ax[i]=ax[i-1];
	    }
	    
//	    cout<<i<<" : "<<a[i]<<endl;
	
	    i++;
	}
	
	j=0;i=n;k=0;
    mp[c]=0;
//    cout<<endl;
	for(auto d=mp.rbegin();d!=mp.rend();d++)
	{
	    if(d->first != 0)
	    {
	        j=j+d->second;
	        k=max(k,j-c+d->first);
	        b[i]=k;
	        if(i!=n)
	        {
	            if(b[i]!=b[i+1])
	            bx[i]=c-d->first;
	            else
	            bx[i]=bx[i+1];
	        }
//	        cout<<i<<" : "<<b[i]<<endl;
	    
	        i--;
	    }
	    
	}
	j=0;
//	cout<<endl;
	for(i=0;i<=n;i++)
	{
	    j=max(j,a[i]+b[i]-min(ax[i],bx[i]));
	    
//	    cout<<i<<" : "<<v<<endl;
	}
	
	cout<<j;
	return 0;
	
}


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


int main()
{
	unsigned long long h,num=1;
	unsigned long long ans=0;
	cin>>h;
	while(h!=0)
	{
		h=floor(h/2);
		ans+=num;
		num*=2;
		//cout<<ans<<endl;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) ((a+b-1)/(b))
using namespace std;

const int MAX = 100010;
const int MOD = 1000000007;
const int INF = (int)1e9;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;

// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define dbg(msg, var) cout << msg << " " << var << endl;
#define ti tuple<int,int,int>
//

int main() {
    int n, x;
    cin >> n >> x;

    int res = 0;
    vi v(n);
    forn(i, n) {
        cin >> v[i];
    }

    sort(all(v));
    forn(i, n) {
        if(v[i] <= x) {
            x -= v[i];
            res++;
        }
    }

    while(v[0] <= x) {
        x -= v[0];
        res++;
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n,a,b,i,c=0;
 cin>>n>>a>>b;
 for(i=a;i<=b;i++)
 {
     if(i%n==0)
        c++;
 }
 if(c>0)
 {
     cout<<"OK";
 }
 else
 {
     cout<<"NG";
 }
    return 0;
}






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

long long mod = 1000000007;

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  
  long long sum = 0;
  for(int i=0;i<N;i++){
    sum += A[i];
    sum %= mod;
  }
  
  long long ans = 0;
  for(int i=0;i<N;i++){
    sum += mod;
    sum -= A[i];
    sum %= mod;
    long long x = sum * A[i];
    x %= mod;
    ans += x;
    ans %= mod;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4784