akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  REP(n,N) {
    cin >> A[n];
    if (K <= n) {
      if (A[n-K] < A[n]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }



  return 0;
}


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

typedef long long ll;
#define rep(i, n) for (int i = 1; i * i <= (int)(n); i++)

int main() {
    int n,k;cin>>n>>k;
    string s;cin>>s;
    s[k-1] = tolower(s[k-1]);
    cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,p;
  cin >>a >>b >>p;
  p=a*b;
  if(p%2==0) {
    cout <<"Even"<<endl;
  }
  else{
    cout <<"Odd"<<endl;
  }
}
  

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
int prime[10010];
bool is_prime(int n)
{
	int i;
	if(i==1)
		return false;
	for(i=2;i<=sqrt(n);i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
int main()
{
	int n,p,i;
	memset(prime,0,sizeof(prime));
	for(i=1;i<=10000;i++)
	{
		if(is_prime(i))
			prime[i]=1;
	}
	while(scanf("%d",&n)!=EOF)
	{
		p=0;
		for(i=2;i<=n/2;i++)
		{
			if(prime[i]==1&&prime[n+1-i]==1)
				p++;
		}
		p*=2;
		if(n%2!=0&&prime[i]==1&&prime[n+1-i]==1)
			p++;
		printf("%d\n",p);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(3e6) +5;

ll fac[ms];


void check()
{
    int n=3e6;
    fac[0]=1;
    int i;
    for(i=1;i<=n;i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=modo;
    }
}

ll modp(ll a,ll b)
{
    ll r=1;
    while (b>0)
    {
        if(b&1)
        {
            r*=a;
            r%=modo;
        }
        a*=a;
        a%=modo;
        b>>=1;
    }
    return r;
}

ll ncr(ll n,ll r)
{
    ll nn=fac[n];
    ll dem=(fac[r]*fac[n-r])%modo;
    ll ans= nn*modp(dem,modo-2);
    ans%=modo;
    //cout<<n<<" "<<r<<" "<<ans<<endl;
    return ans;
}

ll help(ll n,ll r)
{
   // cout<<n<<" "<<r<<endl;
    if(n<r)return 0;
    return ncr(n+1,r+1);
}

int main()
{
    check();
    ll r1,c1,r2,c2;
    cin>>r1>>c1>>r2>>c2;
    r1++; c1++; r2++; c2++;
    int i;
    ll ans=0;
    ll kk;
    for(i=c1;i<=c2;i++)
    {
        kk=help(r2+i-2,i-1)+modo-help(r1+i-3,i-1);
       // cout<<"Adasd"<<endl;
        kk%=modo;
        ans+=kk;
        ans%=modo;
    }
    cout<<ans;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

ll rec(ll h) {
  if (h == 1) return 1;
  return 2 * rec(h/2) + 1;
}

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

  cout << rec(h) << endl;

  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N,X = map(int, input().split())

m = []
for i in range(0,N):
    data = int(input())
    m.append(data)

for i in m:
    X = X - i
if X == 0:
    print(int(len(m)))
else:
    print(int(len(m)) + int(X/min(m)))

Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<ll, ll>
const ll  MOD = 1000000007;

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (a >= k) cout << k;
	else if (a + b >= k) cout << a;
	else cout << a - (k - a - b);
	return 0;
}

Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int M = in.nextInt();
		int[] P = new int[M];
		Long[] Y = new Long[M];
		for (int i = 0; i < M; i++) {
			P[i] = in.nextInt() - 1;
			Y[i] = in.nextLong();
		}
		ArrayList<ArrayList<Long>> vals = new ArrayList<ArrayList<Long>>() {
			{
				for (int i = 0; i < N; i++) {
					add(new ArrayList<Long>());
				}
			}
		};
		for (int i = 0; i < M; i++) {
			vals.get(P[i]).add(Y[i]);
		}
		for (int i = 0; i < N; i++) {
			Collections.sort(vals.get(i));
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < M; i++) {
			int v = P[i];
			int id = Collections.binarySearch(vals.get(v), Y[i]);
			sb.append(String.format("%06d%06d", v + 1, id + 1));
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb.toString());
		in.close();
	}
}

Measured memory_bytes: 167400
import java.util.Scanner;

/**
 * My Number
 */
public class Main {

	static int[] num = new int[12];

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		for (int i = 0, j = 11; i < 12; i++, j--) {
			if (S.charAt(i) == '?') {
				num[j] = -1;
			} else {
				num[j] = S.charAt(i) - '0';
			}
		}

		int count = 0;
		int ans = 0;

		for (int i = 0; i < 12; i++) {
			if (num[i] == -1) {
				for (int j = 0; j <= 9; j++) {
					num[i] = j;
					if (check()) {
						count++;
						ans = j;
					}
					num[i] = -1;
				}
			}
		}

		if (count > 1) {
			System.out.println("MULTIPLE");
		} else {
			System.out.println(ans);
		}
	}

	static boolean check() {

		int digit = 0;

		for (int i = 11; i >= 1; i--) {
			if (i >= 7) {
				digit += num[i] * (i - 5);
			} else {
				digit += num[i] * (i + 1);
			}
		}

		digit %= 11;

		if (digit <= 1) {
			digit = 0;
		} else {
			digit = 11 - digit;
		}

		return digit == num[0];
	}
}


Measured memory_bytes: 26328
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
int main(){
    ll n; cin >> n;
    cout << n * n << endl;

}

Measured memory_bytes: 256
n, k = map(int, input().split())
if k == 0:
    print(n**2)
    exit()
ans = 0
for i in range(k, n+1):
    p = n // i
    r = n % i
    ans += p * (i - k) + max(0, (r - k + 1))

print(ans)


Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int n, r;
  while (scanf("%d %d", &n, &r) != EOF)
  {
    printf("%d\n", n >= 10 ? r : r + 100 * (10 - n));
  }
  return 0;
}

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

using namespace std;

int main(){
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	if (A1 + A2 + A3 >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
	return 0;
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}
template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int n, m; 
    cin >> n >> m;
    
    v_int a(n);
    cin >> a;
    sort(a.begin(), a.end());

    vector<pii> v;
    
    irep(i, m) {
        int b, c;
        cin >> b >> c;
        v.push_back({c,b});
    }
    sort(v.rbegin(), v.rend());

    int cnt = 0;
    v_int a2(n);

    irep(i, m) {
        if(cnt == n) { break; }
        irep(j, v[i].se) {
            if(cnt == n) { break; }
            a2[cnt++] = v[i].fi;    
        }
    }

    ll sum = 0;
    irep(i, n) {
        sum += max(a[i], a2[i]); 
    }
    cout << sum << endl;
    return 0;
} /*atcoder*/


Measured memory_bytes: 4972
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

typedef struct 
{
    unsigned int uiLeft;
    unsigned int uiArea;
}AreaInfo_t;

#define CALC_AREA(x,y) ((x) - (y))

stack<unsigned int> stuiArealeftIdx;
vector<AreaInfo_t> vectAreaInfo;

unsigned int Decision(char, unsigned int);  /* 水溜り検出(面積を計算) */
void Fusion(AreaInfo_t);                    /* 水溜り合成 */

int main(void){
    char ch = '\0';
    unsigned int uiIdx = 0;
    unsigned int uiTotal = 0;
    
    while(cin >> ch)
    {
        uiTotal += Decision(ch, uiIdx);
        uiIdx++;
    }
    
    cout << uiTotal << endl;
    cout << vectAreaInfo.size();
    for(vector<AreaInfo_t>::iterator it = vectAreaInfo.begin(); it != vectAreaInfo.end(); it++)
    {
        cout << ' ' <<  it->uiArea;
    }
    cout << endl;
    
    return 0;
    
}

unsigned int Decision(char ch, unsigned int uiIdx)
{
    unsigned int rslt = 0;
    
    switch(ch)
    {
        case '\\':
            stuiArealeftIdx.push(uiIdx);
            break;
        case '/':
            if(!stuiArealeftIdx.empty())
            {
                AreaInfo_t tInfo;
                tInfo.uiLeft = stuiArealeftIdx.top();
                tInfo.uiArea = CALC_AREA(uiIdx, stuiArealeftIdx.top());
                rslt =  tInfo.uiArea;
                stuiArealeftIdx.pop();
                Fusion(tInfo);
            }
            break;
        case '_':
            // pass
            break;
        default:
            // unreachable
            break;
    }

    return rslt;
}

void Fusion(AreaInfo_t tInfo)
{
    
    while(1)
    {
        if(!vectAreaInfo.empty())
        {
            AreaInfo_t tmp = vectAreaInfo.back();
            if(tmp.uiLeft > tInfo.uiLeft)
            {
                tInfo.uiArea += tmp.uiArea;
                vectAreaInfo.pop_back();
                continue;
            }
        }
        vectAreaInfo.push_back(tInfo);
        break;
    }

    return;
}



Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    if (k > (n-1)*(n-2)/2){
        PRINT(-1);
        return 0;
    }
    k = (n-1)*(n-2)/2-k;
    PRINT(n-1+k);
    int from = 1,to = 2;
    rep(_,n-1+k){
        cout << from << " " << to << endl;
        if (to < n) to++;
        else{
            from++;
            to = from+1;
        }
    }
}    


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,M;
  cin>>N>>M;
  
  vector<int> K(N);
  
  vector<vector<int>> A(N,vector<int>());
  
  for(int i=0;i<N;i++){
    cin>>K[i];
    A[i].resize(K[i]);
    for(int j=0;j<K[i];j++){
      cin>>A[i][j];
    }
  }
  
  vector<int> check(M,0);
  
  
  for(int i=0;i<N;i++){
    for(int j=0;j<K[i];j++){
      for(int l=1;l<=M;l++){
        if(A[i][j]==l){
          check[l-1]++;
        }
      }
    }
  }
  
  int ans=0;
  
  for(int i=0;i<M;i++){
    if(check[i]==N){
      ans++;
    }
  }
  
  cout<<ans<<endl;
}

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


