akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        ll a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;

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

const ll INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  vector<ll> h(N);
  for (int i = 0; i < N; i++)
  {
    cin >> h[i];
  }

  vector<ll> dp(N, INF);
  dp[0] = 0;
  dp[1] = abs(h[0] - h[1]);

  for (int i = 2; i < N; i++)
  {
    chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
  }

  cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.println(execute(sc.nextLine()));

    }

    public static int execute(String text) {
        int result = 0;
        for(int front = 0; front < text.length() / 2; front++){
            int back = text.length() - front - 1;
            String frontChar = String.valueOf(text.charAt(front));
            String backChar = String.valueOf(text.charAt(back));


            if(!frontChar.equals(backChar)){
                result++;
            }
        }
        return  result;
    }

}

Measured memory_bytes: 24276
#include <iostream>

using namespace std;

int main() {
	int x, y, temp;

	while (1) {
		cin >> x >> y;

		if (x > y) {
			temp = x;
			x = y;
			y = temp;
		}
		else if (x == 0 && y == 0)
			break;

		cout << x << " " << y << endl;
	}

	return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>

int main( void ){
    int a,b;
	
	scanf("%d %d", &a, &b);
	
	if( a < b ){
		printf("a < b\n");
	}
	else if( a > b ){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}


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

int n;
int r[101],c[101];
long long int dp[101][101];
int null = -1;
long long int ans;
long long int inf = 1<<24;
long long int dfs(int i,int j){
    long long int res=inf;
    if(dp[i][j] != null){
        return dp[i][j];
    }
    else if(i == j){
        res = 0;
    }
    else{
        for(int k=i;k<j;k++){
            res = min(dfs(i,k) + dfs(k+1,j) + r[i]*c[k]*c[j],res);
        }
    }

    dp[i][j] = res;
    //cout << i << " " << j << " " << dp[i][j] << endl;
    return res;
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> r[i] >> c[i];
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            dp[i][j] = null;
        }
    }
    ans = dfs(0,n-1);
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 
ll X,Y;
ll M[105][105],vis[105][105],D[105][106];


int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> x >> y;
	X=x,Y=y;
	for(i=1;i<=x;i++)
	{
		string s;
		cin >> s;
		for(j=0;j<y;j++)
			M[i][j+1]=s[j];


	}
	for(i=1;i<=x;i++)
		for(j=1;j<=y;j++)
			D[i][j]=1000000;
	queue<pll>Q;
	Q.push(mp(1,1));
	D[1][1]=0,vis[1][1]=1;
	

	
	while(!Q.empty())
	{
		pll P=Q.front();
		Q.pop();
		i=P.ff,j=P.ss;
		if(i+1<=x)
		{
			if(M[i][j]=='#')
			{
				if(M[i+1][j]=='.')
					D[i+1][j]=min(D[i+1][j],D[i][j]+1);
				else
					D[i+1][j]=min(D[i+1][j],D[i][j]);
			}
			else
				D[i+1][j]=min(D[i+1][j],D[i][j]);
			if(!vis[i+1][j])
			{
				vis[i+1][j]=1;
				Q.push(mp(i+1,j));
			}
		}
		if(j+1<=y)
		{
			if(M[i][j]=='#')
			{
				if(M[i][j+1]=='.')	
					D[i][j+1]=min(D[i][j+1],D[i][j]+1);
				else
					D[i][j+1]=min(D[i][j+1],D[i][j]);

			}
			else
				D[i][j+1]=min(D[i][j+1],D[i][j]);

			if(!vis[i][j+1])
			{
				vis[i][j+1]=1;
				Q.push(mp(i,j+1));
			}
		}
	}

	// for(i=1;i<=x;i++)
	// {
	// 	for(j=1;j<=y;j++)
	// 		cout<<D[i][j]<<" ";
	// 	cout<<endl;
	// }

	if(M[x][y]=='#')
		D[x][y]++;
	cout<<D[x][y]<<endl;
}

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

int n, m;
bool ans = false;
bool t;


