akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> f(202020);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    f[a]++;
  }

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

  int kind = 0;
  for (int i = 0; i < 202020; i++) {
    kind += f[i] > 0;
  }
  int ans = 0;
  for (int i = 0; i < 202020; i++) {
    if (kind > k && f[i] > 0) {
      ans += f[i];
      kind--;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, mx = 0;
    cin >> n;
    map<string, int> freq;
    set<string> st;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        if (++freq[s] > mx) {
            mx = freq[s];
            st.clear();
            st.insert(s);
        } else if (freq[s] == mx) {
            st.insert(s);
        }
    }
    for (auto s: st) 
        cout << s << endl;
    return 0;
}

Measured memory_bytes: 36480
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int x,y;
  cin>>x>>y;
  cout << x + y/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  A[1] =2;
  for(int i=2;i<44;++i){
    A[i] =A[i-1];
    if(i>1)A[i]+=A[i-2];
  }
  return A[n-1];

}
int main(){
  int n;
  cin >> n ;
  cout <<fib(n)<<endl;
}

Measured memory_bytes: 1160
from heapq import heappush, heappop
from collections import deque

N,K = map(int,input().split())
V = list(map(int,input().split()))

ans = 0

for i in range(K+1):
    sup = min(i,N)
    for l in range(sup+1):
        for r in range(sup+1-l):
            j = min(i-r-l,r+l)
            hq = []
            dq = deque(V)
            for _ in range(l):
                item = dq.popleft()
                heappush(hq, item)
            for _ in range(r):
                item = dq.pop()
                heappush(hq, item)
            for _ in range(j):
                heappop(hq)
            res = sum(hq)
            ans = max(ans,res)

print(ans)

Measured memory_bytes: 84744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 998244353
const int MAX = 510000;
vector<vector<P>>V(100000);
ll color[100000];//0,1塗る色
void dfs(int p){
	for(auto c : V[p]){
      	int x=c.first;ll y=c.second;
    	if(::color[x]==0||::color[x]==1){continue;}
      	if(y%2==0){::color[x]=::color[p];}
      	else{::color[x]=1-::color[p];}
      	dfs(x);
    }
}

int main() {
  int N;cin>>N;
  rep(i,N-1){
    ll u,v,w;cin>>u>>v>>w;u--;v--;
    V[u].push_back(P(v,w));
    V[v].push_back(P(u,w));
  }
  rep(i,N){::color[i]=-1;}
  ::color[0]=0;
  dfs(0);
  rep(i,N){cout<<color[i]<<endl;}
}

Measured memory_bytes: 10240
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();


int main() {
    string s, t;
    cin >> s >> t;
    cout << (t+s) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main ()
{

    int a,b,z;
    cin>>a>>b;

    if((a>=1 && a<=9) && (b>=1 && b<=9))
    {
    z= a*b;
    cout<<z;
    }
    else
        cout<<"-1";

    return 0;
}


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

typedef long long ll;

int main(){
	static int n;
	static ll a[100010];
	scanf("%d",&n);
	for(int i = 0 ; i < n ; i ++){
		scanf("%lld",&a[i]);
	}
	
	int cnt = 0;
	for(int i = 0 ; i < n ; i ++){
		if(a[i] < 0)cnt ++;
	}
	ll sum = 0;
	for(int i = 0 ; i < n ; i ++){
		sum += abs(a[i]);
	}
	if(cnt%2 == 0){
		cout << sum << endl;
		return 0;
	}
	ll MIN = 1000000000;
	for(int i = 0 ; i < n ; i ++){
		MIN = min( MIN , abs(a[i]) );
	}
	cout << sum-2*MIN << endl;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3

MOD = 10**9 + 7

n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))

