akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define Ans(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 1010;

int main()
{
	int n, k;
	string s;
	cin >> n >> k >> s;

	s[k - 1] = tolower(s[k - 1]);
	cout << s << endl;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

template <typename T1, typename T2>
bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll mx = 0;
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ans += max(mx - A[i], 0ll);
        chmax(mx, A[i]);
    }
    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 4780
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    cout << (1900 * M + 100 * (N - M))*pow(2, M) << endl;


    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int K,A,B; cin>>K>>A>>B;
  int ans;
  if(A+2>=B||A>=K){
    ans=K+1;
  }
  else{
    int P=B-A;
    int Q=K-A+1;
    ans=Q/2*P+A;
    if(Q%2==1)
      ans++;
  }
  cout<<ans<<endl;
  }


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

#define pb push_back 
#define x first 
#define y second 
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair< int , int > PII;
const int dirx[] = {-2,-1,1,2, 1, -1};
const int diry[] = {0,1,1,0, -1, -1};
inline void debugMode() {
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif
}

int n, a, b, T;

int main(){
	//debugMode();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	int x = 0, y = 0, t = 0;
	for (int i = 1; i <= n; i++){
		cin >> T >> a >> b;
		if (abs(a - x) + abs(y - b) > T) return cout << "No", 0;
		if ((abs(a - x) + abs(y - b)) % 2 != (T - t) % 2) return cout << "No", 0; 
		x = a, y = b, t = T;
	}
	
	cout << "Yes";

	return 0;
}


Measured memory_bytes: 256
N=int(input())
T=list(map(int,input().split()))
M=int(input())
PX=[list(map(int,input().split())) for _ in range(M)]

for px in PX:
  p=px[0]
  x=px[1]
  Total=sum(T)
  Total-=T[p-1]-x
  print(Total)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N;
    cin >> N;
    vector<int> V(N, 0);
    vector<int> C(N, 0);
    for(int i = 0; i < N; i++)
        cin >> V[i];
    for(int i = 0; i < N; i++)
        cin >> C[i];
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if (V[i] - C[i] > 0)
            ans += (V[i] - C[i]);
    }
    cout << ans << endl;
    // max(X - Y)
    // X -> max; Y-> min
    return 0;
}



Measured memory_bytes: 256
def main():
    t = list(input())

    n = len(t)
    p = 0
    while p < n:
        if p == n-1:
            if t[p] == '?':
                t[p] = 'D'
            p += 1
        else:
            if t[p] == 'P' and t[p+1] == '?':
                t[p+1] = 'D'
                p += 2
            elif t[p] == '?' and t[p+1] == 'D':
                t[p] = 'P'
                p += 2
            elif t[p] == '?' and t[p+1] == '?':
                t[p] = 'P'
                t[p+1] = 'D'
                p += 2
            elif t[p] == '?':
                t[p] = 'D'
                p += 1
            else:
                p += 1

    print(''.join(t))

if __name__ == '__main__':
    main()


Measured memory_bytes: 10916
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 150005;

vector<int> G[MAX_N];
double dp[MAX_N];
double dp2[MAX_N];
double ans[MAX_N];
int eda[MAX_N];

void dfs(int u,int p)
{
    int cnt = 0;
    double res = 0;
    if((int)G[u].size() == 1 && G[u][0] == p){
        dp[u] = 0;
        return;
    }
    rep(i,G[u].size()){
        if(G[u][i] != p){
            cnt++;
            dfs(G[u][i],u);
            res += dp[G[u][i]];
        }
    }
    eda[u] = cnt;
    dp[u] = res/cnt + 1;
}

