akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  string s; cin >> s;
  int n=s.size();
  bool f=1;
  rep(i,n){
    if(s[i]!=s[n-1-i]) f=0;
  }
  rep(i,(n-1)/2){
    if(s[i]!=s[(n-1)/2-1-i]) f=0;
  }
  reverse(all(s));
  rep(i,(n-1)/2){
    if(s[i]!=s[(n-1)/2-1-i]) f=0;
  }
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
A.insert(0,0)
A.append(0)
s=0
for i in range(N+1):
    s+=abs(A[i+1]-A[i])
for i in range(N):
    print(s-abs(A[i+1]-A[i])-abs(A[i+2]-A[i+1])+abs(A[i+2]-A[i]))

Measured memory_bytes: 14176
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
ll n,m,k,ans;
string s,t;
const ll powll = 1LL<<1;

bool cmp(P a, P b){
  return a.first+a.second < b.first+ b.second;
}

int main(void){
  int n,k,s; cin >> n >> k >> s;
  rep(i,k){
    cout << s;
    if(i != n-1) cout << " ";
    
  }
  rep(i,n-k){
    if(s != 1) cout << s-1;
    else cout << s+1;

    if(i+k != n-1) cout << " ";
  }
  cout << "\n";
}

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

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

string alphabet = "zabcdefghijklmnopqrstuvwxy";

