akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
struct cake{
    int x;
    int y;
    int z;
};
vector<cake> C;
//=============================
void input()
{
    cin>>N>>M;
    C.resize(N);
    rep(i,N){
        cin>>C[i].x>>C[i].y>>C[i].z;
    }
}
//=============================
void func(){}
//=============================
void solve()
{
    // Mこ食べる
    // |x| + |y| + |z|の最大値
    int ans= -INF;

    for (int i = 0; i < 8; ++i) {
        int xf=((i>>0)&1 ? 1 : -1);
        int yf=((i>>1)&1 ? 1 : -1);
        int zf=((i>>2)&1 ? 1 : -1);
        vector<int> vv(N);
        for (int i=0; i<N;++i){
            vv[i] = (C[i].x * xf) + C[i].y * yf + C[i].z * zf;
        }
        sort(vv.rbegin(),vv.rend());
        int s = 0;
        rep(i,M){
            s += vv[i];
        }
        ans = max(ans,s);
    }

    cout<<ans<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <math.h> // sqrt()
#define rep(i , n) for (int i = 1; i <= (int)(n); i++)
#define repz(i , n) for (int i = 0; i < (int) n; i++)
#define repi(i , r, n) for (int i = r; i <= (int)(n); i++)
#define repd(i , r, n) for (int i = r; i >= (int)(n); i--)

using namespace std;

int64_t calc( int64_t a , int64_t b){
    if ( b % a == 0) return 0;
    else
        return (b / a + 1) * a - b;
}

int main(){
    int n;
    cin >> n;
    int64_t a[n];
    int64_t b[n];
    repz(i , n){
        cin >> a[i] >> b[i];
    }
    int64_t ans = 0;
    repd(i , n - 1 , 0){
        ans += calc( b[i] , a[i] + ans);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 5172
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        char[] S=sc.next().toCharArray();
        int result=0;
        int tmp=0;

        for(int i=0;i<S.length;i++){
            if(S[i]=='R'){
                tmp++;
            }else{
                if(tmp>result){
                    result=tmp;
                    tmp=0;

                }
            }
        }
        if(tmp>result){
            result=tmp;
        }
        System.out.println(result);

    }
}

Measured memory_bytes: 35512
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = (n-1) * b + a - ((n-1) * a + b) + 1;
	chmax(ans, 0LL);
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N % 10;
  b = (N - a) % 100 / 10;
  c = (N - b - a) % 1000 / 100;
  d = N / 1000;

  if ((a == b && b == c) || (b == c && c == d)) {
    cout << "Yes" << endl;
  }
  
  else
    cout << "No" << endl;
  
}

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

int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int ans = 0;
    for(int i = 1;i <= N;i++){
        string s = to_string(i);
        int sum = 0;
        for(int j = 0;j < s.size();j++){
            sum += s[j] - '0';
        }
        if(A <= sum && sum <= B) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ABC053D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string[] cardsStr = Console.ReadLine().Split(' ');
            List<int> cards = new List<int>(n);

            Array.Sort(cardsStr);

            int flow = 0;
            int y = 0;

            cards.Add(Int32.Parse(cardsStr[0]));

            for (int x = 1; x < n; x++)
            {
                string str = cardsStr[x];

                int i = Int32.Parse(str);
                if (i == cards[y])
                {
                    flow++;
                } else
                {
                    cards.Add(i);
                    y++;
                }
            }


            Console.WriteLine(y + 1 - flow % 2);
        }

    }

}


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

int main(void){

    char s[100001];

    scanf("%s", s);

    int len = strlen(s);

    for(int i = 0; i < len; i++){
        if(i % 2 == 0){
            printf("%c", s[i]);
        }
    }
    printf("\n");

    return 0;
}

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

using namespace std;

int main() {
    long long int n;
    cin>>n;
    map<string,int> ma;
    map<string,int> ::iterator it;
    ma["AC"]=0;
    ma["TLE"]=0;
    ma["WA"]=0;
    ma["RE"]=0;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        ma[s]++;
    }
         cout<<"AC"<<" x "<<ma["AC"]<<endl;
         cout<<"WA"<<" x "<<ma["WA"]<<endl;
         cout<<"TLE"<<" x "<<ma["TLE"]<<endl;
         cout<<"RE"<<" x "<<ma["RE"]<<endl;
    
    return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> v(N+1);
	int64_t s = 0;
	rep(i, N+1) {
		cin >> v.at(i);
		s += v.at(i);
	}

	int64_t a=0, b=1, c=0, x, y, z;
	rep(i, N+1) {
		a += b;
		b -= v.at(i);
		s -= v.at(i);
		b = min(b*2, s);
		if ((b <= 0 || s == 0) && i != N) {
			std::cout << "-1" << '\n';
			return 0;
		} else if (b != s && i == N) {
			std::cout << "-1" << '\n';
			return 0;
		}
	}

	std::cout << a << '\n';
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
int main()
{char a[100100],b[100100];
 cin>>a;
 strcpy(b,a);
 for(int i=0;i<strlen(b);i++)
    {if(b[i]=='b') b[i]='d';
     else if(b[i]=='p') b[i]='q';
     else if(b[i]=='q') b[i]='p';
     else if(b[i]=='d') b[i]='b';
	}
 for(int i=0;i<strlen(a);i++)
    if(a[i]!=b[strlen(a)-i-1])
      {printf("No\n");
       return 0;
	  }
 printf("Yes\n");
 return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <time.h>
using namespace std;
#include <math.h>
#define ll long long 
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define max1 100001
vector<vector<int> > arr(max1);




int main(){	
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=(a+b)){
		cout<<min(k,a)<<endl;
	}
	else{
		cout<<2*a+b-k<<endl;
	}
}

