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

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

int main() {
	times(n, in) {
		int s = in, e = in, i = s;
		do {
			out(i , ' ');
			if (i == 9) {
				if (e <= 5)
					i = 5;
				else {
					i = 6;
					out("5 4 3 2 1 0 1 2 3 4 5 ");
				}
			} else if (i <= 5 && i > e)
				i--;
			else
				i++;
		} while(i != e);
		outl(e);
	}
}


Measured memory_bytes: 2412
#include<bits/stdc++.h>
using namespace std;
int a[2000010];
int n,k,d,ans,r,l=10000;
int main(){
    cin>>n>>k;
    while(cin>>d) a[d]++,l=min(l,d),r=max(r,d);
    if(r-l+1<=k) return cout<<0<<endl,0;
    sort(a+l,a+r+1);
    for(;r-l+1>k;l++) ans+=a[l];
    cout<<ans<<endl;
    return 0;
}

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

int h[100009], d[100009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> h[i];
	d[1] = 0;
	for (int i = 2; i <= n; i++) {
		d[i] = d[i - 1] + abs(h[i] - h[i - 1]);
		for (int j = max(1, i - k); j < i; j++)
			d[i] = min(d[i], d[j] + abs(h[i] - h[j]));
	}
	cout << d[n] << '\n';
	return 0;
}

Measured memory_bytes: 1024
# include <bits/stdc++.h>
/// my holy template
# define F first    
# define S second
# define mp make_pair
# define pii pair<int,int>         
/// eveything goes according to plan
# define long long long  
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
/// countdown BEGAN. 10 , 9 , 8 ...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right     

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 9223372036854775807;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm("rdtsc" : "=A"(seed));
  srand(seed);
}
int n, m;     
                              
int main() 
{
  Read_rap ();
  cin >> n >> m;
  cout << ((n - m) * 100 + 1900 * m) * (1<<m);


  return 0;
} 










// Coded by Z...

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

using namespace std;

const int maximum = 2e5+1;

vector<int> edges[maximum];
int dist[maximum];
int indegree[maximum];
bool visited[maximum];

void dfs(int a){
  visited[a]=1;
  for(int b : edges[a]){
    dist[b] = max(dist[a]+1,dist[b]);
    indegree[b]--;
    if(indegree[b]==0){
      dfs(b);
    }
  }
}

int main(){
  int N,M;
  cin >> N >> M;
  int x,y;
  for(int i = 0; i < M; i++){
    cin >> x >> y;
    edges[x].push_back(y);
    indegree[y]++;
  }
  for(int i = 1; i <= N; i++){
    if(!visited[i]&&indegree[i]==0)
      dfs(i);
  }
  int answer = 0;
  for(int i = 1; i <= N; i++){
    answer = max(answer,dist[i]);
  }
  cout << answer << endl;
  return 0;
}


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

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	 printf
#define sf			 scanf
#define pb(a)        push_back(a)
#define mp			 make_pair
#define ff			 first
#define ss			 second
#define for0(i,n)    for(int i=0;i<n;i++)
#define for1(i,n)    for(int i=1;i<=n;i++)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define sq(a)		 (a)*(a)
#define endl		     "\n"
#define abs(x)		 fabs(x)
#define all(v) 		 v.begin(),v.end()
#define pcase(z,x)   cout<<"Case "<<z<<": "<<x<<"\n"
#define mod 1000000007
#define WakandaForever     ios_base::sync_with_stdio(0); cin.tie(0);

