akhauriyash/Code-Regression huggingface dataset:
N = int(input())
t = [0]
x = [0]
y = [0]

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i+1]-t[i]
    dis = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if time<dis:
        flag = False
        break
    elif (time%2 + dis%2) == 1:
            flag = False
            break
    i += 1

if flag == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 11728
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

const unsigned long long BASE = 1e9 + 7;

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int count = 0;
    for (int i = l; i <= r; i++)
    {
        if (i % d == 0)
            count++;
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
const int n_max=2e5+1;
vector<int> g[n_max];

pair<int, int> dfs(int v, int p, int d){
  pair<int, int> pans={-1,-1};
  for(auto i:g[v]){
    if(i!=p){
      pair<int, int> pt=dfs(i,v, d+1);
      if(pt.second>pans.second){
	pans=pt;
      }
    }
  }
  if(pans.second!=-1) return pans;
  pair<int, int> pa;
  pa={v,d};
  
  return pa;  
}



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

  int n;
  cin >> n;
  int a,b;
  rep(i,n-1){
    cin >> a >> b;
    a--; b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  int s=dfs(0,-1,0).first;
  int dia=dfs(s,-1,0).second;
  if((dia+1)%3==2) cout << "Second" << endl;
  else cout << "First" << endl;
  //  cout << s << " " << dfs(s,-1,0).second << " " << dia << endl;
  
  return 0;
    

}


Measured memory_bytes: 29952
package main

import (
   "fmt"
   "sort"
)

func solution(q, h, s, d, n int) int {
   //  25: q
   //  50: h
   // 100: s
   // 200: d
   // 100: n
   n = 100 * n
   out := 0
   a := [][]int{{25, q, 8 * q}, {50, h, 4 * h}, {100, s, 2 * s}, {200, d, d}}
   sort.SliceStable(a, func(i, j int) bool {
        if a[i][2] == a[j][2] {
                return a[i][0] < a[j][0]
        }
        return a[i][2] < a[j][2]
   })

   for i := range a {
        if n >= a[i][0] {
                out += a[i][1] * (n / a[i][0])
                n %= a[i][0]
        }
   }
   return out
}

func main() {
   var q, h, s, d, n int
   fmt.Scan(&q, &h, &s, &d, &n)
   fmt.Println(solution(q, h, s, d, n))
}

Measured memory_bytes: 1840
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

int main() {
    ll x, y;
    cin >> x >> y;
    int count = 0;
    ll val = x;
    while (val <= y) {
        val *= 2;
        count++;
    }
    cout << count << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int n,m,k;scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			int cnt=m*i-i*j+(n-i)*j;
			if(cnt==k){
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  cout << a.back() - a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool a[1000000]; 
main(){
  vector<int>p;
  for(int i=2;i<10000;i++){
    if(!a[i]){
      p.push_back(i);
      for(int j=i;j<10000;j+=i)
        a[j]=1;
    }
  }
  int a,b,m;
  while(cin>>m>>a>>b,m){
    vector<pair<int,pair<int,int> > >v;
    for(int i=p.size()-1;i>=0;i--)
      for(int j=p.size()-1;j>=0;j--){
        int pp=p[i],qq=p[j];
       if(pp*qq<=m&&(double)a/b<=(double)pp/qq&&(double)pp/qq<=1)
          v.push_back(make_pair(qq*pp,make_pair(pp,qq)));
      }
    sort(v.begin(),v.end());
    cout<<v[v.size()-1].second.first<<' '<<v[v.size()-1].second.second<<endl;
  }
}

Measured memory_bytes: 3256
import numpy as np

n, k = map(int, input().split())
h = np.array([int(i) for i in input().split()])

dp = np.zeros(n)
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    ik = max(0, i-k)
    dp[i] = np.min(dp[ik:i]+np.abs(h[i]-h[ik:i]))

print(int(dp[n-1]))


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    string s, t;
    int q;
    cin >> s >> t >> q;
    int lens = (int)s.size(), lent = (int)t.size();

    vector<int> cntsa(lens+1), cntsb(lens+1), cntta(lent+1), cnttb(lent+1);
    for (int i=1; i<lens+1; ++i) {
        cntsa.at(i) = cntsa.at(i-1);
        cntsb.at(i) = cntsb.at(i-1);
        if (s.at(i-1) == 'A') ++cntsa.at(i);
        else ++cntsb.at(i);
    }
    for (int i=1; i<lent+1; ++i) {
        cntta.at(i) = cntta.at(i-1);
        cnttb.at(i) = cnttb.at(i-1);
        if (t.at(i-1) == 'A') ++cntta.at(i);
        else ++cnttb.at(i);
    }

    vector<bool> res(q);
    for (int i=0; i<q; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int sa = cntsa.at(b) - cntsa.at(a-1), sb = cntsb.at(b) - cntsb.at(a-1);
        int ta = cntta.at(d) - cntta.at(c-1), tb = cnttb.at(d) - cnttb.at(c-1);
        int ma = (ta - sa) % 3, mb = (tb - sb) % 3;
        if (ma < 0) ma += 3;
        if (mb < 0) mb += 3;
        if (ma == mb) res.at(i) = true;
        else res.at(i) = false;
    }
    for (auto b : res) {
        if (b) cout << "YES" << '\n';
        else cout << "NO" << '\n';
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 2512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

const int N = 81;

bool dp[N][N][2*N*N];

int main() {
    int h, w;
    cin >> h >> w;
    
    vvl a(h, vl(w)), b(h, vl(w));
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }
    rep(i, h) {
        rep(j, w) {
            cin >> b[i][j];
        }
    }
    
    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    rep(i, h) {
        rep(j, w) {
            rep(k, 2*N*N) {
                if(!dp[i][j][k]) {
                    continue;
                }
                if(i < h-1) {
                    int x = abs(a[i+1][j] - b[i+1][j]);
                    dp[i+1][j][abs(k + x)] = true;
                    dp[i+1][j][abs(k - x)] = true;
                }
                if(j < w-1) {
                    int x = abs(a[i][j+1] - b[i][j+1]);
                    dp[i][j+1][abs(k + x)] = true;
                    dp[i][j+1][abs(k - x)] = true;
                }
            }
        }
    }

    ll ans = INF;
    rep(k, 2*N*N) {
        if(dp[h-1][w-1][k]) {
            chmin(ans, k);
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 83456
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

int f(int b, int n) {
	return n < b ? n : f(b, n / b) + (n % b);
}

signed main() {
	int n, s; cin >> n >> s;
	int ans = -1;
	if (s == n) {
		ans = n + 1;
	}
	for (int i = 2; i * i <= n && ans == -1; i++) {
		if (f(i, n) == s) ans = i;
	}
	for (int p = sqrt(n); p >= 1 && ans == -1; p--) {
		int q = s - p;
		int b = (n - q) / p;
		if (p < b && 0 <= q && q < b && b >= 2 && p * b + q == n) ans = b;
	}
	cout << ans << endl;
	system("pause");
}

Measured memory_bytes: 504
#include<iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define inf mod1
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
int main(){
	fast;
	ll h = 1;
	//scanf("%lld", &h);
    while(h--){ 
            ll n, k, s;
            cin >> n >> k >> s;
            if(k == n){
                for(int i = 0; i < n; i++){
                    cout << s << ' ';
                }
                cout << endl;
                return 0;
            }
            for(int i = 1; i <= k; i++){
                cout << s << " ";
            }
            if(s != 1){
                if(s > 2){
                for(int i = k + 1; i <= n; i++){
                    cout << s - 1 << " ";
                }
                cout << endl;
                return 0;}
                for(int i = k + 1; i <= n; i++){
                    cout << 10000 << " ";
                }
                cout << endl;
                return 0;
            }
            for(int i = k + 1; i <= n; i++){
                cout << 2 << " ";
            }
            cout << endl;
            return 0;
        }
    }       

Measured memory_bytes: 1280
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }

//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p%i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		O("+");
	}
	else if (a*b == 15) {
		O("*");
	}
	else {
		O("x");
	}

	return 0;
}

Measured memory_bytes: 256
import math
import sys


def nontrivial_divisors(x):
	for i in range(1, math.floor(math.sqrt(x)) + 1):
		d, m = divmod(x, i)
		if m == 0:
			if i != x:
				yield i
			if d != x:
				yield d


def solve(n, qs):
	ps = [0] # sent.
	ps.extend(qs)
	balls = [0] * (n + 1)
	vals = [0] * (n + 1)
	divs = [set() for _ in range(n + 1)]
	for i in range(1, n // 2 + 1):
		for j in range(2, n // i + 1):
			divs[i * j].add(i)
	# print(divs, file=sys.stderr)
	first = n // 2 + 1
	last = n
	while True:
		for i in range(first, last + 1):
			if vals[i] % 2 != ps[i]:
				balls[i] += 1
				vals[i] += 1
				for j in divs[i]:
					vals[j] += 1
		if first == 1:
			break
		last = first - 1
		first = last // 2 + 1
	for i in range(1, n + 1):
		if vals[i] % 2 != ps[i]:
			return None
	else:
		bs = [b for b in range(1, n + 1) if balls[b]]
		m = len(bs)
		return m, bs
	

def main():
	n = int(input())
	qs = [int(q) for q in input().split()]
	res = solve(n, qs)
	if res is None:
		print(-1)
	else:
		m, bs = res
		print(m)
		print(*bs)


if __name__ == "__main__":
	main()

Measured memory_bytes: 229416
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> trg(m);
    VI cnt(n);
    REP(i,m){
        cin >> trg[i];
        //cout << trg[i] << endl;
    }
    REP(i,n){
        cnt[i]=0;
        //cout << cnt[i] << endl;
    }
    vector< vector <int>> a (m, vector<int>(n) );
    REP(i,m){
        REP(j,n){
            cin >> a[i][j];
            //cout << a[0][1] << endl;
        }
    }
    REP(j,n){
        REP(i,m){
             if(trg[i]==a[i][j]){
            cnt[j]++;
            //cout << a[i][j] << ' ' << i << ' ' << j<< endl; 
            }else{
                cnt[trg[i]-1]++;
                //cout << a[i][j] << ' ' << i << ' ' << j << endl; 
            }
            //cout << a[i][j] << ' ' << trg[j] << endl; 
        }
    }
    REP(i,n){
        cout << cnt[i] << endl;
    }
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <math.h>
int main(void)
{
  double a,b,c;
  double S,L,h;
  
  scanf("%lf",&a);
  scanf("%lf",&b);
  scanf("%lf",&c);

  S=(a*b*sin((M_PI*c)/180))/2;
  L=a*a+b*b-2*a*b*cos((M_PI*c)/180);
  L=sqrt(L);
  L=L+a+b;
  h=(2*S)/a;

  printf("%f\n%f\n%f\n",S,L,h);

  return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char s[100];
	scanf("%s",&s);
	int n=strlen(s),b=0;
	for(int i=0,j=n-1;i<n,j>=0;i++,j--)
	{
		if(s[i]!=s[j])
		{
			printf("No");
			return 0;
		}
	}
	for(int i=0,j=(n-2)/2;i<(n-1)/2,j>=0;i++,j--)
	{
		if(s[i]!=s[j])
		{
			printf("No");
			return 0;
		}
	}
	for(int i=(n+2)/2,j=n-1;i<n-1,j>=(n+2)/2;i++,j--)
	{
		if(s[i]!=s[j])
		{
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> a(N,0);
    vector<ll> b(N,0);
    for(ll i=0;i<N;++i)cin>>a[i];
    for(ll i=0;i<N;++i)cin>>b[i];
    ll suma=0,sumb=0;
    for(auto p: a)suma+=p;
    for(auto p: b)sumb+=p;
    ll k=sumb-suma;
    //debug(suma)
    //debug(sumb)
    ll ka=0;ll kb=0;
    for(ll i=0;i<N;++i){
        if(a[i]>=b[i]){
            kb+=a[i]-b[i];
        }
        else if((b[i]-a[i])%2==0){
            ka+=(b[i]-a[i])/2;
        }
        else {
            ka+=(b[i]-a[i])/2+1;
            kb+=1;
        }
    }
    if(ka<=k&&kb<=k){
        prt("Yes");
    }
    else prt("No");
    //debug(ka)
    //debug(kb)
    //debug(k)
    return 0;
}



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


    int[] ar = new int[3];
    ar[0] = sc.nextInt();
    ar[1] = sc.nextInt();
    ar[2] = sc.nextInt();
    Arrays.sort(ar);
    System.out.println(ar[2]-ar[0]);
  }
}

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

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

  vector<int> x(N), y(N), h(N);
  rep(i, N) cin >> x[i] >> y[i] >> h[i];

  rep(i, 101) {
    rep(j, 101) {
      int curr = -1, memo = -1;
      rep(k, N) {
        if (h[k] == 0)
          continue;

        curr = h[k] + abs(x[k] - i) + abs(y[k] - j);
        if (memo == -1)
          memo = curr;

        if (curr == memo)
          continue;

        curr = -1;
        break;
      }

      if (curr == -1)
        continue;

      bool ok = true;
      rep(k, N) {
        if (h[k] != 0)
          continue;
        if (curr - abs(x[k] - i) - abs(y[k] - j) > 0)
          ok = false;
      }

      if (ok) {
        cout << i << " " << j << " " << curr << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
import math

def F(A,B):
    if A > B:
        return len(str(A))
    else:
        return len(str(B))
            

N = int(input())
min = F(1,N)
rt = int(math.sqrt(N))
for i in range(2,rt+1):
    if N % i != 0:
        continue
    f = F(i,int(N/i))
    if f < min:
        min = f
print(min)

Measured memory_bytes: 3064
#include <stdio.h>

void myswap(int *, int *);

int main(int argc, char const *argv[])
{
    int a, b, c;
    int temp;
    scanf("%d %d %d", &a, &b, &c);
    if (a>b){myswap(&a, &b);}
    if (b>c){myswap(&b, &c);}
    if (a>b){myswap(&a, &b);}
    printf("%d %d %d\n", a, b, c);
    return 0;
}

void myswap(int *p1, int *p2)
{
    int temp;
    temp = *p1;
    *p1 = *p2;
    *p2 = temp;
}


Measured memory_bytes: 2140
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
var lines = input.split('\n');

var n = +lines.shift();

for (var i = 0; i < n; i++) {
    var str = lines.shift();
    var min = str.split('').sort();
    var max = str.split('').sort(function(a,b){
        return b.charCodeAt(0) - a.charCodeAt(0);
    });
    var diff = (max.join('') - 0) - (min.join('') - 0);
    console.log(diff);
}

Measured memory_bytes: 7640
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+100;
int n;
int A[maxn];
int main()
{
    while(cin>>n)
    {
        if(n==1)
        {
            cout<<1<<endl;
            continue;
        }
        int maxx=INT_MIN,maxx2=INT_MIN,pos1=-1,pos2=-1;
        for(int i=0;i<n;i++)
        {
            cin>>A[i];
            if(maxx<A[i])
            {
                maxx2=maxx;
                pos2=pos1;
                maxx=A[i];
                pos1=i;
            }
            else if(maxx2<A[i])
            {
                maxx2=A[i];
                pos2=i;
            }
        }
        for(int i=0;i<n;i++)
        {
            if(i!=pos1)
                cout<<maxx<<endl;
            else
            {
                if(n==1)
                    cout<<maxx<<endl;
                else
                    cout<<maxx2<<endl;
            }
        }
    }
}

Measured memory_bytes: 2432
import sys
import math
from collections import deque

N = int(input())
h = list(map(int, input().split()))

dp = [[-1, -1] for _ in range(N)]
dp[0] = [0, 0]
dp[1] = [abs(h[0]-h[1]), abs(h[0]-h[1])]
for i in range(2, N):
    dp[i][0] = min(dp[i - 1]) + abs(h[i] - h[i - 1])
    dp[i][1] = min(dp[i - 2]) + abs(h[i] - h[i - 2])

print(min(dp[N-1]))


Measured memory_bytes: 24272
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]

flag = 0

for i in range(N - 2):
    if D[i][0] == D[i][1]:
        if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                flag = 1

if flag == 1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62504
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int w,h,n,x,y;
  int d[100010]={};
  cin >> w >> h >> n;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    d[y] = max(d[y],x);
  }
  
  for(int i=h-1;i>=0;i--){
    d[i] = max(d[i],d[i+1]);
  }

  int ans = h;
  for(int i=0;i<h;i++){
    ans = min(ans,i+d[i+1]);
  }
  cout << ans << endl;
  return(0);
}



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

int main() {
 ll n,k; cin >> n >>k;
 vector<pair<ll, ll>> p(n);
 for(int i=0;i<n;i++){
 cin >> p[i].first >> p[i].second;
   }

 sort(p.begin(), p.end());
ll cnt=0,ans;
 for(int i=0;i<n;i++){
   cnt+=p[i].second;
   if(cnt>=k){
     ans=p[i].first;
     break;
   }
 }
 cout << ans << endl;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Main me = new Main();
		System.out.println(me.fact(Integer.parseInt(in.readLine())));
	}
	private long fact(long n){
		if(n==0)
			return 1;
		else
			return n*fact(n-1);
	}
}

Measured memory_bytes: 16856
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

template <class T>
struct lazy_segtree {
  int n;
  vector<T> data;
  vector<T> lazy;
  vector<bool> lazyFlag;

  lazy_segtree(const int s) {
    init(s);
  }

  lazy_segtree(const int s, const T u) {
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = u;
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = min(data[i*2+1], data[i*2+2]);
    }
  }

  lazy_segtree(const vector<T> &v) {
    int s = v.size();
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = v[i];
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = min(data[i*2+1], data[i*2+2]);
    }
  }

  void init(const int s) {
    n = 1;
    while (n < s) n <<= 1;
    data = vector<T>(2*n-1);
    lazy = vector<T>(2*n-1);
    lazyFlag = vector<bool>(2*n-1);
  }

  void evaluate(int p, int a, int b) {
    if (lazyFlag[p]) {
      data[p] = lazy[p] * (b - a);
      if (b - a > 1) {
        lazy[p*2+1] = lazy[p];
        lazy[p*2+2] = lazy[p];
        lazyFlag[p*2+1] = true;
        lazyFlag[p*2+2] = true;
      }
      lazy[p] = 0;
      lazyFlag[p] = false;
    }
  }

  void update(int l, int r, T v, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init

    // evaluate lazy value
    evaluate(p, a, b);

    if (r <= a || b <= l) return; // out of range
    if (l <= a && b <= r) { // fully covered
      lazy[p] = v;
      lazyFlag[p] = true;
      evaluate(p, a, b);
    }
    else {
      update(l, r, v, p*2+1, a, (a + b) / 2); // left
      update(l, r, v, p*2+2, (a + b) / 2, b); // right
      data[p] = data[p*2+1] + data[p*2+2]; // update
    }
    return;
  }

  T query(int l, int r, T p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init
    if (r <= a || b <= l) return 0; // out of range

    // evaluate lazy value
    evaluate(p, a, b);

    if (l <= a && b <= r) return data[p];// fully covered

    T vl = query(l, r, p*2+1, a, (a + b) / 2); // left
    T vr = query(l, r, p*2+2, (a + b) / 2, b); // right
    return vl + vr;
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<vector<int> > query(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    cin >> query[i][0] >> query[i][1] >> query[i][2];
    if (query[i][0] == 0) cin >> query[i][3];
  }

  lazy_segtree<ll> lst(n);
  vector<ll> ans;
  for (int i = 0; i < q; i++) {
    if (query[i][0] == 0) { // update
      lst.update(query[i][1], query[i][2]+1, query[i][3]);
    }
    else { // getSum
      ans.push_back(lst.query(query[i][1], query[i][2]+1));
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}



Measured memory_bytes: 13524
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
typedef pair<int, int> P;

int N;
string S;
string ans;
bool check() {
	for (int i = 0; i < N; i++) {
		if (S[i] == 'o') {
			if (ans[i + 1] == 'S') {
				if (ans[i] == 'S') {
					ans += 'S';
				}
				else {
					ans += 'W';
				}
			}
			else {
				if (ans[i] == 'S') {
					ans += 'W';
				}
				else {
					ans += 'S';
				}
			}
		}
		else {
			if (ans[i + 1] == 'S') {
				if (ans[i] == 'S') {
					ans += 'W';
				}
				else {
					ans += 'S';
				}
			}
			else {
				if (ans[i] == 'S') {
					ans += 'S';
				}
				else {
					ans += 'W';
				}
			}
		}
	}
	//cout << ans << endl;
	if (ans[0] == ans[N] && ans[1] == ans[N + 1]) return true;
	else return false;
}

int main()
{
	cin >> N >> S;
	string tmp;
	ans.push_back('S');
	ans.push_back('S');
	if (check()) {
		for (int i = 1; i <= N; i++) {
			cout << ans[i];
		}
		cout << endl;
		return 0;
	}
	ans = tmp;
	ans.push_back('W');
	ans.push_back('S');
	if (check()) {
		for (int i = 1; i <= N; i++) {
			cout << ans[i];
		}
		cout << endl;
		return 0;
	}
	ans = tmp;
	ans.push_back('S');
	ans.push_back('W');
	if (check()) {
		for (int i = 1; i <= N; i++) {
			cout << ans[i];
		}
		cout << endl;
		return 0;
	}
	ans = tmp;
	ans.push_back('W');
	ans.push_back('W');
	if (check()) {
		for (int i = 1; i <= N; i++) {
			cout << ans[i];
		}
		cout << endl;
		return 0;
	}
	cout << -1 << endl;
}


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

typedef long long int ll;
typedef double d;

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)

#define be(a) a.begin(),a.end()
#define sz(x) x.size()

#define nl cout<<"\n";
#define sp cout<<" ";

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    su;
    string s,a,b;
    int n;
    cin>>n>>s;
    if(n&1)
      cout<<"No";
    else
    {
       a=s.substr(0,n/2);
       b=s.substr(n/2);
       if(a==b)
         cout<<"Yes";
       else
         cout<<"No";
    }
    nl;
    return 0;
}


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

int main() {
	string s;
	long long ans = 0, B = 0;
	cin >> s;
	rep(i, s.size()) {
		if (s[i] == 'B') B++;
		else  ans += B;
	}
	cout << ans << endl;
	return 0;
}

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

int main(void) {
    int sum, sum_max;
    int n;
    
    while(cin >> n) {
        if(n == 0) {
            break;
        }
        int array[n] = {};
        for(int i = 0; i < n; ++i) {
            cin >> array[i];
        }
        sum_max = array[0];
        for(int i = 0; i < n; ++i) {
            sum = 0;
            for(int j = i; j < n; ++j) {
                sum += array[j];
                if(sum_max < sum) {
                    sum_max = sum;
                }
            }
        }
        cout << sum_max << endl;
    }
}


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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int n;

  cin>>n;
  
  int a[200001];


  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  if(n%2==0){
    
    for(int i=n-1;i>0;i-=2){
      cout<<a[i]<<" ";
    }
    
    for(int i=0;i<n;i+=2){
      
      if(i>=n-2){
	cout<<a[i]<<endl;
      }else{
	cout<<a[i]<<" ";
      }
    }
  }
  else{

    for(int i=n-1;i>=0;i-=2){

      if(n==1){
	cout<<a[i]<<endl;
      }else{
	cout<<a[i]<<" ";
      }      
      
    }
    
    for(int i=1;i<n;i+=2){
      
      if(i>=n-2){
	cout<<a[i]<<endl;
      }else{
	cout<<a[i]<<" ";
      }
    }
  }
  return 0;

}


Measured memory_bytes: 2944
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

void print_state(int* A, int N) {
    for (int i=0; i<N-1; i++) {
        std::cout << A[i] << " ";
    }
    std::cout << A[N-1] << std::endl;
};

void swap(int* a, int* b) {
    int tmp = *b;
    *b = *a;
    *a = tmp;
};

int main() {
    int N, minj, count=0;
    int A[110];
    std::cin >> N;
    for (int i=0; i<N; i++) {
        std::cin >> A[i];
    }

    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            swap(&A[i], &A[minj]);
            count++;
        }
    }
    print_state(A,N);
    std::cout  << count << std::endl;

    return 0;
}



