akhauriyash/Code-Regression huggingface dataset:
def gi; gets.to_i end
def gs; gets.chomp end
def gli; gets.split(' ').map(&:to_i) end
def d(n); Math.log10(n).to_i + 1 end
class Integer
  # 約数の組み合わせを列挙する
  def divisor_combinations
    (1..Math.sqrt(self).to_i).
      select { |i| self % i == 0 }.
      map { |i| [i, self / i] }
  end
end

A, B = gli

puts [0, A - B * 2].max


Measured memory_bytes: 1788
using System;

class Program
{
    static void Main()
	{
		var st = Console.ReadLine().Split(new[] { ' ' });
		var ab = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var u = Console.ReadLine();

		var s = st[0];
		var t = st[1];
		var a = ab[0];
		var b = ab[1];

		if (u == s) {
			Console.WriteLine($"{a - 1} {b}");
		} else {
			Console.WriteLine($"{a} {b - 1}");
		}
	}
}


Measured memory_bytes: 13140
d,n=map(int,input().split())
if d==0:
    c=0
    a=0
    while c<n:
        a+=1
        if a%100!=0:
            c+=1
elif d==1:
    c=0
    a=0
    while c<n:
        a+=100
        if a%10000!=0:
            c+=1
else:
    c=0
    a=0
    while c<n:
        a+=10000
        if a%1000000!=0:
            c+=1
print(a)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    if(n <= 111) cout << "111" << endl;
    else if(n <= 222) cout << "222" << endl;
    else if(n <= 333) cout << "333" << endl;
    else if(n <= 444) cout << "444" << endl;
    else if(n <= 555) cout << "555" << endl;
    else if(n <= 666) cout << "666" << endl;
    else if(n <= 777) cout << "777" << endl;
    else if(n <= 888) cout << "888" << endl;
    else if(n <= 999) cout << "999" << endl;
}

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

int main()
{ 
  double ans = 0, a;
  int n;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> a;
    ans += 1 / a;
  }
  cout << fixed << setprecision(5) << 1 / ans << endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int T,H,S;
	while(true){
		cin>>T>>H>>S;
		if(T<0 && H<0 && S<0) break;
		int R = 60*60*2-T*60*60-H*60-S;
		int NS = R%60;
		R/=60;
		int NH = R%60;
		int NT = R/60;
		printf("%02d:%02d:%02d\n",NT,NH,NS);
		R = (60*60*2-T*60*60-H*60-S)*3;
		NS = R%60;
		R/=60;
		NH = R%60;
		NT = R/60;
		printf("%02d:%02d:%02d\n",NT,NH,NS);
	}
	
	return 0;
}


Measured memory_bytes: 3124
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)


function main()
	h,w,n = readline() |> split |> parseMap
	a = Array{Int}(2,n)
	for i in 1:n
		a[:,i] = readline() |> split |> parseMap
	end
	a = sortcols(a,by=x->(x[1],x[2]))
	count = 0
	stack = 0
	flg = 0
	for i in 1:n
		if a[1,i] == a[2,i]+stack
			stack += 1
			count = a[1,i]
		elseif a[1,i] > a[2,i]+stack
			count = a[1,i]
			flg = 1
			break
		end
	end
	if flg == 0
		count = h+1
	end
	println(count-1)
end

main()


Measured memory_bytes: 160840
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;


