akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	m, _ := strconv.Atoi(sc.Text())

	if n >= m {
		fmt.Println(0)
		return
	}

	l := make([]int, m)
	for i := 0; i < m; i++ {
		sc.Scan()
		x, _ := strconv.Atoi(sc.Text())
		l[i] = x
	}

	sort.Ints(l)
	d := make([]int, m-1)
	for i := 0; i < m-1; i++ {
		d[i] = l[i+1] - l[i]
	}
	sort.Ints(d)

	ans := l[m-1] - l[0]
	for i := len(d) - 1; i > len(d)-n; i-- {
		ans -= d[i]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            //res.push_back(i);
            if(i!=x/i){
                if(x/i>i+1) res.push_back(x/i);
            }
        }
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=0;
    vector<ll> ret=divisor(n);
    //cout_vec(ret);
    rep(i,len(ret)){
      ans+=ret[i]-1;
    }
    cout<<ans<<endl;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int a,b; cin >> a >> b;
  int x = 0;
  for(x = 0; x < 1001001001; ++x){
    if((int)((double)x*0.08) == a && (int)((double)x*0.1) == b)break;
    if(x > 100100100){x = -1;break;}
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int H, W;
	int i, j;

	

	while (1)
	{
		cin >> H >> W;
		if (H == 0 && W == 0) break;
		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				if (0 < j && j < W - 1 && 0 < i && i < H - 1) {
					cout << '.';
					continue;
				}
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}

	

	return (0);
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define v(x)        vector<x>
#define int         long long
#define ar(x,y)       array<x,y>
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}
struct dsu{
  map<int,int> pr,sz;
  dsu(){
    (this->pr).clear();
    (this->sz).clear();
  }
  void make(int x){
    pr[x] = x;
    sz[x] = 1;
  }
  int getpar(int x){
    if(pr[x] == x)return x;
    return pr[x] = getpar(pr[x]);
  }
  void merge(int x,int y){
    x = getpar(x);
    y = getpar(y);
    if(sz[x]<sz[y])swap(x,y);
    pr[y] = x;
    sz[x]+=sz[y];
    sz[y] = 0;
  }
};


void solve(){
  int n;
  cin>>n;
  v(int)a(n);
  map<int,int> mp;
  int sum = 0;
  for(int i = 0; i<n; i++){
    cin>>a[i];
    mp[a[i]]++;
    sum+=a[i];
  }
  int q;
  cin>>q;
  while(q--){
    int b,c;
    cin>>b>>c;
    auto it = mp.find(b);
    if(it == mp.end())cout<<sum<<"\n";
    else{
      sum-=(it->ff)*(it->ss);
      sum+=(it->ss)*c;
      mp.erase(it);
      mp[c] += it->ss;
      cout<<sum<<"\n";
    }
  }
}

signed main(){
    fastio();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 7876
s=[int(input()) for i in range(6)]
a=0
b=0
for j in range(5):
  for k in range(5):
    if j==k:
      continue
    else:
      if abs(s[j]-s[k])>s[5]:
        a+=1
if 0==a:
  print('Yay!')
else:
  print(':(')

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

int main() {
    int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
    int ans = 2000000000;
    for (int i = 0; i <= 100000; i++) {
        int cost = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B;
        ans = min(ans, cost);
    }
    cout << ans << endl;
}

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

int main(){
  int a, b,c, d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c) <= d)) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 256
A, B = [int(x) for x in input().split(" ")]

cnt = 0

for i in range(A,B+1):
    lis = list(str(i))
    for j in range(0,len(lis)):
        if j == len(lis)-1:
            cnt += 1
        elif lis[j] != lis[(-1-j)]:
            break
        
print(cnt)
        

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