Measured memory_bytes: 3092
#include<stdio.h>
int main(){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if((h==0)&&(w==0)) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
}

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

int main(){
	int t;
	// cin>>t;
	t =1;
	for (int z = 0; z < t; ++z)
	{	
		string s;
		cin>>s;
		if (s[s.size()-1] == 's')
		{
			s+="es";
		}
		else{
			s+="s";
		}
		cout<<s;
	}
}


Measured memory_bytes: 3640
N,K = map(int,input().split())
D = list(map(str,input().split()))

N -=1
N_str = str(N)
while True:
    N += 1
    N_str = str(N)
    for d in D:
        if d in N_str:
            break
    else:
        break
print(N_str)

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

using namespace std;

const long long MOD = 998244353;

long long bin_pow(long long a, long long n, long long m)
{
    if(n == 0)
        return 1;
    long long p = bin_pow(a, n / 2, m);
    if(n % 2 == 0)
        return (p * p) % m;
    else
        return (((a * p) % m) * p) % m;
}

int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
	int t=c*60+d;
	double sx=b*cos(-t*6*PI/180);
	double sy=b*sin(-t*6*PI/180);
	double tx=a*cos(-t*0.5*PI/180);
	double ty=a*sin(-t*0.5*PI/180);
	printf("%.12f\n",sqrt((sx-tx)*(sx-tx)+(sy-ty)*(sy-ty)));
}

