akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    string s,t,u;
    cin >> s >> t >> u;
    transform (s.begin(), s.end(), s.begin(), ::toupper);
    transform (t.begin(), t.end(), t.begin(), ::toupper);
    transform (u.begin(), u.end(), u.begin(), ::toupper);
    cout << s[0] << t[0] << u[0] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n,count = 0;
    cin>>n;
    int m = INT_MAX;
    for (int i=0;i<n;++i){
        int x;
        cin>>x;
        m = min(m,x);
        if (x<=m){
            count++;
        }
    }
    cout<<count;
}

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

using namespace std;

int main()
{
  int N, K;
  vector<int> h;
  cin >> N >> K;

  for(int i = 0; i < N; i++)
  {
    int he;
    cin >> he;
    h.push_back(he);
  }

  vector<int> dp(N, 0);
  //dp[1] = abs(h[0] - h[1]);

  for(int i = 1; i < N; i++)
  {
        int min_val = INT_MAX;
      for(int j = 1; j <= K; j++)
      {
        if(i - j >= 0)
            min_val = min(min_val, dp[i-j] + abs(h[i] - h[i-j]));
      }
      dp[i] = min_val;
  }

  cout << dp[N-1] << '\n';

  return 0;
}



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

using namespace std;

inline long long read(){
	long long x=0;char ch='@';bool flag=false;
	for(;!isdigit(ch);ch=getchar())	flag|=(ch=='-');
	for(;isdigit(ch);ch=getchar())	x=(x<<3)+(x<<1)+(ch^48);
	return flag?-x:x;
}

long long A,B,C;
long long ans;

int main(){
	A=read(),B=read(),C=read();
	if(A>=C-1)	ans=B+C;
	else if(B>=C-1)	ans=B+C;
	else if(A+B>=C-1)	ans=B+C;
	else if(A+B<C-1)	ans=B+A+B+1;
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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

int MOD = (int) 1e9 + 7;

void solve() {
    int N;
    cin>>N;
    string S,T;
    cin>>S>>T;

    stringstream ss;
    REP(i,N) {
        ss << S[i] << T[i];
    }

    cout << ss.str() << endl;
}


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

//    cout << solve() << endl;
    solve();
//    cout << (solve() ? "Yes" : "No") << endl;
    return 0;
}



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

void solve() {
    int a, b, c, d, n;
    cin >> a >> b >> c >> d;
    cin >> n;
    long long min_abc = min(c, min(4 * a, 2 * b));
    long long ans = 0;
    if (d < 2 * min_abc) {
        ans = (long long) d * (n / 2);
        if (n % 2 != 0) {
            ans += min_abc;
        }
    } else {
        ans = min_abc * n;
    }
    cout << ans << endl;
}