dp = [[0] * (m + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
    for j in range(m):
        dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j]
        if s[i] == t[j]:
            dp[i + 1][j + 1] += dp[i][j] + 1
        dp[i + 1][j + 1] %= MOD

print(dp[n][m] + 1)


Measured memory_bytes: 72668
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    int absMin = (int)1e9;
    int minusCount = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        absMin = min(absMin, abs(A[i]));
        if (A[i] < 0) ++minusCount;
    }
    int answer = 0;
    for (int i = 0; i < N; i++) {
        answer += abs(A[i]);
    }
    if (minusCount % 2 == 1) answer -= absMin * 2;
    cout << answer << endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int max(int a, int b) {
  return a < b ? b : a;
}

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

  cin >> a >> b >> c;

  int v1 = 10*a + b + c;
  int v2 = 10*b + a + c;
  int v3 = 10*c + a + b;

  cout << max(max(v1, v2), v3) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll MOD2=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int ca){
    int N,M,X; cin>>N>>M>>X;

    int cost[15]; int A[15][15];

    for (int i = 0; i < N; ++i) {
        cin>>cost[i];
        for (int j = 0; j < M; ++j) {
            cin>>A[i][j];
        }

    }

    int ans=1e9;

    for (int itr = 0; itr < (1 << N); ++itr) {
        int tmp=0;
        int cnt[15]={0};
        for (int i = 0; i < N; ++i) {
            if((itr>>i)&1){
                tmp+=cost[i];
                for (int j = 0; j < M; ++j) {
                    cnt[j]+=A[i][j];
                }
            }
        }
        bool ok=true;
        for (int i = 0; i < M; ++i) {
            if(cnt[i]<X){
                ok= false;
                break;
            }
        }
        if(ok) {
            chmin(ans,tmp);
        }
    }
    if(ans==1e9) {
        cout<<-1<<endl;
        return;
    }
    cout<<ans<<endl;
}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

int main();

int main(){
  int a, b;

  scanf("%d %d", &a, &b);

  if(a==b)
    printf("a == b\n");

  else if(a>b)
    printf("a > b\n");

    else
      printf("a < b\n");


    return 0;
    }

Measured memory_bytes: 580
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#define MN 200000
#define N 262144
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
struct data{int x,y,id;
	bool operator <(const data&b)const{return x>b.x;}
}s[MN+5];
priority_queue<data> q;vector<int> v[MN+5];
int n,a[MN+5],T[N*2+5],t[N*2+5],num=0;
inline int Merge(int x,int y){return a[x]<a[y]?x:y;}
int Query(int*T,int l,int r)
{
	int res=0;
	for(l+=N-1,r+=N+1;l^r^1;l>>=1,r>>=1)	
	{
		if(~l&1) res=Merge(res,T[l+1]);	
		if( r&1) res=Merge(res,T[r-1]);
	}
	return res;
}
int Solve(int l,int r)
{
	int x=0,y=0,z=++num;
	if(l&1) x=Query(T,l,r-1),y=Query(t,x,r); 
	else    x=Query(t,l,r-1),y=Query(T,x,r);
	s[z]=(data){a[x],a[y],z};
	if(x!=l) v[z].push_back(Solve(l,x-1));
	if(r!=y) v[z].push_back(Solve(y+1,r));
	if(x!=y-1) v[z].push_back(Solve(x+1,y-1));
	return z;
} 
int main()
{
	n=read();a[0]=1e9;
	for(int i=1;i<=n;++i) a[i]=read(),(i&1)?T[i+N]=i:t[i+N]=i;
	for(int i=N;i;--i) T[i]=Merge(T[i<<1],T[i<<1|1]),t[i]=Merge(t[i<<1],t[i<<1|1]);
	int id=Solve(1,n);q.push(s[id]);
	while(!q.empty())
	{
		data x=q.top();q.pop();
		printf("%d %d ",x.x,x.y);	
		for(int i=0;i<v[x.id].size();++i) q.push(s[v[x.id][i]]);
	}
	return 0;
}



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

int main() {
    int N, X;
    cin >> N >> X;
    vector <int> L(N);
    for(int i = 0; i < N; i++)
    {
        cin >> L[i];
    }

    int D = 0;
    int count = 1;
    for(int i = 0; i < N; i++)
    {
        D += L[i];
        if(D <= X) count++;
    }

    cout << count << endl;
    return 0;
}



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

int memo[30] = {};

int main(){
  memo[2] = 1;
  memo[4] = 2;
  memo[6] = 2;
  memo[9] = 2;
  memo[11] = 2;
  
  int a, b;
  cin >> a >> b;
  cout << (memo[a] == memo[b] ? "Yes" : "No") << endl;
  
  return 0; 
}

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

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int rong[102][102];
 main()