Measured memory_bytes: 5480
N,W=map(int, input().split() )
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i] = map(int,input().split())
dp=[[0]*(W+1) for _ in range(N)]
dp[0] = [v[0] if w[0]<=ww else 0 for ww in range(W+1)]
for i in range(1,N):
    for ww in range(W+1):
        if ww-w[i]>=0:
            dp[i][ww] = max(dp[i-1][ww],dp[i-1][ww-w[i]]+v[i])
        else:
            dp[i][ww] =dp[i-1][ww]
print(dp[-1][-1])

Measured memory_bytes: 119148
#include <bits/stdc++.h>
using namespace std;
#define vi vector<long long int>
#define mii map<long long int, long long int>
#define pii pair<long long int, long long int>
#define pqmax priority_queue<long long int>
#define pqmin priority_queue<long long int, vector<long long int>, greater<long long int>>
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define sp(x, y) fixed<<setprecision(y)<<x
#define ll long long
#define MOD 1000000007
#define endl "\n"

const int N = 1000005;
int a[N];
void solve(){
	ll n;
	cin >> n;
	mii m;
	for(int i = 0; i < n-1; i++){
		int x; cin >> x;
		m[x]++;
	}
	for(int i = 1; i <= n; i++){
		cout << m[i] << endl;
	}
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 16156
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
			while (true) {
            // 入力されるx,yを定義

            int x = scanner.nextInt();
            int y = scanner.nextInt();

            if (x == 0 && y == 0) {
            	break;
            }
            if (x <= y) {
            	System.out.println(x + " " + y);
            } else if (y < x) {
            	System.out.println(y + " " + x);
            }
			}
	}
}



Measured memory_bytes: 36520
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const long long INF = 1e10;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<LL,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int w,h;
	while(cin >> w >> h){
		// h--, w--;
		vector<LL> p(w);
		vector<LL> q(h);
		REP(i,w) cin >> p[i];
		REP(i,h) cin >> q[i];
		priority_queue<P,vector<P>,greater<P>> quw;
		priority_queue<P,vector<P>,greater<P>> quh;
		REP(i,w){
			quw.push(P(p[i],i));
		}
		REP(i,h){
			quh.push(P(q[i],i));
		}
		int cnth = 0;
		int cntw = 0;
		LL ans = 0;
		vector<bool> lh(h,false);
		vector<bool> lw(w,false);
		while(!quh.empty() or !quw.empty()){
			P ht = P(INF,-10000);
			P wt = P(INF,-10000);
			if(!quh.empty()){
				ht = quh.top();
			}
			if(!quw.empty()){
				wt = quw.top();
			}
			DEBUG(ht.F); DEBUG(wt.F);
			if(ht < wt){
				quh.pop();
				ans += ht.F*max(w+1-cntw,0);
				// int pl = 1;
				cnth++;
			}else{
				quw.pop();
				ans += wt.F*max(h+1-cnth,0);
				// int pl = 1;
				cntw++;
			}
		}
		dpite(ALL(lh)); dpite(ALL(lw));
		DEBUG(cnth); DEBUG(cntw);
		cout << ans << endl;
	}
	return 0;
}


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

typedef long long lint;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const lint inv = MOD - 2;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int n;
int c[510], s[510], f[510];

int solve(int stn, int ti, int cnt){
    if(stn == n-1){
        return cnt;
    }
    if(ti < s[stn]){
        cnt += s[stn] - ti;
        ti = s[stn];
    }
    if(ti % f[stn] != 0){
        cnt += f[stn] - (ti % f[stn]);
        ti += f[stn] - (ti % f[stn]);
    }
    return solve(stn + 1, ti + c[stn], cnt + c[stn]);
}

