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

typedef long long i64;
const int MAX_N = 200005;

class Edge {
public:
  int nxt, to;
} e[MAX_N << 1];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
  e[++cnt] = (Edge){head[v], u}, head[v] = cnt;
}

int N;
char S[MAX_N];
int mx[MAX_N], smx[MAX_N], num[MAX_N], low[MAX_N];

void update(int x, int v) {
  if (mx[x] <= v) smx[x] = mx[x], mx[x] = v;
  else if (smx[x] < v) smx[x] = v;
}

void dfs1(int u, int v) {
  mx[u] = 0, num[u] = S[u], low[u] = N;
  for (int i = head[u]; i; i = e[i].nxt) 
    if (e[i].to != v) {
      dfs1(e[i].to, u);
      if (num[e[i].to]) low[u] = min(low[u], mx[e[i].to] + 1);
      num[u] += num[e[i].to];
      update(u, mx[e[i].to] + 1);
    }
}

void dfs2(int u, int v) {
  for (int i = head[u]; i; i = e[i].nxt)
    if (e[i].to != v) {
      int d;
      if (mx[u] == mx[e[i].to] + 1) {
	d = smx[u] + 1;
      } else {
	d = mx[u] + 1;
      }
      update(e[i].to, d);
      if (num[u] - num[e[i].to] > 0) low[e[i].to] = min(low[e[i].to], d);
      num[e[i].to] = num[u];
      dfs2(e[i].to, u);
    }
}

int main() {
  scanf("%d", &N);
  for (int i = 1, u, v; i < N; ++i) {
    scanf("%d%d", &u, &v);
    addedge(u, v);
  }
  
  scanf("%s", S + 1);
  for (int i = 1; i <= N; ++i) S[i] = S[i] - '0';
  
  dfs1(1, 0);
  dfs2(1, 0);

  i64 res = 0;
  for (int i = 1; i <= N; ++i) {
    int h = min(mx[i], smx[i] + 2);
    int l = S[i] ? 0 : low[i];

    res += max(0, h - l);
  }
  
  printf("%lld\n", res + 1);
  return 0;
}


Measured memory_bytes: 14592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 500000

typedef struct _n{
  int number;
  struct _n *parent;
  struct _n *successor;
  struct _n *left;
  struct _n *right;

}Node;

Node root;

void insert(int);
void output(Node *);
void out(Node *);

int main(){

  int i;
  int n, number;
  char order[7];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s", order);
    if(strcmp(order, "insert") == 0){
      scanf("%d", &number);
      insert(number);
    }
    if(strcmp(order, "print") == 0){
      output(&root);
      printf("\n");
      out(&root);
      printf("\n");

    }

  }

  return 0;
}

void insert(int number){
  
  int i;
  Node *p, *q;
  Node *set;  

  if(root.number == 0){
    root.number = number;
    root.left = NULL;
    root.right = NULL;
  }
  else{
    set = (Node *)malloc(sizeof(Node));
    set->number = number;
    set->left = NULL;
    set->right = NULL;
    
    q = NULL;
    p = &root;
    
    while(p != NULL){
      q = p;
      
      if(set->number < p->number) p = p->left;
      else p = p->right;
      
    }
    
    set->parent = q;

    if(set->number < q->number) q->left = set;
    else q->right = set;

  }


}


void output(Node *a){

  if(a == NULL) return;

  output(a->left);
  printf(" %d", a->number);
  output(a->right);
  
}

void out(Node *a){
  if(a == NULL) return;
  printf(" %d", a->number);
  out(a->left);
  out(a->right);

}

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

#define llint long long
#define LL(x) (x * 2)
#define RR(x) (x * 2 + 1)
#define fi first
#define se second
#define db(x) cout << #x << " = " << x << endl;
#define BIT(x, i) ((x >> i) & 1)
#define MASK(i) (1ll << i)
#define mini(x, y) (x > y ? x = y, 1 : 0)
#define maxi(x, y) (x < y ? x = y, 1 : 0)

void openFile() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef Tr___
	freopen("test.inp", "r", stdin);
	freopen("test.out", "w", stdout);
	#endif
}

const int maxN = 2e5 + 5;
const int maxM = 1e6 + 5;
const llint INF = 1e9 + 7;
typedef pair<pair<int, int>, pair<int, int> > pii;

int N;
int a[maxN];
map<pair<int, int>, bool> vis;
map<pair<int, int>, pair<int, int> > dp;

struct cmp {
	bool operator () (pii lef, pii rig) {
		return a[lef.fi.fi] > a[rig.fi.fi];
	};
};

priority_queue<pii, vector<pii>, cmp> q;

struct node {
	int odd, even, posOdd, posEven;
};

class segmentTree {
public:
	node it[maxN * 4];
	int L[maxN * 4], R[maxN * 4];

