akhauriyash/Code-Regression huggingface dataset:
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
import Data.Array.IArray
--import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
dictCompare :: [a -> a -> Ordering] -> a -> a -> Ordering
dictCompare [] _ _ = EQ
dictCompare (f:fs) x y = let c = f x y in if c==EQ then dictCompare fs x y else c
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
count :: (a -> Bool) -> [a] -> Int
count = (length .) . filter
-- end of templete

f :: Int -> Array (Int, Int) Char -> (Int, Int) -> (Int, Int) -> Int
f n arr (dy,dx) from = g 0 0 from
  where
    g r t p@(y,x) 
      | inRange ((1,1), (n,n)) p = (if (arr!p == '1') then let nt = t+1 in g (max r nt) nt  else g r 0) (y+dy, x+dx)
      | otherwise = r

main = do
    n <- getInt
    when (n/=0) $ do
        fd <- replicateM n getLine
        let arr = listArray ((1,1), (n, n)) $ concat fd :: Array (Int,Int) Char
        let fn = f n arr in print $ maximum $ concat [[fn (0, 1) (y, 1)| y <- [1..n]], [fn (1, 0) (1, x) | x <- [1..n]], [fn (1, 1) (y, 1) | y <- [1..n]], [fn (1, 1) (1, x) | x <- [2..n]], [fn (1, -1) (1, x) | x <- [1..n]], [fn (1, -1) (y, n) | y <- [2..n]]]
        main


Measured memory_bytes: 10168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<59;
const ll Mod=998244353;

int main(){
  ll i,j;
  ll n,m,l;
  cin>>n>>m>>l;
  VVI d(n,VI(n,INF));
  for(i=0;i<m;i++){
    ll  a,b,c;
    cin>>a>>b>>c;
    a--; b--;
    d[a][b]=min(c,d[a][b]);
    d[b][a]=min(c,d[b][a]);
  }

  for(int k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }

  VVI d2(n,VI(n,INF));
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(d[i][j]<=l) d2[i][j]=1;
    }
  }

  for(int k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        d2[i][j]=min(d2[i][j],d2[i][k]+d2[k][j]);
      }
    }
  }
  ll  q;
  cin>>q;
  while(q--){
    int s,t;
    cin>>s>>t;
    s--; t--;
    if(d2[s][t]>=INF) cout<<-1<<endl;
    else cout<<d2[s][t]-1<<endl;
  }
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;

    int cntAB = 0; 
    int cntB = 0;
    rep(i, n){
        bool isok = false;
        if (s[i]=='a') {
            if (cntAB < (a+b)){
                isok = true;
                cntAB++;
            }
        } else if (s[i]=='b') {
            if (cntB < b && cntAB < (a+b)){
                isok = true;
                cntB++; 
                cntAB++;
            }
        }
        if (isok) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

}



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

using namespace std;

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

  long long a, b, k;
  cin >> a >> b >> k;
  cout << max(0ll, a - k) << ' ' << max(0ll, b - (k - (a - max(0ll, a - k))));

  return 0;
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};

int a, b, c, A[1000], B[1000], C[1000], D[1000][1000];
string s, t, r;

int main(){
	cin >> a >> s;
	int ans = 0;
	for(int i = 1; i < s.size()-1; i++){
		t = s.substr(0, i);
		r = s.substr(i, s.size()-i);
		int d = 0;
		for(int j = 0; j < 26; j++){
			b = count(t.begin(), t.end(), (char)('a'+j));
			c = count(r.begin(), r.end(), (char)('a'+j));
			if(b&&c)d++;
		}
		ans = max(ans, d);
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
typedef pair<double,double> Pd;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,(n))
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) rrepi(i,(n),0)
#define rrepi(i,a,b) for(ll i=(a);i>=(b);i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const double Pi = acos(-1);
const ll INF=1e18;
const int iINF = 1e9;

