akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n)-1; i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  int a, b, q;  cin >> a >> b >> q;
  vector<ll> s(a+2),  t(b+2);
  s[0] = t[0] = -LLINF;
  s[a+1] = t[b+1] = LLINF;
  REPS(i, a) cin >> s[i];
  REPS(i, b) cin >> t[i];
  REP(i, q){
    ll x;  cin >> x;
    auto su = upper_bound(ALL(s), x);
    auto sl = su - 1;
    auto tu = upper_bound(ALL(t), x);
    auto tl = tu - 1;

    ll d1 = abs(max(*sl, *tl) - x) + abs(*sl - *tl);
    ll d2 = min(abs(*sl-x), abs(*tu-x))*2 + max(abs(*sl-x), abs(*tu-x));
    ll d3 = min(abs(*su-x), abs(*tl-x))*2 + max(abs(*su-x), abs(*tl-x));
    ll d4 = abs(min(*su, *tu) - x) + abs(*su - *tu);
    cout << min({d1, d2, d3, d4}) << endl;
  }
  return 0;
}


Measured memory_bytes: 2944
macro_rules! input {
    ($t:ty) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty ;) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ; $n:expr) => {
        (0..$n).map(|_|
            input!($t)
        ).collect::<Vec<_>>()
    };
}

fn main(){
    let (n,m) = input!(usize,usize);
    let mut s:Vec<String> = input!(String;n);
    s.sort();
    println!("{}", s.concat())
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main (void)
{
  char dna[2];
  scanf("%s",&dna[0]);
  if(!strcmp(dna, "A")) printf("T");
  if(!strcmp(dna, "T")) printf("A");
  if(!strcmp(dna, "C")) printf("G");
  if(!strcmp(dna, "G")) printf("C");

  return 0; 
}

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

int main() {
  int n,m,ans;
  cin >> n >>m >>ans;
  for(int k=0;k<=n;k++){
    for(int l=0;l<=m;l++){
      int ans2=l*(n-k)+k*(m-l);
      if(ans2 == ans){
        cout <<"Yes";
        return 0;
      }
    }
  }
  cout << "No";
      
  
  
}

Measured memory_bytes: 256
n=int(input())#泊まる日数
k=int(input())#変更日付
x=int(input())
y=int(input())
a=b=i=0
if n<=k:
 for i in range(n):
   a+=x
   i+=1
else:
 for i in range(k):
   a+=x
   i+=1 
i=0
if n>k:
 for i in range(n-k):
   a+=y
   i+=1
print(a)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

const ll MOD = 1000000007;

map<int, int> prime_factor(int n) {
    map<int, int> ret;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }

    if (n != 1) ret[n] = 1;
    return ret;
}

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

    map <int, int> mp;
    for (int i = 2; i <= n; i++) {
        map <int, int> m = prime_factor(i);
        for (auto itr = m.begin(); itr != m.end(); ++itr) {
            mp[itr->first] += itr->second;
        }
    }

    ll ans = 1;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if (itr->first == 1) continue;
        ans = ans * (itr->second + 1) % MOD;
    }

    cout << ans << "\n";
    return 0;
}

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

typedef unsigned long long ULL;
typedef long long LL;

const int PI = 3.1415926535;
const int inf = 1000111222;
const int mod = 1000000007;
const int N = 100007;