int main() {
  cin >> n >> m;
  vector<string> a(n);
  vector<string> b(m);
  rep (i, n) {
    cin >> a[i];
  }
  rep (i, m) {
    cin >> b[i];
  }
  rep (i, n-m+1) {
    rep (j, n-m+1) {
      t = true;
      rep (x, m) {
        rep (y, m) {
          if (a[i+x][j+y] != b[x][y]) t = false;
        }
        if (!t) break;
      }
      if (t) {
        ans = true;
        break;
      }
    }
    if (ans) break;
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <sstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1e-9;


signed main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n,m;
  cin>>n>>m;
  pair<ll, ll> p[n];
  rep(i,n) {
    cin>>p[i].first>>p[i].second;
  }
  sort(p, p+n, [&](pair<ll, ll> x, pair<ll, ll> y) {
    if (x.first == y.first) return x.second > y.second;
    return x.first < y.first;
  });
  // rep(i,n) {
  //   debug(p[i].first);
  //   debug(p[i].second);
  // }
  ll ans = 0;
  int d = 1;
  int c = 0;
  priority_queue<ll> q;
  while(d <= m){
    while(p[c].first <= d) {
      q.push(p[c].second);
      c++;
    }
    if(!q.empty()) {
      int top = q.top();
      q.pop();
      ans += top;
    }
    d++;
    // debug(c);
    // debug(d);
    // debug(ans);
    // if(p[c].first <= d) {
    //   q.push(p[c].second);
    //   ans += p[c].second;
    //   d++;
    //   c++;
    // } else {
    //   d++;
    // }

  }
  cout << ans << endl;


  return 0;
}


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

int main() {
    int a, b, q;
    cin >> a >> b >> q;
    vector<int64_t> s(a+2), t(b+2), ans(q, 1e18);
    for (int i=1; i<=a; i++) cin >> s[i];
    s[0] = -1e18;
    s[a+1] = 1e18;
    for (int i=1; i<=b; i++) cin >> t[i];
    t[0] = -1e18;
    t[b+1] = 1e18;
    for (auto& e : ans) {
        int64_t n;
        cin >> n;
        auto rs = upper_bound(s.begin(), s.end(), n), rt = upper_bound(t.begin(), t.end(), n);

        for (auto& ss : { rs, rs - 1 }) {
            for (auto& tt : { rt, rt - 1 }) {
                e = min(e, abs(*ss - n) + abs(*tt - *ss));
                e = min(e, abs(*tt - n) + abs(*ss - *tt));
            }
        }
    }

    for(auto& e : ans) cout << e << endl;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#include<stdio.h>
#include<cstdio> 

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
	ll h,w,h1,w1;
	cin>>h>>w>>h1>>w1;
	cout<<(h-h1)*(w-w1)<<endl;
	return 0;
}

Measured memory_bytes: 3536
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
  
        static long[] a;
        static long N;
        static long K;
        
        static void Main(string[] args)
        {
          //入力を受け取る
          var NY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
          long N = NY[0];
          long Y = NY[1];
          long man = -1;
          long gosen = -1;
          long sen = -1;
          bool flag = false;
          
          for(long i = Y/10000; i >= 0 ; i--){
            var nokori = Y-i*10000;
            for(long j = nokori/5000; j >= 0 ; j--){
              var nokori2 = nokori-j*5000;
              sen = nokori2/1000;
              //Console.WriteLine(i+" "+j+" "+sen);
              if(i+j+sen == N){
                man = i;
                gosen = j;
                flag = true;
                break;
              }else{
                sen = -1;
              }
            }
            if(flag){
              break;
            }
          }
          
          Console.WriteLine(man+" "+gosen+" "+sen);
        }
 }


Measured memory_bytes: 13396
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  n = readline() |> parseInt
  v = readline() |> split |> parseArray

  sort!(v)
  ans=v[1]
  for i in 2:n
    ans=(ans+v[i])/2
  end

  println(ans)
end

main()


Measured memory_bytes: 168960
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N =  INT()
if N == 1:
	print("Hello World")
else:
	A = INT()
	B = INT()
	print(A+B)


Measured memory_bytes: 5336
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin>>n;
    ll h,k,w;
    for(int i=1;i<=3500;i++){
        for(int j=1;j<=3500;j++){
            ll a=n*i*j;
            ll b=4*i*j-n*i-n*j;
            if(b>0){
                if(a%b==0){
                    h=i;
                    k=j;
                    w=a/b;
                    break;
                }
            }
        }
        if(w!=0)
            break;
    }
    cout<<h<<' '<<k<<' '<<w<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        int t;
        cin >> t;
        v[i] = t - (i + 1);
    }

    sort(v.begin(), v.end());

    int median = v[N / 2];
    long result = 0;
    for (int i = 0; i < N; ++i)
        result += abs(v[i] - median);
    cout << result << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD =1e9+7;
using ll=long long;
int n, m;
int d, t;
map<int, int> D, T;
int main(){
  cin >> n;
  rep(i,n){
    cin >> d;
    D[d]++;
  }
  cin >> m;
  rep(i,m){
    cin >> t;
    T[t]++;
  }
  string ans = "YES";
  for(auto p: T){
    int score = p.first;
    int cnt = p.second;
    if(D[score] < cnt) ans = "NO";
  }
  cout << ans << endl;
}


