akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT false
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

map<int,int> memo;
int DFS(int N,int A,int B, int C,int D)
{
  if(N == 0)return 0 ;
  if(N == 1) return D;
  if(memo.count(N))return memo[N];

  int l2 = (N/2)*2;
  int r2 = ((N+1)/2)*2;
  int l3 = (N/3)*3;
  int r3 = ((N+2)/3)*3;
  int l5 = (N/5)*5;
  int r5 = ((N+4)/5)*5;

  int res = 1e18;
  if(N < res/D) res = N*D;//全部Dのパターンはここで考慮される。
  res = min(res,abs(l2 - N)*D + A + DFS(l2/2,A,B,C,D));
  res = min(res,abs(r2 - N)*D + A + DFS(r2/2,A,B,C,D));

  res = min(res,abs(l3 - N)*D + B + DFS(l3/3,A,B,C,D));
  res = min(res,abs(r3 - N)*D + B + DFS(r3/3,A,B,C,D));

  res = min(res,abs(l5 - N)*D + C + DFS(l5/5,A,B,C,D));
  res = min(res,abs(r5 - N)*D + C + DFS(r5/5,A,B,C,D));

  memo[N] = res;

  return res;

}


void solve(void)
{
  int T;cin>>T;
  for (int q = 0; q < T; q++)
  {
    memo.clear();
    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    cout<<DFS(N,A,B,C,D)<<endl;
  }
   
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

using namespace std;

int main()
{
  string s, t;
  cin >> s >> t;
  
  map<char, set<int64_t>> chmap;
  for (char c = 'a'; c <= 'z'; ++c) {
    chmap.emplace(c, set<int64_t>());
  }
  
  for (uint64_t n = 0; n < s.size(); ++n) {
    chmap[ s[n] ].insert(n);
  }
  
  bool not_partial_flag = false;
  int64_t ix = 0, iy = -1;
  for (uint64_t n = 0; n < t.size(); ++n) {
    if (chmap[ t[n] ].size() == 0) {
      not_partial_flag = true;
      break;
    }
    
    auto itr = chmap[ t[n] ].upper_bound(iy);
    if (itr == chmap[ t[n] ].end()) {
      ++ix;
      iy = *chmap[ t[n] ].begin();
    } else {
      iy = *itr;
    }
  }
  
  if (not_partial_flag) {
    cout << -1 << endl;
  } else {
    cout << (ix * s.size() + iy + 1) << endl;
  }
  
  return 0;
}

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

using namespace std;

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

  bool ok = true;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) {
      ok = false;
    }
  }

  if (ok) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}

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

namespace Atcoder
{
    class AtCodeeeeeeeeeeeeeeeeeeeer
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int N = s.Length;

            string RightS = "";
            string LeftS = "";

            if (N % 2 == 0)
            {
                RightS = s.Substring(0, s.Length / 2);
                LeftS = s.Substring(s.Length / 2, s.Length / 2);
            }
            else
            {
                RightS = s.Substring(0, s.Length / 2);
                LeftS = s.Substring((s.Length / 2) + 1, s.Length / 2);
            }
            int Rone = 0;
            int Rzero = 0;
            int Lone = 0;
            int Lzero = 0;

            for (int i = 0; i < RightS.Length; i++)
            {
                if (RightS[i] == '0')
                {
                    Rzero++;
                }
                else if (RightS[i] == '1')
                {
                    Rone++;
                }
            }
            for (int i = 0; i < LeftS.Length; i++)
            {
                if (LeftS[i] == '0')
                {
                    Lzero++;
                }
                else if (LeftS[i] == '1')
                {
                    Lone++;
                }
            }
            if (N == 1)
            {
                Console.WriteLine(0);
            }
            else
            {
                if (N % 2 == 0)
                {
                    Console.WriteLine(
                         N - (Math.Abs(Rzero - Lone) + Math.Abs(Lzero - Rone))
                        );
                }
                else
                {
                    Console.WriteLine(
                        N - (Math.Abs(Rzero - Lone) + Math.Abs(Lzero - Rone))-1
                        );
                }
            }

        }

    }
}


Measured memory_bytes: 13172
#include<iostream>
#include<string>
using namespace std;
int n;
string a,b,c;
int change(char x,char y,char z){
  int res=0;
  if(x==y) res++;
  if(y==z) res++;
  if(z==x) res++;
  if(res==0) return 2;
  else if(res==1) return 1;
  else return 0;
  return 0;
}
int main(){
  cin >> n >> a >> b >> c;
  int cnt=0;
  for(int i=0;i<n;i++){
    cnt+=change(a[i],b[i],c[i]);
  }
  cout << cnt << "\n";
  
  return 0;
}