	node combine(node a, node b) {
		node res;
		if (a.odd < b.odd) {
			res.odd = a.odd;
			res.posOdd = a.posOdd;
		}
		else {
			res.odd = b.odd;
			res.posOdd = b.posOdd;
		}
		if (a.even < b.even) {
			res.even = a.even;
			res.posEven = a.posEven;
		}
		else {
			res.even = b.even;
			res.posEven = b.posEven;
		}
		return res;
	}

	void buildTree(int x, int low, int high) {
		L[x] = low; R[x] = high;
		if (low == high) {
			it[x] = {INF, INF, low, low};
			if (low % 2 == 1) {
				it[x].odd = a[low];
			}
			else {
				it[x].even = a[low];
			}
			return;
		}
		int mid = (low + high) / 2;
		buildTree(LL(x), low, mid);
		buildTree(RR(x), mid + 1, high);
		it[x] = combine(it[LL(x)], it[RR(x)]);
	}

	node query(int x, int low, int high) {
		if (L[x] > high || R[x] < low) return {INF, INF, INF, INF};
		if (low <= L[x] && R[x] <= high) {
			return it[x];
		}
		return combine(query(LL(x), low, high), query(RR(x), low, high));
	}
} tree;

void enter() {
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		cin >> a[i];
	}
}

pair<int, int> solve(int l, int r) {
	if (vis[{l, r}]) return dp[{l, r}];
	int ll, rr;
	if (l % 2 == 1) {
		ll = tree.query(1, l, r).posOdd;
		rr = tree.query(1, ll, r).posEven;
	}
	else {
		ll = tree.query(1, l, r).posEven;
		rr = tree.query(1, ll, r).posOdd;
	}
	vis[{l, r}] = true;
	dp[{l, r}] = {ll, rr};
	return {ll, rr};
}

void prepare() {
	tree.buildTree(1, 1, N);
}

vector<pair<int, int> > res;

void solve() {
	prepare();
	q.push({solve(1, N), {1, N}});
	while (!q.empty()) {
		pii u = q.top(); q.pop();
		pair<int, int> in = u.fi;
		pair<int, int> out = u.se;
		//cerr << in.fi << " " << in.se << flush << endl;
		res.push_back(in);
		if (in.fi != out.fi) {
			q.push({solve(out.fi, in.fi - 1), {out.fi, in.fi - 1}});
		}
		if (in.se != out.se) {
			q.push({solve(in.se + 1, out.se), {in.se + 1, out.se}});
		}
		if (in.fi + 1 != in.se) {
			q.push({solve(in.fi + 1, in.se - 1), {in.fi + 1, in.se - 1}});
		}
	}

	for (int i = 0; i < res.size(); ++i) {
		cout << a[res[i].fi] << " " << a[res[i].se] << " ";
	}
}

int main() {
	openFile();
	enter();
	solve();
	return 0;
}


Measured memory_bytes: 32628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    VI v;
    int n;
    cin >> n;
    REP(i,n) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    
    sort(v.begin(), v.end());
    cout << v.back() - v.front() << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <numeric>
#include <string>
#include <map>
#include <sstream>
using namespace std;
 
