akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {

    ll A, B, X;
    cin >> A >> B >> X;
    /*
    if(A > X){
        cout << "NO" << endl;
    }else if(A == X){
        cout << "YES" << endl;
    }else{
        if(B >= X - A){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    */

   if(X >= A && A + B >= X){
       cout << "YES" << endl; 
   }else{
       cout << "NO" << endl;
   }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
#define int long long int
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
lli dp[3005][3005] = {};
tuple<lli, lli, char> mem[3005][3005] = {};
vector<int> t_cnt[26];
vector<int> s_cnt[26];
int nextt(int i, char c)
{
  c -= 'a';
  // t でi以上あとにでjが出るときのインデックス出ないならlength
  return *std::lower_bound(t_cnt[c].begin(), t_cnt[c].end(), i);
}
int nexts(int i, char c)
{
  c -= 'a';
  // t でi以上あとにでjが出るときのインデックス出ないならlength
  return *std::lower_bound(s_cnt[c].begin(), s_cnt[c].end(), i);
}

void solve(std::string s, std::string t)
{
  int n(s.size()), m(t.size());
  rep(i, m) t_cnt[t[i] - 'a'].push_back(i);
  rep(i, n) s_cnt[s[i] - 'a'].push_back(i);

  rep(i, 26) s_cnt[i].push_back(n), t_cnt[i].push_back(m);
  rep(i, n) rep(j, m)
  {
    // s[0, .., i), t[0, .., j)に含まれるLCS
    if (chmax(dp[i + 1][nextt(j, s[i]) + 1], dp[i][j] + 1))
    {
      mem[i + 1][nextt(j, s[i]) + 1] = make_tuple(i, j, s[i]);
    }
    if (chmax(dp[nexts(i, t[j]) + 1][j + 1], dp[i][j] + 1))
    {
      mem[nexts(i, t[j]) + 1][j + 1] = make_tuple(i, j, t[j]);
    }
    if (chmax(dp[i + 1][j], dp[i][j]))
    {
      mem[i + 1][j] = make_tuple(i, j, 0);
    }
    if (chmax(dp[i][j + 1], dp[i][j]))
    {
      mem[i][j + 1] = make_tuple(i, j, 0);
    }
  }
  lli ans = 0;
  pair<lli, lli> cur;
  rep(i, n + 1) rep(j, m + 1)
  {
    if (chmax(ans, dp[i][j]))
      cur = make_pair(i, j);
  }
  vector<char> tt;
  cerr << ans << endl;
  while (true)
  {
    int nx, ny;
    char c;
    tie(nx, ny, c) = mem[cur.first][cur.second];

    //cout << nx << " " << ny << endl;
    if (c)
      tt.push_back(c);
    cur = make_pair(nx, ny);
    if (nx == 0 && ny == 0)
      break;
  }
  rrep(i, tt.size())
  {
    cout << tt[i];
  }
  cout << endl;
}

signed main()
{
  std::string s;
  std::cin >> s;
  std::string t;
  std::cin >> t;
  solve(s, t);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 282496
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int main()
{
  ll h,w;cin >> h >> w;
  ll x,y;cin >> x >> y;
  bool f = false;
  if(2*x==h&&2*y==w) f = true;
  double res = (double)h*w/2;
  printf("%.7f ", res); cout << f << "\n";
  
  return 0;
}


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

int main(void){
	int a[4];
	cin>>a[0]>>a[1]>>a[2]>>a[3];
	sort(a,a+4);
	if(a[0]==a[1]&&a[2]==a[3])cout<<"yes"<<endl;
	else cout<<"no"<<endl;
	return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;


int N,M;
pair<pair<int,int>,int> PY[100000];
string ans[100000];

void addans(int pre,int index,int i){
    string res;
    string s1=to_string(pre);
    rep(i,6-s1.size()) res+="0";
    res+=s1;
    string s2=to_string(index);
    rep(i,6-s2.size()) res+="0";
    res+=s2;
    ans[i]=res;
}

int main(){
    cin>>N>>M;
    rep(i,M){
        int p,y;
        cin>>p>>y;
        PY[i].first.first=p;
        PY[i].first.second=y;
        PY[i].second=i;
    }

    sort(PY,PY+M);
    
    /*rep(i,M){
        cout<<PY[i].first.first<<' '<<PY[i].first.second<<' '<<PY[i].second<<endl;
    }*/

    int pre=0, index=1;
    rep(i,M){
        if(PY[i].first.first==pre){
            addans(pre,index,PY[i].second);
        }else{
            pre=PY[i].first.first;
            index=1;
            addans(pre,index,PY[i].second);
        }
        index++;
    }

    rep(i,M){
        cout<<ans[i]<<endl;
    }
}

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

#define iFOR(idx, from, upto) for (int  idx = from; idx < upto; ++idx)
#define lFOR(idx, from, upto) for (long idx = from; idx < upto; ++idx)

#define ll long long

using namespace std;

int main() {
    int s, w;
    cin >> s >> w;

    if (w >= s) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var xy = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var (varX, varY) = (xy[0], xy[1]);

        for (int a = 0; a <= varX; ++a)
        {
            var b = varX - a;
            if (2 * a + 4 * b == varY)
            {
                Console.WriteLine("Yes");
                return;
            }
        }

        Console.WriteLine("No");
    }
}


Measured memory_bytes: 28288
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif



signed main()
{
    // fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    double l; cin>>l;
    l/=3;
    double ans = l*l*l;
    printf("%.10f\n", ans);
    return 0;
}





Measured memory_bytes: 256
//
// Created by yamunaku on 2019/08/24.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    rep(i,n){
        repl(j,i+1,n){
           rep(k,100){
               if((i^j)&(1<<k)){
                   cout << k+1 << " ";
                   break;
               }
           }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 512
from sys import stdin

a = [int(i) for i in stdin.readline().rstrip().split(' ')]

min = min([a[0], a[1]])
max = max([a[0], a[1]])

k = 0
for i in list(reversed(range(1, min + 1))):
    if max % i == 0 and min % i == 0:
        k += 1
        if k == a[2]:
            print(i)
            break


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

struct Edge{
    int v, c;

    Edge(int v, int c):v(v), c(c){}

//    bool operator >(Edge &e){
//        return c > e.c;
//    }
};

struct SDto{
    int v, d, from;
    SDto(int v, int d, int from): v(v), d(d), from(from){}

//    bool operator <(SDto &that){
//        return d < that.d;
//    }

    friend bool operator>(SDto s1, SDto s2){
        return s1.d > s2.d;
    }

//    friend bool operator<(SDto s1, SDto s2){
//        return s1.d < s2.d;
//    }
};

// dijkstra
const int MAX_N = 10000, INF = 1 << 28;
int distTo[MAX_N];
int parentOf[MAX_N];
void dijkstra(vector<Edge> G[]);

int main() {
//    SDto s1(1, 1, 1);
//    SDto s2(1, 2, 1);
//    cout << (s1 > s2);

    int n;
    cin >> n;

    // Graph
    vector<Edge> G[n];
    for (int i = 0; i < n; ++i) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; ++j) {
            int v, c;
            cin >> v >> c;
            G[u].emplace_back(v, c);
        }
    }

    dijkstra(G);

    for (int l = 0; l < n; ++l) {
        cout << l << " " << distTo[l] << endl;
    }

    return 0;
}

void dijkstra(vector<Edge> G[]){
    fill(distTo, distTo + sizeof(distTo) / sizeof(*distTo), INF);

    priority_queue<SDto, vector<SDto>, greater<SDto>> pq;

    pq.push(SDto(0, 0, -1));
    while(!pq.empty()) {
        SDto sd = pq.top(); pq.pop();
        if (sd.d < distTo[sd.v]) {
            distTo[sd.v] = sd.d;
            for (auto e: G[sd.v]) {
                if (distTo[e.v] < INF) continue;
                pq.push(SDto(e.v, distTo[sd.v] + e.c, sd.v));
            }
        }
    }
}


Measured memory_bytes: 10648
void main()
{
    long n = rdElem;
    string s = rdStr;

    auto g = s.group.array;
    long len = g.length;
    chcnt[] lists = new chcnt[len+1];
    lists[0].b = s.count(".");
    foreach (i, x; g)
    {
        if (x[0] == '#')
        {
            lists[i+1].w = lists[i].w + x[1].to!long;
            lists[i+1].b = lists[i].b;
        }
        else
        {
            lists[i+1].w = lists[i].w;
            lists[i+1].b = lists[i].b - x[1].to!long;
        }
    }

    long result = 1L << 60;
    foreach (x; lists)
    {
        result = min(result, x.w+x.b);
    }

    result.writeln;
}

alias Tuple!(long, "w", long, "b") chcnt;

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 7548
#include<stdio.h>
#define u_int unsigned int

int main(void){
  struct shain{
    u_int ID;
    u_int uriage;
  }uri[4000];
  u_int i,j,n,flg;
  u_int ids,tank,kazu,now;
  
  while(scanf("%u",&n)&&n!=0){
    for(i=0;i<4000;i++){
      uri[i].ID=0;
      uri[i].uriage=0;
    }
    for(i=0,now=0;i<n;i++,now++){
      scanf("%u %u %u",&ids,&tank,&kazu);
      for(flg=0,j=0;j<now;j++){
        if(uri[j].ID==ids){
          uri[j].uriage+=tank*kazu;
          flg=1;
          now--;
        }
      }
      if(flg==0){
        uri[now].ID=ids;
        uri[now].uriage+=tank*kazu;
      }
    }
    for(flg=0,i=0;i<4000;i++){
      if(uri[i].uriage>=1000000){
        printf("%u\n",uri[i].ID);
        flg=1;
      }
    }
    if(flg==0) puts("NA");
  }
  return 0;
}

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

from collections import Counter
c = Counter(a)
for k in c.keys():
    if c[k] == 2:
        break
l = []
for i in range(len(a)):
    if a[i] == k:
        l.append(i)
    if len(l) == 2:
        break
d = n - l[1] + l[0]

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod

mod = 10 ** 9 + 7
N = n + 2

factorial = [1]
for i in range(1, N):
    factorial.append(factorial[i - 1] * i % mod)

inverseFactorial = [0] * N
inverseFactorial[N - 1] = power(factorial[N - 1], mod - 2)
for i in range(N - 2, -1, -1):
    inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod

def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod

for k in range(1, n + 2):
    if d >= k - 1:
        print((comb(n+1, k) - comb(d, k-1)) % mod)
    else:
        print(comb(n+1, k))


Measured memory_bytes: 22876
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

int main(){
    cout << setprecision(10) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    double pi = 6.283185307179586232;
    int n;
    cin >> n;
    cout << n * pi;
    return 0;
}


Measured memory_bytes: 3804
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();

        int maxX = -111;
        int minY = 111;

        for(int i=0; i<N; i++){
            int eachX = sc.nextInt();
            if(eachX > maxX) maxX = eachX;
        }

        for(int i=0; i<M; i++){
            int eachY = sc.nextInt();
            if(eachY < minY) minY = eachY;
        }

        if(minY > maxX) {
            boolean flg = false;
            for(int i=maxX+1; i<=Y; i++){
                if(i > X && i <= minY){
                    flg = true;
                    break;
                }
            }
            if(flg){
                System.out.println("No War");
            } else {
                System.out.println("War");
            }
        } else {
            System.out.println("War");
        }
    }
}


