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

// Order statistics tree (if supported by judge!):
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// template<class TK, class TM> using order_tree = tree<TK, TM, less<TK>, rb_tree_tag, tree_order_statistics_node_update>;
// iterator	find_by_order(int r) (zero based)
// int		order_of_key(TK v)
// template<class TV> using order_set = order_tree<TV, null_type>;

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

template<class T> int sz(const vector<T> &v) { return (int) v.size(); }

template<class T> ostream& operator<<(ostream &os, vector<T> v) {
	os << "\n[";
	for(T &x : v) os << x << ',';
	return os << "]\n";
}

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

int leading(int x) {
	if (x < 10) return x;
	else return leading(x / 10);
}

void run() {
	int N;
	cin >> N;

	int p10 = 1, np10 = 2;
	int ld = 1;
	int a = 1, fd = 0;

	ll ans = 0;
	for (; a <= N; a++) {
		if (a == 10*p10) {
			p10 = a;
			np10 = p10 * 2;
			ld = 1;
		} else if (a == np10) {
			ld++;
			np10 += p10;
		}
		if (++fd == 10) {
			fd = 0;
			continue;
		}

		// printf("%d %d %d\n", a, fd, ld);

		// assert(1 <= fd && fd < 10 && a % 10 == fd);
		// assert(leading(a) == ld);

		if (ld == fd && fd <= N) {
			// printf("%d: +1\n", a);
			ans++; // B = fd
		}

		for (int len = 0; len <= 4; len++) {
			int pb10 = 1;
			REP(_, len) pb10 *= 10;
			int b0 = fd * 10 * pb10 + ld;

			if (b0 > N) continue;

			// printf("%d %d\n", a, b0);
			int diff = (N - b0) / 10;
			ans += min(diff + 1, pb10);
		}

	}
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}


Measured memory_bytes: 256
//
// Created by maze on 2019/09/15.
//

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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

