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

ll k;

ll fun(ll a[], ll ind, ll dp[]){
    if(ind==0)return dp[0]=0;
    if(ind==1)return dp[1]=abs(a[0]-a[1]);
    ll& ans=dp[ind];
    if(ans!=-1)return ans;
    ll r=INT_MAX;
    for(ll i=ind-1;i>=0&&i>=ind-k;i--){
        r=min(r,abs(a[i]-a[ind])+fun(a,i,dp));
    }
    return ans=r;
    // return ans=min(abs(a[ind]-a[ind-1])+fun(a,ind-1,dp),abs(a[ind]-a[ind-2])+fun(a,ind-2,dp));
}

int main() {
    ll n;
    cin>>n>>k;
    ll a[n];
    ll dp[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        dp[i]=-1;
    }
    cout<<fun(a,n-1,dp);
}

Measured memory_bytes: 13008
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}


int main() {
	int h, n; cin >> h >> n;
	vec a(n);
	ll sum = 0;
	rep(i, n) {
		int x;
		cin >> x;
		sum += x;
	}
	if (sum < h)cout << "No" << endl;
	else cout << "Yes" << endl;



	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    multiset<int>adj[n];
    vector<int>val(n);
    f(i,0,n){
        cin >> val[i];
    }
    f(i,0,m){
        int x,y;
        cin >> x >> y;
        x--;
        y--;
        adj[x].insert(val[y]);
        adj[y].insert(val[x]);
    }
    int ans = 0;
    f(i,0,n){
        if(adj[i].size() == 0){
           ans++;
           continue;
        }
        auto s = adj[i].end();
        s--;
        if(val[i] > *s){
            ans++;
            // cout << val[i] << " " << *s << "\n";
            // cout << i << "\n";
        }
    }
    cout << ans << "\n";
    return 0;
}
 

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    string s;
    cin >> s;

    string t = "";
    REP(i, s.size()){
    	if(i<(int)s.size()-1 && s[i]=='B' && s[i+1]=='C'){
    		t += 'D';
    		i++;
    	}else{
    		t += s[i];
    	}
    }
    ll res = 0;
    ll cu = 0;
    REP(i, t.size()){
    	if(t[i] == 'A'){
    		cu++;
    	}else if(t[i]=='D'){
    		res += cu;
    	}else{
    		cu = 0;
    	}
    }
    cout << res << endl;
    //cout << t << endl;
    return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int a, b, c; cin >> a >> b >> c;
	Yes(a == b and b == c);

	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

class UnionFind(object):
    def __init__(self,n):
        self.__par=list(range(n))
        self.__rank=[0]*n
        self.__size=[1]*n

    def root(self,k):
        if(self.__par[k]==k): return k
        self.__par[k]=self.root(self.__par[k])
        return self.__par[k]

    def unite(self,i,j):
        i=self.root(i); j=self.root(j)
        par=self.__par; rank=self.__rank; size=self.__size
        if(i==j): return False
        if(rank[i]>rank[j]):
            par[j]=i
            size[i]+=size[j]
        else:
            par[i]=j
            size[j]+=size[i]
            if(rank[i]==rank[j]): rank[j]+=1
        return True

    def is_same(self,i,j):
        return self.root(i)==self.root(j)

    def size(self,k):
        return self.__size[self.root(k)]

def resolve():
    n,m=map(int,input().split())
    uf=UnionFind(m)
    S=set()
    for _ in range(n):
        L=list(map(int,input().split()))[::-1]
        k=L.pop()
        for i in range(k):
            S.add(L[i]-1)
            if(i+1<k):
                uf.unite(L[i]-1,L[i+1]-1)

    print("YES" if(max(uf.size(i) for i in range(m))==len(S)) else "NO")
resolve()