int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif

        int a, b;
        cin >> a >> b;
        if (a == b) cout << "Draw" << endl;
        else if (a == 1) cout << "Alice" << endl;
        else if (b == 1) cout << "Bob" << endl;
        else cout << (a > b ? "Alice" : "Bob") << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<int> Slist() { return new List<int>(ReadLine().Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var S = ReadLine();
            var ans = 0;
            for(var i=0;i<1000;i++)
            {
                var t = string.Format("{0:000}", i);
                var ti = 0;
                for(var j=0;j<N;j++)
                {
                    if(S[j]==t[ti])
                    {
                        ti++;
                        if (ti == 3) break;
                    }
                }
                if (ti == 3) ans++;
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
/*
ID: lyr14721
PROG: 
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	int	n;
	string sta,stb;
	cin>>n;
	cin>>sta>>stb;
	for(int i=0;i<n;i++){
		cout<<sta[i]<<stb[i];
	}
	return 0;
}


Measured memory_bytes: 256
class UnionFind:
  def __init__(self, n):
    self.par = [-1 for _ in range(n)]
    self.rank = [0 for _ in range(n)]
  def find(self, x):
    if self.par[x] < 0: return x
    self.par[x] = self.find(self.par[x])
    return self.par[x]
  def unite(self, x, y):
    x = self.find(x); y = self.find(y)
    if x == y: return
    if self.rank[x] < self.rank[y]: x, y = y, x
    if self.rank[x] == self.rank[y]: self.rank[x] += 1
    self.par[x] += self.par[y]
    self.par[y] = x
    return
  def size(self, x):
    return self.par[self.find(x)]
  
n, m = map(int, input().split())
a = []; b = []
for _ in range(m):
  s, t = map(int, input().split())
  a.append(s-1); b.append(t-1)
ans = [n * (n-1) // 2]
uf = UnionFind(n)
for i in range(m-1):
  if uf.find(a[m-1-i]) == uf.find(b[m-i-1]):
    ans.append(ans[i])
  else:
    ans.append(ans[i] - uf.size(a[m-1-i]) * uf.size(b[m-1-i]))
    uf.unite(a[m-1-i], b[m-1-i])
for i in range(m):
  print(ans[m-1-i])

Measured memory_bytes: 17660
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$X = $key->A[0];
$pos = 0;
$max = 0;
for($i=0;$i<$X;$i++) {
  $pos += $i+1;
  if ($pos == $X) {
    printf("%d\n",$i+1);
    exit;
  }
  if ($pos > $X) {
    break;
  }
}
//入れ替えていけるはず？
printf("%d",$i+1);
exit;


Measured memory_bytes: 3828
var lines = [];
var a;

var readline = require("readline");
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on("line", function (x) {
    lines.push(x);
});

rl.on("close", function () {
    var tmp = lines[0].split(" ");
    var A = Number(tmp[0]);
    var B = Number(tmp[1]);
    var C = Number(tmp[2]);

    if (B >= C + 1) {
        var Yummy = B + C;
        console.log(Yummy);
    }
    else {
        var Yummy = B * 2 + 1;
        C -= B + 1
        Yummy += Math.min(A, C);
        console.log(Yummy);
    }
});

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

using namespace std;

int dp[44][444][444];
int a[44],b[44],c[44];
int n,ma,mb;
const int INF = 1e6;


int dfs(int i, int A, int B) {
  if(dp[i][A][B] != -1) return dp[i][A][B];
  if(i == n) {
    if((A != 0 || B != 0) &&  A * mb == B * ma) {
      return 0;
    }
    else return INF;
  }

  dp[i][A][B] = min(dfs(i + 1,A,B),dfs(i + 1,A+a[i],B+b[i]) + c[i]);

return dp[i][A][B];
}

int main() {
  cin >> n >> ma >> mb;
  
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];

  memset(dp,-1,sizeof dp);


  int ans = dfs(0,0,0);

  if(ans == INF) cout << "-1" << endl;
  else cout << ans << endl;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    rep(i, k) {
        vi b(n+1);
        rep(j, n) {
            int l = max(0, j-a[j]);
            int r = min(n-1, j+a[j]);
            b[l]++; b[r+1]--;
        }
        rep(j, n) b[j+1] += b[j];
        b.pop_back();
        if (b == a) break;
        a = b;
    }
    rep(i, n) cout << a[i] << (i<n-1?' ':'\n');
    return 0;
}


Measured memory_bytes: 4800
#include <iostream>
#include <vector>
#include <queue>
#include <limits>

using namespace std;


template<typename W>
struct range_edge_graph {
    int n;
    struct edge { int to; W weight;};
    vector<vector<edge>> g;

    range_edge_graph(int n) : n(n) {
        g.resize(3*n);
        for (int i = 1; i < n; ++i) {
            int cl = i<<1|0, cr = i<<1|1;
            add_edge(i, cl, 0);
            add_edge(i, cr, 0);
            add_edge(cl+2*n, i+2*n, 0);
            add_edge(cr+2*n, i+2*n, 0);
        }
    }

    // map [3n, 4n) -> [n, 2n)
    void add_edge(int u, int v, W w) {
        if (3*n <= u) u -= 2*n;
        g[u].push_back({v, w});
    }

    // from [l1, r1) to [l2, r2)
    void add_edge(int l1, int r1, int l2, int r2, W w) {
        int idx = g.size();
        for (l1 += n, r1 += n; l1 < r1; l1 >>= 1, r1 >>= 1) {
            if (l1 & 1) add_edge(l1+2*n, idx, 0), l1++;
            if (r1 & 1) --r1, add_edge(r1+2*n, idx, 0);
        }
        vector<edge> node;
        for (l2 += n, r2 += n; l2 < r2; l2 >>= 1, r2 >>= 1) {
            if (l2 & 1) node.push_back({l2++, w});
            if (r2 & 1) node.push_back({--r2, w});
        }
        g.push_back(node);
    }

    vector<W> dijkstra(int s) {
        s += n;
        vector<W> dist(g.size(), numeric_limits<W>::max());
        dist[s] = 0;
        using P = pair<W, int>;
        priority_queue<P, vector<P>, greater<P>> que;
        que.emplace(0, s);
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (dist[v] < p.first) continue;
            for (edge& e : g[v]) {
                if (dist[e.to] > dist[v] + e.weight) {
                    dist[e.to] = dist[v] + e.weight;
                    que.emplace(dist[e.to], e.to);
                }
            }
        }
        vector<W> res(dist.begin() + n, dist.begin() + 2*n);
        return res;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    range_edge_graph<long long> g(n);
    for (int i = 0; i < m; ++i) {
        int l, r, w;
        cin >> l >> r >> w;
        l--; r--;
        g.add_edge(l, r+1, l, r+1, w);
    }
    auto dist = g.dijkstra(0);
    cout << (dist[n-1] == numeric_limits<long long>::max() ? -1 : dist[n-1]) << '\n';
}


Measured memory_bytes: 83556
def examC():
    N, K = LI()
    d = defaultdict(int)
    element = set()
    for _ in range(N):
        a, b = LI()
        d[a] += b
        element.add(a)
    element = list(element)
    element.sort()
    for i in element:
        K -= d[i]
        if K<=0:
            ans = i
            break
    print(ans)
#    print(element)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 50524
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX=2e5+5;
vector<LL> GRAPH[MAX];
LL a[MAX];
bool vis[MAX];
LL b[MAX];

void DFS(LL x)
{
        if(vis[x]) return;
        vis[x]=true;
        for(int i=0;i<GRAPH[x].size();i++)
        {
                if(!vis[GRAPH[x][i]])
                {
                        b[GRAPH[x][i]]+=b[x];
                        DFS(GRAPH[x][i]);
                }
        }
}

int main()
{
        int n,q;
        cin>>n>>q;
        int m=n-1;
        memset(vis,false,sizeof(vis));
        while(m--)
        {
                LL x,y;
                cin>>x>>y;
                GRAPH[x].push_back(y);
                GRAPH[y].push_back(x);
        }
        while(q--)
        {
                LL p,x;
                cin>>p>>x;
                a[p]+=x;
        }
        for(int i=1;i<=n;i++)
        {
                b[i]=a[i];
        }
        DFS(1);
        for(int i=1;i<=n;i++)
        {
                cout<<b[i]<<" ";
        }
}

Measured memory_bytes: 25856
from sys import stdin
import numpy as np
import math
from itertools import accumulate

x1,y1,x2,y2 = [int(x) for x in stdin.readline().rstrip().split()]

a = abs(x2-x1)
b = abs(y2-y1)

if x2-x1 >= 0 and y2-y1 >= 0:
    print(x2-b,y2+a,x1-b,y1+a)
elif x2-x1 >= 0 and y2-y1 < 0:
    print(x2+b,y2+a,x1+b,y1+a)
elif x2-x1 < 0 and y2-y1 >= 0:
    print(x2-b,y2-a,x1-b,y1-a)
else:
    print(x2+b,y2-a,x1+b,y1-a)

Measured memory_bytes: 20904
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

ll move(ll x, string s, V<char> tv, V<char> dv) {
  ll n = s.size();
  REP(i, tv.size()) {
    if (x < 0 || x > n - 1) break;
    if (s.at(x) == tv.at(i)) {
      if (dv.at(i) == 'L') x--;
      else x++;
    }
  }
  return x;
}

int main() {
  ll n, q; cin >> n >> q;
  string s; cin >> s;
  V<char> t(q), d(q);
  REP(i, q) cin >> t.at(i) >> d.at(i);
  ll lll=0, lr=n;
  while (lll < lr) {
    ll mid = (lll + lr) / 2;
    if (move(mid, s, t, d) < 0) lll = mid+1;
    else lr = mid;
  }
  ll rl=0, rr=n;
  while (rl < rr) {
    ll mid = (rl + rr) / 2;
    if (move(mid, s, t, d) >= n) rr = mid;
    else rl = mid + 1;
  }
  cout << rr-lr << endl;
  return 0;
}


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

int main(){
    vector<vector<int>> dp = vector<vector<int>>(80010, vector<int>(11, 0));
    string s;
    while(true){
        cin >> s;
        if(s == "0") break;
        int n = s.size();
        for(int i=0; i<n+1; i++)for(int j=0; j<11; j++){
            dp[i][j] = 0;
        }
        dp[0][0];
        for(int i=0; i<n; i++){
            for(int j=0; j<11; j++){
                dp[i+1][(j*10+(s[i]-'0'))%11] += dp[i][j];
            }
			if(s[i]!='0') dp[i+1][s[i]-'0']++;
        }
		int ans = 0;
		for(int i=0; i<n; i++) ans += dp[i+1][0];
		cout << ans << endl;
    }
}


Measured memory_bytes: 9880
#include <stdio.h>

#define MOD 1000000007
#define ISIX 166666668

int modinvp(int a, int p) {
	long long int ret = 1, b = a;
	int e = p-2;
	while (e) {
		if (e&1) {
			ret = (ret * b) % p;
		}
		e >>= 1;
		b = (b * b) % p;
	}
	return (int) ret;
}

int choose(int n, int k) {
	long long int num = 1, den = 1;
	for (int i = n-k+1; i <= n; i++) {
		num = (num * i) % MOD;
	}
	for (int i = 2; i <= k; i++) {
		den = (den * i) % MOD;
	}
	num = (num * modinvp((int) den, MOD)) % MOD;
	return (int) num;
}

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

	long long int sumx = n;
	sumx = (sumx * (n-1)) % MOD;
	sumx = (sumx * (n+1)) % MOD;
	sumx = (sumx * m) % MOD;
	sumx = (sumx * m) % MOD;
	sumx = (sumx * ISIX) % MOD;

	long long int sumy = m;
	sumy = (sumy * (m-1)) % MOD;
	sumy = (sumy * (m+1)) % MOD;
	sumy = (sumy * n) % MOD;
	sumy = (sumy * n) % MOD;
	sumy = (sumy * ISIX) % MOD;

	long long int sum = (sumx + sumy) % MOD;
	sum = (sum * choose(n*m -2, k-2)) % MOD;
	printf("%d\n", (int) sum);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define MXN 200005
vector<int> v[2005];
int vis[2005];
vector<int> merge(vector<int> a,vector<int> b){
    vector<int> res;
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    while(a.size()||b.size()){
        if(a.empty()){
            res.pb(b.back());
            b.pop_back();
        }
        else if(b.empty()){
            res.pb(a.back());
            a.pop_back();
        }
        else if(a.back()>b.back()){
            res.pb(a.back());
            a.pop_back();
        }
        else{
            res.pb(b.back());
            b.pop_back();
        }
    }
    return res;
}
vector<int> dfs(int x){
    vis[x]=1;
    vector<int> res;
    for(auto it:v[x]){
        if(!vis[it]){
            res=merge(res,dfs(it));
        }
    }
    reverse(res.begin(),res.end());
    res.pb(x);
    reverse(res.begin(),res.end());
    return res;
}
int main(){
    int n;
    scanf("%d",&n);
    int a[2005];
    for(int i = 0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i = 0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(__gcd(a[i],a[j])!=1){
                v[i].pb(j);
                v[j].pb(i);
            }
        }
    }
    for(int i = 0;i<n;i++){
        sort(v[i].begin(),v[i].end());
    }
    vector<int> ans;
    for(int i = 0;i<n;i++){
        if(!vis[i]){
            ans=merge(ans,dfs(i));
        }
    }
    for(auto it:ans){
        printf("%d ",a[it]);
    }
}


Measured memory_bytes: 17920
#include<stdio.h>

int main(void){
    int n, k;
    int a[100000] = {0};
    int i;
    scanf("%d %d", &n, &k);

    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    int ct = 0;
    for(i = 0; n - i > 1; i += (k-1)){
        ct += 1;
    }
    printf("%d\n", ct);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
long long x,y,z,k,a[1005],b[1005],c[1005];
vector<long long>vec;
int main(){
	cin>>x>>y>>z>>k;
	for(int i=0;i<x;i++)cin>>a[i];sort(a,a+x,greater<long long>());
	for(int i=0;i<y;i++)cin>>b[i];sort(b,b+y,greater<long long>());
	for(int i=0;i<z;i++)cin>>c[i];sort(c,c+z,greater<long long>());
	for(int i=0;i<x;i++)
		for(int j=0;j<y;j++)
			for(int l=0;l<z;l++){
				if((i+1)*(l+1)*(j+1)<=k)vec.push_back(a[i]+b[j]+c[l]);
				else break;
			}
	sort(vec.begin(),vec.end(),greater<long long>());
	for(int i=0;i<k;i++)cout<<vec[i]<<endl;
	return 0;
} 

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

namespace AOJ
{
  class Program
  {
    public static void Main(string[] args)
    {
      foreach (var s in ReadStrings())
        Console.WriteLine(new String(s.Reverse().ToArray()));
    }

    static IEnumerable<string> ReadStrings()
    {
      string line;
      while ((line = Console.ReadLine()) != null)
        yield return line;
    }
  }
}

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

int main(){
	int n,k;
	cin >> n >> k;
	int x[n];
	int left=0, right=0;
	bool flag = true;
	for(int i=0;i<n;i++) {
		cin >> x[i];
	}
	int mintime=1e9;
	for(int l=0;l<=n-k;l++){
		int r=l+k-1;
		int time=min(abs(x[l])+abs(x[r]-x[l]), abs(x[r])+abs(x[r]-x[l]));
		mintime=min(mintime, time);
	}
	cout << mintime << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*Coding Space*/
int main(){
  int n,k; cin >> n >> k;
  vi in(n); rep(i,n) cin >> in[i];
  cout << (n-1+k-2) / (k-1) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[4];
	for (int i = 0; i < 4; i++){
		cin >> a[i];
	}
	sort(a, a + 4);
	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int arr[3];
  for(int i=0; i<3; i++) cin>>arr[i];
  sort(arr,arr+3);
  if((arr[0]==arr[1] && arr[1]!=arr[2]) || (arr[0]!=arr[1] && arr[1]==arr[2])) 
    	cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3612
using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int countFive = 0;
            int countSeven = 0;

            foreach(string valStr in input)
            {
                int val = int.Parse(valStr);
                if(val == 5)
                {
                    countFive++;
                }else if(val == 7)
                {
                    countSeven++;
                }
            }

            if(countFive == 2 & countSeven == 1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }

Measured memory_bytes: 11092
package main

import (
	"fmt"
)

func main() {
	var N, T int
	fmt.Scan(&N, &T)

	var c, t int
	C := 1000
	tel := true
	for i := 0; i < N; i++ {
		fmt.Scan(&c, &t)
		if t <= T {
			if C >= c {
				C = c
				tel = false
			}
		}
	}
	if tel {
		fmt.Print(`TLE`)
	} else {
		fmt.Print(C)
	}
}


Measured memory_bytes: 512
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2)


if __name__ == "__main__":
    main()

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

using namespace std;

int main(void){
  int n, m;
  cin >> n;
  cin.ignore();
  vector<string> s, t;
  string tmps;
  for(int i = 0; i < n; i++){
    cin >> tmps;
    s.push_back(tmps);
    cin.ignore();
  }
  cin >> m;
  cin.ignore();
  for(int i = 0; i < m; i++){
    cin >> tmps;
    cin.ignore();
    t.push_back(tmps);
  }

  sort(s.begin(), s.end());
  sort(t.begin(), t.end());

  // 上から探す。対象が小さくなったら止める
  auto itrs = s.begin();
  auto itrt = t.begin();
  int a = 0;
  int tmp = 0;
  while(itrs != s.end()){
    //itrt = t.begin();
    tmps = *itrs;
    tmp = 0;
    while(itrs != s.end() && tmps==*itrs){
      tmp++;
      //cout << tmps << "!!!" << endl;
      itrs++;
    }
    while(itrt != t.end() && tmps > *itrt){
      itrt++;
      //cout << "0000" << endl;
    }
    //cout << "1111" << endl;
    while(itrt != t.end() && tmps == *itrt){
      tmp -= 1;
      //cout << "2222" << endl;
    //cout << *itrt << endl;
      itrt++;
    }
    if(a < tmp){
      //cout << "TMP:" << tmps << tmp << endl;
      a = tmp;
    }
    if(itrs == s.end()) break;
  }

  if(a < 0) cout << 0 << endl;
  else cout << a << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define ll long long 
using namespace std;
int main() {
    ll n;
    cin>>n;
    ll A[n];
    ll B[n];
    ll C[n];
    for(int i=0;i<n;i++){
        cin>>A[i]>>B[i]>>C[i];
    }
    ll dp[3][n+5];
    dp[0][0]=A[0];
    dp[1][0]=B[0];
    dp[2][0]=C[0];
    for(int i=1;i<n;i++){
        dp[0][i]=A[i]+max(dp[1][i-1],dp[2][i-1]);
        dp[1][i]=B[i]+max(dp[0][i-1],dp[2][i-1]);
        dp[2][i]=C[i]+max(dp[0][i-1],dp[1][i-1]);
    }
    cout<<max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]));
    
}


Measured memory_bytes: 4992
#include<iostream>
#include<complex>
using namespace std;
int main()
{
     int k,i;
     string s;
    cin >> k >> s;
    for(i=0;i<k;i++){
        if(s[i]=='\0') {
            i++;
            break;
        }
        cout << s[i];
    }
    if(s[i]!='\0')cout << "...";
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<double> vecx(N);
    vector<double> vecy(N);
    rep(i,N){
        cin >> vecx[i];
        cin >> vecy[i];
    }
    double dist = 0;
    rep(i,N){
        rep(j,N){
            dist += sqrt((vecx[i] - vecx[j]) * (vecx[i] - vecx[j]) + (vecy[i] - vecy[j]) * (vecy[i] - vecy[j]));
        }
    }
    dist /= 2;
    cout << setprecision(10) << dist * 2 / N << endl;
}


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

int main() {
	int n,y;
	cin>>n>>y;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n-i;j++){
			int k=n-i-j;
				if(y==10000*i+5000*j+1000*k){
					cout<<i<<" "<<j<<" "<<k;
					return 0;
				}
		}
	}
	cout<<"-1 -1 -1";
	return 0;
}

