akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main(){
    ll R,C,N; cin>>R>>C>>N;
    vector<P> bou;
    rep(i,N){
        ll x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
        ll x=-1,y=-1;
        if(x1==0) x=y1;
        else if(y1==C) x=C+x1;
        else if(x1==R) x=C+R+C-y1;
        else if(y1==0) x=C+R+C+R-x1;
        else continue;

        if(x2==0) y=y2;
        else if(y2==C) y=C+x2;
        else if(x2==R) y=C+R+C-y2;
        else if(y2==0) y=C+R+C+R-x2;
        else continue;

        bou.emplace_back(x,i);
        bou.emplace_back(y,i);
    }

    SORT(bou);
    deque<ll> dq;
    for(auto& x: bou){
        if(!dq.empty() and dq.back()==x.second){
            dq.pop_back();
        }
        else{
            dq.emplace_back(x.second);
        }
    }
    cout<< ( dq.empty() ? "YES" : "NO" )<<"\n";
    
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 6512
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Cut and Count
 */

#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 */

const int MAX_N = 100;

/* typedef */

/* global variables */

char s[MAX_N + 4];
int xs[26], ys[26];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) ys[s[i] - 'a']++;

  int maxd = 0;
  for (int i = 0; i < n; i++) {
    int c = s[i] - 'a';
    xs[c]++, ys[c]--;

    int d = 0;
    for (int i = 0; i < 26; i++)
      if (xs[i] > 0 && ys[i] > 0) d++;
    if (maxd < d) maxd = d;
  }

  printf("%d\n", maxd);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


ll moP(ll x, ll n) {
  ll res=1;
  while(n>0) {
    if(n&1) moC(res, *, x);
    moC(x, *, x);
    n>>=1;
  }
  return res;
}

ll fa[2020], rfa[2020];

ll C(ll n, ll k) {
  if(n<k) return 0;
  if(k<0) return 0;
  if(k==0) return 1;
  if(n==k) return 1;
  return fa[n]*rfa[n-k]%MOD*rfa[k]%MOD;
}

int main(void) {
  ll N, K;
  cin >> N >> K;
  ll i;
  
  fa[0]=1;
  rfa[0]=1;
  for(i=1; i<=2000; i++) {
    fa[i]=i*fa[i-1]%MOD;
    rfa[i]=moP(fa[i], MOD-2);
  }
  
  for(i=1; i<=K; i++) {
    pt(C(N-K+1, i)*C(K-1, i-1)%MOD);
  }
  
}














Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    string a,b;
    cin >> a >> b;
    int x =stoi(a+b);
    if (sqrt(x)==(int)(sqrt(x))){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int cnt = 0;
    while (1) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) {
                a[i] /= 2;
            } else {
                cout << cnt << '\n';
                return 0;
            }
        }
        ++cnt;
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 256
a, b, m = gets.chomp.split.map(&:to_i)
ai = gets.split.map(&:to_i)
bi = gets.split.map(&:to_i)
w = []
ans = (ai.min.to_i + bi.min.to_i)
m.times do |i|
  w.push(gets.split.map(&:to_i))
  t = (ai[w[i][0] - 1] + bi[w[i][1] - 1] - w[i][2])
  ans = t if ans > t
end
p ans


Measured memory_bytes: 18972
#include <stdio.h>

