akhauriyash/Code-Regression huggingface dataset:
using System;

public class Program
{
    private int N;
    private int[] X, Y;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        X = new int[N];
        Y = new int[N];
        for (int i = 0; i < N; i++)
        {
            X[i] = sc.NextInt();
            Y[i] = sc.NextInt();
        }

        double[] angle = new double[N];

        for (int i = 0; i < N; i++)
        {
            angle[i] = Math.Atan2(Y[i], X[i]);
        }

        double ans = 0;
        int[] Index = new int[N];
        for (int i = 0; i < N; i++)
        {
            Index[i] = i;
        }

        Array.Sort(Index, (a, b) => angle[a].CompareTo(angle[b]));

        for (int i = 0; i < N; i++)
        {
            long x = 0;
            long y = 0;
            for (int j = 0; j < N; j++)
            {
                x += X[Index[(i + j) % N]];
                y += Y[Index[(i + j) % N]];
                ans = Math.Max(ans, Math.Sqrt((x * x) + (y * y)));
            }
        }
        
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

void Main() {
  int n;
  std::cin >> n;
  int a[n];
  int b[n];
  int c[n];

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

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

  for (int i = 0; i < n - 1; i++) {
    std::cin >> c[i];
  }

  int res = 0;
  for (int i = 0; i < n; i++) {
    res += b[a[i] - 1];
    if (i && a[i] == a[i - 1] + 1) {
      res += c[a[i - 1] - 1];
    }
  }

  std::cout << res << std::endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    char c;
    cin >> c;
    
    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
// author: tarang 
#include<bits/stdc++.h>
#define ll long long
#define endl  '\n'
#define fastio  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD=1000000007;
#define PI acos(-1)
using namespace std;
int vis[1000000+7];
int gcd(int x, int y)
{                     
        return (x==0)? y : gcd(y % x, x);
}
int main(){
    int n ; cin >> n ;
    int a[n] ; cin >> a[0];
    int ans = a[0] ;
    for(int i = 1 ; i < n  ; i++){
    	  cin >> a[i];
    	  ans = gcd(ans,a[i]);
	}
	for(int i = 0 ; i < n ; i++){
		  int x = a[i];
		  for(int j = 2 ; j*j <= x ; j++){
		  	  if(x%j==0){
		  	  	while(x%j==0){
		  	  		   x/=j;
					}
					vis[j]++;
				}
		  }
		  if(x > 1){
		  	vis[x]++;
		  }
	}
	bool flag = 0;
	for(int i = 2 ; i <= 1000000 ; i++){
		 if(vis[i] > 1){
		 	flag = 1;
		 	break;
		 }
	}
	if( ans ==1 and flag !=0) cout << "setwise coprime" << endl;
	else if(flag == 0 and ans == 1){
		cout << "pairwise coprime" << endl;
	}
	else cout << "not coprime" << endl;
}


Measured memory_bytes: 11428
#include <stdio.h>
int main(){
  int a, X, Y, W, H, N, x, y, j, i, b;
  scanf("%d", &a);
  for (j = 1;j <= a;j++){
    b=0;
  scanf("%d %d %d %d", &X, &Y, &W, &H);
  scanf("%d", &N);
  for (i = 1;i <= N;i++) {
    scanf("%d %d", &x, &y);
    if (X <= x && x <= X+W && Y <= y && y <= Y+H)b++;}
    printf("%d\n", b);
  }
  return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static System.Array;

class MainClass : Scanner
{
    static void Main()
    {
        var (D, T, S) = ReadStream<int,int,int>();
        if (T * S >= D) WriteLine("Yes");
        else WriteLine("No");
    }
}

class Scanner
{
    public static int RInt() => int.Parse(Console.ReadLine());
    public static long RLong() => long.Parse(Console.ReadLine());
    public static string RString() => Console.ReadLine();
    public static double RDouble() => double.Parse(Console.ReadLine());

    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static string[] RStrings() => Console.ReadLine().Split();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static T1 ReadStream<T1>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadStream<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadStream<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadStream<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}

Measured memory_bytes: 27584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    if (unique(a, a+3) - a == 2)
        cout << "Yes\n";
    else
        cout << "No\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <string>
#include <algorithm>

using namespace std;

using veci = vector<int>;
using pii = pair<int, int>;
using vecii = vector<pii>;
using ll = long long;
using vecl = vector<ll>;
#define fi first
#define se second
#define endl '\n'

struct Node {
    int idx;
    int degree;
    vector<Node*> edge;

    Node(int id) {
        degree = 0;
        idx = id;
    }
};

struct Link {
    Node* lhs;
    Node* rhs;

    Link(Node* lhs, Node* rhs) {
        this->lhs = lhs;
        this->rhs = rhs;
    }

    bool operator==(Link const& rhs) const {
        return this->lhs==rhs.lhs && this->rhs==rhs.rhs;
    }
};

struct LinkHasher {
    std::size_t operator()(Link const& k) const {
        return ((ll(k.lhs->idx) | (ll(k.rhs->idx) << 32)));
    }
};

vector<Node*> graph;
unordered_map<Link, int, LinkHasher> hm;

void dfs(Node* nd, Node* par, int parColor, int maxColor, vector<int>& ans) {
    int cur = 0;
    for (Node* child : nd->edge) {
        if (child == par) continue;
        if (cur == parColor) cur = (cur + 1) % maxColor;

        auto it = hm.find(Link(nd,child));
        if (it==hm.end()) {
            it = hm.find(Link(child,nd));
        }
        ans[it->second] = cur;
        dfs(child, nd, cur, maxColor, ans);
        cur = (cur + 1) % maxColor;
    }
}

void solve() {
    int n;
    cin >> n;

    int k = 0;
    int a, b;

    hm.clear();
    graph.clear();
    graph.resize(n);
    for (int i=0; i<n; ++i) graph[i] = new Node(i);
    for (int i=1; i<n; ++i) {
        cin >> a >> b;
        a--, b--;

        graph[a]->edge.push_back(graph[b]);
        graph[a]->degree += 1;

        graph[b]->edge.push_back(graph[a]);
        graph[b]->degree += 1;

        hm[Link(graph[a], graph[b])] = i;
        k = max(k, max(graph[a]->degree, graph[b]->degree));
    }

    vector<int> ans(n);
    dfs(graph[0], NULL, -1, k, ans);
    cout << k << endl;
    for (int i=1; i<n; ++i) {
        cout << ans[i]+1 << endl;
    }
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#if defined(LOCAL_TEST)
    (void)argc;
    freopen(string(argv[0]).append("-test.in").c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
    solve();
}


Measured memory_bytes: 15780
//  Author : Amit Kumar 
//  Date   : Saturday 11 July 2020 05:35:34 PM IST

#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define int int64_t

signed main(void){
#ifdef HELL_JUDGE
    freopen("input","r",stdin);
    freopen("output","w",stdout);
    freopen("error","w",stderr);
#endif 
    ios::sync_with_stdio(false); // FLUSH THE STREAM IF USING puts / printf / scanf/
    cin.tie(nullptr);            // DISABLE FOR INTERACTIVE PROBLEMS
    cout.tie(nullptr);           //
#ifdef HELL_JUDGE
    auto INITIAL_TIME = high_resolution_clock::now();
#endif 
    int l , r , d; 
    cin >> l >> r >> d; 
    int counter{};
    for(int i=1; i<123; ++i){
        counter += (l <= d * i && d * i <= r);
    }
    cout << counter << '\n'; 
#ifdef HELL_JUDGE
    auto FINAL_TIME = high_resolution_clock::now();
    cout << "Time : "
         << duration_cast<milliseconds>(FINAL_TIME-INITIAL_TIME).count() 
         << " ms" << '\n'; 
#endif 
    return 0;
}


Measured memory_bytes: 3632
using System;
using System.Runtime.CompilerServices;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            int K = cin.NextInt();
            int N = cin.NextInt();
            int[] A = cin.ArrayInt(N);
            int ans = 0;
            int x = 0;

            for (int i = N - 1; -1 < i; i--)
            {
                if (i == 0)
                {
                    int z = Math.Abs(K+A[i] - A[N-1]);
                    if (x < z) x = z;
                    ans += z;

                    ans -= x;
                    break;
                }

                int y = Math.Abs(A[i-1] - A[i]);
                if (x < y) x = y;
                ans += y;
            }
            Console.WriteLine(ans);
        }
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 43104
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

bool isp(int n) {
	for (int i = 2; i <= sqrt(n); ++i) {
		if (n%i == 0) { return 0; }
	}
	return 1;
}

int n, mon;
int main() {
	cin >> n;

	for (int i = 6; i <= 55555; i += 5) {
		if (isp(i)) {
			cout << i << " ";
			++mon;
		}
		if (mon == n) { break; }
	}
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
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")
    };
}

#[allow(dead_code)]
const MOD: u64 = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        A: chars,
        S: chars,
        C: chars
    }
    println!("A{}C", S[0]);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,k;
    cin>>n>>k;
    ve <ll> arr(n);
    ll ans=0;
    rep (i,0,n)
    {
        cin>>arr[i];
        if (arr[i]>=k)
        {
            ans++;
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 1024
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <ctype.h>
typedef long long ll;
const int MYINF = 1e9+7;

#define len 30
static int count[len];

int main(int argc, char **argv)
{
	int c, i;
	while ((c = getchar()) != EOF) {
		if (isalpha(c)) {
			count[tolower(c) - 'a']++;
		}
	}
	for (i = 0; i <= 'z' - 'a'; i++) {
		printf("%c : %d\n", 'a' + i, count[i]);
	}
	return 0;
}

Measured memory_bytes: 524
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define INF 10000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	int N, A, B;
	char S[200001];
	int i;
	int ans[200001];
	int a = 1, b = 1;
	int c = 0;
	
	scanf("%d %d %d", &N, &A, &B);
	scanf("%s", S);
	for(i=0;i<N;i++) {
		if(S[i] == 'a') {
			if(c < A + B) {
				ans[i] = 1;
				c++;
			} else {
				ans[i] = 0;
			}
			a++;
		} else if(S[i] == 'b') {
			if(c < A + B && b <= B) {
				ans[i] = 1;
				c++;
			} else {
				ans[i] = 0;
			}
			b++;
		} else {
			ans[i] = 0;
		}
	}
	
	for(i=0;i<N;i++) {
		if(ans[i]) printf("Yes\n");
		else printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fora(i,a,b) for(int i=a,Wub=b;i<Wub;++i)
#define ford(i,a,b) for(int i=a,Wub=b;i>=Wub;--i)
#define SPEEDIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 1000000
#define MOD 1073741824
using namespace std;
typedef long long ll;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d)<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;long long k,I,A,xy,x[2],fib[2],a,i;double D;int dp[3],h;int main(){cin>>k;a=sqrt(k)/16;xy=(long long)(2*sqrt(k-a-0.01))-1;A=(xy+2)*(xy+2)/4;I=(xy+1)*(xy+1)/4+1;D=1.0*(A+I)/2;if(k<=D){x[1]=(k-I)*2;}else{x[1]=(A-k)*2+1;}x[0]=xy-x[1];for(h=0;h<2;h++){if(x[h]<3){fib[h]=x[h]+1;}else{dp[0]=1;dp[1]=2;dp[2]=3;for(i=3;i<=x[h];i+=3){dp[0]=(dp[1]+dp[2])%M;dp[1]=(dp[2]+dp[0])%M;dp[2]=(dp[0]+dp[1])%M;}fib[h]=dp[x[h]%3];}}cout<<(fib[0]*fib[1])%M<<endl;}

Measured memory_bytes: 3092
col = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 5000]
nums = [0 for _ in range(9)]
N = int(input())
a = list(map(int, input().split()))
for x in a:
    for i in range(9):
        if x < col[i]:
            nums[i] += 1
            break
cnt = 0
for i in range(8):
    if nums[i] > 0:
        cnt += 1
print(max(cnt, 1), cnt+nums[8])

Measured memory_bytes: 3064
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n,k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
a.sort!

plusc = a.count{|e| e > 0}
minusc = a.count{|e| e < 0}
has_zero = a.any?{|e| e == 0}

if plusc == 0 && k.odd?
  if has_zero
    puts 0
  else
    ans = 1
    k.times do |i|
      ans = ans * a[-i-1] % MOD
      # ans = ans % MOD if i.even?
    end
    ans = (ans + MOD) % MOD
    puts ans
  end
  exit
end
# -------


ans = 1
l = 0
r = n - 1

while l + (n-1-r) + 2 <= k
  lmul = a[l] * a[l+1]
  rmul = a[r-1] * a[r]
  if lmul > rmul || (plusc <= 2 && k.odd?)
    ans = ans * lmul % MOD
    l += 2
    minusc -= 2
  else
    ans = ans * rmul % MOD
    r -= 2
    plusc -= 2
  end
  # p [[l, r], [lmul, rmul], ans]
end

if l + (n-1-r) < k
  ans = [ans * a[l], ans * a[r]].max
end

ans = (ans + MOD) % MOD
puts ans


Measured memory_bytes: 36356
# 全ての数字に対してn桁目のbitが立っているかを調べる
N = int(input())
A = list(map(int, input().split()))

ans = 0
mod = 10**9 + 7
for i in range(61):
    # n桁目のbitが立っているかを確認する
    bit = 1 << i
    count = 0
    for a in A:
        if bit & a > 0:
            count += 1
    ans += 2**i * (count) * (N-count) % mod
print(ans % mod)


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

int main() {
	string s;cin>>s;
	for(int i=0;i<4;i++){
		cout<<s[i];
	}
	cout<<' ';
	for(int i=4;i<12;i++){
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 100000

typedef struct {
  char mark;
  int num;
} TRP;

TRP CARD[N],store[N];

int patition(int p,int r){
  int i,j;
  TRP X,V;

  X = CARD[r];
  i = p - 1;
  for(j = p;j < r;j++){
    if(CARD[j].num <= X.num){
      i = i + 1;
      V = CARD[i];
      CARD[i] = CARD[j];
      CARD[j] = V;
    }
  }
  V = CARD[i+1];
  CARD[i+1] = CARD[r];
  CARD[r] = V;
  return i+1;
}

void QuickSort(int p,int r){
  int q;
  if(p < r){
    q = patition(p,r);
    QuickSort(p,q-1);
    QuickSort(q+1,r);
  }
}

void merge(int left,int mid,int right){
  int i,j,k,n1,n2;

  n1 = mid - left;
  n2 = right - mid;

  TRP L[n1],R[n2];

  for(i = 0;i < n1;i++) L[i] = store[left + i];
  for(i = 0;i < n2;i++) R[i] = store[mid + i];

  L[n1].num = R[n2].num = 1000000005;

  i = 0; j = 0;
  for(k = left;k < right;k++){
    if(L[i].num <= R[j].num){
      store[k] = L[i];
      i++;
    }
    else {
      store[k] = R[j];
      j++;
    }
  }
}

void mergeSort(int left,int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,mid,right);
  }
}

int main(){
  int n,i,stable = 1;

  scanf("%d",&n);

  for(i = 0;i < n;i++){
     scanf("%s%d",&CARD[i].mark,&CARD[i].num);
     store[i] = CARD[i];
   }

  QuickSort(0,n-1);
  mergeSort(0,n);

  /*for(i = 0;i < n;i++){
    for(l = i+1;l < n;l++){
      if(CARD[i].num == CARD[l].num){
        same = 1;
        for(j = k;j < n;j++){
          if(CARD[i].num == store[j].num){
            for(k = j+1;k < n;k++){
              if(store[j].num == store[k].num){
                printf("%c %c %c %c\n",CARD[i].mark,store[j].mark,CARD[l].mark,store[k].mark);
                printf("%d %d %d %d\n",CARD[i].num,store[j].num,CARD[l].num,store[k].num);
                if(CARD[i].mark != store[j].mark || CARD[l].mark != store[k].mark){
                  flag = 1;
                }
                break;
              }
            }
            break;
          }
        }
        break;
      }
      else k = 0;
    }
  }
  if(same == 0 || flag == 0) printf("Stable\n");
  else printf("Not stable\n");
  */

  for(i = 0;i < n;i++){
    if(CARD[i].mark != store[i].mark) stable = 0;
  }

  if(stable) printf("Stable\n");
  else printf("Not stable\n");

  for(i = 0;i < n;i++) printf("%c %d\n",CARD[i].mark,CARD[i].num);

  return 0;
}



Measured memory_bytes: 4084
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		try (Scanner s = new Scanner(System.in)) {
			int n = s.nextInt();
			int k = s.nextInt();
			int[] b = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
			for (int i = 0; i < k; i++) {
				b[s.nextInt()] = -1;
			}
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < 10; i++) {
				if (b[i] != -1) {
					sb.append(b[i]);
				}
			}
			String target = sb.toString();
			boolean found = false;
			while (!found) {
				String str = String.valueOf(n);
				int len = str.length();
				int i = 0;
				for (i = 0; i < len; i++) {
					if (!target.contains("" + str.charAt(i))) {
						break;
					}
				}
				if (i == len) {
					found = true;
				} else {
					n++;
				}
			}
			if (found) {
				System.out.println(n);
			}
		}
	}
}


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

