akhauriyash/Code-Regression huggingface dataset:
n=int(input())
a,b=0,0
for i in range(n):
    l=list(input().split())
    l1=sorted(l)
    if l[0]==l[1]:
        a +=1
        b +=1
    elif l[0]==l1[0]:
        b += 3
    else:
        a +=3
print(a,b)


Measured memory_bytes: 5600
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        for(int i = 0 ; i < m ; i++ ){
            x[i] = sc.nextInt();
        }
        sc.close();
        if(n >= m){
            System.out.println(0);
        }else{
            Arrays.sort(x);
            int[] y = new int[m - 1];
            for(int i = 0 ; i < m - 1 ; i++ ){
                y[i] = x[i + 1] - x[i];
            }
            Arrays.sort(y);
            for(int i = 1 ; i < m - n; i++ ){
                y[0] += y[i];
            }
            System.out.println(y[0]);
        }
    }
}

Measured memory_bytes: 58948
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;

ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    COMinit();
    ll n,k;
    cin >> n >> k;
    if (k >= n-1) k = n-1;
    ll ans = 1;
    rep(i,1,k+1){
        ans += COM(n-1,n-i-1)*COM(n,n-i);
        ans %= MOD;
    }
    PRINT(ans);
}


Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
  int n, k; cin >> n >> k;
  int h[200000]; for (int i = 0; i < n; ++i) cin >> h[i];
  
  sort(h, h+n);
  
  long long sum = 0;
  if (n > k) for (int i = 0; i < n-k; ++i) sum += h[i];
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <tuple>
using namespace std;
    #define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
    #define ll long long
    #define int long long 
    #define ull unsigned long long 
    #define ld long double
    #define sb __builtin_popcount
    #define vi vector<int>
    #define vc vector<char>
    #define ii pair<int, int>
    #define pq priority_queue<ii, vector<ii>, greater<ii>>
    #define vii vector<ii>
    #define sz(a) int((a).size())
    #define f(a, b) for (int i = a; i < b; i++)
    #define fr(a, b) for (int i = a - 1; i >= b; i--)
    #define tr(x, m) for (auto x : m)
    #define in(a, b) (b.find(a) != string::npos)
    #define minin(a) *min_element(all(a))
    #define maxin(a) *max_element(all(a))
    #define X first
    #define Y second
    #define fill(a, x) memset(a, x, sizeof(a))
    #define pb push_back
    #define pf push_front
    #define mp make_pair
    #define all(v) v.begin(), v.end()
    #define rall(v) reverse(v.begin(), v.end())
    #define unq(v) v.erase(unique(all(v)), v.end())
    #define el "\n"
    #define mx3(a, b, c) max(max(a, b), c)
    #define mn3(a, b, c) min(min(a, b), c)
    #define S(v) accumulate(all(v), (ll)0)
    #define SP(n) cout.precision(n)
    const ld PI = atan(1.0) * 4.0;
    const ll MOD = 1e9 + 7;
    const ll INF = 1e18;
    const ld EPS = 0.0000001;
    const ll MD = 998244353;
   
    int32_t main() {
        fio;
        int n,k;
        cin>>n>>k;
        int x;
        unordered_map<int,int> mp;
        vector<int> v[n+1];
        for(int i=1;i<=n;i++){
             cin>>x;
             mp[i]=x;
        }
        int a,b;
        for(int i=0;i<k;i++){
             cin>>a>>b;
             v[a].pb(b);
             v[b].pb(a);
        }
        int cnt=0;
        for(int i=1;i<=n;i++){
                int g=1;
                for(int j=0;j<v[i].size() && g;j++){
                     if(mp[v[i][j]]>=mp[i]){
                         g=0;
                         break;
                     }
                }
                if(g)cnt++;
        }
        cout<<cnt<<el;
        return 0;
    }