int main() {
	
	ios_base :: sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	int n; cin >> n;
	vector <int> ar;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		ar.push_back(x);
	}
	sort(ar.begin(), ar.end());
	int m = (int)ar.size();
	int cnt = 0;
	for (int i = 0; i < m; i++) {
		for (int j = i + 1; j < m; j++) {
			for (int k = j + 1; k < m; k++) {
				int flag = 0;
				if (ar[i] + ar[j] <= ar[k]) flag = 1;
				if (ar[i] + ar[k] <= ar[j]) flag = 1;
				if (ar[j] + ar[k] <= ar[i]) flag = 1;
				if (!flag && ar[i] != ar[j] && ar[i] != ar[k] && ar[j] != ar[k]) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << "\n";
	return 0;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,A; cin>>N;
	map<int,int> ct;
	for (int i=0; i<N-1; i++) {
		cin>>A; ct[A]++;
	}
	for (int i=1; i<=N; i++)
		cout<<ct[i]<<"\n";
	return 0;
}

Measured memory_bytes: 13000
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
char a[10000+5];
int alen,f1,f2,d1,d2;
int main()
{
	scanf("%s",a);
	alen=strlen(a);
	for(int i=0;i<alen;i++)
	{
		if(a[i]=='N')
		{
			if(d1==2)
				f1=0;
			else
				f1=1;
			d1=1;
		}
		if(a[i]=='S')
		{
			if(d1==1)
				f1=0;
			else
				f1=1;
			d1=2;
		}
		if(a[i]=='E')
		{
			if(d2==2)
				f2=0;
			else
				f2=1;
			d2=1;
		}
		if(a[i]=='W')
		{
			if(d2==1)
				f2=0;
			else
				f2=1;
			d2=2;
		}
	}
	if(f1==0&&f2==0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


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

bool isBomb(vector<vector<char>>& map, int x, int y, int x_max, int y_max) {
    if (x >= 0 && x < x_max && y >= 0 && y < y_max) {
        if (map.at(y).at(x) == '#') {
            return true;
        }
    }
    return false;
}

int countArroundBomb(vector<vector<char>>& map, int x, int y, int x_max, int y_max) {
    int cnt = 0;
    if (isBomb(map, x-1, y-1, x_max, y_max)) cnt++;
    if (isBomb(map, x  , y-1, x_max, y_max)) cnt++;
    if (isBomb(map, x+1, y-1, x_max, y_max)) cnt++;
    if (isBomb(map, x-1, y  , x_max, y_max)) cnt++;
    if (isBomb(map, x+1, y  , x_max, y_max)) cnt++;
    if (isBomb(map, x-1, y+1, x_max, y_max)) cnt++;
    if (isBomb(map, x  , y+1, x_max, y_max)) cnt++;
    if (isBomb(map, x+1, y+1, x_max, y_max)) cnt++;
    return cnt;
}

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<char>> cell(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> cell.at(i).at(j);
        }
    }

    vector<vector<char>> cell2(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (cell.at(i).at(j) == '#') {
                cell2.at(i).at(j) = '#';
            } else {
                cell2.at(i).at(j) = to_string(countArroundBomb(cell, j, i, w, h))[0];
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << cell2.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  
  bool ok = false;
  REP(i,3){
    if(s[i] == '7') ok = true;
  }

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const pid_t pid = getpid();
// Problem Specific Parameter:



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

	string s[55];
	int t[55];

	rep(i, n) cin >> s[i] >> t[i];

	int ans = 0;
	bool asleep = false;
	string x;
	cin >> x;


	rep(i, n){
		if(asleep) ans += t[i];
		if(s[i] == x) asleep = true;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <cstdio>
using namespace std;
int main(void)
{
    int n;
    cin >> n;
    vector<int> d(n);

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

    int count = 0;

    sort(d.begin(),d.end());

    int diff= d[n/2]-d[n/2-1];
    cout << diff<<endl;
    return 0;
}

Measured memory_bytes: 640
_ = gets
h = Hash.new(0)
$<.each do |line|
  l = line.chars.sort.join
  h[l] += 1
end
count = 0
h.values.each do |v|
  next if v <= 1
  count += ((v-1)..v).reduce(&:*)/((1..2).reduce(&:*))
end
p count

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  unordered_set<int> st;
  unordered_set<int> st2;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (st.find(a[i]) != st.end()) {
      st2.insert(a[i]);
    } else {
      st.insert(a[i]);
    }
  }

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    bool ok = true;
    for (int j = 1; j * j <= a[i]; ++j) {
      if (a[i] % j == 0) {
	if (st.find(j) != st.end()) {
	  if (j == a[i] && st2.find(j) == st2.end()) {
	    continue;
	  }	  
	  ok = false;
	  break;
	}
	if (a[i] / j != j) {
	  int can = a[i] / j;
	  if (can == a[i] && st2.find(can) == st2.end()) {
	    continue;
	  }
	  if (st.find(can) != st.end()) {
	    ok = false;
	    break;
	  }
	}
      }
    }
    if (ok) ans++;
  }

  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 12524
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll a;
vec<ll> m, ps;
vec<vec<ll>> dp;

int main() {
    fast;
    cin>>a;
    m = vec<ll>(a);
    ps = vec<ll>(a);
    for(int q=0; q<a; q++){
        cin>>m[q];
        ps[q] = m[q] + (q ? ps[q-1] : 0);
    }
    dp = vec<vec<ll>>(a, vec<ll>(a));
    for(int d=1; d<=a; d++){
        for(int l=0; l+d<=a; l++){
            int r = l+d-1;
            if(d==1){dp[l][r] = 0;continue;}
            if(d==2){dp[l][r] = m[l]+m[r];continue;}
            ll mn = 1e18;
            for(int e=l; e<r; e++) mn = min(mn, dp[l][e]+dp[e+1][r]);
            dp[l][r] = mn + ps[r]-(l ? ps[l-1] : 0);
        }
    }
    cout<<dp[0][a-1];
}

Measured memory_bytes: 1536
H, W, K = map(int, input().split())
MOD = 10**9 + 7

dp = [[0 for w in range(W)] for h in range(H + 1)]
dp[0][0] = 1


for h in range(H):
    for i in range(2 ** (W-1)):
        if '11' in bin(i):
            continue
        for w in range(W):  # このループが一番のポイント
            if w == 0:
                if (i >> w) & 1:
                    dp[h+1][w] += dp[h][w+1]
                else:
                    dp[h+1][w] += dp[h][w]
            elif 1 <= w < W-1:
                if (i >> (w-1)) & 1:
                    dp[h+1][w] += dp[h][w-1]
                elif (i >> w) & 1:
                    dp[h+1][w] += dp[h][w+1]
                else:
                    dp[h+1][w] += dp[h][w]
            else:
                if (i >> (w-1)) & 1:
                    dp[h+1][w] += dp[h][w-1]
                else:
                    dp[h+1][w] += dp[h][w]
            dp[h+1][w] %= MOD

print(dp[H][K-1])


Measured memory_bytes: 43248
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, H);
    IN(ll, W);
    IN(ll, M);
    A2IN(ll, h, ll, w, M);
    set<ii> S;
    vi X(W + 1), Y(H + 1);
    REP(i, M)
    {
        S.insert({h[i], w[i]});
        ++Y[h[i]];
        ++X[w[i]];
    }
    ll my = *max_element(ALL(Y));
    ll mx = *max_element(ALL(X));
    vi U, V;
    REP1(i, H)
    {
        if (Y[i] == my)
        {
            V.push_back(i);
        }
    }
    REP1(i, W)
    {
        if (X[i] == mx)
        {
            U.push_back(i);
        }
    }
    FOR(u, U)
    {
        FOR(v, V)
        {
            if (S.count({v, u}) == 0)
            {
                OUT(mx + my);
                return 0;
            }
        }
    }
    OUT(mx + my - 1);
}

Measured memory_bytes: 39776
N, K = [int(x) for x in input().split(" ")]
D = [int(x) for x in input().split(" ")]

combs = []
lim = min(N, K)
for a in range(0, lim + 1):
    for b in range(0, lim - a + 1):
          combs.append((a, b))

maxres = 0
for a,b in combs:
    elems = sorted(D[:a] + D[N-b:])
    negative = len([e for e in elems if e < 0])
    drop = min(negative, max(0, K - a - b))
    res = sum(elems[drop:])
    maxres = max(maxres, res)
print(maxres)


Measured memory_bytes: 3064
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        int[] ans = solve3(N, A);
        for (int i=0; i<N; i++) {
            if (i != 0) {
                System.out.print(" ");
            }
            System.out.print(ans[i]);
        }
        System.out.println();
    }

    private static int[] solve3(int N, int[] A) {
        long sum = 0;
        for (int i=0; i<N; i++) {
            sum += A[i];
        }

        long X1 = sum;
        for (int i=1; i<N; i+=2) {
            X1 -= 2*A[i];
        }

        return assume(N, A, (int)X1);
    }

    private static int[] solve2(int N, int[] A) {
        int[] ans = assume(N, A, 0);
        int value = valid(N, A, ans);

        if (value != 0) {
            ans = assume(N, A, -value);
        }

        return ans;
    }

    private static int[] solve(int N, int[] A) {
        int[] ans = null;

        int minA = 0;
        int maxA = A[0]*2;

        if (valid(N, A, assume(N, A, minA)) == 0) {
            return assume(N, A, minA);
        }
        if (valid(N, A, assume(N, A, maxA)) == 0) {
            return assume(N, A, maxA);
        }
        while (true) {
            int midA = (minA+maxA)/2;
            if (midA%2 == 1) midA+=1;

            ans = assume(N, A, midA);
            int value = valid(N, A, ans);
            if (value == 0) break;
            if (value > 0) {
                maxA = midA;
            } else {
                minA = midA;
            }
        }

        return ans;
    }

    private static int[] assume(int N, int[] A, int a) {
        int[] ans = new int[N];
        ans[0] = a;
        for (int i=1; i<N; i++) {
            ans[i] = (A[i-1] - ans[i-1]/2)*2;
        }

        return ans;
    }

    private static int valid(int N, int[] A, int[] ans) {
        return ans[0]/2 + ans[N-1]/2 - A[N-1];
    }
}


