akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	while (cin >> n) {
		if (n == 0)
			break;
		vector<int> v(n);

		rep(i, n) cin >> v[i];
		long double sum = accumulate(all(v), 0L);
		long double mean = sum / n;
		long double sd = 0;
		rep(i, n) {
			sd += pow(v[i] - mean, 2);
		}
		printf("%.8Lf\n", sqrt(sd / n));
	}

}


Measured memory_bytes: 3156
// clang-format off
	#define BADSEED random_device{}()
	#include <bits/stdc++.h>
	using namespace std;
	using ll = long long;
	using uint = unsigned int;
	ostream &operator<<(ostream &os, int8_t c) { return os << short(c); }
	istream &operator>>(istream &is, int8_t &c) { short x; is >> x; c = x; return is; }
	#define TM_(...) template <class __VA_ARGS__>
	namespace narut {
	TM_(T) using TupSz = tuple_size<decay_t<T>>;
	TM_(T) constexpr auto spc(T const &t, int) -> decltype((cout << t), 'a') { return ' '; }
	constexpr auto spc(string const &s, int) { return '\n'; }
	TM_(T) constexpr auto spc(T const &t, char) { return '\n'; }
	struct IO {
		TM_(T) static auto out_(ostream &os, T const &t, int) -> decltype(void(os << t)) { os << t; }
		TM_(T, class OS) static auto out_(OS &os, T const &t, int) -> decltype(void(begin(t))) {
			auto it = begin(t), e = end(t);
			if (it != e) out_(os, *it++, 0);
			for (; it != e; out_(os, *it++, 0)) os << spc(*it, 0);
		}
		TM_(T, size_t... Is) static void out_tup(ostream &os, T const &t, index_sequence<Is...>) { (void)initializer_list<int>{0, ((Is == 0) ? 0 : ((os << ' '), 0), (os << get<Is>(t)), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) out_(ostream &os, T const &t, char) { out_tup(os, t, make_index_sequence<TupSz<T>::value>{}); }
		TM_(Sep, class F, class... Ts) static ostream &print(ostream &os, Sep sep, F const &f, Ts const &... ts) { return void(initializer_list<int>{(out_(os, f, 0), 0), (out_(os << sep, ts, 0), 0)...}), os; }
		TM_(T) static auto in_(istream &is, T &t, int) -> decltype(void(is >> t)) { is >> t; }
		TM_(T, class IS) static auto in_(IS &is, T &t, int) -> decltype(void(begin(t))) { for (auto &x : t) in_(is, x, 0); }
		TM_(T, size_t... Is) static void in_tup(istream &is, T &t, index_sequence<Is...>) { (void)initializer_list<int>{0, (in_(is, get<Is>(t), 0), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) in_(istream &is, T &t, char) { in_tup(is, t, make_index_sequence<TupSz<T>::value>{}); }
	};
	} // namespace narut
	#define Cout(...) narut::IO::print(cout, ' ', __VA_ARGS__) << '\n'
	#ifdef NARUT_LOCAL
	#define Debug(...) narut::IO::print(cerr << "\033[0;31m", ", ", __VA_ARGS__) << "\033[0m\n"
	#else
	#define Debug(...) 0
	#endif
	[[maybe_unused]] struct Cin { 
		template <class T> Cin const &operator>>(T &t) const { return narut::IO::in_(cin, t, 0), *this; }
		template <class T> operator T() const { T t; return *this >> t, t;  }	
	} Cin;
	TM_(T) auto operator%(T &t, size_t n) -> decltype(t.resize(n), t)& { return t.resize(n), t; }
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)

// clang-format on



ll Raise(ll x) {
	auto sq = x*x;
	return sq*sq*x;
}

auto Main() {
	ll x;
	cin>>x;	
	
	
	FOR(a, -200, 200) {
		FOR(b, -200, 200) {
			if (Raise(a)-Raise(b)==x) {
				Cout(a,b);
				return;
			}
		}
	}	
	
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	Main();
}


Measured memory_bytes: 3636
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	vector<int> v;
	int N;
	for (int i = 0; i < 2; i++) {
		scanf("%d", &N);
		for (int i = 0; i < N; i++) {
			int h, m;
			scanf("%d %d", &h, &m);
			v.push_back(h * 60 + m);
		}
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	printf("%d:%02d", v[0] / 60, v[0] % 60);
	for (int i = 1; i < v.size(); i++) {
		printf(" %d:%02d", v[i] / 60, v[i] % 60);
	}
	printf("\n");
}

Measured memory_bytes: 1076
#include <iostream>

using namespace std;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, s, n) for(int i = s; i < (int)(n); ++i)

int main() {
  int n;
  cin >> n;
  Rep(i, 10) {
    Rep(j, 10) {
      if (i * j == n) {
        cout << "Yes" << endl;
        return 0;
      } 
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll dp[110][100010];

int main()
{
  int n, W;
  cin >> n >> W;
  vector<int> w(n), v(n);
  for (int i = 0; i < n; ++i)
  {
    cin >> w[i] >> v[i];
  }

  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j <= W; ++j)
    {
      if (j >= w[i])
        dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
      else
        dp[i + 1][j] = dp[i][j];
    }
  }
  cout << dp[n][W] << endl;

  return 0;
}


Measured memory_bytes: 79360
# ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
from collections import deque


def main():
    S = {s: deque(list(input().rstrip())) for s in ("a", "b", "c")}
    cur = S["a"].popleft()
    while S[cur]:  # search greedily
        cur = S[cur].popleft()
    print(cur.upper())


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
//#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1e9;
int n, m;
vector <vector <int> > a;
int ans = 0;
inline bool correct (int x, int y) {
    return 0 <= x && x < n && y >= 0 && y < m;
}
inline void dfs (int x, int y) {
    vector <vector <int> > d(n, vector<int> (m, INF));
    d[x][y] = 0;
    queue <pair<int, int> > q;
    q.push({x, y});
    while (!q.empty()) {
        tie(x, y) = q.front();
        q.pop();
        ans = max(ans, d[x][y]);
        for (int i = 0; i < 4; i++) {
            int tox = x + dx[i], toy = y + dy[i];
            if (correct(tox, toy) && a[tox][toy] && d[tox][toy] == INF) {
                q.push({tox, toy});
                d[tox][toy] = d[x][y] + 1;
            }
        }
    }
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    a.assign(n, vector <int> (m));
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        for (int j = 0; j < m; j++) {
            a[i][j] = s[j] == '.';
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j]) {
                dfs(i, j);
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int a = n-k;
    if(a == 0)
    {
        cout << 1 << endl;
        return 0;
    }
    int count = 0;
    if(a % (k-1) == 0)
    {
        count = a / (k-1);
    }
    else count = a / (k-1) + 1;
    cout << count+1 << endl;
}


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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}

int main(){
  int a=0;
  string s;
  cin>>s;
  rep(i,3){
  if(s[i]=='7'){a=1;}
  }
  if(a==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<vector>
using namespace std;
using I=long long;
#define rep(i,n) for(I i=0;i<n;++i)
int main(){
  I n,k,q;
  cin>>n>>k>>q;
  vector<I> c(n);
  rep(i,q){
    I a;
    cin>>a;
    ++c[a-1];
  }
  rep(i,n){
    cout<<(k-(q-c[i])<=0?"No":"Yes")<<endl;
  }
}


Measured memory_bytes: 1408
N = int(input())
h = list(map(int,input().split()))

def s(l):
    x = list(map(str,l))
    x = [ 'a' + i for i in x ]

    x = ''.join(x)
    x = x.split('a0')
    x = [ i.split('a') for i in x ]
    for i in x:
        i.remove('')

    while [] in x:
        x.remove([])
        
    x = [list(map(int,i)) for i in x]
    return x

def f(l):

    if 0 in l:
        x = s(l)
        y = [f(i) for i in x]
        return sum(y)
    else:
        m = min(l)
        x = [ i-m for i in l]
        return m + f(x)
    
print(f(h))

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,c,k; cin >> n >> c >> k;
    vl t(n);
    rep(i,n) cin >> t[i];
    sort(all(t));
    ll ans = 1;
    ll cnt = 1;
    ll mn = t[0];
    REP(i,1,n){
        if(cnt == c){
            cnt = 1;
            ans++;
            mn = t[i];
        }
        else if(t[i] - mn > k){
            cnt = 1;
            ans++;
            mn = t[i];
        }
        else cnt++;
        //cout << mn << endl;
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ans += a;
    ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <math.h>

#define SQ(a) ((a) * (a))

int main(void)
{
	char rgb[8];
	int r, g, b;
	int i;
	double Dk[8];
	double min;
	int num;
	
	scanf("%s", rgb);
	
	while (rgb[0] != '0'){
		
		for (i = 1; i < 7; i++){
			if (rgb[i] <= '9'){
				rgb[i] -= '0';
			}
			else {
				rgb[i] -= 0x57;
			}
		}
		
		r = rgb[1] * 16 + rgb[2];
		g = rgb[3] * 16 + rgb[4];
		b = rgb[5] * 16 + rgb[6];
		
		Dk[0] = sqrt(SQ(r - 0) + SQ(g - 0) + SQ(b - 0));
		Dk[1] = sqrt(SQ(r - 0) + SQ(g - 0) + SQ(b - 255));
		Dk[2] = sqrt(SQ(r - 0) + SQ(g - 255) + SQ(b - 0));
		Dk[3] = sqrt(SQ(r - 0) + SQ(g - 255) + SQ(b - 255));
		Dk[4] = sqrt(SQ(r - 255) + SQ(g - 0) + SQ(b - 0));
		Dk[5] = sqrt(SQ(r - 255) + SQ(g - 0) + SQ(b - 255));
		Dk[6] = sqrt(SQ(r - 255) + SQ(g - 255) + SQ(b - 0));
		Dk[7] = sqrt(SQ(r - 255) + SQ(g - 255) + SQ(b - 255));
		
		num = 0;
		min = 1000;
		for (i = 7; i >= 0; i--){
			if (min >= Dk[i]){
				min = Dk[i];
				num = i;
			}
		}
		
		switch (num){
			case 0:
			printf("black\n");
			break;
			
			case 1:
			printf("blue\n");
			break;
			
			case 2:
			printf("lime\n");
			break;
			
			case 3:
			printf("aqua\n");
			break;
			
			case 4:
			printf("red\n");
			break;
			
			case 5:
			printf("fuchsia\n");
			break;
			
			case 6:
			printf("yellow\n");
			break;
			
			default:
			printf("white\n");
			break;
		}
		
		scanf("%s", rgb);
	}
	
	return (0);
}

Measured memory_bytes: 0
#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>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H,N; cin>>H>>N;
  vi dp(H+1,MOD);
  dp[0]=0;
  rep(i,0,N){
    int A,B; cin>>A>>B;
    REP(i,1,min(A,H)) dp[i]=min(dp[i],B);
    REP(i,min(A,H)+1,H) dp[i]=min(dp[i],dp[i-A]+B);
  }
  cout<<dp[H]<<endl;
  }



Measured memory_bytes: 384
S = input()

if int(S[0:4]) < 2019:
    print('Heisei')
elif int(S[0:4]) == 2019:
    if int(S[5:7])*30 + int(S[9:11]) > 150:
        print('TBD')
    else:
        print('Heisei')
else:
    print('TBD')

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

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

	int n, c, k;
	cin >> n >> c >> k;

	vector<int> t(n);
	rep(i, n) cin >> t[i];

	sort(all(t));

	int res = 0;
	int i = 0;
	while (i < n)
	{
		res++;
		int start = i;
		while (i < n
			&& t[i] - t[start] <= k
			&& i - start < c) {
			i++;
		}
	}

	out(res);

	return 0;
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	int sum = 0;
	for( int i = 0; i < N; i++ ) {
		sum += A[i];
	}
	int num = 0;
	for( int i = 0; i < N; i++ ) {
		if( sum > 4 * M * A[i] ) continue;
		num++;
	}
	string ans = "No";
	if( num >= M ) ans = "Yes";

	cout << ans << endl;
}


Measured memory_bytes: 256
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
import bisect
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

N = int(input())
T = [None]*N
for i in range(N):
    Ai = int(input())
    T[i] = [-1]*N
    for j in range(Ai):
        xij, yij = map(int, input().split())
        dump(i, xij-1, yij)
        T[i][xij-1] = yij
dump(T)


def imply(p, q): return (not p) or q


ans = -1
for trusts in it.product([0, 1], repeat=N):
    dump(trusts)
    ok = True
    for i, trust in enumerate(trusts):
        if trust:
            for j, tij in enumerate(T[i]):
                ok = ok and imply(tij == 1, trusts[j]) and (
                    imply(tij == 0, not trusts[j]))
    if ok:
        ans = max([ans, len([i for i in trusts if i == 1])])
    dump(ans)
print(ans)


Measured memory_bytes: 4336
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
	int n;
    std::cin >> n;
    std::vector<long long> a(n);
	for (int i=0; i < n; i++){
		std::cin >> a[i];
	}
    long long answer = 1000000001;
    for (int i=0; i < n; i++){
        long long g = std::__gcd(a[0], a[i]);
        if(g<answer) answer = g;
    }

    std::cout << answer << std::endl;
	return 0;
}


Measured memory_bytes: 1024
n, m = map(int, input().split())
grid = []
for i in range(n):
    grid.append(list(input()))
dr = [0, 0, -1, 1]
dc = [1, -1, 0, 0]
base = True
for i in range(n):
    for j in range(m):
        if grid[i][j] == '#':
            flag = False
            for k in range(4):
                newx = i + dr[k]
                newy = j + dc[k]
                if newx < 0 or newx >= n or newy < 0 or newy >= m or grid[newx][newy] == '.':
                    continue
                flag = True
            if not flag:
                print('No')
                base = False
                break
    if not base:
        break
if base:
    print('Yes')

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

int main(){
    int a,b;
    cin >> a >> b;
    string res = "a == b";
    if ( a > b) {
        res = "a > b";
    } else if ( b > a ) {
        res = "a < b";
    }
    cout << res << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int ans = 0;


    for(int i = 0; i <= A; i++) {
        for(int j = 0; j <= B; j++) {
            for(int k = 0; k <= C; k++) {
                if(i*500 + j*100 + k*50 == X) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 3616
N=int(input())
S=input()
ans=1000000000
w=[0]*(N+1)
for i in range(N):
  if S[i]==".":
    w[i+1]=w[i]+1
  else:
    w[i+1]=w[i]
    
for i in range(N+1):
  ans=min(ans,i-2*w[i]+w[N])
print(ans)
  

Measured memory_bytes: 42592
#include<bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define ll long long
#define mod 1000000007
#define bitcount    __builtin_popcountll
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pi pair<int,int>
int a[10][10],ans;
void f(int b[],int pos,int n)
{
	if(pos==n)
	{
		int i=0;;
		for(i=1;i<n;i++)
		{
			//printf("%d ",b[i]);
			if(!a[b[i]][b[i-1]])
				break;
		}
		//printf("\n");
		if(i==n)
			ans++;
		return;
	}
	for(int i=pos;i<n;i++)
	{
		swap(b[i],b[pos]);
		f(b,pos+1,n);
		swap(b[i],b[pos]);
	}
}
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n,m,i,j,k,b[10];
    sd(n);
    sd(m);
    for(i=0;i<m;i++)
    {
    	sd(j);
    	sd(k);
    	a[j][k]=1;
    	a[k][j]=1;
    }
    for(i=0;i<n;i++)
    	b[i]=i+1;
    f(b,1,n);
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
from collections import deque
import sys, copy, itertools,heapq
#input = sys.stdin.readline
 
S = input()
T = input()
 
result = float('inf')
for i in range(len(S) - len(T) + 1):
    t = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            t += 1
    result = min(result, t)
print(result)

Measured memory_bytes: 9432
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int t, n, k;

int main(void) {
  cin >> t;
  while(t--) {
    cin >> n >> k;
    vector<int> x, y;
    for (int i = 0; i < n; i++) {
      int tmp;
      cin >> tmp;
      x.push_back(tmp);
      if (i >= 1) y.push_back(tmp-x[x.size()-2]);
    }
    int ans = x[n-1] - x[0];
    sort(y.begin(), y.end());
    if (k > n) k = n;
    for (int i = 0; i < k-1; i++) {
      ans -= y[y.size()-1-i];
    }
    cout << ans << endl;
  }
  return 0;
}
  

Measured memory_bytes: 2392
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    long long N, K, h[100001], i, j, dp[100001];

    cin >> N >> K;

    for(i=1; i<=N; i++){
        cin >> h[i];

        dp[i] = INF;
    }

    dp[1] = 0;

    for(i=2; i<=N; i++){
        if(i <= K){
            for(j=1; j<=i-1; j++){
                chmin(dp[i], dp[j]+abs(h[j]-h[i]));
            }
        }

        else{
            for(j=i-K; j<=i-1; j++){
                chmin(dp[i], dp[j]+abs(h[j]-h[i]));
            }
        }
    }

    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 1792
# ABC106 D - AtCoder Express 2
n,m,q=map(int,input().split())
mat=[[0]*(n+1) for i in range(n+1)]
for i in range(m):
    l,r=map(int,input().split())
    mat[l][r]+=1

for i in range(n+1):
    for j in range(n+1):
        mat[i][j]+=mat[i-1][j]
        mat[i][j]+=mat[i][j-1]
        mat[i][j]-=mat[i-1][j-1]

for i in range(q):
    l,r=map(int,input().split())
    ans=mat[r][r]+mat[l-1][l-1]-mat[l-1][r]-mat[r][l-1]
    print(ans)

Measured memory_bytes: 13584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#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 all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

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

    string n;
    cin >> n;

    ll result = 0;
    char temp;
    rep(i,n.size()){
        temp = n[i];
        result += atoll(&temp);
    }

    if(result % 9 == 0){
        cout << "Yes";
    }
    else cout << "No";

    return 0;
}

Measured memory_bytes: 3780
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = set(map(int, input().split()))

i = 0
while True:
  if x - i not in p:
    print(x-i)
    break
  elif x + i not in p:
    print(x+i)
    break
  
  i += 1

Measured memory_bytes: 9172
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int k = Integer.parseInt(sc.next());

        // 主処理
        int countOdd = 0;
        int countEven = 0;
        for (int i = 1; i <= k; i++) {
            if (i % 2 == 0) {
                countEven++;
            } else {
                countOdd++;
            }
        }
        int result = countEven * countOdd;

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21844
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int[] num = new int[3];
		for(int i = 0; i < 3; i++){
			num[i] = scanner.nextInt();
		}
		Arrays.sort(num);

		if(num[0] == 5){
			if(num[1] == 5 && num[2] == 7){
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}else{
			System.out.println("NO");
		}
	}
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int H, W, K;

// 0は白、1は黒、2は赤
// 0..H-1, 0..W-1
int GRID[6+2][6+2] = {0};
int WG[6+2][6+2] = {0};


int countBlack(){
	int ret = 0;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(WG[i][j] == 1){
				ret++;
			}
		}
	}
	return ret;
}

void copyGrid(){
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(WG[i][j] = GRID[i][j]){
			}
		}
	}
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> H >> W >> K;
	int b0 = 0; //初期状態での黒いマスの数
	for(int i=0; i<H; i++){
		string S;
		cin >> S;
		for(int j=0; j<W; j++){
			if(S[j] == '#'){ //黒
				GRID[i][j] = 1;
				b0++;
			}
			else{
				GRID[i][j] = 0;
			}
		}
	}

	long long ans = 0;
	for(int bh = 0; bh < (1<<H); bh++){
		for(int bw = 0; bw < (1<<W); bw++){
			copyGrid();
			for(int i=0; i<H; i++){
				if(bh & (1<<i)){
					for(int k=0; k<W; k++){
						WG[i][k] = 2;
					}
				}
			}
			for(int j=0; j<W; j++){
				if(bw & (1<<j)){
					for(int k=0; k<H; k++){
						WG[k][j] = 2;
					}
				}
			}
			if(countBlack() == K){
				ans++;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

int main(){
  int a;
  cin >> a;
  string s = to_string(a);
  if(s[0] == s[2]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No"  << endl;
  }

  return 0;
}


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        if (x >= 1200) {
            System.out.println("ARC");
        } else {
            System.out.println("ABC");
        }
    }
}

Measured memory_bytes: 21844
package main

import (
	"fmt"
)

func Sort(s string) string {
	runes := []rune(s)
	for i := 0; i < len(runes); i++ {
		min := runes[i]
		minIndex := i
		for j := i+1; j < len(runes); j++ {
			if min > runes[j] {
				min = runes[j]
				minIndex = j
			}
		}
		tmp := runes[i]
		runes[i] = min
		runes[minIndex] = tmp
	}
	return string(runes)
}

func Reverse(t string) string {
	runes := []rune(t)
	for i := 0; i < len(runes); i++ {
		max := runes[i]
		maxIndex := i
		for j := i+1; j < len(runes); j++ {
			if max < runes[j] {
				max = runes[j]
				maxIndex = j
			}
			
		}
		tmp := runes[i]
		runes[i] = max
		runes[maxIndex] = tmp
	}
	return string(runes)
}

func main() {
	var s,t string
	fmt.Scan(&s,&t)
	
	if Sort(s) < Reverse(t) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
	
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
using namespace std;
typedef long long ll;
int main() {
    int n, W;
    cin >> n >> W;

    vector<int> v, w;
    for (int i=0; i<n; ++i) {
        int vi; cin >> vi; v.push_back(vi);
        int wi; cin >> wi; w.push_back(wi);
    }

    int dp[101][10001] = {0};
    for (int i=1; i<=n; ++i) {
        for (int j=0; j<10001; ++j) {
            int val1 = 0;
            if (j >= w[i-1]) {
                val1 = v[i-1] + dp[i-1][j - w[i-1]];
            }
            int val2 = dp[i-1][j];
            dp[i][j] = max(val1, val2);
        }
    }

    cout << dp[n][W] << endl;

    return 0;
}

Measured memory_bytes: 5164
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define X real()
#define Y imag()
const double EPS = 1e-8;
const double INF = 1e12;

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}

int main() {
  int x0, y0, x1, y1, Q;
  cin >>x0 >>y0 >>x1 >>y1;
  L l = L(P(x0, y0), P(x1, y1));
  cin >>Q;
  REP(q, Q){
    int x, y; cin >>x >>y;
    P p = P(x, y), ans = projection(l, p);
    printf("%.10lf %.10lf\n", ans.X, ans.Y);
  }
  
  return 0;
}

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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int mx,mi;

int main(){
	int n=read(),d=read();
	mx=d;mi=d;
	for(int i=2;i<=n;i++){
		d=read();
		mx=max(d,mx);
		mi=min(d,mi);
	}
	printf("%d\n",mx-mi);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int n,m ;cin>>n>>m;
  vector <LL>v(n);
  LL su = 0;
  forn(i,n) {cin>>v[i];
    su+=v[i];
  }
  LL cnt= 0;
  forn(i,n){
    if(v[i]*4*m >= su) cnt++;
  }
  if(cnt>=m) cout<<"Yes\n";
  else cout<<"No\n";

  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
		int C = in.nextInt();
		int ans = 0;
		while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
			if (A == B && B == C) {
				ans = -1;
				break;
			}
			int tmpA = A;
			int tmpB = B;
			int tmpC = C;
			A = tmpB / 2 + tmpC / 2;
			B = tmpA / 2 + tmpC / 2;
			C = tmpA / 2 + tmpB / 2;
			ans++;
		}
		System.out.println(ans);
		in.close();
	}
}

Measured memory_bytes: 22612
//control+option+n to run!
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector <long long>
#define sll set <long long>
#define ld long double
#define inf 1000000000000000000;
#define mll multiset <long long>
#define nn <<"\n"
#define F(i,b) for (ll i=0, i<b; i++)
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18

//ALL FUNCTIONS SHOULD BE LL!!!!
long long power(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = power(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}


ll log(ll base, ll number)
{

  int x = base;
  int count = 1;
  while (base < number)
  {
    base *= x;
    count++;
  }
  return count;
}

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

    char a;

    cin>>a;
    if ((int) a >=65 && (int)a<=90){
        cout<<'A';
    }
    else {
        cout<<'a';
    }

}


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N, Y;

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

  cin >> N >> Y;
  int ans1 = -1;
  int ans2 = -1;
  int ans3 = -1;
  rep(i, N+1){
    rep(j, N+1){
      int k = N-i-j;
      if (1000*i+5000*j+10000*k==Y){
        if (k>=0){
          ans1=k;
          ans2=j;
          ans3=i;
          break;
        }
      }
    }
  }

  cout << ans1 << ' ' << ans2 << ' ' << ans3 << "\n";
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int n, d;
int x[101][101];

int main() {

	set<int> S;
	for (int i = 0; i <= 1010; i++)S.insert(i*i);

	cin >> n >> d;

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

	int ret = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			int val = 0;
			for (int k = 0; k < d; k++) {
				val += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
				
			}

			if (S.count(val))ret++;
		}
	}

	cout << ret << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long m[10000000];