int main() {
	
	int N;
	cin >> N;
	vector<int> v(N);
	for(int i=0; i<N; i++) cin >> v.at(i);
	sort(v.begin(), v.end());
	reverse(v.begin(),v.end());
	double value;
	for(int i=0; i<N; i++){
		if(i==N-1){
			value += v.at(i)/pow(2,i);
		}
		else value += v.at(i)/pow(2,i+1);
	}
	cout << value << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[500010];
int x=0;
void dfs(ll i,ll c){
	a[++x]=i;
	if(c==10) return;
	for(ll j=max(ll(0),(i%10)-1);j<=min(ll(9),(i%10)+1);j++){
		dfs(i*10+j,c+1);
	}
}
int main(){
	for(int i=1;i<=9;i++){
		dfs(i,1);
	}
	sort(a,a+x);
	ll k;
	cin >> k;
	cout << a[k];
	return 0;
}

Measured memory_bytes: 1792
n = int(input())
XYH = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[2])

for x in range(101):
    for y in range(101):
        hmax = XYH[0][2] + abs(x-XYH[0][0]) + abs(y-XYH[0][1])
        for i in range(n):
            if max(hmax-abs(x-XYH[i][0])-abs(y-XYH[i][1]), 0) != XYH[i][2]:
                break
            if i==n-1:
                print(x, y, hmax)
                exit()