{
    fast
    int a,b;
    cin>>a>>b;
    int cnt=0;
    f(i,1,50)
    {
        f(j,1,100)
        {
            if(i%2==1 && j%2==1)
            {
                if(cnt<a-1)
                {
                    cnt++;
                    rong[i][j]=1;
                }
            }
        }
    }
    f(i,51,100)
    {
        f(j,1,100)
        {
            rong[i][j]=1;
        }
    }
    cnt=0;
     f(i,51,100)
    {
        f(j,1,100)
        {
            if(i%2==0 && j%2==0)
            {
                if(cnt<b-1)
                {
                    cnt++;
                    rong[i][j]=0;
                }
            }
        }
    }
    cout<<"100 100"<<endl;
    f(i,1,100)
    {
        f(j,1,100)
        {
            if(rong[i][j]==0)
            {
                cout<<"#";
            }
            else cout<<".";
        }
        cout<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 3672
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#include<iostream>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define VI vector<int>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=205;
int n;LL a[MAXN];
LL p[MAXN];
bool check(LL x)
{
	for(int i=62;i>=0;i--)if(x&(1LL<<i))
	{
		if(!p[i])return false;
		x^=p[i];
	}return true;
}
void insert(LL x)
{
	for(int i=62;i>=0;i--)if(x&(1LL<<i))
	{
		if(!p[i]){p[i]=x;return ;}
		x^=p[i];
	}
}
char ch[MAXN];
void solve()
{
	memset(p,0,sizeof(p));
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	scanf("%s",ch+1);
	bool flag=true;
	for(int i=n;i>=1;i--)
	{
		if(ch[i]=='1')
			flag&=check(a[i]);
		else insert(a[i]);
	}
	if(!flag)pr2(1);
	else pr2(0);
}
int main()
{
	#ifdef Rose
		double BeginJudgeTime=clock();
	#endif
	for(int __=read();__;--__)solve();
	#ifdef Rose
		double EndJudgeTime=clock();
		cerr<<"JudgeTime is"<<" ";
		cerr<<(EndJudgeTime-BeginJudgeTime)/CLOCKS_PER_SEC<<endl;
	#endif
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

template<class T> 
ostream& operator<<(ostream &os, vector<T> input) {
    os << "[ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "]";
}

template<class T> 
ostream& operator<<(ostream &os, set<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, unordered_set<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, multiset<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, unordered_multiset<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class L, class R> 
ostream& operator<<(ostream &os, map<L,R> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << "(" << elem.first << "," << elem.second << ") ";
	}
	return os << "}";
}

template<class L, class R> 
ostream& operator<<(ostream &os, unordered_map<L,R> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << "(" << elem.first << "," << elem.second << ") ";
	}
	return os << "}";
}

#define ll long long
const int MAXN = 100005;
const int INF = 1e9;
const int MOD = 1e9 + 7;

class TaskC {
private:
	
	vector<vector<int>> graph;
	vector<bool> vis;
	void dfs(int u) {
		vis[u] = true;
		for(int nxt : graph[u]) {
			if(!vis[nxt]) {
				dfs(nxt);
			}
		}
	}

public:
	void solveOne(int it){
		int n, m;
		cin >> n >> m;
		graph.assign(n, vector<int>());
		for(int i = 0; i < m; i++) {
			int x, y;
			cin >> x >> y;
			x--; y--;
			graph[x].push_back(y);
			graph[y].push_back(x);
		}
		vis.assign(n, false);
		int ans = 0;
		for(int u = 0; u < n; u++) {
			if(!vis[u]) {
				dfs(u);
				ans++;
			}
		}
		cout << ans - 1 << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskC solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<ll >    vecll;
typedef vector<string > vecstr;
////////////////////////////////////////////////
int main()
{
  ll n, k;
  cin >> n >> k;
  map<ll, ll> a;
  ll tmpa, tmpb;
  REP(i,n){
    cin >> tmpa >> tmpb;
    a[tmpa] += tmpb;
  }
  ll num = 0;
  // cout << endl;
  // REPvec(itr, a){
  //   cout << itr-> first << " " << itr->second << endl;
  // }
  REPvec(itr, a){
    num += itr->second;
    if(num >= k){
      cout << itr->first << endl;
      return 0;
    }
  }
} 




Measured memory_bytes: 4224
package main

import (
	"fmt"
)

type Score struct {
	wa   int
	isAc bool
}

func main() {
	var n, m int
	var scores []Score

	fmt.Scan(&n)
	fmt.Scan(&m)

	scores = make([]Score, n)

	var i int
	for i = 0; i < n; i++ {
		scores[i] = Score{0, false}
	}

	var p int
	var s string
	for i = 0; i < m; i++ {
		fmt.Scan(&p)
		fmt.Scan(&s)
		if s == "WA" && !scores[p-1].isAc {
			scores[p-1].wa++
		} else {
			scores[p-1].isAc = true
		}
	}

	var ac int = 0
	var wa int = 0
	for i = 0; i < n; i++ {
		if scores[i].isAc {
			ac++
			wa += scores[i].wa
		}
	}

	fmt.Println(ac, wa)
}

func scanNums(len int) (nums []int) {
	var num int
	var i int
	for i = 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


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

int main(void){
    ll a, b;
    cin >> a >> b;

    if(b % a == 0)
        cout << a + b << endl;
    else
        cout << b - a << endl;

    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    if s <= "2019/04/30".to_string() {
        println!("Heisei");
    } else {
        println!("TBD");
    }
}


Measured memory_bytes: 4352
s=input()
N=len(s)
if N%2==1:
    a=N//2+1
else:
    a=N//2
ans=0
for i in range(a):
    if s[i]=="p":
        ans-=1
for i in range(a,N):
    if s[i]=="g":
        ans+=1
print(ans)


Measured memory_bytes: 39408
#!/usr/bin/ruby
# encoding: utf-8

A,B,$K = gets.split.map(&:to_i)

$taka = A
$aoki = B

def taka_ope
  if $taka.odd? then
    $taka -= 1
  end
  $aoki += $taka/2
  $taka = $taka/2
end

def aoki_ope 
  if $aoki.odd? then
    $aoki -= 1
  end
  $taka += $aoki/2
  $aoki = $aoki/2
end

if $K.even? then
  $K = $K/2
  $K.times do 
    taka_ope
    aoki_ope
  end
else
  $K = $K/2
  $K.times do 
    taka_ope
    aoki_ope
  end
  taka_ope
end

puts "#{$taka} #{$aoki}"


Measured memory_bytes: 1788
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
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; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int W, H;
  while (cin >> W >> H, W) {
    vs v(H);
    rep(i, H) cin >> v[i];
    vvi dp(H, vi(W));
    int b = 0, w = 0;
    rep(i, H) rep(j, W) {
      dp[i][j] = 2 * (v[i][j] == 'B') + (v[i][j] == 'W');
      b -= v[i][j] == 'B';
      w -= v[i][j] == 'W';
    }
    rep(_, W * H) rep(i, H) rep(j, W) {
      if (v[i][j] != '.') continue;
      if (i > 0) dp[i][j] |= dp[i - 1][j];
      if (j > 0) dp[i][j] |= dp[i][j - 1];
      if (i < H - 1) dp[i][j] |= dp[i + 1][j];
      if (j < W - 1) dp[i][j] |= dp[i][j + 1];
    }
    rep(i, H) rep(j, W) {
      b += dp[i][j] == 2;
      w += dp[i][j] == 1;
    }
    cout << b << ' ' << w << endl;
  }
}

Measured memory_bytes: 3140
import numpy as np
from collections import Counter
a=int(input())
c=[0]*a
d=[0]*10
x=0
y=a
z=0
for i in range(a):
	e=input()
	for j in range(10):
		d[j]=e[j]
	d.sort()
	c[i]=d[0]+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]

mycounter = Counter(c)
lst=[]
for e in mycounter.items():
    lst.extend(e)
for t in range(1,len(lst),2):
	k=lst[t]
	z=int(z+(k*(k-1)/2))
print(z)

Measured memory_bytes: 28520
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX_V 100
#define MAX_E 10000
#define INF 1e9
typedef pair<int,int> pii;
 
struct Edge{
  int u,v,cost;
  Edge(){}
  Edge(int u,int v,int cost) : u(u),v(v),cost(cost) {}
};
 
bool cmp(const Edge &e1,const Edge &e2){
  return e1.cost < e2.cost;
}
 
int V,E,par[MAX_V],rank[MAX_V],wmin;
Edge es[MAX_E];
 
void init(){
  for(int i = 0 ; i < V ; i++){
    par[i] = i;
    rank[i] = 0;
  }
}
 
int find(int x){
  if(par[x] == x){
    return x;
  }
  return par[x] = find(par[x]);
}
 
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]++;
    }
  }
}
 