int main(){
  ll n,ans = INF;
  cin>>n;
  for(ll i = 1; i*i <= n;i++){
    if(n%i == 0){
      ll m = n/i;
      ans = min(ans,i+m);
    }
  }
  cout<<ans-2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a,b,cnt=0,j,ar[10],i;
	cin>>a>>b;
	for(;a<=b;a++)
	{
		i=a;
		j=0;
		while(i>0)
	  	{
			ar[j]=i%10;
			i/=10;
			j++;
		}
		if(ar[0]==ar[4]&&ar[1]==ar[3])
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int N,K;
	scanf("%d %d",&N,&K);
	int x,pos;
	for(int i=1;i<=N;i++)
	{
		scanf("%d",&x);
		if(x==1)
		{
			pos=i;
			break;
		}
	}
	int ans=ceil(1.0*(N-1.0)/(K-1.0));
	printf("%d\n",ans);
	return 0;
 } 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define DEBUG true
#define $(x) {if (DEBUG) {cout << #x << " = " << (x) << endl;}}

const LL MOD = 1e9 + 7;
inline LL mod_add(LL a, LL b) { return (a + b) % MOD; }
inline LL mod_sub(LL a, LL b) { return (a + MOD - b) % MOD; }
inline LL mod_mul(LL a, LL b) { return ((a % MOD) * (b % MOD)) % MOD; }
LL mod_bipow(LL x, LL y) {   // x^y by bisection method
    if (y == 0) return 1;
    else if (y == 1) return x % MOD;
    else if (y % 2 == 0) {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(val, val);
    } else {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(mod_mul(val, val), x);
    }
}
LL mod_inv(LL x) { return mod_bipow(x, MOD - 2); }   // x^{-1} = x^{MOD-2} (MOD: prime number)
LL mod_div(LL a, LL b) { return mod_mul(a, mod_inv(b)); }   // a/b = a*b^{-1}


LL solve(string s) {
    $(s);
    if (SZ(s) == 0) return 1;
    LL T = 1;
    while (T < SZ(s) && s[T] == '0') T++;
    $(T);
    //if (T == SZ(s)) return 1;
    return mod_add(mod_bipow(3, SZ(s) - 1), mod_mul(2, solve(s.substr(T, SZ(s) - T))));
}

int main() {
    string s;
    cin >> s;
    
    //cout << solve(s) << endl;
    string ss = "";
    LL index = SZ(s) - 1;
    LL ans = 1;
    while (index >= 0) {
        ss = s[index] + ss;
        if (s[index] == '1') {
            ans = mod_add(mod_bipow(3, SZ(s) - index - 1), mod_mul(2, ans));
            ss = "";
        }
        index--;
    }
    cout << ans << endl;
	
    return 0;
}


Measured memory_bytes: 512
function Main(input) {
  var input = input.split(' ');
  var k = parseInt(input[0], 10);
  var x = parseInt(input[1], 10);
  var result = [];
  for (var i=x-k+1; i<x+k; i++){
    result.push(i);
  }

  //出力
  console.log(result.join(' '));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0; i<n; i++){
            p[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for(int i=0; i<n-1; i++){
            if(p[i] == i + 1){
                int tmp = p[i];
                p[i] = p[i+1];
                p[i+1] = tmp;
                ans++;
            }
        }
        if(p[n-1] == n) ans++;

        System.out.println(ans);
    }
}

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

#define FOR(k,m,n) for(int(k)=(m);(k)<(n);(k)++)
#define REP(k,n) FOR((k),0,(n))


int main() {
    int K, X;
    cin >> K >> X;

    for (int i = X - K + 1; i < X + K - 1; ++i) {
        printf("%d ", i);
    }
    printf("%d\n", X + K - 1);

    return 0;
}


/*
 * Local Variables:
 * compile-command: "CXXFLAGS='-std=c++14' make main"
 * End:
 */


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main { 
    public static void main(String[] args) {
        FastScanner sc=new FastScanner();
        int o=0;
        int n=sc.nextInt();
        PriorityQueue<Integer> q=new PriorityQueue<>();
		for(int i=0;i<n;i++){
        		int p=sc.nextInt();
        		q.add(p);
		}
      	int[] a=new int[n];
      	for(int i=0;i<n;i++){
        	a[i]=q.poll();
        }
      	int la=a.length;
      	int max_a=(int)a[la-1];
      	boolean[] dp=new boolean[max_a+1];
      Arrays.fill(dp,true);
      	for(int i=0;i<la;i++){ 
          	if(dp[(int)a[i]]){
              for(int j=1;j<=max_a/(int)a[i];j++){
              	dp[(int)a[i]*j]=false;
                
              }
              if(i<la-1&&a[i]!=a[i+1]){
                	o++;
                }else if(i==la-1){
                	o++;
                }
            }                     	
        }
      System.out.println(o);
    }
}

    class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  string s;
  cin>>N>>s;
  vector<int> cnt(30);
  for(int i(0);i<N;i++){
    cnt[s[i]-'a']++;
  }
  ll ans(1);
  for(int i(0);i<30;i++){
    ans *= (cnt[i]+1);
    ans %= MOD;
  }
  cout << ans-1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k ;
    cin >> k;
    k--;
    cout << a[k] << endl;
}


