akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define scn(n) scanf("%d", &n)
#define scns(s) scanf("%s", &s)
#define pri(n) printf("%d", n)
#define priln(n) printf("%d\n", n)
#define pris(s) printf("%s", s)
#define prisln(s) printf("%s\n", s)
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; }

int main()
{
  int n, m;
  scn(n);
  scn(m);
  int s[m];
  int c[m];

  for (int i; i < m; ++i) {
    cin >> s[i] >> c[i];
  }

  int d[n];
  rep(i, n) d[i] = -1;

  int check = 0;
  rep(i, m) {
    int pos = s[i] - 1;
    if (d[pos] >= 0 && d[pos] != c[i]) {
      check = 1;
      break;
    }

    d[pos] = c[i];
  }

  rep(i, n) {
    if (d[i] < 0) {
      if (i == 0 && n > 1) {
        d[i] = 1;
      } else {
        d[i] = 0;
      }
    }
  }

  if (check == 1 || (d[0] == 0 && n != 1)) {
    cout << -1 << endl;
  } else {
    rep(i, n) cout << d[i];
    cout << endl;
  }

  return 0;
}


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


int main(void)
{
    int n,m,i,max,j,c[100]={0},i2,j2,l2;
    char s[100][11],t[100][11];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",s[i]);
    }
    scanf("%d",&m);
    for(i=0;i<m;i++){
        scanf("%s",t[i]);
    }
    for(i=0;i<n;i++){
        c[i]++;
        for(j=i+1;j<n;j++){
            if(strcmp(s[i],s[j])==0){ c[i]++;
            }
        }
        for(j=0;j<m;j++){
            if(strcmp(s[i],t[j])==0) c[i]--;
        }
    }
    
    for(i=0;i<n;i++){
        if(max<c[i]) max=c[i];

    }
    if(max<0) printf("0\n");
    else printf("%d\n",max);
    


    return 0;
}


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

int main() {
	int A, B, C, X, Y;
	int ans = 0;
	cin >> A >> B >> C >> X >> Y;

	if(A + B <= 2 * C) {
		ans = A * X + B * Y;
	} else {
		int c = 0;
		while(X - c / 2 && Y - c / 2) {
			ans += 2 * C;
			c += 2;
		}
		ans += A * (X - c / 2) + B * (Y - c / 2);
	}
	
	int ans2 = C * max(X, Y) * 2;

	cout << min(ans, ans2) << endl;

	return 0;
}


Measured memory_bytes: 256
while 1:
 m, f, r = map(int, input().split())

 if m == -1 and f == -1 and r == -1: break

 if m == -1 or f == -1:
   print("F")

 elif m == -1: m = 0
 elif f == -1: f = 0

 elif m+f >= 80:   print("A")
 elif m+f >= 65: print("B")
 elif m+f >= 50: print("C")
 elif m+f >= 30:
   if r >= 50:
     print("C")
   else: print("D")
 else: print("F")


Measured memory_bytes: 5592
#include<stdio.h>


int main(){

  double a,b;
  int i,data[8];
  
  for(i=0 ; i < 8; i++){
    data[i] = 0;
  }
  
  while(1){
    if(scanf("%lf %lf",&a,&b) == EOF)
      break;
    if(a >= 1.1)
      data[0]++;
    else if(a >= 0.6)
      data[2]++;
    else if(a >= 0.2)
      data[4]++;
    else 
      data[6]++;
    if(b >= 1.1)
      data[1]++;
    else if(b >= 0.6)
      data[3]++;
    else if(b >= 0.2)
      data[5]++;
    else 
      data[7]++;
  }
  for(i = 0; i < 8;i= i+2){
    printf("%d %d\n",data[i],data[i+1]);
  }
  return 0;
}

	   
	  
      

    

Measured memory_bytes: 0
// https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define FORR(i, s, n) for (int i = (n - 1); i >= s; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    int M;
    cin >> M;
    vector<int> v(10);
    while (M--) {
        int d, c;
        cin >> d >> c;
        v[d] += c;
    }
    int sum = 0;
    REP(i, 10) { sum += v[i] * i; }
    cout << accumulate(ALL(v), 0LL) - 1 + (sum - 1) / 9 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