bool same(int x,int y){
  return find(x) == find(y);
}
 
int kruskal(){
  init();
  sort(es,es+E,cmp);
  set<pii> v;
  bool used[MAX_V] = {false};
  int max = 0, min = INF;
  for(int i = 0 ; i < E ; i++){
    Edge e = es[i];
    if(!same(e.u,e.v) && wmin <= e.cost){
      unite(e.u,e.v);
      used[e.u] = used[e.v] = true;
      v.insert(pii(e.u,e.v));
      max = std::max(max,e.cost);
      min = std::min(min,e.cost);
    } 
  }
  if((int)v.size() != V-1) return INF;
  for(int i = 0 ; i < V ; i++){
    if(!used[i]) return INF;
  }
  return max-min;
}
 
int main(){
  while(cin >> V >> E, (V | E)){
    int a,b,c,w[MAX_E];
    for(int i = 0 ; i < E ; i++){
      cin >> a >> b >> c;
      a--, b--;
      es[i] = Edge(a,b,c);
      w[i] = c;
    }
    sort(w,w+E);
    int res = 1e9;
    for(int i = 0 ; i < E ; i++){
      wmin = w[i];
      res = min(res,kruskal());
    }
    cout << (res == INF ? -1 : res) << endl;
  }
  return 0;
}

