akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f3f3f3f3fLL
#define MOD 2019
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (ll i=(a); i >= b; i--)

#define MN 55
#define MM 2505
int n, m;
ll s;
ll c[MN], d[MN];
vector<pair<int, pll> > e[MN];
ll mn[MN][MM];

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

    cin >> n >> m >> s;
    F0R(_, m){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        e[u].pb({v, {a, b}});
        e[v].pb({u, {a, b}});
    }
    FOR(i, 1, n){
        cin >> c[i] >> d[i];
    }

    s = min(s, 2500LL);

    memset(mn, -1, sizeof mn);

    priority_queue<pair<ll, pll> > pq;
    pq.push({0, {1, s}});
    while(!pq.empty()){
        pair<ll, pll> top = pq.top();
        pq.pop();
        ll ct = -top.f; int cn = top.s.f, ca = top.s.s;
        if(ca < 0) continue;
        ca = min(ca, 2500);

        if(mn[cn][ca] != -1) continue;
        mn[cn][ca] = ct;

        for(auto nn : e[cn]){
            pq.push({-(ct+nn.s.s), {nn.f, ca-nn.s.f}});
        }
        pq.push({-(ct+d[cn]), {cn, ca+c[cn]}});
    }
    FOR(i, 2, n){
        ll ans = INF;
        FOR(j, 0, 2500){
            ans = min(ans, mn[i][j]);
        }
        cout << ans << "\n";
    }

    return 0;
}


Measured memory_bytes: 16520
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>

using namespace std;
const double INF = 1e10;

struct Edge{
  int cost, to;
  Edge(int cost, int to):
    cost(cost), to(to) {}
};

double dijkstra(int a, int b, vector<int> &T, vector< vector<Edge> > &G){
  int n = T.size(), m = G.size();
  vector< vector<double> > D((1<<n),vector<double>(m,INF));
  priority_queue< tuple<double,int,int> > wait;
  wait.emplace(0,(1<<n)-1,a);
  while(!wait.empty()){
    double t = -get<0>(wait.top());
    int u = get<1>(wait.top()), v = get<2>(wait.top());
    wait.pop();
    if(t >= D[u][v]) continue;
    D[u][v] = t;
    for(int i = 0; i < G[v].size(); ++i){
      int d = G[v][i].cost, next_v = G[v][i].to;
      for(int j = 0; j < n; ++j){
        if(((u>>j) & 1) && t+(double)d/T[j] < D[u-(1<<j)][next_v]){
          wait.emplace(-t-(double)d/T[j],u-(1<<j),next_v);
        }
      }
    }
  }
  double ret = INF;
  for(int i = 0; i < (1<<n); ++i){
    ret = min(ret,D[i][b]);
  }
  return ret;
}

int main(){
  int n, m, p, a, b;
  while(cin >> n >> m >> p >> a >> b, n){
    --a;
    --b;
    vector<int> T(n);
    for(int i = 0; i < n; ++i) cin >> T[i];
    int x, y, z;
    vector< vector<Edge> > G(m);
    for(int i = 0; i < p; ++i){
      cin >> x >> y >> z;
      --x;
      --y;
      G[x].emplace_back(z,y);
      G[y].emplace_back(z,x);
    }
    double ans = dijkstra(a,b,T,G);
    if(ans >= INF) cout << "Impossible" << endl;
    else printf("%.12f\n",ans);
  }
  return 0;
}



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

class Program
{
    static void Main(string[] args)
    {


        int a,b,c,d;
        a = int.Parse(Console.ReadLine());

        string[] str1 = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        string[] str2 = Console.ReadLine().Split(' ');

        int[] count = new int[200];
        int[,] map = new int[2,200];

        for(int i = 0; i < a;i++)
        {
            map[0, i] = int.Parse(str1[i]);
            map[1, i] = int.Parse(str2[i]);
        }


        
        for(int i = 0; i <= a; i++)
        {
            int x = 0, y = 0;
            for (int j = 0;j<= a; j++)
            {
                count[i] += map[y, x];
                if (j == i)
                {
                    y++;
                }
                else
                    x++;
            }
            
        }

        int CM = count.Max();
        //for (int i = 0; i <= a; i++)
        {
            /*
            inte.Add(y * a + x);
            count += map[y, x];
            if (y == 0)
            {

                if (map[y + 1, x] > map[y, x + 1])
                {
                    y++;
                }
                else
                    x++;
            }
            else
                x++;
                */

            

        }
        
        //b = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
        //c = int.Parse(str[1]);

         Console.Write("{0}", CM);//改行なし出力
        /*
        for (int i = 0; i < inte.Count; i++)
        {
            Console.Write(inte[i] + " ");
        }
        */
        //onsole.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);//改行付き出力
    }
}


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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define print_var(x) cerr << #x << " = " << x << endl
#define print_array(arr, len) {cerr << #arr << " = "; for (int i = 0; i < len; i++) cerr << arr[i] << " "; cerr << endl;}
#define print_iterable(it) {cerr << #it << " = "; for (const auto &e : it) cerr << e << " "; cerr << endl;}
#else
#define eprintf(...) (void)0
#define print_var(x) (void)0
#define print_array(arr, len) (void)0
#define print_iterable(it) (void)0
#endif