int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << max(A*B,C*D) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
   int n,i,j,k,x,c;
   while(cin>>n>>x){
   	c=0;
		if(n==0&&x==0) break;
			for(i=1;i<=n-2;i++){
				for(j=i+1;j<=n-1;j++){
					for(k=j+1;k<=n;k++){
						if(i+j+k==x){
							c++;
						}
					}
				}
			}cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
X = int(input())
if 400 <= X < 600:
    print("8")
elif 600 <= X < 800:
    print("7")
elif 800 <= X < 1000:
    print("6")
elif 1000 <= X < 1200:
    print("5")
elif 1200 <= X < 1400:
    print("4")
elif 1400 <= X < 1600:
    print("3")
elif 1600 <= X < 1800:
    print("2")
elif 1800 <= X < 2000:
    print("1")

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std; 
int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long N, K;
	cin >> N >> K;
	cout << min(N % K, abs(N % K - K)) << '\n';
	return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
array = []
for I in range(N): array.append(int(input()))
for J in array:
    if not ( 100 <= J <= 10000 ): sys.exit()
if not ( 2 <= N <= 10 ): sys.exit()

print(max(array)//2 + sum(array) - max(array))

Measured memory_bytes: 9148
#include <stdio.h>

typedef struct{
	int no;
	double w;
	double h;
	int flag;
}stu;

int main(void) {
	stu a[500];
	int i=0;
	
	while( scanf("%d,%lf,%lf", &a[i].no, &a[i].w, &a[i].h) != EOF) {
		double bmi=a[i].w/a[i].h/a[i].h;
		a[i].flag=0;
		
		if(bmi>=25.0) a[i].flag=1;
		
		i++;
	}
	
	int j;
	for(j=0; j<i; j++) {
		if(a[j].flag==1) printf("%d\n", a[j].no);
	}
	
	return 0;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("long_input.txt");
    #define cin input_from_file
#else

#endif


struct Vertex{
    //~ bool isLeaf;
    vector<Vertex*> child;
    vector<int> qq;

    Vertex() {
        //~ isLeaf = true;
        child.resize(26, nullptr);
        qq.resize(26, 0);
        //~ for (int k = 0; k < 26; k++) child[k] = nullptr, qq[k] = 0;
    }

    void make_child(int c) {
        if (child[c] != nullptr) return;
        child[c] = new Vertex();
        //~ if (!isLeaf) return;
        //~ isLeaf = false;
        //~ for (int k = 0; k < 26; k++) child[k] = new Vertex();
    }
};


LL res = 0;
Vertex* trie = new Vertex();


void insert(const string& s){
    //~ cout << s << endl;
    Vertex* at = trie;
    vector<int> qq_tr(26,0);
    for (int k = 0; k < 26; k++) qq_tr[k] = at->qq[k];
    for (int i = (int)s.size()-1; i >= 0; i--) {
        int c = s[i]-'a';
        //~ cout << s[i] << endl;
        if (i == 0) at->qq[c]++;
        res += qq_tr[c];
        qq_tr[c] = 0;
        at->make_child(c);
        at = at->child[c];
        //~ cout << "+ " << qq_tr[c] << endl;
        for (int k = 0; k < 26; k++) qq_tr[k] += at->qq[k];
    }
    //~ cout << endl;
}




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    vector<pair<int,int>> oo;
    for (int i = 0; i < N; i++) oo.push_back({S[i].size(), i});
    sort(oo.begin(), oo.end());
    //~ for (string s : S) cout << s << endl;
    for (int i = 0; i < N; i++) {
        insert(S[oo[i].second]);
    }
    cout << res << "\n";
}


Measured memory_bytes: 394716
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, vector<ll> A) {
  ll sum = accumulate(ALL(A), 0LL);
  ll one = N * (N + 1) / 2;
  if (sum % one != 0) { cout << false << endl; return; }
  sum /= one;
  vector<ll> B(N);
  REP(i,N) {
    ll diff = -(A[(i+1)%N] - A[i] - sum);
    // cout << diff << endl;
    if (diff < 0 || diff % N != 0) { cout << false << endl; return; }
    // for (int j = 1; j <= N; ++j) {
    //   B[(i + j) % N] += diff / N * j;
    // }
  }
  cout << true << endl;
  // cout << (A == B) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> A(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &A[i]);
	}
	solve(N, A);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x);1
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX = 10000000;
const ll inf = 5e18-1;

int main() {
	fastio;
	ll n;
	cin>>n;
	string s,a="",b="";
	cin>>s;
	if(n%2!=0){
		no;
		return 0;
	}else{
		f(i,0,n/2){
			a+=s[i];
		}
		f(i,n/2,n){
			b+=s[i];
		}
		if(a==b) yes;
		else no;
	}
    return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<< endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N, M);
  VEC(int, X, M);
  sort(all(X));
  vi d;
  rep(i, 0, M - 1) {
    d.push_back(X[i + 1] - X[i]);
  }
  sort(all(d), greater<>());
  int ans = abs(X[M - 1] - X[0]);
  rep(i, 0, min(N - 1, M - 1)) {
    ans -= d[i];
  }
  print(ans);
}


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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long
#define endll           pf("\n")
#define pf              printf
#define PI              acos(-1.0)
#define eps             1e-12
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MOD  1000000007
#define mod1 1000000009
#define var    int i,j,c=0,t,l,r,mid,z=0,k,x,y
#define aloc(n,t) ((t*)malloc((n)*sizeof(t)))

//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};

ll n,m,k,a[200005],b[200005];

int main()
{
    sfl(n);sfl(m);sfl(k);
    for(int i=1;i<=n;i++)
    {
        sfl(a[i]);
        a[i]+=a[i-1];
    }
    for(int i=1;i<=m;i++)
    {
        sfl(b[i]);
        b[i]+=b[i-1];
    }
    int z =0;
    for(int i=0;i<=n;i++)
    {
        ll c = k - a[i];
        if(c<0)continue;
        int x  = upper_bound(b,b+m+1,c)-b;
        z = max(z,i+x-1);

    }
    pf("%d\n",z);
}


Measured memory_bytes: 6876
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;


