akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <queue>
#include <vector>
#include <utility>
#include <algorithm>

#define lli long long int
#define ll pair<lli, lli>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int main() {
	lli n, m, a, b, c, sum = 0;
	ll p[100010];
	priority_queue<lli, vector<lli>, greater<lli> > pq;
	scanf("%lld %lld", &n, &m);
	for (lli i = 0; i < n; i++) {
		scanf("%lld", &a);
		pq.push(a);
	}
	for (lli i = 0; i < m; i++) {
		scanf("%lld %lld", &b, &c);
		p[i] = mp(-c, b);
	}
	sort(p, p + m);
	for (lli i = 0; i < m; i++) {
		c = -p[i].fi;
		b = p[i].se;
		while (b--) {
			if (pq.empty())
				break;
			a = pq.top();
			pq.pop();
			a = max(a, c);
			sum += a;
		}
	}
	while (!pq.empty()) {
		a = pq.top();
		pq.pop();
		sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 2936
n,k=map(int,input().split())
p=list(map(int,input().split()))

a=[0]*(n+1)
for i in range(n):
    a[i+1]+=a[i]+(((1+p[i])*p[i])//2)/p[i]


cnt=0
for i in range(len(a)-1):
    cnt=max(cnt,a[i+1]-a[i-k+1])

print(cnt)

Measured memory_bytes: 24804
from collections import deque
k = int(input())
queue = deque()
for i in range(1,10):
    queue.append(i)

for i in range(k-1):
    x = queue.popleft()
    if x % 10 != 0:
        queue.append(10*x+x%10-1)
    queue.append(10*x+x%10)
    if x % 10 != 9:
        queue.append(10*x+x%10+1)

lunlun = queue.popleft()
print(lunlun)

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

using namespace std;

int main()
{
    long long int sum = 0;
    long long int res = 0;
    int mod = 1000000007;
    int n;

    cin >> n;
    vector<int> num(n);

    for (int i = 0; i < n; i++)
    {
        cin >> num[i];
        sum += num[i];
        sum %= mod;
    }
    long long int ans = 0;
    for (int i = 0; i < n; i++)
    {
        sum -= num[i];
        if (sum < 0)
            sum += mod;
        ans += sum * num[i];
        ans %= mod;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define inf 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int mod = 1000000007;

const int maxn = 1005;
const int maxv = maxn*(maxn-1)/2;
vector<int> to[maxv];
int id[maxn][maxn];
int toId(int i, int j) {
  if (i > j) swap(i, j);
  return id[i][j];
}

bool visited[maxv];
bool caled[maxv];
int dp[maxv];
int dfs(int v) {
  if (visited[v]) {
    if (!caled[v]) return -1;
    return dp[v];
  }
  visited[v] = true;
  dp[v] = 1;
  for (int u:to[v]) {
    int res = dfs(u);
    if (res == -1) return -1;
    dp[v] = max(dp[v], dfs(u)+1);
  }
  caled[v] = true;
  return dp[v];
}

//有向グラフの問題に置き換える
//ループしているかを検出、dfsで長さを求める
//dp:max length from v
//ループ検出はcaledで行う

int main(){
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n-1));
  for (int i = 0;i < n;i++) {
    for (int j = 0;j < n-1;j++) {
      cin >> a[i][j];
      a[i][j]--;
    }
    reverse(a[i].begin(), a[i].end());
  }
  int v = 0;
  for (int i = 0;i < n;i++)for (int j = 0;j < n;j++) {
    if (i < j) {
      id[i][j] =v++;
    }
  }
  for (int i = 0;i < n;i++) {
    for (int j = 0;j < n-1;j++) {
      a[i][j] = toId(i, a[i][j]);
    }
    for (int j = 0;j < n-2;j++) {
      to[a[i][j+1]].push_back(a[i][j]);
    }
  }
  for (int i = 0;i < n;i++) {
    dfs(i);
  }
  int ans = 0;
  for (int i = 0;i < v;i++) {
    int res = dfs(i);
    if (res == -1) {
      puts("-1");
      return 0;
    }
    ans = max(ans, dfs(i));
  }
  cout << ans << endl;
  return 0;
}

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

void solve(long long N) {
    cout << ((N*(N+1))/2) << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


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

int main() {
  constexpr char OPPONENT_HAND[] = "spr";
  constexpr int NUMBER_OF_HANDS = 3;

  int N, K;
  cin >> N >> K;

  int point[NUMBER_OF_HANDS];
  for (int i = 0; i < NUMBER_OF_HANDS; i++) cin >> point[i];

  string T;
  cin >> T;

  int ans = 0;
  deque<bool> skipped(N, false);

  for (int round = 0; round < N; round++) {
    if (round >= K && T[round] == T[round - K] && skipped[round - K] == false) {
      skipped[round] = true;
      continue;
    }
    for (int idx = 0; idx < NUMBER_OF_HANDS; idx++) {
      if (T[round] == OPPONENT_HAND[idx]) {
        ans += point[idx];
      }
    }
  }

  cout << ans << endl;
}

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

int main() {
  string s,t;
  cin>>s;
  for(int i=0;i<s.size();i+=2){
    t += s[i];
  }
  cout<<t<<endl;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;
typedef double db;

int main()
{
    int H, A;
    scanf("%d%d", &H, &A);
    int res = H / A + 1;
    if(H%A == 0)
        res--;
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x; cin >> x;
  cout << x/500*1000+(x%500)/5*5 << endk;
  return 0;
}


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

using namespace std;
typedef  long long ll;

#define pf printf
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) for(int i=(n-1);i>=(0);--i)
#define REPSZ(i,v) REP(i,SZ(v))
#define pll pair <ll, ll>

const ll mxn = 1e5+5;
ll mod = 1e9+7;
ll arr[mxn];
ll brr[mxn];
vector<ll>v;
bitset<mxn>used;
double eps = 1e-7;
ll n,m,k,cont,tc;
void print(vector <ll> &v){cout << v.size() << endl;for(int i = 0; i < v.size(); i++){pf("%lld ", v[i]);}pf("\n");}
void print(vector <pll> &v){ cout << v.size() << endl; for(int i = 0; i < v.size(); i++){pf("%lld %lld\n", v[i].first, v[i].second);}}
void print(set<ll> s){set <ll> :: iterator itr;for (itr = s.begin(); itr != s.end(); ++itr){cout << *itr << " ";}cout << endl;}
void print(double d){cout << fixed << setprecision(2) << d << endl;}
void print (ll *arr){REP(i,n)cout << arr[i] << " "; cout << endl;}

void from_file(void){ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);}

/* ------------------main section-------------! */
ll Power(ll a, ll b) {
    a %= mod;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

ll NcR(int n, int r) 
{ 
  
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
  
            ll m = __gcd(p, k); 
            p /= m; 
            k /= m; 
  
            n--; 
            r--; 
        } 
    } 
  
    else
        p = 1; 
    return p;
} 

void solve()
{
    
}

void run() {
    fastio;
    bool x;
    cin >> x;
    cout << (x^1) << endl;
}

int main() {
    #ifndef ONLINE_JUDGE
       from_file();
    #endif
    run();
    return 0;
}


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

int k, a, b;

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

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];
  
  rep(i, n) {
    a[i] *= -1;
    b[i] *= -1;
    c[i] *= -1;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  vector<ll> cnt(n, 0);
  int idxc = 0;
  rep(i, n) {
    if (i) cnt[i] += cnt[i - 1];
    while (idxc < n && b[i] > c[idxc]) {
      idxc++;
    }
    cnt[i] += idxc;
  }

  ll ans = 0;
  int idxb = 0;
  rep(i, n) {
    while (idxb < n && a[i] > b[idxb]) {
      idxb++;
    }
    if (idxb) ans += cnt[idxb - 1];
  }
  cout << ans << endl;

  
  return 0;
}

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