Measured memory_bytes: 18944
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#define inf 0x3f3f3f3f
#define esp 1e-7
using namespace std;
long long read(){
    long long x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int n,m;

vector<int> from[200050];
int visited[200050];
int boolean;


int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++){
		int x;int y;
		x=read();y=read();
		from[x].push_back(y);
		from[y].push_back(x);
	}
	boolean=0;
	for (int i=1;i<=n;i++){
		int counts=0;
		for (int j=0,maxn=from[i].size();j<maxn;j++){
			if (from[i][j]==1)	counts++;
			if (from[i][j]==n)	counts++;
		}
		if (counts==2){
			boolean=1;
			break;
		}
	}
	if (boolean)	printf("POSSIBLE\n");
	else			printf("IMPOSSIBLE\n");
	return 0;
}

Measured memory_bytes: 12016
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t A, B, C, K;
  cin >> A >> B >> C >> K;
  const int32_t a_take = min(A, K);
  const int32_t rest_after_a = max(0, K-a_take);
  const int32_t b_take = min(B, rest_after_a);
  const int32_t rest_after_b = max(0, rest_after_a-b_take);
  const int32_t c_take = min(C, rest_after_b);
  cout << (a_take-c_take) << endl;

  return 0;
}


Measured memory_bytes: 3608
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::{Chars};
use std::iter::Iterator;
use std::collections::HashSet;

fn main() {
    input! {
        n: i32,
        mut s: [String; n],
    }


    let mut  hash =  HashSet::new();
    for i in s {
        hash.insert(i);
    }

    println!("{}", hash.len());

}


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

using namespace std;

void outStr(vector<int>& ary) {

	string aryStr = "";
	for (int i = 0; i < ary.size(); i++)
	{
		aryStr = aryStr + to_string(ary[i]);
		if (i < ary.size() - 1) aryStr = aryStr + " ";
	}

	cout << aryStr << endl;
	return;
}


int bubbleSort(vector<int>& ary) {

	bool flag = 1;
	int swTime = 0;
	while (flag)
	{
		flag = 0;
		for (int j = ary.size() - 1; j >= 1; j--)
		{
			if (ary[j] < ary[j - 1]) {
				int sw = ary[j - 1];
				ary[j - 1] = ary[j];
				ary[j] = sw;
				flag = 1;

				swTime++;
			}

		}
	}

	return swTime;
}

int main() {

	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int swt = bubbleSort(A);
	outStr(A);

	cout << swt << endl;


	return 0;
}



Measured memory_bytes: 3240
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

int main() {
    int N, K;
    cin >> N >> K;

    if (K == 1) {
        cout << setprecision(10) << (double)1.0 << endl;
        return 0;
    }

        double win = max(0.0, 1.0 * (N - K + 1) / N);
    double base = 1.0 - win;

    double ans = 0.0;
    for (int i = 1; i <= N && i <= K - 1; i++) {
        int ii  = i * 2;
        int cnt = 1;
        while (ii < K) {
            ii *= 2;
            cnt++;
        }
        ans += pow(2, -cnt);
    }
    ans /= min(N, K - 1);

    ans *= base;
    ans += win;

    cout << setprecision(10) << ans << endl;

    return 0;
}

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

main() {
    int N,D,X; cin >> N >> D >> X;
    rep(i,N){
        int a; cin >> a;
        X+=(D-1)/a+1;
    }
    cout << X << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    int N,K;
    cin>>N>>K;
    if(K>(N-1)*(N-2)/2){cout<<"-1"<<endl;return 0;}
    cout<<N-1+(N-1)*(N-2)/2-K<<endl;
    rep(i,N-1){
        cout<<1<<" "<<i+2<<endl;
    }
    int u=2,v=3;
    rep(i,(N-1)*(N-2)/2-K){
        cout<<u<<" "<<v<<endl;
        if(v==N){u++;v=u+1;}
        else{v++;}
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll             long long
#define pl             pair <ll,ll>
#define ps             pair <string,string>
#define vi         vector <int>
#define vl             vector <ll>
#define vpi            vector <pi>
#define vpl            vector <pl>
#define st             string
#define vs             vector <st>
#define f(i,a,b)       for(ll i=(a);i<(b);i++)
#define fd(i,a,b)      for(ll i=(a);i>(b);i--)
#define Max(a,b)       ((a)>(b)?(a):(b))
#define Min(a,b)       ((a)<(b)?(a):(b))
#define fs             first
#define sc             second
#define si(a)          scanf("%d",&a)
#define sii(a,b)       scanf("%d %d",&a,&b)
#define siii(a,b,c)    scanf("%d %d %d",&a,&b,&c)
#define sl(a)          scanf("%lld",&a)
#define sll(a,b)       scanf("%lld %lld",&a,&b)
#define slll(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c);
#define pf             printf
#define pfi(n)         printf("%d\n",n)
#define pfl(n)         printf("%lld\n",n)
#define pfls(n)        printf("%lld ",n)
#define pfci(n,ans)    printf("Case %lld: %d\n",n,ans)
#define pfcl(n,ans)    printf("Case %lld: %lld\n",n,ans)
#define pfcd(n,ans)    printf("Case %lld: %lf\n",n,ans)
#define pb             push_back
#define mp             make_pair
#define all(v)         v.begin(),v.end()
#define mem(a,v)       memset(a,v,sizeof(a))
#define MAX 10000007
#define MOD 1234567
#define INF 1e12
#define LG  16
#define mid ((l+r)/2)
#define H(i,j) (i*107+j)
#define IN(n) (2*(n))
#define OUT(n) (2*(n)+1)
using namespace std;

ll a[MAX];
int main(){
    ll N;
    sl(N);
    f(i,0,3*N){
        sl(a[i]);
    }
    sort(a,a+3*N);
    ll ans=0;
    for(ll i=N;i<3*N;i+=2){
        ans+=a[i];
    }
    pfl(ans);
}


Measured memory_bytes: 4352
<?php
  $sum=100000;
  while($line=trim(fgets(STDIN))){
    $count=0;
    foreach(array_fill(0,10,"") as $key1=>$hoge){
      foreach(array_fill(0,10,"") as $key2=>$hoge){
        foreach(array_fill(0,10,"") as $key3=>$hoge){
          foreach(array_fill(0,10,"") as $key4=>$hoge){
            if($key1+$key2+$key3+$key4==$line)
              $count++;
          }
        }
      }
    }
    echo $count."\n";
  }

Measured memory_bytes: 15228
n, ma, mb = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(n)]

m = n * 10 + 1

dp = [[[float('inf')] * m for j in range(m)] for i in range(n + 1)]
for i in range(n + 1):
    dp[i][0][0] = 0

for i in range(n):
    for j in range(m):
        for k in range(m):
            dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])

            # i個目を買う
            jj = j + abc[i][0]
            kk = k + abc[i][1]
            if jj < m and kk < m:
                dp[i+1][jj][kk] = min(dp[i+1][jj][kk], dp[i][j][k] + abc[i][2])