int main(){
    cin >> n;
    rep(i, n-1){
        cin >> c[i] >> s[i] >> f[i];
    }
    rep(i, n){
        int ans = solve(i, 0, 0);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*
	RAone00
	Rohit sharma
	*/

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

	typedef long long ll;
	typedef long double ld;
	typedef pair < ll, ll > pll;
	typedef vector < vector < ll > > matrix;
	typedef vector < ll > vll;

	#define pb push_back
	#define debug(x) cout << (#x) << " is " << (x) << endl
	#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

	const ll mod = 1e9 + 7;
	const ll inf = LLONG_MAX;
	const ll N = 1e5 + 10;

	
	int main() {
	    fast_io();
	    char a;
	    cin >> a;
	    cout << ++a << "\n";
	    return 0;
	}

 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;

VI parent;   // 各要素の親の要素

int root(int x) {   // 根に到達するまで親を辿る
    if (parent[x] == x) {   // 根は親==自分
        return x;
    } else {   // 経路圧縮(木の深さを緩和するために辿った要素を全て根に直結させる)
        return parent[x] = root(parent[x]);
    }
}

bool same(int x, int y) {   // 根が同じなら同じ集合に属する
    return root(x) == root(y);
}

void unite(int x, int y) {   // 同値関係x~yを追加(xが属する集合とyが属する集合をマージ)、ランクは考慮しない実装だがO(logN)程度
    x = root(x);
    y = root(y);
    if (x == y) return;   // すでに同じ集合
    parent[x] = y;
}


int main() {
    LL N, M;
    cin >> N >> M;
    parent.resize(N);
    REP(i, N) {   // 初期化(親==自分)
        parent[i] = i;
    }
    REP(i, M) {
        LL x, y, z;
        cin >> x >> y >> z;
        unite(x, y);
    }
    unordered_set<LL> P;
    REP(i, N) {
        P.insert(root(i));
    }
    cout << SZ(P) << endl;
	
    return 0;
}


Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define ll long long

#define INF 999999999

using namespace std;

// input
int n;
map<ll,ll> edge;
priority_queue<ll> que;

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

    cin >> n;

    ll a;

    while(cin >> a){

        if(edge.find(a) == edge.end()){
            edge[a] = 1;
        }
        else{
            que.push(a);
            edge.erase(a);
        }
      
    }

    if(que.size() < 2){
        cout << 0 << "\n";
    }
    else{
        ll a,b;
        a = que.top();que.pop();
        b = que.top();que.pop();
        cout << a*b << "\n";
    }
    
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}



struct node{
    long double x,y;char d;
    node(long double x,long double y,char d):x(x),y(y),d(d){}
    node(){}
};

// 実はxとyの極小が解の候補だったりしません？

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    cout<<fixed<<setprecision(12);

    int n;cin>>n;
    vector<node> v(n);
    rep(i,n){
        long double x,y;char c;cin>>x>>y>>c;
        v[i]=node(x,y,c);
    }

    auto fx=[&](double T){
        long double minx=INF,maxx=-INF;
        rep(i,n){
            if(v[i].d=='U' or v[i].d=='D') chmin(minx,v[i].x),chmax(maxx,v[i].x);
            else{
                long double p;
                if(v[i].d=='R') p=v[i].x+T;
                else            p=v[i].x-T;
                chmin(minx,p);
                chmax(maxx,p);
            }
        }
        return maxx-minx;
    };

    auto fy=[&](long double T){
        long double miny=INF,maxy=-INF;
        rep(i,n){
            if(v[i].d=='R' or v[i].d=='L') chmin(miny,v[i].y),chmax(maxy,v[i].y);
            else{
                long double p;
                if(v[i].d=='U') p=v[i].y+T;
                else            p=v[i].y-T;
                chmin(miny,p);
                chmax(maxy,p);
            }
        }
        return maxy-miny;
    };

    long double lw=0,hi=10.0*INF;
    rep(_,500){
        long double ml=lw*2/3+hi/3;
        long double mh=hi*2/3+lw/3;

        long double resl=fx(ml)*fy(ml);
        long double resh=fx(mh)*fy(mh);
        if(resl>=resh) lw=ml;
        else hi=mh;
    }
    cout<<fx(lw)*fy(hi)<<endl;
    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

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

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
vll adj[200000];
ll dp[200000];

long long calc(long long n) {
	if (adj[n].size() == 0) return 0;
	for (int i = 0; i < adj[n].size(); i++) {
		if (dp[adj[n][i]] != -1) {
			dp[n] = max(dp[n],dp[adj[n][i]]+1);
		} else {
			dp[n] = max(dp[n],calc(adj[n][i])+1);
		}
	}
	return dp[n];
}

int main()
{
	std::ios::sync_with_stdio(false);
	ll n,m;
	cin >> n >> m;
	for(int i = 1;i<=m;i++)
	{
		ll u,v;
		cin >> u >> v;
		adj[u].pb(v);
	//	adj[v].pb(u);
	}
	ll ans =-1;
	for(int i =0;i<200000;i++) dp[i]=-1;
	for(int i =1;i<=n;i++)
	{
		dp[i] = calc(i);
	}
	for(int i = 1;i<=n;i++) ans=max(ans,dp[i]);
	cout << ans << endl;



	return 0;
}


//Hello, this is a snippet.


Measured memory_bytes: 11648
#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 H, W, A, B; cin >> H >> W >> A >> B;
    rep(i, H){
        rep(j, W){
            if(i<B){
                if(j<A) cout << 1;
                else cout << 0;
            }else{
                if(j<A) cout << 0;
                else cout << 1;
            }
        }
        cout << 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: 7720
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
inline int quickpow(int base,int ind)
{
	base%=mod;
	int ans=1;
	while(ind>0)
	{
		if(ind&1)ans=ans*1ll*base%mod;
		ind>>=1;
		base=base*1ll*base%mod;
	}
	return ans;
}
inline int inv(int x)
{
	return quickpow(x,mod-2);
}
const int maxn=1e5+10;
int fact[maxn*2],invfac[maxn];
int powA[maxn],powB[maxn],powC[maxn*2];
int N,A,B,C,iv;
inline int calc(int j,int k)
{
//	cout<<j<<" "<<k<<endl;
//	cout<<powA[j]<<" "<<powB[k]<<" "<<fact[j+k]<<endl;
//	cout<<powC[j+k+1]<<" "<<invfac[j]<<" "<<invfac[k]<<endl;
//	return powA[j]*1ll*powB[k]%mod*1ll*fact[j+k]%mod*1ll*powC[j+k+1]%mod*1ll*invfac[j]%mod*1ll*invfac[k]%mod;
//	cout<<(j+k)<<" "<<powA[j]<<" "<<powB[k]<<" "<<fact[j+k-1]<<endl;
//	cout<<powC[1]<<" "<<invfac[N-1]<<" "<<invfac[k]<<endl;
	return (j+k)*1ll*powC[1]%mod*1ll*powA[j]%mod*1ll*powB[k]%mod*1ll*fact[j+k-1]%mod*1ll*invfac[N-1]%mod*1ll*invfac[j+k-N]%mod;
}
int main()
{
//	cout<<93*1ll*inv(16)%mod<<endl;
	scanf("%d%d%d%d",&N,&A,&B,&C);
	iv=inv(A+B);
	A=A*1ll*iv%mod;
	B=B*1ll*iv%mod;
	C=(100-C)*1ll*inv(100)%mod;
	C=inv(C);
//	cout<<C<<endl;
	fact[0]=1;
	powC[0]=1;
	for(int i=1;i<=N+N;i++)
	{
		fact[i]=fact[i-1]*1ll*i%mod;
		powC[i]=powC[i-1]*1ll*C%mod;
	}
	powA[0]=powB[0]=1;
	for(int i=1;i<=N;i++)
	{
		powA[i]=powA[i-1]*1ll*A%mod;
		powB[i]=powB[i-1]*1ll*B%mod;
	}
	invfac[N]=inv(fact[N]);
	for(int i=N-1;i>=0;i--)
		invfac[i]=invfac[i+1]*1ll*(i+1)%mod;
	
	int ans=0;
	for(int i=0;i<N;i++)
	{
	//	cout<<calc(i,N)<<" "<<calc(N,i)<<endl;
		ans+=calc(i,N);
	//	ans+=A;
		if(ans>=mod)ans-=mod;
	//	cout<<ans<<endl;
		ans+=calc(N,i);
	//	ans+=B;
		if(ans>=mod)ans-=mod;
	//	cout<<ans<<endl;
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

const int N=1e6+3;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans[N],sz[N];

char s[N];

pair<int,int> p[N];

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i].first);
		p[i].second=i;
	}
	sort(p,p+n);
	for(int i=0;i<n;i++)
		printf("%d ",p[i].second+1);
}


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll N,R;
  cin >> N >> R;
  ll ans;
  if(N >= 10){
    ans = R;
  } else { 
    ans = R + 100 * (10-N);
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1);
    rep(i, N + 1) cin >> A[i];

    vector<ll> sumA(N + 2);
    for (int i = N + 1; i > 0; --i) sumA[i - 1] = sumA[i] + A[i - 1];

    if (N == 0) {
        if (A[0] == 1) {
            write(1);
        }
        else {
            write(-1);
        }
        return 0;
    }

    if (A[0] != 0 || sumA[1] == 0) {
        write(-1);
        return 0;
    }

    ll ans = 1, node = 1;

    rep(i, 1, N + 1) {
        ll n = min(2 * node, sumA[i]);

        if (A[i] > n) {
            write(-1);
            return 0;
        }

        ans += n;

        n -= A[i];
        node = n;
    }

    write(ans);
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 100000;
int n,k;
int h[MAX_N];
ll dp[MAX_N];