Measured memory_bytes: 256
i, o, t, j, l, s, z = map(int, input().split())
if i < 1 or j < 1 or l < 1:
    ans1 = 0
else:
    ans1 = ((i - 1) // 2 + (l - 1) // 2 + (j - 1) // 2) * 2 + 3
ans2 = (i // 2 + j // 2 + l // 2) * 2
print(max(ans1, ans2) + o)


Measured memory_bytes: 3060
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut p: Vec<i64> = vec![];

    for _ in 0..n {
        p.push(read());
    }

    p.sort();

    println!("{}", p[..k].iter().sum::<i64>());
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << setw(4) << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

LL X, Y, A, B, C;
VEC<LL> P, Q, R;
int main() {
  cin >> X >> Y >> A >> B >> C;
  P = VEC<LL>(A);
  Q = VEC<LL>(B);
  R = VEC<LL>(C);
  REP(i, 0, A) cin >> P[i];
  REP(i, 0, B) cin >> Q[i];
  REP(i, 0, C) cin >> R[i];
  sort(ALL(P), greater<LL>());
  sort(ALL(Q), greater<LL>());
  sort(ALL(R), greater<LL>());

  priority_queue<LL, VEC<LL>, greater<LL>> q;
  LL sumx, sumy, sumz;
  sumx = sumy = sumz = 0;
  REP(i, 0, X) sumx += P[i];
  REP(i, 0, Y) sumy += Q[i];
  REP(i, 0, X) q.push(P[i]);
  REP(i, 0, Y) q.push(Q[i]);
  // LL limz = min(X + Y, C)+1;
  LL limz = C + 1;
  VEC<LL> ans(limz, 0);
  int ix, iy, iz;
  ix = X - 1;
  iy = Y - 1;
  iz = -1;
  REP(t, 0, C) {
    if (q.top() < R[t]) {
      q.pop();
      q.push(R[t]);
    }
  }
  REP(t, 0, limz) {
    if (ix < 0 && iy < 0) break;
    ans[t] = sumx + sumy + sumz;
    // DUMP("   t,   ix,   iy,   iz,   sumx,   sumy,  sumz, ans[t]");
    // DUMP(t, ix, iy, iz, sumx, sumy, sumz, ans[t]);

    iz++;
    sumz += R[iz];
    // if (P[ix] == Q[iy] && ix >= 0 && iy >= 0) {
    //   if ((double)sumx / (ix + 1) > (double)sumy / (iy + 1)) {
    //     sumy -= Q[iy];
    //     iy--;

    //   } else {
    //     sumx -= P[ix];
    //     ix--;
    //   }
    // } else
    if (P[ix] > Q[iy] && iy >= 0) {
      sumy -= Q[iy];
      iy--;
    } else if (ix >= 0) {
      sumx -= P[ix];
      ix--;
    }
  }
  // DUMP("ans[t]", ans);
  LL ma = 0;
  while(!q.empty()){
    ma+=q.top();
    q.pop();
  }
  cout<<ma<<endl;

  // REP(t, 0, limz) { ma = max(ma, ans[t]); }
  // cout << ma << endl;

  return 0;
}


Measured memory_bytes: 4848
#include<stdio.h>

int main(void){
    
    int x,h,m,s;
    
    scanf("%d",&x);
    h=x/3600;
    m=(x%3600)/60;
    s=(x%3600)%60;
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}


Measured memory_bytes: 2144
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        if(s.charAt(0)==s.charAt(1)&&s.charAt(0)==s.charAt(2)) System.out.println("No");
        else System.out.println("Yes");
    }
}

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

using namespace std;
using ii = pair<int, int>;