Measured memory_bytes: 2496
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N, X, Y = read.nnn()
local t = array(1, 0)
for i=1,N-1 do
    for j=i+1,N do
        local nouse = j - i
        local useXY = math.abs(X - i) + 1 + math.abs(Y - j)
        local useYX = math.abs(Y - i) + 1 + math.abs(X - j)
        local a = math.min(nouse, useXY, useYX)
        --print(i,j,nouse,useXY,useYX,a)
        t[a] = t[a] + 1
    end
end
for k=1,N-1 do
    print(t[k])
end

Measured memory_bytes: 760
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

int dp[1010][1010];

int main() {
    string s1, s2;
    cin >> s1 >> s2;
    int n1 = s1.length(), n2 = s2.length();

    rep(i, n1+1) rep(j, n2+1) dp[i][j] = INF;
    rep(i, n1+1) dp[i][0] = i;
    rep(i, n2+1) dp[0][i] = i;

    for (int i = 1; i <= n1; i++) {
        for (int j = 1; j <= n2; j++) {
            int cost = (s1[i-1] == s2[j-1] ? 0 : 1);
            chmin(dp[i][j], dp[i-1][j] + 1);
            chmin(dp[i][j], dp[i][j-1] + 1);
            chmin(dp[i][j], dp[i-1][j-1] + cost);
        }
    }
    cout << dp[n1][n2] << endl;
}