from fractions import gcd
ans = float('inf')
for i in range(1, m):
    for j in range(1, m):
        g = gcd(i, j)
        if i // g == ma and j // g == mb:
            ans = min(ans, dp[-1][i][j])

if ans == float('inf'):
    print(-1)
else:
    print(ans)


Measured memory_bytes: 144644
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define swap(a,b) a^=b^=a^=b
#define lb(x) ((x)&(-(x)))
#define dalao 1000000007
#define inf 0x3f3f3f3f
//#define dalao 66662333
#define N 200010
typedef long long ll;
using namespace std;
struct wxh{
	int x,v;
	bool operator <(const wxh& b)const{return v<b.v;}
}a[N];
struct yjq{
	int l,r;
	bool operator <(const yjq& b)const{return l<b.l||(l==b.l&&r<b.r);}
}b[N];
int n,x[N],t[N],sum[N<<2],tag[N<<2],tag2[N<<2];
inline void upd(int& a,int b){a+=b;if(a>=dalao)a-=dalao;}
inline int add(int a,int b){return a+b>=dalao?a+b-dalao:a+b;}
inline void down(int x,int l,int r){
	if(tag2[x]^1){
		if(l^r){
			tag2[x<<1]=1ll*tag2[x<<1]*tag2[x]%dalao,tag2[x<<1|1]=1ll*tag2[x<<1|1]*tag2[x]%dalao;
			tag[x<<1]=1ll*tag[x<<1]*tag2[x]%dalao,tag[x<<1|1]=1ll*tag[x<<1|1]*tag2[x]%dalao;
			sum[x<<1]=1ll*sum[x<<1]*tag2[x]%dalao,sum[x<<1|1]=1ll*sum[x<<1|1]*tag2[x]%dalao;
		}
		tag2[x]=1;
	}
	if(tag[x]){
		if(l^r){
			int mid=l+r>>1;
			upd(tag[x<<1],tag[x]),upd(tag[x<<1|1],tag[x]);
			upd(sum[x<<1],1ll*(mid-l+1)*tag[x]%dalao),upd(sum[x<<1|1],1ll*(r-mid)*tag[x]%dalao);
		}
		tag[x]=0;
	}
}
inline void modify(int x,int l,int r,int L,int R,int v){
	down(x,L,R);
	if(l==L&&r==R){upd(sum[x],1ll*(r-l+1)*v%dalao),upd(tag[x],v);return;}
	int mid=L+R>>1;
	if(r<=mid)modify(x<<1,l,r,L,mid,v);
	else if(l>mid)modify(x<<1|1,l,r,mid+1,R,v);
	else modify(x<<1,l,mid,L,mid,v),modify(x<<1|1,mid+1,r,mid+1,R,v);
	sum[x]=add(sum[x<<1],sum[x<<1|1]);
}
inline void modify2(int x,int l,int r,int L,int R,int v){
	down(x,L,R);
	if(l==L&&r==R){sum[x]=1ll*sum[x]*v%dalao,tag2[x]=1ll*tag2[x]*v%dalao,tag[x]=1ll*tag[x]*v%dalao;return;}
	int mid=L+R>>1;
	if(r<=mid)modify2(x<<1,l,r,L,mid,v);
	else if(l>mid)modify2(x<<1|1,l,r,mid+1,R,v);
	else modify2(x<<1,l,mid,L,mid,v),modify2(x<<1|1,mid+1,r,mid+1,R,v);
	sum[x]=add(sum[x<<1],sum[x<<1|1]);
}
inline int query(int x,int l,int r,int L,int R){
	down(x,L,R);
	if(l==L&&r==R)return sum[x];
	int mid=L+R>>1;
	if(r<=mid)return query(x<<1,l,r,L,mid);
	else if(l>mid)return query(x<<1|1,l,r,mid+1,R);
	return add(query(x<<1,l,mid,L,mid),query(x<<1|1,mid+1,r,mid+1,R));
}
namespace init_b{
	int mi[N],mx[N],smi[N],smx[N];
	inline void main(){
		mset(mi,inf);
		for(int i=1;i<=n;i++)mi[a[i].x]=min(mi[a[i].x],i),mx[a[i].x]=max(mx[a[i].x],i);
		for(int i=1;i<=n;i++)smx[i]=max(smx[i-1],mx[i]);
		smi[n+1]=inf;
		for(int i=n;i;i--)smi[i]=min(smi[i+1],mi[i]);
		for(int i=1;i<=n;i++)b[i].l=smi[a[i].x],b[i].r=smx[a[i].x];
	}
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i].x,&a[i].v),x[i]=a[i].x;
	sort(x+1,x+1+n),sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)a[i].x=lower_bound(x+1,x+1+n,a[i].x)-x;
	init_b::main();
	sort(b+1,b+1+n);
	modify(1,0,0,0,n,1);
	for(int i=1;i<=n;i++){
		int c=query(1,b[i].l-1,b[i].r,0,n);
		modify(1,b[i].r,b[i].r,0,n,c);
		if(b[i].r<n)modify2(1,b[i].r+1,n,0,n,2);
	}
	printf("%d",query(1,n,n,0,n));
	return 0;
}

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

