akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

int main() {
	string s,t; cin >> s;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			if (t.size() != 0) t.pop_back();
		}
		if (s[i] == '1') t.push_back(s[i]);
		if (s[i] == '0') t.push_back(s[i]);
	}
	cout << t;

	cout << endl;
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL h, w;
    cin >> h >> w;
    if(h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }
    LL s = h * w;
    s -= (w / 2) * (h / 2 + h % 2);
    s -= (w / 2 + w % 2) * (h / 2);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {

	int n;
	cin >> n;
	vi a(n);
	rep(i, n)cin >> a[i];
	sort(all(a));
	int ans = 0;
	rep(i, n)rep(j, n)rep(k, n) {
		if (i >= j || j >= k)continue;
		if (a[i] == a[j] || a[j] == a[k])continue;
		if (a[i] + a[j] > a[k])ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

void Main() {
  vector<int> vi(5);
  for (auto& e : vi) cin >> e;
  sort(all(vi));

  int mmin = 1e9;
  do {
    int time = 0;
    for (int i = 0; i < 5; ++i) {
      time += vi[i];
      if (i == 4) break;
      for (;;) {
        if (time % 10 == 0) break;
        time++;
      }
    }
    mmin = min(mmin, time);
  } while (next_permutation(all(vi)));

  cout << mmin << endl;
  return;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

unsigned digits_sum(unsigned n);

int main(int argc, char const *argv[])
{
    unsigned N, minor;

    cin >> N;

    minor = digits_sum(1) + digits_sum(N-1);

    for(unsigned i = 2; i < N/2; i++)
    {
        unsigned test = digits_sum(i) + digits_sum(N-i);

        if(test < minor) minor = test;
    }

    cout << minor << endl;
    return 0;
}

unsigned digits_sum(unsigned n)
{
    unsigned place = 1;
    unsigned sum = 0;

    while (n)
    {
        unsigned place_value = n % (unsigned) 10;
        sum += place_value;
        n -= place_value;
        n /= 10;
    }
    
    return sum;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n,x,t;
  cin>>n>>x>>t;
  cout << ((n+x-1)/x)*t << endl;
  return 0;
}

Measured memory_bytes: 3572
fun main(args: Array<String>){
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val x = readLine()!!.toInt()

    var ret = 0
    for(i in 0..a){
        val xx = x - 500 * i
        if(xx == 0){
            ret += 1
            break
        }
        if(xx < 0) break
        for(j in 0 .. b){
            val xxx = xx - 100 * j
            if(xxx == 0){
                ret += 1
                break
            }
            if(xxx < 0) break
            if(xxx <= 50 * c) ret += 1
        }
    }
    print(ret)
}

Measured memory_bytes: 31708
// doot diddly donger cuckerino Hahahahahah


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")

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

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

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

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

const ld PI = acos(-1);

template <typename T> inline T mini(T& x, T y) { return x = min(x, y); }
template <typename T> inline T maxi(T& x, T y) { return x = max(x, y); }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

class CAXBC {
public:
  
  void solve(std::istream& cin, std::ostream& cout) {
    ll n;
    cin >> n;
    ll cnt = 0;
    for (ll a = 1; a < n; a++) {
      for (ll b = 1; b * a <= n; ++b) {
        if (a * b < n) ++cnt;
      }
    }
    cout << cnt << endl;
  }
};

int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
	CAXBC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll n;
ll val(ll a){
	if(a == 1) return 1LL;
	else return 2LL*val(a/2)+1LL;
}
int main(){
	cin>>n;
	cout<<val(n)<<endl;
}

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

int main(){
    int h,w;
    cin>>h>>w;
   
    char p[101][101];
    for(int hh=0;hh<h;hh++){
        for(int ww=0;ww<w;ww++){
            cin>>p[hh][ww];
        }
    }

    for(int t=0;t<w+2;t++)cout<<'#';
    cout<<"\n";

    for(int a=0;a<h;a++){
        cout<<'#';

        for(int b=0;b<w;b++){
            cout<<p[a][b];
        }

        cout<<'#'<<"\n";
    }

    for(int t=0;t<w+2;t++)cout<<'#';
    cout<<"\n";

    return 0;
} 


Measured memory_bytes: 256
#![allow(non_snake_case, unused_variables, unused_mut, dead_code)]
//use permutohedron::LexicalPermutation as _;
//use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
//use std::cmp::*;
//use std::num;

fn main() {
    proconio::input! {
        S:proconio::marker::Chars
    }
    let ans = if S.contains(&'A') && S.contains(&'B') {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


Measured memory_bytes: 2128
#include <cstdio>

int main(){

	int N;
  	int sum = 0;
  	
  	scanf("%d",&N);
  	int tmp = N;
  	
  	while(tmp > 0){
    
     	sum += tmp % 10;
      	tmp /= 10;
    
    }
  
  	if(N % sum == 0){
    	
      	puts("Yes");
      	
    } else {
    
    	puts("No");
    
    }
  
  	return 0;
  
}

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

int main() {
  long long int a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  for(int i=0;i<3;i++){
    if(a[i]%2==0){
      cout<<0;
      return 0;
    }
  }
  
  cout<<a[0]*a[1];
  
}

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

typedef long long LL;

const LL INF=(1LL<<60)-1,inf=(1LL<<30)-1;
const int pr[3]={2,3,5};

LL n,a[3],d;

void into(){
  scanf("%lld%lld%lld%lld%lld",&n,&a[0],&a[1],&a[2],&d);
}

map<LL,LL>dp;

LL Dfs_dp(LL n){
  if (dp.find(n)!=dp.end()) return dp[n];
  LL res=INF;
  for (int i=0;i<3;++i){
	int t=pr[i];
	LL l=n/t,r=(n+t-1)/t;
	if (l<n) res=min(res,Dfs_dp(l)+a[i]+d*(n-l*t)),assert(l*t<=n);
	if (l<n&&n-l<inf) res=min(res,Dfs_dp(l)+d*(n-l));
	if (r<n) res=min(res,Dfs_dp(r)+a[i]+d*(r*t-n)),assert(r*t>=n);
	if (r<n&&n-r<inf) res=min(res,Dfs_dp(r)+d*(n-r));
  }
  return dp[n]=res;
}

void Get_dp(){
  dp.clear();
  dp[0]=0;
  dp[1]=d;
  Dfs_dp(n);
}

void work(){
  Get_dp();
}

void outo(){
  printf("%lld\n",dp[n]);
}

int main(){
  int T;
  scanf("%d",&T);
  for (;T--;){
    into();
	work();
    outo();
  }
  return 0;
}

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

using namespace std;

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

  int N;
  cin>>N;
  vector<vector<int>> table(N, vector<int>(N-1));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N-1; j++) {
      int t; cin>>t;
      t--;
      table[i][j] = t;
    }
  }
  vector<int> is(N, 0);
  unordered_set<int> cands;
  auto check = [&](int x) {
    if (is[x] < N-1) {
      int io = table[x][is[x]];
      if (is[io] < N-1 and table[io][is[io]] == x) {
        cands.insert(x);
        cands.insert(io);
      }
    }
  };
  for (int i = 0; i < N; i++) {
    check(i);
  }
  int d = 0;
  while (not cands.empty()) {
    vector<bool> played(N, false);
    vector<int> ncands;
    for (auto i : cands) {
      ncands.push_back(i);
      if (is[i] == N-1)
        continue;
      int o = table[i][is[i]];
      if (not played[i] and not played[o]) {
        played[i] = played[o] = true;
        ++is[i];
        ++is[o];
      }
    }
    cands.clear();
    for (auto c : ncands)
      check(c);
    d++;
  }
  bool suc = true;
  for (int i = 0; i < N; i++) {
    suc &= is[i] == N-1;
  }
  cout << (suc ? d : -1) << endl;

  return 0;
}


Measured memory_bytes: 4224
n = int(input())
h = list(map(int, input().split()))

# dp[i][j]: 足場iまで見た時 jまでの最小コスト
dp = [0 for i in range(n)]

dp[1] = abs(h[1] - h[0])

for i in range(n):
    if i == 0 or i == 1:
        continue

    cost1jump = dp[i - 1] + abs(h[i] - h[i - 1])
    cost2jump = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = min(cost1jump, cost2jump)

print(dp[-1])


Measured memory_bytes: 52720
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main()
{
	map<int, int> cnt;
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		int m;
		cin >> m;
		cnt[m]++;
	}
	int ans = 0;

	for (auto u : cnt)
	{
		if (u.second >= u.first)
			ans += (u.second - u.first);
		else
			ans += u.second;
	}
	cout << ans << endl;

	return 0;
}
//8
//2 7 1 8 2 8 1 8

Measured memory_bytes: 7996
S=list(input())
l=len(S)

available=[]
for i in range(26):
    available.append(chr(i+97))

for i in S:
    available.remove(i)

if l<26:
    S.append(available[0])
else:
    f=0
    for i in range(l):
        start=ord(S[-1])+1
        for i in range(26):
            want=chr(start+i)
            if want in available:
                S.remove(S[-1])
                S.append(want)
                f=1
                break
        if f==1:
            break
        else:
            available.append(S[-1])
            S.remove(S[-1])
if len(S)==0:
    ans='-1'
else:
    ans=''
    for i in S:
        ans+=i
print(ans)


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

int main(){
  int N,M,X;cin>>N>>M>>X;
  vector<int> C(N);
 // vector<int,vector<int>> A(N,vector<int>(M));
  int A[N][M];
  for(int i=0;i<N;i++){
    cin>>C.at(i);
    for(int j=0;j<M;j++) cin>>A[i][j];
  }
  priority_queue<int,vector<int>,greater<int>> ans;
  
  
  for(int bit=0;bit<(1<<N);bit++){
    vector<int> S;
    for (int i = 0; i < N; ++i) {
      if(bit & (1<<i)){// 列挙に i が含まれるか
        S.push_back(i);
      }
    }
    int sum=0;
    int size=S.size();
    vector<int> unstM(M,0);
    for(int i=0;i<size;i++){
      sum +=C.at(S.at(i));
      //for(int j=0;j<M;j++) unstM.at(j)+=A.at(S.at(i)).at(j);
      for(int j=0;j<M;j++) unstM.at(j)+=A[S.at(i)][j];
    }
    bool can=true;
    for(int i=0;i<M;i++){
      if(unstM.at(i)<X){
        can=false;
        //bool can=false;
        break;
      }
    }
    if(can) ans.push(sum);
  }
  if(ans.empty()) cout<<-1<<endl;
  else cout<<ans.top()<<endl;
}

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

int sum_digits(int n){
  int sum = 0;
  while(n > 0){
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int count = 0;
  for (int i=0; i<=N; ++i){
    if (A <= sum_digits(i) && B >= sum_digits(i)){
      count += i;
    }
  }
  cout << count << endl;
  return 0;
}

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

const ll MOD = 1000000007;
ll dp[101][9];

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

    //dp[h][x]は、上からh段目にいるとき、左からx番目の縦棒にいる場合の数を
    //記録するdpテーブル。始点は左上端であるため、dp[0][0]のみを1、そのほかを0で初期化している。
    dp[0][0] = 1;
    for(ll h=0; h<H; h++) {
        for(ll x=0; x<W; x++) {

            //横棒を引く位置(左点のある縦棒の番号)をbit列を用いて全探索
            //横棒を引く高さは上からh+1行目
            for(int i=0; i<(1<<(W-1)); i++) {
                
                //h+1段目に横棒を引く位置を配列に記録する。
                //例として、iがビット列で0100101なら、下のfor文によって
                //{0, 3, 5}という配列が生成される。
                vector<int> vec;
                for(int j=0; j<W-1; j++) {
                    if((i>>j) & 1) vec.push_back(j);
                }


                bool f = false;
                ll pre = -2;
                set<int> st;
                ll len = (ll)vec.size();

                //上で生成した配列によって、正しく横棒が引かれるか検証する。
                for(int k=0; k<len; k++) {
                    if(vec[k] == pre+1) {

                        //横棒の端点は共有できないので、vecの要素が連続していたら
                         //スキップフラグを立てて離脱。
                        f = true;
                        break;
                    } else {

                        //正しく配置された横棒であれば、左端のある横棒の番号を
                        //setに挿入する。これは、set::count関数によって横棒の
                        //有無を簡単に把握できるため。
                        st.insert(vec[k]);
                        pre = vec[k];
                    }
                }

                //fがtrueのときいずれかの端点が共有されているので無効
                if(f) continue;

                //dpテーブルの更新操作
                if(st.count(x-1)) {
                    //x-1を左端とする横棒が引かれるということは、現在いる位置(x)から
                    //左に移動するという事だから、現在までの場合の数を移動先の場合の数に足し込む。
                    dp[h+1][x-1] = (dp[h+1][x-1] + dp[h][x]) % MOD;
                } else if(st.count(x)) {
                    //xを左端とする横棒が引かれるなら、移動先はx+1
                    dp[h+1][x+1] = (dp[h+1][x+1] + dp[h][x]) % MOD;
                } else {
                    //x, x-1のどちらからも横棒が引かれない場合、移動先はそのままで段数だけ下がる。
                    dp[h+1][x] = (dp[h+1][x] + dp[h][x]) % MOD;
                }
            }       
        }
    }

    //dpのインデックスはゼロスタートであることに注意する。
    //最後の段数はH-1ではなくH(問題の図ではH+1段目)
    cout << dp[H][K-1] << endl;
    return 0;
}

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

struct card{
    public: char c; int x;
};

void merge(card *A, int left, int mid, int right){
    int n1=mid - left;
    int n2 = right - mid;
    int i,j,k;
    card L[1000000], R[1000000];
    for(i=0;i<n1;i++){
        L[i].c = A[left+i].c;
        L[i].x = A[left+i].x;
    }
    for(i=0;i<n2;i++){
        R[i].c = A[mid+i].c;
        R[i].x = A[mid+i].x;
    }
    L[n1].x = 100000000;
    R[n2].x = 100000000;

    i=0;
    j=0;
    for(k=left;k<right;k++){
        if(L[i].x<=R[j].x){
            A[k]=L[i];
            i++;
        }

        else{
            A[k]=R[j];
            j++;
        }
    }
}

void mergesort(card *A, int left, int right){
    int mid = (left+right)/2;
    if(left+1<right){
        mergesort(A, left, mid);
        mergesort(A, mid, right);
        merge(A, left, mid ,right);
    }
}



int partition(int *A, int p, int r){
    int i, j;
    int x = A[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j]<=x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

int partition_card(card *A, int p, int r){
    int i, j;
    int x = A[r].x;
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j].x<=x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

void quicksort(int *A, int p, int r){
    if(p<r){
        int q = partition(A, p, r);
        quicksort(A, p, q-1);
        quicksort(A, q+1, r);
    }
}

void quicksort_card(card *A, int p, int r){
    if(p<r){
        int q = partition_card(A, p, r);
        quicksort_card(A, p, q-1);
        quicksort_card(A, q+1, r);
    }
}

int main(){
    int n;
  	int t;
  	char tc;
    card A[1000000];
  	card B[1000000];
    scanf("%d", &n);
    for(int k=0;k<n;k++){
        scanf("%s %d", &tc, &t);
        B[k].c = A[k].c = tc;
        B[k].x = A[k].x = t;
    }


    quicksort_card(A, 0, n-1);
    mergesort(B, 0, n);
    int k=1;
    for(int j=0;j<n;j++){
        if(A[j].c!=B[j].c){
            cout<<"Not stable"<<endl;
            k=0;
            break;
        };
        //cout<<A[j].c<<" "<<A[j].x<<endl;
    }

    if(k) cout<<"Stable"<<endl;

    for(int j=0;j<n;j++){
        if(A[j].c!=B[j].c) k=0;
        cout<<A[j].c<<" "<<A[j].x<<endl;
        //cout<<B[j].c<<" "<<B[j].x<<endl;
      
    }

    return 0;
}



Measured memory_bytes: 5468
l = []
for i in range(3):
    ll = [int(x) for x in input().split()]
    l.append(ll)
if l[0][0] - l[0][1] != l[1][0] - l[1][1] or l[2][0] - l[2][1] != l[1][0] - l[1][1]:
    print("No")
    exit()
if l[0][2] - l[0][1] != l[1][2] - l[1][1] or l[2][2] - l[2][1] != l[1][2] - l[1][1]:
    print("No")
    exit()
if l[0][0] - l[1][0] != l[0][1] - l[1][1] or l[0][2] - l[1][2] != l[0][1] - l[1][1]:
    print("No")
    exit()
if l[2][0] - l[1][0] != l[2][1] - l[1][1] or l[2][2] - l[1][2] != l[2][1] - l[1][1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
    int p, q, r, temp;
    cin >> p >> q >> r;

    if(p>=q and p>=r){
        p=0;
    } else if(q>=p and q>=r){
        q=0;
    } else{
        r=0;
    }
    cout << p+q+r << endl;

    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate

def solve(A,K):

    opt = [0]+list(accumulate(a if a > 0 else 0 for a in A))
    plain = [0]+list(accumulate(A))

    def it():
        for i in range(len(A)-K+1):
            x = opt[i] + opt[-1] - opt[i+K]
            yield x
            yield x + plain[i+K] - plain[i]

    return max(it())


if __name__ == '__main__':
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    print(solve(A,K))

Measured memory_bytes: 98292
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>

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

using namespace std;

typedef pair<int, int> P;

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

vector<P> open;
int W, H, N;
char field[1002][1002];

bool visit[1002][1002];
bool check(int n){
	memset(visit, 0, sizeof(visit));

	rep(i, min(n, (int)open.size())){
		field[open[i].second][open[i].first] = '.';
	}
	for(int i = n; i < open.size(); i++){
		field[open[i].second][open[i].first] = '#';
	}

	//cout << n << endl;
	//rep(i, 10){
	//	rep(j, 10){
	//		cout << field[i][j];
	//	}cout << endl;
	//}cout << endl;

	queue<P> q;
	q.push(MP(0, 0));

	while(!q.empty()){
		P p = q.front();
		q.pop();
		
		if(visit[p.second][p.first]) continue;
		visit[p.second][p.first] = true;

		if(field[p.second][p.first] == 't') return true;

		rep(i, 4){
			int nx = p.first+dx[i], ny = p.second+dy[i];
			if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
			if(field[ny][nx] != '#') q.push(MP(nx, ny));
		}
	}

	return false;
}


int main(){
	cin >> W >> H;
	rep(i, H) rep(j, W) cin >> field[i][j];
	cin >> N;
	rep(i, N){
		int x, y;
		cin >> x >> y;
		if(field[y][x] != '#'){
			x = y = 1001;
		}
		open.push_back(MP(x, y));
	}

	int lb = -1, ub = 10000;
	while(ub - lb > 1){
		int mid = (lb+ub)/2;
		if(check(mid))ub = mid;
		else lb = mid;
	}
	cout << (ub>N?-1:ub) << endl;

	return 0;
}

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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
    int N, M, X;
    cin >> N >> M >> X;

    vector<vector<int>> list(N, vector<int>(M + 1));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M + 1; j++)
        {
            cin >> list[i][j];
        }
    }

    int ans = mod;
    for (int bitto = 0; bitto < (1 << N); bitto++)
    {
        vector<int> skill(M, 0);
        int price = 0;
        bool x = true;
        bitset<12> s(bitto);
        
        for (int i = 0; i < N; i++)
        {
            //販売中
            if(s.test(i))
            {
                price += list[i][0];
                for (int j = 0; j < M; j++)
                    skill[j] += list[i][j + 1];
            }
        }
        //要件満たしてるか
        for (int i = 0; i < M; i++)
            if(skill[i]<X)
                x = false;
        if(x)
            ans = min(ans, price);
    }
    cout << (ans != mod ? ans : -1);
}