int solve(const vector<int>& vs, int N)
{
    map<int, int> hist[2];
    vector<ii> cost[2];

    for (int k = 0; k < 2; ++k)
    {
        for (int i = k; i < N; i += 2)
            ++hist[k][vs[i]];

        // Corner case: caso todos os elementos sejam iguais, devemos
        // ter uma segunda opção de escolha
        hist[k][100001] = 0;

        for (const auto& p : hist[k])
        {
            int v, n;
            tie(v, n) = p;

            cost[k].push_back(ii(N/2 - n, v));
        }

        sort(cost[k].begin(), cost[k].end());
    }

    enum { LEFT = 0, RIGHT = 1 };

    auto ans = cost[LEFT][0].second == cost[RIGHT][0].second ? 
        min(cost[LEFT][0].first + cost[RIGHT][1].first, 
            cost[LEFT][1].first + cost[RIGHT][0].first) 
        : cost[LEFT][0].first + cost[RIGHT][0].first;

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> vs(N);

    for (int i = 0; i < N; ++i)
        cin >> vs[i];

    auto ans = solve(vs, N);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 6520
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<pair<ll,ll>> vec[1000000];
int main(){
  ll n,m,x,y;
  cin >> n >> m;
  ll a[m];
  rep(i,m){
    cin >> x >> y; //
    vec[x-1].push_back(make_pair(y,i));
  }
  rep(i,n){
    sort(all(vec[i]));
  }
  ll tmp = 0;
  rep(i,n){
    tmp = 0;
    for(auto itr:vec[i]){
      tmp++;
      a[itr.second] = (i+1) * (ll)1000000 + tmp;
    }
  }
  rep(i,m){
    printf("%012lld\n",a[i]);
  }
}


Measured memory_bytes: 28800
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define INF	(1 << 30)

#define N	(5)
#define NN	(N * N)

/* typedef */

typedef vector<int> vi;
typedef map<int,int> mii;

struct Pt {
  int x, y;
};

/* global variables */

Pt dxys[8] = {
  { 1, 0}, {1, -1}, {0, -1}, {-1, -1},
  {-1, 0}, {-1, 1}, {0,  1}, { 1,  1}
};

int n, nn;
mii dists;
vi adjs[NN];

/* subroutines */

int infection(int bits) {
  int ibits = 0;

  for (int pos = 0; pos < nn; pos++) {
    int c = 0;
    vi& adj = adjs[pos];

    for (vi::iterator ait = adj.begin(); ait != adj.end(); ait++)
      c += ((bits >> *ait) & 1);

    int b = 1 << pos;
    int on = bits & b;
    if ((! on && c == 3) || (on && (c == 2 || c == 3))) ibits |= b;
  }

  return ibits;
}

/* main */

int main() {
  for (;;) {
    cin >> n;
    if (n == 0) break;

    nn = n * n;

    int sstat = 0;
    int mask = (1 << nn) - 1;

    for (int y = 0; y < n; y++) {
      string line;
      cin >> line;
      for (int x = 0; x < n; x++) {
	int pos = y * n + x;
	switch (line[x]) {
	case '#': sstat |= (1 << pos); break;
	case '@': sstat |= (pos << nn); break;
	}
      }
    }
    //p sbits.to_s(2)
    //p spos

    for (int y0 = 0; y0 < n; y0++) {
      for (int x0 = 0; x0 < n; x0++) {
	int pos = y0 * n + x0;
	adjs[pos].clear();
	for (int di = 0; di < 8; di++) {
	  int x = x0 + dxys[di].x;
	  int y = y0 + dxys[di].y;
	  if (x >= 0 && x < n && y >= 0 && y < n)
	    adjs[pos].push_back(y * n + x);
	}
      }
    }
    //p adjs

    dists.clear();
    dists[sstat] = 0;

    queue<int> q;
    q.push(sstat);

    int min_d = -1;
  
    while (! q.empty()) {
      int u = q.front();
      q.pop();

      int upos = u >> nn;
      int ubits = u & mask;
      
      int ud = dists[u];
      //puts tostr(n, ubits, upos); puts
    
      if (ubits == 0) {
	min_d = ud;
	break;
      }

      int nvd = ud + 1;
      vi& adj = adjs[upos];
      
      for (vi::iterator ait = adj.begin(); ait != adj.end(); ait++) {
	int vpos = *ait;
	int vb = (1 << vpos);
	if ((ubits & vb) == 0) {
	  int vbits = (infection(ubits | vb) & ~vb);
	  int v = (vpos << nn) | vbits;
	  if (dists.find(v) == dists.end()) {
	    dists[v] = nvd;
	    q.push(v);
	  }
	}
      }
    }

    cout << min_d << endl;
  }

  return 0;
}

Measured memory_bytes: 2396
#include<bits/stdc++.h>
using namespace std;
stack<char>s;
string a;
int main(){
    cin>>a;
    int n=a.size();
    for(int i=0;i<n;i++){
        s.push(a[i]);
    }
    bool flag=1;
    for(int i=0;i<n;i++){
        char top=s.top();
        if(top=='b') top='d';
        else if(top=='d') top='b';
        else if(top=='p') top='q';
        else if(top=='q') top='p';
        if(top==a[i]) {
            flag=1;
            s.pop();
        }
        else {
            flag=0;
            break;
        }
    }
    if(flag==0) printf("No");
    else printf("Yes");
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int n;
vector<int> a;
vector<int> ans;

int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		scanf("%d",&x);
		a.pb(x);
	}
	sort(a.begin(),a.end());
	
	for(int i=0;i<a.size()-1;i++){
		if(a[i]==a[i+1]){
			ans.pb(a[i]);
			i++;
		}
	}
	if(ans.size()<2) puts("0");
	else{
		printf("%lld\n",1LL*ans[ans.size()-1]*ans[ans.size()-2]);
	}
	return 0;
}


