akhauriyash/Code-Regression huggingface dataset:
const int N = 4e5;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

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

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

void __fast_IO()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
}

//##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**
//##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**

ll n, a, b;
bitset<10001> kn;

signed main()
{
    __fast_IO();
    cin >> n;
    kn[0] = 1;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        kn |= kn << a;
    }
    for (int i = 10000; i >= 0; i--)
    {
        if (kn[i] && i % 10 != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << 0;
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


Measured memory_bytes: 256
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;

typedef long long LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 1e5;

LL n, a[MaxN], m, x, y, deg[MaxN], kq, vis[MaxN], ans[MaxN];
vector<LL> q[MaxN];

class Edge{

    public:
        LL u, v, id;

        Edge(LL _u = 0, LL _v = 0, LL _id = 0):u(_u), v(_v), id(_id){}

} e[MaxN];

void DFS(LL u, LL color){
    vis[u] = 1;
    LL cnt = 0;
    for(int i : q[u]){
        LL v = e[i].u + e[i].v - u;
        if(vis[v]) continue;
        cnt++;
        if(cnt == color) cnt++;
        ans[e[i].id] = cnt;
        DFS(v, cnt);
    }
}

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 0 ; i < n - 1 ; ++i){
        cin >> x >> y;
        e[i] = Edge(x, y, i);
        deg[x]++;
        deg[y]++;
        q[x].push_back(i);
        q[y].push_back(i);
        kq = max(kq, max(deg[x], deg[y]));
    }
    cout << kq << endl;
    DFS(1, 0);
    for(int i = 0 ; i < n - 1 ; ++i) cout << ans[i] << endl;

    return 0;
}

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

int a[2050];
void solve(){
	int n,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n-2;i++){
		for(int j=i+1;j<=n-1;j++){
			int k=lower_bound(a+j+1,a+n+1,a[i]+a[j])-a;
			ans+=(k-j-1);
		}
	}
	printf("%d",ans);
}

