akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// 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();
}

//
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, d;
  cin >> n >> d;

  int ans = 0;
  while (ans * (d * 2 + 1) < n) {
    ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n=int(input())
h=[int(i) for i in input().split()]
dp=[0,abs(h[1]-h[0])]+[100000000000]*100010
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 13928
data = []
r, c = [int(n) for n in input().split()]
result = [0 for n in range(c)]

for i in range(r):
    data.append([int(n) for n in input().split()])
    for j in range(c):
        result[j] += data[i][j]
data.append(result)
for i in range(r + 1):
    data[i].append(sum(data[i]))
    print(' '.join([str(n) for n in data[i]]))

Measured memory_bytes: 7760
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    ll a = 0;
    ll w = 0;
    ll t = 0;
    ll r = 0;
    rep(i, n){
        string s;
        cin >> s;
        if(s == "AC") a++;
        if(s == "WA")w++;
        if(s == "TLE")t++;
        if(s == "RE")r++;
    }

    cout << "AC x " << a << endl;
    cout << "WA x " << w << endl;
    cout << "TLE x " << t << endl;
    cout << "RE x " << r << endl;


}


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

int main() {
  int a;
  cin >> a;
  int count = 0;
  if (a == 1) count = 2;
  else if (a == 2) count = 2;
  else {
    while (a != 1){
     count++;
     if (a%2 == 0) a = a/2;
     else a = a*3 + 1;
    }
  }
  cout << count+2 << endl; 
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AStationAndBus solver = new AStationAndBus();
        solver.solve(1, in, out);
        out.close();
    }

    static class AStationAndBus {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String a = in.next();
            out.append(a.contains("A") && a.contains("B") ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 8e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 5e5+100;
const int LOG = 19;
const ll mod = 998244353;
const int MX = 5e5+100;

void bad(){
    cout <<"impossible";
    exit(0);
}
bool mat[5][5];
void solve() {
    int n = 4, m =3;
    for(int i=1;i<=m;++i){
        int a,b;
        cin >> a >> b;
        mat[a][b] = 1;
        mat[b][a] = 1;
    }
    vector<int> v = {1,2,3,4};
    do{
        bool flag =  true;
        for(int i=1;i<n;++i){
            flag = flag && mat[v[i-1]][v[i]];
        }
        if(flag){
            cout <<"YES"<< endl;
            return;
        }
    }while(next_permutation(all(v)));
    cout <<"NO"<<endl;
}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
   // freopen("../output.txt","w",stdout);
#else
#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);


    int t = 1;
    while (t--)
        solve();
}

Measured memory_bytes: 256
from collections import deque
INF = float("inf")
TO = 0;  CAP = 1;  REV = 2
class Dinic:
    def __init__(self, N):
        self.N = N
        self.V = [[] for _ in range(N)]  # to, cap, rev
        # 辺 e = V[n][m] の逆辺は V[e[TO]][e[REV]]
        self.level = [0] * N

    def add_edge(self, u, v, cap):
        self.V[u].append([v, cap, len(self.V[v])])
        self.V[v].append([u, 0, len(self.V[u])-1])

    def add_edge_undirected(self, u, v, cap):  # 未検証
        self.V[u].append([v, cap, len(self.V[v])])
        self.V[v].append([u, cap, len(self.V[u])-1])

    def bfs(self, s: int) -> bool:
        self.level = [-1] * self.N
        self.level[s] = 0
        q = deque()
        q.append(s)
        while len(q) != 0:
            v = q.popleft()
            for e in self.V[v]:
                if e[CAP] > 0 and self.level[e[TO]] == -1:  # capが1以上で未探索の辺
                    self.level[e[TO]] = self.level[v] + 1
                    q.append(e[TO])
        return True if self.level[self.g] != -1 else False  # 到達可能

    def dfs(self, v: int, f) -> int:
        if v == self.g:
            return f
        for i in range(self.ite[v], len(self.V[v])):
            self.ite[v] = i
            e = self.V[v][i]
            if e[CAP] > 0 and self.level[v] < self.level[e[TO]]:
                d = self.dfs(e[TO], min(f, e[CAP]))
                if d > 0:  # 増加路
                    e[CAP] -= d  # cap を減らす
                    self.V[e[TO]][e[REV]][CAP] += d  # 反対方向の cap を増やす
                    return d
        return 0

    def solve(self, s, g):
        self.g = g
        flow = 0
        while self.bfs(s):  # 到達可能な間
            self.ite = [0] * self.N
            f = self.dfs(s, INF)
            while f > 0:
                flow += f
                f = self.dfs(s, INF)
        return flow
H, W = map(int, input().split())
dinic = Dinic(H+W+2)
for i in range(H):
    a = input()
    for j, a_ in enumerate(a):
        if a_=="S":
            start = i, j
        elif a_=="T":
            goal = i, j
        if a_!=".":
            dinic.add_edge_undirected(H + j, i, 1)
dinic.add_edge_undirected(H+W, start[0], 1<<30)
dinic.add_edge_undirected(H+W, start[1]+H, 1<<30)
dinic.add_edge_undirected(H+W+1, goal[0], 1<<30)
dinic.add_edge_undirected(H+W+1, goal[1]+H, 1<<30)

if start[0]==goal[0] or start[1]==goal[1]:
    print(-1)
else:
    print(dinic.solve(H+W, H+W+1))


Measured memory_bytes: 5364
#include<iostream>
#include<vector>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>a(N);
  for (int i = 0; i < N; i ++) cin >> a[i];
  vector<int>box(N, 0);
  vector<vector<int>>re(N, vector<int>());
  vector<int>ans(N);
  int si = 0;
  for (int i = 1; i <= N / 2; i ++) {
    for (int j = 2; j <= N / i; j ++) {
      int k = i * j - 1;
      re[k].push_back(i - 1);
    }
  }
  for (int i = N - 1; i >= 0; i --) {
    if (box[i] % 2 != a[i]) {
      ans[si] = i + 1;
      si ++;
      for (int j = 0; j < re[i].size(); j ++) {
        box[re[i][j]] ++;
      }
    }
  }
  cout << si << endl;
  if (!si) return 0;
  cout << ans[0] << ' ';
  for (int i = 1; i < si; i ++) {
    cout << ' ' << ans[i];
  }
  cout << endl;
}
  
  


