akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(X: int):

    for i in range(10000000):
        a = i*(i+1)//2
        if(a >= X):
            print(i)
            exit()
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    global X
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int H, W;
char a[102][102];

bool ok(const string &s) {
    auto n = s.size();
    auto s1 = s.substr(0, n / 2);
    auto s2 = s.substr(n / 2 + n % 2, n / 2);
    reverse(all(s2));
    return s1 == s2;
}

bool ok(const vector<char> &vec) {
    rep(i, H) {
        string s = "";
        rep(j, W) s += vec[i * W + j];
        if (!ok(s)) return false;
    }
    rep(i, W) {
        string s = "";
        rep(j, H) s += vec[i + j * W];
        if (!ok(s)) return false;
    }

    return true;
}

void naive() {
    vector<char> vec;
    rep(i, H) rep(j, W) vec.push_back(a[i][j]);
    sort(all(vec));

    do {
        if (ok(vec)) {
            rep(i, H) {
                rep(j, W) { cout << vec[i * W + j]; }
                cout << " ";
            }
            cout << endl;
        }
    } while (next_permutation(all(vec)));
}

int main() {
    cin >> H >> W;
    rep(i, H) rep(j, W) cin >> a[i][j];

    int cnt[26] = {};
    rep(i, H) rep(j, W) cnt[a[i][j] - 'a']++;
    // rep(i, 26) if (cnt[i]) cout << char(i + 'a') << ": " << cnt[i] << endl;

    int mod4[4] = {};
    int mod2[2] = {};
    rep(i, 26) mod4[cnt[i] % 4]++;
    rep(i, 26) mod2[cnt[i] % 2]++;
    int sum = 0;
    rep(i, 4) sum += mod4[i];
    if (H == 1 || W == 1) {
        int odd_cnt = 0;
        rep(i, 26) odd_cnt += cnt[i] % 2;
        if ((H + W) % 2 == 1) {
            if (odd_cnt == 0) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            if (odd_cnt == 1) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
        return 0;
    }
    if (H % 2 == 1 && W % 2 == 1) {
        if (mod2[1] != 1) {
            cout << "No" << endl;
            return 0;
        }
        assert(mod4[3] + mod4[1] == 1);
        if (mod4[0] == sum) {
            cout << "Yes" << endl;
            return 0;
        }
        int t = mod4[3] + mod4[2];
        if (t <= (H + W - 2) / 2) {
            cout << "Yes" << endl;
            return 0;
        }
        cout << "No" << endl;
        return 0;
    }
    if (H % 2 == 0 && W % 2 == 0) {
        if (mod4[0] != sum) {
            cout << "No" << endl;
            return 0;
        }
        cout << "Yes" << endl;
        return 0;
    }
    if (H % 2 == 1 || W % 2 == 1) {
        int t = H;
        if (W % 2 == 0) t = W;
        // cout << mod4[2] << ", " << t / 2 << endl;
        if (mod4[2] != t / 2) {
            cout << "No" << endl;
            return 0;
        }
        if (mod4[2] + mod4[0] != sum) {
            cout << "No" << endl;
            return 0;
        }
        cout << "Yes" << endl;
        return 0;
    }
    assert(false);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, D, X; cin >> N >> D >> X;
  int A[N]; rep(i,N) cin >> A[i];

  int result = X;
  rep(i,N) result += 1 + (D-1)/A[i];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
// ※※※ 解答不能 ※※※
// snuke氏.
// https://atcoder.jp/contests/abc168/submissions/13357090
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using P = pair<int, int>;
using vvi = vector<vector<int>>;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define a first
#define b second
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};

struct L{
    int a, b, c;
    L(int a = 0, int b = 0, int c = 0): a(a), b(b), c(c) {}
};

int main(){
    int n, m;
    map<int, int> mpX, mpY;
    vector<L> lh, lv;
    scanf("%d %d", &n, &m);
    mpX[0] = 0;
    mpY[0] = 0;
    
    rep(i, n){
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        mpX[a] = 0;
        mpX[b] = 0;
        mpY[c] = 0;
        lh.emplace_back(a, b, c);
    }
    rep(i, m){
        int a, b, c;
        scanf("%d %d %d", &c, &a, &b);
        mpY[a] = 0;
        mpY[b] = 0;
        mpX[c] = 0;
        lv.emplace_back(a, b, c);
    }
    vector<int> xs, ys;
    for(auto &p : mpX){
        p.b = xs.size();
        xs.pb(p.a);
    }
    for(auto &p : mpY){
        p.b = ys.size();
        ys.pb(p.a);
    }
    int h = xs.size() * 2;
    int w = ys.size() * 2;
    vvi d(h, vector<int>(w));
    rep(i, n){
        int a = mpX[lh[i].a] * 2;
        int b = mpX[lh[i].b] * 2;
        int c = mpY[lh[i].c] * 2;
        repx(x, a, b + 1) d[x][c] = -1;
    }
    rep(i, m){
        int a = mpY[lv[i].a] * 2;
        int b = mpY[lv[i].b] * 2;
        int c = mpX[lv[i].c] * 2;
        repx(y, a, b + 1) d[c][y] = -1;
    }
    
    queue<P> q;
    int sx = mpX[0] * 2, sy = mpY[0] * 2;
    d[sx][sy] = 1;
    q.emplace(sx, sy);
    while(!q.empty()){
        int x = q.front().a;
        int y = q.front().b;
        q.pop();
        rep(v, 4){
            int nx = x + dx[v], ny = y + dy[v];
            if(nx < 0 || nx >= h) continue;
            if(ny < 0 || ny >= w) continue;
            if(d[nx][ny] != 0)    continue;
            d[nx][ny] = 1;
            q.emplace(nx, ny);
        }
    }
    
    LL ans = 0;
    rep(x, h){
        rep(y, w){
            if(d[x][y] != 1) continue;
            if(x == 0 || x == h - 1 || y == 0 || y == w - 1){
                puts("INF");
                return 0;
            }
            if(x % 2 == 0 || y % 2 == 0) continue;
            LL ex = xs[x / 2 + 1] - xs[x / 2];
            LL ey = ys[y / 2 + 1] - ys[y / 2];
            ans += ex * ey;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 144456
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,K;
    cin >> N >> K;
    int p[N];
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }
    sort(p,p+N);
    int ans = 0;
    for (int i = 0; i < K; i++)
    {
        ans += p[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
using System;
    using System.Text;
    using System.Collections.Generic;
    using static System.Math;
    using System.Linq;
    using static System.Array;
    
    namespace ConsoleApp2
    {
    class Program
    {
        static string S;
        static long ans = 0;
        static long N;
        static long M;
        static Node[] Nodes;
        static void Main(string[] args)
        {

            //var N = long.Parse(Console.ReadLine());
            var ABC = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var A = ABC[0];
            var B = ABC[1];
            var C = ABC[2];

            if (A > B)
            {
                Swap(ref A, ref B);
            }

            if (B > C)
            {
                Swap(ref C, ref B);
            }
            Console.WriteLine(A*B/2);
        }
        static void Swap<T>(ref T a, ref T b)
        {
            var tmp = a;
            a = b;
            b = tmp;
        }

    }

    class Node
    {
        long num = -1;
        public List<long> adj;
        public Node(long inp)
        {
            this.num = inp;
            adj = new List<long>();
        }
    }
}


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

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define For(i,a,n) for(i=a;i<n;i++)
#define all(ar) ar.begin(),ar.end() 
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;
const ll mod = 1000000007;

bool hbe(int x,int y,int h,int w){
    if( x>= 0 && x < h && y >= 0 && y < w ) return true;
    return false;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    /*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    //*/
    int i,h,w;
    cin>>h>>w;
    string ar[h];
    For(i,0,h) cin>>ar[i];
    int j,val[h][w];
    set<pair<int,int> > bomb;
    memset(val,0,sizeof(val));
    For(i,0,h){
        For(j,0,w){
            if(ar[i][j] == '#'){
                bomb.insert(mp(i,j));
                if(hbe(i+1,j,h,w)) val[i + 1][j]++;
                if(hbe(i+1,j+1,h,w)) val[i+1][j+1]++;
                if(hbe(i+1,j-1,h,w)) val[i+1][j-1]++;
                if(hbe(i,j-1,h,w)) val[i][j-1]++;
                if(hbe(i,j+1,h,w)) val[i][j+1]++;
                if(hbe(i-1,j,h,w)) val[i-1][j]++;
                if(hbe(i-1,j+1,h,w)) val[i-1][j+1]++;
                if(hbe(i-1,j-1,h,w)) val[i-1][j-1]++;
            }
        }
    }
    For(i,0,h){
        For(j,0,w){
            if(bomb.count({i,j})) cout<<"#";
            else cout<<val[i][j];
        }
        cout el;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<sstream>

typedef std::stringstream sst;

int ToInt(std::string str){
	int i;
	sst ss;
	ss<<str;
	ss>>i;
	return i;
}
std::string ToStr(int i){
	std::string str;
	sst ss;
	ss<<i;
	ss>>str;
	return str;
}

std::string SubStr(std::string str,int x,int y){
	return str.substr(x,y-x+1);
}
int Third(std::string str){
	int fres,Ans;
	while( ( fres=str.find_first_of("+-",1) ) != std::string::npos ){
		int aRes;
		
		if( (aRes=str.find_first_of("+-",fres+2)) == std::string::npos )
			aRes=str.size()-1;
		else --aRes;
		
		if( str[fres] =='+' ){
			Ans=ToInt(SubStr(str,0,fres-1))+ToInt(SubStr(str,fres+1,aRes));
			str.replace(0,SubStr(str,0,aRes).size(),ToStr(Ans).c_str());
		}else{
			Ans=ToInt(SubStr(str,0,fres-1))-ToInt(SubStr(str,fres+1,aRes));
			str.replace(0,SubStr(str,0,aRes).size(),ToStr(Ans).c_str());
		}
	}
	return ToInt(str);
}

int Second(std::string str){
	int fres,Ans;
	while( ( fres=str.find_first_of("*/") ) != std::string::npos ){
		int bRes,aRes;
		if( (bRes=str.find_last_of("+-",fres)) == std::string::npos  || bRes==0 )
			bRes=0;
		else ++bRes;
		
		if( (aRes=str.find_first_of("+-*/",fres+2)) == std::string::npos )
			aRes=str.size()-1;
		else --aRes;
		
		if( str[fres] =='*' ){
			Ans=ToInt(SubStr(str,bRes,fres-1))*ToInt(SubStr(str,fres+1,aRes));
			str.replace(bRes,SubStr(str,bRes,aRes).size(),ToStr(Ans).c_str());
		}else{
			Ans=ToInt(SubStr(str,bRes,fres-1))/ToInt(SubStr(str,fres+1,aRes));
			str.replace(bRes,SubStr(str,bRes,aRes).size(),ToStr(Ans).c_str());
		}
	}
	Ans=Third(str);
	return Ans;
}

int First(std::string str){
	int fres;
	while( (fres = str.find(")") ) != std::string::npos ){
		int rfres=str.rfind("(",fres);
		std::string Next=SubStr(str,rfres+1,fres-1);
		int cRes=Second(Next);
		str.replace(rfres,Next.size()+2,ToStr(cRes).c_str());
	}
	int lRes = Second(str);
	
	return lRes;
}

int main(){
	int n;
  std::string str;
	std::cin>>n;
	while( n-- ){
		std::cin>>str;
	  std::cout<<First(str)<<std::endl;
	}
}

Measured memory_bytes: 1256
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    int n, a, an, b, bn;
    cin >> n >> an >> a >> bn >> b;
    double x = (double)n/an, y = (double)n/bn;
    x++; y++;
    int tmpa = 0, tmpb = 0;
    for (int i = 1; i <= (int)x; i++) {
        if ( i == x) break; //x == int
        tmpa += a;
    }
    for (int i = 1; i <= (int)y; i++) {
        if ( i == y) break;
        tmpb += b;
    }
    int ans = (tmpa > tmpb) ? tmpb : tmpa;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3088
/**
 * THIS IS CFMASTER'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>
 
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No") << '\n';
  return 0;
}

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

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

    vector<int> T(N);
    for (int i = 0; i < N; i++)
        cin >> T.at(i);

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

    int start_time = T.at(0);
    int bus = 0;
    int ans = 1;

    for (int i = 0; i < N; i++)
    {
        if (bus >= C || T.at(i) - start_time > K)
        {
            ans++;
            start_time = T.at(i);
            bus = 1;
        }
        else
        {
            bus++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
package main

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

func main() {
	k := 5
	n := readInt()
	ans := 0
	for i := 0; i < k; i++ {
		x := readInt()
		if n%x == 0 {
			ans = max(ans, n/x)
		} else {
			ans = max(ans, n/x+1)
		}
	}
	fmt.Println(ans + k - 1)
}

func tle() {
	k := 5
	n := readInt()
	x := make([]int, k)
	for i := range x {
		x[i] = readInt()
	}

	rest := make([]int, k+1)
	tmpRest := make([]int, k+1)
	rest[0] = n

	ans := 0
	for {
		for i := range x {
			if rest[i] > 0 {
				next := min(rest[i], x[i])
				rest[i] -= next
				tmpRest[i+1] += next
			}
			rest[i] += tmpRest[i]
			tmpRest[i] = 0
		}
		ans++
		if tmpRest[k] == n {
			fmt.Println(ans)
			return
		}
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int p[10]={0,0,0,0,0,0,1,1,1,2};
int q[10]={1,1,1,2,2,3,2,2,3,3};
int x[10]={2,3,4,3,4,4,3,4,4,4};
ll m,a,r,c,h;
int main(){
	string s;
	int n;
	ll ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s[0]=='M')m++;
		if(s[0]=='A')a++;
		if(s[0]=='R')r++;
		if(s[0]=='C')c++;
		if(s[0]=='H')h++;
	}
	ll d[5];
	d[0]=m,d[1]=a,d[2]=r,d[3]=c,d[4]=h;
	for(int i=0;i<10;i++){
		ans+=d[p[i]]*d[q[i]]*d[x[i]];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#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
const int N=2005,inf=1e9;
int a[N],dp[2][N][N];
int n,x,y;
int fun(int ind,int turn,int pre=0)
{
  if(dp[turn][ind][pre]!=-1) return dp[turn][ind][pre];
  if(ind==n)
    return abs(a[ind]-a[pre]);
  int ans;
  if(!turn)
    {
      int mx=0;
      rep(i,ind,n)
	mx=max(mx,fun(i+1,1-turn,i));
      mx=max(mx,abs(a[n]-a[pre]));
      ans=mx;
    }
  else
    {
      assert(pre>0);
      int mn=inf;
      rep(i,ind,n)
	mn=min(mn,fun(i+1,1-turn,i));
      mn=min(mn,abs(a[ind]-a[pre]));
      ans=mn;
    }
  return dp[turn][ind][pre]=ans;
}
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  memset(dp,-1,sizeof(dp));
  cin>>n>>x>>y;
  rep(i,1,n+1) cin>>a[i];
  a[0]=y;
  cout<<fun(1,0)<<endl;
  return 0 ;
}


Measured memory_bytes: 31744
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
    i64 x;
    cin>>x;

string s="";
    while(x)
    {
x--;
      s+='a'+((x%26));
      x/=26;
      // x--;
    }
    reverse(all(s));
    cout<<s;




    return 0;
  }


Measured memory_bytes: 3672
package main

import "fmt"

const div = 1000000000 + 7

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

func mod(i int) int {
	return i % div
}

func fact(i int) int {
	if i == 1 {
		return 1
	}
	return mod(i * fact(i-1))
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	if abs(n-m) > 1 {
		fmt.Println(0)
		return
	}

	mn := fact(n)
	mm := fact(m)

	if n == m {
		fmt.Println(mod(mn * mm * 2))
		return
	}

	fmt.Println(mod(mn * mm))
}

Measured memory_bytes: 7040
#include <stdio.h>
#include <stdlib.h>
#define N_MAX 100000

int n,k,c[N_MAX],f;

int max(int x,int y){return(x>y)?x:y;}
int q(void*a,void*b){return*(int*)a-*(int*)b;}

void solve(void){
	int i = 0,n1 = 0,x1 = 0,n2 = 0,x2 = 0,a = 0;
	while(i < k){
		x1 = n1 = c[i];
		while(++i < k && c[i] == x1 + 1)x1++;
		if(f && x2 && x2 == n1 - 2)
			a = max(a, x1 - n2 + 1);
		else
			a = max(a, x1 - n1 + 1 + ((f && (n1 > 1 || x1 < n))?1:0));
		x2 = x1;
		n2 = n1;
	}
	printf("%d\n",a);
	return;
}

int main(void){
	int i,j;
	while(scanf("%d%d",&n,&k),n||k){
		i = 0;
		f = 0;
		while(i < k){
			scanf("%d",&j);
			if(j)
				c[i - f] = j;
			else
				f++;
			i++;
		}
		k -= f;
		qsort(c,k,sizeof(int),q);
		solve();
	}
	return 0;
}

Measured memory_bytes: 1132
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

val br = BufferedReader(InputStreamReader(System.`in`))
val pw = PrintWriter(System.out)
fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    // 回答をここに書く
    val s = next()
    println(s.replace("x","").length * 100 + 700)
}

// 入力取得
fun next() = br.readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }
fun listOfLong() =listOfString().map { it.toLong() }
fun listOfDouble() =listOfString().map { it.toDouble() }

// 約数のList
fun divisor(value : Long) : List<Long> {
    val max = Math.sqrt(value.toDouble()).toLong()
    return (1..max)
            .filter { value % it == 0L }
            .map { listOf(it, value / it) }
            .flatten()
            .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from : Long, to : Long = from) : List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j ->  i % j != 0L }
    }
}

// 素因数分解
fun decom(value : Long) : List<Long>{
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a : Long, b : Long) : Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base : String, a : String, b : String) : String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

fun println(value : Any) {
    pw.println(value)
}

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

using namespace std;

int main ()
{
   int a,b,c;
   cin>>a>>b>>c;
int d=b-a;
int f=c-b;
if(d==f)
{
    cout<<"YES";
}
else cout<<"NO"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int N, M; cin >> N >> M;
VP AB(N); rep(i, 0, N) cin >> AB[i].first >> AB[i].second;
sort(ALL(AB));

int64_t hon = 0, en = 0, i = 0;
for(; i< N && hon < M; ++i){
    hon += AB[i].second;
    en += AB[i].first * AB[i].second;
}

cout << en - (AB[i-1].first * (hon - M)) << endl;


}

// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

#define ll long long

#define DEBUG (0)

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

  int x,y,z = 0;
  x = N/100;
  y = (N - (x *100))/10;
  z = N - (x*100 + 10*y);

  if(x == 7 || y == 7 || z == 7){
    cout << "Yes" << "\n";
  }else{
    cout << "No" << "\n";
  }
#if DEBUG
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << "\n";
#endif
}


Measured memory_bytes: 3620
/*やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん

（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。

今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、

そこでしこたま酒を飲んでからやりはじめたんや。

3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。

しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。

浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、

先に兄ちゃんがわしの口に糞をドバーっと出して来た。

それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、

3人で出した糞を手で掬いながらお互いの体にぬりあったり、

糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。

しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。

浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると

けつの穴が糞と小便でずるずるして気持ちが良い。

にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。

糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。

それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、

糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。

やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。

ああ～～早く糞まみれになろうぜ。

岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や

糞まみれでやりたいやつ、至急、メールくれや。

土方姿のまま浣腸して、糞だらけでやろうや。*/
#include "bits/stdc++.h"
#include <numeric>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define llMIN numeric_limits<long long>::min()
#define intMIN numeric_limits<int>::min()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double

int main(void){
  ll n,m;
  cin>>n>>m;
  vl p(m);
  vector<string> s(m);
  rep(i,m){
    cin>>p[i]>>s[i];
    p[i]--;
  }
  vl wanum(n,0);
  vl oks(n,0);
  rep(i,m){
    if(s[i]=="AC"){
      oks[p[i]]=1;
    }else if(s[i]=="WA"){
      if(oks[p[i]]==0){
        wanum[p[i]]++;
      }else{
        ;
      }
    }
  }
  ll acs=0;
  rep(i,n){
    acs+=oks[i];
  }
  ll was=0;
  rep(i,n){
  	if(oks[i]==1){
    	was+=wanum[i];
    }
  }
  cout<<acs<<" "<<was<<endl;
  return 0;
}


Measured memory_bytes: 8064
n = int(input())
a = list(map(int, input().split(' ')))
c = [0] * (n + 1)
d = [0] * (n + 1)
for i in a:
    c[i] += 1
    d[i] = c[i] * (c[i] - 1) // 2
t = sum(d)
for i in a:
    if c[i] > 2:
        r = (((c[i] - 1) * (c[i] - 2)) // 2)
    else:
        r = 0
    print(t - d[i] + r)

Measured memory_bytes: 25716
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int n;
int a[200005],b;
int main()
{
	cin>>n;
	b=1;
	for(int i=0;i<n;i++){
		cin>>a[i];
		
	}
	sort(a,a+n);
	for(int i=1;i<n;i++){
		if(a[i]==a[i-1]){
			b=0;
			break;
		}
	}
	if(b==0)cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}


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

const int INF = 1e9;

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;
    int a[41], b[41], c[41];
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    int dp[501][501];
    for(int i = 0; i < 501; i++){
        fill(dp[i], dp[i] + 501, INF);
    }
    dp[0][0] = 0;
    for(int k = 0; k < n; k++){
        for(int i = 500; i >= a[k]; i--){
            for(int j = 500; j >= b[k]; j--){
                if(dp[i - a[k]][j - b[k]] != INF){
                    dp[i][j] = min(dp[i][j], dp[i - a[k]][j - b[k]] + c[k]);
                }
            }
        }
    }
    int ans = INF;
    for(int i = 1; ma * i < 501 && mb * i < 501; i++){
        ans = min(ans, dp[ma * i][mb * i]);
    }
    if(ans != INF) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int X1,X2,X3,Y1,Y2,Y3,s;
signed main(){
	cin>>s;
	X1=0;Y1=0;
	X2=1000000000,Y2=1;
	X3=(1000000000-s%1000000000)%1000000000;
	Y3=(s+X3)/1000000000;
	cout<<X1<<" "<<Y1<<" "<<X2<<" "<<Y2<<" "<<X3<<" "<<Y3<<endl;
	//cout<<X2*Y3-X3*Y2;
}


Measured memory_bytes: 256
/*

  _|_|                              _|  _|    _|
_|    _|  _|  _|_|  _|_|_|_|        _|  _|  _|
_|    _|  _|_|          _|          _|  _|_|
_|    _|  _|          _|      _|    _|  _|  _|
  _|_|    _|        _|_|_|_|    _|_|    _|    _|

*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
//#define ls (rt<<1)
//#define rs (rt<<1|1)
#define vi vector<int>
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define fi first
#define se second
typedef long long ll;
const int maxn=2e5+1000;
const int inf=1e9+100;
using namespace std;
vi E[maxn],inset[maxn];
int s=2e5+1,t=2e5+2,cnt=1,head[maxn];
struct gg{
    int u,v,w,next;
}side[maxn*4];
void ins(int u,int v,int w) {
    side[++cnt]=(gg){u,v,w,head[u]};head[u]=cnt;
    side[++cnt]=(gg){v,u,0,head[v]};head[v]=cnt;
}
int rk[maxn],cur[maxn];
queue<int>q;
bool bfs() {
    memset(rk,0,sizeof(rk));rk[s]=1;
    while(!q.empty())q.pop();q.push(s);
    while(!q.empty()) {
        int u=q.front();q.pop();
        for(int i=head[u];i;i=side[i].next) {
            int v=side[i].v;if(rk[v]||!side[i].w)continue;
            rk[v]=rk[u]+1;
            q.push(v);
        }
    }
    if(!rk[t])return 0;
    return 1;
}
int dfs(int u,int flow) {
    if(u==t||!flow)return flow;
    int tot=0;
    for(int &i=cur[u];i;i=side[i].next) {
        int v=side[i].v;//cout<<v<<' '<<rk[v]<<endl;
        if(rk[v]!=rk[u]+1||!side[i].w)continue;
        int sent=dfs(v,min(flow,side[i].w));
        side[i].w-=sent;side[i^1].w+=sent;
        flow-=sent;tot+=sent;
    }
    return tot;
}
int dinic(){
    int maxflow=0;
    while(bfs()){
        memcpy(cur,head,sizeof(cur));
        maxflow+=dfs(s,inf);
    }
    return maxflow;
}
int match[maxn];//match[set_id]=match_point_id
bool inq[maxn];
pii ans[maxn];
int main(){
    //ios::sync_with_stdio(0);
    int n;scanf("%d",&n);//cin>>n;
    rep(i,1,n-1) {
        int c;scanf("%d",&c);//cin>>c;
        rep(j,1,c) {
            int u;scanf("%d",&u);//cin>>u;
            E[i].pb(u);inset[u].pb(i);
            ins(u,n+i,1);
        }
    }
    rep(i,2,n)ins(s,i,1);
    rep(i,1,n-1)ins(n+i,t,1);
    int flow=dinic();
    if(flow!=n-1) {
        printf("-1\n");//cout<<"-1";
        return 0;
    }
    rep(i,n+1,n+n-1) {
        for(int j=head[i];j;j=side[j].next) {
            int v=side[j].v;
            if(v<=n&&side[j].w) {
                match[i-n]=v;break;
            }
        }
    }
    while(!q.empty())q.pop();
    int tot=1;q.push(1);inq[1]=1;
    while(!q.empty()) {
        int u=q.front();q.pop();
        for(int i=0;i<inset[u].size();i++) {
            int setid=inset[u][i],set_match=match[setid];
            if(!inq[set_match]) {
                inq[set_match]=1;ans[setid]=mk(u,set_match);
                q.push(set_match);tot++;
            }
        }
    }
    if(tot!=n) {
        printf("-1\n");//cout<<"-1";
        return 0;
    }
    for(int i=1;i<n;i++) {
        printf("%d %d\n",ans[i].fi,ans[i].se);
        //cout<<ans[i].fi<<' '<<ans[i].se<<endl;
    }
    return 0;
}


Measured memory_bytes: 41904
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,i,u,v;
	ll ans=0ll,tmp;
	std::cin >> n;
	for(i=1; i<=n; ++i){
		ans += 1ll*i*(n-i+1);
	}
	for(i=1; i<n; ++i){
		std::cin >> u >> v;
		if(u>v){
			std::swap(u,v);
		}
		ans -= 1ll*u*(n-v+1);

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


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define iiMPQ priority_queue<ii,vector<ii>,greater<ii> >
#define MPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin>>n
#define scan2(a,b) cin>>a>>b
#define scan3(a,b,c) cin>>a>>b>>c
#define print(n) cout<<n
#define println(n) cout<<n<<"\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,s,e) for(int i=s;i<e;++i)
#define REPS(i,s,e,st) for(int i=s;i<e;i+=st)
#define rep(i,n) for(int i=n-1;i>=0;--i)
#define repr(i,s,e) for(int i=s;i>=e;--i)
#define reps(i,s,e,st) for(int i=s;i>=e;i-=st)
#define SET(arr,k) memset(arr,k,sizeof arr)
#define speed ios::sync_with_stdio(0); cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";

void m1(){
  int sum = 0;
  string s; cin >> s;
  for(int i=0;i<s.length();++i){
  	sum += (s[i] - '0');
  }
  if(sum%9==0) cout << "Yes";
  else cout << "No";
}
/* 
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/
 
signed main(){
  speed;
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}


Measured memory_bytes: 3780
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b] <- getIntList
    print $ if b `mod` a == 0 then a + b else b - a

Measured memory_bytes: 380
import itertools
N, K = map(int,input().split())
S = input()
##num = [i for i in range(1,N + 1)]
##for i in itertools.combinations(num, 2):
##    #print(i)
ans = 0
for i in range(1, N):
    if S[i] == S[i - 1]:
        ans += 1

print(min(N -1, ans + K * 2))

        

Measured memory_bytes: 9276
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[]h=new int[10];for(int i=10;i-->0;)h[i]=s.nextInt();Arrays.sort(h);System.out.printf("%d\n%d\n%d\n",h[9],h[8],h[7]);}}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<map<ll, ll>> edges(n);
    rep(i, n - 1)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edges[a][b] = c;
        edges[b][a] = c;
    }
    vll dist(n, infl);
    ll q, k;
    cin >> q >> k;
    k--;
    dist[k] = 0;
    set<ll> check;
    check.insert(k);
    while (!(check.empty()))
    {
        ll now = *check.begin();
        check.erase(now);
        for (auto p : edges[now])
        {
            ll nex = p.F, d = p.S;
            if (dist[nex] > dist[now] + d)
            {
                dist[nex] = dist[now] + d;
                check.insert(nex);
            }
        }
    }
    rep(i, q)
    {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        cout << dist[x] + dist[y] << endl;
    }
}


Measured memory_bytes: 23936
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)
#define INF 1000000000

bool isSmall(int h1, int w1, int h2, int w2) {
	int d1 = h1*h1 + w1*w1;
	int d2 = h2*h2 + w2*w2;

	if (d1 < d2) return true;
	else if (d1 > d2) return false;
	else if (h1 < h2) return true;
	else return false;
}

int main() {
	int h, w;
	while (cin >> h >> w, h || w) {
		int ans_h = INF, ans_w = INF;
		int diag = h*h + w*w;
		int mnd = INF, mnh = 0;

		REP(i, 1, 151) {
			REP(j, i + 1, 151) {
				int x = i*i + j*j;
				
				if (i == h && j == w) continue;
				if (isSmall(i, j, h, w)) continue;

				if (isSmall(i, j, ans_h, ans_w)) {
					ans_h = i;
					ans_w = j;
				}
			}
		}

		cout << ans_h << " " << ans_w << endl;
	}
	return 0;
}

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

int n,pos;
vector<int> pre,in,post;

//木を再構築して、postorderの列を作る
void rec(int l,int r){
	if(l>=r) return;
	int root=pre[pos++];
	int m=distance(in.begin(),find(in.begin(),in.end(),root));
	rec(l,m); //左部分木
	rec(m+1,r); //右部分木
	post.push_back(root); //根を追加
}

void solve(){
	pos=0;
	rec(0,pre.size());
	for(int i=0;i<n;i++){
		if(i!=0) cout<<" ";
		cout<<post[i];
	}
	cout<<endl;
}

int main(){
	int k;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>k;
		pre.push_back(k);
	}
	for(int i=0;i<n;i++){
		cin>>k;
		in.push_back(k);
	}

	solve();

	return 0;
}



Measured memory_bytes: 3152
n,q=map(int,input().split())
text=input()
sum_=[]
count=0
for i in range(n):
    if text[i-1]=='A' and text[i]=='C':
        count+=1
    sum_.append(count)
for i in range(q):
    l,r=map(int,input().split())
    print(sum_[r-1]-sum_[l-1])

Measured memory_bytes: 6104
def main():
    N, M, X = (int(i) for i in input().split())
    A = []
    C = []
    for _ in range(N):
        c, *a = (int(i) for i in input().split())
        A.append(a)
        C.append(c)
    ans = 10**9
    for bit in range(1 << N):
        cur_m = 0
        cur_ri = [0]*M  # 理解度
        for i in range(N):
            if bit & (1 << i):
                cur_m += C[i]
                for j, a in enumerate(A[i]):
                    cur_ri[j] += a
        if all(ri >= X for ri in cur_ri):
            ans = min(ans, cur_m)
    print(ans if ans != 10**9 else -1)


if __name__ == '__main__':
    main()


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

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

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

	vector<int> x(N);
	int minX = 1000, maxX = 0;

	for (int i = 0; i < N; ++i) {
		cin >> x[i];
		minX = min(minX, x[i]);
		maxX = max(maxX, x[i]);
	}

	int minPower = INT_MAX;
	for (int i = minX; i <= maxX; ++i) {
		int power = 0;
		for (int j = 0; j < x.size(); ++j) {
			power += pow(i - x[j], 2);
		}
		minPower = min(minPower, power);
	}

	cout << minPower << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#define int long long
using namespace std;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int mypow(int x, int y) {
	if (y == 0)return 1;
	if (y % 2)return mypow(x, y - 1)*x;
	else return mypow(x, y / 2)*mypow(x, y / 2);
}

/*ライブラリゾーン！！！！！！！！！！！！！！！*/
int n, k, x[100005],ans=1000000000;
signed main(){
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> x[i];
	for (int i = 0; i <= n - k; i++) {
		int cnt = x[i + k - 1] - x[i] + min(abs(x[i]), abs(x[i + k - 1]));
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 2048
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
typedef long double ld;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


//typedef vector<ll> vcL;
//typedef vector<vcL> vvL;
const ll mod = 1e9 + 7;
ll X[maxn], Y[maxn];
ll dp[maxn][maxn];
ll n, m;


void solve()
{
    //vvL dp( n+1, vcL( m+1, 1 ) );
    //vector<vector<ll> > dp(n+1, vector<ll> (m+1, 1));
    //for(int i = 0; i <= n; i++){
       // for(int j = 0; j <= m; j++) cerr << dp[i][j] << " ";
           // cerr << endl;
   // }
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= m; j++){
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
            if(X[i] == Y[j]) dp[i][j] += dp[i - 1][j - 1];
            dp[i][j] = (dp[i][j] + 10 * mod) % mod;

        }
    }
    cout << dp[n][m]<< "\n";
}


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    cin >> n >> m;
    for(ll i = 1; i <= n; i++) cin >> X[i];

    for(ll i = 1; i <= m; i++) cin >> Y[i];

    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++)dp[i][j] = 1;
    }
    solve();
    //double end_time = clock();
    //prllf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}


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

namespace AtCoderBeginnerContest153
{
	class Program
	{
		static void Main(string[] args)
		{
			var numbers = ReadIntArray();
			var monsters = ReadLongArray();

			if(numbers[0] <= numbers[1])
			{
				Console.WriteLine(0);
			}
			else
			{
				Console.WriteLine(monsters.OrderByDescending(x => x).Skip(numbers[1]).Sum());
			}
		}

		public static int ReadInt()
			=> int.Parse(Console.ReadLine());

		public static int[] ReadIntArray()
			=> Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

		public static long ReadLong()
			=> long.Parse(Console.ReadLine());

		public static long[] ReadLongArray()
			=> Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

		public static string ReadString()
			=> Console.ReadLine();

		public static string[] ReadStringArray()
			=> Console.ReadLine().Split();
	}
}


Measured memory_bytes: 38912
#include<stdio.h>

int main(){
  int s, m, h;

  scanf("%d", &s);

  h = s / 3600;
  m = (s % 3600) / 60;
  s = (s % 3600) % 60;

  printf("%d:%d:%d\n", h,m,s);

  return 0;
}


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

int main(){
  int a, l;
  cin >> a >> l;
  if (l%2 == 1){ cout << "No"; }
  else if (l < a*2){ cout << "No";}
  else if (l > a*4){cout << "No";}
  else {cout << "Yes";}
    
  
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include<string>
#include<deque>

using namespace std;


int main()
{
	string s1,s2;
	cin>>s1>>s2;
	int as=0;
	int a= s1.size();

	for (int i = 0; i < a; ++i)
	{
		if (s1[i]!=s2[i])
		{
			as+=1;
		}
	}

	cout<< as;

	return 0;
}


Measured memory_bytes: 3860
#include "bits/stdc++.h"
using namespace std;

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template<typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	bool ans = false;
	for (int a = A; a <= A * B; a += A)
		if (a % B == C)
			ans = true;

	YN(ans);
	
	return 0;
}

Measured memory_bytes: 256