signed main(){
    int t=1;
    //scanf("%d",&t);
    for(int i=1;i<=t;i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3744
import scala.io.StdIn
import java.util.Arrays

object Main {
  def main(args: Array[String]): Unit = {
    while(true) {
      val n :: m :: _res = StdIn.readLine().split(" ").map(_.toInt).toList
      if(n == 0) { return; }
      val prices = StdIn.readLine().split(" ").map(_.toInt).toSeq

      println(solve(m, prices).map(_.toString).getOrElse("NONE"))
    }
  }

  def solve(max: Int, prices: Seq[Int]): Option[Int] = {
    val ps = prices.toArray
    Arrays.sort(ps)

    var current: Int = 0

    for {
      (p, i) <- ps.zipWithIndex
      (q, j) <- ps.zipWithIndex
      if i < j
    } {
      val add = p + q
      if(add <= max) {
        if(current < add) {
          current = add
        }
      }
    }

    if(current == 0) {
      None
    } else {
      Some(current)
    }
  }
}



Measured memory_bytes: 442512
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
 
 string a="ACL";
 
 ll k;
 cin>>k;
 
 for(ll i=0;i<k;i++)
 cout<<a;
 
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <string.h>
using namespace std;


int p, b[4] = { 0 };
char c[4];

int main(){

	while (scanf("%d,%s", &p, c) != EOF) {
		if (strcmp(c, "A") == 0) {
			b[0]++;
		}
		else if (strcmp(c, "B") == 0) {
			b[1]++;
		}
		else if (strcmp(c, "AB") == 0) {
			b[2]++;
		}
		else {
			b[3]++;
		}
	}
	for (int i = 0; i < 4; i++) {
		printf("%d\n", b[i]);
	}

	return 0;
}

Measured memory_bytes: 2612
#include <stdio.h>

int main(){
  int x, y, z;
  scanf("%d", &x);
  scanf("%d", &y);
  if ((x==1) && (y==2)) z=3;
  if ((x==1) && (y==3)) z=2;
  if ((x==2) && (y==1)) z=3;
  if ((x==2) && (y==3)) z=1;
  if ((x==3) && (y==1)) z=2;
  if ((x==3) && (y==2)) z=1;
  printf("%d\n", z);
}

Measured memory_bytes: 128
import kotlin.math.floor
import kotlin.math.sqrt

fun main() = abc165d()

@OptIn(ExperimentalStdlibApi::class)
fun abc165d() {
    val (a, b, n) = readLine()!!.split(' ').map { it.toLong() }

    val answer = floor(a.toDouble() * Math.min(b - 1, n) / b).toLong()

    println(answer)
}


Measured memory_bytes: 36428
//曼哈顿几何问题:有n条平行坐标轴(x或y)的直线，求所有的交点个数
//使用平面扫描可以高效求解 
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

//端点类型，下、左、右、上 
enum {
	BOTTOM,LEFT,RIGHT,TOP
};

class EndPoint {
	public:
	long x,y;
	int type;
	int r_x; //如果是左端点，则需要知道它的右端点x坐标 
	void set(long x,long y) {
		this->x = x;
		this->y = y; 
	}
	void setType(int type) {
		this->type = type;
	}
	bool operator<(EndPoint & p) {
		//按y排序，如果y相同，按左右端点排序 
		if (y == p.y) {
			return type < p.type;
		} else {
			return y < p.y;
		}
	}
};


int n;
int EP_L;
EndPoint *EP; //端点数组

int solve() {
	sort(EP,EP+EP_L);//先对点排序，以满足从下往上的扫描顺序 
	int cnt = 0;
	//使用二叉树储存垂直于x轴的线段的下端点 
	set<long> BT;
	//从下往上扫描 
	for (int i=0;i<EP_L;i++) {
		//遇到上端点，则将下端点删除，表明这条垂直线段已经扫描结束 
		if (EP[i].type == TOP) {
			BT.erase(EP[i].x);
		} else if (EP[i].type == BOTTOM) {
			BT.insert(EP[i].x);
		} else if (EP[i].type == LEFT) {
			set<long>::iterator a = BT.lower_bound(EP[i].x);
			set<long>::iterator b = BT.upper_bound(EP[i].r_x);
			cnt += distance(a,b);
		}
	}
	return cnt;
} 

int main() {
	cin >> n;
	EP_L = 2*n;
	EP = new EndPoint[EP_L];
	for (int i=0,k=0;i<n;i++) {
		int x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		EP[k++].set(x1,y1);
		EP[k++].set(x2,y2);
		//因为是平行于坐标轴的线段，所有只有y相等或x相等 
		if (y1 == y2) {
			if (x1 < x2) {
				EP[k-2].setType(LEFT);
				EP[k-2].r_x = x2;
				EP[k-1].setType(RIGHT);
			} else {
				EP[k-1].setType(LEFT);
				EP[k-1].r_x = x1;
				EP[k-2].setType(RIGHT);
			}
		} else {
			if (y1 < y2) {
				EP[k-2].setType(BOTTOM);
				EP[k-1].setType(TOP);
			} else {
				EP[k-1].setType(BOTTOM);
				EP[k-2].setType(TOP);
			}
		}
	}
	cout << solve() << endl;
	delete[] EP;
	return 0;
} 




Measured memory_bytes: 10104
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve()
{
    char n;
    cin>>n;
    if(n>='a' and n<='z'){
        cout<<'a';
    }
    else
        cout<<'A';

}

int main()
{
    int x,t;  solve();

}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define fo(i,s,e) for (int i=(s); i < (e); i++)
#define all(obj) (obj).begin(), (obj).end()
#define int long long
int karakaru (int h){
  if(h==1) return 1;
  else return 2*karakaru(floor(h/2))+1;
}
signed main () {
  int n;cin >> n;
  cout << karakaru(n) << endl;
}

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

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

Measured memory_bytes: 79104
#pragma GCC target("sse4.2")
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <nmmintrin.h>

using namespace std;
using ll = long long;
static int32_t b[5000][208] __attribute__((aligned(16))) = { { 0 } };

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> a(n - 1);
	for(int i = 0; i < n - 1; ++i){ cin >> a[i]; }
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){ cin >> b[i][j]; }
	}
	int64_t answer = 0;
	for(int l = 0; l < n; ++l){
		int32_t c[208] __attribute__((aligned(16))) = { 0 };
		int64_t move_sum = 0;
		for(int r = l; r < n; ++r){
			const int32_t *d = &(b[r][0]);
			__m128i sum_i64 = _mm_setzero_si128();
			for(int i = 0; i < m; i += 16){
				const __m128i c0 = _mm_load_si128((const __m128i *)(c + i +  0));
				const __m128i d0 = _mm_load_si128((const __m128i *)(d + i +  0));
				const __m128i c1 = _mm_load_si128((const __m128i *)(c + i +  4));
				const __m128i d1 = _mm_load_si128((const __m128i *)(d + i +  4));
				const __m128i c2 = _mm_load_si128((const __m128i *)(c + i +  8));
				const __m128i d2 = _mm_load_si128((const __m128i *)(d + i +  8));
				const __m128i c3 = _mm_load_si128((const __m128i *)(c + i + 12));
				const __m128i d3 = _mm_load_si128((const __m128i *)(d + i + 12));
				const __m128i e0 = _mm_max_epi32(c0, d0);
				const __m128i e1 = _mm_max_epi32(c1, d1);
				const __m128i e2 = _mm_max_epi32(c2, d2);
				const __m128i e3 = _mm_max_epi32(c3, d3);
				_mm_store_si128((__m128i *)(c + i +  0), e0);
				_mm_store_si128((__m128i *)(c + i +  4), e1);
				_mm_store_si128((__m128i *)(c + i +  8), e2);
				_mm_store_si128((__m128i *)(c + i + 12), e3);
				const __m128i f01 = _mm_add_epi32(e0, e1);
				const __m128i f23 = _mm_add_epi32(e2, e3);
				const __m128i g   = _mm_add_epi32(f01, f23);
				const __m128i h0  = _mm_cvtepu32_epi64(g);
				const __m128i h1  = _mm_cvtepu32_epi64(_mm_srli_si128(g, 8));
				sum_i64 = _mm_add_epi64(sum_i64, _mm_add_epi64(h0, h1));
			}
			int64_t buffer[2] __attribute__((aligned(16)));
			_mm_store_si128((__m128i *)buffer, sum_i64);
			answer = max(answer, buffer[0] + buffer[1] - move_sum);
			move_sum += a[r];
		}
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, x, t;
	cin >> n >> x >> t;
	int ans = 0;
	while(n > 0)
	{
		n -= x;
		ans += t;
	}
	cout << ans;
	return 0;
	
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<ll> v;
    v.emplace_back(2);
    v.emplace_back(1);
    for (int i = 0; i < n; ++i) {
        v.emplace_back(v[i+1] + v[i]);
    }
    cout << v[n] << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 50+10;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7  ;
int n;ll k;
struct mat {
	ll a[N][N];
	mat operator*(const mat &o) const {
		mat r={};
		for(int i=0; i<n; ++i)
			for(int k=0; k<n; ++k)
				for(int j=0; j<n; ++j)
					r.a[i][j]=(r.a[i][j]+a[i][k]*o.a[k][j])%mod;
		return r;
	}
} b, r;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++){
	cin>>b.a[i][j];
	if(i==j)r.a[i][j]=1;}
	while(k)
	{
		if(k%2)
			r=r*b;
		b=b*b;
		k>>=1;}
	ll ans=0;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	(ans+=r.a[i][j])%=mod;
	cout<<ans;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int INF = 1e9;