Measured memory_bytes: 24576
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc076.contest.atcoder.jp/tasks/arc076_b>
問題文============================================================
 平面上に、N 個の街があります。i 個目の街は、座標 (xi,yi) にあります。
 同じ座標に、複数の街があるかもしれません。
 
 座標 (a,b) にある街と座標 (c,d) にある街の間に道を造るのには、min(|a−c|,|b−d|) 円かかります。
 街と街の間以外に、道を造ることはできません。
 
 任意の 2 つの街の間を、道を何本か通って行き来できるようにするためは、最低で何円必要でしょうか。

=================================================================

解説=============================================================

================================================================
*/
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

struct edge{
    ll u,v,cost;
    edge(){}
    edge(ll u,ll v,ll cost):u(u),v(v),cost(cost){}
    bool operator < (const edge& o) const{
        return cost < o.cost;
    }
    bool operator > (const edge& o) const{
        return cost > o.cost;
    }
};

ll solve(){
    ll N; cin >> N;
    vector<pll> p(N);
    for(int i = 0; i < N;i++) cin >> p[i].first >> p[i].second;
    vector<pll> xs(N),ys(N);
    for(int i = 0; i < N;i++){
        xs[i] = {p[i].first,i};
        ys[i] = {p[i].second,i};
    }
    
    sort(xs.begin(),xs.end()); sort(ys.begin(),ys.end());
    UnionFind uf(N);
    ll ret = 0;
    
    priority_queue<edge,vector<edge>,greater<edge>> pq;
    for(int i = 0; i < N-1;i++){
        pq.push(edge(xs[i].second,xs[i+1].second,xs[i+1].first-xs[i].first));
        pq.push(edge(ys[i].second,ys[i+1].second,ys[i+1].first-ys[i].first));
    }
    
    while(!pq.empty()){
        auto e = pq.top(); pq.pop();
        if(uf.findSet(e.u, e.v)) continue;
        
        ret += e.cost;
        uf.unionSet(e.u, e.v);
    }
    
    return ret;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 13680
#include <iostream>

using namespace std;

int main()
{
    int x, y, z, n , a1, a2;
    cin >> x >> y >> z >> n;

    a1 = x * y;
    a2 = z * n;

    if (a1 >= a2)
        cout << a1;
    else
        cout << a2;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double PI=3.1415926535897932;
const double LIT=0.000000000001;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

ll yaku(ll a, ll b){
    if(a>b) return yaku(b,a);
    return b%a ? yaku(b%a,a) : a;
}
map<P,ll> d;
ll Count=-1;

void input(){
    ll x,y; cin>>x>>y;
    P X;
    if(!x){
        if(!y) {
            Count++;
            return;
        }
        X=mp(0,-1);
    }
    else if(!y) X=mp(1,0);
    else{
        ll K=yaku(abs(x),abs(y));
        if(x<0) K=-K;
        X=mp(x/K,y/K);
    }
    d[X]++;
    return;
}

ll ruijou(ll n, ll k){
    if(!k) return 1;
    ll a=ruijou(n,k/2);
    a=(a*a)%mod;
    return k%2 ? (a*n)%mod : a;
}

P tsui(P x){
    return x.second>=0 ? mp(x.second,-x.first) : mp(-x.second,x.first);
}

int main(){
    ll N; cin>>N;
    rep(i,N) input();
    ll ans=1;
    for(auto itr=d.begin(); itr!=d.end(); itr++){
        P A=itr->first; 
        //cout<<A.first<<' '<<A.second<<':'<<d[A]<<endl;
        if(A.second>=0){
            P B=tsui(A);
            if(d.count(B)){
                ll kari=ruijou(2,d[B]);
                ADD(kari,mod-1);
                kari+=ruijou(2,d[A]);
                MUL(ans,kari);
            }
            else MUL(ans,ruijou(2,d[A]));
        }
        else{
            P B=tsui(A);
            if(!d.count(B)) MUL(ans,ruijou(2,d[A]));
        }
    }
    ADD(ans,mod+Count);
    cout<<ans<<endl;
}


Measured memory_bytes: 15884
# ABC072-B
S = input()
ss = set()
for i in range(len(S)):
    ss.add(S[i])

alpha_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 
                       'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ans = ''
for k in range(len(alpha_list)):
    if alpha_list[k] not in ss:
        ans = alpha_list[k]
        break
if len(ss) == 26:
    print('None')
else:
    print(ans)

Measured memory_bytes: 3188
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#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++)

int main()
{
    string S;
    cin >> S;
    int zero = 0, one = 0;

    for (char c : S)
    {
        if (c == '0')
        {
            zero++;
        }
        else
        {
            one++;
        }
    }

    cout << min(zero, one) * 2 << endl;
}


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

int main()
{
    long long a;

    cin >> a;
    
    long long b = std::floor(std::sqrt(a));

    long long n = 0;
    long long m = 0;

    for (long long c = b; c >= 1; c--)
    {
        if (a % c == 0)
        {
            n = c;
            m = a / c;
            break;
        }
    }
    
    cout << (n - 1) + (m - 1) << endl;

    return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n; cin >> n;
	string s; cin >> s;

	int ans = 0;
	int num = 0;
	rep(i, n){
		if(s[i] == 'I') num++;
		if(s[i] == 'D') num--;
		ans = max(ans, num);
	}

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

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

int main(){
   
      ll a,b,c,n; 
      cin >> n;
      string s,t,u;
      cin >> s >> t;
      for(int i=0;i<n;i++){
          cout <<s.at(i)<<t.at(i);
          
      }
      cout << endl;
  }


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int a,b;
	scanf("%d %d",&a,&b);

	printf("%d\n",(a+b)/2);

	return 0;
}

Measured memory_bytes: 3212
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define FLOOR(x) ((int)floor(((double)x)))
#define CEIL(x) ((int)ceil(((double)x)))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int N, K;
int acc[2010][2010];
int sum, white;


void makeAcc(){
	repe(i, 1, 2*K)
		repe(j, 1, 2*K) acc[i][j] += acc[i][j-1];
	repe(i, 1, 2*K)
		repe(j, 1, 2*K) acc[i][j] += acc[i-1][j];
}


int solve(){
	int ans = -INF;
	repe(i, 0, K){
		repe(j, 0, K){
			int a = acc[i][j];
			int b = acc[i+K][j+K]-acc[i+K][j]-acc[i][j+K]+acc[i][j];
			int c = acc[2*K][j]-acc[i+K][j];
			int d = acc[i][2*K]-acc[i][j+K];
			int e = acc[2*K][2*K]-acc[2*K][j+K]-acc[i+K][2*K]+acc[i+K][j+K];
			int cnt = a+b+c+d+e;
			ans = max({ ans, cnt, sum-cnt });
		}
	}
	return ans+white;
}


signed main(){
	cin >> N >> K;
	rep(i, 0, N){
		int x, y;
		char c;
		cin >> x >> y >> c;
		if(c == 'B') acc[y%(2*K)+1][x%(2*K)+1]++, sum++;
		if(c == 'W') acc[y%(2*K)+1][x%(2*K)+1]--, sum--, white++;
	}

	makeAcc();

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 16000
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        for(int i = 0;i < n;i++){
            a.add(sc.nextInt());
        }

        int ans = 100;
        for(Integer it : a){
            int cnt = solve(it);
            ans = Math.min(ans,cnt);
        }
        System.out.println(ans);
    }
    public static int solve(int x){
        int cnt = 0;
        while(x % 2 == 0){
            x /= 2;
            cnt++;
        }
        return cnt;
    }
}


Measured memory_bytes: 21588
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
	int f=1,x=0; char c=getchar();
	while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
	return f*x;
}
int n,k,place,x,sum=0;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		x=read();
		if(x==1) place=i;
	}
	sum+=(place-1)/(k-1);
	if((place-1)%(k-1)!=0)sum++;
	sum+=(n-place)/(k-1);
	if((n-place)%(k-1)!=0){
		sum++;
		if((place-1)%(k-1)!=0&&((n-place)%(k-1))+((place-1)%(k-1))<=k)sum--;
	}
	if(n==k)sum=1;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;