int main() {
	int N, M, a[1000], b[1000], c[1000];
	int dist[100][100];
	int i,j,k,ans;
	scanf("%d %d", &N, &M);
	for (i = 0; i < M; i++) {
		scanf("%d %d %d", &a[i], &b[i], &c[i]);
	}

	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			dist[i][j] = 9999999;
		}
		dist[i][i] = 0;
	}
	for (i = 0; i < M; i++) {
		dist[a[i] - 1][b[i] - 1] = c[i];
		dist[b[i] - 1][a[i] - 1] = c[i];
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			for (k = 0; k < N; k++) {
				if (dist[j][k] > dist[j][i] + dist[i][k]) {
					dist[j][k] = dist[j][i] + dist[i][k];
				}
			}
		}
	}

	ans = 0;
	for (i = 0; i < M; i++) {
		if (dist[a[i] - 1][b[i] - 1] < c[i]) { ans++; }
	}

	printf("%d", ans);
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		double[] array = new double[1000];
		int i;
		for(;;){
			double sum = 0;
			double ave;
			double hen = 0;
			double hen_sum = 0;
			int n = scan.nextInt();
			if(n == 0)
				break;
			for(i = 0; i < n; i++){
				double a = scan.nextDouble();
				array[i] = a;
				sum += a;
			}
			ave = sum / n;
			for(i = 0; i < n; i++){
				hen += (ave - array[i]) * (ave - array[i]);
			}
			double v = hen / n;
			double a = Math.sqrt(v);
			System.out.println(a);
		}
	}
}



		

	

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

using namespace std;

int main(){
	int n, m;
	long long int ans = 0;
	cin >> n >> m;
	int c = 1;
	for(int i = 0; i <= m; i++){
		if(i!=0)
			c *= 2;
	}
	cout << ((n-m)*100+(m * 1900)) * c << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
//--GLOBAL------------------------------------


//--MAIN------------------------------------
void Main(){
    int a,b; cin>>a>>b;

    if(a<=9 and b<=9) cout<< a*b<<"\n";
    else cout<< -1<<"\n";
}

//--START---------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    string s;
    cin>>s;
    int n=s.size();
    set<string> se;
    for(int i=1;i<=7;i++){
        string t=s.substr(0,i);
        // debug(t);
        string u=s.substr(n-(7-i),7-i);
        // debug(u);
        se.insert(t+u);
    }
    if(se.count("keyence")==0){
        cout<<"NO"<<endl;
    }
    else{
        cout<<"YES"<<endl;
    }


}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int o1=a+b;
    int o2=a-b;
    int o3=a*b;

    int max=Math.max(Math.max(o1,o2),o3);

    System.out.println(max);
  }
}


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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    ll n;
    cin >> n;
    vll a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    ll sa = 0, sb = 0;
    rep(i, n) {
        sa += a[i];
        sb += b[i];
    }

    ll diff = sb - sa;

    ll cnt = 0;
    rep(i, n) {
        if (a[i] > b[i]) {
            ll k = a[i] - b[i];
            b[i] += k;

            cnt += k;
        }
    }

    rep(i, n) {
        if (a[i] < b[i]) {
            if ((a[i] - b[i]) % 2 == 0) {
                ll k = (b[i] - a[i]) / 2;
                a[i] += 2 * k;
                cnt -= k;
            } else {
                ll k = (b[i] - a[i] + 1) / 2;
                a[i] += 2 * k;
                cnt -= k;
                cnt++;
            }
        }
    }

    if (cnt > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    int a, b;
    cin >> a >> b;
    cout << a * b;
    return 0;
}

Measured memory_bytes: 3164
N,Y=map(int,input().split())
a=-1
b=-1
c=-1
total=0
for i in range(N+1):
    for n in range((N+1)-i):
        c1=N-i-n
        total=10000*i+5000*n+1000*c1
        if total==Y:
            a=i
            b=n
            c=c1
            print('{} {} {}'.format(a,b,c))
            exit()
print('{} {} {}'.format(a,b,c))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N;
  vector<string> blue(N,"");
  for(int i=0;i<N;i++){
    cin >> blue.at(i);
  }
  cin >> M;
  vector<string> red(M,"");
  for(int i=0;i<M;i++){
    cin >> red.at(i);
  }
  vector<int> ans(N,0);
  for(int i=0;i<N;i++){
    for(int k=0;k<N;k++){
      if(blue.at(i)==blue.at(k)){
        ans.at(i)++;
      }
    }
  } 
   for(int i=0;i<N;i++){
    for(int k=0;k<M;k++){
      if(blue.at(i)==red.at(k)){
        ans.at(i)--;
      }
    }
  } 
  int max=0;
  for(int i=0;i< ans.size();i++) {
        if( ans.at(i) > max ){
            max=ans.at(i);
    }
  }
  cout << max << endl;
}

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    int a, b, h;
    cin >> a  >> b >> h;
    cout << (a+b) * h/2 << endl;
    return 0;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int a, b; cin >> a >> b;
	if (a > 9 or b > 9) {
		cout << -1 << endl;
	}
	else {
		cout << a * b << endl;
	}

	return 0;
}


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