int main ()
{
    int D;
    cin >> D ;
    switch(D){
        case 22:
        cout << "Christmas Eve Eve Eve" << endl;
        break;
        case 23:
        cout << "Christmas Eve Eve" << endl;
        break;
        case 24:
        cout << "Christmas Eve" << endl;
        break;
        case 25:
        cout << "Christmas" << endl;
        break;
        default:
        break;
    }

    
}












Measured memory_bytes: 256
#include <stdio.h>

int main()
{   char s[20];
    scanf("%s",s);
    printf("%c%c%c%c%c %c%c%c%c%c%c%c %c%c%c%c%c\n",
    s[0],s[1],s[2],s[3],s[4],s[6],s[7],s[8],s[9],s[10]
    ,s[11],s[12],s[14],s[15],s[16],s[17],s[18],s[19]);

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
  int x, y, r, tmp;

  scanf("%d%d", &x, &y);

  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }

  while(1){
    r = x % y;
    if (r == 0){
      break;
    }
    x = y;
    y = r;
  }

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

  return 0;
}


Measured memory_bytes: 2120
#define ll long long
#define pb push_back
#define make_pair mp
#define first f
#define second s
#define upper_bound ub
#define lower_bound lb
#define MOD 1000000007
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


#define ordered_set tree<pair<ll,ll> , null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>ll fn

