akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>

using namespace std;
const long long INF = 1LL << 61;

struct sol {
	long long x, cost;
	long long c;

	sol(long long xx, long long cc, long long C) {
		x = xx;
		cost = cc;
		c = C;
	}

	long long getCost(long long y) {
		long long d = y - x;
		return d * d + cost + c;
	}

	long long time(sol sol2) {
		long long l = sol2.x;
		long long r = 5e8L;
		long long ans = r;


		while (l <= r) {
			long long mid = l + (r - l) / 2;
			if (getCost(mid) >= sol2.getCost(mid)) {
				ans = mid;
				r = mid - 1;
			}
			else {
				l = mid + 1;
			}
		}
		return ans;
	}
};

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	long long c;
	cin >> n >> c;

	vector<long long> heights;
	for (int i = 0; i < n; i++) {
		long long h;
		cin >> h;
		heights.push_back(h);
	}

	vector<long long> dp(n, INF);
	dp[0] = 0LL;
	deque<sol> all;
	
	all.push_back({ heights[0], 0, c });
	for (int i = 1; i < n; i++) {
		while (all.size() >= 2 && all[0].getCost(heights[i]) >= all[1].getCost(heights[i])) {
			all.pop_front();
		}
		dp[i] = all[0].getCost(heights[i]);
		sol add(heights[i], dp[i], c);
		while (true) {
			if (all.size() < 2) {
				break;
			}

			if (all[all.size() - 2].time(all[all.size() - 1]) < all[all.size() - 2].time(add)) {
				break;
			}

			if (all[all.size() - 2].time(all[all.size() - 1]) == all[all.size() - 2].time(add)) {
				long long tm = all[all.size() - 2].time(all[all.size() - 1]);
				if (all[all.size() - 1].getCost(tm) < add.getCost(tm)) {
					break;
				}
			}
			all.pop_back();
		}
		all.push_back(add);

	}
	cout << dp[n - 1] << "\n";
}

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

int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() > b.size()) cout << "GREATER" << endl;
  else if (a.size() < b.size()) cout << "LESS" << endl;
  else {
    if (a > b) cout << "GREATER" << endl;
    else if (a < b) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 256
import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def main():
    """ Code implementation """
    n = int(input())
    healths = list(map(int, input().split()))
    m = healths[0]
    for i in range(1, len(healths)):
        if (m < healths[i]):
            g = gcd(m, healths[i])
        else:
            g = gcd(healths[i], m)
        if m > g:
            m = g

    print(m)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14948
#include <stdio.h>
int main(){
    int a,b,c,i,result=0;
    scanf("%d%d%d",&a,&b,&c);
    
    
    for(i=1;i<=c;i++){
        
        if(c%i==0 && a<=i && i<=b){
            result++;
        }
    }
    printf("%d\n",result);
    return 0;
 }

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
#define INF (1<<29)
int l;
//ll a[200005];
ll a;
ll dp[200005][5]={0};
int main(){
    cin>>l;
    //for(int i=0;i<l;i++) cin>>a[i];
    
    for(int i=0;i<5;i++){
        for(int j=0;j<l+2;j++){
            dp[j][i]=INF;
        }
    }
    
    for(int i=0;i<5;i++) dp[0][i]=0;
    
    for(int i=1;i<=l;i++){
        cin>>a;
        int b=(a==0?2:(a%2));
        
        int c=!(a%2);
        
        dp[i][0]=dp[i-1][0]+a;
        
        dp[i][1]=min(dp[i][0],dp[i-1][1]+b);
        
        dp[i][2]=min(dp[i][1],dp[i-1][2]+c);
        
        dp[i][3]=min(dp[i][2],dp[i-1][3]+b);
        
        dp[i][4]=min(dp[i][3],dp[i-1][4]+a);
        
    }
    cout<<dp[l][4]<<endl;
    return 0;
    
}


Measured memory_bytes: 8064
N = int(input())
a_list = list(map(int, input().split()))

a_list = sorted(a_list)[::-1]

A_point = sum([a for i, a in enumerate(a_list) if i % 2 == 0])
B_point = sum([a for i, a in enumerate(a_list) if i % 2 == 1])

print(A_point - B_point)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
#define out(...) (_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

int main() {
	in(ll, A, B, C, K);
	out(K&1 ? B-A : A-B);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

int n,m,k,arr[N],B[N];

void solve()
{
    cin>>n;
    m = (1LL<<n);
    forn(i,0,m-1)
    {
        cin>>arr[i];
    }
    int ans = 0;
    forn(i,1,m-1)
    {
        int a = 0 , b = 0;
        for(int k = i ; k>=0 ; k=(k-1)&i)
        {
            if(arr[k]>a)
            {
                b = a;
                a = arr[k];
            }
            else if(arr[k]>b)
            {
                b=arr[k];
            }
            if(k == 0)break;
        }
        ans = max(ans,a+b);
        cout<<ans<<"\n";
    }
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  

Measured memory_bytes: 7296
#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>;

const int mod = 1000000007;

ll dp[2005];

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

    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= N; ++j) {
            dp[i] = 0;
        }
    }
    for (int i = 3; i <= N; ++i) {
        dp[i] = 1;
    }

    for (int i = 3; i <= N; ++i) {
        for (int j = 3; j <= N; ++j) {
            if (i - j > 0) {
                dp[i] += dp[i - j];
                dp[i] %= mod;
            } else
                break;
        }
    }

    cout << dp[N] << endl;
}


