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

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define TRAV(a, x) for(const auto& a : x)
#define ALL(x) x.begin(), x.end()
#define NEXT_PERM(x) while(next_permutation(ALL(x))) // 순열 알고리즘(오름)
#define PREV_PERM(x) while(prev_permutation(ALL(x))) // 순열 알고리즘(내림)
#define PRINT(x) cout << x
#define PRINT_LN(x) cout << x << endl;
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

typedef long long int ll;
typedef vector<int> vi;
typedef vector<string> vs;

int gcd(int a, int b);
int lcm(int a, int b);


void solve() {
  int a ,b;
  cin >> a >> b;
  int cntA = 1;
  int ar =0;
  int br =0;
  REP(i,b) {
    ar += a*cntA;
    cntA *= 10;
  }
  int cntB = 1;
  REP(i,a) {
    br += b*cntB;
    cntB *= 10;
  }
  cout << max(ar, br);
}

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

int gcd(int a, int b){
	while(b!=0){
		int r = a%b;
		a= b;
		b= r;
	}
	return a;
}

int lcm(int a, int b){
    return a * b / gcd(a,b);
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <unordered_set>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>

using namespace std;

/* macros */
#define all(v)			((v).begin()), ((v).end())
#define SIZE(v)			((int)((v).size()))
#define LOG(x)			log((double)x)
#define TOLOWER(x)          transform(all(x),x.begin(),::tolower)
#define TOUPPER(x)          transform(all(x),x.begin(),::toupper)
#define ROUND(x,m)			(round((double)x/m)*m)
#define DIGITS(x)			(floor(log10((double)x))+1)
#define READSTR(x)			getline(cin,x)
#define sort_g(a,b)              sort(a, b, greater<int>());
#define IOS() ios_base::sync_with_stdio(0);cin.tie(NULL);
#define REP(i, n) for (int i = 0; i < n; i++)
#define FILE_INPUT() 	freopen( "input.txt", "r", stdin)
#define FILE_OUTPUT()   freopen( "output.txt", "w", stdout)

/*typedefs*/
typedef long long ll;

/*functions*/
bool myCmp(pair<int,int> &p1 , pair<int,int>&p2)
{
    return p1.first > p2.first;
}
unsigned long long
choose(unsigned long long n, unsigned long long k) {
    if (k > n) {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
int toInt(string str) {
    int num;
    istringstream iss(str); //put string in input stream
    iss>>num; return num; //read from stream as integer
}

template <class T> string toStr(T par) {
    ostringstream oss;  //output stream string
    oss<<par;    //write par to the stream
    return oss.str(); //return string of output
}

const int MAXN = 50;
bool arr[MAXN] = {0};

int main() {
    IOS();
    int n ;
    string s;
    cin>>n;
    cin>>s;
    int ans = 0;
    if(s.size() == 2)
    {
        cout<<"0\n";
        return 0;
    }
    for(int i = 0 ; i < s.size() - 2 ; i++)
    {
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
            ans++;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    N_len = len(str(N))
    from itertools import product
    s = set()
    for k in range(3, N_len + 1):
        s = s | {t for t in product("753", repeat=k)
                 if int("".join(t)) <= N and len(set(t) & set("753")) == 3}
    print(len(s))


if __name__ == '__main__':
    main()


Measured memory_bytes: 50396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n, k;
  cin >> n >> k;
  if ((n - 1) / 2 + 1 < k)
  {
    cout << "NO" << endl;
  }
  else
    cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 256
H, W = [int(x) for x in input().split()]
 
A = [[0]*W for i in range(H)]
for c in [1, -1]:
    for i in range(H):
        arr = [int(x) for x in input().split()]
        for j in range(W):
            A[i][j] += arr[j] * c
 
M = 160*80
dp = [[0]*W for i in range(H)]
dp[0][0] = 1 << M
for i in range(H):
    for j in range(W):
        if i > 0:
            dp[i][j] |= dp[i-1][j]
        if j > 0:
            dp[i][j] |= dp[i][j-1]
        a = abs(A[i][j])
        dp[i][j] = (dp[i][j] << a) | (dp[i][j] >> a)
 
ans = M
for i in range(2*M):
    if dp[H-1][W-1] & (1 << i) > 0:
        ans = min(ans, abs(M-i))
print(ans)

Measured memory_bytes: 59356
#include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}

int main() {
  ll n; cin >> n;
  ll t, ans = 1;

  while (n--) {
    cin >> t;
    ans = lcm(ans, t);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
D = list(map(int, input().split()))

for i in range(n, 100000):
  m = str(i)
  count = 0
  for j in range(len(m)):
    if int(m[j]) in D:
      break
    else:
      count += 1
    if count == len(m):
      print(i)
      exit()
      
print(0)

Measured memory_bytes: 9188
#include<stdio.h>

int main(){
  int i,n,num[101][101],a[101],n2[101],j,c=0,k;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d%d",&a[101],&n2[i]);
    for(j=1;j<=n2[i];j++){
      scanf("%d",&num[i][j]);
    }
  }
  for(k=1;k<=n;k++){
    for(i=1;i<=n;i++){
      for(j=1;j<=n2[k];j++){	
	if(i==num[k][j]){
	  c=1;
	}
      }
      printf("%d",c);
      c=0;
      if(i==n){
	break;
      }
      printf(" ");
    }
      printf("\n"); 
  }
  return 0;
}




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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n, x, cnt;
    while(cin >> n >> x && n | x) {
        cnt = 0;
        for(i32 i = 1; i < n-1; ++i) {
            for(i32 j = i + 1; j < n; ++j) {
                for(i32 k = j + 1; k <= n; ++k) if(i+j+k == x) ++cnt;
            }
        }
        cout << cnt << '\n';
    }

//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}



Measured memory_bytes: 3228
//Triangular Relationship

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,k;cin>>n>>k;
    int h=0,f=0;
    if(k&1){
        rep(i,1,n+1){
            if(i%k==0)f++;
        }
        cout<<f*f*f<<nnn;
    }else{
        rep(i,1,n+1){
            if(i%k==0)f++;
            else if(i%(k/2)==0)h++;
        }
        cout<<f*f*f+h*h*h<<nnn;
    }
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = ~(1<<31);
const int MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n;
	cin >> n;
	vi l(n);
	rep(i,n) cin >> l[i];

	sort(all(l));

	ll ans = 0;
	int left,right;
	for(int a = 0; a < l.size(); a++){
		for(int b = a+1; b < l.size(); b++){
			left = l[b];
			right = l[b]+l[a];
			ans += lower_bound(all(l),right)-l.begin()-(b+1);

		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s=input()
fst = int(s[:2])
snd = int(s[2:])
if 0<fst and fst<13:
    if 0<snd and snd<13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0<snd and snd<13:
        print('YYMM')
    else:
        print('NA')

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

// コイン両替問題：
//     額面が d1, ..., dm のコインで n 支払う
//     各コインの使用枚数は無制限
int coin_changing(vector<int> coin, const int sum) {
    static const int INF = 1000000000;
    sort(coin.begin(), coin.end());
    vector<int> dp(sum + 1, INF);
    dp[0] = 0;
    for(const auto& d: coin)
        for(int s = d; s <= sum; ++s)
//      for(int s = n; s - d >= 0; --s) // 1 枚制限
            dp[sum] = min(dp[s], dp[sum - d] + 1);
    return dp[sum];
}

// ナップサック問題
struct Goods {int value, weight;};
int knapsack(const vector<Goods>& goods, const int capacity) {
    vector<int> dp(capacity + 1, 0);
    for(const auto& g: goods)
        for(int w = g.weight; w <= capacity; ++w)
//      for(int w = W; w - g.weight >= 0; --w)  // 1 個制限
            dp[w] = max(dp[w], dp[w - g.weight] + g.value);
    return *max_element(dp.begin(), dp.end());
}

// 最長増加部分列：O(n ^ 2)
// int longest_increasing_subsequence(const vector<int>& sequence) {
//     vector<int> dp(sequence.size(), 1);
//     for(int i = 1; i < dp.size(); ++i)
//         for(int j = i - 1; j >= 0; --j)
//             if(sequence[j] < sequence[i]) dp[i] = max(dp[i], dp[j] + 1);
//     return *max_element(dp.begin(), dp.end());
// }
// 最長増加部分列：O(n log n)
int longest_increasing_subsequence(const vector<int>& sequence) {
    vector<int> last;
    last.push_back(sequence[0]);
    for(const auto& i: sequence) {
        if(last.back() < i) last.push_back(i);
        else                *lower_bound(last.begin(), last.end(), i) = i;
    }
    return last.size();
}

int main() {
    int n;
    while(cin >> n) {
        vector<int> array(n);
        for(auto& a: array) cin >> a;
        cout << longest_increasing_subsequence(array) << endl;
    }
}

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

using namespace std;

char from[26] = {'\0'};
char to[26] = {'\0'};
string S, T;

int main(){
    cin >> S;
    cin >> T;
    for(int i = 0; i < S.length(); i++){
        if(from[S[i] - 'a']){
            if(from[S[i] - 'a'] != T[i]){
                cout << "No\n";
                return 0;
            }
        }else{
            if(to[T[i] - 'a']){
                cout << "No\n";
                return 0;
            }else{
                from[S[i] - 'a'] = T[i];
                //from[T[i] - 'a'] = S[i];
                to[T[i] - 'a'] = S[i];
                //to[S[i] - 'a'] = T[i];
                //cout << S[i] << "\n";
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

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

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

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

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

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

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

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

// ---- ----

int a, b, k;

int main() {
	cin >> a >> b >> k;
	
	if(b - a + 1 <= 2 * k) {
		incII(i, a, b) { cout << i << "\n"; }
	} else {
		inc(i, k) { cout << a + i << "\n"; }
		dec(i, k) { cout << b - i << "\n"; }
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int v[] = new int[n];
		Main main = new Main();
		Count[] countA = new Count[100001];
		Count[] countB = new Count[100001];
		for (int i=0;i<100001;i++) {
			Count c = main.new Count();
			c.num=i;
			countA[i] =c ;
		}
		for (int i=0;i<100001;i++) {
			Count c = main.new Count();
			c.num=i;
			countB[i] =c ;
		}
		for (int i=0;i<n;i++) {
			v[i]= sc.nextInt();
			if (i%2==0) {
				countA[v[i]].count++;
			} else {
				countB[v[i]].count++;
			}
		}
		Arrays.sort(countA);
		Arrays.sort(countB);
		if (countA[0].num!=countB[0].num) {
			System.out.println((n/2-countA[0].count)+(n/2-countB[0].count));
		} else {
			int min = (n/2-countA[0].count)+(n/2-countB[1].count);
			if ((n/2-countA[1].count)+(n/2-countB[0].count)<min) {
				System.out.println((n/2-countA[1].count)+(n/2-countB[0].count));
			} else {
				System.out.println(min);
			}
		}
	}
	public class Count implements Comparable<Count> {
		int num;
		int count;
		@Override
		public int compareTo(Count o) {
			return o.count-this.count;
		}

	}
}

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

int main() {
  int N; cin>>N;
  vector<vector<int>> T(N+1, vector<int> (3));
  T.at(0)={0, 0, 0}; //スタート地点
  for(int i=1; i<N+1; i++){
    int t, x, y;
    cin>>t>>x>>y;
    T.at(i)={t, x, y};
  }
  bool ikeru=1;
  for(int i=0; i<N; i++){
    int n=T[i+1][0]-T[i][0]; //経過時間
    int distx=abs(T[i+1][1]-T[i][1]);
    int disty=abs(T[i+1][2]-T[i][2]);
    int man=distx+disty;
    if(n%2==man%2 && man<=n) continue;
    else ikeru=0;
  }
  if(ikeru) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define show(x) cout << #x << " = " << x << endl;
int main(){
    int n,l;
    cin >> n >> l;
    vector<int>a(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n-1){
        if(a[i] + a[i+1] >= l){
            cout << "Possible" << endl;
            for(int j = 0; j <= i-1; j++){
                cout << j+1 << endl;
            }
            for(int j = n-1; j>=i+2; j--){
                cout << j << endl;
            }
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << "Impossible" << endl;
}

Measured memory_bytes: 1152
<?php
fscanf(STDIN, "%s", $t);
$arr = str_split($t);
$out = '';
foreach($arr as $c) {
if($c=='1') {
$out .= '9';
} else if($c=='9') {
$out .= '1';
} else {
$out .= $c;
}
}
echo $out;
?>

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

int next_perm(int *p, int n)
{
  int i, j, k, tmp;

  /* 上位桁のほうが下位桁よりも小さいところまで移動 */
  for(i = n - 1; i > 0 && p[i-1] >= p[i]; i--);

  /* pが最大(次の並べ替えがない) */
  if(i == 0) return 0;

  /* p[i-1]より値の大きい最も下位の桁をp[j]とする */
  for(j = n - 1; j > i && p[i-1] >= p[j]; j--);

  /* p[i-1]とp[j]とを交換 */
  tmp = p[i-1], p[i-1] = p[j], p[j] = tmp;

  /* p[i]から最下位までを逆順 */
  for(k = 0; k <= ((n-1)-i)/2; k++)
    tmp = p[i+k], p[i+k] = p[(n-1)-k], p[(n-1)-k] = tmp;

  return 1;
}

int main(void) {
    int N, x[8], y[8], p[10]={0, 1, 2, 3, 4, 5, 6, 7}, fact, i;
    double s, a;
    scanf("%d", &N);
    for (i=0; i<N; i++) scanf("%d%d", &x[i], &y[i]);
    s=0.0;
    do {
        /*
        for (i=0; i<N; i++) printf("%d, ", p[i]);
        printf("\n");
        */
        
        a=0.0;
        for (i=0; i<N-1; i++) {
            s+=sqrt((x[p[i+1]]-x[p[i]])*(x[p[i+1]]-x[p[i]])+(y[p[i+1]]-y[p[i]])*(y[p[i+1]]-y[p[i]]));
            // printf("%f, ", a);
        }
        
        // s+=sqrt(a);
        // printf("\n");
        
    } while(next_perm(p, N));
    fact=1;
    for (i=1; i<=N; i++) fact*=i;
    printf("%.8f", s/fact);
    // for (i=0; i<N; i++) printf("%d, ", y[p[i]]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	string s;
	cin >> s;
	int k;
	cin >> k;
	int n = s.size();
	ll dp[101][2][5];	// digit, smaller, count of 1-9
	rep(i, 101) rep(j, 2) rep(l, 5) dp[i][j][l] = 0;
	dp[0][0][0] = 1;
	rep1(i, n) rep(j, 2) rep(l, 4) {
		int d = s[i - 1] - '0';
		for(int m = 0; m <= (j ? 9 : d); m++) {
			dp[i][j || (m < d)][l + (m > 0)] += dp[i - 1][j][l];
		}
	}
	cout << dp[n][1][k] + dp[n][0][k] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
typedef pair<ll,ll> P;
ll mod=1e9+7;
map<P,ll> dp;
ll solve(ll X,ll Y){
	if(X==0&&Y==0) return 1;
	if(dp.count(P(X,Y))) return dp[P(X,Y)];
	ll val=0;
	val+=solve(X/2,Y/2);
	if(X>0&&Y>0) val+=solve((X-1)/2,(Y-1)/2);
	if(Y>=2) val+=solve(X/2,Y/2-1);
	val%=mod;
	return dp[P(X,Y)]=val;
}
int main(){
	ll N;
	cin>>N;
	cout<<solve(N,N)<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {

       

        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                string str = "";
                if (line.Equals("1 1 0")) {
                    str = "Open";
                }
                else if (line.Equals("0 0 1")) {
                    str = "Open";
                }
                else { str = "Close"; }

                Console.WriteLine(str);
                break;
            }
        }

        
    }



    
}

Measured memory_bytes: 5268
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

int lcm(int a, int b){
    int pro=a*b;
    pro=pro/__gcd(a,b);
    return pro;
}

int32_t main(){
    ios::sync_with_stdio(false);
    int a, b;
    int c, d;
    cin>>a>>b>>c>>d;
    int n=(b/c)-(a/c);
    if(a%c==0){
        n++;
    }
    n+=(b/d)-(a/d);
    if(a%d==0){
        n++;
    }
    int l=lcm(c,d);
    n-=((b/l)-(a/l));
    if(a%l==0){
        n--;
    }
    int ans=(b-a+1)-n;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int n;
  cin>>n;
  double m=n;
  if(n%2==1){
      cout<<(n/2+1)/m;
  }
  else{
      cout<<(n/2)/m;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc141/tasks/abc141_d
import heapq

# 整数の入力
N, M = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N):
    A[i] *= -1

heapq.heapify(A)

for _ in range(M):
    heapq.heappush(A, ((heapq.heappop(A) * -1) >> 1) * -1)

print(sum(A) * -1)


Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a[100],b,d,n,m,x,y,z,k,h,w,sum,mi,ma,ans,s,t,l,r,res,tmp,itr,p[11],q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<int, int> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<int,int> > VP;

int main(){
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    VL v;
    rep(i,n+1)rep(j,i,n+1){
        v.clear();
        sum=0;
        d(i)d(j)
        if(i+(n-j)>k)continue;
        rep(r,i){d(a[r])v.pb(a[r]);}
        rep(r,(n-j)){d(a[n-1-r])v.pb(a[n-1-r]);}
        if(v.size()==0)continue;
        sort(all(v));
        rep(r,v.size())d(v[r]);
        d(k-(i+(n-j)))
        rep(r,k-(i+(n-j)))if(v[0]<0 && v.size()>0)v.erase(v.begin());
        d("--")
        d(v.size())
        rep(r,v.size())d(v[r]);
        rep(r,v.size())sum+=v[r];
        d(sum);
        ma=max(ma,sum);
    }
    p(ma);
    return 0;
}


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

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll n,m,X,Y;
ll x[100],y[100];
int main() {
    std::cin >> n>>m>>X>>Y;
    for (int i = 0; i < n; i++) {
        std::cin >> x[i];
    }
    for (int i = 0; i < m; i++) {
        std::cin >> y[i];
    }
    sort(x,x+n);
    sort(y,y+m);
    if(min(Y,y[0])-max(x[n-1],X)>0){
        std::cout << "No War" << std::endl;
    }else{
        std::cout << "War" << std::endl;
    }
}


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

int N;
void input() { cin >> N; }

void solve() {
  ll ans = 0;
  ll Ni;
  rep(i, 1, N) {
    Ni = N / i;
    ans += i * (Ni * (Ni + 1) / 2);
    // ans += i * (N / i * (N / i + 1) / 2);
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a[1001],b[1001],c[1001],d,n,m,x,y,z,k,h,w,sum,mi,ma,ans,s,t,l,r,res,tmp,itr;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<int, int> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<int,int> > VP;

// 5 4 3 2
// 4 3 2

int main(){
    cin>>x>>y>>z>>k;
    rep(i,x)cin>>a[i];
    rep(i,y)cin>>b[i];
    rep(i,z)cin>>c[i];
    VL v;
    rep(i,x)rep(j,y)v.pb(a[i]+b[j]);
    sort(all(v));
    reverse(all(v));
    VL v2;
    rep(i,min((int)v.size(),5000))rep(j,z)v2.pb(v[i]+c[j]);
    sort(all(v2));
    reverse(all(v2));
    rep(i,k)p(v2[i]);
    return 0;
}


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

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

const int INF = 100000000;
const double PI=acos(-1);

bool comp(P p1, P p2){
    if (p1.first != p2.first) {
        return p1.first < p2.first;
    }
    else if (p1.second != p2.second) {
        return p1.second > p2.second;
    }
    else {
        return true;
    }
}


int main () {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    vector<int> B(M);
    vector<int> C(M);
    rep(i,N) {
        cin >> A[i];
    }
    rep(i,M) {
        cin >> B[i] >> C[i];
    }

    ll ans = 0;

    sort(A.begin(),A.end());

    vector<int> idx(M);
    iota(idx.begin(),idx.end(),0);
    sort(idx.begin(),idx.end(),[&](int i, int j) {
            return C[i] > C[j];});

    int id = 0;
    rep(i,A.size()) {

        if (A[i]<C[idx[id]]) {
            A[i] = C[idx[id]];
            B[idx[id]]--;
            if (id+1==idx.size()&&B[idx[id]]==0) {
                break;
            }
            if (B[idx[id]]==0) {
                id++;
            }
        }
        else {
            break;
        }
    }
    rep(i,A.size()) {
        ans += A[i];
    }
    cout << ans << endl;

}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int a, b;
  cin >> a >> b;
  if (a == 1) a = 14;
  if (b == 1) b = 14;
  if (a == b) {
    cout << "Draw" << endl;
  } else if (a > b) {
    cout << "Alice" << endl;
  } else {
    cout << "Bob" << endl;
  }

  return 0;
};


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


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

    long long currentT = T[0], currentA = A[0];
    for(int i=1; i<N; i++){
        long long nextT=T[i], nextA=A[i];
        if(nextT < currentT || nextA < currentA){
            long long scale = max(
 currentT/nextT, currentA/nextA);
            nextT = T[i]*scale;
            nextA = A[i]*scale;
            if(nextT < currentT || nextA < currentA){
                scale++;
                nextT = T[i]*scale;
                nextA = A[i]*scale;
            }
        }
        currentT = nextT;
        currentA = nextA;
    }
    cout << (currentT + currentA) << '\n';

}


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

int main(){
	int n;
	cin >> n;
	int arr[2][n];
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < n; j++){
			int c;
			cin >> c;
			arr[i][j] = c;
		}
	}
	int best = 0, row_begin = 0;
	for(int k = 0; k < n; k++){
		int sum = 0, i = 0;
		for(int j = 0; j < n; j++){
			sum += arr[i][j];
			if( j == row_begin && i == 0){
				i++;
				row_begin++;
				sum += arr[i][j];
			}
		}
		best = max(best, sum);
	}
	cout << best << endl;
}

Measured memory_bytes: 256
# import bisect
from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    chars = "abcdefghij"
    que = deque()
    que.append(("a",1))

    while que:
        s, num = que.popleft()

        if len(s) == n:
            print(s)
        else:
            for i in range(num+1):
                ss = s + chars[i]
                if i == num:
                    que.append((ss,num+1))
                else:
                    que.append((ss,num))

if __name__ == '__main__':
    main()

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

int main() {
    int n;
    vector <int> arr;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int num;
        cin >> num;
        arr.push_back(num);
    }

    sort(arr.begin(), arr.end(), std::greater<int>());
    int alice, bob;
    alice = 0;
    bob = 0;
    
    for (int i = 0; i < arr.size(); i++) {
        if (i % 2 == 0) {
            alice += arr[i];
        } else {
            bob += arr[i];
        }
    }

    cout << alice - bob << endl;


}

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

int main() {
    long long x, div, ans=0;
    const int q = 11;
    cin >> x;
    div = x/q;
    ans += div*2;
    x -= div*q;
    if(x) {
        if(x-6<=0) {
            ans += 1;
        }
        else {
            ans += 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
word = gets.chomp
arr = Array.new(26,0)
if word.length % 2 == 0
        ("a".."z").each_with_index do |alpha,i|
                arr[i] = word.count(alpha)
        end
        if arr.all? {|even| even % 2 == 0 || even == 0}
                puts "Yes"
        else puts "No"
        end
else puts "No"
end

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

VV G;
V c, dp;
Vll ans;
int s = 0;

ll chs(ll x) {
  return x*(x+1)/2;
}

void dfs(int u, int p=-1) {
  int tmp = s + dp[c[u]];
  for (auto v : G[u]) if (v != p) {
    dp[c[u]] = -s;
    dfs(v, u);
    ans[c[u]] -= chs(s + dp[c[u]]);
  }
  ++s;
  dp[c[u]] = tmp - s;
}


int main() {
  ll n; cin >> n;
  G.assign(n, V());
  c.assign(n, 0);
  dp.assign(n, 0);
  ans.assign(n, chs(n));

  rep(i, n) {
    cin >> c[i];
    --c[i];
  }
  rep(i, n-1) {
    int a, b; cin >> a >> b;
    --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs(0);

  rep(i, n) {
    ans[i] -= chs(s + dp[i]);
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 29932
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class Monoid> struct RMQ {
    const Monoid INF;
    int SIZE_R;
    vector<pair<Monoid,int> > dat;
    
    RMQ(int n, const Monoid &inf): INF(inf) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, pair<Monoid,int>(INF, -1));
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = make_pair(v, a); }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k) {
            dat[k] = min(dat[k*2], dat[k*2+1]);
        }
    }
    
    /* update, a is 0-indexed */
    void update(int a, const Monoid &v) {
        int k = a + SIZE_R;
        dat[k] = make_pair(v, a);
        while (k >>= 1) dat[k] = min(dat[k*2], dat[k*2+1]);
    }
    
    /* get {min-value, min-index}, a and b are 0-indexed */
    pair<Monoid,int> get(int a, int b) {
        pair<Monoid,int> vleft = make_pair(INF, -1), vright = make_pair(INF, -1);
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = min(vleft, dat[left++]);
            if (right & 1) vright = min(dat[--right], vright);
        }
        return min(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R].first; }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            Monoid val = (*this)[i];
            if (val < INF) cout << val;
            else cout << "INF";
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};

const long long INF = 1LL<<60;
int N;
long long T, E;
vector<long long> x;

long long solve() {
    vector<long long> dp(N+1, INF);
    RMQ<long long> r1(N+1, INF), r2(N+1, INF);
    dp[0] = 0;
    r1.update(0, -x[0] * 2);
    r2.update(0, 0);
    for (int i = 1; i <= N; ++i) {
        int ut = upper_bound(x.begin(), x.end(), x[i-1] - (T+1)/2) - x.begin() - 1;
        int lt = lower_bound(x.begin(), x.end(), x[i-1] - (T-1)/2) - x.begin();
        chmin(ut, i-1);
        chmin(dp[i], r1.get(0, ut+1).first + x[i-1] * 3);
        chmin(dp[i], r2.get(lt, i).first + x[i-1] + T);
        r1.update(i, dp[i] - x[i] * 2 - x[i-1]);
        r2.update(i, dp[i] - x[i-1]);
    }
    return dp[N] + (E - x[N-1]);
}

int main() {
    cin >> N >> E >> T;
    x.resize(N);
    for (int i = 0; i < N; ++i) cin >> x[i];
    cout << solve() << endl;
}

Measured memory_bytes: 9984
from copy import deepcopy
import numpy as np

def paint_red(array, rows, cols):
    ret = deepcopy(array)
    for i in rows:
        ret[i, :] = "r"
    for j in cols:
        ret[:, j] = "r"

    return ret

def get_idx(bins):
    indices = []
    for i, c in enumerate(reversed(bins)):
        if c == "1":
            indices.append(i)
    
    return indices

def is_terminated(array, n_blacks):
    actual_number = 0
    for i in range(array.shape[0]):
        for j in range(array.shape[1]):
            if array[i, j] == "#":
                actual_number += 1
    return n_blacks == actual_number

H, W, K = [int(x) for x in input().split()]
c = []
for i in range(H):
    row = [x for x in input()]
    c.append(row)
c = np.array(c)

n_solutions = 0
for counter in range(2 ** (H + W)):
    bins = bin(counter)[2:].zfill(H + W)
    rows = get_idx(bins[:H])
    cols = get_idx(bins[H:])

    painted = paint_red(c, rows, cols)
    if is_terminated(painted, K):
        n_solutions += 1

print(n_solutions)


Measured memory_bytes: 27040
import java.util.*;
import java.io.*;
public class Main {

	static Scanner inp= new Scanner(System.in);
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {		    	
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	
	
	//Main
	void main() {
		
		String s=inp.next();
		String t=inp.next();
		int n=s.length();
		int m=t.length();
		int gg=m;
		for(int i=0;i<=n-m;i++) {
			int c=m;
			for(int j=0;j<m;j++) {
				if(s.charAt(i+j)==t.charAt(j)) c--;
			}
			gg=Math.min(gg, c);
		}
		System.out.println(gg);
	}
    
    
		
}


Measured memory_bytes: 35924
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

AB.sort(key=lambda x:x[1])

t = 0
ans = 'Yes'
for i in range(N):
    t += AB[i][0]
    if t > AB[i][1]:
        ans = 'No'
        
print(ans)

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	int N;


	cin >> N;

	vi L(N);

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

	sort(L.begin(), L.end());

	ll ans = 0;

	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			int a = L[i], b = L[j];
			int idxL = upper_bound(L.begin(), L.end(), b - a) - L.begin();
			int idxR = lower_bound(L.begin(), L.end(), b + a) - L.begin() - 1;

			db(i, j, a, b, idxL, idxR);

			ans += idxR - idxL + 1 - (idxL <= i && i <= idxR) - (idxL <= j && j <= idxR);


		}
	}

	cout << ans / 3 << '\n';


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 250
int main(){
  int howm,i,j,par,le,ri;
  int T[MAX];
  scanf("%d",&howm);
  for(i=1;i<=howm;i++){
    scanf("%d",&T[i]);
  }
  for(i=1;i<=howm;i++){
    printf("node %d: key = %d,",i,T[i]);
    if(i/2>=1){
      par=i/2;
      printf(" parent key = %d,",T[par]);
    }
    if(howm>=i*2){
      le=i*2;
      printf(" left key = %d,",T[le]);
    }
    if(howm>=i*2+1){
      ri=i*2+1;
      printf(" right key = %d,",T[ri]);
    }
    printf(" \n");
  }
  return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll H;
    cin >> H;
    ll cnt = 0;
    ll ans = 0;
    ll p = 1;
    while (H > 0) {
        H /= 2;
        cnt ++;
        ans += p;
        p *= 2;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
def s()
  gets()
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end

require 'bigdecimal'
require 'bigdecimal/util'

x, y = li()

require "bigdecimal"
require "bigdecimal/math"


x = BigDecimal(x.to_s)
y = BigDecimal(y.to_s)
puts (BigMath.log(y/x, 400)/BigMath.log(2, 200)).floor + 1


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

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

    v_int a(n+1, 0);

    irep(i, n) {
        cin >> a[i];
    }

    int d = (k - a[n-1]) + a[0];
    irep(i, n-1) {
        d = max(d, a[i+1] - a[i]);
    }
    cout << k - d << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 1024
import math

a=0

K=int(input())
for i in range(1,K+1):#(1,2,3)
    for j in range(i,K+1):
        for r in range(j,K+1):
            if i==j and i==r:#(1,1,1)のような場合
                a+=math.gcd(i,math.gcd(j,r))
            elif i==j or j==r:#(1,1,2),(1,2,2)のような場合。各3通り
                a+=math.gcd(i,math.gcd(j,r))*3
            else:
                a+=math.gcd(i,math.gcd(j,r))*6
print(a)

Measured memory_bytes: 9200
#include <stdio.h>
int main(void) {
    long i,n,k,j = 0;
    scanf("%ld",&i);
    for(j = 0;j < i;j++){
        scanf("%ld",&n);
            k=k+n;
        }
    printf("%ld\n",k / i);
    return 0;
}

Measured memory_bytes: 592