akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
const ll mod = 1000000007;
int main()
{
	SPEED
	int n;
	cin >> n;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> arr[i];
	}

	ll suffix_arr[n];
	suffix_arr[n-1] = arr[n-1];
	for (int i = n-2; i >= 0; --i)
	{
		suffix_arr[i] = suffix_arr[i+1] + arr[i];
		suffix_arr[i] = (suffix_arr[i])%mod;
	}

	ll ans = 0;

	for (int i = 0; i < n-1; ++i)
	{
		ll temp = (arr[i]*(suffix_arr[i+1]))%mod;
		ans += temp;
		ans = ans%mod;
	}

	cout << ans;
	return 0;
}

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

int verdicts[5];

int main() {
    int n, counter = 0;
    cin >> n;

    while (n--) {
        string verdict;
        cin >> verdict;

        if (verdict == "AC")
            ++verdicts[1];
        if (verdict == "WA")
            ++verdicts[2];
        if (verdict == "TLE")
            ++verdicts[3];
        if (verdict == "RE")
            ++verdicts[4];
    }

    cout << "AC x " << verdicts[1]
        << "\nWA x " << verdicts[2]
        << "\nTLE x " << verdicts[3]
        << "\nRE x " << verdicts[4];
    return 0;
}

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

int main(){
        int n;
        cin >> n;
        int d[n];
        for(int i = 0;i< n;i++)
        {
                cin>>d[i];
        }
        sort(d,d+n);
        int ans = 0;
        for(int i= 0;i<n;i++)
        {
                if(d[i] != d[i+1])
                {
                        ans++;
                }
        }
        cout << ans << endl;
}

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

long n[1010][1010];
int main() {
	int H, W;
	bool A[1010][1010];
	char c;
	cin >> H >> W;
	for(int i=0; i<H; ++i){
	    for(int j=0; j<W; ++j){
	        cin >> c;
	        A[i][j]=(c=='.');
	    }
	}
	n[0][0]=1;
	for(int i=1; i<H; ++i){
	    if(A[0][i]) n[0][i]=1;
	    else break;
	}
	for(int i=1; i<W; ++i){
	    if(A[i][0]) n[i][0]=1;
	    else break;
	}
	for(int i=1; i<H; ++i){
	    for(int j=1; j<W; ++j){
	        if(A[i][j]) n[i][j]=(n[i-1][j]+n[i][j-1])%1000000007;
	    }
	}
	cout << n[H-1][W-1] << endl;
	return 0;
}


Measured memory_bytes: 9088
A,B=map(int,input().split())
cnt=0
def is_pal(s):
    s_str=str(s)
    s_rev=str() 
    for i in range(1,len(str(s))+1):
        s_rev+=s_str[-i]
    
    if s_str==s_rev:
        return True
    else:
        return False
for i in range(A,B+1):
    if is_pal(i):
        cnt+=1
print(cnt)
        

Measured memory_bytes: 3060
def resolve():
    N, A, B = map(int, input().split())  

    ao_count = 0

    count_num = N // (A + B)
    amari_num = N % (A + B)



    ao_count = count_num * A

    if A <= amari_num:
        ao_count += A
    else:
        ao_count += amari_num

    print(ao_count)



if __name__ == "__main__":
    resolve()

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

