akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>
int main(void){
	int n,i;
	double sum=0,b[1001],ave;
	while(1){
		scanf("%d",&n);
		if(n==0)
			return 0;
		for(i=0;i<n;i++){
			scanf("%lf",&b[i]);
			sum += b[i];}
		ave = sum/n; sum=0;
		for(i=0;i<n;i++)
			sum += (b[i]-ave)*(b[i]-ave);
		printf("%f\n",sqrt(sum/n)); sum=0;
	}
}

Measured memory_bytes: 664
#include<iostream>
#include<string>
#include <cstdio>
#include<vector>
#include<map>
#include<utility>
#include<list>
#include<algorithm>
#include <ctype.h>
#include<deque>
using namespace std;
using ll = long long int;

int x, y, z, k;
vector<ll> a, b, c;
vector<ll> input(int n) {
	vector<ll> ret;
	for (int i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		ret.push_back(tmp);
	}
	return ret;
}

int main(void) {
	cin >> x >> y >> z >> k;
	a = input(x);
	b = input(y);
	c = input(z);

	//sort(a.begin(), a.end(), greater<ll>());
	//sort(b.begin(), b.end(), greater<ll>());
	//sort(c.begin(), c.end(), greater<ll>());
	int cnt = 0;
	vector<ll> ab;
	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			ab.push_back(a[i] + b[j]);
		}
	}
	sort(ab.begin(), ab.end(), greater<ll>());
	if (y > k)
		ab.assign(ab.begin(), ab.begin() + k);
	int n = min(x * y, k);
	int m = min(z, k);
	vector<ll> abc;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			abc.push_back(ab[i] + c[j]);
		}
	}
	sort(abc.begin(), abc.end(), greater<ll>());
	for (int i = 0; i < k; i++) {
		cout << abc[i] << endl;
	}
	return 0;
}

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