Measured memory_bytes: 1144
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    double r;
    cin >> r;
    const double PI=3.14159;
    double ans = 2 * r * PI;
    cout << ans << endl;
}


Measured memory_bytes: 3804
#include<cstdio>
#include<cmath>
#include<utility>
#include<vector>
#include<complex>
#include<algorithm>

using namespace std;

typedef double Real;
typedef complex<Real> Point;
typedef pair<Point,Point> Line;
typedef pair<Point,Point> Segment;
typedef vector<Point> Polygon;

const Real eps=1e-6;
const Real inf=1e9;

Point NPoint=Point(NAN,NAN);

void print(Point p,char ch='\n'){
	printf("(%f %f)%c",p.real(),p.imag(),ch);
}

template<class T> bool eq(T a,T b){
	return abs(a-b)<eps;
}

template<class T> int sgn(T a){
	if(eq(a,(Real)0)) return 0;
	if(a>0) return 1;
	return -1;
}

bool onSeg(Point a,Point b,Point c){
	return eq(abs(a-b),abs(a-c)+abs(c-b));
}

bool onSeg(Segment s,Point p){
	return onSeg(s.first,s.second,p);
}

Real doP(Point a,Point b){
	return (conj(a)*b).real();
}

Real crP(Point a,Point b){
	return (conj(a)*b).imag();
}

Point proj(Point p,Point b){
	return b*doP(p,b)/norm(b);
}

bool isPara(Point a,Point b){
	return eq(crP(a,b),(Real)0);
}

bool isPara(Line l1,Line l2){
	return isPara(l1.second-l1.first,l2.second-l2.first);
}

Point perp(Line l,Point a){
	Point p=l.first,q=l.second;
	return p+proj(a-p,q-p);
}

Point refl(Line l,Point p){
	Point h=perp(l,p);
	return h*(Real)2-p;
}

Point iLL(Line l1,Line l2){
	if(isPara(l1,l2)) return NPoint;
	Point a1=l1.first,b1=l1.second;
	Point a2=l2.first,b2=l2.second;
	Real num=crP(a2-a1,b1-a1);
	Real den=crP(b1-a1,b2-a2);
	return a2+(b2-a2)*(num/den);
}

Point iSS(Segment s1,Segment s2){
	Point p=iLL(s1,s2);
	if(isnan(p.real())) return p;
	if(onSeg(s1,p)&&onSeg(s2,p)) return p;
	return NPoint;
}


int N;
vector<Segment> ms;
Point s,t;

vector<vector<int> > rs;

bool is_valid(Point cs,Point ct,int dep){
	if(dep==6) return false;
	Point p=NPoint;
	Real d=inf;
	Point nt=ct;
	for(int i=0;i<N;i++){
		Segment seg=ms[i];
		Segment cur=Segment(cs,ct);
		Point cp=iSS(seg,cur);
		if(isnan(cp.real())) continue;
		if(eq(cp,cs)) continue;
		Real cd=abs(cs-cp);
		if(cd<d){
			d=cd;
			p=cp;
			nt=refl(seg,ct);
		}
	}
	if(isnan(p.real())){
		if(eq(t,ct)) return true;
		return false;
	}
	bool flg=is_valid(p,nt,dep+1);
	return flg;
}

Real solve(vector<int> rs){
	Point s=::s,t=::t;
	for(int i=(int)rs.size()-1;i>=0;i--){
		Segment seg=ms[rs[i]];
		t=refl(seg,t);
	}
	if(is_valid(s,t,0)) return abs(s-t);
	return inf;
}

void dfs(vector<int> &vec,int cur,int t){
	if(cur==t){
		rs.push_back(vec);
		return;
	}
	for(int i=0;i<N;i++){
		vec.push_back(i);
		dfs(vec,cur+1,t);
		vec.pop_back();
	}
}

void gen(){
	vector<int> tmp;
	rs.clear();
	for(int i=0;i<=5;i++){
		tmp.clear();
		dfs(tmp,0,i);
	}
}

Real solve(){
	gen();
	Real res=inf;
	for(int i=0;i<rs.size();i++){
		Real cur=solve(rs[i]);
		res=min(res,cur);
	}
	return res;
}

Point readPoint(){
	Real x,y;
	scanf("%lf%lf",&x,&y);
	return Point(x,y);
}

void input(){
	ms.clear();
	scanf("%d",&N);
	if(N==0) exit(0);
	for(int i=0;i<N;i++){
		Point p,q;
		p=readPoint();
		q=readPoint();
		ms.push_back(Segment(p,q));
	}
	t=readPoint();
	s=readPoint();
}

