akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int main(void){
  int a[10];
  char s[101];
  while(1){
    int n;
    scanf("%d",&n);
    FOR(n)a[i]=0;
    if(!n)return 0;
    int y=0,ans=0;
    scanf("%s",s);
    FORJ(100){
      if(s[j]=='M'){
        a[j%n]++;
      }else if(s[j]=='S'){
        y+=a[j%n]+1;
        a[j%n]=0;
      }else{
        a[j%n]+=y+1;
        y=0;
      }
    }
    qsort(a,n,sizeof(int),u);
    FORJ(n)printf("%d ",a[j]);
    PRN(y);
  }
  return 0;
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265359
int main()
{
  long double a, b, x;
  cin >> a >> b >> x;
  long double half_x = a * a * b / 2.0;
  if (x >= half_x)
  {
    long double ans = 90.0 - atan((a * a * a) / (2.0 * a * a * b - 2.0 * x)) * 180.0 / PI;
    cout << setprecision(10) << ans << endl;
  }
  else
  {
    long double ans = 90.0 - atan(2.0 * x / (a * b * b)) * 180.0 / PI;
    cout << setprecision(10) << ans << endl;
  }
}


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

int main(void){
    int N,L,i;
    cin>>N>>L;
    string ans;
    vector<string> vec(N);
    for (i=0;i<N;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(), vec.end());
    for(i=0;i<N;i++){
        ans +=vec.at(i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
const ll INF = INT_MAX;

struct graph {
    typedef long long flow_type;
    struct edge {
        int src, dst;
        flow_type capacity, flow;
        size_t rev;
    };
    int n;
    vector<vector<edge>> adj;
    graph(int n) : n(n), adj(n) { }
    void add_edge(int src, int dst, flow_type capacity) {
        adj[src].push_back({src, dst, capacity, 0, adj[dst].size()});
        adj[dst].push_back({dst, src, 0, 0, adj[src].size()-1});
    }
    int max_flow(int s, int t) {
        vector<bool> visited(n);
        function<flow_type(int,flow_type)> augment = [&](int u, flow_type cur) {
            if (u == t) return cur;
            visited[u] = true;
            for (auto &e: adj[u]) {
                if (!visited[e.dst] && e.capacity > e.flow) {
                    flow_type f = augment(e.dst, min(e.capacity - e.flow, cur));
                    if (f > 0) {
                        e.flow += f;
                        adj[e.dst][e.rev].flow -= f;
                        return f;
                    }
                }
            }
            return flow_type(0);
        };
        for (int u = 0; u < n; ++u)
            for (auto &e: adj[u]) e.flow = 0;

        flow_type flow = 0;
        while (1) {
            fill(visited.begin(),visited.end(), false);
            flow_type f = augment(s, INF);
            if (f == 0) break;
            flow += f;
        }
        return flow;
    }
};

int main() {
  int N;
  cin >> N;
  //debug(N);
  vint a(N),b(N),c(N),d(N);
  graph g(2*N+2);
  repeat(i,N){
    cin >> a[i] >> b[i];
  }
  repeat(i,N){
    cin >> c[i] >> d[i];
  }

  repeat(i,N){
    repeat(j,N){
      if(a[i]<c[j] && b[i]<d[j]){
        g.add_edge(i+1,j+1+N,1);
      }
    }
  }
  repeat(i,N){
    g.add_edge(0,i+1,1);
    g.add_edge(i+1+N,2*N+1,1);
  }
  ll ans = g.max_flow(0,2*N+1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    if(N %500 == 0 || N %500 <= A){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


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

#define f(i,a,b) for( ll  i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter   ios::sync_with_stdio(false);cin.tie(0)

// policy-based



using namespace std;


typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;



 
const ll MAX = 3e5+100;
const ll inf = 1e9;
const ll mod = 1e9+7;

ii a[MAX];
int main(){
	fastio;
	ll n;
	cin >> n;
	f(i,0,n) cin >> a[i].ff >> a[i].ss;
	sort(a,a+n);
	ll a1 = -inf,b = inf,x = -inf,y = inf;
	f(i,0,n){
		a1 = max(a1,a[i].ff+a[i].ss);
		b = min(b,a[i].ff+a[i].ss);
		x = max(x,a[i].ff-a[i].ss);
		y = min(y,a[i].ff-a[i].ss);
	}	
	cout << max(a1-b,x-y) << endl;
	return 0;
}

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

using namespace std;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const long long MOD = 1e9 + 7;
const long long  INF = 5e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second




int n, r, L, d, t, x, ans, mx = -1000000010;
int tt[100010], s[100010];
priority_queue<P>pq;
vector<long long>v;

int main() {
	cin >> n >> r >> L;
	pq.push(P(0, -1));
	int now = 1, remain = 0;
	for (int i = 0;i < r;i++) {
		cin >> d >> t >> x;
		s[d] += x;
		pq.push(P(s[d], -d));
		while (true) {
			P p = pq.top();
			if (p.fr == s[-p.sc]) {
				tt[now] += t - remain;
				now = -p.sc;
				remain = t;
				break;
			}
			pq.pop();
		}
	}
	tt[now] += L - remain;
	for (int i = 1;i <= n;i++) {
		if (mx < tt[i])ans = i, mx = tt[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19700
import java.util.*;
import java.io.*;

class Main {

    public static void main(String[] args) {

	final Scanner stdin = new Scanner(System.in);

	while ( stdin.hasNextLine() ) {
	    
	    final String[] input = stdin.nextLine().split( " " );
	    final Stack<Double> stack = new Stack<Double>();

	    for ( String token : input ) {
		if ( "+".equals( token ) ) {
		    stack.push( stack.pop() + stack.pop() );
		} else if ( "-".equals( token ) ) {
		    stack.push( -stack.pop() + stack.pop() );
		} else if ( "*".equals( token ) ) {
		    stack.push( stack.pop() * stack.pop() );
		} else if ( "/".equals( token ) ) {
		    stack.push( 1.0 / stack.pop() * stack.pop() );
		} else {
		    stack.push( Double.parseDouble( token ) );
		}
	    }
	    System.out.println( stack.pop() );
	}
	
    }
    
}

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

using namespace std;

#define ge getchar()
#define Re read()

inline int read() {
	int x = 0, ch;
	while(!isdigit(ch = ge)) ;
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	return x;
}

const int MAXN = 200100;
const int MAXV = 1000100;
const int mod = 998244353;

inline void Add(int&x, int y) { x += y, x -= x >= mod ? mod : 0; }
inline int Mod(int x) { return x >= mod ? x - mod : x; }

template<typename T>
inline void chkmax(T&a, T b) { a = a > b ? a : b; }

int a_1[MAXV + 1];
int a_2[MAXV + 1];
int f_d[MAXV + 1];

int tot;
int pri[MAXV + 1];
int miu[MAXV + 1];
int inv[MAXV + 1];
int chk[MAXV + 1];
int F[MAXV + 1];

inline int init(int mx) {
	inv[1] = 1, miu[1] = 1;
	for(int i = 2; i <= mx; i++) {
		inv[i] = 1LL * (mod - mod / i) * inv[mod % i] % mod;
		if(!chk[i]) pri[++tot] = i, miu[i] = mod - 1;
		for(int j = 1; j <= tot; j++) {
			if(i * pri[j] > mx) break;
			chk[i * pri[j]] = 1;
			if(i % pri[j] == 0) break;
			miu[i * pri[j]] = mod - miu[i];
		}
	}
	for(int i = 1; i <= mx; i++) {
		for(int j = i << 1; j <= mx; j += i)
			Add(a_1[i], a_1[j]), Add(a_2[i], a_2[j]);
		f_d[i] = 1LL * (1LL * a_1[i] * a_1[i] - a_2[i] + mod) % mod * inv[2] % mod;
	}
}

int main() {
	int n = Re, N = 0;
	for(int i = 1; i <= n; i++) {
		int v = Re;
		chkmax(N, v); Add(a_1[v], v);
		Add(a_2[v], 1LL * v * v % mod);
	} init(N); int res = 0;
	for(int d = 1; d <= N; d++) {
		for(int T = d, t = 1; T <= N; T += d, ++t) {
			Add(res, 1LL * inv[d] * miu[t] % mod * f_d[T] % mod);
		}
	} printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 27392
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//以上テンプレ
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}


int main(){
    ll N,K,S;
    cin>>N>>K>>S;
    rep(i,K){
        cout<<S;
        if(i==N-1){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }
    rep(i,N-K){
        if(S!=1000000000){
            cout<<S+1;
        }else{
            cout<<1;
        }
        if(i==N-K-1){
            cout<<endl;
        }else{
            cout<<' ';
        }
    }
    }


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pcase cout<<"Case "<<++cs<<":"
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define mp make_pair
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define inf 10000000000

int main()
{
    int i = 0, j = 0, cs = 0, in;
    int n; cin>>n;
    vi v; vscan;
    ll dp[2][n+5];
    for(i = 0; i < n; i++) dp[0][i] = dp[1][i] = inf;
    dp[0][0] = dp[1][0] = 0;
    dp[0][1] = abs(v[1] - v[0]);
    for(i = 2; i < n; i++){
        dp[0][i] = min(dp[0][i-1],dp[1][i-1]) + abs(v[i] - v[i-1]);
        dp[1][i] = min(dp[0][i-2],dp[1][i-2]) + abs(v[i] - v[i-2]);
    }
    cout << min(dp[0][n-1], dp[1][n-1]) << endl;
    return 0;
}


Measured memory_bytes: 2296
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	vector<vector<ll>>x(3, vector<ll>(3));
	rep(i, 3) {
		rep(k, 3) {
			ll tmp;
			cin >> tmp;
			x[i][k] = tmp;
		}
	}
	ll n;
	cin >> n;
	vector<ll>b(n);
	rep(i, n)cin >> b[i];
	map<ll, bool>mp;
	rep(t,n) {
		rep(i, 3) {
			rep(k, 3) {
				if (x[i][k] == b[t]) {
					mp[x[i][k]] = true;
				}
			}
		}
	}
	ll cnt = 0;
	rep(i, 3) {
		rep(k, 3) {
			if (mp[x[i][k]] == true) {
				cnt++;
			}
		}
		if (cnt == 3)return cout << "Yes" << endl,0;
		cnt = 0;
	}
	cnt = 0;
	rep(k, 3) {
		rep(i, 3) {
			if (mp[x[i][k]] == true) {
				cnt++;
			}
		}
		if (cnt == 3)return cout << "Yes" << endl, 0;
		cnt = 0;
	}
	cnt = 0;
	rep(i, 3) {
			if (mp[x[i][i]] == true) {
				cnt++;
			}
		if (cnt == 3)return cout << "Yes" << endl, 0;
	}
	cnt = 0;
	rep(i, 3) {
		if (mp[x[i][3-i-1]] == true) {
			cnt++;
		}
		if (cnt == 3)return cout << "Yes" << endl, 0;
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
L=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[int(input())-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    ll N, M;
    cin >> N >> M;
    vector<ll> H(N);
    for (auto &h : H) {
        cin >> h;
    }
    vector<vector<ll> > G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G.at(a - 1).push_back(b - 1);
        G.at(b - 1).push_back(a - 1);
    }

    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        bool yes = true;
        for (auto &x : G.at(i)) {
            if (H.at(i) <= H.at(x)) {
                yes = false;
                break;
            }
        }
        if (yes) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9764
use std::io;
use std::collections::HashSet;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let mut set = HashSet::new();
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let m = v[0];
	let v:Vec<i32> = procon_read();
	let k = v[0];
	for j in 1..(k+1) {
		set.insert(v[j as usize]);
	}
	let mut subsubset = set.clone();
	for i in 1..n {
		let v:Vec<i32> = procon_read();
		let k = v[0];
		let mut subset = HashSet::new();
		for j in 1..(k+1) {
			subset.insert(v[j as usize]);
		}
		let mut v:Vec<&i32> = Vec::new();
		subsubset = set.clone();
		v = subsubset.intersection(&subset).collect::<Vec<&i32>>();
		let mut intersection = HashSet::new();
		for j in v {
			intersection.insert(*j);
		}
		set = intersection.clone();
	}
	println!("{}", set.len());
}

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

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

//?´???°????±??????? ????????????
vector<int> divisor(int x) {
	vector<int> ret;
	int i;
	for (i = 1; i*i < x; i++) {
		if (x%i)continue;
		ret.emplace_back(i);
		ret.emplace_back(x / i);
	}
	if (i*i == x)ret.emplace_back(i);
	return ret;
}

signed main() {
	for (int N; cin >> N&&N;) {
		vector<int> d = divisor(N);
		int S = accumulate(d.begin(), d.end(), 0) - N;
		if (S == N) {
			cout << "perfect number" << endl;
		}
		if (S > N) {
			cout << "abundant number" << endl;
		}
		if (S < N) {
			cout << "deficient number" << endl;
		}
	}
	return 0;
}

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

struct UnionFind {
    vector<int> par;
    vector<int> sz;

    UnionFind(int n=0){
        if(n>0) initialize(n);
    }

    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0; i<n; i++){
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }

    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        return true;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    int size(int x){
        return sz[find(x)];
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    int edges[700][700] = {0};
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        edges[a][b] = edges[b][a] = 1;
    }

    UnionFind uf(2*N);
    for(int i=0; i<N; i++) for(int j=0; j<i; j++) if(!edges[i][j]){
        uf.unite(i, j+N);
        uf.unite(j, i+N);
    }
    int num[1400][2] = {0};
    for(int i=0; i<2*N; i++){
        int ra = uf.find(i), rb = uf.find((i+N)%(2*N));
        if(ra == rb){
            cout << -1 << endl;
            return 0;
        }else if(ra < rb){
            num[ra][i/N]++;
        }
    }

    bitset<701> dp;
    dp[0] = 1;
    for(int i=0; i<2*N; i++){
        int a = num[i][0], b = num[i][1];
        dp = (dp<<a) | (dp<<b);
    }
    int ans = 1e9;
    for(int i=0; i<=N; i++) if(dp[i]){
        int j = N-i;
        int res = i*(i-1)/2 + j*(j-1)/2;
        ans = min(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2304
// b-crane-and-turtle.yml
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
template <typename V> using uset = unordered_set<V>;
template <typename K, typename V> using umap = unordered_map<K, V>;
template <typename C> int sz(C &v) { return v.size(); }

int X, Y;

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

    cin >> X >> Y;

    for (int i = 0; i <= 100; i++) {
        for (int j = 0; j <= 100; j++) {
            if (i + j == X && 2 * i + 4 * j == Y) {
                cout << "Yes\n";
                return 0;
            }
        }
    }

    cout << "No\n";

    return 0;
}



Measured memory_bytes: 3608
//A
#include <bits/stdc++.h>
#define write(x) printf("%d\n", x)
using namespace std;
typedef long long ll;
template <typename T>
void read(T &x)
{
	x = 0;
	char c;
	while (!isdigit(c = getchar()));
	do
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
	}while (isdigit(c = getchar()));
}
int main()
{
	int h, a;
	read(h);read(a);
	write((h + a - 1) / a);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

int N, ans;

void dfs(ll i, int mask) {
  if(i > N) return;
  if(mask==7) ans++;

  dfs(i*10+3, mask|1);
  dfs(i*10+5, mask|2);
  dfs(i*10+7, mask|4);
}

int main() {
  cin >> N;

  ans = 0;
  dfs(0ll,0);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<cstdio>
using namespace std;
struct point
{
	double x;
	double y;
};
void Koch_Curve(int i, point x1, point x2) {
	if (i == 0) return;
	point s, u, t;
	s.x = (x2.x - x1.x) / 3+ x1.x;
	s.y = (x2.y - x1.y) / 3+ x1.y;
	t.x = (x2.x - x1.x) * 2 / 3 + x1.x;
	t.y = (x2.y - x1.y) * 2 / 3 + x1.y;
	u.x = (t.x - s.x) * 1.0 / 2 - (t.y - s.y) * sqrt(3) / 2 + s.x;
	u.y = (t.x - s.x) * sqrt(3) / 2 + (t.y - s.y) * 1.0 / 2 + s.y;
	
	Koch_Curve(i - 1, x1, s);
	printf("%.8f %.8f\n",s.x,s.y);
	Koch_Curve(i - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	Koch_Curve(i - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	Koch_Curve(i - 1, t, x2);
}
int main(void) {
	int n;
	cin >> n;
	point x1,x2;
	x1.x = 0;
	x1.y = 0;
	x2.x = 100;
	x2.y = 0;
	printf("%.8f %.8f\n", x1.x, x1.y);
	Koch_Curve(n, x1, x2);
	printf("%.8f %.8f\n", x2.x, x2.y);
}


Measured memory_bytes: 3228
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    token = lines[0].split()
    a = int(token[0])
    p = int(token[1])

    return (a, p)


def solve(a, p):

        
    return int((3 * a + p) / 2)




def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
s = gets.chomp
index = []
for i in 0..s.length-1
if s[i] == "A"
  index.push(i)
  break
end
end
i = s.length-1
while i > 0 do
  if s[i] == "Z"
    index.push(i)
    break
  end
  i -=1
end
puts (index[1] - index[0]).abs + 1

Measured memory_bytes: 2172
N, K = map(int, input().split())
A = list(map(int, input().split()))

x = 0
b = 1<<50
for _ in range(50):
    b = b>>1
    if x+b>K:
        continue

    cnt = 0
    for a in A:
        if a & b:
            cnt += 1
    if cnt < N/2:
        x += b

ans = 0
for a in A:
    ans += x^a

print(ans)

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll s, ans = 0;
    cin >> s;
    set<ll> num;
    num.insert(s);
    ans++;

    while(1) {
        if((s%2) == 0) {
            s /= 2;
            ans++;
            if(num.count(s)) {
                break;
            }
            else {
                num.insert(s);
            }
        }
        else {
            s = 3*s + 1;
            ans++;
            if(num.count(s)) {
                break;
            }
            else {
                num.insert(s);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,m,s,g;
  cin >> n >> m >> s >> g;
  s--;g--;
  vector<map<ll,ll>> Ea(n),Eb(n);
  for(ll i=0;i<m;i++) {
    ll f,t,a,b;
    cin >> f >> t >> a >> b;
    f--;t--;
    Ea[f][t]=Ea[t][f]=a;
    Eb[f][t]=Eb[t][f]=b;
  }
  vec da(n,inf),db(n,inf);
  priority_queue<pll,vector<pll>,greater<pll>> q;
  q.push(pll(0,s));
  while(q.size()) {
    ll f=q.top().second;
    ll d=q.top().first;
    q.pop();
    if(da[f]!=inf) continue;
    da[f]=d;
    for(auto p:Ea[f]) {
      ll t=p.first;
      ll nd=d+p.second;
      if(da[t]!=inf) continue;
      q.push(pll(nd,t));
    }
  }
  q.push(pll(0,g));
  while(q.size()) {
    ll f=q.top().second;
    ll d=q.top().first;
    q.pop();
    if(db[f]!=inf) continue;
    db[f]=d;
    for(auto p:Eb[f]) {
      ll t=p.first;
      ll nd=d+p.second;
      if(db[t]!=inf) continue;
      q.push(pll(nd,t));
    }
  }
  vec ans(n);
  ans[n-1]=da[n-1]+db[n-1];
  for(ll i=n-2;i>-1;i--) {
    ans[i]=min(ans[i+1],da[i]+db[i]);
  }
  for(ll i=0;i<n;i++) {
    cout << (ll)1e15-ans[i] << endl;
  }
}

Measured memory_bytes: 38900
#include <stack>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#define INF 2100000000
#define eps 1e-8
#define mem(a,b) memset((a),(b),sizeof((a)))
#define lld long long

using namespace std;

int n, l;
struct s{
    int pos;
    int dir;
    int out;
    int id;
    bool operator <(const s &I) const {
        if(out != I.out) return out < I.out;
        if(pos == I.pos) return dir < I.dir;
        return pos < I.pos;
    }
    int gettime(const s &I) const {
        if(dir == I.dir) return INF;
        if(dir == 0 && pos <= I.pos) return INF;
        if(dir == 1 && pos >= I.pos) return INF;
        return abs(pos - I.pos) / 2;
    }
    int outdis() const {
        if(dir == 0) return pos;
        else return (l) * 2 - pos;
    }
    void move(int ll) {
        if(dir == 0) pos -= ll;
        else pos += ll;
    }
    void changedir() {
        if(pos % 2) return;
        dir = 1 - dir;
    }
}num[29];
int cnt;

int MAIN() {
    cnt = n;
    char str[19];
    mem(num, 0);
    for(int i = 0; i < n; i++) {
        scanf("%s%d", str, &num[i].pos);
        num[i].id = i + 1;
        if(str[0] == 'L') num[i].dir = 0;
        else num[i].dir = 1;
        num[i].pos *= 2;
    }
    int ans = 0;
    int ans2 = 0;
    while(cnt) {
        sort(num, num + n);
        int t = INF;
        for(int i = 0; i < cnt - 1; i++) {
            t = min(t, num[i].gettime(num[i + 1]));
        }
        for(int i = 0; i < cnt; i++) t = min(t, num[i].outdis());
        for(int i = 0; i < cnt; i++) num[i].move(t);
        sort(num, num + n);
        ans += t;
        if(num[cnt - 1].pos == (l) * 2) {
            if(cnt == 1) {
                ans2 = num[cnt - 1].id;
                break;
            } else {
                num[cnt - 1].out = 1;
                cnt--;
            }
        }
        for(int i = cnt - 1; i >= 1; i--) {
            if(num[i].pos == num[i - 1].pos) {
                num[i].changedir();
                num[i - 1].changedir();
            }
        }
        if(num[0].pos == 0) {
            if(cnt == 1) {
                ans2 = num[0].id;
                break;
            } else {
                cnt--;
                num[0].out = 1;
            }
        }
    }
    printf("%d %d\n", ans / 2, ans2);
    return 0;
}

int main()
{
    int cases;
    while(~scanf("%d%d", &n, &l)) {
        if(n == 0 && l == 0) break;
        MAIN();
    }
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	long int n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e; 
	long int ans=0;
	long int f=min({a,b,c,d,e});
	long long int g=(n-1)/f;
	ans=g+5;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
sa = input()
sb = input()
sc = input()

turn = sa[0]
sa = sa[1:]
while True:
    if turn == "a":
        if sa == "":
            print("A")
            break
        else:
            turn = sa[0]
            sa = sa[1:]
    elif turn == "b":
        if sb == "":
            print("B")
            break
        else:
            turn = sb[0]
            sb = sb[1:]
    elif turn == "c":
        if sc == "":
            print("C")
            break
        else:
            turn = sc[0]
            sc = sc[1:]


Measured memory_bytes: 9120
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def gcd(a,b):
    if b==0:return a
    if a<b:a,b=b,a
    k=a.bit_length()-b.bit_length()
    return gcd(b,a^(b<<k))

def main():
    md=998244353
    n,x=input().split()
    x=int(x,2)
    aa=[input() for _ in range(int(n))]
    aa=[int(a,2) for a in aa]
    #bitを多項式の係数と考えて多項式のGCDを求める
    g=aa[0]
    for a in aa[1:]:
        g=gcd(g,a)
    #print(bin(g))
    #GCDの桁数以上は自由に決められるのでその分を答えに
    ans=x>>(g.bit_length()-1)
    s=0
    # GCDの桁数以上をxと同じにした場合にx以下になるようであればその分も足す
    while 1:
        k=(x^s).bit_length()-g.bit_length()
        #print(k,bin(x^s),bin(x),bin(s))
        if k<0:break
        s^=g<<k
    if s<=x:ans+=1
    print(ans%md)

main()

Measured memory_bytes: 7540
#include <bits/stdc++.h>
using namespace std;
struct unionFind {
	vector<int> ps;
	unionFind(int n) : ps(n, -1) {
	}
	int root(int x) {
		if (ps[x] < 0)
			return x;
		else
			return ps[x] = root(ps[x]);
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y)
			return;
		if (-ps[x] < -ps[y])
			swap(x, y);
		ps[x] += ps[y];
		ps[y] = x;
		return;
	}
	int size(int x) {
		return -ps[root(x)];
	}
};
int main() {
	int n, q;
	cin >> n >> q;
	unionFind tr(n);
	for (int i = 0; i < q; i++) {
		int t, u, v;
		cin >> t >> u >> v;
		if (t == 0) {
			tr.unite(u, v);
		} else {
			cout << tr.same(u, v) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4000
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


string s, t;
bool f = true;

int main() {

	cin >> s >> t;

	rep(i, s.size()) {
		if (s[i] != t[i])f = false;
	}

	if (f)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

main() {
    int N; cin >> N;
    vector<pair<int,int>> p,p2;
    ll ans=0;
    rep(i,N){
        int a,b; cin >> a >> b;
        p.push_back(make_pair(a,b));
        p2.push_back(make_pair(a+b,i));
    }
    sort(p2.begin(),p2.end());
    reverse(p2.begin(),p2.end());
    rep(i,N){
        int pos=p2[i].second;
        if(i%2==0) ans+=p[pos].first;
        else ans-=p[pos].second;
    }
    cout << ans << endl;
}

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

bool linear_search(int A[], int n, int key) {
  int i = 0;
  A[n] = key;
  while (A[i] != key) i++;
  return i != n;
}

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

  int S[n];
  for (int i = 0; i < n; i++) scanf("%d", &S[i]);

  int q;
  scanf("%d", &q);

  int t, cnt = 0;
  for (int i = 0; i < q; i++) {
    scanf("%d", &t);
    if (linear_search(S, n, t)) cnt++;
  }

  printf("%d\n", cnt);

  return 0;
}



Measured memory_bytes: 2724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	
	
	long long n; cin>>n;
	if(n == 1){cout<<1<<"\n"; return 0;}
	if(n % 2 == 0) cout<<(double)(n/2)/n<<"\n";
	else cout<<(double)(((n+1)/2))/n<<"\n";
}

Measured memory_bytes: 256
n,m=gets.chomp.split(" ").map(&:to_i)

flags=Array.new(n){false}
balls=Array.new(n){1}
flags[0]=true
m.times do|i|
  x,y=gets.chomp.split(" ").map(&:to_i)
  if flags[x-1]
    flags[y-1]=true
  end
    balls[x-1]-=1
    balls[y-1]+=1
    if balls[x-1].zero?
      flags[x-1]=false
    end
end
puts flags.count{|flag| flag}


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

void solve() {
    int n; cin >> n;
    string s; cin >> s;
    bool f = true;
    if(n%2 != 0) f = false;
    for(int i = 0; i < n/2; i++) 
        if(s.at(i) != s.at(i + n/2)) 
            f = false;
    cout << (f ? "Yes" : "No") << endl;
}

int main() {
    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<stack>
using namespace std;

int main(){
    int n,m,p;
    long long int c_ans=0,w_ans=0;
    char s[3];
    cin>>n>>m;
    int problem[n+2];
    for(int i=0;i<n+2;i++)problem[i]=0;
    for(int i=0;i<m;i++){
        cin>>p>>s;
        if(s[0]=='A' && problem[p]!=-1){
            w_ans+=problem[p];
            c_ans+=1;
            problem[p]=-1;
        }
        if(s[0]=='W' && problem[p]!=-1){
            problem[p]++;
        }
       
    }
    cout<<c_ans<<" "<<w_ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (int i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 

int solve(){
	int n, m, q;
	cin>> n>> m>> q;
	vi a(q), b(q), c(q), d(q), A(11);
	rep(i, 0, q)
		cin>> a[i]>> b[i]>> c[i]>> d[i];
		int ans = -1;
	rep(l1, 1, m + 1){
		rep(l2, l1, m + 1){
			rep(l3, l2, m + 1){
				rep(l4, l3, m + 1){
					rep(l5, l4, m + 1){
						rep(l6, l5, m + 1){
							rep(l7, l6, m + 1){
								rep(l8, l7, m + 1){
									rep(l9, l8, m + 1){
										rep(l10, l9, m + 1){
											A[1] = l1, A[2] = l2, A[3] = l3, A[4] = l4, A[5] = l5;
											A[6] = l6, A[7] = l7, A[8] = l8, A[9] = l9, A[10] = l10;
											int oops = 0;
											rep(i, 0, q){
												if(A[b[i]] - A[a[i]] == c[i])
													oops += d[i];
											}
											ans = max(ans, oops);
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout<< ans;
	return 0;
}
 
int main()
{
	fast;
	int t = 1;
	//cin>> t;
	while(t--){  
		solve();
	}
	return 0;
}
//upper_bound returns an iterator pointing to the 
//first element in the range [first,last) which has a value greater than ‘val’
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);

Measured memory_bytes: 3664
/**
 *	author: tanishq_code_c
**/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;
// template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



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


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


#define int             							long long
#define setbits(x)     							    __builtin_popcountll(x)
#define zerobits(x)     							__builtin_ctzll(x)
#define mod             							1000000007
#define inf            							    1e18
#define endl            							'\n'
#define pb              							push_back
#define all(x)          							x.begin(),x.end()
#define ff              							first
#define ss              							second
#define rep(i,n)                                  	for(int i = 0; i < n; i++)
#define set(n)                                      fixed << setprecision(n)

int powmod(int a, int b) {int res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod; a = a * a % mod;} return res;}
int fast_pow(int a, int b) {if (b == 1) return a; if (b == 0) return 1; int x = fast_pow(a, b / 2); x *= x; if (b & 1) x *= a; return x;}

void t_c_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("inp.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif*/
	string s, k; cin >> s >> k;
	int n = (int)s.size();
	int nn = (int)k.size();
	int finalans = inf;
	for (int i = 0; i < n - nn + 1; i++) {
		string ss = s.substr(i, nn);
		dbg(ss);
		int ans = 0 ;
		for (int j = 0; j < nn; j++) {
			if (ss[j] != k[j]) {
				++ans;
			}
		}
		finalans = min(ans, finalans);
	}
	cout << finalans << endl;
}
int32_t main()
{
	t_c_c();
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

int main()
{
int n, p[114514];
cin >> n;
rep(i, n) scanf("%d", &p[i]);

int count = 0;

rep(i, n){
    if(p[i] == (i+1)){
        count++;
        if(i+1 != n){
            if(p[i+1]==(i+2)){
                i++;
            }
        }
    }    
}

cout << count << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
   long long int n,i,sum=0;
    scanf("%lld",&n);
    for (i = 1; i <= n; i++)
    {
        if((i%3==0 ) && (i%5==0))
        {
             sum=sum+0;
        }
        else if(i%3==0)
        {
            sum=sum+0;
        }
        else if(i%5==0)
       {
          sum=sum+0;
       }
       else 
       {
           sum=sum+i;
       } 
    }
      printf("%lld\n",sum);  
    
}

Measured memory_bytes: 1724
#pragma G++ optimize (2)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <queue>
#define INF 0x3f3f3f3f
#define NO 30005
#define MO 100005
typedef long long ll;
//by Oliver
using namespace std;
inline ll read()
{
	char ch = ' ', last;
	ll ans = 0;
	while (ch < '0' || ch > '9')
		last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')
		ans = ans * 10 + int(ch - '0'), ch = getchar();
	if (last == '-')
		return -ans;
	return ans;
}
void write(ll x)
{
	if (x >= 10)
		write(x / 10);
	putchar(x % 10 + '0');
}
//head

int n, h, w;
//variable

void init()
{
	n = read(), h = read(), w = read();
}
//functions

int main()
{
	init();
	cout << (n - h + 1) * (n - w + 1) << endl;
	return 0;
}
//main


Measured memory_bytes: 256
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
from math import log
n=int(input())
ans=num2alpha(n).lower()
print(ans)

Measured memory_bytes: 61908
#include<iostream>
#include <iomanip>
using namespace std;
int main(){
  double w, h, x, y;
  cin >> w >> h >> x >> y;
  double ans = 0.5*w*h;
  int flag = 0;
  if (w/2 == x && h/2 == y) flag = 1;  
  cout << fixed << setprecision(6) << ans <<" "<<flag<< endl;

}


Measured memory_bytes: 256
import System.Random
import Control.Monad
main = do
  n <- readLn::IO Int
  xs <- (return . map (read::String->Int) . words) =<< getLine
  yss <- replicateM (n-1) $ (return . map (read::String->Int) . words) =<< getLine
  cs <- replicateM 1000 $ (return . (toEnum::Int->Command)) =<< randomRIO (0, 3)
  putStrLn $ (\b -> if b then "No" else "Yes") . or $ map (\ys -> any (== ys) $ scanl f1 xs cs) yss
  
data Command = N | S | E | W deriving (Show, Enum)
f1 :: [Int] -> Command -> [Int]
f1 [x1,x2,x3,x4,x5,x6] N = [x2,x6,x3,x4,x1,x5]
f1 [x1,x2,x3,x4,x5,x6] S = [x5,x1,x3,x4,x6,x2]
f1 [x1,x2,x3,x4,x5,x6] E = [x4,x2,x1,x6,x5,x3]
f1 [x1,x2,x3,x4,x5,x6] W = [x3,x2,x6,x1,x5,x4]
f0 c | c == 'N' = N
f0 c | c == 'S' = S
f0 c | c == 'E' = E
f0 c | c == 'W' = W


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); }
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

int main() { // Emily <3
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  int s, w; cin >> s >> w;
  if (w >= s) {
    cout << "un";
  }
  cout << "safe\n";

  return 0;
}



Measured memory_bytes: 3764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char S[200000];
int slen;

int eqs (int start, int end) {
	int i;

	int d=start - end+1;
	for (i=start; i<=end; i++) {
		if (S[i] != S[i+d]) return 0;
	}
	return 1;
}

int main(int argc, char *argv[]) {
	int sr;
	int a, b;
	int i, j;
	int dn, dmax=1;
	int start, end;
	int p=1;

	sr=scanf("%s", S);
	slen = strlen(S);

	dn = 1;
	for (i = 1; i < slen; i++) {
		if (p==1 && S[i-1] == S[i]) {
			p=2;
			i++;
			if (i >= slen) dn--;
		} else {
			p=1;
		}
		dn++;
	}

	printf("%d\n", dn); fflush(stdout);

	return 0;

}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	ll T1, T2, A1, A2, B1, B2;
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;

	ll AB1 = A1 - B1;
	ll AB2 = A2 - B2;
	AB1 *= T1;
	AB2 *= T2;

	if (AB1 == 0 || AB2 == 0) {
		co(0);
	}
	else {
		if (AB1 > 0 && AB2 > 0) co(0);
		else if (AB1 < 0 && AB2 < 0) co(0);
		else {
			if (AB1 + AB2 == 0) co("infinity");
			else {
				if (AB1 < 0) {
					AB1 = -AB1;
					AB2 = -AB2;
				}
				ll tmp = AB1 + AB2;
				if (tmp > 0) co(0);
				else {
					tmp = -tmp;
					if (AB1 % tmp == 0) {
						co(AB1 / tmp * 2);
					}
					else {
						co(AB1 / tmp * 2 + 1);
					}
				}
			}
		}
	}



	Would you please return 0;
}

Measured memory_bytes: 256