int n;
vector<vector<pair<int,long long>>> graph;
vector<long long> dist;

void bfs(int v,long long c){
  queue<pair<int,long long>> que;
  que.emplace(v,c);
  while(!que.empty()){
    v=que.front().first;
    c=que.front().second;
    que.pop();
    dist[v]=c;
    for(auto e:graph[v]){
      if(dist[e.first]!=-1) continue;
      que.emplace(e.first,e.second+c);
    }
  }
}

int main(){
  cin >> n;
  graph.assign(n,vector<pair<int,long long>>());
  dist.assign(n,-1);

  for (int i = 0; i < n-1; i++)
  {
    int a,b;
    long long c;
    cin >> a >> b >> c;
    a--;b--;
    graph[a].emplace_back(b,c);
    graph[b].emplace_back(a,c);
  }

  int q,k;
  cin >> q >> k;
  bfs(k-1,0);
  for (int i = 0; i < q; i++)
  {
    int x,y;
    cin >> x >> y;
    cout << dist[x-1]+dist[y-1] << endl;
  }
}

Measured memory_bytes: 10736
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <set>
#include <math.h>
#include <algorithm>
#include <limits.h>
#include <map>
using namespace std;
int N, K, L;
int pre[2][200005];
int res[200005];

int Find(int cur, int x){
    int r=x;
    while(r!=pre[cur][r]){
        r=pre[cur][r];
    }
    int i=x, j;
    while(pre[cur][i]!=r){
        j=pre[cur][i];
        pre[cur][i]=r;
        i=j;
    }
    return r;
}