using ll = long long;
const int N = 100500;

int n, q, root;
vector<pair<int, int>> go[N];
ll dist[N];

void dfs(int v, int p, ll d)
{
    dist[v] = d;
    for (auto e : go[v])
    {
        int to = e.first;
        int w = e.second;
        if (to == p)
            continue;
        dfs(to, v, d + w);
    }
}

void solve()
{
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++)
    {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        a--, b--;
        go[a].emplace_back(b, c);
        go[b].emplace_back(a, c);
    }
    scanf("%d%d", &q, &root);
    root--;
    dfs(root, -1, 0);
    for (int i = 0; i < q; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        a--, b--;
        printf("%lld\n", dist[a] + dist[b]);
    }
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    solve();

    eprintf("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

array<int, 101> tbl;
void factorize(int n) {
    for (int i = 2; i*i <= n; ++i) {
        while (n % i == 0) {
            ++tbl[i];
            n /= i;
        }
    }
    if (n > 1) ++tbl[n];
}

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

    for (int i = 2; i <= N; ++i) {
        factorize(i);
    }

    int ans = 0;
    ans += count_if(tbl.begin(), tbl.end(), [](int n){return n >= 74;});
    int a, b;
    a = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 2;});
    b = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 24;});
    if (a > 1 && b > 0) ans += b * (a-1);
    a = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 4;});
    b = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 14;});
    if (a > 1 && b > 0) ans += b * (a-1);
    a = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 2;});
    b = count_if(tbl.begin(), tbl.end(), [](int n){return n >= 4;});
    if (a > 2 && b > 1) ans += b * (b-1) / 2 * (a - 2);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
     
#define LL long long
#define RG register
     
using namespace std;
template<class T> inline void read(T &x) {
	x = 0; RG char c = getchar(); bool f = 0;
	while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') c = getchar(), f = 1;
	while (c >= '0' && c <= '9') x = x*10+c-48, c = getchar();
	x = f ? -x : x;
	return ;
}
template<class T> inline void write(T x) {
	if (!x) {putchar(48);return ;}
	if (x < 0) x = -x, putchar('-');
	int len = -1, z[20]; while (x > 0) z[++len] = x%10, x /= 10;
	for (RG int i = len; i >= 0; i--) putchar(z[i]+48);return ;
}
const int N = 2010, Mod = 1e9 + 7;
int f[N][N], sum[N];
int fpow(int a, int b) {
	if (b < 0) return 1;
	int res = 1;
	for (; b; b >>= 1, a = 1ll * a * a % Mod)
		if (b & 1) res = 1ll * res * a % Mod;
	return res;
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	int n, k; read(n), read(k);
	f[0][n + 1] = 1;
	for (int i = 1; i <= k; i++) {
		sum[n + 1] = f[i - 1][n + 1];
		for (int j = n; j; j--) sum[j] = (sum[j + 1] + f[i - 1][j]) % Mod;
		for (int j = 1; j <= n - i + 1; j++) f[i][j] = sum[j];
	}
	printf("%lld\n", 1ll * fpow(2, n - k - 1) * sum[2] % Mod);
	return 0;
}


Measured memory_bytes: 15360
N, M = map(int, input().split())
N2 = 2**N
# 各状態のコストが入る関数
# 10**8+1にしているのはmaxコスト10**5の鍵が最大10**3個ある（＝10**8）のでそれより1高くしている
# 最終的にX[-1]が10**8+1なら-1を出力すれば良い
X = [10**8+1]*N2
X[0] = 0

for i in range(M):
    a, b = map(int, input().split())
    C = list(map(int, input().split()))
    
    # 1, 2 → 11、2　→ 10　みたいなやつ作る
    k = sum(1<<(c-1) for c in C)
    for j in range(N2):
        # 各状態からこの鍵を追加したときに行ける状態(j|k)のコストが小さくなればそれを採用
        if X[j|k] > X[j] + a:
            X[j|k] = X[j] + a

ans = X[-1]
if ans >= 10**8+1:
    ans = -1
print(ans)

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

int main() {
  int i, j, N, M;
  cin >> N >> M;
  vector<int> a(2*M);
  vector<int> t(N, 0);

  for(i = 0; i < 2*M ; i++){
    cin >> a.at(i);
    for(j = 0; j < N; j++){
      if(a.at(i)==(j+1)) t.at(j)++;
    }
  }
  for(i = 0; i < N; i++){
    cout << t.at(i) << endl;
  }
}

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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int a, b;
    char op;
    cin >> a >> op >> b;

    if (op == '+') {
        cout << a + b << endl;
    } else if (op == '-') {
        cout << a - b << endl;
    }
}


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

