akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ts  ll t;cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr ll n,i;cin>>n; ll a[n+1];for(i=0;i<n;i++)
#define ln cout<<"\n"; 
#define maxn 1000000


int main() {
	fast
	ll n,x,y,k=0,max1=0;
	cin>>n;
	while(n--){
	cin>>x>>y;
	if(x==y)k++,max1=max(max1,k);
	else k=0;
	}
	if(max1>=3)cout<<"Yes";
	else cout<<"No";
	
	    

	return 0;}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
typedef long long ll; 
 
using namespace std;
 
int main() {
	int N, K;
	cin >> N >> K;
	vector<ll> a(N + 1);
	for (int i = 1; i <= N; ++i) { cin >> a[i]; }
 
	vector<ll> d(N + 1, 0);
	for (int i = 1; i <= N; ++i) { d[i] = d[i - 1] + a[i]; }
 
	vector<ll> v;
	for (int l = 0; l <= N - 1; ++l) {
		for (int r = l + 1; r <= N; ++r) {
			ll x = d[r] - d[l];
			v.push_back(x);
		}
	}

   ll res = 0;
   for (int i = 50; i >= 1; --i) {
	   ll x = res + pow(2, i - 1);
	   int cnt = 0;
	   for (int j = 0; j < v.size(); ++j) {
		   ll y = x & v[j];
		   if (y == x) { ++cnt; }
	   }

	   if (cnt >= K) {
		   res += pow(2, i - 1);
	   }
   }

   cout << res << endl;

   return 0;
}


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

int main() {
	int now=0;
	string in,out;
	cin>>in;
	for(int i=0;in[i]!='\0';i++){
		switch(in[i]){
			case '1':
			out[now]='1';
			now++;
			break;
			case '0':
			out[now]='0';
			now++;
			break;
			case 'B':
			if(now>0)now--;
			break;
		}
	}
	
	for(int i=0;i<now;i++){
		cout<<out[i];
	}
}

Measured memory_bytes: 256
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define N 5050
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const long long INF = 1e18;

ll dp[N][N];
vector<ii> vec;

bool cmp(const ii &a, const ii &b){
	return b.ff + b.ss > a.ff + a.ss;
}

int main(){

	fastio;
	int n;
	cin >> n;
	vec.resize(n);
	// first -> strength second -> weight
	FER(i,0,n) cin >> vec[i].ff >> vec[i].ss;
	sort(vec.begin(),vec.end(),cmp);
	
	int ans = 1;
	FER(i,0,N) FER(j,0,N) dp[i][j] = INF;
	for(int i = 0; i < n; ++i) dp[0][i] = vec[i].ss;
	for(int i = 1; i < n; ++i){
		ll min_weight = INF;
		FER(j,0,i) min_weight = min(min_weight,dp[i-1][j]);
		for(int j = i; j < n; ++j){
			if(vec[j].ff >= min_weight)
				dp[i][j] = min_weight + vec[j].ss, ans = i+1;
			min_weight = min(min_weight,dp[i-1][j]);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 199680
a, b = map(int, input().split())

if (a > 0) & (b > 0):
    print('Positive')
elif (a <= 0) & (b >= 0):
    print('Zero')
else:
    if (b - a + 1) % 2 == 1:
        print('Negative')
    else:
        print('Positive')

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main(){

	int i;
	int m, n;
	
	cin >> n >> m;

	vector<int> data[100005];
	vector<int> pre(n, -1);
	vector<int> dist(n, -1);

	for(i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		data[a].push_back(b);
		data[b].push_back(a);;
	}

	queue<int> que;
	dist[0] = 0;
	que.push(0);
	
	while(!que.empty()){
		int v = que.front();
		que.pop();
		for(int m : data[v]){
			if(dist[m] != -1) continue;
			dist[m] = dist[v]+1;
			pre[m] = v;
			que.push(m);
		}
	}
	
	cout << "Yes" << endl;

	for(i = 1; i < n; i++){
		//int ans; ans=pre[i]+1;
		//cout << ans << endl;
		cout << pre.at(i)+1 << endl;
	}

	return 0;
}
	


Measured memory_bytes: 10600
#include<bits/stdc++.h>
using namespace std;
string s;
long long jsq=0,sun=0;
long long a=0;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
	     if(s[i]=='C' && sun==0) jsq=1;
	     if(s[i]=='F' && jsq==1) sun=1;
	}
	a=jsq+sun;
	if(a==2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e5)
#define INFL LLONG_MAX
#define NINFL LLONG_MIN
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
	FIO;
	int t = 1;
	//cin >> t;
	while (t--) {
		ll a,b,c;
		cin >> a >> b >> c;
		ll ans = c;
		//cout << ans << "\n";
		for(int i=0;i<10;i++){
			ans = ans*a - b;
			cout << ans << "\n";
		}
	}


	return 0;
}


Measured memory_bytes: 3580
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

ll pi, qi;
ll j;
ll p, q;

void foreach_permutation(ll m, std::function<void(ll *)> f) {
    ll indexes[m];
    for (ll i = 0; i < m; ++i) indexes[i] = i + 1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + m));
}