int main(void) {
    int64 N;
    cin >> N;
    vector<int> a(1 << N), must(1 << N, 0);
    REP(i, 1 << N) cin >> a[i];
    int64 cnt = 0;
    REP(i, 1 << N) {
        if (!must[i] && a[i]) {
            cnt++;
        } else if (must[i]) {
            if (a[i] == 0) {
                cout << -1 << endl;
                return 0;
            }
        }
        if (a[i]) {
            REP(j, N) {
                if (i >> j & 1) continue;
                must[i | (1 << j)] = 1;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 10992
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, s, e) for (ll i = s; i < e; i++)
#define pb push_back
#define ll long long
#define mp make_pair
bool *visited;
ll *parent;
ll ctr = 0;
ll bfs(vector<vector<ll>> &v, ll a)
{
    queue<ll> q;
    q.push(a);
    visited[a] = true;
    ll res = 0;
    while (!q.empty())
    {
        ll temp = q.front();
        res++;
        for (auto itr = v[temp].begin(); itr != v[temp].end(); ++itr)
        {
            if (visited[*itr] == false)
            {
                parent[*itr] = temp;
                q.push(*itr);
                visited[*itr] = true;
            }
        }
        q.pop();
    }
    return res;
}
int main()
{
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> v(n, vector<ll>());
    For(i, 0, m)
    {
        ll a, b;
        cin >> a >> b;
        v[a - 1].pb(b - 1);
        v[b - 1].pb(a - 1);
    }
    visited = new bool[n];
    parent = new ll[n];
    For(i, 0, n)
    {
        visited[i] = 0;
        parent[i] = -1;
    }
    ll res = 0;
    For(i, 0, n)
    {
        if (visited[i] == 0)
        {
            ll xd = bfs(v, i);
            res = max(res, xd);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 18736
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <set>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
void printAns(bool can);

/* main */
int main(){

    int n, q, k;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> k;
        auto it_low = lower_bound(a.begin(), a.end(), k);
        auto it_up = upper_bound(a.begin(), a.end(), k);
        int dist_low = distance(a.begin(), it_low);
        int dist_up = distance(a.begin(), it_up);
        cout << dist_low << ' ' << dist_up << '\n';
    }
}




Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 
const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

typedef tuple<string, int, int> T;

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

    int n; cin >> n;
    vector<T> v(n);
    for(int i=0; i<n; ++i){
        string s; cin >> s;
        int t; cin >> t;
        v[i] = make_tuple(s, -t, i+1);
    }

    sort(v.begin(), v.end());
    for(int i=0; i<n; ++i){
        cout << get<2>(v[i]) << endl;
    }
        
    return 0;
}



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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

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

    if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500005
#define mod 1000000007
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
char s[N],t[N];
int n,flag,pre[N],suf[N],ans=0;
void getfail(int *fail,char *s)
{
	fail[0]=-1;
	int i=0,j=-1;
	while(s[i]){
		if(j==-1||s[i]==s[j])fail[i+1]=j+1,i++,j++;
		else j=fail[j];
	}
}
inline bool checkpre(int pos){return pre[pos]==0||pos%(pos-pre[pos]);}
inline bool checksuf(int pos){return suf[pos]==0||pos%(pos-suf[pos]);}
int main(){
	scanf("%s",s),n=strlen(s);
	for(int i=0;i<n;++i)t[i]=s[n-i-1];
	getfail(pre,s),getfail(suf,t),t[n]='\0';
	flag=checkpre(n)?1:2;
	bool f=true;
	for(int i=1;i<n;++i)if(s[i]!=s[i-1]){f=false;break;}
	if(f)flag=n;
	cout<<flag<<'\n';
	if(flag!=2){cout<<1;return 0;}
	for(int i=0;i<n;++i){
		int tmp=n-i-1;
		if(checkpre(i+1)&&checksuf(tmp))++ans;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5120
def main
  n = gets.chomp.to_i
  n.times do
    mcxi1,mcxi2 = gets.chomp.split(' ').map{ |x| to_integer(x)}
    puts to_mcxi(mcxi1 + mcxi2)
  end
end

def to_integer mcxi
  integer = 0
  num = 1
  mcxi.each_char do |c|
    if c =~ /[2-9]/
      num = c.to_i
      next
    end

    integer += num * begin
      case c
      when 'm'; 1000
      when 'c'; 100
      when 'x'; 10
      when 'i'; 1
      end
    end
    num = 1
  end
  integer
end

def to_mcxi integer
  mcxi = ''
  m = integer / 1000
  unless m == 0
    mcxi << m.to_s unless m == 1
    mcxi << 'm'
  end

  c = integer % 1000 / 100
  unless c == 0
    mcxi << c.to_s unless c == 1
    mcxi << 'c'
  end

  x = integer % 100 / 10
  unless x == 0
    mcxi << x.to_s unless x == 1
    mcxi << 'x'
  end

  i = integer % 10 / 1
  unless i == 0
    mcxi << i.to_s unless i == 1
    mcxi << 'i'
  end

  mcxi
end

main

Measured memory_bytes: 6148
using System;

namespace abc165_b
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());
            long a = 100;
            int year = 0;
            while (a < x)
            {
                a = a + a / 100;
                year += 1;
            }
            Console.WriteLine(year);
            Console.Read();
        }
    }
}


Measured memory_bytes: 27520
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int allTest = scanner.nextInt();
		int passed = scanner.nextInt();
    if (allTest == passed) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
	}
}

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

