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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int A, B, M;
	cin >> A >> B >> M;
	vector<int> a(A);
	for (int i = 0; i < A; ++i) {
		cin >> a[i];
	}
	vector<int> b(B);
	for (int i = 0; i < B; ++i) {
		cin >> b[i];
	}
	int minA = *min_element(a.begin(), a.end());
	int minB = *min_element(b.begin(), b.end());
	int ans = minA + minB;
	for (int i = 0; i < M; ++i) {
		int x, y, c;
		cin >> x >> y >> c;
		--x;
		--y;
		ans = min(ans, a[x] + b[y] - c);
	}
	cout << ans << '\n';
	
	return 0;
}


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int h, n, a, sum = 0;

    cin>> h>> n;


    for(int  i= 0; i<n; i++)
    {
        cin>> a;
        sum+= a;
    }


    cout << (sum>= h? "Yes\n" : "No\n");


    return 0;
}




Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;



int main(){
    ll n;
    cin >> n;
    ll ans = 0;

    if(n%2 == 0){
        ll tmp = n;
        ll cnt = 0;
        while(tmp >= 10){
            cnt++;
            tmp /= 10;
        }
        ll div = 1;
        ll div_f = 50;
        for(int i = 1; i <= cnt; i++){
            div *= 10;
            ans += n/div;
            while(div % div_f == 0){
                ans += n/div_f - n/div;
                div_f *= 5;
            }
        }
        while(n >= div_f){
            ans += n/div_f;
            div_f *= 5;
        }

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
using namespace std;
char n;
int a,b,s;
int main()
{
    cin>>a>>b;
    for( s=0;s<a;s++)
    {
        cin>>n;
        if(n<'0'||n>'9')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cin>>n;
    if(n!='-')
    {
        cout<<"No"<<endl;
        return 0;

    }
    for( s=0;s<b;s++)
    {
        cin>>n;
        if(n<'0'||n>'9')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    ll ans=0;
    REP(i, 1, n+1){
        ll cnt=0;
        if(i%2==0) continue;

        REP(j, 1, i+1){
            if(i%j==0) cnt++;
        }

        if(cnt==8) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e6+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p,ll mod)
{
	if(p==0) return 1;
	ll z=powN(a,p/2,mod);
	z=(z*z)%mod;
	if(p%2) z=(z*a)%mod;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vector<int> MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	int n,k;
	cin>>n>>k;
	vi A(n);
	take(A,0,n);
	int times=0;
	while(times<k)
	{
		vi PR(n+1);
		for(int i=0;i<n;i++)
		{
			PR[max(0,i-A[i])]++;
			PR[min(n,i+A[i]+1)]--;
		}
		for(int i=1;i<=n;i++)
		{
			PR[i]+=PR[i-1];
		}
		bool same=true;
		for(int i=0;i<n;i++)
		{
			if(A[i]!=PR[i]) same=false;
			A[i]=PR[i];
		}
		if(same) break;
		times++;
	}
	prin(A);

}		

Measured memory_bytes: 8804
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

N = I()
print((-N % 1000))

Measured memory_bytes: 61108
N = int(input())
A = [int(input()) for _ in range(N)]
"""
this is wrong answer!!
dp = [[[0, 0], [0, 0]] for _ in range(N)]
dp[0][0][0] = 2
dp[0][1][0] = 2
dp[0][0][1] = A[0]-1
dp[0][1][1] = A[0]-1
for i in range(1, N):
    for l in [0, 1]:
        remove = A[i] // dp[i-1][l][0]
        if A[i] % dp[i-1][l][0] == 0:
            if dp[i][1][1] < dp[i-1][l][1] + remove - 1:
                dp[i][1][1] = dp[i-1][l][1] + remove - 1
                dp[i][1][0] = dp[i-1][l][0] + 1
            if dp[i][0][1] < dp[i-1][l][1] + remove - 2:
                dp[i][0][1] = dp[i-1][l][1] + remove - 2
                dp[i][0][0] = dp[i-1][l][0]
        else:
            if dp[i][1][1] < dp[i-1][l][1] + remove:
                dp[i][1][1] = dp[i-1][l][1] + remove
                dp[i][1][0] = dp[i-1][l][0]
                dp[i][0][1] = dp[i][1][1]
                dp[i][0][0] = dp[i][1][0]
ans = max(dp[N-1][0][1], dp[N-1][1][1])
print(ans)
"""

p = 2
ans = A[0]-1
for i in range(1, N):
    if p == A[i]:
        p += 1
    else:
        if A[i] % p == 0:
            ans += A[i]//p-1
        else:
            ans += A[i]//p
print(ans)


Measured memory_bytes: 7080
#include <bits/stdc++.h>
using namespace std;
const int limit = 50;

int n, m;
int a[limit], b[limit];

bool graph[limit][limit];
bool visited[limit];

void dfs(int v) {
	visited[v] = true;
	for (int v2 = 0; v2 < n; ++v2) {
		if (graph[v][v2] == false) continue;
		if (visited[v2] == true) continue;
		dfs(v2);
	}
}

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

	for (int i = 0; i < m; ++i) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	int ans = 0;

	for (int i = 0; i < m; ++i) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		for (int j = 0; j < n; ++j) visited[j] = false;

		dfs(0);

		bool bridge = false;
		for (int j = 0; j < n; ++j) if (visited[j] == false) bridge = true;
		if (bridge) ans += 1;

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.append(0)
    elif S[i] == "1":
        Z.append(1)
    elif S[i] == "B":
        if len(Z)== 0:
            pass
        else:
            Z.pop()
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1

Measured memory_bytes: 8976
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a, b;
  cin >> a >> b;

  if (a * b <= 0) puts("Zero");
  else if (a > 0) puts("Positive");
  else {
    long foo = min(b+1, 0l) - a;
    if (foo % 2 == 0) puts("Positive");
    else puts("Negative");
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const long long INF = 1LL<<60;
static const int MAX = 210;

int N, M, R;
long long d[MAX][MAX];

int main() {
    cin >> N >> M >> R;
    vector<int> r;
    for (int i = 0; i < R; ++i) {  
        int tmp; 
        cin >> tmp; 
        --tmp; 
        r.push_back(tmp); 
        }
    
    for (int i = 0; i < MAX; ++i) {
        for (int j = 0; j < MAX; ++j) d[i][j] = INF;
        d[i][i] = 0;
    }

    for (int i = 0; i < M; ++i) {
        int a, b, c; cin >> a >> b >> c; --a, --b;
        d[a][b] = c;
        d[b][a] = c;
    }
    for (int k = 0; k < N; ++k)
        for (int i = 0; i < N; ++i)
            for (int j = 0; j < N; ++j)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

    long long res = INF;

    sort(r.begin(), r.end());//next_permutationをするから

    do {
        long long tmp = 0;
        for (int i = 1; i < r.size(); ++i) tmp += d[r[i]][r[i-1]];
        res = min(res, tmp);
    } while (next_permutation(r.begin(), r.end()));

    cout << res << endl;

    return 0;
}

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

int main(void){
    int n, i, tmp, sum_, max_, min_;
    while(true){
        scanf("%d", &n);
        if(n == 0) break;
        min_ = 1001;
        max_ = -1;
        sum_ = 0;
        for(i = 0; i < n; i++){
            scanf("%d", &tmp);
            sum_ += tmp;
            min_ = min(min_, tmp);
            max_ = max(max_, tmp);
        }
        sum_ = sum_ - max_ - min_;
        printf("%d\n", sum_/(n-2));
   }
}


Measured memory_bytes: 2572
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a, b):
    if a>8 or b>8:
        answer=':('
    else:
        answer='Yay!'
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = n;
        int w = n;
        
        // board[i][j]: 迷路
        char[][] board = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = sc.next();
            for (int j = 0; j < w; j++) {
                board[i][j] = str.charAt(j);
            }
        }
        
        // to: 隣接リスト
        List<Integer>[] to = new List[n];
        for (int i = 0; i < n; i++) {
            to[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (board[i][j] == '1') {
                    to[i].add(j);
                    to[j].add(i);
                }
            }
        }
        
        int ans = 0;
        for (int i = 0; i < n; i++) {
            // visited: 当該点を既に通ったか否か
            boolean[] visited = new boolean[n];
            visited[i] = true;
            
            // max: iから最も遠い点との距離
            int max = 0;
            int[] dist = new int[n];
            // 頂点0から順に、親から子へ初期値を配り最終値を求める
            Queue<int[]> que = new ArrayDeque<int[]>();
            que.add(new int[]{i, 0});
            while (!que.isEmpty()) {
                int[] cur = que.poll();
                int p = cur[0];
                int dis = cur[1];
                
                visited[p] = true;
                for (Integer q : to[p]) {
                    if (visited[q]) continue;
                    
                    if (dist[q] != 0 && dist[q] != dis + 1) {
                        System.out.println(-1);
                        return;
                    }
                    
                    if (dist[q] != 0 && dist[q] == dis + 1) continue;
                    
                    dist[q] = dis + 1;
                    que.add(new int[]{q, dist[q]});
                    max = Math.max(max, dist[q]);
                }
            }
            
            ans = Math.max(ans, max);
        }
        
        System.out.println(ans+1);
    }
}


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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b, n;
  while (cin >> a >> b >> n) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
      (a %= b) *= 10;
      ans += a / b;
    }
    cout << ans << endl;
  }

  return 0;
}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; string s; cin>>n>>s;
	map<int,int> pre, suf;
	for (int i=0; i<n; i++)
		pre[i]=pre[i-1]+int(s[i]=='W');
	for (int i=n-1; i>=0; i--)
		suf[i]=suf[i+1]+int(s[i]=='E');
	int ret=INT_MAX;
	for (int i=0; i<n; i++)
		ret=min(ret,pre[i-1]+suf[i+1]);
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 28692
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const ll inf=100000000000000000;
struct edge{
	int to,cost;
};
struct pos{
	int to;
	ll cost;
};
struct pos2{
	int to,from;
	ll cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 1002
ll dp2[100001];
vector<pos> vec[100001];
vector<int> vec2[100001];
int dp[10011][10]={};
int main() {
	int n,m;
	cin>>n>>m;
	int b[10]={};
	int c[10]={0,2,5,5,4,5,6,3,7,6};
	rep(i,m){
		int a;
		cin>>a;
		b[a]=1;
	}
	for(int i=9;i>0;--i){
		if(b[i]>0&&dp[c[i]][0]==0){
			dp[c[i]][i]=1;
			dp[c[i]][0]=1;
		}
	}
	for(int i=2;i<n;++i){
		if(dp[i][0]>0){
			for(int i2=9;i2>0;--i2){
				if(b[i2]>0){
					int ndp[10]={};
					rep(i3,10){
						ndp[i3]=dp[i][i3];
					}
					ndp[i2]++;
					ndp[0]++;
					bool flg=false;
					if(ndp[0]>dp[i+c[i2]][0]){
						flg=true;
					}else if(ndp[0]==dp[i+c[i2]][0]){
						int flg2=0;
						for(int i3=9;i3>0;--i3){
							if(flg2==0){
								if(ndp[i3]>dp[i+c[i2]][i3])flg2=1;
								if(ndp[i3]<dp[i+c[i2]][i3])flg2=-1;
							}
						}
						if(flg2==1)flg=true;
					}
					if(flg){
						rep(i3,10)dp[i+c[i2]][i3]=ndp[i3];
					}
				}
			}
		}
	}
	for(int i=9;i>0;--i){
		rep(i2,dp[n][i])cout<<i;
	}
	cout<<endl;

	return 0;
}





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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;
#define DBG(x) cerr << x << endl;

/*
	http://abc073.contest.atcoder.jp/tasks/abc073_b
*/
int n;
int solve()
{
	int ret = 0;
	while(n--)
	{
		int l, r;
		cin >> l >> r;

		ret += r - l + 1;
	}
	return ret;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
	//freopen("tmp.out", "w", stderr);
#endif
	cin >> n;
	
	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>

int main() {
	int n, flag = 0;
	std::cin >> n;
	int a[200000];
	for (int i = 0;i < n;i++) {
		std::cin >> a[i];
	}
	std::sort(a, a + n);
	int m, now = 0;
	std::cin >> m;
	int b[200000];
	for (int i = 0;i < m;i++) {
		std::cin >> b[i];
	}
	std::sort(b, b + m);
	for (int i = 0;i < m;i++) {
		int F = 0;
		for (int j = now;j < n;j++)
			if (a[j] == b[i]) {
				F = 1;
				now = j+1;
				break;
			}
		if (F == 0)
			flag = 1;
	}
	if (flag == 1)
		std::cout << "NO" << std::endl;
	else std::cout << "YES" << std::endl;
	return 0;
}



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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;


int main(void){
	ll n,m,d;
	cin >> n >> m >> d;

	R ans = 1.0 * (m -1) / n / n; 

	if(d == 0){
		ans *= n;
	}else{
		ans *= 2.0 * (n - d);
	}
	
	cout.precision(10);
	cout << fixed << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
string s;
int s0,s1;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='0')
			s0++;
		else
			s1++;
	}
	cout<<min(s1,s0)*2;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <queue>
#include <set>

int MAX_n = 100000;
int imin(int x, int y) {
  if(x<y)return x;
  else return y;
}

int main(){
  
  /* read input */
  int n;
  int v[MAX_n];
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", v+i);
  }
  