Measured memory_bytes: 256
# include <iostream>
using namespace std;
const int N=106;
long long a[N];
long long s,t;
int n;
long long gcd (long long x,long long y)
{
	if (x%y==0)
	return y;
else return gcd (y,x%y);
}
void work (void)
{
	int i;
	t=a[1];
	s=t;
	for (i=2;i<=n;i++)
	{
		t=gcd (t,a[i]);
		s*=a[i]/t;
		t=s;
	}
	cout<<s;
}
int main (void)
{
	int i;
	cin>>n;
	for (i=1;i<=n;i++)
	cin>>a[i];
	work ();
	return 0;
}


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

typedef int32_t i32;
typedef int64_t i64;
typedef double f64;

void *const null=(void *)0;
i64 const llinf=4611686018427387903LL;
i64 const mod=1000000009LL;
f64 const pi=3.141592653589793;
f64 const rad=57.295779513082323;

#define CODE_

i32 main(void){
    i64 n,a,b,ap,bp;
    while(1){
        scanf("%lli",&n);
        if(n==0LL) break;
        ap=0LL;
        bp=0LL;
        for(i64 i=0LL;i<n;++i){
            scanf("%lli%lli",&a,&b);
            if(a>b) ap+=a+b;
            else if(a<b) bp+=a+b;
            else{
                ap+=a;
                bp+=b;
            }
        }
        printf("%lli %lli\n",ap,bp);
    }
    return 0;
}



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