Measured memory_bytes: 13124
#include<iostream>
#include<algorithm>
using namespace std;
struct State { int x[5][5]; };
int n, b[6];
pair<State, int>del(State S) {
	bool used[5][5]; for (int i = 0; i < 25; i++)used[i / 5][i % 5] = false;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 3; j++) {
			if (S.x[i][j] == S.x[i][j + 1] && S.x[i][j] == S.x[i][j + 2] && S.x[i][j] >= 1) {
				for (int k = j; k < j + 3; k++)used[i][k] = true;
			}
			if (S.x[j][i] == S.x[j + 1][i] && S.x[j][i] == S.x[j + 2][i] && S.x[j][i] >= 1) {
				for (int k = j; k < j + 3; k++)used[k][i] = true;
			}
		}
	}
	int cnt = 0, u = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) { if (used[i][j] == true) { cnt += b[S.x[i][j]]; S.x[i][j] = 0; u++; } }
	}
	if (u == 0)cnt = -1;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 5; k++) {
				if (S.x[j][k] >= 1 && S.x[j + 1][k] == 0)swap(S.x[j][k], S.x[j + 1][k]);
			}
		}
	}
	return make_pair(S, cnt);
}
int dfs(State S, int depth, int cx, int cy) {
	if (depth == n) {
		int d = 1, c = 0;
		while (true) {
			pair<State, int>G = del(S);
			if (G.second == -1)return c;
			c += d*G.second; S = G.first; d++;
		}
	}
	int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }, maxn = 0;
	for (int i = 0; i < 4; i++) {
		int ex = cx + dx[i], ey = cy + dy[i];
		if (ex < 0 || ex >= 5 || ey < 0 || ey >= 5)continue;
		State T = S; swap(T.x[ex][ey], T.x[cx][cy]);
		maxn = max(maxn, dfs(T, depth + 1, ex, ey));
	}
	return maxn;
}
int main() {
	while (true) {
		cin >> n; if (n == -1)break; State V;
		for (int i = 0; i < 25; i++)cin >> V.x[i / 5][i % 5];
		for (int i = 1; i <= 5; i++)cin >> b[i];
		int ret = 0; for (int i = 0; i < 25; i++) { for (int j = 0; j <= n; j++)ret = max(ret, dfs(V, j, i / 5, i % 5)); }
		cout << ret << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){
  
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<int> p(a),q(b),r(c);
  REP(i,a)cin >> p[i];
  REP(i,b)cin >> q[i];
  REP(i,c)cin >> r[i];
  sort(ALL(p),greater<int>());
  sort(ALL(q),greater<int>());
  priority_queue<int,vector<int>,less<int>> que;
  for(int i = 0;i < x;i++)que.push(p[i]);
  for(int i = 0;i < y;i++)que.push(q[i]);
  for(auto au : r)que.push(au);
  ll res = 0;
  for(int i = 0;i < x+y;i++){
    res += que.top();
    que.pop();
  }
  cout << res << endl;

  



  return 0;
}


Measured memory_bytes: 3572
import java.util.*;

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

        int[][] parent = new int[30][N];
        for (int i=0;i<N;i++) {
            parent[0][i] = ~Arrays.binarySearch(x, x[i]+L, (o1, o2)->o1>o2?1:-1)-1;
        }
        for (int j=0;j<29;j++) {
            for (int i=0;i<N;i++) {
                if (parent[j][i]!=N-1) {
                    parent[j+1][i] = parent[j][parent[j][i]];
                } else {
                    parent[j+1][i] = N-1;
                }
            }
        }
        // System.out.println(Arrays.deepToString(parent));
        int Q = sc.nextInt();
        for (int i=0;i<Q;i++) {
            int a = sc.nextInt()-1;
            int b = sc.nextInt()-1;
            if (a>b) {
                int tmp = a;
                a = b;
                b = tmp;
            }
            int ok = 1_000_000;
            int ng = -1;
            while (Math.abs(ok-ng)>1) {
                int mid = (ok+ng)/2;
                int tmp = a;
                for (int j=0;j<25;j++) {
                    if ((mid&(1<<j))==(1<<j)) {
                        if (tmp!=N) tmp = parent[j][tmp];
                    }
                }
                if (tmp>=b) {
                    ok = mid;
                } else {
                    ng = mid;
                }
            }
            System.out.println(ok);
        }
    }
}

Measured memory_bytes: 118236
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    double A,B,H,M;
    double temp =0,result = 0,kakudo=0,radians=0,tankakudo=0,chokakudo=0;
    const double PI = acos(-1);
    cin >> A >> B >> H >> M;

    tankakudo = 30 * H + (30 * M / 60);

    chokakudo = 6 * M;

    kakudo = abs(tankakudo - chokakudo);

    if (kakudo == 180) {
        result = A + B;
        cout << fixed << setprecision(20) << result << endl;
        return 0;
    }
    else if (kakudo >= 180) {
        kakudo = 360 - kakudo;
    }

    radians = kakudo * PI / 180;
    temp = pow(A,2) + pow(B,2) - (2*A*B*cos(radians));

    result = sqrt(temp);

    cout << fixed << setprecision(10) << result << endl;

    return 0;
}

Measured memory_bytes: 4216
#include<stdio.h>
#include<stdbool.h>
#include<math.h>
#include<string.h>

#define M 100000

typedef struct q{
  char name[10];
  int v;
} q;


int head,tail,n;
q Q[M];
q A;


bool isEnpty(){
  if(tail == head) true;
  else false;
}

int min(int a, int b){
  return a<b?a:b;
}

