akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;
bool dp[6410][20000];
int abs(int x,int y){
    if(x>=y) return x-y;
    else return y-x;
}
int main(){
    int h,w;
    cin >> h >> w;
    vector<int> a(h*w), b(h*w);
    rp(i,h*w) cin >> a[i];
    rp(i,h*w) cin >> b[i];
    rp(i,6410){
        rp(j,20000) dp[i][j]=false;
    }
    int m=0;
    rp(i,h*w) m=max(m,abs(a[i],b[i]));
    dp[0][abs(a[0],b[0])]=true;
    for(int i=1; i<h*w; i++){
        int dif=abs(a[i],b[i]);
        if(i%w){
            for(int k=0; k<=(h+w)*m;k++){
                if(dp[i-1][k]){
                    dp[i][abs(k,dif)]=true;
                    if(k+dif<=(h+w)*m*2) dp[i][k+dif]=true;
                }
            }
        }
        if(i>=w){
            for(int k=0; k<=(h+w)*m;k++){
                if(dp[i-w][k]){
                    dp[i][abs(k,dif)]=true;
                    if(k+dif<=(h+w)*m*2) dp[i][k+dif]=true;
                }
            }
        }
    }
    int ans;
    int c=0;
    while(1){
        if(dp[h*w-1][c]){
            ans=c;
            break;
        }
        c++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 125440
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Rectangle {
    Integer a;
    Integer b;
    
    public Rectangle(Integer a, Integer b) {
        this.a = a;
        this.b = b;
    }
    
    public Integer calculateArea() {
        return  a*b;
    }
    public Integer calculatePerimeter() {
        return  2*(a+b);
    }
}

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputLine = reader.readLine();
        String[] splitStrings = inputLine.split("\\s");
        
        if(splitStrings.length != 2) {
            throw new Exception("invalid input");
        }
        
        Rectangle rectangle = new Rectangle(Integer.parseInt(splitStrings[0]), Integer.parseInt(splitStrings[1]));
        System.out.printf("%d %d\n", rectangle.calculateArea(), rectangle.calculatePerimeter());
    }
}



Measured memory_bytes: 24612
#include <iostream>
#include <vector>
using namespace std;
constexpr auto INF = 100000000001;

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

	int N, W; cin >> N >> W;
	vector<int> weight(N); vector<int> value(N);
	for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];
	vector<vector<long long> > dp(110, vector<long long>(100010, INF));
	dp[0][0] = 0;

	for (int i = 0; i < N; ++i) {
		for (int sum_v = 0; sum_v < 100010; ++sum_v) {
			if (sum_v - value[i] >= 0) {
				dp[i + 1][sum_v]
					= min(dp[i + 1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
			}
			dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v]);
		}
	}
	long long ans = 0;
	for (int sum_v = 0; sum_v < 100010; ++sum_v) {
		if (dp[N][sum_v] <= W) ans = sum_v;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 87296
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int main(void){
	int a=nextint();
	int b=nextint();
	int c=nextint();
	int k=nextint();
	while(a>=b){ b*=2; k--; }
	while(b>=c){ c*=2; k--; }
	puts(k>=0?"Yes":"No");
}


Measured memory_bytes: 1496
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String tommorow = "";
    switch (sc.next()) {
      case "Sunny":
        tommorow = "Cloudy";
        break;
      case "Cloudy":
        tommorow = "Rainy";
        break;
      case "Rainy":
        tommorow = "Sunny";
        break;
    }
    System.out.println(tommorow);
  }
}