  /* count numbers of each number in the sequence */
  int odd_count[100000];
  int even_count[100000];
  // initialize count
  for(int i = 0; i < 100000; i++){
    odd_count[i] = 0;
    even_count[i] = 0;
  }
  // count
  for(int i = 0; i < n/2; i++){
    odd_count[v[2*i+1]-1]++;
    even_count[v[2*i]-1]++;
  }
  
  // solve problem
  int odd_count1 = 0;
  int odd_count2 = 0;
  int odd_index1 = -1;
  int odd_index2 = -1;
  int even_count1 = 0;
  int even_count2 = 0;
  int even_index1 = -1;
  int even_index2 = -1;
  
  // solve problem
  for(int i = 0; i < 100000; i++){
    if(odd_count[i] >= odd_count1){
      odd_count2 = odd_count1;
      odd_index2 = odd_index1;
      odd_count1 = odd_count[i];
      odd_index1 = i;
    }
    else if(odd_count[i] >= odd_count2){
      odd_count2 = odd_count[i];
      odd_index2 = i;
    }
    if(even_count[i] >= even_count1){
      even_count2 = even_count1;
      even_index2 = even_index1;
      even_count1 = even_count[i];
      even_index1 = i;
    }
    else if(even_count[i] >= even_count2){
      even_count2 = even_count[i];
      even_index2 = i;
    }
  }