int main()
{
    WakandaForever
    int n;
    cin>>n;
    vi p,m;
    for0(i,n){
        int x,y;
        cin>>x>>y;
        p.pb(x+y);
        m.pb(x-y);
    }
    sort(all(p));
    sort(all(m));

    int a = p[0] - p.back();
    int b = m[0] - m.back();
    int c = - m[0] + m.back();
    int d = - p[0] + p.back();
    //cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    int ans = max({a,b,c,d});
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5120
// Vicfred
// https://atcoder.jp/contests/abc152/tasks/abc152_b
// simulation, implementation
import std.stdio;

void main() {
    int a, b;
    readf("%s %s\n", &a, &b);

    string u;
    for(int i = 0; i < b; ++i)
        u ~= a+'0';

    string v;
    for(int i = 0; i < a; ++i)
        v ~= b+'0';

    if(u < v)
        u.writeln;
    else
        v.writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll mod_pow(ll x, ll n, ll mod=INFLL) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main () {
  ll h;
  cin >> h;

  auto f = [&](ll x) {
    ll res = 0;
    while (x != 0) {
      x /= 2;
      res++;
    }
    return res;
  };
  ll ans = (1 - mod_pow(2,f(h)))/(1-2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstddef>
#include<cstdint>
#include<vector>
#include<algorithm>
using usize=std::size_t;
using i64 = std::int_fast64_t;

int main(){
  usize n,q;
  std::cin>>n>>q;
  std::vector<i64> a(n);
  for(auto&e:a)std::cin>>e;
  std::sort(a.begin(),a.end());
  for(usize i=0;i<q;++i){
    i64 l,r;
    std::cin>>l>>r;
    std::cout<<std::upper_bound(a.cbegin(),a.cend(),r)
    -std::lower_bound(a.cbegin(),a.cend(),l)<<std::endl;
  }
}



Measured memory_bytes: 3548
// ABC059A - 

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	printf("%c%c%c\n", s1[0] - ('a' - 'A'), s2[0] - ('a' - 'A'), s3[0] - ('a' - 'A'));

	return 0;
}


Measured memory_bytes: 256
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e6+5;

char a[10][10];

int main()
{ 

  IOS;


ll h,w,k;
cin>>h>>w>>k;

ll cnt=0;

for(int i=0;i<h;i++){
  for(int j=0;j<w;j++){
    cin>>a[i][j];
  if(a[i][j]=='#')cnt++;
  }
}

//cout<<cnt<<endl;

vl cr(h),cc(w);

for(int i=0;i<h;i++){
  ll d=0;
  for(int j=0;j<w;j++){
    if(a[i][j]=='#')d++;
  }
  cr[i]=d;
 // cout<<cr[i]<<" ";
}

for(int j=0;j<w;j++){
  ll d=0;
  for(int i=0;i<h;i++){
    if(a[i][j]=='#')d++;
  }
  cc[j]=d;
}

//cout<<cr[3]<<endl;


//cout<<cc[]<<endl;

ll ans=0;

ll y=0;

for(int i=0;i<(1LL<<h);i++){
  //ll tot=0;
  for(int j=0;j<(1LL<<w);j++){
    ll tot=0;
     set<ll>r;
     set<ll>c;
     //cout<<i<<" "<<j<<endl;

     for(int p=0;p<h;p++){
      ll a1=1LL<<p;
      if(a1&i)r.insert(p);
      //if(a1&j)c.insert(p);
     }
     for(int p=0;p<w;p++){
      ll a1=1LL<<p;
      if(a1&j)c.insert(p);
     }

   /* if(i==7&&j==3){
      for(int p=0;p<w;p++){
        if(c.count(p))cout<<p<<endl;
      }
      cout<<endl;
      for(int p=0;p<h;p++){
        if(r.count(p))cout<<p<<endl;
      }
    }*/

   for(int p=0;p<h;p++){
    for(int q=0;q<w;q++){
      if(c.count(q)||r.count(p))continue;
      else if(a[p][q]=='#')tot++;
    }
   }

   if(tot==k){
    ans++;
  //  cout<<i<<" "<<j<<endl;
  }
//cout<<tot<<endl;

}
}

cout<<ans<<endl;



return 0;
 
}



Measured memory_bytes: 3616
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
#define endl "\n"
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}




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



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

int main(){
    std::string S;
    std::cin >> S;
    for(int i = 0; i < S.size(); i++){
        if(i % 2 == 0){
            if(S[i] == 'R' || S[i] == 'U' || S[i] == 'D'){
                continue;
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }else{
            if(S[i] == 'L' || S[i] == 'U' || S[i] == 'D'){
                continue;
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>

using namespace std;
set<int> s[100010],res;
queue<int> que;
int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n-1;i++){
		int a,b;
		cin >> a >> b;
		s[a].insert(b); s[b].insert(a);
	}
	for(i=0;i<n;i++){
		res.insert(i);
		if(s[i].size()==1){
			que.push(i);
		}
	}
	while(que.size()){
		if(res.size()==1) break;
		int x = que.front();
		que.pop();
		auto it = s[x].begin();
		int y = *it;
		if(s[y].size()==2) {
			res.erase(x); s[y].erase(x); que.push(y);
		}
	}
	if(res.size()==2){
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	for(i=0;i<n;i++){
		if(!res.count(i)) continue;
		auto it = s[i].begin();
		int ret = 0;
		while(it!=s[i].end()){
			if(s[*it].size()==1) ret++;
			it++;
		}
		ans += max(ret - 1,0);
	}
	cout << ans << endl;
}

Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1000000
using namespace std;
typedef pair<int, int> P;
typedef pair<P, string> Pi;
#define fi first
#define sec second
int main()
{
    int n, q;
    while (cin >> n >> q)
    {
        if (n == 0 && q == 0)
            break;
        string str;
        vector<Pi> vec(n + 1);
        int era[n + 1];
        int westerm[n + 1];
        rep(i, n)
        {
            cin >> str >> era[i] >> westerm[i];
            vec[i].fi.fi = westerm[i] - era[i] + 1;
            vec[i].fi.sec = westerm[i];
            vec[i].sec = str;
        }
        vector<int> year(q + 1);
        rep(i, q) cin >> year[i];
        rep(i, q)
        {
            bool flag = false;
            rep(j, n)
            {
                if (year[i] >= vec[j].fi.fi && year[i] <= vec[j].fi.sec)
                {
                    flag = true;
                    cout << vec[j].sec << " " << year[i] - westerm[j] + era[j] << endl;
                    break;
                }
            }
            if (!flag)
                cout << "Unknown" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3220
#!pypy3
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

s=input()
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5292
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


ll mod = 1e9 + 7;

ll POW(ll A, ll B) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		ll hannbunn = POW(A, B / 2);
		return hannbunn * hannbunn % mod;
	}
	else {
		return A * POW(A, B - 1) % mod;
	}
}



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

	
	ll H, W, A, B;
	cin >> H >> W >> A >> B;

	if (H - A > W - B) {
		swap(H, W);
		swap(A, B);
	}

	ll comb1[100001], comb2[100001];

	comb1[0] = 1;
	rep1(i, H - A - 1) {
		comb1[i] = comb1[i - 1] * (H - A + B - i) % mod;
		comb1[i] = comb1[i] * POW(i, mod - 2) % mod;
	}

	comb2[0] = 1;
	rep1(i, W - B - 1) {
		comb2[i] = comb2[i - 1] * (W - B + A - i) % mod;
		comb2[i] = comb2[i] * POW(i, mod - 2) % mod;
	}

	ll kotae = 0;
	rep(i, H - A) {
		ll kari = comb1[i] * comb2[i + W - B - H + A] % mod;
		kotae = (kotae + kari) % mod;
	}
	
	co(kotae);

	Would you please return 0;
}

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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};




int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll x,n;cin>>x>>n;
  vl p(n);
  rep(i,n)cin>>p[i];
  ll d=INF;
  ll ans=-1;
  for(ll i=0;i<=101;i++){
    bool skip=false;
    rep(j,n){
      if(i==p[j])skip=true;
    }
    if(skip)continue;
    if(d>abs(i-x)){
      d=abs(i-x);
      ans=i;
    }
    else if(d==abs(i-x)){
      ans=min(ans,i);
    }
  }
  cout<<ans<<endl;
}

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

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

  vector<int>slime(N);
  for(int i = 0; i < N; i++){
    cin >> slime.at(i);
  }

  int count = 0;
  for(int j = 0; j < N - 1; j++){
    if(slime.at(j) == slime.at(j + 1)){
      count += 1;
      slime.at(j + 1) = 100001;
      }
    }
    cout << count << endl;
  }
  

Measured memory_bytes: 256
let fs = require('fs');

const fuga = data => {
  lines = data.split("\n");
  lines = lines.map(line => line.split(" "));
  lines = lines.map(line => line.map(elem => parseInt(elem)));
  
  for(let i = 0; i < lines.length; i++) {
    let str = "";
    if(!lines[i][0]) return;
    for(let j = 0; j < lines[i][0]; j++) {
      for(let k = 0; k < lines[i][1]; k++) {
        str += "#";
      }
      console.log(str);
      str = "";
    }
    console.log("");
  }
}

const readFile = path => {
  fs.readFile(path, 'utf8', (err, data) => {
    fuga(data);
  });
}

const readFileWithoutArg = () => {
  const data = require('fs').readFileSync('/dev/stdin', 'utf8');
  fuga(data)
}

let sampleInputPath = "";

if(process.argv.length > 2) {
  sampleInputPath = process.argv[2];
  readFile(sampleInputPath);
} else {
  readFileWithoutArg();
}



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

int par[110] ;

int main(){


    ios::sync_with_stdio(false) ;
    cin.tie(0) ;

    int n ;
    cin >> n ;
    for(int i = 0; i < n;i++){

        cin >> par[i+1] ;
        par[i+1]+=par[i] ;

    }
    int YE = 1000000 ;
    for(int i = 0; i <= n; i++){

        YE = min(YE, abs(par[i]-par[n]+par[i])) ;

    }
    cout << YE ;

}


Measured memory_bytes: 256
#include<stdio.h>

main(){

int n,i,j;

scanf("%d",&n);

int a[100];

 for(i=0;i<n;i++){

 scanf("%d",&a[i]);

 }

 for(j=n-1;j>=0;j--){

 if(n-1-j){
 printf(" ");
 }
 printf("%d",a[j]);
 
 }
 printf("\n");

return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int N;
int H[101010];
const ll mo=998244353;
ll fact2[101010];
const int NUM_=400001;
ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

ll comb(ll N_, ll C_) {
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

vector<ll> V[101010];

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}


template<class T> vector<T> fft(vector<T> v, bool rev=false) {
	int n=v.size(),i,j,m;
	
	for(i=0,j=1;j<n-1;j++) {
		for(int k=n>>1;k>(i^=k);k>>=1);
		if(i>j) swap(v[i],v[j]);
	}
	for(int m=2; m<=n; m*=2) {
		T wn=modpow(5,(mo-1)/m);
		if(rev) wn=modpow(wn);
		for(i=0;i<n;i+=m) {
			T w=1;
			for(int j1=i,j2=i+m/2;j2<i+m;j1++,j2++) {
				T t1=v[j1],t2=(ll)w*v[j2]%mo;
				v[j1]=t1+t2;
				v[j2]=t1+mo-t2;
				while(v[j1]>=mo) v[j1]-=mo;
				while(v[j2]>=mo) v[j2]-=mo;
				w=(ll)w*wn%mo;
			}
		}
	}
	if(rev) {
		ll rv = modpow(n);
		FOR(i,n) v[i]=(ll)v[i]*rv%mo;
	}
	return v;
}

template<class T> vector<T> MultPoly(vector<T> P,vector<T> Q,bool resize=false) {
	if(resize) {
		int maxind=0,pi=0,qi=0,i;
		int s=2;
		FOR(i,P.size()) if(norm(P[i])) pi=i;
		FOR(i,Q.size()) if(norm(Q[i])) qi=i;
		maxind=pi+qi+1;
		while(s*2<maxind) s*=2;
		P.resize(s*2);Q.resize(s*2);
	}
	P=fft(P), Q=fft(Q);
	for(int i=0;i<P.size();i++) P[i]=(ll)P[i]*Q[i]%mo;
	return fft(P,true);
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	
	fact2[1]=1;
	for(i=3;i<=101000;i+=2) fact2[i]=fact2[i-2]*i%mo;
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	cin>>N;
	FOR(i,2*N) {
		cin>>x;
		H[x]++;
	}
	priority_queue<pair<int,int>> P;
	FOR(i,100001) if(H[i]) {
		V[i].push_back(1);
		for(j=1;2*j<=H[i];j++) {
			V[i].push_back(comb(H[i],2*j)*fact2[2*j-1]%mo);
		}
		P.push({-(int)V[i].size(),i});
	}
	
	while(P.size()>1) {
		x=P.top().second;
		P.pop();
		y=P.top().second;
		P.pop();
		V[x]=MultPoly(V[x],V[y],1);
		V[y].clear();
		P.push({-(int)V[x].size(),x});
	}
	
	ll ret=0;
	x=P.top().second;
	FOR(i,V[x].size()) if(V[x][i]) {
		ll v=V[x][i]*(i==N?1:fact2[2*(N-i)-1])%mo;
		if(i%2) ret+=mo-v;
		else ret+=v;
	}
	cout<<ret%mo<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

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

ll dp[N];

int main() {
	FREOPEN();
	int n, W;
	cin >> n >> W;
	for (int i = 0; i < N; i++) dp[i] = INF;
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		int w, v;
		scanf("%d %d", &w, &v);
		for (int j = N - 1; j >= 0; j--) {
			if (dp[j] < INF && dp[j] + w < dp[j + v]) dp[j + v] = dp[j] + w;
		}
	}
	for (int i = N - 1; i >= 0; i--) {
		if (!dp[i]) continue;
		if (dp[i] <= W) {
			printf("%d ", i);
			return 0;
		}
	}
	return 0;
}


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

int main(){
    int n; cin >>n;
    vector<ll> a(n), b(n);
    ll suma=0, sumb=0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        suma += a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
        sumb += b[i];
    }
    if(suma<sumb) cout << -1 << endl;
    else{
        vector<ll> diff(n);
        int ans=0;
        ll lack=0;
        for(int i=0; i<n; i++){
            diff[i]=a[i]-b[i];
        }
        sort(diff.begin(), diff.end());
        int i = 0;
        while(diff[i]<0){
            lack += diff[i];
            i ++;
        }
        ans += i;
        int j=0;
        while(lack<0){
            lack += diff[n-1-j];
            j++;
        }
        ans += j;
        cout << ans << endl;
    }
}

Measured memory_bytes: 5608
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 200100
#define mdn 1000000007
using namespace std;

int f[N],b[N],c[N];
int n,cnt;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)	scanf("%d",&c[i]);
	for(int i=1;i<=n;i++)	if(c[i]!=c[i-1])	c[++cnt]=c[i];
	n=cnt; f[0]=1; b[c[1]]=1;
	for(int i=1;i<=n;i++)
		f[i]=b[c[i]],b[c[i+1]]=(b[c[i+1]]+f[i])%mdn;
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 2560
n, Y = list(map(int, input().split()))
for i in range(n + 1):
    for j in range(n + 1 - i):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == Y:
            print(i, j, n - i - j)
            exit()
else:
    print('-1 -1 -1')


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

int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<int> que;
  int A;
  for(int i=1; i<=N; i++) {
    cin >> A; que.push(A);
  }

  int t;
  for(int i=1; i<=M; i++) {
    t=que.top();
    que.pop();
    que.push(t/2);
  }

  long long sum;
  for(int i=1; i<=N; i++) {
    t=que.top();
    sum += t;
    que.pop();
  }
  cout << sum;

}

Measured memory_bytes: 892
n=int(input())
l=sorted(list(map(int,input().split())))
p=0
o=len(l)

t=[]
for i in range(o-2):
  while p<o and l[p]-l[i]<=2:
    p+=1
  t.extend([p-i])

if len(l)==1:
  print(1)
elif len(l)==2:
  if abs(l[0]-l[1])<=2:
    print(2)
  else:
    print(1)
else:
  print(max(t))

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

long N;

bool check753(long n){
    int n3=0,n5=0,n7=0;
    for(long m=n;m>2;m/=10){
        int t = m %10;
        if(t==3)n3++;
        else if(t==5)n5++;
        else if(t==7)n7++;
        else return false;
    }
    if (n3>0&&n5>0&&n7>0)return true;
    else return false;
}

int dfs(long n){
    if (n > N)return 0;
    int ret;
    if (check753(n))ret = 1;
    else ret = 0;
    for(int i=3;i<=7;i+=2) ret += dfs(n*10+i);
    return ret;
}

int main(){
    cin >> N;

    cout << dfs(0) << endl;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<regex>
#include<queue>
#include<stack>
#include<bitset>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>

#pragma warning(disable:4996)
using namespace std;

int N;

int GetAns(long long mid) {
	if (mid <= 2) {
		return 0;
	}
	return GetAns((mid - 1) >> 1) + 1;
}

long long GetAns() {
	long long left = 2;
	long long right = 1000000000000000000;
	while (left < right) {
		long long mid = (left+right+1) >> 1;
		if (GetAns(mid) <= N) {
			left = mid;
		}
		else {
			right = mid - 1;
		}
	}
	return left;
}

int main() {
	scanf("%d",&N);
	printf("%lld\n",GetAns());
	return 0;
}

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

using namespace std;

int main (void) {
    while (1) {
        double v0, v;
        cin >> v0;
        if (cin.eof()) break;
        for (int n = 0; ; n++) {
            v = 9.8 * sqrt((5 * n - 5) / 4.9);
            if (v >= v0) {
                cout << n << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1232
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        int casos = Ent.nextInt();
        float total = 0;
        for (int i = 0; i < casos; i++) {
            float aux = Ent.nextInt();
            float numero = 1 / aux;
            total += numero;
        }
        System.out.println(1/total);
    }
}

Measured memory_bytes: 23252
import java.io.*;
import java.util.*;
import java.lang.ArrayIndexOutOfBoundsException;
import java.math.*;


class Main {
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	public static void main(String[] args) throws Exception {
		BigInteger n = new BigInteger(sc.next());
		BigInteger m = new BigInteger(sc.next());
		System.out.println(n.modPow(m, new BigInteger("1000000007")));
	}
}

Measured memory_bytes: 17364
N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9 + 7
cnt = [0] * (N + 1)
cnt[0] = 3
ans = 1
for a in A:
    ans *= cnt[a]
    ans %= mod
    cnt[a + 1] += 1
    cnt[a] -= 1
print(ans)


Measured memory_bytes: 13964
main(N,R,M,m,y,n,t,c,i,d){double r;
	for(scanf("%d",&N);N--;printf("%d\n",R)){
		for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){
			if(m=M,d=0,scanf("%d%lf%d",&t,&r,&c),t){ //fukuri
				for(i=0;i<y;i++){
					d=(int)(r*m);
					m=m+d-c;
				}
			}else{ //tanri
				for(i=0;i<y;i++){
					d+=(int)(r*m);
					m=m-c;
				}
				m+=d;
			}
		}
	}
exit(0);}

Measured memory_bytes: 0
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n; cin>>n; 
    int a[n],b[n],ans=0;
    for (int i=0;i<n;i++) cin>>a[i]>>b[i];
    for (int i=n-1;i>=0;i--){
    	a[i] += ans;
    	if (a[i]%b[i]) ans += b[i]-(a[i]%b[i]);
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 5072
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 3e18+7
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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 double PI = acos(-1.0);
const double EPS = 1e-10;

vector<vector<int>> G;
vector<ll> sum(202020);

void dfs(int v, int p, ll s){
    sum[v] += s;
    for(auto nv : G[v]){
        if(nv == p) continue;
        dfs(nv,v,sum[v]);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q;
    cin >> N >> Q;
    G.resize(N);
    REP(i,N-1){
        int a,b;
        cin >> a >> b;
        --a,--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    REP(i,Q){
        int p,x;
        cin >> p >> x;
        --p;
        sum[p] += x;
    }
    
    dfs(0,-1,0);
    REP(i,N) cout << sum[i] << " ";
    cout << endl;
}


Measured memory_bytes: 24320
#include <bits/stdc++.h> 
#define ll long long int 
using namespace std; 
  
int main() 
{  
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL);  
    int n;
     cin>>n;
    std::set<char >s; 
    for(int i=0;i<n;i++)  
    {
        char x; 
        cin>>x; 
        s.insert(x); 
    } 
    if(s.size()==3)  cout<<"Three"; 
    else 
         cout<<"Four";
    return 0; 
} 


Measured memory_bytes: 3632
// #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const int INF = 1e9;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
   ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
   ostr << "}";
   return ostr;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


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

 ll N;
 cin >> N;
 vector<ll> B(N-1);
 REP(i, N-1){cin >> B[i];}

 ll ans = 0;
 REP(i, N){
   if (i==0){ans += B[0];}
   else if (i==N-1){ans += B[N-2];}
   else {
     ll val = min(B[i-1], B[i]);
     ans += val;
   }}

   cout << ans << endl;




 return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a,b,m;
	int f=0;
	cin>>a>>b>>m;
	for(int i=1;i<b;i++){
		if(a*i%b==m){
			f++;
			break;
		}
	}
	cout<<(f?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 256
X, N = map(int, input().split())

ps = []
anti_Ps = []
if N != 0:
  ps = input()
  anti_Ps = [int(i) for i in ps.split()]
Ps = [int(i) for i in range(-100, 200) if i not in anti_Ps]

most_like_p = 1000
for p in Ps:
  if abs(p-X) == abs(most_like_p - X):
    most_like_p = min(p, most_like_p)
  elif abs(p-X) < abs(most_like_p - X):
    most_like_p = p

print(most_like_p)

Measured memory_bytes: 9200
from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10**9 + 7
L = defaultdict(lambda: [0,0])
zero = 0
for _ in range(N):
    A, B = map(int, input().split())
    if A==0: d=B
    elif B==0: d=A
    else: d=gcd(A,B)
    if d != 0:
        A, B = A//d, B//d
        if A<0: A, B = -A, -B
        if B>0: L[(A,B)][0] += 1
        else: L[(-B,A)][1] += 1
    else: zero += 1

res = 1

for x,y in L.values():
    res *= pow(2,x,MOD) + pow(2,y,MOD) -1
    res %= MOD
print((res+zero-1)%MOD)



Measured memory_bytes: 60604
// 2020-08-28 16:52:33
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<ll, ll>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
int sum[60][60];
void answer() {
  int n, k;
  cin >> n >> k;
  vector<P> ps(n);
  map<ll, int> mx, my;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    ps[i] = P(x, y);
    mx[x] = 0;
    my[y] = 0;
  }
  vector<ll> xs, ys;
  for (auto& m : mx) {
    xs.push_back(m.first);
    m.second = xs.size();
  }
  for (auto& m : my) {
    ys.push_back(m.first);
    m.second = ys.size();
  }
  for (auto& p : ps) {
    sum[mx[p.first]][my[p.second]] = 1;
  }
  rep(i, n) rep(j, n) {
    sum[i + 1][j + 1] += sum[i + 1][j] + sum[i][j + 1] - sum[i][j];
  }
  ll ans = 5e18;
  REP(i1, 1, n) REPC(i2, i1 + 1, n) REP(j1, 1, n) REPC(j2, j1 + 1, n) {
    int c =
        sum[i2][j2] - sum[i2][j1 - 1] - sum[i1 - 1][j2] + sum[i1 - 1][j1 - 1];
    if (c >= k) {
      ll now = (xs[i2 - 1] - xs[i1 - 1]) * (ys[j2 - 1] - ys[j1 - 1]);
      chmin(ans, now);
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

int main() {
  ll a,b; cin >> a >> b;
  ll k = (a+b)/2;
  if (abs(a-k) == abs(b-k)) cout << k << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


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

using namespace std;

#define fto(i, s, e) for(int i = s; i <= e; ++i)
#define fto1(i, s, e) for(int i = s; i < e; ++i)
#define fdto(i, s, e) for(int i = s; i >= e; --i)
#define fit(var, it) for(__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define frit(var, it) for(__typeof(var.rbegin()) it = var.rbegin(); it != var.rend(); ++it)

#define newl '\n'
#define debugt cerr << 0.001*clock() << newl
#define debug1(x, i) cout << #x << '[' << i << "] = " << x[i] << newl
#define debug(v, l, r) fto(_i, l, r) debug1(v, _i)
#define debug2(x, i, j) cout << #x << '[' << i << "][" << j << "] = " << x[i][j] << newl
#define debug3(x, i, j, k) cout << #x << '[' << i << "][" << j << "][" << k << "] = " << x[i][j][k] << newl

#define ll long long
#define ii pair<int, int>
#define ff first
#define ss second
#define pb push_back
#define glen(v) int((v).size())

template<typename T1, typename T2> ostream& operator<< (ostream &os, pair<T1, T2> const &v) {
	return os << '(' << v.ff << ", " << v.ss << ')';
}

#define eps 1e-15
#define oo 1000000007
#define OO 1000000000000000003LL
#define maxn 103

int n, w, sum;
int a[maxn], b[maxn];
ll f[maxn][100003];

int main() {
	#ifndef ONLINE_JUDGE
		//freopen("main.inp", "r", stdin);
		//freopen("main.out", "w", stdout);
	#endif
	//ios_base::sync_with_stdio(0); cin.tie(0);

	scanf("%d%d", &n, &w);

	fto (i, 1, n) {
		scanf("%d%d", &a[i], &b[i]);
		sum += b[i];
	}

	fto (i, 0, n) fto (j, 1, sum) f[i][j] = OO;

	fto (i, 1, n) {
		fto (j, 1, sum) {
			f[i][j] = f[i-1][j];
			if (j >= b[i]) f[i][j] = min(f[i][j], f[i-1][j-b[i]] + a[i]);
		}
	}

	fdto (j, sum, 0) if (f[n][j] <= w) {
		printf("%d\n", j);
		break;
	}

	return 0;
}


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

namespace ARC095C {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int[] inputb = new int[N];
            for(int i = 0; i < N; i++) {
                inputb[i] = input[i];
            }
            Array.Sort(inputb);
            int low = inputb[N / 2 - 1];
            int high = inputb[N / 2];
            for(int i = 0; i < N; i++) {
                int del = input[i];
                int ans = -1;
                if(del <= low) {
                    ans = high;
                } else {
                    ans = low;
                }
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 37060
#include <iostream>
#include <array>
#include <algorithm>
 
int main(void) {
    std::array<u_int, 10> heights;
	
    for (u_int i = 0; i < 10; ++i) {
        std::cin >> heights[i];
    }
	
    std::sort(heights.begin(), heights.end(), std::greater<u_int>());
	
    for (u_int i = 0; i < 3; ++i) {
        std::cout << heights[i] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1164
// God put a smile upon your face <3

#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 958585860497

#define base 2001487

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    ll a, b, c, d;

    while(cin >> a >> b >> c >> d)
    {
		bool on = 0;

		while(a > 0 && c > 0)
		{
			if(!on) c -= b;
			else a -= d;

//			cout << b << " " << d << endl;
			on ^= 1;
		}

		if(on) printf("Yes\n");
		else printf("No\n");
    }


}





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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll k;
  string s;
  cin >> k >> s;

  if (s.size() <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "..." << endl;
  }

  return 0;
}


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    ll a, b;
    cin >> a >> b;
    cout << a * b / __gcd(a, b) << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    vector<int> L(M);
    vector<int> R(M);
    for (int i = 0; i < M; ++i) {
        cin >> L[i] >> R[i];
    }

    vector<int> t(N+1, 0);

    for (int i = 0; i < M; ++i) {
        ++t[L[i]-1];
        --t[R[i]];
    }

    for (int i = 0; i < N+1; ++i) {
        t[i+1] += t[i];
    }

    int ans = count(begin(t), end(t), M);
    cout << ans << endl;

    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//end



int main(){
   int a,b,c; cin>>a>>b>>c;
   swap(a,b); swap(a,c);
   printf("%d %d %d\n",a,b,c);
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MIN -1000001
#define MAX 1000001

int main(void) {
    int a, n = MAX, x = MIN;
    long long s = 0;
    for(scanf("%*d"); ~scanf("%d", &a); s += a) {
        a < n && (n = a);
        a > x && (x = a);
    }
    printf("%d %d %lld\n", n, x, s);
    return 0;
}

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

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

    int count = 0;
    int shikai = D * 2 + 1;
    int nokori = N;

    while (0 < nokori){
        nokori -= shikai;
        count += 1;
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int64_t N,A,B;
  cin>>N>>A>>B;
  vector<int>X(N);
  for(int i=0;i<N;i++){
    cin>>X[i];
  }
  vector<int>table(N-1);
  for(int i=0;i<N-1;i++){
    table[i]=X[i+1]-X[i];
  }
  int64_t sum=0;
  for(int i=0;i<N-1;i++){
    sum+=min(B,A*table[i]);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
using namespace std;
 
int main(){
    int N,M;
    cin>>N;
    string s[N];
    for(int i=0;i<N;++i)cin>>s[i];
    cin>>M;
    string t[M];
    for(int i=0;i<M;++i)cin>>t[i];
    
    map<string,int> P{};
    int ans=0;
    for(int i=0;i<N;i++)P[s[i]]++;
    for(int i=0;i<M;i++)P[t[i]]--;

    for(int i=0;i<N;i++){
        if(ans<P[s[i]])ans=P[s[i]];
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cfenv>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 0x3f //plus infinite

typedef struct item{
  string name;
  int number;
  int money;
}item;

int A[2000000];
int ans[2000000];

int main(){
  int N;
  cin >> N;
  ans[1] = 0;
  for(int i = 2;i <= N;i++){
    cin >> A[i];
    ans[i] = 0;
  }

  for(int i = 2;i<=N;i++){
    ++ans[A[i]];
  }

  for(int i = 1;i<=N;i++){
    cout << ans[i] << endl;
  }
  


  return 0;
}

/*文字列の辞書順について
 *C++の順序では'0'～'9'→'A'～'Z'→'a'～'z'の順に
 *                       なっていることに注意しましょう。
 */

/*行単位での入力
 * getline(cin,文字列変数);
 */


Measured memory_bytes: 5160