Measured memory_bytes: 21716
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    public static void main(String[] args) throws IOException {
        StringBuilder ans = new StringBuilder();
//        int t=ri();
        int t=1;
        while (t-- > 0)
        {
            String str1=rs();
            String str2=rs();
            int count=0;
            for(int i=0;i<str1.length();i++)
            {
                if(str1.charAt(i)!=str2.charAt(i))
                {
                    count++;
                }
            }
            ans.append(count).append("\n");
        }
        out.print(ans.toString());
        out.flush();

    }
}


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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int n,k;
	cin >> n >> k;
	int d[10] = {0};
	REP(i,k){
		int tmp;
		cin >> tmp;
		d[tmp] = 1;
	}
	while(1){
		string str = to_string(n);
		int flag[10] = {0};
		REP(i,str.size()){
			flag[str[i]-'0'] = 1;
		}
		bool okflag = true;
		REP(i,10){
			if(d[i] && flag[i]) okflag = false;
		}
		if(okflag) break;
		n++;	
	}
	cout << n << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	while(cin>>N>>M) {
		VI A(N);
		REP(i, N) cin>>A[i];
		VI dis;
		ll ans = 0;
		REP(i, N) {
			ans += A[i];
			ll den = 2;
			REP(mi, M) {
				ll v = A[i]/(den/2)-A[i]/den;
				if(v==0) break;
				dis.PB(v);
				den*=2;
			}
		}
		sort(ALLR(dis));
		REP(i, min((ll)dis.size(), M)) ans-=dis[i];
		
		cout<<ans<<endl;
	}
	
	return 0;
}


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

using namespace std;

signed main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int64_t n, x;
    cin >> n >> x;
    cout << 3 * (n - __gcd(n, x)) << "\n";
    return 0;
}


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

using namespace std;

tuple<int, int, int> solve(int64_t N, int64_t Y) {
  for (int64_t i = 0; i <= N && i * 10 <= Y; ++i) {
    for (int64_t j = 0; i + j <= N && i * 10 + j * 5 <= Y; ++j) {
      int64_t k = N - i - j;
      if (10 * i + 5 * j + k == Y) {
        return make_tuple(i, j, k);
      }
    }
  }
  return make_tuple(-1, -1, -1);
}

int main() {
  int64_t N, Y;
  cin >> N >> Y;
  Y /= 1000;
  int i, j, k;
  tie(i, j, k) = solve(N, Y);
  cout << i << " " << j << " " << k << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main() {
	int i,n,Rt[200000],max,min;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &Rt[i]);
	}
	min= Rt[0];
	max = Rt[1]-Rt[0];
	for (i = 1; i < n; i++) {
		if (max < Rt[i] - min) {
			max = Rt[i] - min;
		}
		if (min > Rt[i]) {
			min = Rt[i];
		}
	}
	printf("%d\n", max);

}

Measured memory_bytes: 3468
//B Strings with the Same Length
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  string s,t;
  cin>>n>>s>>t;
  for(int i=0;i<n;i++)
  {
    cout<<s.at(i)<<t.at(i);
  }
  cout<<endl;
}


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

  
    
    int main(){
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t;
        cin>>t;
        while(t--){
            ll a,b,c,d;
            cin>>a>>b>>c>>d;
            if(a<b){
                cout<<"No"<<endl;
                continue;
            }
            if(a>=b && b>d){
                cout<<"No"<<endl;
                continue;
            }

            if(a>=b && b<=d && c>=b){
                cout<<"Yes"<<endl;
                continue;
            }
            else{
                ll g=__gcd(b,d);
                if(b-g+a%g > c){
                    cout<<"No"<<endl;
                }
                else{
                    cout<<"Yes"<<endl;
                }
            }
          

        }

    }

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
const int N = 1e5 + 10;
int phi[N];
void phi_1_to_n(int n = N - 5) {
    phi[0] = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
        phi[i] = i;

    for (int i = 2; i <= n; i++) {
        if (phi[i] == i) {
            for (int j = i; j <= n; j += i)
                phi[j] -= phi[j] / i;
        }
    }
}
int fpow(int a,int b,int mod){
	int r = 1;
	for(;b;b>>=1,a=a*a%mod){
		if(b & 1) r = r * a%mod;
	}
	return r;
}
int32_t main()
{
    phi_1_to_n();
    int n,x,m; cin >> n >> x >> m;
    vi v{x};set<int>s{x};
    map<int,int> idx; idx [x] = 0;
    fr(_,3*m){
    	int nx = (x * x) % m;
    	if(s.find(nx) != s.end()) break;
    	v.push_back(nx); 
    	idx[nx] = _ + 1;
    	s.insert(nx);
    	x = nx;
    }
    int id =  idx[v.back()*v.back()%m];
    n -= id;
    int cyc = v.size() - id;
    // dbg(cyc);nl;
    int ans = 0;
    fr(i,id) ans += v[i];
    int sm = 0;
   if(cyc)rep(i,id,v.size()-1) ans += (n/cyc) * v[i];
   // cout << (n % cyc);nl;
   for(int i=id,cnt=0;cnt<n%cyc;cnt++,i++){
   	ans += v[i];
   }
   cout << ans;
}