Measured memory_bytes: 66908
#include<bits/stdc++.h>
using namespace std;
int main(){
    int H, W;
    cin >> H >> W;
    string s[H];
    for(int i = 0; i < H; i++) cin >> s[i];
    int dh[] = {1, 0, -1, 0};
    int dw[] = {0, 1, 0, -1};
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            bool po = (s[i][j] == '.');
            for(int k = 0; k < 4; k++){
                if(!(0 <= i + dh[k] && i + dh[k] < H && 0 <= j + dw[k] && j + dw[k] < W)) continue;
                po |= (s[i + dh[k]][j + dw[k]] == '#');
            }
            if(!po){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

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

using namespace std;

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

    int ans = 0;
    for (int i = 0; i + 2 < n; ++i) {
        if (s.substr(i, 3) == "ABC") ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int N;
    string S;
    int cnt=0;
    cin >> N >> S;
    for(int i=0;i<N;i++){
        if(S.substr(i,3)=="ABC") cnt++;
    }
    cout << cnt << 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>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
const int N=2e5+5;
int mod=1e9+7;
int fact[N],invfact[N];

int power(int base,int exp)
{
	if(exp==0)
		return 1;
	if(exp&1)
		return ((base%mod)*power((base*base)%mod,exp/2))%mod;
	else
		return power((base*base)%mod,exp/2)%mod;
}

void precompute()
{
	fact[0]=1;
	fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
	}
	invfact[N-1]=power(fact[N-1],mod-2)%mod;
	for(int i=N-2;i>=0;--i)
	{
		invfact[i]=(invfact[i+1]*(i+1))%mod;
	}
}

int ncr(int a,int b)
{
	if(b>a)
		return 0;
	int temp=0;
	temp=fact[a]%mod;
	temp*=invfact[b];
	temp%=mod;
	temp*=invfact[a-b];
	temp%=mod;
	return temp%mod;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	precompute();
	int n,m,k;
	cin>>n>>m>>k;
	int ans=0;
	int add=ncr(n*m-2,k-2)%mod;
	for(int i=1;i<=n;i++)
	{
		int temp=(m*m)%mod;
		temp=(temp*add)%mod;
		temp=(temp*((i*(i-1))%mod))%mod;
		temp=(temp*(power(2,mod-2)%mod))%mod;
		ans=(ans+temp)%mod;
	}
	for(int i=1;i<=m;i++)
	{
		int temp=(n*n)%mod;
		temp=(temp*add)%mod;
		temp=(temp*((i*(i-1))%mod))%mod;
		temp=(temp*(power(2,mod-2)%mod))%mod;
		ans=(ans+temp)%mod;
	}
	cout<<ans%mod;
	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAXN 303
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    ll arr[n],ans=0;
    for(int i=0;i<n;i++)
       cin>>arr[i];
    if(n<3)
    {
        cout<<"0";
        return 0;
    }
    sort(arr,arr+n);
    vector<vector<ll> > v;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
           for(int k=j+1;k<n;k++)
           {
               if((arr[i]!=arr[j])&&(arr[j]!=arr[k]))
                  v.push_back({arr[i],arr[j],arr[k]});
           }
        }
    }
    for(int i=0;i<v.size();i++)
    {
        int x=v[i][0];
        int y=v[i][1];
        int z=v[i][2];
        if(x+y>z)
           ans++;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 13480
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend();
#define sz  size()
#define fr(i,a,b) for(int i=a ;i <= b ; i++ )
#define frr(i,a,b) for(int i=a ;i >= b ; i-- )
#define inp ios_base::sync_with_stdio(false);cin.tie(NULL);
#define PQ_INC vector<int>, greater<int>   //priority_queue
using namespace std ;

ll  lcm(ll a, ll  b){
 return a / __gcd(a,b) * b ;
}

const int N = 3e5 + 9 ,  MOD = 1e9+7 , OO = 0x3f3f3f3f ;
int dX[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dY[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int n , a , b ;
int main(){
   cin >> n >> a >> b ;
   cout << min (a * n ,b) ;
}


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

int i,j,n,nxt,code,MAX,sel;
int num[20],dist[20],wei[20],next[36000][20];
double time[36000][20],speed[36000],ttt,tim;

int main(){
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d %d %d",&num[i],&dist[i],&wei[i]);
		wei[i]*=20;
	}

	MAX=1<<n;

	for(code=MAX-2;code>=0;code--){
		sel=0;
		for(j=0;j<n;j++){
			if(code >> j & 1)sel+=wei[j];
		}
		speed[code]=2000.0/(sel+70);
	}

	for(code=MAX-2;code>0;code--){
		for(i=0;i<n;i++){
			if(code >> i & 1){
				ttt=99999999;
				for(j=0;j<n;j++){
					if( !(code>>j&1) ){
						tim=time[code+ (1<<j) ][j]+abs(dist[i]-dist[j])/speed[code];
						if(tim<ttt){ttt=tim;sel=j;}
					}
				}
				time[code][i]=ttt;
				next[code][i]=sel;
			}
		}
	}

	ttt=99999999;
	for(j=0;j<n;j++){
		tim=time[1<<j][j];
		if(tim<ttt){ttt=tim;sel=j;}
	}
	next[0][0]=sel;

	for(i=0,j=0;i<MAX-1;){
		nxt=next[i][j];
		printf("%s%d",i>0?" ":"",num[nxt]);
		i+=1<<nxt;
		j=nxt;
	}
	printf("\n");

	return 0;
}

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

#define sz size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

using namespace std;

const int N = 1e6 + 9;
const int inf = 1e9 + 7;

int n;
int a[N], b[N], c[N], dp[N][5];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin>> n;
    for(int i = 1; i <= n; i++){
        cin>> a[i]>> b[i]>> c[i];
    }
    dp[1][1] = a[1];
    dp[1][2] = b[1];
    dp[1][3] = c[1];
    for(int i = 2; i <= n; i++){
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a[i];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + b[i];
        dp[i][3] = max(dp[i - 1][2], dp[i - 1][1]) + c[i];
    }
    cout<< max(dp[n][1], max(dp[n][2], dp[n][3]));
}


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

int main(){

    string S;
    long double A,B;
    long double K;
    cin >>A >>B;
    if(A==B)cout<<"IMPOSSIBLE"<<endl;
    else{
      K=(A*A-B*B)/(2*A-2*B);
      if(ceil(K)!=floor(K))cout<<"IMPOSSIBLE"<<endl;
      else if(K<0)cout<<"IMPOSSIBLE"<<endl;
      else cout<<(int)K<<endl;
    }
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main()
{
   int arr[3];
   for(int i =0;i<3;i++)
   {
       cin >> arr[i];
   }
   sort(arr, arr+3);
   int area =  (arr[0] * arr[1])/2;
   cout << area;
  return 0;
   
}


Measured memory_bytes: 256
D = input()
ans = 0
ans_list = []
if D.count("R") >= 1:
  for i in range(3):
    if D[i] == 'R':
      ans += 1
      ans_list.append(ans)
    elif D[i] == 'S':
      ss = 0
      ans_list.append(ss)
      if i > 0:
        ans = 0
  print(max(ans_list))
elif D.count("R") < 1:
  print(0)


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

int main(){

    long long N;
    long long mx=0;
    vector<long long> input;
    while(cin>>N){
        if(N==0) break;
        input.push_back(N);
        mx = max(mx,N);
    }

    mx = mx * 2+1;
    vector<bool> sosu(mx+1,true);
    sosu[1] = false;
    sosu[2] = true;
    sosu[3] = true;

    for(long long i=2;i*i<=mx;i++){
        if(sosu[i]==false) continue;
        for(long long j=2;i*j<=mx;j++){
            sosu[i*j]=false;
        }
    }

    for(long long ii=0;ii<input.size();ii++){
        N = input[ii];
        long long cnt1 = 0;
        for(long long i=1;i<=N;i++) if(sosu[i]) cnt1++;
        long long cnt2 = 0;
        for(long long i=1;i<=2*N;i++) if(sosu[i]) cnt2++;
        cout << cnt2 - cnt1 << endl;
    }
}

Measured memory_bytes: 3188
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

/*
ll x[1000], y[1000], z[1000];

ll dfs(int idx, int cnt, int max_, ll x_sum, ll y_sum, ll z_sum)
{
	if (cnt == max_)
	{
		return abs(x_sum) + abs(y_sum) + abs(z_sum);
	}

	return max(dfs(idx+1, cnt, max_, x_sum, y_sum, z_sum), dfs(idx+1, cnt+1, max_, x_sum+x[idx], y_sum+y[idx], z_sum + z[idx]));

}
*/

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

	int n, m;
	
	cin >> n >> m;
	//ll x[n], y[n], z[n];
	ll a[n][3];

	rep(i, n)
	{
		//cin >> x[i] >> y[i] >> z[i];
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}

	//cout << dfs(0,0,m,0,0,0) << endl;
	
	ll maxn = 0;
	rep(i, 8)
	{
		//ans = 0;
		vector<ll> v;
		rep(j, n)
		{
			ll s = 0;
			rep(k, 3)
			{
				if ( (i & (1<<k)) )
				{
					s += a[j][k];
				}
				else
				{
					s -= a[j][k];
				}
			}
			v.pb(s);
		}
		ll ans=0;
		sort(v.begin(), v.end(), greater<ll>());
		//reverse(v.begin(), v.end());
		rep(p, m)
		{
			//cout << v[p] << endl;

			ans+=v[p];
		}
		maxn = max(maxn, ans);

	}

	cout << maxn << endl;

	return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    c = s.count("0")
    print(2*min(c,len(s)-c))
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 49904
x = int(input())
if x < 100:
    if x == 0:
        print(1)
    else:
        print(0)
    import sys
    sys.exit()

have = x // 100
need = x % 100

dp = [ -1 for i in range(100) ]
dp[0] = 0
dp[1] = 1
dp[2] = 1
dp[3] = 1
dp[4] = 1
dp[5] = 1
for j in range(6,100):
    dp[j] = 10**9
    for i in [1,2,3,4,5]:
        dp[j] = min( dp[j], dp[j-i] + 1 )

if dp[need] <= have:
    print(1)
else:
    print(0)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}


int main() {
  int a,b,k;
  cin >> a >> b >> k;
  int a_start = a;
  int a_end = min(a+k,b);
  int b_start = max(a_end,b-k+1);
  int b_end = b;
  for(int i=a_start;i<a_end;i++){
    cout << i<<endl;
  }
  for(int i=b_start;i<=b_end;i++){
    
    cout << i << endl;
  }
}


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

int main(){
	int i,m,s,e,a,b,aa;
	
	for(aa=0;aa<2;aa++){
		cin >> i >> m >> s >> e;
		
		if(aa==0){
			a = i + m + s + e;
		}
		if(aa==1){
			b = i + m + s + e;
		}
	}
	
	if(a>b || a==b){
		cout << a << endl;
	}
	
	else if(a<b){
		cout << b << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))

d = {}
for i in a:
  if i in d: d[i] += 1
  else: d[i] = 1

t = 0
ans = []
for k,v in sorted(d.items(), key=lambda x: x[0], reverse=True):
  if v >= 4 and t == 0:
    print(k*k)
    exit()
  elif v >= 2:
    ans.append(k)
    t += 1
  if t == 2:
    print(ans[0]*ans[1])
    exit()
print(0)

Measured memory_bytes: 26520
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n;
    cin>>n;
    int ans=1000-n%1000;
    ans%=1000;
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define F first
#define S second
#define mp make_pair
#define vecin1(n) vector<int> vec1(n); rep(i,n) cin >> vec1.at(i)
#define vecin2(n) vector<int> vec2(n); rep(i,n) cin >> vec2.at(i)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

ll x,y,S,ans = 0;
int main() {

int n,a,p = 0;
cin >> n;
vector<ll> B(n);
vector<ll> A(n);
rep(i,n)
{
  cin >> B.at(i);
  if (B.at(i) < 0)
  p++;
  A.at(i) = abs(B.at(i));
  S += A.at(i);
}
if (p % 2 == 0)
ans = S;
else
{
  ll min = *std::min_element(A.begin(), A.end());
  min = abs(min);
  ans = S-2*min;
}

  cout << ans << endl;
}

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

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

	string ans = "No";
	int n = 1;
	for( int i = 0; i < K; i++ ) n *= 3;
	for( int mask = 0; mask < n; mask++ ) {
		int a = A;
		int b = B;
		int c = C;
		for( int i = 0; i < K; i++ ) {
			int m = mask;
			for( int ii = 0; ii < i; ii++ ) m /= 3;
			if( m %  3 == 0 ) {
				a *= 2;
				if( b > a && c > b ) {
					ans = "Yes";
					break;
				}
			}
			else if( m % 3 == 1 ) {
				b *= 2;
				if( b > a && c > b ) {
					ans = "Yes";
					break;
				}
			}
			else if( m % 3 == 2 ) {
				c *= 2;
				if( b > a && c > b ) {
					ans = "Yes";
					break;
				}
			}
		}
		if( ans == "Yes" ) break;
	}

	cout << ans << endl;
}


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




int main()
{
string s;
cin >> s;
if(s[0] == s[1]) cout << "Bad" << endl;
else if(s[1] == s[2]) cout << "Bad" << endl;
else if(s[2] == s[3]) cout << "Bad" << endl;
else cout << "Good" << endl;
	return 0;
}


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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int cnt = 0;
    int cnt1 = 0;
    for (int i = 0; i < S.length(); i++) {
      if (i % 2 == 0 && S.charAt(i) == '0') {
        cnt++;
      } else if (!(i % 2 == 0) && S.charAt(i) == '1') {
        cnt++;
      }
    }
    for (int i = 0; i < S.length(); i++) {
      if (i % 2 == 0 && S.charAt(i) == '1') {
        cnt1++;
      } else if (!(i % 2 == 0) && S.charAt(i) == '0') {
        cnt1++;
      }
    }
    System.out.println(Math.min(cnt, cnt1));
  }
}


