akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000005 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    ll N;
    cin>>N;
    vector<int> L(N);
    rep(i,N) cin>>L[i];
    ll ans=0;
    sort(L.begin(),L.end());
    for(int a=2;a<N;a++){
        for(int b=1;b<a;b++){
            int c=upper_bound(L.begin(),L.begin()+b,L[a]-L[b])-L.begin();
            ans+=max(b-c,0);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int n, k, h[100000], ans = 1e9;

int main() {
    cin >> n >> k;
    rep(i, n) cin >> h[i];
    sort(h, h + n);
    for (int i = k - 1; i < n; i++) {
        ans = min(ans, h[i] - h[i-k+1]);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
const ll mod = 1e9 + 7;
 
int main() {
  ll h, w;
  cin >> h >> w;
  ll tot = h*w;
  if (h%3 == 0 || w%3 == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = min((h % 3 != 0) * w, (w % 3 != 0) * h);
  for (int _ = 0; _ < 2; _++) {
    for (ll i = 1; i < h; i++) {
      ll x = w * i;
      ll y = w / 2 * (h - i);
      ll z = tot - x - y;
      ans = min(ans, max({x, y, z}) - min({x, y, z}));
    }
    swap(h, w);
  }
  for (int _ = 0; _ < 2; _++) {
    for (ll i = 1; i < h-1; i++) {
      ll x = w * i;
      ll y = (h - i) / 2;
      ll z = tot - x - y;
      ans = min(ans, max({x, y, z}) - min({x, y, z}));
    }
    swap(h, w);
  }
  assert(ans != LLONG_MAX);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define MOD 1000000007

int main(){
	int N,K;
	cin >> N >> K;
	string S;
	cin >> S;
	vector<int> v;
	for(int i=0; i<S.size(); i++){
		if(i == 0 || S[i-1] != S[i]) v.PB(0);
		v[v.size()-1]++;
	}
	if(S[0] == '0') v.insert(v.begin(),0);
	if(v.size()%2 == 0) v.PB(0);

	int tmp = 0;
	for(int i=0; i<min((int)v.size(), 2*K+1); i++){
		tmp += v[i];
	}
	int ans = tmp;
	int j = 0;
	for(int i=2*K+1; i<v.size(); i+=2){
		tmp -= v[j];
		tmp -= v[j+1];
		tmp += v[i];
		tmp += v[i+1];
		j += 2;
		ans = max(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


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

#define N 500

using namespace std;

int main(void) {
    int i;
    int hash[N];
    char c;
    string w, ans;
    // get input ----------------------------
    cin >> w;
    // init hash ----------------------------
    for(i = 0; i < N; i++) {
        hash[i] = 0;
    }
    // check --------------------------------
    for(i = 0; i < w.size(); i++) {
        c = w[i];
        hash[c]++;
    }
    ans = "Yes";
    for(i = 0; i < N; i++) {
        if(hash[i]%2 == 1) {
            ans = "No";
            break;
        }
    }
    // disp answer --------------------------
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// abc114_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)
#define CHAR2INT(c) (c - '0')

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    int ans = 0;
    REPN(d, 3, 10){
        int p = pow(3, d);

        string s = "357";
        REP(i, p){
            string tmp;
            int pp = i;
            REP(k, d){
                tmp += s[pp % 3];
                pp /= 3;
            }
            int n = stoi(tmp);

            if (count(ALL(tmp), '3') > 0 && count(ALL(tmp), '5') > 0 && count(ALL(tmp), '7') > 0 && n <= N){
                ans++;
            }
        }
    }

    print(ans);

    return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    for (int i = 0; i < 12; ++i) {
        cout << S[i];
        if (i == 3) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    vector<int> v(3);
    REP(i,3) cin >> v[i];
    REP(i,3) {
        if (v[i] % 2 != 0) {
            OUT(0)
            return 0;
        }
    }

    if (v[0] == v[1] && v[1] == v[2]) {
        OUT(-1)
        return 0;
    }

    int ans = 0;
    bool loop = true;
    while(loop) {
        vector<int> tmp(3);
        REP(i,3) tmp[i] = v[(i+1) % 3] / 2 + v[(i+2) % 3] / 2;
        swap(tmp,v);
        ans++;
        REP(i,3) {
            if (v[i] % 2 != 0) loop = false;
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
from itertools import product

H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]
P=[(0,1),(0,-1),(1,0),(-1,0)]

for x,y in product(range(W),range(H)):
    if S[y][x]!="#":
        continue

    b_flg=False
    for p in P:
        c_y=y+p[0]
        c_x=x+p[1]
        if c_x <0 or c_x>=W or c_y<0 or c_y>=H: 
            continue
        if S[c_y][c_x]=="#":
            b_flg=True

    if b_flg==False:
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 3064
# include <iostream>
# include <cmath>
# include <set>
# include <map>
# include <algorithm>

using namespace std;

int main()
{
    long long n, a;
    long long x[55];
    cin >> n >> a;
    long long dp[55][55][n*a+10];
    x[0] = 0;
    for (int i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }
    sort(x, x + n + 1);
    for (int j = 0; j <= n; ++j)
    {
        for (int k = 0; k <= n; ++k)
        {
            for (int s = 0; s <= k*a; ++s)
            {
                if(j + k + s == 0)
                    dp[j][k][s] = 1;
                else if (j >= 1 && s < x[j])
                    dp[j][k][s] = dp[j-1][k][s];
                else if (j >= 1 && k >= 1 && s >= x[j])
                    dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s - x[j]];
                else
                    dp[j][k][s] = 0;
            }
        }
    }
    long long ans = 0;
    for (int i = 1; i <= n; ++i)
        ans += dp[n][i][i*a];
    cout << ans;
}


Measured memory_bytes: 55936
# N, K = gets.chomp.split.map(&:to_i)
# A = gets.chomp.split.map(&:to_i)

S = gets.chomp

h = {}
S.chars.each do |c|
  h[c] ||= 0
  h[c] += 1
end

# p h

a = h.values
# p a

if a.size == 2 && a[0] == 2 && a[1] == 2
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 3836
#include <cmath>
#include <iostream>
#include <limits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace libcomp {
namespace geometry {
static const double EPS = 1e-9;
inline double abs(double x){ return std::abs(x); }
inline bool tolerant_eq(double a, double b){ return abs(a - b) < EPS; }
}
}
namespace libcomp {
namespace geometry {
struct Point {
	double x;
	double y;
	explicit Point(const double &x = 0.0, const double &y = 0.0) :
		x(x), y(y)
	{ }
	static Point invalid(){
		double qnan = numeric_limits<double>::quiet_NaN();
		return Point(qnan, qnan);
	}
	bool is_valid() const { return !(std::isnan(x) || std::isnan(y)); }
	Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
	Point &operator+=(const Point &p){ return *this = *this + p; }
	Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
	Point &operator-=(const Point &p){ return *this = *this - p; }
	Point operator*(double s) const { return Point(x * s, y * s); }
	Point &operator*=(double s){ return *this = *this * s; }
	Point operator*(const Point &p) const {
		return Point(x * p.x - y * p.y, x * p.y + y * p.x);
	}
	Point &operator*=(const Point &p){ return *this = *this * p; }
	Point operator/(double s) const { return Point(x / s, y / s); }
	Point &operator/=(double s){ return *this = *this / s; }
	bool operator==(const Point &p) const { return x == p.x && y == p.y; }
	bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
	bool operator<(const Point &p) const {
		return (x == p.x) ? (y < p.y) : (x < p.x);
	}
	double abs() const { return sqrt(x * x + y * y); }
	double norm() const { return x * x + y * y; }
	Point unit() const { return *this / abs(); }
	Point ortho() const { return Point(-y, x); }
};
inline Point operator*(double s, const Point &p){ return p * s; }
inline bool tolerant_eq(const Point &a, const Point &b){
	return tolerant_eq(a.x, b.x) && tolerant_eq(a.y, b.y);
}
inline double cross(const Point &a, const Point &b){
	return a.x * b.y - a.y * b.x;
}
inline double dot(const Point &a, const Point &b){
	return a.x * b.x + a.y * b.y;
}
inline int ccw(const Point &a, const Point &b, const Point &c){
	Point d = b - a, e = c - a;
	if(cross(d, e) > 0.0){ return 1; }
	if(cross(d, e) < 0.0){ return -1; }
	if(dot(d, e) < 0.0){ return 2; }
	if(d.abs() < e.abs()){ return -2; }
	return 0;
}
}
}
namespace geom = libcomp::geometry;
const char *TABLE[] = {
	"ONLINE_FRONT",
	"CLOCKWISE",
	"ON_SEGMENT",
	"COUNTER_CLOCKWISE",
	"ONLINE_BACK"
};
int main(){
	ios_base::sync_with_stdio(false);
	geom::Point a, b;
	cin >> a.x >> a.y >> b.x >> b.y;
	int T;
	cin >> T;
	while(T--){
		geom::Point c;
		cin >> c.x >> c.y;
		cout << TABLE[geom::ccw(a, b, c) + 2] << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N; cin >> N;
    vec a(3 * N); readvec(a);

    vec S1(N + 1), S2(N + 1);
    int S = 0;
    priority_queue<int> que1;
    REP(i, N){
        S += a[i];
        que1.push(-1 * a[i]);
    }
    S1[0] = S;
    REP(i, N){
        if(a[N + i] > -1 * que1.top()){
            S1[i + 1] = S1[i] + a[N + i] + que1.top();
            que1.pop();
            que1.push(-1 * a[N + i]);
        }else{
            S1[i + 1] = S1[i];
        }
    }

    S = 0;
    priority_queue<int> que2;
    REP(i, N){
        S += a[3 * N - i - 1];
        que2.push(a[3 * N - i - 1]);
    }
    S2[N] = S;
    REP(i, N){
        if(a[2 * N - i - 1] < que2.top()){
            S2[N - i - 1] = S2[N - i] + a[2 * N - i - 1] - que2.top();
            que2.pop();
            que2.push(a[2 * N - i - 1]);
        }else{
            S2[N - i - 1] = S2[N - i];
        }
    }

    int ans = -1 * INF;
    REP(i, N + 1) ans = max(ans, S1[i] - S2[i]);

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 6516
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    char c;
    cin >> c;
    char a;
    if(c == 'A')a = 'T';
    else if(c == 'T')a = 'A';
    else if(c == 'C')a = 'G';
    else if(c == 'G')a = 'C';
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip("\n") for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
#def OutH(lst): print(*lst) ## not used for pypy
#def OutV(lst): print(*lst, sep="\n") ## not used for pypy
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

## 貪欲法で、その日に一番スコアが高くなるテストをする
## input txt: AtCoder_200628_heuristics_A_input.txt

N_ALP = 26

D = iIn()
C = iInLH()
S = iInLD(D)

T = []
score = 0
past = [0] * N_ALP
for i in range(D):
    ## 一番スコアが高くなるテストを探す
    ## その日テストiを行うと（相対的に）S[i][T[i]] + C[i] * (past[i]+1) がもらえる
    max_score = 0
    max_idx = 0
    for j in range(N_ALP):
        this_score = S[i][j] + C[j] * (past[j] + 1)
        if this_score > max_score:
            max_idx = j
            max_score = this_score
    T.append(max_idx)
    score += S[i][T[i]]
    past = [x+1 for x in past]
    past[T[i]] = 0
    for j in range(N_ALP):
        score -= C[j] * past[j]
    print(T[i] + 1)

#print(score)

Measured memory_bytes: 68672
#include<iostream>
 
int gcd(int x, int y){
    if(x % y == 0){
        return y;
    } else {
        gcd(y, x%y);
    }
}
 
int main() {
    int x, y, swp;
    std::cin >> x >> y;
    if( x < y ){
        swp = x;
        x = y;
        y = swp;
    } 
    std::cout << gcd(x,y) << std::endl;
    return 0; 
}

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

long long int height_(vector < long long int> &height, vector <int> &h, int k)
{
    int i, j;
    for(i = 2; i < h.size(); i++)
    {   long long int mini= INT_MAX;
        for(j = i - 1; j >= 0 && i - j <= k; j--)
        {
            int cost = abs(h[i] - h[j]) + height[j];
            if(cost < mini)
            {
                mini = cost;
                
            }
        }
        height[i] = mini;
       
    }
    /*for(i = 0; i < height.size(); i++)
        cout << height[i] << " ";*/

    return height.back();

}

int main()
{
    int n, k;
    cin >> n >> k;
    vector <int> h(n);
    for(int i = 0; i < n; i++)
        cin >> h[i];
    
    vector <long long int> height(n);
    height[0] = 0;
    height[1] = llabs(h[1] - h[0]);
    cout << height_(height, h, k) << endl;
  

}


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

int main(){
     int m,f,r;
     
     while(1){
          cin>>m>>f>>r;
          if(m==-1&&f==-1&&r==-1) break;
          if(m==-1||f==-1) cout<<"F"<<endl;
          else if(m+f>=80) cout<<"A"<<endl;
          else if(80>m+f&&m+f>=65) cout<<"B"<<endl;
          else if(65>m+f&&m+f>=50) cout<<"C"<<endl;
          else if(50>m+f&&m+f>=30){
               if(r>=50) cout<<"C"<<endl;
               else cout<<"D"<<endl;
          }
          else if(30>m+f) cout<<"F"<<endl;
     }
}

Measured memory_bytes: 3080
def popcount(n):
    ret = 0
    while n > 0:
        ret += n & 1
        n >>= 1
    return ret

def f(n):
    ret = 0
    while n > 0:
        n %= popcount(n)
        ret += 1
    return ret

def mod(x, d):
    '''
    x % d where x: string, d: int
    '''
    rem = 0
    for i in range(len(x)):
        divd = (rem << 1) + int(x[i], 2)
        rem = divd % d

    return rem

N = int(input())
X = input()

popx = X.count('1')
qp = mod(X, popx + 1)  # X mod (popcount(X) + 1)
if popx - 1 > 0:
    qm = mod(X, popx - 1)   # X mod (popcount(X) - 1)

ans = []
pow2p = pow2m = 1
for i in range(N):
    if X[N - 1 - i] == '1':
        if popx == 1: # X_iが0
            ans.append(0)
        else:
            next = (qm - pow2m) % (popx - 1)
            ans.append(1 + f(next))
    else:  #  X[N - 1 - i] == '0'
        next = (qp + pow2p) % (popx + 1)
        ans.append(1 + f(next))

    pow2p = pow2p * 2 % (popx + 1)
    if popx > 1:
        pow2m = pow2m * 2 % (popx - 1)

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

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

enum week{
	SUN,MON,TUE,WED,THU,FRI,SAT
};

int main(){
	vector<string> s{"SUN","MON","TUE","WED","THU","FRI","SAT"};
	string S;
	cin >> S;
	int i = 0;
	for(string a: s){
		if(a==S) break;
		i++;
	}
	std::cout << 7-i << std::endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
using namespace std;
using ll = long long;

int main(){
    string S;
    cin>>S;
    if(S=="hi"||S=="hihi"||S=="hihihi"||S=="hihihihi"||S=="hihihihihi"){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;



}
 

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

public class Main{
	
	public static void main(String[] args) throws Exception{
    	
      	InputStream inputStream = System.in;
      	OutputStream outputStream = System.out;
      	InputReader in = new InputReader(inputStream);
      	PrintWriter out = new PrintWriter(outputStream);
      	Task solver = new Task();
      	solver.solve(in,out);
		out.close();
      
    }
  
  	static class Task{
    	public void solve(InputReader in , PrintWriter out){
        	
          	int x = in.nextInt();
          	int a = in.nextInt();
          
          
          	if(x < a)
              	out.println("0");
          	else 
              	out.println("10");
          
        }
    }
  	
  	static class InputReader{
    	
      	BufferedReader reader;
      	StringTokenizer tokenizer;
      
      	public InputReader(InputStream inputStream){
        	reader = new BufferedReader(new InputStreamReader(inputStream));
          	tokenizer = null;
        }
      
      	public String next(){
        	while(tokenizer == null || !tokenizer.hasMoreTokens()){
            	try{
                	tokenizer = new StringTokenizer(reader.readLine());
                }
              	catch(IOException e){
                	throw new RuntimeException(e);
                }
            }
          return tokenizer.nextToken();
        }
      
      public int nextInt(){
      	return Integer.parseInt(next());
      }
    }
}

Measured memory_bytes: 21332
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>

using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int diffX = (x2 - x1);
	int diffY = (y2 - y1);
	cout << x2 - diffY << " " << y2 + diffX << " " << x1 - diffY << " " << y1 + diffX;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<iomanip>
using namespace std;

#define ll long long

int main(void){

    double x,t;
    cin>>x>>t;
    cout<<std::setprecision(10)<<x/t<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>>data(h, vector<char>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++)
      cin >> data.at(i).at(j);
  }
  
  int dx[8] ={-1,0,1,1,1,0,-1,-1};
  int dy[8] ={-1,-1,-1,0,1,1,1,0};
  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if(data.at(i).at(j) == '#')
        continue;
      int num=0;
      for(int d=0; d<8; d++){
        int ni = i+dy[d];
        int nj = j+dx[d];
        if((ni<0) or (h <= ni))
          continue;
        if((nj<0) or (w <= nj))
          continue;
        if(data.at(ni).at(nj) == '#')
          num++;
      }
      data.at(i).at(j) = char(num+'0');
    }
  }
  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cout << data.at(i).at(j);
    }
    cout << endl;
  }
}

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

ll h[100000];
ll dp[100010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

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

	fill((ll*)begin(dp), (ll*)end(dp), 1LL << 50);
	dp[0] = 0;
	for(int i = 0; i < N; i++){
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
	}
	cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####
from collections import defaultdict as ddic, Counter, deque
import heapq, bisect, itertools
MOD = 10 ** 9 + 7

D,T,S=rrm()
move = T*S
if move >= D:
    print "Yes"
else:
    print "No"

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 998244353;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

template<int64 mod>
struct ModInt{
  int64 x;
  constexpr ModInt(int64 y = 0):x((y%mod+mod)%mod){}
  constexpr ModInt& operator+=(const ModInt& a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& a){
    if((x -= a.x) < 0)x += mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& a){
    x = x * a.x % mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& a){
    *this *= a.inv();
    return *this;
  }
  constexpr ModInt operator-() const {
    return ModInt(-x);
  }
  constexpr ModInt operator+(const ModInt& a) const {
    return ModInt(*this) += a;
  }
  constexpr ModInt operator-(const ModInt& a) const {
    return ModInt(*this) -= a;
  }
  constexpr ModInt operator*(const ModInt& a) const {
    return ModInt(*this) *= a;
  }
  constexpr ModInt operator/(const ModInt& a) const {
    return ModInt(*this) /= a;
  }
  constexpr ModInt operator++(){
    *this += ModInt(1);
    return *this;
  }
  constexpr ModInt operator++(int){
    ModInt old = *this;
    ++*this;
    return old;
  }
  constexpr ModInt operator--(){
    *this -= ModInt(1);
    return *this;
  }
  constexpr ModInt operator--(int){
    ModInt old = *this;
    --*this;
    return old;
  }
  constexpr bool operator==(const ModInt& a) const {
    return x == a.x;
  }
  constexpr bool operator!=(const ModInt& a) const {
    return x != a.x;
  }
  constexpr ModInt pow(int64 r) const {
    if(!r)return 1;
    ModInt res = pow(r>>1);
    res *= res;
    if(r & 1) res *= *this;
    return res;
  }
  constexpr ModInt inv() const {
    return pow(mod-2);
  }
  friend istream& operator>>(istream& is, ModInt& a){
    int64 t;
    is >> t;
    a = ModInt(t);
    return is;
  }
  friend ostream& operator<<(ostream& os, const ModInt& a){
    return os << a.x;
  }
};
using mint = ModInt<MOD>;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,m,k;
  cin >> n >> m >> k;

  vector<mint> fact(n+1,1);
  REP(i,n)fact[i+1] = fact[i] * (i+1);
  vector<mint> ifact(n+1);
  ifact[n] = fact[n].inv();
  FORR(i,n,1)ifact[i-1] = ifact[i] * i;
  auto comb = [&](int32 n, int32 r){return fact[n] * ifact[n-r] * ifact[r];};

  mint ans = 0;
  mint cur = m;
  REP(i,n-k-1)cur *= (m-1);
  FORR(i,k,0){
    // cout << i << " " << cur << " " << comb(n-1,i) << endl;
    ans += cur * comb(n-1,i);
    cur *= (m-1);
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 6320
import java.util.Scanner;
import java.util.HashSet;

class Main{
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		sc.close();
			
		for(int i = 0; i <= N; i++) {
			for(int j = 0; j <= N-i; j++) {
				int k = N - i -j;
				if(i + j + k == N) {
					if(Y == 10000*i+5000*j+1000*k) {
						System.out.println(i +" "+ j + " " + k);
						System.exit(0);
					}
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>void print(T x){cout << x << endl;}
template<class T>void printvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int n, x, y; cin >> n >> x >> y;
    vector<int> ans(n, 0);
    rep(i, n){
        FOR(j, i+1, n){
            ans[min(j-i, abs(x-1-i) + abs(y-1-j)+1)]++;
        }
    }
    FOR(i, 1, n){
        printf("%d\n", ans[i]);
    }
    return 0;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

// a^b mod を計算する
ll mod_pow(ll a, ll b, ll p) {
    if (b == 0) return 1;
    if (b & 1) return (a * mod_pow(a, b - 1, p)) % p;
    ll t = mod_pow(a, b / 2, p);
    return (t * t) % p;
}

ll mod_inv(ll a, ll p) { return mod_pow(a, p - 2, p); }
 
ll mod_comb(ll n, ll r, ll p) {
    ll tn = 1, tr = 1;
    for (int i = n; i > n - r; i--) {
        tn *= i;
        tn %= p;
    }
    for (int i = r; i > 0; i--) {
        tr *= i;
        tr %= p;
    }
    return tn * mod_inv(tr, p) % p;
}

signed main()
{   
    gearup;
    ll x,y; cin >> x >> y;
    if(x < y)swap(x,y);
    if(((x+y) % 3) != 0 || x > 2*y){
        out(0);
        return 0;
    }
    ll x1 = (2*x-y)/3;
    ll y1 = (2*y-x)/3;
    ll res = mod_comb(x1+y1,x1,MOD);
    out(res);
}


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

int n,a[maxn],b[maxn],ans=0;
int main()
{
	cin>>n;
	for(int i=1;i<n;++i) cin>>a[i];
	b[1]=a[1],b[2]=a[1];
	for(int i=2;i<n;++i) 
	{
		b[i+1]=a[i];
		b[i]=min(a[i-1],a[i]);
	}
	for(int i=1;i<=n;++i) ans+=b[i];
	cout<<ans;
	return 0;
} 

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

vector<int> primes;

void sieve(){
  int n = 123457 * 2;
  bool isPrime[n] = {false};
  isPrime[0] = true;
  isPrime[1] = true;

  for(int i = 2; i <= n; i++){
    if(!isPrime[i]){
      primes.push_back(i);
      for(int j = i; j <= n; j += i){
        isPrime[j] = true;
      }
    }
  }
}
int main(){
  int n;
  sieve();
  while(cin >> n, n){
    int cnt = 0;
    for(int i = 0; i < primes.size(); i++){
      if(primes[i] > n && primes[i] <= 2 * n){
        cnt++;
      }
    }
    cout << cnt << endl;
  }
}

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

int main() {
  int N, M; //N:都市の数, M:道路の数
  cin >> N >> M;
  vector<int> vec(M * 2);
  for (int i = 0; i < vec.size(); i++) {
    cin >> vec.at(i);
  }
  
  //N:都市の数だけ繰り返す
  for (int i = 0; i < N; i++) {
    //配列の要素の数だけ繰り返す
    int sum = 0;
    for (int j = 0; j < vec.size(); j++) {
      
      if (vec.at(j) == i + 1) {
        sum++;
      }
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 256
N = int(raw_input())
T, A = map(int, raw_input().split())
H = map(int, raw_input().split())
min = 10000000
ans = -1
for i in range(0, N):
	temp = 1000*T - 6*H[i]
	if abs(temp-1000*A) < min:
		min = abs(temp-1000*A)
		ans = i+1

print ans

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
//    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int a[]=sc.nextIntArray(n);
        long dp[][] = new long[n][n];
        for (int i = 0; i < dp.length; i++) {
			fill(dp[i],Long.MAX_VALUE);
		}

        out.println(rep(0,n-1,0,a,dp));
        out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    static long rep(int l, int r, int c, int a[], long dp[][]) {
    	if(dp[l][r]!=Long.MAX_VALUE) return dp[l][r];
    	if(l==r) {
    		return dp[l][r] = c%2==0 ? a[l]:-a[l];
    	}
		long L=dp[l+1][r]!=Long.MAX_VALUE?dp[l+1][r]:rep(l+1,r,c+1,a,dp);
		long R=dp[l][r-1]!=Long.MAX_VALUE?dp[l+1][r-1]:rep(l,r-1,c+1,a,dp);
		return dp[l][r] = (c%2==0 ? max(a[l]+L, a[r]+R) : min(-a[l]+L, -a[r]+R));
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main(){
  int n,m;
  map<string, int> point;

  cin >> n;
  rep(i,n){
    string s; cin >> s;
    point[s]++;
  }

  cin >> m;
  rep(i,m){
    string s; cin >> s;
    point[s]--;
  }

  int ans = 0;
  for(auto itr = point.begin(); itr != point.end(); itr++){
    int p = itr->second;
    ans = max(ans, p);
  }

  cout << ans << endl;
}


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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}

int h, w;
int n;
int a[120][120];

int main() {
    cin >> h >> w;
    cin >> n;
    int x = 0;
    int y = 0;
    for (int i = 0; i < n; ++i) {
        int c;
        cin >> c;
        while (c--) {
            a[x][y] = i;
            if (x % 2 == 0) {
                ++y;
                if (y == w)
                    y = w - 1, ++x;
            }
            else {
                --y;
                if (y == -1)
                    y = 0, ++x;
            }
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j)
            cout << a[i][j] + 1 << " ";
        cout << "\n";
    }
    return 0;
}




Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main(){
  int a[3];
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  qsort(a, 3, sizeof(int), compare_int);
  int ans;
  ans=10*a[2]+a[0]+a[1];
  printf("%d", ans);
  return 0;
}

  
    


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;

#define YES(condition) if(condition){ cout << "YES" << endl; }else{ cout << "NO" << endl; }
#define Yes(condition) if(condition){ cout << "Yes" << endl; }else{ cout << "No" << endl; }
#define Poss(condition) if(condition){ cout << "Possible" << endl; }else{ cout << "Impossible" << endl; }

template< typename T >
struct edge {
    int src, to;
    T cost;
    
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    
    operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s)
{
    const auto INF = numeric_limits< T >::max();
    vector< T > dist(g.size(), INF);
    
    using Pi = pair< T, int >;
    priority_queue< Pi, vector< Pi >, greater< Pi > > que;
    dist[s] = 0;
    que.emplace(dist[s], s);
    while(!que.empty()) {
        T cost;
        int idx;
        tie(cost, idx) = que.top();
        que.pop();
        if(dist[idx] < cost) continue;
        for(auto &e : g[idx]) {
            auto next_cost = cost + e.cost;
            if(dist[e.to] <= next_cost) continue;
            dist[e.to] = next_cost;
            que.emplace(dist[e.to], e.to);
        }
    }
    return dist;
}

int main(){
    int K;
    cin >> K;
    WeightedGraph<int> roads(K);
    for(int i = 0; i < K; i++){
        roads[i].push_back({-1, (i * 10) % K, 0});
        roads[i].push_back({-1, (i + 1) % K, 1});
    }
    cout << dijkstra(roads, 1)[0] + 1 << endl;
}



Measured memory_bytes: 6780
#include<cstdio>
long long a[3],s;
int main(){
	int t;
	scanf("%lld%lld%lld",&a[0],&a[1],&a[2]);
	for(int i=0;i<=2;i++)
		if(a[i]%2==0)
			s++;
	for(int i=0;i<=2;i++)
		for(int j=i;j<=2;j++)
			if(a[i]>a[j]){
				t=a[i];
				a[i]=a[j];
				a[j]=t;
			}
	if(s==1||
		s==2||s==3)
		printf("0");
	else
		printf("%lld",a[0]*a[1]);
}

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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
    int n;
    cin >> n;
    int ans = n;
    REP(i,n+1) {
        int withdraw = 0;
        int first = i;
        while(first > 0) {
            withdraw += first % 6;
            first /= 6;
        }
        int second = n - i;
        while(second > 0) {
            withdraw += second % 9;
            second /= 9;
        }
        ans = min(ans, withdraw);
    }
    cout << ans;
    cout << "\n";
    return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1000;
const int inf=1e9;
int main(){
	int H,W;cin>>H>>W;
    char a[size][size];
    long dp[size+1][size+1]={};
	rep(i,0,H)rep(j,0,W){
		cin>>a[i][j];
	}dp[0][1]=1;
	rep(i,1,H+1)rep(j,1,W+1){
		if(a[i-1][j-1]=='.') dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
	}cout<<dp[H][W]<<endl;
}

Measured memory_bytes: 9088
///supercalifragilisticexpialidocious.
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
int a[3];
int32_t main()
{
	for(int i = 0 ; i < 3 ; i ++)
        cin >> a[i];
    sort(a , a + 3);
    if(!(a[0] % 2) || !(a[1] % 2) || !(a[2] % 2))
        return cout << 0 << endl , 0;
    return cout << a[0] * a[1] << endl , 0;
}


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

const int INF = 2000000000;

int main() {
  int D, G;cin >> D >> G;
  int p[D], c[D];
	for(int i = 0; i < D;i++){
		cin >> p[i] >> c[i];
	}
	//Bit全探索
	int minc = INF;
  for(int bit = 0; bit < (1 << D); ++bit){
		int count = 0;// 解く問題の個数
		int point = 0;//ポイント
		vector<int> S;// 解き切る問題のIndex
		int high;//中途半端に解く問題のIndex
		//解き切る問題のIndex集計
		for( int i = 0; i < D; ++i){
			if (bit & (1 << i)) {
				S.push_back(i);
				// cout << i <<"とく";
			}else{
				high=i;
			}
		}
		//解き切る問題の計算
		for(int i=0;i<(int)S.size(); ++i){
			count += p[S[i]];
			point += p[S[i]]*(S[i]+1)*100 + c[S[i]];
		}
		// cout << "とききった" <<point << endl;

		for(int i=0;i<p[high] -1;i++){
			if(point < G){
				count ++;
				point+= (high+1)*100;
			}
		}
		if(point >= G) minc = min(minc, count);

		// cout << "おわった" << point << endl;
		// cout << "そのときの数" <<count << endl;
  }
	cout << minc << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;

class Main {

    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String data;
        char tmp;
        int num, input;
        Queue<Character> q = new LinkedList<Character>();

        try {
            while (!(data = br.readLine()).equals("-")) {
                for (int i = 0; i < data.length(); i++)
                    q.offer(data.charAt(i));
                num = Integer.parseInt(br.readLine());
                for (int i = 0; i < num; i++) {
                    input = Integer.parseInt(br.readLine());
                    for (int j = 0; j < input; j++) {
                        tmp = q.poll();
                        q.offer(tmp);
                    }
                }
                while (!q.isEmpty())
                    System.out.print(q.remove());
                System.out.print("\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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

constexpr long long MOD = 1000000007;

int N;
vector<vector<int> > V;
vector<int> Par;
vector<long long> Size;
vector<long long> DP1, DP2;
vector<long long> ANS;

long long Comb(int A, int B) {
	const int NUM = 200000;
	static long long F[NUM + 1], RF[NUM + 1], INV[NUM + 1];
	if (F[0] == 0) {
		F[0] = RF[0] = INV[1] = 1;
		for (int i = 2; i <= NUM; i++) {
			INV[i] = (INV[MOD % i] * (MOD - MOD / i)) % MOD;
		}
		for (int i = 1; i <= NUM; i++) {
			F[i] = (F[i - 1] * i) % MOD;
			RF[i] = (RF[i - 1] * INV[i]) % MOD;
		}
	}
	if (B < 0 || A < B) return 0;
	return (F[A] * ((RF[B] * RF[A - B]) % MOD)) % MOD;
}

long long Pow(int A, int B = MOD - 2) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		long long C = Pow(A, B / 2);
		return (C * C) % MOD;
	}
	return (A * Pow(A, B - 1)) % MOD;
}

void DFS1(int P, int Q) {
	Par[P] = Q;
	Size[P] = 1;
	int PID = -1;
	for (int i = 0; i < V[P].size(); i++) {
		int NP = V[P][i];
		if (NP == Q) PID = i;
		else {
			DFS1(NP, P);
			Size[P] += Size[NP];
		}
	}
	if (PID != -1) {
		swap(V[P][PID], V[P][V[P].size() - 1]);
		V[P].pop_back();
	}
}

void DFS2(int P) {
	DP1[P] = 1;
	int NOW = 0;
	for (int i = 0; i < V[P].size(); i++) {
		int NP = V[P][i];
		DFS2(NP);
		NOW += Size[NP];
		DP1[P] *= (DP1[NP] * Comb(NOW, Size[NP])) % MOD;
		DP1[P] %= MOD;
	}
}

void DFS3(int P) {
	long long COUNT = DP2[P];
	int NOW = N - Size[P];
	for (int i = 0; i < V[P].size(); i++) {
		int NP = V[P][i];
		NOW += Size[NP];
		COUNT *= (DP1[NP] * Comb(NOW, Size[NP])) % MOD;
		COUNT %= MOD;
	}
	ANS[P] = COUNT;
	for (int i = 0; i < V[P].size(); i++) {
		int NP = V[P][i];
		DP2[NP] = (COUNT * Pow((DP1[NP] * Comb(N - 1, Size[NP])) % MOD)) % MOD;
		DFS3(NP);
	}
}

int main() {
	cin >> N;
	V.resize(N);
	Par.resize(N);
	Size.resize(N);
	DP1.resize(N);
	DP2.resize(N);
	ANS.resize(N);
	for (int i = 0; i < N - 1; i++) {
		int A, B;
		cin >> A >> B;
		A--, B--;
		V[A].push_back(B);
		V[B].push_back(A);
	}
	DFS1(0, -1);
	DFS2(0);
	DP2[0] = 1;
	DFS3(0);
	for (int i = 0; i < N; i++) {
		cout << ANS[i] << endl;
	}
}

Measured memory_bytes: 25588
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] a = new int[4];
        a[0] = Character.getNumericValue(s.charAt(0));
        a[1] = Character.getNumericValue(s.charAt(1));
        a[2] = Character.getNumericValue(s.charAt(2));
        a[3] = Character.getNumericValue(s.charAt(3));
        String[] op = new String[3];
        dfs(a, op, 0);
        System.out.println(a[0] + op[0] + a[1] + op[1] + a[2] + op[2] + a[3] + "=7");
    }

    private static boolean dfs(int[] a, String[] op, int n) {
        int sum = 0;
        if (n == 3) {
            sum = sumsub(op[0], a[0], a[1]);
            sum = sumsub(op[1], sum, a[2]);
            sum = sumsub(op[2], sum, a[3]);
            return sum == 7;
        }
        op[n] = "+";
        if (dfs(a, op,n + 1)) {
            return true;
        }
        op[n] = "-";
        if (dfs(a, op,n + 1)) {
            return true;
        }
        return false;
    }

    private static int sumsub(String op, int a, int b) {
        if ("+".equals(op)) {
            return a + b;
        } else {
            return a - b;
        }
    }
}

Measured memory_bytes: 21716
#include<iostream>

using namespace std;

int main() {
  int K, S;
  cin >> K >> S;
  //cout << K << S << endl;
  int ans = 0;
  for (int i = 0; i <= K; ++i) {
    for (int j = K; j >= 0; --j) {
      int k = S - i - j;
      if (k < 0 || K < k) continue;
      //printf("%d %d %d\n", i, j, k);
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616