akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
        int n;
        int p[20000];
        cin>>n;
        for(int i=0; i<n; i++){
                cin>>p[i];
                p[i]--;
        }

        int ai[19999], bi[19999];
        for(int i=0; i<n; i++){
                int inc=i+1;
                int pc=p[i];
                if(pc!=0) ai[pc-1]=inc;
                if(pc!=n-1) bi[pc]=inc;
        }

        int a[20000];
        a[0]=1;
        for(int i=1; i<n; i++) a[i]=a[i-1]+ai[i-1];

        int b[20000];
        b[n-1]=1;
        for(int i=n-2; i>=0; i--) b[i]=b[i+1]+bi[i];

        for(int i=0; i<n; i++) cout<<a[i]<<" ";
        cout<<endl;
        for(int i=0; i<n; i++) cout<<b[i]<<" ";
        cout<<endl;

        return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => {
        #[cfg(debug_assertions)]
        eprintln!(">>> {} = {:?}", stringify!($x), $x)
    };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! flush {
    () => {
        std::io::stdout().flush().unwrap();
    };
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let s: String = sc.cin();
    if s.ends_with("s") {
        println!("{}es", s);
    } else {
        println!("{}s", s);
    }
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
int main(){IOS;
	int n;
	cin>>n;
	ll ans=0;
	ll mx=0;
	for(int i=0;i<n;i++){
	 ll a;
	 cin>>a;
	 mx=max(mx,a);
	 ans+=mx-a;}
	 cout<<ans<<endl;}

Measured memory_bytes: 3656
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

int N;
ll T[110], cur_GCD, cur_LCM;

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

int main() {
	rd(N);
	repi(i, 0, N) rd(T[i]);
	if (N == 1) { 
		wrln(T[0]);
		return 0;
	}
	repi(i, 1, N) {
		ll a, b;
		if (i == 1) a = T[0];
		else a = cur_LCM;
		b = T[i];
		(a > b) ? cur_GCD = gcd(a, b) : cur_GCD = gcd(b, a);
		cur_LCM = (a / cur_GCD)*(b / cur_GCD)*cur_GCD;
	}
	wrln(cur_LCM);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        long count = 0;
        int n = int.Parse(Console.ReadLine());
        int[] arr = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        Dictionary<int, int> map = new Dictionary<int, int>();
        for(int i = 0; i < n; i++)
        {
            if (!map.ContainsKey(arr[i] + i))
            {
                map.Add(arr[i] + i, 1);
            }
            else map[arr[i] + i]++;
            if (map.ContainsKey(i - arr[i]))
            {
                count += map[i - arr[i]];
            }
        }
        Console.WriteLine(count);
        

    }




}





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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<(vi==INF?"_":to_string(vi))<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,m;
  cin>>n>>m;
  vector<vector<ll>> adj(n),rev(n);
  vector<ll> deg(n);
  rep(i,n-1+m){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    adj[a].emplace_back(b);
    rev[b].emplace_back(a);
    deg[b]++;
  }

  ll r = -1;
  rep(i,n)if(deg[i]==0)r=i;

  stack<ll> st;
  st.emplace(r);
  vector<ll> sorted_v;
  vector<ll> par(n,-1);
  sorted_v.reserve(n);
  while(!st.empty()){
    ll v = st.top();
    st.pop();
    sorted_v.emplace_back(v);
    for(auto nv:adj[v]){
      deg[nv]--;
      if(deg[nv]==0){
        st.emplace(nv);
        par[nv] = v;
      }
    }
  }

  rep(i,n){
    cout<<(par[i]+1)<<endl;
  }


}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e5+11;
ll const LG=(ll)log2(N)+1;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>x>>n;
        set<ll> s;
        for(i=0;i<n;i++){
                cin>>y;
                s.insert(y);
        }
        ll ans=200;
        ll tt=-200;
        for(i=-200;i<=200;i++){
                if(s.find(i)==s.end()){
                        if(abs(x-i)<ans){
                                ans=abs(x-i);
                                tt=i;
                                // cout<<tt<<endl;
                        }
                }
        }
        cout<<tt<<endl;
        
       
}   
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 3652
/**
*    author:  yuya1234
*    created: 14.07.2020 15:32:32
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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 (b<a) { a=b; return 1; } return 0; }
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

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

  int n;
  cin>>n;

  string s[n];
  REP(i,n)cin>>s[i];

  int a[26][n];
  REP(i,26)REP(j,n)
  {
    a[i][j]=0;
  }

  REP(i,n)
  {
    REP(j,SZ(s[i]))
    {
      a[s[i][j]-'a'][i]++;
    }
  }

  string ans="";
  int cnt;
  REP(i,26)
  {
    cnt=INT_MAX;
    REP(j,n)
    {
      cnt=min(cnt,a[i][j]);
    }
    REP(k,cnt)
    {
      ans+=char(i+'a');
    }
  }
  
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3648
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 1e9+7;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 5e5+5;

int32_t main(){
   
   speed_cubing

   int l,r,d;
   cin>>l>>r>>d;

   int cnt = 0;

   for(int i=1;i<=100;i++){
      if(d*i>=l && d*i<=r)
        cnt++;
   }

   cout<<cnt;
             
    
   return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<pair<string,int>> str;
    string S;
    while(cin >> S){
        int d;
        cin >> d;
        str.push_back(make_pair(S,d));
    }
    sort(str.begin(),str.end());
    int N = str.size();
    for(int i=0; i<N; i++){
        cout << str[i].first << enld;
        cout << str[i].second;
        while(i+1<N and str[i].first == str[i+1].first){
            i++;
            cout << " " << str[i].second;
        }
        cout << enld;
    }
    return 0;
}


Measured memory_bytes: 3136
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji Rabbi Minkulli Jamio
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define MX 1000007
int i,j,k;
main()
{
 int l,r,d;int c=0;
 cin>>l>>r>>d;
 for(i=l;i<=r;i++)
 {
     if(i%d==0)c++;
 }
 cout<<c<<endl;
}


Measured memory_bytes: 3632
#!/usr/bin/python3

import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

#N = int(input())
#A = [int(x) for x in input().split()]
#V = [[0] * 100 for _ in range(100)]

X,Y = [int(x) for x in input().split()]

n = X
ans = 0
while n <= Y:
    n *= 2
    ans += 1

print(ans)


Measured memory_bytes: 3064
#include <atcoder/dsu>
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
	int n, q; cin >> n >> q;
	atcoder::dsu uf(n);
	for (int i = 0; i < q; ++i) {
		int t, u, v; cin >> t >> u >> v;
		if (t == 0) uf.merge(u, v);
		else if (uf.same(u, v)) printf("1\n");
		else printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 3908
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	string s;
	cin >> s;
	cout << s[0] << s.length()-2 << s[s.length()-1];
	
	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
public:
  ll *fac,*finv,*inv;
  Comb(){
    fac = new ll[1000001];
    finv = new ll[1000001];
    inv = new ll[1000001];
    fac[0] = 1;
    for(int i=1;i<1000001;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000001;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000001;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int n;
  cin >> n;
  ll a[n];
  ll temp;
  int koubai[1000000];
  for(int i=0;i<n;i++) cin >> a[i];
  for(int k=2;k<1000000;k++) koubai[k] = 0;
  for(int i=0;i<n;i++){
    temp = a[i];
    int divide[1000];
    for(int k=2;k<1000;k++) divide[k] = 0;
    for(int k=2;k<1000;k++){
      while(temp%k == 0){
        divide[k]++;
        temp /= k;
      }
    }
    for(int k=2;k<1000;k++){
      koubai[k] = max(koubai[k],divide[k]);
    }
    koubai[temp] = 1;
  }

  ll ans = 0;
  ll L = 1;
  ll value = 0;
  for(int k=2;k<1000000;k++){
    if(koubai[k] == 0) continue;
    for(int j=0;j<koubai[k];j++){
      L *= k;
      L %= MOD;
    }
  }

  Comb comb;
  for(int i=0;i<n;i++){
    value = comb.inv[a[i]];
    value %= MOD;
    value *= L;
    value %= MOD;

    ans += value;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 27648
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

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

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: i64,
      a: i64,
      b: i64,
    }
    let x = min(a, b);
    let y = max(a+b-n, 0);
    println!("{} {}", x, y);
}


Measured memory_bytes: 4352
import java.util.*;

class Point{
  private long i;
  private long j;

  Point(long i,long j){
    this.i=i;
    this.j=j;
  }

  public long getter(){
    return (this.i-1)+(this.j-1);
  }
}

class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    long N=scan.nextLong();
    int k=0;
    Point[] points=new Point[10*10*10*10*10*10];
    for(long i=1;i<=(N/i);i++){
      if(N%i==0){
        long j=N/i;
        points[k++]=new Point(i,j);
      }
    }
    long min=points[0].getter();
    for(int i=0;i<k;i++){
      if(min>points[i].getter()){
        min=points[i].getter();
      }
    }
   System.out.println(min);
  }
}

Measured memory_bytes: 26068
def cin():  return list(map(int,input().split()))

a, b, c, d = cin()
ans1 = a * c
ans2 = a * d
ans3 = b * c
ans4 = b * d
ans = max(ans1, ans2, ans3, ans4)
if((a <= 0 and b >= 0) or (c <= 0 and d >= 0)): ans = max(ans, 0)
print(ans)

Measured memory_bytes: 61700
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		if (k % 2 == 0) {
			System.out.println(-1);
			return;
		}
		int p = 7;
		for (int i = 1; i < 1000000; i++) {
			if (p % k == 0) {
				System.out.println(i);
				return;
			}
			p = (10 * p + 7) % k;
		}
		System.out.println(-1);
	}

}


Measured memory_bytes: 36044
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(void){
	int N; cin >> N;
	string c; cin >> c;
	vector<int> acc_r(N + 1, 0);
	for (int i = 1; i <= N; ++i){
		if (c[i - 1] == 'R')
			acc_r[i] = acc_r[i - 1] + 1;
		else acc_r[i] = acc_r[i - 1];
	}
	int res = (1 << 30); // INF
	for (int b = 0; b <= N; ++b){
		int lw = b - acc_r[b];
		int rr = acc_r[N] - acc_r[b];
		res = min(res, lw + rr - min(lw, rr));
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 2019;

ll nums[MOD + 5];

int main() {
    string s;
    cin >> s;
    int n = s.size();
    nums[0] = 1;
    ll num = 0, t = 1;
    for (int i = n - 1; i >= 0; i--, t *= 10) {
        t %= MOD;
        num = (num + (s[i] - '0') * t) % MOD;
        nums[num]++;
    }
    ll ans = 0;
    for (int i = 0; i < MOD; i++) {
        ans += nums[i] * (nums[i] - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3768
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v
    print(" ".join(list(map(str, A))))

Measured memory_bytes: 7700
#include<stdio.h>
#define MAX 100000
int parent(int);
int left(int);
int right(int);
int main(){
  int N,i;
  scanf("%d",&N);
  int A[MAX+1];
  for(i=1;i<=N;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=N;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=N)printf("left key = %d, ",A[left(i)]);
    else printf("\n");
    if(right(i)<=N)printf("right key = %d, \n",A[right(i)]);
    else if(left(i)<=N)printf("\n");
  }
}
int parent(int n){
  return n/2;
}
int left(int n){
  return 2*n;
}
int right(int n){
  return (2*n)+1;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for(int i = 0; i < n; i++)
    {
        if(s[i] != t[i])
        {
            cout << "No" << endl;
            return false;
        }
    }
    cout << "Yes" << endl;
}


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

int main() {
    int64_t a = 1, b = 2;
    int n;
    cin >> n;
    for(int i = 0;i < n;i++) {
        int64_t tmp = a;
        a += b;
        b = tmp;
    }
    cout << b << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int w, h;
	int i, j,k,l;
	while (cin >> w >> h) {
		if (w == 0)break;
		int lan[52][52];
		for (i = 0; i < 52; i++) {
			for (j = 0; j < 52; j++) {
				lan[i][j] = 0;
			}
		}
		for (j = 1; j <= h; j++) {
			for (i = 1; i <= w; i++) {
				cin >> lan[i][j];
			}
		}
		int count = 0;
		for (j = 1; j <= h; j++) {
			for (i = 1; i <= w; i++) {
				if (lan[i][j] == 1) {
					count++; lan[i][j] = 0;
					vector<P> q; q.push_back(P { i,j });
					while (!q.empty()) {
						int nx = q[0].first; int ny = q[0].second;
						q.erase(q.begin() + 0);
						for (k = nx - 1; k <= nx + 1; k++) {
							for (l = ny - 1; l <= ny + 1; l++) {
								if (lan[k][l] == 1) {
									q.push_back(P{k,l}); lan[k][l] = 0;
								}
							}
						}
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
	if((S[0]==S[1])&&(S[1]==S[2])){
		cout << "No" << endl;
	}else{
		cout << "Yes"<< endl;
	}

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
#include <math.h>

typedef struct{
  double x;
  double y;
}XY;

void koch(int,XY,XY);
 

int main(){

 
  XY o,k;
  o.x = 0;
  o.y = 0;
  k.x = 100;
  k.y = 0;
  
  int n;
  scanf("%d",&n);
  
  printf("%f %f\n",o.x,o.y);
  koch(n,o,k);
  printf("%f %f\n",k.x,k.y);

   return 0;
}

void koch(int n,XY p1,XY p2){

  XY s,t,u;

  if(n==0)return;

  s.x = (2*p1.x+p2.x)/3;
  s.y = (2*p1.y+p2.y)/3;
  t.x = (p1.x+2*p2.x)/3;
  t.y = (p1.y+2*p2.y)/3;

  u.x = (t.x-s.x)*cos(M_PI/3)-(t.y-s.y)*sin(M_PI/3)+s.x;
  u.y = (t.x-s.x)*sin(M_PI/3)+(t.y-s.y)*cos(M_PI/3)+s.y;


  
  koch(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  koch(n-1,t,p2);
   

}



Measured memory_bytes: 2104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,pair<ll,pair<ll,ll> > > CAKE;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    ll N; cin>>N;
    //x AGC ACG GAC AG?C A?GC
    //0A 1C 2G 3T
    // dp[i][j][k][l]:i文字までみたとき答え(j:i-2 k:i-1 l:i)
    ll dp[101][4][4][4];
    
    rep(m,101)rep(i,4)rep(j,4)rep(k,4) dp[m][i][j][k]=0;
    rep(i,4)rep(j,4)rep(k,4) dp[3][i][j][k]=1;
    dp[3][0][2][1]=0; dp[3][0][1][2]=0; dp[3][2][0][1]=0;
    
    FOR(i,4,N+1){
        //T
        rep(j,4)rep(k,4){ dp[i][j][k][3]=(dp[i-1][0][j][k]+dp[i-1][1][j][k]+dp[i-1][2][j][k]+dp[i-1][3][j][k])%MOD;
        }
        
        //A
        rep(j,4)rep(k,4){ dp[i][j][k][0]=(dp[i-1][0][j][k]+dp[i-1][1][j][k]+dp[i-1][2][j][k]+dp[i-1][3][j][k])%MOD;
        }
        
        //G dp[i-1][?][0][1]->0
        rep(j,4)rep(k,4){
            rep(l,4){
                if(j==0 && k==1){}
                else{
                    dp[i][j][k][2]+=dp[i-1][l][j][k];
                    dp[i][j][k][2]%=MOD;
                }
            }
        }
        
        //C
        //ljk
        //?02
        //?20
        //02?
        //0?2
        rep(j,4)rep(k,4){
            rep(l,4){
                if((j==0 && k==2)||(j==2 && k==0)||(l==0 && j==2)||(l==0 && k==2)){}
                else{
                    dp[i][j][k][1]+=dp[i-1][l][j][k];
                    dp[i][j][k][1]%=MOD;
                }
            }
        }
    }
    
    ll ans=0;
    rep(i,4)rep(j,4)rep(k,4){
        ans+=dp[N][i][j][k];
        ans%=MOD;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  vector<vector<int> > s_alpha(n, vector<int>(26, 0));
  vector<int> min_alpha(26, 999);
  for(int i = 0; i < n; i++){
    cin >> s[i];
    string cur = s[i];
    for(int j = 0; j < cur.length(); j++){
      char t = cur[j] - 'a';
      s_alpha[i][t]++;
    }

    for(int j = 0; j < 26; j++){
      // cout << min_alpha[j] << ", " << s_alpha[i][j] << endl;
      if(min_alpha[j] > s_alpha[i][j]){
        min_alpha[j] = s_alpha[i][j];
      }
    }
  }

  string ans = "";
  for(int i = 0; i < 26; i++){
    for(int j = 0; j < min_alpha[i]; j++){
      char temp = 'a' + i;
      ans.push_back(temp);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val s = sc.next()
    println(abc159b(s))
}

fun abc159b(s: String): String {
    var ans = "No"
    val sb = s.substring(0, (s.length-1)/2)
    val sa = s.substring((s.length+2)/2, s.length)
    if(s.equals(s.reversed())){
        if(sb.equals(sb.reversed())){
            if(sa.equals(sa.reversed())){
                ans = "Yes"
            }
        }
    }
    return ans
}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 31520
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	vector<vector<int>> bingo(3, vector<int>(3));
	vector<vector<int>> grid(3, vector<int>(3, 0));
	int n;
	int temp;

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++){
			cin>>bingo[i][j];
		}
	}
	cin>>n;
	for (int rep = 0; rep < n; rep++) {
		cin>>temp;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++){
				if (bingo[i][j] == temp){
					grid[i][j] = 1;
				}
			}
		}
	}
	for (int i = 0; i < 3; i++) {
		bool hori = 1, vert = 1;
		for (int j = 0; j < 3; j++){
			if(!grid[i][j]){
				hori = 0;
			}
			if(!grid[j][i]){
				vert = 0;
			}
		}
		if (vert||hori){
			cout<<"Yes\n";
			return 0;
		}
	}
	bool dig1 = 1, dig2 = 1;
	for (int i = 0; i < 3; i++) {
		if(!grid[i][2-i]){
			dig1 = 0;
		}
		if(!grid[i][i]){
			dig2 = 0;
		}
	}
	if (dig1||dig2){
		cout<<"Yes\n";
		return 0;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define MOD 1000000007

#define FOR(i, m, n) for (ll i = m; i <= n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)

ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

ll X[100];

int main() {
    ll K;
    cin >> K;
    
    fill(&X[0], &X[100], 0);

    FOR(i, 1, K) {
        ll z = 99;
        while (X[z] == 0) z--;

        ll j = 0;
        while (j < z && X[j] == X[j + 1] + 1) {
            loop:
            j++;
        }
        X[j]++;
        if (X[j] == 10) {
            goto loop;
        }

        FORR(k, j - 1, 0) {
            X[k] = max(X[k + 1] - 1, 0LL);
        }
    }

    ll i = 99;
    while (X[i] == 0) i--;

    FORR(j, i, 0) {
        cout << X[j];
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,m,sum=0,i,x;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>x;
        sum+=x;
    }
    if(n-sum<0)
        cout<<-1<<endl;
    else
        cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
const long double EPS = 1e-9;

const int MAX = 55;
int n, m;
string A[MAX], B[MAX];
char strbuf[MAX];

int main(void) {
    scanf("%d%d", &n, &m);
    REP(i, n) {
        scanf("%s", strbuf);
        A[i] = strbuf;
    }
    REP(i, m) {
        scanf("%s", strbuf);
        B[i] = strbuf;
    }
    bool ok = false;
    REP(i, n) {
        REP(j, n) {
            bool ng = false;
            if (A[i][j] == B[0][0]) {
                REP(k, m) REP(l, m) {
                    int ni = i + k;
                    int nj = j + l;
                    if (!(0 <= ni && ni < n && 0 <= nj && nj < n)) {
                        ng = true;
                        break;
                    }
                    if (A[ni][nj] != B[k][l]) {
                        ng = true;
                        break;
                    }
                }
                if (!ng) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

from collections import defaultdict
d = defaultdict(int)

d[a[0]] = 1
ans = 0
for i in range(1,n):
    ai = a[i]
    ans += d[ i - ai ]
    d[ ai+i ] += 1

print(ans)

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

#define MAXN 200010
#define ll long long

using namespace std;

int n;
ll sl, sr, mini = MAXN;

int a[MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		sr += a[i];
	}
	sl = a[1];
	sr -= a[1];
	mini = abs(sl - sr);
	for (int i = 2; i <= n; i++) {
		sl += a[i]; sr -= a[i];
		mini = min(mini, abs(sl - sr));
	}
	cout << mini << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> Hs(N);
  for(int i = 0; i < N; i++){
    cin >> Hs[i];
  }
  vector<int> dp(N); //1 origin
  dp[0] = 0;
  dp[1] = abs(Hs[1] - Hs[0]);
  for(int i = 2; i < N; i++){
    int M1 = dp[i-1] + abs(Hs[i] - Hs[i-1]);
    int M2 = dp[i-2] + abs(Hs[i] - Hs[i-2]);
    dp[i] = min(M1,M2);
  }

  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
	int  a,b,c;scanf("%d%d",&a,&b);
	if(a >= b)
	{
		for(int i=0;i<a;i++)
		{
			printf("%d",b);
	}
	}
	else
	{
		for(int i=0;i<b;i++)
		{
			printf("%d",a);
		}
	}
	printf("\n");
}


Measured memory_bytes: 256
/*
ID: Aman Raj
LANG: C++
TASK: subset
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
//hr
using namespace std;
using namespace __gnu_pbds;
//hy
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  //# define mod 1e9+7
   ll gcd(ll a,ll b)
   {
       if(a==0)return b;
       return gcd(b%a,a);
   }
//kj
int main()
{
   ll n;cin>>n;
     vector<ll> v(n);
      vector<ll> dp(n,0);
      for(ll i=0;i<n;i++)cin>>v[i];
      ll ans=0;
     vector<ll> s;
     for(ll i=n-1;i>=0;i--)
     { //cout<<i<<" ";
          ll a=v[i];
         auto iter=upper_bound(s.begin(),s.end(),a);
         if(iter==s.end())
         { ans++;
           s.push_back(a);

         }
         else *iter=a;
     }

      cout<<ans;

      return 0;
}


Measured memory_bytes: 2936
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
	int n, t, a, h[1000];
	int tmin, pmin;
	cin >> n >> t >> a;
	t *= 1000;
	a *= 1000;
	cin >> h[0];
	tmin = abs(a - (t - h[0] * 6));
	pmin = 0;
	for(int i = 1;i < n;i++){
		cin >> h[i];
		if(abs(a - (t - h[i] * 6)) < tmin){
			tmin = abs(a - (t - h[i] * 6));
			pmin = i;
		}
	}
	cout << pmin + 1 << endl;
}

Measured memory_bytes: 256
//PLUS ULTRA

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define mp make_pair
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)

typedef long long ll;
typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;



int main(){
    SPEED;

    int n,m; 
    cin >> n >> m;

    cout << (ll)((n*(n-1))/2) + ((m*(m-1))/2) << endl ;

    
    return 0;
}
      
       


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

int main(){
    int N;
    cin >> N;
    vector<long long> v(N);
    for(int i =0; i < N; i++){
        cin >> v[i];
        v[i] = v[i] - (i + 1);
    }
    sort(v.begin(),v.end());
    int index = N/2;
    long long b = v[index];
    long long sum = 0;
    for(int i =0; i < N; i++){
        sum += abs(v[i] - b);
    }
    cout << sum << endl;     
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
ll X[1005], Y[1005], Z[1005];

ll ans = -1e18, sum[1005];
int Solve(bool x, bool y, bool z){
  fill(sum, sum + N, 0);
  for (int i = 0; i < N; i++){
    sum[i] = X[i] * pow(-1, x) + Y[i] * pow(-1, y) + Z[i] * pow(-1, z);
  }
  sort(sum, sum + N, greater<ll>());

  ll res = 0;
  for (int i = 0; i < M; i++) res += sum[i];
  ans = max(ans, res);
  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < N; i++){
    cin >> X[i] >> Y[i] >> Z[i];
  }

  for (int i = 0; i < 2; i++){
    for (int j = 0; j < 2; j++){
      for (int k = 0; k < 2; k++){
        Solve(i, j, k);
      }
    }
  }
  cout << ans << endl;


  return 0;
}



Measured memory_bytes: 3832
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <vector>
#include <stdio.h>
#include <iostream>
#include <unordered_set>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <random>
#include <time.h>
#include <cassert>


#define prev askdnsajd
#define rank asasdmdnasd
#define next lsjndajbs
#define hash asmdklansd
#define index asdklnas
#define right sld
#define left sldl

using namespace std;

typedef long long ll;
typedef long double dbl;

template<class T>
void print(vector<T> s){
    for (T x : s)
        cout << x << " ";
    cout << endl;
}

mt19937 mrand(random_device{} ());
int rnd() {
    return mrand();
}

const int mod = 1e9 + 7;

vector<int> getBits(ll x){
    vector<int> a;
    while (x > 0){
        a.push_back(x & 1);
        x >>= 1;
    }
    reverse(a.begin(), a.end());
    return a;
}

ll calc(vector<int> curL, vector<int> curR, int n){
    for (int k = 0; k < min(curL.size(), curR.size()); k++){
        if (curL[k] > curR[k])
            return 0;
    }
    // print(curL);
    // print(curR);
    ll answer = 1;
    for (int i = curL.size(); i < curR.size(); i++){
        if (curR[i] == 1)
            answer = answer * 2 % mod;
    }
    for (int i = curR.size(); i < curL.size(); i++){
        if (curL[i] == 0)
            answer = answer * 2 % mod;
    }
    for (int i = max(curL.size(), curR.size()); i < n; i++)
        answer = answer * 3 % mod;
    // cout << answer << endl << endl;
    return answer;
}

ll get(ll l, ll r){
    if (l > r)
        return 0;
    // cout << l << " " << r << endl;
    vector<int> L = getBits(l);
    vector<int> R = getBits(r);
    assert(L.size() == R.size());
    int n = L.size();
    int cur = 0;
    while (cur < n && L[cur] == R[cur])
        cur++;
    vector<int> curL;
    ll result = 0;
    for (int i = cur; i < n + 1; i++){
        if (i > cur)
            curL.push_back(L[i - 1]);
        if (i < n && L[i] == 1)
            continue;
        if (i < n)
            curL.push_back(1);
        vector<int> curR;
        for (int j = cur; j < n + 1; j++){
            if (j > cur)
                curR.push_back(R[j - 1]);
            if (j < n && R[j] == 0)
                continue;
            if (j < n)
                curR.push_back(0);
            result += calc(curL, curR, n - cur);
            // print(curL);
            // print(curR);
            // cout << i << " " << j << " " << result << endl;
            // cout << endl;
            curR.pop_back();
        }
        curL.pop_back();
    }
    // cout << result << endl;
    return result % mod;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(77);
    ll l, r;
    cin >> l >> r;
    ll answer = 0;
    // cout << get(, 7) << endl;
    // return 0;
    for (int i = 0; i < 61; i++)
        answer += get(max(l, (1LL << i)), min(r, (1LL << (i + 1)) - 1));
    cout << answer % mod << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

q_1 = []
q_2 = []
q_3 = []

for i in P:
    if i <= A:
        q_1.append(i)
    elif A < i <= B:
        q_2.append(i)
    else:
        q_3.append(i)

print(min(len(q_1), len(q_2), len(q_3)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;




int main(){
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];
  int a, b;
  vector<int> d(n);
  rep(i, n) d[i] = i+1;
  int i = 0;
  do {
    bool okp = true, okq = true;
    rep(i, n) {
      if (d[i] != p[i]) okp = false;
      if (d[i] != q[i]) okq = false;
    }
    if (okp) a = i;
    if (okq) b = i;
    i++;
  } while(next_permutation(ALL(d)));
  cout << abs(a - b) << endl;
}

Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias Classes = Tuple!(long, "number", long, "person");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long a, b;
    scan(a, b);
    intersection(a.prime_factorization, b.prime_factorization).length.writeln();
}

auto factorization(long a)
{
    auto factor = new long[](0);
    auto limit = cast(long) sqrt(cast(float) a);
    foreach (i; iota(limit))
    {
        long tmp = i + 1;
        if (a % tmp == 0)
        {
            factor ~= tmp;
            if (tmp != a / tmp)
                factor ~= a / tmp;
        }
    }
    factor.sort();
    return factor;
}

auto prime_factorization(long a)
{
    auto factor = a.factorization();
    auto p_factor = [1L];
    foreach (i; iota(1, factor.length))
    {
        bool is_prime = true;
        foreach (j; iota(1, i))
            is_prime &= (factor[i] % factor[j] != 0);
        if (is_prime)
            p_factor ~= factor[i];
    }
    return p_factor;
}

auto intersection(T)(T a, T b)
{
    auto retary = new T(0);
    foreach (i; iota(a.length))
    {
        foreach (j; iota(b.length))
        {
            if (a[i] == b[j])
            {
                retary ~= a[i];
                break;
            }
        }
    }
    return retary;
}


Measured memory_bytes: 2300