int main(){
    ll N;
    ll answer = 0;
    ll mn = 1001001001001;
    cin >> N;
    vector<ll> A(N);
    rep(i, N){
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    for(int i = 1; i < N; i++){
        answer += A[i/2];
    }
    cout << answer << endl;
}


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

int N;
int A[210];
int main()
{
        cin >> N;
        for (int i=0;i<N;++i) {
            cin >> A[i];
        }
        int cnt = 0;
        for(int i=0;i<N;++i){
            cnt |= A[i];
        }  
        int ans = 0;
        while(true){
            if((cnt>>ans)&1) break;
            ans++;
        }
       
       
       
       
        cout << ans << endl;
        return 0;
}   

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

using namespace std;

void solve()
{
	char x, y, ans;
	int N;
	cin >> N;
	cin >> x >> y;
	if (y == 'F' && x == 'T')
	{
		x = 'F';
	}
	else x = 'T';
	for (int i = 0; i < N - 2; i++)
	{
		cin >> y;
		if (y == 'F' && x == 'T')
		{
			x = 'F';
		}
		else x = 'T';
	}
	cout << x << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  long long m=x%d;
  long long n=(x-m)/d;
  if(n<=k){
    if(n%2==k%2) cout<<m;
    else cout<<d-m;
  }else cout<<abs(x-d*k);
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
/*freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);*/
#define ll long long
const int inf=0x3f3f3f3f;
const int maxc=500010;
#define mod 1000000007
int main()
{
    int n;
    cin>>n;
    int a[100];
    int b[100];
    int sum=0;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    for(int i=0;i<n;i++){
        if(a[i]-b[i]>0)
            sum+=a[i]-b[i];
    }
    cout<<sum<<endl;
    return 0;
}


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

void solve() {
    int N;
    cin >> N;
    vector<int> b(N), ans(N);
    for (int i = 0; i < N; i++) cin >> b.at(i);
    for (int i = N - 1; i >= 0; i--) {
        int f = 0;
        for (int j = i; j >= 0; j--) {
            if (b.at(j) > j + 1) {
                cout << -1 << endl;
                return;
            }
            if (b.at(j) == j + 1) {
                ans.at(i) = j + 1;
                b.erase(b.begin() + j);
                f = 1;
                break;
            }
        }
        if (f == 0) {
            cout << -1 << endl;
            return;
        }
    }
    for (int i = 0; i < N; i++) cout << ans.at(i) << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
const ll mod = 1e9+7;
const ll INF = 100000000009;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h,n; cin >> h >> n;
	vec<ll> damage(n),mp(n);
	rep(i,n)cin >> damage[i] >> mp[i];
	ll dp[100010];
	rep(i,100010)dp[i] = INF;
	dp[0] = 0;
	ll dm = 0; rep(i,n)dm = max(dm,damage[i]);
	rep(m,h+dm+1){
		rep(j,n){
			if(m >= damage[j]) dp[m] = min(dp[m-damage[j]] + mp[j],dp[m]);		
		}
	}
	ll ans = dp[h];
	for(ll i = h;i<=h+dm;i++){
		ans = min(ans,dp[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main() {
    int N;
    string S;

    cin >> N >> S;

    vector<int> counterSharpToDot(N);
    vector<int> counterDotToSharp(N);

    counterSharpToDot[0] = 0;
    counterDotToSharp[0] = 0;

    for (int i = 0; i < N - 1; ++i) {
        counterSharpToDot[i + 1] = counterSharpToDot[i];
        if (S.substr(i, 1) == "#") {
            ++counterSharpToDot[i + 1];
        }
    }

    reverse(S.begin(), S.end());

    for (int i = 0; i < N - 1; ++i) {
        counterDotToSharp[i + 1] = counterDotToSharp[i];
        if (S.substr(i, 1) == ".") {
            ++counterDotToSharp[i + 1];
        }
    }

    reverse(counterDotToSharp.begin(), counterDotToSharp.end());




    int min = N;
    for (int i = 0; i < N; ++i) {
        int num = counterDotToSharp[i] + counterSharpToDot[i];
        if (min > num) {
            min = num;
        }
    }
    cout << min << endl;

    return 0;
}



Measured memory_bytes: 2308
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
	int ans = A * B;
	cout << ans << endl;

}







Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  	int a,b;
	cin >> a >> b;
  	double m = 0.5*(a+b);
    double k = m-(int)m;
  	int l = (k>=0.5?(int)m+1:(int)m);
   	cout << l << endl;
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
#define rep(i, s, n) for(i64 i=(s); i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;

signed main()
{
  string s;
  cin >> s;

  auto f = [](char c) { return c == 'A' || c == 'C' || c == 'G' || c == 'T'; };

  int ans = 0;
  int cnt = 0;
  for (char c : s) {
    if (f(c)) {
      ++cnt;
    } else {
      cnt = 0;
    }
    chmax(ans, cnt);
  }

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



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000001
using namespace std;
typedef long long ll;

int main(){
  ll k, a, b;  cin >> k >> a >> b;
  ll ans = 1+k;
  ll biscuit = 1;
  while(k-2>=a-biscuit and k>1){
    if(biscuit < a){
      k -= a-biscuit;
      biscuit += a-biscuit;
    }
    biscuit += b-a;
    k-=2;
  }
  ans = max(ans, biscuit+k);
  cout << ans << endl;
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N, M;
    cin >> N >> M;
    int s[11][11];
    REP(i,M) REP(j,M) s[i][j] = -1;
    REP(i,M){
        int k;
        cin >> k;
        REP(j,k){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    int p[11];
    REP(i,M) cin >> p[i];

    int ans = 0;
    REP(i,1<<N){
        int sum[11];
        REP(i,M) sum[i] = 0;
        REP(j,N){
            if(i & (1<<j)){
                REP(k,M){
                    REP(l,M) if(s[k][l] == j) sum[k]++;
                }
            }
        }
        bool can = true;
        REP(m,M) if(sum[m] % 2 != p[m]) can = false;
        if(can) ans++;
    }
    cout << ans << endl;
}

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

typedef complex<double> Point;
typedef vector<Point> VP;
#define X real()
#define Y imag()

double cross(Point a, Point b) {
  return a.X*b.Y - a.Y*b.X;
}

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

// ???????§???¢?????´?????????????????????
pair<int, int> convexDiameter(const VP& ps) {
  int n = ps.size();
  int i = min_element(ps.begin(), ps.end()) - ps.begin();
  int j = max_element(ps.begin(), ps.end()) - ps.begin();
  int maxI, maxJ;
  double maxD = 0;
  rep(_, 2*n) {
    if (maxD < norm(ps[i]-ps[j])) {
      maxD = norm(ps[i]-ps[j]);
      maxI = i;
      maxJ = j;
    }
    if (cross(ps[i]-ps[(i+1) % n], ps[(j+1) % n]-ps[j]) <= 0) j = (j+1) % n;
    else                                                      i = (i+1) % n;
  }
  return make_pair(maxI, maxJ);
}


int main(void){
    int n;
    double x,y;
    cin>>n;
    VP ch(n);
    rep(i,n){
        cin>>x>>y;
        ch[i] = {x,y};
    }

    pair<int,int> pp = convexDiameter(ch);
    printf("%.9f\n",abs(ch[pp.first]-ch[pp.second]));
    return 0;
}

Measured memory_bytes: 4028
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
    //k:連続で塗られている個数
    //x:塗られている座標
    int k,x;
    cin >> k >> x;
    
    //2k-1個の石に可能性がある
    vector<int> stones(2*k-1);
    for(int i = 0; i < 2*k-1; i++){
        stones.at(i) = x - (k - 1) + i;
    }
    for(int i = 0; i < 2*k-1; i++){
        cout << stones.at(i);
        cout << " ";
    }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll x, y;
	cin >> x >> y;
	int cnt = 1;
	while((x * 2) <= y) x *= 2, cnt++;
	cout << cnt << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CS_AtCoder {
	class Program {
		static void Main(string[] args) {
			new Calc().Solve();
		}
	}
	public class Calc {
		public Calc() { }
		public void Solve() {
			string Sa = Console.ReadLine();
			string Sb = Console.ReadLine();
			string Sc = Console.ReadLine();
			char next = 'a';
			while (true) {
				if (next == 'a') {
					if (Sa.Length == 0) break;
					next = Sa[0];
					Sa = Sa.Remove(0, 1);
				} else if (next == 'b') {
					if (Sb.Length == 0) break;
					next = Sb[0];
					Sb = Sb.Remove(0, 1);
				} else {
					if (Sc.Length == 0) break;
					next = Sc[0];
					Sc = Sc.Remove(0, 1);
				}
			}
			Char.ToUpper(next).WL();
			return;
		}
	}
	public static class Utils {
		public static int ReadInt() => int.Parse(Console.ReadLine());
		public static void WL(this object obj) {
			Console.WriteLine(obj);
		}
	}
}


Measured memory_bytes: 11092
import java.awt.*;
import java.io.*;
import java.util.*;

public class Main {
    static int x,y,a,b,c;
    static Long aa[],bb[],cc[];
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        x=sc.nextInt();y=sc.nextInt();a=sc.nextInt();b=sc.nextInt();c=sc.nextInt();
        aa=new Long[a];
        bb=new Long[b];cc=new Long[c];
        for (int i=0;i<a;i++)aa[i]=sc.nextLong();
        for (int i=0;i<b;i++)bb[i]=sc.nextLong();
        ArrayList<Long> arr=new ArrayList<>();
        for (int i=0;i<c;i++)arr.add(sc.nextLong());
        Arrays.sort(aa, new Comparator<Long>() {
            @Override
            public int compare(Long o1, Long o2) {
                long z=o2-o1;
                if (z>0)return 1;
                else return -1;
            }
        });Arrays.sort(bb, new Comparator<Long>() {
            @Override
            public int compare(Long o1, Long o2) {
                long z=o2-o1;
                if (z>0)return 1;
                else return -1;
            }
        });
        for (int i=0;i<Math.min(x,a);i++)arr.add(aa[i]);
        for (int i=0;i<Math.min(y,b);i++)arr.add(bb[i]);
        Collections.sort(arr,Collections.reverseOrder());
        long sum=0;
        for (int i=0;i<x+y;i++){
            sum+=arr.get(i);
        }
        System.out.println(sum);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 65480
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  string o,e;
  cin >> o >> e;

  rep(i,sz(o))
  {
    if(i < sz(o))
      cout << o[i] ;
    if(i < sz(e))
      cout << e[i] ;
  }

  cout << endl;
  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    
    int k, i, j, ii, jj, n, x, y;
   
    cin >> n;
    
    vector<vector<int>> g(n, vector<int>(n, -1));
    
    
    for(i = 0; i < n; ++i)
    {
        cin >> k;
        g[i][i] = 1;
        for(j = 0; j < k; ++j)
        {
            cin >> x >> y;
            --x;
            g[i][x] = y;
        }
    }
    
    int mask, sz, copy, cur_ans;
    k = 0;
    sz = 1 << n;
    
    bool flag;
    
    vector<int> ans;
    
    for(mask = 0; mask < sz; ++mask)
    {
        copy = mask;
        i = 0;
        ans.clear();
        while (copy)
        {
            if (copy % 2 == 1)
            {
                ans.push_back(i);
            }
            copy = copy  >> 1;
            ++i;
        }
        for (j = 0; j < n; ++j)
        {
            cur_ans = -1;
            flag = true;
            for(i = 0; i < ans.size(); ++i)
            {
                x = g[ans[i]][j];
                if ((x == -1) || (cur_ans == -1) || (x == cur_ans))
                {
                    if (x != -1)
                    {
                        cur_ans = x;
                    }
                }
                else
                {
                    flag = false;
                    j = n;
                    break;
                }
            }
            if (flag)
            {
                if ((cur_ans != -1) && (cur_ans != count(ans.begin(), ans.end(), j)))
                {
                    flag = false;
                    break;
                }
            }
        }
        if (flag)
        {
            k = max({(int)ans.size(), k});
        }
    }
    
    cout << k;
    

    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <variant>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll r,c,k;
  cin>>r>>c>>k;
  vector mat(r, vecll(c));
  REP(i,k) {
    ll y,x,v;
    cin>>y>>x>>v;
    --y;--x;
    mat[y][x] = v;
  }
  vector dp(4, vecll(c));
  vector nx(4, vecll(c));
  REP(i,r) {
    REP(i,4) nx[i].assign(c, 0);
    REP(j,c) {
      REP(m,3) {
        if (j > 0) {
          nx[m+1][j] = max(nx[m+1][j], nx[m][j-1] + mat[i][j]);
        }
      }
      REP(m,4) {
        if (j > 0) {
          nx[m][j] = max(nx[m][j], nx[m][j-1]);
        }
        nx[0][j] = max(nx[0][j], dp[m][j]);
        nx[1][j] = max(nx[1][j], dp[m][j] + mat[i][j]);
      }
    }
    swap(dp, nx);
  }
  ll mx = 0;
  REP(i,4) {
    mx = max(mx, dp[i][c-1]);
  }
  cout<<mx<<endl;
  return 0;
}


Measured memory_bytes: 74172
def selectionSort(A, N):
    cnt = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if A[i] != A[minj]:
            cnt += 1
        A[i], A[minj] = A[minj], A[i]
    print(*A)
    print(cnt)


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

selectionSort(A, N)



Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

vector<int> primes;

void siv(){
	vector<int> siv(N,0);
	for(int i=2; i<N; ++i){
		if( siv[i] == 0 ){
			primes.push_back(i);
			for(int j=i+i; j < N; j +=i){
				siv[j] = 1;
			}
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	siv();
	cin>>n;
	cout<<*lower_bound(primes.begin(),primes.end(),n)<<'\n';

	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
struct edge_t {
  int u, v, w;
  edge_t() = default;
  edge_t(int u, int v, int w) : u(u), v(v), w(w) {}
  friend bool operator<(const edge_t &lhs, const edge_t &rhs) {
    return lhs.w < rhs.w;
  }
};
int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> pts(n);
  for (auto &p : pts) cin >> p.first >> p.second;
  sort(pts.begin(), pts.end());
  pts.resize(unique(pts.begin(), pts.end()) - pts.begin());
  n = pts.size();
  int64_t cost = 0;
  vector<int> p(n, -1), r(n, 1);
  function<int(int)> find = [&](int x) {
    if (p[x] == -1) return x;
    return p[x] = find(p[x]);
  };
  auto merge = [&](int x, int y) {
    int xg = find(x), yg = find(y);
    if (xg == yg) return false;
    if (r[xg] < r[yg]) {
      p[xg] = yg;
    } else if (r[xg] > r[yg]) {
      p[yg] = xg;
    } else {
      r[xg] += 1;
      p[yg] = xg;
    }
    return true;
  };
  vector<edge_t> edges;
  {
    for (int i = 1; i < n; ++i) {
      edges.emplace_back(i - 1, i, pts[i].first - pts[i - 1].first);
    }
    auto vt = pts;
    sort(vt.begin(), vt.end(), [&](pair<int, int> lhs, pair<int, int> rhs) {
      return make_pair(lhs.second, lhs.first) < make_pair(rhs.second, rhs.first);
    });
    for (int i = 1; i < n; ++i) {
      int u = lower_bound(pts.begin(), pts.end(), vt[i]) - pts.begin();
      int v = lower_bound(pts.begin(), pts.end(), vt[i - 1]) - pts.begin();
      edges.emplace_back(v, u, vt[i].second - vt[i - 1].second);
    }
  }
  sort(edges.begin(), edges.end());
  for (auto &[u, v, w] : edges) {
    if (merge(u, v)) {
      cost += w;
    }
  }
  cout << cost << '\n';
  return 0;
}

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

int gcd(int a, int b) {
  if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

int main() {
  int k;
  cin >> k;
  long long int sum = 0;

  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      int g = gcd(max(a,b),min(a,b));
      for (int c = 1; c <= k; c++) {
        int i = min(g,c);
        int j = max(g,c);
        sum += gcd(j,i);
      }
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 3636
function main(input) {
    const args = input.split(' ');
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);
	 var arr=[]
 arr[0]=build(a,b);
 arr[1]=build(b,a);
	arr.sort()
 
	console.log(arr[0])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
 
function build (num1,num2){
  tmp=''
  for(var i=0;i<num2;i++){
     tmp+=num1;
  }
  return tmp;
}

Measured memory_bytes: 7372
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ans = 1;
		int check = 0;
		long[] a = new long[n];
		for(int i = 0; i < a.length; ++i){
          a[i] = sc.nextLong();
          if(a[i]==0){
              check = 1;
          }
        }
        int[] b = new int[18];
        for(int j=0; j<18; ++j){
            b[j] = 10;
        }
        long num = 1;
        for(int j=0; j<18; ++j){
            num = num*b[j];
        }
         for(int i=0; i<n; ++i){
           if(a[i]<=num/ans){
            ans = ans*a[i];
           }else{
             ans=0;
          	break;
           }
         }
         if(check == 0){
             if(ans == 0){
             System.out.println("-1");
            }else{
              System.out.println(ans);
            }
         }else{
             System.out.println("0");
         }
	}
}


Measured memory_bytes: 62172
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        mut s: Chars
    };
    s.sort();
    let mut ss = s.clone();
    ss.dedup();
    println!("{}", ["no", "yes"][(s.len() == ss.len()) as usize]);
}


Measured memory_bytes: 2148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
const int INF = 2147483647;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int h, w;
int c[10][10];

int main()
{
	cin >> h >> w;

	for(int i=0;i<10;i++)
		for (int j = 0;j < 10;j++) {
			cin >> c[i][j];
		}

	for (int k = 0;k < 10;k++)
	  for (int i = 0;i<10;i++)
		for (int j = 0;j < 10;j++) {
				c[i][j] = std::min(c[i][j], c[i][k] + c[k][j]);
			}

	ll ans = 0;

	for (int i = 0;i < h;i++)
		for (int j = 0;j < w;j++) {
			int t;
			cin >> t;

			if (t != 1 && t != -1) {
				ans = ans + (ll) c[t][1];
			}
		}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define repi(i,a) for(auto i = a.begin(); i!= a.end() ;++i) 
#define repdi(i,a) for(auto i = a.rbegin(); i!=a.rend();++i) 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define INF 1e18
#define sz(a) (int)a.size() 
#define all(a) a.begin(),a.end()
#define mod 998244353
#define limit 1000
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  

typedef vector<ll> vll;
typedef pair<ll,ll> pii;
typedef vector<pii> vpi;
typedef vector<vector<ll> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
ll dp[100005][105],a[100005],b[100005],w,n;

ll ans(int i,int wt) {
	if(wt<0) return -INF;
	if(i==n or w==0) return 0;
	if(dp[wt][i]!=-1) return dp[wt][i];
	return dp[wt][i] = max(b[i]+ans(i+1,wt-a[i]),ans(i+1,wt)); 
}

void solve() {
	cin >> n >>w ;
	rep(i,0,n) cin >> a[i] >> b[i] ;
	fl(dp,-1);
	cout << ans(0,w) ;
}

int32_t main() {

    fast; 
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int h, w, k;
ll dp[900][105], m[] = {1, 1, 2, 3, 5, 8, 13, 21};

int main() {
  cin >> h >> w >> k;

  dp[0][0] = 1;
  REP(i, h) {
    REP(j, w) {
      dp[i][j] %= MOD;
      if (j != 0) {
        dp[i + 1][j + 1] += dp[i][j] * m[j] * m[max((ll)0, w - j - 2)];
        dp[i + 1][j] += dp[i][j] * m[j] * m[w - j - 1];
        dp[i + 1][j - 1] += dp[i][j] * m[max((ll)0, j - 1)] * m[w - j - 1];
      } else if (j == 0) {
        dp[i + 1][j + 1] += dp[i][j] * m[max((ll)0, w - j - 2)];
        dp[i + 1][j] += dp[i][j] * m[w - j - 1];
      }
    }
  }

  cout << dp[h][k - 1] % MOD << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
	long long a,b;
	cin >> a >> b;
	
	int k = (a+b)/2;
	
	if((a+b)%2 == 1) cout << "IMPOSSIBLE\n";
	else cout << k << endl;
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
nums = map(int, raw_input().split())

sums = [0] * (n + 1)
xors = [0] * (n + 1)

for i in xrange(n):
    sums[i + 1] = sums[i] + nums[i]
    xors[i + 1] = xors[i] ^ nums[i]

results = 0

for i in xrange(0, n):
    left, right = i + 1, n + 1
    while right - left > 1:
        mid = (left + right) / 2
        if sums[mid] - sums[i] == xors[mid] ^ xors[i]:
            left = mid
        else:
            right = mid
    results += left - i

print results

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long

int main(void)
{
    string s; cin>>s;
    if(s[1]=='B')cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 3588
// ProblemURL : https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	ok := a == b && b == c
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, sum, k, q, u, v;
ll ta[ohara], ao[ohara];
V g[ohara];
bool vi[ohara];

void dfs1(ll now, ll dep) {
  if (ta[now] != -1) return;
  ta[now] = dep;
  rep(i, Size(g[now])) {
    ll to = g[now][i];
    dfs1(to, dep + 1);
  }
}

void dfs2(ll now, ll dep) {
  if (ao[now] != -1) return;
  ao[now] = dep;
  rep(i, Size(g[now])) {
    ll to = g[now][i];
    dfs2(to, dep + 1);
  }
}

void dfs(ll now) {
  if (vi[now]) return;
  vi[now] = true;
  if (ta[now] < ao[now]) {
    if (Size(g[now]) != 1) ans = max(ans, ao[now]);
    rep(i, Size(g[now])) {
      ll to = g[now][i];
      dfs(to);
    }
  } else {
    if (ta[now] == ao[now]) ans = max(ans, ao[now]);
  }
}

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

  cin >> n >> u >> v;
  u--;
  v--;
  rep(i, n - 1) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]].p_b(b[i]);
    g[b[i]].p_b(a[i]);
  }
  rep(i, ohara) ta[i] = -1, ao[i] = -1;
  dfs1(u, 0LL);
  dfs2(v, 0LL);
  // rep(i, n) Cout(ta[i]);

  dfs(u);
  Cout(ans);
  return 0;
}

Measured memory_bytes: 49536
#include <bits/stdc++.h>
#define ll long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INt_MAX
#define inf llONG_MAX
#define PI acos(-1)
#define fir first
#define sec second
using namespace std;

const int N = 2e5 + 10;

pair < ll, ll > v[N], tmp;
ll a[N];
ll dp[100];

bool cmp(pair < ll, ll > A, pair < ll, ll > B) {
    return A.fir * (B.sec + 1) > B.fir * (A.sec + 1);
}

void solve() {

    int n; ll t;
    scanf("%d %lld", &n, &t);
    int cnt1 = 0, cnt2 = 0;
    rep(i, 1, n) {
        scanf("%lld %lld", &tmp.fir, &tmp.sec);
        if(tmp.fir == 0) a[++ cnt2] = tmp.sec + 1;
        else v[++ cnt1] = tmp;
    }

    sort(a + 1 , a + cnt2 + 1);
    sort(v + 1, v + cnt1 + 1, cmp);

    rep(i, 1, 30) dp[i] = t + 1;
    dp[0] = 0;
    rep(i, 1, cnt2 ) a[i] += a[i - 1];

    rep(i, 1, cnt1 ) {
        dep(j, 1, 30) {
            dp[j] = min(dp[j], (v[i].fir + 1) * (dp[j - 1] + 1) + v[i].sec);
        }
    }

    int ans = 0 ;
    for(int i = 0 ;i <= 30 ;i ++)
     {
       if(dp[i] > t) continue ;
       int j = 0 ;
       if(cnt2)
        j = upper_bound(a + 1 , a + cnt2 + 1 , t - dp[i]) - a - 1;
       ans = max(ans , i + j) ;
     }
    printf("%d\n", ans);
    return ;
}
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll> p1;

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

    ll A,B;
    cin >> A >> B;
    if(A%2 == B%2) {
        cout << (A+B)/2 << endl;
    } else {
        cout << "IMPOSSIBLE"<< endl;
    }
    return 0;
}


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

int main() {
	ll A, B, x = 0, y = 0, z = 0, max = 0;
	cin >> A >> B;
	x = A + B;
	y = A - B;
	z = A*B;
	if (x >= y) {
		if (x >= z)cout << x << endl;
		else cout << z << endl;
	}
	else {
		if (y >= z)cout << y << endl;
		else cout << z << endl;
	}
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

long long q, h, s, d;
long long n;

int main() {
    cin >> q >> h >> s >> d;
    cin >> n;

    long long best1 = min(min(s, h * 2),  q * 4);
    long long best2 = min(d, best1 * 2);

    cout << (n / 2) * best2 + (n % 2) * best1 << endl;
    
    return 0;
}


Measured memory_bytes: 256
N,K= list(map(int, input().split()))
Ps = list(map(int, input().split()))

ruisekiwa = [0]

for P in Ps:
    ruisekiwa.append(P + ruisekiwa[-1])

#print(ruisekiwa)
ans = 0
for i in range(N-K+1):
    ans = max(ans, (ruisekiwa[i+K] - ruisekiwa[i] + K) / 2)
#    print(ans)
print(ans)

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

template<class Val, class Upd, class Map>
struct SegTreeLazy {
    int n;
    vector<Val> data, lazy;
    vector<bool> isLazy;
    Upd upd;
    Map mp;
    const Val Lim;
    explicit SegTreeLazy(int n_, const Val& lim = Val())
        : upd(Upd()), mp(Map()), Lim(lim) { init(n_);}
    void init(int n_) { // 0 init
        for(n = 1; n < n_; n <<= 1);
        data.assign(2 * n - 1, Lim);
        lazy.assign(2 * n - 1, Val());
        isLazy.assign(2 * n - 1, false);
    }
    inline void setLazy(int cn, Val x) {
        isLazy[cn] = true;
        lazy[cn] = upd(lazy[cn], x);
        data[cn] = upd(lazy[cn], x);
    }
    inline void push(int cn) {
        if(isLazy[cn] == false) return;
        setLazy(cn * 2 + 1, lazy[cn]);
        setLazy(cn * 2 + 2, lazy[cn]);
        lazy[cn] = Val();
        isLazy[cn] = false;
    }
    // operation : upd [ql, qr) by x
    // current node : cn [cl, cr)
    void updrange(int ql, int qr, const Val& x) {
        updrange(ql, qr, x, 0, 0, n);
        return;
    }
    void updrange(int ql, int qr, const Val& x, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return;
        if(ql <= cl && cr <= qr) {
            setLazy(cn, x);
            return;
        }
        push(cn);
        updrange(ql, qr, x, cn * 2 + 1, cl, (cl + cr) / 2);
        updrange(ql, qr, x, cn * 2 + 2, (cl + cr) / 2, cr);
        data[cn] = mp(data[cn * 2 + 1], data[cn * 2 + 2]);
    }
    Val query(int ql, int qr) {
        return query(ql, qr, 0, 0, n);
    }
    Val query(int ql, int qr, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return Lim;
        if(ql <= cl && cr <= qr) return data[cn];
        push(cn);
        Val a = query(ql, qr, cn * 2 + 1, cl, (cl + cr) / 2);
        Val b = query(ql, qr, cn * 2 + 2, (cl + cr) / 2, cr);
        return mp(a, b);
    }
};

template<class T> // no requirement 
struct updater {
    T operator ()(const T& a, const T& b) { return b;}
};

template<class T> // requirement : operator +
struct adder {
    T operator ()(const T& a, const T& b) { return a + b;}
};

template<class T>
struct mpmin { // requirement : operator <
    T operator ()(const T& a, const T& b) { return a < b ? a : b;}
};

template<class T>
struct mpmax { // requirement : operator <
    T operator ()(const T& a, const T& b) { return a < b ? b : a;}
};

using SegTree = SegTreeLazy<int, updater<int>, mpmin<int>>;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegTree seg(n, 2147483647);
    while(q--) {
        int k;
        cin >> k;
        if(k) {
            int l, r;
            cin >> l >> r;
            ++r;
            cout << seg.query(l, r) << '\n';
        }
        else {
            int l, r, x;
            cin >> l >> r >> x;
            ++r;
            seg.updrange(l, r, x);
        }
    }
    return 0;
}

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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  std::string a, b, c;
  std::cin >> a >> b >> c;
  if (a.back() == b.front() && b.back() == c.front()) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 100010
struct S{
    int i;
    int A;
}s[MAXN];
bool cmp(S s1, S s2){
    return s1.A < s2.A;
}
int main(){
    int N;
    scanf("%d", &N);
    for(int i=1; i<=N; i++){
        scanf("%d", &s[i].A);
        s[i].i = i;
    }
    sort(s+1, s+1+N, cmp);
    for(int i=1; i<N; i++)
        printf("%d ", s[i].i);
    printf("%d\n", s[N].i);
   // system("pause");
    return 0;
}

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


int main (){
	char str[201];
	gets(str);
	int n=strlen(str);
	int i=0;
	int chk=0;
	char str1[100];
	char str2[100];
	while(chk==0){
		memset(str1,'\0',100);
		memset(str2,'\0',100);

		i+=2;
		for(int j=0;j<(n-i)/2;j++){
			str1[j]=str[j];
			str2[j]=str[j+(n-i)/2];
		}

		if(strcmp(str1,str2)==0) chk=1;	
		

	}
	printf("%d \n",n-i);
	
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main()
{
    ll N;
    input(N);
    vector<ll> X(N, 0);
    input(X);

    ll res = 1e9;
    rep(i, 1, 101)
    {
        ll sum = 0;
        rep(j, 0, N)
        {
            sum += (X[j] - i) * (X[j] - i);
        }
        res = min(res, sum);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
y, m, d=(int(i) for i in input().split("/"))
if y<2019:
    print("Heisei")
elif y==2019 and m<4:
    print("Heisei")
elif y==2019 and m==4 and d<=30:
    print("Heisei")
else:
    print("TBD")

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

int power10(int n)
{
	int i,result=1;
	for(i=0;i<n;i++)
	{
		result*=10;
	}
	return result;
}

int main()
{
	char str[82];
	int i,len,power,ans=0;

	while(fgets(str,82,stdin)!=NULL)
	{
		power=0;
		len=strlen(str)-1;

		for(i=len-1;i>=0;i--)
		{
			if(*(str+i)>='0'&&*(str+i)<='9')
			{
				ans+=((int)(str[i]-'0'))*power10(power);
				power++;
			}
			else
			{
				power=0;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}



int check(int n) {

	int temp = n + 9;

	temp = temp / 10;
	return temp * 10;



}

bool comp(pair<string,pair<int,int>> a , pair<string,pair<int,int>> b) {


	// return a % 10 > b % 10;
	if(a.F!=b.F)
		return a.F<b.F;
	return a.S.F>b.S.F;

}
bool check(int a,int b,int c){

	set<int> s;
	s.insert(a);
	s.insert(b);
	s.insert(c);

	auto it = s.begin();
	it++;
	// cout<<*it<<endl;
	if(b==*it)
		return true;
	return false;



}

int main() {
	int i, n, m, k, c = 0;
	c_p_c();
	cin>>n;
	int a[n];
	fo(i,n) cin>>a[i];

	for (int i = 0; i < n-2; ++i)
	{
		/* code */
		if(check(a[i],a[i+1],a[i+2]))
			c++;
	}
	cout<<c<<endl;
	return 0;
}



Measured memory_bytes: 3516