Measured memory_bytes: 9816
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    if (n>=30)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 3644
def slove():
    import sys
    input = sys.stdin.readline
    x, y = list(map(int, input().rstrip('\n').split()))
    cnt = abs(abs(y) - abs(x))
    if abs(x) < abs(y):
        if x < 0:
            cnt += 1
        if y < 0:
            cnt += 1
    elif abs(x) > abs(y):
        if x > 0:
            cnt += 1
        if y > 0:
            cnt += 1
    else:
        if x * y < 0:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;

int main(){
    int r;
    cin >> r;
    cout << 3 * r*r << endl;
}

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

long long r,l;

int main()
{
	cin >> r >> l;
	if(r <= 1 || l <= 1)
	{
		puts("1");
		return 0;
	}
	cout << (long long)r/2*l+r%2*((l+1)/2) << endl;
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static int D;
    static int N;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        D = sc.nextInt();
        N = sc.nextInt();

        if (N == 100) {
            System.out.println((int)((N+1) * Math.pow(100, D)));
        } else {
            System.out.println((int)(N * Math.pow(100, D)));
        }
    }
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;
vl A;
vl B;
ll dp[1001][10001];

int main(){
    int H, N; cin >> H >> N;
    rep(i, 0, N){
        ll a, b;
        cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
    rep(i, 1, 10001) dp[0][i] = inf;
    rep(i, 0, N){
        rep(j, 0, H+1){
            if(j - A[i] >= 0){
                dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i]);
            } else {
                dp[i+1][j] = min(dp[i][j], B[i]);
            }
        }
    }
    cout << dp[N][H] << endl;
    return 0;
}




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

using ll = long long;

int N, M;
priority_queue<ll> que;

template<typename T> void print_queue(T& q) {
    while(!q.empty()) {
        std::cout << q.top() << " ";
        q.pop();
    }
    std::cout << '\n';
}


ll sum_calc(priority_queue<ll> vec){
    ll sum = 0;
    while(!vec.empty()){
        sum += vec.top();
        vec.pop();
    }
    // cout << endl;
    return sum;
}

int main()
{
    cin >> N >> M;
    ll buf;

    for(int i  = 0; i<N; i++){
        cin >> buf;
        que.push(buf);
    }
    // print_queue(que);
    // cout << "wow";

    for(int j = 0; j<M; j++){
        // print_queue(que);

        ll now = que.top()/2.0;
        que.pop();
        que.push(now);
    }

    // cout.setf(ios::dec);
    cout << fixed<< setprecision(0) << sum_calc(que) << endl;

}


Measured memory_bytes: 1908
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int a,b; cin >> a >> b;
    for(int i=0; i<=200000; i++){
        int aa = floor((double)i * 0.08);
        int bb = floor((double)i * 0.1);
        if(aa == a && bb == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;   
}

Measured memory_bytes: 256
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
  int n, m;
  readf (" %d %d", &n, &m);
  auto a = new int[n];
  foreach (t; 0 .. n) {
    readf (" %d", &a[t]);
  }
  auto s = a.sum;
  auto c = a.count! (p => p * 4 * m >= s);
  writeln ( (c >= m) ? "Yes" : "No");
}



Measured memory_bytes: 256
using System;
using System.Text;