int main(void){
    int h, w;
    int i, j;

    while(1){
        scanf("%d %d", &h, &w);
        if(h + w == 0)
            break;
        for(i = 1; i <= h; i++){
            for(j = 1; j <= w; j++){
                if(i == 1 || i == h || j == 1 || j == w)
                    putchar('#');
                else
                    putchar('.');
            }
            puts("");
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 588
#include<iostream>
using namespace std;
int main()
{
  int y,m,d;
  long long int t;
  for(;cin>>y>>m>>d;)
    {
      string n="meiji";
      t=y*365+m*12+d;
      y-=1867;
      if(t>697993)
	n="taisho",y-=44;
      if(t>703158)
	n="showa",y-=14;
      if(t>726004)
	n="heisei",y-=63; 
      if(t<681936)
	cout<<"pre-meiji"<<endl;
      else
	cout<<n<<" "<<y<<" "<<m<<" "<<d<<endl;
    }
}

Measured memory_bytes: 1208
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL<<60;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

struct edge{
  int from;
  int to;
  int cost;
};

int main(){
  int N,M;
  cin >> N >> M;
  vector<edge> G(M);
  for(int i=0; i<M; i++){
    cin >> G[i].from >> G[i].to >> G[i].cost;
    G[i].from--;
    G[i].to--;
    G[i].cost *= -1;
  }
  vector<ll> dist(N,INF);
  dist[0] = 0;
  for(int i=0; i<N-1; i++){
    for(int j=0; j<M; j++){
      chmin(dist[G[j].to],dist[G[j].from] + G[j].cost);
    }
  }
  vector<bool> inf_loop(N,false);
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      if(chmin(dist[G[j].to],dist[G[j].from]+G[j].cost)){
        inf_loop[G[j].to] = true;
      }
      if(inf_loop[G[j].from]) inf_loop[G[j].to] = true;
    }
  }
  if(inf_loop[N-1]){
    cout << "inf" << endl;
  }else{
    cout << -dist[N-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1<<28
#define MAX_V 600
struct edge {
  int to,cap,rev;
  edge(){}
  edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
};
 
vector<edge> G[MAX_V],G2[MAX_V];
map<int,int> M[MAX_V];
int level[MAX_V];
int iter[MAX_V];
 
void add_edge(int from,int to,int cap){
  M[from][to]=G2[from].size();
  M[to][from]=G2[to].size();
  G2[from].push_back(edge(to,cap,G2[to].size()));
  G2[to].push_back(edge(from,cap,G2[from].size()-1));
}
 
void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s]=0;
  que.push(s);
  while(!que.empty()){
    int v=que.front();que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap>0&&level[e.to]<0){
	level[e.to]=level[v]+1;
	que.push(e.to);
      }
    }
  }
}
 
int dfs(int v,int t,int f){
  if(v==t) return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}
 