Measured memory_bytes: 25044
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 505;
int n; ll a[N][N], b[N][N], dp[N][N];
void chkmn(ll &a, ll b){ if(a > b) a = b; }
ll coef(int k, int j, int i){
	return b[j+1][i] + a[n][j] - a[n][k] - a[i][j] + a[i][k];
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++)
	if(j!=i) scanf("%lld",&a[i][j]);
	for(int i=n; i>=1; i--)
	for(int j=i; j<=n; j++)
	b[i][j]=a[i][j]+b[i+1][j]+b[i][j-1]-b[i+1][j-1];
	for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++)
	a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
	memset(dp,0x3f,sizeof(dp));
	ll ans = 1e18;
	for(int i=1; i<n; i++){
		dp[i][0] = coef(0,0,i);
		chkmn(ans, dp[i][0] + coef(0,i,n));
		for(int j=1; j<i; j++)
		for(int k=0; k<j; k++)
		chkmn(dp[i][j], dp[j][k] + coef(k,j,i));
		for(int j=1; j<i; j++)
		chkmn(ans, dp[i][j] + coef(j,i,n));
	} cout << ans; return 0;
}

Measured memory_bytes: 9648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n,a=0,b=0,cnt=1;
  cin >> n;
  vector<int> p(n),q(n),r(n);
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> q[i];
  rep(i,n) r[i]=i+1;

  do{
    if(p==r) a=cnt;
    if(q==r) b=cnt;
    cnt++;
  }while(next_permutation(all(r)));
  cout << abs(a-b) << 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 REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

  cout<<t<<s<<endl;

  return 0;
}

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