namespace _0064
{
    class Program
    {
        static void Main(string[] args)
        {
            int secretNumber = 0;
            var text = "";

            while((text = Console.ReadLine()) != null)
            {
                var textCharacters = text.ToCharArray();
                //var numberCharacters = new StringBuilder();
                string numberCharacters = "";

                foreach(var textCharacter in textCharacters)
                {
                    if(Char.IsDigit(textCharacter))
                    {
                        //numberCharacters.Append(textCharacter);
                        numberCharacters += textCharacter;
                    }else
                    {
                        if(numberCharacters.Length > 0)
                        {
                            secretNumber += int.Parse(numberCharacters);
                            //numberCharacters.Clear();
                            numberCharacters = "";
                        }
                    }
                }
                if (numberCharacters.Length > 0)
                {
                    secretNumber += int.Parse(numberCharacters);
                    //numberCharacters.Clear();
                    numberCharacters = "";
                }               
            }
            Console.WriteLine(secretNumber);
        }
    }
}

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

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  rep(i,N) cin>>vec[i];
  sort(vec.begin(),vec.end());
  int sum=0;
  rep(i,N) sum+=vec[i];
  int bsum=0;
  rep(i,N/2) bsum+=vec[N-i*2-2];
  cout<<sum-bsum*2<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
 
long long factorial(long long n) {
    long long result = 1;
    for (long long i = 1; i <= n; i++) {
        result *= i;
    }
    return result;
}
 
long long combination(long long n, long long r) {
    long long result = factorial(n) / factorial(n - r) / factorial(r);
    // cout << "combination " << n << " C " << r << "is " << result << endl;
    return result;
}
 
long long combination_improved(long long n, long long r) {
    long long d      = n - r;
    long long result = 1;
    while (n > 1 || d > 1 || r > 1) {
        if (n > 1) {
            result *= n;
            n--;
        }
        if (d > 1 && result % d == 0) {
            result /= d;
            d--;
        }
        if (r > 1 && result % r == 0) {
            result /= r;
            r--;
        }
    }
    // cout << "combination " << n << " C " << r << "is " << result << endl;
    return result;
}
 
int main(void) {
    // cout << std::fixed << std::setprecision(10);
    // cin.tie(0);
    // std::ios::sync_with_stdio(false);
    long long n, m;
    long long count=0;
    long long cum[100001];
    std::multimap<long long, long long> mod_map; //(mod M,number)
    cin >> n >> m;
    long long m1;
    for (int i = 0; i < n; i++) {
        cin >> m1;
        if (i == 0)
            cum[i] = m1;
        else
            cum[i] = cum[i - 1] + m1;
    }
    for (int i = 0; i < n; i++) {
        mod_map.insert(std::make_pair(cum[i] % m, cum[i]));
    }
 
    int prev = m;
    for (auto itr : mod_map) {
        // cout << itr.first << " " << itr.second << endl;
        if (prev != itr.first) {
            if (itr.first == 0) {
                if (mod_map.count(0) >= 1)
                    count += combination_improved(mod_map.count(0) + 1, 2);
            } else {
                if (mod_map.count(itr.first) >= 2) {
                    count += combination_improved(mod_map.count(itr.first), 2);
                }
            }
        }
        prev = itr.first;
    }
 
    cout << count << endl;
 
    return 0;
}

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

using namespace std;

int main()
{
    string a;
    cin >> a;
    if(a[0] == a[1] and a[1] == a[2]) {
        cout << "Yes";
    }
    else if(a[1] == a[2] and a[2] == a[3]) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    cout << "\n";
    return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;

int last[N][3];
int prev[N][3];

int n, l, t;

int len(int a, int b)
{
    if (a <= b)
    {
        return b - a;
    }
    else
    {
        return (l - (a - b));
    }
}

int print(int x)
{
    x %= l;
    x += l;
    x %= l;
    x /= 2;
    printf("%d\n", x);
}

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    scanf("%d%d%d", &n, &l, &t);
    vector <int> x(n), w(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d%d", &x[i], &w[i]);
    }
    vector <int> op;
    ll nc = 0;
    for (int i = 0; i < n; i++)
    {
        int dir = (w[i] == 1 ? 1 : -1);
        ll pos = x[i] + dir * (ll) t;
        nc += (pos > 0 ? pos / l : (pos - l + 1) / l);
        op.push_back((pos % l + l) % l);
    }
    nc = ((nc % n) + n) % n;
    sort(op.begin(), op.end());
    for (int i = 0; i < n; i++)
    {
        printf("%d\n", op[(i + nc) % n]);
    }
}