Measured memory_bytes: 21716
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
vector<vector<int>> e;
vector<set<int>> cols;
map<P,int> col;
void rec(int now,int p){
	for(int next:e[now]){
		if(next != p){
			int next_cols = *cols[now].begin();
			cols[next].erase(next_cols);
			cols[now].erase(next_cols);
			col[P(next,now)] = next_cols;
			col[P(now,next)] = next_cols;
			rec(next,now);
		}
	}
}
int main(){
	int n;
	cin >> n;
	e.resize(n);
	cols.resize(n);
	vector<P> edges;
	for(int i = 0;i < n-1;i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		e[a].push_back(b);
		e[b].push_back(a);
		cols[a].insert(e[a].size());
		cols[b].insert(e[b].size());
		edges.push_back(P(a,b));
	}

	rec(0,-1);

	int k = 0;
	vector<int> ans;
	for(int i = 0;i < n-1;i++){
		ans.push_back(col[edges[i]]);
		k = max(k,col[edges[i]]);
	}

	cout << k << endl;
	for(int a:ans)cout << a << endl;
}


Measured memory_bytes: 30196
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    4000
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)


#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); } 
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;
int dp[N][N];

void solve(){
	string a, b;
	cin>>a>>b;
	a = '*' + a;
	b = '5' + b;
	rep(i, 1, sz(b)) {
		rep(j, 1, sz(a)) {
			if(b[i] == a[j]) {
				int tmp = dp[i-1][j-1] + 1;
				self_max(dp[i][j], tmp);
			}
			self_max(dp[i][j], dp[i-1][j]);
			self_max(dp[i][j], dp[i][j-1]);
		}
	}
	string ans = "";
	int col = sz(a) - 1;
	rev(i,sz(b)-1, 1) {
		if(col < 1) 
			break;
		if(dp[i][col] == dp[i-1][col]) {
			continue;
		}
		else if(dp[i][col] == dp[i][col - 1]) {
			col--;
			i++;
		}
		else {
			ans += b[i];
			col--;
		}
	}
	reverse(all(ans));
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


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

#define ll long long int
#define ff first
#define ss second
#define int long long int
#define pb push_back

#define N 100010
#define MOD 1000000007


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string ans = "";

    for (int i = 0; i < n; ++i)
    {
        ans += s[i];
        ans += t[i];
    }
    cout << ans;
    return 0;
}


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


