akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.io.ObjectInputStream.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = (long)1e9+7;
	//final static long MOD = 998244353;

	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		slove(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void slove(String[] args) throws Exception{

		int X=nextInt();
		int Y=nextInt();
		int A=nextInt();
		int B=nextInt();
		int C=nextInt();
		PriorityQueue<Integer> p = new PriorityQueue<>();
		PriorityQueue<Integer> q = new PriorityQueue<>();
		PriorityQueue<Integer> r = new PriorityQueue<>(Comparator.comparing(Integer::intValue,Comparator.reverseOrder()));
		for(int i=0;i<A;i++) {
			p.add(nextInt());
		}

		while(p.size()>X) {
			p.poll();
		}
		for(int i=0;i<B;i++) {
			q.add(nextInt());
		}
		while(q.size()>Y) {
			q.poll();
		}
		for(int i=0;i<C;i++) {
			r.add(nextInt());
		}
		int pMin = p.peek();
		int qMin = q.peek();
		while(!r.isEmpty()) {
			int v = r.poll();
			if(pMin<qMin) {
				if(pMin<v) {
					p.poll();
					p.add(v);
					pMin=p.peek();
				}else {
					break;
				}
			}else {
				if(qMin<v) {
					q.poll();
					q.add(v);
					qMin=q.peek();
				}else {
					break;
				}
			}
		}
		long ans = 0;
		for(int v:p) {
			ans+=v;
		}
		for(int v:q) {
			ans+=v;
		}
		pw.println(ans);
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}



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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  set<int> st;

  int a, b, c;
  cin >> a >> b >> c;
  st.insert(a);
  st.insert(b);
  st.insert(c);

  if(st.size() == 2){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
int main(){
    int n;
     cin >> n;
     vector<ll> a(n), b(n);
     rep(i,n){
        cin >> a[i];
        b[0] += a[i]*pow(-1,i%2);
    }
    rep(i,n-1){
        b[i+1] = 2*a[i]-b[i];
    }
    rep(i,n)cout << b[i] << endl;
    return 0;
}

Measured memory_bytes: 2944
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	while (true) {
		double d, e;
		cin >> d >> e;
		if (d == 0 && e == 0)break;

		double ans = 100000;
		for (double i = 0; i < (d + 1) / 2; i++) {
			double x = hypot(i, d - i);
			x = abs(e - x);
			if (ans > x)ans = x;
		}
		printf("%.6f\n", ans);
	}
}


Measured memory_bytes: 3320
#include <stdio.h>
int main(void) {
    int matrix[11][11],num,i,j;
    while (1) {
        scanf("%d",&num);
        if (num==0) break;
        matrix[num][num]=0;
        for (i=0; i<num; i++) {
            matrix[i][num]=0;
            for (j=0; j<num; j++) {
                if (i==0) matrix[num][j]=0;
                scanf("%d",&matrix[i][j]);
                matrix[i][num]+=matrix[i][j];
                matrix[num][j]+=matrix[i][j];
                matrix[num][num]+=matrix[i][j];
            }
        }
        for (i=0; i<=num; i++) {
            for (j=0; j<=num; j++) printf("%5d",matrix[i][j]);
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 616
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int64_t n, k;
    cin >> n >> k;

    int ans = 0;
    while (n > 0)
    {
        ans++;
        n /= k;
    }
    cout << ans << endl;
}


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

int main(){
  long long n,m; cin >> n >> m;
  string s,t;
  cin >> s;
  cin >> t;
  long long len;
  int a,b;
  if(m < n){
    a = m;
    b = n;
  }
  else{
    a = n;
    b = m;
  }
  int r =  b % a;
  while(r != 0){
    b = a;
    a = r;
    r = b % a;
  }
  len = n*m/a;
  int flag = 0;
  for(long long  i = 0 ; i < a ; i++){
    if(s[i*n/a] != t[i*m/a]){
      flag = 1;
      cout << -1 << endl;
      break;
    }
  }
    if(!flag) cout << len << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;using int32=int_fast32_t;using uint32=uint_fast32_t;using int64=int_fast64_t;using uint64=uint_fast64_t;using pi=pair<int32,int32>;using pll=pair<int64,int64>;using vi=vector<int32>;using vvi=vector<vector<int32>>;using vll=vector<int64>;using ll=int64;using ull=uint64;
#define all(x) x.begin(),x.end()
inline ll read(){ll x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N=read(), R, B;
    string ans="No";
    char c=getchar();
    while(c!='R'&&c!='B')c=getchar();
    while(c=='R'||c=='B'){
        if(c=='R')R++;
        else B++;
        c=getchar();
    }
    if(R>B) ans="Yes";
    printf("%s\n", ans.c_str());
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

ll power_(ll a, ll power){
    ll value = 1;
    
    while(power != 0){
        if(power & 1) value = (value * a);
        a = a * a;
        power = power >> 1;
     
    }
 
    return value;
}

ll get_range(ll k){
    ll pow2 = power_(ll(-2), k);
    if (k % 2 == 0) return (pow2 + 2) / 3;
    else return (pow2 - 1) / 3;
}

int main(void){
    ll N;
    string answer = "";
    cin >> N;

    if (N == 0){cout << 0 << endl; return 0;}

    while(N != 0){
        if (abs(N % 2) == 1){answer = "1" + answer; N -= 1; N /= -2;}
        else {answer = "0" + answer; N /= -2;}
    }

    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;

void bsearch(long long target, long long curVal, vector<long long>&val, long long& rank) {
    int low = 0;
    int up = val.size()-1;
    int greater = -1;

    while (low <= up) {
        int mid = (low + up) / 2;
        long long res = curVal * val[mid];

        if (res <= target) {
            greater = mid;
            low = mid+1;
        } else {
            up = mid-1;
        }
    }

    rank += (greater+1);
}

int main() {
    int N;
    long long K;
    cin >> N >> K;

    vector <long long> val(N);
    vector <long long> rval(N);

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

    sort(val.begin(), val.end());
    rval = val;
    reverse(rval.begin(), rval.end());

    const long long INF = 1000000000000000000LL;
    long long low = -INF;
    long long up = INF;
    long long ans = INF;

    while (low <= up) {
        long long rank = 0; // how many numbers <= mid
        long long mid = (low+up) / 2;

        for (int i = 0; i < val.size(); ++i) {
            if (val[i]*val[i] <= mid) { //avoid self*self
                --rank;
            }

            if (val[i] < 0) {
                bsearch(mid, val[i], rval, rank);
            } else {
                bsearch(mid, val[i], val, rank);
            }
        }

        rank /= 2;

        if (rank >= K) {
            up = mid-1;
            ans = mid;
        } else {
            low = mid+1;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

LL MOD = 998244353;
void solve(long long N, std::vector<long long> X, std::vector<long long> D)
{
  vector<PII> data;
  for (int i = 0; i < N; i++)
    data.push_back(PII(X[i], D[i]));
  sort(data.begin(), data.end());

  LL ans = 1;
  stack<PII> sta;
  for (auto xd : data)
  {
    LL x = xd.first;
    LL d = xd.second;

    while (!sta.empty())
    {
      auto val = sta.top();
      if (x >= val.first)
      {
        // /cout << x << " " << val.second << endl;
        ans += val.second;
        ans %= MOD;
        sta.pop();
      }
      else
        break;
    }
    sta.push(PII(x + d, ans));
  }
  while (!sta.empty())
  {
    ans += sta.top().second;
    ans %= MOD;
    sta.pop();
  }
  cout << ans << endl;
}

int main()
{
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  std::vector<long long> X(N);
  std::vector<long long> D(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &X[i]);
    scanf("%lld", &D[i]);
  }
  solve(N, std::move(X), std::move(D));
  return 0;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n,t; cin >> n >> t;
    ll ans=t;
    ll locate=t;
    rep(i,0,n){
        ll tm; cin >> tm;
        if(tm>=locate){
            ans += t;
            locate=tm + t;
        }else{
            ans += tm + t -locate;
            locate = tm + t;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << "\n";
  
}

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

#define lli long long int
#define endl "\n"
#define debug(n) cout<<n<<endl
#define debug2(a, b) cout<<a<<" "<<b<<endl;
#define forn(i, in, fin) for(int i = in; i<fin; i++)
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define x first
#define y second
#define punto pair<lli,lli>

using namespace std;

struct Edge{
    lli flow, capacity, to;
    Edge *res;
    Edge(lli to, lli flow, lli capacity): to(to), flow(flow), capacity(capacity) {}
    
    void addFlow(lli flow)
    {
        this->flow += flow;
        this->res->flow -= flow;
    }
};

vector< vector<Edge*> >  adjList;
vector< lli >  dist;
vector< lli >  pos;
const lli INF = numeric_limits<int>::max();
lli n; 

void addEdge(lli u, lli v, lli capacity)
{
    Edge *uv = new Edge(v, 0, capacity);
    Edge *vu = new Edge(u, 0, 0);
    uv->res = vu;
    vu->res = uv;
    adjList[u].push_back(uv);
    adjList[v].push_back(vu);
}

lli blockingFlow(lli u, lli t, lli flow)
{
    if(u==t) return flow;
    for(lli &i = pos[u]; i<adjList[u].size(); i++)
    {
        Edge *v = adjList[u][i];
        if(v->capacity > v->flow && dist[u] + 1 == dist[v->to])
        {
            lli f = blockingFlow(v->to, t, min(flow, v->capacity - v->flow));
            if(f > 0)
            {
                v->addFlow(f);
                return f;
            }
        }
    }
    return 0;
}


lli dinic(lli s, lli t)
{
    lli maxFlow = 0;
    dist[t] = 0;
    while(dist[t]!=-1) 
    {
        fill(all(dist), -1);
        queue<lli> q; q.push(s);
        dist[s] = 0;
        while(!q.empty())
        {
            lli u = q.front(); q.pop();
            for(Edge* v: adjList[u])
            {
                if(dist[v->to] == -1 && v->capacity > v->flow)
                {
                    dist[v->to] = dist[u] + 1;
                    q.push(v->to);
                }
            }
        }
        if(dist[t] != -1)
        {
            lli f = 0;
            fill(all(pos), 0);
            while(f = blockingFlow(s, t, INF))
            {
                maxFlow += f;
            }
        }
    }
    return maxFlow;
}

int main()
{
    fastIO();
    cin>>n;
    adjList.resize(2*n + 2);
    pos.resize(2*n + 2);
    dist.resize(2*n + 2);
    vector<punto> red(n+1);
    vector<punto> blue(n+1);
    // 2*(n) -> inicio, 2*(n+1) -> fin  
    //inicio  -> red -> blue -> fin
    forn(i, 1, n+1)
    {
        cin>>red[i].x>>red[i].y;
        addEdge(0, i, 1 );
    }
    forn(i,1,n+1)
    {
        cin>>blue[i].x>>blue[i].y;
        addEdge(i+n, 2*n+1, 1 );
    }
    forn(i, 1, n+1)
    {
        forn(j, 1, n+1)
        {
            if(red[i].x < blue[j].x && red[i].y < blue[j].y)
            {
                addEdge(i, j+n, 1);
            }
        }
    }
    cout<< dinic(0, 2*n+1) <<endl;


    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline int Mult(int x,int y){long z=x*y-(long)((long double)x/MOD*y+1e-8)*MOD;return z;}
static inline void Radix(int A[],const int N)
{
  int temp[200001];
  rep(k,4)
  {
    int u[256]={},v[256]={};
    rep(i,N)u[A[i]>>8*k&255]++;
    rep(i,255)u[i+1]+=u[i];
    rep(i,N){temp[--u[A[N-1-i]>>8*k&255]]=A[N-1-i];}k++;
    rep(i,N)v[temp[i]>>8*k&255]++;
    rep(i,255)v[i+1]+=v[i];
    rep(i,N)A[--v[temp[N-1-i]>>8*k&255]]=temp[N-1-i];
  }
}
int main()
{
  int N=IN(),K=IN(),m=0,p=0,z=0,accum=1,A[200000];
  rep(i,N){A[i]=IN();if(A[i]>0)p++;else if(A[i]<0)m++;else z++;}
  Radix(A,N);
  if(K==N){if(z){return puts("0"),0;}else{rep(i,K){accum=Mult(accum,A[i]);}K=0;}}
  if(m+p<K)return puts("0"),0;
  if(!p&&K&1){if(z){return puts("0"),0;}else rep(i,K){accum=Mult(accum,A[N-1-i]);}K=0;}
  p+=z,m=p;
  if(K&1){K--;accum=Mult(accum,A[--p]);}
  while(K)
  {
    K-=2;
    if(p>1&&m<N-1&&1l*A[p-1]*A[p-2]>1l*A[m]*A[m+1]){accum=Mult(Mult(accum,A[--p]),A[--p]);continue;}
    if(p>1&&m<N-1&&1l*A[p-1]*A[p-2]<1l*A[m]*A[m+1]){accum=Mult(Mult(accum,A[m++]),A[m++]);continue;}
    if(p>1){accum=Mult(Mult(accum,A[--p]),A[--p]);continue;}
    if(m<N-1){accum=Mult(Mult(accum,A[m++]),A[m++]);continue;}
  }
  return printf("%d\n",accum<0?accum+MOD:accum),0;
}

Measured memory_bytes: 3176
#include <cstdlib>
#include <functional>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <string>

#define ll long long int

using namespace std;

ll factorial(ll x) {
  if (x == 0) {
    return 1;
  }

  ll ret = 1;
  for (ll i = 1; i <= x; i++) {
    ret *= i;
  }
  return ret;
}

int main(int argc, char *argv[])
{
  string s;
  cin >> s;

  for (ll i = 0; i < s.size(); i++) {
    if (s[i] == s[i+1]) {
      cout << i + 1 << " " << i + 2;
      return 0;
    }

    if (s[i] == s[i+2]) {
      cout << i + 1 << " " << i + 3;
      return 0;
    }
  }

  cout << "-1 -1";
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

bool isMM(string s){
  if((s[0] == '0' && s[1] != '0' ) || s == "10" || s=="11" || s=="12"){
    return true;
  }else{
    return false;
  }
}

int main(){
  string S;
  cin >> S;

  if(isMM(S.substr(2,2)) && isMM(S.substr(0,2))){
    cout << "AMBIGUOUS" << endl;
  }else if(isMM(S.substr(2,2))){
    cout << "YYMM" << endl;
  }else if(isMM(S.substr(0,2))){
    cout << "MMYY" << endl;
  }else{
    cout << "NA" << endl;
  }

}


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

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define mp make_pair
#define F first
#define S second


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(long long* a,long long n,long long val){
	for(long long i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	rep(i,0,n){
	    cout<<a[i]<<b[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 int N,C; cin >> N >> C;
  
  vector<vector<int>> ch(C, vector<int>(100100,0));
  for(int i = 0; i < N; i++){ 
    int s,t,c; cin >> s >> t >> c; c--; t++;
    ch[c][s]++; ch[c][t]--;}
  
  for(int c = 0; c < C; c++){
    for(int j = 0;  j+1 < 100100; j++){
      ch[c][j+1] += ch[c][j];}}
  
  for(int i = 0; i < C; i++){
    for(int j = 0; j < 100100; j++){
      if(ch[i][j]){ ch[i][j] = 1;}}}
  
  ll ans = 0;
  
  for(int i = 0; i < 100100; i++){
    
      ll res = 0;
    
      for(int j = 0; j < C; j++){
        res+= ch[j][i];}
    
    ans = max(ans, res);}
 
  
  cout << ans << endl; return 0;}
 
                          

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

int main(){
  int i,n;
  double x1,y1,r1,x2,y2,r2,dist;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&r1,&x2,&y2,&r2);
    dist=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    if((dist+r2)<r1){
      printf("2");
    }else if((dist+r1)<r2){
      printf("-2");
    }else if(dist<=(r1+r2)){
      printf("1");
    }else{
      printf("0");
    }
    printf("\n");
  }
  return 0;
}

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

int main(){
    long long N;
    cin>>N;
    vector<long long> a(N);
    for(int i=0;i<N;i++) cin>>a[i];
    int ans=0;
    for(int i=0;i<N;i++){
        while(1){
            if(a[i]%2!=0){
                break;
            }else{
                a[i] /= 2;
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> doup;

ll N, M;
ll x[100001];
vector<P> G[100000];
ll ans;

void bfs(ll s) {
    ll i, u;
    P v;
    queue<ll> q;
    x[s]=0;
    q.push(s);
    
    while(q.size()) {
        u=q.front(); q.pop();
        
        for(i=0; i<G[u].size(); i++) {
            v=G[u][i];
            if(x[v.first]==INF) {
                x[v.first]=x[u]+v.second;
                q.push(v.first);
            }else if(x[v.first]!=x[u]+v.second) {
                ans=0;
                return;
            }
            
        }
        
    }
    
}




int main(void) {
    ll l, r, d, i;
    cin >> N >> M;
    ans=1;
    for(i=0; i<M; i++) {
        cin >> l >> r >> d;
        l--; r--;
        G[l].push_back(P(r, d));
        G[r].push_back(P(l, -d));
    }
    
    for(i=0; i<N; i++) {
        x[i]=INF;
    }
    
    
    for(i=0; i<N; i++) {
        if(x[i]!=INF) continue;
        bfs(i);
        if(ans==0) {
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
}


Measured memory_bytes: 14080
#include<cstdio>
#include<algorithm>
using namespace std;
struct point {
	int x, y;
	bool operator<(const point &p)const {
		return x != p.x?x<p.x:y<p.y;
	}
}A[110], B[110];
int n, v[110], res;
int main() {
	int i, j;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &A[i].x, &A[i].y);
	}
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &B[i].x, &B[i].y);
	}
	sort(B + 1, B + n + 1);
	for (i = 1; i <= n; i++) {
		int pv = -1;
		for (j = 1; j <= n; j++) {
			if (!v[j] && A[j].x < B[i].x && A[j].y < B[i].y) {
				if (pv == -1 || A[pv].y < A[j].y)pv = j;
			}
		}
		if(pv!=-1)v[pv] = 1, res++;
	}
	printf("%d\n", res);
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main() 
{
    int A,B,C;
    cin >>A>>B>>C;
	
  	if(A==B || A==C || B==C)
    {
      if(A==B&&A==C&&B==C)
      {
            cout<<"No"<<endl;
      }
      else
      {
            cout<<"Yes"<<endl;
      }
    }
    else
    {
        cout<<"No"<<endl;
    }   

}

Measured memory_bytes: 3556
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (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 (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール
bool is_ge(ll k, const vector<ll> &a) {

    vector<bool> g(a.size());
    REP(i, a.size()) g[i] = a[i] >= k ? true : false;

    ll m = a.size();
    ll i = m / 2;
    if (g[i] != g[i-1] && g[i] != g[i+1]) {
        bool is_corner = true;
        REP(j, m-1) if (g[j] == g[j+1]) {
            is_corner = false;
            break;
        }
        if (is_corner) {
            return g[0];
        } else {
            ll cl = i, cr = i;
            while (cl >  0  && g[cl] != g[cl-1] && g[cl] != g[cl+1]) cl--;
            while (cr < m-1 && g[cr] != g[cr-1] && g[cr] != g[cr+1]) cr++;
            if (i - cl < cr - i) {
                return g[cl];
            } else {
                return g[cr];
            }
        }
    } else {
        return g[i];
    }

}

// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> a(n*2-1);
    REP(i, n*2-1) cin >> a[i];

    ll ok = 0;
    ll ng = n*2;
    while (ng - ok > 1) {
        ll mid = (ok + ng) / 2;
        if (is_ge(mid, a)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << endl;
    
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 a,b,c,x,y;
void solve(){
	cin >> a >> b >> c >> x >> y;
	
	cout << min((a*x+b*y) , min(c*max(x,y)*2 , c*min(x,y)*2+(x>y?(x-y)*a:(y-x)*b))) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int x, c, a, b;
	int cnt = 0;
	scanf("%d %d %d %d", &a, &b, &c,&x);
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if (500 * i + 100 * j + 50 * k == x)
					cnt++;
			}
		}
	}
	printf("%d", cnt);
}

Measured memory_bytes: 128
using System;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            ulong ans = 1;

            for(int i = 0; i < N; i++)
            {
                ulong T;
                T = ulong.Parse(Console.ReadLine());
                ans = lcm(ans, T);
            }

            Console.WriteLine(ans);
        }

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

        static ulong lcm(ulong a, ulong b)
        {
            ulong g = gcd(a, b);
            return a / g * b;
        }

    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "../../../debug_print.hpp"
#else
#define debug(...)
#endif
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int a, b;
    scan(a, b);
    string aa = "";
    string bb = "";
    rep(i, b) { aa += to_string(a); }
    rep(i, a) bb += to_string(b);
    if (aa < bb)
        print(aa);
    else
        print(bb);

    return 0;
}

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

typedef long long ll;

const int maxn = 200005;

int f[maxn];

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm

    int n, x, y;
    cin >> n >> x >> y;

    for( int i = 1; i <= n; i++ ){
        for( int j = i+1; j <= n; j++ ){
            int d = j-i;
            int d1 = abs(i - x) + abs(j - y) + 1;
            d = min(d, d1);
            f[d]++;
        }
    }

    for( int i = 1; i < n; i++ )
        cout << f[i] << "\n";
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

long long int f1(long long int n) {
	long long int res = 0;
	while (n > 0) {
		res += n / 5;
		n /= 5;
	}
	return res;
}

long long int f2(long long int n) {
	long long int res = 0;
	if (n < 10) return 0;
	res += n / 10;
	res += f1(n / 10);
	return res;
}

int main(int argc, char *argv[]) {
	long long int n;
	long long int res;
	cin >> n;
	if (n < 10) {
		cout << 0 << endl;
		return 0;
	}
	if (n % 2 == 0) {
		res = f2(n);
	}
	else {
		res = 0;
	}
	cout << res << endl;
}









Measured memory_bytes: 256
/*

road to the IOI
&author : kair011a_

*/
#include <bits/stdc++.h>

#define PB push_back
#define F first
#define S second
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()

#define open(name) \
    freopen(name".in", "r", stdin); \
    freopen (name".out", "w", stdout);

using namespace std;

const int N = 1e5 + 7;
const int logg = 20;
const int INF = 1e9 + 7;
const int p = 31;

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

int n;
int dp1[N], dp2[N], dp3[N];

void solve() {
    cin >> n;
    for (int i = 1; i <= n; i ++) {
        int a, b, c;
        cin >> a >> b >> c;

        if (i == 1) {
            dp1[1] = a, dp2[1] = b, dp3[1] = c;
        } else {
            dp1[i] = max(dp2[i - 1], dp3[i - 1]) + a;
            dp2[i] = max(dp1[i - 1], dp3[i - 1]) + b;
            dp3[i] = max(dp2[i - 1], dp1[i - 1]) + c;
        }
    }
    cout << max(dp1[n], max(dp2[n], dp3[n]));
}

main() {
    ios::sync_with_stdio(false);
    //open("LOSER");
    solve();
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn=200010;
struct point
{
	int l,r;
}q[maxn];
int b[maxn];
int s0[maxn],s1[maxn],mn[maxn*4],tag[maxn*4];
int n,Q;
vector<int> a[maxn];

inline bool cmp(const point &x,const point &y)
{
	return x.l<y.l;
}

inline void push_up(int p)
{
	mn[p]=min(mn[p<<1],mn[p<<1|1]);
}

inline void push_down(int p)
{
	if(tag[p])
	{
		tag[p<<1]+=tag[p];
		tag[p<<1|1]+=tag[p];
		mn[p<<1]+=tag[p];
		mn[p<<1|1]+=tag[p];
		tag[p]=0;
	}
}

inline void ins(int p,int l,int r,int x,int der)
{
	push_down(p);
	if(l==r)
	{
		mn[p]=min(mn[p],der);
		return;
	}
	push_down(p);
	int mid=(l+r)>>1;
	if(x<=mid) ins(p<<1,l,mid,x,der);
	else ins(p<<1|1,mid+1,r,x,der);
	push_up(p);
}

inline void add(int p,int l,int r,int L,int R,int der)
{
	if(L>R) return;
	push_down(p);
	if(l>=L && r<=R)
	{
		tag[p]+=der;
		mn[p]+=der;
		return;
	}
	push_down(p);
	int mid=(l+r)>>1;
	if(L<=mid) add(p<<1,l,mid,L,R,der);
	if(R>mid) add(p<<1|1,mid+1,r,L,R,der);
	push_up(p);
}

inline int query(int p,int l,int r,int L,int R)
{
	if(L>R) return 1e9;
	if(l>=L && r<=R)
		return mn[p];
	push_down(p);
	int mid=(l+r)>>1;
	int res=1e9;
	if(L<=mid) res=query(p<<1,l,mid,L,R);
	if(R>mid) res=min(res,query(p<<1|1,mid+1,r,L,R));
	return res;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%d",&b[i]);
		if(b[i]==0) s0[i]=1;
		else s1[i]=1;
		s0[i]+=s0[i-1],s1[i]+=s1[i-1];		
	}
	scanf("%d",&Q);
	for(int i=1;i<=Q;i++)
		scanf("%d%d",&q[i].l,&q[i].r);
	sort(q+1,q+Q+1,cmp);
	for(int i=1;i<=Q;i++)
		a[q[i].l].push_back(q[i].r);
	for(int i=1;i<=n*4+4;i++) mn[i]=1e9;
	ins(1,0,n,0,0);
	for(int i=1;i<=n;i++)
	{
		int si=a[i].size();
		for(int nn=0;nn<si;nn++)
		{
			int dd=query(1,0,n,0,a[i][nn]);
			ins(1,0,n,a[i][nn],dd);
		}
		if(s1[i]-s1[i-1]) add(1,0,n,0,i-1,1);
		else add(1,0,n,0,i-1,-1);
	}
	printf("%d",s0[n]+query(1,0,n,0,n));
	return 0;
}


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

using ll=long long;
int main(){
    ll N;
    cin>>N;
    for(ll h=1;h<=3500;h++){
        for(ll n=1;n<=3500;n++){
            ll nhn=N*h*n;
            ll bun=4*h*n-N*(h+n);
            if(bun!=0 && nhn%bun==0 && bun>0){
                cout<<h<<" "<<n<<" "<<nhn/bun<<endl;
                return 0;
            }
            
        }
    }

    return 0;    
}

Measured memory_bytes: 256
def main():
    n = int(raw_input())
    a = map(int, raw_input().split())
    s = sum(a)
    t = n * (n + 1) / 2
    if s % t:
        print "NO"
        return
    t = s / t
    a += [a[0]]
    b = [a[i+1] - a[i] - t for i in xrange(n)]
    c = [0] * (n + n)
    d = [0] * (n + n)
    for i, x in enumerate(b):
        if x % n:
            print "NO"
            return
        b[i] = -x / n
        c[i+n] += b[i]
    b += [0] * n
    k = 0
    s = 0
    for i in xrange(n + n):
        k += b[i]
        d[i] += s if s > 0 else 0
        s += k
        k -= c[i]
        s -= c[i] * (n + 1)
    for i in xrange(n):
        if a[i] != d[i] + d[i+n]:
            print "NO"
            return
    print "YES"
main()


Measured memory_bytes: 15532
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

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

#define MAX_V 101000
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void add_edge(int from, int to){
    G[from].push_back(to);
    rG[to].push_back(from);
}

void dfs(int v){
    used[v] = true;
    for(auto u: G[v]){
        if(!used[u]){
            dfs(u);
        }
    }
    vs.push_back(v);
}

void rdfs(int v, int k){
    used[v] = true;
    cmp[v] = k;
    for(auto u: rG[v]){
        if(!used[u]){
            rdfs(u, k);
        }
    }
}

int scc(int N){
    memset(used, 0, sizeof(used));
    vs.clear();

    for(int v = 0; v < N; v++) {
        if (!used[v]) {
            dfs(v);
        }
    }

    memset(used, 0, sizeof(used));
    int k = 0;
    for(int i = vs.size() - 1; i >= 0; i--){
        if(!used[vs[i]]){
            rdfs(vs[i], k++);
        }
    }
    return k;
}

int main(){
    int v, e;
    cin >> v >> e;
    for(int i = 0; i < e; i++){
        int x, y;
        cin >> x >> y;
        add_edge(x, y);
    }

    int k = scc(v);
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        int x, y;   cin >> x >> y;
        if(cmp[x] == cmp[y]){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
    }



    return 0;
}



Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	string s;
	cin >> s;
	string ans;
	if(s == "Sunny") ans = "Cloudy";
	else if(s == "Cloudy") ans = "Rainy";
	else if(s == "Rainy") ans = "Sunny";
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    string S;
    cin >> S;

    int price = 700;
    for (int i = 0; i < S.length(); ++i) {
        if (S[i] == 'o') {
            price += 100;
        }
    }

    cout << price << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int n, d; scanf("%d %d", &n, &d);
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ll x, y; scanf("%lld %lld", &x, &y);
		if (x*x + y*y <= (ll)d*d) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3824
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int m1 , m2;
    m1 = min(a,b);
    m2 = a+b-n;
    if(m2<0)m2=0;

    cout << m1 << " " << m2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int a,b;
  cin>>a>>b;
  int x=a/__gcd(a,b);
  int y=b;
  if(x<=1000 && y<=1000){
    cout<<x*y<<endl;
    return 0;
  }
  int p=(x%1000)*(y%1000)%1000;
  int q=(x%1000)*(y%1000)/1000;
  int r=(x/1000)*(y%1000);
  int s=(x%1000)*(y/1000);
  int t=(x/1000)*(y/1000)*1000;
  int left=q+r+s+t;
  int right=p;
  printf("%d%03d",left,right);
  return 0;
}
  

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    string S,T;
    cin >> S >> T;

    int ans = T.size();
    REP(i,S.size()) {
        if ((i+T.size()) > S.size()) break;
        int cnt = 0;
        FOR(j,i,i+T.size()) {
            if(S[j] != T[j-i]) cnt ++;
        }
        chmin(ans,cnt);
    }
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main(void)
{
  int x,y;
  int z=0;
  scanf("%d%d",&x,&y);
  if(x<y)
  {
    z=x;
    x=y;
    y=z;
  }

  int d=0;
  d=x%y;
  while(d!=0)
  {
    x=y;
    y=d;
    d=x%y;
  }
  printf("%d\n",y);
  return 0;
}



Measured memory_bytes: 2092
#include<stdio.h>
#include<algorithm>

using namespace std;

int ar[3];

int main() {
  for (int i = 0; i < 3; i++) {
    scanf("%d", &ar[i]);
  }
  if (ar[0] == ar[1] && ar[1] == ar[2] && ar[0] % 2 == 0) {
    printf("-1\n");
  } else {
    int ans = 0;
    while (ar[0] % 2 == 0 && ar[1] % 2 == 0 && ar[2] % 2 == 0) {
      int ta = ar[1] / 2 + ar[2] / 2;
      int tb = ar[0] / 2 + ar[2] / 2;
      int tc = ar[0] / 2 + ar[1] / 2;
      ar[0] = ta;
      ar[1] = tb;
      ar[2] = tc;
      ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void){

int a,b,i=0,j=0,flagone=0,flagtwo=0;

char s[10],t[10],u[10];

scanf("%s %s",&s,&t);

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

scanf("%s",&u);

while(s[i]!='\0'&&u[i]!='\0'){
  if(s[i]!=u[i]){
    flagone=1;
    break;
  }else{
    i++;
  }
}

while(t[j]!='\0'&&u[j]!='\0'){
  if(t[j]!=u[j]){
    flagtwo=1;
    break;
  }else{
    j++;
  }
}

if(flagone==0){printf("%d %d",a-1,b);}
if(flagtwo==0){printf("%d %d",a,b-1);}

return 0;

}

Measured memory_bytes: 1732
n = int(input())
a = list(map(int,input().split()))

l = 1
m = 1
r = 3

sumll = a[0]
suml = a[0]
sumrr = sum(a[3:])
sumr = a[1]+a[2]+sumrr

res = sumr + a[0]

for m in range(1,n-2):
    suml += a[m]
    sumr -= a[m]
    while sumll+a[l]<=suml/2 and l<m:
        sumll += a[l]
        l += 1
    while sumrr-a[r]>=sumr/2 and r<n-1:
        sumrr -= a[r]
        r += 1
    p1 = sumll
    q1 = suml - sumll
    r1 = sumr - sumrr
    s1 = sumrr
    # print(p1,q1,r1,s1)
    p2 = p1 + a[l]
    q2 = q1 - a[l]
    r2 = r1 + a[r]
    s2 = s1 - a[r]
    abs1 = max(p1,q1,r1,s1)-min(p1,q1,r1,s1)
    abs2 = max(p2,q2,r2,s2)-min(p2,q2,r2,s2)
    abs3 = max(p1,q1,r2,s2)-min(p1,q1,r2,s2)
    abs4 = max(p2,q2,r1,s1)-min(p2,q2,r1,s1)
    rest = min(abs1,abs2,abs3,abs4)
    if res > rest:
        res = rest

print(res)

Measured memory_bytes: 25672
#include <stdio.h>

int array[10000];

int n;
int search(int q){
int i = 0, flag = 0;
  while(i <= n){
     if(q == array[i]){
      flag = 1;
     }
     i++;

   }
  return flag;

}


int main(){
int i = 0, q = 0, p, sum = 0;
 scanf("%d", &n);
 for(i; i <= n - 1; i++)
   scanf("%d", &array[i]);

 scanf("%d", &q);

 for(i = 0; i <= q - 1; i++){
    scanf("%d", &p);
    sum += search(p);
 }

 printf("%d\n", sum);
 return 0;
}

Measured memory_bytes: 636
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


class FenwickTree {
    public:

        FenwickTree(int n) : N(n), data(n, 0) {
        }

        void put(int x, int v) {
            for (; x < N; x |= x + 1) {
                data[x] += v;
            }
        }
        int get(int x) {
            int res = 0;
            for (; x >= 0; x = (x & (x + 1)) - 1) {
                res += data[x];
            }
            return res;
        }

        int get(int l, int r) {
            if (l > r) {
                return 0;
            }
            return get(r) - get(l - 1);
        };

    private:
        int N;
        vector<int> data;
};


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<long long> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    vector<long long> X;
    for (int i = 0; i < n; ++i) {
        X.push_back(i - A[i]);
        X.push_back(i + A[i]);
    }
    sort(X.begin(), X.end());
    X.resize(unique(X.begin(), X.end()) - X.begin());
    auto index = [&](long long x) {
        return lower_bound(X.begin(), X.end(), x) - X.begin();
    };


    FenwickTree ft(X.size() + 123);

    long long res = 0;

    for (int i = 0; i < n; ++i) {
        int x = index(i - A[i]);
        res += ft.get(x, x);
        
        x = index(i + A[i]);
        ft.put(x, 1);
    }

    cout << res << '\n';

    
    return 0;
}

Measured memory_bytes: 9036
#include <iostream>
     
using namespace std;
const int MAX=(1<<18);
typedef long long ll;
     
int N;
int h[200007];
int a[200007];
ll tree[2*MAX+7];
     
void Update(ll a, ll b)
{
    a+=MAX;
    while(a != 0)
    {
        tree[a]=max(tree[a], b);
        a/=2;
    }
    return;
}
     
ll Query(ll a, ll b)
{
    a+=MAX;
    b+=MAX;
    ll odp=0;
    while(a <= b)
    {
        if(b%2==0) odp=max(odp, tree[b]);
        if(a%2==1) odp=max(odp, tree[a]);
        a=(a+1)/2;
        b=(b-1)/2;
    }
    return odp;
}
     
int main()
{
    cin >> N;
    for(int i=1; i<=N; i++)
        cin >> h[i];
    for(int i=1; i<=N; i++)
        cin >> a[i];
    for(int i=1; i<=N; i++)
        Update(h[i], Query(1, h[i])+a[i]);
    cout << Query(1, MAX);
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <queue>
#include <math.h>
using namespace std;

#define ll long long

int main(){

    double r;
    cin >> r;

    printf("%.6lf ", M_PI*r*r);
    printf( "%.6lf\n", 2*M_PI*r);
    
    return 0;
}

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

int main() {
  char b;
  cin >> b;
  if(b=='A') cout << 'T' << endl;
  if(b=='T') cout << 'A' << endl;
  if(b=='C') cout << 'G' << endl;
  if(b=='G') cout << 'C' << endl;
}

Measured memory_bytes: 256
W,H,x,y,r = raw_input().split()
W,H,x,y,r = map(int,(W,H,x,y,r))
def isXok(W,H,x,y,r):
    if x-r<0 or x+r>W:
        return False
    else:
        return True
def isYok(W,H,x,y,r):
    if y-r<0 or y+r>H:
        return False
    else:
        return True
if isXok(W,H,x,y,r) and isYok(W,H,x,y,r):
    print "Yes"
else:
    print "No"

Measured memory_bytes: 4224
n=input()
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

result=sum(b)
for i in range(len(a)-1):
  if a[i]+1==a[i+1]:
    result+=c[a[i]-1]
print(result)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 3 2");
            //YES
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2 3 4");
            //NO
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        int Val = wkArr[1] * 10 + wkArr[2];
        Console.WriteLine((Val % 4 == 0) ? "YES" : "NO");
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        String message;
        if(a > b) message = "a > b";
        else if(a < b) message = "a < b";
        else message = "a == b";
        System.out.println(message);
    }
}



Measured memory_bytes: 26196