akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 2000005


ll fact[SIZE],inv_fact[SIZE];

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll nCk(ll n,ll k){

	ll ret = fact[n]*inv_fact[k];
	ret %= MOD;
	ret *= inv_fact[n-k];

	return ret%MOD;
}



int main(){

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= MOD;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],MOD);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= MOD;
	}

	ll X,Y;
	scanf("%lld %lld",&X,&Y);

	if((X+Y)%3 != 0){

		printf("0\n");
		return 0;
	}

	if(2*X-Y >= 0 && (2*X-Y)%3 == 0 && (X+Y)/3 >= (2*X-Y)/3){

		printf("%lld\n",nCk((X+Y)/3,(2*X-Y)/3));
		return 0;
	}
	if(2*Y-X >= 0 && (2*Y-X)%3 == 0 && (X+Y)/3 >= (2*Y-X)/3){

		printf("%lld\n",nCk((X+Y)/3,(2*Y-X)/3));
		return 0;
	}

	printf("0\n");

	return 0;
}


Measured memory_bytes: 31488
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

int cnt[100];

int main(){
	int n, m;
	while(cin >> n >> m && (n || m)){
		memset(cnt, 0, sizeof(cnt));
		rep(i, n){
			rep(j, m){
				int a;
				cin >> a;
				if(a) cnt[j]++;
			}
		}
		vector<P> res;
		rep(i, m){
			res.push_back(P(-cnt[i], i+1));
		}
		sort(res.begin(), res.end());
		rep(i, m) {
			if(i != 0) cout << " ";
			cout << res[i].second;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
s = input()

if s == 'SSS':
    print(0)
if s == 'RRR':
    print(3)
if s == 'SRR':
    print(2)
if s == 'RRS':
    print(2)
if s == 'SRS':
    print(1)
if s == 'RSR':
    print(1)
if s == 'SSR':
    print(1)
if s == 'RSS':
    print(1)


Measured memory_bytes: 9044
N = int(input())

arr = []

for i in range(N):
  arr.append(int(input()))
  
A = sorted(arr)

M1 = A[-1]
M2 = A[-2]

for i in range(N):
  if arr[i] == M1:
    print(M2)
  else:
    print(M1)

Measured memory_bytes: 14152
using System;

public class my
{
	public static void Main()
	{
		Console.ReadLine();
		my.BubbleSort(my.GetIntArray());
	}
	
	public static void BubbleSort(int[] A)
	{
		bool flag = true;
		int cnt = 0;
		
		while(flag) {
			flag = false;
			
			for(int i = A.Length -1; i > 0; i--) {
				if(A[i] < A[i-1]) { 
					my.Swap(ref A[i], ref A[i-1]);
					flag = true;
					cnt++;
				}
			}
		}
		
		my.WriteArray(A);
		Console.WriteLine(cnt);
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) FOR(i, 0, n - 1)
using namespace std;
typedef long long ll;
template <class T> inline bool dpmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool dpmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(long long s) {
    ll N = 1e7;
    vector<ll> seq(N);
    seq[0] = s;

    ll n = 1;
    for (n = 1; n < N; n++) {
        if (n >= 3 && seq[n-3] == 4 && seq[n-2] == 2 && seq[n-1] == 1) {
            break;
        }

        if (seq[n-1]%2 == 0) {
            seq[n] = seq[n-1] / 2;
        } else {
            seq[n] = 3*seq[n-1] + 1;
        }
        /* cout << seq[n] << endl; */
    }

    ll ans;

    if (s == 4 || s == 2 || s == 1) {
        ans = 4;
    } else {
        ans = n+1;
    }

    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long s;
  cin >> s;
  solve(s);
  return 0;
}


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n;cin >> n;
    ll x[15],y[15],p[15];
    for (int i = 0;i < n;++i) cin >> x[i] >> y[i] >> p[i];
    vector<vector<ll>> mnx(1<<n,vector<ll>(n)),mny(1<<n,vector<ll>(n));
    for (int s = 0;s < (1<<n);++s) {
        for (int i = 0;i < n;++i) {
            mnx[s][i] = abs(x[i]);
            for (int j = 0;j < n;++j) if ((s>>j)&1) mnx[s][i] = min(mnx[s][i],abs(x[i]-x[j]));
            mnx[s][i] *= p[i];
        }
    }
    for (int s = 0;s < (1<<n);++s) {
        for (int i = 0;i < n;++i) {
            mny[s][i] = abs(y[i]);
            for (int j = 0;j < n;++j) if ((s>>j)&1) mny[s][i] = min(mny[s][i],abs(y[i]-y[j]));
            mny[s][i] *= p[i];
        }
    }
    vector<ll> ans(n+1,1e18);
    for (int s = 0;s < (1<<n);++s) {
        int cnt = 0;
        for (int i = 0;i < n;++i) if ((s>>i)&1) cnt++;
        for (int i = s;;i = (i-1)&s) {
            ll sum = 0;
            for (int j = 0;j < n;++j) sum += min(mnx[i][j],mny[s^i][j]);
            ans[cnt] = min(ans[cnt],sum);
            if (i == 0) break;
        }
    }
    for (int i = 0;i < n+1;++i) cout << ans[i] << newl;
}

Measured memory_bytes: 13012
#include<stdio.h>
int main(void){
  int count=0,ans=0,i;
  char S[20];
  scanf("%s",S);
  for(i=0;i<20;i++){
    if(S[i]=='A' || S[i]=='T' || S[i]=='G' || S[i]=='C'){
      count++;
      if(ans<count){
        ans=count;
      }
    }
    else{
      count=0;
    }
    if(S[i]=='\0'){
      break;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.nextInt();
            var b = cin.nextInt();

            Console.WriteLine((a%3==0 || b%3==0 || (a+b)%3==0)? "Possible": "Impossible");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11092
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        s: String,
    }

    let words = vec!["dreamer", "dream", "erase", "eraser"];

    let mut flag = false;

    for words_com in words.iter().permutations(4) {
        let mut ans: String = s.clone();
        for word in words_com.into_iter() {
            ans = ans.replace(word, "");
        }

        if ans == "".to_string() {
            flag = true;
            break;
        }
    }

    if flag {
        println!("YES");
    } else {
        println!("NO");
    }
    
}


Measured memory_bytes: 2564
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
 
#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)
 
using namespace std;

typedef long long LL;
const int N = 300010;
 
struct P{ LL x, y;} p[N];
 
struct T{ LL mx, tg;}t[N * 4];
 
void modify(int x, int l, int r, int a, int b, LL c)
{
	
	if (a > b) return;
//	printf("%d %d*\n", a, b);
	if (a <= l && r <= b){
		t[x].tg += c, t[x].mx += c;
		return;
	}
	int mid = (l + r) >> 1;
	if (a <= mid) modify(x << 1, l, mid, a, b, c);
	if (b > mid) modify(x << 1 | 1, mid + 1, r, a, b, c);
	t[x].mx = max(t[x << 1].mx, t[x << 1 | 1].mx) + t[x].tg;
}
 
void build(int x, int l, int r)
{
	t[x].tg = 0;
	if (l == r){
		t[x].mx = p[l].x;
		return;
	}
	int mid = (l + r) >> 1;
	build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r);
	t[x].mx = max(t[x << 1].mx, t[x << 1 | 1].mx) + t[x].tg;
}
 
LL h, w;
int n;
 
bool cmp(P a, P b) { return a.x != b.x ? a.x < b.x : a.y > b.y;}
 
int stl[N], str[N], topl, topr;
LL ans;
 
void solve()
{
	sort(p + 1, p + 1 + n, cmp);
	build(1, 1, n); 
	topl = topr = 0, stl[0] = str[0] = n;
	modify(1, 1, n, 1, n, h);
	for (int i = n; i; i --) {
		ans = max(ans, t[1].mx - p[i].x);
		if (p[i].y >= h / 2) {
			modify(1, 1, n, i + 1, stl[topl], p[i].y - h);
			while (topl && p[stl[topl]].y > p[i].y){
				modify(1, 1, n, stl[topl] + 1, stl[topl - 1], p[i].y - p[stl[topl]].y);
				topl --;
			}
			stl[++ topl] = i;
		}
		else {
			modify(1, 1, n, i + 1, str[topr], -p[i].y);
			while (topr && p[str[topr]].y < p[i].y){
				modify(1, 1, n, str[topr] + 1, str[topr - 1], p[str[topr]].y - p[i].y);
				topr --;
			}
			str[++ topr] = i;
		}
	}
}

int main()
{
	//freopen("qaq.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	scanf("%lld%lld%d", &w, &h, &n);
	Rep(i, n){
		scanf("%lld%lld", &p[i].x, &p[i].y);
	}
	p[++ n] = (P){0, 0}, p[++ n] = (P){w, h};
	solve();
	Rep(i, n) swap(p[i].x, p[i].y);
	swap(h, w);
	solve();
	
	printf("%lld\n", ans * 2);
	
	return 0;
}
/*
5 5 5
5 4
2 5
0 1
1 2
4 3
*/

Measured memory_bytes: 24448
#include<bits/stdc++.h>
using namespace std;
int ara[102];
int main()
{
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++)scanf("%d", &ara[i]);
    sort(ara+1, ara+1+n);
    int res= 0;
    for(int i=1; i+2<=n; i++)
    for(int j=i+1; j+1<=n; j++)
    for(int k=j+1; k<=n; k++)
    res+= (ara[i]!=ara[j] && ara[j]!=ara[k] && ((ara[i]+ara[j])>ara[k]));
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <string>

using namespace std;

typedef long long ll;

int main(void) {
    
    int n;
    int a = 0;
    int b = 0;
    int c = 0;
    
    
    cin >> n;
    
    for (int i = 0; i < n; ++i) {
        
        int num; cin >> num;
        
        if (num % 2 != 0) {
            
            ++a;
            
        } else if (num % 4 == 0) {
            
            ++b;
            
        } else if (num % 2 == 0) {
            
            ++c;
            
        }
        
    }
    
    if (c == 0) {
        
        if (a <= b + 1) {
            
            cout << "Yes";
            
        } else {
            
            cout << "No";
            
        }
        
    } else {
        
        if (a == b) {
            
            cout << "Yes";
            
        } else {
            
            cout << "No";
            
        }
        
    }
    
    cout << endl;
    
    return 0;
    
}






















































Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n, k[100005];
	cin >> n;
	vector<bool>v(n);
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
		if (k[i] == i + 1) v[i] = true;
		else v[i] = false;
	}
	int count = 0;
	for (int i = 0; i < n; ++i) {
		if (v[i]) {
			count++;
			swap(v[i], v[i + 1]);
			v[i] = false;
			v[i + 1] = false;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    long long int a;
    cin>>n;
    for (int i=1;i<n+1;i++) {
        cin>>a;
        cout<<"Case "<<i<<":"<<endl;
        for (int j=0;j<10;j++) {
            a=a*a;
            string tmp=to_string(a);
            if (tmp.size()<8) {
                int hoge=8-tmp.size();
                for (int k=0;k<hoge;k++) {
                    tmp="0"+tmp;
                }
            }
            string tmp2=tmp.substr(2,4);
            a=stoi(tmp2);
            cout<<a<<endl;
        }
    }
}


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

bool isPrime(int x){
	int i;
	if(x < 2)	return false;

	for(i=2; i*i<=x; i++){
		if(x % i == 0)	return false;
	}
	return true;
}

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

for(int j=X;;j++){
	if(isPrime(j)==true){
		cout << j;
		break;
	} 
}


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;

ll a, b, n;

ll f(ll x){
    return a * x / b - a * (x / b);
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> a >> b >> n;
    ll low = 1, high = n, mid1, mid2;
    int cnt = 0;
    while(high - low > 3){
        mid1 = low + (high - low) / 3;
        mid2 = high - (high - low) / 3;
        if(f(mid1) > f(mid2)){
            high = mid2;
        }
        else low = mid1;
    }
    ll ans = 0;
    for(ll i = low; i <= high; i++) ans = max(ans, f(i));
    cout << ans;

    return 0;

}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll P = 1e9+7;
const ll N = 1e6+7;


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

	ll t=1;
	// cin>>t;

	while(t--){
		string s;
		cin>>s;
		if(s[s.length()-1] == 's') s.append("es");
		else s += 's';

		cout<<s<<"\n";

	}

	return 0;
}	


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

#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll MOD = 1000000007;
const long long INF = 1LL << 60;
//cout<<fixed<<setprecision(10);

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;}

signed main()
{   
    gearup;
    ll x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<ll> p(a),q(b),r(c);
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];
    sort(all(p),greater<ll>());
    sort(all(q),greater<ll>());
    rep(i,x) r.push_back(p[i]);
    rep(i,y) r.push_back(q[i]);
    sort(all(r),greater<ll>());
    //ll sum = accumulate(r.begin(),r.begin()+x+y+1,0);
    ll res = 0;
    rep(i,x+y) res += r[i];
    cout << res << endl;
}