typedef struct {
    int time;
    int tower[3][15];
    int t[3];
} HANOI;

HANOI queue[50000];
int head, tail;
int pow[30];

void enq(HANOI t)
{
	queue[tail % 50000] = t;
	tail++;
}

void deq(HANOI *t)
{
	*t = queue[head % 50000];
	head++;
}

char v[15000000];

int move(HANOI temp, int from, int to, int pw)
{
    int num;
    int i, j;
    HANOI first;
    if ((temp.t[from] > 0 && temp.t[to] > 0 && temp.tower[from][temp.t[from] - 1] > temp.tower[to][temp.t[to] - 1]) ||temp.t[from] > 0 && temp.t[to] == 0){
        first = temp;
        first.tower[to][temp.t[to]] = first.tower[from][temp.t[from] - 1];
        first.tower[from][temp.t[from] - 1] = 0;
        first.t[from]--;
        first.t[to]++;
        first.time++;
        num = 0;
        for (i = 0; i < 3; i++){
            for (j = 0; j < first.t[i]; j++){
                num += i * pow[first.tower[i][j] - 1];
            }
        }
        if (v[0] == 1 || v[pw] == 1){
            printf("%d\n", first.time);
            return (1);
        }
        if (!v[num]){
            v[num] = 1;
            enq(first);
        }
    }
    return (0);
}

int main(void)
{
    int n, m;
    HANOI start, temp;
    int i, j;
    int pw;
    
    pow[0] = 1;
    for (i = 1; i < 20; i++){
        pow[i] = pow[i - 1] * 3;
    }
    
    while (1){
        scanf("%d%d", &n, &m);
        
        if (n + m == 0){
            break;
        }
        memset(start.tower, 0, sizeof(start.tower));
        for (i = 0; i < 3; i++){
            scanf("%d", &start.t[i]);
            for (j = 0; j < start.t[i]; j++){
                scanf("%d", &start.tower[i][j]);
            }
        }
        
        memset(v, 0, sizeof(v));
        
        start.time = 0;
        head = tail = 0;
        pw = pow[n] - 1;
        enq(start);
        
        while (head != tail){
            deq(&temp);
            
            if (temp.time > m){
                printf("-1\n");
                break;
            }
            
            if (move(temp, 0, 1, pw)){
                break;
            }
            if (move(temp, 1, 0, pw)){
                break;
            }
            if (move(temp, 1, 2, pw)){
                break;
            }
            if (move(temp, 2, 1, pw)){
                break;
            }
        }
    }
    
    return (0);
}

Measured memory_bytes: 24000
import math
N,M = map(int,input().split())
n = math.ceil(N/0.08)
m = int(M/0.1)
ans = 2000
if int(n*0.1) ==M:
  ans = min(n,ans)
if int(m*0.08) ==N:
  ans =min(m,ans)
  
if int(n*0.1)!=M and int(m*0.08)!=N:
  ans = -1
  
print(ans)

Measured memory_bytes: 9120
// https://beta.atcoder.jp/contests/abc099
// status:
//

#define SUBMIT
//#define DEBUG

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <queue>
#include <numeric>
#include <limits>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const int MAX_N = 500;
const int MAX_C = 30;
const int NOT_VISITED = -1;

int D[MAX_C + 1][MAX_C + 1];
int color_count[3][MAX_C + 1];
// change_cost[i][j] (x + y) % 3 == iの要素を全てj色に変えたときのコスト
int change_cost[3][MAX_C + 1];

int N, C;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    auto s = std::string(R"(4 3
0 12 71
81 0 53
14 92 0
1 1 2 1
2 1 1 2
2 2 1 3
1 1 2 2
)");
    stringstream stream(s);
#endif
    memset(color_count, 0, sizeof(color_count));
    memset(change_cost, 0, sizeof(change_cost));

    stream >> N >> C;
    for (int y = 1; y <= C; ++y) {
        for (int x = 1; x <= C; ++x) {
            stream >> D[y][x];
        }
    }

    int c;
    for (int y = 1; y <= N; ++y) {
        for (int x = 1; x <= N; ++x) {
            stream >> c;
            color_count[(x + y) % 3][c]++;
        }
    }

    for (int r = 0; r < 3; ++r) {
        for (int from = 1; from <= C; ++from) {
            for (int to = 1; to <= C; ++to) {
                change_cost[r][to] += color_count[r][from] * D[from][to];
            }
        }
    }

    // C色から3色を選ぶ全組み合わせから最小値を探す
    // 3 <= C <= 30なのでO(C^3)でもO(27000)
    int min_cost = numeric_limits<int>::max();
    for (int i = 1; i <= C; ++i) {
        for (int j = 1; j <= C; ++j) {
            for (int k = 1; k <= C; ++k) {
                if (i == j || j == k || k == i) continue;
                min_cost = min(min_cost, change_cost[0][i] + change_cost[1][j] + change_cost[2][k]);
            }
        }
    }