Measured memory_bytes: 63164
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> xys(n);
    vector<int> xs(n), ys(n);
    for(int i = 0; i < n; i++){
        cin >> xys[i].first >> xys[i].second;
        xs[i] = xys[i].first;
        ys[i] = xys[i].second;
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
    ll ans = (1ll << 62);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < i; j++){
            int x1 = xs[j], x2 = xs[i];
            for(int i = 0; i < n; i++){
                for(int j = 0; j < i; j++){
                    int y1 = ys[j], y2 = ys[i];
            // int x1 = min(xs[i], xs[j]),
            //     x2 = max(xs[i], xs[j]),
            //     y1 = min(ys[i], ys[j]),
            //     y2 = max(ys[i], ys[j]);
            // int x1 = min(xys[i].first, xys[j].first),
            //     x2 = max(xys[i].first, xys[j].first),
            //     y1 = min(xys[i].second, xys[j].second),
            //     y2 = max(xys[i].second, xys[j].second);
            int cnt = 0;
            for(int k = 0; k < n; k++){
                if(x1 <= xys[k].first && xys[k].first <= x2 && 
                   y1 <= xys[k].second && xys[k].second <= y2){
                    cnt++;
                }
            }
            printd(x1, y1, x2, y2, cnt, ans, x2 - x1, y2 - y1);
            if(cnt >= k){
                ans = min(ans, ll(x2 - x1) * (y2 - y1));
                printd(cnt, ans, x2 - x1, y2 - y1);
            }
        }
    }
    }}
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

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

    int former_n = n / 100;
    int latter_n = n % 100;

    bool yymm_able = true;
    bool mmyy_able = true;

    if(former_n > 12 || former_n == 0) mmyy_able = false;
    if(latter_n > 12 || latter_n == 0) yymm_able = false;

    string ans = (yymm_able && mmyy_able)? "AMBIGUOUS" : (yymm_able)? "YYMM" : (mmyy_able)? "MMYY" : "NA";

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

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