#define START 0
#define FORWARD 1
#define BACK 2
using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;
bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll gcd(ll a, ll b)
{
	ll tmp, r;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
	//// 引数に０がある場合は０を返す
	//if ((0 == m) || (0 == n))
	//	return 0;

	//// ユークリッドの方法
	//while (m != n)
	//{
	//	if (m > n) m = m - n;
	//	else         n = n - m;
	//}
	//return m;
}//gcd

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll x[10004] = {};
	ll y[10004] = {};
	ll z[10004] = {};
	ll connect[10004] = {};
	ll x2[10004] = {};
	ll z2[10004][10004] = { {} };
	vector<tuple<ll, ll>> vec;
	string s;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);
	//cout << LLONG_MAX<< endl;
	cin >> a;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
	}
	b = accumulate(x, x + a,0);
	ans =  b;
	for (int i = 0; i < a; i++)
	{
		c += x[i];
		b -= x[i];
		ans = min(ans, abs(c - b));
	}
	cout << ans << endl;





	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//sort(x, x + a, std::greater<ll>());

//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得
//
//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}
//
//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え


/*vector<pair<ll, ll> > hoges(a);
for (int i = 0; i < a; i++)
{
cin >> x[i];
cin >> y[i];
hoges[i] = make_pair(x[i], y[i]);
}
sort(hoges.begin(),hoges.end(),comp);
for (int i = 0; i < a; i++)
{
if (hoges[i].second>=b)
{
ans += hoges[i].first*b;
break;
}
else
{
ans += hoges[i].first*hoges[i].second;
b -= hoges[i].second;

}
}*/

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