void check(int cur,int a, int b){
    int fx=Find(cur, a);
    int fy=Find(cur, b);
    if(fx!=fy){
        pre[cur][fy]=fx;
    }
}

int main()
{
    //freopen("input.in", "r", stdin);
    memset(pre, 0, sizeof(pre));
    memset(res, 0, sizeof(res));
    cin>>N>>K>>L;
    for(int i=1;i<=N;i++){
        pre[0][i]=i;
        pre[1][i]=i;
    }
    int a, b;
    for(int i=0;i<K;i++){
        cin>>a>>b;
        check(0,a, b);
    }
    for(int i=0;i<L;i++){
        cin>>a>>b;
        check(1, a, b);
    }
    map<pair<int, int>, int> al;
    for(int i=1;i<=N;i++){
        al[make_pair(Find(0, i), Find(1, i))]++;
    }
    for(int i=1;i<=N;i++){
        cout<<al[make_pair(Find(0, i), Find(1, i))]<<" ";
    }
    return 0;
}


Measured memory_bytes: 14464
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		long sum=0;
		for (int i = 0; i < arr.length; i++) {
			arr[i]=sc.nextInt();
			sum+=arr[i];
		}
		
		long temp=0;
		long min=Long.MAX_VALUE;
		for (int i = 0; i < arr.length-1; ++i) {		
			temp+=arr[i];
			min=Math.min(min, Math.abs((sum-temp)-temp));
		}
		
		System.out.println(min);
	}

}


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

int main(){
  int n,m;
  cin >>n >>m;
  const int NMMAX = 50;
  int a[NMMAX], b[NMMAX], c[NMMAX], d[NMMAX];
  rep(i,n) cin >>a[i] >>b[i];
  rep(i,m) cin >>c[i] >>d[i];
  rep(i,n){
    int min_dist = abs(a[i]-c[0])+abs(b[i]-d[0]), checkpoint=1;
    for(int j = 1; j<m; j++){
      const int cur_dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(min_dist>cur_dist){
        min_dist=cur_dist;
        checkpoint=j+1;
      }
    }
    cout << checkpoint << endl;
  }
  return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int A[3];

	for(int i = 0; i < 3; i++){

		scanf("%d",&A[i]);
	}
	sort(A,A+3);

	printf("%d\n",(A[1]-A[0])+(A[2]-A[1]));

	return 0;
}


Measured memory_bytes: 3796
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if((1*a*b)%2==1||(2*a*b)%2==1||(3*a*b)%2==1)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int K;
    cin>>s>>K;
    int size=s.size();
    vector<string>v;
    for(int i=0;i<min({5,size});i++){
        for(int j=0;j<s.size()-i;j++){
            v.push_back(s.substr(j,i+1));
        }
    }
    sort(v.begin(),v.end());
    unique(v.begin(),v.end());
    cout<<v[K-1]<<endl;
}

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

const int INF = 1e9;