void enqueue(q x){
  Q[tail] = x;
  if(tail+1 == M) tail = 0;
  else tail = tail +1;
}
			  
q dequeue(q *Q){
  q x;
  x = Q[head];
  if(head+1 == M) head = 0;
  else head = head +1;
  return x;
}


int main(){

  int i,value,x,y,total=0,k=0;


  scanf("%d%d",&n, &value);

  head = 1;
  tail = n+1;

  for(i=1;i<=n;i++){
    scanf("%s%d",Q[i].name,&Q[i].v);
  }

  while(head != tail){


    A = dequeue(Q);
    k = min(value,A.v);
    A.v -= k;
    total += k;
    if(A.v > 0) enqueue(A);
    else printf("%s %d\n",A.name,total);
      
  }
  
    
  return 0;
}



Measured memory_bytes: 3244
import itertools
import collections
N = int(input())
S = [[str(x) for x in input()] for _ in range(N)]
S = [''.join(sorted(x)) for x in S]

cnt=0
reg = collections.defaultdict(int)
for s in S:
    reg[s] += 1
    if reg[s] > 1:
        cnt += reg[s] - 1
print(cnt)

Measured memory_bytes: 31792
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val a = cin.nextInt() - 1
    val b = cin.nextInt() - 1
    val c = cin.nextInt() - 1
    val d = cin.nextInt() - 1
    val s = cin.next()

    var ok = true
    if (d > c) {
        for (i in a..d-1) {
            if (s[i] == '#' && s[i+1] == '#') {
                ok = false
                break
            }
        }
    } else {
        var exist_triple = false
        for (i in a..c-1) {
            if (s[i] == '#' && s[i+1] == '#') {
                ok = false
                break
            }  
            if (i >= b && d >= i) {
                if (s[i] == '.' && s[i+1] == '.' && s[i-1] == '.') {
                    exist_triple = true
                }
            }    
        }
        if (!exist_triple) {
            ok = false
        }
    }
    if (ok) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 33900
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, m, q;
    cin >> n >> m >> q;
    vector<int> a(q), b(q), c(q), d(q);
    for(int i = 0; i < q; ++i){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i], --b[i];
    }
    int ans = 0;
    vector<int> data;
    auto dfs = [&](auto&& self) -> void {
        if(data.size() == n){
            int sum = 0;
            for(int i = 0; i < q; ++i){
                if(data[b[i]] - data[a[i]] == c[i]) sum += d[i];
            }
            chmax(ans, sum);
            return;
        }
        int st;
        if(!data.size())    st = 1;
        else    st = data.back();
        for(int i = st; i <= m; ++i){
            data.push_back(i);
            self(self);
            data.pop_back();
        }
        return;
    };
    dfs(dfs);
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  int Original = N;
  int sum = 0;
  while(N>0){
	sum += N%10;
    N /=10;
  }
  
  if (Original%sum == 0){
    cout << "Yes"<< endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=200001;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    ll i,j,k,n,a[N],r=1;

    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==r)
            r++;
    }
    if(r==1){
        cout<<"-1\n";
        return 0;
    }
    r--;
    cout<<n-r<<"\n";




    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    vector<vector<ll>> dp(N+1,vector<ll>(K+1,0));
    dp[0][0]=1;
    rep(i,N){
        vector<ll> until(K+2);
        until[0]=0;
        rep2(j,1,K+2) until[j]=(until[j-1]+dp[i][j-1])%MOD;
        rep(j,K+1) dp[i+1][j]=(until[j+1]-until[max((ll)0,j-a[i])]+MOD)%MOD;
    }
    cout << dp[N][K] << endl;
}