Measured memory_bytes: 1300
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> t(N+1), x(N+1), y(N+1);
    rep(i,0,N) {
        cin >> t[i+1] >> x[i+1] >> y[i+1];
    }

    bool ok = true;
    rep(i,1,N+1) {
        int dfx = abs(x[i] - x[i-1]);
        int dfy = abs(y[i] - y[i-1]);
        int dft = abs(t[i] - t[i-1]);
        if(dft < dfx + dfy) ok = false;
        if((dft % 2) ^ ((dfx + dfy) % 2)) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  int cnt = 0;
  for(int i = 1; i < n-1; i++) {
    if(p[i-1] < p[i] && p[i] < p[i+1]) cnt++;
    else if(p[i+1] < p[i] && p[i] < p[i-1]) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3628
n = int(input())
a = list(map(int, input().split()))
submap = {}
for each in a:
  try:
    submap[each] += 1
  except:
    submap[each] = 1
for i in range(1, n+1):
  try:
    print(submap[i])
  except:
    print(0)

Measured memory_bytes: 33348
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#define fi first
#define se second
#define debug printf(" I am here\n");
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int maxn=2e5+5,inf=0x3f3f3f3f;
const double eps=1e-10;
int n,a[maxn],b[maxn];
int vis[maxn],ma1,ma2;
signed main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
//        vis[a[i]]++;
//        ma1=max(ma1,vis[a[i]]);
    }
//    memset(vis,0,sizeof(vis));
    for(int i=1;i<=n;i++){
        scanf("%d",&b[i]);
//        vis[b[i]]++;
//        ma2=max(ma2,vis[b[i]]);
    }
    reverse(b+1,b+1+n);
    int pos=1;
    for(int i=1;i<=n;i++){
        if(a[i]==b[i]){
            for(;pos<=n;pos++){
                if(b[pos]!=a[i]&&b[i]!=a[pos]){
                    swap(b[i],b[pos]);
                    break;
                }
            }
        }
    }
//    cout<<pos<<endl;
    if(pos>=n+1){
        printf("No\n");
    }else{
        printf("Yes\n");
        for(int i=1;i<=n;i++){
            printf("%d%c",b[i],i==n?'\n':' ');
        }
    }
//    if(ma1+ma2>n){
//        printf("No\n");
//    }else{
//        printf("Yes\n");
//        do{
//            bool flag=1;
//            for(int i=1;i<=n;i++){
//                if(a[i]==b[i]){
//                    flag=0;
//                    break;
//                }
//            }
//            if(flag){
//                for(int i=1;i<=n;i++){
//                    printf("%d%c",b[i],i==n?'\n':' ');
//                }
//                break;
//            }
//        }while(next_permutation(b+1,b+1+n));
//    }
    return 0;
}




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

int n, a, b, c = 0;
bool f = 0;

int main(){

cin >> n;

for(int i = 0; i < n; i++){
    cin >> a >> b;

    if(a == b)
      c++;
    else
      c = 0;

    if(c > 2)
    f = 1;
}

if(f)
  cout << "Yes" << endl;
else
  cout << "No" << endl;
}


