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

using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define debug(x) cout << #x << ":" << x << endl;
#define debug2(x) for(auto a : x) cout << a << " "; cout << endl;
#define debug3(x) rep(i, sizeof(x)) cout << x[i] << " "; cout << endl;

vector<pii> around = {MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1)};

//------------------------------------------------------
const int MAX_N = 1 << 17; //100000ぐらい

class SegmentTree {
public:
    int N; //要素数
    vector<ll> dat;

    SegmentTree(int n_) {
        N = 1;
        while (N < n_) N *= 2;
        dat.assign(2 * N - 1, 0);
    }

    void update(int k, int a) { //k番目(0-indexed)にaを可算
        k += N - 1; //一番下
        dat[k] += a;
        while (k > 0) {
            k = (k - 1) / 2; //1つ上がる
            //更新
            dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
        }
    }

    //[a, b)の値（最小値/和/etc.）を求める
    //kは節点の番号、l, rはその節点が[l,r)に対応づいていることを表す
    //外からはquery(a, b, 0, 0, N)と呼ぶ

    int query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return 0;
        //[a, b)が[l,r)を完全に含む
        if (a <= l && r <= b) return dat[k];
        else {
            int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return vl + vr;
        }
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, q;
    cin >> n >> q;
    SegmentTree sg(n + 1);

    rep(i, q) {
        ll com, x, y;
        cin >> com >> x >> y;
        if (com == 0) sg.update(x, y);
        else cout << sg.query(x, y + 1, 0, 0, sg.N) << endl;
    }
    return 0;
}


Measured memory_bytes: 4844
import java.util.Arrays;
import java.util.Scanner;