Measured memory_bytes: 6256
# coding: utf-8
# Your code here!
N,Ma,Mb=map(int,input().split())

dp=[[10**9 for i in range(401)] for j in range(401)]
dp[0][0]=0

for _ in range(N):
    a,b,c=map(int,input().split())
    for i in range(401)[::-1]:
        for j in range(401)[::-1]:
            if dp[i][j]!=10**9:
                dp[i+a][j+b]=min(dp[i+a][j+b],dp[i][j]+c)

ans=10**9
for i in range(Ma,401)[::Ma]:
    j=i//Ma*Mb
    if j>=401:
        break
    ans=min(ans,dp[i][j])

if ans==10**9:
    print(-1)
else:
    print(ans)
    


Measured memory_bytes: 4844
#include<stdio.h>
int main()
{
 int i,a,b,m=0,n,o=0;
 scanf("%d %d",&a,&b);
  if(a>=1&&a<=10000&&b>=1&&b<=10000)
 {
  n=a;
 for(i=0;;)
 {
 	n-=b;i++;	
 	if(n<=0)  {printf("%d",i);o++;break;}
 }
 }
else printf("Print the number of attacks Serval needs to make before winning.");

return 0;	

}


Measured memory_bytes: 128
#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 <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  int INF = INT_MAX;
  ll mod = 1e9+7;
  // lld PI = 3.141592653;



  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     // fstream cin("text.txt");

      int n;
      cin>>n;
      vector<vector<pair<int,int>>> adj(n+1, vector<pair<int,int>>(0));
      int m;
      cin>>m;
      set<pair<int,int>> edges;
      for (int i = 0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        adj[a].push_back({b,c});
        adj[b].push_back({a,c});
        edges.insert({a,b});
      }
      for (int now = 1; now<=n; now++){
      vector<int> d(n+1, INF);
      vector<bool> visited(n+1);
      vector<int> p(n+1);
      // int now = 1;
      d[now] = 0;
      for (int i = 0; i<n; i++){
        int mini = 1;
        for (int j =2; j<=n; j++){
          if (!visited[j] && (visited[mini] || d[j] < d[mini])) mini = j;
        }
        // cout<<mini<endl;
        // if (d[mini] == INF) break;
        visited[mini] = true;
        // cout<<mini<<endl;
        for (pair<int,int> a: adj[mini]){
          if (d[mini] + a.second < d[a.first]){
            d[a.first] = d[mini] + a.second;
            p[a.first] = mini;
          }
          // d[a.first] = min(d[a.first], d[now]+a.second);
        }

      }
      
      for (int t = 1; t<=n; t++){
        vector<int> path;
        for (int v = t; v!= now; v = p[v]) path.push_back(v);
        path.push_back(now);
        for (int i = 1; i< path.size();i++) {

          edges.erase({path[i], path[i-1]});
          edges.erase({path[i-1], path[i]});
        }
      }

    }
    cout<<edges.size()<<"\n";
      // for (int i = 1; i<=n; i++) cout<<d[i]<<" ";
      //   cout<<endl;
      //   for (int i = 1; i<=n; i++) cout<<p[i]<<" ";
      // cout<<endl;

}
  