ll n,m;
vector<vector<ll> > g(200005);
bool vis[200005];
void dfs(ll ver, ll &cnt){
    vis[ver]=1;cnt++;
    for(ll i=0;i<g[ver].size();i++){
        if(vis[g[ver][i]]==0){
            dfs(g[ver][i],cnt);
        }
    }
}
void solve(){
    cin>>n>>m;
    memset(vis,0,sizeof(vis));
    for(ll i=1;i<=m;i++){
        ll x,y;cin>>x>>y;
        g[x].pb(y);g[y].pb(x);
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(vis[i]==0){
            ll cnt=0;
            dfs(i,cnt);
            ans=max(ans,cnt);
        }
    }
    cout<<ans;
}

int main ()
{
  ios_base::sync_with_stdio (false);
  cin.tie (NULL);
  ll t;
  //cin>>t;
  t = 1;
  while (t)
    {
      solve();t--;
      //cout<<"end of test case"<<endl;
    }
  return 0;
}


Measured memory_bytes: 23764
#include <queue>
#include <vector>
#include <cstring>
#include <iostream>
using namespace std;
int H, W, ax, ay, bx, by, x[52][52], dp[52][52][52][52];
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int main() {
	while(cin >> W >> H >> ax >> ay >> bx >> by) {
		for(int i = 0; i < H + 2; i++) {
			for(int j = 0; j < W + 2; j++) {
				x[i][j] = 1;
				if(i && i != H + 1 && j && j != W + 1) scanf("%d", &x[i][j]);
			}
		}
		for(int i = 0; i < H + 2; i++) {
			for(int j = 0; j < W + 2; j++) {
				for(int k = 0; k < H + 2; k++) {
					for(int l = 0; l < W + 2; l++) dp[i][j][k][l] = -1;
				}
			}
		}
		dp[ay][ax][by][bx] = 0;
		queue<vector<int> > que; que.push({ax, ay, bx, by});
		bool flag = false;
		while(!que.empty()) {
			vector<int> v1 = que.front(); que.pop();
			for(int i = 0; i < 4; i++) {
				vector<int> v2 = v1;
				if(!x[v1[1] + dy[i]][v1[0] + dx[i]]) v2[0] += dx[i], v2[1] += dy[i];
				if(!x[v1[3] - dy[i]][v1[2] - dx[i]]) v2[2] -= dx[i], v2[3] -= dy[i];
				if(v2[0] == v2[2] && v2[1] == v2[3]) {
					flag = true; break;
				}
				if(dp[v2[1]][v2[0]][v2[3]][v2[2]] == -1) {
					dp[v2[1]][v2[0]][v2[3]][v2[2]] = dp[v1[1]][v1[0]][v1[3]][v1[2]] + 1;
					que.push(v2);
				}
			}
			if(flag) {
				cout << dp[v1[1]][v1[0]][v1[3]][v1[2]] + 1 << endl; break;
			}
		}
		if(!flag) cout << "NA" << endl;
	}
}

