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

int Num();
int Fact();
int Term();
int Exp();

int ite;
string s;

int Num() {
	int res = 0;
	while (isdigit(s[ite])) {
		res = res * 10 + s[ite] - '0';
		ite++;
	}
	return res;
}

int Fact() {
	if (s[ite] == '(') {
		ite++;
		int res = Exp();
		ite++;
		return res;
	}
	else {
		return Num();
	}
}

int Term() {
	int res = Fact();
	while (true) {
		if (s[ite] == '*') {
			ite++;
			res *= Fact();
		}
		else if (s[ite] == '/') {
			ite++;
			res /= Fact();
		}
		else {
			break;
		}
	}
	return res;
}

int Exp() {
	int res = Term();
	while (s[ite] != '=' && s[ite] != ')') {
		if (s[ite] == '+') {
			ite++;
			res += Term();
		}
		else if(s[ite] == '-') {
			ite++;
			res -= Term();
		}
	}
	return res;
}

int main()
{
	int n;
	cin >> n;
	while (n--) {
		cin >> s;
		ite = 0;
		cout << Exp() << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <array>
#include <string>

using namespace std;

constexpr size_t SIZE = 8;
constexpr size_t PATTERN = 7;

const array<string, PATTERN> pattern = {
    "1100000011", "1000000010000000100000001", "1111",
    "1000000110000001", "11000000011",
    "100000001100000001", "110000011"};

string surface;

char choice();

int main()
{
    while (true) {
        surface = "";

        for (size_t row = 0; row < SIZE; row++) {
            string buf;
            cin >> buf;

            surface += buf;
        }

        cout << choice() << endl;

        cin.ignore(2);
        if (cin.eof()) {
            break;
        }
    }

    return 0;
}

char choice()
{
    for (size_t i = 0; i < PATTERN; i++) {
        if (surface.find(pattern.at(i), 0) != string::npos) {
            return static_cast<char>('A' + i);
        }
    }
    return 'G';
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <sstream>
#include <string>

using namespace std;

int main()
{
    int N;
    cin >> N;
    double x[N];
    string u[N];
    for (int i=0; i<N; i++) {
        cin >> x[i] >> u[i];
    }
    
    double result = 0;
    for (int i=0; i<N; i++) {
        if (u[i]=="JPY") {
            result += x[i];
        } else {
            result += x[i]*380000;
        }
    }
    cout << result;
    
    return 0;
}   


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;
 
namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (r[0] == r[1])
            {
                Console.WriteLine(r[2]);
            }else if (r[0] == r[2])
            {
                Console.WriteLine(r[1]);
            }
            else
            {
                Console.WriteLine(r[0]);
            }
        }
        
    }
}

Measured memory_bytes: 13396
n = gets.chomp.to_i
ary1 = gets.chomp.split(" ").map(&:to_i)
ary2 = ary1.select{|elem| elem % 2 ==0}.select{|elem| (elem % 3 !=0) and (elem % 5 !=0)}
if ary2.length>0
  puts "DENIED"
else
  puts "APPROVED"
end


