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

int main()
{
  int a,b,c;cin>>a>>b>>c;
  if(a==b&&b==c)
  {
    if(a%2==0)cout<<-1<<endl;
    else cout<<0<<endl;
  }
  else
  {
    int count=0;
    while(a%2==0&&b%2==0&&c%2==0)
    {
      int na=(b+c)/2;
      int nb=(a+c)/2;
      int nc=(a+b)/2;
      a=na;
      b=nb;
      c=nc;
      count++;
    }
    cout<<count<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int N,W;
int w[100], v[100];
LL dp[100][100001];

LL solve(int now, int nokori){
	if(nokori < 0) return -MAX;
	if(now == N) return 0;
	if(dp[now][nokori] != -1) return dp[now][nokori];
	return dp[now][nokori] = max(solve(now+1, nokori), v[now]+solve(now+1, nokori-w[now]));
}

int main(){
	cin >> N >> W;
	for(int i=0; i<N; i++){
		cin >> w[i] >> v[i];
		for(int j=0; j<=W; j++) dp[i][j] = -1;
	}
	cout << solve(0,W) << endl;
	

	return 0;
}

Measured memory_bytes: 78464
#include <cmath>
#include <iostream>
using namespace std;
int H, W, A[25][25], ans = 1145141919;
int main() {
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int sum = 0;
      for (int k = 0; k < H; k++) {
        for (int l = 0; l < W; l++) {
          sum += min(A[k][l] * abs(i - k), A[k][l] * abs(j - l));
        }
      }
      ans = min(ans, sum);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
ll n;
vector<vector<ll> >a(17,vector<ll>(17));
vector<ll>dp(100010,-1);
ll solve(ll k){
    if(dp[k]>=0)return dp[k];
    ll ma=0;
    rep(i,n){
        REP(j,i+1,n){
            if(((1<<i)&k)&&((1<<j)&k)){
                ma+=a[i][j];
            }
        }
    }
    for(int i=k;;){
        i=(i-1)&k;
        if(i==0)break;
        ma=max(solve(i)+solve(k-i),ma);
    }
    dp[k]=ma;
    return dp[k];
}
int main(){
    cin>>n;
    rep(i,n)rep(j,n)cin>>a[i][j];
    rep(i,n)dp[1<<i]=0;
    solve((1<<n)-1);
    cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
	os << '[' << m.first << " " << m.second << ']'; 
	return os; 
}

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

	int n;
	cin >> n;
	vector<int> freq(1e5 + 7);

	ll sum = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		sum += x;
		freq[x]++;
	}

	int q;
	cin >> q;
	while(q--) {
		ll v, k;
		cin >> v >> k;
		cout << sum - (v * freq[v]) + (k * freq[v]) << endl;
		sum = sum - (v * freq[v]) + (k * freq[v]);
		freq[k] += freq[v];
		freq[v] = 0;
	}

	

	return 0;
}

Measured memory_bytes: 3708
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int A,B; cin >> A >> B;
    string S;
    cin >> S;
    bool ok = true;
    bool go;
    if(S[A] != '-') ok = false;
    else {
        for(int i = 0; i < A; i++) if(!isdigit(S[i])) ok = false;
        for(int i = A+1; i < A+B+1; i++) if(!isdigit(S[i])) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>

int main(){
  std::string str;
  std::cin>>str;
  int c=0;
  for(int i=0;i<3;i++){
    if(str[i]=='R')c++;
  }
  if(c==2&&str[1]=='S')std::cout<<1<<std::endl;
  else
  std::cout<<c<<std::endl;
  return 0;
}



Measured memory_bytes: 3616
use io::*;
use std::*;

fn solve(S: String) {
    let w = S.as_str();
    match w {
        "Sunny" => println!("Cloudy"),
        "Rainy" => println!("Sunny"),
        "Cloudy" => println!("Rainy"),
        _ => unreachable!(),
    }
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut S: String;
    S = scanner.next();
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(S)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 8572
#include <iostream>
#include <cctype>
using namespace std;
int main(){
    char c;
    int a[26]={0};
    while(cin>>c){
        a[tolower(c)-'a']++;
    }
    for(int i=0;i<26;i++){
        cout<<(char)(i+'a')<<" : "<<a[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1144
<?php
while(fscanf(STDIN, "%d %d %d %d %d %d", $a, $b, $c, $d, $e, $f)){
    $den = $a * $e - $b * $d;
    $x = ($c * $e - $b * $f)  / $den;
    $y = ($a * $f - $d * $c)  / $den;
    printf("%.3f %.3f\n", $x, $y);
}


Measured memory_bytes: 9208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp_AtCoder
{


    class Program
    {

        static int N;
        static int[] H;

        static void Main(string[] args)
        {
            N = int.Parse(Console.ReadLine());
            H = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            bool result = true;  

            H[0]--;  
            for(int i = 1; i < N; i++)
            {
                if (H[i - 1] < H[i]) H[i]--;  
                if (H[i - 1] > H[i]) result = false;

                if (!result) break;
            }


            if (result) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 28252
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int e=0, f=0;
	vector<int> hoge;
	REP(i, 8) {
		int tmp;
		cin >> tmp;
		hoge.push_back(tmp);
	}
	e = hoge[4] * hoge[0] + hoge[5] * hoge[1] + (int)(hoge[0] / 10)*hoge[6] + (int)(hoge[1] / 20)*hoge[7];
	f = hoge[4] * hoge[2] + hoge[5] * hoge[3] + (int)(hoge[2] / 10)*hoge[6] + (int)(hoge[3] / 20)*hoge[7];
	if (e > f) {
		cout << "hiroshi" << endl;
	}
	else if (e < f) {
		cout << "kenjiro" << endl;
	}
	else {
		cout << "even" << endl;
	}
}


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

#define pb push_back
#define mp make_pair
#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef long long ll;

const int MAX = 1e4 + 5;

ll n,ans;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n;
	ans = n * (n - 1) / 2;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

#define rep(i, a, n) for (int i = a; i < (int)(n); i++)
typedef long long ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

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

constexpr int ginka_inf = 50 * 50;
constexpr ll dist_inf = 100000'00000'00000LL;
constexpr int n_inf = 50;
struct edge {
    int cod;
    int unchin;
    ll jikan;
};
int n, m;
int s;
vector<vector<edge>> edges(n_inf);
vector<int> koukan_ginka_s(n_inf);
vector<ll> koukan_jikan_s(n_inf);

vector<vector<bool>> used_dijk(n_inf, vector<bool>(ginka_inf + 1, false));
vector<vector<ll>> res(n_inf, vector<ll>(ginka_inf + 1, dist_inf));

typedef tuple<ll, int, int> dijk_type;
void dijk(const dijk_type &tup) {
    priority_queue<dijk_type, vector<dijk_type>, greater<dijk_type>> mins;
    mins.push(tup);
    while (!mins.empty()) {
        ll dist; int v, ginka; tie(dist, v, ginka) = mins.top(); mins.pop();
        if (used_dijk[v][ginka]) {
            continue;
        }
        used_dijk[v][ginka] = true;
        res[v][ginka] = dist;
        {
            auto ginka_ = ginka + koukan_ginka_s[v];
            auto dist_ = dist + koukan_jikan_s[v];
            if (ginka_ <= ginka_inf && dist_ < res[v][ginka_] && !used_dijk[v][ginka_]) {
                res[v][ginka_] = dist_;
                mins.push({dist_, v, ginka_});
            }
        }
        for (auto e : edges[v]) {
            auto ginka_ = ginka - e.unchin;
            auto dist_ = dist + e.jikan;
            auto v_ = e.cod;
            if (ginka_ >= 0 && dist_ < res[v_][ginka_] && !used_dijk[v_][ginka_]) {
                res[v_][ginka_] = dist_;
                mins.push({dist_, v_, ginka_});
            }
        }
    }
}

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin >> n >> m >> s;
    s = min(s, ginka_inf);

    edges.resize(n);
    koukan_ginka_s.resize(n);
    koukan_jikan_s.resize(n);
    used_dijk.resize(n);
    res.resize(n);

    rep(i, 0, m) {
        int u, v, un; ll ji;
        cin >> u >> v >> un >> ji;
        u--; v--;
        edges[u].push_back({v, un, ji});
        edges[v].push_back({u, un, ji});
    }

    rep(i, 0, n) {
        int gi, ji;
        cin >> gi >> ji;
        koukan_ginka_s[i] = min(gi, ginka_inf);
        koukan_jikan_s[i] = ji;
    }

    dijk({0LL, 0, s});
    rep(v, 1, n) {
        ll r = dist_inf;
        rep(j, 0, ginka_inf + 1) {
            r = min(r, res[v][j]);
        }
        cout << r << '\n';
    }

    return 0;
}


Measured memory_bytes: 6184
#include <iostream>
#include <algorithm>

using namespace std;

string st;

int const nmax = 50;
int barby[1 + nmax];

int main() {

  int n, s = 1, m = 0, l = 0;
  cin >> n >> m;
  for(int i =1;i <= n;i++){
    cin >> barby[i];
    m += l - s + 1;
  }
  sort(barby+1, barby+n+1);
  for(int i = n;i > n - m ;i--){
    l += barby[i];
  }
  cout << l;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

ll MOD=998244353;

ll add(ll x, ll y)
{
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}
ll sub(ll x, ll y)
{
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}
ll mult(ll x, ll y)
{
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return mult(x, bin_pow(x, p - 1));
    return bin_pow(mult(x, x), p / 2);
}


//int dp[200010], dp2[200010];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    vector<int>dp(n+10,0),dp2(n+10,0);
    vector<int>l(k),r(k);
    for (int i = 0; i < k; i++)
    {
        cin>>l[i]>>r[i];
    }
    int cnt=0;
    dp[1]=1;

    for (int i = 1; i <=n; i++)
    {
        for (int j = 0; j < k; j++)
        {
            if(i+l[j] <=n+1) {
                dp2[i+l[j]]+=dp[i];
                dp2[i+l[j]]%=MOD; 
            }
            if(i+r[j]+1<=n+1) {
                dp2[i+r[j]+1]= dp2[i+r[j]+1] +  10*MOD - dp[i];
                dp2[i+r[j]+1]%=MOD;
               // dp2[i+r[j]+1]-=dp[i];
            }
        }
        //dp[i]%=MOD;
        dp2[i+1]+=dp2[i];
        dp2[i+1]%=MOD;
        dp[i+1]=dp2[i+1];
        dp[i+1]%=MOD;
        //dp[1]=0;
     //   show(dp);
      //  show(dp2);
    }
    //show(dp);
    //show(dp2);
    cout<<(dp[n]+MOD)%MOD<<endl;

    return 0;
}

Measured memory_bytes: 6360
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int k, s;
	cin >> k >> s;
	int cnt = 0;

	for(int x=0; x<=k; x++){
		for(int y=0; y<=k; y++){
			if(0 <= s-x-y && s-x-y <= k) cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

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

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

constexpr int MAX_N = 1e5+100+7;
constexpr int INF = 1e9+7;

int h[MAX_N];
long long dp[MAX_N];

int main() {
  int N, K; cin >> N >> K;
  for (int i = 0; i < N; ++i) cin >> h[i];

  // 初期化 (最小化問題なので MAX_H に初期化)
  for (int i = 0; i < 100100; ++i) dp[i] = INF;

  // 初期条件
  dp[0] = 0;

  // ループ
  for (int i = 0; i < N; ++i) {
    for (int j = 1; j <= K; ++j) {
      chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1408
def calc(x):
    return (x+1)/2

n, k = map(int, input().split())
p = list(map(calc,(map(int, input().split()))))

_ans = sum(p[0:k])
ans = _ans
for x in range(n-k):
    # print(x, x + k)
    _ans = _ans - p[x] + p[x + k]
    ans = max(ans, _ans)

print(ans)


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	vector<int> cnt(110000, 0);
	for (int i = 0; i < n; i += 2) {
		cnt[v[i]]++;
	}
	int i1 = max_element(cnt.begin(), cnt.end()) - cnt.begin(), i2 = 0;
	for (int i = 0; i < cnt.size(); i++) {
		if (i != i1) {
			if (cnt[i2] < cnt[i]) i2 = i;
		}
	}
	int ci1 = cnt[i1], ci2 = cnt[i2];
	for (auto& val : cnt) val = 0;
	for (int i = 1; i < n; i += 2) {
		cnt[v[i]]++;
	}
	int j1 = max_element(cnt.begin(), cnt.end()) - cnt.begin(), j2 = 0;
	for (int i = 0; i < cnt.size(); i++) {
		if (i != j1) {
			if (cnt[j2] < cnt[i]) j2 = i;
		}
	}
	int cj1 = cnt[j1], cj2 = cnt[j2];
	int ans;
	if (i1 == j1) {
		ans = n - ci1 - max(ci2, cj2);
	} else {
		ans = n - ci1 - cj1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3932
main :: IO ()
main = do
 n <- readLn :: IO Int
 as <- map read . words <$> getLine
 let cnt4 = length $ filter ((0 ==).(`mod`4)) as
     cnt2 = length $ filter (\x -> 0 == (x`mod`2) && 0 /= (x`div`4)) as
     cnt0 = length $ filter ((/=0).(`mod`2)) as
 if cnt4 >= cnt0 then putStrLn "Yes"
   else if odd (length as) && cnt4+1 == cnt0 then putStrLn "Yes" else putStrLn "No"


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

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

    int N;
    cin >> N;
    int D[N] = {};
    int sum = 0;
    for(int i=0; i<N; i++){
        int d;
        cin >> d;
        D[i] = d;
        sum += d;
    }
    int ans = 0;
    for(int i=0; i<N; i++){
        ans += D[i] * (sum - D[i]);
    }
    cout << ans/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    bool check = false;
    int ans;
    rep(i, n) {
        cin >> A[i];
    }
    int cnt = 0;
    rep(i, n) {
        int a = A[i];
        while(a % 2 == 0) {
            a /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sn = new Scanner(System.in);
    	int n = sn.nextInt();
        int k = sn.nextInt();
      	int a[] = new int[n];
      	for(int i = 0; i < n; i++) {
        	a[i] = sn.nextInt();
        }
      	for(int i = k; i < n; i++){
        	if(a[i] <= a[i - k]) {
            	System.out.println("No");
            } else {
            	System.out.println("Yes");
            }
        }
    }
}

Measured memory_bytes: 60780
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,k;
    cin >> a>>b>>k;
    int ans =0;
    int x = 0;
    int i = min(a,b);
    while (x<k)
    {
        if(a%i ==0&&b%i ==0)
        {
            x++;
            if(x ==k)
            {
                ans +=i;
                break;
            }
        }
        i--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    vector<int> a(n, 0);
    vector<int> b(n, 0);

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

    for(int i = 0; i < n - 1; ++i) {
        a[i+1] = a[i] + w[i];
    }
    reverse(w.begin(), w.end());
    for(int i = 0; i < n - 1; ++i) {
        b[i+1] = b[i] + w[i];
    }

    int min = 100000;
    for (int i = 1; i < n; ++i) {
        if (min > abs(a[i] - b[n-i])) {
            min = abs(a[i] - b[n-i]);
        }
    }

    cout << min << endl;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); (i)++)
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

struct Edge {
   int to, cost;
};
ll INF = 1e18;
int N, M;
vec<vec<Edge>> G;

void dfs(int pos, vec<ll> &dist) {
   for (Edge e : G[pos]) {
      if (dist[e.to] == INF) {
         dist[e.to] = dist[pos] + e.cost;
         dfs(e.to, dist);
      }
   }
}

int main() {
   cin >> N >> M;
   G = vec<vec<Edge>>(N);
   rep (i, 0, M) {
      int l, r, d;
      cin >> l >> r >> d;
      l--, r--;
      G[l].push_back(Edge{r, d});
      G[r].push_back(Edge{l, -d});
   }

   vec<ll> dist(N, INF);
   rep (i, 0, N) {
      if (dist[i] == INF) {
         dist[i] = 0;
         dfs(i, dist);
      }
   }

   rep (i, 0, N) {
      for (Edge e : G[i]) {
         if (dist[e.to] - dist[i] != e.cost) {
            puts("No");
            return 0;
         }
      }
   }
   puts("Yes");

   return 0;
}

Measured memory_bytes: 12416
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    string n;
    cin >> n;
    bool flag=false;
    rep(i, n.size()) {
        if(n[i]=='7') {
            flag = true;
            break;
        }
    }
    print(flag?"Yes":"No");
    return 0;
}


Measured memory_bytes: 3624
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n,k = map(int,input().split())
    if n % k == 0:
        print(0)
    else:
        print(1)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 40692
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sumA = sum(A)
for i in range(N + 1):
  if i != 0:
    if A[i] > B[i - 1]: 
      A[i] -= B[i - 1]
    else:
      A[i] = 0

  if i != N:
    if B[i] > A[i]:
      t = A[i]
      A[i] = 0
      B[i] -= t
    else:
      t = B[i]
      B[i] = 0
      A[i] -= t
print(sumA - sum(A))

Measured memory_bytes: 18624
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n,m,cnt,f,ans,a[10000],b[10000],flag[100];
queue<int> que;

int main(){
  cin >> n >> m;
  vector<vector<int>> Graph(n,vector<int>());
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    Graph[a[i]].push_back(b[i]);
    Graph[b[i]].push_back(a[i]);
  }
  for(int i=0;i<m;i++){
    que.push(0);
    flag[0]=1;
    cnt=n-1;
    while(!que.empty()){
      f=que.front();
      que.pop();
      for(auto j:Graph[f]){
        if(!flag[j]&&!(a[i]==f&&b[i]==j)&&!(a[i]==j&&b[i]==f)){
          flag[j]=1;
          que.push(j);
          cnt--;
        }
      }
    }
    if(cnt==0) ans++;
    for(int i=0;i<n;i++) flag[i]=0;
  }
  cout << m-ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main(){
    speed;
    ll a;
    long double b;
    cin >> a >> b;
    cout << (ll)floor(a * b);   
    return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; return(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

ll gcd(ll a, ll b) {
    if (a < b) {
        return gcd(b, a);
    }
    ll c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    cin >> d;
    vl c(26);
    vvl s(d, vl(26));
    vl last(26);

    REP(i, 0, 26) {
        cin >> c[i];
        last[i] = 0;
    }

    REP(i, 0, d) {
        REP(j, 0, 26) {
            cin >> s[i][j];
        }
    }

    ll ans = 0;
    REP(i, 0, d) {
        ll t;
        cin >> t;

        last[t - 1] = i + 1;
        ans += s[i][t - 1];
        REP(j, 0, 26) {
            ans -= c[j] * (i + 1 - last[j]);
        }
        MSG(ans)
    }
}


Measured memory_bytes: 3684
#ifndef ___Geometry_Library
#define ___Geometry_Library

// ------ Includes ------ //
#include <cmath>
#include <vector>
#include <complex>
#include <utility>
#include <algorithm>

// ------ Defines ------ //
typedef long double GType;
typedef std::complex<GType> Point;
typedef std::pair<Point, Point> Segment;

// ------ Constants ------ //
const GType EPS = 1.0e-10L;

// ------ Functions Level 1 ------ //
GType dot(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).real();
}
GType cross(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).imag();
}
int ccw(const Point& p1, const Point& p2, const Point& p3) {
	Point v1 = p2 - p1, v2 = p3 - p1;
	if (cross(v1, v2) > EPS) return +1;
	if (cross(v1, v2) < -EPS) return -1;
	if (dot(v1, v2) < -EPS) return +2;
	if (std::norm(v1) < std::norm(v2)) return -2;
	return 0;
}

// ------ Functions Level 3 ------ //
bool is_convex(std::vector<Point> v) {
	if (v.size() < 3) return false;
	int s = -3;
	for (int i = 0; i < v.size(); i++) {
		int r = ccw(v[i], v[(i != 0 ? i - 1 : v.size() - 1)], v[(i + 1 != v.size() ? i + 1 : 0)]);
		if (abs(r) == 1 && s == -3) s = r;
		if (s * r == -1) return false;
	}
	return true;
}

#endif

#include <iostream>
using namespace std;
int n, x, y; vector<Point> v;
int main() {
	cin >> n; v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		v[i] = Point(x, y);
	}
	cout << (int)(is_convex(v)) << endl;
	return 0;
}

Measured memory_bytes: 3152
#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;
bool OK[100000+1] = {};
bool isfilled[100000+1] = {};

bool search(int N);

int main(){
	int N;
	bool ans;
	scanf("%d",&N);

	for(int i=0;i<=N;i++){
		ans = search(i);
	}
	printf("%d",OK[N]);

	return 0;
}


bool search(int n){
	bool ans;

	if(isfilled[n]==true){
		return OK[n];
	}else{
		if(n==0){
			ans = true;
		}else if(n<0){
			ans = false;
		}else if((search(n-100)==true)||(search(n-101)==true)||(search(n-102)==true)||(search(n-103)==true)||(search(n-104)==true)||(search(n-105)==true)){
			ans = true;
		}else{
			ans = false;
		}
		if(n>=0){
			OK[n] = ans;
			isfilled[n] = true;
		}
	}

	return ans;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

ll a, b;

vector<ll> A, B;

void prime_factor(vector<ll>& res, ll n) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			res.push_back(i);
			n /= i;
		}
	}
	if (n != 1) res.push_back(n);
	res.erase(unique(res.begin(), res.end()), res.end());
}

int main(void){
	cin>>a>>b;

	prime_factor(A, a);
	prime_factor(B, b);

	ll cnt = 1;
	for (int i = 0; i < A.size(); i++) {
		for (int j = 0; j < B.size(); j++) {
			if (A[i] == B[j]) {
				cnt++;
				break;
			}
		}
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int dp[1001][1001];

int main(void){
	int q;
	cin >> q;

	vector<int> res;
	for(int i = 0; i < q; i++){
		string s, t;
		cin >> s >> t;

		fill(dp[0], dp[1000] + 1000, 0);
		for(int j = 0; j < s.size(); j++){
			for(int k = 0; k < t.size(); k++){
				if(s[j] == t[k]) dp[j+1][k+1] = dp[j][k] + 1;
				else dp[j+1][k+1] = max(dp[j+1][k], dp[j][k+1]);
			}
		}

		res.push_back(dp[s.size()][t.size()]);
	}

	for(int i = 0; i < q; i++) cout << res[i] << '\n';

	return 0;
}



Measured memory_bytes: 7084
fn main() {
    let (n, m): (usize, usize) = (read::<usize>(), read::<usize>());
    let height: Vec<usize> = (0..n).map(|_| read::<usize>()).collect();
    let mut adjl = vec![vec![]; n];
    for _ in 0..m {
        let (u, v): (usize, usize) = (read::<usize>() - 1, read::<usize>() - 1);
        adjl[u].push(v);
        adjl[v].push(u);
    }
    let mut ans = 0;
    'outer: for i in 0..n {
        for j in &adjl[i] {
            if height[*j] >= height[i] {
                continue 'outer;
            }
        }
        ans += 1;
    }
    println!("{:?}", ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 8532
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A,B,M;
  	cin >> A>>B>>M;
  	vector<long> a(A);
  	vector<long> b(B);
  	long minA = 100100100;
  	long minB = 100100100;
  	long price= 100100100;
  	for(int i=0;i<A;i++){
    	cin >> a[i];
      	if(a[i] <= minA){
          minA = a[i];
        }
    }
    for(int i=0;i<B;i++){
    	cin >> b[i];
      	if(b[i] <= minB){
          minB = b[i];
        }
    }
  	price = minA + minB;
  	for(int i=0;i<M;i++){
      	int x,y;
      	long c;
      	cin >>  x>>y>>c;
      	if (a[x-1]+b[y-1]-c <= price){
           price = a[x-1]+b[y-1]-c;
        }
    }
  	cout << price << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
int main ()
{

	int i,n,k,l,m;
	scanf("%d%d",&n,&k);
	l=k-(n-1);
	m=k+(n-1);
for(i=l;i<=m;i++)
{
	printf("%d ",i);

}
return 0;}

Measured memory_bytes: 256
//48
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

bool cmp(pair<string,int> a,pair<string,int> b){
  return a.second<b.second;
}

int main(){
  string ml;
  map<string,int> wc;
  for(string s;cin>>s;){
    if(ml.size()<s.size()){
      ml=s;
    }
    wc[s]++;
  }
  cout<<max_element(wc.begin(),wc.end(),cmp)->first<<' '<<ml<<endl;
  return 0;
}

Measured memory_bytes: 0
var
 s:ansistring;
 i,x,y,z,k:longint;
begin
 readln(s);
 for i:=1 to length(s) do
  begin
   if s[i]='W' then x:=1;
   if s[i]='N' then z:=1;
   if s[i]='E' then y:=1;
   if s[i]='S' then k:=1;
  end;
 if (x=1) and (y=1) and (z=1) and (k=1) then writeln('Yes') else
   if (x=1) and (y=1) and (z=0) and (k=0) then writeln('Yes') else
    if (x=0) and (y=0) and (z=1) and (k=1) then writeln('Yes') else
     if (x=0) and (y=0) and (z=0) and (k=0) then writeln('Yes') else
      writeln('No');
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

ll modpow(ll a, ll n, ll p) {
  ll res = 1;
  while (n) {
    if (n&1) res = res * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return res;
}

map<ll, ll> PrimeFactorization(ll n) {
  map<ll, ll> m;
  for (int i = 2; i*i <= n; i++) {
    while (n%i == 0) {
      m[i]++;
      n /= i;
    }
  }
  if (n != 1) m[n]++;
  return m;
}

vector<ll> fac;
vector<ll> ifac;
const ll MOD = 1e9+7;


void combinit(ll n) {
  fac.resize(n);
  ifac.resize(n);

  fac[0] = ifac[0] = 1;
  rep(i, n) {
    fac[i+1] = fac[i]*(i+1) % MOD;
    ifac[i+1] = ifac[i]*modpow(i+1, MOD-2, MOD) % MOD;
  }
}

ll comb(ll n, ll k) {
  if (n == 0 && k == 0) return 1;
  if (n < k || n < 0) return 0;
  return (fac[n]*ifac[k]%MOD)*ifac[n-k]%MOD;
}

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

  ll n, m;
  cin >> n >> m;

  auto ma = PrimeFactorization(m);

  combinit(2*n+10);

  ll ans = 1;

  for (auto&& i : ma) {
    ans = ans * comb(i.second+(n-1), n-1) % MOD;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3328
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
void YesNo(bool flag){ cout<<(flag? "Yes":"No");}
void YESNO(bool flag){ cout<<(flag? "YES":"NO");}

ll a,b,c,d,n,x;
vector<ll>v[3];
map<ll,ll>m;
string s[3],s2;
void input(){
    cin>>a>>b>>c;
}
void src(){
    cout<<a+b+c-max({a,b,c});
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

class unionfind {
    int n;
    vector<int> par, rank;
public:
    unionfind(int n) : n(n), par(n, -1), rank(n, 0) {}
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) { return root(x) == root(y); };
    
    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) { return -par[root(x)]; };
    
    bool connected() {
        rep(i, n - 1) if (!same(i, i + 1)) return false;
        return true;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    unionfind uf(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.merge(a, b);
    }
    int ans = 0;
    rep(i, n) chmax(ans, uf.size(i));
    cout << ans << endl;
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int  ans=1;int n;string s;
	cin>>n >> s;
	int a[26]={};
	for(int i=0;i<n;i++){
		a[(int)s[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		ans*=(a[i]+1);
		ans%=1000000007;
	}
	cout<<ans-1<<endl;
}

Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    H=[int(_) for _ in input().split()]
    cunt_p=0
    while sum(H):
        in_p=False
        for i in range(n):
            if H[i]>0:
                H[i]-=1
                if in_p==False:
                    cunt_p+=1
                    in_p=True
            elif H[i]==0 and in_p:
                in_p=False
    print(cunt_p)
                



if __name__=='__main__':
    main()

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

  int n; rd(n);
  auto s=new char[][](n);
  foreach(i; 0..n) s[i]=readln.chomp.to!(char[]);

  long[char] cnt;
  cnt['M']=cnt['A']=cnt['R']=cnt['C']=cnt['H']=0L;
  foreach(i; 0..n){
    auto c=s[i][0];
    if(c in cnt) cnt[c]++;
  }

  long tot=0;
  tot+=cnt['M']*cnt['A']*cnt['R'];
  tot+=cnt['M']*cnt['A']*cnt['C'];
  tot+=cnt['M']*cnt['A']*cnt['H'];
  tot+=cnt['M']*cnt['R']*cnt['C'];
  tot+=cnt['M']*cnt['R']*cnt['H'];
  tot+=cnt['M']*cnt['C']*cnt['H'];
  tot+=cnt['A']*cnt['R']*cnt['C'];
  tot+=cnt['A']*cnt['R']*cnt['H'];
  tot+=cnt['A']*cnt['C']*cnt['H'];
  tot+=cnt['R']*cnt['C']*cnt['H'];

  writeln(tot);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}

Measured memory_bytes: 6780
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int alice=0,bob=0;
        for(int i=0;i<n;i++){
            if(i%2==0){
                alice+=a[i];
            }
            else{
                bob+=a[i];
            }
        }
        cout << alice-bob;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))
A=sorted([(a,p) for p, a in enumerate(A)])[::-1]

dp=[[0]*(N+1) for _ in range(N+1)]
for i,(a,p) in enumerate(A):
  for j in range(i+1):
    #左詰
    dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+(p-j)*a)
    #右詰
    dp[i+1][j]=max(dp[i+1][j],dp[i][j]+((N-1-(i-j))-p)*a)
print(max(dp[-1]))

Measured memory_bytes: 100004
use strict;
use warnings;

sub main {
    chomp(my $s = <STDIN>);
    my ($N,$M) = split(/ /,$s);
    my (@A,@B);
    for(1..$N){
        chomp(my $tmp = <STDIN>);
        push @A, $tmp;
    }
    for(1..$M){
        chomp(my $tmp = <STDIN>);
        push @B, $tmp;
    }
    print solver($N,$M,\@A,\@B);
}
main() unless caller;

sub solver {
    my ($N,$M,$A,$B) = @_;
    if($N == $M) {
        if(join("", @$A) eq join("", @$B)){
            return "Yes";
        }
        else {
            return "No";
        }
    }
    my @firstmatchies;
    for my $j (0..$N-$M) {
        my $i = index($A->[$j], $B->[0]);
        if($i != -1){
            push @firstmatchies, $i;
        }
    }
    for my $fm(@firstmatchies){
        for my $j (0..$N-$M) {
            for my $k(1..$M-1) {
                if(index($A->[$j+$k], $B->[$k]) != $fm){
                    last;
                }
                else {
                    if($k==$M-1){
                        return "Yes";
                    }
                    else {
                        next;
                    }
                }
            }
        }
    }
    return "No";
}

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

int main(){
    string S;
    cin >> S;
    if(S[5] == '1') {
        cout << "TBD" << endl;
    }
    else if(S[6] == '4' || S[6] == '3') {
        cout << "Heisei" << endl;
    }
    else if(S[6] == '2' || S[6] == '1') {
        cout << "Heisei" << endl;
    }
    else {
        cout << "TBD" << endl;
    }
}


Measured memory_bytes: 256