int main() {
  long long a,b,ans=2019;
  cin>>a>>b;
  if(b-a>2019){
    cout<<0;
  }
  else{
    for(long long i=a;i<b;i++){
      for(long long j=i+1;j<=b;j++){
        long long c=(i%2019*j%2019)%2019;
        ans=min(ans,c);
      }
    }
    cout<<ans<<endl;
  }
  long long x=b*b;
  //cout<<x;
      
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.algorithm;

string[255] s;
int[] dx = [1, 0, 1, -1];
int[] dy = [0, 1, 1 ,1];

void main(){
	int n, ans, tmp;
	int px, py;
	while (readf("%d\n", &n), n) {
		ans = 0;
		foreach (i; 0..n) s[i] = chomp(readln());

		foreach (y; 0..n) {
			foreach (x; 0..n) {
				foreach (i; 0..4) {
					px = x;
					py= y;
					tmp = 0;
					while (px >= 0 && px < n && py >= 0 && py < n && s[py][px] == '1') {
						px += dx[i];
						py += dy[i]; 
						tmp++;
					}
					ans = max(tmp, ans);
				}
			}
		}
		writeln(ans);
	}
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VB = vector<bool>;
using VS = vector<string>;
using graph = vector<vector<int>>;

int main()
{
int n;
string q;
cin>>n;
int a=0,w=0,t=0,r=0;
for (int i = 0; i < n; i++)
{
 cin>>q;
 if (q=="AC")
 {
     a++;
 }
 else if (q=="WA")
 {
     w++;
 }
 else if (q=="TLE")
 {
     t++;
 }
 else r++;
 
}
cout<<"AC x "<<a<<endl;
cout<<"WA x "<<w<<endl;
cout<<"TLE x "<<t<<endl;
cout<<"RE x "<<r<<endl;

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>  
#include <cmath>
 using namespace std; 
typedef long long ll;
 int main(void)
 {  ll a,b,c;
 cin >> a >> b >> c;
 ll d = c - a - b; if(d > 0 && d * d > 4 * a * b){  cout << "Yes" << endl;  } else {  cout << "No" << endl;  }
return 0;  }


Measured memory_bytes: 256
import java.util.*;

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

        int[][] matrix = new int[N][N];
        for (int i = 0; i < N; i++){
            for (int j = i; j < N; j++) {
                matrix[i][j] = j - i;
            }
        }
        for (int i = 0; i < N; i++){
            for (int j = i; j < N; j++) {
                int val = Math.abs(X - (i + 1)) + Math.abs(Y - (j + 1)) + 1;
//                System.out.println("i: "+i+" j:"+j+" matrix[i][j]: "+matrix[i][j]+" val: "+val);
                if (matrix[i][j] > val){
                    matrix[i][j] = val;
                }
//                System.out.println("i: "+(i+1)+" j:"+(j+1)+" matrix[i][j]: "+matrix[i][j]+" val: "+val);
            }
        }
//        HashMap<Integer,Integer> numVals = new HashMap<>();
        int[] numVals = new int[N];
        for (int i = 0; i < N; i++){
            for (int j = i; j < N; j++) {
//                System.out.println("i: "+i+" j:"+j+" matrix[i][j]: "+matrix[i][j]);
                numVals[matrix[i][j]]++;
            }
        }

        for (int n = 1; n < N; n++){
            System.out.println(numVals[n]);
        }

//        for (int i = 0; i < N; i++){
//            for (int j = i; j < N; j++) {
//                System.out.println("i: "+i+" j:"+j+" matrix[i][j]: "+matrix[i][j]);
//            }
//        }


    }
}


Measured memory_bytes: 52308
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

const int mn=2000000+2000+1;
bitset<mn> b;
void solve(int n, vector<int> a){
	b[0]=1;
	int sum=0;
	for (auto &w:a) {
		sum+=w;
		b|=(b<<w);
	}
	int mid=(sum+1)/2;
	int ans=(mid==0)?b._Find_first():b._Find_next(mid-1);
	printf("%d\n",ans);
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	int N;
	scanf("%d",&N);
	vector<int> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%d",&A[i]);
	}
	solve(N, A);
	return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	cout << N / 3 << endl;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 500007 , __ = _<<1 , inf = 0x3f3f3f3f;

int to[__],ne[__],he[_]={0},du[_]={0},ecnt=1;
inline void adde(int a,int b){du[b]++,to[++ecnt]=b,ne[ecnt]=he[a],he[a]=ecnt;}

struct sgt
{
#define lc (x<<1)
#define rc (x<<1|1)
#define mid ((l+r)>>1)
	
	static const int _t = _<<2;

	int t[_t];

	sgt(){t[0]=inf;}

	inline void up(int x){t[x]=min(t[lc],t[rc]);}
		
	void plant(int x,int l,int r)
	{
		t[x]=inf;
		if(l==r)return;
		plant(lc,l,mid),plant(rc,mid+1,r),up(x);
	}

	void change(int x,int l,int r,int tar,int dlt)
	{
		if(l==r){t[x]=dlt;return;}
		if(tar<=mid)change(lc,l,mid,tar,dlt);
		if(tar>mid)change(rc,mid+1,r,tar,dlt);
		up(x);
	}

	int finder(int x,int l,int r,int tl,int tr)
	{
		if(tl<=l && r<=tr)return t[x];
		if(tr<=mid)return finder(lc,l,mid,tl,tr);
		if(tl>mid)return finder(rc,mid+1,r,tl,tr);
		return min(finder(lc,l,mid,tl,tr),finder(rc,mid+1,r,tl,tr));
	}
	
	
#undef lc
#undef rc
#undef mid
}t;

int n,lim,val[_]={0},loc[_]={0};
int ans[_]={0},lans=0,temp[_]={0};

int main()
{
	n=ty(),lim=ty();
	for(int i=1;i<=n;i++)val[i]=ty(),loc[val[i]]=i;

	t.plant(1,1,n);
	for(int i=n;i>=1;i--)
	{
		int a=t.finder(1,1,n,max(loc[i]-lim+1,1),loc[i]);
		if(a<=n)adde(loc[i],loc[a]);
		a=t.finder(1,1,n,loc[i],min(loc[i]+lim-1,n));
		if(a<=n)adde(loc[i],loc[a]);
		t.change(1,1,n,loc[i],i);
	}

	priority_queue<int,vector<int>,greater<int>> q;
	for(int i=1;i<=n;i++)if(!du[i])q.emplace(i);
	while(!q.empty())
	{
		int a=q.top();q.pop(),ans[++lans]=a;
		for(int i=he[a];i;i=ne[i])
			if((--du[to[i]])==0)q.emplace(to[i]);
	}
	for(int i=1;i<=n;i++)temp[ans[i]]=i;
	for(int i=1;i<=n;i++)printf("%d\n",temp[i]);

	return 0;
}


Measured memory_bytes: 28928
#include <stdio.h>

typedef long long ll;

ll a[100005];
ll b[100005];
ll sumA[100005];
ll sumB[100005];

ll ma(ll a, ll b);

int main() {

	int N, K;

	scanf("%d %d",&N,&K);

	int i;

	ll s = 0ll;
	for (i = 0; i < N; i++) {
		scanf(" %lld",&a[i]);
		b[i] = ma(0ll,a[i]);
		s += a[i];
		sumA[i] = s;
	}

	s = 0ll;
	for (i = 0; i < N; i++) {
		s += b[i];
		sumB[i] = s;
	}


	int l = 0;
	int r = K-1;

	ll ans = 0ll;

	while (1) {
		if (r >= N) { break; }
		ll S = sumA[r];
		if (l != 0) { S -= sumA[l - 1]; }
		S = ma(S, 0ll);
		if (l == 0) {
			ll add = sumB[N - 1] - sumB[K - 1];
			S += add;
		}
		else if (r == N - 1) {
			ll add = sumB[l - 1];
			S += add;
		}
		else {
			ll add1 = sumB[l - 1];
			ll add2 = sumB[N - 1] - sumB[r];
			S += add1 + add2;
		}
		if (S > ans) { ans = S; }
		l++;
		r++;
	}
	printf("%lld\n",ans);

	return 0;
}
ll ma(ll a, ll b) {
	if (a >= b) { return a; }
	else { return b; }
}

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

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)
typedef long long ll;