void solve(){
  int n;
  cin >> n;
  string ans = "";
  while(n > 0){
    //cout << alphabet[n % 26];
    ans += alphabet[n%26];
    n--;
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans <<endl;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 3005;
int MOD;

ll inv[MAX_N],fac[MAX_N],finv[MAX_N];

void make()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++){
		inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
}

ll comb(int a,int b)
{
	if(a<b){
		return 0;
	}
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}

ll add(ll x,ll y)
{
    return (x + y)%MOD;
}

ll sub(ll x,ll y)
{
    return (x+MOD-y)%MOD;
}

ll mul(ll x,ll y)
{
    return x*y%MOD;
}

int t[9000005];
int tt[3005];
int S[3005][3005];

void Stirling(int N)
{
    S[0][0] = 1;
    rep(i,N){
        rep(j,i+1){
            S[i+1][j+1] = add(S[i][j],mul(j+1,S[i][j+1]));
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n >> MOD;
    make();
    t[0] = 1;
    rep(i,n*n){
        t[i+1] = mul(t[i],2);
    }
    tt[0] = 2;
    rep(i,n){
        tt[i+1] = mul(tt[i],tt[i]);
    }
    Stirling(n+1);
    int ans = 0;
    rep(k,n+1){
        int cri = 0;
        rep(i,k+1){
            cri = add(cri,mul(t[i*(n-k)],S[k+1][i+1]));
        }
        if(k % 2){
            ans = sub(ans,mul(cri,mul(tt[n-k],comb(n,k))));
        }else{
            ans = add(ans,mul(cri,mul(tt[n-k],comb(n,k))));
        }
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;

typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define forn(n) for(int i = 0; i < n; i++)
#define print(n) cout << n << "\n"
#define fprint(n) fout << n << "\n"

/*
ID: argnowillac
TASK:
LANG: C++
*/

int n;
int ans = 0;
int main()
{
    cin>>n;
  	for(int i = 1; i < 10 and i <= n; i++)
      ans++;
  	for(int i = 100; i < 1000 and i <= n; i++)
      ans++;
  	for(int i = 10000; i < 100000 and i <= n; i++)
      ans++;
  	cout<<ans<<endl;

    return 0;
}


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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

signed main() {
    int K, X;
    cin >> K >> X;

    int left = max(X-K+1, -1000000);
    int right = min(X+K-1, 1000000);

    REP2(i, left, right) {
        cout << i << " \n"[i == right];
    }

    return 0;
}


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

public class Main {
    public static void up(){
        System.out.print("U");
    }
    public static void down(){
        System.out.print("D");
    }
    public static void left(){
        System.out.print("L");
    }
    public static void right(){
        System.out.print("R");
    }
    
    public static void up(int N){
        for(int n=0;n<N;n++)up();
    }
    public static void down(int N){
        for(int n=0;n<N;n++)down();
    }
    public static void left(int N){
        for(int n=0;n<N;n++)left();
    }
    public static void right(int N){
        for(int n=0;n<N;n++)right();
    }
    
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        
        int dx = tx-sx;
        int dy = ty-sy;
        
        left();
        up(dy+1);
        right(dx+1);
        down();
        
        left(dx);
        down(dy);
        
        right(dx);
        up(dy);
        
        right();
        down(dy+1);
        left(dx+1);
        up();
    }
}

Measured memory_bytes: 22720
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = null;
		String numT = "";
		String numX = "";

		try {
			scanner = new Scanner(System.in);
			numT = scanner.next();
			numX = scanner.next();

			BigDecimal result = new BigDecimal(numT).divide(
					new BigDecimal(numX), 6, RoundingMode.HALF_UP);
			System.out.println(result.floatValue());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using SS = stringstream;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<long>>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

template <class T>
void Printnector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void Printnector(const vector<T> & v, unsigned n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}


int main(int argc, char const *argv[]) {
  I x, y;
  cin >> x >> y;
  if (x % y == 0) cout << -1 << endl;
  else cout << x << endl;
  return 0;
}


Measured memory_bytes: 768
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  la=['M','A','R','C','H']
  lb=[0]*5

  for _ in range(n):
    s=S()
    if la.count(s[0])>0:
      lb[la.index(s[0])]+=1

  sm=0

  for x in list(itertools.combinations(la,3)):
    sm+=lb[la.index(x[0])]*lb[la.index(x[1])]*lb[la.index(x[2])]

  return sm

print(main())


Measured memory_bytes: 5420
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
//#include <cstdlib>
using namespace std;


int main(){
	/*input*/
	int n, t, a;
	cin >> n >> t >> a;

	int h[1000];
	for(int i = 0; i < n; i++){
		cin >> h[i];
	}

	/*calc*/
    int ans = 0;
    float min = 10000;
    float differ = 0.0;
    for(int i = 0; i < n; i++){
    	float temp = t - h[i] * 0.006;
//    	cout << "temp" << temp << endl;
    	differ = fabsf(a - temp);
//    	cout << "differ" << differ << endl;
    	if(min > differ){
    		ans = i+1;
    		min = differ;
    	}
    }

    /*output*/
	cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
    int n, k; string s; cin >> n >> s >> k;
    string ans = "";
    rep(i, n) {
        if(s[i] == s[k - 1]) ans += s[i];
        else ans += '*';
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int mi[100], ma[100];
  for (int i = 0; i < 100; ++i) {
    mi[i] = ma[i] = 0;
  }
  int x, n;
  cin >> x >> n;

  for (int i = 0; i < n; ++i) {
    int y;
    cin >> y;
    if (x == y) {
      mi[0] = ma[0] = 1;
    }
    else if (x > y) {
      mi[x-y] = 1;
    }
    else {
      ma[y-x] = 1;
    }
  }

  for (int i = 0; i < 100; ++i) {
        if (mi[i] == 0) {
      cout << x - i << endl;;
      return 0;
    }

    if (ma[i] == 0) {
      cout << x + i << endl;;
      return 0;
    }
  }
}





Measured memory_bytes: 3624
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    ans=0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if i+j+k==x:
                    ans+=1
    print(ans)



Measured memory_bytes: 5592
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    a,b,c=MI()
    if b-a==c-b:print("YES")
    else:print("NO")
main()

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;

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

    ll sum=0, cnt_first=0, cnt_second=0;

    //a[odd]<0 && a[even]>0
    for(int i=0; i<n; i+=2) {
        if(sum+a[i]<=0) {
            cnt_first += abs(1-sum-a[i]);
            sum = 1;
        } else {
            sum+=a[i];
        }

        if(i!=n-1) {
            if(sum+a[i+1]>=0) {
                cnt_first += abs(-1-sum-a[i+1]);
                sum = -1;
            } else {
                sum += a[i+1];
            }
        }
    }

    sum=0;
    //a[odd]>0 && a[even]<0
    for(int i=0; i<n; i+=2) {
        if(sum+a[i]>=0) {
            cnt_second += abs(-1-sum-a[i]);
            sum = -1;
        } else {
            sum+=a[i];
        }

        if(i!=n-1) {
            if(sum+a[i+1]<=0) {
                cnt_second += abs(1-sum-a[i+1]);
                sum = 1;
            } else {
                sum+=a[i+1];
            }
        }
    }


    cout << ((cnt_first<cnt_second)?cnt_first:cnt_second) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010

int main(){
	IOS;
	ll a1,a2,a3;cin>>a1>>a2>>a3;
	if(a1+a2+a3>=22)cout<<"bust";
	else cout<<"win";
	
	
	
	return 0;
}



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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int D, N; cin >> D >> N;
    if(N == 100) N = 101;
    cout << N * (ll)pow(100, D) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

int get_Max_size(int money, int base) {
  int count = 0;
  int tmp_money = money;
  for (;;) {
    if (tmp_money - base > 0) {
      tmp_money -= base;
      count += 1;
    } else {
      break;
    }
  }
  // std::cout << "count" << count << std::endl;
  return count;
}

int main() {
  int N = 0;
  int Y = 0;
  std::cin >> N;
  std::cin >> Y;
  if (Y / 1000 == N) {
    std::cout << "0"
              << " "
              << "0"
              << " " << N << std::endl;
    return 0;
  } else if (Y / 5000 == N) {
    std::cout << "0"
              << " " << N << " "
              << "0" << std::endl;
    return 0;
  } else if (Y / 10000 == N) {
    std::cout << N << " "
              << "0"
              << " "
              << "0" << std::endl;
    return 0;
  }

  int x = 0;
  int y = 0;
  int z = 0;

  int x_counter = 0;
  int y_counter = 0;
  int z_counter = 0;

  int max_10000 = get_Max_size(Y, 10000);

  for (int i = 0; i < max_10000 + 1; i++) {
    int tmp_Y = Y - 10000 * i;
    x_counter = i;
    int max_5000 = get_Max_size(tmp_Y, 5000);
    for (int j = 0; j < max_5000 + 1; j++) {
      y_counter = j;
      z_counter = (tmp_Y - 5000 * j) / 1000;

      if (x_counter + y_counter + z_counter == N) {
        std::cout << x_counter << " " << y_counter << " " << z_counter
                  << std::endl;
        return 0;
      }
    }
  }

  std::cout << "-1"
            << " "
            << "-1"
            << " "
            << "-1" << std::endl;

  // std::cout << x_counter << " " << y_counter << " " << z_counter <<
  // std::endl;
  return 0;
}

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

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let w: usize = read();
    const INF: i64 = std::i64::MAX / 3;
    let v_max: usize = 1000 * (n + 1);
    // (weight, value)
    let mut vec: Vec<(i64, i64)> = vec![];
    for _ in 0..n {
        vec.push((read(), read()));
    }
    let mut dp: Vec<Vec<i64>> = vec![vec![INF; v_max + 1]; n + 1];
    dp[0][0] = 0;
    for i in 0..n {
        for j in 0..v_max {
            if j < vec[i].1 as usize {
                dp[i + 1][j] = dp[i][j];
                continue;
            }
            dp[i + 1][j] = std::cmp::min(dp[i][j - vec[i].1 as usize] + vec[i].0, dp[i][j])
        }
    }
    let mut max_val = 0;
    for v1 in dp {
        for (i, &v2) in v1.iter().enumerate() {
            if v2 <= w as i64 {
                max_val = std::cmp::max(max_val, i);
            }
        }
    }

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


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  int N;
  cin>>N;
  ll ans(0);
  for(int a(1);a<N;a++){
    ans += N/a;
    if(N%a==0) ans--;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int a=count(s.begin(),s.end(),'A');
    int b=count(s.begin(),s.end(),'B');
    if(a&&b)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


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

const int MAX_N = 100005;

int N;
int h[MAX_N];
int dp[MAX_N];

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

  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);

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


Measured memory_bytes: 1024
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	int N;
	int a[20000];
	int ans=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>a[i];
		while(a[i]%2==0){
			a[i]/=2;
			ans++;
		}
	}
	cout<<ans<<endl;
}

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

int main() {

  int N, K;
  int l;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    if( x <= K-x){l += 2*x;
    }
    else{l += 2*(K-x);
    }
  }
 cout << l << endl;
}


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

void InsertionSort(int *A, int N) {
    int i, j, k, v;

    cout << A[0];
    for(k=1; k<N; k++)
        cout << ' ' << A[k];
    cout << endl;

    for(i=1; i<N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

        cout << A[0];
        for(k=1; k<N; k++)
            cout << ' ' << A[k];
        cout << endl;
    }

    return;
}

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

    InsertionSort(A, N);

    return 0;
}

Measured memory_bytes: 3076
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n=int(input())
	s=input().rstrip().decode('utf-8')
	
	ans=0
	
	for i in range(n-2):
		if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
			ans+=1
	
	
	
	print(ans)
	
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

//立ってるビットの本数
int cardinal(int n) {
    int res = 0;
    while (n > 0) {
        if (n & 1) res++;
        n >>= 1;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<int> isOpen(n, 0);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            int temp;
            cin >> temp;
            if (temp == 1) {
                isOpen[i] |= (1 << j);
            }
        }
    }
    vector<vector<int>> p(n, vector<int>(11));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 11; j++) {
            cin >> p[i][j];
        }
    }
    int ans = -1e+9 - 1;
    for (int i = 1; i < (1 << 10); i++) {
        int temp = 0;
        for (int j = 0; j < n; j++) {
            temp += p[j][cardinal(i & isOpen[j])];
        }
        ans = max(ans, temp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val A = Array.fill(N)(sc.nextInt()).sorted

    // comb(ai, aj), これは ai を固定した時には,
    // 単峰関数のような関数 f_ai(x) = comb(ai, x)
    // となる。すると, 最大の値の候補は
    // ai の真ん中もしくは, 真ん中に近い2つの値が候補になる
    // これは, 二分探索で探せるのでいける
    // これを全てのaiについて調べても間に合う
    // 実際に combを計算する必要はない
    def solve(N: Int, A: Array[Int]): (Int, Int) = {
      def upperBounds(n: Int, upper: Int): Int = {
        @scala.annotation.tailrec
        def loop(left: Int, right: Int): Int =
          if (right - left > 1) {
            val mid = left + (right - left) / 2
            if (A(mid) >= n) loop(left, mid)
            else loop(mid, right)
          } else right
        loop(-1, upper)
      }
      def lowerBounds(n: Int, upper: Int): Int = {
        @scala.annotation.tailrec
        def loop(left: Int, right: Int): Int =
          if (right - left > 1) {
            val mid = left + (right - left) / 2
            if (A(mid) <= n) loop(mid, right)
            else loop(left, mid)
          } else left
        loop(-1, upper)
      }
      @scala.annotation.tailrec
      def loop(i: Int, diff: Int, n: Int, r: Int): (Int, Int) =
        if (i < N) {
          val center = (A(i) / 2.toDouble).round.toInt
          val li = lowerBounds(center, i)
          val ri = upperBounds(center, i)
          val left = if (li >= 0) A(li) else 0
          val right = if (ri < A(i)) A(ri) else A(i)
          if (left > A(i) - right) {
            if (left > diff) loop(i + 1, left, A(i), left)
            else loop(i + 1, diff, n, r)
          } else {
            if (A(i) - right > diff) loop(i + 1, A(i) - right, A(i), right)
            else loop(i + 1, diff, n, r)
          }
        } else (n, r)

      loop(N - 1, 0, A.last, 0)
    }

    val (n, r) = solve(N, A)
    println(s"$n $r")
  }

}



