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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define mp              make_pair
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

#define PI              acos(-1.0)

//inline int setBit(int n,int pos) { return n = n | (1 << pos); }
//inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
//inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
//inline int countBit(int n) { return __builtin_popcount(n); }


//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

/******************************************************************************************/

const int MAX = 100010;
const ll INF = 20000000000000000LL;
//const double inf = 1.0/0.0;
//const int MOD = 1000000007;

vector <int> ed[MAX];
vector <ll> co[2][MAX];
ll dis[2][MAX];
bool vis[2][MAX];

struct node{
    ll city,cost;
};

bool operator < (node a,node b){return a.cost>b.cost;}

void dijkstra(int s,int n,int id) {
    int i,u,v;
    ll c;
    node a,b;
    for(i=1;i<=n;i++) dis[id][i] = INF;
    dis[id][s] = 0;
    a = {s,0};
    priority_queue <node> q;
    q.push(a);
    while(!q.empty()){
        a = q.top();
        q.pop();
        u = a.city;
        if(!vis[id][u]){
            vis[id][u] = true;
            for(i=0;i<ed[u].size();i++){
                v = ed[u][i];
                c = co[id][u][i];
                if(dis[id][v]>dis[id][u]+c){
                    dis[id][v] = dis[id][u]+c;
                    b = {v,dis[id][v]};
                    q.push(b);
                }
            }
        }
    }
}

ll ans[MAX];

int main() {
//    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    int n,m,s,t,u,v;
    ll a,b;
    sii(n,m);
    sii(s,t);

    for(int i=1;i<=m;i++) {
        sii(u,v);
        sll(a,b);

        ed[u].pb(v);
        ed[v].pb(u);

        co[0][u].pb(a);
        co[0][v].pb(a);

        co[1][u].pb(b);
        co[1][v].pb(b);
    }

    dijkstra(s,n,0);
    dijkstra(t,n,1);

    ll x;
    ans[n+1] = 0;


    ll cur = 1e15;

    for(int i=n;i>=1;i--) {
        x = dis[0][i] + dis[1][i];
        x = cur - x;
        ans[i] = max(ans[i+1],x);
    }

    for(int i=1;i<=n;i++) {
        printf("%lld\n",ans[i]);
    }


    return 0;
}




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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
struct RUQ //calculateはminimum
{
    int n;
    const T ex = 1ll << 60; //初期値
    vector<T> dat, lazy; //tree本体
    RUQ(vector<T> v){
        int x = 1;
        int i;
        n = v.size();
        while(x < n) x <<= 1;
        n = x; 
        dat.resize(2*n-1, ex);
        lazy.resize(2*n-1, ex);
        for(i = 0;i < v.size();++i){
            dat.at(i + n - 1) = v.at(i);
        }
        for(i = n-2;i >= 0;--i){
            dat.at(i) = calculate(dat.at(2*i+1), dat.at(2*i+2));
        }
    }
    
    T calculate(T a, T b){
        return min(a, b);
    }
    
    void eval(int now){
        if(lazy.at(now) == ex) return;
        if(now < n - 1){
            lazy.at(2*now + 1) = lazy.at(now);
            lazy.at(2*now + 2) = lazy.at(now);
        }
        dat.at(now) = lazy.at(now);
        lazy.at(now) = ex;
    }
    
    void update(int a, int b, T x, int now, int l, int r){
        eval(now);
        if(a <= l && r<= b){
            lazy.at(now) = x; //上から書き換える。
            eval(now);
        }else if(a < r && l < b){
            update(a, b, x, 2*now + 1, l, (l + r)/2);
            update(a, b, x, 2*now + 2, (l + r)/2, r);
            dat.at(now) = calculate(dat.at(2*now + 1), dat.at(2*now + 2));
        }
    }
    void update(int a, int b, T x){update(a, b, x, 0, 0, n);}
    
    T query(int a, int b){return query_sub(a, b, 0, 0, n);}
    T query_sub(int a, int b, int now, int l, int r){
        eval(now);
        if(r <= a || b <= l) return ex;
        else if(a <= l && r <= b) return dat.at(now);
        else{
            T vl = query_sub(a, b, 2*now + 1, l, (l + r)/2);
            T vr = query_sub(a, b, 2*now + 2, (l + r)/2, r);
            return calculate(vl, vr);
        }
    }
};