// https://atcoder.jp/contests/abc095/tasks/arc096_a

int main() {
  int a, b, c;
  int x, y;
  cin >> a >> b >> c;
  cin >> x >> y;

  int ans = 0;

  // 1. a,bピザをx,y枚購入する
  {
    int count = a * x + b * y;
    ans = count;
  }
  // 2. min(x,y) a or bピザを購入し、残り*2枚数cピザを購入する
  {
    int count = 0;
    int sub = abs(x - y);
    if(x > y) {
      count = sub * a;
    } else {
      count = sub * b;
    }
    int rest = max(x, y) - sub;
    count += c * rest * 2;
    ans = min(ans, count);
  }
  // 3. cピザをmax(x,y)*2枚購入する
  {
    int count = max(x, y) * 2 * c;
    ans = min(ans, count);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int r, c, si, sj, gi, gj;
  rd(r, c, si, sj, gi, gj);
  const int mod = 10 ^^ 9 + 7;
  const int inf = 10 ^^ 9;
  auto dist = new int[][](r, c), dp = new int[][](r, c);
  foreach (i; 0 .. r)
    foreach (j; 0 .. c)
      dist[i][j] = inf;
  struct T {
    int y, x;
  }

  auto dir = [T(1, 0), T(-1, 0), T(0, 1), T(0, -1)];
  auto dr = [0, r - 1], dc = [0, c - 1];
  auto q = new Queue!(T)(r * c);
  dist[si][sj] = 0;
  dp[si][sj] = 1;
  q.insertBack(T(si, sj));
  void relieve(int y, int x, int ny, int nx) {
    if (0 <= ny && ny < r && 0 <= nx && nx < c) {
      if (dist[y][x] + 1 == dist[ny][nx]) {
        (dp[ny][nx] += dp[y][x]) %= mod;
      }
      if (dist[ny][nx] == inf) {
        dist[ny][nx] = dist[y][x] + 1;
        dp[ny][nx] = dp[y][x];
        q.insertBack(T(ny, nx));
      }
    }
  }

  while (!q.empty) {
    auto cur = q.front;
    q.removeFront;
    foreach (d; dir) {
      relieve(cur.y, cur.x, cur.y + d.y, cur.x + d.x);
    }
    foreach (d; dr)
      relieve(cur.y, cur.x, d, cur.x);
    foreach (d; dc)
      relieve(cur.y, cur.x, cur.y, d);
  }
  writeln(dist[gi][gj], " ", dp[gi][gj]);
}

class Queue(T) {
private:
  int n, l = 0, r = 0;
  T[] arr;

public:
  this(int size) {
    n = size + 1;
    arr.length = n;
  }

  bool empty() {
    return l == r;
  }

  bool full() {
    return l == (r + 1) % n;
  }

  T front() {
    return arr[l];
  }

  void insertBack(T x) {
    assert(full == false);
    arr[r] = x;
    (r += 1) %= n;
  }

  void removeFront() {
    assert(empty == false);
    (l += 1) %= n;
  }
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}



Measured memory_bytes: 5564
n = int(input())

num = [1, 2, 3, 4, 5, 6, 7, 8, 9]

ans = 0
for i in range(9):
    for j in range(9):
        if n%num[i] == 0 and n%num[i] == 0 and n//(num[i]) == num[j]:
            ans = 1
if ans == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
A = inpl()
for i in range(N):
    A[i] -= 1
P = dict()
k = 0
former = True
i = 1
while i <= K:
    if k in P.keys() and former:
        loop = i - P[k]
        K = i + (K-i) % loop
        former = False
    else:
        P[k] = i
    k = A[k]
    i += 1
else:
    print(k+1)


Measured memory_bytes: 110892
n,k = map(int,input().split())
A = list(map(int,input().split()))
dp = [False]*(k+1)
for i in range(k+1):
    for a in A:
        if i + a<k+1:
            dp[i+a] |= not dp[i]
        else:
            break
print('First' if dp[k] else 'Second')

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

const ll inf = 1e18;
const int nax = 1e5 + 5;

// ll fact[nax], invfact[nax];

// void pre()
// {
// 	fact[0] = 1;
// 	forn(i, 1, nax)
// 	{
// 		fact[i] = mult(fact[i - 1], i);
// 	}

// 	invfact[nax - 1] = mypow(fact[nax - 1], mod - 2);

// 	ford(i, nax, 1)
// 	{
// 		invfact[i - 1] = mult(invfact[i], i);
// 	}
// }

// ll ncr(ll n, ll r)
// {
// 	if (r > n)
// 		return 0;

// 	ll ans = mult(fact[n], mult(invfact[n - r], invfact[r]));

// 	return ans;
// }

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		ll n;
		cin>>n;

		ll x[n];
		forn(i,0,n)
		{
			cin>>x[i];
		}

		ll ans = inf;

		forn(i,0,101)
		{
			ll val = 0;
			forn(j,0,n)
			{
				val += (x[j]-i)*(x[j]-i);
			}

			ans = min(ans,val);
		}

		cout<<ans;
	}

	return 0;
}