Measured memory_bytes: 32424
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;

    FOR(i,1,50001){
        if((int)floor(i*1.08) == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

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

int main(void){
    string strN;
    int K;
    cin >> strN;
    cin >> K;
    int res = 0;
    vector<int> firstKofN;
    vector<int> posfKoN;

    int nonzerobuf = 0;
    int numdigits = 0;
    int lenN = strN.length();
    if(lenN < K){
        cout << 0 << endl;
        return 0;
    }
    for(char e: strN){
        if(e != '0'){
            nonzerobuf++;
            firstKofN.push_back(e-'0');
            posfKoN.push_back(numdigits);
        }
        if(nonzerobuf >= K)break;
        numdigits++;
    }

    if(firstKofN.size()<K){
        for(int i=firstKofN.size(); i<K; i++){
            firstKofN.push_back(0);
            posfKoN.push_back(lenN-1);
        }
    }

    int resbuf = firstKofN[K-1];
    res += resbuf;

    resbuf = 1;
    if(K>1)resbuf = firstKofN[K-2]-1;
    resbuf *= 9*(lenN-posfKoN[(K-2 < 0 ? 0 : K-2)]-1);
    res += resbuf;

    if(K>1){
        resbuf = 1;
        if(K==3)resbuf*=firstKofN[0]-1;
        resbuf *= 81*(lenN-1)*(lenN-2)/2;
        res += resbuf;
        resbuf = 9*(lenN-posfKoN[K-1]-1);
        res += resbuf;
    }
    if(K>2){
        resbuf = 729*(lenN-1)*(lenN-2)*(lenN-3)/6;
        res += resbuf;
        resbuf = 81*(lenN-posfKoN[K-2]-1)*(lenN-posfKoN[K-2]-2)/2;
        res += resbuf;
    }


    cout << res << endl;

    return 0;
}

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

int main () {
	int takasa[10];

	for(int i = 0; i < 10; i++){
		cin >> takasa[i];
	}
	
	//sort
	/*for(int i = 0; i < 9; i++){
		for(int j = i + 1; j < 10; j++){
			if(takasa[i] < takasa[j]){
				swap(takasa[i],takasa[j]);
			}
		}
	}*/

	sort(&takasa[0],&takasa[10]);

	for(int i = 0; i < 3; i++){
		cout << takasa[9-i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1176
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main
{
	static Set<Integer> xSet = new TreeSet<>(), ySet = new TreeSet<>();
	static int a,b,c,d,e,f;

	public static void main(String[] args)
	{
		try(Scanner sc = new Scanner(System.in))
		{
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			d = sc.nextInt();
			e = sc.nextInt();
			f = sc.nextInt();
		}

		for(int i = 0;;i++)
		{
			boolean flag = false;
			for(int j = 0;; j++)
			{
				int x = 100*a*i + 100*b*j;
				if(x > f) break;
				xSet.add(x);
				flag = true;
			}
			if(!flag) break;
		}

		for(int i = 0;;i++)
		{
			boolean flag = false;
			for(int j = 0;; j++)
			{
				int y = c*i + d*j;
				if(y > f) break;
				ySet.add(y);
				flag = true;
			}
			if(!flag) break;
		}

		float max = -1.0f;
		int maxWater = 0, maxSuger = 0;
		for(int water : xSet)
		{
			for(int suger : ySet)
			{
				if(water + suger > f || suger * 100.0f > e * water) break;
				if(max < (100.0f * suger) / (water + suger))
				{
					max = (100.0f * suger) / (water + suger);
			        maxWater = water;
			        maxSuger = suger;
				}
			}
		}

		System.out.println((maxWater + maxSuger) + " " + maxSuger);
	}

}


Measured memory_bytes: 28208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  
  vector<int> A(Q);
  for(int i =0; i < Q; i ++){
    cin >> A.at(i);
  }
  
  vector<int> score(N);
  for (int i = 0; i < N; i++) {
    score.at(i) = K;
  }
  vector<int> score_get(N);
  for (int i = 0; i < Q; i++){
  	score_get.at(A.at(i) - 1)++;
  }
  for (int  i = 0; i < N; i++) {
    if (Q - score_get.at(i) < score.at(i)) cout << "Yes" << endl;
    if (Q - score_get.at(i) >= score.at(i)) cout << "No" << endl;
  } 
}
 

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

int main() {
  int x, y;
  cin >> x >> y;
  vector<int> a = {1, 3, 5, 7, 8, 10, 12};
  vector<int> b = {4, 6, 9, 11};
  bool ans = false;
  rep(i, a.size()) {
    if (x == a.at(i)) {
      rep(j, a.size()) {
        if (y == a.at(j)) ans = true;
      }
    }
  }
  rep(i, b.size()) {
    if (x == b.at(i)) {
      rep(j, b.size()) {
        if (y == b.at(j)) ans = true;
      }
    }
  }
  if (ans == true) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld double
#define ff first
#define ss second
ll mod = 1000000007;
ll dp[2][10000000+1];
void fun(){
	vector<int> v(3);
	cin>>v[0]>>v[1]>>v[2];
	sort(v.begin(),v.end());
	if(v[0]+v[1]==v[2]) cout<<"Yes\n";
	else cout<<"No\n";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t=1; //cin>>t;
	while(t--){
		fun();
	}
	return 0;
}


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

using namespace std;

int main()
{
	int D, G;
	cin >> D >> G;
	vector < int >p(D), c(D);
	for (int i = 0; i < D; i++) {
		cin >> p[i] >> c[i];
	}

	int ans = INT_MAX;
	for (int bits = 0; bits < (1 << D); bits++) {
		int score = 0;
		int num = 0;
		int resultMax = -1;
		for (int i = 0; i < D; i++) {
			if (bits >> i & 1) {
				score += 100 * (1 + i) * p[i] + c[i];
				num += p[i];
			} else {
				resultMax = i;
			}
		}

		if (score < G) {
			int s1 = 100 * (resultMax + 1);
			int need = (G - score + s1 - 1) / s1;
			if (need >= p[resultMax]) {
				continue;
			}
			num += need;
		}
		ans = min(ans, num);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  vector<ll> va(n + 1);
  for (int i = 0; i < n + 1; ++i) {
    cin >> va[i];
  }

  ll a_sum = accumulate(va.begin(), va.end(), 0ll);

  ll base = 1;
  ll ans = 0;
  bool ok = true;
  for (int i = 0; i < va.size(); ++i, base = min(base * 2ll, a_sum)) {
    ans += base;
    base -= va[i];
    a_sum -= va[i];

    if (base < 0) {
      ok = false;
      break;
    }
  }

  ans += base;

  if (!ok) {
    cout << -1 << '\n';
  } else {
    cout << ans << '\n';
  }

  return 0;
}

Measured memory_bytes: 4052
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

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

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N, A, B, C;
vec l;

int calc(int a, int b, int c, int n) {
  if (n == N) {
    if (a * b * c != 0) {
      return abs(A - a) + abs(B - b) + abs(C - c);
    } else {
      return INF;
    }
  }

  int res = INF;

  if (a)
    chmin(res, calc(a + l[n], b, c, n + 1) + 10);
  else
    chmin(res, calc(a + l[n], b, c, n + 1));

  if (b)
    chmin(res, calc(a, b + l[n], c, n + 1) + 10);
  else
    chmin(res, calc(a, b + l[n], c, n + 1));

  if (c)
    chmin(res, calc(a, b, c + l[n], n + 1) + 10);
  else
    chmin(res, calc(a, b, c + l[n], n + 1));

  chmin(res, calc(a, b, c, n + 1));

  return res;
}

signed main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    l.push_back(tmp);
  }

  cout << calc(0, 0, 0, 0) << endl;
  return 0;
}


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

int main(void)
{
    int h, a;
    cin >> h >> a;
    int i=0;
    for(i=0; h > 0; i++)
    {
        h -= a;
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 256
n, k ,s = gets.split.map(&:to_i)
a = []
x = 10**9
if s == x
  k.times{a << s}
  (n-k).times{a << s-1}
else
  k.times{a << s}
  (n-k).times{a << s+1}
end
puts a.join(' ')


Measured memory_bytes: 16240
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

int ans[maxn];
int32_t main(){
	fastio();
	int n , x , y;
	cin >> n >> x >> y;
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= n; j++){
			int dis = min(abs(j - i), abs(x - i) + 1 + abs(j - y));
			ans[dis]++;
		}
	}
	for(int i = 1; i <= n - 1; i++){
		cout << ans[i] << "\n";
	}
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> c(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    c[a].push_back(b);
    c[b].push_back(a);
  }

  queue<int> q;
  vector<int> g(n, -1);
  q.push(0);
  g[0] = 0;
  while (!q.empty()) {
    int ni = q.front(); q.pop();
    auto x = c[ni];
    rep(i,x.size()) {
      if (g[x[i]] == -1) {
        q.push(x[i]);
        g[x[i]] = ni;
      }
    }
  }
  string ans = "Yes";
  rep(i,n) if (g[i] == -1) ans = "No";
  cout << ans << endl;
  if (ans == "Yes") {
    for (int i = 1; i < n; ++i) cout << ++g[i] << endl;
  }
  

  return 0;
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e17;
// Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    Int a, b;
    cin >> a >> b;
    dump(b % a == 0 ? a + b : b - a);
    return 0;  
} 

Measured memory_bytes: 256
#import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

from collections import deque

def main():
	n,m=MI()

	G=[[] for _ in range(n+1)]

	for _ in range(m):
		a,b=MI()
		G[a].append(b)
		G[b].append(a)

	ans=[0]*(n+1)

	Q=deque([1])
	sumi=set()

	while Q:
		now=Q.popleft()

		for next in G[now]:
			if next in sumi:
				continue
			else:
				Q.append(next)
				ans[next]=now
				sumi.add(next)

	print("Yes")

	print(*ans[2:],sep="\n")






































if __name__ == "__main__":
	main()


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

int frog(int num,vector<int> h){
    vector<int> result(num);
    result[0] = 0;
    result[1] = abs(h[0] - h[1]);
    if (num > 2){
        for(int i = 2;i < num;i++){
            result[i] = min(result[i-1]+abs(h[i-1]-h[i]),result[i-2]+abs(h[i-2]-h[i]));
        }
    }
    return result[num-1];
}

int main(){
    int N;
    cin >> N;
    vector<int> h(N);
    for(int i = 0;i < N;i++){
        cin >> h[i];
    }
    int unko = frog(N,h);
    cout << unko << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int l,r,ans=1e9;
int main()
{
	cin>>l>>r;
	if(r-l>=2019)cout<<0;
	else
	{
		l%=2019,r%=2019;
		if(r<l)r+=2019;
		for(int i=l;i<=r;i++)
			for(int j=i+1;j<=r;j++)
				ans=min(ans,(i*j)%2019);
		cout<<ans;
	}
}

Measured memory_bytes: 256
// in the name of Allah

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

#define inf 1e9
#define max_n 123456
#define mod 1000000007

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

int n;
ll a[500];
ll sum[500];
ll dp[500][500];

ll memo(int L, int R) {
	if(L == R) return 0;
	if(L+1 == R) return a[L] + a[R];
	if(dp[L][R] != -1) return dp[L][R];
	ll res = 1e18;
	for(int i=L; i<R; i++) {
		res = min(res, sum[R] - sum[L-1] + memo(L, i) + memo(i+1, R));
	}
	return dp[L][R] = res;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	sum[0] = 0;
	for(int i=1; i<=n; i++) {
		cin >> a[i];
		sum[i] = sum[i-1] + a[i];
	}
	memset(dp, -1, sizeof dp);
	cout << memo(1, n) << endl;
	return 0;
}

Measured memory_bytes: 2304
#include <stdio.h>
#include <string.h>
int main()
{
    int n;
    int i,j,k,t,a,b;
    int namenagasa,kanbannagasa;
    int cnt=0;
    char name[26],kanban[201] ;
    scanf("%d",&n);
    scanf("%s",name);
    namenagasa=strlen(name);
    for(i=0;i<n;i++){
        scanf("%s",kanban);
        kanbannagasa=strlen(kanban);
        for(j=0;j<kanbannagasa; j++){
            for(k=1;j+(namenagasa-1)*k<kanbannagasa;k++){
				a=0;
				b=0;
                for( t=0;t<namenagasa;t++){
                    if(kanban[j+t*k]!=name[t]){
						a=1;
						break;
				    }
                }
				if(a==0){
                	cnt++;
					b=1;
					break;
				}
		    }
			if(b==1){
				break;
			}
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


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

    int t=1,te=0;
    // cin>>t;
    while(t--){
        ll x,c=0ll;
        cin>>x;

        while(x>=1){
            x/=2ll;
            ++c;
        }   

        ll res=0ll;

        for(ll i=0;i<c;++i){
            res+= (1ll<<i);
        }

        printf("%lld\n", res);


        //printf("Case %d: ",++te);
    }
    return 0;
}

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

long long int n,i,a[200010],k,ans,p[200010];
long double x;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>k;
	for (i=1;i<n+1;i++) cin>>a[i];
	p[0]=0;
	for (i=1;i<n+1;i++) p[i]=p[i-1]+a[i];
	ans=0;
	for (i=k;i<n+1;i++) ans=max(ans,p[i]-p[i-k]);
	ans=ans+k;
	x=(double)ans/2;
	cout<<setprecision(13)<<fixed<<x;
}


Measured memory_bytes: 3328
N,K = map(int,input().split())
S = list(input())

ch = 0
ans = 0

if N != 1:
    for i in range(N):
        if i == 0:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R':
                ans += 1
        elif i == N-1:
            if S[i] == S[i-1] == 'L':
                ans += 1
        else:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
                ans += 1

print(ans+min(K*2,ch))


Measured memory_bytes: 4084