int max_flow(int s,int t){
  int flow=0;
  for(;;){
    bfs(s);
    if(level[t]<0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}
 
int main(){
  int N,E,Q;
  cin>>N>>E>>Q;
  for(int i=0,f,t;i<E;i++) scanf("%d%d",&f,&t),add_edge(f,t,1);
  int prev=0;
  for(int i=1;i<=N;i++) G[i]=G2[i];
  while(Q--){
    int m,a,b;
    scanf("%d%d%d",&m,&a,&b);
    if(m==1){
      
      if(M[a].find(b)==M[a].end()) {
	add_edge(a,b,1);
	G[a].push_back(edge(b,1,G[b].size()));
	G[b].push_back(edge(a,1,G[a].size()-1));
      }else{
	G[a][M[a][b]].cap=G[b][M[b][a]].cap=1;
	G2[a][M[a][b]].cap=G2[b][M[b][a]].cap=1;
      }
    }else{
      G2[a][M[a][b]].cap=G2[b][M[b][a]].cap=0;
      for(int i=1;i<=N;i++) G[i]=G2[i];
      prev=0;
    }
    prev=prev+max_flow(1,N);
    printf("%d\n",prev);
  }
  return 0;
}

Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a;
bool p=false,q=false;
int pp,qq,l=0;
int main()
{
	while(a=getchar())
	{
		if(!isalpha(a))
		{
			break;
		}
		l++;
		if(a=='C')
		{
			p=true;
			pp=l;
		}
		if(a=='F')
		{
			q=true;
			qq=l;
		}
		if(p&&q&&qq>pp)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef map<pair<pair<ll,ll>,pair<ll,ll> >,ll> mll;
typedef set<ll> sll;

const ll INF = 1e9+7;

#define se second
#define fi first
#define pb push_back

ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
ll a[500][500],d[500][500];
ll n,m;
string s[22];

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

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

	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<m;j++)
		{
			if(s[i][j]=='.')
			{
				for(ll k=0;k<4;k++)
					if(i+dx[k]<n && i+dx[k]>=0 && j+dy[k]<m && j+dy[k]>=0)
					{
						if(s[i+dx[k]][j+dy[k]]=='.')
						{
							d[i*m + j][(i+dx[k])*m + j+dy[k]]=1;
							d[(i+dx[k])*m + j+dy[k]][i*m + j]=1;
						}
					}
			}
		}
	}

	for(ll i=0;i<n*m;i++)
	{
		for(ll j=0;j<n*m;j++)
			if(!d[i][j])
				d[i][j]=INF;
	}
	ll ans=0;
	for(ll k=0;k<n*m;k++)
	{
		for(ll i=0;i<n*m;i++)
		{
			for(ll j=0;j<n*m;j++)
				if(i==j)
					d[i][j]=0;
				else
					d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		}
	}
	for(ll i=0;i<n*m;i++)
	{
		for(ll j=0;j<n*m;j++)
		{
			if(d[i][j]<INF)
				ans=max(ans,d[i][j]);
		}
	}
	cout<<ans;
}


Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = [ii() for _ in range(5)]

sa = 0
ans = 0
for num in N:
    if not num % 10:
        ans += num
    else:
        add = (num // 10 + 1) * 10
        ans += add
        sa = max(sa, add - num)

print(ans - sa)




Measured memory_bytes: 9092
def diff(a, b, i = 0)
    return 2 if a.size != b.size
    return 0 if i >= a.size
    if a[i][0] == ?"
        if a[i] == b[i]
            return diff(a, b, i+1)
        elsif b[i][0] != ?"
            return 2
        else
            return 1 + diff(a, b, i+1)
        end
    else
        return a[i] == b[i] ? diff(a, b, i+1) : 2
    end
end
f = -> { gets.chomp.scan(/[^"]+|"[^"]*"/) }
loop do
    a = f[]
    break if a == ["."]
    b = f[]
    case diff(a, b)
    when 0
        puts 'IDENTICAL'
    when 1
        puts 'CLOSE'
    else
        puts 'DIFFERENT'
    end
end



Measured memory_bytes: 6968
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
bool us[1000010]={false};
bool p[1000010] = {0};
int main(){
    /*Eratosthenes*/
    p[2] = true;
    for(int i = 0; i <= 1000010; i+=2){
        us[i] = true;
    }
     
    int cnt = 1;
    for(int i = 3; i <= 1000010; i+=2){
        int q = 0;
        if(us[i] == true)continue;
        else if(us[i] == false){
            p[i] = true;
            us[i] = true;
            q = i;
            for(int j = q+q; j <= 1000010; j += q){
                us[j] = true;
            }
        }
    }
     
    int n;
    while(scanf("%d",&n),n){
        int x = 0;
        for(int i = 2; i <= n/2; i++){
            if(p[i] && p[n-i]){
                x++;
            }
        }
        printf("%d\n",x);
    }
    return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    if (K <= 500){
        for (int i = 1; i <= K; i++){
            vector<int> vec_copy(N + 1,0);
            rep(j,N){
                if (j - vec[j] < 0){
                    vec_copy[0]++;
                }
                else{
                    vec_copy[j - vec[j]]++;
                }
                if (j + 1 + vec[j] >= N){
                    vec_copy[N]--;
                }
                else{
                    vec_copy[j + 1 + vec[j]]--;
                }
            }
            rep(j,N){
                vec_copy[j + 1] += vec_copy[j];
            }
            rep(j,N){
                vec[j] = vec_copy[j];
            }
        }
    }
    else{
        for (int i = 1; i <= 500; i++){
            vector<int> vec_copy(N + 1,0);
            rep(j,N){
                if (j - vec[j] < 0){
                    vec_copy[0]++;
                }
                else{
                    vec_copy[j - vec[j]]++;
                }
                if (j + 1 + vec[j] >= N){
                    vec_copy[N]--;
                }
                else{
                    vec_copy[j + 1 + vec[j]]--;
                }
            }
            rep(j,N){
                vec_copy[j + 1] += vec_copy[j];
            }
            rep(j,N){
                vec[j] = vec_copy[j];
            }
        }
    }
    rep(i,N - 1){
        cout << vec[i] << " ";
    }
    cout << vec[N - 1] << endl;
}



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

struct UnionFind {
    vector<int> par;  // par[i]: parent of i

    UnionFind(int N) : par(N) {  // initialize by making every node a root node
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {  // find the root of a given node
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {  // return true if x and y belong to the same tree
        return root(x) == root(y);
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }
    UnionFind uf(n);
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        uf.unite(x, y);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (uf.same(p[i], i)) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        k: usize,
    }
    let mut ans = 0;
    for i in 1..=k {
        for j in 1..=k {
            for k in 1..=k {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    println!("{}", ans);
}

fn gcd(a: usize, b: usize) -> usize {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


Measured memory_bytes: 2112
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayDeque;

public class Main{

    public static void main(String[] args) throws IOException
{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        ArrayDeque<Integer> list = new ArrayDeque<Integer>();
        for(int i = 0; i < n; i++){
            String[] in = br.readLine().split(" ");
            if(in[0].equals("insert")){
                int key = Integer.parseInt(in[1]);
                list.addFirst(key);
            }else if(in[0].equals("deleteFirst")){
                list.removeFirst();
            }else if(in[0].equals("deleteLast")){
                    list.removeLast();
            }else if(in[0].equals("delete")){
                int key = Integer.parseInt(in[1]);
                list.remove((Integer)key);
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append(list.poll());
        for(int num: list){
            sb.append(" ").append(num);
        }
        System.out.println(sb);
    }
}

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

class Program
{
    static void Main(string[] args)
    {
        var A = sc.ReadStr();
        var B = sc.ReadStr();
        var C = sc.ReadStr();
        Console.WriteLine("A" + B.First() + "C");
    }

    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11220
h,w,n = map(int, input().split())
stage = [input() for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i+1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]

starts[0] = "S"
for y in range(h):
	for x in range(w):
		if stage[y][x] in starts:
			starts_y[starts.index(stage[y][x])] = y
			starts_x[starts.index(stage[y][x])] = x
		if stage[y][x] in goals:
			goals_y[goals.index(stage[y][x])] = y
			goals_x[goals.index(stage[y][x])] = x


sum = 0

for start_y, start_x, goal_y, goal_x in zip(starts_y, starts_x, goals_y, goals_x):
	bfs_map = [[-1 for j in range(w)] for i in range(h)]
	data_y = [start_y]
	data_x = [start_x]
	bfs_map[start_y][start_x] = 0
	goal = False
	
	while len(data_y) != 0 and not goal:
		y = data_y.pop(0)
		x = data_x.pop(0)
		goal = False
	
		for i in range(4):
			ny = y + [1,-1,0,0][i]
			nx = x + [0,0,1,-1][i]
			
			if ny >= 0 and ny < h and nx >= 0 and nx < w:
				if bfs_map[ny][nx] == -1 and stage[ny][nx] != "X":
					bfs_map[ny][nx] = bfs_map[y][x]+1
					data_y.append(ny)
					data_x.append(nx)
			if bfs_map[goal_y][goal_x] != -1:
				sum += bfs_map[goal_y][goal_x]
				goal = True
				break

print(sum)


Measured memory_bytes: 36500
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for B - Iron Bar Cutting
	var N int
	fmt.Scan(&N)

	sc.Split(bufio.ScanWords)
	A := make([]int, N)
	var temp int
	sum := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
		temp += A[i]
		sum[i] = temp
	}

	var flag int
	var min int = 10000000000
	for i := 0; i < N; i++ {
		flag = int(math.Abs(float64(sum[i] - (sum[N-1] - sum[i]))))
		if min > flag {
			min = flag
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 7596
def count2(lst):
    ans = [["",0],0]
    def check():
        nonlocal ans
        if a > ans[0][1]:
            ans[1] = ans[0][1]
            ans[0][0] = last
            ans[0][1] = a
        elif a > ans[1]:
            ans[1] = a
    lst.sort()
    last =lst[0]
    a = 0
    for e in lst:
        if last == e:
            a +=1
        else:
            check()
            last = e
            a = 1
    check()
    return ans

def main(n:int,lst:list)->int:
    ans1 =count2(lst[::2])
    ans2 =count2(lst[1::2])
    if ans1[0][0] == ans2[0][0]:
        return n - max(ans1[0][1] + ans2[1],ans2[0][1] + ans1[1])
    else:
        return n - ans1[0][1] - ans2[0][1]
n = int(input())
lst = input().split()
print(main(n,lst))

Measured memory_bytes: 10844
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    string s;
    cin>>s;
    int a=0,b=0;
    rep(i,0,s.length()-1){
        if(s[i]=='0') a++;
        else b++;
    }
    cout<<min(a,b)*2<<endl;
    return 0;
}

Measured memory_bytes: 512
n,w = map(int,input().split())
dpv = [10 ** 20 for i in range(10**5+1)]
dpv[0] = 0
for i in range(n):
  weight,value = map(int,input().split())
  for j in range(10**5-value,-1,-1):
    dpv[j+value] = min(dpv[j+value],dpv[j]+weight)
for i in range(10**5,-1,-1):
  if dpv[i] <= w:
    print(i)
    exit()

Measured memory_bytes: 75824
// D - Insertion
#include <bits/stdc++.h>
using namespace std;

int main(){
	int _N; cin>>_N;
	string S; cin>>S;

	string L = "(", R = ")";

	int depth = 0;
	string ans;
	for(char s:S){
		if(s == '('){
			depth++;
			ans += L;
		}
		else{
			depth--;
			ans += R;
			if(depth < 0){
				ans = L + ans;
				depth++;
			}
		}
	}

	while(depth--) ans += R;
	cout<< ans <<endl;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int M=0;
    int m=0;
    int Mitr=1,mitr=1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>=0){
            if(M<=a[i]){
                M=a[i];
                Mitr=i+1;
            }
        }else{
            if(m>=a[i]){
                m=a[i];
                mitr=i+1;
            }
        }
    }
    int ans=0;
    vector<int> x(0),y(0);
    if(M>abs(m)){
        for(int i=1;i<=n;i++){
            x.push_back(Mitr);
            y.push_back(i);
            ans++;
        }
        for(int i=1;i<=n-1;i++){
            x.push_back(i);
            y.push_back(i+1);
            ans++;
        }
    }else{
        for(int i=1;i<=n;i++){
            x.push_back(mitr);
            y.push_back(i);
            ans++;
        }
        for(int i=n;i>=2;i--){
            x.push_back(i);
            y.push_back(i-1);
            ans++;
        }
    }
    cout<<ans<<endl;
    for(int i=0;i<ans;i++){
        cout<<x[i]<<" "<<y[i]<<endl;
    }
}

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

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,x;
    cin >> n >> x;

    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    int ans = abs(x-a[0]);
    for(int i = 1; i < n; i++) ans = __gcd(ans,abs(x-a[i]));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

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

    int ans = 0;
    rep(i, n) {
        if (x[i] > k-x[i]) ans += 2*(k-x[i]);
        else ans += 2*x[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,x) for(int i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}

int main(){
    string A, B, C;
    cin >> A >> B >> C;
    ll a = A.size();
    ll b = B.size();
    ll c = C.size();
    if (A[a - 1] == B[0] && B[b - 1] == C[0])cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int main(void) {
    ios::sync_with_stdio(false);
    char a, b, c;
    cin >> a >> b >> c;
	if (a == c) cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (int i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<int, int>  ii;
typedef pair<double, double>  iidb;
#define iii pair<ii, nodo*>
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 300000
#define offset 3000
#define ptr nodo*


using namespace std;
string txt;
set<int> vpos[300];
int n;
int dp[tam];
int print[tam];
int f(int pos)
{
	assert(pos<tam);
	if (dp[pos]!=-1)
		return dp[pos];
	int res=n;
	forr(chr,'a','z'+1)
	{
		auto ite=vpos[chr].lower_bound(pos);
		if (ite==vpos[chr].end()){
			res=1;
		}
		else
		{	
			res=min(f(*ite+1)+1,res);
		}
	}
	

	return dp[pos]=res;
}
void goprint(int pos)
{
	forr(chr,'a','z'+1)
	{
		auto ite=vpos[chr].lower_bound(pos);
		if (ite==vpos[chr].end()){
			cout<<char(chr)
			<<endl;
			return;
		}
		else
		{	
			if (dp[*ite+1]+1==dp[pos])
			{
				cout<<char(chr);
				goprint(*ite+1);
				break;
			}
		}
	}
	
}
int main()
{	
	cin>>txt;
	n=txt.size();
	forr(i,0,txt.size())
	{
		vpos[txt[i]].insert(i);
	}
	memset(dp,-1,sizeof dp);
	f(0);
	//cout<<"fin\n";
	//return 0;
	goprint(0);
}

Measured memory_bytes: 14664
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))
const output = (x: any) => console.log(x)
// debug(input)
const [A, B, N] = input

const x = N < B ? N : B - 1
// debug(x)

const sum = Math.floor(A / B * x) - A * Math.floor(x / B)
output(sum)

Measured memory_bytes: 29552
#!/usr/bin/env python3


class UnionFind():
    def __init__(self, size):
        self.table = [-1] * size

    def find(self, x):
        while 0 <= self.table[x]:
            x = self.table[x]
        return x

    def unite(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            dx = -self.table[rx]
            dy = -self.table[ry]
            if dx != dy:
                if dx < dy:
                    self.table[rx] = ry
                else:
                    self.table[ry] = rx
            else:
                self.table[rx] -= 1
                self.table[ry] = rx
        return


def solve(n, m, a, b):

    uf = UnionFind(n)
    sizes = [1] * n

    r = n * (n - 1) // 2
    ans = [r]

    for i in range(m - 1, 0, -1):
        ca = uf.find(a[i])
        cb = uf.find(b[i])
        if ca != cb:
            r -= sizes[ca] * sizes[cb]
            ans.append(r)
            s = sizes[ca] + sizes[cb]
            sizes[ca] = sizes[cb] = s
            uf.unite(ca, cb)
        else:
            ans.append(r)


    ans.reverse()
    for r in ans:
        print(r)


def main():
    n, m = input().split()
    n = int(n)
    m = int(m)
    a = []
    b = []
    for _ in range(m):
        ai, bi = input().split()
        ai = int(ai) - 1
        bi = int(bi) - 1
        a.append(ai)
        b.append(bi)

    solve(n, m, a, b)


if __name__ == '__main__':
    main()



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

#define N 100000
#define C 30

int n, c;
int imos[C][N];

int main()
{
	int ans = 0;
	int s, t, cc;

	cin >> n >> c;
	for( int i = 0; i < n; i++ ) {
		cin >> s >> t >> cc;
		s--;
		t--;
		cc--;
		imos[cc][s]++;
		imos[cc][t]--;
	}

	for( int j = 0; j < c; j++ ) {
		for( int i = 1; i < N; i++ ) {
			imos[j][i] += imos[j][i-1];
		}
	}
	for( int j = 0; j < c; j++ ) {
		for( int i = 1; i < N; i++ ) {
			if( imos[j][i-1] == 0 && imos[j][i] == 1 ) {
				imos[j][i-1] = 1;
			}
		}
	}
	for( int i = 0; i < N; i++ ) {
		int cnt = 0;
		for( int j = 0; j < c; j++ ) {
			if( imos[j][i] ) {
				cnt++;
			}
		}
		ans = max( ans, cnt );
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n, m;
  cin >> n >> m;
  ans = (ll)pow(2, m) * (100 * (n - m) + 1900 * m);
  cout << ans << endl;
  return 0;
}



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

int n, m;
char c[10][10];
bool bio[10][10];

void dfs(int x, int y){
    bio[x][y] = true;

    if(x < n && c[x + 1][y] == '#'){
        dfs(x + 1, y);
        return;
    }

    if(y < m && c[x][y + 1] == '#'){
        dfs(x, y + 1);
        return;
    }
}

int main(){
    cin >> n >> m;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> c[i][j];
        }
    }

    dfs(1, 1);

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(c[i][j] == '#' && !bio[i][j]){
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }

    cout << "Possible" << endl;

    return 0;
}


Measured memory_bytes: 256
A, B, C, K = input().split()
IA = int(A)
IB = int(B)
IC = int(C)
IK = int(K)
ALL = IA + IB + IC
cn = 0

if IA <= IK:
    cn = cn + IA
    D = IK - IA
    if IB <= D:
        E = D - IB
        cn = cn - E
        print(cn)
    else:
        print(cn)
else:
    print(IK)


Measured memory_bytes: 61968
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pa pair<int,int>
#define pii pair<ll,ll>
#define st first
#define nd second
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x...) cerr<<#x<<" = "<<x<<"\n";
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int main()
{
    BOOST;
    string s;
    cin>>s;
    if ((s.length()%2)==1)
    {
        cout<<"No";
        return 0;
    }
    for (int i=0;i<s.length();i++)
    {
        if (i%2==0 && s[i]=='h')continue;
        else if (i%2==1 && s[i]=='i')continue;
        else
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}


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

int count = 0;
void printlist(int lst[], size_t len){
	for(int i = 0; i < len - 1; i ++){
		cout << lst[i] << " ";
	}
	cout << lst[len - 1] << endl;
}

int seleSort(int lst[], size_t len){
	for(size_t i = 0; i < len - 1; i ++){
		int forgetmin(lst[i]);
		int forgeti(i);

		for(size_t j = i + 1; j < len; j ++){
			if (forgetmin > lst[j]){
				forgetmin = lst[j];
				forgeti = j;
			}
		}

		if(i != forgeti){
			swap(lst[i], lst[forgeti]);
			count ++;
		}
		else{
			continue;
		}
	}
	return count;
}

int main(int argc, char const *argv[])
{
	int N;
	cin >> N;
	int st[N];
	for (auto& i : st){
		cin >> i;
	}
	int count = seleSort(st, sizeof(st) / sizeof(int));
	printlist(st, sizeof(st) / sizeof(int));
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, answer;
  string op;
  cin >> a >> op >> b;
  while (op != "?") {
    if (op == "+") {
      answer = a + b;
    } else if (op == "-") {
      answer = a - b;
    } else if (op == "*") {
      answer = a * b;
    } else if (op == "/") {
      answer = a / b;
    }
    cout << answer << endl;
    cin >> a >> op >> b;
  }
  return 0;
}



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

int main(){
    string s;
    cin >> s;
    ll cnt = 0;
    string ans;
    size_t sn = s.size();
    rep(i,sn){
        cnt += int(s[i])-48;
    }
    if(cnt%9==0) ans = "Yes";
    else ans = "No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>
int main(void){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a>=b)&&(a>=c)) printf("%d",b+c);
	else if((b>=a)&&(b>=c)) printf("%d",a+c);
	else printf("%d",a+b);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const long long MOD=1e09+7;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>






int main(){
  

  int n,m;
  cin>>n>>m;
  

  set<int> data;
  rep(i,m){
    int tmp;
    cin>>tmp;
    data.insert(tmp);
  }
  
  
  vi answer(n+1);
    
  
  answer.at(0)=1;

  if (data.find(1)!=data.end()){
    answer.at(1)=0;
  }
  else {
    answer.at(1)=1;
  }
  

  
  for (int i=2;i<=n;i++){
    if (data.find(i)!=data.end()){
      answer.at(i)=0;
    }
    else {
      answer.at(i)=(answer.at(i-1)+answer.at(i-2))%MOD;
    }
  }
  
  cout<<answer.at(n)<<endl;
  

      
 

  
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <ios>
#include <iomanip>
using namespace std;
int main (void){
  string date;
  cin >> date;
  
  string year,month,day;
  year = date.substr(0,4);
  month = date.substr(5,2);
  day = date.substr(8,2);
  
  int y,m,d;
  y = stoi(year);
  m = stoi(month);
  d = stoi(day);
  
  if(y < 2019)
    cout << "Heisei" << endl;
  else if(y == 2019 && m <= 4)
    cout << "Heisei" << endl;
  else 
    cout << "TBD" << endl;
  
  return 0;
}
  
  

Measured memory_bytes: 256
///******* In the name of Allah *******///

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

//long long int ar[100013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//int sieve(long long int a)
//{
//    long long int i,j;
//    memset(ar,0,sizeof(ar));
//    for(i=2; i<=a; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=a; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    if(ar[a]==0)
//        return 1;
//    else
//        return 0;
//}

void Ok()
{
    long long int a,b,c,d,e,f,g,h,t,i,j,k,l1,l2,m,n,r,rcv,lo,hi,mid;
    long long int sum = 0,ans_1,ans_2,ans_3,cnt_1 = 0,cnt_2 = 0,cnt_3 = 0,Max,Min,flag = 0,div,temp;
    long double aa,bb,cc,dd,ee,ff,gg;
    char aaa[1013],bbb[1013],ccc,ddd;
    string spc,in[113],rev;

    cin>>aaa;
    l1 = strlen(aaa);
    for(i=1;i<=l1;i++)
    {
        bbb[i] = aaa[i-1];
    }
    l2 = (l1 - 1)/2;
    for(i=1,j=l1;i<=l2;i++,j--)
    {
        if(bbb[i]!=bbb[j])
            flag = 1;
    }
    int l3 = (l1+3)/2;
    if(!flag)
    {
        for(i=1,j=l3;i<=l2;i++,j++)
        {
            if(bbb[i]==bbb[j])
                cnt_1++;
        }
        if(cnt_1==l2)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    else
        cout<<"No"<<endl;

    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;


int main() {
	int a, b, c; cin >> a >> b >> c;
	if (a > b&&a > c)cout << "A" << endl;
	else if (b > a&&b > c)cout << "B" << endl;
	else cout << "C" << endl;
	//stop
	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) {
    }
    int root(int x) {
        return (data[x] < 0) ? x : data[x] = root(data[x]);
    }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y) {
        return root(x) == root(y);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
int main() {
    int n, m;
    cin >> n >> m;
    vector<tuple<ll, int, int>> e;
    rep(i, m) {
        int s, t;
        ll w;
        cin >> s >> t >> w;
        e.emplace_back(w, s, t);
    }
    sort(all(e));
    UnionFind uf(n);
    ll ans = 0;
    for (auto t : e) {
        ll c;
        int from, to;
        tie(c, from, to) = t;
        if (!uf.find(from, to)) {
            ans += c;
            uf.unite(from, to);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4924
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)


ll a, b, c, d;

int main(){
  cin >> a >> b >> c >> d;

  ll ans = max({a*c, a*d, b*c, b*d});

  cout << ans << endl;
}


Measured memory_bytes: 3636