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

long long memo[2][30000000];
bool sht[2][30000000];
int gsb[2][3];

// long long knapsack(int from, int to, int nuts)
// {
//     if (sht[to][nuts])
//         return memo[to][nuts];
//     sht[to][nuts] = 1;
//     memo[to][nuts] = nuts;
    
//     for (int i = 0; i != 3; ++i)
//         if (nuts >= gsb[from][i])
//             memo[to][nuts] = max(memo[to][nuts], knapsack(from, to, nuts - gsb[from][i]) + gsb[to][i]);
    
//     return memo[to][nuts];
// }

long long knapsack(int from, int to, int nuts)
{
    for (int n = 0; n <= nuts; ++n)
    {
        memo[to][n] = n;
    
        for (int i = 0; i != 3; ++i)
            if (n >= gsb[from][i])
                memo[to][n] = max(memo[to][n], memo[to][n - gsb[from][i]] + gsb[to][i]);
    }
    
    return memo[to][nuts];
}

void solve()
{
    int n;
    cin >> n;
    for (int i = 0; i != 2; ++i)
        for (int j = 0; j != 3; ++j)
            cin >> gsb[i][j];
    
    long long nuts = knapsack(0, 1, n);
    nuts = knapsack(1, 0, nuts);
    
    cout << nuts << '\n';
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    solve();
    
    return 0;
}

Measured memory_bytes: 198912
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int N, R;
    cin >> N >> R;

    int ret;
    if(N<10) R+=100*(10-N); 
    cout << R << endl;

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<algorithm>
#include <vector>
#include<cstdio>
#include <numeric>
#include <queue>
#include <list>
#include <math.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
long long mod=1000000007;
int main(){
  int a,b,c,d,e;cin>>a>>b>>c>>d>>e;
  if(a==0)cout<<1<<endl;
  if(b==0)cout<<2<<endl;
  if(c==0)cout<<3<<endl;
  if(d==0)cout<<4<<endl;
  if(e==0)cout<<5<<endl;
    





}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define N               100005
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


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

int main(){
    fio();

    double n,d;
    cin>>n>>d;

    ll ans = 0;

    for(ll z=0;z<n;z++){
        double x,y;
        cin>>x>>y;

        double dist = sqrt(x*x + y*y);

        if(dist <= d) ans++;
    }

    cout<<ans;

    return 0;
}