Measured memory_bytes: 2552
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int h,w;
  cin>>h>>w;
  vector<vector<int> > vec(h, vector<int>(w));
  rep(i,h) rep(j,w) cin>>vec[i][j];
  vector<vector<int> > v(h+w, vector<int>(max(h,w),-1));
  rep(k,h+w-1){
    int i=k,j=0;
    if(k>=h){ i=h-1; j=k-h+1;}
    int d=j;
    while(i>=0 && j<w){
      v[k][d] = vec[i][j];
      i--;j++;d++;
    }
  }

  int d=max(h,w);
  vector<vector<int>> prev(d,vector<int>(d,-1));
  prev[0][0]=0;
  rep(k, h+w-1){
    vector<vector<int>> nxt(d,vector<int>(d,-1));
    rep(j,d)rep(i,j+1)if(prev[i][j]>=0){
      auto c = [&](int a,int b){if(a==b)return v[k][a]; else return v[k][a]+v[k][b];};
      if(v[k][i]>=0) nxt[i][j] = max(nxt[i][j], prev[i][j]+c(i,j));
      if(i+1<=j && v[k][i+1]>=0) nxt[i+1][j] = max(nxt[i+1][j], prev[i][j]+c(i+1,j));
      if(j+1<d && v[k][j+1]>=0){
        if(i+1<=j+1) nxt[i+1][j+1] = max(nxt[i+1][j+1], prev[i][j]+c(i+1,j+1));
        if(v[k][i]>=0) nxt[i][j+1] = max(nxt[i][j+1], prev[i][j]+c(i,j+1));
      }
    }
    swap(prev,nxt);
  }

  cout << prev[d-1][d-1] << endl;
  return 0;
}


Measured memory_bytes: 1120
import itertools
N = int(input())

num_dic = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}
for i in range(N):
    S = input()
    if S[0] in num_dic.keys():
        num_dic[S[0]] += 1

ans = 0
for i, j, k in itertools.combinations(num_dic.keys(), 3):
    ans += num_dic[i] * num_dic[j] * num_dic[k]
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
    int k,x;
    scanf("%d %d",&k,&x);
    int isi = x-(k-1);
    int i = 0;
    while(i < k*2-1) {
        printf("%d ",isi);
        isi++;i++;
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
  int cheapest, m, n, x, i;
  scanf("%d%d",&n,&x);
  for(i=0;i<n;i++){
    scanf("%d",&m);
    if(cheapest==0||m<cheapest)cheapest=m;
    x-=m;
  }
  printf("%d",n+x/cheapest);
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	N := readint()
	K := readint()
	H := make([]int, N)
	for i := 0; i < N; i++ {
		H[i] = readint()
	}
	sort.Sort(sort.IntSlice(H))
	ans := 0
	for i := 0; i < N-K; i++ {
		ans += H[i]
	}
	fmt.Println(ans)
}

const (
	iobufsize = 1 * 1024 * 1024 // 1 MB
)

var stdinsc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, iobufsize), iobufsize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func readint() int {
	stdinsc.Scan()
	v, err := strconv.Atoi(stdinsc.Text())
	if err != nil {
		panic(err)
	}
	return v
}

func readstr() string {
	stdinsc.Scan()
	return stdinsc.Text()
}

func pow(x, y int) int {
	if y < 1 {
		return 1
	}
	return x * pow(x, y-1)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 5120
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define puts(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

void solve(void){

	int a, b, c;
	cin >> a >> b >> c;

	putln((a^b^c));

}

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


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



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



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}



int char_to_int(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4;
	case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9;
	default: return 0;
	}
}