  // print result
  if(odd_index1 != even_index1){
    printf("%d", n-odd_count1-even_count1);
  }
  else{
    printf("%d", imin(n-odd_count1-even_count2, n-odd_count2-even_count1));
  }
  
  return 0;
}


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

int N;
vector<int> A, ans;

void input_init(void) {
	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i];
	ans.resize(N);
}

void solve(void) {
	int all_xor = 0;
	for (int i = 0; i < N; ++i)
		all_xor = all_xor ^ A[i];
	for (int i = 0; i < N; ++i)
		ans[i] = all_xor ^ A[i];
}

int main(void) {
	input_init();
	solve();
	for (int i = 0; i < N; ++i) {
		cout << ans[i];
		cout << ((i == N - 1)? '\n' : ' ');
	}
	return 0;
}


Measured memory_bytes: 4752
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a.at(i);
  vi b;
  rep(i,n) {
    if(i%2==0) b.push_back(a[i]);
    else b.insert(b.begin(),a[i]);  
  }
  if(n%2==1) reverse(b.begin(),b.end());
  rep(i,b.size()-1) cout << b[i] << " ";
  cout << b[b.size()-1] << endl;
  return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	const ll MOD = 1e9 + 7;
	debug(MOD);

	ll N, K;
	cin >> N >> K;
	vector<ll> vec(N);
	vector<ll> count(2002, 0);
	rep(i, N) {
		cin >> vec[i];
		count[vec[i]]++;
	}

	vector<ll> subsum(2002);

	for (int i = 2000; i > 0; i--) {

		if (i == 2000) subsum[i] = count[i + 1];
		else subsum[i] = subsum[i + 1] + count[i + 1];

	}

	debug(subsum);

	vector<ll> tmp(2001, 0);

	vector<ll> now(N);

	//1回目
	rep(i, N) {

		ll t = 0;

		for (int j = vec[i] + 1; j < 2001; j++) {
			t = (t + tmp[j]) % MOD;
		}

		now[i] = t;
		tmp[vec[i]]++;
	}

	ll nowsum = 0;

	rep(i, N) {
		nowsum = (nowsum + now[i]) % MOD;
	}

	//2回目以降
	ll one_vec = 0;

	rep(i, N) {
		one_vec = (one_vec + subsum[vec[i]]) % MOD;
	}

	debug(now);
	debug(one_vec);

	ll ans = 0;

	ll one_vec_cnt = 0;

	one_vec_cnt = (((K) * (K - 1))/2) % MOD;

	ans += (nowsum * K) % MOD;
	ans += (one_vec * one_vec_cnt) % MOD;

	cout << ans % MOD;

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using pr = pair<int, int>;