Measured memory_bytes: 3612
my ($a,$b,$c,$d,$e,$f)=+<<get.words;
my&g={.{"$^x $^y"}//=$^x*100+$^y>$f||$^y>$^x*$e??-1!!g($^x+$a,$^y)*g($^x+$b,$^y)*g($^x,$^y+$c)*g($^x,$^y+$d)*0+$^y/$^x}
g($a,0);g($b,0);
($a,$b)=.sort(-*.value)[0].key.words;
put ($a*100+$b,$b)

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

int main() {
  int w, a, b;

  cin >> w >> a >> b;

  if (max(a, b) - (min(a, b) + w) >= 0)
    cout << max(a, b) - (min(a, b) + w);
  else
    cout << "0";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template<int p = 1000000007>
class Z {
	ll x;
public:
	Z(ll X) :x((X + p) % p) { ; }
	Z() :x(0) { ; }
	Z &operator=(ll y) { return *this = Z(y); }
	Z operator-() const { return Z(-x); }
	Z operator+(ll y) const { return Z(x + y); }
	Z &operator+=(ll y) { return *this = *this + y; }
	Z operator-(ll y) const { return Z(x - y); }
	Z &operator-=(ll y) { return *this = *this - y; }
	Z operator*(ll y) const { return Z(x * y); }
	Z &operator*=(ll y) { return *this = *this * y; }
	Z operator/(ll y) const { return *this * Z(y).inv(); }
	Z &operator/=(ll y) { return *this = *this / y; }
	Z operator+(const Z &r) const { return *this + r.x; }
	Z &operator+=(const Z &r) { return *this += r.x; }
	Z operator-(const Z &r) const { return *this - r.x; }
	Z &operator-=(const Z &r) { return *this -= r.x; }
	Z operator*(const Z &r) const { return *this * r.x; }
	Z &operator*=(const Z &r) { return *this *= r.x; }
	Z operator/(const Z &r) const { return *this / r.x; }
	Z &operator/=(const Z &r) { return *this /= r.x; }
	Z pow(int i) const {
		if (i == 0) return Z(1);
		if (i % 2) return *this * pow(i - 1);
		Z tmp = pow(i / 2);
		return tmp * tmp;
	}
	Z inv() const { return pow(p - 2); }
	ll get() const { return x; }
	friend istream &operator>>(istream &istr, Z &z) { return istr >> z.x; }
	friend ostream &operator<<(ostream &ostr, const Z &z) { return ostr << z.x; }
};

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

	int n, k;
	cin >> n >> k;
	k = min(n - 1, k);
	vector<Z<>> fact(n + 1), ifact(n + 1);
	fact[0] = 1;
	REP(i, n) {
		fact[i + 1] = fact[i] * (i + 1);
	}
	ifact[n] = Z<>(1) / fact[n];
	for (int i = n - 1;i >= 0;--i) ifact[i] = ifact[i + 1] * (i + 1);
	Z<> res = 0;
	for (int i = 0;i <= k;++i) {
		if (i == 0) res += 1;
		else res += fact[n] * ifact[i] * ifact[n - i] * fact[n - 1] * ifact[i] * ifact[n - i - 1];
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll read(){
	char c=getchar();ll x=0,f=1;
	while(c<'0'||c>'9'){ if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return x*f;
}
ll a,b;
int main(){
	a=read(),b=read();
	if(a>b) swap(a,b);
	if(a>0){
		printf("Positive\n");
	}
	else{
		if(a*b<=0){
			printf("Zero\n");
		}
		else{
			if((b-a+1)&1) printf("Negative\n");
			else printf("Positive\n");
		}
	}
	return 0;
}


Measured memory_bytes: 256
/****************************************
/ AUTHOR : ROHAN BAIJAL                  /  
/ ALIAS : rohanblueboybaijal             /
/ INSTITUTE : IIT KANPUR                 /
*****************************************/
//              TEMPLATE                //

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

#define MP make_pair
#define PB push_back
#define ll long long int
#define F first
#define S second
#define MAX(x,y) (x)>(y)?(x):(y)
#define MIN(x,y) (x)<(y)?(x):(y)
#define REP(i,a,n) for(i=a;i<(n);i+=1)
#define REPL(i,a,n) for(i=a;i<=(n); i+=1)
#define REPr(i,n) for(i=n-1;i>=0;i-=1)

typedef vector<ll> vll;
typedef set<int>::iterator sit;
typedef unordered_set<int>::iterator usit;
typedef multiset<int>::iterator msit;
typedef unordered_multiset<int>::iterator umsit;
typedef vector<ll>::iterator vllit;

//cin.ignore(numeric_limits<streamsize>::max(),'\n');


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

    string s;
    cin>>s;
    int n = s.length();
    int sum = 0, i;
    REP(i,0,n) sum += s[i] - '0';
    cout<<(sum%9 ? "No\n" : "Yes\n");
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

constexpr int INF=1e9;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  char a[525][525];
  cin>>n;
  bool ok=false;
  REP(i, n)REP(j, n){
    cin>>a[i][j];
    if(a[i][j]=='#'){
      ok=true;
    }
  }
  if(!ok){
    cout<<-1<<'\n';
    return 0;
  }
  int ans=INF;
  REP(i, n){
    int cnt=0;
    REP(j, n){
      if(a[i][j]!='#'){
        ++cnt;
      }
    }
    if(cnt){
      bool ok=false;
      REP(x, n){
        if(a[x][i]=='#'){
          ok=true;
          break;
        }
      }
      if(!ok){
        ++cnt;
      }
    }
    CHMIN(ans, cnt);
  }
  REP(j, n){
    bool ok=true;
    REP(i, n){
      if(a[i][j]!='#'){
        ok=false;
        break;
      }
    }
    if(!ok){
      ++ans;
    }
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 640
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  s <- T.getLine :: IO T.Text
  t <- T.getLine :: IO T.Text
  print . length . filter (uncurry (/=)) $ T.zip s t
 
unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 6840
#include<iostream>
#include<cstdio>
#include<list>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
int main()
{
	long long int n,r;
	cin>>n>>r;
	int cnt=0;
	while(n>0)
	{
		n/=r;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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

int main() {
	string n;
	cin >> n;
	string k = "No";
	if(n.at(0) == '9' ||n.at(1) == '9')
	{
		k = "Yes";
	}
    cout << k << endl;
	return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);

  rep(i, 0, N) {
    cin >> A[i];
  }
  rep(i, 0, N) {
    cin >> B[i];
  }

  int ans = 0;
  int T = 1;
  rep(k, 0, 30) {
    int mod = 2 * T;
    vector<int> Amod(N);
    vector<int> Bmod(N);
    rep(i, 0, N) {
      Amod[i] = A[i] % mod;
      Bmod[i] = B[i] % mod;
    }
    sort(All(Amod));

    ll counter = 0;
    rep(i, 0, N) {
      int bi = Bmod[i];
      counter += BiSearchRangeNum(Amod, T - bi, 2 * T - bi) + BiSearchRangeNum(Amod, 3 * T - bi, 4 * T - bi);
    }
    if (counter % 2 == 1) ans += T;
    T *= 2;
  }

  cout << ans << endl;
};


Measured memory_bytes: 3432
class UnionFind:
  def __init__(self, num):
    self.rank = [0]*num
    self.par = [i for i in range(num)] #基準(par = parentのpar)
    self.n   = num
    self.size = [1]*num

#親を探す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
      return self.par[x]

#集合を結合する(結合する前に親のポインタを取得する)
  def union(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[y] = x
    self.size[x] += self.size[y]
    self.size[y] = 0

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def all_find(self):
    for n in range(len(self.par)):
      self.find(n)


n,m=map(int,input().split())
uf=UnionFind(n)
ans=0
ab=[]
for i in range(m):
  a,b=map(int,input().split())
  ab.append([a,b])
for i in range(m):
  uf=UnionFind(n)
  flag=False
  for j in range(m):
    a,b=ab[j]
    if i==j:
      continue
    uf.union(a-1,b-1)
  for j in range(n):
    for k in range(j,n):
      if not uf.same(j,k):
        flag=True
  if flag:
    ans+=1

print(ans)

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

using namespace std;
using ll = long long;

int main() {
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i = 0;i < s.size();++i) {
        if(s[i]!=t[i])++ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3916
import sys
sys.setrecursionlimit(1000000)
def solve():
    N = int(input())
    cost = list(map(int, input().split()))
    memo = {}
    def helper(i):
        if i in memo:
            return memo[i]
        if i == 0:
            return 0
        # use i at i+1 or i+2
        if i - 2 >= 0:
            u1 = abs(cost[i-1] - cost[i]) + helper(i-1)
            u2 = abs(cost[i-2] - cost[i]) + helper(i-2)
            f = min(u1, u2)
        else:
            f = abs(cost[i-1] - cost[i]) + helper(i-1)
        memo[i] = f
        return f
    return helper(N-1)
print(solve())

Measured memory_bytes: 130928
#include<iostream>
#include<algorithm>
using namespace std;
struct I{
	int d,p;
};
bool operator>(const I &a,const I &b){
	return a.p!=b.p?a.p>b.p:a.d>b.d;
}
int main(){
	int n,m,ans,t,c;
	I i[10000];
	while(cin>>n>>m,n){
		ans=t=0;
		for(int j=0;j<n;j++)cin>>i[j].d>>i[j].p,ans+=i[j].d*i[j].p;
		sort(i,i+n,greater<I>());
		while(m>0)c=min(i[t].d,m),m-=c,ans-=c*i[t].p,t++;
		cout<<max(ans,0)<<endl;
	}
	return 0;
}

Measured memory_bytes: 940
#include<stdio.h>
int main()
{
	char s[4],i;
	scanf("%s",s);
	for(i=0;i<3;i++)
	{
		if(s[i]!=s[i+1])
			continue;
		if(s[i]==s[i+1]){
			printf("Bad\n");
			break;
		}
	}
	if(i==3)
		printf("Good\n");
	return 0;
}

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

int main (){
    int N = 0;
    cin >> N;
    vector<int> a(N);
    int max= 0;
    int maxsecond = 0;
    int maxseconds = 0;
    int maxs = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        if (max < a[i])
        {
            max = a[i];
            maxs = i;
        }
        else if(maxsecond < a[i]){
            maxsecond = a[i];
            maxseconds = i;
        }
    }
    for (int i = 0; i < N; i++)
    {
        if(i != maxs){
            cout << max << endl;
        }
        else{
            cout << maxsecond << endl;
        }
    }

}


Measured memory_bytes: 2432
fn main() {
    let (k, n): (i32, usize) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let mut s = s.split_whitespace();
        (s.next().unwrap().parse().unwrap(), s.next().unwrap().parse().unwrap())
    };
    let mut a= Vec::with_capacity(n+1);
    a.push(0);
    {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        for v in s.split_whitespace().map(|x|x.parse::<i32>().unwrap()) {
            a.push(v);
        }
    };
    a[0]=a[n]-k;
    let mut m=0;
    for i in 0..n {
        if m<a[i+1]-a[i] {
            m=a[i+1]-a[i];
        }
    }
    println!("{}",k-m);
}

Measured memory_bytes: 8444
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N)cin >> A[i];
    int ans = 0;
    while (true) {
        bool f = true;
        REP(i, N) {
            if (A[i] % 2 == 0) {
                A[i] /= 2;
            }
            else {
                f = false;
                break;
            }
        }
        if (!f)break;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define reverse(x) reverse(x.begin(), x.end())
#define pb push_back
#define pii pair<int, int>
#define pll pair<long long,long long>
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
long long n, m;

int main(){
	long long i, j;
	cin >> n;
	string ans;
	if(n <= 26){
		char c = (n-1+'a');
		cout << c;
		return 0;
	}else if(n <= 702){
		n -= 27;
		for(i=0;i<2;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 18278){
		n -= 703;
		for(i=0;i<3;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 475254){
		n -= 18279;
		for(i=0;i<4;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}
	else if(n <= 12356630) {
		n -= 475255;
		for(i=0;i<5;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}
	else if(n <= 321272406) {
		n -= 12356631;
		for(i=0;i<6;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 8353082582) {
		n -= 321272407;
		for(i=0;i<7;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 217180147158) {
		n -= 8353082583;
		for(i=0;i<8;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 5646683826134) {
		n -= 217180147159;
		for(i=0;i<9;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else if(n <= 146813779479510){
		n -= 5646683826135;
		for(i=0;i<10;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}else {
		n -= 146813779479511;
		for(i=0;i<12;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}
	reverse(ans);
	cout << ans;
}*/

#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define reverse(x) reverse(x.begin(), x.end())
#define pb push_back
#define pii pair<int, int>
#define pll pair<long long,long long>
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
long long n, m;

bool p(){
	long long j = n;
	while(j){
		if(j%26)return 0;
		j/=26;
	}
	return 1;
}

long long pp(){
	long long j = n, c=0;
	while(j){
		j/=26;
	c++;
	}
	return c;
}

int main(){
	long long i, j;
	cin >> n;
	string ans;
	if(n <= 26){
		char c = (n-1+'a');
		cout << c;
		return 0;
	}else {
		long long last = 0, c=1, l = 26;
		while(n > l){
			c++;
			n-=l;
			last += l;
			l*=26;
		}
		n--;
		for(i=0;i<c;i++){
			char c = (n%26);
			ans += c+'a';
			n/=26;
		}
	}
	reverse(ans);
	cout << ans;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int a, b;
  scan(a, b);
  int ans = (a + b) % 24;
  print(ans);
  return 0;
}


Measured memory_bytes: 760
package main 

import (
  "fmt"
  "math"
)

func main() {
  var a, b, c, k int
  fmt.Scan(&a, &b, &c, &k)
  
  ans := 0
  
  if k%2 == 0 {
    ans = k*a+(k-1)*(b+c) - (k*b+(k-1)*(a+c))
  } else {
    ans = (k-1)*a+k*(b+c) - ((k-1)*b+k*(a+c))
  }
 
  if math.Abs(float64(ans)) > 1000000000000000000 {
    fmt.Println("Unfair")
  } else {
    fmt.Println(ans)
  }

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll solve() {
    vector<ll> P(4);
    for ( int i = 0; i < 4; i++ ) {
        cin >> P[i];
    }
    ll N;
    cin >> N;
    ll p1 = P[2];
    ll p2 = P[3];
    p1 = min(p1, P[0] * 4);
    p1 = min(p1, P[1] * 2);
    p2 = min(p2, p1 * 2);
    ll ans = N/2*p2 + N%2*p1;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>n>>x>>y;
    Ff(i,1,n+1)
    {
        if(i+1<=n)
        g[i].pb(i+1);
        if(i-1>=1)
        g[i].pb(i-1);
    }
    g[x].pb(y);
    g[y].pb(x);
    ll b[n];
    Ff(i,0,n)
    b[i]=0;

    Ff(i,1,n+1)
    {
        Ff(j,i+1,n+1)
        {
            b[min(j-i, abs(j-y)+abs(x-i)+1)]++;
        }
    }

    Ff(i,1,n)
    cout<<b[i]<<endl;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 7680
l = int(input())
a = [int(input()) for _ in range(l)]
a.insert(0, 0)
dp = [[1000000] * (l + 1) for _ in range(4)]
for i in range(4):
    dp[i][0] = 0
for i in range(1, l + 1):
    dp[0][i] = dp[0][i - 1] + a[i]
for i in range(1, 4):
    for j in range(1, l + 1):
        if i == 2:
            x = abs(a[j] % 2 - 1)
        else:
            x = abs(2 - min(a[j] % 2 + 2, a[j]))
        dp[i][j] = min(dp[i - 1][j], dp[i][j - 1] + x)
ans = dp[3][l]
s = 0
for i in range(l - 1, -1, -1):
    s += a[i + 1]
    ans = min(ans, dp[3][i] + s)
print(ans)

Measured memory_bytes: 51448
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int K = Integer.parseInt(scanner.next());
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = Integer.parseInt(scanner.next());
        }
        int[] dp = new int[N];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 1; j <= K; j++) {
                if (i + j < N)
                    dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(h[i + j] - h[i]));
            }
        }

        System.out.println(dp[N - 1]);
    }

}



Measured memory_bytes: 50704
//
// Created by Mahmoud Rashad on 11/27/19.
//

#include <bits/stdc++.h>


using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<ii, ii>> vii;


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.out", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n;
    cin >> n;
    vector<ii> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].first;
        arr[i].second = i;
    }

    sort(arr.begin(), arr.end());

    for (int i = 0; i < n; ++i) {
        cout << arr[i].second + 1 << ' ';
    }
    cout << "\n";


    return 0;
}

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

void fnInput(vector<int>& rvnFibDP)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  rvnFibDP.resize(nMaxSiz + 1, 0);

  if (nMaxSiz >= 1)  
    rvnFibDP[0] = rvnFibDP[1] = 1;
  else
    rvnFibDP[0] = 1;
}

int fnFibNumber(vector<int>& rvnFibDP, int nNo)
{
  if (rvnFibDP[nNo])  return rvnFibDP[nNo];

  return rvnFibDP[nNo] = 
         fnFibNumber(rvnFibDP, nNo - 1) + fnFibNumber(rvnFibDP, nNo - 2);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnFibDP; 

  fnInput(vnFibDP);
  cout << fnFibNumber(vnFibDP, vnFibDP.size() - 1) << endl;
  return 0;
}

Measured memory_bytes: 3168
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long

int main(void)
{
    //a + b = x
    //2a + 4b = y;
    //2b = y -2x;
    //2a = 4x - y;
    int x, y;
    int a, b;
    scanf("%d %d", &x, &y);
    b = (y - 2 * x) >> 1;
    a = (4 * x - y) >> 1;
    if (((a + b) == x) && ((2 * a + 4 * b) == y) && a >= 0 && b >= 0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, X;
    cin >> N >> X;
    vector<int> v(N);
    for (auto &&i : v) {
        cin >> i;
    }

    int cnt = 1;
    int now = 0;
    for (auto &&i : v) {
        if (X < now + i)
            break;
        now += i;
        cnt++;
    }
    print(cnt);

    return 0;
}

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

int N, M, C, ans = 0, sum;
int main(){
    cin >> N >> M >> C;
    int A[N+1][M+1];
    int B[M+1];


    for(int i = 0; i < M; i++) {
	cin >> B[i];
    }

    for(int i = 0; i < N ; i++) {
	    for(int j = 0; j < M; j++) {
		cin >> A[i][j];
	    }
    }
    for(int i = 0; i < N ; i++) {
	sum = 0;
	for(int j = 0; j < M; j++){
	    sum += A[i][j] * B[j];
	}
	if(sum + C > 0)
	    ans++;	
    }
    cout << ans << endl; 
	      
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <algorithm>
// #include <cmath>
// #include <math.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    int n = alphabet.length();
    vector<bool> list(n);
    for (int i=0; i<n; ++i) list[i] = false;

    for(int i=0; i<s.length(); ++i){
        for(int j=0; j<n; ++j){
            if (alphabet[j] == s[i]){
                list[j] = true;
            }
        }
    }

    for(int i=0; i<n; ++i){
        if (list[i] == false){
            cout << alphabet[i] << endl;
            return 0;
        }
    }
    cout << "None" << endl;

}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	int ans = inf;
	for (int i = 0; i < s.size() - t.size() + 1; ++i) {
		int cnt = 0;
		for (int j = i; j < t.size() + i; ++j) {
			if (s[j] != t[j - i]) cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n == 1)cout<<"Hello World";
	else if(n == 2){
		int a, b;
		cin>>a;
		cin>>b;
		cout<<a+b;
	}
	
	return 0;
}

Measured memory_bytes: 256
N,Q  = map(int, input().split())

# 木
G = [[] for i in range(N)]
for i in range(N-1):
    u,v = map(int,input().split())
    G[u-1].append((v-1))
    # a<bが決まっているなら、必要ない？
    # G[v-1].append((u-1))

## クエリを覚えておく
scores = [0]*N
for i in range(Q):
    p,x = map(int, input().split())
    scores[p-1] += x 

# 和をとっていく
ans = [0]*N
ans[0] = scores[0]
used = [False] * N

# 木をBFSをする
from collections import deque
used = [False] * N
used[0] = True # 始めどこから行くか
q = deque([0])
while len(q) > 0:
    v = q.popleft()
    Vs = G[v]
    for next_v in Vs: 
        if not used[next_v]:
            q.append(next_v)
            ans[next_v] = ans[v] + scores[next_v]
            used[next_v] = True
print(*ans)

Measured memory_bytes: 93488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> nums(N);
    vector<ll> modifiedNums(N);
    ll modifiedSum = 0;
    for (ll i = 0; i < N; i++)
    {
        cin >> nums.at(i);
        modifiedNums.at(i) = nums.at(i) - (i + 1);
    }
    sort(modifiedNums.begin(), modifiedNums.end());
    ll bestB = modifiedNums.at(N / 2);
    ll answer = 0;
    for (ll i = 0; i < N; i++)
    {
        answer += abs(modifiedNums.at(i) - bestB);
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 3456
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    print(a+b+c-max(a,b,c))

main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
string s;
unordered_map<int, int>cnt;
int main(){
    cin>>s;
    int cur = 0, x;
    for(int i = 0; i < s.size(); ++i){
        cur ^= (1 << (s[i] - 'a'));
        if(cur == 0){
            if(i == s.size() - 1){
                cout<<1<<endl;return 0;
            }
        }
        else{
            int x = 1e8;
            if(cnt[cur] > 0){
                x = min(x, cnt[cur]);
            }
            for(int j = 0; j < 26; ++j){
                if((cur ^ (1 << j)) == 0){ x = 1;break;}
                else{
                    if(cnt[cur ^ (1 << j)] > 0) x = min(x, cnt[cur ^ (1 << j)] + 1);
                    else{
                        x = min(x, cnt[cur ^ (1 << (s[i] - 'a'))] + 1);
                    }
                }
            }
            cnt[cur] = x;
        } 
    }
    cout<<cnt[cur]<<endl;
}

Measured memory_bytes: 170332
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int now[20];
main()
{
    int n,m,x;
    cin>>n>>m>>x;
    int c[n];

    int a[n][m];
    for(int i=0; i<n; i++)
    {
        cin>>c[i];
        for(int j=0; j<m; j++)
            cin>>a[i][j];
    }
    int tot=1e9;
    for(int mask=0; mask<(1<<n); mask++)
    {
        int cost=0;
        memset(now,0,sizeof now);
        for(int i=0; i<n; i++)
        {
            if(mask&(1<<i))
            {
                for(int j=0; j<m; j++)
                {
                    now[j]+=a[i][j];
                }
                cost+=c[i];
            }
        }
        bool f=true;
        for(int i=0; i<m; i++)
            if(now[i]<x)
                f=false;
        if(f)
            tot=min(tot,cost);
    }
    if(tot!=1e9)
        cout<<tot;
    else
        cout<<-1;


}


Measured memory_bytes: 3640
"""
22:17:30

"""

from collections import defaultdict
N = int(input())


def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    if n < 2:
        raise ValueError("N >= 2")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

def factorization(N):
    factors = defaultdict(int)
    for n in range(1,N+1):
        if n <= 3:
            factors[n] += 1
            continue
        primes = getprime(int(n**0.5))
        for prime in primes:
            while n % prime == 0:
                factors[prime] += 1
                n //= prime
                # print(factors,n)
        if n != 1:
            factors[n] += 1
    return factors

d = factorization(N)
# 5種類の数字を洗い出す
n_74 = 0
n_24 = 0
n_14 = 0
n_4 = 0
n_2 = 0
for k in d.keys():
    n = d[k]
    if n >= 2:
        n_2 += 1
    if n >= 4:
        n_4 += 1
    if n >= 14:
        n_14 += 1
    if n >= 24:
        n_24 += 1
    if n >= 74:
        n_74 += 1
# print(n_2,n_4,n_14,n_24,n_74)
cnt = 0
# 1,1,74
cnt += n_74
# 1,3,25
cnt += (n_2-1) * n_24
# 1,5,15
cnt += (n_4-1) * n_14
# 3,5,5
cnt += (n_2-2) * (n_4)*(n_4-1)//2
print(cnt)

Measured memory_bytes: 3436
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
using namespace std;
int main(){
    int a;
    int b;
    while(1)
    {
        cin >> a >> b;
        if(a == 0 && b == 0)break;
        for(int i = 0 ; i < a ; i++)
        {
            for(int j = 0; j < b ; j++ )
            {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int a[100000];
bool ans[100000];

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
		ans[i] = false;
	}

	int i = 0;
	int count = 0;

	while (true)
	{
		if (ans[i])
		{
			cout << -1 << endl;
			return 0;
		}
		if (i == 1) break;
		count++;
		ans[i] = true;
		i = a[i] - 1;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int a,b; cin >> a >> b;
	string s; cin >> s;
	bool ok=true;
	rep(i,a+b+1) {
		if(i==a) {
			if(s[i]!='-') ok=false;
		}
		else {
			if('0'<=s[i]&&s[i]<='9') {}
			else ok=false;
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

////////////////////////////////////////////////////////////////////////////////////////////

template<typename T, typename Monoid>
struct SlidingWindowAggregation {
    T unity;
    Monoid merge;
    vector<pair<T, T>> front, back;

    SlidingWindowAggregation(Monoid f, T id) : merge(f), unity(id) {}

    bool empty() const {return front.empty() and back.empty();}

    int size() const {return front.size() + back.size();}

    T fold_all() const {
        T vf = front.empty() ? unity : front.back().second;
        T vb = back.empty() ? unity : back.back().second;
        return merge(vf,vb);
    }

    void emplace(const T &val) {
        if (back.empty()) {
            back.emplace_back(val,val);
        } else {
            back.emplace_back(val,merge(back.back().second,val));
        }
    }

    void pop() {
        assert(!empty());
        if (front.empty()) {
            front.emplace_back(back.back().first,back.back().first);
            back.pop_back();
            while (!back.empty()) {
                front.emplace_back(back.back().first,merge(back.back().first,front.back().second));
                back.pop_back();
            }
        }
        front.pop_back();
    }
};

///////////////////////////////////////////////////////////////////////////////////////////

void DSL_3_D() {
    int N,L; cin >> N >> L;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    auto f=[](int a, int b) {return min(a,b);};
    const int id = 1e9;
    SlidingWindowAggregation<int, decltype(f)> SWAG(f,id);
    vector<int> ans;
    for (int i = 0; i < N; i++) {
        if (i < L) {
            SWAG.emplace(A[i]);
        } else {
            ans.emplace_back(SWAG.fold_all());
            SWAG.emplace(A[i]);
            SWAG.pop();
        }
    }
    ans.emplace_back(SWAG.fold_all());
    for (int i = 0; i < ans.size(); i++) {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << endl;
}

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

/*
  verified on 2020/06/07
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_3_D&lang=ja
*/


Measured memory_bytes: 12384
let split str =
  let rec split_inner ct b=
    if String.length str = ct then [int_of_string b]
    else
      match str.[ct] with
        ' ' -> (int_of_string b)::split_inner (ct+1) ""
      | c -> split_inner (ct+1) (b^(Char.escaped c))
  in split_inner 0 "";;

let () =
  let is_right l =
    match l with
      [a;b;c] -> if a*a + b*b = c*c then "YES" else "NO"
    | _ -> "NO" and
      n = read_int () in
  let rec read i =
    let line = read_line () |> split |> List.sort compare in
    is_right line |> print_endline;if i > 0 then read (i-1)
  in read (n-1);;

Measured memory_bytes: 2948
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = sc.nextLong();
        for(int i = 1; i < n; i++){
            ans = lcm(ans,sc.nextLong());
        }
        System.out.println(ans);
    }
    
    private static long gcd(long a, long b){
        while (b > 0)
        {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
    
    private static long lcm(long a, long b){
        return a * (b / gcd(a, b));
    }
}

Measured memory_bytes: 23636