#ifdef DEBUG
    cout << "each color count:" << endl;
    for (int r = 0; r < 3; ++r) {
        for (int from = 1; from <= C; ++from) {
            cout << color_count[r][from] << " ";
        }
        cout << endl;
    }

    cout << "change cost:" << endl;
    for (int r = 0; r < 3; ++r) {
        for (int to = 0; to <= C; ++to) {
            cout << change_cost[r][to] << " ";
        }
        cout << endl;
    }
#endif

    cout << min_cost << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
F = []
N.times{
  f = gets.chomp.split(" ").map(&:to_i)
  F << f.each_with_index.inject(0){|r, (ff, i)| r + (ff << i)}
}
P = []
N.times{
  P << gets.chomp.split(" ").map(&:to_i)
}

ans = []
(1...(1<<10)).each{|i|
  tmp = 0
  (0...N).each{|j|
    wk = F[j] & i
    idx = (0...10).count{|k| wk[k] == 1}
    tmp += P[j][idx]
  }
  ans << tmp
}

puts ans.max


Measured memory_bytes: 1788
H,W=map(int, input().split())
S=[]
for i in range(H):
    s=list(input())
    S.append(s)

nowblack=False
dp=[[float("INF")]*W for _ in range(H)]
if S[0][0]=="#":
    dp[0][0]=1
else:
    dp[0][0]=0
for h in range(H):
    for w in range(W):
        if 0<=h-1<H:
            if S[h][w]==".":
                dp[h][w]=min(dp[h][w], dp[h-1][w])
            else:
                if S[h-1][w]=="#":
                    dp[h][w]=min(dp[h][w], dp[h-1][w])
                else:
                    dp[h][w]=min(dp[h][w], dp[h-1][w]+1)


        if 0<=w-1<W:
            if S[h][w]==".":
                dp[h][w]=min(dp[h][w], dp[h][w-1])
            else:
                if S[h][w-1]=="#":
                    dp[h][w]=min(dp[h][w], dp[h][w-1])
                else:
                    dp[h][w]=min(dp[h][w], dp[h][w-1]+1)

print(dp[H-1][W-1])
#print(dp)

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

using namespace std;

const int INF = 1e9 + 5;

int n,i,j,p[100005];
pair <int, int> a[100005];
vector <pair<int, int> > x, y;

int find(int s){
	if(s == p[s]) return s;
	return p[s] = find(p[s]);
}

struct dat{
	int u, v, cost;
	
	bool operator < (const dat& T) const{
		return cost < T.cost;
	}
};

vector <dat> edge;

