akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep0(i,n) for(i=0;i<(n);i++)
#define repn(i,m,n) for(int i=(m);i<=(n);i++)
#define all(n) n.begin(),n.end()
#define mp make_pair
#define PUTLINE cout<<__LINE__<<endl;

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

int p[100100];
int cost[100100];

int main() {
	int n;
	cin>>n;
	rep(i,n)cin>>p[i+1];
	priority_queue<pint,vector<pint>,greater<pint> > que;
	rep(i,100100)cost[i]=100100100;
	que.push(mp(0,1));
	while(!que.empty()){
		pint now=que.top();
		que.pop();
		if(now.second>n)continue;
		if(cost[now.second]<=now.first)continue;
		cost[now.second]=now.first;
		if(p[now.second]!=0){
			now.second+=p[now.second];
			que.push(now);
			continue;
		}
		++now.first;
		rep(i,6){
			++now.second;
			que.push(now);
		}
	}
	cout<<cost[n]<<endl;
	return 0;
}

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

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

    int n, m, l;
    cin >> n >> m >> l;

    long long A[100][100], B[100][100], C[100][100];

    for (int i=0; i<n; ++i) {
        for (int j=0; j<m; ++j) {
            cin >> A[i][j];
        }
    }
    for (int i=0; i<m; ++i) {
        for (int j=0; j<l; ++j) {
            cin >> B[i][j];
        }
    }

    for (int i=0; i<n; ++i) {
        for (int j=0; j<l; ++j) {
            C[i][j] = 0;
            for (int k=0; k<m; ++k) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for (int i=0; i<n; ++i) {
        for (int j=0; j<l; ++j) {
            cout << (j == 0 ? "" : " ") << C[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3468
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdio>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	if (k == 1) puts("0");
	else {
		int ans = n - k;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stddef.h>

int indent = 0;

int search(int *data, int left, int right, int x)
{
	for(int i = left; i <= right; ++i)
	{
		if(data[i] == x) { return i; }
	}
	return -1;
}

void reconstruct(int *pre, int pre_idx, int *in, int in_left, int in_right)
{
	if(in_left <= in_right)
	{
		int pos = search(in, in_left, in_right, pre[pre_idx]);
		if(pos != -1)
		{
			int pre_left  = pre_idx + 1;
			int pre_right = pre_idx + 1 + (pos - in_left);

			reconstruct(pre, pre_left,  in, in_left, pos - 1);
			reconstruct(pre, pre_right, in, pos + 1, in_right);
		}
		
		printf("%d", pre[pre_idx]);
		if(pre_idx != 0) { printf(" "); }
	}
}

int main()
{
	int n, pre[40], in[40];
	
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d", &pre[i]);
	}
	for(int i = 0; i < n; ++i)
	{
		scanf("%d", &in[i]);
	}

	reconstruct(pre, 0, in, 0, n-1);
	printf("\n");
}




Measured memory_bytes: 2124
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

map<ll, int> factor(ll n) {
	map<ll, int> ret;
	for(ll i = 2; i * i <= n; i++) {
		while(n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if(n != 1) {
		ret[n] = 1;
	}
	return ret;
}

int main() {
	ll a, b;
	scanf("%lld %lld", &a, &b);

	vector<ll> v1;
	for(auto e : factor(a)) {
		v1.push_back(e.first);
	}
	vector<ll> v2;
	for(auto e : factor(b)) {
		v2.push_back(e.first);
	}
	int result = 0;
	int i = 0;
	int j = 0;
	while(i < v1.size() && j < v1.size()) {
		if(v1[i] == v2[j]) {
			result++;
			i++;
			j++;
		} else if(v1[i] < v2[j]) {
			i++;
		} else {
			j++;
		}
	}
	printf("%d\n", result + 1);

	return 0;
}

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

int main() {
  long long A;
  double B;
  cin >> A >> B;
  int C=B*100+0.5;
  cout << (long long)(A*C)/100 << endl;
}

Measured memory_bytes: 3700
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n, l = wi()
a = []
for i in range(n):
    a.append(l + i)
sumn = sum(a)
b = []
for i in range(n):
    b.append([abs(sumn - (sumn - (l + i))), sumn - (l + i)])
b.sort()
print(b[0][1])

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

int main () {
  string S;
  cin >> S;
  int s = S.size();
  vector<int> x(s);
  for (int i = 0; i < s; i++) {
    if (S.at(i) == '1') x.at(i) = 1;
    else if (S.at(i) == '2') x.at(i) = 2;
    else if (S.at(i) == '3') x.at(i) = 3;
    else if (S.at(i) == '4') x.at(i) = 4;
    else if (S.at(i) == '5') x.at(i) = 5;
    else if (S.at(i) == '6') x.at(i) = 6;
    else if (S.at(i) == '7') x.at(i) = 7;
    else if (S.at(i) == '8') x.at(i) = 8;
    else x.at(i) = 9;
  }
  int ans = 100*x.at(0) + 10*x.at(1) + x.at(2);
  for (int i = 0; i < s-2; i++) {
    if (fabs(100*x.at(i) + 10*x.at(i+1) + x.at(i+2) - 753) < fabs(ans - 753)) {
      ans = 100*x.at(i) + 10*x.at(i+1) + x.at(i+2);
    }
  }
  cout << fabs(ans - 753) << endl;
}
                               

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
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(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N, X; cin >> N >> X;
    vector<int> m(N);
    rep(i, 0, N) cin >> m[i];
    sort(ALL(m));
    int cnt = 0;
    cnt += N;
    X -= accumulate(ALL(m), 0);
    cnt += X / m[0];
    cout <<cnt << endl;
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res = 0
for i in range(A+1):
	for j in range(B+1):
		for k in range(C+1):
			if 500*i+100*j+50*k == X:
				res += 1
print(res)


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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double Real;
typedef complex<Real> P;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

#define MOD 1000000007
#define eps 1e-8

int n,m;
P cvx[125];
P pts[125];

Real cross(P a, P b){
  return imag(conj(a)*b);
}
Real dot(P a, P b){
  return real(conj(a)*b);
}

bool inner(P p){
  P g = (cvx[0] + cvx[n/3] + cvx[2*n/3]) / 3.0;
  // g += P(1e-7, 1e-7);
  int a = 0, b = n;
  while(a+1<b){
    int c = (a+b)/2;
    if(cross(cvx[a]-g, cvx[c]-g)>0){
      if(cross(cvx[a]-g, p-g)>0 && cross(cvx[c]-g, p-g)<0) b=c;
      else a=c;
    }else{
      if(cross(cvx[a]-g, p-g)<0 && cross(cvx[c]-g, p-g)>0) a=c;
      else b=c;
    }
  }
  b %= n;
  if(cross(cvx[a]-p, cvx[b]-p)<-eps) return false;
  return true;
}

bool inner2(P p){
  bool in = false;
  REP(i,n){
    P a = cvx[i]-p;
    P b = cvx[(i+1)%n]-p;
    if(imag(a)>imag(b))swap(a,b);
    if(imag(a)<=0 && 0<imag(b)){
      if(cross(a,b)<0)in = !in;
    }
    if(abs(cross(a,b))<eps && dot(a,b)<=0)return true;
  }
  return in;
}

int main(){
  scanf("%d",&n);
  REP(i,n){
    Real x,y;
    scanf("%lf%lf",&x,&y);
    cvx[i] = P(x,y);
  }
  scanf("%d",&m);
  REP(i,m){
    Real x,y;
    scanf("%lf%lf",&x,&y);
    pts[i] = P(x,y);
  }
  vector<P> po;
  const Real PI = 4.0*atan(1.0);

  REP(i,n)po.push_back(cvx[i]);

  REP(i,m)REP(j,i){
    P a = pts[i], b = pts[j];
    P s1 = (a+b)/2.0;
    P d1 = (b-a)*exp(P(0,PI/2.0));
    REP(ii,n){
      P x = cvx[ii], y = cvx[(ii+1)%n];
      P s2 = x;
      P d2 = y-x;
      if(cross(d1,s2-s1)*cross(d1,s2+d2-s1) >= eps)continue;
      if(abs(cross(d2,d1))<eps)continue;
      P o = s1 + d1*cross(d2, s2-s1)/cross(d2, d1);
      // #define X real()
      // #define Y imag()
      // if(x.X <= y.X && (o.X < x.X-eps || o.X > y.X+eps))continue;
      // if(x.X >= y.X && (o.X > x.X+eps || o.X < y.X-eps))continue;
      // if(x.Y <= y.X && (o.Y < x.Y-eps || o.Y > y.Y+eps))continue;
      // if(x.Y >= y.X && (o.Y > x.Y+eps || o.Y < y.Y-eps))continue;
      po.push_back(o);
    }
  }

  REP(i,m)REP(j,i)REP(k,j){
    P a = pts[i], b = pts[j], c = pts[k];
    if(abs(cross(b-a,c-a))<eps)continue;
    P ab = (a+b)/2.0;
    P ac = (a+c)/2.0;
    P abd = (b-a)*exp(P(0,PI/2.0));
    P acd = (c-a)*exp(P(0,PI/2.0));
    P o = ab + abd * cross(acd, ac-ab) / cross(acd, abd);
    if(inner2(o))po.push_back(o);
  }

  Real ans = 0.0;
  REP(i,po.size()){
    P o = po[i];
    Real tmp = 1e18;
    REP(ii,m){
      CHMIN(tmp, abs(pts[ii]-o));
    }
    CHMAX(ans, tmp);
  }
  printf("%.9f\n",ans);
  return 0;
}



Measured memory_bytes: 4992
#include<iostream>
#include<utility>
using namespace std;
typedef pair<int, int>P;

P planet[1002][1002];

int main() {
	int m, n, k;
	cin >> m >> n;
	cin >> k;

	for (int i = 0;i<m;i++) {
		planet[i][0] = make_pair(0, 0);
		for (int j = 1;j<=n;j++) {
			char a;
			cin >> a;
			planet[i][j] = planet[i][j - 1];
			if (a == 'J')planet[i][j].first++;
			else if (a == 'O')planet[i][j].second++;
		}
	}

	for (int i = 0;i<k;i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int J = 0, O = 0, I = 0;
		for (int j = a - 1;j<c;j++) {
			int e = planet[j][d].first - planet[j][b - 1].first;
			int f = planet[j][d].second - planet[j][b - 1].second;
			J += e;
			O += f;
		}
		I = (c - a + 1)*(d - b + 1) - J - O;
		cout << J << ' ' << O << ' ' << I << endl;
	}
	return 0;
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define MIN(x) *min_element(all(x))
#define MAX(x) *max_element(all(x))
#define in(x) cin >> x
#define co(x) cout << x
#define el  cout << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
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, M, X, Y, Z, i, num, xmax=-100, ymin=100, ans;
  cin >> N >> M >> X >> Y;


  REP(i, N) {
    in(num);
    chmax(xmax, num);
  }
  REP(i, M) {
    in(num);
    chmin(ymin, num);
  }
  Z = ymin;
  if(xmax < Z && X < Z && Z <= Y ){
    co("No War");
  }else{
    co("War");
  }

  return 0;
}


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

int main(){

  int s;
  cin >> s;
  set<int> visited;
  visited.insert(s);
  int i = 1;
  while(true){
    i++;
    if(s % 2 == 0){
      s = s / 2;
    } else {
      s = 3 * s + 1;
    }
    if(visited.find(s) != visited.end()){
      break;
    } else {
      visited.insert(s);
    }
  }
  cout << i << endl;

}


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

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

typedef long long ll;

using namespace std;

int main() {
    int m, d;
    cin >> m >> d;

    int ans = 0;
    rep(i, m+1)rep(j, d+1) {
        int d10, d1, d2;
        d10 = j / 10;
        d1 = j % 10;
        d2 = d1 * d10;
        //cout << d10 << " " << d1 << " " << d2 << " " << i << endl;
        if (d10 >= 2 && d1 >= 2 &&  i == d2) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int out = 0;
	for(int i = 1; i <= n; i += 2){
		int count = 0;
		for(int j = 1; j <= i; j += 2){
			if(i % j == 0) count++;
		}
		if(count == 8) out++;
	}
	cout << out << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>



int main() {
	int n;

	std::cin >> n;

	std::vector<int> v(n);

	for (size_t i = 0; i < n; i++)
	{
		std::cin >> v[i];
	}

	std::sort(v.begin(), v.end());

	std::cout << v[n / 2] - v[n / 2 - 1] << std::endl;


	return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("6");
            WillReturn.Add("khabarovsk 20");
            WillReturn.Add("moscow 10");
            WillReturn.Add("kazan 50");
            WillReturn.Add("kazan 35");
            WillReturn.Add("moscow 60");
            WillReturn.Add("khabarovsk 40");
            //3
            //4
            //6
            //1
            //5
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10");
            WillReturn.Add("yakutsk 10");
            WillReturn.Add("yakutsk 20");
            WillReturn.Add("yakutsk 30");
            WillReturn.Add("yakutsk 40");
            WillReturn.Add("yakutsk 50");
            WillReturn.Add("yakutsk 60");
            WillReturn.Add("yakutsk 70");
            WillReturn.Add("yakutsk 80");
            WillReturn.Add("yakutsk 90");
            WillReturn.Add("yakutsk 100");
            //10
            //9
            //8
            //7
            //6
            //5
            //4
            //3
            //2
            //1
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    struct JyoutaiInfo
    {
        internal int ID;
        internal string S;
        internal int P;
    }
    static void Main()
    {
        List<string> InputList = GetInputList();

        var JyoutaiList = new List<JyoutaiInfo>();
        int CurrID = 1;
        foreach (string EachStr in InputList.Skip(1)) {
            string[] wkArr = EachStr.Split(' ');

            JyoutaiInfo WillAdd;
            WillAdd.ID = CurrID++;
            WillAdd.S = wkArr[0];
            WillAdd.P = int.Parse(wkArr[1]);
            JyoutaiList.Add(WillAdd);
        }

        foreach (var EachItem in JyoutaiList.OrderBy(X => X.S).ThenByDescending(X => X.P)) {
            Console.WriteLine(EachItem.ID);
        }
    }
}


Measured memory_bytes: 11616
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
   string s,t;
   cin>>s>>t;
   sort(all(s));
   sort(all(t));
   reverse(all(t));
   if(s<t)
    cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;


    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0; i < N; i++) {
        cin >> X[i];
    }
    int result = 100000000;
    for(int i = 0; i <= 100; i++) {
        int tmp = 0;
        for(int j = 0; j < N; j++) {
            tmp += pow(X[j] - i, 2);
        }
        result = min(result, tmp);
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
N,T = map(int,input().split())
A = list(map(int,input().split()))
C = {}
amin = A[0]
for i in range(1,N):
    a = A[i]
    if a>amin:
        b = a-amin
        if b not in C:
            C[b] = []
        C[b].append(i)
    elif a==amin:
        continue
    else:
        amin = a
C = sorted(list(C.items()),key=lambda x:x[0],reverse=True)
print(len(C[0][1]))

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    switch (n % 10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;
    case 3:
        cout << "bon" << endl;

        break;
    }
}

Measured memory_bytes: 3592
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {;
    string s;
    cin>>s;
    if(s[0]=='S'){
        cout<<"Cloudy"<<endl;
    }else if( s[0]=='C'){
        cout<<"Rainy"<<endl;
    }else {
        cout<<"Sunny"<<endl;
    }



    return 0;
}


Measured memory_bytes: 256
//c.c C-Coloring Colorfully
#include<stdio.h>
#include<string.h>

int main(void){
    char msg[100001];
    scanf("%s",msg);

    int len = strlen(msg),count1 = 0,count2 = 0;
    for(int i=0;i<len;++i){
        if(i%2==0 && msg[i] == '1'){
            count1++;
        }
        if(i%2==1 && msg[i] == '0'){
            count1++;
        }
    }

    for(int i=0;i<len;++i){
        if(i%2==0 && msg[i] == '0'){
            count2++;
        }
        if(i%2==1 && msg[i] == '1'){
            count2++;
        }
    }

    printf("%d\n",count1>count2? count2:count1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
const int maxn = 200000 + 5;


int sum1[maxn];
int sum2[maxn];
signed main(){
    int n,m,k;
    cin >> n >> m >> k;
    for(int i=1;i<=n;i++){
        scanf("%d",&sum1[i]);
        if(i!=0){
            sum1[i] = sum1[i]+sum1[i-1];
        }
    }
    for(int i=1;i<=m;i++){
        scanf("%d",&sum2[i]);
        if(i!=0){
            sum2[i] = sum2[i]+sum2[i-1];
        }
    }
    int ans =0;
    for(int i=0;i<=n;i++){
        if(sum1[i]<=k){
        int x = upper_bound(sum2,sum2+m+1,k-sum1[i])-sum2;
        // cout << i << x << endl;
        ans = max(ans,i+x-1);
        }
    }
    cout << ans << endl;
    return 0;
}

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




int main(void) {
  int n;
  cin >> n;
  int a[100001],b[100001],c[100001];
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);
  ll sum = 0;
  rep(i,n){
    ll p = lower_bound(a,a+n,b[i])-a;
    //cout << p << endl;
    ll q = c+n-upper_bound(c,c+n,b[i]);
    //cout << q << endl;
    sum += p*q;
    
  }
  cout << sum << endl;
  
  
  
 
   
}

  
  
 
   



Measured memory_bytes: 1408
h, w, k = map(int, input().split())
s = [list(map(int, list(input()))) for _ in range(h)]
result = []
if h*w<=k:
    result.append(0)
else:
    for i in range(2**(h-1)):
        checker, num = 0, i
        while num > 0:
            checker += num%2
            num >>= 1
        x = 0
        c = [0 for _ in range(checker+1)]
        
        num = i
        p = 0
        nex = [0 for _ in range(checker+1)]
        for m in range(h):
            nex[p] += s[m][0]
            p += num%2
            num = num >> 1
        if max(nex) > k:
            x = float('inf')
            continue

        if all(nex[m]+c[m] <= k for m in range(checker+1)):
            c = [c[I]+nex[I] for I in range(checker+1)]
        else:
            x += 1

        for j in range(1, w):
            num = i
            p = 0
            nex = [0 for _ in range(checker+1)]
            for m in range(h):
                nex[p] += s[m][j]
                p += num%2
                num = num >> 1
            if max(nex) > k:
                x = float('inf')
                break            
            
            if all(nex[m]+c[m] <= k for m in range(checker+1)):
                c = [c[I]+nex[I] for I in range(checker+1)]
            else:
                x += 1
                c = nex
        result.append(checker+x)
print(min(result))

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

using namespace std;

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

const int MOD = 998244353;

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int n;
    cin >> n;
    vector<int> a(n);
    int xo = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        xo ^= a[i];
    }
    for (int i = 0; i < n; ++i) {
        cout << (xo ^ a[i]) << " ";
    }
    
    return 0;
}


Measured memory_bytes: 3948
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>

typedef long long ll;

int main(int argc, char* argv[])
{
  ll n;
  std::cin >> n;
  std::vector< ll > va(n*3, 0);
  std::priority_queue< ll, std::vector< ll >, std::greater< ll > > pq1;
  std::priority_queue< ll > pq2;

  // input
  for (ll i = 0; i < n * 3; i++) {
    ll tmp;
    std::cin >> tmp;
    va[i] = tmp;
  }

  std::vector< ll > left (n*3, 0);
  std::vector< ll > right(n*3, 0);

  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    sum += va[i];
    pq1.push(va[i]);
  }
  left[n-1] = sum;
  for (ll i = n; i <= n*2; i++) {
    pq1.push(va[i]);
    ll x = pq1.top();
    sum += va[i] - x;
    left[i] = sum;
    pq1.pop();
  }

  sum = 0;
  for (ll i = n*2; i < n*3; i++) {
    sum += va[i];
    pq2.push(va[i]);
  }
  right[n*2] = sum;
  for (ll i = n*2-1; i >= n-1; i--) {
    pq2.push(va[i]);
    ll x = pq2.top();
    sum += va[i] - x;
    right[i] = sum;
    pq2.pop();
  }

  ll ans = -((ll)1 << 60);
  for (ll i = n-1; i < n*2; i++) {
    //std::cout << left[i] << " " << right[i] << std::endl;
    ans = std::max(ans, left[i] - right[i+1]);
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 9588
#include<stdio.h>
#include<math.h>

struct point{
	double x,y;
};

int koch(int n,struct point p1,struct point p2)
{
	if(n==0) return 0;
	struct point s,t,u;
	s.x=(2*p1.x+p2.x)/3;
	s.y=(2*p1.y+p2.y)/3;
	t.x=(p1.x+2*p2.x)/3;
	t.y=(p1.y+2*p2.y)/3;
	u.x=(t.x-s.x)*cos(M_PI/3)-(t.y-s.y)*sin(M_PI/3)+s.x;
	u.y=(t.x-s.x)*sin(M_PI/3)+(t.y-s.y)*cos(M_PI/3)+s.y;
	koch(n-1,p1,s);
	printf("%f %f\n",s.x,s.y);
	koch(n-1,s,u);
	printf("%f %f\n",u.x,u.y);
	koch(n-1,u,t);
	printf("%f %f\n",t.x,t.y);
	koch(n-1,t,p2);
}

int main()
{
	int n;
	struct point p1,p2;
	p1.x=0;
	p1.y=0;
	p2.x=100;
	p2.y=0;
	
	scanf("%d",&n);
	printf("%f %f\n",p1.x,p1.y);
	koch(n,p1,p2);
	printf("%f %f\n",p2.x,p2.y);
	return 0;
}


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

int main()
{
    long long int a, b, c, d;
    long long int ans, ans2, mx1, mx2, mx3, mx4;
    cin>>a>>b>>c>>d;
     mx1=a*c;
     mx2=a*d;
     mx3=b*c;
     mx4=b*d;
     ans=max(mx1, max(mx2, max(mx3, mx4)));
     cout<<ans<<endl;

    return 0;

}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();  // 荷物の数
		int K = sc.nextInt();  // トラックの数
		int[] W = new int[N];  // 各荷物の重さ
		int[] truck = new int[K];  // トラック🚚
		int left = 0;         // 荷物の重さの最大値（最低でも必要な積載量）
		int right = 0;        // 荷物の重さの合計値（トラック最大の積載量）

		for(int i = 0; i < N; i++) {
			W[i] = sc.nextInt();
			if(W[i] > left) {
				left = W[i];
			}
			right += W[i];
		}

		int p = 0;  // トラックの最大積載量p(こいつを求める)
		while(left <= right) {
			int mid = (left + right) / 2;
			int j = 0;  // 荷物配列用インデックス
			for(int i = 0; i < K; i++) {
				while(j < N && (truck[i] + W[j]) <= mid) {  // トラックへの詰め込み
					truck[i] += W[j];
					j++;
				}
			}
			if(j == N) {  // トラック詰め込み成功
				p = mid;
				right = mid - 1;
			}else {
				left = mid + 1;
			}

			initialize_array(truck);
		}

		System.out.println(p);
		sc.close();
	}

	public static void initialize_array(int[] a) {
		for(int i = 0; i < a.length; i++) {
			a[i] = 0;
		}
	}
}


Measured memory_bytes: 71312
S=input()
K=int(input())
ans=0
last=S[0]
cnt=1
if len(set(S))>1:
    for i in range(1,len(S)):
        if S[i]==last:
            cnt+=1
        else:
            ans+=cnt//2
            cnt=1
            last=S[i]
    ans+=cnt//2
    ans*=K
    if S[0]==S[-1]:
        a,b=0,0
        last=S[0]
        for i in range(len(S)):
            if last==S[i]:
                a+=1
            else:
                break
        S=S[::-1]
        for i in range(len(S)):
            if last==S[i]:
                b+=1
            else:
                break
        ans-=(a//2+b//2-(a+b)//2)*(K-1)
else:
    ans=len(S)*K//2
print(ans)

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int N;
 	cin >> N;
 	int x[N];
 	int y[N-1];
 	for (int i = 0; i < N; i++){
 		cin >> x[i];
 	}
 	y[0]=0;
 	y[1]=abs(x[0]-x[1]);
 	for (int i = 2; i < N; i++){
 		int a=y[i-2]+abs(x[i-2]-x[i]);
 		int b=y[i-1]+abs(x[i-1]-x[i]);
 		if(a>b){
 			y[i]=b;
 		}else{
 			y[i]=a;
 		}
 	}
 	cout << y[N-1] << endl;
 }

Measured memory_bytes: 1024
n, l = gets.chomp.split(" ").map(&:to_i)

sum = 0
tastes = []
(0..n-1).each do |i|
    tastes << (l + i)
    sum += (l + i)
end

max = tastes[n-1]
min = tastes[0]

if min > 0
    puts sum - min
elsif max < 0
    puts sum - max
else 
    puts sum
end

Measured memory_bytes: 1788
// https://atcoder.jp/contests/abc178/tasks/abc178_e

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

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;
const int X_I_MAX = 1e9;
const int Y_I_MAX = 1e9;

int N;
vector<int> z;
vector<int> w;

int main() {
  cin >> N;
  z = vector<int>(N);
  w = vector<int>(N);
  REP(i, N) {
    int x, y;
    cin >> x >> y;
    z[i] = x + y;
    w[i] = x - y;
  }

  sort(z.begin(), z.end());
  sort(w.begin(), w.end());

  int ans = max(z[N - 1] - z[0], w[N - 1] - w[0]);
  cout << ans << endl;
}


Measured memory_bytes: 4772
n, k = map(int, input().split())
s = input()

change_points = [i for i in range(n) if i == 0 or s[i-1] != s[i]]
change_points.append(n)
max_ = 0
for i, p in enumerate(change_points):
    if i == len(change_points) - 1:
        continue
    if s[p] == '0':
        if i == 0:
            idx = min(i + 2 * k, len(change_points) - 1)
            tmp = change_points[idx] - p
        else:
            continue
    else:
        idx = min(i + 2 * k + 1, len(change_points) - 1)
        tmp = change_points[idx] - p
    if tmp > max_:
        max_ = tmp

print(max_)


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

const int MAXV=(int) 2e5+2;
 
struct edge{
    int to;
};
 
vector <edge> G[MAXV];
int mark[MAXV];
bool visited[MAXV]={};
int member[MAXV]={};
 
int search(int start, int &count){
    queue <int> que;
    if(visited[start]) return -1;
    int nmem=0;
    count++;
    nmem++;
    visited[start]=true;
    que.push(start);
    mark[start]=count;
    while(!que.empty()){
        int v;
        v=que.front();
        que.pop();
        for(auto x: G[v]){
            if(visited[x.to]) continue;
            visited[x.to]=true;
            mark[x.to]=count;
            que.push(x.to);
            nmem++;
        }
    }
    return nmem;
}

int main(){

    int N,M;
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        edge e = { b };
        G[a].push_back(e);
        e = { a };
        G[b].push_back(e);
    }

    int count=0;

    for(int i=1; i<=N; i++){
        int tmp = search(i,count);
        if( tmp>0 ) member[count] = tmp;
        //cout << "i count member " << i << " " << count << " " << member[count] << endl;
        //cout << "member[1] " << member[1] << endl;
    }

    sort(member,member+MAXV);

    int ans=0;

    //cout << "member[1] " << member[1] << endl;

    for(int i=1; i<MAXV; i++){
        ans += member[i] - member[i-1];
        //if( member[i] != 0 ){
            //cout << "i member[i-1] member[i] " << i << " " << member[i-1] << " " << member[i] << endl;
        //}
    }

    cout << ans << endl;

}

Measured memory_bytes: 16628
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	string s; cin >> s;
	REPC(&i, s)if (i != 'A' && i != 'C' && i != 'G' && i != 'T')i = ' ';
	vector<string>vs;
	stringstream ss(s);
	while (true) {
		string s2; ss >> s2;
		if (!ss)break;
		vs.push_back(s2);
	}
	if (vs.size() == 0) {
		cout << '0' << endl;
	}
	else {
		sort(ALL(vs), [](const string & s1, const string & s2) {return s1.length() < s2.length(); });
		cout << vs.back().length() << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,count;
  cin >> a >> b >> c;
  if(a==b&&a==c){
    cout << 1 << endl;
  }
  else if(a!=b&&a!=c&&b!=c){
    cout << 3 << endl;
  }
  else{
    cout << 2 << endl;
  }
}

Measured memory_bytes: 3548
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N >> M >> K;
	L = min(N - M, K);
	K -= L;
	cout << K << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = stdIn.nextInt();
        }

        int counter = 0;
        int min = p[0];

        for (int i = 0; i < n; i++) {
            if (min >= p[i]) {
                counter++;
                min = p[i];
            }
        }

        System.out.println(counter);
    }
}


Measured memory_bytes: 66588
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
const i64 MOD = 1e9 + 7;
// O(log a)
int64_t powmod(int64_t a, int64_t p) {
    int64_t v = 1;
    for (int64_t b = a; p > 0; p >>= 1, b = (b * b) % MOD) {
        if (p & 1) v = (v * b) % MOD;
    }
    return v;
}

int64_t invmod(int64_t x) {
    return powmod(x, MOD - 2);
}

int main() {
    int N;
    i64 m = 1;
    cin >> N;
    vector<i64> A(N);
    for(i64 &x : A) cin >> x;
    i64 ans = 0, carry = 0;
    for(int i = 0; i < 62 || carry != 0; i++) {
        i64 tmp = 0;
        if (i < 62) {
            for (i64 x : A) {
                tmp += (x >> i) & 1;
            }
        }
        carry += 2 * tmp * (N - tmp);
        ans = (ans + (carry % 2) * m) % MOD;
        carry /= 2;
        m = (2 * m) % MOD;
    }
    ans = (ans * invmod(2)) % MOD;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2560
N, A, B, C = map(int, input().split())
inputs = [int(input()) for _ in range(N)]

def dfs(depth, a, b, c):
	if depth == N:
		if a == 0 or b == 0 or c == 0:
			return 1e9
		return abs(A - a) + abs(B - b) + abs(C - c)
	
	x = dfs(depth + 1, a, b, c)
	w = dfs(depth + 1, a, b, c + inputs[depth]) + 10 * (c != 0)
	y = dfs(depth + 1, a + inputs[depth], b, c) + 10 * (a != 0)
	z = dfs(depth + 1, a, b + inputs[depth], c) + 10 * (b != 0)
	
	return min(x, y, z, w)

print(dfs(0, 0, 0, 0))

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

int main(){
  int n;
  cin >> n;
  vector<int> price(n);
  for (int i= 0; i < n; i++){
    cin >> price.at(i);
  }
  sort(price.begin(),price.end());
  int sum = 0;
  for (int i= 0; i < n; i++){
    if(i<n-1){
      sum += price.at(i);
    }else{
      sum += price.at(i)/2;
    }
  }
  cout << sum << endl;
  return 0;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


void solve(){
    int H, N;
    cin >> H >> N;
    int s = 0;
    rep(i,N){
        int t;
        cin >> t;
        s += t;
    }
    if(s>=H) Yes;
    else No;
}

signed main(){
    cout << fixed << setprecision(18) << endl;
    cerr << fixed << setprecision(18) << endl;
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d})<<endl;;




    
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int n,ans = 1;
    cin >> n;

    for(int i = 1;;i++){
        if(n < i*i){
            ans = (i-1)*(i-1);
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
	int W, H, N;
  	cin >> W >> H >> N;
  
  vector<vector<int>> P(N, vector<int>(3));

   for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        cin >> P.at(i).at(j);
      }
    }
  
  int w = 0;
  int h = 0;
  
  for (int i = 0; i < N; i++){
    if( P.at(i).at(2) == 1) w = max(w, P.at(i).at(0));
    else if( P.at(i).at(2) == 2) W = min(W, P.at(i).at(0));
    else if( P.at(i).at(2) == 3) h = max(h, P.at(i).at(1));
    else H = min(H, P.at(i).at(1));    
  }
  
	cout << max(W - w, 0) * max(H - h, 0) << endl;
}


Measured memory_bytes: 256
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)


N, M = map(int, input().split())
parent = [-1] * N


def union(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    parent[x] = y


def find(x):
    if parent[x] == -1:
        return x
    res = parent[x] = find(parent[x])
    return res

for _ in range(M):
    a, b = map(int, input().split())
    union(a - 1, b - 1)


count = Counter(find(i) for i in range(N))
print(count.most_common(1)[0][1])


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

int main() {
  using pii = pair<string, int>;
  
  int N;
  cin >> N;
  vector<pii> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i).first >> A.at(i).second;
    B.at(i).first = A.at(i).first;
    B.at(i).second = - A.at(i).second;
  }
  
  sort(B.begin(), B.end());
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (B.at(i).first == A.at(j).first && B.at(i).second == - A.at(j).second) {
        cout << j + 1 << endl;
      }
    }
  }
}

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

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const set<A>& s) {
    for(auto it = s.begin(); it != s.end(); ++it) {
        output << *it << endl;
    }
    return output;
}

template<class A, class B>
ostream& operator << (ostream& output, const map<A, B>& m) {
    for(auto it = m.begin(); it != m.end(); ++it) {
        output << "[" << it->first << ", " << it->second << "]" << endl;
    }
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for(int i = 2; i < n; ++i) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n - 1] << '\n';

    return 0;
}

Measured memory_bytes: 3936
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
 int $(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
signed main(){
  int a,b=100000000,j,c,d,e=0;
  cin>>a;
  string f,g;
  for(int i=1;i<a;i++){
    e=0;
    j=a-i;
    c=keta(i),d=keta(j);
    f=to_string(i),g=to_string(j);
    for(int k=0;k<c;k++)
      e+=f.at(k)-'0';
    fo(k,d)
      e+=g.at(k)-'0';
    b=min(b,e);
  }
  cout<<b<<endl;
}

Measured memory_bytes: 640