akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

int main()
{
	string str;
	vector<char>a;
	while (1)
	{
		getline(cin, str);
		if (str == ".")break;
		a.clear();
		bool f = 1;
		for (auto x : str)
		{
			switch (x)
			{
				case '[':a.push_back('['); break;
				case '(':a.push_back('('); break;
				case ']':{
						if (!a.empty() && *a.rbegin() == '[')
						{
							a.pop_back();
						} else
						{
							f = 0;
						}
						break;
					}
				case ')':{
						if (!a.empty()&&*a.rbegin() == '(')
						{
							a.pop_back();
						} else
						{
							f = 0;
						}
						break;
					}
				default:
					break;
			}
		}
		if (!a.empty())
		{
			f = 0;
		}
		cout << (f ? "yes" : "no") << endl;
	}
}

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

int main(){
    int n,m,k;
    cin>>n;
    vector<int> a;
    rep(i,n){
        cin>>k;
        if(k==0){
            cin>>m;
            a.push_back(m);
        }
        else if(k==1){
            cin>>m;
            cout<<a.at(m)<<endl;
        }
        else{
            a.pop_back();
        }
        
    }
    return 0;
}

 


Measured memory_bytes: 3904
n, m = map(int, input().split())
like = [0] * m
for _ in range(n):
    ka = list(map(int , input().split()))
    for i in range(1, ka[0]+1):
        like[ka[i]-1] += 1

ans = 0
for li in like:
    if li == n:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<limits>

using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	for (int i = 0; i < S.size() - 1; i++) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			cout << "Yes" << endl;
			system("pause");
			return 0;
		}
	}
	cout << "No" << endl;
	system("pause");
	return 0;
}

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

#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define R(i,n) for(int i=0;i<(n);++i)
#define fill(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second

const int maxn = 1e5 + 10;
int N,Q;
LL ans[maxn],q[maxn];
map<LL,LL,greater<LL> > mp;