int main(){
	scanf("%d", &n);
	
	
	for(i = 0; i < n; i++)
	scanf("%d%d", &a[i].first, &a[i].second);
	
	for(i = 0; i < n; i++){
		p[i] = i;
		x.push_back({a[i].first, i});
		y.push_back({a[i].second, i});
	}
	
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	
	for(i = 1; i < x.size(); i++)
	edge.push_back({x[i - 1].second, x[i].second, x[i].first - x[i - 1].first});
	for(i = 1; i < y.size(); i++)
	edge.push_back({y[i - 1].second, y[i].second, y[i].first - y[i - 1].first});
	
	sort(edge.begin(), edge.end());
	
	long long res = 0;
	
	for(i = 0; i < edge.size(); i++){
		int u = find(edge[i].u);
		int v = find(edge[i].v);
		int cost = edge[i].cost;
		
		if(u == v) continue;
		
		p[u] = v;
		res += cost;
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 8296
N = int(input())

mod = 10 ** 9 + 7

# dp[N][4][4][4]
dp = []
for _ in range(N):
    n = []
    for _ in range(4):
        l = []
        for _ in range(4):
            c = [0] * 4
            l.append(c)
        n.append(l)
    dp.append(n)

CHAR_A = 0
CHAR_C = 1
CHAR_G = 2
CHAR_T = 3

for c in range(4):
    for r in range(4):
        dp[1][CHAR_T][c][r] = 1

for i in range(2, N):
    for l in range(4):
        for c in range(4):
            for r in range(4):
                for a in range(4):
                    if c == CHAR_A and r == CHAR_G and a == CHAR_C:
                        continue
                    if c == CHAR_A and r == CHAR_C and a == CHAR_G:
                        continue
                    if c == CHAR_G and r == CHAR_A and a == CHAR_C:
                        continue
                    if l == CHAR_A and c == CHAR_G and a == CHAR_C:
                        continue
                    if l == CHAR_A and r == CHAR_G and a == CHAR_C:
                        continue
                    dp[i][c][r][a] += dp[i-1][l][c][r]

ans = 0
for l in range(4):
    for c in range(4):
        for r in range(4):
            ans += dp[N-1][l][c][r]

print(ans%mod)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
char p[3]="CF",c[1005];
int main()
{    ios::sync_with_stdio(false);
    int x=0;  
    gets(c); 
    for(int i=0;i<strlen(c);i++)
        if(c[i]==p[x]) x++;  
    if(x>=2) cout<<"Yes"<<endl;  
    else cout<<"No"<<endl;  
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main extends App {
  def getNum(i:Int) = i match {
    case 4 => 5
    case 5 => 7
    case 6 => 8
    case 7 => 9
    case x => x
  }

  def scan(n:Int,b:Long,p:Long):Long = {
    val (m,r) = (n/8, n%8)
    if(m==0) b + getNum(r)*p
    else scan(m, b+getNum(r)*p, p*10)
  }

  Iterator.continually(readInt).takeWhile( _ != 0 ).foreach { n=>
    println(scan(n,0,1))
  }
}

Measured memory_bytes: 62388
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let mut a: usize = iterator.next().unwrap().parse().unwrap();
    let mut b: usize = iterator.next().unwrap().parse().unwrap();
    if a == 1 {
        a = 14;
    }
    if b == 1 {
        b = 14;
    }

    return if a == b {
        "Draw".to_string()
    } else if a > b {
        "Alice".to_string()
    } else {
        "Bob".to_string()
    };
}


Measured memory_bytes: 2076
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll N, M; cin >> N >> M;
    vector<ll> X(M);
    rep(i, M) cin >> X[i];
    sort(all(X));

    ll ans = 0;

    deque<ll> deq;

    rep(i, M - 1) deq.push_back(X[i+1]-X[i]);

    sort(all(deq));

    rep(i, M - N) {
        ans += deq[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1920
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll se, fu;
vector<P> ans;

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

  cin >> n;
  rep(i, n) {
    cin >> a[i];
    if (a[i] >= 0)
      se = max(se, a[i]);
    else
      fu = max(fu, abs(a[i]));
  }
  if (fu <= se) {
    rep(i, n) {
      if (se == a[i]) tmp = i;
    }
    rep(i, n) { ans.p_b({tmp, i}); }
    rep(i, n - 1) { ans.p_b({i, i + 1}); }
  } else {
    rep(i, n) {
      if (fu * -1 == a[i]) tmp = i;
    }
    rep(i, n) { ans.p_b({tmp, i}); }
    rrrep(i, n - 1, 1) { ans.p_b({i, i - 1}); }
  }
  Cout(Size(ans));
  rep(i, Size(ans)) { cout << ans[i].fi + 1 << " " << ans[i].se + 1 << "\n"; }
  return 0;
}

Measured memory_bytes: 256
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int n, k;
long double res;

int main() {
  init_ios();
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    long double pro = 1./n;
    int ile = 0;
    int j = i;
    while (j < k) {
      ++ile;
      j *= 2;
    }
    pro *= pow(2, -ile);
    res += pro;
  }
  cout<<fixed<<setprecision(13)<<res<<"\n";
}

Measured memory_bytes: 512
# coding: utf-8
# Your code here!

while True:
   try:
      s = input()
      
      Jc = 0
      Ic = 0
      for i in range(len(s) - 2):
         if s[i] == "J" and s[i + 1] == "O" and s[i + 2] == "I":
            Jc += 1
         if s[i] == "I" and s[i + 1] == "O" and s[i + 2] == "I":
            Ic += 1
      print(Jc)
      print(Ic)

   except EOFError:
      break


Measured memory_bytes: 5576
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod1e7(ll a){
  return (a % 1000000007);
}

ll mod1e9(ll a){
  return (a % 1000000009);
}

ll mod998(ll a){
  return (a % 998244353);
}

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

vector<ll> fac(200001);
void factorial(){
  fac[0] = 1; 
  for(ll i=1; i < 200001; i++){
    fac[i] = mod998(fac[i-1]*i);
  }
}
    
ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return mod998(fac[n]/fac[r]/fac[n-r]);
}

int main(){
  ll n,k; cin >> n >> k; ll ans = INT_MAX;
  vl high(n);
  
  rep(i,n) cin >> high[i];
  
  sort(all(high));
  
  for(ll i=0; i+k-1 <= n-1; i++){
    ans = min(ans,high[i+k-1]-high[i]);
  }
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 5680
#include <complex>
#include <vector>
#include <cstdio>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

typedef vector<P> G;

#define curr(P, i) P[(i+1) % P.size()]
#define next(P, i) P[(i+2) % P.size()]
#define prev(P, i) P[(i) % P.size()]
bool isconvex(const G &P){
  for(int i = 0; i < P.size(); ++i){
    int d=ccw(prev(P, i), curr(P, i), next(P, i));
	if(d==-1) return false;
  }
  return true;
}

int main(){
	G poly;
	P p;
	int n;
	double x,y;
	for(scanf("%d",&n);n--;poly.push_back(p))scanf("%lf%lf",&x,&y),p=P(x,y);
	printf("%d\n",isconvex(poly));
}

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

using namespace std;

int H, W;
char MapData[100][100];

void solve(char c, int row, int col) {
	int currentRow, currentCol;
	int dx[] = {0,1,0,-1};
	int dy[] = {1,0,-1,0};

	MapData[row][col] = 0;
	for (int i = 0; i < 4; i++) {
		currentRow = row + dx[i];
		currentCol = col + dy[i];
		
		if (currentRow<0 || currentRow>H - 1 || currentCol<0 || currentCol>W - 1) {
			continue;
		}
		if (MapData[currentRow][currentCol] == c) {
			solve(c, currentRow, currentCol);
		}
	}
}


int main() {
	int cnt;

	while (cin >> H >> W, H) {
		memset(MapData, 0, sizeof(MapData));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >>MapData[i][j];
			}
		}
		cnt = 0;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				switch (MapData[i][j])
				{
				case '@':cnt++; solve('@',i,j); break;
				case '#':cnt++; solve('#',i,j); break;
				case '*':cnt++; solve('*',i,j); break;
				default :break;
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}


Measured memory_bytes: 4220
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323
//void quick(int *,long long,long long);

int main(){
     
	int a,i,j,flag;

	while(scanf("%d",&a)!=EOF){
		i=a-1;
		while(1){
			for(j=2;j*j<=a&&i%j!=0;j++);
			if(i%j!=0||i==j){
				printf("%d ",i);
				break;
			}
			i--;
		}
		i=a+1;
		while(1){
			for(j=2;j*j<=a&&i%j!=0;j++);
			if(i%j!=0){
				printf("%d\n",i);
				break;
			}
			i++;
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int n=0;
  cin >> N;
  if(N<10){
    n=N;
  }
  else if(N<100){
    n=9;
  }
  else if(N<1000){
    n=9+N-99;
  }
  else if(N<10000){
    n=909;
  }
  else if(N<100000){
    n=9+900+N-9999;
  }
  else{
    n=90909;
  }
  cout << n;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


bool is_prime(ll v)
{
	if(v<2) return false;
	if(v%2==0)
	{
		return (v==2);
	}

	for(ll i=3;i*i<=v;i+=2)
	{
		if(v%i==0) return false;
	}
	return true;
}

using pf=vector<pair<ll,int> >;
pf prime_factorization(ll v)
{
	pf p;

	for(ll i=2;i*i<=v;i++)
	{
		if(v%i==0)
		{
			p.push_back(make_pair(i, 1));
			for(v/=i;v%i==0;v/=i)
			{
				p.back().second++;
			}
		}
	}
	if(v>1) p.push_back(make_pair(v, 1));

	return p;
}


int calc_divisor(vll&ret, ll v)
{
	auto p=prime_factorization(v);

	ret.clear();
	ret.push_back(1);
	for(auto&mp:p)
	{
		int n=ret.size();
		for(int i=0;i<n;i++)
		{
			ll t=ret[i];
			for(int j=mp.second;j>0;j--)
			{
				ret.push_back(t*=mp.first);
			}
		}
	}
	sort(ret.begin(), ret.end());

	return ret.size();
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		int n;
		cin >> n;
		if(cin.fail()) break;
		vi a(n);
		for(auto&m:a) cin >> m;

		map<ll,int> m;
		for(int i=0;i<n;i++)
		{
			auto p=prime_factorization(a[i]);
			for(auto&mp:p)
			{
				m[mp.first]++;
			}
		}

		int count=1;
		for(auto&mm:m)
		{
			max_u(count, mm.second);
		}

		string msg;
		if(count==1)
		{
			msg="pairwise coprime";
		}
		else if(count==n)
		{
			msg="not coprime";
		}
		else
		{
			msg="setwise coprime";
		}

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


Measured memory_bytes: 11736
#include <iostream>
using namespace std;
int main(void){
    
    int A, B;
    cin >> A >> B;
    
    if(A >= 1 && A <= 9 && B >= 1 && B <= 9){
        cout << A * B << endl;
    }
    else{
        cout << -1 << endl;
    }
    
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  string s;
  cin >> s;
  
  int i = 0;
  
  while(i < (s.size() - 1)){
    
    if(s.at(i) == s.at(i + 1)){
      cout << "Bad" << endl;
      break;
    }
    
    else
      i++;
    
  }
  
  if(i == (s.size() - 1))
    cout << "Good" << endl;
}
    

Measured memory_bytes: 256