ll n, m;
vector<ll> a, b;
vector<ll> A, B;
bool m1[51][51][51][51][2][2] = {0};
ll m2[51][51][51][51][2][2];
ll f(ll l1, ll r1, ll l2, ll r2) {
	return (A[l1] - A[r1]) - (B[l2] - B[r2]);
}
ll dp(ll l1, ll r1, ll l2, ll r2, bool is_first, bool is_skipped) {
	const ll sgn = is_first ? 1 : -1;
	ll res = -linf;
	if (m1[l1][r1][l2][r2][is_first][is_skipped]) {
		return m2[l1][r1][l2][r2][is_first][is_skipped];
	}
	if (is_skipped && l1 == r1 && l2 == r2) chmax(res, 0LL);
	else {
		chmax(res, sgn * (f(l1, r1, l2, r2) + dp(r1, r1, r2, r2, !is_first, l1 == r1 && l2 == r2)));
	}
	if (is_first) {
		if (r1 < n) {
			if (a[r1] < 0) {
				chmax(res, sgn * dp(l1, r1+1, r2, r2, !is_first, false));
			}
			else {
				chmax(res, sgn * dp(l1, r1+1, l2, r2, !is_first, false));
			}
		}
	}
	else {
		if (r2 < m) {
			if (b[r2] < 0) {
				chmax(res, sgn * dp(r1, r1, l2, r2+1, !is_first, false));
			}
			else {
				chmax(res, sgn * dp(l1, r1, l2, r2+1, !is_first, false));
			}
		}
	}
	m1[l1][r1][l2][r2][is_first][is_skipped] = true;
	return m2[l1][r1][l2][r2][is_first][is_skipped] = sgn * res;
}
void S(vector<ll>& X, const vector<ll>& x) {
	X.assign(x.size()+1, 0);
	rrep(i, x.size()) {
		X[i] = X[i+1] + max(x[i], 0LL);
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	a.resize(n); cin >> a;
	b.resize(m); cin >> b;
	S(A, a);
	S(B, b);
	cout << dp(0, 0, 0, 0, true, false) << endl;
}

Measured memory_bytes: 94444
#include<stdio.h>
typedef long long ll;
ll solve(ll x,ll n)
{
    ll ans;
    if(n%x==0)
        return n*2-x;
    ans=n/x*x*2+solve(n%x,x);
    return ans;
}
int main()
{
    ll n,x;
    ll ans;
 
    scanf("%lld%lld",&n,&x);
    ans=solve(x,n-x)+n;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
program main
    implicit none
    integer X, Y, i
    integer(8) N

    read(*,*) X, Y

    if(mod(X,Y)==0)then
        write(*,*) -1
        stop
    endif

    do i = 1, 1000000000
        N = X*i
        if(mod(N,Y)/=0)then
            write(*,*) N
            stop
        endif
    enddo

    write(*,*) -1


end program

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

#define MOD 1000000007
#define int long long
int dp[1010][1010];
int n,m;

inline void sum(int &a,int b){
	a = (a+b)%MOD;
}

int32_t main(){
	scanf("%lld%lld",&n,&m);
	string G[n];
	for(auto &a:G){
		char k[m+2];
		scanf("%s",k);
		a=k;
	}
	dp[n-1][m-1] = 1;
	for(int i=n-1;i>=0;i--)
		for(int j=m-1;j>=0;j--){
			if((i+1)<n and G[i+1][j]!='#'){
				sum(dp[i][j],dp[i+1][j]);
			}
			if((j+1)<m and G[i][j+1]!='#'){
				sum(dp[i][j],dp[i][j+1]);
			}
		}
	printf("%lld\n",dp[0][0]);
	
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000005
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

using Weight = ll;
using Flow = ll;
struct Edge {
    ll src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(ll s, ll d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, ll a, ll b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
    g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, ll a, ll b, Weight w = 1) { g[a].emplace_back(a, b, w); }

Graph to_rooted(const Graph &g, ll r = 0) {
    ll n = g.size();
    Graph ng(n);
    std::vector<ll> ord(n, -1);
    std::queue<ll> q;
    q.push(r);
    ll k = 0;
    while (q.size()) {
        ll u = q.front();
        q.pop();
        for (auto &e : g[u]) {
            ll v = e.dst;
            if (ord[v] == -1) {
                ord[v] = k++;
                q.push(v);
                ng[u].emplace_back(e);
            }
        }
    }
    return ng;
}

ll res[200001];
bool used[200001];
vector<ll> dp(200001, INF);
vector<long long> a(200001), u(200001), v(200001);

Graph g(200001);

void solve(ll piv, long long N) {
    used[piv] = true;
    ll p = *lower_bound(dp.begin(), dp.end(), a[piv]);
    *lower_bound(dp.begin(), dp.end(), a[piv]) = a[piv];
    res[piv] = POSL(dp, INF);
    for (auto x : g[piv]) {
        if (!used[x.dst]) solve(x.dst, N);
    }
    *lower_bound(dp.begin(), dp.end(), a[piv]) = p;
}

int main() {
    long long N;
    scanf("%lld", &N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &a[i]);
    }

    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &u[i]);
        scanf("%lld", &v[i]);
        u[i]--;
        v[i]--;
    }

    rep(i, N) { add_edge(g, u[i], v[i]); }

    solve(0, N);
    rep(i, N) cout << res[i] << endl;
    return 0;
}


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

int n;
string S,T;
int main(){
	cin >> n;
	set<string> s;
	for(int i=1;i<=n;i++){
		cin >> S >> T;
		if(S=="insert") s.insert(T);
		else{
			decltype(s)::iterator it = s.find(T);
			if(it!=s.end()) cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}
}


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

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
		cout<<"YES";
	else
		cout<<"NO";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


int main() {
	int n;
	cin >> n;
	int max_n = 100000;
	int even[max_n], odd[max_n];
	rep(i, max_n) even[i]=odd[i]=0;
	rep(i, n/2) {
		int o, e;
		cin >> o >> e;
		odd[o]++;
		even[e]++;
	}
	int even_max = 0, even_max_n = 0;
    int even_second = 0, even_second_n = 0;
    int odd_max = 0, odd_max_n = 0;
    int odd_second = 0, odd_second_n = 0;

    rep(i, max_n) {
    	if (even[i] > even_max) {
    		even_second = even_max;
    		even_second_n = even_max_n;
    		even_max = even[i];
    		even_max_n = i;
    	}
    	else if (even[i] > even_second) {
    		even_second = even[i];
    		even_second_n = i;
    	}
    	if (odd[i] > odd_max) {
    		odd_second = odd_max;
    		odd_second_n = odd_max_n;
    		odd_max = odd[i];
    		odd_max_n = i;
    	}
    	else if (odd[i] > odd_second) {
    		odd_second = odd[i];
    		odd_second_n = i;
    	}
    }
    if (even_max_n != odd_max_n) {
    	cout << n - even_max - odd_max << endl;
    }
    else {
    	cout << min(n - even_max - odd_second, n - even_second - odd_max) << endl;
    }
}

Measured memory_bytes: 1024
n, m = list(map(int, input().split()))

transfer_1 = set()
transfer_2 = set()

for i in range(m):
  a, b = list(map(int, input().split()))
  if(a == 1):
    transfer_1.add(b)
  if(b == n):
    transfer_2.add(a)
s_intersection = transfer_1 & transfer_2
print("POSSIBLE" if len(s_intersection) else "IMPOSSIBLE")

Measured memory_bytes: 18996
import java.util.*;

class Main
{
    public static  void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        String s = sc.next();
        String newS = s.replace("ABC", "0");
        
        int length = s.length() - newS.length();
        
        System.out.println(length / 2);
        
        
    }
}
        

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

template<class T> inline T re(){
	T N = 0; char c = getchar(); bool neg = 0;
	for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
	for (; c >= '0' && c <= '9'; c = getchar())
		N = (N<<3)+(N<<1) + c - '0';
	return neg ? -N : N;
}

int n;
set<int> s;

int main(){
	n = re<int>();
	for (int i = 1; i <= n; i++){
		int u = re<int>();
		if (s.find(u) != s.end()){
			s.erase(u);
		} else {
			s.insert(u);
		}
	}
	cout << s.size() << '\n';
	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
const ll mod = 1000000007;
vector<ll> inv, FactorialInv, Factorial;
ll beki(ll a, ll b){
    ll ret = 1 % mod;
    a %= mod;
    while(b) {
        if(b & 1LL) ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}
void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    inv.resize(MAX + 1);
    Factorial[0] = 1;
    inv[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = beki(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
    for(int i = 1; i <= MAX; i++) {
        inv[i] = FactorialInv[i] * Factorial[i-1] % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    init_combination(1005000);
    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    for(int i = 0; i <= N; i++) {
        ll tmp = combination(N, i);
        tmp *= combination(M, i);
        tmp %= mod;
        tmp *= Factorial[i];
        tmp %= mod;
        ll factor = combination(M-i, N-i);
        factor *= Factorial[N-i];
        factor %= mod;
        factor *= factor;
        factor %= mod;
        tmp *= factor;
        tmp %= mod;
        if(i % 2 == 0) ans += tmp;
        else ans -= tmp;
    }
    ans %= mod;
    ans += mod;
    ans += mod;
    ans %= mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 26604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;



int main(){
    fast_io
    
    ll h, w;
    cin>>h>>w;
    ll ans=0;

    if(h%2==0||w%2==0) ans=w*h/2;
    else ans=(w*h)/2+1;
    if(h==1||w==1) ans=1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 105;

int n, l[maxn];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> l[i];
    sort(l, l + n);
    int ans = 0;
    for(int i = 0; i < n; i++)
        for(int j = i + 1; j < n; j++)
            for(int k = j + 1; k < n; k++)
                if(l[i] != l[j] && l[j] != l[k] && l[i] + l[j] > l[k])
                    ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include <math.h>
using namespace std;


	int main() {
		int n;
		cin >> n;
		int R[200000];
		
		for (int i = 0; i < n; i++) {
			cin >> R[i];
		}
		int maxv = -2000000000;
		int minv = R[0];
		for (int i = 1; i < n; i++) {
			if (R[i] - minv > maxv) maxv = R[i] - minv;
			if (R[i] < minv) minv = R[i];
		}
		cout << maxv << endl;

		return 0;
	}



Measured memory_bytes: 3872
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long height[] = new long[num];
		for(int i = 0; i < num; i ++) {
			height[i] = sc.nextLong();
		}
		long dp[] = new long[num];
		for(int i = 0; i < num; i ++) {
			dp[i] = i == 0 ? 0
				: i == 1 ? Math.abs(height[i] - height[i - 1])
				: Math.min(dp[i - 1] + Math.abs(height[i] - height[i - 1]),
					dp[i - 2] + Math.abs(height[i] - height[i - 2]));
		}
		System.out.println(dp[num - 1]);
	}
}

Measured memory_bytes: 61052
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll N,M,K,Q;
double A,B,C,D,X[200010];

ll ans;
bool F=false;
string S,T,U;
double s=0,temp=0;
int main(){
    cin>>N>>K;
    REP(i,N)cin>>X[i];

    REP(i,N){
        if(i<K-1)continue;
        else if(i==K-1){
            REP(j,K){
                temp+=(X[j]+1)/2;
            }
            s=temp;
            DEB(s)END;
        }
        else if(i>K-1){
            temp+=(X[i]+1)/2-(X[i-K]+1)/2;
            DEB(i)DEB(s)DEB(temp)TF(s<temp);
            if(s<temp){s=temp;DEB(s);}
            DEB(s)DEB(temp)END;
        }

    }
    printf("%.09lf\n",s);
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int N[1000];
int main(){
  int a;
  cin >> a;
  int N[a];
  for(int i=0; i<a; i++){
    cin >> N[i];
  }
  for(int i=0; i<a; i++){
    if(N[i] % 2 == 0){
      if(N[i] % 3 != 0 && N[i] % 5 != 0){
	cout << "DENIED" << endl;
	return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUF_SIZE (200)

void solve(int data[100][50], int num_rows, int level, int up) {
	int *next, *prev, idx, i;

	if (level >= num_rows)
		return;
	next = data[level];
	prev = data[level-1];
	if (up) {
		for (i = 0; i < level+1; i++) {
			idx = (i-1 > 0) ? (i-1) : 0;
			next[i] += (prev[idx] > prev[i]) ? prev[idx] : prev[i];
		}
	} else {
		for (i = 0; i < num_rows-level; i++) {
			next[i] += (prev[i] > prev[i+1]) ? prev[i] : prev[i+1];
		}
	}
	solve(data, num_rows, level+1, num_rows / 2 > level);
}

int main(void) {
	char in[BUF_SIZE], *p;
	int data[100][50], i, row = 0;

	while (fgets(in, BUF_SIZE, stdin) != NULL) {
		i = 0;
		for (p = strtok(in, ",\n"); p != NULL; p = strtok(NULL, ",\n")) {
			data[row][i] = atoi(p);
			i++;
		}
		row++;
	}
	solve(data, row, 1, 1);
	printf("%d\n", data[row-1][0]);
	return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <vector>

using namespace std;

#define INF (int)(1e8)

int main(void)
{
    int books_count;
    int algos_count;
    int skill_border;
    vector<vector<int> > books_skills;
    vector<int> book_prices;

    cin >> books_count >> algos_count >> skill_border;

    for(int i = 0; i < books_count; i++){
        int p;
        cin >> p;
        book_prices.push_back(p);

        vector<int> skills;
        for(int j = 0; j < algos_count; j++){
            int s;
            cin >> s;
            skills.push_back(s);
        }
        books_skills.push_back(skills);
    }

    int min_cost = INF;
    for(int i = 0; i < (1 << books_count); i++){
        int price_sum = 0;
        vector<int> skill_sum(algos_count);
        for(int j = 0; j < algos_count; j++){
            skill_sum[j] = 0;
        }

        for(int bit_pos = 0; bit_pos < books_count; bit_pos++){
            if((i & (1 << bit_pos)) != 0){
                price_sum += book_prices[bit_pos];

                for(int j = 0; j < algos_count; j++){
                    skill_sum[j] += books_skills[bit_pos][j];
                }
            }
        }

        bool achieves = true;
        for(int j = 0; j < algos_count; j++){
            if(skill_sum[j] < skill_border){
                achieves = false;
                break;
            }
        }
        if(achieves && price_sum < min_cost){
            min_cost = price_sum;
        }
    }

    if(min_cost == INF){
        cout << -1 << endl;
    }else{
        cout << min_cost << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a>b){ans += a;--a;}
    else{ans += b ; --b;}
    ans += max(a,b);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define YEET ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define f first
#define s second
#define mod 1000000007

using namespace std;

int main ()
{
	YEET;
	int n,l;
	cin>>n>>l;
	vector<int> v;
	for(int y=1;y<=n;y++)
	{
		v.pb(l+y-1);
	}
	int ans=0;
	for(int y=0;y<v.size();y++)
		ans+=v[y];
	int min__=abs(ans-(ans-v[0])),val=ans-v[0];

	for(int y=0;y<n;y++)
	{
		if(abs(ans-(ans-v[y]))<min__)
		{
			val=ans-v[y];
			min__=abs(ans-(ans-v[y]));
		}
	}
		//min__=min(abs(ans-v[0]),min__);
	cout<<val;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#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; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S; std::cin >> S;

  int ans = sz(S);
  for(int k=1; k<sz(S); k++) {
    if ( S[k-1] != S[k] ) {
      int c = std::max(k, sz(S)-k);
      ans = std::min(ans,c);
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if(A + B > C + D) {
        cout << "Left" << endl;
    }else if(A + B == C + D) {
        cout << "Balanced" << endl;
    }else {
        cout << "Right" << endl;
    }
}


Measured memory_bytes: 384
from heapq import heappop, heappush

N = int(input())
R = []
B = []
YFlag = [True]*(2*N)

for _ in range(N):
  a, b = map(int, input().split())
  R.append((a, b))

for _ in range(N):
  c, d = map(int, input().split())
  B.append((c, d))

B.sort()

ans = 0
for c, d in B:
  cand = []
  for a, b in R:
    if a < c and b < d and YFlag[b]:
      cand.append(b)
  if cand:
    ans += 1
    YFlag[max(cand)] = False

print(ans)

Measured memory_bytes: 9260
import math,bisect
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,d,a = map(int,readline().split())
lst1 = [list(map(int,readline().split())) for i in range(n)]
lst1.sort()

#####segfunc######
def segfunc(x,y):
    return x+y

def init(init_val): #渡されたリストでsegを初期化
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x): #segの要素kをxに変更(セグ木全体の更新)
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q): #区間[p,q)での、segfuncに準じた値を返す
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
"""
最小値のセグ木 → 10**9　(最小値の更新に影響しないため)
　　和のセグ木 → 0
　　積のセグ木 → 1
　　gcdのセグ木 → 0　(gcdを更新しない値は0)
"""
ide_ele = 0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num


#process
x = []
for i in lst1:
    x.append(i[0])


ans = 0

for i in range(n):
    k = bisect.bisect_left(x,lst1[i][0]-2*d) #手前側にあるダメージ量を確認

    r = query(k,i) #kからiまでの合計ダメージを取得

    if lst1[i][1] > r:
        if (lst1[i][1]-r)/a%1==0:
            need = (lst1[i][1]-r)//a
        else:
            need = (lst1[i][1]-r)//a+1
        ans += need
        update(i,need*a)

print(ans)


Measured memory_bytes: 99940
#include<iostream>

using namespace std;


int main() {
	int big, small, c, d;
	cin >> big >> small;
	c = big * small;

	if (big < small) {
		d = big;
		big = small;
		small = d;
	}
	


	for (long long i = small; i < 10000000000; ) {
		if (i % small ==0 && i % big ==0 ) {
			cout << i;
			break;
		}
		i += small;

	}


}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 200050;

int bit[MAX_N], a[MAX_N];
int N;

int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add(int i, int x) {
    while (i <= N) {
        bit[i] += x;
        i += i & -i;
    }
}

int seg(int i, int j) {
    assert(i <= j);
    if (i == 0) {
        return sum(j);
    } else {
        return sum(j) - sum(i-1);
    }
}

int findr(int i) {
    if (seg(i, N) == N - i + 1) {
        return N;
    } else {
        int lb = i;
        int ub = N;
        while (lb + 1 < ub) {
            int mid = (lb + ub) / 2;
            if (seg(i, mid) == mid - i + 1) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return lb;
    }
}

int findl(int i) {
    if (seg(1, i) == i) {
        return 1;
    } else {
        int lb = 1;
        int ub = i;
        while (lb + 1 < ub) {
            int mid = (lb + ub) / 2;
            if (seg(mid, i) == i - mid + 1) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        return ub;
    }
}

long long seg_num(long long i, long long j) {
    if (j < i) {
        return 0;
    } else {
        return (j - i + 1 + 1) * (j - i + 1) / 2;
    }
}

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> a[i];
    }

    for (int i = 0; i < MAX_N; i++) {
        bit[i] = 0;
    }
    std::vector<std::pair<int, int>> vec;

    for (int i = 1; i <= N; i++) {
        vec.push_back(std::pair<int,int>({a[i], i}));
    }
    std::sort(vec.begin(), vec.end());

    long long ret = 0;
    for (int i = vec.size() - 1; 0 <= i; i--) {
        int loc = vec[i].second;
        int val = vec[i].first;
        assert(val == i + 1);
        add(loc, 1);
        int left = findl(loc);
        int right = findr(loc);
        long long num = seg_num(left, right) - seg_num(loc + 1, right) - seg_num(left, loc - 1);
        //std::cout << val << " " << loc << " " << left << " " << right << " " << num << std::endl;
        ret += num * val;
    }

    //std::cout << seg_num(1, 3) << " " << 

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 3956
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;


int main()
{
    int N,M;
    double sum=0;
    int A[100];
    rep(i,100){
        A[i] = 0;
    }

    cin >> N >> M;
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    std::sort(A, A + 100, std::greater<>());

    if((int)sum % (4*M)==0 ){
        int tmp = (int)sum % (4*M);
        if(A[M-1] == tmp){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(double(A[M-1]) < sum/4.0/M){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 100005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define PI acos(-1.0)
#define eps 1e-9

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;

int Set(int N, int pos){return N=N | (1<<pos);}
int reset(int N, int pos){return N=N & ~(1<<pos);}
bool check(int N, int pos){return (bool)(N & (1<<pos));}

int x[25][25], y[25][25];

int call(int* a, int n)
{
    int ans = 0;
    for(int mask = 1; mask < (1<<n); mask++)
    {
        bool flag = true;
        for(int i = 0; i < n; i++)
        {
            if(!check(mask, i))
                continue;
            for(int j = 0; j < a[i]; j++)
            {
                if((check(mask, x[i][j]-1))!=y[i][j])
                    flag = false;
            }
        }
        if(flag)
            ans = max(ans, __builtin_popcount(mask));
    }
    return ans;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    int n;
    cin>>n;
    int a[n+5];
    for(int i = 0; i < n; i++)
    {
        cin>>a[i];
        for(int j = 0; j < a[i]; j++)
            cin>>x[i][j]>>y[i][j];
    }
    int ans = call(a, n);
    cout<<ans<<endl;

    //End();
    return 0;
}


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

using namespace std;
// using namespace atcoder;

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

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

#endif

vector<ll> divisorsCount(ll n) {
    vector<ll> res(n + 1, 0);
    for (ll i = 1; i <= n; i++) {
        for (ll j = i; j <= n; j += i) {
            res[j]++;
        }
    }
    return res;
}

void solve() {
    ll N;
    cin >> N;
    ll ans = 0;
    auto X = divisorsCount(N);
    rep2(c, 1, N) {
        ll r = N - c;
        ans += X[r];
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 11116
#include <iostream>
#include <vector>
#include <algorithm>

using ll = long long;
using namespace std;

int main()
{
  int N;
  cin >> N;
  vector <ll> a(N);
  for( int i=0;i<N;i++ )
    cin >> a[i];

  ll ans = 0;
  for( int i=0;i<N;i++ )
    ans += a[i]-1;

  cout << ans << endl;

  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=105;
vector<int>b[N],c[N];
int n,T,now,d[N],vi[N],f1[N],f2[N],v[N],nex[N],head[N];
void addedges(int x,int y){
	nex[++now]=head[x],++d[y];
	head[x]=now,v[now]=y;
}
void get1(int x){
	int si=b[x].size();
	for(int i=0;i<si;i++){
		int v=b[x][i];
		if(v!=f1[x])	f1[v]=x,get1(v);
	}
}
void get2(int x){
	int si=c[x].size();
	for(int i=0;i<si;i++){
		int v=c[x][i];
		if(v!=f2[x])	f2[v]=x,get2(v);
	}
}
queue<int>que;
int check(int rt){
	int cnt=0,res=0;
	f1[rt]=0,get1(rt);
	f2[rt]=0,get2(rt);
	for(int i=1;i<=n;i++)	d[i]=head[i]=0;
	for(int i=1;i<=n;i++)
		if(f1[i]==f2[i])	vi[i]=1;
		else	++cnt,++res,vi[i]=0;
	now=0;
	for(int i=1;i<=n;i++){
		addedges(i,f1[i]);
		if(!vi[f2[i]])	addedges(f2[i],i);
	}
	for(int i=1;i<=n;i++)
		if(!d[i]&&!vi[i])	que.push(i);
	while(!que.empty()){
		int x=que.front();
		que.pop();	--cnt;
		for(int j=head[x];j;j=nex[j])
			if(!vi[v[j]]&&!(--d[v[j]]))
				que.push(v[j]);
	}
	if(cnt)	return -1;
	else	return res;
}
void erase(int x,int y){
	for(vector<int>::iterator i=b[x].begin();i!=b[x].end();i++)
		if(*i==y){
			b[x].erase(i);
			return ;
		}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d",&n);
		for(int i=1;i<=n;i++)	b[i].clear(),c[i].clear();
		for(int i=1,x,y;i<n;i++){
			scanf("%d%d",&x,&y);
			b[x].push_back(y);
			b[y].push_back(x);
		}
		for(int i=1,x,y;i<n;i++){
			scanf("%d%d",&x,&y);
			c[x].push_back(y);
			c[y].push_back(x);
		}
		int ans=INT_MAX;
		for(int i=1;i<=n;i++){
			for(int j=1,k;j<=n;j++){
				if(b[j].size()>1||i==j)	continue;
				k=b[j][0],b[j].clear();
				b[j].push_back(i),erase(k,j);

				int d=check(j);
				if(d!=-1)	ans=min(ans,d+1);
				b[j].clear(),b[j].push_back(k),b[k].push_back(j);
			}
			int d=check(i);
			if(d!=-1)	ans=min(ans,d);
		}
		if(ans==INT_MAX)	puts("-1");
		else	printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N,a,b,x,y,i,j,k,l,f,X[15][15];
main(){
    for(cin>>N;i<N;++i){
        for(cin>>b,j=0;j<b;++j){
            cin>>x>>y;
            X[i][x-1]=y+1;
        }
    }
    for(;l<1<<N;a=max(a,__builtin_popcount(l)*!f),++l){
        for(f=j=0;j<N;++j){
            for(k=0;k<N;++k)f|=(l>>j)%2*(b=X[j][k])&&(l>>k)%2!=b-1;
        }
    }
    cout<<a;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; ++i) ans += i * (n - i + 1);
    REP(i, n - 1) {
        ll u, v;
        cin >> u >> v;
        --u; --v;
        if (u > v) swap(u, v);
        ans -= (u + 1) * (n - v);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char a, b;
    cin >> a >> b;
    if(a==b) {
        cout << "H" << endl;
    } else {
        cout << "D" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans, cnt;

vector< ll > divisor(ll n) {
	vector< ll > ret;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}

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

	ll N;
	cin >> N;

	vector<ll>A(N);
	map<ll, ll> m;
	rep(i, N) {
		cin >> A[i];
		m[A[i]]++;
	}

	bool is_ans = false;
	rep(i, N) {
		vector<ll> v;
		v = divisor(A[i]);

		is_ans = true;
		if (m.count(A[i])) {
			if (m[A[i]] >= 2) {
				is_ans = false;
			}
		}

		rep(j, v.size()) {
			// cout << v[j] << " ";
			if (v[j] != A[i] && m.count(v[j])) {
				is_ans = false;
				//cout << v[j] << endl;
				break;
			}
		}
		if (is_ans) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 17176
#include <bits/stdc++.h>
#define ll long long int
#define ii int
#define du double
#define jmp "\n"
#define vl vector<ll>
#define vvl vector<vl>
#define pb push_back
#define printv(v)     \
  for (auto x : v)    \
    cout << x << " "; \
  cout << jmp;
#define vi vector<int>
#define vb vector<bool>
#define SORT(v) sort(v.begin(), v.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define SET(x, a) memset(x, a, sizeof(x))
#define si(x) x.size()
#define ff first
#define ss second
#define iin insert
#define deb(x) cout << "test " << #x << "=" << x << jmp
#define deb2(x, y) cout << "test " << #x << "=" << x << "," << #y << "=" << y << jmp
using namespace std;
const ll nax = 1e5 + 5;
void solve()
{
  string s, t;
  cin >> s >> t;
  ll ss = si(s), tt = si(t);
  ll ans = LLONG_MAX;
  for (ll i = 0; i < (ss - tt + 1); i++)
  {
    ll ctr = tt;
    string co = s.substr(i, tt);

    for (ll j = i, k = 0; k < tt; j++, k++)
    {
      if (s[j] == t[k])
        ctr--;
    }

    ans = min(ctr, ans);
  }

  cout << ans;
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  // cin >> t;
  while (t--)
    solve();
  return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n;cin >> n;
    vector<lint> a(n);
    REP(i, n) { cin >> a[i]; }
    lint ans=100000000;
    FOR(x,-100,101){
        lint dsum = 0;
        REP(i, n)
        {
            dsum += (a[i] - x) * (a[i] - x);
        }
        ans = min(ans, dsum);
        }
    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  int a, b;
  std::cin >> a >> b;
  if (a < b) {
    std::cout << "a < b" << std::endl;
  }
  else if (a > b)
  {
    std::cout << "a > b" << std::endl;
  }
  else
  {
    std::cout << "a == b" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3092
X = int(input())

def is_prime(x):
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    
    rx = int(x ** 0.5)
    for i in range(2, rx + 1):
        if x % i == 0:
            return False
    
    return True

i = 0
while True:
    X2 = X + i
    if is_prime(X2):
        break
    else:
        i = i + 1
    
print(X2)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}



int main(void){
	int n;
	cin>>n;
	map<string,int>m;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC"<<" x "<<m["AC"]<<endl;
	cout<<"WA"<<" x "<<m["WA"]<<endl;
	cout<<"TLE"<<" x "<<m["TLE"]<<endl;
	cout<<"RE"<<" x "<<m["RE"]<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int p[200005], q[200005];

int root(int x) {return p[x] < 0 ? x : p[x] = root(p[x]);}

void mer(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
}

int root2(int x) {return q[x] < 0 ? x : q[x] = root2(q[x]);}

void mer2(int x, int y) {
    if ((x = root2(x)) == (y = root2(y))) return;
    if (q[x] > q[y]) swap(x, y);
    q[x] += q[y];
    q[y] = x;
}

int main() {
    ios::sync_with_stdio(false);
    int n, k, l, u, v;
    cin >> n >> k >> l;
    for (int i = 1; i <= n; i++) p[i] = q[i] = -1;
    while (k--) cin >> u >> v, mer(u, v);
    while (l--) cin >> u >> v, mer2(u, v);
    map<pii, int> m;
    for (int i = 1; i <= n; i++) m[{root(i), root2(i)}]++;
    for (int i = 1; i <= n; i++) cout << m[{root(i), root2(i)}] << ' ';
}


Measured memory_bytes: 13568
type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [for _ in 0 .. n - 1 -> this.NextI32()]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [for _ in 0 .. n - 1 -> this.NextI64()]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [for _ in 0 .. n - 1 -> this.NextF32()]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [for _ in 0 .. n - 1 -> this.NextF64()]

    member public __.Tuple2List n (f : int -> 'a list) =
        [for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]]
    
    member public __.Tuple3List n (f : int -> 'a list) =
        [for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]]

end

[<EntryPoint>]
let main _ =
    let scanner = Scanner()
    let n = scanner.NextI32()
    let t = scanner.NextF64()
    let a = scanner.NextF64()
    let hArr = scanner.ArrayF64(n)

    let temper x = t - x * 0.006
    let answer x =
        let p = a - (temper x)
        if p < 0.0 then p * -1.0 else p
    let arr = [|for item in hArr -> answer item|] 
    let minv = Array.min arr
    
    Array.findIndex ((=) minv) arr
    |> (+) 1
    |> printfn "%i"

    0


Measured memory_bytes: 14300
class atcorder:
    
    class atcorder:

        N,M=map(int,input().split())
        A=[]
        A=list(map(int,input().split()))
        Sum=sum(A)
        i=0
        for n in range(len(A)):
            if A[n]>=Sum/(4*M):
                i+=1
            else:
                continue
        if i>=M:
            print("Yes")
        else:
            print("No")

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

int main(){
  int N;
  cin>>N;
  queue<int> bricks;
  for(int i=0; i<N; i++){
    int a;
    cin>>a;
    bricks.push(a);
  }
  int max=0;
  bool dame=true;
  while(!bricks.empty()){
  if(bricks.front()==max+1){
    max++;
    dame=false;
  }
    bricks.pop();
  }
  if(dame) cout<<-1<<endl;
  else cout<<N-max<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, Y;
    cin >> N >> Y;

    vector<int> ans(3, -1);
    REP(i, N + 1){
        REP(j, N + 1 - i){
            int k = N - (i + j);
            int tmp = 10000 * i + 5000 * j + 1000 * k;
            if(tmp == Y){
                ans[0] = i;
                ans[1] = j;
                ans[2] = k;
                break;
            }
        }
    }

    cout << ans[0] << " " << ans[1] << " " << ans[2];
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

int main() {
  string s, t;
  cin >> s >> t;
  vector<char> vecs(s.size()), vect(t.size());
  for(int i=0; i<s.size(); i++){
    vecs[i]=s[i];
  }
  for(int i=0; i<t.size(); i++){
    vect[i]=t[i];
  }
  
  sort(vecs.begin(),vecs.end());
  sort(vect.begin(),vect.end());
  reverse(vect.begin(),vect.end());
  for(int i=0; i<s.size(); i++){
    s[i] = vecs[i];
  }
  for(int i=0; i<t.size(); i++){
    t[i]=vect[i];
  }
  
  if(s<t) cout << "Yes" << endl;
  else cout << "No" << endl;
  

}

Measured memory_bytes: 256