int main() {
	int n;
	cin >> n;
	int dp[100001];
	
	
	vector<int>h(n);
	rep(i, n) {
		cin >> h[i];
	}
	rep(i, 100001) {
		dp[i] = INF;
	}
	dp[0] = 0;
	rep(i, n) {
		if (i < n - 1) {
			chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
			
			if (i - 1 >= 0)chmin(dp[i + 1], dp[i-1] + abs(h[i + 1] - h[i - 1]));
			//cout << dp[i + 1] << endl;
		}	
	}
	cout << dp[n - 1] << endl;
	return 0;

}

Measured memory_bytes: 3992
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;
// #define int long long
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long

ll _sum_vector(pair<int, int> pairs){
  if(pairs.first == 0 || pairs.second == 0){
    return 0;
  }
  return (pairs.first - 1) * (pairs.second - 1);
}

bool compare_pair(pair<ll, ll> pair1, pair<ll, ll> pair2){
  return (pair1.second < pair2.second);
}

int main(int argc, const char * argv[]) {

    int N;
    cin >> N;
    vector< pair<ll, ll> > xy;

    rep(i,N){
      ll x, y;
      cin >> x >> y;
      xy.push_back(make_pair(x, y));
    }

    sort(xy.begin(), xy.end(), compare_pair);

    ll sum = 0;
    bool flag = false;
    rep(i,N){
      sum += xy[i].first;
      if (sum > xy[i].second){
        flag = true;
      }
    }
    if(flag){
      cout << "No" << endl;
    }
    else{
      cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 6512
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S,T;
	cin>>S>>T;
	vector<vector<int>> DP(3010,vector<int>(3010,0));
	vector<vector<pii>> PAR(3010,vector<pii>(3010,mp(0,0)));
	
	rep(i,0,SZ(S))rep(j,0,SZ(T))
	{
		if(S[i]==T[j])
		{
			DP[i+1][j+1]=DP[i][j]+1;
			PAR[i][j]=mp(i-1,j-1);
		}
		else
		{
			if(chmax(DP[i+1][j+1],DP[i][j+1]))
			{
				PAR[i][j]=mp(i-1,j);
			}
			if(chmax(DP[i+1][j+1],DP[i+1][j]))
			{
				PAR[i][j]=mp(i,j-1);
			}
		}
	}
	string ANS;
	int l=SZ(S)-1,r=SZ(T)-1;
	while(true)
	{
		if(S[l]==T[r])ANS+=S[l];
		if(l<0||r<0||l==0&&r==0)break;
		auto par=PAR[l][r];
		l=par.first;
		r=par.second;
	}
	reverse(all(ANS));
	cout<<ANS<<endl;
	
	return 0;
}

Measured memory_bytes: 212864
a,b = gets.chomp.split.map(&:to_i).sort

def prime?(n)
  return true if n == 2 || n == 3
  return false if n < 2 || n % 2 == 0 || n % 3 == 0
  step_flag = true
  current = 5
  while current <= Math.sqrt(n).to_i
    return false if n % current == 0
    current += step_flag ? 2 : 4
    step_flag = !step_flag
  end

  return true
end

ans = 1
array = []
(1..Math.sqrt(b).to_i).each do |i|
  if b % i == 0
    array << i if a % i == 0
    array << b / i if a % (b / i) == 0
  end
end

array.each do |i|
  if prime?(i)
    ans += 1
  end
end
puts ans


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC096
{
    class Program
    {
        public static void Main(string[] args)
        {
            /*
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = input[0];
            int b = input[1];
            */

            var s = Console.ReadLine();
            var aarray = s.ToCharArray();
            var result = 700;

            for (int i = 0; i < aarray.Length; i++) {
                if(aarray[i] == 'o') {
                    result += 100;
                }
            }

            Console.WriteLine(result);
        }
    }
}

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



int main() 
{
  ll n; cin>>n;
  vector<string> S(n);
  rep(i,n)
  {
    cin>>S.at(i);
  }
  vector<ll> moji(26,1000);
  rep(i,n)
  {
    string s=S.at(i);
    vector<ll> moji2(26);
    rep(j,S.at(i).size())
    {
      moji2.at(s.at(j)-'a')++;
    }
    rep(j,26)
    {
      moji.at(j)=min(moji.at(j),moji2.at(j));
    }
  }
  rep(i,26)
  {
    char ch='a'+i;
    rep(j,moji.at(i))
    {
      cout<<ch;
    }
  }
  cout<<""<<endl;
  return 0;
}


Measured memory_bytes: 256
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

r=input1()
print(2*math.pi*r)

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

int main(){
  int ans = 700;
  string s;
  cin >> s;
  for (int i = 0;i < 3;i++){
  	if(s.at(i) == 'o'){
      ans += 100;
    }
  }
  cout << ans << endl;
}


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






int main(){
  


  int n;
  cin>>n;
  
  vector<pair<int,int>> red(n),blue(n);
  
  for (int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    red.at(i).first=x;
    red.at(i).second=y;
  }
  
  for (int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    blue.at(i).first=x;
    blue.at(i).second=y;
  }
  
  sort(red.begin(),red.end());
  reverse(red.begin(),red.end());
  
  sort(blue.begin(),blue.end());
  
  int answer=0;
  
  for (int i=0;i<n;i++){

    auto tmp=upper_bound(blue.begin(),blue.end(),red.at(i));
    
    
    
    int dis=distance(blue.begin(),tmp);
    
    
    int erasednumber=200;
    int erasedj=-1;
    
    for (auto j=dis;j<int(blue.size());j++){
      if (blue.at(j).second>red.at(i).second and blue.at(j).second<erasednumber){
        erasedj=j;
        erasednumber=blue.at(j).second;
      }
    }
    
    
    if (erasedj!=-1){
      blue.erase(blue.begin()+erasedj);
      answer++;
    }
  }
  
  cout<<answer<<endl;
    
    
    
        
      
    
    
  


    
  
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
    vector<int> a(n+1);
    vector<vector<int>> x(n+1);
    vector<vector<int>> y(n+1);
    for(int i=1; i<=n; ++i){
        cin >> a[i];
        x[i].resize(a[i]);
        y[i].resize(a[i]);
        for(int j=0; j<a[i]; ++j) cin >> x[i][j] >> y[i][j];
    }

    int ans=0;
    for(int i=1; i<(1<<n); ++i){
        int cnt=0;
        for(int j=1; j<=n; ++j){
            if(!((1<<(j-1)) & i)) continue;
            ++cnt;
            for(int k=0; k<a[j]; ++k){
                if(((i>>(x[j][k]-1))&1)^y[j][k]) goto OUT;
            }
        }
        ans = max(ans,cnt);
    OUT:;
    }

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

struct datas{
    Int max;
    Int size;
};

int main(void) {
    double a;
    double b;
    cin >> a >> b;
    double x;
    cin >> x;
    double ans = 0;
    double koko =  atan(b/a);
    if (x  >= a * a * b / 2) {
        double ng = M_PI/ 2 ;
        double ok = 0;
        REP(1000,i){
            double memo = (ng + ok) / 2;
            if (a * a * b - a * (a * a * tan(memo) )/2 > x) {
                ok = memo;
            }else{
                ng = memo;
            }
        }
        ans = ok;
    }else{
        double ng = M_PI / 2;
        double ok = 0;
        REP(1000,i){
            double memo = (ng + ok) / 2;
//            cout << 360 * memo / (2 * M_PI) << " " << b * a * b / tan(memo) / 2 << endl;
            if ((b * a * b / 2) / tan(memo) > x) {
                ok = memo;
            }else{
                ng = memo;
            }
        }
        ans = ok;
    }
    ans = 360 * ans / (2 * M_PI);
    cout << setprecision(15) << ans << endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

//Cup Game
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] c = new boolean[3];
		c[0] = true;
		while(sc.hasNext()){
			char[] a = sc.next().toCharArray();
			int s = a[0]-'A';
			int t = a[2]-'A';
			boolean b = c[s];
			c[s] = c[t];
			c[t] = b;
		}
		for(int i=0;i<3;i++)if(c[i]){System.out.println((char)(i+'A'));break;}
	}
}