int main()
{
#define FASTIO
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n >> k;
  forn(i,n) cin >> h[i];

  fill_n(dp,n,LLONG_MAX);
  dp[0] = 0;

  forn (i,n-1) {
    for (int j = 1; j <= k && i+j < n; j++) {
      chmin(dp[i+j],dp[i] + abs(h[i]-h[i+j]));
    }
  }

  cout << dp[n-1] << endl;


  return 0;
}


Measured memory_bytes: 1408
import numpy as np
from itertools import combinations
from functools import reduce
from collections import defaultdict

N = int(input())
d = defaultdict(int)
for i in range(N):
    c = input()
    if c[0] in ('M', 'A', 'R', 'C', 'H'):
        d[c[0]] += 1

l = len(d)
if l < 3:
    print(0)
else:
    ans = 0
    for l in list(combinations(d.values(), 3)):
        ans += reduce(np.multiply, l)
    print(ans)

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

typedef struct {
  int B;
  int C;
}bc;

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int cmp( const void *p, const void *q ) {
    return ((bc*)q)->C - ((bc*)p)->C;
}


int main(){

  int n,m;
  int i,k;
  scanf("%d%d",&n,&m);
  long int ans=0;
  int a[n+20000];
   bc set[m+20000];



  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<m;i++){
    scanf("%d%d",&set[i].B,&set[i].C);
  }

  qsort(a,n,sizeof(int),compare_int);
  qsort(set,m,sizeof(bc),cmp);


  i=0;
  k=0;
  while(i<m){

    if(a[k]<=set[i].C&&set[i].B>0){
      a[k]=set[i].C;
      k++;
      set[i].B--;
    }else{
      i++;
    }
  }



    for(i=0;i<n;i++){
      ans+=a[i];
    }
    printf("%ld",ans);


  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int A,B,C; cin >> A >> B >> C;

    bool res = (C >= A && C <= B);

    cout << ((res) ? "Yes" : "No");

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int ans=700;
	for(int i=0;i<3;i++)
	{
		if(s[i]=='o')
		ans+=100;
	}
	 cout<<ans;
	 return 0;
 } 