int main() {
	int a;
	string s,t;
	int num = 0;

	cin >> s;
	cin >> t;

	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) {
			num++;
		}
	}
	cout << num << endl;
	return 0;
}

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

int main(){
  int n,p[101],m[101][101];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>p[i-1]>>p[i];
  }
  for(int i=1;i<=n;i++) m[i][i]=0;
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      int j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<=j-1;k++){
	m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  cout<<m[1][n]<<endl;
  return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int x[] = {0, 0, 1, -1}, y[] = {1, -1, 0, 0};
int main()
{
	int w, h;
	cin >> w >> h;
	string s[w + 2];
	for (int i = 0; i < w; i++) cin >> s[i];
	for (int i = 0; i < w; i++)
		for (int j = 0; j < h; j++)
			{
				if (s[i][j] == '#')
					{
						int c = 0, d = 0;
						for (int k = 0; k < 4; k++)
							{
								int dx = i + x[k];
								int dy = j + y[k];
								if (dx >= 0 && dy >= 0 && dx < w && dy < h && s[dx][dy])
									{
										c++;
										if (s[dx][dy] == '#') d++;
									}
							}
						if (c > 0 && d == 0) return puts("No"), 0;
						if (c == 0) return puts("No"), 0;
					}
			}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

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

int n;
int lcm(int a, int b)
{
  return(a*b/__gcd(a,b));
}
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
	cin>>n;
  ll ans=lcm(n,360)/n;
  cout<<ans<<'\n';

	
}



int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
   solve();

	return 0;
}