int N, K;
ll x[50];
ll y[50];

ll minX;
ll maxX;
ll minY;
ll maxY;

int main(void)
{
	cin >> N >> K;
	Rep(i, N){
		cin >> x[i] >> y[i];
	}
	ll minS = 1LL << 62;

	Rep(a, N){
		Rep(b, N){
			if(x[a] > x[b]) continue;
			minX = x[a];
			maxX = x[b];
			Rep(c, N){
				Rep(d, N){
					if(y[c] > y[d]) continue;
					minY = y[c];
					maxY = y[d];
					ll S = (maxX - minX) * (maxY - minY);
					if(S < minS){
						int count = 0;
						Rep(i, N){
							if(minX <= x[i] && x[i] <= maxX && minY <= y[i] && y[i] <= maxY){
								count++;
							}
						}
						if(count >= K){
							minS = S;
						}
					}
				}
			}
		}
	}
	PrintLn(minS);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a,b;
  cin >> a >> b;
  if (a>b) {
    cout << "a > b" << endl;
  }
  if (a<b) {
    cout << "a < b" << endl;
  }
  if (a==b) {
    cout << "a == b" << endl;
  }
}


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

typedef vector<int> vec;

int main() {
    int N;
    cin >> N;
    
    if (N % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }
    
    vec d(N);
    rep(i, N) cin >> d[i];
    
    sort(d.begin(), d.end());
    
    cout << d[N/2] - d[N/2 - 1] << endl;
    
}

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

ll fact(ll x) {
    if (x == 1 || x == 0) {
        return 1;
    } else {
        return x * fact(x - 1);
    }
}

long long int combination(long long int n, long long int k) {
    vector<vector<long long int>> v(n + 1, vector<long long int>(n + 1, 0));
    for (long long int i = 0; i < n + 1; i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (long long int i = 1; i < n + 1; i++) {
        for (long long int j = 1; j < i; j++) {
            v[i][j] = v[i - 1][j - 1] + v[i - 1][j];
        }
    }

    return v[n][k];
}

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

    ll even = 0;
    ll odd = 0;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        if (tmp % 2 == 1) {
            odd++;
        } else {
            even++;
        }
    }

    ll output = 0;
    if (P == 1) {
        for (ll i = 1; i <= odd; i += 2) {
            output += combination(odd, i);
        }
        output *= powl(2, even);
    } else {
        for (ll i = 0; i <= odd; i += 2) {
            output += combination(odd, i);
        }
        output *= powl(2, even);
    }

    cout << output << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <map>
#include<string>

using namespace std;