Measured memory_bytes: 3636
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

def floor(a,b):
    return a//b

N = I()

ans = 0

for i in range(1,10**6+1):
    ans += floor((N-1),i)

print(ans)

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

using namespace std;

class Point{
public:
	double x,y;
	bool done;
	bool operator<(const Point &p) const{
		if( x < p.x ) return true;
		else return false;
	}
};
class Vector{
public:
	double x,y,z;
	Vector():x(0.0),y(0.0),z(0.0){}
	Vector(Point po,Point pt){
		x = pt.x - po.x;
		y = pt.y - po.y;
		z = 0.0;
	}
};

Vector Cross(Vector va, Vector vb){
	Vector vret;
	vret.x = va.y * vb.z - vb.y * va.z;
	vret.y = va.z * vb.x - vb.z * va.x;
	vret.z = va.x * vb.y - vb.x * va.y;
	return vret;
}

int main(void){
	while( true ){
		int cnt = 0;
		int nowPoint = 0;
		int n;
		vector<Point> vPoints;

		scanf("%d", &n);
		if( n == 0 ) break;

		for(int i = 0; i < n; i++){
			Point p;
			scanf("%lf,%lf", &p.x, &p.y);
			p.done = false;
			vPoints.push_back( p );
		}
		sort(vPoints.begin(), vPoints.end());

		vPoints[nowPoint].done = true;
		do{
			for(int i = 0; i < n; i++){
				if( !vPoints[i].done ){
					Vector vo(vPoints[nowPoint],vPoints[i]);
					bool isPerimeter = true;
			
					vPoints[i].done = true;
					for(int j = 0; j < n; j++){
						if( !vPoints[j].done ){
							Vector vt(vPoints[nowPoint],vPoints[j]);
							Vector cr = Cross(vo, vt);
					
							if( cr.z > 0 ){
								isPerimeter = false;
								break;
							}
						}
					}
					if( !isPerimeter ) vPoints[i].done = false;
					else{
						nowPoint = i;
						vPoints[0].done = false;
						break;
					}
				}
			}
		}while( nowPoint != 0 );

		vPoints[0].done = true;
		for(int i = 0; i < n; i++){
			if( !vPoints[i].done ) cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

int main()
{
	string w;
	cin >> w;

	int32_t ALPHA_MAX = 26;
	vector<int32_t> cnts(ALPHA_MAX);
	std::fill(cnts.begin(), cnts.end(), 0);

	for (size_t i = 0; i < w.size(); i++) {
		cnts[w[i] - 'a']++;
	}
	for (int32_t i = 0; i < ALPHA_MAX; i++) {
		if (cnts[i] % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int d;
  cin >> d;
  if(d==25) cout << "Christmas" << endl;
  else if(d==24) cout << "Christmas Eve" << endl;
  else if(d==23) cout << "Christmas Eve Eve" << endl;
  else cout << "Christmas Eve Eve Eve" << endl;
}

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

template<typename T>
vector<T> convert_base(T x, T base) {
    if (x == 0) return {0};
    vector<T> ret;
    while (x) {
        T r = x % base;
        if (r < 0) r -= base;
        x = (x - r) / base;
        ret.emplace_back(r);
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

int main() {
    int n; cin >> n;
    for (int x: convert_base(n, -2)) cout << x;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    double T,X;
    cin>>T>>X;
    double z=T/X;
    cout<<setprecision(10.10)<<endl;
    cout<<z<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl;

using namespace std;
const int inf = 1e18;
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	double a,b;
	cin>>a>>b;
	int ans = a*b;
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define clr(x,y) memset(x,y,sizeof x)
#define INF 0x3f3f3f3f
const int maxn = 1e5 + 10;
typedef long long ll;
typedef unsigned long long ull;
const ull D = 131;
const ll Mod = 1e9 + 7;
const int N = 2e6 + 10;

int main()
{
    int n;ll a[90];
    a[1] = 1;a[0] = 2;
    for(int i = 2;i < 90;i ++)a[i] = a[i - 1] + a[i - 2];
    while( ~ scanf("%d",&n))
    {
        printf("%lld\n",a[n]);
    }
    return 0;
}


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

#define NEGATIVE_INF -999999999
#define INF 999999999

using namespace std;

typedef vector<int> vi;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  vi xs(N), ys(M);
  int max_x = NEGATIVE_INF;
  int min_y = INF;
  for (int i=0; i<N; i++) {
    cin >> xs[i];
    max_x = max(max_x, xs[i]);
  }
  for (int i=0; i<M; i++) {
    cin >> ys[i];
    min_y = min(min_y, ys[i]);
  }
  int Z = max_x + 1;
  cout << ((min_y >= Z && X < Z && Z <= Y) ? "No War" : "War") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, z, n) for(int64_t i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

vector<pair<int64_t, int64_t>> prime_factorize(int64_t n) {
    vector<pair<int64_t, int64_t>> res;
    for (int64_t p = 2; p * p <= n; p++) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0){
            num++;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    int64_t N;
    cin >> N;
    vector<pair<int64_t, int64_t>> p = prime_factorize(N);
    
    int64_t count = 0;
    rep(i, 0, p.size()){
        int64_t X = p.at(i).first;
        int64_t Y = p.at(i).second;
        int n = 0;
        while(((n + 2) * (n + 1)) / 2 <= Y){
            n++;
        }
        //cout << X << " " << Y << " " << n << endl;
        count += n;
    }
    cout << count << endl;
}

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


int main(){
  
  int K, N, i;
  long long Sum = 0;
  cin >> N >> K;
  vector<int> p(N);
  
  for(i = 0; i < N; i++){
   cin >> p.at(i); 
  }
  sort(p.begin(), p.end());
  
  for(i = 0; i < K; i++){
   Sum += p.at(i); 
  }  
  
  cout << Sum << endl;
  return 0;
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define previous fake_previous
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 2001;

int n;
int k;
VVI g;
vector<set<int>> graph;
VCH used;
VVI dist;
VCH is;
int counter;

inline void dfs1(int root, int v)
{
	used[v] = 1;
	for (auto i : g[v])
		if (used[i] == 0)
			dist[root][i] = dist[root][v] + 1, dfs1(root, i);
}

inline void dfs2(int v)
{
	counter++;
	used[v] = 1;
	for (auto i : graph[v])
		if (used[i] == 0 && is[i] == 1)
			dfs2(i);
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);

	cin >> n >> k;
	g.assign(n + 1, VI());
	int u, v;
	FOR(i, 0, n - 1)
	{
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	dist.assign(n + 1, VI());
	graph.assign(n + 1, set<int>());
	FOR(i, 1, n + 1)
	{
		used.assign(n + 1, 0);
		dist[i].assign(n + 1, 0);
		dfs1(i, i);
	}

	int ans = 0;

	FOR(i, 1, n + 1)
	{
		FOR(j, 1, n + 1)
			if (dist[i][j] > k)
				graph[i].insert(j);
	}

	VCH old;
	used.assign(n + 1, 0);
	is.assign(n + 1, 1);
	
	while (1)
	{
		int d = 1;
		FOR(i, 1, n + 1)
			if (is[i] == 1)
			{
				d = i;
				break;
			}

		FOR(i, 1, n + 1)
			if (is[i] == 1 && SZ(graph[i]) > SZ(graph[d]))
				d = i;

		if (SZ(graph[d]))
		{
			++ans;
			is[d] = 0;
			for (auto i : graph[d])
				graph[i].erase(d);
		}
		else
			break;
	}

	cout << ans << endl;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 203392
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long ll;

constexpr long long INFLL = 1e18;

using namespace std;

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

    while (n > 0)
    {
        n -= 1000;
    }
    if (n < 0)
    {
        n *= -1;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 3220
class Formula():
    def __init__(self, S):
        self.input = S
        self.sum = 0
        self.input_len = len(S)

        self.input_split_pos = self.input_len - 1
        self.mask = 2**self.input_split_pos - 1

    def calc_sum(self, S: str, split_pos: int) -> int:
        stack = []
        split_pos = [i for i, x in enumerate(
            [int(x) for x in bin(split_pos)[2:].zfill(self.input_split_pos)]) if x == 1]

        start = 0
        if split_pos == []:
            stack.append(int(self.input))
        else:
            for i in split_pos:
                stack.append(int(self.input[start:i + 1]))
                start = i + 1
            stack.append(int(self.input[start:self.input_len]))
        self.sum += sum(stack)
        return self.sum


def main():
    S = input()
    formula = Formula(S)

    bits = 0b0

    while bits <= formula.mask:
        formula.calc_sum(S, bits & formula.mask)
        bits += 1
    print(formula.sum)


main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;

int main (int argc, char const *argv[])
{
    int X,A,B;
    cin>>X>>A>>B;

    int num=X-A;
    int don=num/B;

    cout<<num-don*B<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 50;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using pll = pair<long long, long long>;

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

	ll N, M, L;
	cin >> N >> M >> L;

	vector<vector<pair<ll, ll> > > vedge(N);
	rep(i, M) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		vedge[a].push_back(make_pair(b, c));
		vedge[b].push_back(make_pair(a, c));
	}

	vector<vector<pair<ll, ll> > > vBest(N, vector<pair<ll, ll> >(N, { longinf, longinf }));
	for (ll i = 0; i != N; ++i) {
		vBest[i][i].first = 0;
		vBest[i][i].second = 0;
		priority_queue<pair<pair<ll, ll>, ll >,
			vector<pair<pair<ll, ll>, ll > >,
			greater<pair<pair<ll, ll>, ll > > > pque;
		pque.push(make_pair(make_pair(0, 0), i));

		while (!pque.empty()) {
			pair<pair<ll, ll>, ll> p = pque.top();
			pque.pop();
			ll init = p.second;
			ll hokyu = p.first.first;
			ll used = p.first.second;

			if (p.first > vBest[i][init]) continue;

			for (ll j = 0; j != vedge[init].size(); ++j) {
				ll next = vedge[init][j].first;
				ll cost = vedge[init][j].second;

				if (cost > L) continue;

				ll next_hokyu = hokyu;
				ll next_used = used;
				if (used + cost > L) {
					next_hokyu++;
					next_used = cost;
				}
				else {
					next_used = used + cost;
				}

				if (vBest[i][next].first > next_hokyu) {
					vBest[i][next].first = next_hokyu;
					vBest[i][next].second = next_used;
					pque.push(make_pair(make_pair(next_hokyu, next_used), next));
				}
				else if (vBest[i][next].first == next_hokyu) {
					if (vBest[i][next].second > next_used) {
						vBest[i][next].second = next_used;
						pque.push(make_pair(make_pair(next_hokyu, next_used), next));
					}
				}
			}
		}

	}

	ll Q;
	cin >> Q;
	for (int i = 0; i != Q; ++i) {
		ll s, t;
		cin >> s >> t;
		s--;
		t--;
		if (vBest[s][t].first == longinf) {
			cout << "-1" << endl;
		}
		else {
			cout << vBest[s][t].first << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 5656
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, N;
    String ans;
    int f;

    void run(){
	while(sc.hasNext()){
	    N = sc.nextInt();
	    n = N;
	    if(n==-1) break;

	    f = 1;
	    while(n>=f) f*=4;
	    ans = "";
	    int a = 0;

	    while(n>=0 && f>0){
		if(n>=f){
		    n -= f;
		    a++;
		}
		else{
		    ans += a;
		    a = 0;
		    f /= 4;
		}
	    }

	    //System.out.print(N+" : ");
	    System.out.println
		(ans.substring(0, 1).equals("0") && ans.length()>1 ? 
			       ans.substring(1, ans.length()) : ans);
	}
    }
}

Measured memory_bytes: 23428
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

//総和
/*
int t_sum(int x) {
	int sum = 0;
	while (x > 0) {
		sum += x % 10;
		x = x / 10;
	}
	return sum;
}
*/

int n[3];
int a[200000];

void solve() {
	sort(n, n + 3);
	cout << n[2] - n[0] << endl;
}

int main() {
	cin >> n[0]>>n[1]>>n[2];
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
typedef long long ll;

const ll inf = (1ll << 60ll);
ll n, m;
ll r;
ll node[10];
ll min_cost[205][205];
int visited[10];

ll dfs(int old, int m);

int main()
{
	for (ll i = 1; i <= 200; i++) {
		for (ll j = 1; j <= 200; j++) {
			min_cost[i][j] = inf;
			if (i == j) min_cost[i][j] = 0;
		}
	}

	scanf("%lld %lld %lld", &n, &m, &r);
	for (ll i = 0; i < r; i++) {
		scanf("%lld", &node[i]);
	}
	for (ll i = 0; i < m; i++) {
		ll a, b, c;

		scanf("%lld %lld %lld", &a, &b, &c);

		min_cost[a][b] = c;
		min_cost[b][a] = c;
	}

	for (ll k = 1; k <= n; k++) {
		for (ll i = 1; i <= n; i++) {
			if (min_cost[i][k] == inf) continue;
			for (ll j = 1; j <= n; j++) {
				if (min_cost[k][j] == inf) continue;
				min_cost[i][j] = min(min_cost[i][j], min_cost[i][k] + min_cost[k][j]);
			}
		}
	}

	printf("%lld\n", dfs(0, 0));

	return 0;
}

ll dfs(int old, int m)
{
	if (m == r) {
		return 0;
	}

	ll res = inf;
	for (int i = 0; i < r; i++) {
		if (!visited[i]) {
			visited[i] = 1;
			res = min(res, dfs(node[i], m + 1) + min_cost[old][node[i]]);
			visited[i] = 0;
		}
	}

	return res;
}


Measured memory_bytes: 512
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

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

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// }}}

int N;
ll h[100000];
ll dp[100000];

void solve()
{
    REP(i, N) dp[i] = LINF;
    dp[0] = 0;
    REP(i, N) {
        if (i + 1 < N) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
        if (i + 2 < N) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i]-h[i+2]));
    }
    cout << dp[N-1] << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> h[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
  return 0;
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	string s;
	cin >>s;
	cout <<s.front() <<s.size()-2 <<s.back() <<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __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>;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);    
    int n;
    cin >> n;
    int v[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> v[i];
    }
    vector<int> odd, even;
    map<int, int> ebco, ebce;
    for (int i = 1; i <= n; i++) {
        if (i & 1) { 
            odd.push_back(v[i]); 
        } else { 
            even.push_back(v[i]);
        }
    }
    sort(odd.begin(), odd.end()), sort(even.begin(), even.end());
    vector<int> cnto, cnte;
    int cnt = 0;
    for (int i = 0; i < n / 2; i++) {
        if (odd[i] == odd[i + 1]) {
            cnt++;
        } else {
            ebco[cnt + 1] = odd[i];
            cnto.push_back(cnt + 1);
            cnt = 0;
        }
    }
    cnt = 0;
    for (int i = 0; i < n / 2; i++) {
        if (even[i] == even[i + 1]) {
            cnt++;
        } else {
            ebce[cnt + 1] = even[i]; 
            cnte.push_back(cnt + 1);
            cnt = 0;
        }
    }
    int ans;
    if (cnto.size() == 1) {
        cnto.push_back(0);
    }
    if (cnte.size() == 1) {
        cnte.push_back(0);
    }
    sort(cnto.rbegin(), cnto.rend()), sort(cnte.rbegin(), cnte.rend());
    if (ebco[cnto[0]] == ebce[cnte[0]]) {
        ans = min(n - cnto[1] - cnte[0], n - cnto[0] - cnte[1]);
    } else {
        ans = n - cnto[0] - cnte[0];        
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4624
#include<bits/stdc++.h>
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;


void solve(){
	int a , b , c ; cin >> a >> b >> c ;
	if(a>=c){
		cout << a-c << ' ' << b << endl;
		return ;
	}else{
		c -= a ;
		b -= c ;
		cout << 0 << ' ' << max(b,0ll) << endl; 
	}
}

int32_t main(){IOS;

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


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

using namespace std;

int main(int argc, char const *argv[])
{
    long long N, D;
    cin >> N >> D;
    long long X, Y;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> X >> Y;
        if (X * X + Y * Y <= D * D)
        {
            cnt++;
        }
        
    }

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

Measured memory_bytes: 3196
#include <stdio.h>
#include <string.h>

int main(void) {
	int n;
	char str1[101], str2[101];
	int hanako = 0, tarou = 0;
	
	scanf("%d", &n);
	
	while (n--) {
		scanf("%s %s", str1, str2);
		
		if (strcmp(str1, str2) > 0) tarou += 3;
		else if (strcmp(str1, str2) < 0) hanako += 3;
		else {
			tarou++;
			hanako++;
		}
	}
	
	printf("%d %d\n", tarou, hanako);
	
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
using namespace std;
int main()
{
	int r,d,x;
	cin>>r>>d>>x;
	int a[11];
	a[1]=r*x-d;
	cout<<a[1]<<endl;
	for(int i=2;i<=10;i++)
	{
		a[i]=a[i-1]*r-d;
		cout<<a[i]<<endl;
	}
	return 0;
} 

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

int main() {
	int R;
	cin >> R;
	if (0 <=R && R<1200) {
		cout << "ABC" << endl;
	}
	else if(1200<=R && R<2800){
		cout << "ARC"<<  endl;
	}
	else{
		cout << "AGC"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>

const int mod = 1e9 + 7;

void swap(long long* a, long long* b){
  *a ^= *b;
  *b ^= *a;
  *a ^= *b;
}

long long inverse(long long x){
  long long m = mod, u = 1, v = 0;
  while(m){
    long long t = x / m;
    x -= t * m; swap(&x, &m);
    u -= t * v; swap(&u, &v);
  }
  u %= mod;
  if(u < 0) u += mod;
  return u;
}

int main(){
  long long H, W, A, B;
  scanf("%lld%lld%lld%lld", &H, &W, &A, &B);
  
  long long fact[H + W + 1];
  fact[0] = 1;
  for(int k = 1; k <= H + W; k++){
    fact[k] = fact[k - 1] * k % mod;
  }
  
  long long move = 0;
  for(long long j = B; j < W; j++){
    move += 
      fact[H - A - 1 + j] * inverse(fact[j] * fact[H - A - 1] % mod) % mod
      * fact[W - j + A - 2] % mod * inverse(fact[W - j - 1] * fact[A - 1] % mod) % mod;
    move %= mod;
  }
  
  printf("%lld\n", move);
  
  return 0;
}

Measured memory_bytes: 1664