long long int N, A, B, C, M = 115292150460686976LL;

int main(){
    scanf("%lld", &N);
    for(int i = 0; i < N; ++i){
        scanf("%lld%lld", &A, &B);
        C += B;
        M = (A > B) ? min(M, B) : M;
    }
    cout << (M > (1LL << 30) ? 0 : C - M) << endl;
    return 0;
}

Measured memory_bytes: 384
//日野茜★担当
//的場梨沙★担当
//結城晴★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>

using namespace std;

int main(void) {
    string S;
    cin>>S;

    if(S[0]=='R'&&S[1]=='R'&&S[2]=='R'){
        cout<<3<<endl;
        return 0;
    }else if((S[0]=='R'&&S[1]=='R')||(S[1]=='R'&&S[2]=='R')){
        cout<<2<<endl;
        return 0;
    }else if(S[0]=='S'&&S[1]=='S'&&S[2]=='S'){
        cout<<0<<endl;
        return 0;
    }else{
        cout<<1<<endl;
        return 0;
    }


}

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

const int maxn = 2e5 + 5;
vector<int> g[maxn];
int fd, f;

void dfs(int x, int p, int d) {
    if (d > fd) {
        fd = d;
        f = x;
    }
    for (int i = 0; i < (int)g[x].size(); ++i) {
        int u = g[x][i];
        if (u == p) continue;
        dfs(u, x, d + 1);
    }
}