void solve() {
  ll n, k; cin >> n >> k;
  ll s = 0, t = 0;
  vector<ll> a(n); rep(i, n) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i] > a[j]) s++;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] > a[j]) t++;
    }
  }

  // debug(sum);

  outl(k * ((s + t * (k - 1) % MOD * modinv(2, MOD)) % MOD) % MOD);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))
def inNL(n):
    return [list(map(int,input().split())) for i in range(n)]
s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61896
import java.util.Scanner;

public class Main {
	public static void main(String[] argst) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String a = scan.next();

		String b = scan.next();

		String c = scan.next();

		char a_back = a.charAt(a.length() - 1); // aの後ろ

		char b_front = b.charAt(0); // bの前
		char b_back = b.charAt(b.length() - 1); // bの前

		char c_front = c.charAt(0);

		if (a_back == b_front) {
			if (b_back == c_front) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} else {
			System.out.println("NO");
		}

	}
}

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


void solve() {
  int N,X;
  cin >> N >> X;
  int arr[N];
  rep(i,N) {
    scanf("%d", &arr[i]);
  }
  int zahyo=0;
  int ans = 0;
  int i = 0;
  while (zahyo <= X) {
    zahyo = zahyo+arr[i];
    ans++;
    i++;
  }
  if (ans>N+1) {
    ans=N+1;
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll ans = 0;
  for(ll i=1;i<=N;++i) {
    if(N%i==0) {
      ans += N/i-1;
    }
    else {
      ans += N/i;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    if(k==1){
        cout<<1<<endl;return 0;
    }
    double ans=0;
    if(n>=k)
    ans=(double)((n-k+1)/n);
    double sub=0;

    long long K=k;
    for(long long i=1;i<=n;i++)
    {
        long long j=i;
        double c=0;
        while(j<K)
        {
            j=j*2;
            c+=1;
        }
        
        sub+=(double)1/((pow(2.0, c)));  
    }
    
    sub=sub/n;
    ans+=sub;
    printf("%.11lf\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==5 && b==5 && c==7)||(a==5 && b==7 && c==5)||(a==7 && b==5 && c==5))
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 3592
def solve(n, aaa):
    added_once = n * (n + 1) // 2
    total = sum(aaa)
    d, m = divmod(total, added_once)
    if m != 0:
        return False
    cnt = 0
    for a1, a2 in zip(aaa, aaa[1:] + aaa[:1]):
        k = d - (a2 - a1)
        kd, km = divmod(k, n)
        if kd < 0 or km != 0:
            return False
        cnt += kd
    assert cnt == d
    return True


n = int(input())
aaa = list(map(int, input().split()))
print('YES' if solve(n, aaa) else 'NO')


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

using ll=long long;

ll cul(ll x,ll y,ll z){
  ll ans = x*x+y*y+z*z+x*y+y*z+z*x;
  return ans;
}


int main(){

  ll n;
  cin >> n;
  vector<ll> f(n+1,0);

  ll num;
  for(ll x=1;x<n;x++){
    for(ll y=1;y<=x;y++){
      for(ll z=1;z<=y;z++){
        num=cul(x,y,z);
        if(num>n){
          break;
        }
        if(x==y && y==z){
          f[num]++;
        }else if(x==y || y==z || x==z){
          f[num]+=3;
        }else{
          f[num]+=6;
        }
      }
    }
  }

  for(int i=1;i<=n;i++){
    cout << f[i] << endl;
  }
}

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

int main()
{
  int n;
  cin >> n;
  int a = n /100;
  int b = n % 100;
  if (1 <= a && a <= 12){
    if(1 <= b && b <= 12) cout << "AMBIGUOUS" << endl;
  	else cout << "MMYY" << endl;
  }
  else {
    if (1 <= b && b <= 12) cout << "YYMM" << endl;
  	else cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <utility>

int main() {
		
	// recieve |V| and |E|
	int V, E; std::cin >> V >> E;
	std::vector<std::vector<std::pair<int, int>>> G(V);
	
	for(int i = 0; i < E; i++) {
		// recieve edges
		int u, v, d; std::cin >> u >> v >> d;
		u--; v--;
		G[u].push_back({v, d});
		G[v].push_back({u, d});
	}
	
	int Tmax; std::cin >> Tmax;

	// recieve info
	for(int i = 0; i < Tmax; i++) {
		int Nnew; std::cin >> Nnew;
		for(int j = 0; j < Nnew; j++) {
			int new_id, dst; std::cin >> new_id >> dst;
		}
	}

  // insert your code here to get more meaningful output
	// all stay
	for(int i = 0; i < Tmax; i++) std::cout << -1 << std::endl;
	return 0;
}

Measured memory_bytes: 384
n = int(input())
cnt = 0
flg = False
for i in range(n):
    a,b = map(int,input().split())
    if a == b:
        cnt += 1
        if cnt == 3:
            flg = True    
    else:
        cnt = 0
if flg:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9100
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        int T = sc.nextInt();
        int A = sc.nextInt();

        int nearest = -1;
        double nearestDiff = 0;

        for (int i = 0; i < N; i++) {
            int h = sc.nextInt();

            double diff = Math.abs(A - (T - h * 0.006));
            if ( nearest < 0 || diff < nearestDiff ) {
                nearest = i;
                nearestDiff = diff;
            }
        }

        System.out.println(nearest + 1);
    }
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n, m;
    cin >> n >> m;
    vector<pii>ab(m);
    vector<vector<int>>board(n, vector<int>(n, 10000));
    rep(i, 0, n){
        rep(j, 0, n){
            if(i==j)board[i][j]=0;
        }
    }
    rep(i, 0, m){
        cin>> ab[i].first >> ab[i].second;
        ab[i].first--;
        ab[i].second--;
        board[ab[i].first][ab[i].second]=1;
        board[ab[i].second][ab[i].first]=1;
    }
    int cnt = 0;
    rep(i, 0, m){
        vector<vector<int>>temp = board;
        temp[ab[i].first][ab[i].second] = 10000;
        temp[ab[i].second][ab[i].first] = 10000;
        rep(k, 0, n){
            rep(s, 0, n){
                rep(g, 0, n){
                    chmin(temp[s][g], temp[s][k]+temp[k][g]);
                }
            }
        }
        bool p = false;
        rep(j, 0, n)rep(k, 0, n)if(temp[j][k]==10000)p= true;
        if(p)cnt++;
    }
    cout << cnt << endl;
}

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

using namespace std;


int main(){
	
	int n,m;
	cin >> n >> m;
	int left=INT_MIN;
	int right = INT_MAX;
	int a,b;
	for(int i=0;i<m;i++){
		cin >> a >> b;
		left = max(left,a);
		right = min(right,b);
	}
	cout << max(0,right-left+1);
	return 0;
}

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

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> set = new HashSet<>();
        for(int i = 0; i < n; i++){
            set.add(sc.next());
        }
        System.out.println(set.size());
    }
}

Measured memory_bytes: 74120
{-# LANGUAGE FlexibleContexts #-}
import Data.Array
import Data.Array.ST

category::[Int]->Array Int Int
category xs = runSTArray $ do
                  ar<-newArray (0,8) 0
                  mapM_ (writer ar) xs
                  return ar
                    where writer ar x = do
                              let i=min (div x 400) 8
                              v<-(readArray ar i)
                              writeArray ar i (v+1)

solver::Array Int Int -> (Int,Int)
solver ar = let d =  length (filter (\x-> x/=0) (take 8 (elems ar))) in
            let l = last (elems ar) in
            ( d+(if (d>0)||(l==0) then 0 else 1),d+ l)

main::IO()
main =do
  _<-getLine
  datc<-getLine
  let dat = map read (words datc)::[Int]
  let (x,y)=solver (category dat)
  putStr ((show x)++" "++(show y)++"\n")

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        int pi;
        cin >> pi;
        p[i] = pi;
    }

    int min = p[0];

    for (int i = 0; i < n; i++)
    {
        if(p[i] <= min){
            cnt += 1;
            min = p[i];
        }
    }

    cout << cnt << endl;

}

Measured memory_bytes: 1024
def main():
    N, K = map(int, input().split())
    D = set(map(int, input().split()))

    for i in range(10):
        if i not in D:
            min_ = i
            break

    ans = []
    apnd = ans.append
    num, top, i = N, 0, 0
    while num > 0:
        while num % 10 in D:
            num += 1
            top = i
        num, m = divmod(num, 10)
        apnd(m)
        i += 1

    ans[0:top] = [min_] * top
    print(*ans[::-1], sep='')

main()


Measured memory_bytes: 3064
package main

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

type pair struct {
	a, b int
}

func solve() {
	n := getInt()

	retAB := func(num int) pair {
		a := num % 10
		for num >= 10 {
			num /= 10
		}
		b := num
		return pair{a, b}
	}

	m := make(map[pair]int)
	for i := 1; i <= n; i++ {
		if i%10 == 0 {
			continue
		}

		p := retAB(i)
		m[p]++
	}

	ans := 0
	for i := 1; i <= n; i++ {
		p := retAB(i)
		ans += m[pair{p.b, p.a}]
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int A[1000005];
int a,n;
int main(int argc, char** argv) {
	cin>>n;
	for(int i=1;i<=n;i++) 
	{
		cin>>a;
		A[a]=i;
	}
	for(int i=1;i<=n;i++) 
	{
		cout<<A[i]<<" ";
	}
	return 0;
}


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

int main()
{
  int h, w;
  cin >> h >> w;
  char c[h][w];
  int a[h][w];
  rep(i, h){
    rep(j, w){
      cin >> c[i][j];
      a[i][j]= 0;
    }
  }
  
  rep(i, h){
    rep(j, w){
      if(i != 0 && j != 0 && c[i - 1][j - 1] == '#') a[i][j]++;
      if(i != 0 && c[i - 1][j] == '#') a[i][j]++;
      if(i != 0 && j != w - 1 && c[i - 1][j + 1] == '#') a[i][j]++;
      if(j != w - 1 && c[i][j + 1] == '#') a[i][j]++;
      if(i != h - 1 && j != w - 1 && c[i + 1][j + 1] == '#') a[i][j]++;
      if(i != h - 1 && c[i + 1][j] == '#') a[i][j]++;
      if(i != h - 1 && j != 0 && c[i + 1][j - 1] == '#') a[i][j]++;
      if(j != 0 && c[i][j - 1] == '#') a[i][j]++;
    }
  }
  
  rep(i, h){
    rep(j, w){
      if(c[i][j] == '#') cout << c[i][j];
      else cout << a[i][j];
    }
    cout << endl;
  }
  //cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string s, t;
  cin >> s >> t;
  ll ss = s.size(), ts = t.size(), ans = INF;
  rep(i, ss - ts + 1) {
    ll cnt = 0;
    rep(j, ts) if(s[i+j] != t[j]) cnt++;
    chmin(ans, cnt);
  }
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int q = sc.nextInt();
        int[] a = new int[n];

        a[0] = sc.nextInt();
        for (int i = 1; i < n; i++) {
            a[i] = sc.nextInt();
        }

        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 0; i < q; i++) {
            long x = sc.nextLong();

            long cnt = 0;
            int right = 0;
            long sum = 0;
            for (int left = 0; left < n; left++) {
                while (right < n && sum + a[right] <= x)
                    sum += a[right++];

                cnt += right - left;

                if (right == left)
                    right++;
                else
                    sum -= a[left];
            }

            pw.println(cnt);
        }

        pw.flush();
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

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


Measured memory_bytes: 42848
#include<iostream>

using namespace std;

int main(){
  char c[3][3];
  for(int i=0;i < 3;i++)
    cin >> c[i][0] >> c[i][1] >> c[i][2];
  
  cout << c[0][0] << c[1][1] << c[2][2];
  return 0;
}


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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, s[300003];
LL ans;

int main(){
	scanf("%d", &n);
	FI(i, 1, n + n + n) scanf("%d", &s[i]);
	sort(s + 1, s + n + n + n + 1);
	FI(i, n + 1, n + n + n){
		ans += s[i];
		i++;
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
	int n;
	cin>>n;
	int p[100];
	for(int i=0;i<n;i++){
		cin>>p[i];
	}
	int t=0,score=0;;
	while(1){
		int cnt=0;
		for(int i=0;i<n;i++){
			if(p[i]>=t) cnt++;
		}
		if(cnt>=t){
			score=t;
		}else{
			break;
		}
		t++;
	}
	cout<<score<<endl;
	return 0;
}

Measured memory_bytes: 3096
n = int(input())
#a,b = map(int,input().split())
L1 = tuple(map(int,input().split()))
L2 = tuple(map(int,input().split()))
L = [x+1 for x in range(n)]

li = []
import itertools
for x in itertools.permutations(L,n):
    #print(x)
    li.append(x)
#print(li)
print(abs(li.index(L1)-li.index(L2)))

Measured memory_bytes: 8052
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;

int n;
int a[N];
int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n;
	int s = 0;
	rep(i, 1, n) {
		cin >> a[i];
		s ^= a[i];
	}
	rep(i, 1, n) cout << (s ^ a[i]) << ' ';
	ioi
}


Measured memory_bytes: 4388
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int a = in.nextInt();
        final int b = in.nextInt();
        final int c = in.nextInt();
        final int k = in.nextInt();
        in.nextLine();
        if (a > k) {
            System.out.println(k);
        } else if (a + b >= k) {
            System.out.println(a);
        } else {
            int diff = k - (a + b);
            System.out.println(a - diff);
        }
    }
}


Measured memory_bytes: 35916
#include <stdio.h>

int ft_strlen(const char *s)
{
    int i;

    i = 0;
    while (s[i])
    {
        i++;
    }
    return i;
}

int main()
{
    char s[200000];
    char t[200000];
    int s_len;
    int t_len;
    int i;
    int num;
    if ((s_len = scanf("%s", s)) < 0)
    {
        fprintf(stderr, "error\n");
        return 0;
    }
    if ((t_len = scanf("%s", t)) < 0)
    {
        fprintf(stderr, "error\n");
        return 0;
    }
    if (t_len != s_len)
    {
        return 0;
    }
    i = 0;
    num = 0;
    while (t[i])
    {
        if (t[i] != s[i])
            num++;
        i++;
    }
    printf("%d", num);
    return 0;
}

Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	long long k;
	scanf("%d %lld", &n, &k);
	vector<long long> a(n);
	vector<long long> f(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);
	for(int i = 0; i < n; i++) scanf("%lld", &f[i]);
	sort(a.begin(), a.end());
	sort(f.begin(), f.end());
	long long l = -1, r = 1e12 + 10;
	while(r - l > 1) {
		long long mid = (l + r) / 2;
		bool flag = true;
		long long cnt = k;
		for(int i = 0; i < n; i++) {
			long long num = mid / f[i];
			if(num < a[n - i - 1]) {
				cnt -= a[n - i - 1] - num;
				if(cnt < 0) {
					flag = false;
					break;
				}
			}
		}
		if(flag) r = mid;
		else l = mid;
	}
	printf("%lld\n", r);
	return 0;
}

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

int main() 
{	int a;
	int b;
	cin >>a >>b;
	if(a%2==0||b%2==0)
	{
		cout <<"Even"<<endl;
	}
	else
	{
		cout <<"Odd"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
    return (b>0)? gcd(b, a%b): a;
}

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

int main() {
    ll a, b; cin >> a >> b;
    cout << lcm(a, b) << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int count = 0;
  
  for (int i = 0; i < 3; i++) {
    // cout << s[i] << "," << s[i] == (char)"1" << "," << endl;
    count += s[i] == '1';
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3584
var=input()
var=var.split()
a=int(var[0])
b=int(var[1])
c=int(var[2])
if(1<=a<=10000 and 1<=b<=10000 and 1<=c<=10000):
    if(a<b<c):
        print(str(a)+" "+str(b)+" "+str(c))
    elif(c<a<b):
        print(str(c)+" "+str(a)+" "+str(b))
    elif(b<c<a):
        print(str(b)+" "+str(c)+" "+str(a))
    elif(a<c<b):
        print(str(a)+" "+str(c)+" "+str(b))
    elif(c<b<a):
        print(str(c)+" "+str(b)+" "+str(a))
    elif(b<a<c):
        print(str(b)+" "+str(a)+" "+str(c))
    elif(a==b and a>c):
        print(str(c)+" "+str(a)+" "+str(b))
    elif(a==b and a<c):
        print(str(a)+" "+str(b)+" "+str(c))
    elif(a==c and a>b):
        print(str(b)+" "+str(a)+" "+str(c))
    elif(a==c and a<b):
        print(str(a)+" "+str(c)+" "+str(b))
    elif(c==b and c>a):
        print(str(a)+" "+str(b)+" "+str(c))
    elif(c==b and c<a):
        print(str(b)+" "+str(c)+" "+str(a))


Measured memory_bytes: 5616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>

#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define chk(a) rep(i, a.size()) cout << a[i] << " "
#define SORT(c) sort((c).begin(),(c).end())
#define ll long long
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)


using namespace std;
typedef pair<int, int> pii;
#define WARU 1000000007;

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

int main(void) {
	int k, t;
	cin >> k >> t;
	vector<int> v(t);
	int goukei = 0;
	int saidai = 0;
	rep(i, t) {
		cin >> v[i];
		goukei += v[i];
		saidai = max(saidai, v[i]);
	}
	int result = 1;
	if ((saidai - (goukei - saidai)) > 0) {
		result = (saidai - (goukei - saidai));
	}
	cout << result - 1 << endl;


	return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        an:[usize;n],
    }
    let mut count =0;
    for j in 0..n-2 {
        let mid  =an [j+1];
        let mut v = vec![an[j],an[j+1],an[j+2]];
        v.sort();
        if v[1] == mid {
            count += 1;
        }
    }
    println!("{}",count);
}



fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};



int main(){
  ll n,k; cin>>n>>k;
  map<ll,ll> mp;
  rep(i,n){
    ll a,b; cin>>a>>b;
    mp[a]+=b;
  }
  ll pre=0;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    pre+=itr->sc;
    if(pre>=k){
      cout<<itr->fs<<endl;
      break;
    }
  }


  return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, bnum = 4, fnum = 3, rnum = 10;
  vector<int> rooms(bnum * fnum * rnum);
  cin >> n;

  for (int i = 0; i < n; i++) {
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    int roomIndex = (b - 1) * fnum * rnum + (f - 1) * rnum + (r - 1);
    rooms[roomIndex] += v;
  }

  for (int i = 0; i < rooms.size(); i++) {
    cout << ' ' << rooms[i];
    if (i % rnum == rnum - 1) cout << endl;
    if (i % (fnum * rnum) == (fnum * rnum - 1) && i != rooms.size() - 1) {
      cout << string(20, '#') << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3116
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(X: int):

    # 状態s, カウンターcnt
    s = 100
    cnt = 0
    while X > s:
        cnt += 1
        s = int(s*1.01)
    print(cnt)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9084
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    let mut broken: Vec<bool> = vec![false; n];
    for _ in 0..m {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        broken[a] = true;
    }

    let mut dp: Vec<usize> = vec![0; n + 2];
    dp[n] = 1;
    for i in (0..n).rev() {
        if broken[i] {
            continue;
        }
        dp[i] = (dp[i + 1] + dp[i + 2]) % MOD;
    }

    return format!("{}", dp[0]);
}

const MOD: usize = 1_000_000_007;


Measured memory_bytes: 6524
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
using namespace std;

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

    if (a > b) printf("%d\n", a - 1);
    else printf("%d\n", a);

    return 0;
}

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)n; ++i)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;


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

    // const int M = 1e5 + 10;
	  
    int n; 
    cin >> n;
    cout << pow(n, 3) << endl;
	
  
}	

  // cout << "Case #" << caseNum++ << ": " << ans << endl;  


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll K; cin >> K;
    string s; cin >> s;
    if (s.size() <= K) cout << s << endl;
    else {
        for (int i = 0; i < K; i++) cout << s[i];
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
	ll N,i,j;
    cin >> N;
    ll X[N];
    for(i=0;i<N;i++){
        cin >> X[i];
    }
    ll ans = 10000000;
    ll tmp;
    for(j=1;j<=100;j++){
        tmp=0;
        for(i=0;i<N;i++){
            tmp+=pow(X[i]-j,2);
        }
        ans=min(ans,tmp);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#include <limits>
#include <vector>
#include <algorithm>
#include <functional>
#include <cctype>
#include <sstream>

typedef long long lint;

using namespace std;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);++i)
#define all(x) (x).begin(),(x).end()
#define sl(c) (('a')<=(c)&&(c)<=('z'))
#define ll(c) (('A')<=(c)&&(c)<=('Z'))
#define makeupper(t) transform(all(t),t.begin(),::toupper);
#define makelower(t) transform(all(t),t.begin(),::tolower);
lint* arr1(lint x) {
	lint *array = new lint[x];
	rep(i, x)array[i] = 0;
	return array;
}
lint** arr2(lint x, lint y) {
	lint **array = new lint*[x];
	rep(i, x)array[i] = new lint[y];
	rep(i, x)rep(j, y)array[i][j] = 0;
	return array;
}
vector<string> split(const string &s, char delim) {
	vector<string> elems;
	stringstream ss(s);
	string item;
	while (getline(ss, item, delim)) {
		if (!item.empty()) {
			elems.push_back(item);
		}
	}
	return elems;
}