Measured memory_bytes: 3864
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSumANDSubarrays solver = new BSumANDSubarrays();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSumANDSubarrays {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            int k = in.ints();
            int[] a = in.ints(n);
            long[] sum = new long[n + 1];
            for (int i = 0; i < n; i++) {
                sum[i + 1] = sum[i] + a[i];
            }

            long ans = 0;
            for (int i = 62; i >= 0; i--) {
                long mask = ans | (1L << i);
                int c = 0;
                for (int r = 1; r < n; r++) {
                    for (int l = 0; l < r; l++) {
                        long s = sum[r + 1] - sum[l];
                        if ((s & mask) == mask) {
                            c++;
                        }
                    }
                }
                if (c >= k) {
                    ans = mask;
                }
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



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


int main(){
	ll n;
	cin>>n;
	ll a[n+5];
	map<ll,ll> b;
	for (int i = 0; i < n; i++){
		cin>>a[i];
		b[a[i]]++;
	}
	ll ans=0;
	for(auto x:b){
		ll temp;
		temp=x.second;
		ans+=(temp*(temp-1))/2;	
	}

	for (int i = 0; i < n; i++){
		ll dp;
		ll x=b[a[i]];
		dp=ans- (x*(x-1))/2 + ((x-1)*(x-2))/2; 
		cout<<dp<<endl;
	}
}

Measured memory_bytes: 11008
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int keta(ll a) {
  ll tmp = 1e10;
  ll ans;
  for(int i=11;i>0;--i) {
    if(a/tmp>0) {
      ans = i;
      break;
    }
    tmp /= 10;
  }
  return ans;
}

int main() {
  ll N;
  cin>>N;
  int ans = inf;
  for(ll i=1;i*i<=N;++i) {
    if(N%i==0) {
      ans = min(ans, max(keta(i), keta(N/i)));
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3640
using System;
using System.Linq;

class Program
{
    static void Main (string[] args)
    {
        var s = Console.ReadLine();

        var nc = s.Where(x => x == 'N').Count();
        var sc = s.Where(x => x == 'S').Count();
        var wc = s.Where(x => x == 'W').Count();
        var ec = s.Where(x => x == 'E').Count();

        var output = "Yes";

        if ((nc == 0 && sc > 0) || (sc == 0 && nc > 0))
        {
            output = "No";
        }

        if ((wc == 0 && ec > 0) || (ec == 0 && wc > 0))
        {
            output = "No";
        }

        Console.WriteLine(output);
    }
}


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

int main() {

    int n; string s; cin >> n >> s;
    int cnt_w = 0;
    int cnt_b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '.') cnt_w++;
        if (s[i] == '#') cnt_b++;
    }
    if (cnt_w == n || cnt_b == n) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> rev_accum_w(n + 1, 0);    
    for (int i = n - 1 ; i >= 0; i--) {
        if (s[i] == '.') rev_accum_w[i]++;
        if (i == n) continue;
        rev_accum_w[i] += rev_accum_w[i + 1];
    }
    vector<int> accum_b(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        accum_b[i] += accum_b[i - 1];
        if (s[i - 1] == '#') accum_b[i]++;        
    }
    int ans = 100000000;
    for (int i = 0; i <= n; i++) {
        int tmp = 0;
        tmp += accum_b[i];
        tmp += rev_accum_w[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5232
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int gcd(int a, int b){
    if(a < b) swap(a, b);

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

int main(void)
{
    int n;
    cin >> n;

    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    vector<int> L(n);
    vector<int> R(n);

   rep(i, n-1) L[i+1] = gcd(L[i], a.at(i));
   for(int i = n-1; i >= 1; i-- ) R[i-1] = gcd(R[i], a.at(i));
   int ans = 0;

   rep(i, n) ans = max(ans, gcd(L[i], R[i]));

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

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;
long long gcd( long long a, long long b )
{
	while(b)
	{
		long long temp = b;
		b = a % b;
		a = temp;
	}
	return	a;
}

long long lcm( long long a, long long b )
{
	long long result = a * b / gcd(a,b);
	
	return result;
}
int main()
{
	long long A,B,C,D;
	cin>>A>>B>>C>>D;
	long long cdlcm = lcm(C,D);
	//cout<<cdlcm<<endl;
	A--;
	long long cntA = (A / C) + (A / D) - (A / cdlcm);
	long long cntB = (B / C) + (B / D) - (B / cdlcm);
	//cout<<cntA<<endl<<cntB<<endl;
	cout<<B-A - (cntB-cntA)<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  string ans;
  if(x < 1200) ans = "ABC";
  else ans = "ARC";

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


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int ans = a * n < b ? a * n : b;
  cout << ans << endl;
  return 0;
}


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

struct node_t {
	int id;
	int parent;
	int depth;
	const char *kind;
	int degree;
	int *childs;
};
typedef struct node_t Node;

void calc_depth(Node *data, int i) {
	int j, idx;

	for (j = 0; j < data[i].degree; j++) {
		idx = data[i].childs[j];
		data[idx].depth += 1;
		calc_depth(data, idx);
	}
}

void print_node(Node *p) {
	int i;
	const char *fmt = "%d";

	printf(
		"node %d: parent = %d, depth = %d, %s, [",
		p->id, p->parent, p->depth, p->kind);

	for (i = 0; i < p->degree; i++) {
		printf(fmt, p->childs[i]);
		fmt = ", %d";
	}
	puts("]");
}

int main(void) {
	Node *data, *p;
	int n, id, degree, i, j;

	scanf("%d", &n);
	data = malloc(sizeof(Node)*n);
	for (i = 0; i < n; i++) {
		data[i].parent = -1;
		data[i].depth = 0;
	}

	for (i = 0; i < n; i++) {
		scanf("%d %d", &id, &degree);
		p = &data[id];
		p->id = id;
		p->degree = degree;
		p->kind = degree ? "internal node" : "leaf";
		p->childs = malloc(sizeof(int)*degree);
		for (j = 0; j < degree; j++) {
			scanf("%d", p->childs+j);
			data[p->childs[j]].parent = id;
		}
	}

	for (i = 0; i < n; i++) {
		calc_depth(data, i);
	}

	for (i = 0; i < n; i++) {
		if (data[i].depth == 0) {
			data[i].kind = "root";
		}
		print_node(data+i);
	}
	return 0;
}

Measured memory_bytes: 8036
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
int history[100000];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll n, x, m;
	cin >> n >> x >> m;
	ll a = x, sum = x;
	history[x] = 1;
	ll loop_start, loop_end = -1;
	ll loop_start_value;
	for (int i = 2; i <= n; i++) {
		a = a * a % m;
		/* cout << i << ':' << a << '\n'; */
		if (history[a]) {
			loop_start = history[a];
			loop_end = i;
			loop_start_value = a;
			break;
		} else {
			history[a] = i;
		}
		sum += a;
	}
	if (loop_end == -1) {
		cout << sum << '\n';
		return 0;
	}
	ll ntimes = (n - loop_start + 1) / (loop_end - loop_start);
	ll rest = (n - loop_start + 1) % (loop_end - loop_start);
	/* cout << loop_start << ' ' << loop_end << ' ' << rest << ' ' << ntimes << '\n'; */
	ll partialsum = (loop_start > 1 ? x : 0);
	a = x;
	for (int i = 2; i < loop_start; i++) {
		a = a * a % m;
		partialsum += a;
	}
	/* cout << sum << ' ' << partialsum << ' ' << sum - partialsum << '\n'; */
	ll totalsum = (sum - partialsum) * ntimes + partialsum;
	a = loop_start_value;
	ll anothersum = loop_start_value;
	for (int i = 2; i <= rest; i++) {
		a = a * a % m;
		anothersum += a;
	}
	if (rest) {
		totalsum += anothersum;
	}

	cout << totalsum << '\n';
	return 0;
}


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

int dp[223456][3];
bool used[223445][3];
long long n, a[3123123], b[312312], c[312312];
vector <int> g[3123123];
int tin[3123123], tout[3123123];
int timer;
int q;
string s, t;
vector <int> v[30];

void dfs(int u, int p = 0) {
	tin[u] = ++timer;
	for(int i = 0; i < g[u].size(); i++) {
		int to = g[u][i];
		if(to == p) continue;
		dfs(to, u);

	}
	tout[u] = timer;
}
int m, d;
int main() {
    ios_base::sync_with_stdio(0);
    int ans = 0;
    cin >> m >> d;
    for(int i = 1; i <= m; i++) {
    for(int j = 22; j <= d; j++) {
    	if((j % 10) * (j / 10) == i && j % 10 >= 2 && j / 10 >= 2) ans++;
    }
    }
    cout << ans;
}



Measured memory_bytes: 76032
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		if(x - r < 0)
			System.out.println("No");
		else if(x + r > W)
			System.out.println("No");
		else if(y - r < 0)
			System.out.println("No");
		else if(y + r > H)
			System.out.println("No");
		else
			System.out.println("Yes");
	}
}
		


Measured memory_bytes: 26316
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
char in[5];
int main(){
	scanf("%s",in);
	int ret=7;
	if(in[0]=='S'&&in[1]=='A')ret=1;
	else if(in[0]=='F')ret=2;
	else if(in[0]=='T'&&in[1]=='H')ret=3;
	else if(in[0]=='W')ret=4;
	else if(in[0]=='T')ret=5;
	else if(in[0]=='M')ret=6;
		printf("%d\n",ret);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;

int f(int a) {
	int cnt = 0;
	while (a % 2 == 0) {
		a /= 2; cnt++;
	}
	return cnt;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	VE a(n); rep(i, n)cin >> a[i];
	rep(i, n)a[i] /= 2;
	int tmp = f(a[0]);
	rep(i, n) {
		if (tmp != f(a[i])) {
			cout << 0 << endl; return 0;
		}
		a[i] /= (1 << tmp);
	}
	m /= (1 << tmp);
	int l = 1;
	rep(i, n) {
		l = lcm(l, a[i]); if (l > m) { cout << 0 << endl; return 0; }
	}
	m /= l;
	cout << (m + 1) / 2 << endl;
	return 0;
}

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef std::pair<int, int> P;

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i - 1);
            if (i * i != n) {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main() {
    string S;
    cin >> S;
    bool a, b;
    a = b = false;
    rep(i, S.length()) {
        if (S[i] == 'A') {
            a = true;
        }
        if (S[i] == 'B') {
            b = true;
        }
    }
    if (a && b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int cnt=0;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len/2;i++){
        if(s[i]!=s[len-1-i]){
            cnt+=1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  bool hantei=false;
  for(int i=1;i<=100;i++){
    if(a*i%b==c){
      hantei=true;
      break;
    }
  }
  if(hantei){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    int cnt = 0;
    rep(i, 3) {
        if (S[i] == T[i]) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=998244353;
const int inf=1e9+7;
const double eps=1e-8;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
//const double pi=acos(-1);
 
ll dp[2030][2030];

int main()
{
    TB
	int n;
	cin>>n;
	fdd(3,n+1){
		dp[1][i]=1;
	}
	fdd(2,n/3+1){
		ll ans=0;
		for(int j=i*3;j<=n;j++){
			ans+=dp[i-1][j-3];
			ans%=inf;
			dp[i][j]=ans;
		}
	}
	ll sum=0;
	fdd(1,2001){
		sum+=dp[i][n];
		sum%=inf;
	}
	cout<<sum<<'\n';
	return 0;
}

Measured memory_bytes: 11204
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var N, A, B, C int
var takes = make([]int, 0)

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func dfs(depth, a, b, c int) int {
	if depth == N {
		if a > 0 && b > 0 && c > 0 {
			return abs(A-a) + abs(B-b) + abs(C-c) - 30
		}
		return math.MaxInt32 - 10
	}

	ret := make([]int, 4)
	ret[0] = dfs(depth+1, a, b, c)
	ret[1] = dfs(depth+1, a+takes[depth], b, c) + 10
	ret[2] = dfs(depth+1, a, b+takes[depth], c) + 10
	ret[3] = dfs(depth+1, a, b, c+takes[depth]) + 10

	// sort.Slice(ret, func(i, j int) bool { return ret[i] < ret[j] })
	sort.Ints(ret)

	return ret[0]
}

func main() {
	line := nextLine()
	parts := strings.Split(line, " ")
	N, _ = strconv.Atoi(parts[0])
	A, _ = strconv.Atoi(parts[1])
	B, _ = strconv.Atoi(parts[2])
	C, _ = strconv.Atoi(parts[3])

	for i := 0; i < int(N); i++ {
		line := nextLine()
		take, _ := strconv.Atoi(line)
		takes = append(takes, take)
	}

	fmt.Println(dfs(0, 0, 0, 0))
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    std::string a, b, c;
    std::cin>>a>>b>>c;

    std::string ans = "NO";
    if(a[a.size() -1] == b[0] && b[b.size() - 1] == c[0]){
        ans = "YES";
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
S = []
for i in range(h):
    S.append(input())


def ans():
    for i in range(h):
        for j in range(w):
            if (S[i][j] == '#')\
                    and (i == 0 or S[i-1][j] == '.')\
                    and (i+1 == h or S[i+1][j] == '.')\
                    and (j == 0 or S[i][j-1] == '.')\
                    and (j+1 == w or S[i][j+1] == '.'):
                return 'No'
    return 'Yes'


print(ans())


Measured memory_bytes: 3064
defmodule Main do
    def main do
        n = IO.read(:line)
        |> String.trim()
        |> String.to_integer()

        ans = 1..n
        |> Enum.map(fn x ->
            cond do
                rem(x, 3) == 0 -> 0
                rem(x, 5) == 0 -> 0
                true -> x
            end
        end)
        |> Enum.sum

        IO.puts ans
    end
end


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

namespace AtCoder_Project_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var hw = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int h = hw[0], w = hw[1];

            var s = new char[h][];

            bool isThereSharp = false;
            for (int i = 0; i < h; i++)
            {
                s[i] = new char[w];
                var l = Console.ReadLine();
                for (int j = 0; j < w; j++)
                {
                    if (l[j] == '.')
                    {
                        s[i][j] = l[j];
                    }
                    else
                    {
                        s[i][j] = l[j];
                        isThereSharp = true;
                    }
                }
            }

            if (!isThereSharp)
            {
                Console.WriteLine("Yes");
                return;
            }


            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (s[i][j] == '#')
                    {
                        bool isAdjacentSharp = false;
                        for (int a = -1; a <= 1; a += 2)
                        {
                            if (i + a < 0 || i + a >= h) continue;
                            if (s[i + a][j] == '#')
                            {
                                isAdjacentSharp = true;
                            }
                        }
                        for (int a = -1; a <= 1; a += 2)
                        {
                            if (j + a < 0 || j + a >= w) continue;
                            if (s[i][j + a] == '#')
                            {
                                isAdjacentSharp = true;
                            }
                        }

                        if (!isAdjacentSharp)
                        {
                            Console.WriteLine("No");
                            return;
                        }
                    }
                }
            }

            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bn begin()
#define en end()
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007
#define pi 3.141592653589
#define INF 1000000000000
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie   
    int n, m, x ;
    cin >> n >> m >> x ;
    vi a(n), b(m) ;
    rep(i, 0, n) cin >> a[i] ;
    rep(i, 0, m) cin >> b[i] ;
    int sum=0,count=0,temp=0,i=0,j=0;        
    while(i<n && sum+a[i]<=x) {  
        sum+=a[i];
        i++;
    }
    count=i;        
    while(j<m && i>=0) {       
        sum+=b[j];             
        j++;
        while(sum>x && i>0){
            i--;
            sum-=a[i];
        }
        if(sum<=x && i+j>count)
            count=i+j;
    }
    cout<<count<<endl;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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


Measured memory_bytes: 6364
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

int a[3005], b[3005];

string best[3005];

string dp[3005];

int pref[6005];

int id[6005];

char s[6005];

int n;

string calc(int l, int r) {
    static string ret;
    ret.clear();

    int cl = id[l];
    int cr = id[r + 1] - 1;

    if (s[l] == 'a') {
        int p = -1;
        
        for (int i = cl; i <= cr; ++i) {
            if (a[i] > p) {
                p = b[i];
                ret += "ab";
            }
        }
    }
    else {
        string cur;

        for (int i = cl; i <= cr; ++i) {
            cur.clear();    

            for (int j = b[i]; j <= r; ++j) {
                if (id[j] >= i && id[j] <= cr) {
                    cur += s[j];
                }
            }

            ret = max(ret, cur);
        }
    }

    return ret;
}

void solve() {                   
    scanf("%d", &n);
    scanf("%s", s + 1);
    id[n * 2 + 1] = n + 1;

    for (int i = 1, szA = 0, szB = 0; i <= n * 2; ++i) {
        pref[i] = pref[i - 1];

        if (s[i] == 'a') {
            a[++szA] = i;
            id[i] = szA;
            ++pref[i];
        }    
        else {
            b[++szB] = i;
            id[i] = szB;
            --pref[i];
        }
    }

    vector<pair<int, int>> vv;

    for (int l = 1, r; l <= (n << 1); l = r) {
        int bal = 0;
        r = l + 1;
                  
        s[l] == 'a' ? ++bal : --bal;

        while (r <= (n << 1) && bal != 0) {
            s[r] == 'a' ? ++bal : --bal;
            ++r;
        }

        vv.pb(mp(l, r - 1));
    }

    for (int i = 0; i < vv.size(); ++i) {
        best[i] = calc(vv[i].fi, vv[i].se);
    }

    for (int i = 0; i < vv.size(); ++i) {
        dp[i] = best[i];

        for (int j = 0; j < i; ++j) {
            dp[i] = max(dp[i], dp[j] + best[i]);
        }
    }

    cout << dp[vv.size() - 1];
}

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 14336
import itertools
N = int(input())
S_num = [0] * 5
answer = 0
for _ in range(N):
    S = input()
    if S[0] == 'M':
        S_num[0] += 1
    elif S[0] == 'A':
        S_num[1] += 1
    elif S[0] == 'R':
        S_num[2] += 1
    elif S[0] == 'C':
        S_num[3] += 1
    elif S[0] == 'H':
        S_num[4] += 1

for v in itertools.combinations(S_num, 3):
    answer += v[0] * v[1] * v[2]
print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))	
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)	
#define FloorN(x, n)	((x)-(x)%(n))			
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long			ll;
typedef unsigned long long	ull;
typedef pair<ll, ll>		P;
typedef vector<ll>			VLL;
typedef vector<VLL>			VVLL;
typedef vector<VVLL>		VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// 枝定義
struct Edge
{
	int	to;
	ll	dist;
	Edge(){}
	Edge(int to, ll dist) : to(to), dist(dist){}
};

// グラフ定義(二次元配列)
template <class E>
using Graph = vector<vector<E>>;

// ダイクストラ
template<class D, D infVal>
class Dijkstra
{
public:
	// res[i] = sからiまでの最短距離
	vector<D> res;

	// 復元パス
	//	vector<int> pathList;

private:
	vector<int> pathRev;

public:
	template<class E>
	Dijkstra(const Graph<E> &G, int startFrom)
	{
		int V = (int)G.size();
		res = vector<D>(V, infVal);
		pathRev.resize(V, -1);

		using P = pair<D, int>;
		priority_queue<P, vector<P>, greater<P>> que;
		que.push(P(0, startFrom));
		res[startFrom] = 0;

		while (!que.empty()) {
			P p = que.top(); que.pop();
			int egdeFrom = p.second;

			// 違う最短距離がキューにあるのでスキップ
			if (res[egdeFrom] < p.first) {
				continue;
			}

			// 最短距離を更新
			for (E edge : G[egdeFrom]) {
				D nextDist = p.first + edge.dist;
				if (nextDist < res[edge.to]) {
					res[edge.to] = nextDist;
					pathRev[edge.to] = egdeFrom;
					que.push(P(nextDist, edge.to));
				}
			}
		}
	}

	// 経路を取得する
	vector<int> getPath(int dstPos)
	{
		vector<int> pathList;

		while (dstPos != -1) {
			pathList.push_back(dstPos);
			dstPos = pathRev[dstPos];
		}
		reverse(pathList.begin(), pathList.end());
		return pathList;
	}
};

int main()
{
	int N;
	cin >> N;
	Graph<Edge>	G(N);
	REP(i, N  - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		G[a].emplace_back(Edge(b, c));
		G[b].emplace_back(Edge(a, c));
	}

	int Q, K;
	cin >> Q >> K;
	vector<ll> x(Q), y(Q), ans(Q);
	REP(i, Q) {
		cin >> x[i] >> y[i];
		x[i]--; y[i]--;
	}

	Dijkstra<ll, (ll)2e18> dijk(G, K - 1);

	REP(i, Q) {
		ans[i] = dijk.res[x[i]] + dijk.res[y[i]];
	}

	REP(i, Q) {
		cout << ans[i] << endl;
	}

	return 0;
}


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

namespace ABC0124A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] H = Console.ReadLine().Split(' ');
            int A = int.Parse(H[0]);
            int B = int.Parse(H[1]);
            int result = 0;

            if(A > B)
            {
                result += A;
                A -= 1;
            }
            else
            {
                result += B;
                B -= 1;
            }

            if (A > B)
            {
                result += A;
                A -= 1;
            }
            else
            {
                result += B;
                B -= 1;
            }
            Console.WriteLine(result);


        }
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main {
    public static void main(String[] args) {
        for(int i = 1; i <= 9; ++i) {
            for(int j = 1; j <= 9; ++j) {
                System.out.println(i + "x" + j + "=" + i*j);
            }
        }
    }
}

Measured memory_bytes: 15016
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 4000000000000000000LL //4e18

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    int xmin = INF;
    int ymin = INF;
    int xmax = -INF;
    int ymax = -INF;
    cin >> N >> K;
    vector<int> x(N);
    vector<int> y(N);
    REP(i,N){ 
        cin >> x[i] >> y[i];
        xmin = min(xmin,x[i]);
        ymin = min(ymin,y[i]);
        xmax = max(xmax,x[i]);
        ymax = max(ymax,y[i]);
    }
    /////////////

    /////////////
    ll ans = LLINF;
    REP(i,N){
        REP(j,N){
            REP(k,N){
                REP(l,N){
                    int tx1 = max(x[i],x[j]);
                    int tx2 = min(x[i],x[j]);
                    int ty1 = max(y[k],y[l]);
                    int ty2 = min(y[k],y[l]);
                    int count = 0;
                    REP(i,N){
                        if(x[i]<=tx1&&x[i]>=tx2&&y[i]<=ty1&&y[i]>=ty2) count++;
                    }
                    if(count>=K){
                        ans = min(ans, ((ll)tx1-(ll)tx2)*((ll)ty1-(ll)ty2));
                    }
                }
            }
            
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
'use strict';
const p = s => console.log(s);
// let a,b,c,d;
// [a,b,c,d] = input[0].trim().split(" ").map(i => parseInt(i));

function main(input) {
  let N = input[0].trim().split("");

  let num = N.pop();

  if(num == 3) {
    p('bon');
  } else if (num == 0 || num == 1 || num == 6 || num == 8){
    p('pon');
  } else {
    p('hon');
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


Measured memory_bytes: 30004
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 25 18:21:57 2018
ABC107C
@author: maezawa
"""

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for l in range(n-k+1):
    r = l+k-1
    ans1 = abs(x[l]) + abs(x[r]-x[l])
    ans2 = abs(x[r]) + abs(x[r]-x[l])
    ans0 = min(ans1, ans2)
    if ans > ans0:
        ans = ans0
print(ans)



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

#define ll long long
#define mk make_pair
#define pb push_back


using namespace std;


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

   string S; cin >> S;
   if(S == "Sunny"){
      cout << "Cloudy";   
   }else if(S == "Cloudy"){
      cout << "Rainy";
   }else{
      cout << "Sunny";
   }
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
		long long sum[5];sum[0]=2*a-1;sum[1]=a+b;sum[2]=2*b-1;
		sort(sum,sum+3);
		cout<<sum[2]<<endl;
	}
	return 0;
}


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

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

#define loop(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;
struct __{__(){ios_base::Init i;ios_base::sync_with_stdio(0);cin.tie(0);}}__;

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

int main() {
	int n = nxt(), k=nxt();
	vector<long long> a(n);
	for (int i = 0; i< n; ++i){
		a[i] = nxt();
	}

	for (int i = k; i< n; ++i){
		if (a[i] > a[i-k]){
			cout << "Yes\n";
		} else{
			cout << "No\n";
		}
	}

	return 0;
}

Measured memory_bytes: 4860
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int a,b,sum=0,x=0,y=0;
    string s;
    cin>>a>>b>>s;
    int n=s.size();
    if(s[a]=='-')
        sum++;
    if(n==a+b+1)
        sum++;
    for(int i=0;i<a;i++){
        if(s[i]>='0'&&s[i]<='9')
            x++;
    }
    for(int i=a+1;i<=a+b;i++){
        if(s[i]>='0'&&s[i]<='9')
            y++;
    }
    if(x==a&&y==b)
        sum++;
    if(sum==3)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

using Lint=long long;
const int INF=1e9;

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

   vector<vector<int>> dp(1<<N,vector<int>(N,INF));
   for(int i=0;i<N;i++) dp[1<<i][i]=0;
   for(int S=1;S<(1<<N);S++) for(int i=0;i<N;i++) if(dp[S][i]<INF){
      int cnt=__builtin_popcount(S);
      int prv=(i%2==(cnt-1)%2? a[i]:b[i]);
      int cost=0;
      for(int j=N-1;j>=0;j--){
         if(S>>j&1) cost++;
         else {
            int cur=(j%2==cnt%2? a[j]:b[j]);
            if(prv<=cur) dp[S|(1<<j)][j]=min(dp[S|(1<<j)][j],dp[S][i]+cost);
         }
      }
   }
   int ans=INF;
   for(int i=0;i<N;i++) ans=min(ans,dp[(1<<N)-1][i]);
   cout<<(ans==INF? -1:ans)<<endl;
   return 0;
}


Measured memory_bytes: 27008
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>

#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

typedef long long int64;

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
    int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(n, -1));
	for (int i = 0; i < n; ++i) {
	    int m;
		cin >> m;
		for (int j = 0; j < m; ++j) {
		    int x, y;
			cin >> x >> y;
			--x;
			a[i][x] = y;
		}
	}
	int ans = 0;
	for (int i = 0; i < (1 << n); ++i) {
	    int sum = 0;
		vector<bool> honest(n, false);
		for (int j = 0; j < n; ++j) {
		   if (i & (1 << j)) {
		       honest[j] = true;
			   ++sum;
		   }
		}
		bool ok = true;
		for (int j = 0; j < n; ++j) {
		    for (int k = 0; k < n; ++k) {
				if (a[j][k] == -1) continue;
				if (!honest[j]) continue;
				if (a[j][k] == 1 && !honest[k]) {
				    ok = false;
				}
				if (a[j][k] == 0 && honest[k]) {
				    ok = false;
				}
			}
		}
		if (ok) {
			ans = max(ans, sum);
		}
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; -i)
#define INF (1 << 30)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int par[100001], Rank[100001];

//n????´???§?????????
void init(int n) {
	rep(i, n) {
		par[i] = i;
		Rank[i] = 0;
	}
}

//??¨??????????±???????
int find(int x) {
	if(par[x] == x) return x;
	else return par[x] = find(par[x]);
}

//x??¨y????±??????????????????????
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(Rank[x] < Rank[y]) par[x] = y;
	else par[y] = x;
	if(Rank[x] == Rank[y]) ++Rank[x];
}

//x??¨y???????????????????±????????????????
bool same(int x, int y) {
	return find(x) == find(y);
}

struct edge {int u, v, cost; };
int N, M;
edge es[100000];

bool comp(const edge &a, const edge &b){
	return a.cost < b.cost;
}

int kruskal() {
	sort(es, es + M, comp);
	init(N);
	int res = 0;
	rep(i, M) {
		edge &e = es[i];
		if(!same(e.u, e.v)) {
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}

int main() {
    while(scanf("%d", &N), N) {
    	scanf("%d", &M);
    	rep(i, M) {
    		int a, b, c;
    		scanf("%d,%d,%d", &a, &b, &c);
    		c = c / 100 - 1;
    		edge tmp = {a, b, c};
    		es[i] = tmp;
    	}
        printf("%d\n", kruskal());
    }
	return 0;
}

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

P=sum(X)/N
if P%1 < 0.5:
    P=P//1
else:
    P=P//1+1
L=0
for i in range(N):
    L += X[i]**2
print(int(L-2*P*sum(X)+N*P**2))

Measured memory_bytes: 3064
# ABC 084
# 基本
import math
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def getIntFromRows(n): return [int(input()) for i in range(n)]
def getIntMat(n):
    mat = []
    for i in range(n): mat.append(getIntList())
    return mat

def zeros(n): return [0 for i in range(n)]
def zeros2(n, m): return [[0 for i in range(m)] for j in range(n)]
N1097 = 10**9 + 7 
debug = True
def db(x): 
    if debug: print(x)

debug = False
n = getInt()
c, s, f = zeros(n-1), zeros(n-1), zeros(n-1)
for i in range(n-1):
    c[i], s[i], f[i] = getIntList()
db((c,s,f))
for i in range(n-1):
    arriv = 0
    dept = s[i]
    for j in range(i+1, n-1):
        arriv = dept + c[j-1]
        dept = (max(arriv, s[j])+f[j]-1) // f[j] * f[j]
        db((arriv, dept))
    arriv = dept + c[n-2]
    print(arriv)
print(0)



Measured memory_bytes: 3188
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

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

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

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int N;
    cin >> N;
    if(N % 2 == 0) cout << N << endl;
    else cout << 2*N << endl;
    return 0;
}


Measured memory_bytes: 3592
n,q=map(int,input().split())
s=str(input())
ans=[]
for i in range(n):
    if i==0:
        ans.append(0)
    else:
        if (s[i-1]=='A') and (s[i]=='C'):
            ans.append(ans[i-1]+1)
        else:
            ans.append(ans[i-1])
for i in range(q):
    l,r=map(int,input().split())
    l=l-1
    r=r-1
    print(ans[r]-ans[l])

Measured memory_bytes: 6180