int main() {
  int x;
  cin>>x;
  int cnt = 0;
  int j;
  for (int i=1; i<=x; i++) {
    cnt += i;
    if (cnt >= x) {
      cout<<i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {

  def solve(sc: Scanner): String = {
    val (n, a, b) = (sc.nextInt(), sc.nextInt(), sc.nextInt())

    (if (n * a > b) b else n * a).toString
  }

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val writer = new java.io.PrintWriter(System.out)
    writer.println(solve(sc))
    writer.flush()
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null) println(x)
  }
}


Measured memory_bytes: 27688
//#include "bits/stdc++.h"

#include <iostream>
#include <array>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

array<int, 100002> box; // use key 100001

int n;
int np;
int min_;
int max_;

int solve() {
	cin >> n;
	np = n + 1;
	for (int i = 0; i < n; i++) {
		cin >> min_ >> max_;
		if (min_ > np) {
			continue;
		}
		box[min_ - 1]--;
		max_ = min(max_, np);
		box[max_]++;
	}
	box[np + 2] = 0;
	for (int i = np + 1; i >= 0; i--) {
		box[i] += box[i+1];
		//std::cout << "debug " << i << " " << box[i] << std::endl; // debug
		if (i - 1 <= box[i]) {
			return i - 1;
		}
	}
	return 0;
}

int main() {

	cout << solve() << endl;

	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  rep(i, 0, b) {
    cout << a;
  }
  cout << endl;

  return 0;
};


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
#include <numeric>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<int,int> pii;
ll dp[1<<16];
ll sum[1<<16];
int a[16][16];
int main(){
    int n;
    cin >> n;
    rep(i,n)rep(j,n)cin >> a[i][j];
    rep(i,1<<n){
        rep(j,n){
            if(i&(1<<j)){
                rep(k,j){
                    if(i&(1<<k)){
                        sum[i] += a[j][k];
                    }
                }
            }
        }
    }
    rep(i,1<<n)if(i)dp[i] = -(1LL<<60);
    rep(i,1<<n){
        for(int s = i; s >= 0; s = (s-1) & i){
            dp[i] = max(dp[i], dp[s] + sum[i-s]);
            if(s == 0) break;
        }
    }
    cout << dp[(1<<n)-1] << endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(long long i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000000000
typedef long long ll;
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; }


struct UnionFind {
	vector<int> par;
  
  UnionFind(int N): par(N){
  	for(int i=0;i<N;i++) par[i] =i;
  }
};





int main(){
  ios::sync_with_stdio(false);
  
  ll N;
  cin>>N;
  ll h[N];
  rep(i,N) cin>>h[i];
  
  
  ll DP[N];
  DP[0] =0;
  
  for(int i = 1; i<N;i++){
  	if(i-2>=0){
    	DP[i] = min(DP[i-1]+abs(h[i]-h[i-1]),DP[i-2]+abs(h[i]-h[i-2]));
    }else{
    	DP[i] = DP[i-1] +abs(h[i]-h[i-1]);
    }
  }
  
  cout<<DP[N-1];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long
				
int32_t main() {
	fast_cin();  
	int n; cin >> n;
	string s; cin >> s;
	s = '&' + s;
	int pref[n + 5] = {0};
	for (int i = 1; i <= n; ++i) {
		pref[i] += pref[i - 1] + (s[i] == 'W');
	}
	int ans = min(pref[n], n - pref[n]);
	for (int i = 1; i <= n - 1; ++i) {
		int white = pref[i];
		int red = (n - i - pref[n] + pref[i]);
		ans = min(ans, white + red - min(white, red)); 
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> L;
    for (int i = 0; i < N; i++)
    {
        int l; cin >> l;
        L.push_back(l);
    }
    sort(L.begin(), L.end());
    long ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            int c = L[i] + L[j];
            auto iter = lower_bound(L.begin()+j+1, L.end(), c);
            ans += iter - (L.begin() + j + 1);
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int n,c,total=0,mini=0;
    vector<pair<int,int>> t;
    int m,l,a,b;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> a;
        t.push_back(make_pair(a,0));
    }
    for(int i=0;i<n;i++)
    {
        cin >> b;
        t[i].second=b;
    }
    for(int i=0;i<n;i++)
    {
        if(t[i].first>t[i].second)
        {
            total+=t[i].first;
            mini+=t[i].second;
        }
    }
    cout << total-mini << '\n';

}


Measured memory_bytes: 256
def examA():
    N = LI()
    N.sort()
    if N[0]==N[1] and N[0]!=N[2]:
        print("Yes")
    elif N[1]==N[2] and N[0]!=N[2]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                print("DENIED")
                return
    print("APPROVED")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Measured memory_bytes: 5840
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    int ha = 0;
    int kari = N % 1000;
    if ( kari == 0 ){
        cout << 0 << endl;
    } else if ( kari != 0 ){
        cout << 1000 - kari << endl;
    }
        
    
    
    
    
 
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int s = a * 100 + b * 10 + c;
  if(s%4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * (n+1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
      
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())


N,M = map(int, input().split())
uf = UnionFind(N)
for M in range(M):
  A,B = map(int, input().split())
  uf.union(A,B)

ans = 0
for i in uf.roots():
  ans = max(ans, uf.size(i))
print(ans)

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

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> s(M, vector<int>());
	vector<int> p(M);
	for (int i = 0; i < M; i++) {
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int a;
			cin >> a;
			s[i].push_back(a-1);
		}
	}
	for (int i = 0; i < M; i++) {
		cin >> p[i];
	}
	int ans = 0;
	for (int i = 0; i < (1 << N); i++) {
		int lights = 0;
		for (int j = 0; j < M; j++) {
			int switches = 0;
			for (int k = 0; k < s[j].size(); k++) {
				if (i & (1 << s[j][k]))switches++;
			}
			if (switches % 2 == p[j])lights++;
		}
		if (lights == M)ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
typedef long long ll;
 int g[15][15];
int main(){
  int n;
  cin >> n;
  //vector<vector<int>> g(n,vector<int>(n));
  rep(i,n)rep(j,n) g[i][j] = -1;
  rep(i,n){
    int m;
    cin >>m;
    rep(j,m){
      int a, x;
      cin >> a >>x;
      --a;
      g[i][a] = x;
    }
  }
  int ans = 0;
  rep(i,1<<n) {
    vector<int> d(n);
    rep(j,n) if( i>>j&1 ){
      d[j] = 1;
    }
    bool ok = true;
    rep(j,n) {
      if (d[j]){
        rep(k,n){
          if (g[j][k] == -1 ) continue;
          if (g[j][k] != d[k]) ok = false;
        }
      }
    }
    if (ok) ans = max(ans,__builtin_popcount(i));
 
  }
  cout << ans << endl;
  return 0;
}

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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX 1000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int main(){
    ll N;
    ll A,B;
    cin >> N >> A >> B;
    N %= 12;
    ll p[2][12];
    p[0][0] = A;
    p[1][0] = B;
    Rep(i,11){
        if(i % 2 == 0){
            p[0][i+1] = p[0][i]-p[1][i];
            p[1][i+1] = p[1][i];
        }else{
            p[1][i+1] = p[0][i]+p[1][i];
            p[0][i+1] = p[0][i];
        }
        //cout << p[0][i+1] << sp << p[1][i+1] << endl;
    }
    cout << p[0][N] << sp << p[1][N] << endl;
    //cin >> N;
}


Measured memory_bytes: 3108
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

char changeit(char c){
	char n = c;
	if(65 <= n && n <= 90){
		n = n + 32;
	}
	else if(97 <= n && n <= 122){
		n = n - 32;
	}
	return n;
}

int main(){
	string s;
	getline(cin, s);
	int n = s.length();
	for(int i = 0; i < n; i++){
		cout << changeit(s[i]);
	}
	cout << "\n";
}


Measured memory_bytes: 3208
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))

    cost_pn = 0
    cost_np = 0
    acc_pn = 0
    acc_np = 0
    for i in range(N):
        acc_pn += A[i]
        acc_np += A[i]

        if i % 2 == 0:
            if acc_pn <= 0:
                cost_pn += abs(acc_pn) + 1
                acc_pn = 1

            if acc_np >= 0:
                cost_np += abs(acc_np) + 1
                acc_np = -1

        else:
            if acc_pn >= 0:
                cost_pn += abs(acc_pn) + 1
                acc_pn = -1

            if acc_np <= 0:
                cost_np += abs(acc_np) + 1
                acc_np = 1

    return min(cost_pn, cost_np)


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 14612
#!/usr/bin/env python3

def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = [(v, i + 1) for i, v in enumerate(A)]
    a = sorted(a, key=lambda x: x[0])
    a = [i[1] for i in a]
    print(*a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20196
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  double A,B,H,M;
  cin>>A>>B>>H>>M;
  
  double T=H*30-M*5.5;
  while(T<0) T+=360;
  while(T>360) T-=360;
  
  cout<<setprecision(12)<<sqrt(A*A+B*B-2*A*B*cos(T/180*PI))<<endl;
}

Measured memory_bytes: 4164
#!/usr/bin/env python3
import numpy as np


def solv(n, k):
    d = np.arange(1, n+1, dtype='float64')
    p = np.fmax(k / d, 1)
    t = np.ceil(np.log2(p))
    r = np.power(0.5, t)
    return np.mean(r)


if __name__ == '__main__':

    n, k = map(int, input().split())
    ans = solv(n, k)

    print(ans)


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

using namespace std;

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

int main() {
    int n;
    cin >> n;
    int x[n] = {};
    int y[n] = {};

    REP(i, n) cin >> x[i];
    REP(i, n) cin >> y[i];

    double d[4] = {};
    FOR(p, 1, 4) {
        REP(i, n) d[p] += pow(fabs(x[i] - y[i]), p);
        d[p] = pow(d[p], 1.0 / p);
    }

    REP(i, n) {
        d[0] =max(d[0], fabs(x[i] - y[i]));
        //d[0] = (d[0] < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]) : d[0]);
    }

    printf("%lf\n", d[1]);
    printf("%lf\n", d[2]);
    printf("%lf\n", d[3]);
    printf("%lf\n", d[0]);
}

Measured memory_bytes: 3340
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        static void Main(string[] args)
        {
            var NKQ = Sarray();
            var N = NKQ[0];
            var K = NKQ[1];
            var Q = NKQ[2];
            var num = new long[N];
            for (var i = 0; i < Q; ++i)
            {
                var A = Sarray()[0];
                ++num[A - 1];
            }
            for (var i = 0; i < N; ++i)
            {
                if (K <= Q - num[i])
                    WriteLine("No");
                else
                    WriteLine("Yes");
            }
        }
    }
}