Measured memory_bytes: 80256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int a = ni();
		int b = ni();

		if (a == b) {
			out(a * 2);
		} else {
			out(max(a, b) * 2 - 1);
		}

	}

	/*
	 * 以下メソッド集
	 */

	static int abcount(String str) {
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if ("AB".equals(str.substring(i, i + 2))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


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

int main() {

  long N;
  cin>>N;
  long ans=0;
  for(int i=1;i<=N;i++){

    if(i%3==0) continue;
    if(i%5==0) continue;
    ans+=i;
  }
cout<<ans<<endl;
}


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

struct ope{
	int b;
	int c;
};

bool comp(ope& ope1, ope& ope2){
	if(ope1.c != ope2.c) return ope1.c > ope2.c;
	return ope1.b > ope2.b;
}


int main(){
	
	int n,m;
	cin >> n >> m;
	
	priority_queue<int,vector<int>,greater<int>> aque;
	rep(i,n){
		int tmp;
		cin >> tmp;
		aque.push(tmp);
	}
	
	vector<ope> opes(m);
	rep(i,m){
		int b,c;
		cin >> b >> c;
		opes[i] = ope{ b, c };
	}
	
	sort(opes.begin(), opes.end(), comp);
	
	vector<int> insnum;
	rep(i,opes.size()){
		rep(j,opes[i].b){
			if(insnum.size() < n) insnum.push_back(opes[i].c);
		}
		
		if(insnum.size() >= n) break;
	}
	
	rep(i,insnum.size()){
		if(aque.top() < insnum[i]){
			aque.pop();
			aque.push(insnum[i]);
		}
	}
	
	ll res = 0;
	while(!aque.empty()){
		res += (ll) aque.top();
		aque.pop();
	}
	
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 2168
import java.util.*;
    import java.io.*;
     
     
    public class Main{
     
         public static void main(String []args){
            Scanner scanner = new Scanner(System.in);
           int n = scanner.nextInt();
           int [] arr = new int[n];
           
       
         
           
           for(int i=0;i<n;i++)
           arr[i] = scanner.nextInt();
           
           Arrays.sort(arr);
           
           long min =(long)Math.pow(10,7);
           long index=0;
          
            for(int i=arr[0];i<=arr[n-1];i++)
            {
                long sum=0;
                for(int j=0;j<n;j++)
                {
                    sum=sum+(long) Math.pow((arr[j]-i),2);
                   
                }
                 if(sum<min){
                    min=sum;
                    index=sum;
                 }
                
            }
            
            System.out.println(index);
            
            
        
            
            //System.out.println()
            //for(int i=0;i<n;i++)
         }
    }

Measured memory_bytes: 35892
from operator import itemgetter
n, m = map(int, input().split())
a = []
ans = 0
many = m
for i in range(n):
    a.append(list(map(int, input().split())))
a.sort(key=itemgetter(0))
for i in range(m):
    if a[i][1] < many:
        ans += (a[i][0])*(a[i][1])
        many = many-a[i][1]
    else:
        ans += a[i][0]*many
        print(ans)
        break


Measured memory_bytes: 28972
$%=1e9+7;
$N=<>-3;
@_=[(1)x64];
$_[0][0b011000]=0;
$_[0][0b100100]=0;
$_[0][0b010010]=0;
for$i(1..$N){
	for$j(0..63){
		for$k(0..3){
			$t=$k<<4|$j>>2;
			next if$t==0b011000||$t==0b100100||$t==0b010010;
			next if($j&0b001111)==0b001000&&$k==0b01;
			next if($j&0b110011)==0b100000&&$k==0b01;
			($_[$i][$t]+=$_[$i-1][$j])%=$%
		}
	}
}
$x=($x+$_)%$%for@{$_[$N]};
print$x,$/


Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
using namespace std;
#define sd(n) scanf("%d", &n)
#define sdd(n, m) scanf("%d%d", &n, &m)
#define sddd(n, m, k) scanf("%d%d%d", &n, &m, &k)
#define pd(n) printf("%d\n", n)
#define pc(n) printf("%c", n)
#define pdd(n, m) printf("%d %d\n", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n, m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld", &n)
#define sldd(n, m) scanf("%lld%lld", &n, &m)
#define slddd(n, m, k) scanf("%lld%lld%lld", &n, &m, &k)
#define sf(n) scanf("%lf", &n)
#define sc(n) scanf("%c", &n)
#define sff(n, m) scanf("%lf%lf", &n, &m)
#define sfff(n, m, k) scanf("%lf%lf%lf", &n, &m, &k)
#define ss(str) scanf("%s", str)
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = a; i >= n; i--)
#define mem(a, n) memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mod(x) ((x) % MOD)
#define gcd(a, b) __gcd(a, b)
#define lowbit(x) (x & -x)
typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
inline int read()
{
    int ret = 0, sgn = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            sgn = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        ret = ret * 10 + ch - '0';
        ch = getchar();
    }
    return ret * sgn;
}
inline void Out(int a) //ê?3?ía1ò
{
    if (a > 9)
        Out(a / 10);
    putchar(a % 10 + '0');
}

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

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
///快速幂m^k%mod
ll qpow(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    ll res = qpow((x * x) % mod, n / 2, mod) % mod;
    if (n & 1)
        res = (res * x) % mod;
    return res % mod;
}
// 快速幂求逆元
int Fermat(int a, int p) //费马求a关于b的逆元
{
    return qpow(a, p - 2, p);
}

///扩展欧几里得
ll exgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1;
        y = 0;
        return a;
    }
    ll g = exgcd(b, a % b, x, y);
    ll t = x;
    x = y;
    y = t - a / b * y;
    return g;
}

int n, m, k;
int res, cnt, ans;
const int N = 4e5 + 10;
string s;