Measured memory_bytes: 256
k=int(input())
x,y=map(int,input().split())
if x<0:fx=-1
else:fx=1
if y<0:fy=-1
else:fy=1
ax,ay=abs(x),abs(y)
if ax<ay:
  x,y=y,x
  ax,ay=ay,ax
  fx,fy=fy,fx
  flag=1
else:flag=0
r=ax+ay
if k%2==0 and r%2==1:print(-1);exit()
if r==k:
  print(1)
  if flag:x,y=y,x
  print(x,y)
  exit()
if r%2==1 and r<k:
  print(3)
  anss=[]
  anss.append(((ax+(k-ay))//2,(k-(ax+(k-ay))//2)))
  anss.append((ax+(k-ay),0))
  anss.append((ax,ay))
  for i,j in anss:
    ii,jj=i*fx,j*fy
    if flag:ii,jj=jj,ii
    print(ii,jj)
  exit()
if r%2==0 and r<k:
  rm=(2*k-ax-ay)//2
else:
  rn=(k-(r%k))%k
  if rn%2==1:rn+=k
  rm=rn//2
ans=(r+rm*2)//k
anss=[]*ans
print(ans)
first=[0,-rm]
second=[ax,-rm]
third=[ax,ay]
xx=yy=0
while yy>first[1]:
  if yy-k<=first[1]:
    xx+=k-(yy-first[1])
    yy=first[1]
  else:
    yy-=k
  anss.append((xx*fx,yy*fy))
while xx<second[0]:
  if xx+k>=second[0]:
    yy+=k-(second[0]-xx)
    xx=second[0]
  else:
    xx+=k
  anss.append((xx*fx,yy*fy))
while yy!=third[1]:
  yy+=k
  anss.append((xx*fx,yy*fy))
for i,j in anss:
  ii,jj=i,j
  if flag:ii,jj=jj,ii
  print(ii,jj)

Measured memory_bytes: 29292
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int a,b,k,aa[110000],cnt=0;
pair<string,int> p[220000];
string s,ss[220000],x;
char c;
signed main(){
    cin>>a>>b>>k;
    while(1){
        if(a%2==1){
            a--;
        }
        b+=a/2;
        a/=2;
        cnt++;
        if(cnt==k){
            break;
        }
        if(b%2==1){
            b--;
        }
        a+=b/2;
        b/=2;
        cnt++;
        if(cnt==k){
            break;
        }
    }
    cout<<a<<' '<<b;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
vector<int>gg;
vector<int>gg1;
vector<int>gg2;
int k;
int dp[100001][3];
int solve(int x,int last)
{
  if(x>=gg.size())return 0;
  //if(x==gg.size()-1)return 0;
  if(dp[x][last]!= -1)return dp[x][last];
  int ans = -INF;
  if(last != 0)
  ans = max(ans , gg[x]+solve(x+1,0));
  if(last != 1)
  ans = max(ans , gg1[x]+solve(x+1,1));
  if(last != 2)
  ans = max(ans , gg2[x]+solve(x+1,2));
  return dp[x][last]=ans;
}
int main()
{
  // flash;
  int x;
  cin>>x;
  memset(dp,-1,sizeof dp);
  for (int i = 0; i < x; ++i)
  {
    int l,y,z;
    cin>>l>>y>>z;
    gg.pb(l);gg1.pb(y);gg2.pb(z);
  }
  int ans = -INF;
  for (int i = 0; i < 3; ++i)
  {
    ans = max(ans,solve(0,i));
  }
  cout<<ans;
  return 0;
}

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

int main()
{
    int n, k; cin>>n>>k;
    double res=0;
    for(int i=1; i<=n; ++i) {
        long c=0, x=i;
        for(; x<k; x*=2) ++c;
        res+=pow(0.5, c);
    }
    printf("%.9f\n", res/n);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		//System.setIn(new FileInputStream("./input.txt"));
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		StringBuilder sb = new StringBuilder();
		String[] s;
		int a, b, c;
		for(int i = 0; i < n; ++i) {
			s = br.readLine().split(" ");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);
			c = Integer.parseInt(s[2]);
			if(a*a == b*b + c*c || b*b == c*c + a*a || c*c == a*a + b*b) {
				sb.append("YES\n");
			}else{
				sb.append("NO\n");
			}
		}
		System.out.print(sb);
	}

}

Measured memory_bytes: 25832
# コンテスト中の考えは悪くなかったがN本に固執して貪欲的に考えていた。
# 敗因は動的計画法が思い浮かばず書けなかったこと。
# 提出4298627を参考にした


N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)  # 大きい方から探索したいため