Measured memory_bytes: 18388
n = int(input())

s = input()
ss = {s}

ans = True

for i in range(1, n):
  t = input()
  if t not in ss and s[-1] == t[0]:
    s = t
    ss.add(s)
  else:
    ans = False
    break
  
  
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
# Union-Find木（サイズ付き）
class UnionFind():
    # 初めは全ての頂点が別々の木の根
    def __init__(self, n):  # n要素で初期化
        self.parent = [None] * n # 親
        self.rank = [None] * n   # 木の深さ
        self._size = [1] * n # 要素が属する集合の大きさ（根の要素のみ参照すること）
        for i in range(n):
            self.parent[i] = i
            self.rank[i] = 0

    def root_of(self, x):
        children = [x]
        while self.parent[x] != x:
            # px = self.parent[x]
            x = self.parent[x]
            children.append(x)

        for ch in children:
            self.parent[ch] = x

        return x

    # xとyの属する集合を併合
    def union(self, x, y):
        rx = self.root_of(x)
        ry = self.root_of(y)
        if rx == ry:
            return
        if self.rank[rx] < self.rank[ry]: # ランクの小さい木から大きい木の根に辺を張る
            self.parent[rx] = ry  # rxをryの子とする
            self._size[ry] += self._size[rx]
        else:
            self.parent[ry] = rx
            self._size[rx] += self._size[ry]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するかどうか
    def same(self, x, y):
        return self.root_of(x) == self.root_of(y)