Measured memory_bytes: 54632
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int W = scan.nextInt();
		int[]v = new int[N];
		int[]w = new int[N];
		for(int i = 0; i < N; i++) {
			v[i] = scan.nextInt();
			w[i] = scan.nextInt();
		}
		scan.close();
		int[] dp = new int[W + 1];
		Arrays.fill(dp, -1);
		dp[0] = 0;
		for(int i = 0; i < N; i++) {
			for(int j = W - w[i]; j >= 0; j--) {
				int t = j + w[i];
				if(dp[j] != -1 && t <= W) {
					dp[t] = Math.max(dp[t], dp[j] + v[i]);
				}
			}
		}
		int max = 0;
		for(int i : dp) {
			max = Math.max(max, i);
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 27152
import sys

N = int(sys.stdin.readline().strip())

ans = [0] * (10000+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp <= 10000:
                ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 9248
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

	cout << 24 + 24 - M;
	return 0;
}

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

#define rep(i,k,n) for(int (i)=(k);(i)<(n);(i)++)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define abs(a) (a)>0 ?(a):-(a)
#define llong long long

int main(){
	int A,B; scanf("%d %d",&A,&B);
	printf("%d",A*B);
	return 0;
}


Measured memory_bytes: 1732
/*
title:

url:
*/

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

using namespace std;

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

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

int main()
{
    string S, T;
    cin >> S >> T;
    char s_to_t[26];
    for (int i = 0; i < 26; i++)
    {
        s_to_t[i] = '0';
    }
    for (int i = 0; i < S.size(); i++)
    {
        if (s_to_t[S[i] - 'a'] == '0')
        {
            s_to_t[S[i] - 'a'] = T[i];
        }
        else if (s_to_t[S[i] - 'a'] != T[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = 0; i < 26; i++)
    {
        for (int j = i + 1; j < 26; j++)
        {
            if (s_to_t[i] != '0' && s_to_t[i] == s_to_t[j])
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    for (int i = 0; i < S.size(); i++)
    {
        S[i] = s_to_t[S[i] - 'a'];
    }
    if (S == T)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
string s,g;
char hs(char c){
    if(c=='b') return 'd';
    if(c=='d') return 'b';
    if(c=='p') return 'q';
    return 'p';
}
int i,j,k,l,m,n,b;
int main(){
    cin>>s;
    for(i=0;i<s.size();i++){
        g+=hs(s[s.size()-i-1]);
    }
    if(s==g) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node {
	int key;
	Node *next, *prev;
};

Node *nil;

void print(){
	Node *cur = nil->next;
	int c = 0;
	while(1){
		if(cur == nil) break;
		if(c++ > 0) printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}


Node *ListSearch(int key){
	Node *cur = nil->next;
	while(cur != nil && cur->key != key){
		cur = cur->next;
	}
	return cur;
}

void initialize(){
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}


void deleteNode(Node *t){
	if(t == nil) return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}


void DeleteFirst(){
	deleteNode(nil->next);
}

void DeleteLast(){
	deleteNode(nil->prev);
}

void DeleteKey(int key){
	deleteNode(ListSearch(key));
}

void insert(int key){
	Node *d = (Node *)malloc(sizeof(Node));
	d->key = key;
	d->next = nil->next;
	nil->next->prev = d;
	nil->next = d;
	d->prev = nil;
}

int main(void){
	int i,n,key;
	int size = 0;
	char in[20];

	int np = 0,nd = 0;
	scanf("%d",&n);
	
	initialize();

	for(i=0;i<n;i++){
		scanf("%s%d",in,&key);
		if(in[0] == 'i'){
			insert(key);
			np++;
			size++;
		}else if(in[0] == 'd'){
			if(strlen(in) > 6){
				if(in[6] == 'F'){
					DeleteFirst();
				}else if(in[6] == 'L'){
					DeleteLast();
				}
			}else{
				DeleteKey(key);
				nd++;
			}
			size--;
		}
	}
	print();

	return 0;
}











Measured memory_bytes: 33872
#include<iostream>
#include<vector>
#define VMAX 10001
using namespace std;

void CountingSort(std::vector<int>& a, std::vector<int>& b, int n){
	std::vector<int> c(VMAX,0);
	for(int i=1;i<=n;i++){
		c[a[i]]++;
	}
	for(int i=1;i<=VMAX;i++){
		c[i] = c[i] + c[i-1];
	}
	for(int i=n;i>0;i--){
		b[c[a[i]]] = a[i];
		c[a[i]]--;
	}
}

int main(){

	int n,in;
	std::vector<int> v(2000010);
	std::vector<int> b(2000010);
	cin >> n;
	for(int i=1;i<=n;i++){
		cin>>v[i];
	}
	CountingSort(v,b,n);

	for(int i=1;i<=n;i++){
		if(i>1) cout << " ";
		cout << b[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 16800
n, y = map(int, input().split(" "))
 
for i in range(0, n+1):
	for j in range(0, n+1-i):
		k = n-i-j
		if 10000*i + 5000*j + 1000*k == y:
			print(i, j, k)
			exit()
 
print("-1 -1 -1")

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

#define MOD 1000000007
#define MAX_N 100000
#define MAX_P 200005
int fact[MAX_P];
int extgcd(int a,int b,int& x,int& y){
  int d=a;
  if(b!=0){
    d=extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1;y=0;
  }
  return d;
}
int mod_inverse(int a,int m){
  int x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}

int euler_phi(int n){
  int res=n;
  for(int i=2;i*i<=n;i++){
    if(n%i==0){
      res=res/i*(i-1);
      for(;n%i==0;n/=i);
    }
  }
  if(n!=1) res=res/n*(n-1);
  return res;
}

int euler[MAX_N];

void euler_phi2(){
  for(int i=0;i<MAX_N;i++) euler[i]=i;
  for(int i=2;i<MAX_N;i++){
    if(euler[i]==i){
      for(int j=i;j<MAX_N;j+=i) euler[j]=euler[j]/i*(i-1);
    }
  }
}

int mod_pow(int x,int n,int mod){
  int res=1;
  while(n>0){
    if(n&1) (res*=x)%=mod;
    (x*=x)%=mod;
    n>>=1;
  }
  return res;
}

void init(int p){
  fact[0]=1;
  for(int i=1;i<MAX_P;i++) fact[i]=(fact[i-1]*i)%p;
}

int mod_fact(int n,int p,int& e){
  e=0;
  if(n==0) return 1;
  int res=mod_fact(n/p,p,e);
  e+=n/p;
  if(n/p%2!=0)return res*(p-fact[n%p]) %p;
  return res*fact[n%p]%p;
} 
int mod_comb(int n,int k,int p){
  if(k<0||k>n) return 0;
  if(n==k||k==0) return 1;
  int e1,e2,e3;
  int a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
  if(e1>e2+e3) return 0;
  return a1*mod_inverse(a2*a3%p,p)%p;
}


signed main(){
  int n;
  cin>>n;
  int a[n+1];
  for(int i=0;i<n+1;i++) cin>>a[i];
  int c[n+1];
  memset(c,0,sizeof(c));
  for(int i=0;i<n+1;i++) c[a[i]]++;
  int k=-1;
  for(int i=1;i<=n;i++)
    if(c[i]==2) k=i;
  int x=-1,y;
  for(int i=0;i<n+1;i++){
    if(a[i]!=k) continue;
    if(x<0) x=i;
    else y=n-i;
  }
  init(MOD);
  //cout<<x<<" "<<y<<endl;
  for(int i=1;i<=n;i++){
    int res=mod_comb(n+1,i,MOD);
    int sub=mod_comb(x+y,i-1,MOD);
    res=(res+MOD-sub)%MOD;
    cout<<res<<endl;
  }
  cout<<1<<endl;
  return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e9+10;
#define what_is(x) cerr << #x << " is " << x << endl;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

ll n, mod = 998244353;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);

ll inv[MAX];

int main()
{
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < S.length()/2; i++){
        if (S[i] != S[S.length() - i - 1]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 78336
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


n = int(readline())
print(len(str(make_divisors(n)[-1])))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<=(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
	ll x;
	mint() :x(0) {}
	mint(ll x) :x((x% mod + mod) % mod) {}
	// mint(ll x):x(x){}
	mint& fix() { x = (x % mod + mod) % mod; return *this; }
	mint operator-() const { return mint(0) - *this; }
	mint operator~() const { return mint(1) / *this; }
	mint& operator+=(const mint& a) { if ((x += a.x) >= mod) x -= mod; return *this; }
	mint& operator-=(const mint& a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; }
	mint& operator*=(const mint& a) { (x *= a.x) %= mod; return *this; }
	mint& operator/=(const mint& a) { (x *= a.pow(mod - 2).x) %= mod; return *this; }
	mint operator+(const mint& a)const { return mint(*this) += a; }
	mint operator-(const mint& a)const { return mint(*this) -= a; }
	mint operator*(const mint& a)const { return mint(*this) *= a; }
	mint operator/(const mint& a)const { return mint(*this) /= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint res = pow(t / 2);
		res *= res;
		return (t & 1) ? res * x : res;
	}
	bool operator<(const mint& a)const { return x < a.x; }
	bool operator==(const mint& a)const { return x == a.x; }
};
mint ex(mint x, ll t) { return x.pow(t); }
istream& operator>>(istream & i, mint & a) { i >> a.x; return i; }
ostream& operator<<(ostream & o, const mint & a) { o << a.x; return o; }
typedef vector<mint> vm;
struct comb {
	vm f, g;
	comb() {}
	comb(int mx) :f(mx + 1), g(mx + 1) {
		f[0] = 1;
		rrep(i, mx) f[i] = f[i - 1] * i;
		g[mx] = f[mx].pow(mod - 2);
		for (int i = mx; i > 0; i--) g[i - 1] = g[i] * i;
	}
	mint c(int a, int b) {
		if (a < b) return 0;
		return f[a] * g[b] * g[a - b];
	}
} c(3e6);

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x, y;
	cin >> x >> y;
	int s = x + y;
	if (s % 3 != 0) {
		puts("0");
		return 0;
	}
	s /= 3;
	x -= s; y -= s;
	if (x < 0 || y < 0) {
		puts("0");
		return 0;
	}

	cout << c.c(x + y, x) << endl;

	return 0;
}


Measured memory_bytes: 47104
#include <cstring>
#include <iostream>
#include <utility>
using namespace std;
typedef pair<int, int> pii;

int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
const pii INIT = pii(-1,-1);
int board[33][33];
int acc[33][33];
pii memo[33][33][33][33];
int H, W, E, S;

int getsum(int p, int q, int x, int y){
  return board[x][y] - board[p][y] - board[x][q] + board[p][q];
}

pii solve(int l, int t, int r, int b){
  pii& ans = memo[l][t][r][b];
  if(ans != INIT) return ans;

  int sum = getsum(l,t,r,b);
  if(sum < E - S) return ans = pii(0, 0);
  
  ans = pii(1, S - E + sum);
  
  for(int i = l+1; i < r; ++i){
    pii ra = solve(l,t,i,b);
    pii rb = solve(i,t,r,b);
    pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
    ans = max(ans, temp);
  }

  for(int i = t+1; i < b; ++i){
    pii ra = solve(l,t,r,i);
    pii rb = solve(l,i,r,b);
    pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
    ans = max(ans, temp);
  }

  return ans;
}

int main(){
  while(cin >> H >> W >> S, H){
    memset(board, 0, sizeof(board));
    for(int i = 0; i < 33; ++i)
      for(int j = 0; j < 33; ++j)
	for(int k = 0; k < 33; ++k)
	  for(int l = 0; l < 33; ++l)
	    memo[i][j][k][l] = INIT;
    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	cin >> board[i+1][j+1];

    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	board[i+1][j+1] += board[i+1][j];

    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	board[i+1][j+1] += board[i][j+1];

    E = getsum(0,0,H,W);
    pii ans = solve(0,0,H,W);
    cout << ans.first << " " << ans.second << endl;
  }
  return 0;
}

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

int main() {
    int L, m, n, brk, i, j;
    while (cin >> L && L) {
        brk = -1;
        for (i=1; i<13; i++) {
            cin >> m >> n;
            L -= m - n;
            if (L <= 0 && brk == -1) {
                brk = i;
            }
        }
        if (brk == -1) {
            cout << "NA" << endl;
        } else {
            cout << brk << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
// #include <atcoder/all>

using boost::multiprecision::cpp_int;
using namespace std;
// using namespace atcoder;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<p> v(n);
  rep(i, n) cin >> v[i].first >> v[i].second;

  rep(i, n-2){
    rep(j, 3){
      if(v[i].first == v[i].second && v[i+1].first == v[i+1].second && v[i+2].first == v[i+2].second){
        cout << "Yes" << endl;
        exit(0);
      }

    }
  }

  cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K;cin>>N>>K;
  cout << (N%K!=0)<<endl;
  return 0;
}


Measured memory_bytes: 256
def edit(s1,s2):
    
    n, m = len(s1), len(s2)
    E= [[0] * (m+1) for i in range(n+1)]
    
    for i in range(n+1):
        E[i][0] = i

    for j in range(m+1):
        E[0][j] = j

    for i in range(1, n+1):
        for j in range(1, m+1):
            cost = 0 if s1[i-1] == s2[j-1] else 1
            E[i][j] = min(E[i-1][j] + 1, E[i][j-1]+1, E[i-1][j-1] + cost)
            
    return E[n][m]

s1=input()
s2=input()

print(edit(s1,s2))



Measured memory_bytes: 43068
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	t := scanInts(n)

	ans := 1
	for i := 0; i < n; i++ {
		ans = ans / gcd(ans, t[i]) * t[i]
	}
	fmt.Fprintln(wr, ans)
}

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;

int main(){
    string S;
    int Q;
    cin >> S >> Q;
    vector<char> A,B;
    int c=0;
    for(int i=0; i<Q; i++){
        int T;
        cin >> T;
        if(T==1){
            c++;
        }else{
            int F;
            char C;
            cin >> F >> C;
            if(F==1){
                if(c%2==0) A.push_back(C);
                else B.push_back(C);
            }else{
                if(c%2==1) A.push_back(C);
                else B.push_back(C);
            }
        }
    }
    if(c%2==0){
        for(int i=A.size()-1; i>=0; i--) cout << A.at(i);
        cout << S;
        for(int i=0; i<B.size(); i++) cout << B.at(i);
    }else{
        for(int i=B.size()-1; i>=0; i--) cout << B.at(i);
        for(int i=S.size()-1; i>=0; i--) cout << S.at(i);
        for(int i=0; i<A.size(); i++) cout << A.at(i);
    }
    return 0;
}

Measured memory_bytes: 1024
N, S = map(int, input().split())
A_array = list(map(int, input().split()))

mod = 998244353

a = 1
arr2 = [1]
ans = 0
for i in range(N):
    a = a * 2 % mod
    arr2.append(a)

dp = [0] * (S + 1)
dp[0] = 1

for i, a in enumerate(A_array):
    # print(dp)
    if S - a >= 0:
        ans = (ans + dp[S - a] * arr2[N - 1 - i]) % mod
    for j in range(S, -1, -1):
        dp[j] = (2 * dp[j] + (dp[j - a] if (j - a) >= 0 else 0)) % mod
print(ans)


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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int x1 = 0;
		int x2 = w;
		int y1 = 0;
		int y2 = h;
		for(int i=0;i<n;i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();
			if(a==1) {
				x1 = Math.max(x1,x);
			}else if(a==2) {
				x2 = Math.min(x2, x);
			}else if(a==3) {
				y1 = Math.max(y1, y);
			}else {
				y2 = Math.min(y2, y);
			}
		}
		if(x2>x1 && y2>y1) {
			System.out.println((x2-x1)*(y2-y1));
		}else {
			System.out.println(0);
		}
	}

}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REV(i, b, a) for(int i = b; i >= a; i--)
#define show(a) cout << #a << " = " << a << endl
#define mp make_pair
#define pb push_back
#define mset(v, a) memset(v, a, sizeof(v))
#define printv(v, n) for(int i = 0; i < n; i++){ cout << v[i] << " ";} cout << endl;
#define int long long
#define endl "\n"
using namespace std;
int v[500];
main(){
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	REP(i, 0, 2*n){
		cin >> v[i];
	}

	sort(v, v+2*n);
	int ans = 0;
	for(int i = 2*n-1; i >= 0; i-=2){
		ans += min(v[i], v[i-1]);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(setq *n* (read))
(setq *d* (read))
(setq *xij* nil)

(dotimes (i *n*)
         (setq *xij* (cons (mapcar #'parse-integer (split " " (read-line))) *xij*)))

(defun calc-distance-square (y z)
  (if (equal nil (car y))
    0
    (+ (expt (- (car y) (car z)) 2) (calc-distance-square (cdr y) (cdr z)))))

(defun distance-squares-between-others (x1j xij)
  (if (equal (car xij) nil)
    nil
    (cons (calc-distance-square x1j (car xij)) (distance-squares-between-others x1j (cdr xij)))))

(defun all-distance-squares (xij)
  (if (equal nil (cadr xij))
    nil
    (append (distance-squares-between-others (car xij) (cdr xij)) (all-distance-squares (cdr xij)))))

(defun squarep-logic (n sqn i)
  (let ((q (/ n i)))
    (if (and (< sqn i) (not (equal n 0)))
      0
      (if (or (equal n 0) (equal (/ n q) q))
        1
        (squarep-logic n sqn (1+ i))))))

(defun squarep (n)
  (squarep-logic n (sqrt n) 1))

(print (apply #'+ (mapcar #'squarep (all-distance-squares *xij*))))

Measured memory_bytes: 16228