akhauriyash/Code-Regression huggingface dataset:
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => n.split(''));

  const a = s[0];
  const b = s[1];
  const c = s[2];

  const a_last  = a[a.length - 1];
  const b_first = b[0];
  const b_last  = b[b.length - 1];
  const c_first = c[0]

  const ans = (a_last === b_first && b_last === c_first) ? 'YES' : 'NO';

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;
const long long INF = (1LL << 31) - 1;

struct Segment_Tree{
    int N;
    vector<int> dat;
    Segment_Tree(int n_){
        N = 1;
        while(n_ > N){
            N *= 2;
        }
        dat.resize(2*N - 1, INF); //ここのINFは、何を求めたいかにより変更
    }

    /*void init(int q, int a){
        q = q + N - 1;
        dat[q] = a;
        while(q > 0){
            q = (q-1) / 2;
            dat[q] = min(dat[2*q + 1],dat[2*q + 2]);
        }
    }*/

    void update(int q, int a){
        q = q + N -1;
        dat[q] = a;
        while(q > 0){
            q = (q-1) / 2;
            dat[q] = min(dat[2*q + 1],dat[2*q + 2]);  //ここは何を求めたいかにより変更
        }
    }

    int queri(int a, int b, int k, int l, int r){ //[a, b)の最小値を求める　kは節点(何番目の箱？を考えてるか) [l,r)の範囲を考える (最初は[0,N) )
        // → 最初は (a, b, 0 , 0 , N)って感じになる
        if(a >= r || b <= l){
            return INF; //何を求めたいかにより変更
        }
        else if(a <= l && b >= r){
            return dat[k];
        }

        else{
            int left = queri(a, b, k*2 + 1, l, (l+r) / 2);
            int right = queri(a, b, k*2 + 2, (l+r) / 2, r);
            return min(left,right); //何を求めたいかにより変更
        }
    }


};

int main(){
    //cin.tie(nullptr);
	//ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N,Q; cin >>N>>Q;
    Segment_Tree tree(N);
    REP(i,Q){
        int c,x,y;cin>>c>>x>>y;
        if(c == 0){
            tree.update(x,y);
        }
        else{
            cout << tree.queri(x, y+1, 0, 0, tree.N) << endl;
        }
    }

}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n;
    cin >> n;
        string s;
    getline(cin, s);
    rep(i, n){
        getline(cin, s);
        while(true){
            if(s.find("Hoshino") == string::npos) break;
            else s.replace(s.find("Hoshino"), 7, "Hoshina");
        }
        cout << s<< endl;
    }
}

Measured memory_bytes: 1208
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  rep(i, N) cin >> P[i];
  int ans {};
  rep(i, N) {
    if (P[i] != i+1) {
      ++ans;
    }
  }
  if (ans <= 2) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}


Measured memory_bytes: 384
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
x,n = MI()
if n == 0:
  print(x)
else:
  p = set(LI())
  li = set(range(-1,102))
  new_li = li - p
  x_dis = []
  for k in new_li:
    x_dis.append(abs(k-x))
  ind = x_dis.index(min(x_dis))
  print(list(new_li)[ind])

Measured memory_bytes: 9196
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

const double PI  = acos(-1.0);
using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
const int N = 2e5 + 9;

ll n,x,a[N],sum[N],mn=1e18;

 int main()
{
//freopen("product.in","r",stdin);
//freopen("travel.out","w",stdout);
//__builtin_popcount()
input
        cin>>n>>x;
        forr(i,1,n)
        {
            cin>>a[i];
            sum[i]=sum[i-1]+a[i];
        }
        forr(i,1,n)
        {
            ll cur=0,c=5;
            for(int j=n,cnt=1;j>0;j-=i,cnt++)
            {
                if(cnt>2)c+=2;
                cur+=(sum[j]-sum[max(0,j-i)])*c;
                if(cur>mn)break;
            }
            mn=min(mn,1LL*i*x+n*x+cur);
        }
        cout<<mn<<endl;




return 0;
}


Measured memory_bytes: 3328
n = int(input())
input_list = [int(x) for x in input().split()]

def sort_print(n, input_list):
    # index[0]~ [n-1]?????§?¨??????????
    # ???????????????index??\???????????\?????°???????????°?????\????????????print???
    for i in range(n):
        index = i

        num = input_list[index]
        while index-1 >=0 and input_list[index-1] > num:
            input_list[index] = input_list[index-1]
            index -= 1
        input_list[index] = num

        result = [str(x) for x in input_list]
        print(' '.join(result))

sort_print(n, input_list)