int f[10000 + 7];

int main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for(int i = 1; i <= 100; i++) {
		for(int j = 1; j <= 100; j++) {
			for(int k = 1; k <= 100; k++) {
				int x = i * i + j * j + k * k + i * j + j * k  + k * i;
				if(x <= 10000) {
					f[x]++;
				}
			}
		}
	}
	int n; cin >> n;
	for(int i = 1; i <= n; i++) {
		cout << f[i] << endl;
	}
}

Measured memory_bytes: 3616
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable uint mod = 10^^9 + 7;
alias mint = ModInt!mod;

void main() {
    auto s = readln.split.map!(to!int);
    auto n = mint(s[0]);
    auto m = s[1];
    writeln(n^^m);
}

struct ModInt(uint mod) {
    import std.conv : to;

    uint n;

    this(int n) {
        this.n = (n % mod + mod) % mod;
    }

    this(long n) {
        this.n = (n % mod + mod) % mod;
    }

    private this(uint n) {
        this.n = n;
    }

    string toString() {
        return to!string(this.n);
    }

    private uint normilize(uint n) {
        return n < mod ? n : n - mod;
    }

    ModInt pow(uint n, long x) {
        long ret = 1;
        long a = n;
        while (x) {
            if (x & 1) ret = ret * a % mod;
            a = a * a % mod;
            x >>= 1;
        }
        return ModInt(to!ulong(ret));
    }

    ModInt opBinary(string op)(ModInt rhs) {
        static if (op == "+") {
            return ModInt(normilize(n + rhs.n));
        } else if (op == "-") {
            return ModInt(normilize(n + mod - rhs.n));
        } else if (op == "*") {
            return ModInt(to!uint(to!long(n) * rhs.n % mod));
        } else if (op == "/") {
            return this * pow(rhs.n, mod-2);
        } else if (op == "^^") {
            return pow(this.n, rhs.n);
        }
    }

    ModInt opBinary(string op, T)(T rhs) {
        static if (op == "^^") {
            return pow(this.n, rhs);
        }
    }
}



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

int main(){
  int a, b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<endl;
  }
  if(a==b){
    cout<<"a == b"<<endl;
  }
  if(a>b){
    cout<<"a > b"<<endl;
  }
  return 0;
}


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

typedef long long ll;

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