int main() {
	int x0, y0, x1, y1;
	cin >> x0 >> y0 >> x1 >> y1;
	cout << x1 - (y1 - y0) << " " << y1 - (x0 - x1) << " " << x0 - (y1 - y0) << " " << y0 - (x0 - x1) << endl;
}


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

bool is_palindrome(string s){
    bool b;
    string t(s.rbegin(), s.rend());
    
    if(s==t)
        b=1;
    else b = 0;
    return b;

}
int main()
{
    string s;
    int n;

    cin>>s;

    n = s.size();

    if(is_palindrome(s) && is_palindrome(s.substr(0,(n-1)/2)) && is_palindrome(s.substr((n+1)/2)))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}

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

const int inf = 1e9 + 7;
pair<int, int> xy1[107];
pair<int, int> xy2[107];


int N;

bool vis[207][207];

//int fnc_pre_and_post()
//{
//    for (int i = 0; i <= 200; i++) for (int j = 0; j <= 200; j++) vis[i][j] = 0;
//
//    int cnt = 0;
//    for (int i = 1; i <= N; i++) {
//        int sumx = inf, sumy = inf;
//        for (int j = N+1; j <= 2*N; j++) {
//            if (x[j] > x[i] && y[j] > y[i] && !vis[x[j]][y[j]]) {
//                if (x[j] < sumx && y[j] < sumy) sumx = x[j], sumy = y[j];
//            }
//        }
//        if (sumx != inf) cnt++, vis[sumx][sumy] = 1; //cout << sumx << ' ' << sumy << endl;
//    }
//
//    return cnt;
//}

int later_fnc_post()
{
    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        int sumx = -1, sumy = -1;
        for (int j = 1; j <= N; j++) {
            if (xy2[i].first > xy1[j].first && xy2[i].second > xy1[j].second  && !vis[ xy1[j].first  ][ xy1[j].second  ]) {
                if (xy1[j].second > sumy) sumx = xy1[j].first, sumy = xy1[j].second;
            }
        }
        if (sumx != -1) cnt++, vis[sumx][sumy] = 1; //cout << sumx << ' ' << sumy << endl;
    }

    return cnt;
}

int main()
{
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> xy1[i].first >> xy1[i].second;
    for (int i = 1; i <= N; i++) cin >> xy2[i].first >> xy2[i].second;

    sort(xy1+1, xy1+N+1);
    sort(xy2+1, xy2+N+1);

    int ans = later_fnc_post();

    cout << ans << endl;
}

/*

3
0 0
2 6
8 0

3 7
4 2
9 1
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MOD1 998244353
#define MOD2 1000000007

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

int power(ll a,ll b,ll m)
{
ll ans=1;
while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;}
return ans;
}


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

    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int dp[n]={0};
    dp[1] = abs(h[1]-h[0]);
    dp[2] = min(abs(h[2]-h[0]), dp[1]+abs(h[2]-h[1]));

    for(int i=3;i<n;i++)
    {
        dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
    }

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


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	int n,ans=0;
	cin>>n;
	vector<int>v(n),c(n);
    rep(i,n)cin>>v[i];
    rep(i,n)cin>>c[i];
    rep(i,n){
        if(v[i]>c[i])ans+=(v[i]-c[i]);
    }
	cout<<ans;
	return 0;
}

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

int main(){
	int T[101][101],r,c;

	cin >> r >> c;
	for( int i = 0; i < r; i++)
		for(int j = 0; j < c; j++)
			cin >> T[i][j];

	for(int i = 0;i <= r; i++)T[i][c]=0;
	for(int j = 0;j <= c; j++)T[r][j]=0;

	for(int i = 0;i < r;i++){
		for(int j = 0; j < c ; j++){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for(int i = 0; i <= r ; i++){
		for(int j = 0; j <= c;j++){
			if(j)cout << " ";
			cout << T[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

typedef long long ll;
#define Inf 1 << 20
#define MInf -(1 << 20)
 
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define Rep(i,n,m) for(int i = (int)(n); i < (int)(m);i++)
#define rrep(i,n) for(int i = (int)(n - 1); i > -1;i--)
#define RRep(i,n,m) for(int i = (int)(n - 1); i > (int)(m);i--)
#define trav(a, x) for(auto& a : x)
 
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))
#define REVERSE(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REVERSE(V)
 
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define yes(n) cout << ((n) ? "yes" : "no") << endl;


int main()
{
    string s;
    cin >> s;
    vector<char> str;
    rep(i,s.size())
    {
        if(i % 2 == 0)
        {
            cout << s[i];
        }
    }
    cout << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second > b.second;
	}
	else {
		return a.first > b.first;
	}
}

int main() {
	// 入力
	int N, M; cin >> N >> M;

	double** matrix = new double* [N];

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

		for (int j = 0; j < N; j++) {
			matrix[i][j] = 0;
		}
	}

	vector<pair<int, int>> input;
	for (int i = 0; i < M; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		input.push_back(make_pair(a, b));
		matrix[a][b]++;
	}
	sort(input.begin(), input.end());

	for (int i = 0; i < N; i++) {
		int count = 0;
		for (int j = 0; j < N; j++) {
			count += matrix[i][j];
		}
		if (count > 0) {
			for (int j = 0; j < N; j++) {
				matrix[i][j] = matrix[i][j] / (double)count;
			}
		}
	}

	double* E = new double[N];
	int* ans = new int[N];
	for (int i = 0; i < N; i++) {
		E[i] = 0;
		ans[i] = -1;
	}

	int j = M - 1;
	for (int i = N - 2; i >= 0; i--) {
		double e = 0;// 最も悪い行き先
		double sum = 0;// 合計
		double count = 0;// 行き先の数
		while (j >= 0 && input[j].first == i) {
			if (E[input[j].second] > e) {
				ans[i] = input[j].second;
				e = E[input[j].second];
			}
			sum += E[input[j].second];
			count++;
			j--;
		}
		E[i] = 1 + sum / count;
	}
	/*
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
	cout << endl;*/

	sort(input.begin(), input.end(), compare_by_b);

	double* dp = new double[N];
	for (int i = 0; i < N; i++) {
		dp[i] = 0;
	}
	double m = E[0];

	for (int k = 0; k < N - 1; k++) {
		int count = 0;
		for (int i = 0; i < N; i++) { if (matrix[k][i] != 0) { count++; } }

		if (count == 1) { continue; }
		double rate = 1.0 / (1.0 - 1.0 / (double)count);
		for (int i = 0; i < N; i++) { matrix[k][i] *= rate; }

		for (int i = 0; i < N; i++) {
			dp[i] = 0;
		}
		matrix[k][ans[k]] = 0;
		/*
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				cout << matrix[i][j] << " ";
			}
			cout << endl;
		}
		cout << endl;*/

		for (auto itr = input.begin(); itr != input.end(); itr++) {
			dp[itr->first] += (dp[itr->second] + 1.0) * matrix[itr->first][itr->second];
		}

		matrix[k][ans[k]] = 1;
		for (int i = 0; i < N; i++) { if (matrix[k][i] != 0) { matrix[k][i] = 1.0 / count; } }

		//for (int i = 0; i < N; i++) { cout << dp[i] << endl; }cout << endl;

		if (m == -1) {
			m = dp[0];
		}
		else { m = min(m, dp[0]); }
	}

	delete[] dp;

	cout << setprecision(15) << m << endl;

	return 0;
}