int main()
{
	//freopen("test.txt","r",stdin);
	scanf("%d %d",&N,&Q);
	q[0] = N;
	F(i,1,Q) scanf("%lld",q+i);
	LL cur = q[Q];
	mp[cur]++;
	while(Q--)
	{
		if(cur > q[Q])
		{
			cur = q[Q];
			for(auto it = mp.begin();it != mp.end() && it->fi > q[Q]; it = mp.erase(it))
			{
				mp[q[Q]] += it->fi/q[Q] * it->se;
				if(it->fi % q[Q]) mp[it->fi % q[Q]] += it-> se;
			}
		}
	}
	for(int i=N;i;--i)
		ans[i] = ans[i+1] + mp[i];
	F(i,1,N) printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 9472
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


long long ans[100000];

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

	map<int, int> cnt;
	int n;
	cin >> n;
	vector<pair<int, int>> v;
	v.emplace_back(0, -1);
	int ma = 0;
	rep(i,n) {
		int a;
		cin >> a;
		cnt[a]++;
		if (ma < a) {
			v.emplace_back(a, i);
			ma = a;
		}
	}
	auto it = cnt.rbegin();
	long long s = 0;
	for (int i = v.size() - 1; i > 0;i--) {
		while (it != cnt.rend() && v[i].first <= it->first) {
			s += it->second;
			++it;
		}
		auto it2 = it;
		long long t = 0;
		while (it2 != cnt.rend() && v[i-1].first <= it2->first) {
			t += it2->second * (long long)(it2->first - v[i - 1].first);
			++it2;
		}

		ans[v[i].second] = t + s * (v[i].first - v[i - 1].first);
	}
	rep(i,n) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 7284
#include<iostream>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;

int t[3628800];

int fact(int n){
  if(n<=1)return 1;
  return n*fact(n-1);
}

void make_T(int n){
  //T1 [initialize]
  int N = fact(n), d = N/2, m = 2, k, j;
  t[d] = 1;

  while(m!=n){
    //T2 [Loop on m]
    m++;
    d /= m;
    k = 0;

    //T3 [Hunt down]
  T3:
    k += d; j = m-1;
    while(j>0){
      t[k] = j;
      k += d;
      j--;
    }

    //T4 [Offset]
    t[k]++;

    //T5 [Hunt up]
    k += d;
    j = 1;
    while(j<m){
      t[k] = j;
      k += d;
      j++;
    }

    if(k<N)goto T3;
  }
}

int alphametrics(vector<int> s, vector<int> F){
  //A1 [initialize]
  vector<int> a(10);
  for(int i=0;i<10;i++)a[i] = i;

  int v = 0;
  for(int i=0;i<10;i++)v += i*s[i];

  int k = 1;

  vector<int> delta(9);
  for(int i=0;i<9;i++)delta[i] = s[i+1] - s[i];

  //A2 [Test]
  int res = 0;
  while(true){
    bool flag = true;
    for(int i=0;i<F.size();i++){
      if(a[F[i]]==0){
	flag = false;
	break;
      }
    }

    if(v==0 && flag)res++;
    
    //A3 [Swap]
    if(k==3628800)return res;
    int j = t[k]-1;
    v -= (a[j+1] - a[j])*delta[j];
    swap(a[j+1],a[j]);
    k++;
  }
}
    
int main(){
  make_T(10);

  int n;
  string str[20];
  while(cin >> n,n){
    vector<int> s(10);
    for(int i=0;i<10;i++)s[i] = 0;

    vector<int> F;
    vector<char> alpha;

    for(int id=0;id<n;id++){
      cin >> str[id];
      for(int i=0;i<str[id].size();i++){
	bool flag = true;
	for(int j=0;j<alpha.size();j++){
	  if(str[id][i] == alpha[j]){
	    flag = false;
	    break;
	  }
	}
	if(flag)alpha.push_back(str[id][i]);
      }
    }

    for(int id=0;id<n;id++){
      int tmp = 1;
      if(id==n-1)tmp *= -1;

      for(int i=str[id].size()-1;i>=0;i--){
	for(int j=0;j<alpha.size();j++){
	  if(str[id][i] == alpha[j]){
	    s[j] += tmp;
	    break;
	  }
	}
	tmp *= 10;

	if(str[id].size()>1){
	  for(int i=0;i<alpha.size();i++){
	    if(str[id][0] == alpha[i]){
	      F.push_back(i);
	      break;
	    }
	  }
	}
      }
    }

    sort(F.begin(),F.end());
    F.erase(unique(F.begin(),F.end()),F.end());

    cout << alphametrics(s,F)/fact(10-alpha.size()) << endl;
  }
}

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

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

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

  int p = 0;
  int res=0;
  while(1){
    res++;
    p += 2 * d + 1;
    if (p >= n) break;
  }

  cout<<res<<endl;

  return 0;
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// 中央値がcで、その前後にk本ずつ、計2k+1本の辺を採用するとする
// 前のk本はなるべくコストが小さい方が良い 後ろのk本のコストはどうでもいい
// 結局普通に最小全域木を求めて使った辺の中央値が答え

int n, m, a, b, c;
vector<pair<int,pair<int,int> > > e;

struct UF {
	vector<int> p;
	UF(int n) : p(n, -1) {};
	bool unite(int u, int v) {
		if ((u = find(u)) == (v = find(v))) return false;
		if (p[u] > p[v]) swap(u, v);
		p[u] += p[v]; p[v] = u;
		return true;
	}
	bool same(int u, int v) { return find(u) == find(v); }
	int find(int u) { return p[u] < 0 ? u : p[u] = find(p[u]); }
	int usize(int u) { return -p[find(u)]; }
};

int kruskal() {
	sort(e.begin(),e.end());
	UF uf(n);
	int res = 0;
	for (int i=0; i<m; ++i) {
		if (!uf.same(e[i].se.fi, e[i].se.se)) {
			uf.unite(e[i].se.fi, e[i].se.se);
			res++;
			if (res==n/2) return e[i].fi;
		}
	}
	return res;
}

signed main() {
	while (1) {
		cin >> n >> m;
		if (n==0) break;
		e.clear();
		rep(i,m) {
			cin >> a >> b >> c;
			a--, b--;
			e.pb({c,{a,b}});
		}
		cout << kruskal() << ln;
	}
}


Measured memory_bytes: 3224
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)

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

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int q;
    cin >> q;
    vector<int> ms(q);
    for (int i = 0; i < q; i++)
    {
        cin >> ms[i];
    }
    vector<int> list;
    for (int tmp = 0; tmp < (1 << n); tmp++)
    {
        int sum = 0;
        bitset<20> s(tmp);
        for (int j = 0; j < n; j++)
        {
            if (s.test(j))
            {
                sum += a[j];
            }
        }
        list.push_back(sum);
    }
    sort(list.begin(), list.end());
    for (int i = 0; i < q; i++)
    {
        if (binary_search(list.begin(), list.end(), ms[i]))
        {
            cout << "yes" << endl;
        }
        else
        {
            cout << "no" << endl;
        }
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 6984
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//JJOOII
public class Main{

	class R{
		char ch;
		int c;
		public R(char ch, int c) {
			this.ch = ch;
			this.c = c;
		}
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int n = s.length, c = 1;
		char r = s[0];
		List<R> l = new ArrayList<R>();
		for(int i=1;i<n;i++){
			if(s[i]!=r){
				l.add(new R(r, c)); r = s[i]; c = 0;
			}
			c++;
		}
		l.add(new R(r, c));
		int res = 0;
		for(int i=1;i<l.size()-1;i++){
			R r1 = l.get(i-1), r2 = l.get(i), r3 = l.get(i+1);
			if(r1.ch=='J'&&r2.ch=='O'&&r3.ch=='I'&&r2.c<=r1.c&&r2.c<=r3.c)res = Math.max(res, r2.c);
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 43000
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define all(x) begin(x),end(x)
#define pb push_back
using namespace std;
typedef int64_t ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using maxheap = priority_queue<T>;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    int p2[]={1,2,4,8,16,32};
    cin >> n >> m;
    int x=100*(n-m)+1900*m;
    cout << x * p2[m] << '\n';
    return 0;
}

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

int main() {
  int A,B;
  cin >> A >> B;
  bool J=false;
  for(int i=0;i<B/A;i++){
    if(A*(i+1)==B){
      J=true;
    }
  }
  if(J==true){
    cout << A+B << endl;
  }else{
    cout << B-A << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    double a,tmp;
    double sum = 0;
    int count; //何個足し算するか

    scanf("%d",&count); 

    for(int i = 0; i < count; i++){
        scanf("%lf",&tmp);
        a = tmp;
        sum += 1 / a;
    }

    printf("%lf\n",1/sum);

    return 0;
}

Measured memory_bytes: 128
package main

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

//最大値
func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("min() requires at least one arguments.")
	}
	res := nums[0]
	for _, val := range nums {
		if res < val {
			res = val
		}
	}
	return res
}

var sc = bufio.NewScanner(os.Stdin)
func nextInt() int {
	sc.Scan()
	val, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return val
}

func main() {
	sc.Split(bufio.ScanWords)
	k, n := nextInt(), nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	dist := make([]int, n+1)
	var ans int
	for i := 0; i < n-1; i++ {
		dist[i] = a[i + 1] - a[i]
		ans += dist[i]
	}
	dist[n] = a[0] + k - a[n - 1]
	ans += dist[n]
	fmt.Println(ans - Max(dist...))
}


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

int n, w;
int dp[105][10005] = {0};
pair<int, int> bag[105];

int main() {
  int i, j;
  cin >> n >> w;
  for(i = 0; i < n; ++i)
    cin >> bag[i].first >> bag[i].second;
  for(i = 1; i <= n; ++i)
    for(j = 1; j <= w; ++j) {
      dp[i][j] = dp[i - 1][j];
      if(j >= bag[i - 1].second)
        dp[i][j] =
            max(dp[i][j], dp[i][j - bag[i - 1].second] +
                              bag[i - 1].first);
    }
  cout << dp[n][w] << endl;
  return 0;
}


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

ll arr[100005] , n ;

int main(){
   cin>>n ; 
   ll sum = 0 ; 
   for(int i=1;i<=n;i++){
     cin>>arr[i] ;
   }
  
   for(int i=2;i<=n;i++){
      if(i%2){
        sum += -1*arr[i] ; 
      }
     else{
       sum += arr[i] ; 
     }
   }
   ll ans[n+5] ; 
   ll aa = arr[1] - sum ;
   ans[1] = aa ; 
  ll a = aa/2 , pre ;
  pre = a ; 
  for(int i=1;i<=n-1;i++){
    ll x = arr[i] - pre ; 
    pre = x ; 
    ans[i+1] = 2*x ; 
  }
  for(int i=1;i<=n;i++){
    cout<<ans[i]<<" " ; 
  }
}

Measured memory_bytes: 2816
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define P putchar
using namespace std;
signed main()
{
	string a,b,c;cin>>a>>b>>c;
	P((a[0]-32)),P((b[0]-32)),P((c[0]-32));
	return P(10),0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> B(N);
    rep(i, N) B[i] = A[i] - (i + 1);
    sort(B.begin(), B.end());

    ll b = B[N/2];
    ll ans = 0;
    rep(i, N) {
        ans += abs(B[i] - b);
    }

    // if (b % 2 == 0) {
    //     b = B[N/2-1];
    //     int ans2 = 0;
    //     rep(i, N) {
    //         ans2 += abs(B[i] - b);
    //     }
    //     ans = min(ans, ans2);
    // }

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

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

#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(int i = a ; i < b ; i++)
#define     repn(i, a, b)   for(int i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     sz              size()
#define     len             length()
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define     pii              pair<int, int>
#define     pll             pair<long long int, long long int>
#define     vll             vector<long long int>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;


/*############################# DSU ##############################*/
vi parent(1e5), Size(1e5), Rank(1e5);

void make_set(int v){
    parent[v]=v;
    Size[v] = 1;
    // Rank[v] = 0;
}
 
int find_set(int v){
	return (parent[v]==v) ?  v : parent[v] = find_set(parent[v]);
}
 
void union_sets(int a, int b){
	a = find_set(a);
	b = find_set(b);
	if(a != b){
        if(Size[a] < Size[b])
            swap(a, b);
        // if(Rank[a] < Rank[b])
        //     swap(a, b);
		parent[b] = a;
        Size[a] += Size[b];
        // if(Rank[a] == Rank[b])
        //     Rank[a]++;
    }
}
/*############################# DSU ##############################*/


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }

ll pw2[32];
void cal(){ pw2[0] = 1; rep(i, 1, 32)pw2[i] = 2*pw2[i-1]; }

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

void solve()
{
    string s; cin>>s;
    if(s=="ABC")cout<<"ARC"<<nl;
    else cout<<"ABC"<<nl;
}


int main()
{
    // boost;
    cal();
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

Measured memory_bytes: 4580
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
using P = pair<int, int>;

int main()
{
	int D, T, S; cin >> D >> T >> S;

	if (S * T >= D)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

ll n,a,b,c,d,e,ans;

ll ka(ll x){
  return (n+x-1)/x;
}
int main(){
  cin>>n>>a>>b>>c>>d>>e;


  ans+=4LL;
  ans+=max(ka(a),max(ka(b),max(ka(c),max(ka(d),ka(e)))));
  cout<<ans<<endl;


}


Measured memory_bytes: 256
while 1:
    n = int(input())
    if n==0:
        break
    ab = [list(input().split()) for _ in range(n)]
    
    T = [0] * (3600*24)
    
    for i in range(n):
        a, b = ab[i]
        a_h, a_m, a_s = map(int, a.split(':'))
        b_h, b_m, b_s = map(int, b.split(':'))
        a_time = a_h*3600 + a_m*60 + a_s
        b_time = b_h*3600 + b_m*60 + b_s
        T[a_time] += 1
        T[b_time] -= 1
        
    for i in range(1, len(T)):
        T[i] += T[i-1]
    
    print(max(T))


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

#define log(x) cout << (x) << endl
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
using vi = vector<int>;

int g[50][50] = {0}, n, m;
bool visited[50];

void dfs(int v=0) {
	visited[v] = true;
	rep (i, n) {
		if (!g[v][i]) continue;
		if (visited[i]) continue;
		dfs(i);
	}
}


int main() {
	cin >> n >> m;
	vi a(m), b(m);

	rep (i, m) {
		cin>>a[i]>>b[i];
		--a[i],--b[i];
		g[a[i]][b[i]]=g[b[i]][a[i]]=1;
	}

	int ans = 0;
	rep (i, m) {
		g[a[i]][b[i]]=g[b[i]][a[i]]=0;
		rep (j, n) visited[j] = false;
		dfs();
		rep (j, n) {
			if (!visited[j]) {
				ans+=1;
				break;
			}
		}
		g[a[i]][b[i]]=g[b[i]][a[i]]=1;
	}
	log(ans);

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int x; cin >> x;
    vector<bool> dp(100200);
    dp[0] = 1;
    rep(i, 100000){
        if(dp[i] == 1){
            for(int j=i+100; j<= i+105; j++){
                dp[j] = 1;
            }
        }
    }
    cout << dp[x] << ln;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)
    var loop = true
    while (loop) {
        val a = sc.nextInt()
        val op = sc.next()
        val b = sc.nextInt()
        when (op) {
            "+" -> {
                println(a+b)
            }
            "-" -> {
                println(a-b)
            }
            "*" -> {
                println(a*b)
            }
            "/" -> {
                println(a/b)
            }
            else ->{
                loop = false
            }
        }
    }

}


Measured memory_bytes: 25616
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=998244353;
ll n,m,mn,jc[1000010],ny[1000010],ans;
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
ll C(ll x,ll y){
	return jc[x]*ny[y]%p*ny[x-y]%p;
}
ll nyC(ll x,ll y){
	return ny[x]*jc[y]%p*jc[x-y]%p;
}
int main(){
	ll i;
	scanf("%lld%lld",&n,&m);
	mn=min(n,m);
	jc[0]=ny[0]=1;
	for(i=1;i<=max(n,m)*2;i++)jc[i]=jc[i-1]*i%p,ny[i]=ksm(jc[i],p-2);
	for(i=1;i<=mn;i++)ans=(ans+C(i*2,i)*C(n+m-i*2,n-i)%p)%p;
	ans=ans*nyC(n+m,n)%p*ny[2]%p;
	ans=(ans+max(n,m))%p;
	printf("%lld",ans);
}

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

#define what_is(x) cout << #x << " is " << x << endl;
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 10
#define N 500001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX];
ll fact[MAX];

const long long INF64 = 1e18;
ll vpow(ll a,ll b,ll p){
    if(b==0)
        return 1;
    if(b==1)
            return a;
    ll temp=vpow(a,b/2,p);
    temp*=temp;
    temp%=p;
    if(b%2==0)
        return temp;
    temp=temp*a;
    temp%=p;
    return temp;
}

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


ll inverseMod(ll a,ll b,ll p){
    if(b==0)
        return 1;
    ll temp=vpow(b,p-2,p);
    ll ans=temp*a;
    ans%=p;
    return ans;
}
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
ll max(ll a, ll b)
{
    return a>b?a:b;
}

void factorial(){
    fact[0]=1;
    fact[1]=1;
    rep(i,2,MAX){
        fact[i]=(fact[i-1]*i);
        // fact[i]%=M;
    }
}
ll rand(ll a,ll b){
    return a+rand()%(b-a+1);
}

void solve(ll ttt){
    ll n;
    cin>>n;
    ll a[n],pre[n];
    ll i,sum=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    pre[n-1]=a[n-1];
    ll ans=0;
    for(i=n-2;i>-1;i--)
    {
        pre[i]=(pre[i+1]+a[i])%M;
    }
    for(i=0;i<n-1;i++)
    {
        ans=ans+((a[i]*pre[i+1])%M);
        ans=ans%M;
    }
    cout<<ans<<endl;
    return;

}

int main(){
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    //
    //freopen("input1.txt","r",stdin);
    // freopen("output1.txt","w",stdout);
#endif
    ll t=1;
     //cin>>t;
    fix(12);
    rep(q,1,t+1){
         //cout<<"Case #"<<q<<": ";
         solve(q);
    }
    return 0;

}




Measured memory_bytes: 6772
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ITP1_10-B

Math Functions - Triangle
????§???¢

????§???¢????????? a, b ??¨?????????????§? C ???????????????????§???¢?????¢??? S?????¨????????? L, a ???????????¨????????¨???????????? h ????±???????????????°?????????????????????????????????
Input

a ?????????, b ?????????, C?????§????????????????????´??°???????????????????????§?????????????????????
Output

S, L, h ???????????????1??????????????????????????????0.0001??\????????????????????£????????????????????¨????????????
Sample Input

4 3 90

Sample Output

6.00000000
12.00000000
3.00000000

=end
Pi = 3.14159265359
fh=STDIN
fl=fh.gets.chomp.split
a=fl[0].to_f
b=fl[1].to_f
c=fl[2].to_f
theta =  c * Pi / 180.0
s = a * b * Math.sin(theta) / 2.0
l = a + b + Math.sqrt(a**2 + b**2 - 2*a*b*Math.cos(theta))
h = b * Math.sin(theta)
puts s
puts l
puts h

Measured memory_bytes: 8916
n = int(input())
a = list(map(int, input().split()))
dp = [[-float('inf')] * (n + 2) for _ in range(2 + n % 2)]
dp[0][0] = 0
if n % 2:
    for i in range(n):
        if i < n - 2:
            dp[2][i + 4] = dp[0][i] + a[i + 2]
        if i < n - 1:
            dp[1][i + 3] = dp[0][i] + a[i + 1]
            dp[2][i + 3] = max(dp[2][i + 3], dp[1][i] + a[i + 1])
        dp[0][i + 2] = dp[0][i] + a[i]
        dp[1][i + 2] = max(dp[1][i + 2], dp[1][i] + a[i])
        dp[2][i + 2] = max(dp[2][i + 2], dp[2][i] + a[i])
    print(max(dp[2][-1], dp[1][-2], dp[0][-3]))
else:
    for i in range(n):
        if i < n - 1:
            dp[1][i + 3] = dp[0][i] + a[i + 1]
        dp[0][i + 2] = dp[0][i] + a[i]
        dp[1][i + 2] = max(dp[1][i + 2], dp[1][i] + a[i])
    print(max(dp[1][-1], dp[0][-2]))


Measured memory_bytes: 117468
#include<bits/stdc++.h>
using namespace std;
int n;
string s[30];
int dfs(int d,int k,int e){
  int res=0;
  if(e)res=1;
  for(int i=d;i<n&&k<s[i].size();i++){
    if(s[i][k]=='.')continue;
    int a=s[i][k]-'0';
    if(s[i][k]=='+')a=dfs(i+1,k+1,0);
    if(s[i][k]=='*')a=dfs(i+1,k+1,1);
    if(e)res*=a;
    else res+=a;
  }
  return res;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)cin>>s[i];
    cout<<dfs(0,0,0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	int x[5];
	int ans=0;
	rep(i,5){
		cin>>x[i];
		if(x[i]==0){
			ans=i+1;
		}
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3652
import Foundation


func solution() -> String {
   let AB = readLine()!.components(separatedBy: " ")
   let A = NSDecimalNumber(string: AB[0])
   let B = NSDecimalNumber(string: AB[1])
   
   let A_B = A.multiplying(by: B)
   
   let behaviors:NSDecimalNumberHandler = NSDecimalNumberHandler(
      roundingMode: .down,
      scale: 0,
      raiseOnExactness: false,
      raiseOnOverflow: false,
      raiseOnUnderflow: false,
      raiseOnDivideByZero: false
   )
   
   
   let result = A_B.rounding(accordingToBehavior: behaviors)
   
   
   return result.stringValue
}

print(solution())


Measured memory_bytes: 17900
#include <bits/stdc++.h>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define ll long long int
#define ld long double
#define fo(i, n) for(ll i = 0; i<n; i++)
#define Fo(i, a, n) for(ll i = a; i<n; i++)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pi pair<int, int>
#define pl pair<ll, ll>
#define u_m unordered_map
#define u_s unordered_set
#define p_q priority_queue
using namespace std;
void fast() {ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);}
const int N = 1e5+2;
void print(vl arr){
    fo(i, arr.size())
        cout<<arr[i]<<" ";
    cout<<endl;
}
void solve()
{
    int n;
    cin>>n;
    vector<double> dp(n+1);
    dp[0] = 1;
    for(int i = 1; i<=n; i++)
    {
        double p;
        cin>>p;
        for(int x = i; x>=0; x--)
        {
            dp[x] = (x==0 ? 0 : dp[x-1]*p) + dp[x]*(1-p);
        }
    }
    double ans = 0;
    for(int i = n/2+1; i<=n; i++)
    {
        ans+=dp[i];
    }
    cout<<setprecision(10)<<ans<<endl; 
}
int main()
{
    fast(); 
    int t;
    //scanf("%d", &t);
    //while(t--)
		solve();	
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int maxW = scanner.nextInt();

        int[] w = new int[n];
        int[] v = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = scanner.nextInt();
            v[i] = scanner.nextInt();
        }

        long[][] dp = new long[n + 1][maxW + 1];
        for (int i = 0; i < n + 1; i++) {
            for (int j = 0; j < maxW + 1; j++) {
                dp[i][j] = 0;
            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < maxW + 1; j++) {
                if (j - w[i] >= 0) {
                    dp[i + 1][j] = dp[i][j - w[i]] + v[i];
                }
                dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
            }
        }

        System.out.println(dp[n][maxW]);
    }
}

Measured memory_bytes: 127572
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

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

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

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

fn main() {
    input! {
        n: String
    }

    let mut n = n.parse::<i32>().unwrap();
    let mut v = Vec::new();
    for _i in 0..4 {
        let d = n / 1000;
        v.push(d);
        n = n % 1000 * 10;
    }

    // println!("{:?}", v);

    'a: for i in 0..2 {
        for j in 0..2 {
            for k in 0..2 {
                let mut ans = v[0];
                match i {
                    0 => ans += v[1],
                    1 => ans -= v[1],
                    _ => unreachable!(),
                }
                match j {
                    0 => ans += v[2],
                    1 => ans -= v[2],
                    _ => unreachable!(),
                }
                match k {
                    0 => ans += v[3],
                    1 => ans -= v[3],
                    _ => unreachable!(),
                }

                if ans == 7 {
                    println!(
                        "{}{}{}{}{}{}{}=7",
                        v[0],
                        if i == 0 { '+' } else { '-' },
                        v[1],
                        if j == 0 { '+' } else { '-' },
                        v[2],
                        if k == 0 { '+' } else { '-' },
                        v[3]
                    );
                    break 'a;
                }
            }
        }
    }
}


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

int main() {
  string s;
  cin >> s;
  if (s == "SAT") {
    cout << 1 << endl;
  } else if (s == "FRI") {
    cout << 2 << endl;
  } else if (s == "THU") {
    cout << 3 << endl;
  } else if (s == "WED") {
    cout << 4 << endl;
  } else if (s == "TUE") {
    cout << 5 << endl;
  } else if (s == "MON") {
    cout << 6 << endl;
  } else {
    cout << 7 << endl;
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define f(i,n)  for(i=0;i<n;i++)
#define em emplace_back
#define mp make_pair

int main() {
    int n,i;
    cin>>n;
    string s;
    set<string> st;
    f(i,n)  cin>>s,st.insert(s);
    cout<<st.size();
    
	return 0;
}//1236895

Measured memory_bytes: 19176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int tmp = n/111;
    int ans =(n%111==0) ? tmp*111 : (tmp+1)*111;
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<utility>
 
typedef pair<double, double> point;
typedef point* data;
 
double dist(const point &p1, const point &p2)
{
    double dx = p1.first - p2.first;
    double dy = p1.second - p2.second;
    return sqrt(dx * dx + dy * dy);
}
 
bool sort_y(const point &p1, const point &p2){ return p1.second < p2.second; }
 
double closest(data X, data Y, int n)
{
    if(n <= 3){
        double d = dist(X[0], X[1]);
        for(int i = 0; i < n; i++){ Y[i] = X[i]; }
        sort(Y, Y + n, sort_y);
 
        if(n < 3){ return d; }
        else{ return min(d, min(dist(X[0], X[2]), dist(X[1], X[2]))); }
    }
    int m = (n >> 1);
    double median = X[m].first;
    double d = min(closest(X, Y, m), closest(X + m, Y + m, n - m));
 
    data Z; int size = 0;
    Z = new point [n];
    int i = 0, j = m;
    while(i < m || j < n){
        if(i < m && j < n){
            if(Y[i].second < Y[j].second){
                Z[size] = Y[i]; size++; i++;
            }else{
                Z[size] = Y[j]; size++; j++;
            }
        }
        if(i == m){ while(j < n){ Z[size] = Y[j]; size++; j++; }; }
        if(j == n){ while(i < m){ Z[size] = Y[i]; size++; i++; }; }
    };

	for(i = 0; i < n; i++){ Y[i] = Z[i]; } // merge.

    int resize = 0;
    for(i = 0; i < size; i++){
        if(fabs(Z[i].first - median) <= d){ Z[resize] = Z[i]; resize++; }
    }
 
    int a = 0;
    for(i = 1; i < resize; i++){
        for(j = a; j < i; j++){
            if(Z[i].second - Z[j].second > d){ a++; }
            else{
                d = min(d, dist(Z[i], Z[j]));
            }
        }
    }
    delete [] Z;
    return d;
}
 
int main()
{
    data X, Y;
    int i, n;
    scanf("%d", &n);
    X = new point [n];
    Y = new point [n];
 
    double co_x, co_y;
    for(i = 0; i < n; i++){
        scanf("%lf %lf", &co_x, &co_y);
        X[i] = make_pair(co_x, co_y);
    }
    sort(X, X + n);
 
    double d = closest(X, Y, n);
    printf("%.12f\n", d);
 
    cin >> n;
    delete [] X;
    delete [] Y;
 
    return 0;
}

Measured memory_bytes: 6524
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        double d = (double)((double)w*h/2);
        int ans = w%2==0 && h%2==0 && w/2==x && h/2==y? 1 :0;
        System.out.println(d+ " " + ans);
        sc.close();

    }

}


Measured memory_bytes: 23892
#include <cstdio>
using namespace std;
int main()
{
	int n,k,res=1;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)
	{
		if(res<k) res+=res;
		else res+=k;
	}
	printf("%d\n",res);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int mx2=80, mx=80*80*2*2, offset=mx/2;
bool dp[mx2][mx2][mx];

int main() {
	int h,w; scanf("%d %d",&h,&w);
	int a[h][w], b[h][w];
	for (int i=0; i<h; i++)
		for (int j=0; j<w; j++)
			scanf("%d",&a[i][j]);
	for (int i=0; i<h; i++)
		for (int j=0; j<w; j++)
			scanf("%d",&b[i][j]);
	int init=a[0][0]-b[0][0];
	dp[0][0][init+offset]=true;
	dp[0][0][-init+offset]=true;
	for (int i=1; i<h; i++) {
		int cur=a[i][0]-b[i][0];
		for (int j=0; j<mx; j++)
			if(dp[i-1][0][j])
				dp[i][0][j+cur]=true, dp[i][0][j-cur]=true;
	}
	for (int i=1; i<w; i++) {
		int cur=a[0][i]-b[0][i];
		for (int j=0; j<mx; j++)
			if(dp[0][i-1][j])
				dp[0][i][j+cur]=true, dp[0][i][j-cur]=true;
	}
	for (int i=1; i<h; i++) {
		for (int j=1; j<w; j++) {
			int cur=a[i][j]-b[i][j];
			for (int k=0; k<mx; k++) {
				if(dp[i-1][j][k])
					dp[i][j][k+cur]=true, dp[i][j][k-cur]=true;
				if(dp[i][j-1][k])
					dp[i][j][k+cur]=true, dp[i][j][k-cur]=true;
			}
		}
	}
	int ret=INT_MAX;
	for (int i=0; i<mx; i++)
		if(dp[h-1][w-1][i])
			ret=min(ret,abs(i-offset));
	printf("%d\n",ret);
	return 0;
}

Measured memory_bytes: 159104
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;



void solve()
{	

	int x[5];
	for(int i=0;i<5;i++)
		cin>>x[i];

	for(int i=0;i<5;i++)
	{
		if(x[i]==0)
		{
			cout<<i+1<<endl;
			rr;
		}
	}

}	

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;



	int t=1;
	// cin>>t;
	
	for(int i=1;i<=t;i++)
	{
		// cout<<"Case "<<i<<" : "<<endl;
		solve();
	}
	
	#ifndef ONLINE_JUDGE	
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

Measured memory_bytes: 3600
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
//	tmp = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
 	var a = parseInt(input[0], 10);
	var m =a*a;
	
	
	console.log(m)
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

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

const int N = 10005;

typedef pair<int, int> pii;
typedef pair<int, pii> node;

int a[3];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    for(int i = 0; i < 3; i++)    
        cin >> a[i];
    sort(a, a + 3);
    cout << a[2] * 10 + a[1] + a[0] << endl;
}