Measured memory_bytes: 256
combinations = [(1, 2, 3), (4, 5, 6), (7, 8, 9),
                (1, 4, 7), (2, 5, 8), (3, 6, 9),
                (1, 5, 9), (5, 5, 7)
                ]

def main():
    a9 = []
    for _ in range(3):
        temp = list(map(int, input().split()))
        a9 += temp

    n = int(input())
    bbb = []
    for _ in range(n):
        b = int(input())
        bbb.append(b)
        if b in a9:
            idx = a9.index(b)
            a9[idx] = 0

    ans = 'No'
    for ccc in combinations:
        bingo_flag = True
        for c in ccc:
            idx = c - 1
            if a9[idx] == 0:
                continue
            else:
                bingo_flag = False
        if bingo_flag:
            ans = 'Yes'
            break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

const int ans[] = {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};

int k;

int main()
{
    read(k);
    printf("%d\n", ans[k - 1]);
    return 0;
}

Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException ‚There is no more input";}else{var returnInput = this.list[this.index++];return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var M = one[1];
  var list = new Array(N).fill(0);
  for(var i = 0; i < M; i++){
    var tmp = nextIntArray();
    var L;
    var R;
    if(tmp[0] > tmp[1]){
      L = tmp[1];
      R = tmp[0];
    }else{
      L = tmp[0];
      R = tmp[1];
    }
    list[L - 1]++;
    list[R - 1]--;
  }
  for(var i = 1; i < N; i++){
    list[i] += list[i - 1];
  }
  var output = "YES";
  for(var i = 0; i < N - 1; i++){
    if(list[i] % 2 == 1){
      output = "NO";
    }
  }
  myout(output);
}