int main() {
    int n; scanf("%d", &n);
    for (int i = 0; i < n - 1; ++i) {
        int x, y; scanf("%d%d", &x, &y);
        --x, --y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    fd = -1;
    dfs(0, -1, 0);
    fd = -1;
    dfs(f, -1, 0);

    if ((fd + 1) % 3 == 2)
        puts("Second");
    else
        puts("First");
    return 0;
}


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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
ll n,m,g=1;
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n>>m;
	if(abs(n-m)>1){
		cout<<0;
		return 0;
	}
	rep(i,n){
		g*=i;
		g%=INF;
	}
	rep(i,m){
		g*=i;
		g%=INF;
	}
	if(n==m){
		g*=2;
		g%=INF;
	}
	cout<<g;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b=a/3600;
		int c=(a%3600)/60;
		int d=(a%3600)%60;
		System.out.printf("%d:%d:%d\n",b,c,d);
	}
}




Measured memory_bytes: 26308
#include<stdio.h>
void main(){
   int n,m;
   scanf("%d%d",&n,&m);
   int a[m];
   int i;
   for(i=0;i<m;i++){
      scanf("%d",&a[i]);
      n=n-a[i];
   }
   if(n>=0){
      printf("%d",n);
   }else{
      printf("-1");
   }
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m);


    for (int i = 0; i < m; ++i) {
        cin >> a.at(i);
    }

    int sum = 0;

    for (int j = 0; j < m; ++j) {
        sum += a.at(j);
    }

    int ans = n -sum;
    if(ans>=0) cout << ans << endl;
    else cout << -1 << endl;

    return 0;
}

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

