akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
    class Program
    {
        static void MainA(string[] args)
        {
            Console.WriteLine(Console.ReadLine().ToCharArray().Zip(Console.ReadLine().ToCharArray(), (x, y) => x == y).Count(x => x));
        }

        static void MainB()
        {
            var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var ans = (arr[1] - 1 + arr[0] - 2) / (arr[0] - 1);
            Console.WriteLine(ans);
        }

        static void MainC()
        {
            Console.ReadLine();
            var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int cnt = 0;
            int cntmax = 0;
            for (int i = 0; i < arr.Length - cntmax - 1; i++)
            {
                cnt = 0;
                for (int j = i + 1; j < arr.Length; j++)
                {
                    if (arr[j - 1] >= arr[j])
                        cnt++;
                    else
                    {

                        break;
                    }
                }
                if (cnt > cntmax)
                    cntmax = cnt;
            }
            Console.WriteLine(cntmax);
        }

        static void Main()
        {
            long n = int.Parse(Console.ReadLine()) - 1;
            Console.WriteLine((n * n + n) / 2);
        }
    }

}

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

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x/GCD(x,y)*y;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{

int N;
cin >> N;

vector<long double> x(N);
vector<string> u(N);

rep(i,N) {cin >> x[i] >> u[i];}

long double S=0;

rep(i,N){
if(u[i]=="JPY"){S+=x[i];}
else if(u[i]=="BTC"){S+=380000*x[i];}
}

cout << fixed << setprecision(15) << S << endl;

}

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

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int n, m;
	cin >> n >> m;
	if (n == m) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define MEM(a,b) memset(a,b,sizeof(a))

using namespace std;

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

