akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	vector<int> b = a;
	sort(b.begin(),b.end());
	map<int,int> m;
	rep(i,n) m[b[i]] = i;
	int ans=0;
	rep(i,n) if(m[a[i]]%2!=i%2) ans++;
	cout << ans/2 << endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int a,b,c;
int main(){
  cin >> a;
  a = a % 10;
  if(a==3){cout << "bon" <<endl;}
  else if(a==0||a==1||a==6||a==8){cout << "pon" <<endl;}
  else {cout << "hon" <<endl;}
  return 0;
}

Measured memory_bytes: 3632
N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
if result_list == []:
    print(0)
else:
    print (max(result_list))

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

const int MAX_N = 100000 + 10;

ll n, x, a[MAX_N], ans;

int main() {
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] + a[i + 1] > x) {
      ans += a[i] + a[i + 1] - x;
      if (x > a[i])
        a[i + 1] = x - a[i];
      else
        a[i + 1] = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
INF = float("inf")

H, W = map(int, input().split())
S = [input() for _ in range(H)]

N = W * H
E = [[INF] * N  for _ in range(N)]

dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            for di, dj in dij:
                ni, nj = i + di, j + dj
                if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == ".":
                    E[W * i + j][W * ni + nj] = 1

from scipy.sparse.csgraph import floyd_warshall
A = floyd_warshall(E)
INF = float("inf")

print(int(max(max(a if a != INF else 0 for a in a) for a in A)))


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 3e18;

ll N;
ll P[5005];
ll C[5005];
ll S[5005];

ll calc(ll s, ll K) {
    memset(S, 0, sizeof(S));

    ll num = 0;
    ll index = s;
    do {
        ll p = P[index];
        S[num + 1] = C[p] + S[num];
        index = p;
        num++;
    } while (index != s);

    S[0] = S[num];

    ll ret = -INF;
    REP(i, std::min(num, K)) {
        ret = std::max(ret, S[(i + 1) % num]);
    }
    ll init = 0;
    if (S[0] > 0) {
        ll t = K / num;
        init = t * S[0];
    }
    if (init > 0)
        ret = std::max(ret, init);
    K %= num;
    REP(i, K) {
        ret = std::max(init + S[(i + 1) % num], ret);
    }

    if (init > 0) {
        init -= S[0];
        REP(i, num) {
            ret = std::max(init + S[(i + 1) % num], ret);
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> N >> K;
    REP(i, N) {
        cin >> P[i];
        P[i]--;
    }
    REP(i, N) {
        cin >> C[i];
    }

    ll ans = -INF;
    REP(i, N) {
        ans = std::max(ans, calc(i, K));
    }

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

Measured memory_bytes: 3764
line = gets.split(' ').map(&:to_i)
if line[0]==line[1] && line[1]!=line[2] then
  puts "Yes"
elsif line[0]==line[2] && line[0]!=line[1] then
  puts "Yes"
elsif line[1]==line[2] && line[0]!=line[1] then
  puts "Yes"
else
  puts "No"
end

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

int main() {
  string S;
  cin>>S;
  int cnt1(0),cnt0(0);
  for (int i(0);i<S.size();i++){
    if (S[i]=='1')cnt1+=1;
    else cnt0+=1;
  }
  cout << min(cnt1,cnt0)*2 <<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n,i;
	cin>>n;
	string s;
	cin>>s;
	for(i=0;i<sz(s);i++)
	{
	    ll offset = (s[i]-'A'+n)%26;
	    s[i] = 'A' + offset;
	}
    cout<<s;	
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define ushi int
#define tapu main
#define nichia (
#define kunn void
#define wara )

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main(){

	int n, a, b;
	bool alice = false;
	scanf("%d%d%d", &n, &a, &b);
	while (a + 1 != b) {
		++a;
		if (a + 1 == b)alice = true;
		if (b - 1 != a)--b;
	}
	printf("%s\n", alice ? "Alice" : "Borys");

	Please AC;
}


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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int ans = a[0] + a[1];
        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main() {
  int x, y;
  cin >> x >> y;

  rep(i, 101) {
    rep(j, 101) {
      if ((i + j == x) && (2 * i + 4 * j == y)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	for(int i=0; i<=n/4; i++){
		if((n-4*i)%7==0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

#define PI 3.14159265358979323846264338327950L

string res;

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

    string S;
    cin >> S;
    res = "yes";
    for (int i = 0; i < S.length(); i++)
    {
        for (int j = 0; j < S.length(); j++)
        {
            if (S[i] == S[j] && i != j)
            {
                res = "no";
                break;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class abc124_B
{
    static void Main(string[] args)
    {
        var QN = int.Parse(Console.ReadLine());
        var QHs = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var lastHeight = 0;
        var cansee = 0;
        for(var i=0; i<QN; i++) {
            if(lastHeight <= QHs[i]) {
                cansee++;
                lastHeight = QHs[i];
            }
        }
        Console.WriteLine(cansee);

    }
}

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

using ll = long long int;
typedef long double ld;
typedef pair<ll,ll> pll;

#define sz(v) (ll)v.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()

ll dp[100010][3],dp2[100010];
ll a[100010],b[100010],c[100010];
void solve(ll cur,ll n)
{
	if(cur>n)return;
	if(cur==1)
	{
		if(cur==n)
		{
			dp2[cur]=max(a[cur],max(b[cur],c[cur]));
			return;
		}
		dp[cur][0]=a[cur];
		dp[cur][1]=b[cur];
		dp[cur][2]=c[cur];
		for(ll i=0;i<3;i++)dp2[cur]=max(dp2[cur],dp[cur][i]);
		solve(cur+1,n);
		return;
	}
	dp[cur][0]=a[cur]+max(dp[cur-1][1],dp[cur-1][2]);
	dp[cur][1]=b[cur]+max(dp[cur-1][0],dp[cur-1][2]);
	dp[cur][2]=c[cur]+max(dp[cur-1][0],dp[cur-1][1]);
	for(ll i=0;i<3;i++)dp2[cur]=max(dp2[cur],dp[cur][i]);
	solve(cur+1,n);
	return;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
		dp[i][0]=dp[i][1]=dp[i][2]=dp2[i]=0;
	}
	solve(1,n);
	cout<<dp2[n]<<"\n";
	return 0;
}

Measured memory_bytes: 5760
import numpy as np
n = int(input())
li_a = list(map(int, input().split()))
m = max(li_a)
e = np.zeros(m)
dup = []
for a in li_a:
    if(e[a-1]==1):
        dup.append(a-1)
        continue
    e[a-1] = 1

for i in dup:
    e[i] = 0

for a in set(li_a):
    origin = a
    while a <= m:
        if a==origin:
            a += origin
            continue
        e[a-1]=0
        a += origin
print(int(sum(e)))

Measured memory_bytes: 55808
<?php

fscanf(STDIN, "%d", $w);
$g = new G();
$a = array();
for ($i = 0; $i < $w; $i++) {
    $a[$i + 1] = 0;
    $g->lines[$i + 1] = new Line($i + 1);
}


fscanf(STDIN, "%d", $n);
$bars = array();
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%s", $bar);
    $bar = explode(',', $bar);

    $line = $g->getLine((int) $bar[0]);
    $line->edges[$i] = $bar[1];

    $line = $g->getLine((int) $bar[1]);
    $line->edges[$i] = $bar[0];
}

for ($i = 1; $i <= $w; $i++) {
    $l = $i;
    $t = 0;
    while (TRUE) {
        $line = $g->getLine($l);
        $next = $line->nextLine($t);
        if ($next === NULL) {
            $a[$l] = $i;
            break;
        }
        $t = $next[0] + 1;
        $l = $next[1];
    }
}

foreach ($a as $v) {
    echo (string) $v;
    echo PHP_EOL;
}

class Line
{
    public $index;
    public $edges = array();

    public function __construct($index) {
        $this->index = $index;
    }

    public function nextLine($t) {
        foreach ($this->edges as $key => $value) {
            if ($key >= $t) {
                return array($key, $value);
            }
        }
        return NULL;
    }
}

class G
{
    public $lines = array();

    public function getLine($index) {
        return $this->lines[$index];
    }
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

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

template<i64 M>
constexpr i64 euinv(i64 val) {
    i64 a = M, b = val;
    i64 x = 0, u = 1;
    while (b) {
        i64 t = a / b;
        swap(a -= t * b, b);
        swap(x -= t * u, u);
    }
    return x < 0 ? x + M : x;
}

template<i64 M>
struct modint {
  i64 a;
  constexpr modint(const i64 x = 0) noexcept: a((x % M + M) % M) {}
  constexpr i64 value() const noexcept { return a; }
  constexpr modint inv() const noexcept { return modint(euinv<M>(a)); }
  constexpr modint pow(i64 r) const noexcept {
    modint ans(1);
    modint aa = *this;
    while(r) {
      if(r & 1) {
        ans *= aa;
      }
      aa *= aa;
      r >>= 1;
    }
    return ans;
  }
  constexpr modint& operator+=(const modint r) noexcept {
    a += r.a;
    if(a >= M) a -= M;
    return *this;
  }
  constexpr modint& operator=(const i64 r) {
    a = (r % M + M) % M;
    return *this;
  }
  constexpr modint& operator-=(const modint r) noexcept {
    a -= r.a;
    if(a < 0) a += M;
    return *this;
  }
  constexpr modint& operator*=(const modint r) noexcept {
    a = a * r.a % M;
    return *this;
  }
  constexpr modint& operator/=(modint r) noexcept {
    i64 ex = M - 2;
    while(ex) {
      if(ex & 1) {
        *this *= r;
      }
      r *= r;
      ex >>= 1;
    }
    return *this;
  }

  constexpr modint operator+(const modint r) const {
    return modint(*this) += r;
  }
  constexpr modint operator-(const modint r) const {
    return modint(*this) -= r;
  }
  constexpr modint operator*(const modint r) const {
    return modint(*this) *= r;
  }
  constexpr modint operator/(const modint r) const {
    return modint(*this) /= r;
  }

  constexpr bool operator!=(const modint r) const {
    return this->value() != r.value();
  }

};

template<const i64 M>
std::ostream& operator<<(std::ostream& os, const modint<M>& m) {
  os << m.value();
  return os;
}

using fp = modint<(i64)(1e9 + 7)>;

#include <vector>
using i64 = long long;


int main() {
  i64 N;
  cin >> N;
  i64 a, b;
  cin >> a >> b;
  auto binom = [&](i64 n, i64 r) {
    if(r < 0 || n < r) { return fp(0); }
    fp ans(1);
    for(i64 i = 0;i < r;i++) {
      ans *= fp(n - i) / fp(r - i);
    }
    return ans;
  };
  cout << fp(2).pow(N) - 1- binom(N, a) - binom(N, b) << endl;
}



Measured memory_bytes: 256
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) ->
      if x < y then Node (y, doit l, r)
      else Node (y, l, doit r) in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> f x; doit l; doit r in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> doit l; f x; doit r in
  doit t

let print t =
  inorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n";
  preorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n"

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r in
  doit t

let () =
  let m = read_int () in
  let t = ref (create ()) in
  for _ = 0 to m - 1 do
    let op = Scanf.scanf "%s " (fun i -> i) in
    if op = "print" then print !t
    else
      let n = Scanf.scanf "%d " (fun i -> i) in
      if op = "find" then print_endline (if find n !t then "yes" else "no")
      else t := insert n !t
  done

Measured memory_bytes: 26300
#include <bits/stdc++.h>
using namespace std;
#define push_back pb
#define make_pair mp
using ll = long long;
const int INF = 0x3f3f3f3f;
const int MAX_N = 2e5+10;

int N;
int a[MAX_N];

void solve()
{
	reverse(a, a+N);
	int ans = 0, cur = 0;
	for(int i=1;i<N;++i){
		if(a[i]>=a[i-1])cur++;
		else{
			ans = max(ans, cur);
			cur = 0;
		}
	}
	ans = max(ans,cur);
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N;++i)cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

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


int main(){
    int N;
    cin >> N;
    string s[10100];
    ll res = 0;
    for(int i = 0; i < N; i++){
        cin >> s[i];
        for(int j = 0; j < s[i].length()-1; j++){
            if(s[i][j] == 'A' && s[i][j+1] == 'B'){
                res++;
            }
        }
    }

    queue<int> qa, qb;
    vector<P> x_list;
    map<P, bool> mp;
    int xa = 0, xb = 0, xab = 0;

    for(int i = 0; i < N; i++){
        if(s[i][0] == 'B' && s[i][s[i].length()-1] == 'A'){
            xab++;
        }
        else if(s[i][0] == 'B'){
            xb++;
        }
        else if(s[i][s[i].length()-1] == 'A'){
            xa++;
        }
    }


    if(xab >= 1){
        res += (xab - 1);
        if(xa >= 1){
            xa--;
            res++;
        }
        if(xb >= 1){
            xb--;
            res++;
        }
    }
    res += min(xa, xb);

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<bool> array(26,true);
    int i;
    for(i = 0;i < s.size();++i){
        array.at((int)s.at(i)-97) = false;
    }
    for(i = 0;i < 26;++i){
        if(array.at(i)){
            cout << (char)(i+97) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int count;
void ans(int a,int b,int c,int n,int s){
  if(b==s&&c==n) count++;
  if(b<s&&c<n) for(int i=a+1;i<=9;i++) ans(i,b+i,c+1,n,s);
}
int main(){
  int n,s;
  while(cin>>n>>s){
    if(n==0&&s==0) break;
    count = 0;
    for(int i=0;i<=9;i++) ans(i,i,1,n,s);
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		long W = s.nextLong();
		int[] wei = new int[N + 1];
		int[] val = new int[N + 1];
		for(int i = 1; i < N + 1; i++) {
			wei[i] = s.nextInt();
			val[i] = s.nextInt();
		}
		wei[0] = val[0] = 0;
		
		long[][] dp = new long[N + 1][201010];
		for(int n = 0; n < N + 1; n++) {			
			for(int i = 0; i < N * 1010; i++) {
				dp[n][i] = 2036854775807l;
			}
		}
		dp[0][0] = 0;
		
		for(int n = 1; n < N + 1; n++) {
			for(int v = 1; v < N * 1010 + 1; v++) {
				dp[n][v - 1] = Math.min(dp[n - 1][v - 1], dp[n][v - 1]);
				dp[n][v - 1 + val[n]] = Math.min(dp[n - 1][v - 1] + wei[n], dp[n][v-1 + val[n]]);
			}
		}
		
		int result = 0;
			for(int v = 0; v < N * 1000 + 1; v++) {
				if(dp[N][v] <= W && result < v)
					result = v;
			}
		
		
		System.out.println(result);
    }
}

Measured memory_bytes: 243872
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int n;
    cin >> n;

    int a = 4;
    int dp[n + 1][a][a][a] = {};
    dp[0][3][3][3] = 1;
    for (int len = 0; len < n; len++) {
        for (int c1 = 0; c1 < a; c1++) {
            for (int c2 = 0; c2 < a; c2++) {
                for (int c3 = 0; c3 < a; c3++) {
                    if (dp[len][c1][c2][c3] == 0)
                        continue;

                    for (int c0 = 0; c0 < a; c0++) {
                        if (c0 == 1 && c1 == 2 && c2 == 0)
                            continue;
                        if (c0 == 1 && c1 == 0 && c2 == 2)
                            continue;
                        if (c0 == 2 && c1 == 1 && c2 == 0)
                            continue;
                        if (c0 == 1 && c1 == 2 && c3 == 0)
                            continue;
                        if (c0 == 1 && c2 == 2 && c3 == 0)
                            continue;

                        dp[len + 1][c0][c1][c2] += dp[len][c1][c2][c3];
                        dp[len + 1][c0][c1][c2] %= MOD;
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int c1 = 0; c1 < a; c1++) {
        for (int c2 = 0; c2 < a; c2++) {
            for (int c3 = 0; c3 < a; c3++) {
                ans += dp[n][c1][c2][c3];
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.

int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	string s;
	cin>>s;
	int n = s.length();
	LL one = 0, zero = 0;
	rep(i,0,n){
		if(s[i] == '1')
			one++;
		else
			zero++;
	}
	LL ans = 2*min(one, zero);
	cout<<ans;
  	return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
          
int main()
{
    int n, m;
    cin >> n >> m;
    string s, t;
    cin >> s;
    cin >> t;
    
    ll g = __gcd(n, m);
    ll L = (ll)n * m / g;
    ll step_s = n / g;
    ll step_t = m / g;

    bool is_ok = true;
    rep(i, 0, g)
        is_ok &= s[step_s * i] == t[step_t * i];
    
    if (is_ok)
        cout << (ll) L << endl;
    else
        cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

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

int main() {
    int x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2;
    x3 = x2-(y2-y1);
    y3 = y2+(x2-x1);
    cout << x2-(y2-y1) << " " <<  y2+(x2-x1) << " " << x3-(y3-y2) << " " << y3+(x3-x2);
}


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

int main() {
  string S;
  cin >> S;
  long N = S.size(), M = 1e9+7, ans = 1;
  for (long i = N - 1, d = 1; i >= 0; i--, d = d * 3 % M) {
    if (S.at(i) == '1') ans = (ans * 2 + d) % M;
  }
  cout << ans << "\n";
}

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

int main(){
    using namespace std;
    long long k;
    vector<long long> temp = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    vector<long long> ans, post;
    ans = temp;
    cin >> k;
    while(ans.size() < k){
        for(int i = 0; i < temp.size(); i++){
            if(temp[i] % 10 == 0){
                post.push_back(temp[i] * 10 + 0);
                post.push_back(temp[i] * 10 + 1);
                ans.push_back(temp[i] * 10 + 0);
                ans.push_back(temp[i] * 10 + 1);
            }
            else if(temp[i] % 10 == 9){
                post.push_back(temp[i] * 10 + 8);
                post.push_back(temp[i] * 10 + 9);
                ans.push_back(temp[i] * 10 + 8);
                ans.push_back(temp[i] * 10 + 9);
            }
            else{
                post.push_back(temp[i] * 10 + temp[i] % 10 - 1);
                post.push_back(temp[i] * 10 + temp[i] % 10);
                post.push_back(temp[i] * 10 + temp[i] % 10 + 1);
                ans.push_back(temp[i] * 10 + temp[i] % 10 - 1);
                ans.push_back(temp[i] * 10 + temp[i] % 10);
                ans.push_back(temp[i] * 10 + temp[i] % 10 + 1);
            }
        }
        temp = post;
        post.clear();
    }
    cout << ans[k - 1] << endl;
}

Measured memory_bytes: 4940
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int cnt=0,n,d;cin>>n>>d;
  long long x,y;
  for(int i=0; i<n; ++i){
    cin>>x>>y;
    if(sqrt(x*x+y*y)<=d) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////


signed main(){
  double h,a;cin>>h>>a;
  cout << (int)ceil(h/a) << endl;
}



Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end

using mint = ModInt<MOD>;
mint dp[2010];

int main() {
    int S; cin >> S;
    dp[0] = mint(1);
    for(int i=0; i<=S; i++) {
        for(int j=3; j<=S; j++) {
            if(i+j <= S) dp[i+j] += dp[i];
        }
    }
    cout << dp[S] << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String Sa = sc.next();
		String Sb = sc.next();
		String Sc = sc.next();

		char card = Sa.charAt(0);
		Sa = Sa.substring(1, Sa.length());

		while (true) {

			if (card == 'a') {
				if (Sa.length() == 0) {
					System.out.println("A");
					break;
				} else {
					card = Sa.charAt(0);
					Sa = Sa.substring(1, Sa.length());
				}
			} else if (card == 'b') {
				if (Sb.length() == 0) {
					System.out.println("B");
					break;
				} else {
					card = Sb.charAt(0);
					Sb = Sb.substring(1, Sb.length());
				}
			} else {
				if (Sc.length() == 0) {
					System.out.println("C");
					break;
				} else {
					card = Sc.charAt(0);
					Sc = Sc.substring(1, Sc.length());
				}
			}
		}
	}
}

Measured memory_bytes: 21972
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10 ** 9 + 7
def solve():
    h = int(input())
    w = int(input())

    k = int(input())

    a = ((k - 1) // (max(h, w)))
    print(a + 1)


def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()


Measured memory_bytes: 62156
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<ctime>

using namespace std;
const int Max = 1e6 + 5;

int main(){
	int n, m, i, j, t, k, flag = 0;
	string a, b;
	cin >> a >> b;
	int A[26] = {0}, B[26] = {0};
	for(i = 0; i < a.length(); i++)
		A[a[i] - 'a']++;
	for(i = 0; i < b.length(); i++)
		B[b[i] - 'a']++;
	sort(A, A + 26);
	sort(B, B + 26);
	for(i = 0; i < 26; i++)
		if(A[i] != B[i]) { flag++; break; }
	if(flag) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;

}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define FUP(i, a, b) for(int i = a; i <= b; i++)
#define FDOWN(i, a, b) for(int i = a; i >= b; i--)
#define MS(a, b) memset(a, b, sizeof(a))
#define ALL(v) v.begin(), v.end()
#define CIN(a) cin >> a;
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, b, c) cin >> a >> b >> c
#define COUT(a) cout << a
#define COUT2(a, b) cout << a << ' ' << b
#define COUT3(a, b, c) cout << a << ' ' << b << ' ' << c
#define ENDL cout << '\n'
int dy[4] = { -1, 1, 0, 0 };
int dx[4] = { 0, 0, 1, -1 };
#define MOD 1000000007

ll dp[2001];
ll sum[2001];

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

	dp[0] = dp[1] = dp[2] = 0;
	sum[0] = sum[1] = sum[2] = 0;
	FUP(i, 3, 2000)
	{
		dp[i] = 1 + sum[i - 3];
		dp[i] %= MOD;
		sum[i] = sum[i - 1] + dp[i];
		sum[i] %= MOD;
	}
	int N;
	CIN(N);
	COUT(dp[N]);



	return 0;
}

Measured memory_bytes: 3548
while True :
    n = int(input())
    
    if n == 0 :
        break
    else :  
        C = [0 for i in range(10)]
        
        for i in range(n) :
            C[int(input())] += 1
            
        for j in range(10) :
            if C[j] == 0 :
                print("-")
            else :
                for i in range(C[j]) :
                    print("*", end = "")
                print()


Measured memory_bytes: 7588
#include <bits/stdc++.h>
#define fir first
#define sec second
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define ll long long
using namespace std;

const int maxn=1e6+7;
ll a[maxn];

int dig(ll x){
	ll ans=0;
	while(x) x/=10,ans++;return ans;
}

int solve(int T){


	string ss,s;cin>>ss;
	s=ss;
	reverse(all(s));
	int ans=0;
	for(int i=0;i<ss.size();i++) {
		ans+=ss[i]!=s[i];
	}
	cout<<ans/2<<endl;

    return 0;
}
int main(){
    int T=1;
    //scanf("%d",&T);
    for(int cas=1;cas<=T;cas++) solve(T);
	return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

// clang-format off
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    auto v = ivec<double>(n);
    repall (e, v)
        e = 1 / e;
    double x = sum_(v);
    cout << setprecision(10) << 1 / x << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int n,m;
		int cal;
		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();
		m=scan.nextInt();
		int[][] yousoA =new int[n][m];
		int[] yousob =new int[m];
		int[] yousoc =new int[n];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++) {
			cal=scan.nextInt();
			yousoA[i][j]=cal;
			}
		}
		for(int i=0;i<m;i++)
		{
			cal=scan.nextInt();
			yousob[i]=cal;
		}
		for(int i=0;i<n;i++)
		{
			cal=0;
			for(int j=0;j<m;j++)
				cal=cal+yousoA[i][j]*yousob[j];
			yousoc[i]=cal;
			System.out.println(yousoc[i]);
		}
		
	}
}

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

int main(void)
{
  int k=1;
  int hudcount;
  int grade;
  cin>>hudcount>>grade;
  for(int i=0;i<hudcount;i++){
      k*=100;
  }
  k*=grade;
  if(grade==100&&hudcount==0)
  {
    k+=1;
  }
  if(grade==100&&hudcount==1)
  {
    k+=100;
  }
  if(grade==100&&hudcount==2)
  {
    k+=10000;
  }
  cout<<k;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
int main() {
    int n;
    cin >> n;
    vector<int> f(n + 1, 0);
    for (int x = 1; x <= 100; ++x) {
        for (int y = 1; y <= 100; ++y) {
            for (int z = 1; z <= 100; ++z) {
                ull tmp = x * x + y * y + z * z + x * y + y * z + z * x;
                if (tmp <= n)
                    ++f[x * x + y * y + z * z + x * y + y * z + z * x];
            }
        }
    }
    for_each(f.begin() + 1, f.end(), [](int i) { cout << i << '\n'; });
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string S;
    while(cin>>S,S!="0"){
        map<string,int>dist;
        dist[S]=0;

        queue<string>que;
        que.push(S);
        while(que.size()){
            string s=que.front();
            que.pop();

            for(int i=0;i+1<s.size();i++){
                if(s[i]==s[i+1])continue;
                int c;
                rep(j,3)if("rgb"[j]!=s[i]&&"rgb"[j]!=s[i+1])c=j;
                string ss=s;
                ss[i]=ss[i+1]="rgb"[c];
                if(dist.find(ss)!=dist.end())continue;
                dist[ss]=dist[s]+1;
                que.push(ss);
            }
        }

        int mi=1001001001;
        rep(i,3){
            string s=string(S.size(),"rgb"[i]);
            if(dist.find(s)!=dist.end())chmin(mi,dist[s]);
        }

        if(mi==1001001001)cout<<"NA"<<endl;
        else cout<<mi<<endl;
    }
    return 0;
}

Measured memory_bytes: 5360
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in xrange(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            else:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        else:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,raw_input().strip().split())
ices = [int(raw_input().strip()) for _ in xrange(N)]

orderN(N,L,ices)

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int a, b; cin >> a >> b;
    string as = "";
    for(int i = 0; i < b; i++){
        as += to_string(a);
    }
    string bs = "";
    for(int i = 0; i < a; i++){
        bs += to_string(b);
    }
    if(as < bs) cout << as << endl;
    else cout << bs << endl;

    return 0;
}


Measured memory_bytes: 3672
#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 = 11451419194545;

//階乗
vector<ll>fact;
//逆元
vector<ll>inv;
//逆元階乗
vector<ll>finv;

//拡張ユークリッドの互除法
pii extgcd(ll a, ll b){
    //前提：aとbが互いに素であること．
    pii x(make_pair(1,0), a);
    pii y(make_pair(0,1), b);

    ll div = 0;

    //終了条件:(GCD(a,b), 0)または(0,GCD(a,b))
    while(true){
        if(y.second == 0) return x;
        
        div = x.second / y.second;
        x.second = x.second  - div * y.second;
        x.first.first = x.first.first - div * y.first.first;
        x.first.second = x.first.second - div * y.first.second;

        if(x.second == 0) return y;

        div = y.second / x.second;
        y.second = y.second - div * x.second;
        y.first.first = y.first.first - div * x.first.first;
        y.first.second = y.first.second - div * x.first.second;
    }
}

//逆元
ll modinv(ll a, ll m = MOD){
    //前提：aとmが互いに素であること．
    pii ans;
    ans = extgcd(a, m);

    ll invNum = 0;
    invNum = ans.first.first;
    invNum %= m;
    //C++特有の剰余がマイナスになってしまう対策
    if(invNum < 0) invNum += m;

    return invNum;
}

//割り算MOD
ll warizan_mod(ll warareru, ll waru, ll m = MOD){
    //割られる数に逆元をかけるだけ
    warareru %= m;
    return warareru * modinv(waru, m) % m;
}

void combination(ll num, ll m = MOD){
    fact.assign(num + 1919, 0);
    finv.assign(num + 1919, 0);
    inv.assign(num  + 1919, 0);

    //初期化
    fact[0] = 1; fact[1] = 1;
    finv[0] = 1; finv[1] = 1;
    inv[0] = 1; inv[1]  = 1;
    //テーブルに列挙
    for(ll i = 2; i < fact.size(); i++){
        fact[i] = fact[i - 1] * i % m;
        inv[i]  = modinv(fact[i]);
        //finv[i] = finv[i - 1] * inv[i] % m;
    }
}

//二項係数
ll nCk(ll n, ll k, ll m = MOD){
    if(k < 0 || n < k) return 0;
    return fact[n] * (inv[k] * inv[n - k] % m) % m;
}


int main(){
 
    ll X, Y;
    cin >> X >> Y;
    
    //x方向の動き(1,2)をa y方向の動き(2,1)をbとする
    //するとXとYはa+2b=Xと2a+b=Yで表すことができる
    //aとbの合計がXとYにたどり着くまでの移動回数

    //1回毎に移動距離は3なのでX＋Yが3の倍数ではなかったら求めることはできない
    if((X + Y) % 3 != 0){
        cout << 0 << endl;
        return 0;
    }

    //ここで割り切れるならX/3とY/3がx方向とy方向へのそれぞれの移動回数
    ll A = X - (X + Y) / 3;
    ll B = Y - (X + Y) / 3;

    if(A < 0 || B < 0){
        cout << 0 << endl;
        return 0;        
    }
    if(A < B) swap(A, B);
    combination(A + B);
    //cout << nCk(X, Y) << endl; 
    cout << nCk(A + B, A) << endl; 



}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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 V, E;
int g[20][20];
int dp[1<<20][20];

int main() {
    cin >> V >> E;
    rep(i, V) rep(j, V) g[i][j] = -1;
    rep(i, E) {
        int s, t, d;
        cin >> s >> t >> d;
        g[s][t] = d;
    }

    rep(i, 1<<V) rep(j, 20) dp[i][j] = INF;
    dp[(1<<V) - 1][0] = 0;
    for (int S = (1<<V) - 2; S >= 0; S--) {
        for (int v = 0; v < V; v++) {
            for (int u = 0; u < V; u++) {
                if (!(S & 1<<u) && g[v][u] != -1) {
                    dp[S][v] = min(dp[S][v], dp[S|1<<u][u] + g[v][u]);
                }
            }
        }
    }

    cout << (dp[0][0] != INF ? dp[0][0] : -1) << endl;
}



Measured memory_bytes: 5664