int N, M;

int main() {
    scanf("%d %d", &N, &M);
    if((N + M) % 2 == 1) puts("IMPOSSIBLE");
    else printf("%d\n", M + N >> 1);
}


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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;



int main(){
   ll n,k; cin>>n>>k;
   ll ans = n%k, ans1 = fabs(ans-k);
   cout<<min(ans,ans1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int x, p; cin >> x >> p;
    cout << fixed << setprecision(10) << ((x - 1) / 2 + 1) / (double)p * 100.0 << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var S string
	fmt.Scan(&S)

	a := strings.Split(S, "")
	sort.Strings(a)
	s := strings.Join(a, "")
	if s == "abc" {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int cnt = 0;
        for(int i=0; i<S.length(); i++){
          if(S.charAt(i) != T.charAt(i)){
            cnt++;
          } else {
            continue;
          }
        }
        System.out.println(cnt);
   }
}

Measured memory_bytes: 41476
#!/usr/bin/env python
# coding: utf-8

# In[12]:


N = int(input())
A = list(map(int, input().split()))


# In[20]:


def main():
    mylist = []
    s = 0
    m = 1000
    ans = m
    for i in range(1,N):
        if A[i] > A[i-1]:
            mylist.append(1)
        elif A[i] < A[i-1]:
            mylist.append(-1)
        else:
            mylist.append(0)
    for j,x in enumerate(mylist):
        if x > 0:
            b = m//A[j]
            s += b
            m -= b*A[j]
        elif x < 0:
            m += s*A[j]
            s = 0
        ans = max(ans, m+s*A[j])
    ans = max(ans, m+s*A[-1])
    print(ans)


# In[21]:


if __name__ == '__main__':
    main()


# In[ ]:






Measured memory_bytes: 9236
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


int main() {
    int n;
    set<char> s;
    cin >> n;
    rep(i, n) {
        char temp;
        cin >> temp;
        s.insert(temp);
    }
    if (s.size() == 4) cout << "Four" << endl;
    else cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  int m;cin>>m;
  int tmp = n - m;
  int one = 1900*m + tmp*100;
  
  ll ans = power(2,m)*one;
  print(ans);
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

g = [set() for _ in range(3 * n)]

for u, v in uv:
    a = u - 1
    b = v - 1
    g[a].add(n + b)
    g[n+a].add(n*2 + b)
    g[n*2+a].add(b)

#print(g)

s -= 1
t -= 1
ans = 0
temp = set()
temp.add(s)
while 1:
    ans += 1
    next = set()
    for x in temp:
        for y in g[x]:
            next.add(y)
        g[x] = []
    if len(next) == 0:
        print(-1)
        exit()
    if t in next:
        print(ans // 3)
        exit()
    temp = next


Measured memory_bytes: 118820
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int a = std::numeric_limits<int>::max();
	int k;
	cin>>n>>k;
	int h[n];
	int dp[n];
	
	for(int i=0;i<n;i++)
	{
	cin>>h[i];
	dp[i]=1e9;
	}
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
		
		for(int j=1;j<=k;j++)
		{
			if(i<j)
			continue;
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n-1];
	
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main() {
	int L, A, B, C, D;
	int restA = 0, restB = 0;
	cin >> L >> A >> B >> C >> D;
	if( A % C > 0) { restA = 1;}
	if( B % D > 0) { restB = 1;}
	cout << L - max((A/C) + restA, (B/D) +restB ) << endl;
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;

int main() {
	long long N, M, scc, cccc;
	cin >> N >> M;
	scc = min(N, M / 2);
	cccc = (M - scc * 2) / 4;
	cout << scc + cccc << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string.h>
using namespace std;

#define MAX_N (105)
#define MAX_W (10005)
int v[MAX_N];
int w[MAX_N];
int dp[MAX_W];

int main()
{
    int N, W;
    scanf("%d %d", &N, &W);
    memset( dp, 0, MAX_W * sizeof(int) );

    for ( int i = 0; i < N; i++ ) {
	scanf("%d %d", &v[i], &w[i]);
    }

    for ( int i = 0; i < N; i++ ) {
	for ( int j = W; j >= w[i]; j-- ) { // ??????????????´??°???????????¨??§1?????§??????
	    dp[j] = max( dp[j], dp[j - w[i]] + v[i] );
	}
    }
    
    printf("%d\n", dp[W]);
    return 0;
}

Measured memory_bytes: 1072
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();

        Set<Integer> set = new HashSet<>();
        for(int i=0; i<N; i++){
            Integer A = nextInt();
            if(set.contains(A)) set.remove(A);
            else set.add(A);
        }

        println(set.size());
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(i) cin >> a[i];
  
  int maxi = -1;
  int maxa = 0;
  for(i) maxa = max(maxa, a[i]);
  for(i){
    if(a[i] == maxa){
      if(maxi == -1){
        maxi = i;
      }
      else{
        for(j) cout << maxa << endl;
        return 0;
      }
    }
  }
  
  for(i){
    if(i != maxi){
      cout << maxa << endl;
    }
    else{
      int tempmax = 0;
      for(j){
        if(j != i){
          tempmax = max(tempmax, a[j]);
        }
      }
      cout << tempmax << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2432
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  if (a >= k) {
    ans = k;
  } else if (a + b >= k) {
    ans = a;
  } else {
    ans = 2 * a + b - k;
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3652
n=int(input())
a=list(input().split())
for i in range(n):
    a[i]=int(a[i])
a.sort(reverse=True)
total=0
for i in range(n):
    if i%2==0:
        total=total+a[i]
    else:
        total=total-a[i]
print(total)


Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >>N;
  string S,T;
  cin>>S>>T;
  string U;
  for(int i=0;i<N;i++){
    U+=S[i];
    U+=T[i];
  }
  cout<<U;
  return 0;
}

Measured memory_bytes: 256
import collections,sys
d=collections.deque()
input()
for e in sys.stdin.readlines():
 if'i'==e[0]:d.appendleft(e.split()[1])
 else:
  if' '==e[6]:
   m=e.split()[1]
   if m in d:d.remove(m)
  elif len(e)%2:d.pop()
  else:d.popleft()
print(*d)


Measured memory_bytes: 212232
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define pi (acos(-1))
// https://atcoder.jp/contests/abc172/tasks/abc172_d
int main() { 
int n;int a;
int ans=0;
std::cin>>n;
for(int i=0;i!=n;++i){
        std::cin>>a;
        if(((i+1)%2==1)&&a%2!=0){
ans++;    
        }}
std::cout<<ans<<std::endl;
return 0;
} 

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

int main() {
	string s,t;
	cin >> s >> t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	reverse(t.begin(),t.end());
	if(s<t){
		cout << "Yes";
	}else{
		cout << "No";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif
ll a[50];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  ll k;
  cin>>k;
  cout<<50<<endl;
  rep(i,0,50) a[i]=k/50+i;
  k%=50;
  while(k--)
    {
      ll mnind=-1,mn=LLONG_MAX;
      rep(i,0,50)
	if(a[i]<mn) mn=a[i],mnind=i;
      rep(i,0,50)
	{
	  if(i==mnind) a[i]+=50;
	  else a[i]--;
	}
    }
  rep(i,0,50) cout<<a[i]<<" "; cout<<endl;
  return 0 ;
}


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const data = input.split(' ');

function lastStr(str) {
   const length = str.length;
  return str.substring(length-1);
}

if(
  lastStr(data[0]) === data[1].substring(0,1) &&
  lastStr(data[1]) === data[2].substring(0,1) ){
  console.log('YES');
}else {
  console.log('NO');
}

Measured memory_bytes: 7372
import           System.IO
import           Text.Printf
import           Data.List
import           Control.Monad

yami :: Double -> Double
yami n = n * 1.05

round3 :: Double -> Double
round3 n = 1000 * (fromIntegral $ ceiling $ n / 1000)

next = round3 . yami

main = do
  n <- readLn
  print $ ceiling $ foldl (\acc -> \_ -> next acc) 100000 [1..n]



Measured memory_bytes: 3776
MOD = 998244353
def modpow(x,n)
  ret = 1
  while n > 0
    ret = ret*x % MOD if n&1 == 1
    x = x*x % MOD
    n >>= 1
  end
  return ret
end

n = gets.to_i
d = gets.split.map(&:to_i)
if d[0] != 0
  p 0
  exit
end

cnt = [0]*n
d.each do |v|
  if v >= n
    p 0
    exit
  end
  cnt[v] += 1
end

if cnt[0] > 1
  p 0
  exit
end

ans = 1
prev = 1
sum = 0
cnt.each do |v|
  sum += v
  ans *= modpow(prev,v)
  ans %= MOD
  prev = v
  if v == 0
    if sum != n
      p 0
      exit
    end
    break
  end
end

p ans

Measured memory_bytes: 8844
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  if(n>=30)cout<<"Yes"<<ENDL;
  else cout<<"No"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 30005;
const int mod = 998244353;
const int dx[4] = {0, -1, 0, 1}, dy[4] = {1, 0, -1, 0};

int n, q, k, a[MAXN];

bool trial(int l, int r){
	int cnt = 0;
	for(int i=0; i<n;){
		if(a[i] < l){
			i++;
			continue;
		}
		int e = i;
		while(e < n && a[e] >= l) e++;
		if(e - i >= k){
			int tcnt = 0;
			for(int j=i; j<e; j++){
				if(a[j] <= r) tcnt++;
			}
			cnt += min(tcnt, e - i - k + 1);
		}
		i = e;
	}
	return cnt >= q;
}

vector<int> crd;

int main(){
	cin >> n >> k >> q;
	for(int i=0; i<n; i++){
		cin >> a[i];
		crd.push_back(a[i]);
	}
	sort(crd.begin(), crd.end());
	crd.resize(unique(crd.begin(), crd.end()) - crd.begin());
	int ret = 1e9;
	int e = 0;
	for(int i=0; i<crd.size(); i++){
		while(e < crd.size() && !trial(crd[i], crd[e])) e++;
		if(e < crd.size()) ret = min(ret, crd[e] - crd[i]);
	}
	cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int n;
    cin >> n;
    int ans = 0;
    while(n > 0) {
        if (n % 10 == 2) ans++;
        n /= 10;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){c=Getchar();rev|=c=='-';if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------------------------head--------------------------------------------------

const int inf=0x3f3f3f3f;
const int N=1000005,M=100005,mod=998244353;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,m,fac[N],ifac[N];

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	n=1000000;fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=(ll)fac[i-1]*i%mod;
	ifac[n]=exp(fac[n],mod-2);
	for(int i=n;i;i--) ifac[i-1]=(ll)ifac[i]*i%mod;
	read(n,m);
	int ans=0;
	for(int i=1;i<=min(n,m);i++)
		ch(ans,(ll)ifac[i]*ifac[i]%mod*ifac[n-i]%mod*ifac[m-i]%mod*fac[i*2-1]%mod*fac[n+m-2*i]%mod*i);
	ans=(ll)ans*fac[n]%mod*fac[m]%mod*ifac[n+m]%mod;
	ch(ans,max(n,m));
	print(ans);
	return 0;
}

Measured memory_bytes: 8064
def fast_pow(x, n, MOD):
    res = 1
    while n:
        if n & 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1
    return res
  

MOD = 10**9+7

n = int(input())

a = fast_pow(10, n, MOD)
b = fast_pow(8, n, MOD)
c = fast_pow(9, n, MOD)
print((a - 2*c + b)% MOD)

Measured memory_bytes: 9100
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    int maxi = max(a+b,a-b);
    cout << max(maxi,a*b);
    
    
    cout << endl;
}


Measured memory_bytes: 256