int a[364364];
int main() {
	int n;
	cin >> n;
	REP(i, n) {
		int x;
		cin >> x;
		a[i] = x - (i + 1);
	}
	sort(a, a + n);
	ll unko;
	if (n % 2 == 0) {
		ll tmp0 = 0, tmp1 = 0;
		REP(i, n) {
			tmp0 += abs(a[i] - a[(n / 2) - 1]);
		}
		REP(i, n) {
			tmp1 += abs(a[i] - a[(n / 2)]);
		}
		unko = min(tmp0, tmp1);
	}
	else {
		unko = 0;
		REP(i, n) {
			unko += abs(a[i] - a[(n - 1)/ 2]);
		}
	}
	cout << unko << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int at(int i, int j){
    return 1 & (i >> j);
}

int H, W, K;
int dp[200][15];

long amida(int now, int now_x){
    if(now == H){
        return now_x == K - 1;
    }else if(dp[now][now_x] != -1){
        return dp[now][now_x];
    }
    long ans = 0;
    for(int i = 0; i < (1 << W); i += 2){
        for(int j = 1; j < W - 1; j++){
            if(at(i, j) && at(i, j + 1)){
                goto fin;
            }
        }
        if(at(i, now_x)){
            ans += amida(now + 1, now_x - 1);
        }else if(at(i, now_x + 1)){
            ans += amida(now + 1, now_x + 1);
        }else{
            ans += amida(now + 1, now_x);
        }
    fin: ;
    }
    return dp[now][now_x] = ans % mod;
}

int main(){
    cin >> H >> W >> K;
    memset(dp, -1, sizeof(dp));
    cout << amida(0, 0) << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
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 ( 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 ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
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" ) } ; }

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => {
        if $x < $y {
            $x = $y;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: u64
    }

    let mut cnt = 0;
    let mut ret = 0;
    for i in 1..n+1 {
        if chmax!(cnt, count(i)) {
            ret = i;
        }
    }
    println!("{}", ret);
}

fn count(mut n: u64) -> u64 {
    let mut cnt = 0;
    while n > 0 {
        n /= 2;
        cnt += 1;
    }
    cnt
}


Measured memory_bytes: 4352
a,b,c,x,y = list(map(int, input().split()))

# xの方が多い状態にする
if x<y:
    a,b,x,y = b,a,y,x

min_price = 1000000000000
# +1を忘れるとWA
for i in range(x+1):
    # 残り枚数がマイナスにならないようにmaxを取る
    need = max(0,(x-i))*a + max(0,(y-i))*b + 2*i*c
    min_price = min(min_price, need)    
print(min_price)



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

int main(){
  int N; cin >> N;
  vector<int> a(N);
  int sum = 0;
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  int mean = sum / N;
  int cost1 = 0, cost2 = 0;
  
  for(int i = 0; i < N; i++){
    cost1 += (a.at(i) - mean) * (a.at(i) - mean);
    cost2 += (a.at(i) - (mean + 1)) * (a.at(i) - (mean + 1));
  }
  
  
  cout << min(cost1, cost2) << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1000000007;//1e9 + 7;





int main(){
    int a,b,c;
    cin>>a>>b;
    bool bo[3]={};
    bo[a-1]=1;
    bo[b-1]=1;
    if(!bo[0])cout<<1<<endl;
    if(!bo[1])cout<<2<<endl;
    if(!bo[2])cout<<3<<endl;

}

Measured memory_bytes: 256
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=rd())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int rd(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	c^'-'?(k=1,x=c&15):k=x=0;
	while(isdigit(Gc(c)))x=x*10+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
int s,w;
signed main(){
	Rd(s),Rd(w);
	printf(s>w?"safe":"unsafe");
	exit(0);
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define rd(x) cin >> x;
#define rda(a,n) for(int i=1;i<=n;i++) cin >> a[i];
#define wr(x) cout << x << ' ';
#define wrl(x) cout << x << '\n';
#define wra(a,n) for(int i=1;i<=n;i++) cout << a[i] << ' '; cout << '\n';
#define lg length()
#define pb push_back
ifstream in("ciclueuler.in");
ofstream out("ciclueuler.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,t[100005],p[100005],a,b,x,f[100005],m[100005],mod=1e9+7;

long long pwr(long long a, long long p){
    if(p==1) return a;
    long long x=pwr(a,p/2);
    if(p%2) return (((x*x)%mod)*a)%mod;
    else return (x*x)%mod;
}

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    f[0]=1; m[0]=1;
    for(int i=1;i<=n+1;i++){
        f[i]=(f[i-1]*i)%mod;
        m[i]=pwr(f[i],mod-2);
    }
    for(int i=1;i<=n+1;i++){
        cin >> t[i];
        p[t[i]]++;
        if(p[t[i]]==2) x=t[i],b=n-i+1;
    }
    for(int i=1;i<=n+1;i++){
        if(t[i]==x){
            a=i-1;
            break;
        }
    }
    for(int i=1;i<=n+1;i++){
        long long ans=(((f[n+1]*m[i])%mod)*m[n+1-i])%mod;
        if(i-1<=a+b) ans-=(((f[a+b]*m[i-1])%mod)*m[a+b-i+1])%mod;
        while(ans<0) ans+=mod;
        cout << ans << '\n';
    }

}


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  int n,l;
  cin>>n>>l;
  vector<string>s(n);
  rep(i,n)cin>>s[i];
  sort(all(s));
  rep(i,n)cout<<s[i];
  cout << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>

using namespace std;

int main() {
  int n;
  int p = 0;
  cin >> n;
  vector<int> map(n,0);
  for (int i = 0; i < n; ++i) {
    cin >> map[i];
    --map[i];
    if (map[i] < i && map[map[i]]==i) {
      ++p;
    }
  }
  cout << p << endl;
  return 0;
}


Measured memory_bytes: 768
from string import ascii_lowercase, ascii_uppercase
s = open(0).read()
ans = [0]*26
for c in s:
    i = ascii_lowercase.find(c)
    if i > -1:
        ans[i] += 1
    i = ascii_uppercase.find(c)
    if i > -1:
        ans[i] += 1
for c, t in zip(ascii_lowercase, ans):
    print("%s : %d" % (c, t))


Measured memory_bytes: 6688
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


class UnionFind {
	vector<int> par;
	vector<int> rank;
public:
	UnionFind(int max_n) :par(max_n), rank(max_n) {}
	void init(int n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};




int n;
int a[100000];
int b[100000];

bool solve() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];

	vector<int> va(a, a + n), vb(b, b + n);

	sort(a,a+n);
	sort(b,b+n);

	rep(i,n) {
		if (a[i] > b[i]) {
			return false;
		}
	}

	rep(i,n) {
		int cnt = upper_bound(a, a + n, b[i]) - a;
		if (cnt != i+1) {
			return true;
		}
	}
	
	unordered_map<int, int> idxs;
	idxs.reserve(n);
	vector<int> pos(n);
	rep(i, n)idxs[va[i]] = i;
	rep(i, n) {
		int idx = upper_bound(a, a + n, vb[i]) - a - 1;
		pos[i] = idxs[a[idx]];
	}


	UnionFind uf(n);
	uf.init(n);

	rep(i, n) {
		uf.unite(i, pos[i]);
	}
	unordered_set<int> p;
	rep(i, n)p.insert(uf.find(i));

	return p.size() > 1;
}


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

	cout << (solve() ? "Yes" : "No") << endl;



	return 0;
}

Measured memory_bytes: 6912
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;



int MOD=1000000007;
int main(void){
	int X,Y,ans=0;
	cin >> X >> Y;
	if(X==3) ans+=100000;
	if(X==2) ans+=200000;
	if(X==1) ans+=300000;
	if(Y==3) ans+=100000;
	if(Y==2) ans+=200000;
	if(Y==1) ans+=300000;
	if(X==1 && Y==1) ans+=400000;
	cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 50;
const long long mod_const = 1e9 + 7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

using pll = pair<long long, long long>;

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

	ll N, T;
	cin >> N >> T;

	vector<int> vA(N, 0);
	vector<int> vB(N, 0);
	vector<pll> vp(N);
	rep(i, N) {
		cin >> vA[i] >> vB[i];
		vp[i].first = vA[i];
		vp[i].second = vB[i];
	}
	sort(vp.begin(), vp.end());

	vector<vector<ll> > dp(N + 1, vector<ll>(T+1, -1));
	dp[0][0] = 0;

	for (int i = 0; i != N - 1; ++i) {
		for (int t = 0; t != T; ++t) {
			if (t - vp[i].first >= 0) {
				if (dp[i][t - vp[i].first] != -1) {
					dp[i + 1][t] = max(dp[i + 1][t], dp[i][t - vp[i].first] + vp[i].second);
				}
			}

			if (t + vp[i].first >= T) {
				if (dp[i][t] != -1) {
					dp[i + 1][T] = max({ dp[i + 1][T], dp[i][T], dp[i][t] + vp[i].second });
				}
			}

			if (dp[i][t] != -1) {
				dp[i + 1][t] = max(dp[i + 1][t], dp[i][t]);
			}
		}
		dp[i + 1][T] = max(dp[i + 1][T], dp[i][T]);
	}

	ll ans = 0;
	for (int t = 0; t != T; ++t) {
		if (dp[N - 1][t] != -1) {
			ans = max(ans, dp[N - 1][t] + vp[N - 1].second);
		}
	}

	for (int i = 0; i != N; ++i) {
		ans = max(ans, dp[i][T]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 70784
n,d=input().split()
n=int(n)
d=int(d)
r=0
d=d**2
for i in range(n):
  x,y=input().split()
  x=int(x)
  y=int(y)
  t=x**2+y**2
  if d>=t:
    r=r+1
    
print(r)

Measured memory_bytes: 9200
n = STDIN.gets.chomp
a = STDIN.gets.chomp.split(' ').map {|num| num.to_i}


def insertion_sort a, n
  puts a.join ' '
  i = 1
  while i <= (n - 1) do
    v = a[i]
    j = i - 1
    while (j >= 0) and (a[j] > v) do
      a[j + 1] = a[j]
      j -= 1
    end
    a[j + 1] = v
    puts a.join ' '
    i += 1
  end
end

insertion_sort a, n.to_i

Measured memory_bytes: 8776
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100;

int n,have;
int want[MAXN];
ll sum[MAXN+1];

void run() {
	scanf("%d%d",&n,&have); REP(i,n) scanf("%d",&want[i]);
	sort(want,want+n);
	sum[0]=0; REP(i,n) sum[i+1]=sum[i]+want[i];
	int ret=0; REP(i,n) if(have>=sum[i]) ret=max(ret,i); if(have==sum[n]) ret=max(ret,n); printf("%d\n",ret);
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() {

	int n, k;
	cin >> k >> n;
	int a[n] = { 0 };
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int diff = 0, ma = 0;
	for (int i = 0; i < n; ++i) {
		if (i != n - 1)
			diff = a[i + 1] - a[i];
		else
			diff = k - a[i] + a[0];
		if (diff > ma)
			ma = diff;
	}
	cout << k - ma << "\n";
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


sys.setrecursionlimit(1000000)


def solve(N: int, M: int, X: "List[int]", Y: "List[int]", Z: "List[int]"):
    par = list(range(N))

    def getpar(n: int):
        if par[n] == n:
            return n
        par[n] = getpar(par[n])
        return par[n]

    def union(a: int, b: int):
        par[getpar(b)] = getpar(a)

    for Xi, Yi in zip(X, Y):
        Xi -= 1
        Yi -= 1
        union(Xi, Yi)

    print(len({getpar(i) for i in range(N)}))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    Z = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
        Z[i] = int(next(tokens))
    solve(N, M, X, Y, Z)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24520
#include<bits/stdc++.h>
using namespace std;
int main() {
  int h,w,i,j;
  cin>>h>>w;
  vector<vector<char>> a(h,vector<char>(w));
  vector<int> r(h),c(w);
  for (i=0;i<h;i++) for (j=0;j<w;j++) cin>>a.at(i).at(j);
  for (i=0;i<h;i++) {
    for (j=0;j<w;j++) if (a.at(i).at(j)=='#') break;
    if (j==w) r.at(i)=1;
  }
  for (j=0;j<w;j++) {
    for (i=0;i<h;i++) if (a.at(i).at(j)=='#') break;
    if (i==h) c.at(j)=1;
  }
  for (i=0;i<h;i++) {
    if (r.at(i)==0) {
      for (j=0;j<w;j++) if (c.at(j)==0) cout<<a.at(i).at(j);
      cout<<endl;
    }
  }
} 

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

const int N = 3e3 + 5;

typedef long double ld;

//dp[toss_number][heads]

int n;
ld dp[N][N], p[N];

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> p[i];
  dp[1][0] = 1.0 - p[1];
  dp[1][1] = p[1];
  for(int i = 2; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      dp[i][j] = dp[i-1][j]*(1.0 - p[i]) + 
        (j-1 >= 0 ? dp[i-1][j-1]*p[i] : 0.0);
    }
  }
  ld ans = 0;
  for(int j = 0; j <= n; j++) if(j > n-j) ans += dp[n][j];
  cout << fixed << setprecision(10) << ans << "\n";
}


Measured memory_bytes: 141056
#include <stdio.h>

int main(void){
    int i,s,n,max,min,sum;
    while(scanf("%d",&n),n){
        max=0;
        min=1000;
        sum=0;
        for(i=0;i<n;i++){
            scanf("%d", &s);
            sum+=s;
            if(s>max)max=s;
            if(s<min)min=s;
        }
        printf("%d\n", (sum-max-min)/(n-2));
    }
    return 0;
}

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

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

    vector<bool> a(26);

    
    for(int i = 0; i < s.size(); i++){
        a[s[i] - 'a'] = true;
    }
    
    int flag = 0;
    for(int i = 0; i < 26; i++){
        if(!a[i]){
            flag = 1;
            char c = i + 'a';
            cout << c;
            break;
        }
    }
    if(!flag) cout << "None";
}


Measured memory_bytes: 512
using System;

    class Program
    {
        static void Main(string[] args)
        {
            //input
            int a = int.Parse(Console.ReadLine());

            // 500
            var happy1 = (a / 500) * 1000;
            var amari = a - (a / 500) * 500;
            // 5
            var happy2 = (amari / 5) * 5;
            Console.WriteLine((happy1 + happy2).ToString());
        }
    }

Measured memory_bytes: 11092
import java.util.Scanner;

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

		long sum = 0;
		long p = 0;
		for(int i=0;i<S.length();i++){
			String x = S.substring(i, i+1);
//			System.out.println(x);
			if(x.equals("W")){
				sum += p;
			}else{
				p+= 1;
			}
		}
		System.out.println(sum);
	}

}



Measured memory_bytes: 40076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,ans;
  char op;
  
  ans = 0;
  
  cin >> A >> op >> B;
  
  switch(op){
    case '+':
        ans = A + B;
        break;
    case '-':
        ans = A - B;
        break;
    default:
        break;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3544
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLine >>= print . solve

solve :: [Int] -> Int
solve (x : y : _) = (x * y) `div` 2

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll N;
	cin >> N;

	ll ans = 0;
	for(ll i=1;i<=N;i++) {
		if (i % 3 != 0 && i % 5 != 0)
			ans += i;
	}

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

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    if(n==4||n==8||n==12||n==7||n==15||n==16||n>17||n==11){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  string s;
  cin >> n >> s;
  int w=0, e=0;
  for (int i=0; i<n; ++i) {
    (s[i] == 'E' ? e : w) += 1;
  }
  int nw=0, ne=0;
  int best = n;
  for (int i=0; i<n; ++i) {
    (s[i] == 'E' ? e : w) -= 1;
    best = min(best, nw+e);
    (s[i] == 'E' ? ne : nw) += 1;
  }
  cout << best << endl;
  return 0;
}


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

int main() {
    int k,a,b;cin>>k>>a>>b;
    int result=0;
    for(int i=a;i<=b;i++){
        if(i%k==0) result=1;
    }
    if(result==1) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>

using namespace std;

#define ll long long
#define rep(i, n) for (i = 0; i < n; i++)

int gcd(int a, int b)
{
  if (a < b)
  {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  return b ? gcd(b, a % b) : a;
}

int main()
{
  int K;
  cin >> K;
  ll ans = 0;
  for (int i = 1; i <= K; i++)
  {
    for (int j = 1; j <= K; j++)
    {
      for (int k = 1; k <= K; k++)
      {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int h[100005];
int dp[100005];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d", &h[i]);
        dp[i] = 2e9;
        if(i == 1) dp[i] = 0;
        if(i > 1) dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
        if(i > 2) dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]));
    }   
    printf("%d\n", dp[n]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int k,t; cin>>k>>t;
	VI a(t); rep(i,t) cin>>a[i]; sort(RALL(a));
	cout << max(a[0]-1-(k-a[0]),0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ll k,q;
  cin>>k>>q;
  vecll d(k);
  for(auto&& e:d) cin>>e;
  for(auto&& i:irange(0l,q)) {
    ll n,x,m;
    cin>>n>>x>>m;
    --n;
    ll sum = 0;
    for(auto&& e:d) {
      sum += (e+m-1) % m + 1;
    }
    sum *= n / k;
    sum += x % m;
    ll rem = n % k;
    for(auto&& j:irange(0l,rem)) {
      sum += (d[j]+m-1) % m + 1;
    }
    cout<<n-sum/m<<'\n';
  }
  cout<<flush;
  return 0;
}


Measured memory_bytes: 384
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, m = map(int, rl().split())
li = [[] for _ in range(m+1)]
for _ in range(m):
  a, b = map(int, rl().split())
  a -= 1
  b -= 1
  li[a].append(b)
  li[b].append(a)

marks = [-1]*n
stack = [0]
while stack:
    for next_room in li[stack[0]]:
        if marks[next_room] == -1:
            stack.append(next_room)
            marks[next_room] = stack[0]
    del stack[0]
if -1 in marks:
  print('No')
else:
  print('Yes')
  for i in marks[1:]:
    print(i+1)


Measured memory_bytes: 59444
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int r;
  scan(r);
  print(3*r*r);
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  for (int i = 0; i < N; i++) {
    cin >> card.at(i);
  }
  sort(card.begin(), card.end());
  
  int count = 1;
  for (int i = 1; i < N; i++) {
    if ( card.at(i-1) != card.at(i) ) count++;
  }  
  cout << count << endl;
}

Measured memory_bytes: 256
w=input()
count=0

if w=="SSS":
 print(0)
if w=="SSR":
 print(1)
if w=="SRR":
 print(2)
if w=="RRS":
 print(2)
if w=="RSR":
 print(1)
if w=="SRS":
 print(1)
if w=="RSS":
 print(1)
if w=="RRR":
 print(3)

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

struct A {
  int a, i;
  bool operator<(const A &that) const {
    #define lt(x) if (x != that.x) return x < that.x;
    #define gt(x) if (x != that.x) return x > that.x;
    lt(a) lt(i)
    #undef gt
    #undef lt
    return false;
  }
  bool operator>(const A &that) const {
    return that < *this;
  }
};

void solve() {
  int n;
  cin >> n;
  vstr s(n);
  vi32 p(n);
  rep(i, n) {
    cin >> s[i] >> p[i];
  }
  vi32 o(n);
  iota(all(o), 0);
  sort(all(o), [&](int i, int j) {
    if (s[i] != s[j]) return s[i] < s[j];
    if (p[i] != p[j]) return p[i] > p[j];
    return false;
  });
  rep(i, n) {
    cout << o[i] + 1 << endl;
  }
}

Measured memory_bytes: 256
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

string S;
string T;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> S;
    cin >> T;
    solve();
}

// S,T は 1 文字以上 1000 文字以下
// T の長さは S の長さ以下
// S,T は 英小文字のみを含む

// string S, string T
// S を書き換える文字数の最小値を出力せよ。
void solve(){
    ll n=S.size(),m=T.size();
    ll ans=INF;
    rep(i,n-m+1){
        ll tmp=0;
        rep(j,m)tmp+=S[i+j]!=T[j];
        chmin(ans,tmp);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
typedef long long LL;
using namespace std;
#define MP make_pair
int n, m, k;
char s[1005][1005];
int vis[1005][1005];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
    scanf("%d%d%d", &n, &m, &k);
    int x, y;
    memset(vis, -1, sizeof(vis));
    for (int i = 0; i < n; ++i) {
        scanf("%s", s[i]);
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == 'S') {
                x = i;
                y = j;
                s[i][j] = '.';
            }
        }
    }
    queue<pair<int, int>> q;
    q.push(MP(x, y));
    vis[x][y] = 0;
    while (!q.empty()) {
        auto w = q.front();
        // cout << w.first <<" "<<w.second<<endl;
        q.pop();
        if(w.first == 0 || w.second == 0 || w.first + 1 == n || w.second + 1 == m){
            printf("1\n");
            return 0;
        }
        if (vis[w.first][w.second] == k)
            continue;
        for (int i = 0; i < 4; ++i) {
            int nx = w.first + dx[i];
            int ny = w.second + dy[i];
            if (nx < 0 || ny < 0 || nx >= n || ny >= m || s[nx][ny] == '#' || vis[nx][ny] != -1)
                continue;
            q.push(MP(nx,ny));
            vis[nx][ny] = vis[w.first][w.second] + 1;
        }
    }
    int ans = 999999;
    // cout << "???"<<endl;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (vis[i][j] == -1)
                continue;
            int dis = min(i, j);
            dis = min(dis, n - i - 1);
            dis = min(dis, m - j - 1);
            dis = dis / k + (dis % k != 0);
            ans = min(ans, 1 + dis);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

const int V=100010;
int n;
vector<vector<int>> g(2*V+10);
vector<bool> used(2*V+10,false);
P cnt;

void dfs(int v){
	if(used[v]) return ;
	used[v]=true;
	if(v>=V) cnt.se++;
	else cnt.fi++;
	for(auto itr:g[v]){
		dfs(itr);
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n;
	vector<int> a(n),b(n);
	rep(i,n){
		int x,y;
		cin>>x>>y;
		y+=V;
		a[i]=x,b[i]=y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	ll ans=0;
	rep(i,n){
		cnt.fi=cnt.se=0;
		dfs(a[i]);
		ans+=cnt.fi*cnt.se;
	}
	cout<<ans-n<<endl;
}

Measured memory_bytes: 12032
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
int main(){
int n;
cin>>n;
vector<ll> a(n),ans;
for(int i=0;i<n;i++){
    cin>>a.at(i);
}
ll tmp=a.at(0);
for(int i=1;i<n;i++){
    if(i%2==1)tmp-=a.at(i);
    else tmp+=a.at(i);
}
ans.push_back(tmp);
tmp/=2;
for(int i=0;i<n;i++){
    tmp=a.at(i)-tmp;
    ans.push_back(tmp*2);
}
for(int i=0;i<ans.size()-1;i++){
    cout<<ans.at(i)<<" ";
    if(i==(int)ans.size()-2)cout<<endl;
}
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vector<LP> ta(n);
    cin>>ta;

    ll ct = ta[0].fi, ca = ta[0].se;
    rep(i, n - 1) {
        ll r = max((ct + ta[i + 1].fi - 1) / ta[i + 1].fi, (ca + ta[i + 1].se - 1) / ta[i + 1].se);
        ct = r * ta[i + 1].fi;
        ca = r * ta[i + 1].se;
    }
    cout<<ct + ca<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define REP(i,a,b)	for(i=a;i<=b;i++)
#define REPr(i,b,a) for(i=b;i>=a;i--)
#define pi 3.14159265358979323846
using namespace std;

int main(){
	int n;	cin>>n;
	int arr[n+1];
	int i;
	int ans=0;
	REP(i,1,n){
		cin>>arr[i];
		if(i&1 && arr[i]&1)	ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3628