# 各数字を作るのに必要なマッチの本数
num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

# dpをするための配列を用意
# pd[i]としたときに、i本のマッチで実現できる最大桁数を格納するものとする
# shapeは(N+1,) ∵ i=0~N本のときも考える
dp = [-1 * float("inf")] * (N + 1)

# 各数字を一つずつ使う場合は1桁だとわかりきっているので、初期化ができる
dp[0] = 0
for a in A:
    if num[a] <= N:  # ここは念のための処理、指定されたNがマッチで使う数字より少ないかもしれない。
        dp[num[a]] = 1

# dpのmain
for i in range(1, N + 1):  # dpに格納されているすべての要素をなめていく。
    for a in A:  # i本使うときの最大桁数を決定するためにはaを全探索して下式を最大となるものが取得できればよい
        if i - num[a] >= 0:  # 念の為の条件
            # この式については解説を参照のこと
            dp[i] = max(dp[i], dp[i - num[a]] + 1)

# 探索が終わったので答えを出す。
# 大きい桁にはなるべく大きな数字を割り振る
ans = ""
for i in range(dp[N]):  # dpによって得た桁数について上位桁から決定していく
    for a in A:  # すでに大きい順にソートしたので決定次第break
        # 1つ目の条件は探索中に配列外アクセスをするのを防ぐため。2つ目の条件についても解説を参照のこと
        if N - num[a] > -1 and dp[N - num[a]] == dp[N] - 1:
            ans += str(a)
            N -= num[a]  # マッチの本数から引くのを忘れずにね
            break

print(ans)


Measured memory_bytes: 3308
#include <stdio.h>

int main(void) {
	int card[5];
	int swap;
	int i, j;
	int pair[2];
	_Bool straight;
	while (scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4]) != EOF) {
		pair[0] = pair[1] = 0;
		straight = 1;
		for (i = 5; i > 0; i--)
			for (j = 0; j < i; j++)
				if( card[j] > card[j+1]) {
					swap = card[j];
					card[j] = card[j+1];
					card[j+1] = swap;
				}
		for (i = j = 0; i < 4; i++) {
			if( card[i]+1 != card[i+1] )
				straight = 0;
			if( card[i] == card[i+1]) {
				if( pair[j] == 0)
					pair[j] = 2;
				else
					pair[j]++;
			}
			else if( j < 2 ? pair[j] : 0)
				j++;
		}
		if( card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13)
			straight = 1;
		if( pair[0] == 4)
			printf("four card\n");
		else if( (pair[0] == 3 && pair[1] == 2) || (pair[0] == 2 && pair[1] == 3))
			printf("full house\n");
		else if( straight)
			printf("straight\n");
		else if( pair[0] == 3 || pair[1] == 3)
			printf("three card\n");
		else if( pair[0] == 2 && pair[1] == 2)
			printf("two pair\n");
		else if( pair[0] == 2 || pair[1] == 2)
			printf("one pair\n");
		else
			printf("null\n");
	}
	return 0;
}

Measured memory_bytes: 580
#ifdef DBG_MACRO_NO_WARNING
#include <dbg.h>
#endif
#include <bits/stdc++.h>
#define all(c) c.begin(), c.end()
#define isz(c) (int)c.size()

using namespace std;
using ll  = long long;
using ii  = pair<int, int>;
using vi  = vector<int>;
using vll = vector<ll>;

int const MOD = 1e9 + 7;

int const SMAX = 2000 + 11;
ll        mem[SMAX];
bool      vis[SMAX];

ll add(ll a, ll b) { return ((a + MOD % MOD) + (b + MOD % MOD)) % MOD; }

ll dp(int s)
{
    if (s == 0)
        return 1;
    if (vis[s])
        return mem[s];

    ll &ans = mem[s];
    vis[s]  = true;
    for (int d = 3; d <= s; ++d)
        ans = add(ans, dp(s - d));
    return ans;
}

int main(void)
{
    int s;
    cin >> s;
    cout << dp(s) << endl;

    return 0;
}


Measured memory_bytes: 3640
inpl = lambda: list(map(int,input().split()))
def gcd(a, b):
    if a < 0: a = -a
    if b < 0: b = -b
    while b > 0:
        (a, b) = (b, a % b)
    return a