Measured memory_bytes: 1788
//SAIKH SERAJ FAHIM, CSE-19-HSTU, BANGLADESH.

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int count=0;
    string s1,s2;
    getline(cin,s1);
    getline(cin,s2);
    for(int i=0; s1[i]!='\0'; i++)
    {
        if(s1[i]!=s2[i])
            count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3920
#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, less<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(int i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(int i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(int i=0;i<int(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(int)(b);++i)
#define rrep(i,n) for(int i=int(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define irep(i,n) for(int i=int(n);;++i)
#define all(n) begin(n),end(n)
inline auto gcd(auto A,auto B){return B?gcd(B,A%B):A;}
inline auto lcm(auto A,auto B){return A/gcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={-1,1,0,0,1,1,-1,-1};
const vector<lint> dy={0,0,-1,1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[](auto f,auto... args){return f(f,args...);};

vec ans;
mat g;
set<lint>visited;
void solve(int v){
    for(auto d:g[v]){
        if(!visited.count(d)){
            ans.push_back(d+1);
            visited.insert(d);
            solve(d);
            return;
        }
    }
}
int main(){
    lint n,m;
    cin>>n>>m;
    g.resize(n);
    rep(i,m){
        lint s,t;
        cin>>s>>t;
        s--;t--;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    visited.insert(0);
    solve(0);
    reverse(all(ans));
    ans.push_back(1);
    solve(0);
    cout<<ans.size()<<endl;
    output(ans);
}


Measured memory_bytes: 15352
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Aug  2 21:38:01 JST 2020
 **/

struct Mo {
    struct Query {
        int l, r, idx;
        Query(int l_, int r_, int idx_) : l(l_), r(r_), idx(idx_) {}
    };
    int width;
    std::vector<Query> query;
    std::vector<bool> v;

    Mo(int n, int width_ = -1) : width(width == -1 ? (int)sqrt(n) : width_), v(n) {}
    void add(int l, int r) {
        int idx = query.size();
        query.emplace_back(l, r, idx);
    }
    template <class F, class G, class H> void run(const F& add, const G& del, const H& rem) {
        std::sort(query.begin(), query.end(), [&](const Query& a, const Query& b) {
            int ablock = a.l / width, bblock = b.l / width;
            if (ablock != bblock) return ablock < bblock;
            if (ablock & 1) return a.r < b.r;
            return a.r > b.r;
        });
        int nl = 0, nr = 0;
        auto push = [&](int idx) {
            v[idx].flip();
            if (v[idx])
                add(idx);
            else
                del(idx);
        };
        for (Query& q : query) {
            while (nl > q.l) push(--nl);
            while (nr < q.r) push(nr++);
            while (nl < q.l) push(nl++);
            while (nr > q.r) push(--nr);
            rem(q.idx);
            while (nl > q.l) push(--nl);
        }
    }
};

signed main() {
    Int n, Q;
    std::cin >> n >> Q;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Mo mo(n, 1000);
    REP(q, Q) {
        Int l, r;
        std::cin >> l >> r, l--;
        mo.add(l, r);
    }
    Int cur = 0;
    std::vector<Int> cnt(n), ans(Q);
    mo.run(
        [&](Int i) {
            if (cnt[a[i]]++ == 0) cur++;
        },
        [&](Int i) {
            if (--cnt[a[i]] == 0) cur--;
        },
        [&](Int i) { ans[i] = cur; });
    REP(q, Q) std::cout << ans[q] << "\n";
}


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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h) cin >> s[i];
	vector<vector<int>> d(h, vector<int>(w, -1));
	d[0][0] = 0;
	queue<pii> q;
	q.push({0, 0});
	while (!q.empty()) {
		pii p = q.front();
		q.pop();
		int y, x;
		tie(y, x) = p;
		vector<int> dy = {0, 1, 0, -1};
		vector<int> dx = {1, 0, -1, 0};
		rep(i, 4) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if (ny < 0 || ny >= h || nx < 0 || nx >=w) continue;
			if (s[ny][nx] == '#' || d[ny][nx] != -1) continue;
			d[ny][nx] = d[y][x] + 1;
			q.push({ny, nx});
		}
	}
	int ans = h * w;
	rep(i, h) rep(j, w) {
		if (s[i][j] == '#') ans--;
	}
	if (d[h - 1][w - 1] != -1) cout << ans - d[h - 1][w - 1] - 1 << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#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 = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 5999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

ll n, t, s[300000], ans = 0;
int main() {
	cin >> n >> t;
	REPO(i, n) {
		ll a;
		cin >> a;
		s[i] = a + t;
		ans += min(t, s[i] - s[i - 1]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
import math
import itertools

N = int(input())
X = [list(map(int,input().split())) for i in range(N)]
l = [i for i in range(N)]
ans = 0
for v in itertools.permutations(l,N):
    for i in range(N):
        if i==0:x,y = X[v[i]]
        else:
            x2,y2 = X[v[i]]
            ans+=math.sqrt((x-x2)**2+(y-y2)**2)
            x,y = x2,y2
print(ans/math.factorial(N))

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

using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 1010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

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

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

ll shop[110][20];
ll v[110], w[110];
ll p[110][20];

ll f(ll x, ll y) {
	ll x2 = 0;
	ll y2 = 0;
	ll x3 = x, y3 = y;
	while (x3 > 0) {
		x3 /= 10;
		x2++;
	}
	while (y3 > 0) {
		y3 /= 10;
		y2++;
	}
	ll res = max(x2, y2);
	return res;
}


//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	ll target = n;
	vector<ll>factorize;
	for (ll i = 2;i <= sqrt(target) + 1;++i) {
		if (target % i == 0) {
			factorize.push_back(i);
		}
	}
	ll m = factorize.size();
	ll ans = f(1, n);
	rep(i, m) {
		ll res = n / factorize[i];
		ll res2 = f(res, factorize[i]);
		ans = min(ans, res2);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
  ll a, b, c, k;
  while(cin>>a>>b>>c>>k){
    ll ans;
    if(k%2==0)
      ans=a-b;
    else
      ans=b-a;
    cout<<ans<<endl;
  }
  return 0;
}




Measured memory_bytes: 256
d={i:0 for i in range(13)}
d[0]=1
s=input()
for k,t in enumerate(s[::-1]):
    if t=='?':
        d2={i:0 for i in range(13)}
        for i in range(10):
            u=i*pow(10,k,13)
            for i in range(13):
                d2[(i+u)%13]+=d[i]
    else:
        u=int(t)*pow(10,k,13)
        d2={i:0 for i in range(13)}
        for i in range(13):
            d2[(i+u)%13]+=d[i]
    for i in range(13):
        d[i]=d2[i]%(10**9+7)
print(d[5])

Measured memory_bytes: 43884
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin >> s;
  	int size = s.size();
  	string ans = "Yes";
  	if(size%2 !=0){
    	ans = "No";
    }
    for(int i=0;i<size;i++){
    	if((i%2== 0 && s[i]!='h')||(i%2 == 1 &&s[i]!='i')){
          ans = "No";
        }
    }
  	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
import javax.swing.text.DefaultStyledDocument.ElementSpec;

import java.util.HashSet;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] yosou = sc.next().toCharArray();
        char[] zissai = sc.next().toCharArray();
        int count = 0;
        for (int i = 0; i < yosou.length; i++) {
            if (yosou[i] == zissai[i])
                count++;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>

int main(void){

  int x,y,z,tmp;
  scanf("%d %d %d",&x,&y,&z);

  tmp=x;
  x=y;
  y=tmp;

  tmp=x;
  x=z;
  z=tmp;

  printf("%d %d %d",x,y,z);


  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
"""
A - ABC/ARC
https://atcoder.jp/contests/abc053/tasks/abc053_a

"""
import sys


def solve(x):
    if x < 1200:
        return 'ABC'
    return 'ARC'


def main(args):
    x = int(input())
    ans = solve(x)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

	VAR(int, a, b);
	OUT(((a & 1) && (b & 1)) ? "Yes" : "No")BR; 
  
  return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio

    st s ;
    getline (cin , s) ;

    for (lli i = 0 ; i < s .size() ; i++)
    {
        lli n = 120 - s[i] ;
        s[i] += n ;
    }
    cout << s ;


    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, k;
	cin >> n >> k;
	ll h[n];
	zep(i, 0, n){
		cin >> h[i];
	}
	sort(h, h+n);
	ll ans = 0;
	zep(i, 0, max(n-k, 0LL)){
		ans += h[i];
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;

ll low[100][33333], high[100][33333], Sa[33333];

int main(){
	int N, K;
	cin >> N >> K;
	int nr = sqrt(N), bo = 0;
	for (int j = 1;j <= nr;j++) {
		low[0][j] = 1;
		Sa[j] = high[0][j] = N / j;
	}

	for (int j = 1;j <= nr;j++) {
		Sa[j] -= Sa[j + 1];
		high[0][j] -= high[0][j + 1];
	}
	for (int j = 1;j <= nr;j++)low[0][j] += low[0][j - 1];
	Sa[nr] -= low[0][nr];
	high[0][nr] -= low[0][nr];
	for (int j = nr;j > 0;j--)high[0][j] += high[0][j + 1];

	for (int i = 1;i < K;i++) {
		for (int j = 1;j <= nr;j++) {
			low[i][j] = low[i - 1][nr] + high[i - 1][j];
			high[i][j] = low[i - 1][j] * Sa[j];
			low[i][j] %= MOD;
			high[i][j] %= MOD;
		}
		for (int j = 1;j <= nr;j++)low[i][j] += low[i][j - 1], low[i][j] %= MOD;
		for (int j = nr;j > 0;j--)high[i][j] += high[i][j + 1], high[i][j] %= MOD;
	}

	cout << (low[K - 1][nr] + high[K - 1][1]) % MOD << endl;
}

Measured memory_bytes: 52480
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split(' ');
    var W = Number(inputs[0]);
    var H = Number(inputs[1]);
    var x = Number(inputs[2]);
    var y = Number(inputs[3]);
    var r = Number(inputs[4]);

    var x0 = W - x - r;
    var x1 = W - x + r;
    var y0 = H - y - r;
    var y1 = H - y + r;

    if ((x0 >= 0 && x1 <= W) && (y0 >=0 && y1 <= H)) {
        console.log('Yes');
    } else {
        console.log('No');
    }
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15564
#define LOCAL

#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

// From Errichto's Youtube stream
#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__) << "] "

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
const int MAXD = 100;

int H, W;
int cap[2 * MAXD + 2][2 * MAXD + 2];

int used[2 * MAXD + 2];
int parent[2 * MAXD + 2];

int SOURCE;
int SINK;

bool dfs(int x) {
    //debug() << x;
    if (used[x])
        return false;
    used[x] = true;
    if (x == SINK)
        return true;
    
    for (int i = 0; i <= SINK; i++) {
        if (cap[x][i] && !used[i] && dfs(i)) {
            parent[i] = x;
            return true;
        }
    }
    return false;
}

bool flow() {
    memset(used, 0, sizeof(used));
    if (dfs(SOURCE)) {
        for (int x = SINK; x; x = parent[x]) {
            cap[parent[x]][x]--;
            cap[x][parent[x]]++;

            //debug() << parent[x] << " " << x;
        }
        return true;
    }   
    return false; 
}

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

    cin >> H >> W;

    string S;

    int SR(-1), SC(-1), TR(-1), TC(-1);

    SOURCE = 0;
    SINK = H + W + 1;

    for (int i = 0; i < H; i++) {
        cin >> S;
        for (int j = 0; j < W; j++) {
            if (S[j] == 'S') {
                SR = i, SC = j;
            } else if (S[j] == 'T') {
                TR = i, TC = j;
            } else if (S[j] == 'o') {
                cap[i + 1][j + 1 + H] = 1;
                cap[j + 1 + H][i + 1] = 1;
            }
        }
    }

    //debug() << SR << " " << SC << " " << TR << " " << TC;

    cap[SOURCE][SR + 1] = H + W;
    cap[SOURCE][SC + H + 1] = H + W;

    cap[TR + 1][SINK] = H + W;
    cap[TC + 1 + H][SINK] = H + W;


    int result = 0;

    while(flow())
        result++;

    cout << (result <= H + W - 2 ? result : -1) << "\n";

    return 0;
}


Measured memory_bytes: 384
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

# N = int(readline())
# D = [int(d) for d in readline().split()]

import itertools

N = int(readline())
A = [int(x)-1 for x in readline().split()]
B = [int(x) for x in readline().split()]
C = [int(x) for x in readline().split()]

ans = 0
ans += sum(B)
for a,b in zip(A,A[1:]):
    if a + 1 == b:
        ans += C[a]


print(ans)


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

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	
	// 貪欲
	ll ans = 0;
	rep(i, d) {
		ll mx = -1001001001;
		int now = 0;
		
		rep(j, n) {
			ll tmp = ans;
			tmp += s[i][j];
			rep(k, n) {
				if(j == k) continue;
				tmp -= c[k] * (i+1-last[k]);
			}
			if(mx < tmp) {
				mx = tmp;
				now = j;
			}
		}
		ans = mx;
		last[now] = i+1;
		t[i] = now+1;
	}
	int cnt = 0;
	while(1) {
		// 局所探索法
		cnt++;
		if(cnt > 200000) break;
		vector<int> old = t;
		const int CH = rand()%100 + 1; // CH箇所変える
		rep(i, CH) {
			int nd = rand()%d;
			int nq = rand()%n + 1;
			t[nd] = nq;	
		}
		
		// 点数の再計算
		vector<int> nlast(n);
		ll now = 0;
		rep(i, d) {
			now += s[i][t[i]];
			nlast[t[i]-1] = i+1;
			rep(j, n) {
				now -= c[j] * (i+1-nlast[j-1]);
			}
		}
		
		// 良くなれば更新
		if(now > ans) {
			ans = now;
		} else {
			t = old;
		}
	}
	
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

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

int main(void){
    long long n;
    cin >> n;
    string ans = "";
    if(n==0){
        cout << "0\n";
        return 0;
    }
    while(n!=0){
        long long q, am;
        if(n%(-2)==0){
            q = n/(-2);
        }else{
            q = (n-1)/(-2);
        }
        am = n-q*(-2);
        n = q;
        ans = to_string(am) + ans;
    }
    cout << ans << endl;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), prefix_sum(n, 0);
    rep(i, n) {
        cin >> a[i];
        prefix_sum[i] = (i - 1 >= 0 ? prefix_sum[i - 1] : 0) + a[i];
        prefix_sum[i] %= m;
    }
    ll ans = 0;
    unordered_map<int, int> counter;
    for (int i = 0; i < n; i++) {
        counter[prefix_sum[i]]++;
        if (prefix_sum[i] == 0) {
            ans += counter[prefix_sum[i]];
        } else
            ans += counter[prefix_sum[i]] - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4492
#include<stdio.h>

int main(){
    int a,b,n,i,sum,t;

    while(sum=0,scanf("%d %d %d",&a,&b,&n)!=EOF){
        a%=b;
        for(i=0;i<n;i++){
            a*=10;
            sum+=a/b%10;
            a%=b;
            if(!a)break;
        }
        printf("%d\n",sum);
    }
    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{long long v[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  long long n;cin>>n;cout<<v[n-1];
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			char [] s = sc.next().toCharArray();
			
			int ans = Integer.MAX_VALUE;
			for(int i = 0; i < 26; i++){
				int ind = 0;
				int count = 0;
				char now = (char) ('a' + i);
				for(int j = 0; j < s.length;j++){
					if(s[j] == now){
						ind = Math.max(count, ind);
						count = 0;
					}
					else{
						count++;
					}
				}
				ind = Math.max(ind, count);
//				debug(ind, (char)now);
				
				ans = Math.min(ans, ind);
			}
			System.out.println(ans);

		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


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

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

const int INF = 1070000000;

int n,m,k,p;
int dist[1<<10][1<<10];
int pick[7], send[7];
int dp[1<<10][1<<6][1<<6];

int f(int cur,int mask1,int mask2){
	int& res = dp[cur][mask1][mask2];
	if(res != -1) return res;
	if(mask2 == (1<<k)-1) return res = 0;
	res = INF;
	// pick
	rep(i,k)if((mask1>>i&1) == 0){
		res = min(res, dist[cur][pick[i]] + f(pick[i], mask1 | 1<<i, mask2));
	}
	// send
	rep(i,k)if((mask2>>i&1) == 0 && (mask1>>i&1) == 1){
		res = min(res, dist[cur][send[i]] + f(send[i], mask1, mask2 | 1<<i));
	}
	//cout<<cur<<" "<<mask1<<" "<<mask2<<" : "<<res<<endl;
	return res;
}

int main(){
	cin>>n>>m>>k>>p; p--;
	rep(i,n)rep(j,n)dist[i][j] = i==j ? 0 : INF;
	rep(i,m){
		int x,y,w;
		cin>>x>>y>>w;
		x--; y--;
		dist[x][y] = dist[y][x] = w;
	}
	rep(K,n)rep(i,n)rep(j,n)dist[i][j] = min(dist[i][j], dist[i][K] + dist[K][j]);
	//rep(i,n)rep(j,n)cout<<dist[i][j]<<(j==n-1 ? "\n":" ");
	rep(i,k){
		cin>>pick[i]>>send[i];
		pick[i]--; send[i]--;
	}
	memset(dp,-1,sizeof(dp));
	int ans = f(p, 0, 0);
	if(ans >= INF) cout<<"Cannot deliver"<<endl;
	else cout<<ans<<endl;
}

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

using namespace std;

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

  vector<int> W(N);
  for(int i = 0; i < N; i++) cin >> W[i];
  int sum = 0;

  vector<int> V(N + 1);
  for(int i = 0; i < N; i++){
    sum += W[i];
    V[i + 1] = V[i] + W[i];
  }
  int min = 10000000;
  for(int i = 0; i < N; i++){
    if(min > abs(V[i] - (sum - V[i]))) min = abs(V[i] - (sum - V[i]));
  }

  cout << min;

  return 0;
}





Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const long long INFL = 2e18;
const int MOD = 1000000007;

const long long MAX = 1000100;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2;i < MAX;i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k){
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

template <class T, class U>
T pow_mod(T a,T b,U m){
	if(b == 0)return 1;
	else if(b % 2 == 0){
		ll t = pow_mod(a,b/2,m);
		return t * t % m;
	}
	return a  * pow_mod(a,b-1,m) % m;
}

int main(){
	COMinit();
	int n;
	cin >> n;

	vector<ll> pow2(n+1,1);
	vector<ll> pow8(n+1,1);

	for(int i = 1;i <= n;i++){
		pow2[i] = pow2[i-1] * 2 % MOD;
		pow8[i] = pow8[i-1] * 8 % MOD;
	}
	ll ans = 0;
	for(int i = 2;i <= n;i++){
		ans += ((pow2[i] - 2 + MOD) % MOD * COM(n,i)) % MOD * pow8[n-i];
		ans %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 42180
#include <stdio.h>
#include <string.h>




int main(void){
    char po[364];
    scanf("%s",po);
    int a=strlen(po);
    if(a!=26){
    int unko[26]={};
    for(int i=0;i<a;i++)unko[po[i]-'a']=1;
    printf("%s",po);
    for(int i=0;i<26;i++)if(unko[i]==0){printf("%c",'a'+i);return 0;}
    }
    else{
        char nari[]="zyxwvutsrqponmlkjihgfedcba";
        if(strcmp(po,nari)==0){printf("-1");return 0;}
        else{
            int now=po[a-1]-'a';
            for(int i=a-2;i>=0;i--){
                if(po[i]-'a'<now){
                    for(int j=0;j<i;j++)printf("%c",po[j]);
                    for(int j=a-1;;j--)if(po[i]<po[j]){printf("%c",po[j]);return 0;}
                }
                else now=po[i]-'a';
            }
            
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n;
	long long t, a;
	cin >> n;

	long long x = 1;
	long long y = 1;
	for (int i = 0; i < n; i++) {
// cout << "-----" << endl;
// printf("x %lld, y %lld\n", x, y);

		cin >> t >> a;
		long long prod1 = (long long) (x + t - 1) / t;
		long long prod2 = (long long) (y + a - 1) / a;

// printf("t %lld, a %lld, p1 %lld, p2 %lld\n", t, a, prod1, prod2);

		auto x1 = t * prod1;
		auto y1 = a * prod1;

		auto x2 = t * prod2;
		auto y2 = a * prod2;
// printf("xy1 %lld %lld, xy2 %lld %lld\n", x1, y1, x2, y2);

		if (x1 + y1 > x2 + y2) {
			swap(x1, x2);
			swap(y1, y2);
		}

		if (x1 >= x && y1 >= y) {
			x = x1;
			y = y1;
		} else {
			x = x2;
			y = y2;
		}
// printf("x %lld, y %lld\n", x, y);
	}

	cout << x + y << endl;
	return 0;
}


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

int main()
{
	int N;
	long long Y;
	cin >> N >> Y;
	int a, b , c;
	a = 0;
	while (a <= Y / 10000)
	{
		b = 0;
		while (10000*a + 5000 * b <= Y)
		{
			c = N - a - b;
			if (10000*a + 5000*b + 1000*c == Y)
			{	cout << a << " " << b << " " << c << endl;
				return 0;
			}
			b++;
		}
		a++;
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    if(abs(a-b) > n || a > b){
        cout << 0 << endl;
    }else if(n == 1 && a==b)cout << 1 << endl;
    else if(n == 1 && a!=b)cout << 0 << endl;
    else{
        ll ma = a+(n-1)*b;
        ll mi =  a*(n-1)+b;
        cout << ma - mi +1  << endl;
    }
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long

ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  return gcd(b, a%b);
}
int main(){
  int N;
  cin >> N;
  vector<ll> T(N);
  for(ll i=0; i<N; i++){
    cin >> T[i];
  }
  ll ans=T[0];
  for(int i=1; i<N; i++){
    ans = T[i]/gcd(T[i], ans)*ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::VecDeque;

fn main() {
    input!{
        h: usize,
        w: usize,
        v: [chars; h]
    }
    let mut q = VecDeque::new();
    let mut dist = vec![vec![usize::max_value(); w]; h];
    q.push_back((0, 0));
    dist[0][0] = 0;
    while let Some((x, y)) = q.pop_front() {
        dfs(x, y, &v, &mut q, &mut dist);
    }
    if dist[h - 1][w - 1] % 2 == 1 {
        println!("{}", (dist[h - 1][w - 1] + 1) / 2);
    } else if v[0][0] == '#' {
        println!("{}", dist[h - 1][w - 1] / 2 + 1);
    } else {
        println!("{}", dist[h - 1][w - 1] / 2);
    }
}

fn dfs(x: usize, y: usize, v: &Vec<Vec<char>>, q: &mut VecDeque<(usize, usize)>, dist: &mut Vec<Vec<usize>>) {
    let h = v.len();
    let w = v[0].len();
    if x < h - 1 && dist[x + 1][y] == usize::max_value() {
        if v[x + 1][y] == v[x][y] {
            dist[x + 1][y] = dist[x][y];
            dfs(x + 1, y, v, q, dist);
        } else {
            dist[x + 1][y] = dist[x][y] + 1;
            q.push_back((x + 1, y));
        }
    }
    if y < w - 1 && dist[x][y + 1] == usize::max_value() {
        if v[x][y + 1] == v[x][y] {
            dist[x][y + 1] = dist[x][y];
            dfs(x, y + 1, v, q, dist);
        } else {
            dist[x][y + 1] = dist[x][y] + 1;
            q.push_back((x, y + 1));
        }
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<stdlib.h>
int c=0;

int* Selection(int *A, int N){
  int i, j, minj, num;
  for(i=0 ; i<N ; i++){
    minj=i;
    for(j=i ; j<N ; j++){
      if(A[j]<A[minj]){
        minj=j;
      }
    }
    num=A[i];
    A[i]=A[minj];
    A[minj]=num;
    if(A[i]!=A[minj])c++;
  }
  return A;
}

int main(void){
  int N,i;
  int *A;
  while(1){
  scanf("%d",&N);
  if(N>=1 && N<=100)break;
}
  A = (int*)malloc(sizeof(int)*N);
  for(i=0 ; i<N ; i++){
    while(1){
    scanf("%d",&A[i]);
    if(0<=A[i] && A[i]<=100)break;
  }
  }
  A=Selection(A,N);
  printf("%d",A[0]);
  for(i=1 ; i<N ; i++){
    printf(" %d",A[i]);
  }
  printf("\n%d\n",c);
  return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll i,j,k,l,n,x,a,b;
    cin>>x>>a>>b;
    l=abs(x-a);
    ll l1=abs(x-b);
    if(l<=l1)
    {
        cout<<"A"<<endl;
    }
    else
    {
        cout<<"B"<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(int argc, char *argv[]) {
  vector<ll> a(100);
  a[0] = 2, a[1] = 1;
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    a[i] = a[i - 1] + a[i - 2];
  }
  cout << a[n] << endl;
  return 0;
}


Measured memory_bytes: 256
program balanced_path
  implicit none
  integer, parameter :: inf = 1000000000
  integer :: h, w, a(80,80) = 0, b(80) = 0, i, j, k
  logical :: dp(80,80,0:13000) = .false.
  read(*,*) h, w
  do i = 1, h
    read(*,*) a(i,1:w)
  end do
  do i = 1, h
    read(*,*) b(1:w)
    a(i,1:w) = abs(a(i,1:w)-b(1:w))
  end do
  dp(1,1,a(1,1)) = .true.
  do i = 1, h
    do j = 1, w
      if (i > 1) then
        do k = 0, 13000
          if (dp(i-1,j,k)) then
            dp(i,j,abs(k-a(i,j))) = .true.
            dp(i,j,k+a(i,j)) = .true.
          end if
        end do
      end if
      if (j > 1) then
        do k = 0, 13000
          if (dp(i,j-1,k)) then
            dp(i,j,abs(k-a(i,j))) = .true.
            dp(i,j,k+a(i,j)) = .true.
          end if
        end do
      end if
    end do
  end do
  do k = 0, 13000
    if (dp(h,w,k)) then
      write(*,'(i0)') k
      stop
    end if
  end do
end program balanced_path

Measured memory_bytes: 319744
n = gets.to_i
p = gets.chomp.split(" ").map(&:to_i)
a = Array.new(n){|i|(i+1)*20001}
b = Array.new(n){|i|(n-i)*20001}
for i in 0..n-1
  a[p[i]-1] += i
end
puts a.join(" "),b.join(" ")

Measured memory_bytes: 5116
#include<cstdio>

int main(){
    int H,W;
    for(;;){
        scanf("%d %d\n\n",&H,&W);
        if(H == 0 && W == 0){
            break;
        }
        for(int i = 1;;i++){
            for(int j = 1;;j++){
                printf("#");
                if(j == W){
                    printf("\n");
                    break;
                }
            }
            if(i == H){
                printf("\n");
                break;
            }
        }
    }
    return 0;
}


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

int const maxN = 1e5 + 10;

int N, ut, va;
vector<int> E[maxN];

int main()
{
  scanf("%d%d%d", &N, &ut, &va);
  for(int i = 0; i < N-1; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    E[A].push_back(B);
    E[B].push_back(A);
  }

  if(ut == va) { puts("0"); return 0; }


  int aoki[maxN];
  vector<bool> vis(N+1, false);
  queue<pair<int, int>> q;
  vis[va] = true;
  q.push({va, 0});

  while(q.size()) {
    //auto [u, t] = q.front(); q.pop();
    int u, t;
    tie(u, t) = q.front(); q.pop();
    aoki[u] = t;
    for(int v: E[u])
      if(!vis[v]) q.push({v, t+1}), vis[v] = true;
  }

  int taka[maxN];
  memset(taka, -1, sizeof taka);
  vis.assign(N+1, false);
  vis[ut] = true;
  q.push({ut, 0});

  while(q.size()) {
    //auto [u, t] = q.front(); q.pop();
    int u, t;
    tie(u, t) = q.front(); q.pop();
    taka[u] = t;
    for(int v: E[u])
      if(!vis[v] && t+1 <= aoki[v]) q.push({v, t+1}), vis[v] = true;
  }


  int ans = 0;
  for(int i = 1; i <= N; i++)
    if(taka[i] != -1) ans = max(ans, aoki[i]-1);

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b == c + d)
    cout << "Balanced" << endl;
  else if (a + b > c + d)
    cout << "Left" << endl;
  else
    cout << "Right" << endl;
}

Measured memory_bytes: 3616
n = int(input())

found = False
cnt = 0
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        found = True

if found:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62056
using System;
using System.Collections.Generic;

public static class Program
{
	public static void Main()
	{
		var stack = new Stack<int>();
		foreach (var s in Console.ReadLine().Split(' '))
		{
			switch (s)
			{
			case "+":
				stack.Push(stack.Pop() + stack.Pop());
				break;
			case "-":
				int a = stack.Pop();
				int b = stack.Pop();
				stack.Push(b - a);
				break;
			case "*":
				stack.Push(stack.Pop() * stack.Pop());
				break;
			default:
				stack.Push(int.Parse(s));
				break;
			}
		}
		Console.WriteLine(stack.Pop());
	}
}



Measured memory_bytes: 10132
H,W = map(int,input().split())
c = []
ans = 0
for i in range(10):
    c.append(list(map(int,input().split())))
maze = []
for i in range(H):
    maze.append(list(map(int,input().split())))

for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k]+c[k][j])

for i in maze:
    for j in i:
        if j != -1:
            ans += c[j][1]

print(ans)


Measured memory_bytes: 40668
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int h,w,n,sr,sc;string s,t;cin>>h>>w>>n>>sr>>sc>>s>>t;
  int rest = sr;
  rep(i,n){
    if(s[i] == 'U')rest--;
    if(!rest){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i] == 'D' && rest < h)rest++;
  }
  rest = sc;
  rep(i,n){
    if(s[i] == 'L')rest--;
    if(!rest){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i] == 'R' && rest < w)rest++;
  }
  rest = h-sr+1;
  rep(i,n){
    if(s[i] == 'D')rest--;
    if(!rest){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i] == 'U' && rest < h)rest++;
  }
  rest = w-sc+1;
  rep(i,n){
    if(s[i] == 'R')rest--;
    if(!rest){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i] == 'L' && rest < w)rest++;
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 776
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), d = sc.nextInt();
        out.println((n + (2 * d+1) - 1) / (2 * d+1));
        out.flush();
        out.close();
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }


        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }


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

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


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

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }
}

Measured memory_bytes: 20948