Measured memory_bytes: 3596
sx,sy,tx,ty = map(int, input().split())
u = 'U'
d = 'D'
l = 'L'
r = 'R'
ans = ''


# 1st
for i in range(1,abs(tx-sx)+1):
    if tx > sx:
        ans += r
    else:
        ans += l

for i in range(1,abs(ty-sy)+1):
    if ty > sy:
        ans += u
    else:
        ans += d


# 2nd
if tx > sx:
    ans += r
else:
    ans += l

for i in range(1,abs(ty-sy)+2):
    if ty < sy:
        ans += u
    else:
        ans += d

for i in range(1,abs(tx-sx)+2):
    if tx < sx:
        ans += r
    else:
        ans += l

if ty > sy:
    ans += u
else:
    ans += d


# 3rd
for i in range(1,abs(ty-sy)+1):
    if ty > sy:
        ans += u
    else:
        ans += d

for i in range(1,abs(tx-sx)+1):
    if tx > sx:
        ans += r
    else:
        ans += l


# 4th
if ty > sy:
    ans += u
else:
    ans += d

for i in range(1,abs(tx-sx)+2):
    if tx < sx:
        ans += r
    else:
        ans += l

for i in range(1,abs(ty-sy)+2):
    if ty < sy:
        ans += u
    else:
        ans += d
        
if tx > sx:
    ans += r
else:
    ans += l

print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    string s; 
    cin >> s;
    int n=s.size();
    int c0=0,c1=0;
    rep(i,n){
        if(s[i]=='0') c0++;
        else c1++;
    }
    cout << 2*min(c0,c1) << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int n;bool f[10];
bool ok(int x){
	while(x){
		if(f[x%10])return false;
		x/=10;
	}
	return true;
}
int main(){
	int k,x;
	for(scanf("%d%d",&n,&k); k--;){
		scanf("%d",&x);
		f[x] = true;
	}
	while(!ok(n))n++;
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

long long triang(long long x){return (x*(x+1))/2;}

int main(void){
	long long n,t=0,i,a[131072],tria,m;
	scanf("%lld",&n);
	for(i = 1;i <= n;i++){scanf("%lld\n",&a[i]);t+=(a[i]);}
	tria = triang(n);
	if(t%tria != 0){printf("NO\n");return 0;}
	m = t / tria;
	for(i = 1;i < n;i++){
		if(a[i] < m){printf("NO\n");return 0;}
		if(((a[i+1] - a[i] - m)%n) != 0){printf("NO\n");return 0;}
	}
	if(a[n] < m){printf("NO\n");return 0;}
	if(((a[1] - a[n] - m)%n) != 0){printf("NO\n");return 0;}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
#include <bitset>
//#include <boost/math/common_factor_rt.hpp>

#define ll long long
#define max 100000
using namespace std;
ll l = 1000000007;

int main()
{
	ll l[15] = {};
	int n, sum = 0;
	cin >> n;

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

	sort(l, l + n, greater<int>());

	for (int i = 1; i < n; i++)
	{
		sum += l[i];
	}

	if (l[0] < sum) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;

	}
}



Measured memory_bytes: 256
program sample
	implicit none
    integer ::a
    integer ::b(32)=(/1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51/)

    
    read(*,*) a
    
    write(*,*) b(a)
    stop
end program sample

Measured memory_bytes: 2768
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll A;
  ll B;
   ll C;
  ll X;
   ll Y;
  cin >>A>>B>>C>>X>>Y;
  
  ll c=2*C;
  ll n=max(X,Y);
  
  ll sum=0;
  rep(i,1000000) {
  if(i==0) {
  sum=A*X+B*Y;
}

else {
ll aa=C*2*i;
if((X-i>0) &&(Y-i>0)) {
aa+=(X-i)*A+(Y-i)*B;
}
else if((X-i>0) &&(Y-i<=0)){
aa+=(X-i)*A;


}
else if((X-i<=0) &&(Y-i>0)){
aa+=(Y-i)*B;
}
else if((X-i<=0) &&(Y-i<=0)){

}


sum=min(sum,aa);



}


}//endrep


cout<<sum<<endl;
}