Measured memory_bytes: 7696
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    vector<int> a;
    string s;

    cin >> n >> k;
    cin >> s;

    int cont = 1, num = 1;
    for (int i=1; i<n; i++) {
        if (s[i-1] == s[i]) {
            cont++;
        }
        else {
            a.push_back(cont);
            cont = 1;
            num++;
        }
    }
    a.push_back(cont);

    vector<int> sum;
    sum.push_back(0);
    for (int i=0; i<num; i++){
        sum.push_back(sum[i] + a[i]);
    }
    if (s[0] == '0') {
        sum.insert(sum.begin(), 0);
    }
    num = (int)sum.size();

    /*
    for (int i=0; i<num; i++) {
    cout << sum[i] << " ";
    }
    cout << endl;
    */

    int l = 0, r = min(num-1, k*2+1);
    int ans = sum[r] - sum[l];
    for (int i=2; i<num; i+=2) {
        l = i; r = min(num-1, i + k*2 + 1);
        // cout << "l=" << l << "r=" << r << "ans=" << sum[r] - sum[l] << endl; 
        ans = max(ans, sum[r] - sum[l]);
    }

    cout << ans << endl;

    return 0;
}

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


int main ()
{
   int N;
   cin >>N;
   int t;
   t=N%100;
   N=N/100;
   if(N <= 12 && t <= 12 && t>0 &&N>0){
      cout <<"AMBIGUOUS"<<endl;
   }else if(t<=12 && t>0){
      cout<< "YYMM"<<endl;
   }else if(N<=12 && N>0){
      cout<<"MMYY"<<endl;
   }else{
      cout <<"NA"<<endl;
   }
}

Measured memory_bytes: 256
n = int(input())
     