main()
{
    int co_ordinate, sum = 0, MINIMUM_SUM = 999999;

    cin >> co_ordinate;

    int values[co_ordinate];

    for (int i = 0; i < co_ordinate; i++)
    {
        cin >> values[i];
    }

    for (int i = 0; i < 101; i++)
    {
        for (int j = 0; j < co_ordinate; j++)
        {
            sum = sum + (values[j] - i) * (values[j] - i);
        }

        MINIMUM_SUM = min(MINIMUM_SUM, sum);
        sum = 0;
    }

    cout << MINIMUM_SUM;

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 10, INF = 1e9;

vector<pii> adj[N];
int n, sz[N], cent = -1, mn = INF;
ll opt = 0, we = 0;
bool fl = false;

void dfs(int v, int p = -1){
	sz[v]++;
	int mx = -1;
	for(auto X : adj[v]){
		if(X.F == p)continue;
		dfs(X.F, v);
		opt += 2LL * min(sz[X.F] , (n - sz[X.F])) * X.S;
		if(sz[X.F] == n - sz[X.F])
			fl = true, we = X.S;
		mx = max(mx, sz[X.F]);
		sz[v] += sz[X.F];
	}
	mx = max(mx, n - sz[v]);
	if(mx < mn)
		mn = mx, cent = v;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i=0; i<n - 1; i++){
		int u, v, w; cin >> u >> v >> w;
		adj[u].pb({v, w});
		adj[v].pb({u, w});
	}
	dfs(1);
	if(fl)
		return cout << opt - we << '\n', 0;
	//cout << cent << endl;
	ll mni = INF;
	for(auto X : adj[cent])
		if(X.S < mni)mni = X.S;
	return cout << opt - mni << '\n', 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    long long n;
    cin >> n;
    char stack[255];
    char *ptr = stack + 254;
    *ptr = 0;
    while (n > 0) {
        *(--ptr) = 'a' + (n - 1) % 26;
        n = (n - 1) / 26;
    }
    cout << ptr << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

signed main() {
  int n;
  cin >> n;
  int x, y;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(begin(a), end(a));
  int p = lower_bound(begin(a), end(a), 0) - begin(a);
  int m = 0;
  for (auto&& u : a) m += abs(u);

  if (a[0] <= 0 && a[n - 1] >= 0) {
    cout << m << endl;
    x = a[0];
    int j = n - 2;
    for (j = n - 2; j > 0 && a[j] >= 0; j--) {
      y = a[j];
      cout << x << " " << y << endl;
      x = x - y;
    }

    cout << a[n - 1] << " " << x << endl;
    x = a[n - 1] - x;
    for (j = 1; a[j] < 0; j++) {
      y = a[j];
      cout << x << " " << y << endl;
      x = x - y;
    }
  } else if (a[0] > 0) {
    cout << m - 2 * a[0] << endl;
    x = a[0];
    repf(i, 2, n) {
      y = a[i];
      cout << x << " " << y << endl;
      x = x - y;
    }
    cout << a[1] << " " << x << endl;
  } else {
    cout << m + 2 * a[n - 1] << endl;
    x = a[n - 1];
    rep(i, n - 1) {
      y = a[i];
      cout << x << " " << y << endl;
      x = x - y;
    }
  }
}

Measured memory_bytes: 2688
strings = input()
length = len(strings)

ans = 0

for i in range(1,length):
    test_str = strings[:-i]
    if len(test_str) % 2 == 1:
        pass
    elif len(test_str) % 2 == 0:
        splitter = int(len(test_str) / 2)
        if test_str[splitter:] == test_str[:splitter]:
            if splitter > ans:
                ans = splitter*2

print(ans)


Measured memory_bytes: 2940
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  string s;
  cin >> s;
  if (s == "RRR") {
    cout << 3 << endl;
  }
  else if ((s == "RRS") ||( s == "SRR")) {
    cout << 2 << endl;
  }
  else if (s == "SSS") {
    cout << 0 << endl;
  }
  else {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 3632
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

typedef long long ll;
using namespace std;

int main(){
    ll i,j;
    int a[4];
    int x;
    for(i=0;i<4;i++) a[i]=0;
    for(i=0;i<4;i++){
        cin>>x;
        if(x==1) a[0]++;
        if(x==4) a[1]++;
        if(x==7) a[2]++;
        if(x==9) a[3]++;
    }

    if(a[0]>0&&a[1]>0&&a[2]>0&&a[3]>0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

class RollingHash{
private:
    int M = 1e9+7;
    int base = 1213;
    string str;
    int n;
    vector<int> pow,sum;

    void build(){
        n = str.size();
        sum = pow = vector<int> (n+1);
        sum[0] = 0;
        pow[0] = 1;
        for(int i = 0; i < n; i++){
            sum[i+1] = (str[i] + sum[i] * base) % M;
            pow[i+1] = pow[i] * base % M;
        }
    }


public:
    RollingHash(){}
    RollingHash(string in){
        str = in;
        build();
    }
    RollingHash(string in, int p, int mod){
        M = mod;
        base = p;
        str = in;
        build();
    }

    int calc(int l, int r){//[l,r)のハッシュ値を計算
        int len = r - l;
        int ret = sum[r] + M;
        ret -= sum[l] * pow[len] % M;
        return ret % M;
    }

};




signed main(void) {
    char in[2000000];
    scanf("%s",in);
    string s = string(in);
    RollingHash rh(s);
    int n = s.size();
    int ans = INF;
    loop(a,1,n){
        if(a*3 >= n)continue;
        int b = (n - a * 3)/2;
        if(a*3 + 2*b != n)continue;
        //A = [0,a), [a+b,2*a+b), [2*a+2*b,n)
        //B = [a,a+b), [2*a+b,2*a+2*b)
        bool c = true;
        if(rh.calc(0,a) != rh.calc(a+b,2*a+b)) c = false;
        if(rh.calc(0,a) != rh.calc(2*a+2*b,n)) c = false;
        if(rh.calc(a,a+b) != rh.calc(2*a+b,2*a+2*b)) c = false;
        if(c && a+b < ans)ans = a+b;
    }
    if(ans == INF){
        cout << "mitomerarenaiWA" << endl;
    }else{
        cout << "Love ";
        rep(i,ans)printf("%c",in[i]);
        cout << "!" << endl;
    }
}



Measured memory_bytes: 28240
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  char bef = s[0];
  int res = 1;
  repz(i, 1, n) {
    if (s[i] != bef) {
      bef = s[i];
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 512
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn divide2(s: usize, t: usize, cum: &Vec<i64>) -> Vec<i64> {
    let mut l = s;
    let mut r = t-1;
    let mut m = (l+r) / 2;
    let mut m1 = cum[m] - cum[s-1];
    let mut m2 = cum[t] - cum[m];
    let mut dmin = m1 - m2;
    if dmin == 0 {
        return vec![m1,m2];
    } else if dmin > 0 {
        r = m;
    } else {
        l = m;
    }
    while l + 1 < r {
        m = (l+r) / 2;
        let t1 = cum[m] - cum[s-1];
        let t2 = cum[t] - cum[m];
        let dt = t1 - t2;
        if dmin.abs() > dt.abs() {
            m1 = t1;
            m2 = t2;
            dmin = dt;
        }
        if dt == 0 {
            return vec![m1,m2];
        } else if dt > 0 {
            r = m;
        } else {
            l = m;
        }
    }
    let t1 = cum[l] - cum[s-1];
    let t2 = cum[t] - cum[l];
    let dt = t1 - t2;
    if dmin.abs() > dt.abs() {
        m1 = t1;
        m2 = t2;
        dmin = dt;
    }
    let t1 = cum[r] - cum[s-1];
    let t2 = cum[t] - cum[r];
    let dt = t1 - t2;
    if dmin.abs() > dt.abs() {
        m1 = t1;
        m2 = t2;
    }
    return vec![m1,m2];
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();
    let mut cum: Vec<i64> = vec![0;n+1];
    for i in 0..n {
        cum[i+1] = cum[i] + a[i];
    }
    let mut ans = -1;
    for p in 3..n {
        let m1 = divide2(1,p-1,&cum);
        let m2 = divide2(p,n,&cum);
        let min = cmp::min(cmp::min(m1[0],m1[1]),cmp::min(m2[0],m2[1]));
        let max = cmp::max(cmp::max(m1[0],m1[1]),cmp::max(m2[0],m2[1]));
        if ans < 0 || ans > max - min {
            ans = max - min;
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 10996
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

// https://leetcode.com/problems/count-complete-tree-nodes/
#include <bits/stdc++.h>
using namespace std;


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

	int age, cost; cin >> age >> cost;

	if (age > 12)
		cout << cost;
	else if (6 <= age && age <= 12)
	{
		double res = cost / 2;
		cout << res;
	}
	else if (age < 6)
		cout << 0;
	
    return 0;
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
constexpr int INF  = 0x3f3f3f3f;
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int body(int a, int b){
	return (a-b)*(a-b);
}
int main()
{
	int n, min = INF;
	cin >> n;
	vector<int> x(n);
	rep(i,n){
		cin >> x[i];
	}
	loop(j, 1, 101){
		int sum = 0;
		rep(i,n){
			sum += body(x[i], j);
		}
		if(min > sum) min = sum;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

ll dp[100010][11];
ll c[100010];
int main(){
	ll n, m;
	cin>>n>>m;
	vector<vector<ll>> edge(n+1);
	rep(i,m){
		ll a,b; cin>>a>>b;
		edge[a].pb(b);
		edge[b].pb(a);
	}
	ll q;cin>>q;
	FOR(i,1,q+1){
		ll v,d; cin>>v>>d>>c[i];
		dp[v][d]=i;
	}

	for(ll i=9;i>=0;i--){
		FOR(j,1,n+1){
			//一つ上のものが塗られているか.
			dp[j][i]=max(dp[j][i],dp[j][i+1]);
			//接続先が塗られているか.
			for(auto to: edge[j]){
				dp[j][i]=max(dp[j][i],dp[to][i+1]);
			}
		}
	}
	//(N+M)d

	FOR(i,1,n+1){
		cout<<c[dp[i][0]]<<endl;
	}

    return 0;
}

Measured memory_bytes: 16244
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        if (A % 2 == 1 && B % 2 == 1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL X, Y;

int main()
{
	in >> X >> Y;
	if (X%Y == 0) out << -1 << std::endl;
	else out << X << std::endl;
	return 0;
}


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

#define reg register
typedef long long ll;
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)

char IO;
int rd(){
	int s=0,f=0;
	while(!isdigit(IO=getchar())) if(IO=='-') f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(isdigit(IO=getchar()));
	return f?-s:s;
}

const int N=1e5+10,P=1e9+7;

char s[4],p[4];



int n;
int a[N];


int main(){
	int x=rd(),y=rd();
	cout<<(x+y-3)/(x-1)<<endl;
}








Measured memory_bytes: 256
input_str=input()
j=0
l1=[0]
for i in range(len(input_str)):
  k=input_str[i]
  if (k=="A"or k=="T"or k=="G"or k=="C"):
    j+=1
  else:
    l1.append(j)
    j=0
l1.append(j)
print(max(l1))
  

Measured memory_bytes: 2940
n = int(input())
A = list(map(int, input().split()))


if A == [1]:
    print(0)
else:
    ans = 0
    cnt = 1
    for i in range(n):
        if A[i] == cnt:
            cnt += 1
        else:
            ans += 1
    if cnt == 1:
        print(-1)
    else:
        print(ans)


Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n, m;
	cin>>n>>m;
	vector<int> a(n);
	priority_queue<int> pq;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
		pq.push(a[i]);
	}
	for(int i = 0; i < m; i++)
	{
		int t = pq.top();
		pq.pop();
		pq.push(t/2);
	}
	ll sum =0;
	while(!pq.empty())
	{
		sum+=pq.top();
		pq.pop();
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 1276
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[4];
    for(int i=0;i<4;i++){
      a[i] = 0; 
    }
    for(int i=0;i<n;i++){
      String s = sc.next();
      if(s.equals("AC")){
        a[0] += 1;
      }else if(s.equals("WA")){
        a[1] += 1;
      }else if(s.equals("TLE")){
        a[2] += 1;
      }else if(s.equals("RE")){
        a[3] += 1;
      }
    }
    System.out.println("AC x "+a[0]);
    System.out.println("WA x "+a[1]);
    System.out.println("TLE x "+a[2]);
    System.out.println("RE x "+a[3]);
  }
}


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

int main(){
    int n ;
    cin >> n ;
    vector<int> h(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> h.at(i) ;
    }
    int ans = 0 ;
    int current = 0 ;
    for (size_t i = 0; i < n-1; i++)
    {
        if (h.at(i) >= h.at(i+1))
        {
            current ++ ;
        }
        else
        {
            if (current >= ans)
            {
                ans = current ;
            }
            current = 0 ;
        }
        
        
    }
    if (current >= ans)
            {
                ans = current ;
            }
            current = 0 ;
    cout << ans << endl ;
    
}

Measured memory_bytes: 640
N=int(input())
number=list(map(int,input().split()))

print(' '.join(map(str,number)))
for i in range(1,N):
    strage=number[i]
    j=i-1
    for j in range(0,i)[::-1]:
        if number[j]>strage:
            number[j+1]=number[j]
            j-=1
            number[j+1]=strage
    print(' '.join(map(str,number)))



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int x, y, a, b, c; ll t; 
vector<ll>p, q, r;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>x>>y>>a>>b>>c;
	for(int i=0; i<a; i++){
		cin>>t; p.push_back(t);
	}
	for(int i=0; i<b; i++){
		cin>>t; q.push_back(t);
	}
	sort(p.begin(), p.end());
	sort(q.begin(), q.end());
	reverse(p.begin(), p.end());
	reverse(q.begin(), q.end());
	for(int i=0; i<x; i++) r.push_back(p[i]);
	for(int i=0; i<y; i++) r.push_back(q[i]);
	for(int i=0; i<c; i++){
		cin>>t; r.push_back(t);
	}
	sort(r.begin(), r.end());
	reverse(r.begin(), r.end());
	ll ans=0ll;
	for(int i=0; i<x+y; i++){
		ans+=r[i];
	}
	printf("%lld\n", ans); return 0;
}

Measured memory_bytes: 7664
/*
01背包
dp[v]表示背包容量剩余v的时候能装载的最大价值
dp[v] = max(dp[v - weg[i]] + val[i])
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const int inf = 0x3f3f3f3f;
int n, Weg;
int weg[MAXN];
ll val[MAXN], dp[MAXN];
int main()
{
    cin >> n >> Weg;
    for (int i = 1; i <= n; i++)
        cin >> weg[i] >> val[i];
    for (int j = 1; j <= n; j++)
    {
        for (int i = Weg; i >= weg[j]; i--)
        {
            dp[i] = max(dp[i], dp[i - weg[j]] + val[j]);
        }
    }
    ll ans = 0;
    for (int i = 0; i <= Weg; i++)
        ans = max(ans, dp[i]);
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
X = int(input())

if 1800 <= X <= 1999:
  print("1")
elif 1600 <= X <= 1799:
  print("2")
elif 1400 <= X <= 1599:
  print("3")
elif 1200 <= X <= 1399:
  print("4")
elif 1000 <= X <= 1199:
  print("5")
elif 800 <= X <= 999:
  print("6")
elif 600 <= X <= 799:
  print("7")
elif 400 <= X <= 599:
  print("8")

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,a[8],p[8],q[8];
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>p[i];
	}
	for(ll i=0;i<n;i++){
		cin>>q[i];
	}
    for(ll i=0;i<n;i++){
    	ll now=i+1;
    	a[i]=now;
    }
    ll A=0,B=0;
    ll cnt=0;
    do{
    	for(ll i=0;i<n;i++){
    	//	cout <<a[i];
    	}
    //	cout <<endl;
    	for(ll i=0;i<n;i++){
    		if(a[i]!=p[i]){
    			break;
    		}
    		if(i==n-1){
    			A=cnt;
    		}
    	}
    	for(ll i=0;i<n;i++){
    		if(a[i]!=q[i]){
    			break;
    		}
    		if(i==n-1){
    			B=cnt;
    		}
    	}
    	cnt++;
    }while(next_permutation(a,a+n));
    cout << abs(A-B);
	// your code goes here
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, h[100001], dp[100001], INF = 1e9;

int main() {
	cin >> n;
	inc(i, n) { cin >> h[i]; }
	
	inc(i, n) { dp[i] = INF; }
	dp[0] = 0;
	inc(i, n - 1) {
		inc1(j, 2) { setmin(dp[i + j], dp[i] + abs(h[i] - h[i + j])); }
	}
	
	cout << dp[n - 1] << endl;
	
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	int y = 1800;
	for (int i = 1; i <= 8; ++i) {
		if (x >= y) {
			cout << i << endl;
			return 0;
		}
		y -= 200;
	}
}

Measured memory_bytes: 3616
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

#define ll long long

#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
    "%s:%d: " format "\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define debug(format, ...)
#define NDEBUG
#endif

int n;
ll a[200005]; ll b[200005];
ll tmp[200005]; ll c[200005];
ll f[200005]; long double e[200005];

void cshift(ll* arr, int amt)
{
    for (int i = 1; i <= n; i++) {
        tmp[(i - 1 + amt) % n + 1] = arr[i];
    }
    for (int i = 1; i <= n; i++) {
        arr[i] = tmp[i];
    }
}

long double slope(int x, int y)
{
    return (long double)(f[y] - f[x]) / (long double)(y - x);
}

int main()
{
    scanf("%d", &n);
    ll max_a = -100, max_loc = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%lld", a + i);
        if (a[i] > max_a) {
            max_loc = i; max_a = a[i];
        }
    }
    for (int i = 1; i <= n; i++) scanf("%lld", b + i);
    cshift(a, n - max_loc);
    cshift(b, n - max_loc);
    a[0] = a[n]; b[0] = b[n];
    for (int i = 2; i <= n; i++) {
        c[i] = 2LL * b[i-1] + 2LL * c[i-1] - c[i-2];
    }
    for (int i = 0; i <= n; i++) {
        f[i] = a[i] - c[i];
        //printf("%lld ", f[i]);
    }
    //printf("\n");
    vector<int> hull;
    for (int i = 0; i <= n; i++) {
        while (hull.size() >= 2 && slope(i, hull[hull.size() - 1])
            > slope(hull[hull.size() - 1], hull[hull.size() - 2])) hull.pop_back();
        hull.push_back(i);
    }
    //for (int i = 0; i < hull.size(); i++) printf("%d ", hull[i]);
    int hullcur = 0;
    for (int i = 0; i <= n; i++) {
        while (hull[hullcur] < i) hullcur++;
        if (hull[hullcur] == i) {
            e[i] = f[i];
        } else {
            e[i] = (long double)(f[hull[hullcur - 1]]) +
                slope(hull[hullcur - 1], hull[hullcur]) *
                (long double)(i - hull[hullcur - 1]);
        }
        //printf("%.15Lf\n", e[i]);
    }
    long double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        ans += (e[i] + (long double)c[i]) / (long double)n;
    }
    printf("%.15Lf", ans);
    return 0;
}


Measured memory_bytes: 14460
#include<stdio.h>
#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
int main(){
int n,m;
while(scanf("%d %d",&n,&m),n!=0){
queue<int> chair;
for(int i=0;i<n;i++){
chair.push(i);
}
int ans=0;
while(chair.empty()!=true){
for(int j=m-1;j--;){
int n;
n=chair.front();chair.pop();
chair.push(n);
}
ans=chair.front();chair.pop();
}
cout<<ans+1<<endl;
}
}

Measured memory_bytes: 1236
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
  
int main() {
  int A[26];
  for (int i = 0; i < 26; i++) {
    A[i] = 0;
  }
  
  string str;
  getline(cin, str);
  while (1) {
    if (str == "") break;
    for ( int i = 0; i < str.size(); i++) {
      if (str[i] == '\n') break;
      if ('A' <= str[i] && str[i] <= 'Z') { ++A[str[i] - 'A']; }
      else if ('a' <= str[i] && str[i] <= 'z') { ++A[str[i] - 'a']; }
    }

    getline(cin,str);
  }
  
  for (int i = 0; i < 26; i++) {
    printf("%c : %d\n", 'a' + i, A[i]);
  }
  
  return 0;
}


Measured memory_bytes: 3236
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	var K, N int
	fmt.Scan(&K, &N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
	}
	maxi := 0
	for i := 1; i < N; i++ {
		maxi = max(maxi, A[i]-A[i-1])
	}
	maxi = max(maxi, K+A[0]-A[N-1])
	fmt.Println(K - maxi)
}


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

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};


int main(){
    int N,M;
    cin >> N >> M;

    UnionFind uf = UnionFind(N);
    int clusterNumber =N;

    for(int i=0;i<M;i++){
        int x,y,z;
        cin >> x>>y>>z;
        x--;
        y--;
        z--;
        if(uf.unite(x,y)){
            clusterNumber--;
        }

    }
    cout << clusterNumber << endl;
    return 0;
}

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

int main()
{
    int a[5][5], n, b[200] = {0}, flag = 0;
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    cin >> n;
    rep(i, n)
    {
        int l;
        cin >> l;
        b[l]++;
    }

    rep(i, 3)
    {
        if (b[a[0][i]] > 0 && b[a[1][i]] > 0 && b[a[2][i]] > 0)
        {
            flag = 1;
            break;
        }
        if (b[a[i][0]] > 0 && b[a[i][1]] > 0 && b[a[i][2]] > 0)
        {
            flag = 1;
            break;
        }
    }

    if (b[a[0][0]] > 0 && b[a[1][1]] > 0 && b[a[2][2]] > 0)
        flag = 1;
    if (b[a[0][2]] > 0 && b[a[1][1]] > 0 && b[a[2][0]] > 0)
        flag = 1;

    if (flag == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

string tos(int n){
    stringstream ss;
    ss<<n;
    return ss.str();
}

int len(int n){
    return tos(n).size();
}

signed main(){
    int N;
    cin>>N;

    int mi=INT_MAX;
    for(int i=1;i*i<=N;i++){
        if(N%i)continue;
        chmin(mi,len(N/i));
    }
    cout<<mi<<endl;
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    bool is_find = false;
    do {
        is_find = false;
        for (int i = 0; i < (int)s.size() - 1; i++) {
            if (s.at(i) != s.at(i+1)) {
                s.erase(s.begin()+i);
                s.erase(s.begin()+i);
                ans += 2;
                is_find = true;
                break;
            }
        }
    } while(is_find);

    cout << ans << endl;
}

Measured memory_bytes: 3760
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
    double r;
    cin >> r;
    cout << fixed;
    cout << setprecision(6);
    cout << r*r*M_PI << " " << 2*r*M_PI << endl;
    return 0;
}

Measured memory_bytes: 3292
a, b, x = map(int, input().split())
import math

if x >= a*a*b/2:
    print(math.degrees(math.atan(2/a*(b-x/a/a))))    
    
if x < a*a*b/2:
    print(90-math.degrees(math.atan(2*x/a/b/b)))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
//using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
  int k,n;
  int ans = 1000000007;
  cin >> k >> n;
  vector<int>A(2*n);
  for(int i=0;i<2*n;i++){
    if(i<n) cin >> A[i];
    else A[i] = k+A[i-n];
  }
  for(int i=0;i<n+1;i++){
    ans = min(ans,A[i+n-1]-A[i]);
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main(){
    int N,M; cin >> N >> M;
    int X[M];
    int range[M-1];
    int num = 0;
    int work;
    for(int i = 0; i < M; i++){
        cin >> X[i];
    }
    if(N >= M){
        cout << "0" << endl;
    }else{
        sort(X,X+M); 
        for(int i = 0; i < M-1; i++){
            range[i] = X[i+1] - X[i];
        }
        sort(range,range+(M-1)); 
        for(int i = 0; i < M-N; i++){
            num += range[i];
        }
        cout << num << endl;
    }
    return 0;

}

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


int main()
{
	vector<int> v;
	int n;
	int abc = 99999999;
	int s1, s2;
	int a;

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		s1 = 0;
		s2 = 0;
		for (int j = 0; j < n; j++)
		{
			if (j <= i)
			{
				s1 += v[j];
			}
			else
			{
				s2 += v[j];
			}
		}

		if (abc > abs(s1 - s2))
		{
			abc = abs(s1 - s2);
		}

	}

	cout << abc;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,count,ans=0;cin>>N;
  for(int i=1;i<=N;i+=2){
    count=0;
    for(int j=1;j<=i;j+=2)
      if(i%j==0)count++;
    if(count==8)ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String data[] = new String[4];
        for (int i = 0; i < 4; i++) {
            data[i] = S.substring(i, i+1);
        }

        int judge = 0;
        for (int i = 0; i < 3; i++) {
            if (data[i].equals(data[i+1])) {
                judge++;
            }
        }

        if (judge > 0) {
            System.out.println("Bad");
        } else {
            System.out.println("Good");
        }
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x;
int main()
{
	scanf("%lld",&x);
	for(ll i=1;i<=200;++i){
		for(ll j=-200;j<=200;++j){
			if(i*i*i*i*i-j*j*j*j*j==x){
				printf("%lld %lld\n",i,j);
				return 0;
			}
		}
	}
}

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

class Dice {
    public:
        int a, b, c, d, z, f;
        Dice(int a, int b, int c, int d, int z, int f) {
            this->a = a;
            this->b = b;
            this->c = c;
            this->d = d;
            this->z = z;
            this->f = f;
        }

        void s() {
            int tmp = this->b;
            this->b = this->a;
            this->a = this->z;
            this->z = this->f;
            this->f = tmp;
        }

        void e() {
            int tmp = this->c;
            this->c = this->a;
            this->a = this->d;
            this->d = this->f;
            this->f = tmp;
        }

        void n() {
            int tmp = this->b;
            this->b = this->f;
            this->f = this->z;
            this->z = this->a;
            this->a = tmp;
        }

        void w() {
            int tmp = this->c;
            this->c = this->f;
            this->f = this->d;
            this->d = this->a;
            this->a = tmp;
        }

        void printTop() {
            cout << this->a << endl;
        }
};


int main () {
        int a,  b,  c,  d,  z,  f;
        cin >> a >>  b >>  c >>  d >>  z >>  f;
        Dice dd(a, b, c, d, z, f);
        char orders[100];
        scanf("%s", orders);
        for(int i=0; i<strlen(orders); i++) {
            if (orders[i] == 'S') {
                dd.s();
            }
            else if (orders[i] == 'E') {
                dd.e();
            }
            else if (orders[i] == 'W') {
                dd.w();
            }
            else if (orders[i] == 'N') {
                dd.n();
            }
        }
        dd.printTop();
        return 0;
}

Measured memory_bytes: 1188