Measured memory_bytes: 256
import numpy as np

H,W,K = map(int, input().split())

c_list = []

for i in range(H):
    c_list.append(list(input()))

import numpy as np
import itertools

c_array = np.array(c_list)

result = 0

for i in range(H+1):
    for j in range(W+1):
  
        select_row =  list(itertools.combinations(range(H),i))  
        select_col =  list(itertools.combinations(range(W),j))    
  
        finish = c_array[select_row,:][:,:,select_col]
        partial_result = np.sum(np.sum(np.sum(finish =='#',axis=3),axis=1) == K)
  
        result = result + partial_result
    
print(result)   

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

int main() {
    int N, L;
    cin >> N >> L;
    vector<int> taste(N + 1, 0);
    int sum = 0;
    int minv = 1e9;
    for (int i = 1; i <= N; i++) {
        taste[i] = L + i - 1;
        if (abs(taste[i]) < abs(minv)) {
            minv = taste[i];
        }
        sum += taste[i];
    }
    cout << sum - minv << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int dp[101010][3];

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> P(3);
    for(auto &p : P) cin >> p;
    string t;
    cin >> t;
    int ans = 0;
    rep(idx, k) {
        int x = idx;
        string str;
        while(x < n) {
            str += t[x];
            x += k;
        }
        int m = str.size();
        rep(j, m + 1) rep(a, 3) dp[j][a] = 0;
        rep(i, m) {
            rep(a, 3) rep(b, 3) {
                if (a == b) continue;
                if ((str[i] == 'r' && a == 2) ||
                    (str[i] == 's' && a == 0) ||
                    (str[i] == 'p' && a == 1)) {
                    chmax(dp[i + 1][a], dp[i][b] + P[a]);
                } else {
                    chmax(dp[i + 1][a], dp[i][b]);
                }
            }
        }
        ans += *max_element(dp[m], dp[m] + 3);
    }
    cout << ans << endl;
}

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


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