// https://atcoder.jp/contests/abc161/tasks/abc161_b
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] array = new int[n];
		double sum = 0.0;
		for(int i=0;i<n;i++) {
			array[i] = sc.nextInt();
			sum = sum + array[i];
		}
		sc.close();


		double flag = 1.0/4.0/m;
		Arrays.sort(array);

		boolean ans = true;

		for(int i=0;i<m;i++) {
			if(array[n-1-i]/sum<flag) {
				ans = false;
			}else {

			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23892
import sys

S = list(map(int, input()))

if len(S) <= 1:
    print(0)
    sys.exit()

S2 = [s for s in S]
S2[0] ^= 1

res1 = 0
res2 = 1
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        S[i+1] ^= 1
        res1 += 1
    if S2[i] == S2[i+1]:
        S2[i+1] ^= 1
        res2 += 1

print(min([res1, res2]))

Measured memory_bytes: 4640
#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
using namespace std;
const int N=100007;
int n,C[60];
LL A[N],S[60];
void ins(LL x) {
	Dor(i,59,0)
	if(x&(1LL<<i)) {
		if(!S[i]) {
			S[i]=x;
			break;
		}
		x^=S[i];
	}
}
int main() {
	scanf("%d",&n);
	For(i,1,n) scanf("%lld",&A[i]);
	For(i,1,n)
		For(j,0,59)
		if((A[i]&1LL<<j)) ++C[j];
	For(i,1,n)
		For(j,0,59)
		if((A[i]&1LL<<j)&&C[j]&1) A[i]^=1LL<<j;
	For(i,1,n) ins(A[i]);
	LL ans=0;
	Dor(i,59,0) ans=max(ans,ans^S[i]);
	ans<<=1;
	For(i,0,59)
	if(C[i]&1) ans+=1LL<<i;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main() {
  int num1, num2, tmp, height[10];

  for (num1 = 0; num1 <= 9; num1++) {
    scanf("%d", &height[num1]);
  }

  for (num1 = 0; num1 <= 9; num1++) {
    for (num2 = num1 + 1; num2 <= 9; num2++) {
      if (height[num1] < height[num2]) {
        tmp = height[num1];
        height[num1] = height[num2];
        height[num2] = tmp;
      }
    }
  }

  for (num1 = 0; num1 <=2; num1++) {
    printf("%d\n", height[num1]);
  }

  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
struct edge
{
	int v,x,y;
	edge(){}
	edge(int _v,int _x,int _y):v(_v),x(_x),y(_y){}
};
struct query
{
	int d,u,v,c;
	query(){}
	query(int _d,int _u,int _v,int _c):d(_d),u(_u),v(_v),c(_c){}
};
vector<edge>e[N];
vector<query>q[N];
vector<int>g[N];
int n,m,s[N],t[N],tim,dis[N],fa[N][17],dep[N],sum[N],ans[N],df[N];
void dfs(int u)
{
	s[u]=++tim;
	for(auto i:e[u])
	{
		int v=i.v,x=i.x,y=i.y;
		if(v==fa[u][0])
			continue;
		fa[v][0]=u;
		dep[v]=dep[u]+1;
		dis[v]=dis[u]+y;
		df[v]=y;
		g[x].push_back(v);
		dfs(v);
	}
	t[u]=tim;
}
int lca(int u,int v)
{
	if(dep[u]<dep[v])
		swap(u,v);
	for(int i=16;i>=0;i--)
		if(dep[fa[u][i]]>=dep[v])
			u=fa[u][i];
	if(u==v)
		return u;
	for(int i=16;i>=0;i--)
		if(fa[u][i]!=fa[v][i])
			u=fa[u][i],v=fa[v][i];
	return fa[u][0];
}
struct seg
{
	int tr[N<<2],tag[N<<2];
	void pushdown(int k)
	{
		tr[k<<1]+=tag[k];
		tag[k<<1]+=tag[k];
		tr[k<<1|1]+=tag[k];
		tag[k<<1|1]+=tag[k];
		tag[k]=0;
	}
	void update(int k,int l,int r,int a,int b,int v)
	{
		if(l==a&&r==b)
		{
			tr[k]+=v;
			tag[k]+=v;
			return;
		}
		pushdown(k);
		int mid=l+r>>1;
		if(b<=mid) update(k<<1,l,mid,a,b,v);
		else if(a>mid) update(k<<1|1,mid+1,r,a,b,v);
		else update(k<<1,l,mid,a,mid,v),update(k<<1|1,mid+1,r,mid+1,b,v);
	}
	int query(int k,int l,int r,int x)
	{
		if(l==r)
			return tr[k];
		pushdown(k);
		int mid=l+r>>1;
		if(x<=mid) return query(k<<1,l,mid,x);
		else return query(k<<1|1,mid+1,r,x);
	}
}s1,s2;
int dist(int u,int x,int y)
{
	return dis[u]-s2.query(1,1,n,s[u])+s1.query(1,1,n,s[u])*y;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++)
	{
		int u,v,x,y;
		scanf("%d%d%d%d",&u,&v,&x,&y);
		e[u].emplace_back(v,x,y);
		e[v].emplace_back(u,x,y);
		sum[x]+=y;
	}
	for(int i=1;i<=m;i++)
	{
		int c,d,u,v;
		scanf("%d%d%d%d",&c,&d,&u,&v);
		q[c].emplace_back(d,u,v,i);
	}
	dep[1]=1;
	dfs(1);
	for(int j=1;j<17;j++)
		for(int i=1;i<=n;i++)
			fa[i][j]=fa[fa[i][j-1]][j-1];
	for(int i=1;i<=n;i++)
	{
		for(auto u:g[i])
		{
			s1.update(1,1,n,s[u],t[u],1);
			s2.update(1,1,n,s[u],t[u],df[u]);
		}
		for(auto j:q[i])
		{
			int c=j.c,u=j.u,v=j.v,l=lca(u,v),y=j.d;
			ans[c]=dist(u,i,y)+dist(v,i,y)-2*dist(l,i,y);
		}
		for(auto u:g[i])
		{
			s1.update(1,1,n,s[u],t[u],-1);
			s2.update(1,1,n,s[u],t[u],-df[u]);
		}
	}
	for(int i=1;i<=m;i++)
		printf("%d\n",ans[i]);
	return 0;
}

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

using namespace std;

int main()
{
    int m,n;
    cin >> n >> m;
    char array[n][n];
    for(int i = 0;i < n;i++){
        string str;
        cin >> str;
        for(int j = 0;j < n;j++){
            array[i][j] = str[j];
            //cout << array[i][j] << i << j << endl;
            }
    }
    char match[m][m];
    for(int i = 0;i < m;i++){
        string str;
        cin >> str;
        for(int j = 0;j < m;j++)
            match[i][j] = str[j];
    }
    for(int i = 0;i < n - m + 1;i++){
    for(int j = 0;j < n - m + 1;j++){
        bool flag = true;
        for(int k = 0;k < m;k++){
        for(int r = 0;r < m;r++){
            if(match[k][r] != array[i + k][j + r])flag = false;
            //cout << i << j << k << r;
        }
    }
    if(flag){
        cout << "Yes";
        return 0;
    }
    }
}
        cout << " No";
        return 0;
    }


Measured memory_bytes: 256
// ABC 三井住友信託銀行プログラミングコンテスト2019-B
// 2019.12.1 bal4u

#include <stdio.h>

int main()
{
	int N, X;
	
	scanf("%d", &N);
	X = (int)N/1.08;
	while (X <= N) {
		if ((int)(X*1.08) == N) {
			printf("%d\n", X);
			return 0;
		}
		++X;
	}
	puts(":(");
	return 0;
}


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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int a, b; cin >> a >> b;
  for(int i = 1; i < 1000000; i++) {
    int j = i + 1;
    int ii = i * (i + 1) / 2;
    int jj = j * (j + 1) / 2;
    if(b - a == jj - ii) {
      cout << jj - b << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * 1617.cc: Almost Identical Programs
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef pair<int,string> pis;

enum { PRG, STR, EOL };

/* global variables */

char s0[256], s1[256];

/* subroutines */

pis next_literal(char *(&cpt)) {
  if (*cpt) {
    if (*cpt == '"') { // string literal
      cpt++; // '"'
      string s;
      while (*cpt != '"') s += *(cpt++);
      cpt++; // '"'
      return pis(STR, s);
    }

    // program
    string s(*(cpt++), 1);
    return pis(PRG, s);
  }
  return pis(EOL, string());
}

/* main */

int main() {
  while (scanf("%s", s0) == 1 && strcmp(s0, ".") != 0) {
    scanf("%s", s1);

    int pdf = 0, ldf = 0;
    char *cpt0 = s0, *cpt1 = s1;
    while (! pdf && ldf <= 1 && *cpt0 && *cpt1) {
      pis l0 = next_literal(cpt0);
      pis l1 = next_literal(cpt1);

      if (l0.first != l1.first)
	pdf++;
      else if (l0.first == PRG && l0.second != l1.second)
	pdf++;
      else if (l0.first == STR && l0.second != l1.second)
	ldf++;
    }
    if (*cpt0 != *cpt1) pdf++;

    if (pdf > 0 || ldf > 1) puts("DIFFERENT");
    else if (ldf > 0) puts("CLOSE");
    else puts("IDENTICAL");
  }
  return 0;
}



Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int n;
    cin>>n;
    int a[n];
    f(i, n) cin>>a[i];
    int rg[n], lf[n];
    f(i, n) rg[i] = lf[i] = 0;
    f(i, n) {
        if(i + a[i] < n) lf[i + a[i]]++;
        if(i - a[i] >= 0) rg[i - a[i]]++;
    }
    int ans = 0;
    f(i, n) {
        ans += lf[i] * rg[i];
    }
    cout<<ans;
} 


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}


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

int main(){
  string N;
  cin>>N;
  rep(i,3){
    if(N[i] == '7'){
      cout<< "Yes";
      return 0;
    }
  }
  cout<< "No";
}


Measured memory_bytes: 3632
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)

template<typename S, typename T>
class accumulate_table_fn_t {
public:
  accumulate_table_fn_t(const std::vector<std::vector<S>>& a) :
    N_(a.size()), M_(a[0].size())
  {
    acc_.assign(N_ + 1, std::vector<T>(M_ + 1));

    for (int i = 0; i < N_; i ++)
      for (int j = 0; j < M_; j ++)
        acc_[i + 1][j + 1] = acc_[i + 1][j] + a[i][j];

    for (int j = 0; j <= M_; j ++)
      for (int i = 1; i < N_; i ++)
        acc_[i + 1][j] += acc_[i][j];
  };

public:
  T sum(int x0, int y0, int x1, int y1) const {	// [x0, x1), [y0, y1)
    assert(0 <= x0 && x0 <  M_);
    assert(0 <= y0 && y0 <  N_);
    assert(0 <= x1 && x1 <= M_);
    assert(0 <= y1 && y1 <= N_);
    assert(x0 <= x1);
    assert(y0 <= y1);

    return
        acc_[y1][x1]
      - acc_[y1][x0]
      - acc_[y0][x1]
      + acc_[y0][x0];
  };

private:
  int N_;
  int M_;

  std::vector<std::vector<T>> acc_;
};


std::vector<int> test(int H, int W, int K, accumulate_table_fn_t<int, int>& fn, const std::vector<int>& a)
{
  std::vector<int> b;

  for (int x = 1, xx = 0; x <= W; ) {
    bool valid = true;
    
    for (int i = 0, size = a.size(); i < size - 1; i ++) {
      int y0 = a[i], y1 = a[i + 1], s = fn.sum(xx, y0, x, y1);

      if (s > K) {
        valid = false;
        
        break;
      }
    }

    if (! valid) {
      if (x - 1 == xx) {
        b.clear();

        return b;
      }

      b.push_back(xx = x - 1);
    }
    else {
      x ++;
    }
  }

  b.insert(std::begin(b), 0);
  b.push_back(W);

  return b;
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int H, W, K;

  std::cin >> H >> W >> K;

  std::vector<std::vector<int>> a(H, std::vector<int>(W));

  for (int i = 0; i < H; i ++) {
    std::string s;

    std::cin >> s;
  
    for (int j = 0; j < W; j ++)
      a[i][j] = s[j] - '0';
  }

  accumulate_table_fn_t<int, int> fn(a);

  int nm = INF;

  for (int i = 0; i < 1 << 9; i ++) {
    std::vector<int> b;

    b.push_back(0);

    for (int k = 0; k < 9; k ++)
      if (i & (1 << k))
        b.push_back(k + 1);

    if (b.back() >= H)
      continue;

    b.push_back(H);

    std::vector<int> c = test(H, W, K, fn, b);

    if (c.empty())
      continue;

    int v = b.size(), h = c.size();

    int n = (v - 2) + (h - 2);

    nm = std::min(n, nm);
  }

  std::cout << nm << std::endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
# define PI 3.1415926535
#define ll long long int
char a[1010][1010];
int dp[1010][1010];
int r,c;
#define mod 1000000007

int paths(int i, int j)
{
	if(i > r || j > c)
		return 0;
	if(i == r && j == c)
		return 1;
	if(dp[i][j] >= 0)
		return dp[i][j];
	int k1 = 0, k2 = 0;
	if(a[i+1][j] == '.')
		k1 = paths(i + 1, j) % mod;
	if(a[i][j+1] =='.')
		k2 = paths(i, j+1) % mod;
	dp[i][j] = (k1 + k2)%mod;
	return dp[i][j];		  
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> r >> c;
	for(int i=0; i < 1010; ++i)
		for(int j = 0; j < 1010; ++j)
			dp[i][j] = -1;
	for(int i=1; i <= r;++i)
	{
		for(int j=1; j <= c; ++j)
			cin >> a[i][j];
	}

	int k = paths(1, 1);
	cout << k <<"\n";
	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
int n,mod=(int)(1e9+7);
int main(){
   cin>>n;
   ll wo09=1,wo9=1,ts=1,ans=0;
   for(int i=0;i<n;++i){
       ts=(ts*10)%mod;
        wo09=(wo09*8)%mod;
        wo9=(wo9*9)%mod;
   }

    ans=(ts%mod-wo09%mod-(wo9%mod-wo09%mod)%mod-(wo9%mod-wo09%mod)%mod)%mod;
    if(ans<0) ans+=mod;
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>

int main()
{
  int a;
  std::cin >> a;
  
  std::vector<int> v(a*2);
  for(int i=0; i<a*2; ++i)
  {
    std::cin >> v[i];
  }

  std::sort(v.begin(), v.end());
  
  int sum = 0;
  for(int i=0; i<a*2; i+=2)
  {
    sum += std::min(v[i], v[i+1]);
  }
  
  std::cout << sum << std::endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

const mod int = 1e9 + 7

func main() {
	var h, w, k int
	fmt.Scan(&h, &w, &k)

	dp := [101][8]int{}
	dp[0][0] = 1

	for i := 0; i < h; i++ {
		for bits := 0; bits < 1<<(w-1); bits++ {
			ls := fmt.Sprintf("%0"+strconv.Itoa(w-1)+"b", bits)
			if strings.Contains(ls, "11") {
				continue
			}

			for j := 0; j < w; j++ {
				nj := j
				if 1 <= j && ls[j-1] == '1' {
					nj = j - 1
				} else if j < len(ls) && ls[j] == '1' {
					nj = j + 1
				}

				dp[i+1][nj] += dp[i][j]
				dp[i+1][nj] %= mod
			}
		}
	}

	fmt.Println(dp[h][k-1])
}


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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	int n; cin >> n;

	vector <string> s(n);

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

	map <string, int> m;

	for(int i = 0; i < n; i++){
		m[s[i]]++;
	}

	int record = 0;
	for(auto it : m){
		record = max(record, it.second);
	}	

	vector <string> v;

	for(auto it : m){
		if(it.second == record){
			v.push_back(it.first);
		}
	}


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

	for(auto e : v){
		cout << e << endl;
	}
	
	
	
	return 0;
}

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

bool c(int x) {
	return x == 9999; 
}

int main() {
	int board[3][3];
  	for (int i = 0; i < 3; i++)
      for (int j = 0; j < 3; j++)
        cin >> board[i][j];
  	int n; cin >> n;
  	for (int i = 0; i < n; i++) {
     	int x; cin >> x;
      	for (int j = 0; j < 3; j++)
          for (int k = 0; k < 3; k++)
            if (board[j][k] == x) board[j][k] = 9999;
    }
  	bool w = 0;
  	w |= c(board[0][0]) && c(board[0][1]) && c(board[0][2]);
  	w |= c(board[1][0]) && c(board[1][1]) && c(board[1][2]);
  	w |= c(board[2][0]) && c(board[2][1]) && c(board[2][2]);
  
  	w |= c(board[0][0]) && c(board[1][0]) && c(board[2][0]);
  	w |= c(board[0][1]) && c(board[1][1]) && c(board[2][1]);
  	w |= c(board[0][2]) && c(board[1][2]) && c(board[2][2]);
  
  	w |= c(board[0][0]) && c(board[1][1]) && c(board[2][2]);
  	w |= c(board[2][0]) && c(board[1][1]) && c(board[2][0]);
  
  	cout << (w ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <ctime>

#ifndef ONLINE_JUDGE
#include "LocalDebug.h"
#else 
#define dbg(...)
#endif

void go () {
	int h1, m1, h2, m2, k;
	std::cin >> h1 >> m1 >> h2 >> m2 >> k;
	int ans = 0;
	while (h1 < h2 || (h1 == h2 && m1 < m2)) {
		ans++;
		m1++;
		if (m1 == 60) m1 = 0, h1++;
	}
	std::cout << ans - k << "\n";
}

int main () {
	int T = 1;
	time_t tic = clock();
	while (T--) go();
	time_t toc = clock();
	std::cerr << __FILE__ << " execution time : " << 1000.0 * (toc - tic) / CLOCKS_PER_SEC << "ms\n";
	return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

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

int main() {
	int N;
	cin >> N;
	vector<ll> X(N), Y(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		Y[i] = X[i];
	}

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

	for (int i = 0; i < N; i++) {
		if (X[i] <= Y[N / 2 - 1]) {
			cout << Y[N / 2] << endl;
		}
		else {
			cout << Y[N / 2 - 1] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int P, Q, R;

void solve() {
	cin >> P >> Q >> R;
	cout << P + Q + R - max({P, Q, R}) << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int x, a, b;
    std::cin >> x >> a >> b;
    
    if (a < b) {
        if (std::abs(x-a) <= std::abs(b-x)) {
            std::cout << 'A' << std::endl;
        } else {
            std::cout << 'B' << std::endl;
        }
    } else {
        if (std::abs(x-b) <= std::abs(x-a)) {
            std::cout << 'B' << std::endl;
        } else {
            std::cout << 'A' << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int hash[3][3] = {{5,5,7},{5,7,5},{7,5,5}};

int main()
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  bool yes = false;
  for(int i = 0;i < 3;++i){
    if(hash[i][0] == a && hash[i][1] == b && hash[i][2] == c)yes = true;
  }
  if(yes)printf("YES\n");else printf("NO\n");
  return 0;
}

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

using namespace std;

#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()

template <class T>
void mini(T& l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
  l = max(l, r);
}

using LL = long long;
using LD = long double;
using ULL = unsigned long long;
const int dx[] = {0, -1, 1, 0, -1, -1, 1, 1},
          dy[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const int INF = 1e9;
const LL MOD = 1e9 + 7;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  map<string, int> m;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    m[s] += 1;
  }
  cout << "AC x " << m["AC"] << '\n';
  cout << "WA x " << m["WA"] << '\n';
  cout << "TLE x " << m["TLE"] << '\n';
  cout << "RE x " << m["RE"] << '\n';
  return 0;
}

Measured memory_bytes: 3668
def xxx(n):
    ret = int(n % 4 in (1, 2))
    if n % 2 == 1:
        return ret
    for d in range(1, 40):
        if (n >> d) % 2 == 1:
            ret += 1 << d
    return ret


a, b = map(int, input().split())
if a == 0:
    a += 1
print(xxx(a - 1) ^ xxx(b))


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include <set>
 
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>
 
void print(T x)
{
	std::cout << x << " ";
}
 
template <typename T>
 
void println(T x)
{
	std::cout << x << "\n";
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    void init(int N) {
        par.resize(N);
        siz.assign(N, 1);  // resize だとなぜか初期化されなかった
        for (int i = 0; i < N; ++i) par[i] = i; // 初期では親は自分自身
    }


    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { return siz[root(x)]; }
};

signed main(void) {
	int n,m;
	cin >> n >> m;
	UnionFind d(n);
	d.init(n);
	rep(i,m){
		int a,b;
		cin >> a>>b;
		d.unite(a,b);
	}
	set<int>st;
	rep(i,n){
		st.insert(d.root(i));
	}
	int ret = st.size();
	print(ret-1);
}

Measured memory_bytes: 8484
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b=a;
    vector<int> c(n-1);
    
    for(int i=0;i<n;i++) cin>>a.at(i);
    for(int i=0;i<n;i++) cin>>b.at(i);
    for(int i=0;i<n-1;i++) cin>>c.at(i);
    
    int ans=0;
    
    for(int i=0;i<n;i++){
        ans+=b.at(a.at(i)-1);
        if(i!=0 && a.at(i-1)+1==a.at(i)) ans+=c.at(a.at(i-1)-1);
    }
    
    cout<<ans<<endl;
     
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
int main() {

  uint input_a,input_b,input_c;
  cin >> input_a >> input_b >> input_c;

  //cout << "input:" <<input_a << " " << input_b << " " << input_c << endl;

  if(input_a + input_b >= input_c){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }

}

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

bool prime(int n){
    for(int i=2; i<=sqrt(n); i++){
        if(n%i==0) return false;
    }
    return true;
}

int main(void){
    int N;
    cin>>N;
    vector<int> res;
    rep(i,11111){
        int p = i*5+4;
        if(prime(p)){
            res.push_back(p);
        }
        if(res.size() == N) break;
    }
    rep(i,N){
        cout<<res[i]<<(i==N-1 ? "\n" : " ");
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    cnt = 0
    if k==0:
        print(n**2)
        return
    for i in range(1, n+1):
        if i>k:
            cnt += i-k
            cnt += (n-i+1)//i*(i-k)
            cnt += max((n-i+1)%i-k, 0)
    print(cnt)

if __name__=='__main__':
    main()

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

#define llong long long 
#define xx first
#define yy second
#define ii pair<int, int>
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = - 1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i++ < n; )

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  while (1) {
    if (a == 1 and b == 2) {
      cout << "Borys";
      exit(0);
    }
    if (a + 1 == b) --a;
    else ++a;
    if (a == n - 1 and b == n) {
      cout << "Alice";
      exit(0);
    }
    if (a == b - 1) ++b;
    else --b;
  }

  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
inpl = lambda: list(map(int,input().split()))
N, M = inpl()
A = inpl()
class CountUp:
    def __init__(self, start=0):
        self.index = start-1

    def __call__(self):
        self.index += 1
        return self.index

ui = defaultdict(CountUp())
ui[0]
v = [1]
L = 1
s = 0
for i in range(N):
    s = (s+A[i])%M
    j = ui[s]
    if j < L:
        v[j] += 1
    else:
        v.append(1)
        L += 1

print(sum(n*(n-1)//2 for n in v))

Measured memory_bytes: 62576
#include<algorithm>
#include<iostream>
using namespace std;
#define i64 long long int
#define ran 11111
int id[ran];
int n,m;
i64 b[ran],a[ran][3],f[3];
bool cmp(int x,int y){
	return b[x] > b[y];
}
i64 Abs(i64 x){return x>=0?x:-x;}
int main(){
	cin >> n >> m;
	for(int i=0; i<n; i++)
		for(int j=0; j<3; j++){
			cin >> a[i][j];
		}
	i64 res = 0;
	for(int mask=0; mask<(1<<3); mask++){
		for(int i=0; i<n; i++){
			b[i] = 0;
			for(int j=0; j<3; j++)if(mask&(1<<j))
				b[i] += a[i][j];
			else
				b[i] -= a[i][j];
			id[i] = i;
		}
		sort(id,id+n,cmp);
		f[0]=f[1]=f[2]=0;
		for(int i=0; i<m; i++)
			for(int j=0; j<3; j++)
				f[j] += a[id[i]][j];
		res = max(res, Abs(f[0]) + Abs(f[1]) + Abs(f[2]));
	}
	cout << res << endl;
	return 0;
}


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

int main() {
  string S1, S2, T;
  cin >> S1 >> T;
  S2 = S1;

  int N = S2.size() - T.size() + 1;
  //stack<string> ans;
  vector<string> ans;

  //if ( N < 1) cout << "UNRESTORABLE" << endl;

  //else{
    rep(i, N){
      S1 = S2;
      bool judge = true;
      rep(j, T.size()){
        if(S2.at(i + j) != '?' && S2.at(i + j) != T.at(j))
        judge = false;
      }
      if(judge){
        rep(j, T.size()){
          S1.at(i + j) = T.at(j);
          //ans.push(S1);
          }
        rep(k, S1.size()){
          if(S1.at(k) == '?') S1.at(k) = 'a';
        }
          ans.push_back(S1);
      }
    }
  //}

  if(ans.size() == 0) cout <<  "UNRESTORABLE" << endl;
  else{
    /*cout <<  ans.size() << endl;
    S1 = ans.top();
    rep(i, S1.size()){
      if(S1.at(i) == '?') S1.at(i) = 'a';
    }
    cout << S1 << endl;*/
    sort(ans.begin(), ans.end());
    cout << ans.at(0) << endl;
  }
}


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

using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s)
{
    return '"' + s + '"';
}

string to_string(const char* s)
{
    return to_string((string) s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out()
{
    cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    vector<int> x(n + 1), y(n + 1);
    x[1] = a[1];
    for (int i = 2; i <= n; i++)
    {
        x[i] = __gcd(x[i - 1], a[i]);
    }
    y[n] = a[n];
    for (int i = n - 1; i >= 1; i--)
    {
        y[i] = __gcd(y[i + 1], a[i]);
    }
    int ans = max(y[2], x[n - 1]);
    for (int i = 2; i < n; i++)
    {
        ans = max(ans, __gcd(x[i - 1], y[i + 1]));
    }
    cout << ans;
    return 0;
}



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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

int main() {
    uint32_t a, b; cin >> a >> b;
    uint64_t ret = 0;

    for (uint64_t max = MAX(a, b), min = MIN(a, b), i = max; !ret; i += max)
        if (!(i % min))ret = i;

    cout << ret << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
unsigned int a, b, temp, masatoy;
int main() {
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0)return 0;
		if (a<b) {
			temp = b;
			b = a;
			a = temp;
		}
		while (b != 0) {
			a = a % b;
			temp = a;
			a = b;
			b = temp;
			masatoy++;
		}
		cout << a << " " << masatoy << endl;
		masatoy = 0;
	}
}

Measured memory_bytes: 3060
import java.util.Scanner;

/**
 * https://abc043.contest.atcoder.jp/tasks/arc059_b
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		
		char[] chars = s.toCharArray();
		int left = -1;
		int right = -1;
		for(int l=1; l<=2; l++){
			for(int i=0; i<chars.length-l; i++){
				int[] tmp = new int[26];
				for(int k=0; k<=l; k++){
					tmp[chars[i+k]-'a']++;
				}
				for(int t: tmp){
					if(t*2>l+1){
						left = i+1;
						right = i+l+1;
						break;
					}
				}
				if(left>=0) break;
			}
			if(left>=0) break;
		}
		
		System.out.println(left+" "+right);
		
	}

}


Measured memory_bytes: 40488
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a-1);i>=(b);i--)
#define all(x) (x).begin(), (x).end()
const int INF = 1e18;
const int MOD = 1e9+7;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<string> vstr;
void print() {cout<<'\n';}template<class Head,class...Tail>void print(Head&&head,Tail&&...tail){cout<<head;if(sizeof...(tail)!=0)cout<<" ";print(forward<Tail>(tail)...);}template<class T>void print(vector<T>&vec){for(auto&a:vec){cout<<a;if(&a!=&vec.back())cout<<" ";}cout<<'\n';}template<class T>void print(vector<vector<T>>&df){for(auto&vec:df){print(vec);}}
template<class T=int>T in() {T x;cin>>x;return(x);}
template<class T=int>vector<T> input_to_vector(int n) {vector<T>x;rep(i,n){T a;cin>>a;x.push_back(a);}return(x);}

signed main(){
    int a, b;
    cin >> a >> b;
    print((a-1) * (b-1));
}

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

int main(){
    int A1, A2, A3; cin >> A1 >> A2 >> A3;
    int ans = A1 + A2 + A3;
    if(ans >= 22) cout << "bust" << endl;
    else cout << "win" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int A, B, C; cin >> A >> B >> C;
  auto sum = A+B+C;
  auto ans = sum - std::max({A, B, C});
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll waru(ll i,ll j){
    if((i%j+j)%j==0){
        return i/j;
    }else if(i>0){
        return i/j;
    }
    return i/j-1;
}

int main(){
    ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;
    if(c==d && c==0){
        if(a==b){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }else{
        ll i;
        i=waru((b-a+(n-1)*d),(c+d));
        ll s=c*i+(n-1-i)*(-d);
        if(0<=i && i<=n-1 && b-a<=s+(d-c)*(n-1)){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    string s;cin>>s;
    if(s[0]==s[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;

const int N = 1e6 + 5;

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

int A[N];
vector<int> ans;

int main() {

	boost;
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		cin>>A[i];
	}
	for(int j=1; j<=n; j++) {
		int k = -1;
		for(int i=n-j+1; i>=1; i--) {
			if(i == A[i]) {
				k = i;
				break;
			}
		}
		if(k == -1) {
			cout<<"-1\n";
			exit(0);
		}
		ans.pb(k);
		while(k < n-j+1) {
			A[k] = A[k+1];
			k++;
		}
	}
	reverse(ans.begin(), ans.end());
	for(auto it : ans) {
		cout<<it<<"\n";
	}
	return 0;
}

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

int main () {
  int n = 0;
  cin >> n;
  vector<string> v (n);
  rep (i, n) {
    cin >> v[i];
    sort(v[i].begin(), v[i].end());
  }
  sort(v.begin(), v.end());
  string tmpstr = v[0];
  long ans = 0, tmpint = 0;
  for (int i = 1; i < n; i++) {
    if (tmpstr == v[i]) {
      tmpint++;
    } else {
      if(tmpint > 0) {
        ans += tmpint * (tmpint + 1) / 2;
      }
      tmpint = 0;
      tmpstr = v[i];
    }
  }
  if(tmpint > 0) {
    ans += tmpint * (tmpint + 1) / 2;
  }
  cout << ans << endl;
}

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

int main(void)
{
    char weather[256];
    
    scanf("%s",weather);
    
    if(strcmp(weather , "Sunny")==0)  printf("Cloudy\n");
    else if(strcmp(weather , "Cloudy")==0)  printf("Rainy\n");
    else if(strcmp(weather , "Rainy")==0)   printf("Sunny\n");
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <deque>
#include <utility>
using namespace std;
typedef pair<long long,long long> ll;
struct convex_hull{
    deque<ll> dq; //m,c
    double POI(ll i, ll j){
        return (double)(j.second-i.second)/(double)(i.first-j.first);
    }
    void add(long long m,long long c){
        if (dq.empty()){
            dq.push_back(ll(m,c));
            return;
        }
        ll last=dq.back();
        dq.pop_back();
        while (!dq.empty() && POI(ll(m,c),last)<=POI(last,dq.back())){
            last=dq.back(),dq.pop_back();
        }
        dq.push_back(last);
        dq.push_back(ll(m,c));
    }
    long long query(long long i){
        ll _first=dq.front();
        dq.pop_front();
        while (!dq.empty() && POI(_first,dq.front())<=i){
            _first=dq.front(),dq.pop_front();
        }
        dq.push_front(_first);
        return _first.first*i+_first.second;
    }
}*hull=new convex_hull();
int n;
long long arr[200005];
int main(){
    long long c,w;
    scanf("%d%lld",&n,&c);
    for (int x=0;x<n;x++) scanf("%lld",&arr[x]);
    hull->add(-2*arr[0],arr[0]*arr[0]);
    n--;
    for (int x=1;x<n;x++){
        w=hull->query(arr[x])+c+arr[x]*arr[x];
        hull->add(-2*arr[x],w+arr[x]*arr[x]);
    }
    printf("%lld\n",hull->query(arr[n])+c+arr[n]*arr[n]);
}


Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x=sc.nextInt();
		for(;x>1;x--) {
			for(int i=2;i < x; i++) {

				int n = i*i;
				if(n > x) break;

				while(n <= x) {
					if(n==x) {
						System.out.println(x);
						return;
					}
					n *= i;
				}

			}
		}
		System.out.println(x);
	}
}


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

int main(){
    string s;
    cin >> s;
    int n = 0;
    for(int i = 0;i < 3; ++i){
        if(s[i] == 'o'){
            n++;
        }
    }
    cout << 700 + n * 100 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  if(N%10 == 3)
  {
    cout<<"bon"<<endl;
  }else if(N%10 == 0)
  {
    cout<<"pon"<<endl;
  }else if(N%10 == 1)
  {
    cout<<"pon"<<endl;
  }else if(N%10 == 6)
  {
    cout<<"pon"<<endl;
  }else if(N%10 == 8)
  {
    cout<<"pon"<<endl;
  }else
  {
    cout<<"hon"<<endl;
  }
}

Measured memory_bytes: 3596
def main():
    n, m = map(int, input().split())
    a_lst = list(map(int, input().split()))
    total = sum(a_lst)
    cnt = 0

    for a in a_lst:
        if a >= total / (4 * m):
            cnt += 1

    if cnt >= m:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61912