akhauriyash/Code-Regression huggingface dataset:
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
n_odd = np.sum(a % 2 == 1)
n_four = np.sum(a % 4 == 0)
if n_odd <= n_four or n_odd - 1 == n_four == N // 2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 23116
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500 + j*100 + k*50 == X:
                count += 1

print(count)


Measured memory_bytes: 3060
import java.util.*;
class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    String s = sc.next();
    String r = s.replaceAll("^(.{"+k+"}).+$","$1...");
    System.out.println(r);
  }
}

Measured memory_bytes: 38704
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

	string ans;

	while (N > 0) {
		auto m = (N - 1) % 26;
		ans += 'a' + m;
		N = (N - m) / 26;
	}
	reverse(ans.begin(), ans.end());

	cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int N;
    cin >> N;
    vector<double> p(N);
    rep(i,N){
        cin >> p[i];
    }
    cout << fixed << setprecision(10);
    vector<vector<double>> dp(N+1,vector<double>(N+1,0));
    dp[0][0]=1;
    rep(i,N){
        rep(j,i+1){
            dp[i+1][j+1]+=dp[i][j]*p[i];
            dp[i+1][j]+=dp[i][j]*(1-p[i]);
        }
    }
    double ans=0;
    rep(i,N+1){
        if (2*i>N){
            ans+=dp[N][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 70784
N=int(input())
List=[[0 for i in range(3)] for j in range(N)]
for i in range(N):
  S,P=input().split()
  List[i][0]=i+1
  List[i][1]=S
  List[i][2]=int(P)
List.sort(key=lambda x:x[2],reverse=True)
List.sort(key=lambda x:x[1])
for i in range(N):
  print(List[i][0])

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if(c >= a && c <= b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,'1')
else:
    answer =['0']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))




Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	
	int a,b;

	while(1){
		bool FF[25][25];
		cin>>a>>b;if(a==b&&a==0)break;
		for(int i=1;i<=20;i++)
		for(int j=1;j<=20;j++)
			FF[i][j]=false;
	int N[20][20]={};
	int n;
	cin>>n;
	while(n--){
		int x,y;
		cin>>x>>y;
		FF[x][y]=true;
	}
	N[1][1]=1;
	for(int i=1;i<=b;i++)
		for(int j=1;j<=a;j++)
		{
			if(FF[j][i]!=true){
				N[j][i+1]+=N[j][i];
				N[j+1][i]+=N[j][i];
			}
		}
	cout<<N[a][b]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
char S[105],T[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int N,K[105],i,j,p;
int main()
{
	for(;scanf("%d",&N),N;puts(""))
	{
		for(i=0;i<N;K[i++])
			scanf("%d",&K[i]);
		scanf("\n%s",S);
		for(i=j=0;S[i];i++,j=(j+1)%N)
		{
			if(S[i]<'a')p=S[i]-'A'+26;
			else p=S[i]-'a';
			putchar(T[(p-K[j]+52)%52]);
		}
	}
	return 0;
}

Measured memory_bytes: 592
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>  // assert(x>=10), 部分点問題
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>

#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define SORT(v,n) sort(v,v+n)
#define VSORT(v) sort(all(x))
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second
#define bit(n) (1LL<<(n))

using namespace std;

typedef long long llong;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<llong, pll> plp;

const int MOD=1000000007; // 10^9 + 7
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // 右下左上


int main(int argc, char**argv){
  int n;
  cin >> n;
  vector<long> a;
  rep(i, n){
    long tmp;
    cin >> tmp;
    a.pb(tmp);
  }

  bool inc = false, dec = false;
  int ans = 1;
  rep(i, n-1){
    // cout << i << ':' << a[i] << endl;
    // dbg(inc); dbg(dec);
    if (inc == false && dec == false){
      if (a[i] < a[i+1]) inc = true;
      else if (a[i] > a[i+1]) dec = true;
      else continue;
      continue;
    }
    if (inc == true && dec == false) {
      if (a[i] <= a[i+1]) continue;
      else {
        // dbg("inc stopped");
        ans++;
        inc = false;
        continue;
      }
    }
    if (inc == false && dec == true){
      if (a[i] >= a[i+1]) continue;
      else {
        // dbg("dec stopped");
        ans++;
        dec = false;
        continue;
      }
    }
  }
  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1400
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    string s;
    cin>>s;
    REP(i,4)cout<<s[i];
    cout<<" ";
    REP(i,8)cout<<s[i+4];
    cout<<endl;
}


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 rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<int> G[100010];
int dA[100010];
int dB[100010];
void dfs(int v, int parent, int depth, int turn) {
    if (turn == 0)
        dA[v] = depth;
    else
        dB[v] = depth;
    for(auto to: G[v]) {
        if (to == parent) continue;
        dfs(to, v, depth + 1, turn);
    }
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    rep(i, N - 1) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    dfs(0, -1, 0, 0);
    dfs(N - 1, -1, 0, 1);
    int A = 0, B = 0;
    rep(i, N) {
        if (dA[i] <= dB[i]) A++;
        else B++;
    }
    if (A > B) {
        cout << "Fennec" << endl;
    } else {
        cout << "Snuke" << endl;
    }

    return 0;
}


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

using namespace std;

string N;

string res[] = {"Sunny", "Cloudy", "Rainy"};

int sel = 0;

int main () {
	
  cin >> N;
  
  for (int i = 0; i < 3; i++) {
  
  	if (res[i] == N) {sel = i; }
    
  }
  
  sel = (sel+1)%3;
  
  cout << res[sel] << "\n";
  
  return 0;
  
}

Measured memory_bytes: 256
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	input = input.trim().split("\n").map((a)=>Number(a));
  var N = input[0];
  var K = input[1];
  var X = input[2];
  var Y	= input[3];
  console.log(X * Math.min(N,K) + Math.max(0,N - K) * Y);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

const int INF = 1<<25;
int dp[401][401] = {};

int main(){
    for(int i = 0; i < 401; i++){
        for(int j = 0; j < 401; j++){
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    int n, ma, mb, a, b, c;
    cin >> n >> ma >> mb;

    while(n-- > 0){
        cin >> a >> b >> c;
        for(int i = 400-a; i >= 0; i--){
            for(int j = 400-b; j >= 0; j--){
                if(dp[i][j] != INF) dp[i+a][j+b] = min(dp[i+a][j+b], dp[i][j]+c);
            }
        }
    }

    int ans = INF;
    for(int i = 1; i <= 400; i++){
        for(int j = 1; j <= 400; j++){
            if(i*mb == j*ma)    ans = min(ans, dp[i][j]);
        }
    }

    if(ans == INF)  ans = -1;

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

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

int main()
{
    string s, t;
    cin >> s >> t;
    //文字の種類の数が一緒の場合はyes 違う場合はnoだと思う。
    map<char, ll> a;
    map<char, ll> b;
    rep(i, s.size())
    {
        a[s[i]] += 1;
        b[t[i]] += 1;
    }
    priority_queue<ll> x;
    priority_queue<ll> y;
    for (auto k : a)
    {
        x.push(k.second);
    }
    for (auto k : b)
    {
        y.push(k.second);
    }
    int flag = 0;
    while (x.empty() != 1 && y.empty() != 1)
    {
        if (x.top() != y.top())
        {
            flag = 1;
            cout << "No" << endl;
            break;
        }
        x.pop();
        y.pop();
    }
    if (flag == 0)
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 776
#include <iostream>
#include <fstream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <queue>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

int d[20][20];

int dx[] = {-1,1,0,0};
int dy[] = {0,0,-1,1};
int H,W;
int iMax = 0;

int used[20][20];

int dfs(int x, int y, int cnt)
{
    iMax = max(iMax, cnt);
    if(used[x][y] == 1)return 0;
    used[x][y] = 1;
    if(d[x][y] == '#')return 0;

    for(int i = 0; i < 4 ; ++i)
    {
        int cur_x = x + dx[i];
        int cur_y = y + dy[i];
        if(cur_x < 0 || cur_x >= W || cur_y < 0 || cur_y >= H)continue;

        dfs(cur_x, cur_y, cnt + 1);
    }

    return 0;
}

void warshall_floyd(int n) {
  for (int k = 0; k < n; k++){       // 経由する頂点
    for (int i = 0; i < n; i++) {    // 始点
      for (int j = 0; j < n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    vector <string> s(H);
    REP(i, H)
    {
        cin >> s[i];
    }

    REP(i, H)
    {
        REP(j, W)
        {
            REP(y,20)
            {
                REP(x,20)
                {
                    used[y][x] = 0;
                }
            }
            int cnt;
            queue<pair < pair <int, int> , int > > que;
            pair <int, int> a = {i,j};
            que.push({a, 0});
            while (!que.empty()) {
                auto v = que.front(); // キューから先頭頂点を取り出す
                que.pop();
                int y = v.first.first;
                int x = v.first.second;
                cnt = v.second;
                
                iMax = max(iMax, cnt);
                if(s[y][x] == '#')continue;
                if(used[y][x] == 1)continue;
                used[y][x] = 1;

                for(int i = 0; i < 4 ; ++i)
                {
                    int cur_y = y + dy[i];
                    int cur_x = x + dx[i];
                    if(cur_x < 0 || cur_x >= W || cur_y < 0 || cur_y >= H)continue;
                    pair <int, int>  b =  {cur_y, cur_x};
                    que.push({b, cnt + 1});

                }

            }
        }
    }
    cout << iMax - 1<< endl;

    return 0;
}


Measured memory_bytes: 256
// AOJ 2661 Todaiji
// 2018.3.19 bal4u

#include <stdio.h>
#include <string.h>
#include <math.h>

// [library]

//#define getchar_unlocked()  getchar()
int in()	// get non-negative integer from stdin
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

typedef struct { double x, y; } PP;
typedef struct { PP s, e; } SEG, LINE;

#define INF			1e8
#define EPS			1e-8

PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
double vabs(PP a) { return hypot(a.x, a.y); }
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }
int ccw(PP p0, PP p1, PP p2) { PP a, b;	double t;
	a = vsub(p1, p0), b = vsub(p2, p0), t = cross(a, b);
	if (t >  EPS) return 1;	if (t < -EPS) return -1;
	if (dot(a, b) < -EPS) return 2;	if (norm(a) < norm(b)) return -2;
	return 0;
}
int is_intersectSS(PP s1s, PP s1e, PP s2s, PP s2e)
{
	return ccw(s1s, s1e, s2s) * ccw(s1s, s1e, s2e) <= 0 &&
		   ccw(s2s, s2e, s1s) * ccw(s2s, s2e, s1e) <= 0;
}
double distanceLP(PP ss, PP se, PP p) {
	return fabs(cross(vsub(se, ss), vsub(p, ss)) / vabs(vsub(se, ss))); }
double distanceSP(PP ss, PP se, PP p)
{
	if (dot(vsub(se, ss), vsub(p, ss)) < 0) return vabs(vsub(p, ss));
	if (dot(vsub(ss, se), vsub(p, se)) < 0) return vabs(vsub(p, se));
	return distanceLP(ss, se, p);
}
double distanceSS(PP s1s, PP s1e, PP s2s, PP s2e)
{
	double res, x;
	if (is_intersectSS(s1s, s1e, s2s, s2e)) return 0;
	res = distanceSP(s1s, s1e, s2s);
	x = distanceSP(s1s, s1e, s2e); if (x < res) res = x;
	x = distanceSP(s2s, s2e, s1s); if (x < res) res = x;
	x = distanceSP(s2s, s2e, s1e); if (x < res) res = x;
	return res;
}

// [\library]  

PP seg1[55], seg2[55];

int main()
{
	int N1, N2, i, j;
	double ans, t;

	N1 = in(); seg1[0].x = 0, seg1[0].y = 0;
	for (i = 1; i <= N1; i++) seg1[i].x = in(), seg1[i].y = in();
	seg1[++N1].x = 1000, seg1[N1].y = 0;
	
	N2 = in(); seg2[0].x = 0, seg2[0].y = 1000;
	for (i = 1; i <= N2; i++) seg2[i].x = in(), seg2[i].y = in();
	seg2[++N2].x = 1000, seg2[N2].y = 1000;
	
	ans = INF;
	for (i = 0; i < N1; i++) for (j = 0; j < N2; j++) {
		t = distanceSS(seg1[i], seg1[i+1], seg2[j], seg2[j+1]);
		if (t < ans) ans = t;
	}
	printf("%.10lf\n", ans);
	return 0;
}


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

int main() {
    long n, m;
    cin >> n >> m;
    vector<vector<long>> vvl(n+1);
    for (long i=0; i<m; i++) {
        long a, b;
        cin >> a >> b;
        vvl[a].push_back(b);
        vvl[b].push_back(a);
    }
    long len = vvl[1].size();
    for (long i=0; i<len; i++) {
        long x = vvl[1][i];
        auto y = vvl[x];
        if (find(y.begin(), y.end(), n) != y.end()) {
            puts("POSSIBLE");
            return 0;
        }
    }
    puts("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 12776
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
	int n;
	cin>>n;
		string s;
		getline(cin,s);
	REP(i,n){
		getline(cin,s);
		int  p=0;
		while(1){
			p= s.find("Hoshino",p);
			if(p==s.npos){
				break;
			}
			p+=6;
			s[p]='a';
		}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n, k; cin >> n >> k;
    cout << (k == 1 ? 0 : n - k) << endl;
}


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

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

  bool finished = false;

for(int i=1; i<10; i++) {
  for(int j=1; j<10; j++) {
    if(n == i*j) {
      finished = true;
      break;
    } else {
      //cout << "t" << endl;
      continue;
    }
  }
  if (finished == true) {
    break;
  } else {
    continue;
  }
}
if (finished == true ) {
  cout << "Yes" << endl;
} else {
  cout << "No" << endl;
}

}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <complex>


using namespace std;
template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;}
template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp make_pair
#define pb push_back
#define y2 y2228
#define rank rank228
using ll = long long;
using ld = long double; 
const string FILENAME = "input";
const int MAX_LOG = 30;

int nxt = 10; 


int get() { 
	return nxt++; 
}


int ONE;
vector<tuple<char, int, int, int> > operations;


int IS_SMALLER(int i, int j) {
    int k = get();
    operations.push_back({'<', i, j, k});
    return k++;
}


int ADD(int i, int j) {
    int k = get();
    operations.push_back({'+', i, j, k});
    return k++;
}



int BIN_SHIFT(int i, int by) {
    for(int rep = 0; rep < by; ++rep) {
        i = ADD(i, i);
    }
    return i;
}



int SUB(int i, int j) {
    i = ADD(i, ONE);
    int where_diff = get();
    for(int expo = MAX_LOG - 1; expo >= 0; --expo) {
        int power_two = BIN_SHIFT(ONE, expo); 
        int should_add = IS_SMALLER(ADD(j, power_two), i);
        should_add = BIN_SHIFT(should_add, expo);
        where_diff = ADD(where_diff, should_add);
        j = ADD(j, should_add);
    }
    return where_diff;
}

int NEGATION(int i) {
    return IS_SMALLER(i, ONE);
}



int TERNARY(int i, int j) {
    return SUB(j, BIN_SHIFT(NEGATION(i), MAX_LOG));
}


int MULTIPLY(int i, int j) {
    i = ADD(i, ONE);
    int product = get();
    int almost_i = get();
    for(int expo = MAX_LOG-1; expo >= 0; --expo) {
        int power_two = BIN_SHIFT(ONE, expo);
        int should_add = IS_SMALLER(ADD(almost_i, power_two), i);
        int j_or_zero = TERNARY(should_add, j);
        should_add = BIN_SHIFT(should_add, expo);
        almost_i = ADD(almost_i, should_add);
        product = ADD(product, BIN_SHIFT(j_or_zero, expo));
    }
    return product;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read(FILENAME);
	ONE = IS_SMALLER(2, ADD(0, 1));
    int answer = MULTIPLY(0, 1);
    operations.push_back({'+', answer, 2, 2}); 
   	cout << sz(operations) << '\n';
    for (auto ope: operations) {
        cout << get<0>(ope) << ' ' << get<1>(ope) << ' ' << get<2>(ope) << ' ' << get<3>(ope) << '\n';
    }	
}


Measured memory_bytes: 3800
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int keta = String.valueOf(b).length();
		int ans = (int)Math.pow(10, keta) * a + b;


		for(int i = 1;i < ans/2;i++){
			if(i*i == ans){
				System.out.println("Yes");
				return;

			}
		}
		System.out.println("No");





	}
}




class Graph{
	int from;
	int to;
	int cost;

	public Graph() {
	}

	public Graph(int f,int t,int c) {
		from = f;
		to= t;
		cost = c;
	}
}


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

int main()
{
	ll N;
	cin >> N;
	vector<ll> w(N),sum(N + 1, 0);
	for (ll i = 0; i < N; i++) {
		cin >> w[i];
		sum[i + 1] = sum[i] + w[i];
	}
	vector< vector<ll> > dp(N, vector<ll>(N, -1)), mo(N, vector<ll>(N));
	for (ll i = 0; i < N; i++) {
		dp[i][i] = 0;
		mo[i][i] = i;
	}
	for (ll i = 0; i + 1 < N; i++) {
		dp[i][i + 1] = sum[i + 2] - sum[i];
		mo[i][i + 1] = i;
	}

	for (ll l = 2; l < N; l++) {
		for (ll i = 0; i + l < N; i++) {
			for (ll k = mo[i][i + l - 1]; k <= mo[i + 1][i + l]; k++) {
				if (dp[i][i + l] == -1 || dp[i][i + l] > dp[i][k] + dp[k + 1][i + l]) {
					dp[i][i + l] = dp[i][k] + dp[k + 1][i + l];
					mo[i][i + l] = k;
				}
			}
			dp[i][i + l] += sum[i + l + 1] - sum[i];
		}
	}
	cout << dp[0][N - 1] << endl;
	return 0;
}

Measured memory_bytes: 253408
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int t,x; cin >> t >> x;
  cout << fixed << setprecision(10);
  COUT((double)t/x);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>

using namespace std;

int main(){
  int n;
  scanf("%d", &n);

  vector<int> a;
  for (int i = 0; i < n; ++i) {
    int a_;
    scanf("%d", &a_);
    if (a.empty() || a.back() != a_) a.push_back(a_);
  }

  if (a.size() == 1) {
    puts("1");
    return 0;
  }

  int ans = 1;
  bool is_increasing = a[1] > a[0];
  int sz = (int)a.size();
  for (int i = 1; i < sz; ++i) {
    if (is_increasing && a[i] < a[i - 1]) {
      ans++;
      if (i < sz - 1) {
	is_increasing = a[i] < a[i + 1];
      }
    } else if (!is_increasing && a[i] > a[i - 1]) {
      ans++;
      if (i < sz - 1) {
	is_increasing = a[i] < a[i + 1];
      }
      
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}
// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    string s;
    cin>>s;
    ll n = s.length();
    if(s[n-1] =='s')
        cout<<s<<"es";
      else cout<<s<<"s";      
}
// Driver Function
int main()
{
    ll compte = 1;
   // test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
vector<int> vec;
void make(int a){
  if(a > 1e8) return;
  vec.pb(10*a+3);
  vec.pb(10*a+5);
  vec.pb(10*a+7);
  make(10*a+3);
  make(10*a+5);
  make(10*a+7);
}
void rem(){
  int sz = (int)vec.size();
  REP(i,sz){
    int tmp = vec[i];
    bool fl[3] = {true,true,true};
    for(;tmp > 0;tmp/=10){
      if(tmp%10==3) fl[0] = false;
      else if(tmp%10==5) fl[1] = false;
      else if(tmp%10==7) fl[2] = false;
    }
    if(fl[0]||fl[1]||fl[2]) vec[i] = 1e9*2;
  }
}
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  cioacc();
  int n;
  cin >> n;
  make(0);
  rem();
  sort(ALL(vec));
  auto ite = upper_bound(ALL(vec),n);
  cout << distance(vec.begin(),ite) << endl;
}

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

int main() {
  int a, b, c, d;

  cin >> a >> b >> c >> d;

  int health_takahashi = a / d + int(bool(a % d));
  int health_aoki = c / b + int(bool(c % b));

  if (health_takahashi >= health_aoki) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3616
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

D = input()

S = "Christmas"
for i in range(D, 25):
    S = S + " Eve"

print S

Measured memory_bytes: 2808
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        w: u64,
        h: u64,
        x: u64,
        y: u64,
    }
    println!("{} {}", (w as f64) * (h as f64) / 2.0,
        if 2*x == w && 2*y == h {1} else {0});
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(3e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)

int main() {
    string s,ans="YES",a="AKIHABARA";
    cin >> s;
    if(s[s.size()-1]=='R')s.push_back('A');
    int i=0,j=0;
    while(i<s.size() && j<a.size()){
        if(s[i]!=a[j]){
            if(a[j]=='A')j++;
            else{
                ans = "NO";
                break;
            }
        }
        else{
            i++;
            j++;
        }
    }
    if(i!=s.size() || j!=a.size())ans = "NO";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();

    if (r < 1200) {
      System.out.println("ABC");
    }

    if (1200 <= r && r < 2800) {
      System.out.println("ARC");
    }

    if (r <= 4208 && r >= 2800) {
      System.out.println("AGC");
    }
  }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	ll ans = INF;
	for(int i=-100;i<=100;i++) {
		ll s=0;
		rep(j,n) {
			s+=(i-a[j])*(i-a[j]);
		}
		ans=min(ans,s);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

ll calc_p(ll n) {
  return (1ll << (n+1)) - 1;
}

ll calc_total(ll n) {
  return (1ll << (n+2)) - 3;
}

ll solve(ll n, ll x) {
  if (x == 0) return 0;
  if (x == 1) return n==0 ? 1 : 0;
  ll h = calc_total(n-1);
  if (x < h+1) return solve(n-1, x-1);
  if (x == h+1) return calc_p(n-1);
  if (x == h+2) return calc_p(n-1)+1;
  if (x < 1+h+1+h+1) return calc_p(n-1) + 1 + solve(n-1, x-1-h-1);
  return 2*calc_p(n-1)+1;
}

int main()
{
  ll n,x;
  cin>>n>>x;
  cout << solve(n,x) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define con_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define con_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;

int main(){
    int n,k,q,x;
    cin>>n>>k>>q;
    int array[n]={};
    rep(i,q){
        cin>>x;
        array[x-1]++;
    }
    rep(i,n){
        if(array[i]-q+k>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull B = 1000000007ULL;

int main(){
  int N; // N is the size of string s
  string s,P;
  cin >> s >> P;
  N=s.size();
  vector<ull> p(N+1); // p is power (base B)
  vector<ull> hash(N+1); // hash values
  p[0] = 1; hash[0] = 0;
  for (int i = 0; i < N; i++) {
    hash[i+1] = hash[i]*B + s[i];
    p[i+1] = p[i]*B;
  }
  /*
    s?????¨????????????s[L,R]??????????????\????????\?????????????????????.
    hash[L,R] := hash[R+1]-hash[L]*p[R-L+1];
  */
  ull base=0,ans=0;
  for(int i=0;i<P.size();i++){
    base=base*B+P[i];
  }
  for(int i=0;i+P.size()<=N;i++){
    int L=i,R=i+P.size()-1;
    if(hash[R+1]-hash[L]*p[R-L+1]==base) printf("%d\n",i);//cout<<i<<endl;
  }
  return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;
constexpr int MOD = 1000000007;

int mod(int x){
	return x % MOD;
}

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

int main(void)
{
    IOS
    int n;cin >> n; cin.ignore();
    char buf[200010*(10+10+5)];
    cin.read(buf,sizeof buf);
    auto r = cin.gcount();
    //cerr << r << endl;
    buf[r+1] = 0;
    string s(buf,r);
    vector<string> vl=split(s,'\n');
    vector<string> vs;
    vector<pair<int,int>> v(n);
    REP(i,n) {
        vs = split(vl[i],' ');
        int x = stoi(vs[0]), y=stoi(vs[1]);
        v[i] = make_pair(y,x);
    }
    sort(ALL(v));

    int t=0;
    REP(i,n) {
        t += v[i].second;
        //cerr << t << endl;
        if (t > v[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


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

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if ((abs(a-c)) <= d)
	  cout << "Yes";
	else 
	  if ((abs(a-b) <= d) && (abs(b-c) <= d))
	    cout << "Yes";
	  else
	    cout << "No";
	return 0;
}

Measured memory_bytes: 256
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	int cnt[3] = {};
	REP(i, 0, n){
		int p;
		scanf("%d", &p);
		cnt[(p>a)+(p>b)]++;
	}
	printf("%d\n", std::min({cnt[0], cnt[1], cnt[2]}));
	return 0;
}



Measured memory_bytes: 3796
#include <stdio.h>
#include <math.h>
 
double distance(double x1, double y1, double x2, double y2);
 
int main(void){
  double x1, x2, y1, y2, dis;
 
  scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
  dis = distance(x1, y1, x2, y2);
  printf("%f\n", dis);
  return 0;
}
 
 
double distance(double x1, double y1, double x2, double y2){
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1- y2));
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
signed main()
{
 
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    
    char c; cin >> c;
    if (c >='A' and c<= 'Z') {
        cout << "A";
    }
    else if (c >='a' and c<= 'z'){
        cout << "a";
    }
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<math.h>

int main(){
	char ss[400],gen[300];
	int i,j,n,k;
	
	while(0<=scanf(" %s ",ss)){
		i=0;
		j=0;
		k=0;
		for(i=0;i<400;i++){
			if(ss[i]=='\0'){
				gen[j]=='\0';
				break;
			}
			if(ss[i]=='@'){
				n=ss[i+1]-'0';
				for(k=0;k<n;k++){
					gen[j+k]=ss[i+2];
				}
				i+=2;
				j+=n;
			}else{
				gen[j]=ss[i];
				++j;
			}
			gen[j]='\0';
//			printf("%s\n",gen);
		}
		printf("%s\n",gen);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

unordered_map<char,int>mp;

bool isOK(int n){
    bool ret = true;
    string cmp = to_string(n);
    rep(i,cmp.size()){
        if(mp[cmp[i]]){
            ret = false;
        }
    unordered_map<char,int>mp;
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,k;
    cin>>n>>k;
    rep(i,k){
        char tmp;cin>>tmp;
        mp[tmp]++;
    }
    bool flag = true;
    while(flag){
        if(isOK(n))flag = false;
        else n++;
    }
    cout<<n<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll n,r,c;
	cin>>n>>r>>c;
	if(r>n || c>>n)
	{
		cout<<0;
		return 0;
	}
	ll ans=n-c+1;
	ans+=ans*(n-r);
	cout<<ans;
 	return 0;
}


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

using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    while(M--){
        int next;
        cin >> next;
        N -= next;
        if(N < 0){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << N << endl;
}


Measured memory_bytes: 3620
// Vicfred
// https://atcoder.jp/contests/abc176/tasks/abc176_c
// greedy
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main() {
    long n = readln.chomp.to!long;
    long[] a = readln.split.map!(to!long).array;

    long last = a[0];
    long ans = 0;
    for(int i = 1; i < n; i++) {
        if(a[i] < last)
            ans += last - a[i];
        else
            last = a[i];
    }

    ans.writeln;
}



Measured memory_bytes: 11588
import java.util.Scanner;

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

        System.out.printf("%.6f %.6f\n", r * r * Math.PI, 2 * r * Math.PI);
        sc.close();
    }
}


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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)
#define fi first
#define se second

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

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

P p[50];
int x[50], y[50];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int inner, n;
    cin >> n >> inner;
    rep(i, n) {
        cin >> p[i].first >> p[i].second;
        x[i] = p[i].first; y[i] = p[i].second;
    }
    sort(x, x + n);
    sort(y, y + n);
    int res = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
    rep(i, n) FOR(j, i + 1, n) rep(k, n) FOR(l, k + 1, n) {
        int cnt = 0;
        rep(c, n) {
            if(x[i] <= p[c].first && p[c].first <= x[j] && y[k] <= p[c].second && p[c].second <= y[l]) ++cnt;
        }
        if(cnt >= inner) chmin(res, (x[j] - x[i]) * (y[l] - y[k]));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    let mut m = vec![0;n];
    let nn = ((n as f64).sqrt() as usize) + 1;
    for x in 1..nn {
        for y in 1..nn {
            for z in 1..nn {
                let t = x * x + y * y + z * z + x * y + y * z + z * x;
                if t > n {break;}
                m[t-1] += 1;
            }
        }
    }
    for i in 0..n {
        println!("{}", m[i]);
    }
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a,b,ans;
signed main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=n/(a+b)*a;
	ans+=min(a,n%(a+b));
	printf("%lld\n",ans);
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
#define int long long
#define ll long long
#define vel vector<int>
#define vvel vector<vel>
#define veb vector<bool>
#define pin pair<int,int>
#define mp make_pair 
#define int long long
using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
signed main() {
	int h, w, h0, w0;
	cin >> h >> w >> h0 >> w0;
	int a = h / h0;
	int r = h % h0;
	if (r > 0) {
		cout << "Yes" << endl;
		int x = a + 1;
		int y = (a+1) * (h0 - 1) + 1;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i%h0 == h0-1) { cout << -y; }
				else { cout << x; }
				if (j + 1 < w) { cout << " "; }
				else { cout << endl; }
			}
		}
	}
	else {
		int qa = w / w0;
		int qr = w % w0;
		if (qr > 0) {
			cout << "Yes" << endl;
			int x = qa + 1;
			int y = (qa+1) * (w0 - 1) + 1;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (j%w0 == w0 - 1) { cout << -y; }
					else { cout << x; }
					if (j + 1 < w) { cout << " "; }
					else { cout << endl; }
				}
			}
		}
		else { cout << "No" << endl; }
	}
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;

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

    ll res = 0;
    res += B[0];
    res += B[N-2];
    for(int i=1;i<N-1;i++) res += min(B[i-1], B[i]);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	double vol = (double)n/3*n/3*n/3;
	printf("%.6lf\n", vol); 
	return 0;
};


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

using namespace std;

typedef pair<int,int> P;

int main() {
  int H,W,N,x,y;
  cin>>H>>W>>N;
  cin>>y>>x;
  string s,t;
  cin>>s;
  cin>>t;
  bool flag = false;// 脱出可能ならtrue
  int lx=0;
  int rx=W+1;
  for(int i=N-1;i>=0;i--){
    if(t[i]=='R') lx=max(lx-1,0);
    if(t[i]=='L') rx=min(rx+1,W+1);
    if(s[i]=='R') rx--;
    if(s[i]=='L') lx++;
    if(lx+1>=rx){
      flag=true;
      break;
    }
  }
  if(x<=lx || x>=rx) flag=true;

  int ly=0;
  int ry=H+1;
  for(int i=N-1;i>=0;i--){
    if(t[i]=='D') ly=max(ly-1,0);
    if(t[i]=='U') ry=min(ry+1,H+1);
    if(s[i]=='D') ry--;
    if(s[i]=='U') ly++;
    if(ly+1>=ry){
      flag=true;
      break;
    }
  }
  if(y<=ly || y>=ry) flag=true;

  if(!flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 776
using System;
using System.Linq;
using System.Collections.Generic;

namespace AGC003
{
    class B
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());

            long[] A = new long[N];
            for (long i = 0; i < N; i++)
            {
                A[i] = long.Parse(Console.ReadLine());
            }

            long sum = 0;
            long count = 0;
            for (long i = 0; i < N; i++)
            {
                while (i < N && A[i] != 0)
                {
                    count += A[i];
                    i++;
                }
                sum += count / 2;
                count = 0;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 17884
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int N;
int C[501],S[501],F[501];
int main(){
  cin >> N;
  for(int i=0;i<N-1;i++)cin >> C[i] >> S[i] >> F[i];
 
  for(int i=0;i<N-1;i++){
    int ans=S[i];
    for(int j=i;j<N-1;j++){
      if(ans<S[j])ans=S[j];
      int x=ans%F[j];
     
      if(x==0)ans+=C[j];
      else {
	ans+=(F[j]-x);
	ans+=C[j];
      }
      //cout << ans << endl;
    }
    cout << ans << endl;
  }
  cout << "0" << endl;
  return 0;
}


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

struct edge{int s,t,n;}e[200010];
int n,h[100010];

int dfs(int x,int f)
{
	int s=0;
	for (int i=h[x],y; y=e[i].t,i; i=e[i].n)
		if (y!=f)  s^=dfs(y,x)+1;
	return s;
}

void work()
{
	scanf("%d",&n);
	for (int i=1,x,y,tot=0; i<n; i++)
		{
			scanf("%d %d",&x,&y);
			e[++tot]=(edge){x,y,h[x]},h[x]=tot;
			e[++tot]=(edge){y,x,h[y]},h[y]=tot;
		}
	puts(dfs(1,0)?"Alice":"Bob");
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 7808
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int n, k; cin >> n >> k;
    vector<double> q(n + 1, 0);
    for (int i = 0; i < n; i++) {
        double p;  cin >> p;
        q[i + 1] = q[i] + (p + 1) / 2;
    }
    double ans = 0;
    for (int i = 0; i < n - k + 1; i++) {
        ans = max(ans, q[i + k] - q[i]);
    }
    printf("%.10f", ans);
    return 0;
}

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

int main () {
  char c;
  cin >> c;
  if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    int n,k; cin >> n >> k; 
    int h[n+1];
    h[0]=0;
    int dp[n+1];
    dp[0]=0;
    dp[1]=0;
    for(int i=1;i<=n;i++)
    {
        cin >> h[i];
    }
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=1;j<=k;j++)
        {
            if(j<i)
            {
                dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    cout << dp[n];
}

Measured memory_bytes: 1024