int main() {
	string text;
	getline(cin, text);
	makelower(text);
	int count = 0;
	string str;
	while (1) {
		getline(cin, str);
		if (str == "END_OF_TEXT")break;
		makelower(str);
		for (string s : split(str,' ')) {
			if (s == text)count++;
		}
	}
	cout << count<<"\n";
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    int x; cin >> x;
    cout << (x>=30? "Yes": "No") << endl;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n,m;
    cin >> n >> m;
    int a,b;
    vector<vector<int>> v(n);
    rep(i,m){
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    vector<bool> t(n);
    queue<int> que;
    int ans=0;
    // rep(i,n){
    //     rep(j,v[i].size()){
    //         cout << v[i][j];
    //     }
    //     cout << endl;
    // }
    int count,f;
    rep(i,n){
        if(t[i]) continue;
        que.push(i);
        t[i]=true;
        count=1;
        while(!que.empty()){
            f=que.front();
            que.pop();
            for(int j=0; j<v[f].size(); j++){
                if(t[v[f][j]]) continue;
                t[v[f][j]]=true;
                count++;
                que.push(v[f][j]);
            }
        }
        ans=max(ans,count);
    }

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

Measured memory_bytes: 14796
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<int> v(N);
  vector<int> w(N);
  rep(i,N){
    cin >> v[i];
    w[i] = -v[i];
  }
  sort(all(v));
  sort(all(w));
  ll count = 0;
  rep(i,N){
    repp(j,i+1,N){
      ll over = v.end() - lower_bound(all(v),v[i]+v[j]);
      count += (ll) N-j-1 - over;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
import sys,os
import math
from fractions import Fraction 
from collections import defaultdict
from random import randint

#sys.stderr=open('err.txt','w')
#sys.stdout=open('output.txt','w')
#sys.stdin=open('input.txt','r')

def linput():
    return list(minput())

def minput():
    return map(int, sys.stdin.readline().strip().split())

###############################################################

s=input()
t=input()

ans=len(t)

for i in range(len(s)-len(t)+1):
    cur=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            cur+=1
    ans=min(ans,cur)
print(ans)

Measured memory_bytes: 10788
#include "bits/stdc++.h"
using namespace std;
#define OUT(x)                cout << #x << " = " << x << endl
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int x; scanf("%d", &x); return x; }
long long lin() { long long x; scanf("%lld", &x); return x; }

#define int long long
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int INF = 0x3f3f3f3f;

int n, a, b;
vector<int> h;

bool B(int x) {
        int cnt = 0LL;
        rep(i, n) {
                if (b * x >= h[i]) continue;
                else {
                        int c = h[i] - b * x;
                        //cnt += c / (a - b);
                        //if (c % (a - b) == 0LL) cnt += c / (a - b);
                        //else cnt += c / (a - b) + 1LL;
                        cnt += (c + (a - b) - 1) / (a - b);
                }
        }
        if (cnt > x) return false;
        return true;
}

signed main() { 
        cin >> n >> a >> b;
        h.resize(n);
        rep(i, n) cin >> h[i];
        int l = 0, r = INF;
        while (r - l > 1) {
                int mid = (l + r) / 2LL;
                if (B(mid)) r = mid;
                else l = mid;
        }
        cout << r << endl;
        return 0;
}               



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

int main() {
	int n,a=0,b=0;
	cin >> n;
	vector<int> ary(n);

	for (int i = 0; i < n; i++)
	{
		cin >> ary[i];
	}
	sort(ary.begin(),ary.end(),greater<int>());

	for (int i = 0; i < n; i++)
	{
		if(i % 2 == 0){
			a += ary[i];
		}else{
			b += ary[i];

		}
	}

	cout << a -b << endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

int f(int a){
  if (a%2==0){
    return a / 2;
  }else{
    return 3 * a + 1;
  }
}

int main(){
  int s, ans=1;
  vector<int> A;
  cin >> s;
  int a = s;
  A.push_back(a);
  while(f(a) <= 1000000){
    a = f(a);
    ans++;
    if (binary_search(A.begin(), A.end(), a)){
      printf("%d\n", ans);
      break;
    }
    A.push_back(a);
    sort(A.begin(), A.end());
  }
}


Measured memory_bytes: 3724
import sys
input = sys.stdin.readline

k,q = map(int,input().split())
d_array = list(map(int,input().split()))

ans_array = []
for _ in range(q):
    n, x, m = map(int,input().split())
    d_mod_array = [d % m for d in d_array]
    d_sum = 0
    d_part = 0
    zero_count = 0
    zero_part = 0
    part = (n-1) % k
    for i,d in enumerate(d_mod_array):
        d_sum += d
        if i < part:
            d_part += d
        if d == 0:
            zero_count += 1
            if i < part:
                zero_part += 1
    mod_total = x % m + d_sum * ((n-1) // k) + d_part
    reduce_total = mod_total // m

    zero_total = zero_count * ((n-1) // k) + zero_part
    ans = (n-1) - reduce_total - zero_total
    ans_array.append(str(ans))

print("\n".join(ans_array))



Measured memory_bytes: 64348
#include <stdio.h>
#include <string.h>

int main( void ) {
	int n;

	scanf( "%d", &n );

	while ( n-- ) {
		int base = 0, out = 0, point = 0;

		while ( out != 3 ) {
			char event[ 8 ];

			scanf( "%s", event );

			switch ( event[ 1 ] ) {
			case 'I':
				base++;
				if ( base == 4 ) {
					base--;
					point++;
				}
				break;
			case 'U':
				out++;
				break;
			case 'O':
				point += base + 1;
				base = 0;
				break;	
			}
		}

		printf( "%d\n", point );
	}

	return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
     
int main(int argv, char** argc) {
  int N;
  cin >> N;
  int A[N],B[N],C[N-1];
  int ans=0;
  for(int i=0;i<N;i++)
    cin >> A[i];
  for(int i=0;i<N;i++){
    cin >> B[i];
    ans += B[i];
  }
  for(int i=0;i<N-1;i++)
    cin >> C[i];
     
  for(int i=0;i<N-1;i++){
    if(A[i]+1==A[i+1])
      ans+=C[A[i]-1];
  }
  cout << ans << endl;
     
  return 0;
     
}

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

#define ll long long int


int main()
{
	ll n;
	cin>>n;
	ll h[n+1];
	for(int i=1; i<=n; i++) cin>>h[i];
	ll dp[n+1];
// dp [i] denotes the cost to reach step i.
	dp[1] = 0;
	dp[2] = abs(h[2]-h[1]);
	dp[3] = abs(h[3]-h[1]);

	for(int i=4; i<=n; i++)
	{
		dp[i] = min (abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
	}

//	for(int i=1; i<=n; i++) cout<<dp[i]<<"\t";
//	cout<<endl;
	cout<<dp[n];

	return 0;
}

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

namespace ProgrammingContest_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var e = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var list = new List<string>();

            for (int i = 0; i < e[0]; i++)
            {
                list.Add(Console.ReadLine());
            }

            list.Sort();
            string ans = string.Concat(list);

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
#define z 1000000007

int main() {
	long long n,k,i,a[100000],j,g=0,l=0,fs,ps,ans;
	cin>>n>>k;
	for(i=0;i<n;i++) cin>>a[i];
	for(i=0;i<n-1;i++) {
		for(j=i+1;j<n;j++) {
			if(a[j]>a[i]) l++;
			if(a[j]<a[i]) g++;
		}
	}
	if(k%2==0) {
		fs=((k/2)*((k+1)%z))%z;
		ps=((k/2)*(k-1))%z;
	} else {
		fs=(k*((k+1)/2))%z;
		ps=(k*((k-1)/2))%z;
	}
	
	ans=((g*fs)%z);
	ans=(ans+(l*ps)%z)%z;
	cout<<ans;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for num_500 in range(0, a + 1):
    for num_100 in range(0, b + 1):
        for num_50 in range(0, c + 1):
            if num_500 * 500 + num_100 * 100 + num_50 * 50 == x:
                count += 1
print(count)


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

int main()
{
    int n, q, c = 0;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &a[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++)
    {
        int b, l = 0, m, r = n;
        scanf("%d", &b);
        while (l < r)
        {
            m = (l + r) / 2;
            if (b == a[m])
            {
                c++;
                break;
            }
            else if(b > a[m])
            {
                l = m + 1;
            }
            else
            {
                r = m;
            }
        }
    }
    printf("%d\n", c);
}


Measured memory_bytes: 3540