akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
	int f[N2]; //??????????????????????????°???
	int space; //0?????\??£???????????????
	string path; //???????????§?????????????????????

	bool operator < (const Puzzle &p) const {
		for (int i = 0; i < N2; i++){
			if (f[i] == p.f[i]) continue; //?????£??¨?????????????´???§?????????
			return f[i] > p.f[i];
		}
		return false; //??????????????????
	}
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p){
	for (int i = 0; i < N2; i++){
		if (p.f[i] != (i + 1)) return false; //0???????????£??????????????????????????£???
	}
	return true; //???????????????
}

string bfs(Puzzle s){
	queue<Puzzle> Q;
	map<Puzzle, bool> V;
	Puzzle u, v;
	s.path = ""; //???????????????????¨????
	Q.push(s);
	V[s] = true;

	while (!Q.empty()){
		u = Q.front(); Q.pop();
		if (isTarget(u)) return u.path;
		int sx = u.space / N; //space????????§?¨?
		int sy = u.space % N; //space????¨???§?¨?
		for (int r = 0; r < 4; r++){
			int tx = sx + dx[r]; //?????§?¨?
			int ty = sy + dy[r]; //?¨???§?¨?
			if (tx < 0 || ty < 0 || tx >= N || ty >= N) continue; //???????????????
			v = u;
			swap(v.f[u.space], v.f[tx * N + ty]);
			v.space = tx * N + ty;
			if (!V[v]){
				V[v] = true;
				v.path += dir[r];
				Q.push(v);
			}
		}
	}

	return "unsolvable";
}

int main(){
	Puzzle in;

	for (int i = 0; i < N2; i++){
		cin >> in.f[i];
		if (in.f[i] == 0){
			in.f[i] = N2; //0?????´???9???????????????
			in.space = i;
		}
	}
	string ans = bfs(in);
	cout << ans.size() << endl; //unsolvable?????´??????10????????????????????????????????¶???????????????????????????

	return 0;
}

Measured memory_bytes: 28676
#include <iostream>

using namespace std;

typedef long long ll;

ll A,B;

ll g(ll n) {
    if (((n+1)/2)%2 == 0) {
        return 0;
    } else {
        return 1;
    }
}

ll f(ll n) {
    if (n%2 == 0) {
        return n^g(n-1);
    } else {
        return g(n);
    }
}

int main() {
    cin >> A >> B;
    cout << (f(A-1)^f(B)) << endl;
}


Measured memory_bytes: 256
// 2011/02/16 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		// üÍ
		int w;						// ¡ÌgpÊ
		cin >> w;
		if(w==-1)
			break;

		// Z
		int bil;					// ¡Ì¹¿à
		if(w<=10)
			bil = 1150;
		else if(w<=20)
			bil = 1150+(w-10)*125;
		else if(w<=30)
			bil = 1150+10*125+(w-20)*140;
		else
			bil = 1150+10*125+10*140+(w-30)*160;

		// oÍ
		cout << 4280-bil << endl;	// ÇÌ­ç¢ßñÅ«½©
	}

	return 0;
}

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

const int N = 3e3 + 5;
vector<int> adj[N];
int n, a[N];
bool dp[N];

void readInput() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		adj[--a].push_back(--b);
		adj[b].push_back(a);
	}
}

void dfs(int x, int par) {
	for (auto v:  adj[x])
		if (v != par) {
			dfs(v, x);
			if (a[v] < a[x])
				dp[x] |= !dp[v];
		}
}

void solve() {
	for (int i = 0; i < n; i++) {
		dfs(i, i);
		if (dp[i])
			cout << i + 1 << ' ';
		for (int i = 0; i < n; i++)
			dp[i] = false;
	}
	cout << endl;
}


int main() {
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	readInput(), solve();
	return 0;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    string s;
    int k,l;
    cin >> s >> k;
    l = s.length();
    ll dp[105][105][2] = {0};
    dp[0][0][0] = 1;
    rep(i,l){
        rep(j,l){
            rep(m,10){
                if (m == 0){
                    if (m == s[i]-'0'){
                        dp[i+1][j][0] += dp[i][j][0];
                        dp[i+1][j][1] += dp[i][j][1];
                    }
                    else{
                        dp[i+1][j][1] += dp[i][j][0]+dp[i][j][1];
                    }
                }
                else if (m > s[i]-'0'){
                    dp[i+1][j+1][1] += dp[i][j][1];
                }
                else if (m == s[i]-'0'){
                    dp[i+1][j+1][0] += dp[i][j][0];
                    dp[i+1][j+1][1] += dp[i][j][1];
                }
                else{
                    dp[i+1][j+1][1] += dp[i][j][0]+dp[i][j][1];
                }
            }
        }
    }
    PRINT(dp[l][k][0]+dp[l][k][1]);
}