int main(void) {
    long long int X, tmp, ans;
    cin >> X;

    tmp = X / 500;
    ans = X / 500 * 1000;
    X = X - 500 * tmp;

    ans += X / 5 * 5;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
a = input()
while (int(a) != 0):
    remain = [0for i in range(11)]
    remain[int(a[0])] = remain[int(a[0])] + 1  ##V0
    n = len(a)
    cnt = 0
    for i in range(1,n):
        copy = remain[:]
        remain = [0for i in range(11)]
        a_i = int(a[i])
        if (a_i != 0):
            for k in range(11):
                rem = (k*10 + a_i)%11
                remain[rem] += copy[k]
            remain[a_i] += 1
        elif (a_i == 0):
            for k in range(11):
                rem = (k*10 + a_i)%11
                remain[rem] += copy[k]
        cnt += remain[0]
    print(cnt)
    a = input()


Measured memory_bytes: 5960
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 3e3 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const ll MOD2 = 1e9 + 7;
const ll MOD3 = 1e9 + 9;

ll n;
double ans , p[MAXN] , dp[MAXN][MAXN];

int main() {
    fast_io;

    cin >> n;
    for(ll i = 1 ; i <= n ; i++)    cin >> p[i];

    dp[0][0] = 1;
    for(ll i = 1 ; i <= n ; i++)
    {
        for(ll j = 0 ; j <= i ; j++)
        {
            if(j == 0)
            {
                dp[i][j] = dp[i - 1][j] * (1 - p[i]);
                continue;
            }
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
        }
    }

    for(ll i = n / 2 + 1 ; i <= n ; i++)
    {
        ans += dp[n][i];
    }
    printf("%.10f" , ans);

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


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

#define mod 1000000007
#define maxn 1000005
#define pi acos(-1.0)

double a, b, x;

int main()
{
    //freopen("monotonic.in", "r", stdin);
    //freopen("monotonic.out", "w", stdout);
    cin >> a >> b >> x;
    x /= a;
    if (x > a * b / 2)
        printf("%.9f\n", 180 / pi * atan(2 * (a * b - x) / a / a));
    else
        printf("%.9f\n", 180 / pi * atan(b * b / 2 / x));

    return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from bisect import bisect_left
import sys,math,itertools,pprint,fractions,time
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b = inpl()
res = INF
for i in range(1,10**6):
    if int(i*0.08) == a and int(i*0.1) == b:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 65644
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;


int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    vector<ll> x(n);
    for(ll i=0;i<n;i++) cin>>x[i];
    ll ans=0;
    for(ll i=0;i<n-1;i++){
        ll dis=x[i+1]-x[i];
        if(dis<=b/a){
            ans+=dis*a;
        }else{
            ans+=b;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  vecint a(n);
  REP(i,n)cin>>a[i];
  int cnt=0;
  REP(i,n-2) {
    if (a[i+1] != max({a[i],a[i+1],a[i+2]}) && a[i+1] != min({a[i],a[i+1],a[i+2]})) {
      ++cnt;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <climits>

int main()
{
  std::priority_queue<long long, std::vector<long long>, std::greater<long long>> max_group;
  std::priority_queue<long long> min_group;
  int n;
  std::cin >> n;
  std::vector<std::pair<long long, long long>> candidate(n+1);
  std::vector<long long> item(n*3);
  for (int i = 0; i < n*3; i++) {
    std::cin >> item.at(i);
  }
  long long tmp = 0;
  for (int i = 0; i < n; i++) {
    max_group.push(item.at(i));
    tmp += item.at(i);
  }
  candidate.at(0).first = tmp;
  for (int i = n; i < 2*n; i++) {
    long long current_min = max_group.top();
    if (current_min < item.at(i)) {
      max_group.pop();
      max_group.push(item.at(i));
      tmp += item.at(i) - current_min;
    }
    candidate.at(i-n+1).first = tmp;
  }
  tmp = 0;
  for (int i = 3*n-1; 2*n <= i; i--) {
    min_group.push(item.at(i));
    tmp += item.at(i);
  }
  candidate.at(n).second = tmp;
  for (int i = 2*n-1; n <= i; i--) {
    long long current_max = min_group.top();
    if (item.at(i) < current_max) {
      min_group.pop();
      min_group.push(item.at(i));
      tmp += item.at(i) - current_max;
    }
    candidate.at(i-n).second = tmp;
  }

  long long result = LLONG_MIN;
  for (const auto& p : candidate) {
    result = std::max(result, p.first - p.second);
  }
  std::cout << result << std::endl;
  return 0;
}


Measured memory_bytes: 6516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846264338327950288
#define mt make_tuple


void love() {
	int n, k, q;
	cin>>n>>k>>q;

	int tmp;
	unordered_map<int, int> m;

	for(int i = 0; i<q; i++) {
		cin>>tmp;
		m[tmp]++;
	}

	int arr[n+1];
	for(int i = 0; i<=n; i++) arr[i] = k;

	// forward
	int diff = 0;
	for(int i = 1; i<=n; i++) {
		arr[i] -= diff;
		if(m[i]) diff += m[i];
	}

	// backward
	diff = 0;
	for(int i = n; i>0; i--) {
		arr[i] -= diff;
		if(m[i]) diff += m[i];
	}

	// final check
	for(int i = 1; i<=n; i++) {
		if(arr[i] > 0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	love();
	return 0;
}

Measured memory_bytes: 6948
/**    epsileer 01 September 2019  17:24:56  **/    
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<LL,LL> PII;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define TEST int t = 1; while(t--) solve()

void solve(){
    string s1, s2; cin>>s1>>s2;
    int ans = 0;
    if(s1[0] == s2[0]) ans++;
    if(s1[1] == s2[1]) ans++;
    if(s1[2] == s2[2]) ans++;
    cout<<ans;
}

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST;
return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
string dp[11000];
const string MINUSINF = "-";

string compare(string str1 ,string str2) {
	if (MINUSINF == str1) {
		return str2;
	}
	if (str1.size() <str2.size()) {
		return str2;
	}
	if (str1.size() > str2.size()) {
		return str1;
	}
	if (str1 < str2) {
		return str2;
	}
	else {
		return str1;
	}
}

int main() {
	int N, M;
	cin >> N >> M; 
	vector<int>A(M);
	map<int, int>mp;
	mp[1] = 2;
	mp[2] = 5;
	mp[3] = 5;
	mp[4] = 4;
	mp[5] = 5;	
	mp[6] = 6;
	mp[7] = 3;
	mp[8] = 7;
	mp[9] = 6; 
	for (int m = 0;m<M;++m) {
		cin >> A[m];
	}
	for (int i = 0; i < 11000; ++i) { 
		dp[i] = MINUSINF; 
	}
	dp[0] = "";
	for (int i = 0;i<N;++i) {
		if (dp[i] == MINUSINF) continue;
		for (int n = 0;n<A.size();++n) {
			//dp[i + mp[A[n]]] = compare(dp[i + mp[A[n]]],"tset"); 
			string strcopy = dp[i];
			strcopy += ('0' + A[n]);
			dp[i + mp[A[n]]] = compare(dp[i + mp[A[n]]], strcopy);
		}
	}
	cout << dp[N]<<endl;
	return 0;
}

Measured memory_bytes: 30064
package main

import "fmt"

var T [][]int
var C []int
var X, N int

func main() {
	var M int
	fmt.Scan(&N, &M, &X)
	T = make([][]int, N)
	C = make([]int, N)
	for i := 0; i < N; i++ {
		T[i] = make([]int, M)
		var V int
		fmt.Scan(&V)
		C[i] = V
		for j := 0; j < M; j++ {
			var V int
			fmt.Scan(&V)
			T[i][j] = V
		}
	}
	arr := make([]int, M)
	ans := rec(0, 0, arr)
	if ans == 10000000000000 {
		fmt.Println(-1)
	} else {
		fmt.Println(ans)
	}
}

func rec(i, cur int, arr []int) int {
	f := true
	for _, v := range arr {
		if v < X {
			f = false
		}
	}
	if f {
		return cur
	}
	if i == N {
		return 10000000000000
	}
	nex_arr := append([]int{}, arr...)
	for j, a := range T[i] {
		nex_arr[j] += a
	}
	nex_cur := cur + C[i]
	return min(rec(i+1, nex_cur, nex_arr), rec(i+1, cur, arr))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


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

int main(){
	string s1,s2;
	cin>>s1>>s2;
	
	for(int i=0;i<s1.size();i++)
	if(s1[i]!=s2[i]){
		cout<<"No";
		return 0;
	}
	
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

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

        if ((a & b & 1) == 0) {
            System.out.println("Even");
            return;
        }
        System.out.println("Odd");
    }
}

Measured memory_bytes: 23508
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, c = M()
k = I()
for _ in range(k):
    if a >= b:
        b = 2*b
    else:
        c = 2*c
if a < b < c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 68356
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int len;
	set<char> S;
	string s;
	
	cin >> s;
	
	len = s.length();
	
	for(int i=0; i<len; i++){
		S.insert(s[i]);
	}
	
	for(int i=0; i<=25; i++){
		if(S.count('a'+i) == 0){
			cout << char('a'+i);
			return 0;
		}
	}
	
	cout << "None";
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,A[100]={},count=0,flag=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int i=0;
    while(flag){
        flag=0;
        for(int j=n-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                int tmp=A[j-1];
                A[j-1]=A[j];
                A[j]=tmp;
                count+=1;
                flag=1;
            }
        }
        i+=1;
    }
    for(int i=0;i<n;i++){
        if(i>0) cout<<" ";
        cout<<A[i];
    }cout<<endl;
    cout<<count<<endl;
    return 0;
    
}




Measured memory_bytes: 3104
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        final int N = sc.nextInt();
        long ans = 1;
        
        for (int i = 1; i <= N; i++) {
            ans *= i;
            ans %= 1000000007;
        }
        
        out.println(ans);
        
        out.flush();
    }
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

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

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

int main() {
	string s, t;
	cin >> s;
	cin >> t;
	int min, count;
	min = 1000000;
	count = 0;
	int c = (int)(s.length()-t.length()) + 1;
	for(int i=0; i<c; i++){
		count = 0;
		for(int j=0;j<(int)(t.length());j++){
			if(s[i + j]!=t[j]){
				count++;
			}
		}
		if(count < min) min = count;
	}
	cout << min << endl;
	return 0;
  
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define N 1000
int c[N+1];
int a[N+1];
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> c[i];
		a[i] = 0;
	}
	int q;
	cin >> q;
	while(q--) {
		int t, x, d;
		cin >> t >> x >> d;
		if(t == 1) {
			a[x] += d;
			if(a[x] > c[x]) {
				cout << x << endl;
				return 0;
			}
		} else {
			a[x] -= d;
			if(a[x] < 0) {
				cout << x << endl;
				return 0;
			}
		}
	}
	cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cmath>
#include<fstream>

int main(){
	int N;
	double res=0;

	std::cin >> N;

	for(int i=0;i<N;i++){
		double x;
		std::string u;

		std::cin >> x;
		std::cin >> u;

		if(u=="JPY") res+=x;
		else res+=(x*380000.0);
	}

	std::cout << res << std::endl;

	return 0;
}


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

bool isRightTriangle(const int &a, const int &b, const int &c)
{
    int sum = a * a + b * b + c * c;
    int max = std::max(a, std::max(b, c));
    return (sum - (max * max) == max * max);


}

int main()
{
    int N, a, b, c;
    std::scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        std::scanf("%d %d %d", &a, &b, &c);
        (isRightTriangle(a, b, c)) ? std::cout << "YES" << std::endl : std::cout << "NO" << std::endl;
    }
    return 0;
}



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

int main(){
  int N,D;cin>>N>>D;
  vector<vector<int>> X(N);
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      int tmp;cin>>tmp;
      X[i].push_back(tmp);
    }
  }
  int cnt=0;
  for(int i=1;i<N;i++){
  for(int j=0;j<i;j++){
    int h=0;
    for(int k=0;k<D;k++){
      h+=pow(X[i][k]-X[j][k],2);
    }
    double ans=sqrt((double)h);
    if(ceil(ans)==floor(ans)){
      ++cnt;
    }
  }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <numeric>
#include <cassert>
#include<map>
#include<bitset>

using lli = long long int;
lli inf = 1000000007;
using namespace std;

void solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)cin >> A[i];

	sort(A.begin(), A.end());
	bool ok = true;
	for (int i = 1; i < N; i++) {
		if (A[i] == A[i - 1])ok = false;
	}
	cout << (ok ? "YES" : "NO") << endl;
}

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

Measured memory_bytes: 1024
'use strict'

function main(s) {

  // 入力処理
  const input = s.split('\n').slice(1, -1);

  // 判定用
  let prev_t = 0;
  let prev_x = 0;
  let prev_y = 0;
  let result = 'Yes';

  input.forEach(t => {

    const next = t.split(' ').map(m => Number(m));
    let next_t = next[0];
    let next_x = next[1];
    let next_y = next[2];

    // 移動可能ホップ数
    let canHop = next_t - prev_t;

    // 実際のホップ数
    let hopped = Math.abs(prev_x - next_x) + Math.abs(prev_y - next_y);

    // 移動可能かどうか
    if(canHop < hopped || (((next_t + 2) % 2) !== ((next_x + next_y + 2) % 2))) {
      result = 'No';
    }

    // 更新
    prev_t = next_t;
    prev_x = next_x;
    prev_y = next_y;
  })

  console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30112
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define maxn 1000

using namespace std;

string s[maxn+5];
vi g[maxn+5];
int d[maxn+5][maxn+5];
queue<pii> qu;
bool inq[maxn+5][maxn+5];
const int mod = 1000000007;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, m; cin >> n >> m;
  int i, j, z;
  for (i = 0; i < n; i++) cin >> s[i];
  d[0][0] = 1; qu.push({0, 0}); inq[0][0] = 1;
  while (!qu.empty()) {
    pii cur = qu.front(); qu.pop();
    i = cur.fi; j = cur.se; inq[i][j] = 0;
    if (i < n && s[i+1][j] == '.') {
      d[i+1][j] = (d[i+1][j] + d[i][j]) % mod;
      if (!inq[i+1][j]) qu.push({i+1,j}), inq[i+1][j] = 1;
    }
    if (j < m && s[i][j+1] == '.') { ///:(
      d[i][j+1] = (d[i][j+1] + d[i][j]) % mod;
      if (!inq[i][j+1]) qu.push({i,j+1}), inq[i][j+1] = 1;
    }
  }
  cout << d[n-1][m-1];
  return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
const int maxn=2e5+5;
string a,b;
ll len1,len2,ans;
int f(int x)
{
    int res=0;
    for(int i=0;i<=len2-1;i++)
    {
        if(a[x+i]!=b[i])
            res++;
    }
    return res;
}
signed main()
{
    //IOS;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>a>>b;
    len1=a.length(),len2=b.length(),ans=INF;
    for(int i=0; i<=len1-len2; i++)
    {
        ans=min(ans,f(i));
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/


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

int main() {
  int N;
  cin >> N;
  vector<int> mochi(N);
  for (int i=0; i<N; i++) {
    cin >> mochi.at(i); }
  sort(mochi.begin(), mochi.end());
  int count = 1;
  for (int i=1; i<N; i++) {
    if (!(mochi.at(i) == mochi.at(i-1))) {
      count++; }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N=5005,M=14,K=205;
using namespace std;
typedef long long ll;
ll n,MS,a[N],b[N];
ll dp[K][M][N];//color, range,start
ll ans[N];
int Q(int l,int r,int col){
    int sz=log2(r-l+1);
    int v1=dp[col][sz][l];
    int v2=dp[col][sz][r+1-(1<<sz)];
    return max(v1,v2);
}
void gen(int l,int r,int optl,int optr){
    if(l>r)return;
    int m=(l+r)/2;
    pair<ll,ll>bes={LLONG_MIN,LLONG_MIN};
    for(int i=optl;i<=min(m,optr);i++){
        ll val=0;
        for(int c=1;c<=MS;c++)val+=Q(i,m,c);
        val-=(b[m]-b[i]);
        pair<ll,ll>cur={val,i};
        bes=max(cur,bes);
    }
    //cout<<m<<' '<<bes.first<<' '<<bes.second<<'\n';
    ans[m]=bes.first;
    int opt=bes.second;
    gen(l,m-1,optl,opt);
    gen(m+1,r,opt,optr);
}
int main()
{ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n>>MS;
    for(int i=2;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)b[i]=a[i]+b[i-1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=MS;j++)cin>>dp[j][0][i];
    }
    for(int col=1;col<=MS;col++){
        for(int i=1;i<M;i++){
            for(int j=1;j+(1<<(i-1))<=n;j++){
                dp[col][i][j]=max(dp[col][i-1][j],dp[col][i-1][j+(1<<(i-1))]);
            }
        }
    }
    gen(1,n,1,n);
    ll res=LLONG_MIN;
    for(int i=1;i<=n;i++)res=max(res,ans[i]);
    cout<<res<<'\n';
    return 0;
}


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

using namespace std;

const int MAXH = 20;
bool isWall[MAXH][MAXH];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
bool visited[MAXH][MAXH];

int solve(int r, int c, int h, int w)
{
    for (int i = 0; i < MAXH; i++)
        fill(visited[i], visited[i] + MAXH, false);
    queue<tuple<int, int, int>> q;
    q.push(make_tuple(r, c, 0));
    visited[r][c] = true;
    int ans = 0;
    while (!q.empty())
    {
        tuple<int, int, int> t = q.front();
        q.pop();
        r = get<0>(t);
        c = get<1>(t);
        int d = get<2>(t);
        ans = d;
        for (int i = 0; i < 4; i++)
        {
            int newr = r + dx[i];
            int newc = c + dy[i];
            if (!isWall[newr][newc] && !visited[newr][newc] && newr >= 0 && newr < h && newc >= 0 && newc < w)
            {
                visited[newr][newc] = true;
                q.push(make_tuple(newr, newc, d + 1));
            }
        }
    }
    return ans;
}

int main()
{
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        string s;
        cin >> s;
        for (int j = 0; j < w; j++)
            isWall[i][j] = s[j] == '#';
    }
    int ans = 0;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (!isWall[i][j])
                ans = max(ans, solve(i, j, h, w));
    cout << ans << endl;
    return 0;
}


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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

ll bigmod(ll a, ll b, ll mod){
  a %= mod;
  ll ret = 1;
  while(b){
    if(b&1) ret = ret*a%mod;
    a = a*a%mod;
    b >>= 1;
  }
  return ret;
}

ll ans(ll n){
  ll ret = 0;
  while(n){
    ret++;
    n %= __builtin_popcount(n);
  }
  return ret;
}

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int n;  cin >> n;
  string s; cin >> s;
  int one = count(s.begin(), s.end(), '1');
  if(one==0){
    for (int i = 0; i < n; ++i){
      cout << "1\n";
    }
  } else if(one==1){
    for (int i = 0; i < n; ++i){
      if(s[i]=='1'){
        cout << "0\n";
      } else {
        if(i==n-1){
          cout << "2\n";
        } else {
          cout << "1\n";
        }
      }
    }
  } else {
    ll r0=0, r2=0;
    for (int i = 0; i < n; ++i){
      if(s[i]=='1'){
        ll tmp = bigmod(2, n-1-i, one+1);
        r2 = (r2+tmp)%(one+1);

        tmp = bigmod(2, n-1-i, one-1);
        r0 = (r0+tmp)%(one-1);
      }
    }
    for (int i = 0; i < n; ++i){
      if(s[i]=='0'){
        ll x = bigmod(2, n-1-i, one+1);
        x = (x+r2)%(one+1);
        cout << ans(x)+1 << "\n";
      } else {
        ll mn = bigmod(2, n-1-i, one-1);
        ll x = ((r0-mn)%(one-1)+(one-1))%(one-1);
        cout << ans(x)+1 << "\n";
      }
    }

  }
  return 0;
}

Measured memory_bytes: 3768