int main() {
  ll x;
  cin >> x;
  ll ans;
  ans = 2*(x/11);
  x = x%11;
  if ((1 <= x) && (x <= 6)) {
    ans++;
  }
  else if ((7 <= x) && (x <= 10)) {
    ans += 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Random;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;

    public static void main(String[] args) {
    	int N = sc.nextInt();
    	Work[] work = new Work[N];
    	for(int i=0; i<N; i++) {
    		work[i] = new Work(sc.nextInt(), sc.nextInt());
    	}
    	Arrays.sort(work, (a, b) -> a.B - b.B);
    	long sum = 0;
    	for(int i=0; i<N; i++) {
    		sum += work[i].A;
    		if(sum > work[i].B) {
    			System.out.println("No");
    			return;
    		}
    	}
    	System.out.println("Yes");
    }

    static class Work {
    	int A;
    	int B;
		public Work(int a, int b) {
			A = a;
			B = b;
		}

    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }

    static void shuffleArray(long[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            long tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
    }
}


Measured memory_bytes: 57360
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e5+5;
struct point {
	int x, y;
};
int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	point p1, p2, p3, p4, cur;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;

	cur.x = p2.x - p1.x;
	cur.y = p2.y - p1.y;

	cur.y *= -1;
	swap(cur.x, cur.y);
	p3.x = p2.x + cur.x;
	p3.y = p2.y + cur.y;

	cur.y *= -1;
	swap(cur.x, cur.y);
	p4.x = p3.x + cur.x;
	p4.y = p3.y + cur.y;

	cout << p3.x << ' ' << p3.y << ' ' << p4.x << ' ' << p4.y;
	return 0;
}


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

a_b = [0 for i in range(100001)]

for i in range(n):
    a, b = map(int, input().split())
    a_b[a] += b

for i in range(1, 100001):
    a_b[i] += a_b[i-1]
    if a_b[i] >= k:
        print(i)
        break

Measured memory_bytes: 9484
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
const int maxn=200005;
int n,a[maxn];
ll ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	if(a[1]){ puts("-1"); return 0;}
	
	for(int i=2;i<=n;i++){
		if(a[i]>a[i-1]+1){ puts("-1"); return 0;}
		if(a[i]==a[i-1]+1) ans++;
		else ans+=(ll)a[i];
	}
	
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
char a[81][81][160 * 160 + 1];
int c[81][81];
int h, w, x, y;
int ans = 160 * 160;
int main() {
	scanf("%d%d", &h, &w);
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			scanf("%d", c[i] + j);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			scanf("%d", &x);
			c[i][j] -= x;
		}
	}
	for (int i = 0; i <= h; i++) {
		a[i][0][80 * 160] = 1;
	}
	for (int i = 0; i <= w; i++) {
		a[0][i][80 * 160] = 1;
	}
	for (int i = 2; i <= h + w; i++) {
		for (int j = 1; j < i; j++) {
			x = j;
			y = i - x;
			if (1 <= x && x <= h) {
				if (1 <= y && y <= w) {
					for (int k = 0; k <= 160 * 160; k++) {
						if (a[x - 1][y][k] && !(x == 1 && y != 1)) {
							a[x][y][k + c[x][y]] = 1;
							a[x][y][k - c[x][y]] = 1;
						}
						if (a[x][y - 1][k] && !(x != 1 && y == 1)) {
							a[x][y][k + c[x][y]] = 1;
							a[x][y][k - c[x][y]] = 1;
						}
					}
				}
			}
		}
	}
	for (int i = 0; i <= 160 * 160; i++) {
		if (a[h][w][i]) {
			x = i - 160 * 80;
			if (x < 0)x = -x;
			if (x < ans)ans = x;
		}
	}
	printf("%d\n", ans);
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  string s; cin >> s;
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A'){
      int a = 0;
      int pos = i;
      for(int j = i; j < s.size(); j++){
        if(s[j] == 'A') a++;
        else if(s[j] == 'B' && s[j+1] == 'C'){
          ans += a;
          j++;
        }
        else {
          pos = j;
          break;
        }

        if(j == s.size()-1){
          pos = j;
          break;
        }
      }
      i = pos;
    }
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 640
def swap(a, c)
  a[c[0]-1], a[c[1]-1] = a[c[1]-1], a[c[0]-1]
  a
end

w = gets.to_i

a = []
0.upto(w-1) do |i|
  a[i] = i + 1
end

n = gets.to_i

n.times do
  c = gets.chomp.split(",").map(&:to_i)
  a = swap(a, c)
end

a.each {|v| puts v}