Measured memory_bytes: 12000
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		double x,y;
		String ln;
		while((ln=br.readLine()) != null){
			
			String[] num = ln.split(" ");
			int a = Integer.parseInt(num[0]);
			int b = Integer.parseInt(num[1]);
			int c = Integer.parseInt(num[2]);
			int d = Integer.parseInt(num[3]);
			int e = Integer.parseInt(num[4]);
			int f = Integer.parseInt(num[5]);
			
			y=(double)(a*f-d*c)/(a*e-b*d);
			x=(double)(-b*y+c)/a;
		
			System.out.printf("%.3f %.3f\n",x,y);
		}
	}
}
		

Measured memory_bytes: 24548
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	ans := make([]int, 0, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())

		if len(ans) == 0 || a <= ans[len(ans)-1] {
			ans = append(ans, a)
			continue
		}

		p := sort.Search(len(ans), func(i int) bool { return ans[i] < a })
		ans[p] = a
	}
	fmt.Println(len(ans))
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

// editorial_answer
int main() {
    ll inf = 1LL << 60;
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    ll c[m];
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
        c[i] = -c[i];
    }

    ll dist[n];
    for (int i = 0; i < n; i++) {
        dist[i] = inf;
    }

    dist[0] = 0;
    for(int loop = 0; loop < n - 1; loop++) {
        for (int i = 0; i < m; i++) {
            if (dist[a[i]] == inf) continue;

            dist[b[i]] = min(dist[b[i]], dist[a[i]] + c[i]);
        }
    }

    ll ans = dist[n - 1];
    bool negative[n];
    for (int i = 0; i < n; i++) {
        negative[i] = false;
    }

    for (int loop = 0; loop < n; loop++) {
        for (int i = 0; i < m; i++) {
            if (dist[a[i]] == inf) continue;

            if (dist[b[i]] > dist[a[i]] + c[i]) {
                dist[b[i]] = dist[a[i]] + c[i];
                negative[b[i]] = true;
            }

            if (negative[a[i]]) {
                negative[b[i]] = true;
            }
        }
    }

    if (negative[n - 1]) {
        cout << "inf" << endl;
    } else {
        cout << -ans << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAX_N = 1e5+10;
const int INF = (1<<29);

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector<int> c;
	c.push_back(1);
	for (int i = 1; pow(6,i) <= n; ++i) c.push_back(pow(6,i));
	for (int i = 1; pow(9,i) <= n; ++i) c.push_back(pow(9,i));
	sort(c.begin(), c.end());
    
    int t[MAX_N];
    for (int i = 0; i <= MAX_N; ++i) t[i] = INF;
    t[0] = 0;
    for (int i = 0; i < c.size(); ++i) {
    	for (int j = 0; j+c[i] <= n; ++j) {
    		t[j+c[i]] = min(t[j+c[i]], t[j]+1);
    	}
    }

    cout << t[n] << endl;
	return 0;
}