int main(){
	while(true){
		input();
		Real ans=solve();
		printf("%f\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> deg(n);
    vector<vector<int>> g(n);
    rep(i,0,m) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        ++deg[a];
        ++deg[b];
        g[a].push_back(b);
        g[b].push_back(a);
    }
    bool good = true;
    rep(i,0,n) if(deg[i]%2!=0) good=false;
    if(good) {
        good = false;
        rep(i,0,n) if(deg[i]>=6) good = true;
        if(!good) {
            int count4 = 0;
            rep(i,0,n) if(deg[i]==4) ++count4;
            if(count4>=3) good = true;
            if(!good && count4==2) {
                rep(i,0,n) if(deg[i]==4) {
                    for(int j:g[i]) if(deg[j]==2) {
                            int x = i, y = j;
                            while(deg[y]==2) {
                                for(int z:g[y]) if(z!=x) {
                                        x = y;
                                        y = z;
                                        break;
                                    }
                            }
                            if(y==i) good = true;
                        }
                }
                
                
            }
        }
    }
    if(good) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 6144
#include <iostream>
#include <cmath>

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

    int n;

    std::cin >> n;
    
    for (; n--;) {
        int h, m;
        char tmp;
        std::cin >> h >> tmp >> m;

        double angle_h, angle_m, diff;

        angle_h = 30. * h + 0.5 * m;
        angle_m = 6. * m;
        diff = std::abs(angle_h - angle_m);

        if (diff > 180.) {
            diff = 360. - diff;
        }

        if (diff < 30.) {
            std::cout << "alert" << std::endl;
        }
        else if (diff < 90.) {
            std::cout << "warning" << std::endl;
        }
        else {
            std::cout << "safe" << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1192
MOD = int(1e9) + 7
MAX = int(1e5) * 2


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


FACT = [1] * (MAX+1)
for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD
INV = [1] * (MAX+1)
INV[MAX] = div(1, FACT[MAX])
for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD


def main():
    N, A, B, C = map(int, input().split())
    DIV = div(1, A+B)
    XA = [1] * (N+1)
    XB = [1] * (N+1)
    for i in range(1, N+1):
        XA[i] = XA[i-1] * A * DIV % MOD
        XB[i] = XB[i-1] * B * DIV % MOD
    ans = 0
    for i in range(N, N*2):
        # nCr
        n = i - 1
        r = i - N
        tmpa = i * (XA[N] * XB[i-N]) * FACT[n] * INV[r] * INV[n-r] % MOD
        tmpb = i * (XB[N] * XA[i-N]) * FACT[n] * INV[r] * INV[n-r] % MOD
        ans = (ans + tmpa + tmpb) % MOD
    ans = ans * div(1, 100-C) * 100 % MOD
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62932
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s,t;
	cin>>s;
	cin>>t;
	int flag=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=t[i])
		{
			flag=1;
			break;
		}
	}
	if(flag==0)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


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

using namespace std;

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

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

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());

	long long a1, c1;
	long long totalcount = 0;
	for (int i = 0; i < n; i++) {
		a1 = lower_bound(a.begin(), a.end(), b[i])-a.begin();
		c1 = c.end()-upper_bound(c.begin(), c.end(), b[i]);
		totalcount += a1 * c1;
	}

	cout << totalcount << endl;
}

Measured memory_bytes: 1536
import queue
import math
n, d, a = map(int, input().split())
xh = list(list(map(int, input().split())) for _ in range(n))

xh.sort(key=lambda x: x[0])
d = d * 2
total = 0
q = queue.Queue()
ans = 0
for i in range(n):
    while(not q.empty() and q.queue[0][0] < xh[i][0]):
        total -= q.queue[0][1]
        q.get()
    h = xh[i][1] - total
    if h > 0:
        c = math.ceil(h/a)
        ans += c
        damage = c * a
        total += damage
        q.put((xh[i][0]+d, damage))

print(ans)


Measured memory_bytes: 100436
#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>;

int main(){
    int n, y;
    cin >> n >> y;
    // bool can = false;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n - i; ++j){
            if(y == 10000 * i + 5000 * j + 1000 * (n - i - j)){
                    cout << i << " " <<  j << " " << n - i - j << endl;
                    return 0;
            }
        }
    }
    cout << -1 <<" " << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 3596
a, b, c = map(int, input().split())
A = list(range(min(a, b)+1))
d = 0
e = 0
A.reverse()
for i in A[:-1]:
    if a % i == 0 and b % i == 0:
        d += 1
        if c == d:
            e = i
            break
print(e)


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