f = [int(input().replace(" ", ""), 2) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
     
ans = float('-inf')
     
for i in range(1, 1024):
    price = 0
    for j in range(n):
        price += p[j][bin(i & f[j]).count('1')]
    ans = max(ans, price)
     
print(ans)

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

int main() {
    int k , x;
    cin >> k >> x;
    if(k*500>=x) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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


int main()
{
	int a, b, c;
	int k[3];
	cin >> a >> b >> c;
	k[0] = a;
	k[1] = b;
	k[2] = c;
	if (a > b) {
		swap(a, b);
		if (a > c) {
			swap(a, c);
		}
		if (b > c) {
			swap(b, c);
		}
	}
	else {
		if (a > c) {
			swap(a, c);
		}
		if (b > c) {
			swap(b, c);
		}
	}
	cout << a << " " << b << " " << c << endl;

	return 0;
}

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

int a[100010],n;
int BinaryS(int key)
{
	int left=0,right=n;
	while(left<right)
	{
		int mid=(left+right)/2;
		if(a[mid]==key)return 1;
		if(a[mid]>key)right=mid;
		if(a[mid]<key)left=mid+1;
	}
	return 0;
}

int main()
{
	cin>>n;
	for(int i=0;i<n;cin>>a[i++]);
	int q,b[50010];cin>>q;
	for(int i=0;i<q;cin>>b[i++]);
	int cnt=0;
	for(int i=0;i<q;i++)
	{
		if(BinaryS(b[i])==1)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main()
{
	int n, a[1000];

	while (1) {
		cin >> n;
		if (n == 0)break;

		for (int i = 0; i < n; i++)cin >> a[i];
		int sum = 0;
		for (int i = 0; i < n; i++)sum += a[i];
		double avg = 1.0*sum / n;
		double bun = 0.0;
		for (int i = 0; i < n; i++) {
			bun += (avg - a[i])*(avg - a[i]);
		}
		printf("%lf\n", sqrt(bun / n));
	}

    return 0;
}


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

int main() {
  int n, tmp, count = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = n - 1; i < j; --j) {
      if (a[j] < a[j - 1]) {
        tmp = a[j];
        a[j] = a[j - 1];
        a[j - 1] = tmp;
        count++;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << a[i] << ((i == n - 1) ? '\n' : ' ');
  }
  cout << count << endl;
}



Measured memory_bytes: 3080
# -*- coding: utf-8 -*-

import sys
import os

def factorial(n):
    a = 1
    for i in range(1, n+1):
        a *= i
    return a

for s in sys.stdin:
    n = int(s)
    if n == 0:
        break

    v = factorial(n)
    s = str(v)

    counter = 0
    for i in range(len(s)-1, -1, -1):
        if s[i] == '0':
            counter += 1
        else:
            break
    print(counter)

Measured memory_bytes: 7688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
struct node
{
	int l,r;
}e[maxn];
bool cmp(node a,node b)
{
	return a.l<b.l;
}

int main()
{
	int n,p,q,lmax=0,rmin=0x3f3f3f3f;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&e[i].l,&e[i].r);
		if(lmax<e[i].l) lmax=e[i].l,p=i;
		if(rmin>e[i].r) rmin=e[i].r,q=i;
	}
		
	sort(e,e+n,cmp);
	int lx[maxn],rx[maxn];
	lx[0]=e[0].l,rx[0]=e[0].r;
	for(int i=1;i<n;i++)
	{
		lx[i]=max(lx[i-1],e[i].l);
		rx[i]=min(rx[i-1],e[i].r);
	}
	int ly[maxn],ry[maxn];
	ly[n-1]=e[n-1].l,ry[n-1]=e[n-1].r;
	for(int i=n-2;i>=0;i--)
	{
		ly[i]=max(ly[i+1],e[i].l);
		ry[i]=min(ry[i+1],e[i].r);
	}
	int ans1=0,ans2=0;
	for(int i=0;i<n;i++)
		if(i!=q&&i!=p)
		ans1=max(ans1,max(0,rmin-lmax+1)+e[i].r-e[i].l+1);
	for(int i=0;i<n-1;i++)
	{
		ans2=max(ans2,max(0,rx[i]-lx[i]+1)+max(ry[i+1]-ly[i+1]+1,0));
	}
//	cout<<ans1<<' '<<ans2<<endl;
	cout<<max(ans1,ans2)<<endl;
	return 0;
 } 

Measured memory_bytes: 2560
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];

void dijkstra() {
  priority_queue<pair<int, int> > PQ;
  int color[MAX];
  int d[MAX];
  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while (!PQ.empty()) {
    pair<int, int> f = PQ.top();
    PQ.pop();
    int u = f.second;
    color[u] = BLACK;

    if (d[u] < f.first * (-1)) continue;

    for (int j = 0; j < adj[u].size(); j++) {
      int v = adj[u][j].first;
      if (color[v] == BLACK) continue;
      if (d[v] > d[u] + adj[u][j].second) {
        d[v] = d[u] + adj[u][j].second;
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main() {
  int k, u, v, c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}



Measured memory_bytes: 8080
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        for (int i = 1 ; i * i <= x ; i++) {
            if (x % i == 0) {
                int n = i;
                int m = x / i;
                for (int j = -50000 ; j < 50000; j++ ) {
                    int a = j;
                    int b = a - n;
                    if ((long) (a * a * a *a + a * a * a * b + a* a* b * b + a * b * b * b + b * b * b * b) == m) {
                        System.out.println(a + " " + b);
                        return;
                    }
                }
            }
        }
    }

}

Measured memory_bytes: 39176
#include<iostream>
#include<string>
using namespace std;
int N_MAX = 10;
int main()
{
  int n,m,i,j,k;
  long long t,res=0;
  long long a[N_MAX];
  string s;
  cin >> s;
  n=s.size();
  for(i=0;i<n;i++)
    a[i]=stoi(s.substr(i,1));
  m=1<<(n-1);
  for(j=0;j<m;j++){
    k=j;
    t=1;
    res+=a[n-1];
    for(i=n-2;i>=0;i--){
      if(k%2==0){
        t*=10;
      }else{
        t=1;
      }
      res+=a[i]*t;
      k>>=1;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
import math
import _collections
n=int(input())
A=list(map(int,input().split()))
ans=A[0]
X=[0]*(max(A)+1)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return set(a)



for i in range(1,n):
    ans=math.gcd(ans,A[i])

if ans!=1:
    print('not coprime')
else:
    ans='pairwise coprime'
    for a in A:
        B=prime_factorize(a)
        for b in B:
            if X[b]!=0:
                ans='setwise coprime'
            else:
                X[b]+=1
    print(ans)

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

int main(){
    int N, A[0];
    cin >> N >> A[0];
    int min = A[0];
    int max = A[0];
    for(int i = 1; i < N; ++i) {
        int A[i];
        cin >> A[i];
        if(A[i] < min) min = A[i];
        else if(A[i] > max) max = A[i];
    }

    cout << max - min << endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    BigInteger k;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        k = new BigInteger(sc.nextLine());
    }

    void solve() {
        BigInteger n = new BigInteger("50");
        BigInteger div = k.divide(n);
        BigInteger mod = k.mod(n);
        int _mod = Integer.parseInt(mod.toString());
        BigInteger[] as = new BigInteger[50];
        for (int i = 0; i < 50; i++) {
            as[i] = div.add(new BigInteger(i+""));
//            as[i] = as[i].subtract(mod);
        }
        for (int i = 0; i < _mod; i++) {
            as[i] = as[i].add(n);
            for (int j = 0; j < 50; j++)
                if (i != j)
                    as[j] = as[j].subtract(BigInteger.ONE);
        }
        System.out.println(50);
        for (int i = 0; i < 49; i++)
            System.out.printf("%s ", as[i].toString());
        System.out.println(as[49].toString());
    }
}


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

int main() {
    const std::vector<int> r {400, 800, 1200, 1600, 2000, 2400, 2800, 3200};
    std::vector<bool> c (r.size(), false);
    int k = 0;
    int o = 0;

    int n; std::cin >> n;
    for (int i = 0; i < n; i++) {
        int l; std::cin >> l;
        if (3200 <= l) {
            o++;
        } else {
            for (size_t j = 0; j < r.size(); j++) {
                if (l < r[j]) {
                    if (!c[j]) {
                        k++;
                    }
                    c[j] = true;
                    break;
                }
            }
        }
    }

    int m = (k == 0)?1:k;
    int M = k+o;
    std::cout << m << " " << M << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


int main(){
    int n;
    string s;
    cin>>n>>s;
    int count=1;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<=i+1;j++){
            if(s.at(i)!=s.at(j)){
                count++;
            }
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int sum = a + b + c;
    int discr = (2 * a - sum) * (2 * b - sum) * (2 * c - sum);
    if (discr == 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23892
#include<stdio.h>
int main(void)
{
   int a,b,c,d,e,f,g;
   scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
   g=a*1+b*5+c*10+d*50+e*100+f*500;
   if(g>=1000){
   printf("1\n");
   }
   else{
   printf("0\n");
   }
   return 0;
   }

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

int main() {
  int N,i,j;
  long int cou=0;
  cin>>N;
  vector<long int> A(N);
  for(i=0;i<N;i++)cin>>A[i];
  sort(A.begin(),A.end());
  for(i=1;i<N;i++)cou+=A[N-i/2-1];
  cout<<cou<<endl;
}

Measured memory_bytes: 4844
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main()
{
	char c[101][101];
	int H,W;
	scanf("%d%d",&H,&W);
	int i,j;
	for(i=0;i<H;i++){
		//for(j=0;j<W;j++){
			scanf("%s",&c[i]);
		//}
	}
	
	int line=0;
	for(i=0;i<H;i++){
		for(line=0;line<2;line++){
			for(j=0;j<W;j++){
				printf("%c",c[i][j]);	
			}
			printf("\n");
		}
}	
		
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int main(){

    int w;
    string S;
    cin>>S;

    for(int i=0;i<S.length();i++){
        if(S[i]=='o')w++;
    }

    w+=15-S.length();

    if(w>=8){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
int a[11],i,j;
for(i=0;i<10;i++)
scanf("%d", &a[i]);
for(j=0;j<10;j++)
for(i=0;i<9;i++)
if(a[i]<a[i+1]){
a[11]=a[i];
a[i]=a[i+1];
a[i+1]=a[11];}
printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
return 0;
}

Measured memory_bytes: 600
# ABC 79 C

def resolve():
    ops = ['+', '-']
    s = input()

    for i in ops:
        for j in ops:
            for k in ops:
                eq = s[0] + i + s[1] + j + s[2] + k + s[3]
                if eval(eq) == 7:
                    print(eq + '=7')
                    return

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<long long,int> P;

int main(){
    ll k;
    cin >> k;

    if (k <= 9){
        cout << k << endl;
        return 0;
    }

    ll cnt = 9;

    queue<ll> que;
    ll ans = 0;
    rep(i,9) que.push(i+1);

    while (cnt < k) {
        ll v = que.front();
        int vv = v % 10;
        que.pop();
        vector<int> tmp;
        if (vv == 0) tmp = {0, 1};
        else if (vv == 9) tmp = {8, 9};
        else tmp = {vv-1, vv, vv+1};

        for (auto nv : tmp) {
            cnt ++;
            que.push(10 * v + nv);
            ans = 10 * v + nv;
            if (cnt == k) break;
        }
    }

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

Measured memory_bytes: 768
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n = input_n
s = n.to_s
if s[-1] == "2" || s[-1] == "4" || s[-1] == "5" || s[-1] == "7" || s[-1] == "9"
  puts "hon"
elsif s[-1] == "0" || s[-1] == "1" || s[-1] == "6" || s[-1] == "8"
  puts "pon"
else
  puts "bon"
end


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
const int INF=999999999;
const int MOD=1000000007;

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

ll n, d[5];
const char march[] = {'M', 'A', 'R', 'C', 'H'};

int main() {
    cin >> n;
    for (int i = 0; i < 5; i++) d[i] = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < 5; j++) {
            if (s[0] == march[j]) d[j]++;
        }
    }
    ll ans = 0LL;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                ans += d[i] * d[j] * d[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//Keep Working Hard
  // I__Like__Food  

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define tracel5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)

const int N = 55;

int32_t main()
{



    IOS

    int a,b,x;
    cin >> a >> b >> x;

    cout << b/x - a/x + (a%x == 0?1:0) ;

    return 0;
}




Measured memory_bytes: 256
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

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

template <class X>
void printarr(X arr[], int n) 
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << ' ';
    cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) 
{
    ll ans = 1;
    while (n) 
    {
        if (n&1) ans = (ans*a)%modulo;
        a = (a*a)%modulo; n = n >> 1;
    }
    return ans;
}

void solve() 
{
    ll n,a,b; cin >> n >> a >> b;
    ll a_fac = 1;
    ll b_fac = 1;
    For(i,1,a+1)
    {
        a_fac = (i * a_fac) % modulo;
    }    
    For(i,1,b+1)
    {
        b_fac = (i * b_fac) % modulo;
    }    

    ll dem2 = fpow(b_fac, modulo-2);
    ll dem1 = fpow(a_fac, modulo-2);

    ll num1 = 1, num2 = 1;
    For(i,1,a+1)
    {
        num1 = (num1 * (n - a + i)) % modulo;
    }
    For(i,1,b+1)
    {
        num2 = (num2 * (n - b + i)) % modulo;
    }

    ll total = fpow(2,n) - 1;
    ll ans = (total - (num1 * dem1) % modulo - (num2 * dem2) % modulo + 10 * modulo) % modulo; 
    cout << ans << endl;
}

int main() 
{
    fast_io();
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}

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

int main(int argc, char const *argv[]) {
    int n, m, k;
    cin >> n >> m >> k;

    vector<int> a(n), b(m);
    vector<long long> A(n+1), B(m+1);

    for (size_t i = 0; i < n; i++) cin >> a[i];
    for (size_t i = 0; i < m; i++) cin >> b[i];

    for (size_t i = 1; i <= n; i++) A[i] = A[i-1] + a[i-1];
    for (size_t i = 1; i <= m; i++) B[i] = B[i-1] + b[i-1];

    int ans = 0;
    int j = m;
    for (int i = 0; i <= n; i++) {
        if (A[i] > k) break;
        while (B[j] > k - A[i]) --j;
        ans = max(ans, i+j);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8016
from collections import defaultdict
import math


def kari():
    map(int, input().split())
    list(map(int, input().split()))
    math.ceil()

def main():
    red, green, blue, num = map(int, input().split())
    ans = 0
    for i in range(num + 1):
        for j in range(num + 1):
            nokori = num - red * i - blue * j
            if nokori < 0:
                break
            if nokori % green == 0:
                # print(i, j, nokori)
                ans += 1
        if num < red * i:
            break
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 38768
n,m = list(map(int,input().split()))
n_l = []
for i in range(n):
    l = list(map(int,input().split()))
    for j in range(l[0]):
        n_l.append(l[j+1])
    
cnt = 0
for i in range(1,m+1):
    if n_l.count(i) == n:
        cnt += 1

print(cnt)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int x[100];
int y[100];
int h[100];
 
int main(){
    int n;cin>>n;
    int cx_a,cy_a,h_a;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    for(int cx=0;cx<101;cx++){
        for(int cy=0;cy<101;cy++){
            int H;
            for(int i=0;i<n;i++){
                if(h[i]==0) continue;
                H=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
                break;
            }
            for(int i=0;i<n;i++){
                if(h[i]!=max(H-abs(x[i]-cx)-abs(y[i]-cy),0)) break;
                if(i==n-1){
                    cx_a=cx;
                    cy_a=cy;
                    h_a=H;
                }
            }
        }
    }
    cout<<cx_a<<' '<<cy_a<<' '<<h_a<<endl;
}

Measured memory_bytes: 3608
x = gets.chomp.split(' ')
s = []
x.each do |n|
  case n
  when '+'
    one = s.pop
    two = s.pop
    s.push(one+two)
  when '-'
    one = s.pop
    two = s.pop
    s.push(two-one)
  when '*'
    one = s.pop
    two = s.pop
    s.push(one*two)
  else
    s.push(n.to_i)
  end
end
puts s.first

Measured memory_bytes: 8600
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String a = sc.next();
            String b = sc.next();
            String c = sc.next();
            String[] list = {a, b, c};
            Arrays.sort(list);
            if("5".equals(list[0]) && "5".equals(list[1]) && "7".equals(list[2])){
              System.out.println("YES");
            } else {
              System.out.println("NO");
            }
          }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

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

    vector<int> a(n), b(n, 0), c(n, 0);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i == n-1)    break;
        int add = 2*(i%2)-1;
        b[i]+=add, b[i+1]-=add;
        c[i]-=add, c[i+1]+=add;
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll x = 0, y = 0;
    for(int i = 0; i < n; i++){
        x += a[i]*b[i];
        y += a[i]*c[i];
    }
    
    cout << max(x, y) << endl;
    return 0;
}

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

int main(){
    int64_t K, S;
    cin >> K >> S;
    int64_t ans = 0;
    for(int x=0; x<=K; x++) for(int y=0; y<=K; y++){
        int z = S-x-y;
        if(0 <= z && z <= K) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9; 
const int N = 6e5+5;                                         
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}

int main () {
	SpeedForce;
	
	string s;
	cin >> s;
	if(s.back() == 's') s += 'e';
	s += 's';
	cout << s << '\n';
	
	return Accepted;
}

// B...a


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

using namespace std;
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

string s;
int n;

void read() {
	cin >> s;
	n = s.size();
}

int ans;

int solve(int last) {
	int ans = 1;
	for (int i = last; i < n; i++) {
		if (last == 2) {
			last = 1;
			ans++;
			continue;
		}
		if (s[i] == s[i - 1]) {
			if (i + 1 < n) {
				last = 2;
				i++;
			}
			else {
				break;
			}
		}
		ans++;
	}
	return ans;
}

void run() {
	ans = solve(1);
	if (s.size() > 1)
		chkmax(ans, solve(2));
}

void write() {
	cout << ans << endl;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int x =(h2-h1)*60+ m2-m1;
	if(x-k>0){
		cout<<x-k<<"\n";
	}else{
		cout<<0<<"\n";
	}

 
	
	
	
	
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;   // cont number of ones from 0 to n in  binarry representation
#define ll long long

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


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

using namespace std;

using ll = long long;

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

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

class Node
{
    public:
    ll counter = 1e9;
    ll x;
    ll y;
    bool color = false; // 白:true 黒:false
    bool seen = false;
};

void ALLIN_GRAPH(ll H, ll W, vector<vector<Node>>& Graph, ll& black_number)
{
    black_number = 0;
    for(ll i=1;i<H+1;i++)
    {
        string s;
        cin >> s;
        for(ll j=1;j<W+1;j++)
        {
            if(s[j-1]=='.') Graph[i][j].color = true;
            else
            {
                black_number++;
            }
            Graph[i][j].x = j;
            Graph[i][j].y = i;
        }
    }
}

void BFS(vector<vector<Node>>& Graph)
{
    queue<Node> bfs;
    Graph[1][1].counter = 0;
    bfs.push(Graph[1][1]);

    while(!bfs.empty())
    {
        Node front_copy = bfs.front();
        bfs.pop();
        if(Graph[front_copy.y-1][front_copy.x].color)
        {
            if(!Graph[front_copy.y-1][front_copy.x].seen)
            {
                Graph[front_copy.y-1][front_copy.x].seen = true;
                Graph[front_copy.y-1][front_copy.x].counter = front_copy.counter+1;
                bfs.push(Graph[front_copy.y-1][front_copy.x]);
            }
        } 
        if(Graph[front_copy.y+1][front_copy.x].color)
        {
            if(!Graph[front_copy.y+1][front_copy.x].seen)
            {
                Graph[front_copy.y+1][front_copy.x].seen = true;
                Graph[front_copy.y+1][front_copy.x].counter = front_copy.counter+1;
                bfs.push(Graph[front_copy.y+1][front_copy.x]);
            }
        } 
        if(Graph[front_copy.y][front_copy.x+1].color)
        {
            if(!Graph[front_copy.y][front_copy.x+1].seen)
            {
                Graph[front_copy.y][front_copy.x+1].seen = true;
                Graph[front_copy.y][front_copy.x+1].counter = front_copy.counter+1;
                bfs.push(Graph[front_copy.y][front_copy.x+1]);
            }
        } 
        if(Graph[front_copy.y][front_copy.x-1].color)
        {
            if(!Graph[front_copy.y][front_copy.x-1].seen)
            {
                Graph[front_copy.y][front_copy.x-1].seen = true;
                Graph[front_copy.y][front_copy.x-1].counter = front_copy.counter+1;
                bfs.push(Graph[front_copy.y][front_copy.x-1]);
            }
        }
    }
}

int main()
{
    ll H,W;
    cin >> H >> W;

    vector<vector<Node>> Graph(H+2,vector<Node>(W+2));
    ll black_number;
    ALLIN_GRAPH(H,W,Graph,black_number);

    BFS(Graph);

    ll ans = (H*W - (Graph[H][W].counter + 1) - black_number); 

    if(Graph[H][W].counter == 1e9)
    {
        OUT0(-1);
    } 
    else
    {
        OUT0(ans);
    }

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    int64_t N, A, B, digits_A, digits_B, ans = 10000000000;
    vector<int64_t> divisor;
    cin >> N;
    for(int i = 1; i <= sqrt(N); i++){
 
        if(N % i == 0) divisor.push_back(i);
 
    }
 
    for(int64_t x : divisor){
        A = x;
        digits_A = 0;
        digits_B = 0;
        B = N / A;
 
        while(A > 0){
            digits_A++;
            A /= 10;
        }
 
        while(B > 0){
            digits_B++;
            B /= 10;
        }
 
        if(digits_A >= digits_B){
            if(digits_A < ans) ans = digits_A;
        }
 
        if(digits_A <= digits_B){
            if(digits_B < ans) ans = digits_B;
        }
 
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int x[5], ans;
  REP(i, 5) {
    cin >> x[i];
    if(x[i] == 0) {
      ans = i + 1;
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
	int n;
	cin >> n;
	if (n % 1000 == 0) cout << 0 << endl;
	else cout << 1000 - n % 1000 << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
typedef  long long ll; 
#define ld long double
#define syncboost ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
#define mp make_pair
#define pb push_back
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vpl vector<pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define sz(x) (ll) x.size()
#define precise(n) cout << fixed; cout << setprecision(n)
#define run(i, v) for(auto &i: v)
#define hike(i, v) for(const auto &i: v)
#define srt(v) sort(v.begin(),v.end())
#define mem(x,val) memset(x,val,sizeof(x))
#define rep(i,init,n) for(ll i=init;i<n;i++)
#define rrep(i,n,init) for(ll i = n;i>=init;i--)
#define fi first
#define se second
#define PI 3.14159265
#define MOD 998244353 
#define MAX 50005
#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)
#define yes cout<<"YES\n";
#define no  cout<<"NO\n";


void solve()
{
    
 ll arr[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  ll k;
  cin>>k;
  cout<<arr[k-1];

}
signed main()
{
    ll t = 1;
    syncboost;

     //cin>>t;
   // precise(10);
    

   while(t--)
    {
        solve();    
    }  
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

int main(){
    vector<int> A;
    for (int i=0;i<3;i++) {
        int x;
        cin >> x;
        A.push_back(x);
    }
    
    sort(A.begin(), A.end());
    //scanf("%d %d %d", &A[0], &A[1], &A[2]);
    
    int sum = 0;
    for (int i=0;i<2;i++) {
        sum += A[i+1] - A[i];
    }
    
    //printf("%d %d %d\n", A[0], A[1], A[2]);
    /*for(int i = 0; i < A.size(); i++)
        cout << A[i] << " ";
    cout << endl;*/
    
    cout << sum << endl;
    
    return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int h, w;
vector<string> g;

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

	cin >> h >> w;

	g.resize(h);
	for (auto &v : g) {
		cin >> v;
	}

	vector<vector<int>> memo(h, vector<int>(w));

	// 右へ左へ
	for (int y = 0; y < h; y++) {
		int score = 0;
		for (int x = 0; x < w; x++) {
			score = g[y][x] == '.' ? score + 1 : 0;
			memo[y][x] += score;
		}

		score = 0;
		for (int x = w - 1; x >= 0; x--) {
			score = g[y][x] == '.' ? score + 1 : 0;
			memo[y][x] += score;
		}
	}

	// 下へ上へ
	for (int x = 0; x < w; x++) {
		int score = 0;
		for (int y = 0; y < h; y++) {
			score = g[y][x] == '.' ? score + 1 : 0;
			memo[y][x] += score;
		}

		score = 0;
		for (int y = h - 1; y >= 0; y--) {
			score = g[y][x] == '.' ? score + 1 : 0;
			memo[y][x] += score;
		}
	}

	int ans = 0;
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			if (g[y][x] == '#') continue;
			ans = max(ans, memo[y][x] - 3);
		}
	}

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


Measured memory_bytes: 20224
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    string s;
    long long k;
    cin >> s >> k;
    long long count=0;
    long long count2=0;
    long long count3=0;
    if(k==1){
        long long count=0;
        for(int i=0; i<s.length(); i++){
            if(s[i]==s[i-1]){
                count++;
                i++;
            }
        }
        cout << count << endl;
        return 0;
    }
    s=s+s+s;
    for(int i=0; i<s.length(); i++){
        if(s[i]==s[i-1]){
            if(s.length()/3<=i&& i<s.length()*2/3)count2++;
            else if(s.length()*2/3<=i)count3++;
            else count++;
            i++;
        }
    }
    cerr << count2 << endl << count3 << endl;;
    if(k>=3){
        count+=k/(long long)2*count2;
        count+=(k-1)/(long long)2*count3;
    }
    if(k==2)count=count+count2;
    cout << count << endl;
}


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

int main() {
	long long int n, a, b;
	cin >> n >> a >> b;

	long long int num = n / (a + b);
	long long int rmd = n % (a + b);

	long long int cnt = 0;
	cnt += a * num;
	if (rmd < a) {
		cnt += rmd;
	} else {
		cnt += a;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	//[l,r)
	long sum1(int l,int r) {
		return (long)(r-l)*(r+l-1)/2;
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		double max=0,cur=0;
		int N=sc.nextInt();//1+2+...+p=p*(p+1)/2
		int K=sc.nextInt();
		int[] p=new int[N];
		for(int i=0;i<N;++i)p[i]=sc.nextInt();
		for(int t=0;t<N;++t) {
			cur+=(p[t]+1)*0.5-(t-K>=0?(p[t-K]+1)*0.5:0);
			max=Math.max(max, cur);
		}
		System.out.println(max);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 74952
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let _n: i64 = read();
    let s: String = read();

    let mut count = [0u64; 26];
    for c in s.chars() {
        count[c as usize - 'a' as usize] += 1
    }

    let mut ans = 1;
    for &x in count.iter() {
        ans = (ans * (x + 1)) % (10u64.pow(9) + 7);
    }

    println!("{}", ans - 1);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
N = int(input())
A = list(map(int,input().split()))
ans = 10**8
for a in A:
    cnt = 0
    while True:
        if a%2 == 0:
            a /= 2
            cnt += 1
        else:
            if cnt < ans:
                ans = cnt
            break
print(ans)

Measured memory_bytes: 3188
import java.util.*;
import java.util.Map.Entry;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String w = in.next();
		
		HashMap<Character,Integer> hm = new HashMap<Character,Integer>();
		for (int i=0;i<w.length();i++) {
			if(hm.containsKey(w.charAt(i))) {
                  hm.put(w.charAt(i), hm.get(w.charAt(i))+1);}
              else { hm.put(w.charAt(i), 1);}}
		
		boolean flag = true;
		for (Entry<Character, Integer> entry : hm.entrySet()) {
            int value = entry.getValue(); 
            char key = entry.getKey(); 
            if (value%2!=0) {
            	flag = false;
            	break;}}
            
            if (flag) {
            	System.out.println("Yes");}
            else {
            	System.out.println("No");}
            }
		}
	



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

int main() 
{
    long long int n,in;
    cin>>n;
    vector<long long > v,v1;
    for(int i=0;i<n;i++)
    {
        cin>>in;
        v.push_back(in);
    }
    long long ans=*max_element(v.begin(),v.end());
    v1=v;
    vector<long long>::iterator it=find(v.begin(),v.end(),ans);
    v.erase(it);
    long long ans2=*max_element(v.begin(),v.end());
    for(int i=0;i<n;i++)
    {
        if(v1[i]==ans)
        {
            cout<<ans2<<endl;
        }
        else
            cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 4848
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    set_a = set()
    set_b = set()

    for i in range(m):
        a, b = list(map(int, input().split()))

        if a == 1:
            set_b.add(b)
        elif b == n:
            set_a.add(a)

    if len(set_a & set_b) > 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')


Measured memory_bytes: 18884
v = [int(d) for d in input().split()]

if v[0] <= 12:
    if v[0] >= 6:
        print(int(v[1]/2))
        exit()
if v[0] <= 5:
    print('0')
    exit()
if v[0] >= 13:
    print(v[1])
    exit()

Measured memory_bytes: 3060
n = int(input())
l= []
x = 0
for elt in range(n):
    inp = input()
    l.append(inp)
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :
        print("No")
        x+=1
        break

    else:
        if elt < len(l)-1:
            if l[elt][-1] != l[elt+1][0]:
                print("No")
                x += 1
                break
if x == 0:
    print("Yes")





Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pii pair <int,int>
ll mod=1000000007;
int main()
{
	fast;
	ll d,t,s;cin>>d>>t>>s;
	if(t*s>=d)
		cout<<"Yes";
	else
		cout<<"No";

}

Measured memory_bytes: 3656