Measured memory_bytes: 54656
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int k;
bool dfs(int depth, vector<int> &stack)
{
    int prev = stack.back();
    bool ret = false;
    if(depth == stack.size())
    {
        k--;
        if (k == 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    for(int i=-1;i<=1;++i)
    {
        int next = prev + i;
        if(next < 0 || 10 <= next) continue;

        stack.push_back(next);
        ret = dfs(depth, stack);
        if(ret) break;
        stack.pop_back();
    }

    return ret;
}
int main(){
    std::ios::sync_with_stdio(false);
    cin >> k;
    int num_digits = 1;
    vector<int> stack;
    while(k > 0)
    {
        for(int s = 1; s <= 9; ++s)
        {
            stack.push_back(s);
            if(dfs(num_digits, stack))
            {
                for(int tmp: stack)
                {
                    cout << tmp;
                }
                cout << endl;
                return 0;
            }
            stack.pop_back();
        }
        num_digits++;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int nowx = 0, nowy = 0, time = 0;
	for (int i = 0; i < n; i++) {
		int t, x, y;
		cin >> t >> x >> y;
		if (((t - time) - abs(x - nowx) - abs(y - nowy)) % 2 == 0 && (t - time) - abs(x - nowx) - abs(y - nowy) >= 0) {
			time = t; nowx = x; nowy = y;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	void sort(){
		int a[] = new int[3];
		int tmp;
		Scanner s = new Scanner(System.in);
		for(int i = 0;i < 3;i++){
			a[i] = s.nextInt();
			for(int j = 0;j < i;j++){
				if(a[j] > a[i]){
					tmp = a[j];
					a[j] = a[i];
					a[i] = tmp;
				}
			}
		}
		System.out.println(a[0] + " " + a[1] + " " + a[2]);
	}
	public static void main(String args[]){
		Main m = new Main();
		m.sort();
	}
}

Measured memory_bytes: 25968
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    int ans = 0;
    rep(i, 0, n){
        while(a[i] % 2 == 0 && a[i] != 0){
            ans++;
            a[i] /= 2;
        }
    }   
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
#define pb push_back
#define pr pair<int,int>
using namespace std;
using ll = long long;
// using mod = 1000000000 + 7;
void self_max(int &a,int b){
	a = max(a,b);
}

void self_min(int &a,int b){
	a = min(a,b);
}
int main(){
	int a,b,c; cin >> a >>b >> c;

	if(a < b && b < c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 3104
#include<stdio.h>
int main()
{
    int a,b;
    // スペース区切りの整数の入力
    scanf("%d %d",&a,&b);
    // 出力
  	if(a==b){
    	printf("Yes\n");
    }
  	else{
    	printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int x,i;
	i = 1;
	
	while (1){
		cin >> x;
		if (x == 0) break;
		cout << "Case " << i << ": " << x << endl;
		i = i + 1;
	}
	




	return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b; cin >> a >> b;
    if(a==b) cout << a+b << endl;
    else cout << max(a, b)*2-1 << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7556
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll cnt[100003]={0};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  ll n;
  cin>>n;
 vector<int>v;
 ll i,j,k;
 while(n>0)
 {
     v.push_back((n-1)%26);
     n=(n-1)/26;
 }
reverse(v.begin(),v.end());
for(auto x:v)
cout<<(char)(x+'a');
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N, T; cin >> N >> T;
    int ans = inf;
    for (int i = 0; i < N; i++) {
        int c, t; cin >> c >> t;
        if (t <= T) ans = min(ans, c);
    }
    if (ans == inf) cout << "TLE" << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

int main() {
    int k;
    cin>>k;
    string a,b;
    cin>>a>>b;
    string s;
    int i=0,j=0;
    int cnt=0;
    while(cnt<k){
		s+=a[i++];
		s+=b[j++];
		cnt++;
	}
	cout<<s<<endl;
}


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

int main(){
  int x, y, z;
  cin >> x >> y >> z;

  int a ,b ,c;
  a=x;
  b=y;
  c=z;

  a=y;
  b=x;

  a=z;
  c=y;

  cout << a << " " << b << " " << c;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        var whxy = Console.ReadLine().ToLongArray();

        var w = whxy[0];
        var h = whxy[1];
        var x = whxy[2];
        var y = whxy[3];

        var ans = w * h / 2.0;

        var multi = ((w == x * 2) && (h == y * 2)) ? 1 : 0;

        Console.WriteLine($"{ans} {multi}");

    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<queue>
using namespace std;
priority_queue<int> q1;
int main(){
	int a,b,n;
	int i,j,k;
	int s=0;
	cin>>n;
	for(i=0;i<n*2;i++){
		cin>>a;
		q1.push(a);
	}
	for(i=0;i<n;i++){
		q1.pop();
		a=q1.top();
		q1.pop();
		s+=a;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 384