double temp(int t, int x){
    return t - 0.006 * x;
}
int main(){
    int n, t, a;
    cin >> n >> t >> a;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    int idx = 0;
    for(int i=0;i<n;i++){
        if(abs(temp(t,h[i]) - a) < abs(temp(t, h[idx])-a)){
            idx = i;
        }
    }

    cout << idx+1 << endl;

    
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
#define coutd if(DEBUG) cout 
#define ff first
#define ss second
#define debug(x) cout << "> x:" << x << endl;
#define len(x) int(x.size())
#define all(x) x.begin(), x.end()
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(){
	ios::sync_with_stdio(0);
	int a;
	string st;
	cin >> a >> st;
	if(not (a<3200)){
		cout << st << endl;
	}
	else{
		cout << "red\n";
	}
}


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

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

//split delimiter??§?????????
vector<string> split(const string& input, char delimiter) {
	vector<string> ret;
	istringstream stream(input);
	string s;
	while (getline(stream, s, delimiter)) ret.push_back(s);
	return ret;
}

signed main() {
	for (string S; cin >> S&&S != "#";) {
		vector<string> s = split(S, '/');
		int h = s.size();
		int w = 0;
		rep(i, 0, s[0].size()) {
			if (s[0][i] == 'b')w++;
			else w += s[0][i] - '0';
		}
		dump(h);
		dump(w);
		vector<vector<char>> v(h, vector<char>(w, '.'));
		rep(i, 0, h) {
			int j = 0;
			rep(k, 0, s[i].size()) {
				if (s[i][k] == 'b') {
					v[i][j] = 'b';
						j++;
				}
				else j += s[i][k] - '0';
			}
		}
		if(DBG)rep(i, 0, v.size()) {
			cout << v[i][0];
			rep(j, 1, v[i].size()) { cout << " " << v[i][j]; }
			cout << endl;
		}
		int a, b, c, d; cin >> a >> b >> c >> d;
		a--, b--, c--, d--;
		swap(v[a][b], v[c][d]);
		if (DBG)rep(i, 0, v.size()) {
			cout << v[i][0];
			rep(j, 1, v[i].size()) { cout << " " << v[i][j]; }
			cout << endl;
		}
		string ans = "";
		rep(i, 0, h) {
			if (i != 0)ans += "/";
			int cnt = 0;
			rep(j, 0, w) {
				if (v[i][j] == '.')cnt++;
				else {
					if(cnt)ans += to_string(cnt);
					ans += 'b';
					cnt = 0;
				}
			}
			if(cnt)
				ans += to_string(cnt);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(void) {
	string S; cin >> S;

	if (S[2] == S[3] && S[4] == S[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
typedef long long ll;
typedef pair<ll,ll> P;
#define se second
#define fi first
struct PP{ll fi;ll se;ll th;};
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    int n,m;cin>>n>>m;
    vvi v(n,vi(m));
    rep(i,n)rep(j,m)cin>>v[i][j];
    rep(i,n){
        rep(j,m){
            int a;cin>>a;
            v[i][j]=abs(v[i][j]-a);
        }
    }
    vector<vvi> dp(n+1,vvi(m+1,vi(12805)));
  dp[0][0][v[0][0]]=1;
    rep(i,n){
        rep(j,m){
            rep(k,12805){
                if(dp[i][j][k]!=0){
                    if(i+1<n){
                      dp[i+1][j][k+v[i+1][j]]=1;
                      dp[i+1][j][abs(k-v[i+1][j])]=1;
                    }
                    if(j+1<m){
                      dp[i][j+1][k+v[i][j+1]]=1;
                      dp[i][j+1][abs(k-v[i][j+1])]=1;
                    }
                }
            }
        }
    }
    rep(i,12805){
        if(dp[n-1][m-1][i]==1){
          cout<<i<<endl;
          return 0;
        }
    }
}


Measured memory_bytes: 665088
N = gets.to_i

a = 0
w = 0
t = 0
r = 0

N.times do
  str=gets.chomp
  case str
  when "AC"
    a += 1
  when "WA"
    w += 1
  when "TLE"
    t += 1
  when "RE" 
    r += 1
  end
end

puts"AC x #{a}"
puts"WA x #{w}"
puts"TLE x #{t}"
puts"RE x #{r}"

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

using namespace std;

vector<int> solve(int mask, int a, int b) {
	assert(a != b);
	if (__builtin_popcount(mask) == 1) {
		return {a, b};
	}
	
	int bit = 0;
	while (((mask >> bit) & 1) == 0 || ((a >> bit) & 1) == ((b >> bit) & 1)) {
		bit++;
	}
	
	mask ^= (1 << bit);
	int sub = mask, target = __builtin_popcount(a & mask) % 2;
	while (__builtin_popcount(sub) % 2 == target || sub == (a & mask) || sub == (b & mask)) {
		sub = (sub - 1) & mask;
	}
	
	auto L = solve(mask, a, (a & ~mask) | sub);
	auto R = solve(mask, (b & ~mask) | sub, b);
	
	for (int x : R) L.push_back(x);
	return L;
}

int main() {
	int n, a, b;
	ignore = scanf("%d %d %d", &n, &a, &b);
	if (__builtin_popcount(a) % 2 == __builtin_popcount(b) % 2) {
		printf("%s\n", "NO");
		return 0;
	}
	
	auto ans = solve((1 << n) - 1, a, b);
	
	printf("%s\n", "YES");
	for (int x : ans) printf("%d ", x);
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 1648
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int NIL = -1;
const long long INF = 1LL << 60;
const long long MOD = 1e9+7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i <= N; ++i) {
    int now = i;
    double tmp = 1.0 / N;
    while (now < K) {
      now *= 2;
      tmp /= 2;
    }
    ans += tmp;
  }
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 3740
from heapq import heappush, heappop
N = int(input())
que = []
P = [list(map(int, input().split())) for i in range(N)]
P.sort()
ans = 0
for s, t in P:
    while que and que[0][0] < s:
        ans = max(ans, heappop(que)[1])
    heappush(que, (t, ans+1))
while que:
    ans = max(ans, heappop(que)[1])
print(ans)


Measured memory_bytes: 30360
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N, D;
  cin >> N >> D;
  int den = 2 * D + 1;
  int ans = (N + den - 1) / den;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3152
//### In The Name Of GOD ###

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

const int MOD = 1000000007;
const int INF = 30 * 1000 + 20;
const int MAXN = 2600;
const int MLOG = 18;
const int NMAX = 60;

#define int ll
#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
#define ct(x) const_cast<const int&>(x)

signed main(){
	int a[3],ans = 0;
	cin >> a[0] >> a[1] >> a[2];
	int k ;
	cin >> k;
	sort(a, a+3);
	ans += a[0]+a[1];
	ans += a[2] << k;
	cout << ans;
}

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

int main()
{
	int S;
	cin >> S;
	vector<ll> cnt(S + 1);
	for (int i = 1; i <= S; i++) if (S % i == 0) {
		for (int j = 1; j <= i; j++) {
			if (j % 2 == 0) {
				if (i % j != 0 && i % (j >> 1) == 0) {
					int x = i / j + 1;
					if (1 <= x - (j >> 1)) {
						++cnt[i];
					}
				}
			}
			else if (i % j == 0) {
				int x = i / j;
				if (1 <= x - (j >> 1)) {
					++cnt[i];
				}
			}
		}
	}
	ll res = 0;
	for (int i = 1; i <= S; i++) if (S % i == 0) {
		res += cnt[i] * cnt[S / i];
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3540
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a); i < (b); i += (s))
#define down(i, a, b, s) for (int i = (a); (b) < i; i -= (s))

long long r, d, x;

int main(int argc, char const *argv[]) {
  // freopen("B.txt", "r", stdin);

  while (cin >> r >> d >> x) {
    range(i, 0, 10, 1) {
      x = x * r - d;
      cout << x << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
// ProblemURL : https://atcoder.jp/contests/agc035/tasks/agc035_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int, n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		m[a]++
	}

	check := func(m map[int]int) bool {
		zeroCount, zeroExists := m[0]
		if len(m) == 1 {
			return zeroExists
		} else if len(m) == 2 {
			return n%3 == 0 && zeroExists && zeroCount == n/3
		} else if len(m) == 3 {
			keys := make([]int, 3)
			i := 0
			for k := range m {
				keys[i] = k
				i++
			}
			xor := keys[0]^keys[1]^keys[2] == 0
			return xor && m[keys[0]] == n/3 && m[keys[1]] == n/3 && m[keys[2]] == n/3
		}
		return false
	}

	if check(m) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 5760
n, m = gets.chomp.split.map(&:to_i)

h = Hash.new(0)

n.times do |i|
  ka = gets.chomp.split.map(&:to_i)
    ka.each_with_index do |val, idx|
    next if idx.zero?

    h[val] += 1
  end
end

ans = 0
h.each do |i|
  ans += 1if i[1] == n
end

p ans


Measured memory_bytes: 1788
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        char[] s = sc.next().toCharArray();
        int c = 0;
        for (int i = 1; i < n; i++) {
            if(s[i-1] != s[i]) c++;
        }
        int ans = Math.min(n-1, n -1 - (c - 2 * k));
        System.out.println(ans);
        sc.close();

    }

}


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

int dp[31];

int main() {
    dp[0] = 1;
    for(int i = 0; i < 30; i++) {
        if(i + 1 <= 30)
            dp[i + 1] += dp[i];
        if(i + 2 <= 30)
            dp[i + 2] += dp[i];
        if(i + 3 <= 30)
            dp[i + 3] += dp[i];
    }

    while(true) {
        int n;
        cin >> n;
        if(n == 0)
            break;
        cout << ((dp[n] + 9) / 10 + 364) / 365 << endl;
    }
}


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

int main() {
  ll x,y;
  cin >>x >>y;
  int cnt = 0;
  while(x<=y){
    x *= 2;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int h,w,ans;
    cin>>h>>w;
    ans=h*w;
    if(h==1||w==1)
    {
        cout<<1;
    }
    else if(ans%2==0)
    {
        cout<<ans/2;
    }
    else
    {
        cout<<(ans/2)+1;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    MAX = 10 ** 18
    res = 1
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return

    for a in A:
        res *= a
        if res > MAX:
            print(-1)
            return
    print(res)
resolve()

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

int main(){
	int a,b;
    	cin >> a >> b;
    	if((a+b)%2==0){
		cout << (a+b)/2 << endl;
    	}
    	else{
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdlib>
#include <cmath>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using ll = long long;
using namespace std;
int main() {
	int n;
	bool f = true;
	cin >> n;
	vector<int> h(n),d(n);
	d[0] = 0;
	REP(i, n) {
		cin >> h[i];
		if (i)d[i-1] = h[i] - h[i - 1];
	}
	if (n != 1) {
		REP(i, n - 1) {
			if (d[i] == -1) {
				d[i + 1]--;
			}
			else if (d[i] < 0) {
				f = false;
				break;
			}
		}
	}
	if (f)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main(){
  int n;cin>>n;
  for(int i=1; i<=n; i++){
    int x = i;
    if(x%3==0){
      cout<<" "<<i;
      continue;
    }
    while(x){
      if(x%10==3){
        cout<<" "<<i;
        break;
      }
      x/=10;
    }
  }
  cout<<endl;
}


Measured memory_bytes: 3092
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <algorithm>
using namespace std;
const int Max = 1e5;

char s[Max + 5];
bool a[Max + 5], flag;

int main()
{
	scanf ("%s", s);
	int len = strlen(s);
	for (int i = 0; i <= len - 1; i++)	a[s[i]] = 1;
	for (int i = 97; i <= 122; i++){
		if (a[i] == 1)	continue;
		if (a[i] == 0){
			printf ("%c\n", i);
			flag = 1;
			break;
		}
	}
	if (!flag)	printf ("None\n");
}
	
	

Measured memory_bytes: 256
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

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

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

const long long INF = 1e18;

using namespace std;

int main(){
    char c;
    cin >> c;
    if(c >= 'a' && c <= 'z'){
        cout << "a\n";
    }else{
        cout << "A\n";
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;

#define INF (i64)1e18
#define MOD (i64)(1e9+7)
#define REP(i, n) for(i64 i = 0; i < n; i++)
#define RANGE(i, a, b) for(i64 i = a; i < b; i++)
#define EACH(v, e, p) for_each(v.begin(), v.end(), [](auto& e) p)

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  vector<vector<bool>> c(h, vector<bool>(w));
  REP(i, h) {
    string s;
    cin >> s;
    REP(j, w) {
      c[i][j] = s[j] == '#';
    }
  }

  int ans = 0;
  for (int wbit = 0; wbit < (1<<w); ++wbit) {
    for (int hbit = 0; hbit < (1<<h); ++hbit) {
      int count = 0;
      for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
          if ((wbit & (1 << i)) && (hbit & (1 << j))) {
            if (c[j][i]) count++;
          }
        }
      }
      if (count == k) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
vector<int> G[100010];
ll a[100010];
bool ans;
void dfs(int v,int p){
	ll sum=0;
	ll ma=0;
	if(G[v].size()==1)return;
	for(auto e:G[v]){
		if(e==p)continue;
		dfs(e,v);
		sum+=a[e];
		ma=max(ma,a[e]);
	}
	if(a[v]>sum){
		ans=false;
	}else if(a[v]<sum){
		if(ma>a[v]){
			ans=false;
		}
		if((sum-a[v])*2LL>sum){
			ans=false;
		}else{
			a[v]=sum-(sum-a[v])*2LL;
		}
	}
}
int main(){
	ans=true;
	int n;cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	if(n==2){
		if(a[0]!=a[1]){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
		return 0;
	}
	for(int i=0;i<n-1;i++){
		int a,b;cin>>a>>b;a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int v;
	for(int i=0;i<n;i++){
		if(G[i].size()!=1){
			v=i;
			break;
		}
	}
	dfs(v,-1);
	if(a[v])ans=false;
	if(ans){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
    return 0;
}


Measured memory_bytes: 13184
#include <iostream>

using namespace std;

int cache[31] = {};

void init() {
    cache[1] = 1;
    cache[2] = 2;
    cache[3] = 4;
}

int count(int n) {
    if (cache[n] != 0) return cache[n];
    if (n <= 0) return 0;
    return count(n-1) + count(n-2) + count(n-3);
}

int main() {
    int n;
    init();
    while (cin >> n) {
        if (n == 0) break;
        int days = count(n);
        if (days % 3650 == 0) {
            cout << days / 3650 << endl;
        } else {
            cout << days / 3650 + 1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 864
#include <stdio.h>
#include <string.h>
int main(){
int a,b;
char c[15],d[15],e[15];
scanf("%s %s %d %d %s",&c,&d,&a,&b,&e);
if((strcmp(c,e)==0)){
	printf("%d %d",a-1,b);
}
else{
		printf("%d %d",a,b-1);
	}
return 0;
}

Measured memory_bytes: 1732
#include <stdio.h>
 
main(void) {
  int  a, b, d, r;
  double f;
 
  scanf("%d %d", &a, &b);
 
  d = a / b;
  r = a % b;
  f =(double)a / (double)b;
 
  printf("%d %d %f\n", d, r, f);
 
  return 0;
}

Measured memory_bytes: 636
#include<stdio.h>

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

   a = N+L-1;
   
   if(a <= 0) {
      b = a;
   }
   else if(L >= 0) {
      b = L;
   }
   else {
      b = 0;
   }

   int c = (a + L) * (a - L + 1) / 2 - b;

   printf("%d\n", c);
   
   return 0;
}


Measured memory_bytes: 1728
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
//main function
fn main() {
    let n: i32 = read();
    let r: i32 = read();
    if n>=10{
	println!("{}",r);
    }else {
	println!("{}",r+100*(10-n));
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#define mod 1000000007
int H, W, A, B, i, fact[200009], inv[200009], factinv[200009], ret;
inline int ncr(int xx, int yy) {
	return 1LL * fact[xx] * factinv[yy] % mod * factinv[xx - yy] % mod;
}
int main() {
	fact[0] = 1;
	for (i = 1; i <= 200009; i++) fact[i] = 1LL * fact[i - 1] * i % mod;
	inv[1] = 1;
	for (i = 2; i <= 200009; i++) inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;
	factinv[0] = 1;
	for (i = 1; i <= 200009; i++) factinv[i] = 1LL * factinv[i - 1] * inv[i] % mod;
	scanf("%d%d%d%d", &H, &W, &A, &B);
	for (i = 0; i < W - B; i++) ret = (ret + 1LL * ncr(A + i - 1, i) * ncr(W - i + H - A - 2, H - A - 1)) % mod;
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main (void) {

  int a,b,c;
  printf("");	scanf("%d", &a);
  printf("");	scanf("%d", &b);
  printf("");	scanf("%d", &c);
  
  if(a + b + c == 17) {
  	printf("YES");
  } else {
  	printf("NO");
  }
  
return 0;
}

Measured memory_bytes: 128
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    ll a[200000];
    REP(i,n)cin >> a[i];
    P b[200000];
    REP(i,m)cin >> b[i].second >> b[i].first;
    sort(b,b+m);
    reverse(b,b+m);
    sort(a,a+n);
    ll roop = 0;
    REP(i,m){
      if(a[roop]>=b[i].first)break;
      // REP(j,n)cout << a[j] << " ";
      // cout << endl;
      REP(j,b[i].second){
        roop++;
        if(b[i].first<=a[roop-1])break;
        else a[roop-1] = b[i].first;
      }
    }
    ll ans = 0;
    REP(i,n){
      ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = IntRead();
        int[] h = IntLine();
        int[] dp = Enumerable.Repeat(INF, N + 10).ToArray();
        dp[0] = 0;
        for (int i = 0; i < N - 1; i++)
        {
            dp[i + 1] = Math.Min(dp[i + 1], dp[i] + Math.Abs(h[i] - h[i + 1]));
            if (i + 2 < N) dp[i + 2] = Math.Min(dp[i + 2], dp[i] + Math.Abs(h[i] - h[i + 2]));
        }
        Console.WriteLine(dp[N-1]);
    }
}



public class Atcoder
{
    public static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int GCD(int a, int b)
    {
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(int a, int b)
    {
        return (long)a * b / GCD(a, b);
    }
    public static string StrReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int IntRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static long[] LSRead()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }
    public static long Combination(int n, int r)
    {
        if (n == r) return 1;
        return
            Enumerable.Range((n - r + 1), r).ToList().Aggregate((now, next) => now * next) /
            Enumerable.Range(1, r).ToList().Aggregate((now, next) => now * next);
    }
    public static long Permutation(int n, int r)
    {
        if (n == r) return 1;
        return
            Enumerable.Range((n - r), r).ToList().Aggregate((now, next) => now * next);
    }
    public static long LongRead()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] LongLine()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }
    public static int[] IntLine()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
}


Measured memory_bytes: 19168
#pragma GCC optimize(2)
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define N 200001
#define M 2001
using namespace std;
long long jc[N],njc[N],C[M][M];
int n;
bool bzs[N];
long long a[N],sprime[N],yu[N];
int prime[]={0,2,3,5,7,13,17,19,29,31,41,89,97};
long long xabs(long long x)
{
	if (x<0)return -x;
	return x;
}
long long gcd(long long x,long long y)
{
	if (y==0) return x;
	return gcd(y,x%y);
}
void qsort(int l,int r)
{
	int i=l,j=r;
	long long mid=sprime[(i+j)/2];
	while (i<=j)
	{
		while (sprime[i]<mid) i++;
		while (sprime[j]>mid) j--;
		if (i<=j)
		{
			long long t=sprime[i];sprime[i]=sprime[j];sprime[j]=t;
			i++;j--;
		}
	}
	if (i<r) qsort(i,r);
	if (l<j) qsort(l,j);
}
bool div(long long *a,int s)
{
	if (a[0]%s!=0) return false;
	bool bo=true;
	memset(yu,0,sizeof(yu));
	for (int i=n;i>=0;i--) yu[i]=a[i]; 
	if (s==2)
	{
		long long sp=0;
		for (int i=n;i>=0;i--)
			sp=(sp%s+a[i])%s;
		if (sp!=0) return false;
		return true;
	}
	for (int i=n;i>=0;i--)
	{
		if (i-s+1<0) break;
		yu[i-s+1]=(yu[i-s+1]+yu[i])%s;
		yu[i]=0;
	}
	for (int i=n;i>=0;i--)
	{
		if (yu[i]%s!=0)
		{
			bo=false;break;
		}
	}
	return bo;
}
int main()
{
//	long long n;
	scanf("%lld",&n);
	for (int i=n;i>=0;i--) scanf("%lld",&a[i]);
	long long s=0;
	for (int i=0;i<=n;i++) 
	{
		if (s==0&&a[i]!=0) s=xabs(a[i]);
		else	
			if (a[i]!=0) s=gcd(s,xabs(a[i]));
	}
	sprime[0]=0;
	for (int i=2;i<=sqrt(s);i++)
	{
		if (s==1) break;
		if (s%i==0)
		{
			sprime[0]++;sprime[sprime[0]]=i;
			while (s%i==0) s/=i;
		}
	}
	if (s!=1) 
	{
		sprime[0]++;sprime[sprime[0]]=s;
	}
	memset(bzs,false,sizeof(bzs));
	for (int i=1;i<=sprime[0];i++)
		if (sprime[i]<=n) bzs[sprime[i]]=true; 
	for (int i=2;i<=n;i++)
	{
		bool bo=true;
		for (int j=2;j<=sqrt(i);j++)
		{
			if (i%j==0)
			{
				bo=false;break;
			}
		}	
		if (bzs[i]||!bo) continue;
		bo=div(a,i);
		if (!bo) continue;
		sprime[0]++;sprime[sprime[0]]=i;
	}
	qsort(1,sprime[0]);
	for (int i=1;i<=sprime[0];i++)
		if (i==1||sprime[i]!=sprime[i-1]) 
			printf("%d\n",sprime[i]);
} 

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

int main(){
  int n; cin >> n;
  vector<int> l(n*2);
  
  for(int i=0;i<n*2;i++){
    cin >> l.at(i) ;
  }
  sort(l.begin(), l.end());
  
  int ans = 0;
  for(int i=0; i<n*2; i=i+2){
    ans += l.at(i);
  }
  
  cout << ans << endl;

} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double a[55];
int main(){
	int n,i;
	double sum;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	sum=a[1];
	for(i=2;i<=n;i++){
		sum+=a[i];
		sum=sum/2.0;
	}
	cout<<fixed<<setprecision(9)<<sum;
	return 0;
}

Measured memory_bytes: 256
s=input()
tmp,mod,n,ans=0,2019,len(s),0
dic={0:1}
for i in range(len(s)):
  tmp=(tmp+int(s[i])*pow(10,n-i-1,mod))%mod
  if tmp in dic.keys():
    dic[tmp]+=1
  else:
    dic[tmp]=1
for i in dic.items():
  ans+=(i[1]*(i[1]-1))//2
print(ans)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
string s,t,ans="";//ans为最后的答案，赋为空
int i,j,r;
int main(){
    cin>>s>>t;
    if(s.size()<t.size()){
        cout<<"UNRESTORABLE";
        return 0;
    }//大坑，必须判断s的长度会不会比t小(我被坑了3次QAQ)
    for(i=0;i<=s.size()-t.size();i++){//枚举t从哪个地方开始
        int k=i;//将i替换为k
        string ss=s;//将s替换为ss
        j=0;//初始化为0
        while(j<t.size()){
            if(ss[k]=='?')//如果为'?'，替换
                ss[k]=t[j];
            else if(s[k]!=t[j])//否则，如果不匹配，退出
                break;
            k++;//匹配则继续匹配
            j++;
        }
        if(j==t.size()){//如果完美匹配
            for(r=0;r<ss.size();r++){
                if(ss[r]=='?')//把'?'替换为'a'
                    ss[r]='a';
            }
            if(ans=="")//如果ans为空，将ans变为ss
                ans=ss;
            else ans=min(ans,ss);//否则,取字典序最小的
        }
    }
    if(ans=="")//若ans为空
        cout<<"UNRESTORABLE";
    else cout<<ans;//输出ans
    return 0;
}

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

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

int a, b, q;
vector<lint> s, t;

lint left_nearest(vector<lint>& v, lint k) {
    int ok = 0, no = v.size();
    while (abs(ok - no) > 1) {
        int mid = (ok + no) / 2;
        (v[mid] < k ? ok : no) = mid;
    }
    return v[ok];
}
lint right_nearest(vector<lint>& v, lint k) {
    int no = -1, ok = v.size() - 1;
    while (abs(ok - no) > 1) {
        int mid = (ok + no) / 2;
        (v[mid] > k ? ok : no) = mid;
    }
    return v[ok];
}

lint nearest(vector<lint>& v, lint k) {
    lint left = left_nearest(v, k), right = right_nearest(v, k);
    return abs(k - left) <= abs(k - right) ? left : right;
}

int main() {
    cin >> a >> b >> q;
    s.resize(a), t.resize(b);
    for (int i = 0; i < a; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> t[i];
    }
    for (int i = 0; i < q; i++) {
        lint x;
        cin >> x;
        lint ans = LLONG_MAX;
        //左神社
        lint ls1 = left_nearest(s, x);
        lint ls2 = nearest(t, ls1);
        chmin(ans, abs(x - ls1) + abs(ls1 - ls2));
        //右神社
        lint rs1 = right_nearest(s, x);
        lint rs2 = nearest(t, rs1);
        chmin(ans, abs(x - rs1) + abs(rs1 - rs2));
        //左寺
        lint lt1 = left_nearest(t, x);
        lint lt2 = nearest(s, lt1);
        chmin(ans, abs(x - lt1) + abs(lt1 - lt2));
        //右寺
        lint rt1 = right_nearest(t, x);
        lint rt2 = nearest(s, rt1);
        chmin(ans, abs(x - rt1) + abs(rt1 - rt2));
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
import math
import queue
import bisect
import heapq
import time
import itertools

mod = 1e9+7

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    s = input()
    if s=='SUN':
        print(7)
    elif s=='MON':
        print(6)
    elif s=='TUE':
        print(5)
    elif s=='WED':
        print(4)
    elif s=='THU':
        print(3)
    elif s=='FRI':
        print(2)
    elif s=='SAT':
        print(1)
    return


if __name__=='__main__':
    main()

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

using namespace std;

int main(){
  int cnt =0;
  string S, T;
  cin >> S >> T ;
  for(int i = 0 ; i < S.length() - T.length()+1 ; i++){
    int tmp=0;
    for(int j = 0 ; j < T.length() ; j++){
      if(S[i+j] == T[j]){
        tmp++;
      }
    }
    if(cnt < tmp){
      cnt = tmp;
    }
  }

  cout << T.length() - cnt << endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(),b=sc.nextLong(),x=sc.nextLong();
		if(a==0) {
			System.out.println((long)(b/x)+1);
		}else if(a==1){
			System.out.println((long)(b/x));
		}else {
			System.out.println((long)(b/x)-(long)((a-1)/x));
		}


	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
const int maxn = 400005;
char a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int sum = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] == 'E')sum++;
    }
    int ans = sum;
    for(int i = 1; i <= n; i++)
    {
        ans = min(ans, sum);
        if(a[i] == 'E'){
            sum--;
        }
        else {
            sum++;
        }
    }
    ans = min(ans, sum);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  
  lint N; cin >> N;
  vi frd(N,0);
  for(lint i=0; i<N; i++) cin >> frd[i];
  
  sort(ALL(frd));
  reverse(ALL(frd));
  
  lint ans = 0;
  
  if(N%2==0){
    N /= 2;
    for(lint i=0; i<N; i++){
      ans += frd[i];
    }
    ans *= 2;
    ans -= frd[0];
  }else{
    N /= 2;
    for(lint i=0; i<N; i++){
      ans += frd[i];
    }
    ans *= 2;
    ans += frd[N];
    ans -= frd[0];
  }
  
  cout << ans << endl;
}
    

Measured memory_bytes: 4840
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

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

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

using lll = __int128_t;

struct Line {
    ll k, b;
    mutable const Line *nx;
    bool operator<(ll x) const {
        if (!nx) return 0;
        return b - nx->b < lll(nx->k - k) * x;
    }
    bool operator<(const Line& rhs) const {
        return k < rhs.k;
    }
};
// will maintain upper hull for maximum
struct HullDynamic : multiset<Line, less<>> {
    bool bad(iterator y) {
        auto z = next(y);
        if (y == begin()) {
            if (z == end()) return 0;
            return y->k == z->k && y->b <= z->b;
        }
        auto x = prev(y);
        if (z == end()) return y->k == x->k && y->b <= x->b;
        return lll(x->b - y->b)*(z->k - y->k) >= lll(y->b - z->b)*(y->k - x->k);
    }
    void insert_line(ll k, ll b) {
        auto y = insert({k, b, 0});
        if (bad(y)) { erase(y); return; }
        auto z = next(y);
        while (z != end() && bad(z)) z = erase(z);
        if (z != end()) y->nx = &*z;
        while (y != begin() && bad(z = prev(y))) erase(z);
        if (y != begin()) z->nx = &*y;
    }
    ll eval(ll x) {
        auto l = *lower_bound(x);
        return l.k * x + l.b;
    }
};




const int MAXN = 210000;

ll h[MAXN];
int n;
ll c;
ll dp[MAXN];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> c;
	for (int i = 0; i < n; ++i)
		cin >> h[i];
	HullDynamic dph;
	dph.insert_line(2 * h[0], -dp[0] - h[0] * h[0]);
	for (int i = 1; i < n; ++i) {
		dp[i] = -dph.eval(h[i]) + h[i] * h[i] + c;
		dph.insert_line(2 * h[i], -dp[i] - h[i] * h[i]);
	}
	cout << dp[n - 1] << "\n";
	return 0;
}




Measured memory_bytes: 15872
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextLong();
            var k = cin.nextLong();
            var ans = 1;
            while (n >= k)
            {
                n /= k;
                ans++;
            }            
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

ll gcd(ll a, ll b){
  if(b == 0) return a;
  return gcd(b, a%b);
}

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

  ll L;
  while(cin >> L, L){
    ll ans = 0;
    list<ll> y;
    for(ll i = 1; i * i <= L; i++){
      if(L % i == 0){
	y.push_back(i);
	if(i != L/i) y.push_back(L / i);
      }
    }

    //for(int i = 0; i < y.size(); i++) cout << y[i] << endl;

    for(list<ll>::iterator i = y.begin(); i != y.end(); i++){
      for(list<ll>::iterator j = y.begin(); j != y.end(); j++){
	if(*i > *j) continue;
	ll g = gcd(*j, *i);
	if(g * L == *j * *i) ans++;
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int64_t h,w,ans;
  cin >> h >> w ;
  if(h!=1&&w!=1)
  {
  if((h*w)%2==1)
  {
    cout << (h*w+1)/2 << endl;
  }
  else
  {
    cout << (h*w)/2;
  }
  }
  else
  {
    cout << "1" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  
  int K,A,B;
  scanf("%d %d %d",&K,&A,&B);
  
  int L=K;
  int sw=0;
  
  while(L<=B){
    
    if(A<=L){
      sw=1;
      
    }
    
    L=L+K;
      
  
  }
  
  if(sw==1){
    printf("OK\n");
  }else{
    printf("NG\n");
  }
  return 0;
}

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

int main(){
  int n;	cin >> n;
  
  if(n%10 == 3){
    cout << "bon";
    return 0;
  }
  
  if(n%10 == 2 || n%10 ==4 || n%10 == 5 ||
     n%10 == 7 || n%10 == 9){
    cout << "hon";
    return 0;
  }
  
  if(n%10 == 0 || n%10 == 1 || n%10 == 6 ||
     n%10 == 8){
    cout << "pon";
    return 0;
  }
}

Measured memory_bytes: 3552