Measured memory_bytes: 3232
a, b, c, d = [int(n) for n in input().split()]
ans = {0:b*d, 2:b*d, 3:a*d, 8:b*d, 10:max(a*c, b*d), 11:a*c, 12:b*c, 14:a*c, 15:a*c}
f = 0
if a<0:
    f += 8
if b<0:
    f += 4
if c<0:
    f += 2
if d<0:
    f += 1
print(ans[f])


Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 2e9
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int main()
{
	vector<int>a{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;
	cout << a[k - 1] << endl;
	return 0;
}


Measured memory_bytes: 3604
import java.util.*; 
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String[] str = stdIn.nextLine().split(" ");
        Deque<Integer> stack = new LinkedList<Integer>();
 
        for (int i=0; i<str.length; i++) {
            char c = str[i].charAt(0);
            if(c>='0' && c<='9'){
                stack.add(Integer.parseInt(str[i]));
            }else {
                int x = stack.pollLast();
                int y = stack.pollLast();
                switch(c){
                    case '+':stack.add(x+y); break;
                    case '-':stack.add(y-x); break;
                    case '*':stack.add(x*y); break;
                }
            }
        }
 
        System.out.println(stack.poll());
    }
}



Measured memory_bytes: 26148
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

int b[nax];
vector <int> a[nax];
vector <int> d;
int ans[nax];
int n;