Measured memory_bytes: 5240
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
  var num = parseInt(lines[0]);
  var list = lines[1];
  list = list.split('');
  var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  var result = '';
  for(var i=0; i<list.length; i++){
    var idx = alphabet.indexOf(list[i]);
    var new_idx = 0;
    if(idx + num > 25){
      new_idx = idx + num - 26;
    }else{
      new_idx = idx + num;
    }
    result += alphabet[new_idx];
  }
  console.log(result);
});


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    string s;cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    if(a+b+c+d == 7) printf("%d+%d+%d+%d=7\n", a, b, c, d);
    else if(a+b+c-d == 7) printf("%d+%d+%d-%d=7\n", a, b, c, d);
    else if(a+b-c+d == 7) printf("%d+%d-%d+%d=7\n", a, b, c, d);
    else if(a+b-c-d == 7) printf("%d+%d-%d-%d=7\n", a, b, c, d);
    else if(a-b+c+d == 7) printf("%d-%d+%d+%d=7\n", a, b, c, d);
    else if(a-b+c-d == 7) printf("%d-%d+%d-%d=7\n", a, b, c, d);
    else if(a-b-c+d == 7) printf("%d-%d-%d+%d=7\n", a, b, c, d);
    else if(a-b-c-d == 7) printf("%d-%d-%d-%d=7\n", a, b, c, d);
}


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