Measured memory_bytes: 6104
// abc065_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int X, A, B;
    cin >> X >> A >> B;

    if (B <= A){
        print("delicious");
    } else if (B <= A + X){
        print("safe");
    } else {
        print("dangerous");
    }

    return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    
    if(a > b) {
        cout << "a > b" << endl;
    } else if(a < b) {
        cout << "a < b" << endl;
    } else {
        cout << "a == b" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s1;
	string s2;
	string s3;
	string ret;
	cin >> s1 >> s2 >> s3;
	ret.push_back(toupper(s1[0]));
	ret.push_back(toupper(s2[0]));
	ret.push_back(toupper(s3[0]));
	cout << ret;
	return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include <bits/stdc++.h>
using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(Int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(Int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using Int = long long;
using ll = long long;
using P = pair<Int,Int>;
using vi = vector<Int>;
using vvi = vector<vi>;
using vp = vector<P>;
using vvp = vector<vp>;

const Int INF = (1LL<<50);

void solve(){
  string s;
  cin >> s ;
  if(s[0] >= 'a' && s[0] <= 'z') cout << "a" << endl;
  else cout << "A" << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  // Failed to predict input format
  solve();
  return 0;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int INF = 1 << 30;
int a[100000];
int dp[100000];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	fill(dp, dp + n, INF);
	for (int i = 0; i < n; i++) {
		*lower_bound(dp, dp + n, a[i]) = a[i];
	}
	cout << (lower_bound(dp, dp + n, INF) - dp) << endl;
}


Measured memory_bytes: 3904
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
int soinsu[100];
signed main() {
	int n; cin >> n;
	for (int i = 1; i <= n; i++) {
		int N = i;
		for (int j = 2; j*j <= N; j++) {
			while (!(N%j)) {
				N /= j;
				soinsu[j]++;
			}
		}
		if (N != 1)soinsu[N]++;
	}
	
	int cnt = 0;
	int cnt1 = 0;
	for (int j = 2; j <= n; j++) {
		if (soinsu[j] >= 74)cnt++;
	}
	for (int j = 2; j <= n; j++) {
		for (int k = 2; k <= n; k++) {
			if (j == k)continue;
			if (soinsu[j] >= 24 && soinsu[k] >= 2)cnt++;
			if (soinsu[j] >= 14 && soinsu[k] >= 4)cnt++;
		}
	}
	for (int j = 2; j <= n; j++) {
		for (int k = 2; k <= n; k++) {
			for (int l = 2; l <= n; l++) {
				if (j == k || k == l || l == j)continue;
				if (soinsu[j] >= 4 && soinsu[k] >= 2 && soinsu[l] >= 4)cnt1++;
			}
		}
	}
	cout << cnt+cnt1/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[100007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, -1, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
         
        if (prime[p] == -1) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = p; 
        } 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

//to calculate p1^x  *  p2^x2  *p3^x3 ----------
//i.e. prime factorization and store pi and xi in vector 
vector<pair<ll, ll>> pFactor;

void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if (count) 
        pFactor.pb({2,count}); 
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            pFactor.pb({i,count});
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        pFactor.pb({n,1}); 
} 



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
   int x,n;
   cin>>x>>n;
   int min = x*2;
   int max=x*4;
   if(n>=min and n<=max and n%2!=1){
       cout<<"Yes\n";
   }
   else cout<<"No\n";
   
}

Measured memory_bytes: 3652
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            DateTime dateTime1 = DateTime.Parse(input);
            int result = DateTime.Compare(dateTime1, DateTime.Parse("2019 / 04 / 30"));
            if (result <= 0)
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                Console.WriteLine("TBD");
            }
        }
    }
}


Measured memory_bytes: 11616
#include <cmath>
#include <cstdio>
using namespace std;

bool check(long long int n, long long int s, long long int b){
  s -= n;
  while(n > 0){
    n /= b;
    s += n*(b-1);
    if(s > 0) return false;
  }
  return s == 0;
}

int main(){
  long long int n, s;
  scanf("%lld %lld", &n, &s);
  if(s > n){
    printf("%d\n",-1);
    return 0;
  }else if(s == n){
    printf("%lld\n",n+1);
    return 0;
  }
  long long int d = n - s, ans = -1, m = sqrt(d);
  for(long long int i = 1; i <= m; ++i){
    if(d != d/i*i) continue;
    if(check(n,s,i+1)){
      printf("%lld\n",i+1);
      return 0;
    }
    if(check(n,s,d/i+1)){
      ans = d/i+1;
    }
  }
  printf("%lld\n",ans);
  return 0;
}


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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll LL_INF = LLONG_MAX;
const long double PI = (acos(-1));
const ull MOD = 1000000007;


struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    int four = 0, two = 0;
    for(int i = 0; i < N; i++){
        ll a;
        cin >> a;
        if(a % 4 == 0) four++;
        else if(a % 2 == 0) two++;
    }
    int one = N - four - two;
    bool ok = false;
    if(two == 0){
        if(four >= one - 1) ok = true;
    }else if(four >= one) ok = true;
    if(ok) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 1024
k=int(input())
max_a=pow(10,16)+1000
for i in range(2,51):
  a=[j+k//i for j in range(i)]
  for j in range(k%i):
    a[-1-j]+=1
  if max(a)<=max_a:
    print(i)
    print(' '.join(list(map(str,a))))
    exit()

Measured memory_bytes: 9196
//B One Clue
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int k,x,count;
  cin>>k>>x;
  count=k*2-1;
  vector<int> vec(count);
  for(int i=0;i<count;i++)
  {
    vec.at(i)=x-k+1+i;
    cout<<vec.at(i)<<" ";
  }
}


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