int main(void) {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n)cin >> h[i];

    int tmp = -99;
    rep(i, n){
        if(h[i] - tmp < 0){
            puts("No");
            return 0;
        }else if(h[i] - tmp > 0){
            tmp = h[i] - 1;
        }else{
            tmp = h[i];
        }
    }
    puts("Yes");

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
//
//void d(std::istream& in)
//{
//    int N;
//    in >> N;
//    std::vector<int> aList(N, 0);
//    for (auto& a : aList)
//    {
//        in >> a;
//    }
//
//    int count = 0;
//    for (int i = 0; i < N; ++i)
//    {
//        const auto& ai = aList.at(i);
//
//        bool ok = false;
//        for (int j = 0; j < N; ++j)
//        {
//            const auto& aj = aList.at(j);
//            if (i == j)
//                continue;
//
//            if (ai % aj == 0)
//            {
//                ok = true;
//                break;
//            }
//        }
//        if (!ok)
//            ++count;
//    }
//
//    std::cout << count;
//}

void d(std::istream& in)
{
    int N;
    in >> N;
    std::vector<size_t> aList(N, 0);
    size_t max = 0;
    for (auto& a : aList)
    {
        in >> a;
        if (a > max)
            max = a;
    }

    std::vector<bool> bList(max + 1LL, true);
    std::sort(aList.begin(), aList.end());
    size_t preA = 0;
    for (const auto& a : aList)
    {
        if (a == preA)
        {
            bList.at(a) = false;
            continue;
        }
        preA = a;

        if (!bList.at(a))
            continue;

        size_t times = 2;
        while (a * times <= max)
        {
            bList.at(a * times) = false;
            ++times;
        }
    }

    int counter = 0;
    for (const auto& a : aList)
    {
        if (bList.at(a))
            ++counter;
    }

    std::cout << counter;
}