//エラトステネスの篩で、prime で ないところに false を入れる。
//true で初期化された vector を代入する必要がある。
void prime_judge(vector<bool>& prime_or_not) {

	prime_or_not.at(0) = false;
	prime_or_not.at(1) = false;

	ll n = prime_or_not.size() - 1;
	ll region = sqrt(n) + 1;

	for (ll i = 2; i <= n / 2; i++) {
		prime_or_not.at(2 * i) = false;
	}


	for (ll i2 = 1; i2 < n / 2; i2++) {
		ll i = 2 * i2 + 1;  //ここからは奇数のみ探索
		if (i < region && prime_or_not.at(i)) {
			ll j = i * i;
			while (j < n + 1) {
				prime_or_not.at(j) = false;
				j += 2 * i;
			}
		}
	}
};



map<int, int> divide_to_prime(int target) {
	map<int, int> res;

	//sqrt(target) まで調べる。
	int upper_lim = ceil(sqrt(target));
	vector<bool> prime_or_not(upper_lim + 1, true);

	if (upper_lim < 20) prime_or_not.assign(25, true);
	prime_judge(prime_or_not);

	int tempo = target;
	rep(i, upper_lim + 1) {
		if (prime_or_not.at(i)) {
			while (tempo % i == 0) {
				tempo /= i;
				res[i]++;
			}
		}
	}

	if (tempo != 1) res[tempo]++; //sqrt(target) より大きな素因数は高々1つしかない。



	return res;
}





signed main() {
	ld a, b, x;
	cin >> a >> b >> x;
	ld tan_theta = 0;
	ld cot_theta = 0;
	ld theta = 0;

	if (2 * x >= a * a * b) {
		tan_theta = 2.0 * (a * a * b - x) / (a * a * a);
		theta = atan(tan_theta) * 180 / acos(-1);
	}
	else {
		cot_theta = 2*x / (b * b * a);
		theta = 90.00 - atan(cot_theta) * 180 / acos(-1);
	}

	

	//cout << tan_theta << endl;
	printf("%.12Lf\n", (long double)theta);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    VI a(n), ta;
    rep(i, n) cin >> a[i];
    ta = a;
    sort(all(ta));
    ta.erase(unique(all(ta)), ta.end());
    int ans = 1001001001;
    vector<bool> discarded(n, false);
    rep(i, ta.size()) {
        int l = 0;
        priority_queue<int, VI, greater<int>> p, cur_p;
        rep(r, n) {
            if (discarded[r]) {
                int cnt = max(0, r - l - k + 1);
                while(cnt-- && !cur_p.empty()) {
                    p.push(cur_p.top());
                    cur_p.pop();
                }
                while(!cur_p.empty()) cur_p.pop();
                l = r + 1;
            } else {
                cur_p.push(a[r]);
            }
        }
        int cnt = max(0, n - l - k + 1);
        while(cnt-- && !cur_p.empty()) {
            p.push(cur_p.top());
            cur_p.pop();
        }
        if (p.size() < q) {
            break;
        }
        int mn, mx;
        mn = p.top(); p.pop();
        mx = mn;
        rep(_, q - 1) {
            mx = p.top(); p.pop();
        }
        chmin(ans, mx - mn);
        rep(j, n) if (a[j] == ta[i]) discarded[j] = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
N=int(input())
F=[]
for i in range(N):
    f=list(map(int,input().split()))
    F.append(f)
P=[]
for i in range(N):
    p=list(map(int,input().split()))
    P.append(p)
ans=-10**12
for i in range(1,2**10):
    i=bin(i)[2:].zfill(10)
    res=0
    for n in range(N):
        tmp=0
        for j in range(10):
            if i[j]=="1" and F[n][j]==1:
                tmp+=1
        res+=P[n][tmp]
    ans=max(ans,res)
print(ans)


Measured memory_bytes: 42864
#include<cstdio>
#include<cmath>
#include <bits/stdc++.h>

int main(){

    unsigned int a, b, angle;
    double S, L, h;

    scanf("%d%d%d", &a, &b, &angle);

    S = a * b * sin( M_PI * angle/180 ) / 2;
    L = a + b + sqrt( pow(a, 2) + pow(b, 2) - 2 * a * b * cos( M_PI * angle/180 ) );
    h = 2 * S / a;

    printf("%lf\n%lf\n%lf\n", S, L, h);

    return 0;

}


Measured memory_bytes: 3516
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define rrep(i,l,r)for(ll i=(l);i>r;i--)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}/*swap 交換*/
ll max2(ll a,ll b){return a>=b?a:b;}/*2つのうち大きい数を返す*/ 
ll min2(ll a,ll b){return a>=b?b:a;}/*2つのうち小さい数を返す*/ 
ll ABS(ll a){return a>=0?a:(-a);}/*絶対値*/ 
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

/*nをa進数にしたときの、i桁目の数*/
ll placenai(ll n, ll a, ll i){return i==1?n%a:placenai(n/a,a,i-1);}
/*n(2)の中にある１の数*/
ll standn21(ll n){return n==0?0:n%2+standn21(n/2);}


typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    ll n,ans=0;
    scanf("%lld",&n);
    ll a[n],x[15][15],y[15][15];
    rep(i,0,15){
        rep(j,0,15){
            x[j][i]=2;
            y[j][i]=2;
        }
    }
    rep(i,0,n){
        scanf("%lld",&a[i]);
        rep(j,0,a[i]){
            scanf("%lld%lld",&x[i][j],&y[i][j]);
        }
    }
    ll z=pow(2,n)-1;
    rrep(i,z,0){
        ll f2=0;
        if(ans>standn21(i)) continue;
        // printf("%lld\n",i);
        rep(j,0,n){
            ll f1=0;
            // printf("%lld\n",j);
            if(placenai(i,2,j+1)){
                rep(k,0,a[j]){
                    if(placenai(i,2,x[j][k])!=y[j][k]){
                        break;
                    }
                    f1++;
                }
                if(f1!=a[j]) break;
            }
            f2++;
        }
        if(f2==n){
            ans=standn21(i);
            // printf("%lld ",i);
        }
        // printf("\n");
    }
    printf("%lld\n",ans);
    return 0;
}


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


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //



void solve(){
	string s, t;
	cin >> s >> t;
	int n = s.length(), m = t.length(), ans = 0;
	loop(i, n - m + 1){
		int k = 0;
		int j = 0;
		while(k < m){
			if(s[i + k] == t[k]) j++;
			k++;
			ans = max(ans, j);
		}
		//debug(ans);
	}
	cout << m - ans;
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



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



int main(){
    ll a, b, x; cin >> a >> b >> x;
    ll ans = 0;
    ll big = b / x + 1;
    ll small = (a - 1) / x + 1;//a=0 de -1
    if (a == 0) small = 0;
    ans = big - small;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

def main():
    num, k = map(int, input().split())
    data = list(map(int, input().split()))
    dic = defaultdict(int)
    for i in range(num):
        dic[data[i]] += 1

    dic = sorted(dic.items(), key=lambda x: -x[1])
    ans = 0
    for i in range(min(k, len(dic)), len(dic)):
        ans += dic[i][1]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 101576
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 81;
int dp[maxn][maxn][maxn*maxn]={0};
int a[maxn][maxn];
int main()
{
    int n,m;
    int num;
    cin >> n >> m;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin >> a[i][j];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){
            cin >>num;
            a[i][j]-=num;
        }
//    for(int i=0;i<n;i++)
//        for(int j=0;j<m;j++)
//            cout << a[i][j] <<" \n"[j==m-1];
    dp[0][0][abs(a[0][0])]=1;
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            //num=(80*(i+j));
            if(i){
                for(int k=0;k<=6400;++k){
                    if(dp[i-1][j][k]){
                        dp[i][j][abs(k-a[i][j])]=1;
                        dp[i][j][abs(k+a[i][j])]=1;
                    }
                    //dp[i][j][abs(k-a[i][j])]=dp[i][j][]
                }
            }
            if(j){
                for(int k=0;k<=6400;++k){
                    if(dp[i][j-1][k]){
                        dp[i][j][abs(k-a[i][j])]=1;
                        dp[i][j][abs(k+a[i][j])]=1;
                    }
                    //dp[i][j][abs(k-a[i][j])]=dp[i][j][]
                }
            }
//            cout<<i<<" "<<j<<endl;
//            for(int k=0;k<=10;k++){
//                cout << dp[i][j][k]<<" \n"[k==10];
//            }
        }
    }

    for(int i=0;i<6400;i++){
        if(dp[n-1][m-1][i]==1){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


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

long long reflect(long long a, long long b) {
	if (a % b == 0) {
		return ((a / b) * 2 - 1)*b;
	}
	else {
		return reflect(b, a % b) + ((a / b) * 2) * b;
	}

}

int main() {
	long long n, x;
	cin >> n >> x;
	if (n - x >= x) {
		cout << n + reflect(n - x, x) << endl;
	}
	else {
		cout << n + reflect(x, n - x) << endl;
	}
	return 0;
}


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

int main()
{
    int i,n,flag=0 ;
    cin>>n ;
    int arr[51] ;
    
     
    for(i=0 ;i<n ;i++)
    {
        cin>>arr[i] ;
       
        if(arr[i]!= i+1)
        flag++ ;
    }
    if(flag<=2)
    cout<<"YES";
    else 
    cout<<"NO" ;
     
    
    
    
    return 0;
}


Measured memory_bytes: 256
class Dice
  attr_reader :top, :bottom, :front, :back, :left, :right
  def initialize(pips)
    pips = pips.split.map(&:to_i)
    @top    = pips[0]
    @front  = pips[1]
    @right  = pips[2]
    @left   = pips[3]
    @back   = pips[4]
    @bottom = pips[5]
  end

  def rotate(dir)
    case dir
    when 'E'; tmp = @top; @top = @left; @left = @bottom; @bottom = @right; @right = tmp
    when 'W'; tmp = @top; @top = @right; @right = @bottom; @bottom = @left; @left = tmp
    when 'S'; tmp = @top; @top = @back; @back = @bottom; @bottom = @front; @front = tmp
    when 'N'; tmp = @top; @top = @front; @front = @bottom; @bottom = @back; @back = tmp
    when 'Z'; tmp = @front; @front = @right; @right = @back; @back = @left; @left = tmp
    end
  end
end

d = Dice.new gets
gets.to_i.times do
  t, f = gets.split.map(&:to_i)
  case t
  when d.top
  when d.bottom; d.rotate('N'); d.rotate('N')
  when d.front; d.rotate('N')
  when d.back; d.rotate('S')
  when d.left; d.rotate('E')
  when d.right; d.rotate('W')
  end

  d.rotate('Z') until d.front == f
  puts d.right
end

Measured memory_bytes: 6120
#include <iostream>
#include <algorithm>
#include <stdlib.h>

using namespace std;

void solve() {
    int ans, a, z, i;
    char c;
    bool aFlag, bFlag;
    aFlag = bFlag = false;
    a = z = i = 0;
    while((c = getchar()) > 0) {
        if (c == 'A' && !aFlag) {
            aFlag = true;
            a = i;
        }
        if (c == 'Z') {
            z = i;
        }
        ++i;
    }
    cout << z - a + 1;

}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;

void reOrder(int &a,int &b,int &c)
{
	int b1,b2,b3;
	b1 = a > b?(a > c? a:c):( b>c?b:c);
	b3 = a < b? (a < c? a:c):(b < c?b:c);
	b2 = a+b+c - b1 - b3;
	//
	a = b2;
	b = b3;
	c = b1;
}
int main(){

	int g,a,b,c;

	cin>>g;
	for(int i = 0; i < g; i ++)
	{
		cin>>a>>b>>c;
		{
			reOrder(a,b,c);
			if(a*a + b*b == c*c)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
		}

	}

	
    return 0;
}

Measured memory_bytes: 1152