def kruskal(E, n):
    '''
    E ... (辺のコスト, (始点, 終点))のリスト
    n ... 頂点の数
    '''
    E.sort()
    cost = 0
    uf = UnionFind(n)
    for c, (x, y) in E:
        if not uf.same(x, y):
            cost += c
            uf.union(x, y)
    return cost

n, m = [int(x) for x in input().split()]
E = []
for _ in range(m):
    s, t, w = [int(x) for x in input().split()]
    E.append((w, (s, t)))

print(kruskal(E, n))



Measured memory_bytes: 28896
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int n = sc.nextInt();
        int d[] = new int[n];
		int ans = 0;
        for(int i = 0; i < n;i++){
			d[i] = sc.nextInt();
        }
      
        for(int i = 0; i < n;i++){
			for(int j = i + 1; j < n;j++){
				ans += d[i] * d[j];
      	    }
        }
      	System.out.println(ans);
 
    }
}

Measured memory_bytes: 35704
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nkq = readInts()
    let (n, k, q) = (nkq[0], nkq[1], nkq[2])
    
    var aryPoints = [Int](repeating: k - q, count: n)
    
    for _ in 1...q {
        aryPoints[readInt() - 1] += 1
    }
    
    for i in aryPoints {
        print(i > 0 ? "Yes": "No")
    }
}

main()


Measured memory_bytes: 13956
#include <bits/stdc++.h>
using namespace std;
int n,k,c,cnt;
string s;
set<int> se;

signed main(){
  cin>>n>>k>>c>>s;
  if(!c){
    for(char p:s)k-=p=='o';
    if(!k)for(int i=0;i<n;i++)if(s[i]=='o')cout<<i+1<<" ";
    cout<<endl;
    return 0;
  }
  for(int i=n-1;cnt<k;i--){
    if(s[i]=='o'){
      se.insert(i);
      cnt++;
      i-=c;
    }
  }
  cnt=0;
  for(int i=0;cnt<k;i++){
    if(s[i]=='o'){
      if(se.count(i))cout<<i+1<<" ";
      cnt++;
      i+=c;
    }
  }
  cout<<endl;
}