#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx_ori[4] = { -1,0, 1,0 }, dy_ori[4] = { 0,1,0,-1 };
int dx[4] = {0, 0, 0, 0}, dy[4] = {0, 0, 0, 0};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
  int n;
  cin >> n;
  vi a(n);
  rep (i, n) {
    cin >> a[i];
  }

  ll ans = 1;
  vi rgb = {0, 0, 0};
  rep (i, n) {
    int cnt = 0;
    rep (j, 3) {
      if (rgb[j] == a[i]) cnt++;
    }
    ans = ans * cnt % MOD;
    rep (j, 3) {
      if (rgb[j] == a[i]) {
        rgb[j]++;
        break;
      }
    }
  }
  cout << ans << endl;
}


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

int main() {
  ll R;
  cin >> R;
  
  cout << 2*R*3.141592653589 << endl;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define mod 1000000007
#define int long long

void solve() {
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
	int i;
	for(i=0;i<n;i++)cin>>a[i];

	int j;
	vector<int> dp(k+1);
	dp[0] = 0;
	for(i=1;i<=k;i++){
		int t = 0;
		for(j=0;j<n;j++){
			if(i-a[j] >= 0)if(dp[i-a[j]] == 0){
				t = 1;
				break; 
			}
		}
		dp[i] = t;
	}


	if(dp[k] == 1)cout<<"First"<<endl;
	else cout<<"Second"<<endl;

	return;
}

int32_t main() {
	std::ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 3980
#include<iostream>
#include<vector>
#include<algorithm>
#define lli long long int
using namespace std;
int main()
{   
int n,k;
	cin>>n>>k;
	 vector<int> m(n);
for(int i=0;i<n;i++)
{cin>>m[i];
}
	sort(m.begin(),m.end());
	lli ans=0;
	for(int i=0;i<n-k;i++)
	ans+=m[i];
	cout<<ans;
	
	
}

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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

int n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    cout << (1000 - (n%1000))%1000;
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

typedef long long ll;

const double pi = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

int main(){
    int N,M;
    cin >> N >> M;
    vector<priority_queue<int,vector<int>,greater<int>>> p(N+1);
    vector<map<int,string>> m(N+1);
    vector<pair<int,int>> query(M);
    for(int i = 0; i < M ;i++){
        int pre,y;
        cin >> pre >> y;
        query[i] = make_pair(pre,y);
        p[pre].push(y);
    }
    for(int i = 1; i <= N;i++){
        if(p[i].empty()) continue;
        string pre = to_string(i);
        int n = pre.size();
        for(int j = 1; j <= 6-n; j++) pre = "0" + pre;
        int k = p[i].size();
        for(int count = 1; count <= k; count++){
            string after = to_string(count);
            int n = after.size();
            for(int j = 1; j <= 6-n; j++) after = "0" + after;
            string comp = pre + after;
            m[i][p[i].top()] = comp;
            p[i].pop();
        }
    }
    for(auto pa : query){
        cout << m[pa.first][pa.second] << endl;
    }
    return 0;
}

Measured memory_bytes: 24192
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  int n;cin>>n;
  map<string, int> d;
  rep(i, n){
    string s;cin>>s;
    d[s]++;
  }
  int m = 0;
  each(el, d){
    int c = el.second;
    chmax(m, c);
  }

  vector<string> ans;
  each(el, d){
    if (el.second==m){
      ans.pb(el.first);
    }
  }
  sort(all(ans));
  rep(i, sz(ans)){
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 25696
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll N,a[100010],b[100010],c[100010],dp[100010][3];
  cin>>N;
  for(ll i=0;i<N;i++){
    cin>>a[i]>>b[i]>>c[i];
  }
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  for(ll i=0;i<N-1;i++){
    dp[i+1][0]=a[i+1]+max(dp[i][1],dp[i][2]);
    dp[i+1][1]=b[i+1]+max(dp[i][0],dp[i][2]);
    dp[i+1][2]=c[i+1]+max(dp[i][0],dp[i][1]);
  }
  cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    int N,L,i,j,d;
    cin>>N>>L;
    string s[N];
    for(i=0;i<N;i++)
    {
        cin>>s[i];
    }
    sort(s,s+N);
    for(i=0;i<N;i++)
    {
        cout<<s[i];
    }
    cout<<endl;
}


Measured memory_bytes: 3596
# C - Grid Repainting 2
H, W = map(int,input().split())
S = [list(str(input())) for i in range(H)]

for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            tmp = 0
            if w != W-1:
                if S[h][w+1] == '#':
                    tmp = 1
            if h != 0:
                if S[h-1][w] =='#':
                    tmp = 1
            if h != H-1:
                if S[h + 1][w] == '#':
                    tmp = 1
            if w != 0:
                if S[h][w - 1] == '#' and w != 0:
                    tmp = 1
            if tmp == 0:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 39408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int a,b,c;
	cin>>a>>b;
	c=max(a+a-1,a+b);
	c=max(c,b+b-1);
	cout<<c<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;

int main(){
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    int n=ceil(a/d);
    int m=ceil(c/b);
    if(n<m)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}


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


int main() {
  int n, a, b;
  cin >> n;
  if (n == 1) {
    cout << "Hello World" << endl;
    return 0;
  }
  cin >> a;
  cin >> b;
  cout << a + b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359


ll gcd(ll a, ll b)
{
	ll c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

int main() {
	ll N;
	ll T[100];
	cin >> N;
	REP(i, N) {
		cin >> T[i];
	}
	REP(i, N-1) {
		T[i + 1] = T[i]/gcd(T[i], T[i + 1])*T[i+1];
	}
	cout << T[N-1];
	return 0;

	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	long long int a,b;
	cin>>a>>b;
	if(b==100){
		b++;
	}
	if(a==0){
	cout<<b;
}
    if(a==1){
    	cout<<b*100;
	}
	if(a==2){
		cout<<b*10000;
	}
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int n,m,x,y,dp[5][10010],cnt[200],h;
string a;

int main()
{
	int i;
	cin>>a;
	for(i=0;i<a.size();i++)
	{
		cnt[a[i]]++;
		if(cnt[a[i]]%2) h++;
		else h--;
	}
	h?puts("No"):puts("Yes");
}

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

int main()
{
	int n;
	cin >> n;
	vector<double> v(n);
	for(int i=0;i<n;i++)
		cin >> v[i];

	vector<vector<double> > dp(n+1, vector<double>(n+1,0));
	
	dp[0][1] = 1.0- v[0];
	dp[0][0] =1;
	for(int i=2;i<=n;i++)
		dp[0][i] = dp[0][i-1] *(1.0-v[i-1]);
	// for(int i=1;i<=n;i++)
		// dp[i][0]=1;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=n; j++)
		{
			dp[i][j] = dp[i-1][j-1]*v[j-1] + dp[i][j-1]*(1-v[j-1]); 
		}
	}
	// for(int i=0;i<=n;i++)
	// {
	// 	for(int j=0;j<=n;j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	double ans = 0;

	for(int i=((n+1)/2);i<=n;i++)
	{
		// cout << i << endl;
		ans += dp[i][n];
	}
	cout.precision(10);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fastio() ios::sync_with_stdio(0);cin.tie(0);
#define nl "\n"
#define wi(x) cerr << #x << " is " << x << nl
const double eps = 1e-6;

void solve(){
	int n; cin>>n;
	vi v(n+1,0);
	rep(x,1,100){
		rep(y,1,100){
			rep(z,1,100){
				int fn = x*x + y*y + z*z + x*y + y*z + z*x;
				if(fn <= n) v[fn]++;
			}
		}
	}
	rep(i,1,n) cout << v[i] << nl;
}

int main(){
	fastio()
	
	int T=1;
	//int T; cin>>T;
	while(T--) solve();

	return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,x,y,dist;cin>>n>>x>>y;x--,y--;
  lvector ans(n,0);
  for(ll i=0;i<n;++i) {
    for(ll j=i+1;j<n;++j) {
      dist=min(j-i,abs(x-i)+abs(y-j)+1);
      ans[dist]++;
    }
  }
  for(ll i=1;i<n;++i) print(ans[i]);
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long inf = numeric_limits<long long>::max();
typedef long long ll;

ll calc(vector<ll> & vec, ll mode, ll add) {
  ll ans = 0;
  rep(i, vec.size()) {
    if (add ) {
      
    }
    if (vec[i] > 0 && mode != i) {
      ans += 1;
    }
  }
  return ans;
}

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

vector<pair<ll, ll>> convert(vector<ll> &vec) {
  vector<pair<ll, ll>> seq;
  rep(i, vec.size()) {
    if (vec[i] == 0) {
      continue;
    }
    seq.push_back(make_pair((ll)i, vec[i]));
  }
  sort(seq.begin(), seq.end(), sortbysec);
  return seq;
}

int main()
{
  int n;
  cin >> n;
  vector<ll> vec_even(pow(10, 5)+10, 0);
  vector<ll> vec_odd(pow(10, 5)+10, 0);
  int even_size = 0;
  int odd_size = 0;
  rep(i, n) {
    int x;
    cin >> x;
    if (i%2 == 0) {
      even_size++;
      vec_even[x]++;
    } else {
      odd_size++;
      vec_odd[x]++;
    }
  }
  vector<pair<ll, ll>> even_pairs = convert(vec_even);
  vector<pair<ll, ll>> odd_pairs = convert(vec_odd);
  ll res = pow(10, 8);
  if (even_pairs[0].first == odd_pairs[0].first) {
    ll a, b;
    a = even_size - even_pairs[0].second;
    b = odd_size - (odd_pairs.size() == 1 ? 0 : (odd_pairs[1].second));
    res = min(res, a + b);
      
    a = odd_size - odd_pairs[0].second;
    b = even_size - (even_pairs.size() == 1 ? 0 : (even_pairs[1].second));
    res = min(res, a + b);
  } else {
    ll a = even_size - even_pairs[0].second;
    ll b = odd_size - odd_pairs[0].second;
    res = a + b;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[0]+a[1]<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			if(a >=0 && a <= 100) {
				if(b >=0 && b <= 100) {
					if(c >=0 && c <= 100) {
						if(a < b && b < c) {
							System.out.println("Yes");
						} else {
							System.out.println("No");
						}
					}
				}
			}
		}
	}
}

Measured memory_bytes: 26016
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = sc.nextInt();

        int max = Math.max(a, b);
        max = Math.max(max, c);
        int sum = 0;

        if(max == a){
            for(int i=0; i<n; i++){
                a*=2;
            }
        } else if(max == b){
            for(int i=0; i<n; i++){
                b*=2;
            }
        } else {
            for(int i=0; i<n; i++){
                c*=2;
            }
        }

        sum = a + b + c;
        System.out.println(sum);
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
}


Measured memory_bytes: 23636
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private static final long MOD = 1_000_000_007;

    private void solve(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] x = new long[n];
        for (int i = 0; i < n; ++i) {
            x[i] = sc.nextInt();
        }
        long[] y = new long[m];
        for (int i = 0; i < m; ++i) {
            y[i] = sc.nextInt();
        }

        long sum1 = 0;
        for (int i = 0; i < n; ++i) {
            sum1 = (sum1 + (i * x[i] - (n - i - 1) * x[i])) % MOD;
        }
        long sum2 = 0;
        for (int i = 0; i < m; ++i) {
            sum2 = (sum2 + (i * y[i] - (m - i - 1) * y[i])) % MOD;
        }
        _out.println((sum1 * sum2) % MOD);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

public class Main {

    public static void main(String[] args) {
        Scanner in=new Scanner (System.in);
        PrintWriter out=new PrintWriter(System.out);
        TreeMap<Integer,Integer> mset=new TreeMap<>();
        int q=Integer.parseInt(in.next()),size=0;
        for(int i=0;i<q;i++) {
            int odr=Integer.parseInt(in.next());

            switch(odr) {
            case 0:
            	int x0=Integer.parseInt(in.next());
            	Integer num0=mset.get(x0);
            	if(num0!=null)mset.put(x0, num0+1);
            	else mset.put(x0, 1);
            	size++;
            	out.println(size);
            	break;

            case 1:
            	int x1=Integer.parseInt(in.next());
            	Integer num1=mset.get(x1);
            	out.println((num1!=null)? num1:0);
            	break;

            case 2:
            	int x2=Integer.parseInt(in.next());
            	Integer num2=mset.get(x2);
            	if(num2!=null)size-=num2;
            	mset.remove(x2);
            	break;

            case 3:
            	int L=Integer.parseInt(in.next()),R=Integer.parseInt(in.next());
            	NavigableMap<Integer,Integer> sub=mset.subMap(L, true, R, true);
            	Iterator<NavigableMap.Entry<Integer,Integer>> itr=sub.entrySet().iterator();
            	
            	while(itr.hasNext()) {
            		NavigableMap.Entry<Integer,Integer> get=itr.next();
            		int k=get.getKey(),num=get.getValue();
            		for(int j=0;j<num;j++)out.println(k);
            	}
            	break;
            }
        }
        out.flush();
    }

}


Measured memory_bytes: 122608
#include <iostream>

using namespace std;

int main()
{
string s;
cin >>s;
for (int i=0;i<s.size();i++){
   if (s[i]=='i'||s[i]=='a'||s[i]=='o'||s[i]=='e'||s[i]=='u'){
     cout<<"vowel";
   }else{
     cout<<"consonant";
   }
}

   return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  if(a==1){
    if(b==0) cout<<"Close"<<'\n';
    else cout<<"Open"<<'\n';
  }
  else{
    if(b==0){
      if(c==0) cout<<"Close"<<'\n';
      else cout<<"Open"<<'\n';
    }
    else cout<<"Close"<<'\n';
  }
  return(0);
}



Measured memory_bytes: 3128