namespace Jpken_Kyogi1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inputs = Console.ReadLine().Split(' ');

            int a = int.Parse(inputs[0]);
            int b = int.Parse(inputs[1]);
            int union_number;
            if (b == 100)
                union_number = a * 1000 + b;
            else if (b >= 10)
                union_number = a * 100 + b;
            else
                union_number = a * 10 + b;

            int base_number = 0;
            while (base_number <= 100100)
            {
                base_number++;
                if (base_number * base_number == union_number)
                {
                    Console.WriteLine("Yes");
                    break;
                }
                else if (base_number == 100100)
                {
                    Console.WriteLine("No");
                }

            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
//#include <cassert>
//#include <stack>
//#include <queue>
//#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

// template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
#define int ll

const int N = 2e5 + 5;
const int oo = 1e9 + 5;

double l;

void solve() {
	cin >> l;
	/**for (int i = 1; i <= l - 2; ++i) {
		for (int j = 1; j <= l - 1; ++j) {
			int k = l - i - j;
			ans = max(ans, k * i * j);
		}
	}**/	
	cout << fixed << setprecision(7) << (l / 3.0) * (l / 3.0) * (l / 3.0);
}

 main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	while (tt --) {
		solve();
	}
	return 0;
}
/*
	“I’m not gonna run away, I never go back on my word! That’s my nindo: my ninja way.” Naruto
ц*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define F first 
#define S second
const ll N = 200222 ; 
int n, ans, M, A, d[N];
vector<int> g[N] ; 
void dfs(int v, int par){
	if(d[v] >= M){M = d[v], A = v;}
	for(int i = 0 ; i < g[v].size() ; i ++){
		int u = g[v][i] ; if(u == par) continue ;
		d[u] = d[v] + 1 ; dfs(u, v) ;
	}
}
int main()
{
	scanf("%d", &n) ;
	for(int i = 1 ; i < n ; i ++){
		int u, v ; scanf("%d%d", &u, &v) ;
		g[v].push_back(u), g[u].push_back(v) ;
	}
	dfs(1, 0) ; M = 0 ; d[A] = 0 ; 
	dfs(A, 0) ;
	if(M % 3 == 1) return cout << "Second", 0;
	cout << "First" ;
}

Measured memory_bytes: 24448
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,p[54];
bool check(){
    bool flag=1;
	for(int i=1;i<n;i++){
        if(p[i]>p[i+1])flag=0;
	}
	return flag;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>p[i];

	if(check())return puts("YES"),0;
	for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            swap(p[i],p[j]);
            if(check())return puts("YES"),0;
            swap(p[i],p[j]);
        }
    }
    puts("NO");
	return 0;
}


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

int main() {
        long long int N;
        string S="";

        cin >> N;

        while(N != 0){
                if(N%-2==0) S += "0";
                else{
                        N--;
                        S += "1";
                }
                N/=-2;
        }

        reverse(S.begin(), S.end());

        if(S=="")cout<< 0 << endl;
        else cout << S << endl;

        return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n, a, b = map(int, input().split())
    mod = 10 ** 9 + 7

    all_case = pow(2, n, mod) - 1
    nCa = conbination(n, a, mod)
    nCb = conbination(n, b, mod)
    result = all_case - nCa - nCb
    while (result < 0):
        result = result + mod
    print(result)


def conbination(n, r, mod):
    a = 1
    b = 1
    for i in range(1, r + 1):
        # print(a, b, i)
        a = (a * (n - i + 1)) % mod
        b = (b * i) % mod
    b = pow(b, mod - 2, mod)

    return (a * b) % mod


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
//ABC94B
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
    int n, m, x, tmp;
    int right=0, left=0;
    cin >> n >> m >> x;
    vector<int>A(n+1,0);
    rep(i, m){
        cin >> tmp;
        A[tmp]=1;
    }
    for(int i=1; i<x; i++) left +=A[i];
    for(int i=x+1; i<n+1; i++) right +=A[i];
    //rep(i, n+1) cout << A[i] << endl;
    cout << min(left, right) << endl;
}

Measured memory_bytes: 256
L,R=map(int,input().split())
v1,v2=L//2019,R//2019
if v2-v1>=1 or L%2019==0 or R%2019==0:
  print(0)
else:
  tmp=2018
  for i in range(L,R):
    for j in range(i+1,R+1):
      tmp=min(tmp,(i*j)%2019)
  print(tmp)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

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

using namespace std;

int main(){
    string s;
    int k;

    cin >> k >> s;

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

    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define MAX 100010
#define inf 1<<29
#define linf 1e16
#define eps (1e-8)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int n;
ll a[MAX];

int solve(){
  FOR(i,0,n)if(a[i]%2==n%2)return 0;
  sort(a,a+n);
  if(n%2==0){
    for(int i=0;i<n;i+=2){
       if(a[i]!=i+1)return 0;
       if(a[i+1]!=i+1)return 0;
    }
  }
  else {
    if(a[0]!=0)return 0;
    for(int i=1;i<n;i+=2){
       if(a[i]!=i+1)return 0;
       if(a[i+1]!=i+1)return 0;
    }
  }
  ll res=1;
  FOR(i,0,n/2){ res*=2; res%=mod; }
  return res;
}

int main()
{
  cin>>n;
  FOR(i,0,n)cin>>a[i];
  cout<<solve()<<endl;
  return 0;
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, K;
	cin >> N >> K;

	int tmp = N / K, tmp1 = 0;;
	if (K % 2 == 0)tmp1 = (N + K / 2) / K;
	cout << (long long)tmp*tmp*tmp+(long long)tmp1*tmp1*tmp1<< endl;
	return 0;
}

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

int A, B, C;

int main() {
    cin >> A >> B >> C;

    int Ak_mod_B[B];
    for (int i = 0; i < B; i++) {
        Ak_mod_B[i] = 0;
    }

    int k = 1;
    while (Ak_mod_B[A*k % B] == 0) {
        Ak_mod_B[A*k % B]++;
        k++;
    }

    if (Ak_mod_B[C] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 5005;
const int K = 20;
int dp[N][N];
pair < int, pair < int, int > > a[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i].S.F >> a[i].S.S;
        a[i].F = a[i].S.F + a[i].S.S;
    }
    sort(a + 1, a + n + 1);
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= n; j++){
            dp[i][j] = 1e17;
        }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= n; j++){
            dp[i][j] = dp[i - 1][j];
            if (j != 0 && a[i].S.F >= dp[i - 1][j - 1]){
                dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + a[i].S.S);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i <= n; i++){
        if (dp[n][i] < 1e15) ans = i;
    }
    cout << ans;
}


Measured memory_bytes: 195968
#include<iostream>

using namespace std;

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

	int red = 0;
	int blue = 0;
	for (int i = 0; i < N; i++) {
		if (S.at(i) == 'R') {
			red++;
		}
		else {
			blue++;
		}
	}

	if (red > blue) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

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

    cout << max({a+b, a-b, a*b}) << endl;

    return 0;
}


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

int main() {
    int h,w;
    cin >> h >> w;
    char C[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> C[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << C[i][j];
        }
        cout << endl;
        for(int j = 0; j < w; j++){
            cout << C[i][j];
        }
        cout << endl;
    }
    return 0;
}




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

p = list(map(int,input().split()))

count = 0

flg = False

lis=[]

result=0

while True:
    
    up = X+count
    
    down = X-count
    
    if p.count(down) ==0:
        lis.append(down)
        flg = True
    
    if p.count(up)==0:
        lis.append(up)
        flg = True
        
    
    if flg ==True:
        break
    else:
        count+=1
        

lis.sort()

print(lis[0])
    


Measured memory_bytes: 9128
def comb(n,k):
    nCk = 1
    mod = 10**9+7
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
    for i in range(1, k+1):
        nCk *= pow(i, mod-2, mod)
        nCk %= mod
    return nCk

n,a,b = map(int,input().split())
mod = 10**9+7
print((pow(2,n,mod) - 1 - comb(n,a) - comb(n,b))%mod)



Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Sample201
{
    class Program
    {
        static void Main(string[] args)
        {
          int n,k;
            string[] str = Console.ReadLine().Split(' ');
          n = int.Parse(str[0]);
          k = int.Parse(str[1]);
          
 str = Console.ReadLine().Split(' ');
			long[] h = new long[n];
          for(int i =0;i<n;i++){
          h[i] = long.Parse(str[i]);                
          }
          
          h =h.OrderByDescending(s => s).ToArray();
          if(k>n){k=n;}
          
          for(int i=0;i<k;i++){
          h[i]=0;
          }
          
          Console.WriteLine(h.Sum());
          
          
          
        }
    }
}


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

int main(){
  string s; cin >> s;
  int ans = 0;
  rep(i,s.size()){
    if(s[i]!='S'){
      if(i==0){
        ans = 1;
      }else{
        if(s[i-1]=='R') ans++;
        else ans = 1;
      }
    }
  }
  cout << ans << endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  cin >> n;
  ll t, a;
  cin >> t >> a;
  vector<ll> h(n);
  for(i = 0; i < n; i++)
    cin >> h[i];
  ld ave = abs(t - h[0] * 0.006 - a);
  ld buf;
  ll result = 0;
  for(i = 1; i < n; i++){
    buf = abs(t - h[i] * 0.006 - a);
    if(buf < ave){
      result = i;
      ave = buf;
    }
  }
  
  cout << result + 1 << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
INF = 10**6

def main():
    n,m=map(int,input().split())
    G=[INF]*n
    for _ in range(m):
        a,b=map(int,input().split())
        a-=1
        b-=1
        G[a]=min(G[a],b)
    
    lim=INF
    cnt=0
    for i in range(n):
        if lim==i:
            cnt+=1
            lim=G[i]
        else:
            lim=min(lim,G[i])
    
    print(cnt)
if __name__=='__main__':
    main()


Measured memory_bytes: 6980
from collections import defaultdict

N, M = map(int, input().split())
while N:
    H = [int(input()) for _ in range(N)]
    W = [int(input()) for _ in range(M)]

    HC = defaultdict(int)
    WC = defaultdict(int)

    Q = []
    for h in H:
        Q2 = [h]
        HC[h] += 1
        for q in Q:
            HC[h+q] += 1
            Q2.append(h+q)
        Q = Q2

    Q = []
    for w in W:
        Q2 = [w]
        WC[w] += 1
        for q in Q:
            WC[w+q] += 1
            Q2.append(w+q)
        Q = Q2

    ans = 0
    for k, v in HC.items():
        ans += v*WC[k]
    print(ans)

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



Measured memory_bytes: 75280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K,A,B;
  cin >> K >> A >> B;
  bool ans = false;
  for(int i = A; i <= B; i++){
    if(i%K == 0){
      ans = true;
  }
  if(ans)break;
}
if(ans) cout << "OK" <<endl;
else cout << "NG" << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if ((b-a)==(c-b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
	}
}


Measured memory_bytes: 22996
using System;

namespace ITP1_1_D
{
	class Program
	{
		static void Main(string[] args)
		{
			int input = int.Parse(Console.ReadLine());
			int H = input / 3600;
			int M = (input - H * 3600) / 60;
			int S = input - (H * 3600 + M * 60);

			Console.WriteLine(H + ":" + M + ":" + S);
		}
	}
}



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

int main() {
int  A,B;
    cin >> A >> B ;
  if (A!=1&&B!=1){
    cout << "1" << endl;  
  }
  else if (A!=2&&B!=2){
  cout << "2" << endl; 
}
  else {
    cout << "3" << endl ;
  }
 
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,long long> pint;
typedef long long ll;
const ll mod= 1e9+7;
const ll  longinf = 1LL<<60;
const int inf=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};


int main(){
  string s;cin>>s;
  int n=s.size();
  for(int i=0;i<n;i+=2)cout<<s[i];
  cout<<endl;


  return 0;
  }

Measured memory_bytes: 512