Measured memory_bytes: 384
// https://atcoder.jp/contests/agc039/tasks/agc039_b

#include "algorithm"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

ll N;
V<V<ll>> G;
V<ll> colors;  // 0: 未着色
V<V<ll>> ds;
V<ll> group_ids;

bool check_bio(ll v, ll color) {
  colors[v] = color;

  for (auto to : G[v]) {
    if (colors[to] == color) {
      return false;
    }

    if (colors[to] == 0 && !check_bio(to, -color)) {
      return false;
    }
  }

  return true;
}

bool satisfied(ll s) {
  queue<pair<ll, ll>> q;  // f: edge, s: group

  group_ids[s] = 0;
  for (auto u : G[s]) q.emplace(u, 1);

  while (!q.empty()) {
    auto next = q.front();
    q.pop();

    auto u = next.first;
    auto g = next.second;

    if (group_ids[u] != -1) {
      if (group_ids[u] != g) {
        return false;
      } else {
        continue;
      }
    }

    group_ids[u] = g;

    for (auto v : G[u]) {
      if (group_ids[v] == -1) q.emplace(v, g + 1);
    }
  }

  return true;
}

void solve() {
  cin >> N;
  G.assign(N, V<ll>());

  rep(i, 0, N) {
    string e;
    cin >> e;

    rep(j, 0, N) {
      if (e[j] == '1') {
        G[i].push_back(j);
      }
    }
  }

  // {
  //   colors.assign(N, 0);

  //   if (!check_bio(0, 1)) {
  //     drop(-1);
  //   }
  // }

  {
    ll INF = 1 << 30;
    ds.assign(N, V<ll>(N, INF));
    rep(i, 0, N) ds[i][i] = 0;
    rep(i, 0, N) {
      for (auto to : G[i]) {
        ds[i][to] = 1;
        ds[to][i] = 1;
      }
    }

    // ワーシャルフロイド
    rep(k, 0, N) rep(i, 0, N) rep(j, 0, N) {
      ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j]);
    }
  }

  ll max_d = 0;
  rep(i, 0, N) rep(j, 0, N) chmax(max_d, ds[i][j]);

  {
    pair<ll, ll> max_pair;
    rep(i, 0, N) rep(j, 0, N) if (ds[i][j] == max_d) max_pair = make_pair(i, j);

    group_ids.assign(N, -1);

    if (!satisfied(max_pair.first)) {
      drop(-1);
    }
  }

  cout << max_d + 1 << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, 0, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

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

  int n, t, a, h;
  cin >> n >> t >> a;
  t *= 1000;
  a *= 1000;
  int tmp;
  int d = 1001001;
  int j;
  for (int i = 0; i < n; i++) {
    cin >> h;
    tmp = t - h * 6;
    int diff = abs(a - tmp);
    if (diff < d) {
      j = i + 1;
      d = diff;
    }
  }
  cout << j << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

void dfs(vector<vector<int>>& g, int cur, vector<int>& color){
	for(auto to : g[cur]){
		if(color[to] != -1) continue;
		color[to] = color[cur] ^ 1;
		dfs(g, to, color);
	}
}

signed main(){
	int n, m;
	while(cin >> n >> m, n){
		vector<vector<int>> g(n);
		rep(i,m){
			int u, v;
			cin >> u >> v;
			u--; v--;
			g[u].emplace_back(v);
			g[v].emplace_back(u);
		}

		vector<int> color(n, -1);
		color[0] = 0;
		dfs(g, 0, color);

		bool invalid = false;
		rep(i,g.size()){
			for(auto to : g[i]){
				if(color[i] == color[to]){
					invalid = true;
					break;
				}
			}
			if(invalid) break;
		}

		if(invalid){
			cout << 0 << endl;
			continue;
		}

		int cnt = 0;
		rep(i,n){
			cnt += color[i];
		}

		vector<int> ans;
		if(cnt % 2 == 0) ans.emplace_back(cnt / 2);
		if((n - cnt) % 2 == 0) ans.emplace_back((n - cnt) / 2);

		if(ans.size() == 2 and ans[0] == ans[1]) ans.pop_back();
		sort(all(ans));

		cout << ans.size() << endl;
		for(auto i : ans){
			cout << i << endl;
		}
	}
}