Measured memory_bytes: 1796
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] h = new long[N];
		for( int i=0; i<N; i++ ){
			h[i] = sc.nextLong();
		}
		Arrays.sort(h);
		long minium = 1000000000L;
		for( int i=0; i<=N-K; i++ ){
			long ans = h[i-1+K] - h[i];
			minium = Math.min(ans,minium); 
		}
		System.out.println(minium);
	}
}


Measured memory_bytes: 52148
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    string s;

    cin>>s;

    int up,bot;

    up = 0;
    bot = 0;
    up = 10*(s[0]-'0')+(s[1]-'0');
    bot = 10*(s[2]-'0')+s[3]-'0';

    if ((up >= 1 && up <= 12) && (bot == 0 || bot > 12)) {
        cout<<"MMYY"<<endl;
    } else if((up == 0 || up > 12) && (bot >= 1 && bot <= 12)) {
        cout<<"YYMM"<<endl;
    } else if((up >= 1 && up <= 12) && (bot >= 1 && bot <= 12)) {
        cout<<"AMBIGUOUS"<<endl;
    } else {
        cout<<"NA"<<endl;
    }

    return 0;
}





Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Question question = new Question();
        question.solve(sc);
    }

    static class Question {
        public void solve(Scanner sc) {
            int n = sc.nextInt();
            while(n > 0) {
                if(n % 10 == 7) {
                    System.out.println("Yes");
                    return;
                }
                n /= 10;
            }
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35820
import scala.io.StdIn.readLine

object Main extends App {
  val Array(a,b,c) = readLine.split(" ").map(_.toDouble)
  val h = b * Math.sin(c*Math.PI/180)

  println(a*h/2)
  println( a + b + Math.sqrt(a*a+b*b-2*a*b*Math.cos(c*Math.PI/180)) )
  println(h)

}

Measured memory_bytes: 44040
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD = 1e9+7;
ll dp[1010][1010];
int main(){
  ll n,k;
  cin>>n>>k;
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
	for(int j=1;j<=k;j++){            
	  dp[i][j]+=dp[i-1][j-1];
	  if(i>=j)dp[i][j]+=dp[i-j][j];       
	  dp[i][j]%=MOD; 
	}
  }
  ll ans=0;
  for(int i=1;i<=k;i++)ans=(ans+dp[n][i])%MOD;
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 11028
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,s,t,ans =0,now=-1;
    cin>>n;
    vector<pair<long long,long long> > a;
    for(int i=0;i<n;i++){
        cin>>s>>t;
        a.push_back(make_pair(t,s));
    }
    sort(a.begin(),a.end());
    for (int i=0; i<n; i++){
        if (a[i].second > now){
            ans++;
            now = a[i].first;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4920
#include <iostream>
#include <climits>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <array>
#include <memory>

#define IN(a,b) (a.find(b) != a.end())
#define p(a,b) make_pair(a,b)
#define readVec(a) for (int __i = 0; __i<(int)a.size();__i++){cin>>a[__i];}

// jimjam

template<typename T>
void pMin(T &a, T b) {if (b<a){a=b;}}
template<typename T>
void pMax(T &a, T b) {if (b>a){a=b;}}
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& c);
template<typename A, typename B>
std::ostream& operator<<(std::ostream& os, const std::pair<A,B>& c) {std::cout << "(" << c.first << ", " << c.second << ")";return os;}
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& c) {
	if (c.size() == 0) {os << "{}"; return os;}
	os << "{" << c[0];
	for (int64_t i = 1; i < (int)c.size(); i++) {os <<", "<<c[i];}
	os << "}";
	return os;
}

using namespace std;

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

	string a, b; cin >> a >> b; // b < a
	int ans=INT_MAX;
	for (int i = 0; i < a.size()-b.size()+1; i++) {
		int curr=0;
		for (int j = 0; j < b.size(); j++) {
			curr += a[i+j]!=b[j];
		}
		pMin(ans,curr); 
	}
	cout << ans << endl;
	return 0;
}




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

using namespace std;

int main(){
    int H, W;
    cin >> H >> W;

    vector<vector<char> > a(H, vector<char>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> a[i][j];
        }
    }

    long long int dp[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(i == 0 && j == 0)
                dp[i][j] = 1;
            else if(i == 0)
                dp[i][j] = dp[i][j-1] % 1000000007;
            else if(j == 0)
                dp[i][j] = dp[i-1][j] % 1000000007;
            else
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % 1000000007;
            
            if(a[i][j] == '#')
                dp[i][j] = 0;
        }
    }

    
    cout << dp[H-1][W-1] << "\n";
    return 0; 
} 