using namespace std;


int main() 
{
    int n,sum=0;
    cin>>n;
    int arr[n],arr1[n],arr2[n-1];
    for(int i=0;i<n;i++) cin>>arr[i];
    for(int i=0;i<n;i++) {cin>>arr1[i]; sum+=arr1[i];}
    for(int i=0;i<n-1;i++) cin>>arr2[i];

    
    for(int i=1;i<n;i++)
    {
        if((arr[i]-arr[i-1])==1) sum+=arr2[arr[i-1]-1];
    }
    cout<<sum;
    
}

Measured memory_bytes: 256
n = int(input())

if n == 1:
    print(0)
    exit(0)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def count(m):
    count = 0
    for i in range(1, 10**12+1):
        if m >= i :
            m -= i
            count += 1
        else:
            return count


bun = factorization(n)

kazu = len(bun)

#if kazu == 1 and bun[0][1] ==1:
#    print(0)
#    exit(0)


countup = 0
for i in range(kazu):
    countup += count(bun[i][1])

print(countup)


Measured memory_bytes: 9492
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6

int compute(int x, vector<int>& v){
    int res=0;
    for(int i=0; i<v.size(); i++){
        res+=((v[i]-x)*(v[i]-x));
    }
    return res;
}
 
 
int main(){
	fast;
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0; i<n; i++)  cin>>v[i];
	int l= *min_element(v.begin(), v.end());
	int h= *max_element(v.begin(), v.end());
	while((h-l)>2){
	    int m1 = l+(h-l)/3;
	    int m2 = h-(h-l)/3;
	    int d1= compute(m1, v);
	    int d2 = compute(m2, v);
	    if(d1<d2){
	        h=m2;
	    }
	    else{
	        l=m1;
	    }
	}
	cout<<min(compute(l, v), min(compute(h,v), compute((h+l)/2, v)))<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
    long long int x,y,i,j,k,c=0;
    vector<long long int>v;
    for(i=0;i<3;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    while(v[1]<v[2])
    {
        c++;
        v[0]++;
        v[1]++;
    }
    c+=(v[2]-v[0])/2;
    if((v[2]-v[0])%2==1)
    {
        c+=2;
    }
    cout<<c<<endl;
    return 0;
}


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

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

  int m = H > W ? H : W;
  
  int ans = N%m==0 ? N/m : N/m+1;
  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  if((a[0]==a[1]&&a[0]!=a[2])||(a[1]==a[2]&&a[0]!=a[1]))cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(nums[K-1])


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

