akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_map>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define endl                         '\n'	
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define vi                    vector<int>
#define pii                 pair<int,int>
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define forr(i, n) for (int i = 0; i < int(n); i++)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 1e7 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x%y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y))*y); }
void mansour()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
#endif
}
ll n,x;
vector<pair<ll,ll>>edg;
ll dp[102][100005];
ll knap(ll i, ll x)
{
	if(i==n)
		return 0;
	ll ch1;
	if(dp[i][x]!=-1)
		ch1=dp[i][x];
	else
		ch1=knap(i+1,x);
	ll ch2=0;
	if(dp[i][x]!=-1)
		ch2=dp[i][x];
	else if(edg[i].first<=x)
		ch2=knap(i+1,x-edg[i].first)+edg[i].second;
	return dp[i][x]=max(ch1,ch2);
}
int main()
{
	mansour();
	//file();
	/*The First*/
	memset(dp,-1,sizeof(dp));
	ll a,b;
	cin>>n>>x;
	edg.resize(n+5);
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		edg[i]=make_pair(a,b);
	}
	cout <<knap(0,x)<<"\n";
}

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

int main()
{
	int N, C;
	cin >> N >> C;
	vector<vector<int>> D(C, vector<int>(C));
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			cin >> D[i][j];
		}
	}
	vector<vector<int>> cnt(3, vector<int>(C));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int c;
			cin >> c; --c;
			++cnt[(i + j) % 3][c];
		}
	}
	int res = 1e9;
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) if (j != i) {
			for (int k = 0; k < C; k++) if (k != i && k != j) {
				int sum = 0;
				for (int p = 0; p < C; p++) {
					sum += D[p][i] * cnt[0][p];
				}
				for (int p = 0; p < C; p++) {
					sum += D[p][j] * cnt[1][p];
				}
				for (int p = 0; p < C; p++) {
					sum += D[p][k] * cnt[2][p];
				}
				res = min(res, sum);
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 4000000000000000000;
ll a[100005];
ll b[100005];
ll c[100005];
ll mxbc[100005];
ll ans = 0;
int n;
int main(){
    scanf("%d",&n);
    for (int i = 0; i <= n; i++){
        scanf("%lld",&a[i]);
    }
    mxbc[0] = 1-a[0];
    for (int i = 1; i <= n; i++){
        mxbc[i] = min(2*mxbc[i-1] - a[i], INF);
        //printf("MXBC[%d] = %d\n",i,mxbc[i]);
        if (mxbc[i] < 0ll){
            printf("-1"); return 0;
        }
    }
    for (int i = n-1; i >= 0; i--){
        ///b + c <= mxbc
        ///b + 2*c = sum
        ///c >= sum - mxbc
        ll sum = a[i+1]+b[i+1]+c[i+1];
        ll C = max(0ll,sum-mxbc[i]);
        ll B = sum-2*C;
        b[i] = B, c[i] = C;
        if (B < 0ll || B + 2*C != sum){
            printf("-1\n");
            return 0;
        }
        //printf("%d %d\n",B,C);
        /*for (int B = 0; B <= min(mxbc[i],sum); B++){
            if ((sum-B) % 2 == 0){
                int C = (sum-B)/2;
                if (C >= 0 && B <= mxbc[i]-C){
                    b[i] = B;
                    c[i] = C;
                }
            }
        }*/
        ans += a[i] + B + C;
    }
    ans += a[n];
    if (n == 0 && a[0] != 1) printf("-1\n");
    else printf("%lld",ans);
}


Measured memory_bytes: 6956
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <map>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    ll n,m;cin >> n >> m;
    vector<ll>a(n),b(n);
    vector<ll>c(m),d(m);
    rep(i,n)cin >> a[i] >> b[i];
    rep(i,m)cin >> c[i] >> d[i];
    vector<ll>ans(n);
    ll min=10000000000000;
    ll dis;
    ll index=-1;
    for(ll i=0;i<n;i++){
        min=10000000000000;
        index=-1;
        for(ll j=0;j<m;j++){
            dis=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(min>dis){
                min=dis;
                index=j;
            }
        }
        ans[i]=index+1;
    }
    rep(i,n)out(ans[i]);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

const int N = 100010;
const long long mod = 1e9 + 7;

int n, i, x, y;
long long d[2][N];

vector<int> v[N];

void dfs(int x, int rad) {
    d[0][x] = d[1][x] = 1;
    for (int i = 0; i < v[x].size(); ++i) {
        if (v[x][i] != rad) {
            dfs(v[x][i], x);
            d[0][x] = (d[0][x] * (d[0][ v[x][i] ] + d[1][ v[x][i] ]) % mod) % mod;
            d[1][x] = (d[1][x] * d[0][ v[x][i] ]) % mod;
        }
    }
}

int main() {
    cin >> n;
    for (i = 1; i < n; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1, 0);
    cout << (d[0][1] + d[1][1]) % mod << "\n";
    return 0;
}


Measured memory_bytes: 14208
#include<iostream>
using namespace std;
int main(){
    int y,m,d;
    string str[]={
        "pre-meiji",
        "meiji",
        "taisho",
        "showa",
        "heisei"
    };
    while(cin>>y>>m>>d){
        int p=y*10000+m*100+d,c;
        if(p<18680908)c=0;
        else if(p<19120730)c=1;
        else if(p<19261225)c=2;
        else if(p<19890108)c=3;
        else c=4;
        cout<<str[c];
        switch(c){
        case 1:
            cout<<" "<<y-1868+1;
            break;
        case 2:
            cout<<" "<<y-1912+1;
            break;
        case 3:
            cout<<" "<<y-1926+1;
            break;
        case 4:
            cout<<" "<<y-1989+1;
        }
        if(c!=0){
            cout<<" "<<m<<" "<<d;
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int beki(long long a,long long b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}


int gyakugen(int a){
	return beki(a,modulo-2);
}

struct combi{
	deque<int> kaijou;
	deque<int> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(mod(kaijou[i-1]*i));
		}
		
		int b=gyakugen(kaijou[n]);
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(mod(kaijou_[0]*k));
		}
	}
	
	int combination(int n,int r){
		if(n==0&&r==0)return 1;
		if(r>n)return 0;
		int a = mod(kaijou[n]*kaijou_[r]);
		a=mod(a*kaijou_[n-r]);
		return a;
	}
	
	int junretsu(int a,int b){
		int x = mod(kaijou_[a]*kaijou_[b]);
		x=mod(x*kaijou[a+b]);
		return x;
	}
	
	int catalan(int n){
		return mod(combination(2*n,n)*gyakugen(n+1));
	}
	
};

int main(){
	
	int N,M;
	cin>>N>>M;
	
	combi C(2000000);
	int ans = 0;
	
	for(int i=0;i<=N;i++){
		int t = mod(C.combination(N,i)*C.combination(M,i));
		t = mod(t * C.kaijou[i]);
		int tt = mod(C.combination(M-i,N-i)*C.kaijou[N-i]);
		tt = mod(tt * tt);
		t = mod(t * tt);
		if(i%2==0){
			ans = mod(ans + t);
		}
		else ans = mod(ans - t);
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 19748
Ncount = input()
strings = []
count_flag = 0
letters = {}
for i in range(int(Ncount)):
  strings.append(''.join(sorted(input())))

for i in strings:
  if i not in letters:
    letters[i] = 0
  else :
    letters[i] += 1
    count_flag += letters[i]

print(count_flag)

Measured memory_bytes: 19400
N = gets.to_i
M = 10**9 + 7

def mpow(x, n)
  ret = 1
  while n > 0
    if n.even?
      x = x * x % M
      n >>= 1
    else
      ret = ret * x % M
      n -= 1
    end
  end
  ret
end

puts (mpow(10, N) - 2*mpow(9, N) + mpow(8, N)) % M

Measured memory_bytes: 14328
import java.util.Scanner;

public class Main {
    static public void main(String args[]){
        final long INF = (long)1e10;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        long[] h = new long[n];
        long[] dp = new long[n];
        for(int i = 0; i < n ; i++){
            h[i] = sc.nextLong();
            dp[i] = INF;
        }
        dp[0] = 0;

        for(int i = 0 ; i < n-1 ; i++){
            dp[i+1] = Math.min(dp[i+1], dp[i]+Math.abs(h[i+1]-h[i]));
            if(i+2 < n){
                dp[i+2] = Math.min(dp[i+2], dp[i]+Math.abs(h[i+2]-h[i]));
            }
        }

        System.out.println(dp[n-1]);
    }
}


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

#define ll long long
#define fi first
#define se second
#define pb push_back

using namespace std;

ll n, i,    a, b, x, ans;

int main()
{
    cin >> a >> b;
    for (i=0; i<10000; i++) if ((ll)floor(i*0.08)==a && (ll)floor(i*0.1)==b) return cout << i, 0;
    cout << -1;
}


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

typedef pair<int, int> pii;
const int N = 1010;

int n, m, dis[N][N];
int delta_x[] = {0, 0, 1, -1},
	delta_y[] = {1, -1, 0, 0};
char a[N][N];
queue<pii> q;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) {
			cin >> a[i][j];
			if(a[i][j] == '#')
				q.push(pii(i, j));
		}
	while(q.size()) {
		pii p = q.front();
		q.pop();
		int x = p.first, y = p.second;
		for (int i = 0; i < 4; i++) {
			int X = x + delta_x[i],
				Y = y + delta_y[i];
			if(a[X][Y] == '.' && dis[X][Y] == 0) {
				dis[X][Y] = dis[x][y] + 1;
				q.push(pii(X, Y));
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		ans = max(ans, *max_element(dis[i], dis[i] + N));
	cout << ans;
	return 0;
}

Measured memory_bytes: 10112
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
	
	public static void func(List<Integer>[] I, int now, int[] ans) {
		ArrayDeque<Integer> que = new ArrayDeque<>();
		que.add(now);
		
		while(!que.isEmpty()) {
			int x = que.remove();
			
			for(int t: I[x]) {
				if(ans[t] == 0) {
					ans[t] = x;
					que.add(t);
				}
			}
			
		}
		
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		
		List<Integer>[] list = new List[n+1];
		
		int [] ans = new int[n+1];
		
		for(int i = 1; i <= n; i++) {
			list[i] = new ArrayList<>();
		}
		
		for(int i = 1; i <= m; i++) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			list[a].add(b);
			list[b].add(a);
		}

		func(list,1,ans);
		
		System.out.println("Yes");
		
		for(int i = 2; i <= n; i++) {
			System.out.println(ans[i]);
		}
		
	}

}


Measured memory_bytes: 83584
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int A, P;  cin >> A >> P;

    int p = A * 3 + P;

    int ans = p / 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		long a = stdIn.nextLong(); //鬼の座標
		
		long v = stdIn.nextLong(); //鬼の移動量
		
		long b = stdIn.nextLong(); //子供の座標
		
		long w = stdIn.nextLong(); //子供の移動量
		
		long t = stdIn.nextLong(); //時間
		
		if(v <= w) {
			System.out.println("NO");
		}else {
			
			long dist = Math.abs(b-a);
			
			long time = (dist+v-w-1)/(v-w);
			
			if(t < time) {
				System.out.println("NO");
			}else {
				System.out.println("YES");
			}
			
			
			
			
			
			
		}
		
		
		
		
	}

}


Measured memory_bytes: 35748
#include<iostream>

using namespace std;

int main()
{
	int a,b,c;
	int count=0,s=0;
	cin>>a>>b>>c;
	if(a==5)
	{
		count++;
	}
	else s++;
	 if(b==5)
		{
			count++;
		}
		else s++;
	if(c==5)
	{
		count++;
	}
	else s++;
	
	if(count==2&&s==1)
		cout<<"YES";
		
		else
			cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define cpd complex<double>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
const cpd rot90(0, 1);
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

struct circle{
    complex<double> c;//中心
    double r;//半径
    circle() {}
    circle(complex<double> c, double r) : c(c), r(r) {}
};

vector<complex<double>> culc_intersection(circle c1, circle c2){
    double l = abs(c1.c - c2.c), r1 = c1.r, r2 = c2.r;
    vector<complex<double>> ps;

    if(l > r1 + r2) return ps;
    if(r1 > l + r2) return ps;
    if(r2 > l + r1) return ps;

    double x = ((r1 * r1) - (r2 * r2) + (l * l)) / (2 * l);
    double a = sqrt((r1 * r1) - (x * x));
    complex<double> vec1 = (c2.c - c1.c) * x / l;
    complex<double> vec2 = (c2.c - c1.c) * rot90 * a / l;

    ps.push_back(c1.c + vec1 + vec2);
    if(vec2 != complex<double>(0, 0)) ps.push_back(c1.c + vec1 - vec2);
    return ps;
}

bool culc_eps(double a, double b){
    return abs(a - b) < (abs(a) + abs(b)) * EPS;
}

int M;
ll dsum, csum;
int N;
cpd p[60];
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        int x, y;
        cin >> x >> y;
        p[i] = cpd(x, y);
    }
    db lb = 0, ub = 1e4;
    while(!culc_eps(lb, ub)){
        db mid = (ub + lb) / 2;
        vector<cpd> ps;
        for(int i = 0; i < N; i++){
            for(int j = i + 1; j < N; j++){
                vector<cpd> qs = culc_intersection({p[i], mid}, {p[j], mid});
                for(auto u : qs) ps.push_back(u);
            }
        }
        bool flag = false;
        for(auto u : ps){
            bool judge = true;
            for(int i = 0; i < N; i++){
                db d = abs(u - p[i]);
            if(d > mid * (1 + EPS)){
                    judge = false;
                }
            }
            if(judge) flag = true;
        }
        if(flag) ub = mid;
        else lb = mid;
    }
    cout << fixed << setprecision(15);
    cout << ub << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	if (a == 1)
		a = 14;
	if (b == 1)
		b = 14;
	if (a < b) {
		printf("Bob\n");
	} else if (a > b) {
		printf("Alice\n");
	} else {
		printf("Draw\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
namespace my_header {
#define pb push_back
#define mp make_pair
#define pir pair<int, int>
#define vec vector<int>
#define pc putchar
#define clr(t) memset(t, 0, sizeof t)
#define pse(t, v) memset(t, v, sizeof t)
#define bl puts("")
#define wn(x) wr(x), bl
#define ws(x) wr(x), pc(' ')
    const int INF = 0x3f3f3f3f;
    typedef long long LL;
    typedef double DB;
    inline char gchar() {
        char ret = getchar();
        for(; (ret == '\n' || ret == '\r' || ret == ' ') && ret != EOF; ret = getchar());
        return ret; }
    template<class T> inline void fr(T &ret, char c = ' ', int flg = 1) {
        for(c = getchar(); (c < '0' || '9' < c) && c != '-'; c = getchar());
        if (c == '-') { flg = -1; c = getchar(); }
        for(ret = 0; '0' <= c && c <= '9'; c = getchar())
            ret = ret * 10 + c - '0';
        ret = ret * flg; }
    inline int fr() { int t; fr(t); return t; }
    template<class T> inline void fr(T&a, T&b) { fr(a), fr(b); }
    template<class T> inline void fr(T&a, T&b, T&c) { fr(a), fr(b), fr(c); }
    template<class T> inline char wr(T a, int b = 10, bool p = 1) {
        return a < 0 ? pc('-'), wr(-a, b, 0) : (a == 0 ? (p ? pc('0') : p) : 
            (wr(a/b, b, 0), pc('0' + a % b)));
    }
    template<class T> inline void wt(T a) { wn(a); }
    template<class T> inline void wt(T a, T b) { ws(a), wn(b); }
    template<class T> inline void wt(T a, T b, T c) { ws(a), ws(b), wn(c); }
    template<class T> inline void wt(T a, T b, T c, T d) { ws(a), ws(b), ws(c), wn(d); }
    template<class T> inline T gcd(T a, T b) {
        return b == 0 ? a : gcd(b, a % b); }
    template<class T> inline T fpw(T b, T i, T _m, T r = 1) {
        for(; i; i >>= 1, b = b * b % _m)
            if(i & 1) r = r * b % _m;
        return r; }
};
using namespace my_header;

const int N = 1e5 + 100;
int X, Y, Z;
int n;
struct Info {
	LL a, b, c;
	bool operator < (const Info&rhs) const {
		return a - b < rhs.a - rhs.b;
	}
} p[N];
LL ans, addLeft[N], addRight[N];
priority_queue<int, vector<int>, greater<int> > pq;

int main() {
#ifdef lol
	freopen("c.in", "r", stdin);
	freopen("c.out", "w", stdout);
#endif

	fr(X, Y, Z);
	n = X + Y + Z;
	for (int i = 1; i <= n; ++i) {
		fr(p[i].a, p[i].b, p[i].c);
		ans += p[i].c;
		p[i].a -= p[i].c;
		p[i].b -= p[i].c;
	}
	sort(p + 1, p + n + 1);
	for (int i = 1; i <= Y; ++i) {
		addLeft[i] = addLeft[i - 1] + p[i].b;
		pq.push(p[i].b);
	}
	for (int i = Y + 1; i <= n; ++i) {
		addLeft[i] = addLeft[i - 1];
		if (pq.top() < p[i].b) {
			addLeft[i] -= pq.top();
			pq.pop();
			addLeft[i] += p[i].b;
			pq.push(p[i].b);
		}
	}
	while (!pq.empty()) pq.pop();
	for (int i = n; n - X < i; --i) {
		addRight[i] = addRight[i + 1] + p[i].a;
		pq.push(p[i].a);
	}
	for (int i = n - X; 0 < i; --i) {
		addRight[i] = addRight[i + 1];
		if (pq.top() < p[i].a) {
			addRight[i] -= pq.top();
			pq.pop();
			addRight[i] += p[i].a;
			pq.push(p[i].a);
		}
	}
	LL maxSum = LLONG_MIN;
	for (int k = Y; k <= n - X; ++k)
		maxSum = max(maxSum, addLeft[k] + addRight[k + 1]);
	wt(ans + maxSum);

	return 0;
}



Measured memory_bytes: 4600
#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll a, b, c;
int main () {
	cin >> a >> b >> c;
	if ((~a & 1) || (~b & 1) || (~c & 1)) puts("0");
	else printf("%lld\n", min(a * b, min(b * c, a * c)));
	return 0;
}

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

int main(){
  constexpr int64_t Vmax= 3500;
  int64_t N;
  cin >> N;

  bool found= false;
  for(int64_t a=1; a <= Vmax; a++){
    for(int64_t b=1; b <= Vmax; b++){
      int64_t numer= N*a*b;
      int64_t denom= 4*a*b- N*(a+b);
      if(denom > 0 && numer % denom == 0){
        int64_t c= numer/ denom;
        if(c <= Vmax){
          cout << a <<" "<< b <<" "<< c << endl;
          found= true;
          break;
        }
      }
    }
    if(found){ break; }
  }
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = max((a),(b))
#define chmin(a, b) a = min((a),(b))
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;



int main(){
    char a[2][3]={{'R','U','D'},{'L','U','D'}};
    string str;
    cin>>str;
    rep(i,str.length()){
        bool flag=false;
        rep(j,3){
            if(str[i]==a[i%2][j]){
                flag=true;
                break;
            }
        }
        if(flag==false){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())

Store_List=[]
for i in range(n):
    ai,bi=map(int,input().split())
    Store_List.append([ai,bi])


Store_List.sort(key=lambda x:x[0])
# print(Store_List)

have=0
money=0
mise_index=0
while True:
    # print(have,money)
    if have + Store_List[mise_index][1] < m:
       have+=Store_List[mise_index][1]
       money+=Store_List[mise_index][0]*Store_List[mise_index][1]
       mise_index+=1
    else:
        money+=Store_List[mise_index][0]*(m-have)
        break

print(money)

Measured memory_bytes: 21220
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

int x[300 * 300 + 1] = {};
int y[300 * 300 + 1] = {};

ll a[200001] = {};
ll b[200001] = {};

int main(void)
{
	int n;
	INPUT(n);

	for (int i = 0; i < n; i++) {
		int p;
		INPUT(p);
		p--;
		a[p] += i;
		a[n + 1] -= i;
		b[0] += i;
		b[p + 1] -= i;
	}

	for (int i = 0; i < n; i++) {
		a[i + 1] += a[i];
		b[i + 1] += b[i];
		a[i] += i + 1;
		b[i] += n - i;

		PUT(a[i]);
		puts((i == n - 1 ? "\n" : " "));
	}

	for (int i = 0; i < n - 1; i++) {
		PUT(b[i]);
		puts(" ");
	}
	PUT(b[n - 1]);
	puts("\n");

	return 0;
}



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

int main() {
  int a, b, c, d;
  cin >> a;
  b = a / 100;
  c = (a - b * 100) / 10;
  d = (a - b * 100 - c * 10);
  cout << b + c + d << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int h = in.ni();
        int n = in.ni();
        int sum = 0;
        for(int i = 0; i < n; i++) {
            sum += in.ni();
        }
        out.println(sum>=h?"Yes":"No");
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private String[] line;
        private int len, cur;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            line = null;
            len = cur = 0;
        }
        public String ns(){
            if(line== null || cur==len){
                try{
                    line = br.readLine().split(" ");
                    len = line.length;
                    cur = 0;
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            if(cur < len){
                return line[cur++];
            }
            return null;
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}


Measured memory_bytes: 32476
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

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


Measured memory_bytes: 256
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())

query = tuple(tuple(map(int, input().split())) for _ in range(Q))

ans = 0
for comb in combinations_with_replacement(range(1, M+1), N):
    score = 0
    for a, b, c, d in query:
        if comb[b-1] - comb[a-1] == c:
            score += d
    ans = max(ans, score)
print(ans)



Measured memory_bytes: 67784
#pragma region
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define rep(i, a, n) for (long long i = a; i <= n; ++i)
#define per(i, a, n) for (long long i = n; i >= a; --i)
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
template <typename T>
void read(T &x) {
    x = 0;
    char ch = getchar();
    ll f = 1;
    while (!isdigit(ch)) {
        if (ch == '-') f *= -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - 48;
        ch = getchar();
    }
    x *= f;
}
using namespace std;
/*
 *                                                     __----~~~~~~~~~~~------___
 *                                    .  .   ~~//====......          __--~ ~~
 *                    -.            \_|//     |||\\  ~~~~~~::::... /~
 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *           '         ~-|      /|    |-~\~~       __--~~
 *                       |-~~-_/ |    |   ~\_   _-~            /\
 *                            /  \     \__   \/~                \__
 *                        _--~ _/ | .-~~____--~-/                  ~~==.
 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                  -_     ~\      ~~---l__i__i__i--~~_/
 *                                  _-~-__   ~)  \--______________--~~
 *                                //.-~~~-~_--~- |-------~~~~~~~~
 *                                       //.-~~~--\
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

#pragma endregion
const int maxn = 1e5 + 5;
ll n, W, w[maxn], val[maxn], dp[maxn];
int main() {
    IO;
    cin >> n >> W;
    rep(i, 1, n) cin >> w[i] >> val[i];
    rep(i, 1, 1e5) dp[i] = 0x3f3f3f3f;
    dp[0] = 0;
    rep(i, 1, n) for (int t = 1e5; t >= val[i]; --t) dp[t] = min(dp[t], dp[t - val[i]] + w[i]);
    for (int i = 1e5; i; --i)
        if (dp[i] <= W) {
            // cout << dp[i] << endl;
            cout << i << endl;
            return 0;
        }
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i < n+1; i++)
using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n+1];
    rep(i, n) cin >> a[i];

    int i = 1;
    int times = 0;
    int ans = 1;
    while (a[i] != 2) {
        ans++;
        i = a[i];
        times++;
        if (times > n) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
ll solve(ll a,ll k){
    ll r=a%k,q=a/k;
    r%=q+1;
    if(r==0)return q;
    return solve(r+q*k-q-1,k);
}
int main(){
    ll n;cin>>n;
    ll ans=0;
    rep(i,n){
        ll a,k;cin>>a>>k;
        ans^=solve(a,k);
    }
    if(ans)out("Takahashi");
    else out("Aoki");
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
void solution(int N,int K, int X, int Y)
{
	if(K<N)
	{
	int total=0;
	for(int i=0; i<K; i++)
	{
		total+=X;
	}
	for(int j=K;j<N;j++)
	{
		total+=Y;
	}
	cout<<total<<endl;
	}
	else
	{
	int total=0;
	for(int i=0; i<N; i++)
	{
		total+=X;
	}
	cout<<total<<endl;
	}
}
int main()
{
	int n,k,x,y;
	cin>>n;
	cin>>k;
	cin>>x;
	cin>>y;
	solution(n,k,x,y);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;
int digitsum(int n)
{
	int sum=0;
	while(n)
	{
		sum+=n%10;
		n/=10;
	}
	return sum;
}
int main(){
	int n,tmp,l,r;
	cin>>n>>l>>r;
	int sum=0;
	rep(i,1,n+1) 
	{
		tmp=digitsum(i);
		if(tmp>=l&&tmp<=r)
		sum+=i;
	}
	cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, a, ans = 0, cnt = 1;
  scanf("%d", &n);
  for(int i = 1; i <= n; i++){
    scanf("%d", &a);
    if(a != i){
      ans += cnt/2;
      cnt = 1;
    }else cnt++;
  }
  ans += cnt/2;
  printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i >= 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main(){
	int n; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	vint aa(n);
	rep(i,n) cin >> aa[i];
	int ans=0;
	int ame=0;
	rep(i,n) {
		rep(j,n) {
			if(j<=i) ame+=a[j];
			if(j>=i) ame+=aa[j];
			if(j==n-1){
				ans=max(ans,ame);
				ame=0;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,n,m,k,x,y=0,ans=1;
    string str,s="",t,u;


    cin>>s;
    for (int i = 0; i < 4; ++i) {
        if(s[i]=='2')y++;
    }
    cout<<y;





    cout<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int N, M; cin >> N >> M;
    cout << ((1900 * M + 100 * (N - M)) << M) << endl;
    
    return 0;
}

Measured memory_bytes: 888
#if _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifndef ONLINE_JUDGE 
const bool DEBUG = true;
#else
const bool DEBUG = false;
#endif

// Reads a 1D vector
template <class T>
void read1d(vector<T> & arg) {
	const int l = arg.size();
	for (int i = 0; i < l; ++i) cin >> arg[i];
}

void read() {}
// Reads arbitrary values
template <class T1, class... T2>
void read(T1& var1, T2&... var2) { cin >> var1; read(var2...); }



void pln() { cout << (DEBUG ? "]\n" : "\n"); }
template <class T1, class... T2>
void pln(const T1& var1, const T2& ... var2) { cout << var1 << " "; pln(var2...); }

// Prints arbitrary values and goes to next line
template <class T1, class... T2>
constexpr void print(const T1& var1, const T2& ... var2) { cout << (DEBUG ? " [ " : ""); pln(var1, var2...); }

// Prints arbitrary values and goes to next line ONLY IF IN DEBUG MODE
template <class T1, class... T2>
constexpr void debug(const T1& var1, const T2& ... var2) { if (!DEBUG) return;  cout << " debug : [ "; pln(var1, var2...); }





using ll = long long;
using ull = unsigned long long;


#define all(x) begin(x), end(x)

const bool MULTIPLE_TEST_CASES = 0;


void exec() 
{
	string s;
	read(s);

	int sum = 0;
	for (char c : s) sum += c - '0';

	if (sum % 9 == 0) print("Yes");
	else print("No");
}

















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

	if (!MULTIPLE_TEST_CASES)
		exec();
	else {
		int n;
		cin >> n;

		while (n--)
			exec();
	}

    return 0;
}

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

int main() {
    long long a,b;
    cin >> a >> b;
    if(a > b) swap(a,b);
    long long ans = b;
    b -= 1;
    if(a > b) swap(a,b);
    ans += b;
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  string STARTRESULT = "WAKARAN";
  string ENDRESULT = "WAKARAN";
  string RESULT = "WAKARAN";
  int startposit = 0;
  int endposit = n-1;
  cout << 0 << endl;
  fflush(stdout);
  cin >> STARTRESULT;
  cout << n-1 << endl;
  fflush(stdout);
  cin >> ENDRESULT;
  for(int COUNT=0;COUNT < 20;COUNT++){
    int mid = (startposit+endposit)/2;
    cout << (startposit+endposit)/2 << endl;
    fflush(stdout);
    cin >> RESULT;
    if(RESULT != "Vacant"){
      if((STARTRESULT == RESULT && (mid-startposit) % 2 == 1)||
         (STARTRESULT != RESULT && (mid-startposit) % 2 == 0)){
        endposit = mid;
        ENDRESULT = RESULT;
      }else{
        startposit = mid;
        STARTRESULT = RESULT;
      }
    }else{
      return 0;
    }
  }
}
         
      
    
    

Measured memory_bytes: 852
dic={}

for i in range(1,10):
    for j in range(1,10):
        if dic.get(i*j,None)==None:
            dic[i*j]=1
        else:
            dic[i*j]+=1

N = int(input())

if dic.get(N,None)==None:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;
 
int main() {
  ll N, M;
  cin >> N >> M;
  
  ll max = 0;
  ll min = N + 1;
  
  vector<ll> L(M);
  vector<ll> R(M);
  
  for(ll i = 0; i < M; i++) {
    cin >> L.at(i);
    cin >> R.at(i);
    if(R.at(i) <= min) min = R.at(i);
    if(L.at(i) >= max) max = L.at(i);
  }
  
  if(min - max + 1 >= 1) cout << min - max + 1 << endl;
  else cout << 0 << endl;
  
}

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

int main()
{
    int d[5], k;
    for (int i = 0; i < 5; i++)
        cin >> d[i];
    cin >> k;
    if (d[4] - d[0] > k)
        cout << ":(" << endl;
    else
        cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
	is_prime[0]=is_prime[1]=true;
	for(int i=4;i<MAX;i+=2){
		is_prime[i]=true;
	}
	for(int i=3;i*i<MAX;i+=2){
		if(!is_prime[i]){
			for(int j=i*i;j<MAX;j+=i){
				is_prime[j]=true;
			}
		}
	}
	for(int i=0;i<MAX;i++){
		if(!is_prime[i]){
			sumprime[i]=sumprime[i-1]+i;
		}else{
			sumprime[i]=sumprime[i-1];
		}
	}
}
*/


int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	//double	pi=3.14159265358979323846;
	//sieve();
	
	
	int x,n;
	cin>>x>>n;
	set<int> st;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		st.insert(a);
	}
	if(n==0) cout<<x<<endl;
	else{
		int l=x;
		int r=x+1;
		int ans=0;
		while(l>0){
			if(st.find(l)!=st.end() and st.find(r)!=st.end()){
				l--;
				r++;
			}else {

				if(st.find(l)==st.end()){
					ans=l;
					break;
				}else{
					if(st.find(l-1)==st.end()){
						ans=l-1;
						break;
					}else{
						ans=r;
						break;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
	
		
	
	return 0;
	
	
	
	
	
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
	string S, T;
	cin >> S >> T;


	auto len = S.size();
	if (T.substr(0, len) == S) {
		printf("Yes\n");
		return 0;
	}
	else printf("No\n");

	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
 
int main() {
	int h, w;
	cin >> h >> w;
	//char n[h + 2][w + 2];
	for(int i = 0; i < h + 2; i++){
		if(i == 0 || i == h + 1){
			for(int j = 0; j < w + 2; j++){
				cout << "#";
			}
		}else{
			string a;
			cin >> a;
			cout << "#" + a + "#";
		}
		cout << endl;
	}
 
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
N = int(input())
A = list(map(int,input().split()))

length = 0
step_sum = 0

for i in range(N):
  if ( length > A[i] ):
    step_sum += length - A[i]
  else:
    length = A[i]

print(step_sum)

Measured memory_bytes: 32336
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    char x, y;
    cin >> x >> y;
    if (x < y) cout << "<" << endl;
    else if (x == y) cout << "=" << endl;
    else cout << ">" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()

{
	ll n,re=0,bl=0,gr=0,res,wr,i,j,k;
	string s;
	scanf("%lld",&n);
	getchar();
	getline(cin,s);
	for(i=0;i<n;i++)
	{
		if(s[i]=='R')re++;
		if(s[i]=='G')gr++;
		if(s[i]=='B')bl++;
	}
res=re*gr*bl;
wr=0;
for(i=1;i<=n-2;i++)
{
	for(j=i+1;j<=n-1;j++)
	{
		//j-i=k-j
		k=2*j-i;
	  if( k<= n){
                if(s[i-1] != s[j-1] && s[k-1] != s[j-1] && s[i-1] != s[k-1]){
                	wr++;
			}
	}
}
}
	printf("%lld\n",res-wr);
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string b;
  cin>>n;
  if(n==0){
    int x;
    cin>>x;
    if(1868<=x && x<=1911){
      b="M";
      x-=1867;
    }
    else if(1912<=x && x<=1925){
      b="T";
      x-=1911;
    }
    else if(1926<=x && x<=1988){
      b="S";
      x-=1925;
    }
    else{
      b="H";
      x-=1988;
    }
    cout<<b<<x<<endl;
  }
  
  else{
    int x;
    cin>>x;
    if(n==1) x+=1867;
    else if (n==2) x+=1911;
    else if (n==3) x+=1925;
    else if (n==4) x+=1988;
    cout<<x<<endl;
  }
  
    
    
  return 0;
}



Measured memory_bytes: 3116
# 深さdの現実的な上限を先に決める
N = int(input())
# Aは，葉として残す必要があるものの数
A = list(map(int, input().split()))

# 深さdのノード数の上限
limit = [1]  # ルートのノードの上限数 : 当然1
for d in range(1, N+1):
    if d == N:  # 1番深いところの上限はA[N]
        limit.append(A[d])
    else:
        limit.append((limit[-1]-A[d-1])*2)
        # limit[-1] < A[d-1]の場合，葉を確保することができていない
        if limit[-1] < 0:
            print(-1)
            exit()

# Nが0の時の処理
if N == 0:
    if A[0] != 1:
        print(-1)
        exit()

# 1番深いところから構築して最後にsumを取る
ans = [limit[-1]]
# 1番深いところから構築しており，今現在のオードの数
now_node = limit[-1]
for d in range(N-1, -1, -1):
    ans.append(min(now_node+A[d], limit[d]))
    now_node = ans[-1]  # 現在のノードの数

# 構築したものに対してジャッジする
ans.reverse()
for d in range(N):
    if (ans[d]-A[d])*2 < A[d+1]:
        print(-1)
        exit()
print(sum(ans))


Measured memory_bytes: 707884
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		for(int i=0;i<n;i++){
			int data[]=new int[4];
			for(int j=0;j<4;j++)data[j]=in.nextInt();
			int sum=data[0]*data[2]+data[1]*data[3];
			if(data[2]>=5 && data[3]>=2)sum*=0.8;
			
			if(data[2]<5)data[2]=5;
			if(data[3]<2)data[3]=2;
			int itc=data[0]*data[2]+data[1]*data[3];
			itc*=0.8;
			sum=Math.min(sum, itc);
			System.out.println(sum);
		}
	}

}


Measured memory_bytes: 31308
#include <iostream>
using namespace std;
int main()
{
  string s;
  cin >> s;
  string ans = "";
  for (int i = 0; i < s.length(); i++)
  {
    if (s.at(i) == '0')
      ans += "0";
    else if (s.at(i) == '1')
      ans += "1";
    else if (ans != "")
      ans = ans.substr(0, ans.length() - 1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>


int ans[ 100 + 1 ][ 10000 + 1 ] ;

int v ,w ;

int main()
{
	int N ,W ;
	scanf( "%d %d" ,&N ,&W ) ;


	int i ,j ;
	for( i = 1 ; i <= N ; ++i )
	{
		scanf( "%d %d" ,&v ,&w ) ;

		for( j = 1 ; j <= W ; ++j )
		{
			if( j - w >= 0 )
			{
				if( ans[ i - 1 ][ j ] < ans[ i - 1 ][ j - w ] + v )
				{
					ans[ i ][ j ] = ans[ i - 1 ][ j - w ] + v ;
				}

				else
				{
					ans[ i ][ j ] = ans[ i - 1 ][ j ] ;
				}
			}

			else
			{
				ans[ i ][ j ] = ans[ i - 1 ][ j ] ;
			}
		}
	}


	printf( "%d\n" ,ans[ N ][ W ] ) ;


	return 0 ;
}

Measured memory_bytes: 5648