Measured memory_bytes: 3576
def read_input():
    x = int(input())
    return x


def submit():
    x = read_input()

    a = x // 11
    b = x % 11

    c = 2 * a

    if b > 0:
        if b <= 6:
            c += 1
        else:
            c += 2

    print(c)


if __name__ == '__main__':
    submit()


Measured memory_bytes: 38384
n = int(input())
C = input()
cnt = 0

m = n
for i in range(n):
    if C[i] == 'W':
        for j in reversed(range(i,m)):
            if C[j] == 'R':
                cnt += 1
                m = j
                break
        else:
            break

print(cnt)

Measured memory_bytes: 9480
#include<bitset>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

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

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

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
struct UnionFind {
    int n, cc, *u;
    UnionFind() : n(0), cc(0), u(NULL) {}
    UnionFind(int n_) : n(n_), cc(n_) {
	u = new int[n_];
	memset(u, -1, sizeof (int) * n);
    }
    UnionFind(const UnionFind &y) : n(y.n), cc(y.cc) {
	u = new int[y.n];
	memcpy(u, y.u, sizeof (int) * n);
    }
    ~UnionFind() {
	delete[] u; u = NULL;
	n = cc = 0;
    }
    friend void swap(UnionFind &x, UnionFind &y) {
	swap(x.n, y.n); swap(x.cc, y.cc); swap(x.u, y.u);
    }
    UnionFind& operator=(UnionFind y) { 
	swap(*this, y);
	return *this;
    }
    int root(int x) {
	int y = x, t;
	while (u[y] >= 0) y = u[y];
	while (x != y) { t = u[x]; u[x] = y; x = t; }
	return y;
    }
    bool link(int x, int y) {
	x = root(x); y = root(y);
	if (x == y) return false;
	if (u[y] < u[x]) swap(x, y);
	u[x] += u[y]; u[y] = x; cc--;
	return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -u[root(x)]; }
    int count() { return cc; }
};


int N, M;
bool A[711][711];

using Bits = bitset<1024>;

int tri(int n) {
    return n * (n-1) / 2;
}
int solve() {
    UnionFind U(2*N);
    REP (i, N) REP (j, i) if (!A[i][j]) {
	U.link(i, j+N);
	U.link(i+N, j);
    }
    REP (i, N) if (U.same(i, i+N)) return -1; // not bipartite
    vector<pair<int, int> > ret;
    vector<int> cnt(2*N, 0);
    REP (i, N) cnt[U.root(i)]++;
    REP (i, N) {
	int a = U.root(i), b = U.root(i+N);
	if ((a == i && a < b) || (b == i+N && b < a)) {
	    ret.push_back(make_pair(cnt[a], cnt[b]));
	}
    }


    Bits B; B.set(0);
    EACH (e, ret) {
	B = (B<<e->first) | (B<<e->second);
    }

    for (int i=N/2; i>=0; i--) if (B.test(i)) {
	return tri(i) + tri(N-i);
    }

    assert(false);
}

void MAIN() {
    scanf("%d%d", &N, &M);
    REP (i, M) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	A[x][y] = A[y][x] = true;
    }


    int ans = solve();
    printf("%d\n", ans);
}

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



Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define method(name,res,...) function<res (__VA_ARGS__) > name = [&](__VA_ARGS__) -> res
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  ll a = in();
  ll w = in();
  ll b = in();
  ll v = in();
  ll t = in();
  if(w<v){
    cout << "NO" << endl;
    return 0;
  }
  if(abs(a-b) <= (w-v) * t){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int n , m ;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};