int main(int, char* [])
{
    d(std::cin);
    return 0;
}


Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);


signed main()
{
    int n;cin>>n;
    ll ans=0;
    vector<ll> a(n),b(n),c(n-1);
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    rep(i,n){
        cin>>b[i];
    }
    rep(i,n-1){
        cin>>c[i];
    }

    rep(i,n){
        ans+=b.at(a.at(i));
        if(i>0 && a.at(i-1)+1==a.at(i)){
            ans+=c.at(a.at(i-1));
        }
    }

    cout<<ans<<endl;
}

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

int main(int argc, char* argv[]){
    int A, B, ans = 0;
    cin >> A >> B;
    for(int i = A; i <= B; i++){
        if(
            i / 10000 == i % 10 &&
            (i / 1000) % 10 == (i % 100) / 10
        ){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
typedef long long ll;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};
int ans=100000;
int calc(int target, int &left){
    int k = left/target;
    left -= target * k;
    return k;
}
signed main () {
    int n,m;cin >> n >> m;
    vector<int> coins(m);
    REP(i,m)cin >> coins[i];sort(ALL(coins));
    vector<ll> dp(n+1,100000);dp[0]=0;
    REP(i,n+1){
        for(int c : coins){
            if(c>i)continue;
            dp[i]=min(dp[i],dp[i-c]+1);
        }
    }
    cout << dp[n] << endl;
}



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

ans = []
while n != 0:
    if n % -2 == -1:
        n -= 1
        ans += ['1']
    else:
        ans += ['0']
    n //= -2
ans.reverse()
if len(ans) == 0:
    print(0)
else:
    print(''.join(ans))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;



int main(void){

    int N;
    cin>>N;
    int a=4;
    int b = 7;
    int c =1;//0:yes
    while(N>0){
        if(N%4==0){
            c=0;
            break;
        }
        if(N%b==0){
            c=0;
            break;
        }
        N-=a;
    }

    if(c==0){
        cout << "Yes"<< endl;
    }else{
        cout << "No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

int N;
vector<int> h;
int dst(int l, int r) {
    int m = h[l];
    FOR(i, l, r, 1) {
        amin(m, h[i]);
    }
    FOR(i, l, r, 1) {
        h[i] -= m;
    }
    int res = m;
    while (l < r) {
        while (l < N && h[l] == 0) {
            l++;
        }
        r = l;
        while (r < N && h[r] > 0) {
            r++;
        }
        if (l < r) {
            res += dst(l, r);
        }
    }
    return res;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    h = vector<int>(N);
    REP(i, N) {
        cin >> h[i];
    }
    cout << dst(0, N) << endl;
    return 0;
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        a = a//2
        b += a
    else:
        if b % 2 == 1:
            b -= 1
        b = b//2
        a += b

print(a, b)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
using namespace std;
  
int main() {
  string S; cin >> S;
  long numS = stol(S), N = S.size();
  
  ll ans =0;
  for (int i =0; i<(1<<(N-1)); i++) {
    bitset<10> bit(i);
    long tmp = numS;
    int keta =0;
    for (int j =0; j<=N-2; j++) {
      if (bit[j] == 1) {
        ans += (ll)tmp % (ll)pow(10,j - keta +1);
        tmp /= pow(10,j - keta +1);
        keta = j+1;
      }
    }
    if (tmp != 0) ans += tmp;
  }
  
  cout << ans << endl;
}

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

#define int long long

int N;
int x[111], y[111], h[111];

// 中心座標の高さが求められたら高さを返す。求められなかったら-1を返す
int check(int cx, int cy) {
   set<int> s;
   int Max = 1e10;
   for (int i = 0; i < N; i++) {
      int dist = abs(x[i] - cx) + abs(y[i] - cy); // 現在見ている座標から中心座標までの距離
      if (h[i] <= 0) {
         Max = min(Max, dist);
      } else {
         s.insert(h[i]+dist);
      }
   }

   if (s.size() == 1 && *s.begin() <= Max) {
      return *s.begin();
   }

   return -1;
}

signed main() {
   // 入力
   cin >> N;
   for (int i = 0; i < N; i++) {
      cin >> x[i] >> y[i] >> h[i];
   }

   int ax = 0, ay = 0, ah = 0;
   // (cx, cy)を全列挙
   [&]() {
      for (int cy = 0; cy <= 100; cy++) {
         for (int cx = 0; cx <= 100; cx++) {
            int t = check(cx, cy); // (cx, cy)が中心座標かどうかをcheck()で評価する
            if (t == -1) continue; // 返り値が-1なら処理を飛ばす

            ax = cx, ay = cy, ah = t;
            return;
         }
      }
   }();

   printf("%lld %lld %lld\n", ax, ay, ah); // 答えを出力

   return 0;
}

Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    private static class Task implements Comparable<Task> {
        int s;
        int t;

        Task(int s, int t) {
            this.s = s;
            this.t = t;
        }

        public int compareTo(Task task) {
            return t - task.t;
        }
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        sc.nextInt();
        int m = sc.nextInt();

        PriorityQueue<Task> que = new PriorityQueue<>();
        for(int i = 0; i < m; i++) {
            que.add(new Task(sc.nextInt(), sc.nextInt()));
        }

        int ans = 0;
        int t = 0;
        while(!que.isEmpty()) {
            Task task = que.poll();
            if(t <= task.s) {
                ans++;
                t = task.t;
            }
        }

        System.out.println(ans);

        sc.close();
    }
}

Measured memory_bytes: 85932
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
namespace mp = boost::multiprecision;
#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 ALL(v) v.begin(), v.end()

typedef long long lint;
int main(){
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    mp::cpp_dec_float_100 x = a;
    mp::cpp_dec_float_100 y = b;
    mp::cpp_dec_float_100 z = c;

    if(mp::sqrt(x) + mp::sqrt(y) < mp::sqrt(z))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 1000000007


int32_t main(){
    int n;cin>>n;
    int a[n];
    multiset<int> s;
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    for(int i=0;i<n;i++){
    	if(s.empty()){
    		// c++;
    		s.insert(a[i]);
    		continue;
    	}
    	else{
    		auto it=s.lower_bound(a[i]);
    		if(it!=s.begin()){
    			it--;
    			s.erase(it);
    		}
    	}
    	s.insert(a[i]);
    }
    cout<<s.size()<<endl;
    
    
    return 0;
}

Measured memory_bytes: 5760
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] p = sc.IntArray();

        int ans = 1;
        int min = p[0];

        for (int i = 1; i < n; i++)
        {
            if (p[i] < min)
            {
                ans++;
                min = p[i];
            }
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 34012
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int main() {
    ll N, X;
    cin >> N >> X;
    ll ans = 0;
    rep(i, 0, N) {
        int a;
        cin >> a;
        ans = gcd(ans, abs(a-X));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  int h[n];
  int i,a,b;
  int dp[n];
  for(i=0;i<n;i++)
  {
  	cin>>h[i];
    dp[i]=0;
  }
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(i=2;i<n;i++)
  	dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
  cout<<dp[n-1]<<"\n";  
  return 0;
}

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

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		int N;
		cin >> N;

		if( N%10 == 0 ) {
			cout << 10 << endl;
			return;
		}

		int ans = 0;
		while( N ) {
			ans += N%10;
			N /= 10;
		}

		cout << ans << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int box[100];
	int i;
	int a,b;
	cin>>n;
	for(i=0;i<n;i++)	cin>>box[i];
	sort(box,box+n,greater<int>());
	a=0;
	b=0;
	for(i=0;i<n;i++){
		if(i%2==0)	a+=box[i];
		else		b+=box[i];
	}
	cout<<a-b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int d;
int c[27];
int s[366][27];
int calc(vector<int> t){
    int last[26]={};
    vector<int> ret(d);
    int ans=0;
    for(int i=0; i<d; i++){
        ans+=s[i][t[i]];
        last[t[i]]=i+1;
        for(int j=0; j<26; j++){
            ans-=c[j]*(i+1-last[j]);
        }
        ret[i]=ans;
    }
    return ans;
}
int main()
{
    cin>>d;
    for(int i=0; i<26; i++) cin>>c[i];
    for(int i=0; i<d; i++) for(int j=0; j<26; j++) cin>>s[i][j];
    vector<int> t(d);
    for(int i=0; i<d; i++){
        cin>>t[i];
        t[i]--;
    }
  set<int> st[26];
    for(int i=0; i<d; i++) st[t[i]].insert(i);
    int ans=calc(t);
    int m; cin>>m;
    while(m--){
        int k, q; cin>>k>>q;
        k--; q--;
        if(t[k]==q){
            cout<<ans<<endl;
            continue;
        }
        int pr=t[k], ansp=ans;
        ans-=s[k][pr];
        ans+=s[k][q];
        int l1=-1, l2=-1, r1=d, r2=d;
        auto itr1=st[pr].find(k);
        if(itr1!=st[pr].begin()){
            itr1--;
            l1=*itr1;
            itr1++;
        }
        itr1=st[pr].erase(itr1);
        if(itr1!=st[pr].end()){
            r1=*itr1;
        }
        auto itr2=st[q].insert(k).first;
        if(itr2!=st[q].begin()){
            itr2--;
            l2=*itr2;
            itr2++;
        }
        itr2++;
        if(itr2!=st[q].end()){
            r2=*itr2;
        }
        ans+=c[q]*(k-l2)*(r2-k);
        ans-=c[pr]*(k-l1)*(r1-k);
        t[k]=q;
        cout<<ans<<endl;
    }
	return 0;
}


Measured memory_bytes: 3692
n = str(input())
l = len(n)
c = 0
n = "00"+ n
dnow = int(n[l+1])
for i in range(l+1):
  dnext = int(n[l-i])
  if  dnow <= 4:
    c += dnow
  elif dnow == 5:
    if dnext <= 4:
      c += 5
    else:
      dnext += 1
      c += 5
  elif dnow == 10:
    dnext += 1
  else:
    c += 10 - dnow
    dnext += 1
  dnow = dnext
print(c)

Measured memory_bytes: 54384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,x;cin>>a>>b>>x;
	double d;
	if(2*x>a*a*b)
	{
		d=(2.0*b*a*a-2.0*x)/(a*a*a);
	}
	else 
		{
			d=1.0*b*b*a/(2*x);
			
		}
	cout<<fixed<<setprecision(10)<<(atan(d))/3.1415926535*180;
}

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

int main(void){
    ll x, ans = 0;
    cin >> x;
    
    ans += 2 * (x / 11);
    x %= 11;
    if (x > 0) {
        ans++; x -= 6;
    }
    if (x > 0) {
        ans++; x -= 5;
    }
    cout << ans << endl;
}


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

int main() {
	int N, M;
	cin >> N >> M;
	long AB, a = 0, ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> AB;
		a += AB;
	}
	for (int i = 0; i < M; ++i) {
		cin >> AB;
		ans += AB * a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;cin>>N;
  
  if(N%2==0){
    cout<<N<<endl;
  }
  else{
    cout<<2*N<<endl;
  }
}

Measured memory_bytes: 3604