using namespace std;

struct UF
{
  vector<int> par; // 親のインデックスを記憶する配列
  vector<int> sz; // サイズを記憶する。
  vector<int> rank;
  // 初期化
  UF(int n):par(n),sz(n),rank(n){
    for(int i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  // 親を求める
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  // xとyの属する集合を併合
  void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  // xとyが同じ集合ならtrue
  bool same(int x, int y) { return find(x) == find(y); }
  // 素の集合のサイズを求める
  int size(int n){return sz[find(n)];}
};

int main()
{
  int n,m,ans=0;
  vector<int> v;
  cin >> n >> m;
  struct UF pair(n);

  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    v.push_back(a-1);
  }

  for(int i=0;i<m;i++){
    int x,y;
    cin >> x >> y;
    pair.unite(x-1,y-1);
  }

  for(int i=0;i<n;i++)if(pair.same(v[i],i))ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2044
#include <cmath>
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int64_t n357[3] = {3, 5, 7};

int64_t Make(int rest, string num, bool has3, bool has5, bool has7, int64_t N) {
  if (rest == 0) {
    if (has3 && has5 && has7 && stoll(num) <= N) {
      return 1;
    }
    return 0;
  }
  int64_t res = 0;
  for (int64_t n : n357) {
    res += Make(rest-1, num + char('0' + n), has3 || n == 3, has5 || n == 5, has7 || n == 7, N);
  }
  return res;
} 

int main() {
  int64_t N;
  cin >> N;
  
  int unit = static_cast<int>(log10(N)) + 1;
  int64_t res = 0;
  for (int u = 3; u <= unit; ++u) {
    res += Make(u, "", false, false, false, N);
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 3864
//By: Luogu@rui_er(122461)
#include <bits/stdc++.h>
using namespace std;

int d, t, s; 

int main() {
	scanf("%d%d%d", &d, &t, &s);
	if(t * s >= d) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
     string s;
     string s1="s";
     string s2="es";
     cin>>s;
     if(s[s.size()-1]=='s')
         cout<<s+s2<<endl;
     else
        cout<<s+s1<<endl;
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(){
	
	
	int A, B, C;
	
	scanf("%d %d %d", &A, &B, &C);
	
	int counter = 0;
	
	for(int i = 0; i < C; i++){
		counter++;
		if(B - A < 0){
			counter--;
			break;
		}
		B -= A;
	}
	
	printf("%d\n", counter);
	
	return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {

	string S;
	cin >> S;

	int bcnt = 0, wcnt = 0;

	int st = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'B') {
			if (st == 2 || st == 0) bcnt++;
			st = 1;
		}
		if (S[i] == 'W') {
			if (st == 1 || st == 0) wcnt++;
			st = 2;
		}
	}

	cout << bcnt + wcnt -1 << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ADD(ll ADD_X,ll ADD_Y)
{
    return (ADD_X+ADD_Y)%MOD;
}
ll SUB(ll SUB_X,ll SUB_Y)
{
    return ((SUB_X-SUB_Y)+MOD)%MOD;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,x;
    cin>>n>>x;
    vector<int>v;
    int sum=0;
    for(int i=1; i<=n; i++)
    {
        int a;
        a=x+i-1;
        sum+=a;
        v.push_back(a);
    }
    int ans=0,dif=INT_MAX;
    for(int i=0;i<n;i++){
        int cur=sum-v[i];
        int now=abs(abs(cur)-abs(sum));
        if(now<dif){
            dif=now;
            ans=cur;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3600
import sys
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N, K = mi()

cnt_n = N // K
ans = cnt_n ** 3

if K % 2 == 0:
    h_k = K // 2
    if N >= h_k:
        ans += ((N - h_k) // K + 1)**3

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int res = 0;
  int cnt = 0;
  bool flg = true;
  for(int i = 0; i < s.length(); i++){
    if(flg){
      if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
        cnt++;
        res = max(cnt, res);
        flg = false;
      }
    }
    else{
      if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
        cnt++;
        res = max(cnt, res);
      }
      else
        cnt = 0;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int n, m; cin >> n >> m;
  vector<int> a(n), b(n), c(m), d(m);
  rep(i, n) {
    int ai, bi; cin >> ai >> bi;
    a[i] = ai;
    b[i] = bi;
  }
  rep(i, m) {
    int ci, di; cin >> ci >> di;
    c[i] = ci;
    d[i] = di;
  }

  rep(i, n) {
    int mind = __INT_MAX__;
    int pos = -1;

    rep (j, m) {
      int dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (dist < mind) {
        pos = j;
        mind = dist;
      }
    }

    outl(pos + 1);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        if (a < b){
            System.out.println("a < b");
        }
        else if (a > b){
            System.out.println("a > b");
        }
        else System.out.println("a == b");
    }
}


Measured memory_bytes: 26164
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>

using namespace std;

int main(){

    map<long long, bool> m;

    int n;
    cin >> n;
    long long val;
    for(int i = 0; i < n; i++){
        cin >> val;
        if(m[val] == false){
            m[val] = true;
        }
        else {
            m[val] = false;
        }
    }

    int ans = 0;
    for(auto i = m.begin(); i!= m.end(); i++ ){
        if(i->second){
            ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 6528
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int n,a[]=new int[100],i,j,t,s=0;
		n=stdIn.nextInt();
		for(i=0;i<n;i++)a[i]=stdIn.nextInt();
		for(i=0;i<n-1;i++){
			for(j=n-1;j>i;j--){
				if(a[j-1]>a[j]){
					t=a[j-1];
					a[j-1]=a[j];
					a[j]=t;
					s++;
				}
			}
		}
		System.out.print(a[0]);
		for(i=1;i<n;i++)System.out.print(" "+a[i]);
		System.out.println("\n"+s);
	}
}


Measured memory_bytes: 26304
//ぶんなぐる解法. (a_iが相異なるので、重複数え上げが発生しない。）
#include <iostream>
#include <algorithm>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

const int DEPTH = 18;
const int INF = 1e+9;
class RMQ {
	int data[1 << (DEPTH + 1)];
public:
	RMQ() { for (int i = 0; i < (1 << (DEPTH + 1)); i++) data[i] = INF; }
	void update(int p, int x) {
		p += (1 << DEPTH) - 1;
		data[p] = x;
		while (p > 0) {
			p = (p - 1) / 2;
			data[p] = min(data[p * 2 + 1], data[p * 2 + 2]);
		}
	}
	int getMin(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (l >= b || r <= a) { return INF; }
		if (l <= a && b <= r) { return data[id]; }
		int u = getMin(l, r, a, a + (b - a) / 2, id * 2 + 1);
		int v = getMin(l, r, a + (b - a) / 2, b, id * 2 + 2);
		return min(u, v);
	}
};

int n;
int a[200000];
RMQ rmq;

int checkL(int i) {
	int st = -1, ed = i, mid;	//xxxooo, (st, ed]
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		if (rmq.getMin(mid, i + 1) < a[i]) st = mid;
		else ed = mid;
	}
	return ed;
}

int checkR(int i) {
	int st = i, ed = n, mid;	//oooxxx, [st, ed)
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		if (rmq.getMin(i, mid + 1) < a[i]) ed = mid;
		else st = mid;
	}
	return st;
}

signed main() {
	int i;
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) rmq.update(i, a[i]);
	
	int ans = 0;
	rep(i, n) {
		int l = checkL(i);	//j <= i, a[j]～a[i] >= a[i]なる最小のj
		int r = checkR(i);	//j >= i, a[i]～a[j] >= a[i]なる最大のj
		//a[i]を含む区間であって、[l, r]に収まるものの個数は
		int cnt = (i - l + 1) * (r - i + 1);
		ans += cnt * a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5888
#include<stdio.h>

int main(){
  int a,b,tmp;
  scanf("%d", &a);
  scanf("%d", &b);
  
  if (a > b)
  {
    tmp = a;
    a = b;
    b = tmp;
  }
  
  if (a == 1 && b == 2) {
    printf("3\n");
    return 0;
  }
      
  if (a == 1 && b == 3)
  {
    printf("2\n");
    return 0;
  }
  
  if (a == 2 && b == 3)
  {
    printf("1\n");
    return 0;
  }

  printf("%d %d", a,b);
  return 0;
}

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

int main(void)
{
    int x;
    cin >> x;
    int ans;
    
    if(x <= 599){
        ans=8;
    }else if(x <= 799){
        ans =7;
    }else if(x <=999){
        ans = 6;
    }else if(x <=1199){
        ans = 5;
    } else if(x <=1399){
        ans = 4;
    }else if(x <=1599){
        ans = 3;
    } else if(x <=1799){
        ans = 2;
    }else if(x <=1999){
        ans = 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> a(n);
  rep(i, n) cin >> a[i]; 
  sort(a.begin(), a.end());
  string ans = "";
  rep(i, n) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int A = scan.nextInt();
		int L = A;
		int R = A + N - 1;
		int eat = 0;

		if(R <= 0) {
			eat = R;
		}else if(L >= 0) {
			eat = L;
		}else {
			eat = 0;
		}

		int ans = (R + L) * (R - L + 1)/2 - eat;

		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair
#define ss second
#define ff first
const ll INF = 1e13;
const ll N = 200001;
const ll mod=998244353;
bool prime(ll x)
{
	if(x<2) return false;
	for(ll i=2; i*i<=x; i++) if(x%i==0) return false;
	return true;
}
vl fac(N);
void fact()
{
	fac[0]=1;
	loop(i,1,N) fac[i]=(fac[i-1]*i)%mod;
}
void solve()
{
  ll n;
  cin>>n;
  vl a(n), b(n), c(n);
  loop(i,0,n)
  {
  	cin>>a[i]>>b[i]>>c[i];
  }
  ll dp[3][n];
  dp[0][0] = a[0];
  dp[1][0] = b[0];
  dp[2][0] = c[0];
  loop(i,1,n)
  {
  	dp[0][i] = a[i] + max(dp[1][i-1], dp[2][i-1]);
  	dp[1][i] = b[i] + max(dp[0][i-1], dp[2][i-1]);
  	dp[2][i] = c[i] + max(dp[1][i-1], dp[0][i-1]);
  }
  cout<<max(dp[0][n-1], max(dp[1][n-1], dp[2][n-1]));
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--) solve();
 return 0;
}

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

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define REP(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)

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

int main() {
    int n; cin >> n;
    vector<int> li(n * 2);
    rep(i, n * 2) {
        cin >> li[i];
    }
    sort(all(li));

    int ans = 0;
    rep(i, n) {
        int a = i * 2;
        ans += li[a];
    }
    cout << ans << endl;
  
  return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

bool isPrime(int n) {
    if(n == 1) return false;
    if(n == 2) return true;
    for(int i=2;i*i<=n;i++){
        if(n%i == 0) return false;
    }
    return true;
}

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

    vector<int> sum(100002, 0);
    inc(i, 1, 100001){
        if(isPrime(i) && isPrime((i+1)/2)){
            sum[i+1] = sum[i] + 1;
        }else{
            sum[i+1] = sum[i];
        }
    }

    int q;cin >> q;
    inc(i, 0, q){
        int l, r;cin >> l >> r;
        cout << sum[r+1] - sum[l] << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(a,b,c) for(int a=b; a<(int)c; a++)
#define REPD(a,b,c) for(int a=b; a>(int)c; a--)
#define rep(a,b) REP(a,0,b)
#define repd(a,b) REPD(a,b,0)
typedef long long int ll;
using namespace std;

bool isBig(int h1, int w1, int h2, int w2){
  int t1 = h1*h1+w1*w1, t2 = h2*h2 + w2*w2;
  if(t1 > t2){
    return true;
  }else if(t1 <t2){
    return false;
  }else{
    if(h1 > h2){
      return true;
    }else{
      return false;
    }
  }
}

int main(){
  while(true){
    int w,h;
    cin >> h >> w;
    if(h==0 & w==0)break;
    int t = w*w + h*h;
    int ans_h=150, ans_w=150;
    REP(i,1,150){
      REP(j,i+1,150){
        if(isBig(i,j,h,w)){
          if(isBig(ans_h,ans_w,i,j)){
            ans_h = i;
            ans_w = j;
            //cout << ans_h << " " << ans_w << endl;
          }
          break;
        }
      }
    }
    cout << ans_h << " " << ans_w << endl;

  }
  return 0;
}

Measured memory_bytes: 1160
#include <cstdio>

const int MAXN=5005;

int N,la,lb,ans=0;
int nxt[MAXN];
char *T=NULL;
char S[MAXN];

void KMP_init()
{
    nxt[0]=nxt[1]=0;
    for (int j,i=1;i<lb;++i)
    {
        for (j=nxt[i];j&&T[i]!=T[j];j=nxt[j]);
        nxt[i+1]=(T[i]==T[j]?j+1:0);
    }
}

void KMP()
{
    KMP_init();
    int j=0;
    for (int i=0;i<la;++i)
    {
        while (j&&S[i]!=T[j]) j=nxt[j];
        if (S[i]==T[j]) j++;
        if (ans<j) ans=j;
        if (j==lb) return;
    }
}

int main()
{
    scanf("%d%s",&N,S);
    for (la=1;la<N;++la)
    {
        lb=N-la;
        T=&S[la];
        KMP();
    }
    printf("%d",ans);

    return 0;
}


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

int main() {
  int MAX = 100100, cnt = 0;
  int a[MAX + 1] = {};

  int X; cin >> X;
  for (int i = 2; i <= MAX; i++) {
    if (a[i] == 0) {
      a[i] = 1;
      cnt++;
      for (int j = 2; j <= MAX; j++) {
        if (i * j > MAX) break;
        a[i * j] = -1;
      }
    }
  }
  for (int i = 2; i <= MAX; i++) {
    if (a[i] != -1 && i >= X) {
      cout << i << '\n';
      break;
    }
  }
  return 0;
}

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

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

    if(b > a){
        put(max(0LL, b - a - w));
    }else{
        put(max(0LL, a - b - w));
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll A,B,C,D,E,F,G,H,K,L,M,N,P,Q,R,U,W,X,Y,Z;
string S,T;

int main(){
  cin >> N >> K;
  ll Z=1,A=1;
  while(Z<=N){
    Z*=K;
    A++;
  }
  cout << A-1 << endl;
}

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

int main ()
{
	int n;
	long long a;
	long long minValue = 1000000;
	long long maxValue = -1000000;
	long long sum = 0;

	cin >> n;

	for ( int i = 0; i < n; i++ ){
		cin >> a;
		if ( a < minValue ) minValue = a;
		if ( a > maxValue ) maxValue = a;
		sum += a;
	}
	cout << minValue << " " << maxValue << " " << sum << endl;
    return 0;
}	

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

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    int a = 0;
    a += (s[0]=='1')? 1: 0;
    a += (s[1]=='1')? 1: 0;
    a += (s[2]=='1')? 1: 0;
    cout << a << endl;
    return 0;
}



Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;

    Int res = LLONG_MAX;
    for(Int numAB = 0; numAB <= max(X, Y); ++numAB) {
        Int bill = 0;
        bill += numAB * 2 * C;

        Int curX = X - numAB;
        Int curY = Y - numAB;
        if (curX > 0) bill += curX * A;
        if (curY > 0) bill += curY * B;

        res = min(res, bill);
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

    long int H,W,ans;

    scanf("%ld %ld",&H,&W);

    if(H == 1 || W == 1){
        ans = 1;
    }else if(W % 2 == 0){
        ans = (W/2)*H;
    }else if(H % 2 == 0){
        ans = (H/2)*W;
    }else{
        ans = ((W+1)/2)*H - H/2;
    }

    printf("%ld\n",ans);
    return 0;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  
  if(A==B){
    cout << "Draw" << endl;
  }
  else if(A>B&&B!=1){
    cout << "Alice" << endl;
  }
  else if(A<B&&A!=1){
    cout << "Bob" << endl;
  }
  else if(A==1){
    cout << "Alice" << endl;
  }
  else if(B==1){
    cout << "Bob" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<pair<int,int>> x(n);
	vector<int> xx(n);
	for(int i=0;i<n;i++)
	{
		int tmp;
		cin >> tmp;
		x[i]=make_pair(tmp,i+1);
		xx[i]=tmp;
	}

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

	vector<int> ans(n*n+1,0);
	int space=0;
	int now=0;
	for(int i=0;i<n;i++)
	{
		ans[x[i].first-1]=x[i].second;
		space+=x[i].first-now;
		now=x[i].first;
		if(space<x[i].second)
		{
			cout << "No" << endl;
			return 0;
		}
		space-=x[i].second;
	}
	now=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<x[i].second-1;j++)
		{
			while(ans[now]!=0)
				now++;
			ans[now]=x[i].second;
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=x[i].second;j<n;j++)
		{
			while(ans[now]!=0)
				now++;
			ans[now]=x[i].second;
		}
	}
	bool flag=true;
	vector<int> cnt(n,0);
	for(int i=0;i<n*n;i++)
	{
		cnt[ans[i]-1]++;
		if(xx[ans[i]-1]==i+1)
		{
			//cout << cnt[ans[i]-1] << " " << ans[i] << endl;
			if(cnt[ans[i]-1]!=ans[i])
				flag=false;
		}
	}
	if(flag)
	{
		cout << "Yes" << endl;
		for(int i=0;i<n*n;i++)
			cout << ans[i] << (i==n*n-1 ? "\n":" ");
	}
	else
		cout << "No" << endl;
	
}

Measured memory_bytes: 2176