int main()
{
  int64_t k, a, b;
  cin >> k >> a >> b;
  int64_t biscuit;
  if (k < a - 1) {
    biscuit = k + 1;
  } else {
    k -= a - 1;
    biscuit = a;
    if (a + 2 < b) {
      biscuit += (b - a) * (k / 2);
      biscuit += k % 2;
    } else {
      biscuit += k;
    }
  }
  cout << biscuit << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;

int main(){
  cpp_int n, a, b;
  cin >> n >> a >> b;
  cpp_int sum = 0;
  
  sum += n / (a + b) * a;
  if(n % (a + b) > a)
    sum += a;
  if(n % (a + b) < a)
  	sum += n % (a + b);
  
  cout << sum << endl;
  return 0;
}


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

int main() {
    int N, Cx, Cy, H, minh=1e+9, cal_h;
    cin >> N;
    int x[N], y[N], h[N];
    bool match_xyh;
    for (int i=0; i<N; i++) {
        cin >> x[i] >> y[i] >> h[i];
        minh = min(minh, h[i]);
    }

    for (Cx=0; Cx<=100; Cx++) {
        for (Cy=0; Cy<=100; Cy++) {
            for (H=max(1, minh); H<=minh+200; H++) {
                match_xyh = true;
                for (int i=0; i<N; i++) {
                    cal_h = max(H - abs(Cx - x[i]) - abs(Cy - y[i]), 0);
                    if (cal_h != h[i]) {
                        match_xyh = false;
                        break;
                    }
                }
                if (match_xyh) break;
            }
            if (match_xyh) break;
        }
        if (match_xyh) break;
    }
    
    cout << Cx << " " << Cy << " " << H << endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
void syuturyoku(){

}
int main(){
	int x,y,a,b;
	cin>>a>>b;
	if(a>=b){x=a;y=b;}
	else{x=b;y=a;}
	while(y){
		x=x%y;
		swap(x,y);
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 3068
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        S: chars,
    }
    let mut map:HashMap<char,i64> = HashMap::new();
    for c in S{
        *map.entry(c).or_insert(0) += 1;
    }
    let mut ans = "yes";
    for m in map{
        let (_k,v) = m;
        if v>1{
            ans = "no";
            break;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);
ll dp[30000000];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    vector<ll> a(3),b(3);
    rep(i,3)cin >> a[i];
    rep(i,3)cin >> b[i];
    ll mx = 0;
    rep(i,3){
        for(int j=0;j<=N;j++){
            dp[j] = max((ll)j,dp[j]);
            if(j-a[i]>=0){
                dp[j] = max(dp[j],dp[j-a[i]] + b[i]);
            }
        }
    }
    mx = dp[N];
    rep(i,5000*5000 + 1){
        dp[i] = 0;
    }
    rep(i,3){
        for(int j=0;j<=mx;j++){
            dp[j] = max((ll)j,dp[j]);
            if(j-b[i]>=0){
                dp[j] = max(dp[j],dp[j-b[i]] + a[i]);
            }
        }
    }
    cout << dp[mx] << endl;
}

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

using namespace std;

int N, K;
long long int trees[100010];
int fin;
long long int mini = 1000000009;

int main()
{
  cin >> N >> K;
  for(int i=0; i<N; i++)
  {
    cin >> trees[i];
  }
  sort(trees, trees+N);
  fin=K-1;
  for(int i=0; fin<N; fin++,i++)
  {
    //cout << i << " " << fin << "\n";
    if(trees[fin]-trees[i]<mini)
      mini = trees[fin] - trees[i];
  }
  cout << mini;
  return 0;
}


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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const i64 mod = (i64)1e9 + 7;
i64 n, k;
const i64 maxn = 2 * (i64)1e5 + 1000;
i64 fac[maxn],inv[maxn];
i64 pow_mod(i64 a,i64 n)
{
    i64 ret =1;
    while(n)
    {
        if(n&1) ret=ret*a%mod;
          a=a*a%mod;
          n>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(i64 i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
i64 CC(i64 x, i64 y)
{
    return fac[x]*pow_mod(fac[y]*fac[x-y]%mod,mod-2)%mod;
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFIN
    freopen("input.txt", "r", stdin);
#endif

    init();
    cin >> n >> k;
    i64 noPeople = min(n - 1, k);
    i64 ans = 0;
    for (i64 i = 0; i <= noPeople; ++i) {
        ans = (ans + (CC(n, i) * CC(n - 1, n - i - 1)) % mod) % mod;
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
int main(){
    int n,m,i;
    scanf("%d%d",&n,&m);
    int l,r,L,R;
    scanf("%d%d",&L,&R);
    for(i=1;i<m;i++){
        scanf("%d%d",&l,&r);
        L=max(L,l);
        R=min(R,r);
    }
    if(R>=L)printf("%d",R-L+1);
  	else printf("0");
}


Measured memory_bytes: 128
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<complex>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


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




int main() {

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

	int n;
	
	string s, t;
	cin >> n >> s >> t;
	for (int i = 0; i < n; i++)
	{
		cout << s[i] << t[i];
	}
	cout << endl;





	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define reft0(i, j) setfill('0') << setw(i) << j

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

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

    cin >> N >> K;
    rep(i, 0, N){
        ll temp;
        cin >> temp;
        h.push_back(temp);
    }

    ll ans[100010];
    rep(i, 0, 100010) ans[i] = MAX;
    ans[0] = 0;
    rep(idx, 0, N){
        rep(idx2, 1, K + 1){
            if (idx + idx2 < N){
                chMin(ans[idx + idx2], ans[idx] + abs(h[idx] - h[idx + idx2]));
            }
        }
    }

    cout << ans[N - 1] << endl;

    return 0;
}


Measured memory_bytes: 1908
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void insert();
void inorder();
void preorder();
struct node{
  int key;
  struct node *right,*left,*parent;
};
typedef struct node * Node;
Node root;
#define NIL NULL
Node find();

void insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;

  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key<y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}

Node find(Node u,int k){
  while(u!=NIL && k!=u->key){
    if(k<u->key)u=u->left;
    else u=u->right;
  }
  return u;
}

void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
  
int main(){
  int n,i,x;
  char com[20];
  Node t;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    if(!strcmp(com,"insert")){
      scanf("%d",&x);
      insert(x);
    }
    else if(!strcmp(com,"print")){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(!strcmp(com,"find")){
      scanf("%d",&x);
      t=find(root,x);
      if(t!=NIL)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

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

using namespace std;

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

    map<int,int> have;
    map<int,int> need;

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

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        need[x]++;
    }

    for (auto it = need.begin(); it != need.end(); ++it) {
        if (have[it->first] < it->second) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 19072
N=input()
l=len(N)
K=int(input())
dp=[[[0 for i in range(4)] for i in range(2)] for i in range(l+1)]
dp[0][0][0]=1
for i in range(l):
    for smaller in range(2):
        for c in range(4):
            lim=9 if smaller else int(N[i])
            for d in range(lim+1):
                if(c!=3):
                    dp[i+1][smaller or d<lim][c+(d!=0)]+=dp[i][smaller][c]
                else:
                    if(d==0):
                        dp[i+1][smaller or d<lim][c]+=dp[i][smaller][c]

print(dp[l][0][K]+dp[l][1][K])

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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;


const int N = 1e5 + 5;

int a[N], n, k;

int gcd( int x, int y ){
    if ( x > y ){
        swap(x,y);
    }
    int t;
    while(x){
        t = x;
        y %= x;
        x = y;
        y = t;
    }
    return y;
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    scanf("%d %d",&n,&k);
    int g = 0;
    for ( int i = 1; i <= n; i++ ){
        scanf("%d",&a[i]);
        g = gcd( g, a[i] );
    }
    sort(  a + 1, a + n + 1 );
    if ( ( a[n] < k ) || ( k % g != 0 ) ){
        puts("IMPOSSIBLE");
        return 0;
    }
    puts("POSSIBLE");
    return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>

using namespace std;

long long foo(){
	
	int ABC[3];
	int MAX=0;

	cin >> ABC[0] >>ABC[1] >> ABC[2];

	for(int i=0 ; i < 3 ; i++){
		
		if(ABC[i]%2 == 0) return 0;
		MAX = (ABC[MAX] < ABC[i])? i : MAX;
	}

	long long var=1;
	for(int i=0 ; i < 3 ; i++){
		if(i==MAX) continue;
		var *= ABC[i];
	}
	return var;
}

int main(){

	cout << foo() << endl;
}


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

using ll = long long;

int main(){
  int k,a,b;
  cin >> k;
  cin >> a >> b;

  bool ans=false;

  for(int i=a; i<=b; i++){
    if(i%k==0)ans=true;
  }
  cout << (ans ? "OK" : "NG") << endl;
}

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

#define ll long long
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(i,a,b) for(int i=a;i<b;i++)
#define fr1(i,b,a) for(int i=b;i>=a;i--)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
long double infd=1.0/0.0;
const double pi=2*acos(0.0);
const int MOD=1e9+7;

int main(){
    nimble;
    int tt=1;//cin>>tt;
    while(tt--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a+b+c>=22)
            puts("bust");
        else puts("win");
    }
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<ll> v32;
typedef vector<vector<ll> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7 ;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define vvv64 vector<vv32>
#define vvvv64 vector<vvv32>
 
ll exp(ll n, ll e)
{
    if (e==0)
        return 1;
    ll temp=exp((n*n)%MOD,e/2);
    return e%2==0 ? temp : (temp*n)%MOD;
}
void norm(ll &n)
{
    n%=MOD;
    n+=MOD;
    n%=MOD;
}


ll rec(ll n)
{
    if (n==1)
        return 1;
    return 2*rec(n/2)+1;
}
int maxi=1e4+100;
void solve()
{
    int h,n;
    cin>>h>>n;
    vp64 arr(n+1);
    for (int i=1; i<=n; i++)
        cin>>arr[i].fi>>arr[i].se;
    vv64 dp(n+1,v64(h+maxi+1,INF));
    dp[0][0]=0;
    for (int i=1; i<=n; i++)
    {
        // dp[i][0]=0;
        for (int j=0; j<=h+maxi; j++)
        {
            dp[i][j]=dp[i-1][j];
            if (j>=arr[i].fi)
                dp[i][j]=min(dp[i][j],dp[i][j-arr[i].fi] + arr[i].se);
        }
    }
    ll ans=1e18;
    for (int i=h; i<=h+maxi; i++)
        ans=min(ans,dp[n][i]);
    cout<<ans<<endl;
}
 
int main() {
    fast_cin();
    int t=1;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 160640
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate#,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys
#from fractions import gcd
setrecursionlimit(10**6)
input=stdin.readline

def f(s,t):
    if (t-s)%2==0:
        return (t-s)//2
    else:
        return (t-s-1)//2+1
n,a,b=map(int,input().split())

if (b-a)%2==0:
    print((b-a)//2)
else:
    print(min(a-1+f(1,b-a+1),n-b+f(a+n-b,n)))
    

Measured memory_bytes: 3060
S = input()
T = input()

d = {}

for i in range(len(S)):
    #print(S[i],"to",T[i])
    if S[i] not in d:
        if T[i] in d.values():
            print('No')
            break
        else:
            d[S[i]] = T[i]
    else:
        if d[S[i]] != T[i]:
            print('No')
            break
    #print(d)
else:
    print('Yes')

Measured memory_bytes: 9356