Measured memory_bytes: 256
import collections
import copy
INF = 10000

#入力
N, Ma, Mb = map(int, input().split())
medichine = [tuple(map(int, input().split())) for _ in range(N)]

dp = {}
#dp初期化
dp = collections.defaultdict(lambda:INF)
dp[0,0] = 0

for a, b, c in medichine:
    dp_ = copy.copy(dp)
    for ca,cb in dp.keys():
        dp_[ca+a, cb+b] = min(dp_[ca+a, cb+b], dp[ca,cb]+c)
    dp = dp_    

ans = INF
for ca,cb in dp.keys():
    if ca == cb == 0: continue
    if ca*Mb == cb*Ma:
        ans = min(ans, dp[ca,cb])
        
print(-1 if ans == INF else ans)

Measured memory_bytes: 12640
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])


Measured memory_bytes: 9112
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

vector<P> a;
map<P, int> mp;

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    if (n==1) {
        cout << 1 << endl;
        return 0;
    }
    REP(i,n) {
        ll x, y;
        cin >> x >> y;
        a.emplace_back(x,y);
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i == j) continue;
            ll nx = a[i].first-a[j].first;
            ll ny = a[i].second-a[j].second;
            mp[{nx,ny}]++;
        }
    }

    int ans = 0;
    for (auto &&e: mp) {
        // cout << "e.first = " << e.first.first << ", " << e.first.second << endl;
        // cout << e.second << endl;
        ans = max(ans, e.second);
    }
    cout << n-ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    long ans = 0;
    long count = 0;
    boolean b = false;
    for(int i = 0; i < S.length(); i++){
      char c = S.charAt(i);
      if(c == 'W'){
        if(b){
          ans += i-count;
          count++;
        }else{
          count++;
        }
      }else if(c == 'B'){
        b = true;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 28036
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N, M, A, B, C;
    string s1, s2;
    cin >> N;
    if(N >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3588