Measured memory_bytes: 9160
#include <iostream>
#include <cstdlib>
#include <stack>

using namespace std;

int main()
{
    stack<int> S;
    string s;
    int num;
    int opd, opt;

    while( cin >> s )
    {
        if ( s[0] == '+' )
        {
            opd = S.top();
            S.pop();
            opt = S.top();
            S.pop();
            S.push(opt+opd);
        }
        else if ( s[0] == '-')
        {
            opd = S.top();
            S.pop();
            opt = S.top();
            S.pop();
            S.push(opt-opd);
        }
        else if ( s[0] == '*' )
        {
            opd = S.top();S.pop();
            opt = S.top();S.pop();
            S.push(opt*opd);
        }
        else
            S.push(atoi(s.c_str()));
    }
    cout << S.top() << endl;

    return 0;
}



Measured memory_bytes: 3172
#include <cstdio>
#include <cstring>
typedef long long ll;
int x, y;
ll dp[20][20];
int mp[20][20];
int main() {
  while (scanf("%d%d",&x,&y)) {
    if (!x&&!y) break;
    memset(dp, 0, sizeof(dp));
    memset(mp, 0, sizeof(mp));
    for (int i=0; i<y; i++) {
      for (int j=0; j<x; j++) scanf("%d",&mp[i][j]);
    }
    for (int i=0; i<x; i++) if (mp[0][i]!=1) dp[0][i]=1;
    ll res = 0;
    for (int i=0; i<y-1; i++) {
      for (int j=0; j<x; j++) {
        if (mp[i][j]==2&&mp[i+2][j]!=1) {
          dp[i+2][j]+=dp[i][j];
        } else if (mp[i][j]==0) {
          if (j-1>=0&&mp[i+1][j-1]==0) dp[i+1][j-1]+=dp[i][j];
          if (mp[i+1][j]!=1) dp[i+1][j]+=dp[i][j];
          if (j+1<x&&mp[i+1][j+1]==0) dp[i+1][j+1]+=dp[i][j];
        }
      }
    }
    for (int i=0; i<x; i++) res+=dp[y][i]+dp[y-1][i];
    printf("%lld\n",res);
  }
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main() {
    int a[3][3];
    rep(i,3)rep(j,3) cin >> a[i][j];
    int n;
    cin >> n;
    VI b(n);
    rep(i,n) cin >> b[i];
    bool c[3][3];

    rep(i,3) {
        rep(j,3) {
                c[i][j] = false;
            rep(k,n) {
                if(b[k] == a[i][j]) {
                    c[i][j] = true;
                }
            }
        }
    }

    rep(i,3) {
        if(c[i][0] and c[i][1] and c[i][2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    rep(i,3) {
        if(c[0][i] and c[1][i] and c[2][i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(c[0][0] and c[1][1] and c[2][2]) {
        cout << "Yes" << endl;
        return 0;
    }

    if(c[0][2] and c[1][1] and c[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}


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

int main(){
    int A , B , C , s;
    cin >> A >> B >> C;
    bool flag = false;
    for(int i=0;i<100;i++){
        s = (A*i)%B;
        if(s == C){
            flag = true;
        }
        //cout << s << endl;
    }
    if(flag == true){
        cout << "YES";
    }else{
        cout << "NO";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int factors[1007];

int main()
{
    ll N;
    cin >> N;
    ll N1 = N;

    while (N > 1) {
        ll n = N;
        for (ll i = 2; i <= sqrt(N); i++) {
            while (n % i == 0) {
                factors[i]++;
                n /= i;
            }
        }
        if (n > 1) {
            factors[n]++;
        }
        N--;
    }

    ll ans = 1;
    for (ll i = 2; i <= N1; i++) {
        if (factors[i] > 0) {
            ans *= ((factors[i] + 1) % MOD);
            ans %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>graph[1000001];
int dp[1000001];
int solve(int src){
    if(dp[src] != -1){
        return dp[src];
    }
    bool leaf = 1;
    int bestchild = 0;
    for(auto child: graph[src]){
       leaf = 0;
       bestchild  =max(bestchild , solve(child));
    }
    if(leaf == 1){
        return dp[src] = 0;
    }else{
        return dp[src] = 1 + bestchild;
    }
}
int main(){
    memset(dp , -1 , sizeof(dp));
    int n , m;
    cin>>n>>m;
    for(int i=0 ; i<m ; i++){
        int x , y;
        cin>>x>>y;
        graph[x].push_back(y);
    }
    int ans = 0;
    for(int i=1 ; i<=n ; i++){
        ans = max(ans , solve(i));
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 32768
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: i64, r: i64
    }
    puts!("{}\n", r + 100 * max(10 - n, 0));
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int count = 0;
  
  for(A; A<=B; A++){
    int x = A;
    if ((x % 10 == x / 10000) && ((x/10) % 10 == (x/1000) % 10)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
long long n, m, l, x, s, t;
long long a[200001];
long long b[200001];
int main() {
	scanf("%ld%lld%lld", &n, &m, &l);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &x);
		a[i + 1] = a[i] + x;
	}
	for (int i = 0; i < m; i++) {
		scanf("%lld", &x);
		b[i + 1] = b[i] + x;
	}
	while (s <= n && a[s] <= l)s++;
	s--;
	x = 0;
	while (s >= 0) {
		while (t <= m && a[s] + b[t] <= l)t++;
		t--;
		if (x < s + t)x = s + t;
		s--;
	}
	printf("%lld\n", x);
}

Measured memory_bytes: 4848
import sys
input = sys.stdin.readline

N, K = map(int,input().split())
A = sorted((map(int,input().split())), reverse=True)
F = sorted(map(int,input().split()))

def judge(k):
    cnt = 0
    for a, f in zip(A, F):
        x = k//f
        d = a - x if a > x else 0
        cnt += d
    if cnt <= K:
        return True
    else:
        return False

def biserch(ok,ng,judge):
    while abs(ok-ng) > 1:
        mid = (ok+ng) // 2
        if judge(mid):
            ok = mid
        else:
            ng = mid
    return ok

ans = biserch(10**12, -1, judge)
print(ans)

Measured memory_bytes: 107084
n=gets.to_i
d=n.times.map{gets.split.map(&:to_i)}

(n-2).times do |i|
  if d[i][0]==d[i][1] && d[i+1][0]==d[i+1][1] && d[i+2][0]==d[i+2][1]
    puts "Yes"
    return
  end
end
puts "No"


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i] -= (i+1);
    }
    sort(a.begin(),a.end());
    ll res=0,mid;
    if(n%2) mid=a[(n-1)/2];
    else mid=(a[n/2]+a[n/2-1])/2;
    for(int i=0;i<n;i++){
        res += abs(mid-a[i]);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1792
def isPrime(n): 

	# Corner case 
	if n <= 1: 
		return False

	# Check from 2 to n-1 
	for i in range(2, n): 
		if n % i == 0: 
			return False; 

	return True

x=int(input())
if isPrime(x): print(x)
while not isPrime(x):
    x+=1
    if isPrime(x): print(x)
    
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main() {
  ll n;
  cin >> n;
  vector<ll>a(n);
  vector<ll>b(n);

  cin >> a;
  ll ans = 0;

  ll m = 0;
  for(int i=0;i<n;i++){
    if (a[i] < 0)m++;
    ans += abs(a[i]);
    b[i] = abs(a[i]);
  }

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


  cerr << m << endl;
  cerr << b[0] <<endl;
  cerr << ans <<endl;

  if (m %2 ==0){

  }else{
    ans -=b[0];
    ans -=b[0];
  }



  cout << ans ;

}




















Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vector<LL> cnt(n + 1, 0);
    vector<int> data(n);
    for (auto &v : data) {
        cin >> v;
        cnt[v]++;
    }
    long long sum = 0;
    for (int i = 1 ; i <= n ; i++) {
        sum += (cnt[i] - 1) * cnt[i] / 2;
    }
    for (int i = 0 ; i < n ; i++) {
        int x = data[i];
        cout << sum - (cnt[x] - 1) * cnt[x] / 2 + (cnt[x] - 2) * (cnt[x] - 1) / 2 << '\n';;
    }
    


}

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

int main()
{
  ll n; cin >> n;
  vector<ll> a(5);
  ll mi = 1LL<<60;
  rep(i, 5) {
    cin >> a[i];
    mi = min(mi, a[i]);
  }
  cout << (n+mi-1)/mi + 4 << endl;

  return 0;
}


Measured memory_bytes: 256
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_10_A: Fibonacci Number

#include <algorithm>
#include <cstdio>

#define NDEBUG
#include <cassert>

class Fibonnacci {
  static const unsigned int N = 44u;
  unsigned int n_;
  unsigned long* f_;

public:
  Fibonnacci(unsigned int n = N) : n_(std::max(1u, n))
  {
    f_ = new unsigned long[n_+1];
    f_[0] = f_[1] = 1;
    for (auto i = 2u; i <= n_; ++i) {
      f_[i] = f_[i-1] + f_[i-2];
    }
  }

  ~Fibonnacci() { delete[] f_; }
  
  unsigned long operator () (unsigned int n) const
  {
    assert(n <= n_);
    return f_[n];
  }
};

int main()
{
  unsigned int n;
  std::scanf("%u", &n);
  Fibonnacci fib;
  std::printf("%lu\n", fib(n));
}

// eof

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = 1e9 + 7;
const int MAX_N = 5050;

ll dp[MAX_N][MAX_N];
ll dp2[MAX_N];

int main2() {
  CLR(dp, 0);
  CLR(dp2, 0);
  
  int N = nextInt();
  int K = nextInt();
  vector<int> a;
  REP(i, N) {
    int x = nextInt();
    if (x < K) a.push_back(x);
  }
  N = a.size();

  dp[0][0] = 1;
  for (int n = 0; n < N; n++) {
    for (int k = 0; k <= K; k++) {
      dp[n+1][k] = dp[n][k] + (k-a[n] >= 0 ? dp[n][k-a[n]] : 0);
      dp[n+1][k] %= MOD;
    }
  }
  int noNeed = 0;
  for (int n = 0; n < N; n++) {
    CLR(dp2, 0);
    for (int k = 0; k <= K; k++) {
      dp2[k] = dp[N][k] - (k-a[n] >= 0 ? dp2[k-a[n]] : 0);
      dp2[k] = (dp2[k] % MOD + MOD) % MOD;
    }
    int on = 0;
    for (int k = K - a[n]; k < K; k++) if (dp2[k] != 0) on++;
    if (on == 0) noNeed++;
  }
  cout << noNeed << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 199552
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <array>
#include <valarray>

using namespace std;

int main()
{
    int N;
    scanf("%d\n", &N);
    // vector<int> X(N);
    unordered_map<int, int> cards;
    for (int i = 0; i < N; ++i){
        int Xi;
        scanf("%d", &Xi); getchar();
        // X[i] = Xi;
        if (cards.count(Xi)){
            ++cards[Xi];
            if (cards[Xi] == 3) cards[Xi] = 1;
        }else{
            cards.emplace(Xi, 1);
        }
    }
    int single = 0;
    int dual = 0;
    for (auto& card : cards){
        if (card.second == 1){
            ++single;
        }else{
            ++dual;
        }
    }
    printf("%d\n", single + dual - (dual % 2));
}


Measured memory_bytes: 4388
import java.util.*;
public class Main {
    
    // Euclid's algorithm
    static int GCD(int a, int b) {
        if (b == 0) return a;
        return GCD(b, a % b);
    }
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println((360/GCD(n,360)));
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }
}

Measured memory_bytes: 35620
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;


int main()
{


        int N,L;
        cin >> N>>L;
        vector<string> data;
        for(int i=0;i<N;i++){
                string tmp;
                cin>>tmp;
                data.push_back(tmp);
        }
        sort(data.begin(),data.end());

        for(int i=0;i<N;i++)cout<<data[i];
        cout<<endl;



        return 0;



}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int A[20];
int n;
//int cnt;
long long solve(int l,int r,int L,int R)
{
	if(l>r)return 0;
//	cnt++;
	long long ans=1e18;
	for(int i=l;i<=r;i++)
		ans=min(ans,solve(l,i-1,L,L+R)+solve(i+1,r,L+R,R)+1ll*(L+R)*A[i]);
	return ans;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&A[i]);
	printf("%lld\n",A[1]+A[n]+solve(2,n-1,1,1));
//	cerr<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2000, INF = 0x3f3f3f3f, M = 2e6 + 5;
const ll LNF = 0x3f3f3f3f3f3f3f3f;
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, r, l) for (int i = r; i >= l; i--)
#define repe(i, u) for (int i = head[u]; i; i = nxt[i])

const double PI = M_PI;
int X[N], Y[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout.precision(10);
  cout << fixed;
  double x, y, tx, ty;
  int n;
  cin >> n;
  rep(i, 1, n) cin >> X[i] >> Y[i];
  double ans = 0;
  rep(i, 0, 99) {
    x = cos(2 * PI * i / 100);
    y = sin(2 * PI * i / 100);
    tx = ty = 0;
    rep(j, 1, n) if (x * X[j] + y * Y[j] >= 0) tx += X[j], ty += Y[j];
    ans = max(ans, sqrt(tx * tx + ty * ty));
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem(s))
}

fun problem(s: String): String {
    val counts = s.toList().sorted().groupBy { it }.map { it.value.count() }
    val a = counts[0]
    val b = if (counts.size >= 2) counts[1] else 0
    val c = if (counts.size >= 3)  counts[2] else 0
    return if (Math.abs(a - b) < 2 && Math.abs(a - c) < 2 && Math.abs(b - c) < 2) "YES" else "NO"
}

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

int main(void)
{
    long long int n;
    cin >> n;
    int ans = 0;
    for(long long int i = 2; i * i <= n; i++)
    {
        int k = 0;
        int j = 0;
        while( n % i == 0 )
        {
            if( j >= k )
            {
                k++;
                ans++;
                j = 0;
            }
            else
            {
                j++;
            }
            n /= i;            
        }
    }
    if( n > 1 ) ans++;

    cout << ans;
}





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

using namespace std ;

int Max(int a, int b )
{
    return(a>b) ? a : b ;
}


int main()
{
    int a , b, x ;
    cin>>x ;
    cin>>a>>b ;

    x-=a ;

    x%=b ;

    cout<<x <<endl ;



    return 0 ;
}



Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int dp[10][5];//dp[i][1]dp[i][1]dp[i][1]dp[i][1]
int m[10];
int main(){
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int cnt=0;
    for(int i=1;i<=n;i++){
        int m;
        scanf("%d",&m);
        if(m<a||m>=b) cnt++;
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string c;
    cin >> c;
    
    int nx = 0; 
    for(int i=0; i<c.size() ;i++){
        if(c.at(i)=='x'){
            nx++;
        }
    }
    // cout << nx << endl;
    if(nx>= 8){
        cout<< "NO" <<endl;
    }else{
        cout<< "YES" <<endl;
    }
}

Measured memory_bytes: 3584
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
#define mod 1000000007
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define loop(x,y,z) for(int x=y;x<z;x++)
ll power(ll a , ll b){ll res=1;for(ll i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    map<str,ll>m;
    while(x--){
        str s;
        cin>>s;
        m[s]++;
    }
    cout<<m.size();
    return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    ll a[n];
    ll as=0;
    ll at=0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        as+=a[i];
        if(i%2==0)at+=a[i];
    }
    ll x[n];
    x[0]=at-as/2;
    for(int i = 1; i < n; i++) {
        x[i]=a[i-1]-x[i-1];
    }

    for(int i = 0; i < n; i++) {
        cout << x[i]*2 << " ";
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

const int INF=1e9;
class BinaryIndexcedTree
{
// 1-indexed
public:
    vector<int> data;
    BinaryIndexcedTree(int N):data(N+1,-INF){}
    void updata(int i,int x){
        for(;i<data.size();i+=i&-i) chmax(data[i],x);
    }
    int query(int i){
        int res=-INF;
        for(;i>0;i-=i&-i) chmax(res,data[i]);
        return res;
    }
};

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

    int N; cin>>N;
    vector<int> h(N),a(N);
    for(int i=0;i<N;i++) cin>>h[i];
    for(int i=0;i<N;i++) cin>>a[i];

    vector<int> dp(N+1,-INF);
    BinaryIndexcedTree bit(N);
    for(int i=0;i<N;i++){
        dp[h[i]]=a[i];
        chmax(dp[h[i]],bit.query(h[i]-1)+a[i]);
        bit.updata(h[i],dp[h[i]]);
    }
    int ans=-INF;
    for(int i=1;i<=N;i++) chmax(ans,dp[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N >> K;
    vi x(N), y(N);
    REP(i, N) {
        cin >> x[i] >> y[i];
    }
    vi xx = x, yy = y;
    sort(ALL(xx));
    sort(ALL(yy));
    UNIQUE(xx);
    UNIQUE(yy);
    map<int, int> mpx, mpy;
    REP(i, xx.size()) {
        mpx[xx[i]] = i + 1;
    }
    REP(i, yy.size()) {
        mpy[yy[i]] = i + 1;
    }
    W = x.size() + 1;
    H = y.size() + 1;
    vvi dp(H, vi(W));
    REP(i, N) {
        dp[mpy[y[i]]][mpx[x[i]]]++;
    }
    REP(h, H) {
        REP(w, W - 1) {
            dp[h][w + 1] += dp[h][w];
        }
    }
    REP(w, W) {
        REP(h, H - 1) {
            dp[h + 1][w] += dp[h][w];
        }
    }
    ans = LLINF;
    REP(uh, H) {
        REP(uw, W) {
            FOR(dh, 0, uh - 1) {
                FOR(dw, 0, uw - 1) {
                    if (dp[uh][uw] - dp[uh][dw] - dp[dh][uw] + dp[dh][dw] >= K) {
                        Y = yy[uh - 1] - yy[dh];
                        X = xx[uw - 1] - xx[dw];
                        ans = min(X * Y, ans);
                        dump(yy[uh - 1], xx[uw - 1], yy[dh], xx[dw], X, Y);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int n;cin>>n;
    int x=n%10;

    if(x==3)cout<<"bon"<<endl;
    else if(x==0||x==1||x==6||x==8)cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;
const int N = 55;
const int M = 110;
const int K = 10010;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
int n, m, money;
struct edge{
    int v, cost, tim, nxt;
}e[M<<2];
int tot, head[N], c[N], d[N];
ll dis[N][K];
struct node{
    int u, cst;
    ll dis;
    node(int u = 0, int cst = 0, ll dis = 0):u(u),cst(cst),dis(dis){}
    bool operator<(const node& rh)const{
        return dis > rh.dis;
    }
};
void init(void){
    tot = 0; memset(head, -1, sizeof head);
}
void addedge(int u, int v, int a, int b){
    e[tot] = (edge){v, a, b, head[u]}; head[u] = tot++;
    e[tot] = (edge){u, a, b, head[v]}; head[v] = tot++;
}
void dijkstra(int s){
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j < K; ++j) dis[i][j] = INF;
    }
    for (int i = 0; i <= min(money, K-1); ++i){
        dis[s][i] = 0;
    }
    priority_queue<node> q;
    q.push(node(s, min(money, K-1), 0));
    while (!q.empty()){
        node p = q.top(); q.pop();
        int u = p.u, cost = p.cst;
        ll ds = p.dis;
        if (ds != dis[u][cost]) continue;
        for (int i = head[u]; i != -1; i = e[i].nxt){
            int v = e[i].v, cst = e[i].cost, tim = e[i].tim;
            if (cost >= cst && dis[v][cost-cst] > dis[u][cost]+tim){
                dis[v][cost-cst] = dis[u][cost]+tim;
                q.push(node(v, cost-cst, dis[v][cost-cst]));
            }
        }
        if (cost+c[u] < K){
            if (dis[u][cost+c[u]] > dis[u][cost]+d[u]){
                dis[u][cost+c[u]] = dis[u][cost]+d[u];
                q.push(node(u, cost+c[u], dis[u][cost+c[u]]));
            }
        }
    }
}
int main(void){
    IOS;
    init();
    cin >> n >> m >> money;
    for (int i = 1; i <= m; ++i){
        int u, v, a, b; cin >> u >> v >> a >> b;
        addedge(u, v, a, b);
    }
    for (int i = 1; i <= n; ++i){
        cin >> c[i] >> d[i];
    }
    dijkstra(1);
    for (int i = 2; i <= n; ++i){
        ll t = INF;
        for (int j = 0; j < K; ++j){
            t = min(t, dis[i][j]);
        }
        cout << t << endl;
    }
    return 0;
}

Measured memory_bytes: 15552
import sys
input = sys.stdin.readline

n, m = map(int, input().split())

a_set=set()

for index in range(m):
    a_set.add(int(input()))

ans_list=[]

for index in range(n + 1):
    ans_list.append(0)

for index in range(n + 1):
    if index == 0:
        ans_list[index] += 1
        continue
    if index == 1 and (index not in a_set):
        ans_list[index] += ans_list[index - 1]
        continue
    
    if index not in a_set:
        if (index - 1) not in a_set:
            ans_list[index] += ans_list[index - 1]
            ans_list[index] %= 1000000007
        if (index - 2) not in a_set:
            ans_list[index] += ans_list[index - 2]
            ans_list[index] %= 1000000007

print(ans_list[n])


Measured memory_bytes: 11884
#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
#include <string.h>
#include <limits>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <chrono>

using namespace std;

namespace
{

}

#if 1
int main()
{
	string s;
	cin >> s;
	if (s.length() == 3)
	{
		swap(s[0], s[2]);
	}

	cout << s;
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int lenS = S.length();
    int x = 0;
    int cnt = 0;
    rep(i, lenS) {
        if (S[i] == 'x') cnt++;
    }
    int lenA = S.length()-cnt;
    char A[lenA];
    int k = 0;
    rep(i, lenS) {
        if (S[i] == 'x') continue;
        else {
            A[k] = S[i];
            k++;
        }
    }
    rep(i, lenA/2) {
        if (A[i] != A[lenA-i-1]) {
            cout << "-1" << endl;
            return 0;
        }
    }
    int L = 0;
    int R = lenS - 1;
    int ans = 0;
    while (L < R) {
        //dump(L); dump(R);
        if (S[L] == 'x' && S[R] != 'x') {
            ans++;
            L++;
        } else if (S[L] != 'x' && S[R] == 'x') {
            ans++;
            R--;
        } else {
            L++; R--;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 592
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

ll dp[100010][5],a[100010],b[100010],c[100010];

int main(void){
	          ll i,j;

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

	          ll N;
	          cin >> N;
	          for(i=1;i<=N;i++) cin >> a[i] >> b[i] >> c[i];

	          dp[1][0]=a[1];
	          dp[1][1]=b[1];
	          dp[1][2]=c[1];

	          for(i=1;i<N;i++){
	        		  dp[i+1][0]=max(dp[i][1]+a[i+1],dp[i][2]+a[i+1]);
	        		  dp[i+1][1]=max(dp[i][0]+b[i+1],dp[i][2]+b[i+1]);
	        		  dp[i+1][2]=max(dp[i][1]+c[i+1],dp[i][0]+c[i+1]);
	          }

	          cout << max(dp[N][0],max(dp[N][1],dp[N][2])) << endl;

	          return 0;
}


Measured memory_bytes: 6528
/*
    B - 1 Dimensional World's Tale
    https://atcoder.jp/contests/abc110/tasks/abc110_b
*/
#include <bits/stdc++.h>
using namespace std;

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

    int n, m, x, y, input;
    cin >> n >> m >> x >> y;

    for (int i = 0; i < n; i++) {
        cin >> input;
        x = max(x, input);
    }

    for (int i = 0; i < m; i++) {
        cin >> input;
        y = min(y, input);
    }

    // x_N < Z <= y_M
    if (x < y) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }

    return 0;
}

Measured memory_bytes: 256