Measured memory_bytes: 7172
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    FOR(i,a,b+1){
        if(c%i==0){
            ans++;
        }
    }
    print(ans)
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using LL = long long;

class SegmentTreeRSQ {
private:
    int n;
    vector<LL> node, lazy;

public:
    SegmentTreeRSQ(){

    }
    void init(vector<LL> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, LL x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

   LL getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        LL vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        LL vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};



int main(){
    int N;cin >> N;
    string s;cin >> s;
    int Q;cin >> Q;
    vector<SegmentTreeRSQ> Segtrees(26);
    for(int i = 0;i < 26;i++){
        Segtrees[i].init(vector<ll>(N));
    }
    for(int i = 0;i < N;i++){
        Segtrees[s[i] - 'a'].add(i, i+1, 1);
    }
    while(Q--){
        int x;
        cin >> x;
        if(x == 1){
            int i;
            char c;
            cin >> i >> c;
            i--;
            Segtrees[s[i] - 'a'].add(i, i+1, -1);
            s[i] = c;
            Segtrees[s[i] - 'a'].add(i, i+1, 1);
        }else{
            int l,r;cin >> l >> r;
            l--;
            int ans = 0;
            for(int i = 0;i < 26;i++){
                if(Segtrees[i].getsum(l, r) != 0){
                    ans++;
                }
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 431040
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int getint()
{
    ll i=0,f=1;char c;
    for(c=getchar();(c!='-')&&(c<'0'||c>'9');c=getchar());
    if(c=='-')c=getchar(),f=-1;
    for(;c>='0'&&c<='9';c=getchar())i=(i<<3)+(i<<1)+c-'0';
    return i*f;
}
const int N=200005,mod=924844033,g=5;
int n,tot,first[N],nxt[N<<1],to[N<<1],size[N];
ll fac[N],invfac[N],w[N],invw[N],a[N<<3],b[N<<3];
int pos[N<<3];
ll Pow(ll x,int y)
{
	int res=1;
	for(;y;y>>=1,x=x*x%mod)
		if(y&1)res=res*x%mod;
	return res;
}
void add(int x,int y)
{
	nxt[++tot]=first[x],first[x]=tot,to[tot]=y;
}
void dfs(int u,int fa)
{
	size[u]=1;
	for(int e=first[u];e;e=nxt[e])
	{
		int v=to[e];if(v==fa)continue;
		dfs(v,u),size[u]+=size[v];
		a[size[v]]--;
	}
	a[n]++,a[n-size[u]]--;
}
void NTT(ll *f,int len,int on)
{
	for(int i=1;i<len;i++)if(i<pos[i])swap(f[i],f[pos[i]]);
	for(int i=1,num=1;i<len;i<<=1,num++)
	{
		ll wi=on==1?w[num]:invw[num];
		for(int j=0;j<len;j+=(i<<1))
		{
			ll wn=1;
			for(int k=j;k<j+i;k++)
			{
				ll u=f[k],v=wn*f[k+i];
				f[k]=(u+v)%mod,f[k+i]=(u-v+mod)%mod;
				wn=wn*wi%mod;
			}
		}
	}
	if(on==-1)for(int i=0,inv=Pow(len,mod-2);i<len;i++)f[i]=f[i]*inv%mod;
}
int main()
{
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	n=getint();
	fac[0]=1;for(int i=1;i<=n;i++)fac[i]=fac[i-1]*i%mod;
	invfac[n]=Pow(fac[n],mod-2);
	for(int i=n-1;i>=0;i--)invfac[i]=invfac[i+1]*(i+1)%mod;
	int len=1,num=0;
	while(len<=2*n)
	{
		len<<=1;
		w[++num]=Pow(g,(mod-1)/len);
		invw[num]=Pow(w[num],mod-2);
	}
	for(int i=1;i<len;i++)pos[i]=i&1?pos[i>>1]>>1|(len>>1):pos[i>>1]>>1;
	for(int i=1;i<n;i++)
	{
		int x=getint(),y=getint();
		add(x,y),add(y,x);
	}
	dfs(1,0);
	for(int i=0;i<=n;i++)a[i]=a[i]*fac[i]%mod;
	for(int i=0;i<=n;i++)b[i]=invfac[n-i];
	NTT(a,len,1),NTT(b,len,1);
	for(int i=0;i<len;i++)a[i]=a[i]*b[i]%mod;
	NTT(a,len,-1);
	for(int i=1;i<=n;i++)
		cout<<(a[i+n]*invfac[i]%mod+mod)%mod<<'\n';
}

Measured memory_bytes: 38016