Measured memory_bytes: 768
<?php
list($x, $y) = explode(" ", trim(fgets(STDIN)));

// 右m, 下nとする
$m = (2*$x - $y) / 3;
$n = (2*$y - $x) / 3;
//echo $m." ".$n.PHP_EOL;
if(!(is_int($m) && is_int($n))){
  echo "0";
  exit;
}
if($m < 0 || $n < 0){
  echo "0";
  exit;
}

echo combination($m+$n, $m, 1000000007);

/**
 * mod Pの世界での繰り返し二乗法
 * @param $b 基数
 * @param $p 指数
 * @param $m 素数
 */
function repeatSqrt($b, $p, $m){
  if($p==1)
  {
    return $b;
  }
  else if($p%2 == 0)
  {
    $t = repeatSqrt($b, floor($p/2), $m);
    return ($t * $t) % $m;
  }
  else
  {
    return ($b * repeatSqrt($b, $p-1, $m)) % $m;
  }
}

/**
 * mod Pの世界での組み合わせ(nCa)
 * @param $n 全体の数
 * @param $a 選択する数
 * @param $m 素数
 */
function combination($n, $a, $m)
{
    $x=1; // bunbo
    $y=1; // bunshi
    for($i=0;$i<$a;$i++)
    {
        $x=$x*($n-$i)%$m;
        $y=$y*($i+1)%$m;
    }
    // フェルマーの小定理 
    // Y^(P-1)≡1 (mod P) より
    // Y^(P-2)≡1/Y (mod P)
    // つまり
    // $x / $y = $x * $y^($m-2) (mod P)
    $y=repeatSqrt($y, $m-2, $m);
    return ($x*$y)%$m;
}

