akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int maxKeta(int n){
  while(n>=10)n/=10;
  return n;
}


int main(){
  int n;
  cin >> n;
  vector<vector<int> >c(10,vector<int>(10,0));
  int i,j;
  for(i=1;i<=n;i++){
    c[maxKeta(i)][i%10]++;
  }
  long ans = 0;
  for(i=1;i<=9;i++){
    for(j=1;j<=9;j++){
      ans += c[i][j]*c[j][i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
  string a;
  int i,j,k;
  //baseÌ\ª3*3}XÌÀÑÉÎ
  int base[2][8]= {{0,1,2,0,3,6,0,2},{3,3,3,1,1,1,4,2}};
  bool flag;

  //~ÌÇÝÝ
  while(cin >> a){
    flag = false;
    for(int l=0;l<8;l++){
      i = base[0][l];
      j = i + base[1][l];
      k = j + base[1][l];
      if(a[i] == a[j] && a[j] == a[k] && a[i] != 's'){
	cout << a[i] << endl;
	flag = true;
	break;
      }
    }
    if(!flag){
      cout << "d" << endl;
    }
  }
}

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

int main() {
    int n,x;
    cin >> n >> x;
    int ans = 1;
    int d = 0;
    rep(i,n) {
        int l;
        cin >> l;
        d += l;
        if(d <= x) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
A=input().strip().split(" ")
A=[int(i) for i in A]
count=0

for i in range(N):
    if(A[i]%2==1):
        print("0")
        quit()

for i in range(2**30):
    count+=1
    for j in range(len(A)):
        A[j]=int(A[j]/2)
        if(A[j]%2==1):
            print(count)
            quit()
        


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int k;
    int a, b;
    cin >> k >> a >> b;
    for (int i = 1; i * k <= b;i++)
    {
        if(a<=k*i&&k*i<=b){
            c("OK");
            return 0;
        }
    }
    c("NG");
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
	int h, n, a;
	scanf("%d%d", &h, &n);
	while(n > 0) {
		scanf("%d", &a);
		h -= a;
		if(h <= 0) {
			printf("Yes\n");
			return 0;
		}
		n--;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(0,min(b,d)-max(a,c))<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main {
   public static void main(String[] args) throws IOException{
	   BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	   String s;
	   String tmp = "";
	   String sizetmp = "";
	   int cmax = -1;
	   int max = -1;
	   int cnt;
	   s = buf.readLine();
	   String[] data = s.split(" ");
	   for(int i=0;i<data.length;i++){
		   cnt = 1;
		   if(cmax < data[i].length()-1){
			   cmax = data[i].length()-1;
			   sizetmp = data[i];
		   }
		   for(int j=0;j<data.length;j++){
			   if(data[i].equals(data[j]) && i != j) cnt++;
		   }
		   if(max < cnt){
			   tmp = data[i];
			   max = cnt;
		   }
	   }
	   System.out.println(tmp + " " + sizetmp);
   }
}

Measured memory_bytes: 16896
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
const long long inf=1e17;
int pa[maxn],sz[maxn];
struct edge{
    int u,v;
    long long w;
    bool operator <(const edge &x){
        return w<x.w;
    }
    edge(int _u,int _v,long long _w):
        u(_u), v(_v), w(_w) {}
};
int fi(int x){
    return x==pa[x]?x:pa[x]=fi(pa[x]);
}
vector<edge> e;
void kruskal(){
    sort(e.begin(),e.end());
    long long sum=0;
    for(auto j:e){
        int u=fi(j.u),v=fi(j.v);
        if(u==v)continue;
        if(sz[u]<sz[v])swap(u,v);
        sz[u]+=sz[v];
        pa[v]=u;
        sum+=j.w;
    }
    printf("%lld\n",sum);
    exit(0);
}
int n,d,a[maxn];
void dc(int l,int r){
    if(l==r)return;
    int mid=(l+r)>>1;
    dc(l,mid);dc(mid+1,r);
    long long ma=inf,c;
    int idx=-1;
    for(int i=l;i<=mid;i++){
        c=a[i]-1LL*d*i;
        if(c<ma){
            ma=c;
            idx=i;
        }
    }
    int idx2=-1;
    ma=inf;
    for(int i=mid+1;i<=r;i++){
        c=a[i]+1LL*d*i;
        if(c<ma){
            ma=c;
            idx2=i;
        }
    }
    for(int i=l;i<=mid;i++)
        e.push_back(edge(i,idx2,0LL+a[i]+a[idx2]+1LL*d*(idx2-i)));
    for(int i=mid+1;i<=r;i++)
        e.push_back(edge(i,idx,0LL+a[i]+a[idx]+(1LL*d*(i-idx))));
    return;
}

int main(){
    scanf("%d%d",&n,&d);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++){
        pa[i]=i;
        sz[i]=1;
    }
    dc(1,n);
    kruskal();
}


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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    long double r;
    cin>>r;
    long double ans=2*PI*r;
    cout<<prec(20)<<ans;

}


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

const int N = 2e5+5;

int n,a[N];
long long dp[N][2][3],suf[N];

long long rec(int pos, int now, int change){
	if (pos >= n){
		return ((!change || (change == 1 && now)) ? 0 :
		(now != (a[pos] & 1)));
	}
	long long &ret = dp[pos][now][change];
	if (ret != -1){
		return ret;
	}
	ret = min(suf[pos], (now != (a[pos] & 1)) +
	((!now && !a[pos]) ? 2 : 0) + rec(pos+1, now, change));
	if (!change || (change == 1 && now)){
		ret = min(ret, (!now != (a[pos] & 1)) +
		((now && !a[pos]) ? 2 : 0) +
		rec(pos+1, !now, change + 1));
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i=1;i<=n;i++){
		cin >> a[i];
	}
	for (int i=n;i;i--){
		suf[i] = suf[i+1] + a[i];
	}
	while (n && !a[n]){
		n--;
	}
	if (!n){
		cout << "0\n";
		return 0;
	}
	memset(dp,-1,sizeof(dp));
	long long ans = LLONG_MAX;
	long long sum = 0;
	for (int i=1;i<=n;i++){
		ans = min(ans, min(sum + rec(i+1, a[i]&1, 0),
		sum + 1 + rec(i+1, !(a[i]&1), 0)));
		sum += a[i];
	}
	cout << ans << "\n";
}

Measured memory_bytes: 27648
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    double t, x;

    cin >> t >> x;

    printf("%.10f\n", t / x);
}


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

using namespace std;

int main()
{
   int n;
   cin>>n;
   int arr[n]={0};
   int ara[n];
   for(int i=0;i<n-1;i++)
   {
       cin>>ara[i];
   }
   for(int i=0;i<n-1;i++)
   {
       int x=ara[i];
       arr[x-1]++;
   }
   for(int i=0;i<n;i++) cout<<arr[i]<<endl;
    return 0;
}


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

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char* argv[]){
	string S;
	unsigned long long K;
	int k;

	cin >> S;
	cin >> K;
	int s, c;
	for(int i=0; i<S.size(); i++){
		char p[2] = {0};
		p[0] = S[i];
		s = atoi(p);
		if(s==1){
          continue;
        }
		else{
			c = i+1;
			break;
		}
	}

	if(K<=c-1){ k = 1; }
	else{ k = s; }
	printf("%d\n", k);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;

struct Graph
{
    int n;
    vector<vector<int>> g;
    
    Graph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to){
        g[from].push_back(to);
    }
};

struct Tree	//create tree(directed) from graph(undirected)
{
    int n;
    int root;
    vector<vector<int>> t;
    vector<int> par;
    vector<int> dpt;
    
    void init(Graph &g, int root_){
        n = g.n;
        root = root_;
        t.resize(n);
        par.resize(n);
        dpt.resize(n);
        fill(dpt.begin(), dpt.end(), -1);
        queue<int> que;
        par[root] = -1;
        dpt[root] = 0;
        que.push(root);
        while(que.size()){
            int pa = que.front();
            que.pop();
            for(int ch : g.g[pa]){
                if(dpt[ch] == -1){
                    t[pa].push_back(ch);
                    par[ch] = pa;
                    dpt[ch] = dpt[pa] + 1;
                    que.push(ch);
                }
            }
        }
    }

    Tree(){}
    
    Tree(Graph &g, int root_){
        init(g, root_);
    }
};

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    Graph g(n);
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        a--;
        if(i == 0){
            if(a != 0) ans++;
        }
        else{
            g.add_edge(i, a);
            g.add_edge(a, i);
        }
    }
    Tree t(g, 0);
    P p[100005];
    bool b[100005]{0};
    for(int i = 0; i < n; i++) p[i] = P(t.dpt[i], i);
    sort(p, p + n, greater<P>());
    for(int i = 0; i < n; i++){
        int u = p[i].second;
        if(b[u]) continue;
        for(int i = 0; i < k - 1; i++){
            if(u == 0) break;
            u = t.par[u];
        }
        if(u != 0 && t.par[u] != 0) ans++;
        queue<int> que;
        que.push(u);
        b[u] = true;
        while(que.size()){
            int v = que.front();
            que.pop();
            for(int w : t.t[v]){
                if(!b[w]){
                    b[w] = true;
                    que.push(w);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 12800
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, P = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] %= 2
A.sort()
i = 0
while True:
    if i >= len(A):
        break
    if A[i] == 0:
        i += 1
    elif A[i] == 1:
        i -= 1
        if i < 0:
            i = 0
        break
zero = i
not_zero = len(A) - zero
combination0 = 1
for i in range(1, zero + 1):
    combination0 += c(zero, i)
    
if P == 0:
    combination1_0 = 1
    for i in range(2, not_zero + 1, 2):
        combination1_0 += c(not_zero, i)
    print(combination0 * combination1_0)
else:
    combination1_1 = 0
    for i in range(1, not_zero + 1, 2): #1
        combination1_1 += c(not_zero, i)
    print(combination1_1 * combination0)

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

int main(){
	int n;
	cin>>n;
	rep(i,n){
		int ans;
		int x,y,a,b;
		cin>>x>>y>>a>>b;
		int tmp=x*max(a,5)+y*max(b,2);
		tmp*=0.8;
		ans=min(x*a+y*b,tmp);
		cout<<ans<<endl;
	}
}

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

int main()
{
	int64_t a, b;
	cin >> a >> b;
	if(a+b==15){
		cout << '+' << endl;
	}else if(a*b==15){
		cout << '*' << endl;
	}else{
		cout << 'x' << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);

		while (true) {
			int a = scan.nextInt();
			String op = scan.next();
			int c = scan.nextInt();

			if (op.equals("+")) {
				System.out.println(a + c);
			} else if (op.equals("-")) {
				System.out.println(a - c);
			} else if (op.equals("*")) {
				System.out.println(a * c);
			} else if (op.equals("/")) {
				System.out.println(a / c);
			} else if (op.equals("?")) {
				break;
			}
		}
	}
}

Measured memory_bytes: 26192
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n, d;
    cin >> n >> d;
    int ans = 0;
    if (d >= n)
    {
        cout << "1" << endl;
        return 0;
    }
    for (int i = d; i < n; i += 2 * d + 1)
    {
        ans++;
        if (i + d < n - 1 && i + 2 * d + 1 >= n)
        {
            ans++;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 2e5+10;

template<class Container, class T>
ll at_wrap(Container &mp, T v) {
    try {
        return mp.at(v);
    }
    catch(std::out_of_range&) {
        return 0;
    }
}

int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a), greater<ll>());
    map<ll,ll> mp;
    rep(i,n)mp[a[i]]++;
    ll ans = 0;
    auto pow2 = [](ll x){
        ll res = 1;
        while(res <= x)res *= 2;
        return res;
    };
    rep(i,n){
        if(mp[a[i]] <= 0)continue;
        mp[a[i]]--;
        ll t = pow2(a[i]);
        if(at_wrap(mp, t - a[i]) > 0){
            // debug(t);
            // debug(at_wrap(mp, t - a[i]));
            ans++;
            mp[t-a[i]]--;
        }
        // // debug(a[i]);debug(ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 16384
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------
//abc a
int main(void)
{
  int n;
  scanf("%d", &n);
  if (n/100 == 7) {
    printf("Yes\n");
  }else if(n/10-(n/100)*10 == 7){
    printf("Yes\n");
  }else if(n -((n/10)*10) == 7){
    printf("Yes\n");
  }else printf("No\n");
}


Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define int ll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> x;
    vector<int> l;
    for (int i = 0; i < n; i++)
    {
        int tmpx, tmpl;
        cin >> tmpx >> tmpl;
        x.push_back(tmpx);
        l.push_back(tmpl);
    }
    vector<pair<int, int>> interval;
    for (int i = 0; i < n; i++)
    {
        interval.push_back(make_pair(x[i]+l[i]-1, x[i]-l[i]));
    }
    sort(interval.begin(), interval.end());

    int res = 0;
    ll t = -longinf;
    for (int i = 0; i < n; i++)
    {
        if (t < interval[i].second) {
            res++;
            t = interval[i].first;
            //cout <<"t:"<< t << "\n";;
        }
        
    }
    cout << res << "\n";
    
    
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int H, W;
    cin >> H >> W;
    char mat[H+2][W+2];
    REP(i, H+2) {
        REP(j, W+2) {
            mat[i][j] = '.';
        }
    }
    REP(i, H) {
        REP(j, W) {
            cin >> mat[i+1][j+1];
        }
    }

    bool ok = true;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (mat[i][j] == '#') {
                if (mat[i-1][j] != '#' && mat[i][j+1] != '#' &&mat[i+1][j] != '#' &&mat[i][j-1] != '#') {
                    ok = false;
                }
            }
        }
    }
    if (ok) {
        print("Yes");
    } else {
        print("No");
    }
}

signed main() {
    solve();
}


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

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

Measured memory_bytes: 9132
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a-1) * (b-1) << endl;
}

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