int main() {
//    freopen("/Users/simon/Downloads/test.in", "r", stdin);
    //    freopen("/Users/simon/Downloads/test.out", "w", stdout);
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<set>
#define ll long long 
#include <string>
using namespace std;
int main()
{
	ll int h,n,i,s=0;
	cin>>h>>n;
	ll int a[n],f[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		s+=a[i];
		
	}
	if (s<h)
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;



}




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

int main(){
	int h,w;
	cin >> h >> w;
	char map[h][w];
	for (int i = 0; i < h; i ++){
		for (int j = 0; j < w; j++){
			cin >> map[i][j];
		}
	}
	for (int i = 0 ; i < h; i++){
		for (int j = 0; j < w; j++){
			int count = 0;
			if (map[i][j] == '.'){
				if (i-1 >= 0){
					if (map[i-1][j] == '#'){
						count++;
					}
				}
				if (i+1 < h){
					if (map[i+1][j] == '#'){
						count++;
					}
				}
				if (j-1 >= 0){
					if (map[i][j-1] == '#'){
						count++;
					}
				}
				if (j+1 < w){
					if (map[i][j+1] == '#'){
						count++;
					}
				}
				if (i-1 >= 0 && j +1 < w){
					if (map[i-1][j+1] == '#'){
						count++;
					}
				}
				if (i+1 < h && j+1 < w){
					if(map[i+1][j+1] == '#'){
						count++;
					}
				}
				if (i-1 >= 0 && j-1 >= 0){
					if(map[i-1][j-1] == '#'){
						count++;
					}
				}
				if (i+1 < h && j-1 >= 0){
					if(map[i+1][j-1] == '#'){
						count++;
					}
				}
				if (count == 0){
					map[i][j] = '0';
				} 
				else if (count == 1){
					map[i][j] = '1';
			    }
			    else if (count == 2){
			    	map[i][j] = '2';
				}
				else if (count == 3){
					map[i][j] = '3';
				}
				else if (count == 4){
					map[i][j] = '4';
				}
				else if (count == 5){
					map[i][j] = '5';
				}
				else if (count == 6){
					map[i][j] = '6';
				}
				else if (count == 7){
					map[i][j] = '7';
				}
				else if (count == 8){
					map[i][j] = '8';
				}
				else if (count == 9){
					map[i][j] = '9';
				}
			}
			cout << map[i][j];
		}
		cout << endl;
	}
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ld INF = (ld)10000000000000;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

const ll m = 999999937;
int n; string t;
ll rol[1 << 20]; ll srol[1 << 20];
ll invrol[1 << 20], sinvrol[1 << 20];
ll x[1 << 20]; ll invx[1 << 20];

ll mod_pow(ll z, ll n) {
	ll ret = 1;
	while (n) {
		if (n % 2)ret = ret * z%mod;
		n >>= 1; z = z * z%mod;
	}
	return ret;
}
ll invm;
void init() {
	x[0] = 1;
	rep(i, ((1 << 20) - 1)) {
		x[i + 1] = x[i] * m%mod;
	}
	invm = mod_pow(m, mod - 2);
	invx[0] = 1;
	rep(i, ((1 << 20) - 1)) {
		invx[i + 1] = invx[i] * invm%mod;
	}
}
ll calc(int i, int len) {
	ll ret = srol[i + len] - srol[i]; ret = (ret + mod) % mod;
	return ret * invx[i] % mod;
}
ll invcalc(int i, int len) {
	ll ret = sinvrol[i + len] - sinvrol[i]; ret = (ret + mod) % mod;
	return ret * invx[i] % mod;
}
bool can(int k) {
	k--;
	if (2 * k > n) {
		int r = n % k; r--;
		ll le = calc(k - r, r);
		ll ri = invcalc(0, r);
		return le == ri;
	}
	ll le = calc(0, k); ll ri = invcalc(n - 2 * k, k);
	ll le2 = calc(1, k - 1); ll ri2 = invcalc(n - 2 * k, k - 1);
	//cout << k + 1 << " " << le2 << " " << ri2 << endl;
	if (le2 != ri2)return false;

	//cout << k + 1 << endl;
	for (int i = 0; i + k <= n; i += 2 * k) {
		ll c = calc(i, k);
		if (le != c)return false;
	}
	//cout << k + 1 << endl;
	for (int i = k; i + k <= n; i += 2 * k) {
		ll c = invcalc(n - (i + k),k);
		if (ri != c)return false;
	}
	//cout << k + 1 << endl;
	ll r = n % (2 * k); ll d = n / (2 * k); d *= 2 * k;
	if (r <= k) {
		ll c = calc(d, r);
		le = calc(0, r);
		if (c != le)return false;
	}
	else {
		r %= k;
		ri = invcalc(n - k - r,r);
		ll c = invcalc(0, r);
		if (c != ri)return false;
	}
	return true;
}
bool somosomo() {
	rep(i, n - 1) {
		if (t[i] != t[i + 1])return false;
	}
	return true;
}
int main() {
	init();
	cin >> n >> t;
	if (somosomo()) {
		cout << 2 << endl; return 0;
	}
	rep(i, n) {
		rol[i] = (t[i] - 'a' + 1)*x[i]%mod;
	}
	rep(i, n) {
		srol[i + 1] += srol[i] + rol[i]; srol[i + 1] %= mod;
	}
	rep(i, n) {
		invrol[i] = (t[n - 1 - i] - 'a' + 1)*x[i] % mod;
	}
	rep(i, n) {
		sinvrol[i + 1] += sinvrol[i] + invrol[i]; sinvrol[i + 1] %= mod;
	}
	int ans = n;
	Rep1(k,2, n-1) {
		if (can(k)) {
			ans = k; break;
		}
	}
	cout << ans << endl;
	//stop
	return 0;
}




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

using namespace std;

int main () {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if(S[i] == S[i+1]) cnt++;
    }
    for (int i = 0; i < K; i++) cnt += 2;
    cout << min(cnt, N-1) << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

// https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int dp[n + 1][k + 1]; // i 人に配った, 残り j 個
  fill_n(*dp, (n + 1) * (k + 1), 0);
  dp[0][k] = 1;
  rep(i, n) {
    vector<int> acc(k + 1);
    acc[0] = dp[i][0];
    rep3(j, 1, k + 1) add(acc[j], (acc[j - 1] + dp[i][j]) % mod);
    // cout << acc << endl;
    rep(j, k + 1) dp[i + 1][j] = (acc[min(j + a[i], k)] + mod - (j >= 1 ? acc[j - 1] : 0)) % mod;
  }
  cout << dp[n][0] << endl;
  // rep(i, n + 1) { rep(j, k + 1) cout << dp[i][j] << " "; cout << endl; }
}


Measured memory_bytes: 40064
#include <bits/stdc++.h>
 #define rep(i,n) for(long long i=0;i<n;i++)
 using namespace std;
  int main(){
      char a,b;
      cin >> a >> b;
      if(a=='H' && b=='H'){
          cout << 'H' << endl;
      }
        if(a=='H' && b=='D'){
          cout << 'D' << endl;
      }      
  if(a=='D' && b=='H'){
          cout << 'D' << endl;
      }
    if(a=='D' && b=='D'){
          cout << 'H' << endl;
      }
      return 0;
  }


Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y,a;

int main(){
  ll ans=0;
  double b;
  cin >> a >> b;

  ll lb=(b*100.0+0.5);
  
  ans=a*lb/100;
  cout<<ans<<endl;
  return 0;
}



/*
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n ;
  vi a(n),b(n);

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

Measured memory_bytes: 3724
// ---------- BEG ../defs.hpp BEG ----------
#ifndef atcoder_defs_hpp
#define atcoder_defs_hpp
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
using i8t = std::int64_t;
using u8t = std::uint64_t;
using vi8t = std::vector<i8t>;
using vvi8t = std::vector<std::vector<i8t>>;
using vu8t = std::vector<u8t>;
#include <limits>
static const i8t i8t_max=numeric_limits<i8t>::max();
static const i8t i8t_min=numeric_limits<i8t>::min();
#include <unordered_map>
#include <unordered_set>
template<typename Key,typename Value> using map_t=std::unordered_map<Key, Value>;
template<typename Key> using set_t=std::unordered_set<Key>;
#define F3(i,i0,iN,step) for(i8t i=i0,i##_N=iN;i<i##_N;i+=step)
#define F2(i,i0,iN) F3(i,i0,iN,1)
#define F(i,N) F3(i,0,N,1)
#define FR(i,N) for(i8t i=N;i--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
template<typename T> T umax(T& ans,T const& value) {if(value>ans)ans=value;return ans;}
template<typename T> T umin(T& ans,T const& value) {if(value<ans)ans=value;return ans;}
template<typename T> struct identity { using type = T; };
#endif
// ---------- END ../defs.hpp END ----------

int main() {
  R(A)R(B);

  i8t a=3000,b=0,c=3000,d=0;
  F(i,2000){if(A==i*8/100){umin(a,i);umax(b,i);}}
  F(i,2000){if(B==i*10/100){umin(c,i);umax(d,i);}}
  if(max(a,c)<=min(b,d))
    P(max(a,c))
  else
    P(-1);
  return 0;
}


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


public class hello
{
    public static void Main()
    {
        var p1 = new List<double>();
        var p2 = new List<double>();
        var p3 = new List<double>();
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        string[] line2 = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
        {
            var buf = Math.Abs(double.Parse(line[i]) - double.Parse(line2[i]));
            p1.Add(buf);
            var buf2 = Math.Pow(buf, 2);
            p2.Add(buf2);
            var buf3 = Math.Pow(buf, 3);
            p3.Add(buf3);
        }
        Console.WriteLine(p1.Sum());
        Console.WriteLine(Math.Sqrt(p2.Sum()));
        Console.WriteLine(Math.Pow(p3.Sum(), 1 / 3d));
        Console.WriteLine(p1.Max());
    }
}

Measured memory_bytes: 9760
s=input()
t=input()
l=[]
import sys
if len(t)>len(s):
  import sys
  print("UNRESTORABLE")
  exit()
  
for i in range(len(s)-len(t)+1):
  z=s[:i]
  for j in range(i,i+len(t)):
    if s[j]!=t[j-i] and s[j]!="?":
      break
    else:
      z+=t[j-i]
  else:
    z+=s[i+len(t):]
    l.append(z.replace("?","a"))
l.sort()
print(l[0] if len(l) else "UNRESTORABLE")
      

Measured memory_bytes: 8968
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto B = RDA;

	long ans = B[0] + B[$-1];
	foreach (i; 1..N-1)
	{
		ans += min(B[i], B[i-1]);
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N;
  cin >> N;
  int result = N / 2;
  if(N % 2 == 0) {
    result = N / 2 - 1;
  }
  cout << result << endl;
}


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

p_sm=0

for i in range(k):
    p_sm += p[i]

p_mx=p_sm

for i in range(n-k):
    p_sm= p_sm + p[k+i]-p[i]
    if p_sm >p_mx:
        p_mx = p_sm

print((p_mx+k)/2)

Measured memory_bytes: 25060
#include<stdio.h>
int main(){
	int x, y, hasil;
	scanf("%d %d", &x, &y);
	if ( x + y >= 24){
		hasil = x + y - 24;
		printf("%d", hasil);
	}else{
		hasil = x + y;
		printf("%d", hasil);
	}
	return 0;
}

Measured memory_bytes: 128
import math
N = int(input())
Z = [list(map(int, input().split())) for i in range(N)]
sm = 0
for i in range(N):
    for j in range(i+1, N):
         sm += math.sqrt((Z[i][0]-Z[j][0])**2 + (Z[i][1]-Z[j][1])**2)
ans = sm*2/N
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int a,b;
	cin>>a>>b;
	if(a>=13)cout<<b<<endl;
	if(a<13&&a>=6)cout<<b/2<<endl;
	if(a<6)cout<<"0"<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N, C;
    cin >> N >> C;
    vector< vector< pair<int,int> > > channel(C);
    while(N--) {
        int s, t, c;
        cin >> s >> t >> c;
        channel[--c].emplace_back(s, t);
    }

    vector<int> time(100000);
    for(auto c: channel) {
        sort(c.begin(), c.end());
        for(int i=1; i<c.size(); i++) {
            if(c[i-1].second == c[i].first) {
                c[i].first = c[i-1].first;
                c[i-1].second = c[i-1].first - 1;
            }
        }
        for(int i=0; i<c.size(); i++) {
            ++time[c[i].first - 1];
            --time[c[i].second];
        }
    }

    partial_sum(time.begin(), time.end(), time.begin());
    cout << (*max_element(time.begin(), time.end())) << endl;
    return 0;
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N;
  cin >> N;
  vector<pair<int, int>> R(N), B(N);
  for (int i = 0; i < N; i++)
  {
    int a, b;
    cin >> a >> b;
    R.at(i) = make_pair(a, b);
  }
  for (int i = 0; i < N; i++)
  {
    int a, b;
    cin >> a >> b;
    B.at(i) = make_pair(b, a);
  }

  sort(R.begin(), R.end(), greater<pair<int, int>>());
  sort(B.begin(), B.end());

  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int c = B.at(i).second, d = B.at(i).first;
    int dmax = 0, dmaxind = -1;
    for (int j = 0; j < N - ans; j++)
    {
      int a = R.at(j).first, b = R.at(j).second;
      if (a < c && b < d && chmax(dmax, d)) dmaxind = j;
    }
    if (dmaxind >= 0)
    {
      R.erase(R.begin() + dmaxind);
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())

rsp = {"r":p, "s":r, "p":s}
ans = 0
for i in range(n):
  if i < k: ans += rsp[t[i]]
  else:
    if t[i] != t[i-k]: ans += rsp[t[i]]
    else: t[i] = "a"
print(ans)

Measured memory_bytes: 9984
n=int(input())
A=list(map(int,input().split()))
cntA=cntB=sigA=sigB=0
for i in range(n):
  if i%2==0:
    if sigA+A[i]>=0:
      cntA+=abs(sigA+A[i])+1
      sigA=-1
    else:
      sigA+=A[i]
    if sigB+A[i]<=0:
      cntB+=abs(sigB+A[i])+1
      sigB=1
    else:
      sigB+=A[i]
  else:
    if sigA+A[i]<=0:
      cntA+=abs(sigA+A[i])+1
      sigA=1
    else:
      sigA+=A[i]
    if sigB+A[i]>=0:
      cntB+=abs(sigB+A[i])+1
      sigB=-1
    else:
      sigB+=A[i]
print(min(cntA,cntB))

Measured memory_bytes: 14468
#include <stdio.h>

int main()
{
 int a[3],i,tmp;
 for(i=0;i<3;i++)
 {
   scanf("%d",a+i);
   if(i!=0){
    if(a[i]<a[i-1])
    {tmp=a[i];a[i]=a[i-1];a[i-1]=tmp;}
  }
 }
 printf("%d",a[0]+a[1]+a[2]*10);
 return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

bool acgt(char c) {
	return c == 'A' || c == 'C' || c == 'G' || c == 'T';
}

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	string s;
	cin >> s;
	int n = s.length();
	int answer = 0;
	for (int i = 0; i < n; ) {
		int j;
		while (i < n && !acgt(s[i])) ++i;
		for (j = i; j < n && acgt(s[j]); j++) ;
		answer = max(answer, j - i);
		i = j;
	}
	cout << answer << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

template<class T = lint>
vector<T> Dijkstra(vector<vector<pair<int, T>>> &edges, int st) {

	int V = edges.size();
	const T INF = numeric_limits<T>::max();
	vector<T> dist(V, INF);
	dist[st] = 0;

	priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> que;
	que.emplace(dist[st], st);

	while (!que.empty()) {
		T cost;
		int idx;
		tie(cost, idx) = que.top();
		que.pop();

		if (dist[idx] < cost) continue;
		for (auto &e : edges[idx]){
			auto tmp_cost = cost + e.second;
			if (dist[e.first] > tmp_cost) {
				dist[e.first] = tmp_cost;
				que.emplace(dist[e.first], e.first);
			}
 	  }
	}

	return dist;
}

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

	int N;
	cin >> N;

	int u, v, len;
	vector<vector<pair<int, int>>> edges(N);

	for (int i = 0; i < N - 1; i++) {
		cin >> u >> v >> len;
		edges[u - 1].emplace_back(make_pair(v - 1, len ));
		edges[v - 1].emplace_back(make_pair(u - 1, len ));
	}

	auto ans = Dijkstra<int>(edges, 0);

	for (const auto& i: ans){
		if (i % 2) cout << '1' << "\n";
		else cout << '0' << "\n";
	}
}

Measured memory_bytes: 6912
#include <stdio.h>
#include <stdlib.h>

int main(){
    int q;
    scanf("%d\n",&q);
    
    int *a;
    int i=0;
    
    int com,x;
    while(q--){
        scanf("%d \n",&com);
        switch(com){
            case 0:
                scanf("%d\n",&x);
                if(i==0) a=(int*)malloc(sizeof(int));
                else a=(int*)realloc(a,sizeof(int)*(i+1));
                a[i++]=x;
                break;
            case 1:
                scanf("%d\n",&x);
                printf("%d\n",a[x]);
                break;
            case 2:
                a=(int*)realloc(a,sizeof(int)*(i--));
                break;
        }
    }
    
    free(a);
    
    return 0;
}


Measured memory_bytes: 4876
import math

N = int(input())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)

def l2(x1,y1,x2,y2):
    x = (x2 -x1)**2
    y = (y2 -y1)**2
    return math.sqrt(x+y)

len = 0

for i in range(N):
    for j in range(i,N):
        len += l2(grid[i][0],grid[i][1],grid[j][0],grid[j][1])

print((len*2/N))


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

#define SZ 100000
using namespace std;

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

    vector<int> money;
    money.push_back(1);
    for(int i = 6; i <= SZ; i *= 6){
        money.push_back(i);
    }
    for(int i = 9; i <= SZ; i *= 9){
        money.push_back(i);
    }

    //vector<vector<int> > dp(SZ+1, vector<int>(money.size(), 0));
    vector<int> dp(SZ+1, INT_MAX);
    dp[0] = 0;
    for(int i = 0; i <= SZ; i++){
        for(int j = 0; j < money.size(); j++){
            if(i - money[j] < 0){
                continue;
            }
            dp[i] = min(dp[i], dp[i - money[j]] + 1);
        }
    }

    printf("%d\n", dp[n]);

}

Measured memory_bytes: 768
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
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 main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int cnt[100010] = {};
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i, 100010) {
        if(cnt[i] % 2 != 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}


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

long long nr[1009][1009];
long long nr_inv[1009][1009];
long long mod = 1000000007;

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b & (1LL << i)) != 0) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

void init() {
	for (int i = 0; i <= 1000; i++) {
		for (int j = 0; j <= 1000; j++) {
			if (i == 0 || j == 0) nr[i][j] = 1;
			else nr[i][j] = (nr[i][j - 1] + nr[i - 1][j]) % mod;
		}
	}
	for (int i = 0; i <= 1000; i++) {
		for (int j = 0; j <= 1000; j++) {
			nr_inv[i][j] = modpow(nr[i][j], mod - 2, mod);
		}
	}
}

long long ncr(long long n, long long r) {
	if (r < 0 || n < r) return 0;
	return nr[n - r][r];
}

long long ncrinv(long long n, long long r) {
	if (r < 0 || n < r) return 0;
	return nr_inv[n - r][r];
}

long long N, K, A[22];
long long dp[22][1009];

int main() {
	init();

	cin >> N >> K;
	for (int i = 1; i <= K; i++) cin >> A[i];

	dp[1][N] = 1;
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j <= N; j++) {
			for (int k = 0; k <= j; k++) {
				long long prob = ncr(N - (j - k), A[i] - (j - k)) * ncrinv(N, A[i]) % mod;
				prob *= ncr(j, k); prob %= mod;
				dp[i + 1][k] += dp[i][j] * prob;
				dp[i + 1][k] %= mod;
			}
		}
	}

	long long val = dp[K + 1][0];
	for (int i = 1; i <= K; i++) { val *= ncr(N, A[i]); val %= mod; }
	cout << val << endl;
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n;cin>>n;
    vi a(n);
    vvi x(n),y(n);
    rep(i,n){
        cin>>a[i];
        rep(j,a[i]){
            int tx,ty;
            cin>>tx>>ty;
            x[i].push_back(tx);
            y[i].push_back(ty);
        }
    }

    int ans=0,patern=(1<<15);

    rep(i,patern){
        int ok=1;
        rep(j,n){
            if((i>>j)%2){
                rep(k,a[j]){
                    if(y[j][k] != (i>>(x[j][k]-1))%2){
                        ok=0;
                        break;
                    }
                }
            }
        }
        if(ok){
            int tmp=0;
            rep(j,n)tmp+=(i>>j)%2;
            maxs(ans,tmp);
        }
    }

    cout<<ans<<"\n";

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <iomanip>
#include <string.h>
#include <algorithm>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define clr(a,b) memset((a),b,sizeof(a))
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define sz(a) int((a).size())
#define pb push_back

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N = (int)2e5+77;
const ll mod = (ll)1e9+7;

ll n, m, k, x, y;
ll a[N],b[N];

ll fact[N];
//modular exponentiation for fermat little theorem in order to find modular multiplicative inverse
ll mpow(ll a, ll b){
    ll res=1;
    while(b!=0){
        if(b%2==1) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res;
}

//nCr == C(n,r) call this way
ll C(ll n,ll r){
    if(n<r) return 0;
    if(n==r) return 1;
    if(r==0) return 1;
    ll x,y,ans=fact[n];
    x=mpow(fact[n-r],mod-2);
    y=mpow(fact[r],mod-2);
    ans=(ans*x)%mod;
    ans=(ans*y)%mod;
    return ans;
}

ll ways(ll n, ll r){
    return C(n+r-2,n-1);
}

//precalculate factorial
void factorial(ll n){
    fact[0]=1;
    for(int i=1;i<n;i++){
        fact[i]=(fact[i-1]*i)%mod;
    }
}


int main() {
    fast;
    cin >> n;
    n++;
    for1(i, n) {
        cin >> a[i];
        if (b[a[i]]) {
            x = b[a[i]];
            y = i;
        }
        b[a[i]] = i;
    }
//    cout<<x<<" "<<y<<endl;
    factorial(n + 2);
    for1(i, n) {
//        cout<<x+n-y-1<<" "<<i-1<<" ";
        k = (C(n, i) - C(x + n - y - 1, i - 1) + mod) % mod;
        cout << k % mod << endl;
    }
    return 0;
}

Measured memory_bytes: 4480
import bisect
import math

a, b, q = map(int, input().split())
s = [-math.inf]
t = [-math.inf]
x = []
for _ in range(a):
    s.append(int(input()))
for _ in range(b):
    t.append(int(input()))
for _ in range(q):
    x.append(int(input()))
s.append(math.inf)
t.append(math.inf)

for i in x:
    ws = abs(s[bisect.bisect(s, i) - 1] - i)
    if ws != math.inf:
        ws += min(abs(t[bisect.bisect(t, s[bisect.bisect(s, i) - 1])-1] - s[bisect.bisect(s, i) - 1]), \
                  abs(t[bisect.bisect(t, s[bisect.bisect(s, i) - 1])] - s[bisect.bisect(s, i) - 1]))
    else:
        ws = math.inf
    
    es = abs(s[bisect.bisect(s, i)] - i)
    if es != math.inf:
        es += min(abs(t[bisect.bisect(t, s[bisect.bisect(s, i)]) -1] - s[bisect.bisect(s, i)]), \
                  abs(t[bisect.bisect(t, s[bisect.bisect(s, i)])] - s[bisect.bisect(s, i)]))
    else:
        es = math.inf
    
    wt = abs(t[bisect.bisect(t, i) - 1] - i)
    if wt != math.inf:
        wt += min(abs(s[bisect.bisect(s, t[bisect.bisect(t, i) - 1])-1] - t[bisect.bisect(t, i) - 1]), \
                  abs(s[bisect.bisect(s, t[bisect.bisect(t, i) - 1])] - t[bisect.bisect(t, i) - 1]))
    else:
        wt = math.inf
    
    et = abs(t[bisect.bisect(t, i)] - i)
    if et != math.inf:
        et += min(abs(s[bisect.bisect(s, t[bisect.bisect(t, i)])-1] - t[bisect.bisect(t, i)]), \
                  abs(s[bisect.bisect(s, t[bisect.bisect(t, i)])] - t[bisect.bisect(t, i)]))
    else:
        et = math.inf
        
    print(min(ws, es, wt, et))

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

inline ll lcm(ll x, ll y)
{
    return x/__gcd(x,y)*y;
}

typedef pair<ll,ll> F;

inline F mul(const F& a, const F& b)
{
    ll p=a.fi*b.fi;
    ll q=a.se*b.se;

    ll g=__gcd(p,q);
    p/=g;
    q/=g;
    return F(p,q);
}

vector<int> tlist;
vector<int> G[100];
vector<bool> vis;

void dfs(int v)
{
    if(vis[v]) return;
    vis[v]=true;
    rep(i,G[v].size()) dfs(G[v][i]);
    tlist.pb(v);
}

void tsort(int n)
{
    vis=vector<bool>(n,false);
    rep(i,n) dfs(i);
    reverse(all(tlist));
}

inline void init()
{
    tlist.clear();
    rep(i,100) G[i].clear();
}

int main()
{
    int n;
    while(scanf(" %d", &n),n)
    {
        init();

        vector<ll> p(n),q(n);
        vector<int> r(n),b(n);

        rep(i,n)
        {
            scanf(" %lld %lld %d %d", &p[i], &q[i], &r[i], &b[i]);

            ll g=__gcd(p[i],q[i]);
            p[i]/=g;
            q[i]/=g;

            --r[i];
            --b[i];

            if(r[i]>=0) G[i].pb(r[i]);
            if(b[i]>=0) G[i].pb(b[i]);
        }

        tsort(n);

        vector<F> dat(n);
        vector<F> w;

        dat[tlist[0]] = F(1,1);
        rep(i,n)
        {
            int idx = tlist[i];

            ll D=p[idx]+q[idx];

            F nr = mul(dat[idx],F(q[idx],D));
            F nb = mul(dat[idx],F(p[idx],D));
            if(r[idx]==-1) w.pb(nr);
            else dat[r[idx]]=nr;
            if(b[idx]==-1) w.pb(nb);
            else dat[b[idx]]=nb;
        }

        ll M=1;
        rep(i,w.size()) M = lcm(M,w[i].se);

        ll ans=0;
        rep(i,w.size())
        {
            F t = mul(w[i],F(M,1));
            ans += t.fi;
        }

        printf("%lld\n", ans);

    }
    return 0;
}

Measured memory_bytes: 3124
#include<stdio.h>
int main(void){
    unsigned char a[1000];
    int i;

    scanf("%s",a);
    for(i = 0;a[i] != '\0'; i++){
        if(a[i] == 65) a[i] += 23;
        else if(a[i] == 66) a[i] += 23;
        else if(a[i] == 67) a[i] += 23;
        else a[i] -= 3;
    }
    printf("%s\n",a);
    return 0;
}

Measured memory_bytes: 520
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()

void solution(){
	string s, t;
	cin >> s >> t;
	int ans = (int)t.size();
	for(int i = 0; i <= (int)s.size()-(int)t.size(); i++){
		int cur = 0;
		for(int j = 0; j < (int)t.size(); j++){
			if(t[j] != s[i+j]){
				cur++;
			}
		}
		ans = min(ans,cur);
	}
	cout << ans << endl;
}	


int main(){ 
	fio;
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// cout << "Case #" << i << ": ";
		solution();
	} 
	return 0;
}

Measured memory_bytes: 3644
use proconio::input;
use proconio::marker::{Bytes, Chars};
use std::cmp::{max, min};

fn main() {
    input! {
        (n, m): (usize, usize),
    }
    let mut uf = UnionFind::new(n);
    for _ in 0..m {
        input! {
            (mut a, mut b): (usize, usize),
        }
        a -= 1;
        b -= 1;
        if !uf.same(a, b) {
            uf.unite(a, b);
        }
    }
    let ans = uf.roots().len() - 1;
    println!("{}", ans);
}

struct UnionFind {
    root: Vec<usize>,
    rank: Vec<usize>,
    sizes: Vec<usize>,
    n: usize,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut vec = vec![0;n];
        for i in 0..n {
            vec[i] = i;
        }
        UnionFind {
            root: vec,
            rank: vec![0;n],
            sizes: vec![1;n],
            n,
        }
    }

    fn find(&mut self, x: usize) -> usize {
        if self.root[x] == x { return x }
        self.root[x] = self.find(self.root[x]);
        self.root[x]
    }

    fn unite(&mut self, x: usize, y: usize) -> () {
        let x = self.find(x);
        let y = self.find(y);
        if x == y { return }
        if self.rank[x] < self.rank[y] {
            self.root[x] = y;
            self.sizes[y] += self.sizes[x];
        } else {
            self.root[y] = x;
            self.sizes[x] += self.sizes[y];
            if self.rank[x] == self.rank[y] {
                self.rank[x] += 1;
            }
        }
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn size(&mut self, x: usize) -> usize{
        let f = self.find(x);
        self.sizes[f]
    }

    fn roots(&mut self) -> Vec<usize> {
        let mut vec = vec![];
        for i in 0..self.n {
            if self.root[i] == i {
                vec.push(self.root[i]);
            }
        }
        vec
    }
}

Measured memory_bytes: 5756
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int x;
    cin>>x;
    if(x>=30)
    cout<<"Yes";
    else cout<<"No";

    return 0;
}


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

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

using namespace std;
using lint=long long;

lint pow3[31]; // pow3[i] = 3^i

lint to_int(vector<int> s){
	lint a=0;
	rep(i,s.size()) a=a*3+s[i];
	return a;
}

lint solve(vector<int> x1,vector<int> y1,vector<int> x2,vector<int> y2){
	int n=x1.size();
	if(n==0) return 0;

	lint dist_x=abs(to_int(x1)-to_int(x2));
	lint dist_y=abs(to_int(y1)-to_int(y2));

	if(y1[0]==y2[0] && x1[0]==x2[0]){
		x1=vector<int>(x1.begin()+1,x1.end());
		y1=vector<int>(y1.begin()+1,y1.end());
		x2=vector<int>(x2.begin()+1,x2.end());
		y2=vector<int>(y2.begin()+1,y2.end());
		return solve(x1,y1,x2,y2);
	}
	else if(y1[0]!=y2[0] && x1[0]!=x2[0]){
		return dist_x+dist_y;
	}
	else if(abs(y1[0]-y2[0])==2 && x1[0]==1 && x2[0]==1) {
		vector<int> xl(n,2); xl[0]=0;
		vector<int> xr(n,0); xr[0]=2;
		lint dist_l=to_int(x1)-to_int(xl)+to_int(x2)-to_int(xl); // 左回り
		lint dist_r=to_int(xr)-to_int(x1)+to_int(xr)-to_int(x2); // 右回り
		return min(dist_l,dist_r)+dist_y;
	}
	else if(abs(x1[0]-x2[0])==2 && y1[0]==1 && y2[0]==1) {
		return solve(y1,x1,y2,x2);
	}
	else{
		// (x1,y1) が左上のブロックに来るように調整
		if(y1[0]==1 || x1[0]==1){
			swap(y1,y2);
			swap(x1,x2);
		}
		if(x1[0]==2){
			rep(i,n){
				x1[i]=2-x1[i];
				x2[i]=2-x2[i];
			}
		}
		if(y1[0]==2){
			rep(i,n){
				y1[i]=2-y1[i];
				y2[i]=2-y2[i];
			}
		}

		// (x2,y2) が上段に来るように調整
		if(y2[0]!=0){
			swap(x1,y1);
			swap(x2,y2);
		}

		if(n==1 || y1[1]!=y2[1]){ // 上段の中で違う高さにある
			return dist_x+dist_y;
		}
		else{ // 上段の中で同じ高さにある
			if(x1[1]==2 && x2[0]==1 && x2[1]==0){ // 隣接している
				y1[1]=0;
				y2[1]=0;
				x1[1]=1;
				x2[0]=0;
				x2[1]=2;
				return solve(x1,y1,x2,y2);
			}
			else{
				lint cost=0;
				cost-=x1[1]*pow3[n-2];
				x1[1]=0;
				cost+=x2[0]*pow3[n-1]-(2-x2[1])*pow3[n-2];
				x2[0]=0;
				x2[1]=2;
				return solve(x1,y1,x2,y2)+cost;
			}
		}
	}
}

int main(){
	pow3[0]=1;
	rep(i,30) pow3[i+1]=pow3[i]*3;

	int q; scanf("%d",&q);
	rep(_,q){
		lint a,b,c,d; scanf("%lld%lld%lld%lld",&a,&b,&c,&d); a--; b--; c--; d--;

		auto to_ternary=[](lint a){
			vector<int> s;
			rep(i,30){
				s.emplace_back(a%3);
				a/=3;
			}
			reverse(s.begin(),s.end());
			return s;
		};

		printf("%lld\n",solve(to_ternary(a),to_ternary(b),to_ternary(c),to_ternary(d)));
	}

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,C,D,E,F;
    A = 10;
    B = 11;
    C = 12;
    D = 13;
    E = 14;
    F = 15;
    string a,b;
    cin>>a>>b;
    if(a>b)
        cout<<">"<<endl;
    else if(a<b)
        cout<<"<"<<endl;
    else
        cout<<"="<<endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BISU {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int x, y, z;
	    in >> x >> y >> z;
	    int cnt = 0;
	    x -= z;
	    while(x >= y+z){
	        cnt++;
	        x -= (y + z);
	    }

	    out << cnt << endl;
	}
};


int main() {
	BISU solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	ll N, R;
	cin >> N >> R;

	ll ans = 0;

	if (N >= 10)
	{
		ans = R;
	}
	else
	{
		ans = R + 100 * (10 - N);
	}

	cout << ans << endl;

	//system("pause");
}


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

ll n, dp[2][100010];
vector<int>g[100010];
 
void dfs(int node, int p=-1) {
	dp[0][node] = dp[1][node] = 1;
 
	rep(i, g[node].size()) {
		if(g[node][i] == p) continue;
		dfs(g[node][i], node);	
		dp[0][node] = (dp[0][node] * (dp[0][g[node][i]] + dp[1][g[node][i]])) % num;
		dp[1][node] = (dp[1][node] * dp[0][g[node][i]]) % num;
	}
}

int main(){
	int n;
	cin >> n;
	int x,y;
	rep(i,n-1){
		cin>>x>>y;
		x--;y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	dfs(0);
	cout << (dp[0][0] + dp[1][0])%num << endl;
	return 0;
}

Measured memory_bytes: 12800