Measured memory_bytes: 3648
n, d=map(int, input().split())

a=[]
for i in range(n):
    a.append([int(i) for i in input().split()])


s_list=[]

for i in range(n-1):
    for j in range(i+1, n):
        
        sum=0
        for k in range(d):
            sum+=(a[i][k]-a[j][k])**2
        s_list.append(sum)
        
#max
num=int(max(s_list)**(1/2))

count=0
for i in range(num+1):
    for j in s_list:
        if j==i**2:
            count+=1
            
print(count)

Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>



int main() {
	ll a, b;
	cin >> a >> b;
	cout << a * b << endl;
}




Measured memory_bytes: 3108
#include<iostream>
#include<map>
using namespace std;

int main() {
    int n;
    cin >> n;
    int cnt4 = 0, cnt = 0;
    for(int i = 0; i < n; i++) {
        long long a;
        cin >> a;
        if(a % 4 == 0) {
            cnt4++;
        }
        if(a % 2 != 0) {
            cnt++;
        }
    }
    
    if (n % 2 == 0){
        if(cnt4 >= cnt || cnt == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    } else {
        if(cnt4+1 >= cnt || cnt == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false);cin.tie(NULL);
int arr[101];

int main()
{
    BeatMeScanf;
    //freopen("/home/shafayetemon/Documents/in.txt", "r", stdin);
    //freopen("/home/shafayetemon/Documents/out.txt", "w", stdout);

    int n, cnt = 0;
    cin >> n;

    for(int i = 0; i< n; i++)
    {
        int x;
        cin >> x;
        if(x % 2 == 0)
        {
            if(x % 3 !=0 )
            {
                if(x % 5 != 0) cnt++;
            }
        }
        
    }
    
    if(cnt == 0)
        cout<<"APPROVED"<<endl;
    else
        cout<<"DENIED"<<endl;        
    return 0;
}



Measured memory_bytes: 256
s = input()
while len(s) > 0:
    for a in ('dreamer', 'dream', 'eraser', 'erase'):
        if s[-len(a):] == a:
            s = s[:-len(a)]
            break
    else:
        break
if len(s) == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define N 100007
#define inf 999999999
using namespace std;

long long mem[N];
long long ara[N];
int n;

long long dp(int i, int j)
{
    if(i >= n)
        return inf;
    if(i == j)
        return 0;
    if(mem[i] != -1)
        return mem[i];
    long long ans = min(abs(ara[i + 1] - ara[i]) + dp(i + 1, j), abs(ara[i + 2] - ara[i]) + dp(i + 2, j));
    mem[i] = ans;
    return ans;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    for(int i = 0;i < n;i++)
        cin >> ara[i];
    memset(mem, -1, sizeof(mem));
    cout << dp(0, n - 1) << endl;
    return 0;
}

Measured memory_bytes: 8232
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

string s;
int solve1(){
    int ans = 0;
    int n = s.size();
    queue<string> q;
    q.push(s);
    while(!q.empty()){
        string t = q.front(); q.pop();
        rep(i, 0, n){
            if(t[i] == '?'){
                rep(j, 0, 3){
                    string r = t;
                    r[i] = 'A' + j;
                    q.push(r);
                }
                break;
            }
            if(i == n - 1){
                rep(l, 0, n){
                    if(t[l] != 'A') continue;
                    rep(j, l + 1, n){
                        if(t[j] != 'B') continue;
                        rep(k, j + 1, n){
                            if(t[k] == 'C'){
                                (ans += 1) %= mod;
                            }
                        }
                    }
                }
            }
        }
    }
    
    return ans;
}

int dpa[100010];
int dpc[100010];
int ca, cc;

int solve2(){
    string t = s;
    int n = s.size();
    int ans = 0;
    rep(j, 0, 3){   
        if(t[0] == '?') s[0] = 'A' + j;
        else if(j == 1) break;     
        rep(k, 0, 3){
            if(t[n - 1] == '?') s[n - 1] = 'A' + k;
            else if(k == 1) break;
            dpa[0] = 0;
            ca = 1;
            // cout << j << ' ' << k << " " << s << endl;
            rep(i, 0, n){
                if(s[i] == 'A') dpa[i + 1] = (dpa[i] + ca) % mod;
                else if(s[i] == '?'){
                    dpa[i + 1] = (dpa[i] * 3 + ca) % mod;
                    (ca *= 3) %= mod;
                }else dpa[i + 1] = dpa[i];
            }
            dpc[n] = 0;
            cc = 1;
            repr(i, n - 1, 0){
                if(s[i] == 'C') dpc[i] = (dpc[i + 1] + cc) % mod;
                else if(s[i] == '?'){
                    dpc[i] = (dpc[i + 1] * 3 + cc) % mod;
                    (cc *= 3) %= mod;
                }else dpc[i] = dpc[i + 1];
            }
            rep(i, 0, n){
                if(s[i] == 'B' || s[i] == '?'){
                    (ans += dpa[i] * dpc[i + 1] % mod) %= mod;
                }
            }
        }
    }
    return ans;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    // int tmp = solve1();    
    int tmp2 = solve2();
    cout << tmp2 << endl;
}

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

#define N 1001
int A[N][N];

int main() {
    int q;
    cin >> q;

    string target1;
    string target2;
    for (int i = 0; i < q; i++) {
        cin >> target1;
        cin >> target2;
        int l1 = target1.length();
        int l2 = target2.length();
        for (int m = 0; m <= l1; m++) {
            A[m][0] = 0;
        }
        for (int n = 0; n <= l2; n++) {
            A[0][n] = 0;
        }

        target1 = ' ' +  target1;
        target2 = ' ' +  target2;

        for (int m = 1; m <= l1; m++) {
            for (int n = 1; n <= l2; n++) {
                if (target1[m] == target2[n]) {
                    A[m][n] = A[m-1][n-1] + 1;
                } else {
                    A[m][n] = max(A[m-1][n], A[m][n-1]);
                }
            }
        }

        cout << A[l1][l2] << endl;
    }

    return 0;
}


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

int main() {
    int N;
    cin >> N;

    vector<int> D(100);

    int d = 0;
    for (int i = 0; i < N; i++) {
        cin >> d;
        D.at(d-1)++;
    }

    int cnt = 0;
    for (int i = 0; i < 100; i++) {
        if (D.at(i) > 0) {
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

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

using ll = long long;

int main() {
	ll h; cin >> h;
	ll ans = 1;
	while (h > 0) {
		h >>= 1;
		ans <<= 1;
	}

	cout << ans - 1;
}

Measured memory_bytes: 256
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;

int n ,x ,l[N] ,d[N] ,cnt ;
int main(){
    scanf("%d%d",&n,&x);
    for(int i=0;i<n;++i) scanf("%d",l+i);
    for(int i=0;i<=n;++i){
        if(!i) d[i] = 0 ;
        else d[i] = d[i-1] + l[i-1] ;
        cnt += d[i]<=x ;
    }
    cout << cnt ;
    return 0;
}


Measured memory_bytes: 256
//繝・Φ繝励Ξ
#include <bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//
signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int d[10];
   REP(i,4) d[i] = 0;
   REP(i,6) 
   {
      int city;
      cin >> city ;
      d[--city] ++ ;
   }
   if(all_of(d,d+4,[](auto x){return x <=2;}))
   {
      cout << "YES" << endl;
   }
   else
   {
      cout << "NO" << endl;
   }
   
}

//驛ｨ蛻・・譛蟆丞､
//譖ｴ譁ｰ縺励↑縺・ｴ蜷遺・邏ｯ遨阪ｏ
//莠梧ｬ｡蜈・↓縺励◆縺・・縺・ｂ縺呎ｳ・
//荳邂・園繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Segment Tree(縺溘□縺怜叙蠕涌(logN))
//遽・峇繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Lazy Segment Tree


Measured memory_bytes: 256
N,K=map(int,input().split())
MAX=(N-1)*(N-2)//2
if K>MAX:
    print(-1)
else:
    print(N-1+MAX-K)
    for i in range(2,1+N):
        print("1 "+str(i))
    cnt=0
    for i in range(2,N):
        if cnt>=MAX-K:
            break
        for j in range(i+1,1+N):
            print(" ".join(map(str,[i,j])))
            cnt+=1
            if cnt>=MAX-K:
                break

Measured memory_bytes: 3332
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(long long (i)=0;(i)<(long long)(n);(i)++)
#define RREP(i,n) for(long long (i)=(long long)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int N,K;
vector< ll > x,y;
vector< pair<ll,ll> > axis;

int main() {

	cin >> N >> K;
	x.resize(N);
	y.resize(N);
	axis.resize(N);
	REP(i,N) cin >> x[i] >> y[i];
	REP(i,N) {
		axis[i].first = x[i];
		axis[i].second = y[i];
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	ll ans = 5e18;
	ll xL = -1, xR = -1, yT = -1, yB = -1;
	for (int xc = 0; xc < x.size(); xc++) {
		for (int xb = 0; xb < x.size() - xc; xb++) {
			xL = x[xb];
			xR = x[xb + xc];
			for (int yc = 0; yc < y.size(); yc++) {
				for (int yb = 0; yb < y.size() - yc; yb++) {
					yB = y[yb];
					yT = y[yb + yc];
					int cnt = 0;
					REP(i,axis.size()) {
						if (axis[i].first >= xL && axis[i].first <= xR) {
							if (axis[i].second >= yB && axis[i].second <= yT) {
								cnt++;
							}
						}
					}
					if (cnt >= K) {
						ll anst = abs(xL - xR) * abs(yB - yT);
						if (ans > anst) ans = anst;
					}
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	int n,m,d; cin >> n >> m >> d;
	double ans=0;
	if(d==0){
		ans+=(double)(m-1)/n;
	}
	else{
		ans+=(double)(m-1)*2*(n-d)/n/n;
	}
	printf("%.8f\n",ans);
}

Measured memory_bytes: 256
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

N = int(input())
SS = [0]*N
s = set()
SS[0] = str(input())
s.add(SS[0])
for i in range(1,N):
    SS[i] = str(input())
    if(SS[i] in s):
        print('No')
        sys.exit()
    s.add(SS[i])
for i in range(1,N):
    if(SS[i-1][-1] != SS[i][0]):
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 3064
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
d = LI()
for i in range(n,10*n+1):
    s = Counter(list(map(int,list(str(i)))))
    for j in d:
        if s[j] > 0:
            break
    else:
        print(i)
        quit()

Measured memory_bytes: 48360
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
   
    int A,B;
    cin>>A>>B;
    
    int w,s,m;
    w=A+B;
    s=A-B,
    m=A*B;
    
    int S[3]={w,s,m};
    sort(S,S+3);
    cout<<S[2]<<endl;
    
    
    return 0;
   
}






Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
        
    int N, T; cin >> N >> T;
    vi t(N); REP(i, N) cin >> t[i];

    ll ans = 0;
    REP(i,N-1) {
        if (t[i]+T <= t[i+1]) {
            ans += T;
        } else {
            ans += t[i + 1] - t[i];
        }
    }
    ans += T;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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() {
  map<string, int> A {{"SUN", 0}, {"MON", 1}, {"TUE", 2}, {"WED", 3}, {"THU", 4}, {"FRI", 5}, {"SAT", 6}};
  string s;
  cin >> s;
  cout << 7 - A[s] << endl;
  return 0;
}

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

vector<vector<int>> v;
vector<int> d, color;

const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;

int n, ans;

void prim(){
  priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
  q.push(make_pair(0, 0));
  d[0] = 0;

  while(!q.empty()){
    auto next = q.top(); q.pop();
    if(color[next.second] == BLACK) continue;

    color[next.second] = BLACK;
    ans += d[next.second];

    for(int i=0; i<n; ++i){
      if(i != next.second && v[next.second][i] != -1 && color[i] != BLACK && d[i] > v[next.second][i]){
        q.push(make_pair(v[next.second][i], i));
        d[i] = v[next.second][i];
        color[i] = GRAY;
      }
    }
  }
}

int main(){
  cin >> n;

  v.resize(n);
  d.resize(n);
  color.resize(n);

  for(int i=0; i<n; ++i){
    d[i] = numeric_limits<int>::max();
    v[i].resize(n);
    for(int l=0; l<n; ++l) cin >> v[i][l];
  }

  prim();

  cout << ans << endl;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	string s, t;
	cin >> s >> t;
	int n = s.size();
	if (s == t.substr(0, n))
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3656