int main() {
    string S, C;
    int Q, T, F;
    cin >> S >> Q;
    int rev = 1;

    rep(i,Q) {
        cin >> T;
        if (T == 1) {
            rev *= -1;
        } else if (T == 2) {
            cin >> F >> C;
            if ((F == 1 && rev == 1) 
            || (F == 2 && rev == -1)) {
                S.insert(0, C);
            } else {
                S.insert(S.size(), C);
            }
        }
    }
    if (rev == -1) reverse(S.begin(), S.end());
    cout << S << endl;
}


Measured memory_bytes: 3884
#include <stdio.h>
 
int main(void){
 
    int word[26];
    char x;
 
    for(x=0; x<26; x++){
        word[x]=0;
    }
 
    while(!feof(stdin)){
        x = fgetc(stdin);
        if('a'<=x && x<='z'){
            x-='a'-'A';
        }
        if('A'<=x && x<='Z'){
            word[x-'A']++;
        }
    }
 
    for(x=0; x<26; x++){
        printf("%c : %d\n", 'a'+x, word[x]);
    }
 
    return 0;
}

Measured memory_bytes: 524
S=list(input())

if S[0]=="R" and S[1]=="R" and S[2]=="R":
	print(3)

elif S[0]=="R" and S[1]=="R" and S[2]!="R":
	print(2)
    
elif S[0]!="R" and S[1]=="R" and S[2]=="R":
	print(2)
    
elif S[0]=="R" and S[1]!="R" and S[2]=="R":
	print(1)
    
elif S[0]=="R" and S[1]!="R" and S[2]!="R":
	print(1)
    
elif S[0]!="R" and S[1]=="R" and S[2]!="R":
	print(1)
    
elif S[0]!="R" and S[1]!="R" and S[2]=="R":
	print(1)
    
else:
	print(0)

Measured memory_bytes: 9100
main::IO()
main =do
  d<-getLine
  print (solver (trans d))

trans::String -> [Bool]
trans cs = map (\x-> if x=='B' then True else False) cs

solver :: [Bool]->Int
solver     []   =0
solver (_:[])   =0
solver (x:y:dat)=if x==y then solver (y:dat) else 1+(solver (y:dat))

Measured memory_bytes: 5244
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

struct unko {
	string s;
	ll point, num;
	bool operator<(unko e) {
		if (s != e.s) {
			return s < e.s;
		} else {
			return point > e.point;
		}
	}
};

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<unko> a(n);
	for (int i = 0; i < n; i++) {
		string x;
		ll y;
		cin >> x >> y;
		a[i] = (unko){x, y, i + 1};
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; i++) {
		dump(a[i].num);
	}
	return 0;
}

Measured memory_bytes: 256
counter = []
for i in range(3):
    a, b = map(int, input().split())
    counter.append(a)
    counter.append(b)
ans = "YES"
if counter.count(1) >= 3 or counter.count(2) >= 3 or counter.count(3) >= 3 or counter.count(4) >= 3:
    ans = "NO"
print(ans)

Measured memory_bytes: 3060
from bisect import bisect_left

a, b, q = map(int, input().split())
S = []
T = []
X = []


def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b))


for _ in range(a):
    S.append(int(input()))
for _ in range(b):
    T.append(int(input()))
for _ in range(q):
    x = int(input())

    basho1 = bisect_left(S, x)
    basho11 = min(basho1, a - 1)
    basho12 = basho11 - 1

    basho2 = bisect_left(T, x)
    basho21 = min(basho2, b - 1)
    basho22 = basho21 - 1
    ans = calc(x, S[basho11], T[basho21])
    ans = min(ans, calc(x, S[basho11], T[basho22]))
    ans = min(ans, calc(x, S[basho12], T[basho21]))
    ans = min(ans, calc(x, S[basho12], T[basho22]))
    print(ans)


Measured memory_bytes: 12092
function f()
    a,b,c,k=map(x->parse(Int,x),split(readline()))
    ans=0
    ans += a
    if k-a <= 0
        ans = k
        println(ans)
        exit()
    end
    k -= a
    if k-b <= 0
        println(ans)
        exit()
    end
    k -= b
    print(ans-k)
end
f()           


Measured memory_bytes: 162980
#include<bits/stdc++.h>
using namespace std;
long long n,k,l;
int main()
{
	cin>>n;
	for(int i=(int)sqrt(n);i>=1;i--)
	  if(n%i==0)
	  {
	  	k=n/i;
	  	while(k)
	  	{
	  		k/=10;l++;
	  	}
	  	cout<<l<<endl;
	  	break;
	  }
    return 0;
}

Measured memory_bytes: 256