int main() {
    ll n;
    cin >> n;
    vector<ll> ps(n), qs(n);
    p = 0; q = 0;
    for (ll i = 0; i < n; ++i) {
        cin >> ps[i];
        p += ps[i];
        if (i != n-1) {
            p *= 10;
        }
    }
    for (ll i = 0; i < n; ++i) {
        cin >> qs[i];
        q += qs[i];
        if (i != n-1) {
            q *= 10;
        }
    }

    j = 0;
    foreach_permutation(n, [&](ll *indexes) {
        ++j;
        ll r = 0;
        for (ll i = 0; i < n; ++i) {
            r += indexes[i];
            if (i != n-1) {
                r *= 10;
            }
        }
        // cerr << r << endl;
        if (r == p) {
            pi = j;
        }

        if (r == q) {
            qi = j;
        }

    });
    cout << abs(pi - qi) << endl;
}


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

int main(void)
{
    ios::sync_with_stdio(false);
    ll n, i, sum=0, temp;
    ll a[MAXN];
    cin>>n;
    for(i=0; i<n; i++)
        cin>>a[i];
    for(a[n]=1e9,i=0; i<n; i++)
        if(a[i+1]<a[i]){
            temp = a[i]-a[i+1];
            sum = sum+temp;
            a[i+1] = a[i];
        }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 5152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

int main() {
  ll N;
  cin>>N;
  cout<<N*(N+1)/2<<endl;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,K;
    cin >> N >> K;
    vector<ll> V(N);
    rep(i,N){
        cin >> V[i];
    }
    ll ans = 0;
    for(int l=0;l<=min(N,K);l++){
        for(int r=0;r<=min(N,K);r++){
            if(l+r>min(N,K))  continue;
            vector<ll> tmp;
            ll s=0;
            for(int i=0;i<l;i++){
                s+=V[i];
                tmp.push_back(V[i]);
            }
            for(int i=0;i<r;i++){
                s+=V[N-i-1];
                tmp.push_back(V[N-i-1]);
            }
            sort(tmp.begin(),tmp.end());
            for(int i=0;i<min(K-(l+r),(int)tmp.size());i++){
                if(tmp[i]<0){
                    s-=tmp[i];
                }
            }
            ans = max(ans,s);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var a = ReadLongs();

            var count = 0L;
            for (int i = 0; i < N; i++)
            {
                var x = a[i];

                while (x != 0)
                {
                    if (x % 2 == 0)
                    {
                        count++;

                        x /= 2;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return count;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 29328
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>

#include <string>

using namespace std;

long long gcd(long long x,long long y){
    if(y==0)return x;
    return gcd(y,x%y);
}

vector<pair<long long ,int> > factorize(long long n){
  vector<pair<long long ,int> > res;
  for (long long i = 2; i*i <= n; i++) {
    if(n%i)continue;
    res.emplace_back(i,0);
    while (n%i==0) {
      n/=i;
      res.back().second++;
    }
  }
  if(n!=1)res.emplace_back(n,1);
  return res;
}



int main(){
  long long a,b;
  std::cin >> a>>b;
  long long g=gcd(a,b);
  auto f=factorize(g);
  int ans=f.size()+1;
  std::cout << ans << '\n';


return 0;
}


Measured memory_bytes: 256
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();


        let S1 = read::<String>();
        let S1 = S1.chars().collect::<Vec<char>>();

        let S2 = read::<String>();
        let S2 = S2.chars().collect::<Vec<char>>();

        let S3 = read::<String>();
        let S3 = S3.chars().collect::<Vec<char>>();

        if S1[S1.len()-1] == S2[0] && S2[S2.len()-1] == S3[0] {
            println!("YES");
        }else {
            println!("NO");
        }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define ll long long
#define rint register int
using namespace std;
inline char get(){
	const int TOP=1000000;
	static char T[TOP],*x=T,*y=T;
	return x==y&&(y=(x=T)+fread(T,1,TOP,stdin),x==y)?EOF:*x++;
}
inline int read (){
	register int num,sign=1;register char c;
	while (((c=get())<'0'||c>'9')&&c!='-');c=='-'?num=sign=0:num=c-48;
	while ((c=get())>='0'&&c<='9')num=(num<<3)+(num<<1)+(c-48);
	return sign?num:-num;
}
int a,b,c;
int main(){
	a=read();b=read();c=read();
	printf("%d\n",min(a+b+1,c)+b);
} 

Measured memory_bytes: 128
import math
a,aa=map(int,input().split())
b=[list(map(int,input().split())) for i in range(a)]
d=0
for i in range(a-1):
  for j in range(i+1,a):
    c=0
    for k in range(aa):
      c+=(b[i][k]-b[j][k])*(b[i][k]-b[j][k])
    c=math.sqrt(c)
    if c%1==0:
      d+=1

print(d)

Measured memory_bytes: 3064
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

str t;
ll a, d, mod = 1e9+7, dp[10001][2][100];

int main() {
    fast;
    for(int q=0; q<10001; q++) for(int w=0; w<2; w++) for(int e=0; e<100; e++) dp[q][w][e] = 0;
    cin>>t>>d;
    a = t.size();
    vec<int> m(a);
    for(int q=0; q<a; q++) m[q] = t[q]-'0';
    for(int w=0; w<=m[0]; w++){
        if(w<m[0]){
            dp[0][0][w%d] += 1;
        }
        else{
            dp[0][1][w%d] += 1;
        }
    }
    for(int q=1; q<a; q++){
        for(int ost=0; ost<d; ost++) {
            for (int w = 0; w < 10; w++) {
                int p = (ost-w+d*100)%d;
                dp[q][0][ost] += dp[q-1][0][p];
                if(w<m[q]){
                    dp[q][0][ost] += dp[q-1][1][p];
                }
                else if(w==m[q]){
                    dp[q][1][ost] += dp[q-1][1][p];
                }
                else{
                    ;
                }
            }
            dp[q][0][ost] %= mod;
            dp[q][1][ost] %= mod;
        }
    }
    ll o = dp[a-1][0][0] + dp[a-1][1][0];
    cout<<(o-1+mod)%mod;
}

Measured memory_bytes: 16000
<?php

$stack = array();
while (!feof(STDIN)) {
    fscanf(STDIN, '%d', $num);
    if (!is_int($num) || feof(STDIN)) {
        break;
    }
    if ($num === 0) {
        if (!count($stack)) {
            break;
        }
        echo array_pop($stack);
        echo PHP_EOL;
        continue;
    }
    $stack[] = $num;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int H, W; cin >> H >> W;
	vector<vector<char>> arr (H, vector<char> (W));
	F0R(i, H) {
		F0R(j, W) {
			char c; cin >> c;
			arr[i][j] = c;
		}
	}

	for (int par = 0; par < 2; ++par) {
		F0R(i, H) {
			F0R(j, W) {
				if (i == 0) {
					cout << ((par) ? '#' : '.');
				} else if (i == H - 1) {
					cout << ((par) ? '.' : '#');
				} else {
					cout << ((j % 2 == par || arr[i][j] == '#') ? '#' : '.');
				}
			}
			cout << endl;
		}
		if (par == 0) cout << endl;
	}
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>

int main()
{
 int x;
 int y;
 int out=0;

 scanf("%d %d",&x,&y);

 if(x==1) out=300000;
 if(x==2) out=200000;
 if(x==3) out=100000;

 if(y==1) out=out+300000;
 if(y==2) out=out+200000;
 if(y==3) out=out+100000;

 if((x==1)&(y==1)) out=out+400000;
 printf("%d\n",out);
 return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, V;
int X[200011];


VI vs;
int m;

VI G[200011];
int H[22];
void calc(int dp[1<<20]) {
    G[0].push_back(0);
    REP (i, N) {
	REP (j, m) H[j] = -1;
	while (!G[i].empty()) {
	    int s = G[i].back(); G[i].pop_back();
	    if (dp[s] != i) continue;

	    REP (j, m) if (~s>>j&1) {
		int right;
		if (i == 0 || X[i]-X[i-1] > vs[j]) {
		    if (H[j] == -1) {
			right = i+1;
			while (right < N && X[right]-X[right-1] <= vs[j]) right++;
			H[j] = right;
		    } else {
			right = H[j];
		    }
		} else {
		    continue;
		}
		if (dp[s|(1<<j)] < right) {
		    dp[s|(1<<j)] = right;
		    G[right].push_back(s|(1<<j));
		}
	    }
	}
    }
//    rprintf("%d", dp, dp+(1<<m));
}
int L[1<<20], R[1<<20];

int Z[200011];

void MAIN() {
#ifdef LOCAL
    N = 200000;
    V = 100000;
    REP (i, N) X[i] = i * 10;
#else
    scanf("%d%d", &N, &V);
    REP (i, N) scanf("%d", X+i);
#endif
    m = V;
    while (1) {
	vs.push_back(m);
	if (m == 0) break;
	m/=2;
    }
    m = vs.size();

    calc(L);
    reverse(X, X+N);
    REP (i, N) X[i] = -X[i];
    calc(R);
    reverse(X, X+N);
    REP (i, N) X[i] = -X[i];

    memset(Z, 0xc0, sizeof Z);
    REP (s, 1<<m) if (~s&1) {
	int t = ((1<<m)-1) ^ s ^ 1;
	amax(Z[N-R[t]], L[s]);
    }

    int ma = Z[0];
    for (int i=0; i<N; ) {
	int j = i;
	while (j < N && (j == i || X[j] - X[j-1] <= V)) {
	    j++;
	    amax(ma, Z[j]);
	}

	for (int k=i; k<j; k++) {
	    puts(i<=ma? "Possible": "Impossible");
	}
	//eprintf("%d\n", ma);
	i = j;
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 27772
d=int(input())
c=[int(i) for i in input().split()]
s=[]
for i in range(d):
  s.append([int(i) for i in input().split()])
#print(d, c, s)

#Score
Score=[0]*d
last=[0]*26
d_last=[0]*26
t=[]
#d=1
score0=max(s[0])
Score[0]=score0
last[s[0].index(score0)]=1
t.append(s[0].index(score0)+1)
#d>=2
for j in range(1,d):
  d_last=[(j+1)-i if i>0 else 0 for i in last]
  cd=[c*dd for (c,dd) in zip(c,d_last)]
#  print("cd: {}".format(cd))
  score1=[s-c for (s,c) in zip(s[j],cd)]
  Score[j]=max(score1)
  last[score1.index(max(score1))]=j+1
  t.append(score1.index(max(score1))+1)

for l in t:
  print(l)

Measured memory_bytes: 9300
/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
 
*/
#include <iostream>
#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 <cassert>
#include <iomanip>
 
 
using namespace std;
 
 
#define ll long long
#define ld long double
#define null NULL
#define prev prev228
 
 
ll a[51];
 
signed main() {
	ll k;
	cin >> k;
	int n = 50;
	ll x = k / n;
	for (int i = 1; i <= n; ++i) {
		a[i] = x + (i - 1);
	}
	for (int it = 0; it < k % n; ++it) {
		a[1 + it] += n + 1;
		for (int i = 1; i <= n; ++i) {
			--a[i];
		}
	}
	cout << n << endl;
	for (int i = 1; i <= n; ++i) {
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}
 
 
 
 
 
 
 
 


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,k;
	scanf("%d",&n);
	scanf("%d",&k);
	int x=1;
	for(int i=0;i<n;i++){
		if(x*2<x+k){
			x*=2;
		}
		else if(x*2>x+k){
			x+=k;
		}
		else{
			x*=2;
		}
	}
	printf("%d",x);
	return 0;
}

Measured memory_bytes: 1692
import fractions
 
N, M = map(int, input().split())
S = input()
T = input()

cfac = fractions.gcd(N,M)

B = N//cfac
C = M//cfac
 
i = 0
for i in range(cfac):
  if S[i*B] != T[i*C]:
    print(-1)
    exit()
    
print(cfac*B*C)

Measured memory_bytes: 65260
import queue

n, m = list(map(int, input().split()))
dic = {}  
count = 0
q = queue.Queue()

for i in range(m):
  a, b, c = list(map(int, input().split()))
  if not a-1 in dic:
    dic[a-1]=[b-1]
  else:
    dic[a-1].append(b-1)
  
  if not b-1 in dic:
    dic[b-1]=[a-1]
  else:
    dic[b-1].append(a-1)

dp = [0]*n

#print(dic)

for i in range(n):
  if dp[i]==0:
    count += 1
    dp[i]=count
    if i in dic:
      for j in dic[i]:
        dp[j]=count
        q.put(j)
    #print(dp)
    while not q.empty():
      temp = q.get()
      #print(temp)
      if temp in dic:
        for j in dic[temp]:
          if dp[j] == 0:
            dp[j]=count
            q.put(j)
#print(dp)
print(count)

Measured memory_bytes: 36612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();

		boolean[] flg = new boolean[N + 1];
		for(int i = 0; i <= N; i++) {
			flg[i] = true;
		}
		for(int i = 0; i < M; i++) {
			flg[scan.nextInt()] = false;
		}
		int[] b = new int[N + 1];
		b[0] = 1;
		b[1] = 1;

		int mod = 1000000007;
		for(int i = 2; i <= N; i++)
		{
			b[i] = 0;
			if(flg[i - 2]) {
				b[i] += b[i -2];
			}
			if(flg[i - 1]) {
				b[i] += b[i -1];
			}
			b[i] %= mod;
		}

		System.out.println(b[N]);
	}
}

Measured memory_bytes: 50064
#include <iostream>
#include <map>
#include <vector>
using namespace std;

main() {
  int n;
  while((cin >> n) && n) {
    map<int, unsigned long long> m;
    vector<int> id;
    for(int i = 0; i < n; ++i) {
      int r, p, q;
      cin >> r >> p >> q;
      if(!m[r]) id.push_back(r);
      m[r] += p*q;
    }
    bool flag = true;
    for(int i = 0; i < id.size(); ++i) {
      if(m[id[i]] >= 1000000) {
	cout << id[i] << endl;
	flag = false;
      }
    }
    if(flag) cout << "NA" << endl;
  }
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main(){
    long long q, h, s, d;cin>>q>>h>>s>>d;
    double n;cin>>n;

    vector<pair<long long, pair<long long, double>>> cost_performance;
    cost_performance.push_back(make_pair(q / 0.25, make_pair(q, 0.25)));
    cost_performance.push_back(make_pair(h / 0.5, make_pair(h, 0.5)));
    cost_performance.push_back(make_pair(s / 1.0, make_pair(s, 1.0)));
    cost_performance.push_back(make_pair(d / 2.0, make_pair(d, 2.0)));

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

    long long acc = 0;
    for (auto item : cost_performance){
        if (n == 0){
            break;
        }
        auto item_info = item.second;
        auto price = item_info.first;
        auto amount = item_info.second;

        long long num = floor(n / amount);
        acc += num * price;
        n -= amount * num;
    }

    cout << acc <<endl;
    return 0;
}

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

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    vector<int> v(n);
    rep(i, n) {
      cin >> v.at(i);
    }
    sort(v.begin(), v.end());
    int ans = 1000000; 
    rep(i, n - 1) {
      ans = min(ans, v.at(i + 1) - v.at(i));
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3096
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <string>
#include <math.h>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repp(i, m, n) for(int i = m; i < (int)n; i++)
#define reps(i, n) for(int i = 1; i <= (int)n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;

int main()
{
	int n;
	ll a[100010];
	pal b[100010];
	cin >> n;
	rep(i, n) cin >> a[i];
	sort(a, a+n);
	rep(i, n-1) b[i]=pal(abs(2*a[i]-a[n-1]), i);
	sort(b, b+(n-1));
	cout << a[n-1] << ' ' << a[b[0].second] << endl;
	return 0;
}

Measured memory_bytes: 2560
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 998244353
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
lr = [IL() for i in range(K)]
lr.sort()

dp = [0]*(N+1)
dp[1] = 1
data = [0]*(N+1)
data[1] = 1

for i in range(2,N+1):
  tmp = 0
  for l,r in lr:
    if tmp >= r:
      continue
    elif l <= tmp < r:
      l = tmp+1
    if 1 <= i-l:
      dp[i] += data[i-l] - data[max(i-r-1, 0)]
  data[i] = (data[i-1] + dp[i]) %mod
print(dp[N] %mod)

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

#define s(n)		    scanf("%d",&n)
#define ss(n)		    scanf("%s",n)
#define forall(i,a,b)	for(int i=a;i<b;i++)
#define forn(i,n)       for(int i=0;i<n;i++)
#define fill(a,v)	    memset(a, v, sizeof a)
#define fi              freopen("input.txt", "rt", stdin)
#define fo              freopen("output.txt", "wt", stdout)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;

ll dp[55][3005];
int a[55];

void solve()
{
    //fi; fo;
    int n,av;
    cin>>n>>av;

    forall(i,1,n+1){
        cin>>a[i];
    }

	dp[0][0]=1;
	
    forall(i,1,n+1){
		for(int j=i-1; j>=0;j--)
		{
			forn(k,2500){
				int cur = k + a[i];
				dp[j+1][cur] += dp[j][k];
			}
		}
    }
	ll ans=0;
	forall(len,1,n+1){
		ans+=dp[len][av*len];
	}
	cout<<ans<<'\n';
}


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

Measured memory_bytes: 1408
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile (== ' ')) <$> BS.getLine

mod' :: Integral a => a -> a
mod' n = if n < 1000000007 then n else n `mod` 1000000007

f :: [Int] -> Int
f (b:b':bs)= (min b b') + (f (b':bs))
f _ = 0

main :: IO ()
main = do
  n <- readLn :: IO Int
  bs <- getIntList
  print $ (head bs) + (f bs) + (last bs)


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define MP make_pair
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

LL big_mod(LL n, LL p)
{
    if(p==0) return 1;
    if(!(p&1))
    {
        LL r = big_mod(n,p/2) % MOD;
        return ( (r%MOD) * (r%MOD) ) % MOD;
    }
    else return ( ( n%MOD) * (big_mod(n,p-1) %MOD)) % MOD;
}
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
LL ar[200010];
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    LL first,second,n;
    while(cin>>n)
    {
        first=0;
        second=0;
        rep(i,0,n) cin>>ar[i],first+=ar[i];
        LL minimum=10e19;
        rep(i,0,n-1)
        {
            first-=ar[i];
            second+=ar[i];
            minimum=min(minimum,abs(first-second));
        }
        cout<<minimum<<endl;
    }

}


Measured memory_bytes: 1792
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = np.array(input().split(), np.int64)
    ans = 0
    while True:
        if np.count_nonzero(A%2==1) == 0:
            A = A//2
            ans += 1
        else:
            break
    print(ans)




if __name__ == '__main__':
    main()

Measured memory_bytes: 12212
n = int(input())
a = list(map(int,input().split()))
ans = 'DENIED'
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            ans = 'APPROVED'
        else:
            ans = 'DENIED'
            break
    else:
        ans = 'APPROVED'
print(ans)

Measured memory_bytes: 3060
var
	A,B,C,K:Longint;
begin
	read(A,B,C,K);
	while A>=B do begin
		dec(K);
		B:=B*2;
	end;
	while B>=C do begin
		dec(K);
		C:=C*2;
	end;
	if K<0 then writeln('No')else writeln('Yes');
end.


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int a[5];
    rep(i, 5) cin >> a[i];
    int ans = 1e8;

    vector<int> b(5, 0);
    iota(b.begin(), b.end(), 0);
    do {
        int tmp = 0;
        rep(i, 5) {
            tmp += a[b[i]];
            if (tmp%10 and i+1 < 5) {
                tmp += 10 - (tmp%10);
            }
        }
        ans = min(ans, tmp);

    } while (next_permutation(b.begin(), b.end()));

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def print_ans(K, X):
    """Test Case
    >>> print_ans(3, 7)
    5 6 7 8 9
    >>> print_ans(4, 0)
    -3 -2 -1 0 1 2 3
    >>> print_ans(1, 100)
    100
    """
    ans = [i for i in range(X - K + 1, X + K)]
    print(" ".join(list(map(str,ans))))
if __name__ == '__main__':
    K, X = map(int,input().rstrip().split())
    print_ans(K, X)


Measured memory_bytes: 3060
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()
ans = 0
for i in range(n):
    if (i+1)%2==1 and a[i]%2==1:
        ans += 1

print(ans)

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

int main()
{
  char v[3];
  
  for(int i=0;i<3;i++)
  {
  	cin >> v[i];
  }
  
  if(v[0]==v[1])
  {
	if(v[1]==v[2])
  	{
    	cout << "No" <<endl;
  	}
    else{
      cout <<"Yes"<<endl;
    }
  }
  else
  {
    cout <<"Yes"<<endl;
  }
    
    return 0;
    
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	
	static long count(String s, int start, int end)
	{
		long res = 0;
		long na = 0;
		for(int i = start; i < end; i++)
		{
			if(s.charAt(i) == 'A' )
				na++;
			else
				res += na;
		}
		
		return res;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		FastReader e = new FastReader();
		
		String s = e.next();
		s = s.replace("BC", "D");
		long res = 0;
		for(int i = 0; i < s.length(); )
		{
			if(s.charAt(i) == 'A' )
			{
				int j = i;
				while(j < s.length() && (s.charAt(j) == 'A' || s.charAt(j) == 'D') )
					j++;
				res += count(s, i, j);
				i = j;
			}
			else
			{
				i++;
			}
		}
		
		System.out.println(res);
	}
}

Measured memory_bytes: 31608
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int a, b, c;
        cin >> a >> b >> c;
        if(a == 0)
            return 0;

        if(c == 0){
            if(a == 1 && b < 0)
                cout << "1 0 " << a << ' ' << b << endl;
            else
                cout << a << ' ' << b << " 1 0" << endl;
            continue;
        }

        bool impossible = true;
        for(int p=a; p*p>=a; --p){
            if(a % p != 0)
                continue;
            int r = a / p;
            for(int q=-abs(c); q<=abs(c); ++q){
                if(q == 0 || c % q != 0)
                    continue;
                int s = c / q;
                if(p == r && q < s)
                    continue;
                if(p*s + q*r == b){
                    cout << p << ' ' << q << ' ' << r << ' ' << s << endl;
                    impossible = false;
                    break;
                }
            }
        }

        if(impossible)
            cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 880
module app;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

void main()
{
    Input input = parseInput();
    auto result = main2(input);
    writefln("%d", result);
}

BigInt main2(Input input)
{
    BigInt first = 1;
    BigInt last = input.n;
    return (first + last - 1) * (last - 1) / 2;
}

unittest
{
    Input input = {2};
    auto result = main2(input);
    assert(result == 1);
}
unittest
{
    Input input = {13};
    auto result = main2(input);
    assert(result == 78);
}
unittest
{
    Input input = {1};
    auto result = main2(input);
    assert(result == 0);
}

struct Input
{
	uint n;
}

Input parseInput()
{
	Input input;
	input.n = readln().strip().to!uint;
	return input;
}


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

using namespace std;

int main()
{
	int h, w;    cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) cin >> s[i];


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

	
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') continue;


			
			int num = 0;
			for (int d = 0; d < 8; d++) {
				const int ni = i + dy[d];
				const int nj = j + dx[d];

				
				if (0<=ni and ni<h and 0<=ni and nj<w and s[ni][nj] == '#') num++;    
			}

			s[i][j] = char(num + '0');
		}
	}
	for (int i = 0; i < h; i++) cout << s[i] << endl;
	return 0;
}


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

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

signed main() {
    cin >> S;
    vector<string> week = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    for (int i = 0; i < 7; i++) {
        if (S == week[i]) {
            cout << 7 - i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
/*input

*/
#include<bits/stdc++.h>
#define ll        	long long 
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define rrep(i,a,b) for(ll int i=a;i>=b;i--)
#define all(a)      (a).begin(),(a).end()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define tr(i, cont) for(auto i=cont.begin();i!=cont.end();i++)
#define ios        	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define trace(x)                 cerr << #x << ": " << x << "\n";
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << "\n";

#define endl "\n"
using namespace std;


int main(){
	ll n;
	cin>>n;
	cout<<n*n*n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    string n;
    cin>>n;
    if (n[0]==n[1]&&n[1]==n[2]) cout<<"Yes"<<endl;
    else if(n[1]==n[2]&&n[2]==n[3]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, k, q int
	fmt.Scan(&n, &k, &q)
	
	parti := make([]int, n)
	
	for i := range parti {
		parti[i] = k - q
	}
	
	tmp := 0
	for i := 0; i < q; i++ {
		fmt.Scan(&tmp)
		tmp--
		parti[tmp]++
	}

	for i  := range parti {
		if parti[i] > 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


Measured memory_bytes: 5888
#include<iostream>
#define N 3

using namespace std;

int CalculateTime(int, int, int&);

int main(){
  int i;
  int h1, m1, s1, h2, m2, s2;
  int hour[N], minute[N], second[N];

  for(i=0; i<N; ++i){
    cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2;

    second[i] = CalculateTime(s1, s2, m2);
    minute[i] = CalculateTime(m1, m2, h2);
    hour[i] = CalculateTime(h1, h2, s2);
  }

  for(i=0; i<N; ++i)
    cout << hour[i] << " " << minute[i] << " " << second[i] << endl;

  return 0;
}

int CalculateTime(int a1, int a2, int& b){
  if(a1 > a2){
    --b;
    a2 += 60;
  }

  return (a2 - a1);
}

Measured memory_bytes: 0
s = input().split()
s = list(s[0])
s.sort()
alf = [chr(i) for i in range(97, 97+26)]
Flag = 0
s_not_duplicate = []
s_not_duplicate.append(s[0])
for i in range(len(s)):
    if s_not_duplicate[-1] != s[i]:
        s_not_duplicate.append(s[i])

for i in range(len(alf)):
    if i > len(s_not_duplicate) - 1:
        print(alf[i])
        Flag = 1
        break
    
    if s_not_duplicate[i] != alf[i]:
        Flag = 1
        print(alf[i])
        break
if Flag == 0:
    print("None")
    





Measured memory_bytes: 4336
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n; cin >> n;
  vector<int> A(n); loop(i,0,n) cin >> A[i];
  int count = 0;
  loop(i,0,n) {
    if (i==0 or i==n-1) continue;
    int a = A[i-1];
    int b = A[i];
    int c = A[i+1];
    if (a > c) swap(a, c);
    if (a < b and b < c) count++;
  }
  cout  << count << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int n,m,a[31],b[31];

	cin >> n >> m;

	char o;

	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> o >> b[i];
	}

	int p[31];

	for (int j = 1; j < n + 1; j++)
	{
		p[j] = j;
	}

	for (int i = 0; i < m; i++)
	{
		int ha = 0,hb = 0;

		ha = p[b[i]];
		hb = p[a[i]];

		p[a[i]] = 0;
		p[a[i]] = ha;

		p[b[i]] = 0;
		p[b[i]] = hb;
	}

	for (int j = 1; j < n + 1; j++)
	{
		cout << p[j] << endl;
	}
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define aio()                         \
    do {                              \
        std::ios::sync_with_stdio(0); \
        std::cin.tie(0);              \
    } while (0)
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
    aio();

    ll n;
    cin >> n;
    vector<ll> all(n);
    for (auto &i : all) {
        cin >> i;
    }

    ll cur_highest = 0, ans = 0;
    for (auto i : all) {
        cur_highest = max(cur_highest, i);
        ans += cur_highest - i;
    }
    cout << ans;
}


Measured memory_bytes: 4776
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] a = new int[4];
		long[] x = new long[n];
		long[] y = new long[n];
		
		for(int i = 0; i < n; i++)
		{
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		
		int[] b = new int[4];
		long best = 8999999999999999999l;
		
		for(a[0] = 0; a[0] < n; a[0]++)
			for(a[1] = a[0]; a[1] < n; a[1]++)
				for(a[2] = a[1]; a[2] < n; a[2]++)
					for(a[3] = a[2]; a[3] < n; a[3]++)
					{
						long y0 = 2000000000;
						long y1 = -2000000000;
						long x0 = 2000000000;
						long x1 = -2000000000;
						for(int i = 0; i < 4; i++)
						{
							x0=Math.min(x0, x[a[i]]);
							x1=Math.max(x1, x[a[i]]);
							y0=Math.min(y0, y[a[i]]);
							y1=Math.max(y1, y[a[i]]);
						}
						int c = 0;
						for(int i = 0; i < n; i++)
						{
							if(x[i]>=x0&&x[i]<=x1&&y[i]>=y0&&y[i]<=y1)
								c++;
						}
						long area = (x1-x0)*(y1-y0);
						if(c>=k&&area<best)
						{
							for(int i = 0; i < 4; i++)
								b[i] = a[i];
							best = area;
						}
					}
			
		System.out.println(best);
	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef complex <double> cp;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
#define Fill(x,a) memset(x,a,sizeof(x))
#define cpy(a,b) memcpy(a,b,sizeof(a))
const double PI = acos(-1);
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m,q;
int d,t,v;
string s1, s2;
int len1, len2;

int main(){
	cin >> s1 >> s2;
	len1 = s1.size();
	len2 = s2.size(); 
	minn = INF;
	for(int i = 0; i + len2 - 1 < len1; i ++ ){
		int ans = 0;
		for(int j = 0; j < len2; j ++ ){
			if(s1[i + j] != s2[j]){
				ans ++ ;
			}
		}
		minn = min(minn,ans);
	}
	cout << minn << endl;
	


	return 0;
}



Measured memory_bytes: 3636
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
import sys


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007


n = I()
nums = LI()
cnt = 0
ans = 0
for i in range(n):
    if nums[i] == i + 1:
        cnt += 1
    else:
        if cnt:
            ans += (cnt + 1) // 2
        cnt = 0
if cnt:
    ans += (cnt + 1) // 2



print(ans)




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

class Dice {
public:
	Dice(int num[6]) {
		t = num[0];
		b = num[5];
		n = num[4];
		s = num[1];
		w = num[3];
		e = num[2];
	}
	
	void roll_e() {
		int temp = w;
		w = b;
		b = e;
		e = t;
		t = temp;
	}
	void roll_w() {
		for (int i = 0; i < 3; i++)roll_e();
	}
	void roll_n() {
		int temp = s;
		s = b;
		b = n;
		n = t;
		t = temp;
	}
	void roll_s() {
		for (int i = 0; i < 3; i++)roll_n();
	}
	int getTop() {
		return t;
	}
private:
	int t, b;
	int n, s, w, e;
};


int main() {
	int num[6];
	for (int i = 0; i < 6; i++) {
		cin >> num[i];
	}

	Dice dice(num);
	string str;

	cin >> str;
	for (int i = 0; i < str.length();i++) {
		switch (str[i]) {
		case 'E':
			dice.roll_e();
			break;
		case 'N':
			dice.roll_n();
			break;
		case 'W':
			dice.roll_w();
			break;
		case 'S':
			dice.roll_s();
			break;
		}
	}
	cout << dice.getTop() << endl;
	return 0;
}

Measured memory_bytes: 3184