Measured memory_bytes: 9088
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
    int d, t, s;
    scanf("%d %d %d", &d, &t, &s);
    if (s*t>=d) printf("Yes\n"); else printf("No\n");
    return 0;
}

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

int main(){
    int n;
    cin >> n;

    string s;
    cin >> s;

    ll ans = 0;
    int flag = 0;
    ll k = 10e8+7;
    int l[26];
    for(int i = 0; i < 26; i++){
        l[i] = 0;
    }
    for(int i = 0; i < n; i++){
        l[s[i] - 'a']++;
    }

    for(int i = 0; i < 26; i++){
        if(l[i] != 0){
            if(ans == 0){
                ans = l[i] + 1;
            }else{
                ans *= (l[i] + 1);
            }
            ans %= k;
        }
    }

    ans--;

    cout << ans << endl;
}

Measured memory_bytes: 3700
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int d, e, f, g, h, i;
	d = a + b;
	e = a + c;
	f = b + c;
	int ans = min({ d,e,f });
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var d = new Dictionary<char, int>();
        for (int i = 0; i < s.Length; i++)
            if (d.ContainsKey(s[i])) d[s[i]]++;
            else d[s[i]] = 1;
        var ret = "Yes";
        foreach (var x in d)
            if (x.Value % 2 == 1) { ret = "No"; break; }
        Console.WriteLine(ret);
    }
}


Measured memory_bytes: 13152
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');

        var d = new int[n];
        for (int i = 0; i < n; i++)
        {
            d[i] = int.Parse(s[i]);
        }

        var p = 0;
        var ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (p < d[i])
            {
                ans += d[i] - p;
                p = d[i];
            }
            else
            {
                p = d[i];
            }
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque()
for i, ai in enumerate(a):
    if i % 2 == 0:
        b.appendleft(ai)
    else:
        b.append(ai)
if n % 2 == 0:
    print(*reversed(b))
else:
    print(*b)

Measured memory_bytes: 25412
#include<bits/stdc++.h>
using namespace std;
unsigned long long n;
unsigned sss;
unsigned long long prime(unsigned long long x)
{
	if(x==1||x==0)return false;
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0)return false;
	return true;
}
unsigned long long ws(unsigned long long y)
{
	unsigned long long sum=0;
	while(y!=0)
	{
		sum++;
		y/=10;
	}
	return sum;
}
int main()
{
	cin>>n;
	if(prime(n))
	{
		cout<<ws(n);
		return 0;
	}
	for(int i=sqrt(n);i>0;i--)
		if(n%i==0){sss=n/i;break;}
	cout<<ws(sss);
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int a[N],dp[N];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	dp[1]=0;
    dp[0]=0;
    dp[2]=abs(a[2]-a[1]);
    for(int i=3;i<=n;++i)
    	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout<<dp[n];
	return 0;
} 

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int dp[10010][10];
int cost[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
vector<int> A;
int N, M;
int calc(int n, int m) {
    
    if(n < 0) return -INF;
    if(n == 0) return dp[n][m] = 0;
    if(dp[n][m] != -1) return dp[n][m];
    rep(i, M) {
        int c = calc(n - cost[A[i]], A[i]);
        dp[n][m] = max(dp[n][m], c + 1);
        //cout << A[i] << " " << n << " " << m << " " << dp[n][m] << " " << c + 1 << endl;
    }
    return dp[n][m];
}

void output(int n) {
    if(n <= 0) return;
    int len = -1;
    int num = 0;
    rep(i, M) {
        if(n - cost[A[i]] >= 0 && len < dp[n - cost[A[i]]][A[i]]) {
            len = dp[n - cost[A[i]]][A[i]];
            num = A[i] + 1;
        }
    }
    cout << num;
    //cout << num << " " << n << endl;
    output(n - cost[num - 1]);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N >> M;
    rep(i, M) {
        int a; cin >> a;
        a--;
        A.push_back(a);
    }
    sort(A.begin(), A.end(), greater<int>());
    rep(i, 10010) rep(j, 10) dp[i][j] = -1;
    rep(i, M) calc(N - cost[A[i]], A[i]);
    output(N);
    cout << endl;

    return 0;
}


Measured memory_bytes: 768