int main() {
    IO;
    cin >> n >> m;
    int sy, sx, ey, ex;
    cin >> sy >> sx >> ey >> ex;
    sy--, sx--, ey--, ex--;
    vector<string> mat(n);
    for (int i = 0; i < n; i++) {
        cin >> mat[i];
    }
    deque<pair<int, int >> pq;
    pq.emplace_back(sy, sx);
    auto can = [&](int y, int x) {
        return !(y < 0 || y >= n || x < 0 || x >= m || mat[y][x] == '#');
    };
    mat[sy][sx] = '#';
    vector<vector<int>> v(n, vector<int>(m, 1e7));
    v[sy][sx] = 0;
    while (pq.size()) {
        pair<int, int> cur = pq.back();
        pq.pop_back();
        int y = cur.first;
        int x = cur.second;
        int cost = v[y][x];
        if (y == ey && x == ex) {
            cout << cost << endl;
            return 0;
        }
        for (int i = 0; i < 4; i++) {
            int yy = y + dy[i];
            int xx = x + dx[i];
            if (can(yy, xx)) {
                if(v[yy][xx]>cost) {
                    v[yy][xx] = cost;
                    pq.emplace_back(yy, xx);
                }
            }

        }
        for (int i = y - 2; i <= y + 2; i++) {
            for (int j = x - 2; j <= x + 2; j++) {
                if (can(i, j)) {
                    if(v[i][j]>cost+1) {
                        v[i][j] = cost + 1;
                        pq.push_front({i, j});
                    }
                }
            }
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 8676
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {
	int n, m;
	cin >> n >> m;
	int s[5], c[5];
	for (int i = 0; i < m; ++i) {
		cin >> s[i] >> c[i];
	}
	int ans = -1;
	for (int x = 0; x <= 999; ++x) {
		char w[16];
		snprintf(w, 16, "%d", x);
		if (strlen(w) != n) continue;
		bool ok = true;
		for (int i = 0; i < m; ++i) {
			if (w[s[i] - 1] != (c[i] + '0')) {
				ok = false;
			}
		}
		if (ok) {
			ans = x;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	int n;
	while(1) {
		cin >> n;
		if (!n) break;
		if (n <= 2) {
			cout << 0 << endl;
			continue;
		}
		map<int, int> a;
		int cnt = 0, sum = 0;
		int l = 0, r = 0, w = 0;
		while(l < n) {
			while (sum < n && r < n) {
				r++;
				sum += r;
				w++;
			}
			if (sum == n) {
				a[w]++;
				//printf("l=%d r=%d\n",l,r);
			}
			while (sum > n && l < n) {
				l++;
				sum -= l;
				w--;
			}
			if (sum == n) {
				if (r != n) {
					a[w]++;
					//printf("l=%d r=%d\n",l,r);
				}
				l++;
				sum -= l;
				w--;
			}
		}
		cout << a.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














string S;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S;

	int n = S.length();

	if (n % 2 == 1) {
		cout << "No" << endl;
		return;
	}

	rep(i, 0, n / 2) if (S.substr(i * 2, 2) != "hi") {
		cout << "No" << endl;
		return;
	}

	cout << "Yes" << endl;
}







Measured memory_bytes: 256
import java.util.*;

public class Main {

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

		int n, m;
		n = scanner.nextInt();
		m = scanner.nextInt();
		
		Integer[] a = new Integer[n];
		int sum = 0;
		for(int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
			sum += a[i];
		}
		Arrays.sort(a, Collections.reverseOrder());
		double under = sum / ( m * 4.0 );
		
		if(a[m - 1] >= under)
			System.out.println("Yes");
		else 
			System.out.println("No");
		

		scanner.close();
	}

}


Measured memory_bytes: 22996
N, K = map(int, input().split())
h = [int(i) for i in input().split()]

dp = [float('inf')]*N
dp[0] = 0

for i in range(1, N):
    for j in range(0 if i-K < 0 else i-K, i):
        x = abs(h[i]-h[j])+dp[j]
        if x < dp[i]:
            dp[i] = x

print(dp[N-1])


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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
vector<int> arr;
int n;
int myf(int x){
    int res=0;
    for(int i=0;i<n;i++) res+=(arr[i]-x)*(arr[i]-x);
    return res;
}
int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    arr.resize(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    int mn=TYPEMAX(int)/2;
    for(int i=0;i<=100;i++){
        mn=min(mn,myf(i));
    }
    cout<<mn;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) erase(x.begin(), x.begin+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;

vector<vector<int> > graph(100000);

// first is the layer number, second is the number that go out from the vertex
vector<P> vertex(100000);
// struct _chunk {
// 	int connect;
// 	int dist;
// 	int color;
// };

void dfs(vector<vector<int> > &graph, int now, int layer, vector<P> &vertex) {
	vertex[now].first = layer;

	for(int i=0; i<graph[now].size(); i++) {
		int next = graph[now][i];
		if (vertex[next].first == 0) {
			// if it is the first time to visit next vertex
			dfs(graph, next, layer+1, vertex);
			if (vertex[next].second%2 == 0) {
				vertex[now].second += 1;
				cout << now+1 << " " << next+1 << endl;
			} else {
				vertex[next].second += 1;
				cout << next+1 << " " << now+1 << endl;
			}
		} else {
			// if the next layer is smaller than now's, decide the direction in any way
			if(vertex[next].first > vertex[now].first) {
				vertex[now].second += 1;
				cout << now+1 << " " << next+1 << endl;
			}
		}
	}
}

signed main(void) {
  	int N, M;
  	cin >> N >> M;

  	rep(i, M) {
  		int a, b;
  		cin >> a >> b;
  		a--; b--;
  		graph[a].pb(b);
  		graph[b].pb(a);
  		vertex[i] = make_pair(0, 0);
  	}

  	if (M%2 == 0) {
  		dfs(graph, 0, 1, vertex);
  	} else {
  		cout << -1 << endl;
  	}
 	
	return 0;
}


Measured memory_bytes: 17024
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

vector<int> as;

int main(void) {
    int N, K;
    cin >> N >> K;

    as.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> as[i];
    }

    for (int i = K; i < N; i++) {
        if (as[i - K] < as[i]) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }

    return 0;
}


Measured memory_bytes: 4028
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String today = sc.next();

        if(today.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if(today.equals("Cloudy")) {
            System.out.println("Rainy");
        } else {
            System.out.println("Sunny");
        }
    }
}

Measured memory_bytes: 19284
#include <bits/stdc++.h>
using namespace std;
//for(int i = 0; i < n; i++)
 
int main() {
  int n, a, b, ans = 0;
  bool ku = 0;
  long long x;
  string s = "No";
  cin >> n;
  //vector<int> v(n), c(n);
  for(int i = 0; i < 81; i++) {
    if(n == (i / 9 + 1) * (i % 9 + 1)) {
      s =  "Yes";
      break;
    }
  }
  cout << s << endl;
}

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

bool is_prime(long long p){
  int s = sqrt(p);
  for (int i=2;i<=s;i++){
    if (p % i == 0){
      return false;
    }
  }
  return true;
}

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for (int i=0;i<N;i++){
    long long tmp;
    cin >> tmp;
    if (is_prime(tmp)){
      ans += 1;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3088
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner teclado = new Scanner(System.in);
		int N=teclado.nextInt();
		int A=teclado.nextInt();
		int B=teclado.nextInt();
		if(A*N>B) {
			System.out.println(B);
		}else {
			System.out.println(A*N);
		}
        teclado.close();
	}

}


Measured memory_bytes: 23124
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int m, n;
	P[] ps, qs;

	void run(){
		for(;;){
			m=sc.nextInt();
			if(m==0){
				break;
			}
			ps=new P[m];
			for(int i=0; i<m; i++){
				int x=sc.nextInt();
				int y=sc.nextInt();
				ps[i]=new P(x, y);
			}
			n=sc.nextInt();
			qs=new P[n];
			for(int i=0; i<n; i++){
				int x=sc.nextInt();
				int y=sc.nextInt();
				qs[i]=new P(x, y);
			}
			solve();
		}
	}

	void solve(){
		// ps[0]ðqs[j]É í¹é
		// d=qs[j]-ps[0]
		TreeSet<P> set=new TreeSet<P>();
		for(P q : qs){
			set.add(q);
		}

		for(P q : qs){
			P d=q.sub(ps[0]);
			boolean match=true;
			for(P p : ps){
				match&=set.contains(p.add(d));
			}
			if(match){
				println(d.x+" "+d.y);
			}
		}

	}

	class P implements Comparable<P>{
		int x, y;

		P(int x, int y){
			this.x=x;
			this.y=y;
		}

		P add(P p){
			return new P(x+p.x, y+p.y);
		}

		P sub(P p){
			return new P(x-p.x, y-p.y);
		}

		@Override
		public int compareTo(P p){
			if(y!=p.y){
				return y-p.y;
			}else{
				return x-p.x;
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 13000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] str = br.readLine().split(" ");

		int A = Integer.parseInt(str[0]);
		int P = Integer.parseInt(str[1]);

		P += A*3;

		int ans = (P-(P%2))/2;

		System.out.print(ans);

	}

}


Measured memory_bytes: 22100