int main()
{
    ll i,j;
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n, (1ll << 31) - 1);
    RUQ<ll> ruq(a);
    for(i = 0;i < q;++i){
        ll com;
        cin >> com;
        if(com == 0){
            ll s, t, x;
            cin >> s >> t >> x;
            ruq.update(s, t+1, x);
        }else{
            ll s,t;
            cin >> s >> t;
            cout << ruq.query(s, t+1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 8432
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let n: u32 = read();
    for x in 1..n + 1 {
        if ((x as f64) * 1.08) as u32 == n {
            println!("{}", x);
            return;
        }
    }
    println!(":(");
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
string s;
cin>>s;
int n=s.length();
ol(s.substr(0,n-8));

return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define rep(i,n) for(int i=1;i<=(n);i++)
#define max(a,b) (((a)>(b))?(a):(b))

int dat[5005][2];
short int dp[5005][5005];
int A,B;
int main(void){
	scanf("%d%d",&A,&B);
	rep(i,A)scanf("%d",&(dat[i][0]));
	rep(i,B)scanf("%d",&(dat[i][1]));
	rep(i,A){
		rep(j,B){
			dp[i][j]=max(dp[i-1][j],((dat[i][0]==dat[j][1])?(dp[i-1][j-1]+1):0));
			//printf("%d  %d  %d\n",i,j,dp[i][j]);
		}
	}
	int ans=0;
	rep(i,B)ans=max(ans,dp[A][i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 49944
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	SPEED
	int n, temp;
	cin >> n;
	std::map<int, int> mp;

	for (int i = 0; i < n; ++i)
	{
		cin >> temp;
		if (mp.count(temp))
		{
			cout << "NO";
			return 0;
		}
		else
		{
			mp[temp] = 1;
		}
	}

	cout << "YES";
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (unique(s.begin(), s.end()) == s.end()) {
    cout << "yes\n";
  } else {
    cout << "no\n";
  }

  return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
vector<int> g[MAX_N], hate[MAX_N];
int ans[MAX_N];
bool vis[MAX_N];


void dfs(int cur, vector<int>& out) {
  if (vis[cur]) return;
  vis[cur] = true;
  out.push_back(cur);
  for (int nxt : g[cur]) if (!vis[nxt]) {
    dfs(nxt, out);
  }
}

int main2() {
  CLR(ans, 0);
  CLR(vis, 0);
  REP(i, MAX_N) g[i].clear();
  REP(i, MAX_N) hate[i].clear();
  int N = nextInt();
  int M = nextInt();
  int K = nextInt();

  REP(i, M) {
    int a = nextInt() - 1;
    int b = nextInt() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  REP(i, K) {
    int a = nextInt() - 1;
    int b = nextInt() - 1;
    hate[a].push_back(b);
    hate[b].push_back(a);
  }

  REP(i, N) if (!vis[i]) {
    vector<int> out;
    dfs(i, out);
    set<int> st(ALL(out));
    for (int x : out) {
      int val = out.size();
      val--;
      val -= g[x].size();
      for (int y : hate[x]) {
        if (st.count(y)) val--;
      }
      ans[x] = val;
    }
  }

  REP(i, N) {
    if (i > 0) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 17648
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
int n,m,a[1005],b[1005];
bool check()
{
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
        if(a[i]==a[j]) return false;
    for(int i=1;i<=m;i++)
        for(int j=i+1;j<=m;j++)
        if(b[i]==b[j]) return false;
    return true;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=m;i++) scanf("%d",&b[i]);
    sort(a+1,a+1+n);
    sort(b+1,b+1+m);
    if(!check()) printf("0\n");
    else
    {
        a[n+1]=n+1;
        b[m+1]=m+1;
        int x=0,y=0;
        ll ans=1;
        for(int i=1;i<=n*m;i++)
        {
            while(x<=n&&a[x]<i) x++;
            while(y<=m&&b[y]<i) y++;
            ll d=0;
            if(a[x]==i&&b[y]==i) d=1;//如果这个数被限制在第x行y列，则只有一种方式
            else if(a[x]==i) d=m-y+1;//如果这个数被限制在第x行，只有列上的方案数
            else if(b[y]==i) d=n-x+1;//如果这个数被限制在第y行，只有行上的方案数
            else d=(m-y+1)*(n-x+1)-(n*m-i);//这个数在x行和y列以上都可以使用
            ans=ans*d%mod;
        }
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 256
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

L = []
R = []
tl = A[0]
tr = A[-1]
for i in range(N):
  tl = gcd(tl, A[i])
  L.append(tl)
  tr = gcd(tr, A[N-1-i])
  R.append(tr)
mx = 1
R.reverse()
for i in range(N):
  tl = L[i-1] if i else R[i+1]
  tr = R[i+1] if i+1 < N else L[i-1]
  mx = max(mx, gcd(tl, tr))
print(mx)  

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

#define N 25

typedef struct{
  int id;
  int right;
  int left;
  int parent;
  int sibling;
  int degree;
  int depth;
  int height;

}NODE;

void tmpa(NODE *, int);
void parent(NODE *, int);
void depth(NODE *, int);
int height(NODE *, int);

int main(){

  int i, j;
  int n, set;
  NODE a[N];
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d%d%d", &a[i].id, &a[i].left, &a[i].right);
    
  }
  
  tmpa(a, n);
  parent(a, n);

  for(i = 0; i < n; i++){
    if(a[i].parent == -1){
      a[i].depth = 0;
      set = i;
    }
  }

  depth(a, set);

  for(i = 0; i < n; i++){
    a[i].height = height(a, a[i].id);
  }  

  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, sibling = %d, ", a[i].id, a[i].parent, a[i].sibling);
    printf("degree = %d, depth = %d, height = %d, ", a[i].degree, a[i].depth, a[i].height);
    if(a[i].parent == -1) printf("root\n");
    else if(a[i].degree > 0) printf("internal node\n");
    else printf("leaf\n");

  }  

  return 0;
}

void tmpa(NODE *a, int n){

  int i, j;
  NODE tmp;
  
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(a[j].id != j){
	tmp = a[a[j].id];
	a[a[j].id] = a[j];
	a[j] = tmp;
      }
    
    }
  }  

}

void parent(NODE *a, int n){

  int i;

  for(i = 0; i < n; i++){
    a[i].parent = -1;
    a[i].sibling = -1;
    a[i].degree = 0;
    if(a[i].right != -1) a[i].degree++;
    if(a[i].left != -1) a[i].degree++;
  }

  for(i = 0; i < n; i++){
    
    if(a[i].right != -1){
      a[a[i].right].parent = a[i].id;
      a[a[i].right].sibling = a[i].left;

    }

    if(a[i].left != -1){
      a[a[i].left].parent = a[i].id;
      a[a[i].left].sibling = a[i].right;

    }

  }

}

void depth(NODE *a, int n){

  if(a[n].right != -1){
    a[a[n].right].depth = a[n].depth + 1;
    depth(a, a[n].right);
    
  }
   
  if(a[n].left != -1){
    a[a[n].left].depth = a[n].depth + 1;
    depth(a, a[n].left);
    
  }
 
}

int height(NODE *a, int n){

  int r = 1, l = 1;

  if(a[n].right == -1 && a[n].left == -1) return 0;

  if(a[n].right != -1){
    r += height(a, a[n].right);
  }
  
  if(a[n].left != -1){
    l += height(a, a[n].left);
  }
  
  if(r >= l) return r;
  else return l;

}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 N;
    cin >> N;
    Vec<u64> A(N);
    for (u32 i = 0; i < N; i++) cin >> A[i];
    sort(ALL(A));
    string res = "YES";
    for (u32 i = 1; i < N; i++) {
        if (A[i - 1] == A[i]) res = "NO";
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int h, w;
struct lamp{
    char c;
    short int up, down, left, right;
    int s(){return up + down + left + right - 3;}
};

int main()
{
    int ans = 0;
    char t[2000];
    cin >> h >> w;
    vector<vector<lamp> > s(h, vector<lamp> (w));
    for(int i = 0; i < h; i++){
        scanf("%s", t);
        for(int j = 0; j < w; j++){
            s[i][j].c = t[j];
        }
    }

    for(int i = 0; i < h; i++){
        short int kl = 0, kr = 0;
        for(int j = 0; j < w; j++){
            if(s[i][j].c == '#') kr  = 0;
            else                 kr += 1;
            if(s[i][w-1-j].c == '#') kl  = 0;
            else                     kl += 1;
            s[i][j].right = kr;
            s[i][w-1-j].left  = kl;
        }
    }
    for(int j = 0; j < w; j++){
        short int ku = 0, kd = 0;
        for(int i = 0; i < h; i++){
            if(s[i][j].c == '#') kd = 0;
            else                 kd += 1;
            if(s[h-1-i][j].c == '#') ku  = 0;
            else                     ku += 1;
            s[i][j].down = kd;
            s[h-1-i][j].up  = ku;
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ans = (ans < s[i][j].s() ? s[i][j].s() : ans);
        }
    }
    cout << ans << endl;
    return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            double sum = 0;
            int[] a = new int[100];
            n = int.Parse(Console.ReadLine());
            a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            for(int i = 0; i < n; i++)
            {
                sum += a[i];
            }
            sum /= n;
            long sum2 = 0, sum3 = 0;
            for(int i = 0; i < n; i++)
            {
                sum2 += (long)Math.Pow(a[i] - Math.Floor(sum), 2);
                sum3 += (long)Math.Pow(a[i] - Math.Ceiling(sum), 2);
            }
            if (sum3 < sum2) sum2 = sum3;
            Console.WriteLine(sum2);
        }
    }
}


Measured memory_bytes: 13396
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
  	int x, y, z;
  	cin >> x >> y >> z;
  	cout << (x-z)/(y+z) << endl;
	return;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n >> k;
	ll cnt = 0;
	rep(i, n) {
		ll a;
		cin >> a;
		if (a >= k) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

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

using namespace std;

int main() {
  int N, K;
  int cnt[200001] = {};
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    cnt[a - 1]++;
  }
  sort(cnt, cnt + N);
  int ans = 0;
  for (int i = 0; i < N - K; i++) {
    ans += cnt[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

#define int ll

string s;
int n;

signed main(){
    cin>>n;
    int ans=0;
    rep(i,1,n+1)ans+=i;
    cout<<ans<<endl;
    
    
    
    
}

Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    // タイプAとタイプBの物質の混合比がM_a : M_b
    // A の重さが a の時, Bの重さ b は b = (a * M_b) / M_a { (a * M_b) % M_a == 0 } である必要がある.

    // 最初, dp(i)(a)(b) = Inf としておくと, その最小価格が存在しない時には Infである.
    // 条件を満たす全ての dpが Infなら, 作れないということである。
    // i個の薬品を使って, a, b の重さを作る時の 価格は dp(i)(a)(b) で表せるとすると,
    // i番目の薬品を加える時と加えない時の２種類で更新できる。
    // dp(i)(a)(b) = dp(i-1)(a)(b) // 加えない場合
    // dp(i)(a+A(i))(b+B(i)) = dp(i-1)(a)(b) + C(i)
    val INF = Int.MaxValue / 10
    val N, Ma, Mb = sc.nextInt()
    val amax = 10
    val bmax = 10
    val nmax = 40
    val dp = Array.fill(N+1, nmax*amax+1, nmax*bmax+1)(INF)

    dp(0)(0)(0) = 0

    val A, B, C = new Array[Int](N)
    (0 until N) foreach { i =>
      A(i) = sc.nextInt()
      B(i) = sc.nextInt()
      C(i) = sc.nextInt()
    }

    (0 until N) foreach { i =>
      (0 to nmax*amax - A(i)) foreach { a =>
        (0 to nmax*bmax - B(i)) foreach { b =>
          dp(i+1)(a)(b) = Math.min(dp(i+1)(a)(b), dp(i)(a)(b))
          dp(i+1)(a + A(i))(b + B(i)) = Math.min(dp(i+1)(a + A(i))(b + B(i)), dp(i)(a)(b) + C(i))
        }
      }
    }

    var min = INF
    (1 until nmax*amax) foreach { a =>
      (1 until nmax*bmax) foreach { b =>
        if (a * Mb == b * Ma)
          min = Math.min(min, dp(N)(a)(b))
      }
    }

    println(if (min == INF) -1
    else min)
  }
}

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

int main(){
    int N;
    long long m=0,ans=0;
    cin>>N;
    for(int i=0;i<N;i++){
        long long A;
        cin>>A;
        if(A) m+=A;
        else{
            m/=2;
            ans+=m;
            m=0;
        }
    }
    m/=2;
    ans+=m;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import math

a, b, h, m = [int(x) for x in input().split()]

kakudo_a = h * (360.0 / 12) + m * (30.0 / 60)
kakudo_b = m * (360.0 / 60)
kakudo = abs(kakudo_b - kakudo_a)

if kakudo == 0:
        ans = abs(a - b)
elif abs(kakudo) % 180 == 0:
        ans = a + b
else:
        bx = b * math.cos(kakudo*math.pi/180)
        by = b * math.sin(kakudo*math.pi/180)
        ans = math.sqrt((a - bx)** 2 + by ** 2)
        
print(ans)

Measured memory_bytes: 9524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int h, w, n;
char field[1010][1010];
int sx, sy, gx[10], gy[10];
ll ans = 0;

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

int d[1010][1010];

void solve(int k){
	REP(i, h){
		REP(j, w){
			d[i][j] = INF;
		}
	}

	queue<P> que;

	que.push(P(sy, sx));
	d[sy][sx] = 0;

	while (que.size()){
		P p = que.front(); que.pop();

		int y = p.first, x = p.second;

		if (y == gy[k] && x == gx[k])break;

		REP(i, 4){
			int nx = x + dx[i], ny = y + dy[i];
			if (nx >= 0 && nx < w&&ny >= 0 && ny < h){
				if (field[ny][nx] != 'X'&&d[ny][nx] == INF){
					d[ny][nx] = d[y][x] + 1;
					que.push(P(ny, nx));
				}
			}
		}
	}
}

int main(){
	int pos;
	cin >> h >> w >> n;
	REP(i, h){
		REP(j, w){
			cin >> field[i][j];
			if (field[i][j] == 'S'){
				sy = i, sx = j;
			}
			if (field[i][j] >= '1'&&field[i][j] <= '9') {
				pos = field[i][j] - '0';
				gy[pos] = i, gx[pos] = j;
			}
		}
	}
	for (int k = 1; k <= n;k++){
		solve(k);
		ans += d[gy[k]][gx[k]];
		sy = gy[k], sx = gx[k];
	}
	cout << ans << endl;
}

Measured memory_bytes: 6188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string s;
	cin>>s;
	if(s[0]=='9'||s[1]=='9')cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}








Measured memory_bytes: 256
D = [
    (1, 5, 2, 3, 0, 4), # 'U'
    (3, 1, 0, 5, 4, 2), # 'R'
    (4, 0, 2, 3, 5, 1), # 'D'
    (2, 1, 5, 0, 4, 3), # 'L'
]

*L1, = map(int, input().split())
*L2, = map(int, input().split())

p = (0, 0, 0, 1, 1, 2, 2, 3)*3
ok = 0
for k in p:
    if L1 == L2:
        ok = 1
    L2[:] = [L2[e] for e in D[k]]

print("Yes" if ok else "No")


Measured memory_bytes: 5604
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
using namespace std;
using ll = long long;

int main(){
  ll N,X,M;
  cin >> N >> X >> M;
  vector<int> amari(M,0);
  ll test=X%M;
  ll start=-1,finish=-1;
  for(ll i=1;i<=N;i++){
    if(amari[test%M]!=0){
      start=amari[test%M];
      finish=i-1;
      break;
    }
    else{
      amari[test%M]=i;
    }
    test=test*test%M;
  }
  ll ans=0;
  test=X%M;
  if(finish==-1){
    for(ll i=1;i<=N;i++){
      ans+=test;
      test=test*test%M;
    }
    cout << ans << endl;
    return 0;
  }
  test=X%M;
  for(int i=1;i<start;i++){
    test=(test*test)%M;
  }
  ll period=0;
  for(ll i=start;i<=finish;i++){
    period+=test;
    test=test*test%M;
  }
  ll syuki=finish-start+1;
  N=N-(start-1);
  ll kaisuu=N/syuki;
  N=N-syuki*kaisuu;
  ans+=kaisuu*period;
  test=X%M;
  for(ll i=1;i<start;i++){
    ans+=test;
    test=test*test%M;
  }
  test=X%M;
  for(int i=1;i<start;i++){
    test=(test*test)%M;
  }
  for(ll i=1;i<=N;i++){
    ans+=test;
    test=test*test%M;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
yesOrNo :: Int -> Int -> Int -> String
yesOrNo 5 5 7 = "YES"
yesOrNo 5 7 5 = "YES"
yesOrNo 7 5 5 = "YES"
yesOrNo _ _ _ = "NO"

main :: IO ()
main = do
    [a, b, c] <- (map read . words) <$> getLine
    putStrLn $ yesOrNo a b c


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

typedef long long ll;
const int N = 1e5+5 , MOD = 1e9+7;
const ll inf = 1e16;






int main(void){

	ll n;

	set<ll> s;

	cin >> n;

	while(n--){

		ll l;

		cin>>l;

		if(s.find(l)!=s.end()) s.erase(l);
		else s.insert(l);

	}

	cout<<s.size();
   
  	return 0;
}


Measured memory_bytes: 4864
import numpy as np
import math
stdin = open(0)

N,K = map(int,input().split())
A = np.array([int(Ai) for Ai in input().split()])
A = np.sort(A)

maxA = max(np.abs(A))

z = A[A==0]
p = A[A>0]
n = A[A<0]

def check(x):
    ret = 0
    if x >= 0:
        ret += N*len(z)
    ret += np.searchsorted(A,x//p,side='right').sum()
    ret += (N - np.searchsorted(A, -(x // -n))).sum()
#     ret += (N-np.searchsorted(A,np.ceil(x/n))).sum()
    ret -= np.count_nonzero(A*A<=x)
    return ret//2;

ub = maxA*maxA
lb = -ub-1
while ub-lb > 1:
    mid = (ub+lb)>>1
    if check(mid) < K:
        lb = mid
    else:
        ub = mid
print(ub)

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

int yaku(int kazu){
  int c = 0;
  for(int i = 1; i <= kazu; i++){
    if(kazu % i == 0)
      c++;
  }
  return c;
}

int main(){
  int a, b, d;
  cin >> a;
  
  for(int j = 1; j <= a; j+=2){
    b = yaku(j);
    if(b == 8)
      d++;
  }
  cout << d;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[]i = new int[3];
		i[0] = sc.nextInt();
		i[1] = sc.nextInt();
		i[2] = sc.nextInt();
		
		Arrays.sort(i);
		
		
		
		System.out.println(i[0] + " " + i[1] + " " +i[2]);
	}
}


Measured memory_bytes: 26448
import math
n, k = map(int, input().split())

def combination(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
mod = 10**9+7
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        print(combination(n-k+1, i)*combination(k-1, i-1)%mod)

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i=0; i<n; ++i) {
        cin >> h[i];
    }
    vector<bool> ok(n, true);
    for (int i=0; i<m; ++i) {
        int a, b; cin >> a >> b;
        a--; b--;
        if (h[a] < h[b]) ok[a] = false;
        else if (h[a] > h[b]) ok[b] = false;
        else {
            ok[a] = false; ok[b] = false;
        }
    }
    int ans = 0;
    for (int i=0; i<n; ++i) {
        if (ok[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3784
import sys
input = sys.stdin.readline


def main():
    h, w, m = map(int, input().split())
    horizontal_counts = [0] * h
    vertical_counts = [0] * w
    bombs = set()
    for _ in range(m):
        y, x = map(int, input().split())
        y -= 1
        x -= 1
        vertical_counts[x] += 1
        horizontal_counts[y] += 1
        bombs.add((y, x))

    y_max = max(horizontal_counts)
    x_max = max(vertical_counts)
    y_candidates = [y for y, count in enumerate(horizontal_counts) if count == y_max]
    x_candidates = [x for x, count in enumerate(vertical_counts) if count == x_max]

    for y in y_candidates:
        for x in x_candidates:
            if (y, x) in bombs:
                continue
            else:
                print(y_max + x_max)
                return
    print(y_max + x_max - 1)
    return


if __name__ == "__main__":
    main()


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
const int INF = 1e9;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)
#define print(a)       for(auto x : a) cout << x << " "; cout << "\n"
#define print1(a)      for(auto x : a) cout << x.ff << " " << x.ss << "\n"
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << "\n"


ll fast_exp(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
int val(char c){if (c >= '0' && c <= '9')return (int)c - '0';else return (int)c - 'A' + 10;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]
string bitstring(int n, int size){string s;while(n){s+=(n%2)+'0';n/=2;}while(s.size()<size){s+='0';}reverse(all(s));return s;}
// dsu start

vi root(200001,0);
vi size(200001,1);
int find(int x){while(x!=root[x])x = root[x];return x;}
bool same(int a,int b){return find(a)==find(b);}
void unite(int a, int b){a = find(a);b = find(b);if(size[a]<size[b])swap(a,b);size[a] += size[b];root[b] = a;}

// dsu end
vi vis(200001,0);
vi adj[200001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //string bitstring = std::bitset< 3 >( 7 ).to_string(); <bits> (num)
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int x = 0;
    int maxi = 0;
    for(int i=0; i<n; ++i)
    {
    	if(s[i]=='I')
    		++x;
    	else
    		--x;
    	maxi = max(maxi,x);
    }
    cout<<maxi<<"\n";
 	   
}

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

int main() {
  
  int W, a, b; cin >> W >> a >> b;
  
  if (a + W < b) {
    cout << b - (a + W) << endl;
    return 0;
  }
  
  if (b + W < a) {
    cout << a - (b + W) << endl;
    return 0;
  }
  
  cout << 0 << endl;
  
}

Measured memory_bytes: 256
import std.stdio,std.string,std.conv;int n,x,k;int[300999]C,U;void main(){readf("%d\n",&n);foreach(a;readln.split)C[a.to!int]++;foreach(c;C)for(x=0;c;)U[x++]+=c--;for(x=n;k<n;)k*x+x>n-U[x]&&x--||(k++,x.writeln);}

Measured memory_bytes: 14180
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from fractions import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a * b // g


N, K = read_ints()
# Kは固定
# x=abs(x-K)
# x>Kであるならば、引き続けるのがよい
# 0付近のxを探してやればよい？

x = N
x1 = x % K  # 正
x2 = x1 - K  # 負

# x1が負より小さければいい？
print(min(x1, -x2))


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

typedef long long int llint;

int k;
int number=0;
llint answer=0;

llint pow10(int n)
{
    llint ans=1;
    for(int i=0;i<n;i++) ans*=10;
    return ans;
}

bool func(int x,int keta)
{
    if(keta==1)
    {
        number++;
        if(number==k)
        {
            // printf("%d ",x);
            answer+=(llint)x*pow10(keta-1);
            return true;
        }
    }
    else
    {
        for(int next=x-1;next<=x+1;next++)
        {
            if(next<0) continue;
            if(next>=10) continue;
            if(func(next,keta-1))
            {
                // printf("%d ",x);
                answer+=(llint)x*pow10(keta-1);
                return true;
            }
        }
    }
    return false;
}

int main()
{
    scanf("%d",&k);
    for(int i=1;;i++)//桁数
    {
        for(int j=1;j<10;j++)
        {
            if(func(j,i))
            {
                printf("%lld\n",answer);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m,a;
  while(cin >> n >> m >> a,n){
      vector< vector<pair<int, int> > > G(1001);
      rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        G[a].pb(mp(b,c));
        G[a].pb(mp(c,b));
      }
      rrep(i,1001){
          for(const auto& o:G[i]){
            if(o.fi == a){
                a = o.se;
                // cout << a << endl;
                break;
            }
          }
      }
      cout << a << endl;
      G.clear();
  }
  return 0;
}



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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


int main() {
  string s;
  cin >> s;

  if(s.size()%2){cout << "No";return 0;}
  int k = s.size()/2;
  reps(i,k){
    if((s[2*k-2]!='h')||(s[2*k-1]!='i')){
      {cout << "No";return 0;}
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String P = "";
		for (int i = 0; i < N; i++) P += sc.next();
		String Q = "";
		for (int i = 0; i < N; i++) Q += sc.next();
		List<String> list = new ArrayList<>();
		permutation(P,"",list);
		Collections.sort(list);
		int a = list.indexOf(P) + 1;
		int b = list.indexOf(Q) + 1;
		System.out.println(Math.abs(a - b));
	}
	
	public static void permutation(String q, String p,List<String> list){
		if(q.length() <= 1) {
			list.add(p + q);
		} else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						p + q.charAt(i),list);
			}
		}
	}
}

Measured memory_bytes: 46396
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
        return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    //COMinit();
    int n; cin>>n;
    vector<int> p(n,0);
    REP(i,n) cin>>p[i];
    int ans=0;
    for(int i=0; i<n-2; i++)
    {
        if((p[i]>p[i+1]&&p[i+1]>p[i+2])||p[i]<p[i+1]&&p[i+1]<p[i+2])
        {
            ++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
    }





Measured memory_bytes: 256
#include <iostream>
    #include <cstdlib>
    #include <cstring>
    #include <cstdio>
    #include <algorithm>
     
    using namespace std;
     
    const int N = 100010;
     
    int a[N];
     
    int main()
    {	int n;
    	scanf("%d", &n);
    	int Max = 0;
    	for (int i = 1; i <= n; i++)
    		scanf("%d", &a[i]);
    	sort(a + 1, a + 1 + n, greater<int>());
    	int p = 1;
    	while (p <= n && p <= a[p])
    		p++;
    	p--;
    	int x = 1;
    	while (p+x <= n && a[p+x] == p)
    		x++;
    	x--;
    	if (((a[p]-p) & 1) || (x & 1))
    		puts("First");
    	else
    		puts("Second");
    	return 0;
    }

Measured memory_bytes: 640
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    long long int a,b,c,k;
    cin>>a>>b>>k;
    if(k>=(a+b))
    cout<<0<<" "<<0;
    else if(k<=a)
    cout<<a-k<<" "<<b;
    else
    cout<<0<<" "<<b-(k-a);
    

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

// CumulativeSum2D {{{
class CumulativeSum2D {
    vector<vector<intmax_t>> cum;

public:
    CumulativeSum2D() {}
    CumulativeSum2D(const size_t h, const size_t w) : cum(h + 1, vector<intmax_t>(w + 1)) {}

    inline void build() {
        const size_t h = cum.size(), w = cum[0].size();
        for (size_t y = 1; y < h; ++y) {
            for (size_t x = 1; x < w; ++x) {
                cum[y][x] += cum[y][x - 1] + cum[y - 1][x] - cum[y - 1][x - 1];
            }
        }
    }

    inline intmax_t sum(size_t sy, size_t sx, size_t gy, size_t gx) const {
        return cum[gy][gx] - cum[sy - 1][gx] - cum[gy][sx - 1] + cum[sy - 1][sx - 1];
    }

    inline intmax_t operator()(size_t y, size_t x) const {
        return cum[y][x];
    }

    inline intmax_t& operator()(size_t y, size_t x) {
        return cum[y][x];
    }

    inline void resize(const size_t h, const size_t w) {
        cum.assign(h + 1, vector<intmax_t>(w + 1));
    }

    inline intmax_t height() const noexcept {
        return cum.size() - 1;
    }

    inline intmax_t width() const noexcept {
        return cum[0].size() - 1;
    }

    friend ostream& operator<<(ostream &out, const CumulativeSum2D &matrix) {
        const size_t h = matrix.cum.size();
        const size_t w = matrix.cum[0].size();
        for (size_t y = 1; y < h; ++y) {
            for (size_t x = 1; x < w; ++x) {
                out << matrix.cum[y][x] << (x == w - 1)[" \n"];
            }
        }
        return out;
    }
};
// }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    size_t N, M, Q; cin >> N >> M >> Q;

    CumulativeSum2D cum(N, N);
    for (size_t i = 0; i < M; ++i) {
        size_t L, R; cin >> L >> R;
        cum(L, R)++;
    }

    cum.build();

    while (Q--) {
        size_t p, q; cin >> p >> q;
        cout << cum.sum(p, p, q, q) << "\n";
    }


    return 0;
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  int res = INT_MAX;
  for (int x = -100; x <= 100; x++) {
    int sum = 0;
    rep(i, n) {
      sum += (x - a.at(i)) * (x - a.at(i));
    }
    res = min(res, sum);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()
	n := nextInt()
	carry := nextInts(5)

	ans := divFloor(n, min(carry...)) + 4
	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}


Measured memory_bytes: 640