int main()
{
    cin >> s;
    int cnt1 = 0;
    int cnt2 = 0;
    rep(i, 0, 2)
    {
        if (s[i] == 'A')
            cnt1++;
        else
            cnt2++;
    }
    if (cnt1 &&cnt2 )
        puts("Yes");
    else
        puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main () {
  int N, Y;
  cin >> N >> Y;
  for (int i = 0; i <= N; i ++) {
    for (int j = 0; j <= N - i; j ++) {
      int k = N - i - j;
      if (10000 * i + 5000 * j + 1000 * k == Y) {
        cout << i << ' ' << j << ' ' << k << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}
  


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

int main(){
    int x,ans=0;
    cin >> x;
    int a=sqrt(x);
    if(a<2)cout << 1 << endl;
    else{
        for(int i=2;i<=a;i++){
            int tmp=1;
            while(true){
                if(tmp*i<=x)tmp*=i;
                else{break;}
            }
            //cout << tmp << endl;
            if(ans<tmp)ans=tmp;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int point=0;
  
  for(int i=0; i<n; i++){
    if(i%2 == 0){
      point += a.at(i);
    }
    else{
      point -= a.at(i);
    }
  }
  
  cout << point << endl;
	return 0;
}


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

using namespace std;
int main(){
	int n;
	cin>>n;
	double ans=0.0;
	for(int i=0;i<n;i++){
		double m;
		string s;
		cin>>m>>s;
		if(s=="JPY")ans+=m;
		else ans+=m*380000;
	}printf("%f",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}


int main(){
  int n;
  cin>>n;
  string s[n];
  for(int i = 0; i < n; i++){
    cin>>s[i];
    sort(s[i].begin(),s[i].end());
  }
  sort(s,s+n);
  ll sum=0;
  ll tmp=1;
  
  for(int i = 0; i < n-1; i++){
    if(s[i]==s[i+1]){
      tmp++;
    }
    else{
      if(tmp!=1){
        sum+=tmp*(tmp-1)/2;
      }
      tmp=1;
    }
  }
  if(tmp!=1){
        sum+=tmp*(tmp-1)/2;
      }
  cout<<sum<<endl;
  
  return 0;
}

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

int main(){
    int n; cin >> n;
    ll h[n];

    int max = 0;
    int count = 0;
    for (int i=0;i<n;i++){
        cin >> h[i];

        if (i==0){
            continue;
        }

        if (h[i-1] >= h[i]){
            count++;
        } else {
            count = 0;
        }
        
        if (count > max){
             max = count;
        }
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 1024
a_list = input().split()
n = len(a_list)

a_stack = []
for i in range(n):
    a_stack.append(a_list[i])
    if a_list[i] == "+" :
        t = int(a_stack[-3] ) + int(a_stack[-2])
        del a_stack[-3:]
        a_stack.append(t)
    if a_list[i] == "-" :
        t = int(a_stack[-3] ) - int(a_stack[-2])
        del a_stack[-3:]
        a_stack.append(t)
    if a_list[i] == "*" :
        t = int(a_stack[-3] ) * int(a_stack[-2])
        del a_stack[-3:]
        a_stack.append(t)
print(a_stack[0])


Measured memory_bytes: 5600
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
s = input()

if s[0] == s[1] == s[2]:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 2940
package main

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

const maxBits = 50

func main() {
	N, K := ReadInt(), ReadInt()
	A := ReadInts(N)
	c := make([]int, maxBits)
	for i := 0; i < N; i++ {
		a := A[i]
		j := 0
		for a > 0 {
			if a&1 == 1 {
				c[j]++
			}
			a >>= 1
			j++
		}
	}
	t := make([]int, maxBits)
	for i := 0; i < maxBits; i++ {
		if N-c[i] > c[i] {
			t[i] = 1
		}
	}
	k := make([]int, maxBits)
	v := K
	i := 0
	for v > 0 {
		if v&1 == 1 {
			k[i]++
		}
		v >>= 1
		i++
	}

	equal := true
	x := 0
	for i := maxBits - 1; i >= 0; i-- {
		if !equal {
			x |= t[i] << i
			continue
		}

		if k[i] == t[i] {
			x |= t[i] << i
			continue
		}

		if k[i] < t[i] {
			continue
		}

		equal = false
	}

	ans := 0
	for i := 0; i < N; i++ {
		ans += x ^ A[i]
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

int main()
{
    string s;
    cin >> s;
    int n0 = 0, n1 = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if (i % 2 == 0)
        {
            if (s[i] == '0')
                n1++;
            else
                n0++;
        }
        else
        {
            if (s[i] != '0')
                n1++;
            else
                n0++;
        }
    }
    cout << min(n0, n1) << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
    int n,k,q,tem;
    int i,l; //loop
    scanf("%d %d %d", &n,&k,&q);
    int player[n];
    for(i=0;i<n;i++){
        player[i]=0;
    }
    for(l=0;l<q;l++){
        scanf("%d", &tem);
        player[tem-1]++;

    }

    for(i=0;i<n;i++){
        player[i] = k-(q-player[i]);

        if(player[i] > 0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }

    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <list>
#include <iomanip>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
int w[1005];
int dp[1005][1005];
int n;
int rec(int l,int r)
{
  if(dp[l][r]!=-1) return dp[l][r];
  if(abs(l-r)<=1) return 0;
  int res=0;
  if(abs(w[l]-w[r-1])<=1 && rec(l+1,r-1)==r-l-2)
    {
      res=r-l;
    }
  for(int mid=l+1;mid<=r-1;mid++)
    {
      res=max(res,rec(l,mid)+rec(mid,r));
    }
  return dp[l][r]=res;
}

int main(void)
{
  while(cin >> n && n)
    {
      memset(dp,-1,sizeof(dp));
      memset(w,0,sizeof(w));
      for(int i=0;i<n;i++)
	{
	  cin >> w[i];
	}
      cout << rec(0,n) << endl;
    }
  return 0;
}



Measured memory_bytes: 7064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = x;

		if(x == 2) {
			System.out.println(2);
			System.exit(0);
		}else if(x == 3) {
			System.out.println(3);
			System.exit(0);
		}

		if(y % 2 == 0) {
			y++;
		}

		int n = 3;
		while(n <= x) {
			boolean b = true;
			for(int i = 3; i * i < y; i += 2) {
				if(y % i == 0) {
					b = false;
					break;
				}
			}
			if(b) {
				System.out.println(y);
				System.exit(0);
			}
			y += 2;
		}
		sc.close();
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n,x; cin>>n>>x;
	vi v(n);
	rep(i,0,n) cin>>v[i];
	int ans=0;
	sort(all(v));
	rep(i,0,n){
		if(x-v[i]<0){
			cout<<ans<<endl;
			return 0;
		}
		ans++;
		x-=v[i];
	}
	ans+=(x/v[0]);
	cout<<ans<<endl;
		
	return 0;
}

Measured memory_bytes: 3628
import collections

n=int(input())
v = list(map(int, input().split()))


odd=collections.Counter(v[::2])
even = collections.Counter(v[1::2])

if len(odd)==1 and len(even)==1 and odd.most_common()[0]==even.most_common()[0]:
	print(n//2)
elif odd.most_common()[0][0]==even.most_common()[0][0]:
	if len(odd)==1:
		print((n//2-odd.most_common()[0][1])+(n//2-even.most_common()[1][1]))
	elif len(even)==1:
		print((n//2-odd.most_common()[1][1])+(n//2-even.most_common()[0][1]))
	else:
		print(min((n//2-odd.most_common()[0][1])+(n//2-even.most_common()[1][1]), (n//2-odd.most_common()[1][1])+(n//2-even.most_common()[0][1])))
else:
	print((n//2-odd.most_common()[0][1])+(n//2-even.most_common()[0][1]))


Measured memory_bytes: 18656
x=input()

x=int(x)
if 400<=x<=599:
  print(8)
elif 600<=x<=799:
  print(7)
elif 800<=x<=999:
  print(6)
elif 1000<=x<=1199:
  print(5)
elif 1200<=x<=1399:
  print(4)
elif 1400<=x<=1599:
  print(3)
elif 1600<=x<=1799:
  print(2)
elif 1800<=x<=1999:
  print(1)

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

const static ll MOD = (1e+9)+7;

ll modpow(ll a,ll n){
    if(n==0)return 1;
    if(n%2==1)return a*modpow(a,n-1)%MOD;
    ll t = modpow(a,n/2) % MOD;
    return t*t % MOD;
}

int main(){
    ll a,b,n;cin>>a>>b>>n;
    if(n >= b){
        cout<<a*(b-1)/b<<endl;
    }else{
        cout<<a*n/b<<endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long long int INF = 1000000000000000200;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<long long int>v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	cin >> M >> K;
	vector<vector<pair<int, int>>>tap(N - 1, vector<pair<int, int>>(64));
	for (int i = 0; i < N - 1; i++) {
		tap[i][0].first = v[i + 1] - v[i];
		tap[i][0].second = i;
	}
	for (int i = 0; i < M; i++) {
		cin >> L;
		L -= 2;
		swap(tap[L][0], tap[L + 1][0]);
	}
	for (int j = 1; j < 64; j++) {
		for (int i = 0; i < N - 1; i++) {
			tap[i][j] = tap[tap[i][j - 1].second][j - 1];
		}
	}
	long long int ans = v[0];
	cout << ans << endl;
	for (int i = 0; i < N - 1; i++) {
		long long int fig = i;
		for (int j = 0; j < 64; j++) {
			if (K >> j & 1) {
				fig = tap[fig][j].second;
			}
		}
		ans += v[fig + 1] - v[fig];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 55936
#include <iostream>
#include <vector>
#include <algorithm>
const int MAX_V = 100;
const int INF = (1 << 30);
using namespace std;

struct edge { int to, cap, rev; };
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap) {
    G[from].push_back((edge){to, cap, int(G[to].size())});
    G[to].push_back((edge){from, 0, int(G[from].size())-1});
}

int dfs(int v, int t, int f) {
    if (v == t) return f;
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t) {
    int flow = 0;
    while (1) {
        fill(used, used+MAX_V, false);
        int f = dfs(s, t, INF);
        if (f == 0) return flow;
        flow += f;
    }
}

int main(void) {

    int V, E; cin >> V >> E;
    for (int i = 0; i < E; i++) {
        int u, v, c; cin >> u >> v >> c;
        add_edge(u, v, c);
    }

    cout << max_flow(0, V-1) << endl;

    return 0;
}

Measured memory_bytes: 3192
/*
 * Author : Sadi
 * Fri 03/07/2020 * 18:09:36.25
 */
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int x;
    cin >> x;
    if(x == 7 or x == 5 or x == 3) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 3656
import numpy as np

N, M = map(int, input().split())

A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])

T = N - M + 1

for i in range(T):
    for j in range(T):
        if np.sum(A[i:i+M, j:j+M] == B) == M ** 2:
            print('Yes')
            exit(0)
print('No')

Measured memory_bytes: 12440
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <math.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define str string
#define deb_arr(arr,n) for(ll i=0;i<(n);i++){ cout << (arr)[i] << " ";}
#define in_arr0(arr,n) for(ll i=0;i<(n);i++){ cin >> (arr)[i]; }
#define in_arr1(arr,n) for(ll i=1;i<=(n);i++){ cin >> (arr)[i];}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define vll vector<ll> 
#define fr(n) for(i=0;i<(n);i++)
#define fr1(n) for(i=1;i<=(n);i++)
#define pll pair<ll,ll>
#define f first
#define s second
#define vpll vector<pll>
#define ump unordered_map
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define debb(x) cout << (x) << endl
#define IN(a,b) ((a).find(b)!=(a).end())
#define pb push_back
#define mkp make_pair
#define PI M_PI
#define INF 1e18
#define deb(x) if(ON) cout << #x <<" : " << x << endl
#define fast ios_base::sync_with_stdio(false)
#define io cin.tie(NULL),cout.tie(NULL)
#define ON !false
ll dx[]={0,-1,0,1};
ll dy[]={1,0,-1,0};
const ll mod=1e9+7;
inline ll add(ll a,ll b){
    return  ((a%mod)+(b%mod)+mod)%mod;
}
inline ll mul(ll a,ll b){
    return ((a%mod)*(b%mod)+mod)%mod;
}
void pause(ll id){
    cout << "Waiting " << id << endl;
    cin >> id;
}

const int mxn=1e5+10;


void init(){

    return ;
}


signed main(){
    fast;
    io;
    if(!true){
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    }
    init();
    ll i,j;
    // iota(itf,its) ;
    // n=unique(a+1,a+1+n,n)-(a+1);


    string s,t;
    cin >> s >> t;
    ll n=s.size();
    ll m=t.size();
    ll ans=m;
    for(i=0;i<n;i++){
    	j=(i+t.size()-1);
    	if(j >= n){
    		break;
    	}
    	string ok=s.substr(i,m);
    	j=0;
    	ll cnt=0;
    	for(j=0;j<m;j++){
    		if(ok[j]!=t[j]){
    			cnt++;
    		}
    	}
    	ans=min(ans,cnt);
    }
    debb(ans);

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;
#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<" "
#define pr2(a,b)    cout<<a<<" "<<b<<" "
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void minize(ll& a,ll b){a=(a>b?b:a);};
inline void maxize(ll& a,ll b){a=(a<b?b:a);};
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll arr[MAXN+5],dp[100][100];

ll Solves(){
	
	ll n,k,cnt=0,ans=oo,x,y,q,c,sum=0,v,t;
	// PROCESSING IN HERE
	cin>>arr[1]>>arr[2]>>arr[4]>>arr[8];
	sc(n);
	n*=4;
	fu(i,1,16)dp[0][i]=oo;
	fu(i,1,8){
		if(log2(i)!=(ll)log2(i))continue;
		
		fu(j,1,16){
			dp[i][j]=dp[i>>1][j];
			if(j>=i)minize(dp[i][j],min(dp[i][j-i]+arr[i],dp[i>>1][j-i]+arr[i]));
		}
	}
	
	if(n<=16)pr(dp[8][n]);
	else{
		pr(dp[8][8]*(n/8)+dp[8][n%8]);
	}
	
	

	re 0;
	// Hack it if you can :)
}

int main(){
//	INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	ll test;
//	sc(test);
//	fu(T,1,test+1)
	Solves();
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
ll INF = 1LL << 60;

template< typename T >
struct Edge {
  int from, to;
  T cost;
  Edge() {}
  Edge(int f, int t) : from(f), to(t), cost(1) {}
  Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

template< typename T >
using Edges = std::vector< Edge< T > >;
template< typename T >
using Graph = std::vector< Edges< T > >;

bool ok1[2500]; // 1からたどりつけるならtrue
bool okn[2500]; // nにたどりつけるならtrue
bool ok[2500]; // ok1 & okn
Graph<ll> g(2500);
Graph<ll> rg(2500);
int n;

void bfs1() {
  vector<bool> visit(n, false);
  visit[0] = true;
  queue<int> q;
  q.push(0);
  while (!q.empty()) { 
    int fr = q.front(); q.pop();
    ok1[fr] = true;
    for (auto &e : g[fr]) { 
      if (visit[e.to]) continue;
      visit[e.to] = true;
      q.push(e.to);
    }
  }
}

void bfsn() {
  vector<bool> visit(n, false);
  visit[n-1] = true;
  queue<int> q;
  q.push(n-1);
  while (!q.empty()) { 
    int fr = q.front(); q.pop();
    okn[fr] = true;
    for (auto &e : rg[fr]) { 
      if (visit[e.to]) continue;
      visit[e.to] = true;
      q.push(e.to);
    }
  }
}

ll bellman_ford() {
  vector<ll> dist(n, INF);
  dist[0] = 0;
  for (int k = 0; k < n; ++k) {
    for (int v = 0; v < n; ++v) {
      if (dist[v] == INF) continue;
      if (!ok[v]) continue;
      for (auto &e: g[v]) {
        if (!ok[e.to]) continue;
        if (dist[e.to] > dist[v]+e.cost) { 
          // cerr << v << " " << e.to << " " << dist[v] << " " << e.cost << endl;
          dist[e.to] = dist[v] + e.cost;
          if (k == n-1) return -1;
        }
      }
    }
  }
  return max((ll)0, -dist[n-1]);
}

int main() {
  int m, p; cin >> n >> m >> p;
  for (int i = 0; i < m; ++i) { 
    int a, b, c; cin >> a >> b >> c;
    --a; --b;
    g[a].emplace_back(a, b, p-c);
    rg[b].emplace_back(b, a, p-c);
  }
  bfs1(); bfsn();
  for (int i = 0; i < n; ++i) {
    ok[i] = ok1[i] & okn[i];
    // cerr << i << " " << ok[i] << endl;
  }
  ll ans = bellman_ford();
  cout << ans << endl;
}



Measured memory_bytes: 640
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if (N - r*R - g*G) % B == 0 and N - r*R - g*G >= 0:
            ans += 1
print(ans)


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

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

    int n, m, x;
    cin >> n >> m >> x;

    int road[n+1] = {0};
    rep(i, m) {
        int a;
        cin >> a;
        road[a-1] = 1;
    }
    
    int l = 0;
    int r = 0;

    rep(i, n+1){
        if(i<x) l += road[i];
        else r += road[i];
    }
    cout << min(l, r) << endl;

}

Measured memory_bytes: 256
h,w=map(int,input().split())
*l,=eval("input(),"*h)
row=[any(l[i][j]=="#" for i in range(h)) for j in range(w)]
col=["#" in l[i] for i in range(h)]
for i in range(h):
	f=0
	for j in range(w):
		if row[j]&col[i]:
			print(l[i][j],end="")
			f=1
	if f:
		print("")

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/22  Problem: ABC 051 B / Link: http://abc051.contest.atcoder.jp/tasks/abc051_b  ----- */


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

	LL K, S; cin >> K >> S;
	
	LL ans = 0LL;
	FOR(i, 0, K + 1) {
		FOR(j, 0, K + 1) {
			LL k = S - (i + j);
			ans += k >= 0 && k<=K;
		}
	}
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())

    N, M = min(N, M), max(N, M)
    if N == M == 1:
        ans = 1
    elif N == 1:
        ans = M - 2
    else:
        ans = (N - 2) * (M - 2)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940