A, B = inpl()
print(A*B//gcd(A,B))

Measured memory_bytes: 3060
//ITP1_10_C_19140837_Ojima_Yukiya.cpp
//提出日 2020/6/24 wednesday
//プログラミング基礎演習2 CS 第７回課題 ITP1_10_C
//学修番号 19140837　小島優希也
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main(void) {
    while (true) {
        int n;
        cin >> n;

        if (n == 0) {
            break;
        }

        vector<double> s(n);

        double sum = 0;

        for (int i = 0; i < n; i++) {
            cin >> s.at(i);
            sum += s.at(i);
        }

        double mean = sum/(double)n;

        double variance_value = 0;

        for (int i = 0; i < n; i++) {
            variance_value += (s.at(i) - mean)*(s.at(i) - mean);
        }

        variance_value /= (double)n;

        double standard_deviation = sqrt(variance_value);


        printf("%13.10lf\n", standard_deviation);
    }
        return 0;
}


Measured memory_bytes: 3212
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		int []a = new int [n];
		
		for(int i = 0 ; i< n ;i++) {
			a[i] = Integer.parseInt(sc.next());
			a[i] = a[i]/2;
		}
		long L = Lcm(n,a);
		if(L == 0) {
			System.out.println(0);
		}
		else {
		long ans = (long)(k + L) /(2* L);
		
		System.out.println(ans);
		}
	}
	
	static long Lcm(int n, int []a) {
		long lcm = a[0];
		int tmp = 0;
		
		for(int i = 1 ; i < n; i++) {
			int cnt = 0;
			if((lcm % 2) != (a[i] % 2)) {
				return 0;
			}
			while(a[i] % 2 == 0) {
				a[i] /= 2;
				cnt++;
			}
			if(tmp != cnt && tmp != 0) {
				return 0;
			}
			if(tmp == 0) {
				tmp = cnt;
			}
			
			long temp =gcd(lcm,(long)a[i]);
			lcm = (long)lcm * a[i] / temp;

		}
		
		return lcm;
	}

	private static long gcd(long a, long  b) {
		long  temp = 0;

		if(a == 0) {
			return b;
		}
		if(b == 0) {
			return a;
		}
		if(a != 0 || b != 0) {
		while (a % b != 0){
			temp = a;
			a = b;
			b = temp % b;
		}
		}
		return b;
	}
}




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

int main(){
	int n;
	cin >> n;
	if(n==1) {
		cout << 1 << endl;
	}
	if(n>=2 && n<=3) {
		cout << 2 << endl;
	}
	if(n>=4 && n<=7) {
		cout << 4 << endl;
	}
	if(n>=8 && n<=15) {
		cout << 8 << endl;
	}
	if(n>=16 && n<=31) {
		cout << 16 << endl;
	}
	if(n>=32 && n<=63) {
		cout << 32 << endl;
	}
	if(n>=64 && n<=100) {
		cout << 64 << endl;
	}
}


Measured memory_bytes: 3612
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, M, r int
	fmt.Scan(&N, &M)
	xarr := make([]int, M)
	larr := make([]int, M-1)
	for i := 0; i < M; i++ {
		fmt.Scan(&xarr[i])
	}
	sort.Ints(xarr)
	for i := 0; i < M-1; i++ {
		larr[i] = xarr[i+1] - xarr[i]
	}
	sort.Sort(sort.Reverse(sort.IntSlice(larr)))
	for i := N - 1; i < len(larr); i++ {
		r += larr[i]
	}
	fmt.Println(r)
}

Measured memory_bytes: 5504
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<random>
#include<stdio.h>
using namespace std;

typedef long long ll;

ll MAX=100000;

long long Mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

ll N;
vector<ll> depth(MAX);
vector<vector<ll>> edge(MAX,vector<ll>(0));

void dep(ll v,ll val){
    depth[v]=val;
    for (ll i=0;i<edge[v].size();i++){
        ll nv=edge[v][i];
        dep(nv,val+1);
    }
}

vector<bool> ok(MAX);

void dfs(ll v){
    ok[v]=1;
    for (ll i=0;i<edge[v].size();i++){
        ll nv=edge[v][i];
        if (not ok[nv]){
            dfs(nv);
        }
    }
}