int main(){
  string s;
  int n;
  cin>>n>>s;
  size_t size =s.length();
  for(int i=0;i<size;i++){
    if(s[i]+n>90) s[i]=(s[i]+n)%90+64;
    else s[i]=s[i]+n;
  }
  cout<<s<<"\n";
  return(0);
}


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

#define ll long long
#define ar array

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)

#define E_ACH2(x, a) for (auto& x: a)
#define E_ACH3(x, y, a) for (auto& [x, y]: a)
#define E_ACH4(x, y, z, a) for (auto& [x, y, z]: a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...) E_ACHC(__VA_ARGS__)(__VA_ARGS__)

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

	int n;
	cin >> n;
	vector<int> a(n);
	FOR(n)
		cin >> a[i];
	sort(all(a), greater<int>());
	vector<ll> b;
	FOR(n) {
		b.push_back(a[i]);
		if(i)
			b.push_back(a[i]);
	}
	ll ans=0;
	FOR(n-1)
		ans+=b[i];
	cout << ans;
}


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

using namespace std;

int main() {
    string s;
    cin >> s;
    s.erase(remove(s.begin(), s.end(), '/'), s.end());
    int d = stoi(s);
    if (d > 20190430) {
        cout << "TBD\n";
    } else {
        cout << "Heisei\n";
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
int main(){
    int i,n,k;
    string s;
    char a;
    cin>>n>>s>>k;
    a = s[k-1];
    for(i=0;i<n;i++){
        if(s[i]!=a){
            s[i]='*';
        }
    }
    cout<<s;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    edge[x-1].append(y-1)
dp = [0]*N
def f(v):
    if dp[v] != 0:
        return dp[v]
    res = 0
    for i in edge[v]:
        res = max(res, f(i)+1)
    dp[v] = res
    return res
for i in range(N):
    f(i)
print(max(dp))

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (int i = 0; i < (int)S.size(); i++) {
        if ((char)(S[i] + N) <= 'Z') {
            S[i] += N;
        } else {
            int tmp = N - (int)('Z' - S[i]) - 1;
            S[i] = char('A' + tmp);
        }
    }
    cout << S << endl;
}


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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef unsigned long long ULL;
ULL x;
inline void setseed(int x0){x = x0;}
inline ULL getrand(){
    ULL ret = x^(1llu<<63);
    x ^=x<<13;
    x ^=x>>7;
    x ^=x<<17;
    return ret;
}

const int B = 1<<22;
int cnt[B+2];
inline void latte(){
    REP(i,B+2)cnt[i]=0;
}
#define MASK1(x) (x>>42)
#define MASK2(x) ((x<<22)>>42)
#define MASK3(x) ((x<<44)>>44)

int main(){
    int x0,n,k;
    ULL m1,m2;
    cin>>n>>k>>x0;
    latte();
    setseed(x0);
    REP(i,n)cnt[1+MASK1(getrand())]++;
    REP(i,B){
        if(cnt[i+1]>=k){
            m1 = i;
            k -= cnt[i];
            break;
        }
        cnt[i+2]+=cnt[i+1];
    }
    latte();
    setseed(x0);
    REP(i,n){
        ULL y = getrand();
        if(MASK1(y)==m1)
            cnt[1+MASK2(y)]++;
    }
    REP(i,B){
        if(cnt[i+1]>=k){
            m2 = i;
            k -= cnt[i];
            break;
        }
        cnt[i+2]+=cnt[i+1];
    }
    latte();
    setseed(x0);
    REP(i,n){
        ULL y = getrand();
        if(MASK1(y)==m1&&MASK2(y)==m2)
            cnt[1+MASK3(y)]++;
    }
    REP(i,B){
        if(cnt[i+1]>=k){
            cout<<(LL)((1llu<<63)^(m1<<42)^(m2<<20)^(ULL)i)<<endl;
            return 0;
        }
        cnt[i+2]+=cnt[i+1];
    }
    

    return 0;
}

Measured memory_bytes: 19600
N = int(input())
A = list(map(int, input().split()))
dp = [[-10**20 for i in range(3)] for j in range(N+1)]
dp[0][1] = 0
dp[1][1] = 0
dp[1][2] = A[0]

for i in range(1, N):
    if i % 2 == 0:
        dp[i+1][0] = max(dp[i-1][0]+A[i], dp[i][0])
        dp[i+1][1] = max(dp[i-1][1]+A[i], dp[i][1])
        dp[i+1][2] = dp[i-1][2]+A[i]
    else:
        dp[i+1][0] = max(dp[i-1][0]+A[i], dp[i][1])
        dp[i+1][1] = max(dp[i-1][1]+A[i], dp[i][2])
        dp[i+1][2] = dp[i-1][2]+A[i]
ans = dp[N][1]
print(ans)

Measured memory_bytes: 129748
#include<bits/stdc++.h>
using namespace std;
#define ll "%I64d"
const int max1=100010;
//long long a[max1],b[max1];
int main()
{
   string s1,s2;
   cin>>s1>>s2;
   int k=0;
   for(int i=0;i<s1.size();i++)
   {
       if(s1[i]==s2[i])
       {
           k++;
       }
   }
   cout<<k<<"\n";
}



Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int GCD(int x, int y) {
	return x ? GCD(y % x, x) : y;
}

int LCM(int m, int n)
{
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / GCD(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main() {
	int n;
	cin >> n;
	vector<ll>t(n), a(n);
	rep(i, n) {
		cin >> t[i] >> a[i];
	}
	ll takahashi = t[0];
	ll aoki = a[0];
	rep(i, n-1) {
		ll tmp = 1;
		ll j = 1;
		ll k = 1;
		if (takahashi <= t[i]) {
			takahashi = t[i];
		}
		else {
			if (takahashi%t[i] == 0) {
				j = takahashi / t[i];
			}
			else {
				j = takahashi / t[i] + 1;
			}
		}
		if (aoki <= a[i]) {
		    aoki = a[i];
		}
		else {
			if (aoki%a[i] == 0) {
				k = aoki / a[i];
			}
			else {
				k = aoki / a[i] + 1;
			}
		}
		tmp = max(j, k);
		if (tmp > 1) {
			takahashi = t[i] * tmp;
			aoki = a[i] * tmp;
		}
	}
	ll takamin = takahashi;
	ll aomin = aoki;
	if (takahashi %t[n - 1] != 0) {
		takahashi = (takahashi / t[n - 1] + 1)*t[n-1];
	}
	takahashi /= t[n - 1];
	if (aoki%a[n - 1] != 0) {
		aoki = (aoki / a[n - 1] + 1)*a[n - 1];
	}
	aoki /= a[n - 1];
	ll ans = 0;
	if (ans*t[n - 1] >= takamin&&ans*a[n - 1] >= aomin) {
		ans = min(takahashi, aoki);
	}
	else {
		ans = max(takahashi, aoki);
	}
	ans *= (t[n - 1]+a[n - 1]);
	cout << ans << endl;
	
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const double PI = acos(-1);

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n&1||n==0){cout<<0;return 0;}
    else{
        int ans = 0;
        n/=2;
        while(n){
            ans+=n/5;
            n/=5;
        }
        cout<<ans<<endl;
    }
}

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

int main() {
  char N[5] = {0};
  cin >> N;
  
  int i = 0, yesno = 0, val = 0;
  val = N[0];
  if (N[0] == N[1]) {
    // 0,1,2 or 0,1,2,3
    if (N[1] == N[2]) {
        yesno = 1;
    }
  } else {
    // 1,2,3
    if ((N[1] == N[2]) && (N[2] == N[3])) {
        yesno = 1;
    }
  }
  if (yesno == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python

from typing import List


def f(n: int, a_list: List[int]) -> int:
    """
    >>> f(5, [2, 1, 5, 4, 3])
    4
    """
    ans = 0

    n_max: int = a_list[0]
    for i, a_i in enumerate(a_list):
        if n_max > a_i:
            ans += n_max - a_i
        else:
            n_max = a_i

    return ans


if __name__ == '__main__':
    n = int(input())
    a_list = list(map(lambda x: int(x), input().split()))
    print(f(n, a_list))

Measured memory_bytes: 33568
def cake(k, t, a):
    if t == 1:
        return k - 1

    a.sort()
    left = 0
    right = sum(a)
    diff = right

    for i in a:
        left += i
        right -= i
        diff = min(diff, abs(right-left))

    return max(0, diff-1)


if __name__ == "__main__":
    k, t = map(int, input().split())
    a = list(map(int, input().split()))
    ans = cake(k, t, a)
    print(ans)


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

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  int h;

  for (int i = 0; i < n; i++){
    cin >> h;
    if (h >= k) ans++;
  }

  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    ll N;
    cin >> N;
    ll a[N];
    ll sum[100002] = {0};
    REP(i, N){
        cin >> a[i];
        sum[a[i]]++;
        if(a[i] - 1 >= 0)
            sum[a[i] - 1]++;
        if(a[i] + 1 <= 100000)
            sum[a[i] + 1]++;
    }
    ll maxv = sum[0];
    FOR(i, 1, 100002){
        if(sum[i] != 0){
            if(maxv < sum[i])
                maxv = sum[i];
        }
    }
    cout << maxv << endl;
    return 0;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vint a(3*N);
  rep(i, 3*N) cin >> a[i];
  sort(all(a));
  int ans = 0, sum = 0;
  for(int i = N; i < 3*N; i+=2) {
    sum += a[i];
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long H, W, N;
  cin >> H >> W >> N;

  set<pair<long, long>> dots;
  set<pair<long, long>> to_survey;

  rep(i, N) {
    long a, b;
    cin >> a >> b;
    dots.insert(make_pair(a, b));
    for (long x = -1; x <= 1; x++) for (long y = -1; y <= 1; y++) {
      if (a + x <= 1 or H <= a + x or b + y <= 1 or W <= b + y ) continue;
      to_survey.insert(make_pair(a + x, b + y));
    }
  }

  unordered_map<long, long> result;

  for (auto it: to_survey) {
    // cout << "--- it.first: " << it.first << ", it.second: " << it.second << endl;
    long count = 0;
    for (long x = -1; x <= 1; x++) for (long y = -1; y <= 1; y++) {
      pair<long, long> foo = make_pair(it.first + x, it.second + y);
      if (dots.count(foo)) count++;
    }
    result[count]++;
  }

  long zero = (H-2) * (W-2);
  for (auto it: result) zero -= it.second;
  result[0] = zero;

  rep (i, 10) cout << result[i] << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 64768