void dfs (int nod, int pa) {
    vector<int>::iterator it = lower_bound(d.begin(), d.end(), b[nod]);

    bool p_back = false;
    int pos = it - d.begin();
    int from = it == d.end() ? -1 : d[pos];


    if (it == d.end()) {
        p_back = true;
        d.push_back(b[nod]);
    } else {
        *it = b[nod];
    }

    ans[nod] = (int)d.size();
    for (int i : a[nod]) {
        if (i == pa) continue;
        dfs(i, nod);
    }

    if (p_back) {
        d.pop_back();
    } else {
        d[pos] = from;
    }
}


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

    for (int i = 0 ; i < n ; ++ i)
        scanf("%d", b + i);

    for (int i = 0 ; i < n - 1 ; ++ i) {
        int u, v;
        scanf("%d %d", &u, &v);
        -- u; -- v;
        a[u].push_back(v);
        a[v].push_back(u);
    }


    dfs(0, -1);

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

}
/*
    Good Luck
        -Lucina
*/
/*
    I hate Progmeth
*/


Measured memory_bytes: 33060
package main

import "fmt"

func main() {
	var s string
	var count int
	fmt.Scanf("%s", &s)
	if s[0] == '1' {
			count++
	}
	if s[1] == '1' {
		count++
	}
	if s[2] == '1' {
		count++
	}
	fmt.Println(count)
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  rep(i,5) {
    int a;
    cin>>a;
    
    if(a==0) {
      cout<<i+1;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3644
import math
a=float(input())
#print(math.floor(a/1.08))
#print(math.floor(a/1.08)*1.08)
#print(math.ceil(a/1.08))
#print(math.floor(math.ceil(a/1.08)*1.08))
#print(math.floor(math.floor(a/1.08)*1.08))
if math.floor(math.floor(a/1.08)*1.08) ==a or math.floor(math.ceil(a/1.08)*1.08) ==a:
  print(math.ceil(a/1.08))
else:
  print(":(")

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int k;
  cin >> s >> k;
  int l=s.size();
  for(int i=0;i<l;i++){
    if(s[i]=='a') continue;
    if('z' - s[i] < k){
      k-='z'-s[i]+1;
      s[i]='a';
    }
  }
  if(k)s[l-1]+=k%26;
  cout << s;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<iomanip>
#include<map>
#include<cstring>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const ll LLINF = 1LL<<60;
vector<int> dp;//dp[i + 1] : i円にするための最小動作
int main() {
    int N, T; cin >> N >> T;
    int t[N];rep(i, N)cin >> t[i];
    ll ans = 0;
    rep(i, N - 1){
        if(t[i + 1] < t[i] + T)
            ans += t[i + 1] - t[i];
        else
            ans += T;
    }
    cout << ans + T << endl;
}


Measured memory_bytes: 1152
N=int(input())
alphabets = [chr(ord('a') + x) for x in range(26)]
def dfs(n,s,maxc):
    if len(s)==N:
        print(''.join(s))
        return True
    for i in range(maxc+1):
        if i==maxc:
            maxc+=1
        dfs(n+1,s+[alphabets[i]],maxc)
s=[]
dfs(0,s,0)

Measured memory_bytes: 4412
#include <stdio.h>

#define MAX 100000

int main(void)
{
	int i;
	char t;
	char flag[26];

	for(i=0;i<26;i++) {
		flag[i] = 0;
	}

	while(1) {
		scanf("%c", &t);
		if(t == '\n') break;
		flag[(int)(t - 'a')] = 1;
	}

	for(i=0;i<26;i++) {
		if(flag[i] == 0) {
			printf("%c\n", (char)(i + 'a'));
			return 0;	
		}
	}

	printf("None\n");

	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int n, m;
pair<int, int> v[101101];

int main(){
	scanf("%d%d", &n, &m);
	for(int i=0;i<m;i++) {
		scanf("%d%d", &v[i].second, &v[i].first);
	}
	sort(v, v+m);
	int last = -1, ans = 0;
	for(int i=0;i<m;i++) {
		if (last < v[i].second) {
			ans++; last = v[i].first-1;
		}
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 1024
/* 
	بسم الله الرحمن الرحیم
	
	(; طلا یک جهانی
*/

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

#define F first
#define S second
typedef pair<int, int> pii;

const int MAX_N = 200 * 1000 + 5;
int n;
vector<int> adj[MAX_N];

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

pii dfs(int v, int par = -1, int h = 0) {
	pii res = {h, v};
	for (int u: adj[v])
		if (u != par)
			res = max(res, dfs(u, v, h + 1));
	return res;
}

void solve() {
	int x = dfs(dfs(0).S).F;
	if (x % 3 == 1)
		cout << "Second";
	else
		cout << "First";
}

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


Measured memory_bytes: 26880
def examA():
    X = LI()
    for i in range(len(X)):
        if X[i]==0:
            ans = i+1
    print(ans)
    return

def examB():
    X, Y = LI()
    ans = "No"
    for i in range(X+1):
        if i*2+(X-i)*4==Y:
            ans = "Yes"
    print(ans)
    return

def examC():
    X, N = LI()
    P = LI()
    P = set(P)
    cur = inf
    ans = -1
    for i in range(-1,102):
        if i in P:
            continue
        now = abs(i-X)
        if now<cur:
            ans = i
            cur = now
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

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

long long MOD = 1000000000 + 7;

int main(){
  int N;
  ll K;
  cin >> N >> K;
  int log_K = floor(log2(K));
  cerr << N << " " << log_K << endl;
  vector<vector<int>> next(log_K + 1, vector<int>(N));

  for(int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
//    cerr << i << " : " << tmp << endl;
    next.at(0).at(i) = tmp-1;
  }

  for(int k = 0; k < log_K; k++){
    for(int i = 0; i < N; i++){
      if(next[k][i] == -1){
        next[k+1][i] = -1;
      } else { 
        next[k+1][i] = next[k][next[k][i]];
        // cerr << k+1 << " " << i << " " << next[k+1][i] << endl;
      }
    }
  }

  int ans = 0;
  for(ll k = log_K; k >= 0; k--){
    if((K>>k)&1){
      ans = next[k][ans];
    }
  }
  cout << ans+1<< endl;

}


Measured memory_bytes: 51112
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;

int main(){
	string s;
	cin >> s;
	rep(i,s.length()) {
		rep(j,s.length()) {
			string a = s;
			a.erase(i,j);
			if (a == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n=s.size();
    set<string> vec;
    int k;
    cin >> k;
    for(int i=1;i<=min(k,n);i++){
        for(int j=0;j<=n-i;j++){
            vec.insert(s.substr(j,i));
        }
    }
    auto itr = vec.begin();
    for(int i=1;i<k;i++) ++itr;
    cout << *itr << endl;
}


Measured memory_bytes: 1664
n,k = map(int,input().split())
a = list(map(int,input().split()))
c = [10**9]*n
c[0]=0
c[1]=abs(a[0]-a[1])
for i in range(n-1):
    for j in range(i+1,min(n,i+k+1)):
        c[j] = min(c[j],c[i]+abs(a[i]-a[j]))
print(c[n-1])

Measured memory_bytes: 52448
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x;
  cin>>x;
  if(x>=400 && x<=599)
    cout<<"8"<<endl;
  else if(x>=600 && x<=799)
    cout<<"7"<<endl;
  else if(x>=800 && x<=999)
    cout<<"6"<<endl;
  else if(x>=1000 && x<=1199)
    cout<<"5"<<endl;
  else if(x>=1200 && x<=1399)
    cout<<"4"<<endl;
  else if(x>=1400 && x<=1599)
    cout<<"3"<<endl;
  else if(x>=1600 && x<=1799)
    cout<<"2"<<endl;
  else if(x>=1800 && x<=1999)
    cout<<"1"<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

/* Coding Space*/
vi dp(10001,-1);
int main(){
  int n; cin >> n;
  dp[0] = 0;
  int ans = 0;
  rep(i,n){
    int s; cin >> s;
    for(int j = 10000;j >= 0; j--){
      int x = j + s;
      if(x > 0 && x < 10001 && dp[j] != -1){
        dp[x] = 1;
        if(x%10 != 0)
          ans = max(ans,x);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/04  Problem: ABC 044 C / Link: http://abc044.contest.atcoder.jp/tasks/abc044_c  ----- */

LL dp[51][51][2503];

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

	LL N, A; cin >> N >> A;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	// A*kにしたい
	dp[0][0][0] = 1;
	FOR(i, 0, N) {
		FORR(k, N - 1, 0-1) {
			FOR(p, 0, 2500 - a[i] + 1) {
				dp[i + 1][k + 1][p + a[i]] += dp[i][k][p];
				dp[i + 1][k][p] += dp[i][k][p];
			}
		}
	}
	LL ans = 0LL;
	FOR(i, 1, N + 1) {
		ans += dp[N][i][i*A];
	}
	DD(de(ans))
		cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 50176
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  li w,h; cin >>w >>h;
  li x,y; cin >>x >>y;
  print(w*h/2.0,((x*2==w) and (y*2==h)));
}


Measured memory_bytes: 3764
N = gets.to_i
h = gets.split.map(&:to_i)

cnt = 0
# hがなくなったら終了
while h.length != 0
  done = false
  # 先頭から0まで水をあげる
  h.length.times do |i|
    if h[i] != 0
      h[i] -= 1
      done = true
    else
      break
    end
  end
  cnt += 1 if done

  # 先頭から連続する0を取り除く
  while h[0] == 0
    h.shift
  end
end

p cnt

Measured memory_bytes: 1788
//Sentou.cpp (C)
#include <iostream>
#include <string>
using namespace std;

int main(){
  int N,T;
  long long X = 0;
  cin >> N >> T;
  int t[N];
  for(int i = 0; i < N; i++) cin >> t[i];
  int a,b;
  a = b = 0;
  for(int i = 0; i < N-1; i++){
    int x = min(t[i+1] + T, t[i]+T) - max(t[i+1], t[i]);
    if(x <= 0) X += t[b] + T - t[a], a = b = i + 1;
    else b = i + 1;
  }
  X += t[b] + T - t[a];

  printf("%lld\n",X);
  return 0;
}


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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

int main(void) {
  
  ll N, K;
  cin >> N >> K;

  vector<ll> A(N);
  for (auto&& a : A) {
    cin >> a;
  }

  if (N == K) {
    cout << 1 << endl;
    return 0;
  }

  ll posone;
  for (ll i = 0; i < N; i++) {
    if (A[i] == 1) {
      posone = i;
      break;
    }
  }

  ll dl = posone;
  ll dr = N - posone - 1;
  ll k = K - 1;
  ll ans = 0;
  while (dl > 0 || dr > 0) {
    if (dl >= k) {
      dl -= k;
    } else if (dr >= k) {
      dr -= k;
    } else if (dl > 0) {
      dr -= (k - dl);
      dl = 0;
    } else {
      dr = 0;
    }
    ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int matrix[n][m];
  std::memset(matrix, 0, sizeof matrix);
  int vec[m];
  std::memset(vec, 0, sizeof vec);

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

  for (int j = 0; j < m; j++) {
    cin >> vec[j];
  }

  int ans[n];
  std::memset(ans, 0, sizeof ans);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      ans[i] += matrix[i][j] * vec[j];
    }
    cout << ans[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 3080
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <deque>
#define ll long long

using namespace std;

vector<int>A;

int partition(int p,int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++) {
		if (A[j] <= x) {
			i++;
			int mp = A[i];
			A[i] = A[j];
			A[j] = mp;
		}
	}
	int kp = A[i + 1];
	A[i + 1] = A[r];
	A[r] = kp;
	return i + 1;
}


int main() {
	int N; cin >> N;
	A.assign(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int out = partition(0, N - 1);

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


	return 0;
}





Measured memory_bytes: 3116
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
    ll M = max(a,b);
    ll m = min(a,b);
    if (m == 0) {
        return M;
    }
    else {
        return gcd(m,M%m);
    }
} 
int main() {
    ll ret = 0;
    ll n;
    cin >> n;
    for (int i = 1; i <= n; i++){
       for (int j = 1; j <= n; j++){
           for (int k = 1; k <= n; k++) {
               ll temp = gcd(i,j);
               ret += gcd(temp,k);
           }
       }
    }
    cout << ret;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int S = sc.nextInt();
		int W = sc.nextInt();
	if(S <= W) {
		System.out.println("unsafe");
	}else {
		System.out.println("safe");
	}
  }
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    rep(i,3){
        string s; cin >> s;
        cout << s[i];
    }
    cout << endl;
}


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

int main() {
	int n;
  	cin >> n;
  	if (n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9) {
    	cout << "hon"; 
    } else if (n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8) {
    	cout << "pon";  
    } else {
     	cout << "bon"; 
    }
  
  
	return 0;
}

Measured memory_bytes: 3092
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

ll rec(int l, int r, int is_first, vector<ll> &A, vector<vector<ll>> &dp) {
    if(dp[l][r] != LINF)
        return dp[l][r];
    if(l >= r)
        return dp[l][r] = 0;
    if(is_first) {
        return dp[l][r] = max(rec(l, r - 1, !is_first, A, dp) + A[r - 1],
                              rec(l + 1, r, !is_first, A, dp) + A[l]);
    } else {
        return dp[l][r] = min(rec(l, r - 1, !is_first, A, dp) - A[r - 1],
                              rec(l + 1, r, !is_first, A, dp) - A[l]);
    }
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) { cin >> A[i]; }
    vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, LINF));
    // dp[i][j]:=[i,j)から始めたときのX-Yの値
    cout << rec(0, N, 1, A, dp) << endl;
    return 0;
}

Measured memory_bytes: 74008
n=int(input())
s=[input() for _ in range(n)]
from collections import Counter
cnt=0
d=Counter()
import itertools
ans=0
for i  in s:
    d[i[0]]+=1
for i , j,k in itertools.combinations("MARCH",3):
    ans+=d[i]*d[j]*d[k]
print(ans)

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

using namespace std;

int main(void) {

	int number;
	string str;


	while (1) {

		cin >> str;
		if (str == "-") break;

		cin >> number;
		for (int i = 0; i < number; i++) {
			int move;
			string strC;
			cin >> move;

			strC = str.substr(move, str.length());
			str.erase(move, str.length());
			str.insert(0, strC);
		}

		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
import java.util.Scanner;

public class Main {	
	public static void main(String args[]){
		Scanner scr = new Scanner(System.in);
		int t = Integer.parseInt(scr.nextLine());
		for(int i=0; i<t; i++){
			String[] strs = scr.nextLine().split(" ",0);
			int[] g = new int[2]; // g??§?¨?
			g[0] = Integer.parseInt(strs[0]);
			g[1] = Integer.parseInt(strs[1]);
			int s = Integer.parseInt(scr.nextLine());
			MatatabiWays[] m_pos = new MatatabiWays[s];
			for(int j=0; j<s; j++){
				m_pos[j] = new MatatabiWays( scr.nextLine().split(" ",0) );
			}
			int c=Hokusai(g, m_pos);
			if(c==0){
				System.out.println("Miserable Hokusai!");
			}else{
				System.out.println(c);
			}
			
		}
		scr.close();
	}
	private static int Hokusai(int[] g, MatatabiWays[] ms){
		int[][] how_many_ways = new int[g[0]+1][g[1]+1];
		boolean[][] m_load_H = new boolean[g[0]][g[1]+1];
		boolean[][] m_load_V = new boolean[g[0]+1][g[1]];
		for(int x=0; x<=g[0]; x++){
			for(int y=0; y<=g[1]; y++){
				if(x<g[0])m_load_H[x][y] = false;
				if(y<g[1])m_load_V[x][y] = false;
			}
		}//?????????
		for(int s=0; s<ms.length; s++){
			if(ms[s].dir){
				m_load_H[ms[s].x][ms[s].y] = true;
			}else{				
				m_load_V[ms[s].x][ms[s].y] = true;
			}
		}
				
		for(int y=0; y<=g[1]; y++){
			if(y==0){
				how_many_ways[0][0] = 1;
				for(int x=1; x<=g[0]; x++){
					how_many_ways[x][0] = m_load_H[x-1][0]?
							0:
							how_many_ways[x-1][0];
				}
			}else{
				how_many_ways[0][y] = m_load_V[0][y-1]?
						0:
						how_many_ways[0][y-1];
				for(int x=1; x<=g[0]; x++){
					how_many_ways[x][y] = (m_load_H[x-1][y]? 0: how_many_ways[x-1][y])
							+(m_load_V[x][y-1]? 0: how_many_ways[x][y-1]);
				}
			}
		}
		return how_many_ways[g[0]][g[1]];
	}
}
class MatatabiWays{
	public int x;
	public int y;
	public boolean dir;//if Holizontal or else
	MatatabiWays(String[] state){
		int x1 = Integer.parseInt(state[0]);
		int y1 = Integer.parseInt(state[1]);
		int x2 = Integer.parseInt(state[2]);
		int y2 = Integer.parseInt(state[3]);
		x=(x1<=x2)? x1: x2;
		y=(y1<=y2)? y1: y2;
		if(x1==x2){
			dir=false;
		}else if(y1==y2){
			dir=true;
		}
	}
}

Measured memory_bytes: 31280
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 100005

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

int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	if(2*k-1<=n)
	{
		puts("YES");
	}
	else puts("NO");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
#define M 998244353
#define F first
#define S second
#define PB push_back
#define INF 1000000000
void up(ll &x,ll y){
	x=(x+M+y)%M;
}
ll n,inv[1000005],y[1000005],ans,sum[1000005],zsum[1000005];
int main(void){
	inv[0]=1,inv[1]=1;
	for(ll i=2;i<=1000000;i++)inv[i]=M-(M/i)*inv[M%i]%M;
	for(ll i=1;i<=1000000;i++)y[i]=1;
    scanf("%lld",&n);
    for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		for(int j=1;j*j<=a;j++){
			if(a%j==0){
				up(sum[j],a);
				up(zsum[j],1LL*a*a%M);
				if(a/j!=j){
					up(sum[a/j],a);
					up(zsum[a/j],1LL*a*a%M);
				}
			}
		}
	}
	for(int i=1;i<=1000000;i++){
		sum[i]=sum[i]*sum[i]%M;
		sum[i]=(sum[i]+M-zsum[i])%M*inv[2]%M;
		up(ans,sum[i]*y[i]%M*inv[i]%M);
		for(ll j=2;i*j<=1000000;j++){
			up(y[i*j],-(y[i]*j%M));
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 31488
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int n;
  cin>>n;
  int a[n];
  int max=0;
  for(int i=0;i<n;i++){
	cin>>a[i];
    int count=0;
    while(1){
      if(a[i]%2==0){
        count++;
        a[i]=a[i]/2;
      }else{
        break;
      }
  	}
    if(i==0){
      max=count;
    }
    if(max>count){
      max=count;
    }
  }
  cout<<max;
    return 0;
}

Measured memory_bytes: 256
// https://cf17-final.contest.atcoder.jp/tasks/cf17_final_e
#include<iostream>
#include<vector>
#include<string>

struct DSU{
	std::vector<int> parent;
	DSU(int n):parent(n){
		while(n--)parent[n]=n;
	}
	void join(int u,int v){parent[root(u)]=root(v);}
	int root(int u){return parent[u]!=u?parent[u]=root(parent[u]):u;}
};

int main(){
	std::ios::sync_with_stdio(false);std::cin.tie(nullptr);
	std::string str;std::cin>>str;
	int old_str_len=str.size();

	// eliminate (str)'s right side
	for(int i=0,j=str.size()-1;i<j;++i,--j){
		str[i]=(str[i]-str[j]+26)%26;
		// str[j]=0;
	}
	str.resize(str.size()/2);

	// compute differences
	str.push_back(0);
	for(int i=str.size();i-- >1;){
		str[i]=(str[i]-str[i-1]+26)%26;
	}

	// each operation {l, r} "connects" the difference at [l] and [r].
	int nOperation;std::cin>>nOperation;
	DSU dsu(str.size()+1); // hold the connected components
	for(int _=nOperation;_--;){
		int left,right;
		std::cin>>left>>right;
		--left;
		left =std::min(left ,old_str_len-left );
		right=std::min(right,old_str_len-right);
		if(left>right)std::swap(left,right);
		dsu.join(left,right);
	}

	std::vector<int> sum(str.size()+1,0);
	for(unsigned i=0;i<=str.size();++i)
		sum[dsu.root(i)]+=str[i]; // the difference

	for(unsigned i=0;i<=str.size();++i)
		if(sum[i]%26!=0){
			std::cout<<"NO\n";
			return 0;
		}

	std::cout<<"YES\n";
}


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

int main(){
 int n;
cin>>n;
 int m[n];
 for(int i = 0;i < n;i++){
     cin>>m[i];
 }
int i = 0;
int max = 0;
while(i != n){
 if(max < m[i]){
     max = m[i];
 }
 i++;
}
i = 0;
int min = pow(10,9);
while(i != n){
    if(min > m[i]){
        min = m[i];
    }
    i++;
}
int kekka = max - min;
cout<< kekka;
}


Measured memory_bytes: 256