akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

// Z algorithm
// ????????±?????\???????±???????
// O(S)
struct ZAlgorithm {
	// ?????????: a[i]: s??¨s[i:n)???????????±?????\???????????????
	static vector<int> construct(const string &s) {
		int n = s.size();
		vector<int> a(n); a[0] = n;
		int i = 1, j = 0;
		while (i < n) {
			while (i + j < n && s[j] == s[i + j]) ++j;
			a[i] = j;
			if (j == 0) { ++i; continue; }
			int k = 1;
			while (i + k < n && k + a[k] < j) a[i + k] = a[k], ++k;
			i += k; j -= k;
		}
		return a;
	}
	// ?????????: a[i]: t??¨s[i:n)???????????±?????\???????????????
	static vector<int> construct(const string &s, const string &t) {
		vector<int> a = construct(t + s);
		a.erase(a.begin(), a.begin() + t.size());
		int T = t.size();
		for (int &e : a)if (e > T)e = T;
		return a;
	}
	// ?????????: a[i]: t??¨s(i:0]???????????±?????\?°?????????????
	static vector<int> constructSuffix(string s, string t) {
		reverse(s.begin(), s.end());
		reverse(t.begin(), t.end());
		vector<int> a = construct(s, t);
		reverse(a.begin(), a.end());
		return a;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S, T; cin >> S >> T;
	vector<int> prefix = ZAlgorithm::construct(S, T);
	vector<int> suffix = ZAlgorithm::constructSuffix(S, T);
	int ans = 0;
	int s = S.size(), t = T.size();
	rep(i, 0, s - t + 1) {
		if (prefix[i] + suffix[i + t - 1] == t - 1)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n;
  cin >> n;
  vector<int>ar(n), tmp(n);
  for (int i = 0; i < n; i++){
    cin >> ar[i];
  }
  tmp = ar;
  sort(tmp.rbegin(), tmp.rend());
  for (int i = 0; i < n; i++){
    if (ar[i] == tmp[0]){
      cout << tmp[1];
    }
    else {
      cout << tmp[0];
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 3328
/*
 axyb
 abyxb
 ans=b
  0 1 2 3 4
0 1 1 1 1 1
1 1 1 1 2 2
2 1 1 2 2 2
3 1 2 2 2 3
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();

    int dp[n][m];

    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            if(i==0 && j==0)
            {
                if(s[i]==t[j]) dp[i][j] = 1;
                else dp[i][j]=0;
            }
            else if(i==0 && j>0)
            {
                if(s[i]==t[j]) dp[i][j] = 1;
                else dp[i][j]=dp[i][j-1];
            }
            else if(i>0 && j==0)
            {
                if(s[i]==t[j]) dp[i][j] = 1;
                else dp[i][j]=dp[i-1][j];
            }
            else
            {
                if(s[i]==t[j]) dp[i][j] = 1 + dp[i-1][j-1];
                else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }   
        }
    }
    
    int i=n-1;
    int j=m-1;
    string ans ="";
    while(i>=0 && j>=0)
    {
        if(dp[i][j]==0) break;
        if(s[i]==t[j]) {
            ans += s[i];
            i--;
            j--;
            continue;
        }
        else 
        {
            if(i>0 && j>0) 
            {
                if(dp[i-1][j] >= dp[i][j-1]) {
                    i--;
                }
                else j--;
            }
            else if(i==0 && j>0)  j--;
            else if(i>0 && j==0) i--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;

}

Measured memory_bytes: 73920
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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 main() {
  int n;
  cin >> n;
  vector<int> t(n+1), x(n+1), y(n+1);
  FORe(i, 1, n) cin >> t[i] >> x[i] >> y[i];
  REP(i, n) {
    int dt, dx, dy;
    dt = abs(t[i+1]-t[i]);
    dx = abs(x[i+1]-x[i]);
    dy = abs(y[i+1]-y[i]);
    int dc = dx+dy;
    if (dc<=dt && (dc%2)==(dt%2)) continue;
    else {
      cout << "No" << endl;
      return 0;
    }

  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 1408
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    input += chunk;
});
process.stdin.on('end', function() {
    main(input)
});

function main(input){
    var args = input.trim().split('\n');

    var i = 0;
    while(true) {
        var map = [];
        var wh = splitNum(args[i++]);
        if(isEnd(wh)) break;
        initMap(wh, map);

        var startXY = splitNum(args[i++]);
        var goalXY = splitNum(args[i++]);

        var blockCount = parseInt(args[i++]);
        for(var j = 0; j < blockCount; j+=1){
            var block = splitNum(args[i++]);
            putBlock(map, block);
        }

        var res = isReachable(map, startXY[0]-1, startXY[1]-1, goalXY[0]-1, goalXY[1]-1);
        console.log(res ? "OK" : "NG");
    }
}

function initMap(wh, map){
    for(var x = 0; x < wh[0]; x+=1){
        var buff = [];
        for(var y = 0; y < wh[1]; y += 1){
            buff.push(0);
        }
        map.push(buff);
    }
}

function putBlock(map, block){
    var isHorizontal = !block[1];
    var bw = isHorizontal ? 4 : 2;
    var bh = isHorizontal ? 2 : 4;
    var x = block[2]-1;
    var y = block[3]-1;

    for(var mx = x; mx < x + bw; mx += 1){
        for(var my = y; my < y + bh; my += 1){
            map[mx][my] = block[0];
        }
    }
}

function isReachable(map, nowX, nowY, goalX, goalY){
    if(nowX === goalX && nowY === goalY){
        return true;
    }
    var color = map[nowX][nowY];
    map[nowX][nowY] = -2;

    var flag = false;
    [-1, 0, 1].forEach(function(dx){
        [-1, 0, 1].forEach(function(dy){
            if(!dx && !dy){ return; }
            var cx = nowX + dx, cy = nowY + dy;
            if(map[cx] && map[cx][cy] === color){
                flag = flag || isReachable(map, cx, cy, goalX, goalY);
            }
        })
    });
    return flag;
}

function splitNum(str){
    return str.split(' ').map(Number);
}

function isEnd(arr){
    return arr[0] === 0 && arr[1] === 0;
}

Measured memory_bytes: 17992
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    vector<vector<ll>> a(3,vector<ll>(3));
    rep(i,3){
        rep(j,3){
            cin >> a.at(i).at(j);
        }
    }
    ll n; cin >> n;
    rep(i,n){
        ll x; cin >> x;
        rep(j,3){
            rep(k,3){
                if(x == a.at(j).at(k)){
                    a.at(j).at(k) = 1;
                }
            }
        }
    }
    ll tate = 1, yoko = 1, naname = 1;
    bool flag = 0;
    rep(i,3){
        yoko = a.at(i).at(0)*a.at(i).at(1)*a.at(i).at(2);
        if(yoko==1) flag = 1;
    }
    rep(i,3){
        tate = a.at(0).at(i) * a.at(1).at(i) * a.at(2).at(i);
        if(tate==1) flag = 1; 
    }
    rep(i,3){
        naname *= a.at(i).at(i);
    }
    if(naname==1) flag = 1;
    naname = 1;
    rep(i,3){
        naname*=a.at(i).at(2-i);
    }
    if(naname==1) flag = 1;
    if(flag) cout << "Yes" << endl; else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#define ll long long
using namespace std;

ll n, s;

inline bool is_jz(ll x, int b) {
	ll sum = 0;
	while (x)
		sum += x % b, x /= b;
	return sum == s;
}

int main() {
	scanf("%lld %lld", &n, &s);
	if(n == s) {
		printf("%lld", n + 1);
		return 0;
	}
	int sqr = sqrt(n);
	for (ll i = 2; i <= sqr; ++i)
		if (is_jz(n, i)) {
			printf("%lld", i);
			return 0;
		}
	for (ll i = sqr; i; --i)
		if ((n - s) % i == 0) {
			ll b = (n - s) / i + 1;
			if (b <= i)
				continue;
			if (n % b + i == s) {
				printf("%lld", b);
				return 0;
			}
		}
	printf("-1");
	return 0;
}


Measured memory_bytes: 128
from collections import Counter
from itertools import product

H, W, N, *AB = map(int, open(0).read().split())

move = [
    (-1, -1), (-1, 0), (-1, 1),
    (0, -1),  (0, 0),  (0, 1),
    (1, -1),  (1, 0),  (1, 1),
]

C = Counter()
for a, b in zip(*[iter(AB)] * 2):
    C.update(
        (a - i, b - j)
        for i, j in move
        if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1
    )

D = Counter(v for _, v in C.items())

print((H - 2) * (W - 2) - sum(D.values()))
for i in range(1, 10):
    print(D[i])


Measured memory_bytes: 178396
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



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

    int n, d;
    cin >> n >> d;
    vector<vector<double>> x(n, vector<double>(d));

    for (auto& row : x) {
        for (auto& e : row) {
            cin >> e;
        }
    }

    auto isInteger = [](double x) -> bool {
        return std::floor(x) == x;
    };

    int cnt = 0;
    for (size_t j = 0; j < n; ++j)
    {
        for (size_t i = 0; i < j; ++i)
        {
            double acc = 0.0;
            for (size_t k = 0; k < d; ++k)
            {
                acc += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            double distance = std::sqrt(acc);
            if (isInteger(distance)
                && (fabs(acc) > std::numeric_limits<double>::epsilon())
                )
            {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j) vector<vector<ll>> name(i,vector<ll>(j))
#define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k)))
#define vec3f(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define vec4(name,i,j,k,l) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l))))
#define vec4f(name,i,j,k,l,m) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l,m))))
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

int main(){
    ll n; cin >> n;
    vector<ll> a((1<<n));
    REP(i,(1<<n)) cin >> a[i];
    vec3f(dp,(1<<n),19,2,0);
    REP(i,(1<<n)){
        dp[i][0][0]=a[i];
        REP(j,18){
            if ((1<<j)&i){
                vector<ll> com;
                com.pb(dp[i][j][0]);
                com.pb(dp[i][j][1]);
                com.pb(dp[i&~(1<<j)][j][0]);
                com.pb(dp[i&~(1<<j)][j][1]);
                sort(com.rbegin(),com.rend());
                dp[i][j+1][0]=com[0];
                dp[i][j+1][1]=com[1];
            }
            else{
                dp[i][j+1][0]=dp[i][j][0];
                dp[i][j+1][1]=dp[i][j][1];
            }
        }
    }
    vector<ll> ans((1<<n));
    FOR(i,1,(1<<n)-1){
        ans[i]=max(ans[i-1],dp[i][18][0]+dp[i][18][1]);
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 288592
"use strict"
function Main(input) {
  const params = input.split('\n').map(Number);
  const n = params[0];
  const a = params[1];
  const fraction = n % 500;
 
  if (fraction <= a) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define MAX 100000

int N;
long long A[MAX];
long long B[MAX];
long long C[MAX];

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

	long long res = 0;
	for( int i = 0; i < N; i++ ) {
		C[i] = A[i] - B[i];
		res += C[i];
	}
	sort( C, C + N );
	int ans = 0;
	if( res < 0 ) {
		ans = -1;
	}
	else {
		int mcnt = lower_bound( C, C + N, 0 ) - C;
		int pcnt = C + N - upper_bound( C, C + N, 0 );
		long long acc = 0;
		for( int i = 0; i < mcnt; i++ ) {
			acc += C[i];
		}
		ans = mcnt;
		for( int i = N - 1; i >= N - pcnt; i-- ) {
			if( acc >= 0 ) {
				break;
			}
			acc += C[i];
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2560
S = input()

tmp1 = 0
f = '0'
for s in S:
    if s != f:
        tmp1 += 1
    if f == '0':
        f = '1'
    else:
        f = '0'
tmp2 = 0
f = '1'
for s in S:
    if s != f:
        tmp2 += 1
    if f == '0':
        f = '1'
    else:
        f = '0'
print(min(tmp1, tmp2))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

ll val(ll n)
{
	ll p=0, sum=0;
	while (true) {
		p++;
		sum += p;
		if (sum<=n) {

		}
		else {
			return p-1;
		}
	}
}

void solve()
{
	ll n;
	cin>>n;
	vector<int> cnt;
	int a=0;
	while (n%2==0) {
		n/=2;
		a++;
	}
	if (a) {
		cnt.push_back(a);
	}
	for (ll i=3; i*i<=n; i+=2) {
		int c = 0;
		while (n%i==0) {
			n/=i;
			c++;
		}
		if (c) {
			cnt.push_back(c);
		}
	}
	if (n>2) {
		cnt.push_back(1);
	}
	debug() << imie(cnt);
	ll ans = 0;
	for (int x:cnt) {
		ans += val(x);
	}
	cout << ans << "\n";
}

int main()
{
	int t=1;
	// cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3616
a,b=map(int,input().split())
s=input()
han=0
for i in range(a):
  if s[i].isdecimal() ==False:
    han +=1
    
for i in range(a+1,a+b+1):
  if s[i].isdecimal() ==False:
    han +=1
if s[a]!='-':
  han +=1

if han ==0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 8992
class BinaryTreeNode():
    # __slots__ = ['left', 'right', 'val']
    def __init__(self, left=None, right=None, val=None):
        self.left = left
        self.right = right
        self.val = val

class BinarySearchTree():
    def __init__(self):
        self.root = None

    def insert(self, val):
        y = None
        x = self.root
        while x != None:
            y = x
            if val < x.val:
                x = x.left
            else:
                x = x.right
        node = BinaryTreeNode(val=val)

        if y == None:
            self.root = node
        elif node.val < y.val:
            y.left = node
        else:
            y.right = node

    def preorder(self):
        self.preorder_list = []
        self.preorder_bfs(self.root)
        return self.preorder_list

    def preorder_bfs(self, u):
        if u == None: return
        self.preorder_list.append(u.val)
        self.preorder_bfs(u.left)
        self.preorder_bfs(u.right)

    def inorder(self):
        self.inorder_list = []
        self.inorder_dfs(self.root)
        return self.inorder_list

    def inorder_dfs(self, u):
        if u == None: return
        self.inorder_dfs(u.left)
        self.inorder_list.append(u.val)
        self.inorder_dfs(u.right)

def print_elements(arr):
    print(' ' + ' '.join([str(item) for item in arr]))

m = int(input())
bst = BinarySearchTree()
for i in range(m):
    op = input()
    if op == 'print':
        print_elements(bst.inorder())
        print_elements(bst.preorder())
    else:
        num = int(op[7:])
        bst.insert(num)



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

int euclidean_gcd(int a, int b) {
  if(a < b) return euclidean_gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main()
{
    int k; cin >> k;
    ll x = 0;

    FOR(i, 1, k+1) FOR(j, 1, k+1){
        int d = euclidean_gcd(i, j);
        FOR(l, 1, k+1) {
            x += euclidean_gcd(d, l);
        }
    };
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n;
int a,b,c,d;
string s;
bool ans=true;
int main()
{
	cin>>n;
	cin>>a>>b>>c>>d;
	a--,b--,c--,d--;
	cin>>s;
	for(int i=a;i<c;i++)
	{
		if(s[i]=='#' and s[i+1]=='#')
		{
			ans=false;
		}
	}
	for(int i=b;i<d;i++)
	{
		if(s[i]=='#' and s[i+1]=='#')
		{
			ans=false;
		}
	}
	if(c>d)
	{
		bool check=false;
		for(int i=b;i<=d;i++)
		{
			if(s[i-1]=='.' and s[i]=='.' and s[i+1]=='.')
			{
				check=true;
			}
		}
		if(!check)
		{
			ans=false;
		}
	}
	if(ans)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 640
/*
??????
??\?????????????????¨?¨???§????????????????????????????????????????????°???????????????????????????????????????¨?????????£?????????????°?????????? x ????????¨?????????????????????

1x1=1
1x2=2
.
.
9x8=72
9x9=81
*/

#include <stdio.h>

int main(){
	int i;
	int j;
	int x;

	for(i = 1; i < 10; i++){
		for(j = 1; j < 10; j++){
			x = i * j;
			printf("%dx%d=%d\n",i,j,x);
		}
	}
	return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59


ll ok(ll n){
    ll i;
    ll ans=1;
    ll m=n;
    for(i=2;i*i<=n;i++){
        ll k=0;
        while(m%i==0){
            m=m/i;
            k++;
        }
        if(k>=1) ans*=(k+1);
    }
    if(m>1) ans*=2;
    return ans;
}

int main(){
  ll i,j;
  bool f[101010];
  f[0]=0;
  f[1]=0;
  f[2]=0;
  f[3]=0;
  for(i=4;i<101010;i++){
      if(ok(i)>=5) {
          f[i]=1;
      }
      else f[i]=0;
  }
  ll g[101010];
  g[0]=0;
  for(i=1;i<101010;i++){
      g[i]=g[i-1]+f[i];
  }

  ll q;
  cin>>q;
  for(i=0;i<q;i++){
      ll x;
      cin>>x;
      cout<<g[x]<<endl;
  }

  
  return 0;
}


Measured memory_bytes: 3988
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int N;
int A[20];
int x[20][20];
int y[20][20];

int main()
{
   cout << fixed << setprecision(10);
   cin >> N;
   REP(i, N) {
      cin >> A[i];
      int a,b;
      REP(j, A[i]) {
         cin >> a >> b;
         x[i][j] = a - 1;
         y[i][j] = b;
      }
   }
   int ans = 0;
   eprintf("comb: %d\n", (1 << N));
   REP(i, (1 << N)) {
      eprintf("n th: %d\n", i);
      bool isBad = false;
      int nTrue = 0;
      REP(j, N) {
         if (isBad) {
            break;
         }
         if (i & (1 << j)) {
            eprintf("j is 1: %d\n", j);
            nTrue++;
            REP(k, A[j]) {
               if (y[j][k]) {
                  if (i & (1 << x[j][k])) {
                     eprintf("%d is yes? yes\n", x[j][k]);
                  } else {
                     isBad = 1;
                     eprintf("%d is yes? no\n", x[j][k]);
                     break;
                  }
               } else {
                  if (i & (1 << x[j][k])) {
                     isBad = 1;
                     break;
                  }
               }
            }
         }
         eprintf("j ok: %d\n", j);
      }
      if (!isBad) {
         chmax(ans, nTrue);
      }
   }
   cout << ans << endl;
      
   return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i, b, e) for ( int i = b; i < (int)e; i++ )
#define rep(i, n) REP(i, 0, n)

static const int MAX = 100000;

main(){
  int T[MAX+2], A[MAX+2];
  pair<int, int> M[MAX+2];
  int N, L, ans = 0;
  cin >> N >> L;
  rep(i, N+2) T[i] = 0;
  M[0] = make_pair(0, 0);
  M[N+1] = make_pair(0, N+1);
  rep(i, N+2) A[i] = 0;
  
  REP(i, 1, N+1) {
    cin >> T[i];
    M[i] = make_pair((-1)*T[i], i);
  }
  sort(M, M+(N+2));

  rep(i, N+2){
    int idx = M[i].second;
    if ( idx == 0 || idx == N+1 ) continue;
    if ( T[idx] > T[idx-1] && T[idx] > T[idx+1] ){
      A[idx] = L - T[idx];
    } else {
      A[idx] = max(A[idx-1], A[idx+1]) + (L - T[idx]);
    }
  }
  rep(i, N+2) ans = max(ans, A[i] );
  cout << ans << endl;

}

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

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

  for(int i=0;i<n;i++){
    int v=a[i];
    int j=i-1;
    while(j>=0&&a[j]>v) {
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    for(int k=0;k<n-1;k++) cout<<a[k]<<" ";
    cout << a[n-1]<<endl;
  }
  return 0;
}



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

/*
uint32_t GetHashFromString(char *s) {
  if (!s || ::strlen(s) < 1) return 0;
  uint32_t h = 0;
  size_t len = ::strlen(s);
  for (size_t i = 0; i < len; i++) {
    h += s[i] << (8 * (i % 4));
  }
  //h %= 1000;
  return h;
}
*/

using namespace std;

int main(){
    long N,i,j;
    char S[11];
    unsigned char SS[2000100] = {0};
    long count = 0;
    unordered_map<string, short> scores;

    scanf("%ld", &N);

    for (i = 0; i < N; i++){
        scanf("%s", S);
        scores[S] = 1;
    }

    for (auto it = scores.begin(); it != scores.end(); ++it)
    {
        count++;
    }

    printf("%ld", count);
    return 0;
}


Measured memory_bytes: 17676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int a[] = new int[n];

		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 21972
#include<iostream>
using namespace std;
int main()
{
    int k,a,b,flag=0;
    cin>>k;
    cin>>a>>b;
    int temp=a/k;
    temp=temp*k;
    while(temp<=b)
    {
    if((temp>=a)&&(temp<=b))
    {
        cout<<"OK"<<endl;
        flag=1;
        break;
    }
    else
        temp+=k;
    }
    if(flag==0)
        cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define sec setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.1415926

using namespace std;
ll gcd(ll a, ll b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k <= a)cout << k << endl;
	else if (k <= a + b)cout << a << endl;
	else cout << a - (k - (a + b)) << endl;
}

Measured memory_bytes: 3636
use std::io;
use std::str::FromStr;
fn main() {
    let stdin = io::stdin();
    let mut s = String::new();
    stdin.read_line(&mut s).ok();
    s.pop();
    let mut ab : Vec<i32> = Vec::new();
    let it = s.trim().split_whitespace();
    for arg in it {
        ab.push(i32::from_str(&arg).expect("e"));
    }
    let a = ab[0];
    let b = ab[1];
    println!("{}",(a - 1) * (b - 1));
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define endl '\n'
#define len(a) a.length()
#define TIME cout << endl << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

typedef long long ll;

const long long inf = 1e18;
const double eps = 1e-6;
const long long mod = 1e9 + 7;

int cx[4] = {1, -1, 0, 0};
int cy[4] = {0, 0, 1, -1};

int hx[8] = {2, 2, -2, -2, 1, -1, 1, -1};
int hy[8] = {1, -1, 1, -1, 2, -2, -2, 2};

bool on_board (ll x, ll y, ll n, ll m) {
    return x >= 0 && y >= 0 && x < n && y < m;
}

bool be_pow_two (ll a) {
    return ((a & (a - 1)) == 0);
}

ll binpow (ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1LL)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1LL;
	}
	return res;
}

ll string_to_int (string s) {
    reverse(all(s));
    int pw = 1;
    int ans = 0;
    for (int i = 0; i < len(s); i++) {
        ans += (s[i] - '0') * pw;
        pw *= 10;
    }
    return ans;
}

ll div_up (ll x, ll y) {
    if (x == 0)
        return 0;
    return (x - 1) / y + 1;
}

bool is_prime (ll a) {
    for (ll i = 2; i <= sqrt(a); i++)
        if (a % i == 0)
            return false;
    return true;
}

int len_num (int x) {
    int ans = 0;
    while (x > 0) {
        ans++;
        x /= 10;
    }
    return ans;
}

#define f first
#define s second

bool cmp (pair <int, pair <int, int>> &a, pair <int, pair <int, int>> &b) {
    if (a.s.f + a.s.s == 0) {
        a.f = 0;
    }
    else if (b.s.f + b.s.s == 0) {
        b.f = 0;
    }
    else if ((a.s.f + a.s.s != 0) && (b.s.f + b.s.s != 0)) {
        if (a.f / (a.s.f + a.s.s) == b.f / (b.s.f + b.s.s))
            return a.f < b.f;
        return a.f / (a.s.f + a.s.s) < b.f / (b.s.f + b.s.s);
    }
}

int32_t main()
{
    boost;
    int a; cin >> a;
    cout << a + (a * a) + (a * a * a);
    return 0;
}



Measured memory_bytes: 3564
fn main() {
    let v = read_vec::<u32>();
    let a = v[0];
    let b = v[1];
    let c = v[2];
    yn(a + b + c >= 22);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("bust");
    } else {
        println!("win");
    }
}


Measured memory_bytes: 4352
def a(t,i):
    if i == l - 1:
        if eval(t)==7:
            print(t+"=7")
            exit()
        return
    a(t+"+"+N[i+1],i+1)
    a(t+"-"+N[i+1],i+1)

N = input()
l = len(N)
a(N[0],0)



Measured memory_bytes: 9060
import sys
import math
#sys.stdin=open("input.in","r")
#sys.stdout=open("output.out","w")
import decimal
decimal.getcontext().prec = 50
#root = decimal.Decimal('123').sqrt()
n,m,o=map(int,input().split())
if((decimal.Decimal(m).sqrt()+decimal.Decimal(n).sqrt())<decimal.Decimal(o).sqrt()):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 5076
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define EPS 1e-7
typedef pair<double,double> point, circle;

void intrsc( const circle &c1, const circle &c2, vector<point> &v ){
	double a,b,c,d,e,f,g,D;
	double x1,x2,y1,y2,ix1,ix2,iy1,iy2;

	x1 = c1.first;
	x2 = c2.first;
	y1 = c1.second;
	y2 = c2.second;

	a = x1*x1 - x2*x2 + y1*y1 - y2*y2;
	b = 2.0 * ( y1 - y2 );
	c = 2.0 * ( x1 - x2 );
	
	d = b*b + c*c;
	e = b*c*y1 - a*c - b*b*x1;
	f = b*b*(x1*x1 + y1*y1 - 1.0) + a*a - 2*a*b*y1;

	D = e*e - d*f;
	if( D >= 0 ){
		if( abs(d) < EPS ){
			v.push_back( point( x1 + 1.0, y1 ) );
			return;
		}
		g = sqrt(D);
		ix1 = ( -e + g ) / d;
		ix2 = ( -e - g ) / d;
		if( abs(b) < EPS ){
			iy1 = sqrt( 1.0 - (ix1-x1)*(ix1-x1) );
			iy2 = y1 - iy1;
			iy1 += y1;
		}
		else{
			iy1 = ( a - c * ix1 ) / b;
			iy2 = ( a - c * ix2 ) / b;
		}
		v.push_back( point( ix1, iy1 ) );
		v.push_back( point( ix2, iy2 ) );
	}
}

inline bool in( const point &p, const circle &c ){
	return	(p.first-c.first)*(p.first-c.first) +
			(p.second-c.second)*(p.second-c.second) <= 1.0 + EPS;
}

int main(){
	int n;
	double x,y;
	for(; scanf("%d",&n),n; ){
		vector<point> v;
		vector<circle> crcl(n);
		for(int i = 0; i < n; i++ ){
			scanf("%lf,%lf",&x,&y);
			crcl[i] = circle(x,y);
		}

		for(int i = 0; i < n - 1; i++ )
			for(int j = i + 1; j < n; j++ )
				intrsc( crcl[i], crcl[j], v );

		int m = 1;
		for( vector<point>::iterator p_it = v.begin();
				p_it != v.end(); ++p_it ){
			int cnt = 0;
			for( vector<circle>::iterator it = crcl.begin();
					it != crcl.end(); ++it ){
				if( in( *p_it, *it ) )	cnt++;
			}
			m = max( m, cnt );
		}
		printf("%d\n",m);
	}
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
    return 0;
}



Measured memory_bytes: 2148
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <limits>

typedef int ll;
typedef std::pair<ll,ll> ll_pair;
typedef std::vector<ll_pair> ll_pairs;

int solve(const ll_pairs l)
{
    const int n = l.size();
    int ans = 0;

    ll_pairs xmaxmin(n);
    for (int i = 0; i < n; i++) {
        xmaxmin[i].first  = l[i].first + l[i].second;
        xmaxmin[i].second = l[i].first - l[i].second;
    }
    std::sort(xmaxmin.begin(), xmaxmin.end());

    ans = 1;
    ll xmax = xmaxmin[0].first;

    for (int i = 1; i < n; i++) {
        if (xmax <= xmaxmin[i].second) {
            ans++;
            xmax = xmaxmin[i].first;
        }
    }

    return ans;
}

int main(int argc, char *argv[])
{
    int n;
    ll_pairs l;

    std::cin >> n;

    l.reserve(n);

    for (int i = 0; i < n; i++) {
        int xi, li;
        std::cin >> xi >> li;
        l.push_back(ll_pair(xi, li));
    }

    std::sort(l.begin(), l.end());

    int ans = solve(l);

    std::cout << ans << std::endl;


    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define inf0x3f3f3f3f
typedef long long ll;
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+7;
const double eps = 1e-6;
struct node{
	double x,y;
}g[maxn];
ll a[maxn],b[maxn],c[maxn],ans;
priority_queue<ll>q;
bool cmp(ll a,ll b){return a>b;}
vector<ll>v;
int x,y,na,nb,nc;
void A(){
	scanf("%d%d%d%d%d",&x,&y,&na,&nb,&nc);
	for(int i=0;i<na;i++)scanf("%lld",&a[i]);
	for(int i=0;i<nb;i++)scanf("%lld",&b[i]);	
}
void f(){
	
	A();
	for(int i=0;i<nc;i++)
	{
		ll x;
		scanf("%lld",&x);
		q.push(x);
	}
	sort(a,a+na,cmp);
	sort(b,b+nb,cmp);
	for(int i=0;i<x;i++)
	{
		ans+=a[i];
		v.push_back(a[i]);
	}
	for(int i=0;i<y;i++)
	{
		ans+=b[i];
		v.push_back(b[i]);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	{
		if(q.empty())break;
		ll t=q.top();q.pop();
		if(t>v[i])ans=ans-v[i]+t;
		else break;
	}
	printf("%lld",ans);
};
int main()
{
	f();
	return 0;
}


Measured memory_bytes: 4724
#include <stdio.h>
 
int main(void) {

	// ??????????????\??????????????°?????\???????????°
	int line;
	scanf("%d", &line);
	
	int column;
	scanf("%d", &column);
	
	int grid[line + 1][column];
	
/*	// ????¬???????????????????
	for (int left = 0; left <= line; left++) {

		for (int right = 0; right < column; right++) {

			grid[left][right] = 0;
		}
	}*/
	
	// ??\??????????????°?????????????????\??????
	for (int left = 0; left <= line; left++) {

		for (int right = 0; right < column; right++) {

			grid[left][right] = 0;
			scanf("%d", &grid[left][right]);
		}
	}

	// ????¨??????\?????????????????????
	int sum[line];
	
/*	for (int cnt = 0; cnt < line; cnt++) {
		
		sum[cnt] = 0;
	}
*/
	// ???????????????
	for (int cnt1 = 0; cnt1 < line; cnt1++) {
		
		sum[cnt1] = 0;

		for (int cnt2 = 0; cnt2 < column; cnt2++) {

			sum[cnt1] += grid[cnt1][cnt2] * grid[line][cnt2];

		}
		printf("%d\n", sum[cnt1]);
	}
	return 0;
}

Measured memory_bytes: 1852
n = int(input())
pp = list(map(int,input().split())) + [0]
ans = 0
i = 0

while i < n+1:
  if pp[i] == i+1:
    ans += 1
    if (i < n+1) and (pp[i+1] == i+2):
      i += 1
  i += 1
  
print(ans)  

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

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

using namespace std;

int parity(int n,int r){
	rep(i,20) if((n>>i&1)<(r>>i&1)) return 0;
	return 1;
}

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

	rep(i,n-1) s[i]=abs(s[i]-s[i+1])+'0';
	s.pop_back();
	n--;

	int res=0;
	rep(i,n){
		if(parity(n-1,i)==1) res=(res+s[i]-'0')%2;
	}
	if(res==1) return puts("1"),0;

	if(count(s.begin(),s.end(),'1')>0) return puts("0"),0;

	rep(i,n) if(s[i]=='2') s[i]='1';

	res=0;
	rep(i,n){
		if(parity(n-1,i)==1) res=(res+s[i]-'0')%2;
	}
	puts(res==0?"0":"2");

	return 0;
}


Measured memory_bytes: 1412
#include <stdio.h>

int main(void){
    int  x[3];
    int tmp;
    scanf("%d %d %d",&x[1],&x[2],&x[3]);
    
    if (x[1] > x[2]){
        tmp=x[1];
        x[1]=x[2];
        x[2]=tmp;
    }
    
    if (x[2] > x[3]){
        tmp=x[2];
        x[2]=x[3];
        x[3]=tmp;
    }
    
    if (x[1] > x[2]){
        tmp=x[1];
        x[1]=x[2];
        x[2]=tmp;
    }
    
    printf("%d %d %d\n",x[1],x[2],x[3]);
    
    return 0;
}


Measured memory_bytes: 2052
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 10000

struct Node{
  int key;
  struct Node *p;
  struct Node *r;
  struct Node *l;
};

struct Node *root,*NIL;

void Insert(int );
void inorder(struct Node *);
void preorder(struct Node *);
struct Node *find(struct Node *, int );

int main(){
  struct Node *t;
  int n,i,num;
  char order[8];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",order);
    if(strcmp(order,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(strcmp(order,"insert")==0){
      scanf("%d",&num);
      Insert(num);
   }else if(strcmp(order,"find")==0){
       scanf("%d",&num);
       t=find(root,num);
       if(t!=NIL){
           printf("yes\n");
       }else{
           printf("no\n");
       }
   }
  }


 return 0;
}

void Insert(int k){
 struct Node *y = NIL;
 struct Node *x = root;
 struct Node *z;

 z=(struct Node *)malloc(sizeof(struct Node));
 z->key=k;
 z->l=NIL;
 z->r=NIL;

 while(x!=NIL){
   y=x;
   if(z->key < x->key){
     x=x->l;
   }else{
     x=x->r;
   }
 }

z->p=y;
if(y==NIL){
  root=z;
}else{
  if(z->key < y->key){
    y->l=z;
  }else{
    y->r=z;
  }
}
}

void inorder(struct Node *x){
  if(x!=NIL){
    inorder(x->l);
    printf(" %d",x->key);
    inorder(x->r);
  } 
}

void preorder(struct Node *x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->l);
    preorder(x->r);
  }
}

struct Node *find(struct Node *u, int x){
    while(u!=NIL&&x!=u->key){
        if(x<u->key){
            u=u->l;
        }else{
            u=u->r;
        }
    }
    return u;
}



Measured memory_bytes: 20448
N = int(input())
S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]
if N % 2 != 0:
    print('No')
else:
    mae = S[:N//2]
    ato = S[N//2:]
    #print(mae,ato)
    if mae == ato:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 2940
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    S = iss()
    ret = ""
    for n in range(N):
        if n + 1 == K:
            ret += str(S[n]).lower()
        else:
            ret += S[n]
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9884
var
	n, t, a, h, i, ans:longint;
	mi:extended;
begin
	read(n, t, a);
	mi:=233333333.0;
	for i:=1 to n do
	begin
		read(h);
		if abs(t - h * 0.006 - a) < mi then
		begin
			mi:=abs(t - h * 0.006 - a);
			ans:=i;
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
N, x = [int(x) for x in input().split()]
N = 2 * N - 1
if x == 1 or x == N:
    print('No')
else:
    print('Yes')
    l = list(range(2, N))
    l.remove(x)
    for i in l[:(N - 3) // 2] + [1, x, N] + l[(N - 3) // 2:]:
        print(i)


Measured memory_bytes: 51884
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    ab = LIR(m)
    par = [i for i in range(n)]
    size = [1] * n
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]
    def unite(a, b):
        a = root(a)
        b = root(b)
        if a == b:
            return
        if size[a] < size[b]: a, b = b, a
        par[b] = a
        size[a] += size[b]
    for a, b in ab:
        a -= 1
        b -= 1
        unite(a, b)
    
    print(max(size))
    return


#main
if __name__ == '__main__':
    solve()


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

template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=200,A=20;
char s[N][N];
int f[N][N][N],g[N][N][N];

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);
#endif
	int n,m;
	cin>>n>>m;
	rep(i,1,n)scanf("%s",s[i]+1);
	rep(len,1,n)
	rep(u,1,n-len+1)
	{
		int d=u+len-1;
		f[u][d][m+1]=m;
		per(l,m,1)
		{
			if(len==1)f[u][d][l]=s[u][l]==s[u][l+1]?f[u][d][l+1]:l;
			else f[u][d][l]=(s[u][l]==s[u+1][l]&&f[u+1][d][l]>=l)?
					(s[u][l]==s[u][l+1]?f[u][d][l+1]:l):l-1;
		}
	}
	int ans=0;
while(f[1][n][1]<m)
{
	++ans;
	swap(f,g);
	
	rep(len,1,n)
	rep(u,1,n-len+1)
	{
		int d=u+len-1;
		f[u][d][m+1]=m;
		per(l,m,1)
		{
				f[u][d][l]=g[u][d][g[u][d][l]+1];
				if(f[u][d][l]==m)continue;
				int l1=u,r1=d-1;
				if(len>5)
				while(l1+1!=r1)
				{
					int m=(l1+r1)/2;
					if(g[u][m][l]>=g[m+1][d][l])l1=m;
					else r1=m;
				}
			//	if(u==1&&d==6&&l==1)
			//		int yyx=1;
				rep(i,l1,r1)chmax(f[u][d][l],min(g[u][i][l],g[i+1][d][l]));
		}
	}
}
	cout<<ans;
}

Measured memory_bytes: 62720
import math

def isPrime(n):
  if n < 2:
    return False
  if n == 2:
    return True
  if n%2==0:
    return False
  m=math.floor(math.sqrt(n))+1
  for p in range(3,m,2):
      if n % p == 0:
        return False
  return True
m=int(input())
n=[]
for i in range(m):
  n.append(int(input()))
cnt=0
for i in range(m):
  if isPrime(n[i]):
    cnt+=1
print(cnt)


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

string s;
int n; 
vector<int> appear[30];
int cnt = 0;
pair<int, int> pos[100100];
int target[200200];

long long bit[200200];
void update(int pos){
	while(pos <= n){
		bit[pos]++;
		pos += (pos & -pos);
	}
}
long long query(int pos){
	long long sum = 0;
	while(pos > 0){
		sum += bit[pos];
		pos -= (pos & -pos);
	}
	return sum;
}

int main(){
	cin >> s;
	n = s.size();
	rep(i, n){
		appear[s[i] - 'a'].push_back(i);
	}
	int odd = 0;
	rep(i, 26) odd += ((int)(appear[i].size()) % 2);
	if(odd > 1){
		cout << "-1" << endl;
		return 0;
	}
	rep(i, 26){
		int j, k;
		for(j = 0, k = appear[i].size() - 1; j < k; j++, k--){
			pos[cnt++] = make_pair(appear[i][j], appear[i][k]); 
		}
		if(j == k) target[n/2] = appear[i][j];
	}
	sort(pos, pos+cnt);
	rep(i, cnt){
		target[i] = pos[i].first;
		target[n-i-1] = pos[i].second;
	}
	long long ans = 0;
	rep(i, n){
//		cout << target[i] << endl;
		ans += query(n-target[i]);
		update(n-target[i]);
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
int f[1000] = {2, 3};
int par[1000];

void init()
{
	for (int i = 0; i < 1000; i++) par[i] = i;
}

int find(int x)
{
	if (par[x] == x) return x;
	return par[x] = find(par[x]);
}

bool _union(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y) return false;
	par[x] = y;
	return true;
}

bool same(int x, int y)
{
	return find(x) == find(y);
}

int main()
{
	for (int i = 2; i < 1000; i++){
		f[i] = (f[i - 2] + f[i - 1]) % N;
	}
	
	int v, d;
	while (scanf("%d %d", &v, &d) != EOF){
		init();
		int res = v;
		for (int i = 0; i < v; i++){
			for (int j = 1; j < v; j++){
				if (abs(f[i] - f[j]) < d){
					res -= _union(i, j);
				}
			}
		}
		
		printf("%d\n", res);
	}
	
	return 0;
}

Measured memory_bytes: 1192
N = int(input())
L = list(map(int, input().split()))

n = len(L)
c = 0
result = []
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
                if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[i]+L[k]>L[j]:
                    #print(L[i], L[j], L[k])
                    c += 1
print(c)

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

int main(){

int W,H;
cin>>W>>H;

int x,y,r;
cin>>x>>y>>r;

if(x-r>=0&&y-r>=0&&x+r<=W&&y+r<=H)
cout<<"Yes"<<endl;
else cout<<"No"<<endl;

return 0;
}


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

int main() {
	int x1;
  int x2;
  int x3;
  int x4;
  int x5;
cin >> x1;
cin >> x2;
cin >> x3;
cin >> x4;
cin >> x5;
 if(x1==0)
  cout <<  "1";    
  else if(x2==0)
  cout << "2";
  else if(x3==0)
  cout << "3";
  else if(x4==0)
  cout << "4";
  else if(x5==0)
  cout << "5";
	return 0;
}

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

int main() {
    int n;
    int flag = 0;
    string collor;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> collor;
        if(collor == "Y"){
            flag = 1;
            cout << "Four" << endl;
            break;
        }
    }
    if(flag == 0){
        cout << "Three" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(void) {
	int N;
	int k;
	long long a[10000];

	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf(" %lld", &a[i]);
	}

	k = 0;
	for (int i = 0; i < N; ++i) {
		while ((a[i] & 1) == 0) {
			++k;
			a[i] >>= 1;
		}
	}

	printf("%d\n", k);
	fflush(stdout);

	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(int i = (int)n; i > (int)k; i--)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

long long gcd(long long a, long long b) {
    if (b==0) return a;
    return gcd(b, a%b);
}

long long lcm(long long a, long long b) {
    return a / gcd(a,b) * b;
}

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

    int N; cin >> N;
    ll ans; cin >> ans;
    rep(i, N-1) {
        ll T; cin >> T;
        ans = lcm(ans, T);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256