Measured memory_bytes: 3248
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<ii> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  vector<int> ret(n);
  for (int i = 0; i < n; ++i) {
    int k = a[i].second;
    ret[k] = i < n / 2 ? a[n / 2].first : a[n / 2 - 1].first;
  }
  for (int i = 0; i < n; ++i) {
    printf("%d\n", ret[i]);
  }
  return 0;
}


Measured memory_bytes: 4480
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    string s;
    cin >> s;
    char cc[26] = {0};
    rep(i, s.size())
    {
        cc[s[i] - 'a']++;
    }
    rep(i, 26)
    {
        if (cc[i] == 0)
        {
            cout << char(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <unistd.h>

int		main()
{
	int		N, i, r;
	int		nums[1001];

	i = 0;
	scanf("%d\n", &N);
	while (i >= 0)
	{
		r = scanf("%d ", &nums[i]);
		if (r == EOF)
			break ;
		i++;
	}
	nums[i] = 0;
	i = 0;
	while (nums[i])
	{
		if (nums[i] % 2 == 0 && nums[i] % 3 != 0 && nums[i] % 5 != 0)
		{
			printf("DENIED\n");
			return (0);
		}
		i++;
	}
	printf("APPROVED\n");
	return (0);
}


Measured memory_bytes: 128
N = int(input())
k=0
j=0
neg = 1
if N > 1:
	M = -2*N
	neg = 0
else:
	M = N
for i in range(-1*M):
	j = j - 2**(2*i + 1)
	if j <= M:
		k = i+1
		M = N-j
		break
	
out = ""
for i in range(2*k):
	if i%2 == 0:
		pl = M%2
		out = str(pl)+out
		M = int((M - pl)/2)
	else:
		pl = 1-(M%2)
		out = str(pl)+out
		M = int((M-1+pl)/2)

if N == 0:
	out="0"
elif out[0] == "0":
	out = out[1:]
	
print(out)

Measured memory_bytes: 3064
#include<stdio.h>
char s[110];
int p=0;
double f(double a,int b,double c){
  if(b==2)return a+c;
  if(b==3)return a-c;
  if(b==4)return a*c;
  return a/c;
}
int kobun(){
  int i,r=0,o[3];
  int n[3],a;
  char c[]={")=+-*/"};
  while(1){
    for(a=0;'0'<=s[p]&&s[p]<='9';p++)a=a*10+s[p]-'0';
    if(s[p]=='('){
      p++;
      a=kobun();
    }
    for(i=0;s[p]-c[i];i++);
    for(;r&&o[r-1]/2>=i/2;r--)a=f(n[r-1],o[r-1],a);
    n[r]=a;
    o[r++]=i;
    p++;
    if(i/2==0)return n[0];
  }
  return 0;
}
int main(){
  int n;
  for(scanf("%d",&n);n--;p=0){
    scanf("%s",s);
    printf("%d\n",kobun());
  }
  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  string S,T;
  cin >> N;
  
  cin >> S;
  cin >> T;
  
  for(int i = 0;i < N;i ++){
    
    cout << S[i];
    cout << T[i];
  }
  
  cout <<endl;
}
  
    
    


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

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define clean(used) memset(used,false,sizeof(used))
using namespace std;

const int INF = 1e18 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
vi edge[100005];
int u[100005] = {0};
int N;
const str tmp = "atcoder";
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> N;

    rep(i,0,N-1){
        cin >> a >> b;
        a--;b--;
        edge[a].pb(b);
        edge[b].pb(a);
    }

    bool even = true;
    queue<int> que[2],que_[2];

    u[0] = 1;
    u[N-1] = 2;

    que[even].push(0);
    que_[even].push(N-1);

    while(!que[even].empty() || !que_[even].empty()){
        if(!que[even].empty()){
            while(!que[even].empty()){
                int i = que[even].front();
                que[even].pop();
                for(int j : edge[i]){
                    if(!u[j]){
                        //cout << i+1 << " f " << j+1 << endl;
                        u[j] = 1;
                        que[!even].push(j);
                    }
                }
            }
        }

        if(!que_[even].empty()){
            while(!que_[even].empty()){
                int i = que_[even].front();
                que_[even].pop();
                for(int j : edge[i]){
                    if(!u[j]){
                        u[j] = 2;
                        //cout << i+1 << " s " << j+1 << endl;
                        que_[!even].push(j);
                    }
                }
            }
        }
        even = !even;
    }

    int f = 0,s = 0;

    rep(i,0,N){
        if(u[i] == 1)f++;
        if(u[i] == 2)s++;
        //cout << u[i] << endl;
    }

    //cout << f << " " << s << endl;

    if(f > s){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    return 0;
}


Measured memory_bytes: 7424
S = list(input())
Ncnt, Ecnt, Wcnt, Scnt = 0, 0, 0, 0

for i in S:
    if i == 'N':
        Ncnt += 1
    elif i == 'E':
        Ecnt += 1
    elif i == 'W':
        Wcnt += 1
    else:
        Scnt += 1

if (Ncnt > 0 and Scnt == 0) or (Scnt > 0 and Ncnt == 0) or (Ecnt > 0 and Wcnt == 0) or (Wcnt > 0 and Ecnt == 0):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9024
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a[100],n;
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=n;i++)
	{
		if (a[i]%2==0) {
			if (a[i]%3==0 ||a[i]%5==0) {
				continue;
			}
				
			else
				cout<<"DENIED"<<endl;
				return 0;
		}
	}
	cout<<"APPROVED"<<endl;
	return 0;
}

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

int main(){
  int h, w, n;
  cin >> h >> w >> n;
  vector<int> an(n);
  for(int i=0; i<n; ++i) cin >> an[i];
  vector<vector<int>> ans(h,vector<int>(w));
  int x = 0, y = 0;
  for(int i=0; i<n; ++i) for(int j=0; j<an[i]; ++j){
    ans[x][y] = i + 1;
    if(x%2 && y>0) --y;
    else if(x%2 == 0 && y<w-1) ++y;
    else ++x;
  }
  for(int i=0; i<h; ++i) for(int j=0; j<w; ++j){
    if(j != w-1) printf("%d ", ans[i][j]);
    else printf("%d\n", ans[i][j]);
  }
}

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

#define  io  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define  int  long long
#define  endl  '\n'
const double pi = acos(-1);
const int mod = 1e9 + 7;
//______________________



int32_t main()
{ 
  io;
 
  
  int n;
  set<int> div;

  cin>>n;

  for(int i=1;i*i<=n;i++)
  {
    if(n%i) continue;
    int d=i,d2=n/i;

    if(d>1 and n%(d-1) == n/(d-1))
        div.insert(d-1);
    if(d2>1 and n%(d2-1) == n/(d2-1))
        div.insert(d2-1);
  }

  int sum=0;
  for(int i: div)
    sum+=i;

  cout<<sum;
  

 return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>

using namespace std;

int main() {
    double d;
    double r = 2 / sqrt(2);
    cin >> d;
    
    int n = int(floor(d));

    double ans;

    //cout << n << endl;
    if (n == 0) {
        ans = r * d;
    } else if (d < sqrt(1 + n * n)){
        ans = max(n + 1., r * d);
    } else {
        ans = r * d;
    }

    printf("%.12f\n", ans);
}


Measured memory_bytes: 3292
N=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
iM=a.index(M)+1
im=a.index(m)+1
ans=[]
if m>=0:
    flag="+"
elif M<=0:
    flag="-"
elif abs(M)>=abs(m):
    flag="++"
else:
    flag="--"
if flag=="++":
    for i in range(N):
        if a[i]<0:
            a[i]=a[i]+M
            ans.append([iM,i+1])
    flag="+"
if flag=="--":
    for i in range(N):
        if a[i]>0:
            a[i]=a[i]+m
            ans.append([im,i+1])
    flag="-"   
if flag=="+":
    for i in range(N-1):
        M=max(a[:i+1])
        iM=a.index(M)+1
        if a[i]>a[i+1]:
            a[i+1]=a[i+1]+M
            ans.append([iM,i+2])
if flag=="-":
    for i in range(N-2,-1,-1):
        m=min(a[i+1:])
        im=a.index(m)+1
        if a[i]>a[i+1]:
            a[i]=a[i]+m
            ans.append([im,i+1])
print(len(ans))
for i in ans:
    print(i[0],i[1])

Measured memory_bytes: 3188
import java.util.*;

public class Main {

    static int[] g;
    static int[] size;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        g = new int[N]; 
        size  = new int[N]; 
        for (int i = 0; i < N; i++) {
            g[i] = i;
            size[i] = 1;
        }
        for (int i = 0; i < M; i++) {
            int A = sc.nextInt()-1;
            int B = sc.nextInt()-1;
            if (root(A) == root(B)) continue;
            unite(A,B);
        }

        int max = 0;
        for (int i = 0; i < N; i++) {
            max = Math.max(max,size[i]);
        }

        System.out.println(max);
    }

    private static int root(int n) {
        if (g[n] == n) return n;
        return g[n] = root(g[n]);
    }

    private static void unite(int A, int B) {
        int rootA = root(A);
        int rootB = root(B);
        if (rootA == rootB) return;
        if (size[rootA] >= size[rootB]) {
            g[rootB] = rootA;
            size[rootA] += size[rootB];
        } else {
            g[rootA] = rootB;
            size[rootB] += size[rootA];
        }
    }
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  double ans = 0;
  rep(i,n) ans+=1./(double)a[i];
  
  ans = 1./ans;
  
  printf("%.9f\n",ans);
  
  return 0;
}


Measured memory_bytes: 3716
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define REPI(i, a, b) for (int(i) = int(a); (i) < int(b); ++(i))

using namespace std;

int main()
{
    int Z;           //入力待ち
    int j, k;        //for文用
    string to = ","; //デバッグ用
    int e_count = 0; //演算回数を数える
    int count = 0;   //よくあるカウント
    //----------

    //int n;
    //cin >> n;
    int a;
    cin >> a;
    int b;
    cin >> b;

    if (a * b % 2 == 0)
        cout << "Even" << endl;
    else
    {
        cout << "Odd" << endl;
    }

    //cout << "Yes" << endl;

    //-----------
    cin >> Z;
    return 0;
}

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
// const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inline
void update(Vint &Data, int D[3]){
  int next[3] = {-1, -1, -1};
  REP(i, 3) REP(j, 3) if(i != j) next[i] = max(next[i], Data[j] + D[i]);
  REP(i, 3) Data[i] = next[i];
}

int main(void){
  Vint res(3, 0);
  int n, A[3]; cin >> n;
  REP(_, n){
    cin >> A[0] >> A[1] >> A[2];
    update(res, A);
  }
  //REP(i, 3) cout << res.at(i) << " "; cout << "\n";
  cout << *max_element(res.begin(), res.end()) << "\n";
  return 0;
}

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

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

    float ans = 0;
    float value;
    string unit;
    for(int i = 0; i < n; ++i){
        cin >> value >> unit;
        if("BTC" == unit) value = value * 380000;
        ans += value; 
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int k=abs(a-c);
if (k<=d)
cout<<"Yes"<<endl;
else
{
int m=abs(a-b);
int n=abs(b-c);
if (m<=d && n<=d)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
system("pause");
return 0;
}

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

int main(void)
{
    int A[3];
    for(int i = 0; i < 3; i++)
    {
        cin >> A[i];
    }
    sort(A , A + 3);
    cout << (A[2] * 10 + A[1]) + A[0]  << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if (A >= B && A >= C) {
        cout << 10 * A + B + C << endl;
    } else if (B >= A && B >= C) {
        cout << 10 * B + A + C << endl;
    } else {
        cout << 10 * C + A + B << endl;
    }

    return 0;
}


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

int N,K,T;
const int B = 500;
int from[200010/B+1], to[200010/B+1];
int val[200010/B*B+B];

void sync(int b){
  if(from[b] == -1) return;
  for(int i = b*B; i < (b+1)*B; ++i){
    if(val[i] == from[b]){
      val[i] = to[b];
    } else {
      val[i] = -2;
    }
  }
  from[b] = -1;
  to[b] = -1;
}

void naive(int l, int r, int x){
  for(int i = l; i < r; ++i){
    val[i] = (val[i] == x-1) ? x : -2;
  }
}

void block(int l, int r, int x){
  //assert(l%B == 0 && r%B == 0);
  l /= B; 
  r /= B;
  while(l < r){
    if(to[l] != -1){
      to[l] = (to[l] == x-1) ? x : -2;
    } else {
      from[l] = x-1;
      to[l] = x;
    }
    ++l;
  }  
}

void exec(int l, int r, int x){
  if(l/B == r/B){
    sync(l/B);
    naive(l,r,x);
  } else {
    if(l%B){
      sync(l/B);
      naive(l, l-l%B+B, x);
      l = l-l%B+B;
    }
    if(r%B){
      sync(r/B);
      naive(r-r%B, r, x);
      r = r-r%B;
    }
    block(l,r,x);
  }
}

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

  cin >> N >> K;
  cin >> T;

  memset(from, -1, sizeof from);
  memset(to, -1, sizeof to);

  while(N%B) ++N;

  for(int it = 0; it < T; ++it){
    int l,r,x;
    cin >> l >> r >> x;
    --l;
    exec(l,r,x);
  }

  for(int i = 0; i < N/B; ++i){
    sync(i);
  }

  cout << count(val, val+N, K) << endl;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);

int main(){
    std::cout<<std::fixed<<std::setprecision(10);
    double n,m,d;
    cin>>n>>m>>d;
    double x = 2*(n-d)/n/n;
    if(d==0)x=1/n;
    double  ans = x*(m-1);
    cout<<ans<<endl;
}

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

int main() {
    int N;
    vector<int> A(3);
    cin >> A.at(0) >> A.at(1) >> A.at(2) >> N;
    sort(A.begin(),A.end());
    int count = 0;
    for(int i = 0;i<N/A.at(2)+1;i++){
        int Na=N-i*A.at(2);
        for(int j = 0;j<Na/A.at(1)+1;j++){
            int Nb = Na -j*A.at(1);
            if(Nb%A.at(0)==0){
                count++;
            }
        }
    }
    cout << count << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

string mes, ans;
char hyou[6][7] = {
	{' ', ' ', ' ', ' ', ' ', ' ', ' '},
	{' ', 'a', 'f', 'k', 'p', 'u', 'z'},
	{' ', 'b', 'g', 'l', 'q', 'v', '.'},
	{' ', 'c', 'h', 'm', 'r', 'w', '?'},
	{' ', 'd', 'i', 'n', 's', 'x', '!'},
	{' ', 'e', 'j', 'o', 't', 'y', ' '}
};

int main()
{
	while (cin >> mes)
	{
		ans = "";

		if (mes.length() % 2 != 0)
		{
			cout << "NA" << endl;
			continue;
		}

		for (int i=0; i<mes.length(); i++)
		{
			int first = mes[i] - '0';
			int second = mes[i+1] - '0';
			i++;

			if (!(1 <= first && first <= 6) || !(1 <= second && second <= 5))
			{
				ans = "NA";
				break;
			}

			ans += hyou[second][first];
		}

		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N, M, A;
    cin >> N >> M;
    vector<int> S(N + 1);
    for(int i = 0; i < N; ++i){
        cin >> A;
        S[i + 1] = (S[i] + A % M) % M;
    }
    map<int, int> mp;
    ll ans = 0;
    for(int i = 0; i <= N; ++i){
        ans += mp[S[i]];
        ++mp[S[i]];
    }
    cout << ans << endl;
}

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

int main()
{
    string str[108], temp;

    int n,l;
    scanf ("%d%d",&n,&l);
    for(int i = 0; i < n; ++i)
    {
      cin>>str[i];
    }

    for(int i = 0; i < n; ++i)
       for( int j = i+1; j <n; ++j)
       {
          if(str[i] > str[j])
          {
            temp = str[i];
            str[i] = str[j];
            str[j] = temp;
          }
    }



    for(int i = 0; i < n; ++i)
    {
       cout << str[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin, a, b, c;
    print(c, a, b);
    return 0;
}


Measured memory_bytes: 256
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}
use input::*;

const INF: usize = 999999999;

fn dfs(n: usize, dp: &mut Vec<usize>, v: &Vec<Vec<usize>>) -> usize {
    if dp[n] != INF {
        return dp[n];
    }
    let mut ans = 0;
    for z in &v[n] {
        ans = std::cmp::max(ans, dfs(*z, dp, v) + 1);
    }
    dp[n] = ans;
    return ans;
}

fn main() {
    let (n, m): (usize, usize);
    input!(n, m);
    let mut v = vec![vec![]; n];
    for _ in 0..m {
        let (x, y): (usize, usize);
        input!(x, y);
        v[x - 1].push(y - 1);
    }
    let mut dp = vec![INF; n];
    for z in 0..n {
        dfs(z, &mut dp, &v);
    }

    p(dp.iter().max().unwrap());
}




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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
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++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    ll N; cin >> N;
    ll res = 0;
    ll tmp = 10;
    ll tmp1 = 50;
    // ll tmp2 = 100;
    if(N%2){
        cout << 0 << endl;
        return;
    }
    rep(i, 50){
        res += N / tmp;
        tmp *= 5;
    }
    // res += N / 50 - N / 100;

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;
using Graph = vector<vector<long long>>;

int main() {
    // 頂点数と辺数
    ll N, M; 
    cin >> N >> M;
    vector<ll> height;
    for (ll i = 0;i<N;i++) {
        ll h;
        cin >> h;
        height.push_back(h);
    }

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }
    ll cnt;
    cnt = 0;

    for (ll i = 0;i<N;i++) {
        bool ok = true;
        for (ll j : G[i]) {
            if (height.at(i) <= height.at(j)) {
                ok = false;
            }
        }
        if (ok) cnt++;
    }
    cout << cnt << endl;
}

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

typedef struct{
	int num[6];
}saikoro;


saikoro s_1;

void n(saikoro *a){
	int tmp;
	tmp=a->num[4];
	a->num[4]=a->num[0];
	a->num[0]=a->num[1];
	a->num[1]=a->num[5];
	a->num[5]=tmp;
}

void s(saikoro *a){
	int tmp;
	tmp=a->num[1];
	a->num[1]=a->num[0];
	a->num[0]=a->num[4];
	a->num[4]=a->num[5];
	a->num[5]=tmp;
}

void e(saikoro *a){
	int tmp;
	tmp=a->num[2];
	a->num[2]=a->num[0];
	a->num[0]=a->num[3];
	a->num[3]=a->num[5];
	a->num[5]=tmp;
}

void w(saikoro *a){
	int tmp;
	tmp=a->num[3];
	a->num[3]=a->num[0];
	a->num[0]=a->num[2];
	a->num[2]=a->num[5];
	a->num[5]=tmp;
}

int main(){
	int i,num,slen;
	char input[128];
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d %d %d %d %d %d",&s_1.num[0],&s_1.num[1]
		,&s_1.num[2],&s_1.num[3],&s_1.num[4],&s_1.num[5]);
	
	fgets(input,sizeof input,stdin);
	slen=strlen(input)-1;
	for(i=0;i<slen;i++){
		switch(input[i]){
			case 'N':
				n(&s_1);
			break;
			
			case 'S':
				s(&s_1);
			break;
			
			case 'E':
				e(&s_1);
			break;
			
			case 'W':
				w(&s_1);
			break;
		}
	}
	
	printf("%d\n",s_1.num[0]);
	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=5e3+50;
const int mod=1e9+7;
int n;
int main()
{
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
    return 0;
}


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


int main(void){
  int a,b,c,ans=0;
  
  cin >> a >> b >> c;
  
  while (max({a,b,c})-min({a,b,c}) > 1){
    if (a<=b && a<=c) a+=2;
    else if (b<=a && b<=c) b+=2;
    else c+=2;
    ans++;
  }
  
  ans+=(a+b+c)-min({a,b,c})*3;
  
  cout << ans << endl;
  
  return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int a[5],b[5];
    int s=0;
    int t=0;
    
    for(int i=0;i<4;i++){
        cin >> a[i];
    }
    for(int i=0;i<4;i++){
        cin >> b[i];
    }
    
    for(int i=0;i<4;i++){
        s=s+a[i];
        t=t+b[i];
    }
    
    if(s>=t){
        cout << s << endl;
    }
    else{
        cout << t << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 3092
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Node{
  int key;
  struct Node *right, *left, *parent;
}; 
struct Node *root, *NIL; 
struct Node * treeMinimum(struct Node *x){
  while(x->left != NIL) x = x->left;
  return x;
}
struct Node * find(struct Node *u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
} 
struct Node * treeSuccessor(struct Node *x){
  if(x->right != NIL) return treeMinimum(x->right);
  struct Node *y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}
void treeDelete(struct Node *z){
  struct Node *y;
  struct Node *x;
 
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
 
  if(y->left != NIL) x = y->left;
  else x = y->right;
 
  if(x != NIL) x->parent = y->parent;
 
  if(y->parent == NIL) root = x;
  else{
    if(y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }
 
  if(y != z) z->key = y->key;
 
  free(y);
}
void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;
 
  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else{
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}
 
void inorder(struct Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
 
void preorder(struct Node *u){
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
 
int main(){
  int n, i, x;
  char com[10];
 
  scanf("%d", &n);
 
  for(i = 0; i < n; i++){
    scanf("%s", com);
    if(com[0] == 'f'){
      scanf(" %d", &x);
      struct Node *t = find(root, x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(com[0] == 'i'){
      scanf(" %d", &x);
      insert(x);
    }
    else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com[0] == 'd'){
      scanf(" %d", &x);
      treeDelete(find(root, x));
    }
  }
  return 0;
}

Measured memory_bytes: 19364
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD (LL)(1e9+7)

string S;
int N;
int ans[100000] ={};

int main(){
	cin >> S;
	N = S.size();

	vector<int> tamari;
	for(int i=0; i+1<N; i++){
		if(S[i] == 'R' && S[i+1] == 'L'){
			tamari.PB(i);
		}
	}

	int c = 0;
	for(int i=0; i<N; i++){
		if(i%2 == 0){
			if(tamari[c]%2 == 0) ans[tamari[c]]++;
			else ans[tamari[c]+1]++;
		}
		else{
			if(tamari[c]%2 == 0) ans[tamari[c]+1]++;
			else ans[tamari[c]]++;
		}
		
		if(i == N-1) break;
		if(S[i] == 'L' && S[i+1] == 'R'){
			c++;
		}
	}

	for(int i=0; i<N; i++){
		if(i != 0) cout << " ";
		cout << ans[i];
	}
	cout << endl;
}

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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    int N; cin >> N;
    string s1, s2; cin >> s1 >> s2;

    ll ans = 0;
    bool flag = false;
    REP( i, N ){
        if( s1[i] == s2[i] ){
            if( i == 0 ) ans += 3;
            else{
                if( !flag ){
                    ans *= 2;
                    ans %= MOD;
                }
                flag = false;
            }
        }else{
            if( i == 0 ) ans += 6;
            else{
                if( flag ){
                    ans *= 3;
                    ans %= MOD;
                }else{
                    ans *= 2;
                    ans %= MOD;
                }
            }
            flag = true;
            i++;
        }
    }

    cout << ans << endl;
}


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

bool isPrime(int x){
	if(x==2){
		return true;
	}else if(x%2==0){
		return false;
	}
	
	for(int i=3;i*i<=x;i=i+2){
		if(x%i==0){
			return false;
		}
	}
	return true;
	
}

int main() {
	int N;
	cin>>N;
	int numberOfPrimeNumber = 0;
	
	for(int i=0;i<N;i++){
		int primeNumber;
		cin>>primeNumber;
		
		if(isPrime(primeNumber)){
			numberOfPrimeNumber++;
		}
		
	}
	
	cout<<numberOfPrimeNumber<<endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include <stdlib.h>
int cmpnum(const void * n1, const void * n2)
{
  if (*(long long*)n1 > *(long long*)n2)
  {
    return 1;
  }
  else if (*(long long*)n1 < *(long long*)n2)
  {
    return -1;
  }
  else
  {
    return 0;
  }
}

int main(void)
{
  long long n,c,k;
  long long t[200000];
  scanf("%lld %lld %lld",&n,&c,&k);

  for(long long i=0;i<n;i++){
    scanf("%lld",&t[i]);
  }

  qsort(t, n, sizeof(long long), cmpnum);

  long long sum=0;


  for(long long i=0;i<n;){
    sum++;
    long long tmp=i;
    while(t[tmp]+k>=t[i]&&i<tmp+c&&i<n){
      i++;
    }
  }
  printf("%lld\n",sum);
  return 0;
}


Measured memory_bytes: 1788
package main

import (
	"fmt"
	"math"
)

func gcd(a, b int) int {
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

func main() {
	var n, x, r, t int
	fmt.Scan(&n, &x)

	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		// 0から出発してx1-Xにたどり着く
		t = int(math.Abs(float64(t - x)))
		// 0から出発した
		if i == 0 {
			r = t
			continue
		}
		// 最大公約数を求める
		if g := gcd(t, r); r > g {
			r = g
		}
	}

	fmt.Println(r)
}


Measured memory_bytes: 5504