Measured memory_bytes: 4604
#include <algorithm>
#include <iostream>
#include <map>
#include <cstdio>
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define PRINTD(n) printf("%d\n",n)
using namespace std;

int main() {
	char s[100003];
	scanf("%s",s);
	int N = strlen(s);
	string ans = "";
	for (int i = 0 ; i < N ; i = i + 2) {putchar(s[i]);}
	return 0;
}



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

const int MAX_N = (int)1e5 + 5;
int R, C, used[MAX_N];
map<int, int> mp;

bool ob(int x, int y){
    if(x==0 or x==R or y==0 or y==C) return true;
    return false;
}

void append(int x, int y, int i){
    if(x==0) mp[y] = i;
    else if(y==C) mp[C+x] = i;
    else if(x==R) mp[R+2*C-y] = i;
    else mp[2*R+2*C-x] = i;
}

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N;
    cin>>R>>C>>N;
    for(int i=0;i<N;i++){
        int x1, y1, x2, y2;
        cin>>x1>>y1>>x2>>y2;
        if(ob(x1, y1) and ob(x2, y2))
            append(x1, y1, i), append(x2, y2, i);
    }
    deque<int> dq;
    for(auto p : mp){
        if(used[p.second]){
            if(dq.back()==p.second) dq.pop_back();
            else {cout<<"NO"<<endl; return 0;}
        } else {
            used[p.second] = 1;
            dq.push_back(p.second);
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 10240
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		char n[] = N.toCharArray();
		int S = 0;
		for (char num : n) {
			S += Character.getNumericValue(num);
		}
		if (Integer.parseInt(N) % S == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 100000
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int H[MAX_N];
  int X[MAX_N];
  rep(i, N) {
    cin >> H[i];
    X[i] = 0;
  }

  int MAX_X = 0;
  for (int i = N - 2; i >= 0; i--) {
    if (H[i] >= H[i + 1]) {
      X[i] = X[i + 1] + 1;
    } else {
      X[i] = 0;
    }
    MAX_X = max(MAX_X, X[i]);
  }
  cout << MAX_X << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 5*(int)1e5 + 10;
// make sure N size is correctttt!!!!!!!!!


void yes(){
   cout<<"YES"<<endl;
   //exit (0);
}
void no(){
   cout<<"NO"<<endl;
   //exit (0);   
}

int n, a[N], k;
int32_t main(){_

   cin>>n>>k;

   if((n+1)/2 >= k)
      yes();
   else
      no();

   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main()
{
	priority_queue<int, vector<int>, greater<int>> a;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int at;
		cin >> at;
		a.push(at);
	}

	bool suc = true;
	for (int i = 0; i < n - 1; i++) {
		int a1 = a.top();
		a.pop();
		int a2 = a.top();
		if (a1 == a2) {
			suc = false;
			break;
		}
	}
	cout << (suc ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;

int main(){

    int n; cin >> n;

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

    int ans = 1;

    bool start = true;
    bool increasing = true;
    for(int i=1; i<n; i++){
        if(start){
            if(a[i] == a[i-1]){
                continue;
            }
            else if(a[i] > a[i-1]){
                start = false;
                increasing = true;
            }
            else{
                start = false;
                increasing = false;
            }
        }
        else{
            if(increasing && a[i] < a[i-1]){
                start = true;
                ans++;
            }
            else if(!increasing && a[i] > a[i-1]){
                start = true;
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
typedef long long ll;
ll dp[100005];
ll w[maxn],v[maxn];
const ll inf=1e18;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,W;
    cin>>n>>W;
    rep(i,1,n)cin>>w[i]>>v[i];
    
    int V=100*1000;
    rep(i,1,V)dp[i]=1e18;
    rep(i,1,n){
        for(int j=V;j>=v[i];j--)
            dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
    }   
    for(int i=V;i>=0;i--)if(dp[i]<=W){cout<<i<<endl;return 0;}

}
/* 
拿W 最大的价值
dp[i][v]:拿到第i个，价值小于等于v的重量最小拿法的价值
dp[i][w]=max(dp[i-1][w],dp[i-1][w-w[i]]+v[i]);
滚动优化：从后往前更新 记得倒着算组合数的技巧吗？
dp[w]:价值小于等于w的最大拿法的价值。  
 */

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  bool seven=false;
  for(int i=0; i<n.length(); i++) {
    if(n[i]=='7') {
      seven=true;
      break;
    }
  }
  if(!seven) cout << "No";
  else cout << "Yes";
}

Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

N, K = [int(x) for x in input().split()]

def dec_to_n(N, n):
    if N == 0:
        return "0"
    digits = []
    base = 1
    while N != 0:
        if N % (base * n) == 0:
            digits.append('0')
        else:
            digits.append(str(N % (base * n) // base))
            N -= N % (base * n)
        base *= n
    return "".join(digits[::-1])

n = dec_to_n(N, K)
print(len(n))

Measured memory_bytes: 40536
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
using ll = int_fast64_t; using namespace std;

#ifndef __GNUC__
string text =
R"X(50)X";
stringstream iss{text};
#endif

int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	ll N; iss >> N;
	bool ok{false};
	for (ll i = 1; i < 10; ++i) {
		auto qr = div(N, i);
		if (qr.rem == 0 && qr.quot < 10) ok = true;
	}
	cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <list>
#include <cmath>
using namespace std;

struct TCoordinate
{
	double X;
	double Y;
};

TCoordinate FindSplitMiddle(TCoordinate A, TCoordinate B)
{
	TCoordinate C = {(A.X + B.X) / 2, (A.Y + B.Y) / 2};
	C.X += (sqrt(3) / 6) * (A.Y - B.Y);
	C.Y += (sqrt(3) / 6) * (B.X - A.X);
	return C;
}

void Koch(list<TCoordinate> &Point, int n, const list<TCoordinate>::iterator &itrStart, const list<TCoordinate>::iterator &itrEnd)
{
	if(n == 0) return;
	n -= 1;
	
	TCoordinate SplitStart  = { (2 * itrStart->X + itrEnd->X) / 3, (2 * itrStart->Y + itrEnd->Y) / 3};
	TCoordinate SplitMiddle = FindSplitMiddle(*itrStart, *itrEnd);
	TCoordinate SplitEnd    = { (itrStart->X + 2 * itrEnd->X) / 3, (itrStart->Y + 2 * itrEnd->Y) / 3};
	
	auto itr = itrStart;
	itr++;
	Point.insert(itr, SplitStart);
	Point.insert(itr, SplitMiddle);
	Point.insert(itr, SplitEnd);
	itr--;
	auto itrSplitEnd    = itr;
	itr--;
	auto itrSplitMiddle = itr;
	itr--;
	auto itrSplitStart  = itr;
	Koch(Point, n, itrStart,       itrSplitStart );
	Koch(Point, n, itrSplitStart,  itrSplitMiddle);
	Koch(Point, n, itrSplitMiddle, itrSplitEnd   );
	Koch(Point, n, itrSplitEnd,    itrEnd        );
}

void Output(const list<TCoordinate> &Point)
{
	auto itr = Point.begin();
	for(int i = 0; i < Point.size(); i++){
		cout << fixed << setprecision(8) << itr->X << ' ' << itr->Y << endl;
		itr++;
	}
}

int main()
{
	int n;
	cin >> n;
	list<TCoordinate> Point;
	TCoordinate Start = {  0, 0};
	TCoordinate End   = {100, 0};
	Point.push_back(Start);
	Point.push_back(End);
	auto itr = Point.end();
	itr--;
	Koch(Point, n, Point.begin(), itr);
	Output(Point);
	return 0;
}

Measured memory_bytes: 3424
typedef int ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
template<class Monoid> struct SegTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;
    
    SegTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* update a, a is 0-indexed */
    void update(int a, const Monoid &v) {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1) dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* get [a, b), a and b are 0-indexed */
    Monoid get(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }                                                                                                              
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};
int main() {
    ll n,q;
    std::cin >> n>>q;
    vector<ll> c(n+10);
    for (int i = 0; i < n; i++) {
        std::cin >> c[i];
        c[i]--;
    }
    vector<pair<ll,ll>> ans(q+10);
    map<pair<ll,ll>,ll> vmp;
    vector<pair<ll,ll>> qs(q+10);
    for (int i = 0; i < q; i++) {
        ll l,r;
        std::cin >> l>>r;
        l--;r--;
        ans[i] = {l,r};
        qs[i] = {l,r};
    }
    
    SegTree<ll> seg(n+10,
                                      [](ll a, ll b){
                                          return a+b;
                                      },
                                      0
                                      );
    
    sort(qs.begin(),qs.end(),[](const auto le, const auto ri){
        return le.second > ri.second;
    });
    vector<ll> last(n+10,-1);
    vector<ll> doko(n+10,-1);
    for (int i = 0; i < n; i++) {
        last[i] = doko[c[i]];
        doko[c[i]] = i;
    }
    for (int i = 0; i < n; i++) {
        if(doko[c[i]]==i){
            seg.update(i,1);
        }
    }
    ll nowr = n-1;
    for (int i = 0; i < q; i++) {
        for (int j = nowr; j > qs[i].second; j--) {
            seg.update(j,0);
            if(last[j]!=-1){
                seg.update(last[j],1);    
            }
        }
        nowr = qs[i].second;
        vmp[qs[i]] = seg.get(qs[i].first,qs[i].second+1);
    }

    for (int i = 0; i < q; i++) {
        std::cout << vmp[ans[i]] << std::endl;        
    }
}


Measured memory_bytes: 52824
a = gets.split

stack = []
a.each do |e|
    if e == '+'
        stack.push(stack.pop + stack.pop)
    elsif e == '-'
        a = stack.pop
        b = stack.pop
        stack.push(b - a)
    elsif e == '*'
        stack.push(stack.pop * stack.pop)
    else
        stack.push(e.to_i)
    end
end

puts stack.pop


Measured memory_bytes: 6856
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  s += '0';
  int n = s.size();

  int dp[n+1][2];
  rep(i,n+1)rep(j,2){
    dp[i][j] = 1001001001;
  }
  dp[0][0] = 0;

  rep(i,n)rep(j,2){
    int x = s[i] - '0';
    x += j;
    rep(a,10){
      int ni = i + 1, nj = 0;
      int b = a-x;
      if (b<0) {
        nj = 1;
        b += 10;
      }
      dp[ni][nj] = min(dp[ni][nj],dp[i][j]+a+b);
    }
  }
  cout << dp[n][0] << endl;
}


Measured memory_bytes: 9204
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL sum = a;
    LL res = 1;
    while(b){
        if(b&1){
            res = (res * sum)%MOD;
        }
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

int main(){
    int D, E;
    while(cin>>D>>E&&D){
        double ans = INF;
        REP(x, D+1){
            int y = D - x;
            ans = min(ans, abs(sqrt(x*x+y*y)-E));
        }
        printf("%.10f\n", ans);
    }
    return 0;
}



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

#define INF (INT32_MAX/2)
#define MOD (1000000000+7)
#define MAX 1000

int H, W;
char a[MAX][MAX];

long long dp[MAX][MAX];

int main() {
	cin >> H >> W;
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			cin >> a[i][j];
		}
	}

	dp[0][0] = 1;
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			if( a[i][j] == '.' ) {
				if( i > 0 ) {
					dp[i][j] = ( dp[i][j] + dp[i - 1][j] ) % MOD;
				}
				if( j > 0 ) {
					dp[i][j] = ( dp[i][j] + dp[i][j - 1] ) % MOD;
				}
			}
		}
	}
	long long ans = dp[H - 1][W - 1];

	cout << ans << endl;

	return 0;
}


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

int main(){
  int n;
  cin >> n;
  int ret;
  ret = 0;
  rep(i,9){
    int ans;
    if (n % (i+1) == 0) ans = n / (i+1);
    if (ans < 10) ret = 1;
  }
  string YN;
  if (ret == 1) YN = "Yes";
  else YN = "No";
  cout << YN << endl;
}

Measured memory_bytes: 256
using System;

namespace ABC065_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var aaa = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var n = aaa[0];
            var m = aaa[1];
            long ans = 0;

            if (Math.Abs(n - m) >= 2)
            {
                ans = 0;
            }
            else if (n == m)
            {
                ans = (2 * Factorial(n) * Factorial(m)) % 1000000007;
            }
            else
            {
                ans = (Factorial(n) * Factorial(m)) % 1000000007;
            }
            Console.WriteLine(ans);
        }
        public static long Factorial(long a)
        {
            long n = 1;
            for (var i = 1; i <= a; i++)
            {
                n *= i;
                n = n % 1000000007;
            }
            return n;
        }
    }
}


Measured memory_bytes: 11348
//058
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
    string odd;
    string even;
    cin >> odd >> even;
    if(odd.size()==even.size()){
        rep(i, odd.size()) cout << odd[i] << even[i];
    }else{
        rep(i, even.size()) cout << odd[i] << even[i];
        cout << odd.back() << endl;
    }
}

Measured memory_bytes: 256