void dfs2(int u,int p)
{
    rep(i,G[u].size()){
        if(G[u][i] != p){
            if(u == 0){
                if(eda[u] == 1){
                    dp2[G[u][i]] = 1;
                }else{
                    dp2[G[u][i]] = (dp[u]*eda[u]-(1+dp[G[u][i]]))/(eda[u]-1) + 1;
                }
            }else{
                dp2[G[u][i]] = dp2[u]/eda[u] + dp[u]-(1+dp[G[u][i]])/eda[u] + 1;
            }
            ans[G[u][i]] = dp2[G[u][i]]/(eda[G[u][i]]+1) + dp[G[u][i]]*eda[G[u][i]]/(eda[G[u][i]]+1);
            dfs2(G[u][i],u);
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        G[a-1].pb(b-1),G[b-1].pb(a-1);
    }
    dfs(0,-1);
    ans[0] = dp[0];
    dp2[0] = 0;
    dfs2(0,-1);
    // rep(i,n){
    //     cout << i << " " << dp[i] << endl;
    // }
    rep(i,n){
        printf("%.12lf\n",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

ll modpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}
ll modinv(ll a, ll m) {
    return modpow(a, m - 2, m);
}

int main() {
    init();

    ll n, p; string s; cin >> n >> p >> s;

    ll ans = 0;
    if (10 % p == 0) {
        FOR(i, 0, n)if ((s[i] - '0') % p == 0)ans += i + 1;
    }
    else {
        VL a(n + 1);
        ll fil = modpow(10, n - 1, p);
        FOR(i, 0, n) {
            if (0 < i)(a[i + 1] += a[i]) %= p;
            (a[i + 1] += (s[i] - '0') * fil) %= p;
            (fil *= modinv(10LL, p)) %= p;
        }

        map<ll, ll> ma;
        ++ma[0];
        eFOR(i, 1, n) {
            ans += ma[a[i]];
            ++ma[a[i]];
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 2580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
	char data[53];
	for(int i=0;i<26;i++){
		data[i]='A'+i;data[i+26]='a'+i;
	}
	int n,k;
	string s;
	while(cin>>n,n){
		int k[100];
		for(int i=0;i<n;i++)cin>>k[i];
		cin>>s;
		int a[100];
		for(int i=0;i<s.size();i++){
			if(s[i]>='a')a[i]=26+(s[i]-'a');
			else a[i]=s[i]-'A';
			int t=a[i]-k[i%n];
			if(t<0)t+=52;
			cout<<data[t];
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1196
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 3005
#define ll long long
#define mod 1000000007
#define inv2 500000004ll
int f[N][N],ans,n,Q,a[N],tmp=1;
int main()
{
	scanf("%d%d",&n,&Q);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(a[i]<a[j])f[i][j]=1;
	int x,y;
	while(Q--)
	{
		scanf("%d%d",&x,&y);
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%mod;
		for(int i=1;i<=n;i++)
			if(i!=x&&i!=y)
				f[x][i]=f[y][i]=(f[x][i]+f[y][i])*inv2%mod,
				f[i][x]=f[i][y]=(f[i][x]+f[i][y])*inv2%mod;
		tmp=(tmp<<1)%mod;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			ans=(ans+f[i][j])%mod;
	printf("%lld\n",(ll)ans*tmp%mod);
}

Measured memory_bytes: 35584
def f(A, B, C):
    ans = 'NO'
    for k in range(1, B + 1):
        if (k * A % B == C):
            ans = 'YES'
    return ans


if __name__ == "__main__":
    A, B, C = map(int, input().split())
    print(f(A, B, C))

Measured memory_bytes: 2940
n, m = map(int, input().split())
l = [1, n]
for _ in range(m):
  a, b = map(int, input().split())
  if a <= l[1] and b >= l[0]:
    if a > l[0]:
      l[0] = a
    if b < l[1]:
      l[1] = b
  else:
    l = [1, 0]
    break

if l[1] >= l[0]:
  print(l[1]-l[0]+1)
else:
  print(0)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#include <stdio.h>
#define ll long long
#include<cstring>
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>QUE;//きゅー

int length(char* str) {
	int len = strlen(str);
	return len;
}

int main(void)
{
	int D;
	cin >> D;
	if (D == 3 || D == 5 || D == 7) {
		cout << "YES";
		return 0;
	}
	cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int p = 4280,c,n;
	while(1){
		cin >> n;
		if(n == -1) break;
		c = 1150;
		if(n > 10) c += 125 * (n - 10);
		if(n > 20) c += 15 * (n - 20);
		if(n > 30) c += 20 * (n - 30);
		cout << p - c << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for (int i=(a); i<(b); i++)
int main()
{
	int n, sum=0;
	cin>>n;
	int a[n],b[n];
	For(i,0,n)
		cin>>a[i];
	For(i,0,n)
	{
		cin>>b[i];
		if (a[i]-b[i]>0)
			sum+=a[i]-b[i];
	}
	cout<<sum;
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine();
            var b = Console.ReadLine();
            var c = Console.ReadLine();
            Console.WriteLine(a[0].ToString() + b[1].ToString() + c[2].ToString());
        }
    }
}

Measured memory_bytes: 11092
N = int(input())
S1 = input()
S2 = input()
mod = 1000000007
j = 0
if S1[0] == S2[0]:
    ans = 3
else:
    ans = 6
while 1:
    if S1[j] == S2[j]:
        j += 1
        if j >= N:
            break
        ans = ans*2
    else:
        j += 2
        if j >= N:
            break
        if S1[j] != S2[j]:
            ans = ans*3
print(ans%mod)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
  
int main(){
int n,x;
cin>>n;
for(int i=1;i<=n;i++){
if ( i% 3 == 0 ){
    cout << " " << i;
}else{
x=i;
while(x){
if( x% 10 == 3 ){
    cout << " " << i;
    break;
}else{
x=x/10;
}
}
}
  
}
cout<<endl;
}

Measured memory_bytes: 3092
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

int32_t N;
int color[100000] = {};
std::vector<std::pair<int,int>> graph[100000];

void dfs(int v, int p)
{
	for (auto& n : graph[v])
	{
		if (n.first != p) {
			color[n.first] = (color[v]+n.second)%2;
			dfs(n.first, v);
		}
	}
}

int main()
{
	fill_all(color, -1);
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	for (int i = 0; i < N-1; i++)
	{
		int a, b, c;
		in >> a >> b >> c;
		--a; --b; c %= 2;
		graph[a].emplace_back(b, c);
		graph[b].emplace_back(a, c);
	}

	color[0] = 0;
	dfs(0, -1);
	for (int i = 0; i < N; i++)
	{
		out << color[i]<<'\n';
	}

	return 0;
}
#endif


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

int main(){
  int n; string s; cin>>n>>s;
  int ans=0;
  if(n%2==0){
    rep(i,n/2){
      if(s[i]==s[i+n/2]){
        ans++;
      }
    }
  }
  if(ans==n/2&&ans!=0) cout << "Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

using namespace std;
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;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    int ret=(int)1e9;
    for(int c:a){
        vector<int> v;
        vector<int> ans;
        
        rep(i,n){
            if(a[i]<c){
                int sz=(int)v.size();
                if(sz-k+1>=0){
                    sort(ALL(v));
                    rep(j,sz-k+1){
                        ans.pb(v[j]);
                    }
                }
                v.clear();
            }else{
                v.pb(a[i]);
            }
        }
        int sz=(int)v.size();
        if(sz-k+1>=0){
            sort(ALL(v));
            rep(j,sz-k+1){
                ans.pb(v[j]);
            }
        }
        sort(ALL(ans));
        if(ans.size()>=q){
            chmin(ret,ans[q-1]-ans[0]);
        }
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3696
import statistics
import math

N = int(input())
listA = [0] * N
listB = [0] * N
idx = 0
for i in range(N):
  listA[idx],listB[idx] = map(int, input().split())
  idx += 1

medianA = 0
medianB = 0
ans = 0
if N%2 == 0:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = (medianB - medianA) * 2 + 1
else:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = medianB - medianA + 1

print(int(ans))

Measured memory_bytes: 28712
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  long long m=0,r=0,c=0,h=0,a=0;
  cin>>n;
  vector<string>s(n);
  for(int i=0;i<n;i++)cin>>s[i];
  for(int i=0;i<n;i++)
  {
    if(s[i][0]=='M')m++;
    if(s[i][0]=='A')a++;
    if(s[i][0]=='R')r++;
    if(s[i][0]=='C')c++;
    if(s[i][0]=='H')h++;
  }
  long long ans=(m*a*r)+(m*a*c)+(m*a*h)+(m*r*c)+(m*r*h)+(m*c*h)+(a*r*c)+(a*r*h)+(a*c*h)+(r*c*h);
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  ll l,r;
  ll ans = 3000;
  cin >> l >> r;
  r = min(r, l+3000);

  if(l >= r) r+= mod;
  for(ll i = l; i < r; ++i) {
    for(ll j = i+1; j <= r; ++j) {
      // cout << "(" << i << "," << j << ")" << endl;
      ans = min(ans, i * j % mod);
      if(ans == 0) break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s;
    int flag=0,sum_A=0,sum_Un=0;
    for (int i=0;i<n;i++) {
        cin>>s;
        if (s=="A") {
            sum_A++;
            flag=1;
        } else if (s=="Un") {
            sum_Un++;
            if (flag==1&&sum_A!=0) {
                sum_A--;
                sum_Un--;
                if (sum_A==0) {
                    flag=0;
                }
            }
        }
    }
    if (flag==0&&sum_A==0&&sum_Un==0) {
        cout<<"YES"<<endl;
    } else {
        cout<<"NO"<<endl;
    }
}



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

int main() {

	int n;
  	vector<int> v(1, 0);
  	v.push_back(1);
  
	cin >> n;
  
	for (int i = 2;i<n+2;i++){
      	v.push_back(v[i-1]+v[i-2]);
      	//cout<< v[i] <<endl;
    }
  
  	cout<< v[n+1] <<endl;

}


Measured memory_bytes: 3152
N = int(input())

lst = [input() for i in range(N)]

import collections

c = dict(collections.Counter(lst))
c_s = sorted(c.items(), key=lambda x:-x[1])
ma = c_s[0][1]
ans = []
for i in c_s:
  if (i[1] == ma):
    ans.append(i[0])
s_ans = sorted(ans)
for i in s_ans:
  print(i)

Measured memory_bytes: 120528
a, b, q = map(int, input().split())
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
x = [(int(input()), i) for i in range(q)]
x = sorted(x)

def check(x, s0, s1, t0, t1):
    ans = float('inf')
    for x1, x2 in [(s0, t0), (s0, t1), (s1, t0), (s1, t1),
                   (t0, s0), (t0, s1), (t1, s0), (t1, s1)]:
        ans = min(ans, abs(x-x1)+abs(x1-x2))
    return ans

s0, t0 = -float('inf'), -float('inf')
s1, t1 = s[0], t[0]
i_s, i_t = 0, 0
answers = []
for x_i, i in x:
    while s1 < x_i and i_s < a-1:
        s0 = s1
        i_s += 1
        s1 = s[i_s]
    while t1 < x_i and i_t < b-1:
        t0 = t1
        i_t += 1
        t1 = t[i_t]
    ans = check(x_i, s0, s1, t0, t1)
    answers.append((i, ans))

for _, ans in sorted(answers):
    print(ans)


Measured memory_bytes: 37792
#include <iostream>
#include <string>
using namespace std;
int main(){
        string s;
        int i,n,x=0;
        int max=0;
        cin >> n;
        for(i=0; i<n; i++) {
                cin >> s[i];
        }
        for(i=0; i<n; i++) {
                if(s[i] == 'I') {
                        x++;
                }else{
                        x--;
                }
                if(max < x) {
                        max = x;
                }
        }
        cout << max  << endl;
        return 0;
}


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

int main(){

  int n, m;
  int a[200005];
  map<int, int> mp;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    mp[a[i]]++;
  }
  int t, flag = 1;
  cin >> m;
  for(int i = 0; i < m; i++){
    cin >> t;
    mp[t]--;
    if(mp[t] < 0) flag = 0;
  }
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 10368
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
#define N (ll)(1e6+3)
#define INF (ll)(1e18+3)
#define MOD (ll)(1e9+7)
 
#define ll long long
#define rep(i,a,n) for(ll i = a; i < n; i++)
#define per(i,a,n) for(ll i = n-1; i >= a; i--)
 
//using namespace __gnu_pbds;
using namespace std;
 
// typedef
// tree<
//     pair<ll,ll>,
//     null_type,
//     less<pair<ll,ll>>,
//     rb_tree_tag,
//     tree_order_statistics_node_update>
// ordered_set;

ll n, m;
ll a[305][305];
bool b[305];

ll calc() {
    ll cnt[305] = {0};
    rep(i,0,n) {
        rep(j,0,m) {
            if (!b[a[i][j]]) {
                cnt[a[i][j]]++;
                break;
            }
            if (j == m-1) return INF;
        }
    }

    ll mx = 0;
    rep(c,0,305)
        mx = max(mx, cnt[c]);
    rep(c,0,305)
        if (cnt[c] == mx)
            b[c] = true;
    return mx;
}

void solve() {
    cin >> n >> m;
    rep(i,0,n)
        rep(j,0,m) {
            cin >> a[i][j];
            a[i][j]--;
        }

    ll ans = INF;
    rep(i,0,305) {
        ans = min(ans, calc());
    }
    cout << ans << endl;
}
 
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int answer;

void saiki( int number, int sum, int t )
{

	if( number == 0 ){
		if( sum == 0 ){
			answer++;
			return;
		} else {
			return;
		}
	}

	if( sum < 0 ) return;

	if( t > 9 ) return;


	saiki( number - 1, sum - t, t + 1 );

	saiki( number, sum, t + 1 );

}

int main(void)
{
	int number, sum;

	while( cin >> number >> sum && ( number || sum ) ){
		answer = 0;
		saiki( number, sum, 0 );
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  rep(i,n) cin>>a[i];
  int ans=0;
  int cnt=1;
  rep(i,n){
    if(a[i]==i+1){
      cnt++;
    }else{
      ans+=cnt/2;
      cnt=1;
    }
  } ans+=cnt/2;
  cout<<ans<<endl;
  

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
int main(void)
{
  int n, a[200000], b[200000];
  std::cin >> n;
  for(int i = 0; i != n; i++){
    std::cin >> a[i];
    b[i] = a[i];
  }
  std::sort(a, a + n);
  for(int i = 0; i != n; i++){
    std::cout << (b[i] >= a[n / 2] ? a[n / 2 - 1] : a[n / 2]) << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3712
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
#define lb lower_bound
#define ub upper_bound
//hash base 177013

int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		string s;
		cin>>s;
		int temp=0,ans=0;
		fi(0,(int)s.size())
		{
			if(s[i]=='R') ans++;
			else 
			{
				temp=max(temp,ans);
				ans=0;
			}
		}
		temp=max(temp,ans);
		cout<<temp<<'\n';
		
		
	}
}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  queue<pair<int, int>> que;
  vector<vector<int>> count(H, vector<int>(W, -1));
  
  vector<vector<char>> maze(H, vector<char>(W, ' '));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> maze.at(i).at(j);
      if (maze.at(i).at(j) == '#') {
        que.push(pair<int, int>(i, j));
        count.at(i).at(j) = 0;
      }
    }
  }
  
  int dx[] = {1, -1, 0, 0};
  int dy[] = {0, 0, 1, -1};
  
  while (!que.empty()) {
    pair<int, int> pos = que.front();
    que.pop();
    
    for (int i = 0; i < 4; i++) {
      int nx = pos.first + dx[i];
      int ny = pos.second + dy[i];
      
      if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
      if (maze.at(nx).at(ny) == '#') continue;
      if (count.at(nx).at(ny) != -1) continue;
      
      count.at(nx).at(ny) = count.at(pos.first).at(pos.second) + 1;
      que.push(pair<int, int>(nx, ny));
    }
  }
  
  int result = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (count.at(i).at(j) > result) {
        result = count.at(i).at(j);
      }
    }
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 13328
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dbg
#define dloop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for((i)=0;(i)<(n);(i)++)
#else
#define dprintf      (1)?0:printf
#define dbg          (1)?0:
#define dloop(i,s,g) if(0)
#define drep(i,n)    if(0)
#endif

#define INF  (0x7fffffff)
#define LINF (0x7fffffffffffffff)

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())

//typedef long long           int;
typedef long long           ll;
typedef unsigned            ui;
typedef unsigned long long  ull;
typedef pair<int,int>       i_i;
typedef pair<ll,int>        ll_i;
typedef pair<ll,ll>         ll_ll;
typedef pair<double,int>    d_i;
typedef pair<double,double> d_d;

signed main(void)
{
  ull n;
  ull a[312345]={};
  cin>>n;
  ull i;
  ull m=3*n;
  rep(i,m)
    cin>>a[i];
  sort(a,a+m,greater<int>());
  drep(i,m)cout<<a[i]<<endl;
  m=n*2;
  ull sum=0;
  for(i=1;i<m;i+=2)
    sum+=a[i];
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 2816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
    class Program
    {
        static string[] sers = { "the", "this", "that" };
        const int COUNT = 'z' - 'a'+1;

        static void Main(string[] args)
        {
            string str;
            string result = "";
            while ((str = Console.ReadLine()) != null)
            {
                for (int i = 0; i < COUNT; i++)
                {
                    bool isAccepted = false;
                    result = shift(str, i);
                    foreach (var v in sers)
                    {
                        if (result.Contains(v)) { isAccepted = true; break; }
                    }
                    if (isAccepted) break;
                }
                Console.WriteLine(result);
            }
        }

        static string shift(string str, int i)
        {
            string result = "";
            foreach (var v in str)
            {
                result += isSmallLetter(v) ? (char)((v - 'a' + i) % COUNT + 'a') : v;
            }
            return result;
        }

        static bool isSmallLetter(char c)
        {
            return 'a' <= c && c <= 'z';
        }
    }
}

Measured memory_bytes: 6320
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

class Node(var key:Int, var par:Node?, var lef: Node?,var rig:Node?) {
    fun find(value :Int) : Node? = when {
        this.key > value -> lef?.find(value)
        this.key < value -> rig?.find(value)
        this.key == value -> this
        else -> null
    }

    fun insert(value :Int) {
        if(this.key > value){
            if(this.lef == null){
                this.lef = Node(value, this, null, null)
            }else{
                this.lef!!.insert(value)
            }
        }else{
            if(this.rig == null){
                this.rig = Node(value, this, null, null)
            }else{
                this.rig!!.insert(value)
            }
        }
    }
}

val root = Node(-1, null, null, null)

fun main(args: Array<String>) {
    val n = nextInt()
    for(i in 0 until n) {
        val command = next()
        if (command == "print") {
            printTree()
        } else {
            val (com, value) = command.split(" ")
            val key = value.toInt()
            if (com == "insert") {
                if (root.key == -1) {
                    root.key = key
                    continue
                }
                root.insert(key)
            }
            else if (com == "find") {
                if(root.find(key) != null) println("yes") else println("no")
            }
        }
    }

}

fun preOrder(d :Node?) {
    if (d == null) return
    print(" ${d.key}")
    preOrder(d.lef)
    preOrder(d.rig)
}

fun inOrder(d :Node?) {
    if(d == null) return
    inOrder(d.lef)
    print(" ${d.key}")
    inOrder(d.rig)
}

fun printTree(){
    inOrder(root)
    print("\n")
    preOrder(root)
    print("\n")
}


fun abc000a() {
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }


Measured memory_bytes: 185780
import math

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

qq = {}
for i in range(2, int(math.sqrt(M)) + 2):
    while M % i == 0:
        if i in qq:
            qq[i] += 1
        else:
            qq[i] = 1
        M //= i
if M > 1:
    qq[M] = 1

def pow(n, r):
    if r == 0:
        return 1
    if r % 2 == 0:
        return pow(n * n % mod, r // 2) % mod
    else:
        return n * pow(n, r - 1) % mod

ans = 1
a = 0

for r in qq.values():
    C = 1
    for i in range(r):
        C = C * (N + r - 1- i) * pow(i + 1, mod - 2) % mod
    a += r
    ans = ans * C % mod

print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  int n, x;
  cin >> n >> x;
  int d = 0;
  int ans = 1;
  while(n--) {
    int l;
    cin >> l;
    d += l;
    if (d <= x) {
      ans++;
    } else {
      break;
    }
  }
  cout << ans << endl;
  // int x;
  // cout << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iostream>
#include <deque>
#include <math.h>
#include <cstdio>
#include <iomanip>
typedef  long long ll;
using namespace std;

int main(void) {
	int n, m;
	cin >> n >> m;
	ll ans = n * (n - 1) / 2 + m * (m - 1) / 2;
	cout << ans << endl;

	return 0;
}

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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  for (int i=0; i<110; i++) {
    a+=" ";b+=" ";c+=" ";
  }
  deque<char> A,B,C;
  for (int i=0; i<108; i++) {
    A.push_back(a.at(i));B.push_back(b.at(i));C.push_back(c.at(i));
  }
  char symbol='a';
  while(true) {
    if(symbol=='a'){
      if(A.front()==' ') {
        cout << "A" << endl; break;
      }
      else {
        symbol=A.front(); A.pop_front();
      }
    }
    else if(symbol=='b'){
      if(B.front()==' ') {
        cout << "B" << endl; break;
      }
      else {
        symbol=B.front(); B.pop_front();
      }
    }
    else {
      if(C.front()==' ') {
        cout << "C" << endl; break;
      }
      else {
        symbol=C.front(); C.pop_front();
      }
    }
  }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n=ir.nextInt();
		int a=ir.nextInt();
		int b=ir.nextInt();
		out.println((a-b)%2==0?"Alice":"Borys");
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

Measured memory_bytes: 23124
N = int(input())
S = input()
k = len(set(S))

count = 0
for i in range(1, N-k+1):
    X = set(S[:i])
    Y = set(S[i:])
    c = sum([1 if x in Y else 0 for x in X])
    count = c if c > count else count

print(count)

Measured memory_bytes: 3060
def solve(s, K):
    cs = sorted(set(s))
    ws = set([])
    for i in range(len(s)):
        c = s[i]
        if c in cs[:2]:
            ws.add(c)
            ws.add(s[i:i+2])
            ws.add(s[i:i+3])
            ws.add(s[i:i+4])
            ws.add(s[i:i+5])
    wss = sorted(ws)
    return wss[K - 1]

s = input()
K = int(input())

print(solve(s, K))


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <iomanip>

const int MOD = 1000000007;


ll POWER(ll x,ll y)
{
	ll ret=1;
	ll p=x;
	for (ll i=y;i>0;i/=2)
	{
		if (i%2) ret=(ret*p)%MOD;
		p=(p*p)%MOD;
	}
	return ret;
}
ll gcm(ll a, ll b)
{
	if (b>a) {ll c=a; a=b; b=c;}
	while (b>0)
	{
		ll r=a%b;
		a=b;
		b=r;
	}
	return a;
}


int main(int argc, char *argv[])
{
	string s,t;
	cin>>s>>t;
	const int sl=s.length();
	const int tl=t.length();
	int ret=sl;
	for (int i=0;i<=sl-tl;i++)
	{
		int c=0;
		for (int j=0;j<tl;j++)
		{
			c+=(s[i+j]!=t[j]);
		}
		if (c<ret) ret=c;
	}
	cout<<ret<<endl;
	return 0;
}



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

#define MOD 1000000007

typedef struct node{int value;struct node* right;struct node* left;}node;

void swap(int* a,int* b){int c=*a;*a=*b;*b=c;}
int gcd(int a, int b){if(a<b){swap(&a,&b);}while(a%b!=0){int c=a%b;a=b;b=c;}return b;}
int permutations(int n, int r){int a=n;for(int i=1;i<=r;i++){a*=n-i;}return a;}
int combination(int n, int r){if(r==0||r==n){return 1;}if(r==1){return n;}return combination(n-1,r-1)+combination(n-1,r);}
int isPrime(int n){if(n==1){return 0;}if(n==2||n==3){return 1;}if(n%2==0||n%3==0){return 0;}for(int i=5;i*i<=n;i+=2){if(i%3==0){continue;}if(n%i==0){return 0;}}return 1;}
int compare_ascending(const void* a, const void* b){return *(int*)a-*(int*)b;}

float to_deg(float r){
    return r * 180.0 / (atan(1.0) * 4.0);
}

int main(){
    int a, b, x;
    scanf("%d%d%d", &a, &b, &x);
    int w = a*a*b - x;
    float ans;
    if(x >= a*a*b/2.0){
        float b2 = w*2.0/(a*a);
        ans = to_deg(atan2f(b2, a));
    }else{
        float a2 = x*2.0/(a*b);
        ans = 90.0 - to_deg(atan2f(a2, b));
    }
    printf("%lf", ans);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	string s; cin >> s;
	bool ok = true;
	rep(i,s.size()){
		if(i%2 == 0 && s[i] == 'L') ok = false;
		if(i%2 == 1 && s[i] == 'R') ok = false;
	}
	cout << (ok ? "Yes":"No") << endl;
}


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

int main() {
    long long a, b, x, ans;
    cin >> a >> b >> x;
    ans = 0;
    if (a == 0){
        a = 1;
        ans = 1;
    }
    ans += b / x;
    ans -= (a - 1LL) / x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=100000+10;
const int maxm=1000+10;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const ll LINF=(1LL<<62);
const double PI=acos(-1.0);
#define mst(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for (int i=(a);i<b;i++)
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) x&(-x)
#define X first
#define Y second
ll hehe[100];
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    //ios::sync_with_stdio(false); cin.tie(0);
    int n; scanf("%d",&n);
    hehe[0]=2; hehe[1]=1;
    for (int i=2;i<=n;i++) hehe[i]=hehe[i-1]+hehe[i-2];
    printf("%lld\n",hehe[n]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 1e9
#define Inf 1000000000000000000LL
using namespace std;
typedef pair<int,int>pii;
int n,m;
vector<int>G[100010],ord;
int par[100010],val[100010];
int ll[100010],rr[100010];
bool known[100010],vis[100010];
bool pr[100010][2];
void die(string st){
	cout<<st<<endl;
	exit(0);
}
void dfs(int x=1){
	vis[x]=1;
	ll[x]=-INF-1;
	rr[x]=INF+1;
	for(auto to:G[x]){
		if(vis[to])continue;
		dfs(to);
		par[to]=x;
		if(pr[to][0])pr[x][1]=1;
		if(pr[to][1])pr[x][0]=1;
		ll[x]=max(ll[x],ll[to]-1);
		rr[x]=min(rr[x],rr[to]+1);
	}
	if(known[x]){
		ll[x]=max(ll[x],val[x]);
		rr[x]=min(rr[x],val[x]);
		pr[x][val[x]%2]=1;
	}
	if(pr[x][0]==1&&pr[x][1]==1)die("No");
	if(ll[x]>rr[x])die("No");
	ord.pb(x);
}
void make(int x=1){
	vis[x]=1;
	if(x==1&&!known[x])val[x]=ll[x];
	for(auto to:G[x]){
		if(vis[to])continue;
		if(!known[to]){
			if(ll[to]<=val[x]-1&&val[x]-1<=rr[to])val[to]=val[x]-1;
			else val[to]=val[x]+1;
		}
		make(to);
	}
}
int main(){
	cin>>n;
	for(int i=1,x,y;i<n;i++){
		cin>>x>>y;
		G[x].pb(y);
		G[y].pb(x);
	}
	cin>>m;
	for(int i=1,x,y;i<=m;i++){
		cin>>x>>y;
		known[x]=1;
		val[x]=y;
	}
	dfs();
	memset(vis,0,sizeof(vis));
	make();
	puts("Yes");
	for(int i=1;i<=n;i++)cout<<val[i]<<endl;
	// for(int i=1;i<=n;i++)cout<<ll[i]<<' '<<rr[i]<<endl;
	return 0;
}


Measured memory_bytes: 16632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n;
	cin >> n;
	long long ans = 1;
	bool b = true;
	for (int i = 0; i < n; i++) {
		long long a;
		cin >> a;
		if (a == 0) {
			b = true;
			ans = 0;
			break;
		}
		long long co = 1000000000000000000 / ans;
		if (a > co) {
			b = false;
		}
		if (b == true) {
			ans *= a;
		}
	}
	if (b == true) {
		cout << ans << endl;
	}
	else {
		cout << "-1" << endl;
	}
	return 0;
}


Measured memory_bytes: 3600