int main(){
    cin>>N;
    ll K;
    cin>>K;
    vector<ll> a(N);
  	
    for (ll i=0;i<N;i++){
        ll val;
        cin>>val;
        a[i]=val-1;
      	
    }
  	
    ll ans;
  	if (a[0]!=0){
      ans+=1;
    }
  	
    a[0]=0;
  	
    if (K>=N){
        cout<<ans<<endl;
        return 0;
    }

    for (ll i=1;i<N;i++){
        edge[a[i]].push_back(i);
    }

    dep(0,0);

    vector<vector<ll>> dparent(N,vector<ll>(17));
    for (ll i=0;i<N;i++){
        dparent[i][0]=a[i];
    }

    for (ll i=1;i<17;i++){
        for (ll j=0;j<N;j++){
            dparent[j][i]=dparent[dparent[j][i-1]][i-1];
        }
    }

    vector<ll> Kparent(N);
    for (ll i=0;i<N;i++){
        ll t=i;
        for (ll j=0;j<17;j++){
            if ((K-1)>>j &1==1){
                t=dparent[t][j];
            }
        }
        Kparent[i]=t;
    }

    for (ll i=0;i<N;i++){
        if (K>=depth[i]){
            ok[i]=1;
        }
    }
	
    priority_queue<pair<ll,ll>> que;
    for (ll i=0;i<N;i++){
        pair<ll,ll> P;
        P.first=depth[i];
        P.second=i;
        if (not ok[i]){
            que.push(P);
        }
    }

    for (ll i=0;i<N;i++){
        ok[i]=0;
    }


    while (que.size()){
        pair<ll,ll> P;
        P=que.top();
        que.pop();
        ll v=P.second;
        if (not ok[v]){
            ll pv=Kparent[v];
            dfs(pv);
            ans+=1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 29944
n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
s=b[0]
for t in range(1,n):
    s=s+b[t]
    if a[t]==a[t-1]+1:
        s=s+c[a[t-1]-1]
print(s)

Measured memory_bytes: 3060
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1000000007
#define ll_MAX 19223372036859
#define endl "\n"
ll fast_expo(ll x,ll p){if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }

int dp[500001];

int main()
{
    ll t_c; t_c = 1;
    // cin >> t_c;
    for(ll t_i=0; t_i<t_c; ++t_i){
        ll n,k; cin >> n >> k;
        ll arr[n];
        for(ll i=0; i<n; ++i){
            cin >> arr[i];
        }

        for(ll i=0; i<=100001; ++i){
            if(dp[i] == 1) continue;
            for(ll j=0; j<n; ++j){
                dp[i+arr[j]] = 1;
            }
        }

        if(dp[k]) cout <<"First";
        else cout <<"Second";
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
    
	if (n < 2) {
		cout << 1 << endl;
	}
	else if (n < 4) {
		cout << 2 << endl;
	}
	else if (n < 8) {
		cout << 4 << endl;
	}
	else if (n < 16) {
		cout << 8 << endl;
	}
	else if (n < 32) {
		cout << 16 << endl;
	}
	else if (n < 64) {
		cout << 32 << endl;
	}
	else {
		cout << 64 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = 0;
		int min = sc.nextInt();
		int count = 1;
		for(int i = 0; i < n - 1; i++) {
			m = sc.nextInt();
			if(m < min) {
				min = m;
				count++;
			}
			if(m == 1) {
				break;
			}
		}
		System.out.println(count);
		sc.close();
	}
}


Measured memory_bytes: 66964
//don't go gentle into
// the goodnight.

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

#define int       long long
#define ll        long long
#define fr        first
#define sec       second
#define pi        3.141592653589793
#define M         1000000007
#define mod       998244353
#define maxint    2147483647
#define minint    -2147483648
#define maxll     9223372036854775807
#define minll     -9223372036854775808
#define meme0(a)  memset(a,0,sizeof(a));
#define meme1(a)  memset(a,-1,sizeof(a));
#define i_m_speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open      freopen("input.txt","r",stdin);
#define close     freopen("output.txt","w",stdout);
#define v_int     vector<int >
#define v_ll      vector<long long >
#define pb        push_back
#define mk        make_pair
//upper_bound(begin(),end(),key)
//lower_bound(begin(),.end(),key);

const int N=4e6+5;
#define NCR
#define PRIME   M
int pw(int a,int b,int p){
    if(b==0)return 1;
    int t=pw(a,b/2,p);
    if(b%2)return (((a*t)%p)*t)%p;
    else return ((t*t)%p);
}
int fact[N],invfact[N];
void init(){
    int p=PRIME;
    fact[0]=1;
    int i;
    for(i=1;i<N;i++){
        fact[i]=(i*fact[i-1])%p;
    }
    i--;
    invfact[i]=pw(fact[i],p-2,p);
    for(i--;i>=0;i--){
        invfact[i]=(invfact[i+1]*(i+1))%p;
    }
}
int ncr(int n,int r){
    return (((fact[n]*invfact[r])%PRIME)*invfact[n-r])%PRIME;
}
 
int f(int r1,int r2,int k){
    int ans= ncr(k+1+r2,k) - ncr(k+r1,k)+M;
    ans%=M;
    return ans;
}
 
void solve(){
    int r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    int ans=f(r1,r2,c2+1);
    ans = ans - f(r1,r2,c1);
    ans+=M;
    ans%=M;
    cout<<ans;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SEIVE
        seive();
    #endif
    #ifdef NCR
        init();
    #endif
    #ifdef DSU
        cleardsu(MAXDSUSIZE);
    #endif
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

class UnionFind:
    def __init__(self,n):
        self.ps = [-1]*(n+1)
    def find(self,x):
        if self.ps[x]<0:
            return x
        else:
            self.ps[x]=self.find(self.ps[x])
            return self.ps[x]
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
            return False
        if self.ps[x]>self.ps[y]:
            x,y = y,x
        self.ps[x] += self.ps[y]
        self.ps[y] = x
        return True
    def same(self,x,y):
        return self.find(x)==self.find(y)
    def size(self,x):
        x = self.find(x)
        return -self.ps[x]

all1 = [0]*(n)

uf = UnionFind(n)
for i in range(m):
    a,b = map(int,input().split())
    uf.unite(a,b)
    a,b = a-1,b-1
    
    all1[a] +=1
    all1[b] +=1
#print(all1)
ans = [uf.size(x)-1-all1[x-1] for x in range(1,n+1)]
#print(ans)

for i in range(k):
    a,b = map(int,input().split())
    if uf.same(a,b):
        a,b = a-1,b-1
        ans[a] -=1
        ans[b] -=1
print(*ans)

Measured memory_bytes: 18352