namespace study11
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int caunto = 0;
            int ans = 0;
            for (int a = 1; a <= N; a+=2)
            {
                caunto = 0;
                for (int b = 1; b <= a; b++)
                {
                    if (a % b == 0) caunto++;                    
                }
                if (caunto == 8) ans++;
            }
            Console.WriteLine(ans);

        }
    }
}

Measured memory_bytes: 17576
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	
	int t0 = 0;
	int t2 = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] % 2 == 1) {
			t0++;
		}
		if (A[i] % 4 == 0) {
			t2++;
		}
	}
	if ((t0 <= t2) || (((t2+t0==N) && (t0 == t2+1)))) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
	
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a,b,c,x,ans;
int main(){
    cin>>a>>b>>c>>x;
    for (int i=0;i<=a&&500*i<=x;i++){
        for (int j=0;j<=b&&100*j+500*i<=x;j++){
            for (int k=0;k<=c&&50*k+100*j+500*i<=x;k++){
                if (500*i+100*j+50*k==x)
                    ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#import numpy as np
import math
import collections
import bisect


def main():
    a, b, c, d = map(int, input().split())

    dp0 = [[1 for i in range(d + 1)] for j in range(c + 1)]
    dp1 = [[0 for i in range(d + 1)] for j in range(c + 1)]
    for i in range(c + 1):
        for j in range(d + 1):
            if j < b or i < a:
                dp0[i][j] = 0
                dp1[i][j] = 0
    for i in range(a, c + 1):
        for j in range(b, d + 1):
            # print(i, j, dp[i][j])
            if a == i and b == j:
                continue
            dp0[i][j] = ((i * dp0[i][j - 1]) % 998244353 + dp1[i][j - 1]) % 998244353
            dp1[i][j] = (j * (dp0[i - 1][j] + dp1[i - 1][j]) % 998244353) % 998244353

    print((dp0[c][d] + dp1[c][d]) % 998244353)


if __name__ == '__main__':
    main()


Measured memory_bytes: 232324
# coding: utf-8

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

res = 0
for t in T:
    left = 0
    right = n # ??????1????????§??????

    while left != right:
        i = (left+right)//2
        if S[i] == t:
            res += 1
            break
        elif t < S[i]:
            right = i
        else:
            left = i+1 # ?????????????????????????????§????????????

print(res)

Measured memory_bytes: 18544
#include<cmath>
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
	string a,b;
	while(cin>>a>>b)
	{
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	reverse(b.begin(),b.end());
	if(a<b)cout<<"Yes";
	else cout<<"No";
	cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
 
const long INF = (1l << 30);
const long LINF = (1l << 60);

long n, k;
long v[55];
long ans = 0;

int main(){
	scanf("%ld%ld", &n, &k);
	for(int i = 0; i < n; i++){
		scanf("%ld", v+i);
	}
	
	
	for(long x = 0; x <= std::min(n, k); x++){
		for(long l = x, r = n; l >= 0; l--, r--){
			std::vector<long> subs;
			for(int i = 0; i < l; i++){
				subs.push_back(v[i]);
			}
			for(int i = r; i < n; i++){
				subs.push_back(v[i]);
			}
			std::sort(subs.begin(), subs.end());
			long res = 0;
			for(int i = 0; i < subs.size(); i++){
				if(i < k-x){
					res += std::max(0l, subs[i]);
				}else{
					res += subs[i];
				}
			}
			ans = std::max(ans, res);
		}
	}
	printf("%ld\n", ans);
	return 0;
}


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;


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

	int a , b;
	cin >> a >> b;
	cout << b + b - a;

	return 0;
}

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

bool check(vector<P> s) {
  int h = 0;
  for (P p : s) {
    int b = h + p.first;
    if (b < 0) return false;
    h += p.second;
  }
  return true;
}
int main() {
  int n;
  cin >> n;

  int total = 0;
  vector<P> ls, rs;
  rep(i, n) {
    string s;
    cin >> s;
    int hight = 0, bottom = 0;
    for (char c : s) {
      if (c == '(')
        ++hight;
      else
        --hight;
      bottom = min(bottom, hight);
    }
    if (hight > 0)
      ls.emplace_back(bottom, hight);
    else
      rs.emplace_back(bottom - hight, -hight);
    total += hight;
  }
  sort(ls.rbegin(), ls.rend());
  sort(rs.rbegin(), rs.rend());
  if (check(ls) && check(rs) && total == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 19000
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

signed main() {
    SS(int,n,k);
	SV(ll,h,n);
	vector<bool>ans(n,true);
	rep(i,k){
		SS(int,p,q);
		p--;q--;
		if(h[p]<=h[q])ans[p]=false;
		if(h[p]>=h[q])ans[q]=false;
	}
	int res=0;
	rep(i,n){
		if(ans[i]==true)res++;
	}
	p(res);
}


Measured memory_bytes: 3964
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {


	int N,A;
	scanf("%d%d", &N,&A);

	if (N % 500 <= A)printf("Yes");
	else printf("No");


}

Measured memory_bytes: 128
import sys
num50 = input().rstrip()
num10 = input().rstrip()
num5 = input().rstrip()
num = input().rstrip()

num50 = int(num50)
num10 = int(num10)
num5 = int(num5)
num = int(num)

class TestClass(object):
    cnt = 0
    def __init__(self):
        cnt = 0
    def countMoney(self, n10,n2,n1,res,flag):
        if (res == num):
            self.cnt += 1
            return
        if (n10+1 <= num50 and res+500 <= num and flag >= 500):
            self.countMoney(n10+1,n2,n1,res+500,500)
        if (n2+1 <= num10 and res+100 <= num and flag >= 100):
            self.countMoney(n10,n2+1,n1,res+100,100)
        if (n1+1 <= num5 and res+50 <= num and flag >= 50):
            self.countMoney(n10,n2,n1+1,res+50,50)

tc1 = TestClass()
tc1.countMoney(0,0,0,0,500)

print(tc1.cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() 
{
string s;string t;cin>>s>>t;
int ans=0;
for(int i=0;i<s.size();i++)
{
    if(s[i]!=t[i])
    ans++;
}
cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    vector<ll> var(256);
    for(char c='A';c<='C';++c)cin>>var[c];
    vector<string> s(n);
    rep(0,i,n)cin>>s[i];
    vector<char>ans(n);
    rep(0,i,n){
        char c1=s[i][0],c2=s[i][1],cM=(var[c1]>=var[c2]?c1:c2),cm=c1^c2^cM;
        if(var[c1]==var[c2]&&i+1<n&&(s[i+1][0]==c1||s[i+1][1]==c1))swap(cM,cm);
        if(var[cM]==0){
            cout<<"No";
            return 0;
        }
        var[cM]--,var[cm]++;
        ans[i]=cm;
    }
    cout<<"Yes"<<endl;
    rep(0,i,n)cout<<ans[i]<<endl;
}


Measured memory_bytes: 6432
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;

int main() 
{
    ll h,w; cin >> h >> w;
    ll f[h][w];
    ll cnt = INF;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> f[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int tmp = 0;
            for(int k = 0; k < h; k++){
                for(int l = 0; l < w; l++){
                    tmp += f[k][l]*min(abs(i-k),abs(j-l));
                }
            }
            if(cnt > tmp) cnt = tmp;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
const int maxn=0x3f3f3f3f;
int n,k;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    printf("%d\n",max(0,c-(a-b)));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
 
#define ll long long
 
using namespace std;
 
const ll INF = 100005 * 20;
 
ll f(ll a[12][12], ll c[12], int n, int _n, ll x, ll m, bool flag[12]) {
    if (_n >= n) {
        ll o[12];
        for (int i = 0; i < m; i++) {
            o[i] = 0;
        }
        ll cost = 0;
        for (int i = 0; i < n; i++) {
            if (flag[i]) {
                cost += c[i];
                for (int j = 0; j < m; j++) {
                    o[j] += a[i][j];
                }
            }
        }
        bool f = false;
        for (int i = 0; i < m; i++) {
            if (o[i] < x) {
                f = true;
                break;
            }
        }
        if (f) {
            return INF;
        } else {
            return cost;
        }
    }
    // 使わない
    flag[_n] = false;
    ll ans1 = f(a, c, n, _n + 1, x, m, flag);
    // 使う
    flag[_n] = true;
    ll ans2 = f(a, c, n, _n + 1, x, m, flag);
    return min(ans1, ans2);
}
 
int main() {
    ll n, m, x;
    ll a[12][12], c[12];
    bool flag[12];
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++) {
        flag[i] = false;
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    ll ans = f(a, c, n, 0, x, m, flag);
    if (ans >= INF) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll a,b,c;
    string p,q,r;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}


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

bool is_parindrome(string s) {
  int n = s.size();
  for (int i = 0; i < n / 2; i++) {
    if (s.at(i) != s.at(n - i - 1)) return false;
  }
  return true;
}

int main() {
  string s; cin >> s;
  cout << (is_parindrome(s) && is_parindrome(s.substr(0, s.size() / 2)) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int dx_2[24]={2,1,0,-1,-2,2,1,0,-1,-2,2,1,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2};
int dy_2[24]={2,2,2,2,2,1,1,1,1,1,0,0,0,0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2};



ll H,W;
vector<string> grid;
queue<pair<ll,ll>> warps;
queue<pair<ll,ll>> dfss;
vv ans;

bool check(ll h,ll w){
    return(0<= h && h < H && 0<=w && w<=W);
}

void dfs(ll h,ll w,ll now){
    warps.push(MP(h,w));
    rep(i,0,4){
        if(!check(h + dy[i], w + dx[i]))continue;
        if(grid[h + dy[i]][w + dx[i]] == '.'){
            if(now < ans[h + dy[i]][w + dx[i]]){
               
                ans[h + dy[i]][w + dx[i]] = now;
                dfs(h + dy[i], w + dx[i], now);
            }
        }
    }
}

void warp(ll h, ll w, ll now){
    rep(i,0,24){
        if(!check(h + dy_2[i], w + dx_2[i]))continue;
        if(grid[h + dy_2[i]][w + dx_2[i]] == '.'){
            if(now < ans[h + dy_2[i]][w + dx_2[i]]){
                dfss.push(MP(h+dy_2[i],w+dx_2[i]));
                ans[h + dy_2[i]][w + dx_2[i]] = now;
            }
        }
    }
}

int main(){
    cin>>H>>W;

    grid.resize(H);
    ans.resize(H,v(W,INF));

    ll sh,sw,gh,gw;
    cin>>sh>>sw>>gh>>gw;
    sh--;gh--;sw--;gw--;
    rep(i,0,H)cin>>grid[i];
    dfss.push(MP(sh,sw));
    //warps.push(MP(sh,sw));
    ans[sh][sw]=0;

    ll t = 0;
    while(!dfss.empty()){
        while(!dfss.empty()){
            pair<ll,ll> a = dfss.front();
            dfss.pop();
            dfs(a.first, a.second, t);
            //cout<<a.first<<a.second;
        }
        t++;
        while(!warps.empty()){
            pair<ll,ll> a = warps.front();
            warps.pop();
            warp(a.first, a.second, t);
        }
    }
    if(ans[gh][gw] == INF)cout<<-1;
    else cout<<ans[gh][gw];
    return 0;
}

Measured memory_bytes: 13500
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename F>
void all_permutations(int n,F f){
  vector<int> vs(n);
  iota(vs.begin(),vs.end(),0);
  do f(vs); while(next_permutation(vs.begin(),vs.end()));
}

//INSERT ABOVE HERE
signed main(){
  auto naive=
    [&](vector<int> vs){
      int n=vs.size();
      vector<int> rs;
      auto f=
        [&](auto &us){
          if(!rs.empty()) return;
          int res=1;
          for(int i=0;i+1<n;i++)
            res&=us[i+1]!=vs[us[i]];
          if(res) rs=us;
        };
      all_permutations(n,f);
      return rs;
    };

  int n;
  while(cin>>n){
    vector<int> as(n);
    for(int i=0;i<n;i++) cin>>as[i],as[i]--;
    if(n==2){
      cout<<-1<<endl;
      continue;
    }

    vector<int> indeg(n,0);
    for(int a:as) indeg[a]++;

    set<int> cand;
    for(int i=0;i<n;i++) cand.emplace(i);

    int pro=-1;
    vector<int> res;
    int len = min(n, 4);
    for(int i=0;i+len<n;i++){
      auto push=
        [&](int k){
          cand.erase(k);
          res.emplace_back(k);
          indeg[as[k]]--;
          pro=as[k];
        };

      auto it=cand.begin();
      while(1){
        if(cand.count(as[*it]) && indeg[as[*it]]==(n-1-i)){
          push(as[*it]);
          break;
        }
        if(*it==pro){
          ++it;
          continue;
        }
        push(*it);
        break;
      }
    }

    auto check=
      [&](vector<int> bs)->int{
        for(int i=0;i+1<n;i++)
          if(bs[i+1]==as[bs[i]]) return 0;
        return 1;
      };

    vector<int> lst(cand.begin(),cand.end());
    // cerr<<lst.size()<<endl;

    vector<int> ans;
    auto f=
      [&](auto vs){
        if(!ans.empty()) return;
        vector<int> tmp(res);
        for(int i=0;i<len;i++)
          tmp.emplace_back(lst[vs[i]]);
        if(check(tmp)) ans=tmp;
      };
    all_permutations(len,f);

    if(0){
      if(ans.empty() || !check(ans) ||  ans!=naive(as)){
        for(int i=0;i<(int)res.size();i++) cerr<<res[i]<<" ";
        cerr<<endl;
        for(int i=0;i<n;i++) cerr<<as[i]<<" ";
        cerr<<endl;
        for(int i=0;i<(int)ans.size();i++) cerr<<ans[i]<<" ";
        cerr<<endl;
        for(int i=0;i<n;i++) cerr<<naive(as)[i]<<" ";
        cerr<<endl;
      }
      assert(!ans.empty());
      assert(check(ans));
      assert(ans==naive(as));
    }

    for(int i=0;i<n;i++){
      if(i) cout<<" ";
      cout<<ans[i]+1;
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 6272
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong h;
map<llong, llong> mp;

llong dfs(llong h) {
    if (mp.count(h) > 0) {
        return mp[h];
    }
    if (h <= 1) {
        return 1;
    }

    return mp[h] = 2 * dfs(h / 2) + 1;
}

int main() {
    cin >> h;

    cout << dfs(h) << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
mod = 10**9+7
N = '{:060b}'.format(N)[::-1]

dp = [[[[-1 for _ in range(3)] for _ in range(2)] for _ in range(2)] for _ in range(60)]

def f(n,a,b,c):
    if n==-1:
        return 1
    if dp[n][a][b][c]!=-1:
        return dp[n][a][b][c]
    if b:
        res = f(n-1,1,1,2)+f(n-1,1,1,1)+f(n-1,1,1,0)
    else:
        if not a:
            if N[n]=='0':
                res = f(n-1,0,0,0)
            else:
                res = f(n-1,1,0,0)+f(n-1,0,0,1)
        else:
            if N[n]=='0':
                res = f(n-1,0,0,2)+f(n-1,1,0,1)+f(n-1,1,1,0)
            else:
                res = f(n-1,1,0,2)+f(n-1,1,1,1)+f(n-1,1,1,0)
    res %= mod
    dp[n][a][b][c] = res
    return res

ans = f(59,0,0,0)
print(ans)

Measured memory_bytes: 38384
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    T = input()
    size = len(T)
    ans = 10**9
    for i in range(len(S) - size + 1):
        _s = S[i:i + size]
        tmp = 0
        for j in range(size):
            if _s[j] != T[j]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 67528
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase < 1234567;testcase++){
    string s; cin >> s;
    int(n);
    int cnt = 0;
    for(;n--;){
      string t; cin >> t;
      t += t;
      rep(i, t.size() / 2)if(t.substr(i, s.size()) == s){
        cnt++; break;
      }
    }
    pri(cnt);

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;

    if(n<1200){
        cout<<"ABC"<<endl;
    }
    else if(n<2800){
        cout<<"ARC"<<endl;
    }
    else {
        cout<<"AGC"<<endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include<tuple>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n,l;
    scanf("%d%d",&n,&l);
    int sa;
    if(l>0)sa=l;
    else if(n+l-1<0)sa=n+l-1;
    else sa=0;
    long long int ans=n*(2*l+n-1)/2-sa;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define yabs(x) ((x<0)?(-(x)):(x))

using namespace std;

const int N=5e5+10,Inf=1e9+10;

int n,D,Q,a[N],now[N],suf[N];

void Init()
{
	scanf("%d%d",&n,&D);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
}

void Solve()
{
	now[0]=D;
	for (int i=1;i<=n;++i) now[i]=min(now[i-1],yabs(now[i-1]-a[i]));
	suf[n+1]=1;
	for (int i=n;i>=1;--i)
		if (yabs(suf[i+1]-a[i])>=suf[i+1]) suf[i]=suf[i+1];
		else suf[i]=min(suf[i+1]+a[i],Inf);
	
	scanf("%d",&Q);int x;
	for (int i=1;i<=Q;++i)
	{
		scanf("%d",&x);
		if (suf[x+1]>now[x-1]) printf("NO\n");
		else printf("YES\n");	
	}
}

int main()
{
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 7808
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    println!("{}", read::<u32>().pow(3));
}

Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    k--;

    if (s[k] == 'A') s[k] = 'a';
    if (s[k] == 'B') s[k] = 'b';
    if (s[k] == 'C') s[k] = 'c';

    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 888
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	int n, ans = 0;
	cin >> n;
	if (n < 10) {
		cout << n;
		return 0;
	}
	if (n < 100) {
		cout << 9;
		return 0;
	}
	if (n < 1000) {
		cout << 9 + n - 99;
		return 0;
	}
	if (n < 10000) {
		cout << 909;
		return 0;
	}
	if (n < 100000) {
		cout << 909 + n - 9999;
		return 0;
	}
	cout << 90909;
	return 0;
}

Measured memory_bytes: 256
x,k,d = map(int, input().split())
x = abs(x)
if x > d:
    n = x // d
    if k <= n:
        print(x - d*k)
    else:
        k -= n
        m = x % d
        if k%2 ==  0:
            print(m)
        else:
            print(abs(m-d))
else:
    if k%2 == 0:
        print(x)
    else:
        print(abs(x-d))

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

using namespace std;

void solve(){
	int n; cin>>n;
	if(n%1000==0) cout << "0\n";
	else cout << (1000 - (n%1000)) << "\n";
}

int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3636