akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
//#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    constexpr int Max = 1000000;
    VI s;
    for (int i = 1, a = 0, b = 0; b <= Max; ++i) {
        a += i;
        b += a;
        s.push_back(b);
    }
    int m = s.size();

    auto dp = defvec<int>(Max, Max + 1, 2);
    dp[0][0] = 0;
    each(i, s)eFOR(j, 0, Max - i)FOR(k, 0, 2) {
        chmin(dp[i + j][k | ((i & 1) == 0)], dp[j][k] + 1);
    }
    
    for (int n; cin >> n && n;)cout << min(dp[n][0], dp[n][1]) << " " << dp[n][0] << "\n";
}


Measured memory_bytes: 57332
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int a[4]={};
int res=0;
int mn=256,md=128,mx=0;
int mnid=1,mdid=2,mxid=3;
int main()
{
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	if(a[1]==a[2]&&a[1]==a[3])
	{
		printf("0");return 0;
	}
	for(int i=1;i<=3;++i)
	{
		if(mn>a[i])mn=a[i],mnid=i;
		if(mx<a[i])mx=a[i],mxid=i;
	}
	mdid=6-mnid-mxid;
	md=a[mdid];
	if(md==mx)
	{
		if((md-mn)%2)res+=2;
		res+=(md-mn)/2;
		printf("%d",res);
		return 0;
	}
	else
	{
		if((mx-md)%2&&(mx-mn)%2)
		{
			res+=1;
			md+=1;mn+=1;
		}
		else if((mx-md)%2)
		{
			res+=2;
			mx+=1;mn+=1;md+=2;
		}
		else if((mx-mn)%2)
		{
			res+=2;
			mx+=1;mn+=2;md+=1;
		}
		res+=(mx-md)/2;
		res+=(mx-mn)/2;
	}
	printf("%d",res);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<bool>	vb;



void solve(){
	ll l,r,d;
	cin >> l >> r >> d;
	ll ans = 0;
	for(int i = l; i <= r; i++){
		if(i % d == 0) ans++;
	}
	cout << ans;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t = 1;
	// cin >> t;
	rep(i,0,t){
		solve();
	}

}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define printii(x)  for(auto it=x.begin();it!=x.end();it++) cout<<*it.F<<' '<<*it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m;
    string s;
    cin>>s;
    for(int i=0;i<3;i++){
            if(s[i]=='7'){
                cout<<"Yes";
                return 0;
            }
        }
            
cout<<"No";
    return 0;
}







Measured memory_bytes: 3652
using System;

namespace A___Subscribers
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var n = int.Parse (input[0]);
            var a = int.Parse (input[1]);
            var b = int.Parse (input[2]);
            var max = Math.Min (a, b);
            var min = 0;
            var c = n - (a + b);
            if (c >= 0)
                min = 0;

            else
                min = Math.Abs (c);

            Console.WriteLine ($"{max} {min}");

        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(x,y) '(' << x << ',' << y << ')'
ll MOD = 1000000007;
ll INF = 214748364700000000;
double EPS = 1e-12;
double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
   ll N,M;cin >> N >> M;
   vector<ll> cnt(N);
   vector<bool> frag(N,0);
   ll AC = 0,WA = 0;
   rep(i,M){
       ll p;
       string S;
       cin >> p >> S;
       p--;
       if(S == "AC"){
           if(frag[p]){
               continue;
           }else{
               frag[p] = 1;
               AC++;
           }
       }else{
           if(frag[p]){
               continue;
           }else{
               cnt[p]++;
           }
       }
   }
   rep(i,N){
       if(frag[i]){
           WA += cnt[i];
       }
   }
   cout << AC << ' ' << WA << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef struct range
{
	int l,r,num;
	bool operator < (const struct range & t)const 
	{
		return r<t.r;
	}
}RANGE,*PRANGE;
RANGE arr[1<<18];
long long tree[1<<19],lazy[1<<19];
long long search(int index,int lb,int rb,int lq,int rq)
{
	if(lb==rb||(lb==lq&&rb==rq))
		return tree[index];
	if(lazy[index])
	{
		tree[index<<1]+=lazy[index];
		tree[index<<1|1]+=lazy[index];
		lazy[index<<1]+=lazy[index];
		lazy[index<<1|1]+=lazy[index];
		lazy[index]=0;
	}
	int mid=(lb+rb)>>1;	
	if(lq>mid)
		return search(index<<1|1,mid+1,rb,lq,rq);
	else if(rq<=mid)
		return search(index<<1,lb,mid,lq,rq);
	else
		return max(search(index<<1|1,mid+1,rb,mid+1,rq),search(index<<1,lb,mid,lq,mid));
}
void update(int index,int lb,int rb,int lq,int rq,long long value)
{
	if(lb==lq&&rb==rq)
	{
		tree[index]+=value;
		lazy[index]+=value;
		return;
	}
	if(lazy[index])
	{
		tree[index<<1]+=lazy[index];
		tree[index<<1|1]+=lazy[index];
		lazy[index<<1]+=lazy[index];
		lazy[index<<1|1]+=lazy[index];
		lazy[index]=0;
	}
	int mid=(lb+rb)>>1;
	if(lq>mid)
		update(index<<1|1,mid+1,rb,lq,rq,value);
	else if(rq<=mid)
		update(index<<1,lb,mid,lq,rq,value);
	else
	{
		update(index<<1|1,mid+1,rb,mid+1,rq,value);
		update(index<<1,lb,mid,lq,mid,value);
	}	
	tree[index]=max(tree[index<<1],tree[index<<1|1]);
}
int main()
{
	int n,m,i,cnt;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)
		scanf("%d %d %d",&arr[i].l,&arr[i].r,&arr[i].num);
	sort(arr,arr+m);
	cnt=0;
	for(i=1;i<=n;i++)
	{
		update(1,0,n,i,i,search(1,0,n,0,i-1));
		while(i==arr[cnt].r&&cnt<m)
		{
			update(1,0,n,arr[cnt].l,arr[cnt].r,arr[cnt].num);
			cnt++;
		}
	}
	printf("%lld",search(1,0,n,0,n));
	return 0;
}

Measured memory_bytes: 10752
# -*- coding: utf-8 -*-
import heapq as hp
n, m = map(int, input().split())
a = list(map(int, input().split()))
items = []
for ai in a:
    hp.heappush(items, (-ai, ai))

for i in range(m):
    item = hp.heappop(items)
    nv = item[1] >> 1
    hp.heappush(items, (-nv, nv))
count = 0
while len(items) > 0:
    v = hp.heappop(items)
    count += v[1]
print(count)



Measured memory_bytes: 20548
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int n,m;
ll a[1010][3];
ll res=-1e18;
vector<ll> v;
int main()
{
	cin >>n>>m;
	for (int i=0;i<n;i++)
	    cin >>a[i][0]>>a[i][1]>>a[i][2];
	for (int tr=0;tr<8;tr++)
	{
		v.clear();
		for (int i=0;i<n;i++)
		{
			ll t=0;
			for (int j=0;j<3;j++)
			{
				if (tr & (1<<j)) t+=a[i][j];
				else t-=a[i][j];
			}
			v.push_back(t);
		}
		sort(v.begin(),v.end());
		ll r=0;
		for (int i=0;i<m;i++) r+=v[n-1-i];
		res=max(res,r);
	}
	cout <<res;
	return 0;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
	    int  n =fs.nextInt();
	    int count=0;
	    boolean present=false;
	    while(n-->0) {
	    	 int si=fs.nextInt();
	    	 int ei =fs.nextInt();
	    	 if(si==ei) {
	    		 count++;
	    	 }
	    	 if(count==3) {
	    		 present=true;
	    	 }
	    	 if(si!=ei) {
	    		 count=0;
	    	 }
	    }
	  if(present)System.out.println("Yes");
	  else System.out.println("No");
	}
	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for(int i:a) l.add(i);
		Collections.sort(l);
		for(int i=0;i<l.size();i++) a[i]=l.get(i);
	}
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a = new int[n];
			for(int i=0;i<n;i++)a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 32756
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

x, y = map(int, input().split())
if (x in g1) and (y in g1):
  print("Yes")
elif (x in g2) and (y in g2):
  print("Yes")
elif (x in g3) and (y in g3):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		char[] c = s.toCharArray();
		if (s.length() >= k) {
			for (int i = 0; i < k; i++) {
				if (c[i] != '1') {
					break;
				} else if (i == k - 1) {
					System.out.println(1);
					return;
				}
			}
		}
		for (int i = 0; i < s.length(); i++) {
			if (c[i] != '1') {
				System.out.println(c[i]);
				break;
			}
		}
	}
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i,a,p=0,q=0,q1=0,q2=0,q3=0,q4=0,q5=0,q6=0,q7=0,q8=0,mint=0,maxt=0;
    cin>>t;
    for(i=1; i<=t; i++)
    {
        cin>>a;
        if(a>=1 &&a<=399)
        {
            q1++;
        }
        else if(a>=400 &&a<=799)
        {
            q2++;
        }
        else if(a>=800 &&a<=1199)
        {
            q3++;
        }
        else if(a>=1200 &&a<=1599)
        {
            q4++;
        }
        else if(a>=1600 &&a<=1999)
        {
            q5++;
        }
        else if(a>=2000 &&a<=2399)
        {
            q6++;
        }
        else if(a>=2400 &&a<=2799)
        {
            q7++;
        }
        else if(a>=2800 &&a<=3199)
        {
            q8++;
        }
        else if(a>=3200)
        {
            p++;
        }

    }
    if(q1!=0)
    {
        q++;
    }
    if(q2!=0)
    {
        q++;
    }
    if(q3!=0)
    {
        q++;
    }
    if(q4!=0)
    {
        q++;
    }
    if(q5!=0)
    {
        q++;
    }
    if(q6!=0)
    {
        q++;
    }
    if(q7!=0)
    {
        q++;
    }
    if(q8!=0)
    {
        q++;
    }
    if(q==0)
    {
        cout<<"1"<<" "<<p<<endl;
    }
    else
    {
        cout<<q<<" "<<p+q<<endl;
    }
    return 0;
}



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

int main(){
  int n;
  double x, ans = 0.0;
  string u;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> x >> u;
    if(u == "BTC"){
      x *= 380000;
    }
    ans += x;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
    init();
    string s;cin>>s;
    ll ans=0;
    if(s[0]=='1')ans++;
    if(s[1]=='1')ans++;
    if(s[2]=='1')ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

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

    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    ll ans = 0;
	string s;
	ll k;
	cin >> s >> k;
	int cut = 0;
	REP(i, s.size()){
		if(s[cut] != s[s.size()-1]) break;
		cut++;
	}
	//cout << cut << " " << s.size()<< endl;
	if(cut == s.size()){
		ans = (ll)(s.size() * k / 2);
	}
	else{
		string head, ss, news, tail;
		ss = s + s;
		head = ss.substr(0, cut);
		news = ss.substr(cut, s.size());
		tail = ss.substr(cut+s.size());
		int now, len;
		//head
		ans += (ll)head.size() / 2;
		//news
		now = 0; len = 1;
		ll x = 0;
		while(now < news.size()){
			if(news[now] == news[now+len]){
				len++;
			}
			else{
				x += (ll)len / 2;
				now = now + len;
				len = 1;
			}
		}
		ans += x * (k-1);
		//tail
		now = 0; len = 1;
		x = 0;
		while(now < tail.size()){
			if(tail[now] == tail[now+len]){
				len++;
			}
			else{
				x += (ll)len / 2;
				now = now + len;
				len = 1;
			}
		}
		ans += x;
	}
    cout << ans << endl;
}

/*aaabbbaaa
head: aaa
news: bbbaaaaaa
tail: bbbaaa
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll mod = 1e9 + 7;
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll tt = 0;
    rep(i, n) {
        rep(j, n) {
            if (a[i] > a[j]) tt++;
        }
    }
    ll in = 0;
    rep(i, n) {
        reps(j, i + 1, n) {
            if (a[i] > a[j]) in++;
        }
    }
    ll ans = (in + in * (k - 1)) % mod;
    ll ks = k * (k - 1) / 2 % mod;
    ans = (ans + ks * tt) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    A = [0] * (N+1)
    A[0] = 1
    for _ in range(K):
        D = int(input())
        AD = list(map(int, input().split()))   # 数字が一つの時、mapできない
        for i in AD: A[i] = 1

    sum = 0
    for j in A:
        if j == 0: sum += 1

    print(sum)

main()

Measured memory_bytes: 67860
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
long long N;
stringstream s;
string temp;
//int digit(long long x)
//{
//    int res=0;
//    while(x!=0)
//    {
//        x/=10;
//        res++;
//    }
//    return res;
//}
int main(void)
{
    cin>>N;
    int cnt=INT_MAX;
    int len1;
    int len2;
    for(long long i=1; i*i<=N; i++)
    {
        if(N%i==0)
        {
            s.clear();
            s<<i;
            s>>temp;
            len1=temp.length();
            s.clear();
            s<<(N/i);
            s>>temp;
            len2=temp.length();
            cnt=min(cnt,max(len1,len2));
        }
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a<=b)
	{
		for(int i=a;i<=b;i++)
		{
			if(i==c)
			{
				cout<<"Yes";
				return 0;
			}		
		}	
	}
    else
    for(int i=b;i<=a;i++)
    {
    	if(i==c)
    	{
    		cout<<"Yes";
    		return 0;
    	}
    }
	cout<<"No";
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int knl = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i] > a[knl]) knl = i;
  }
  if (a[knl] < 0) {
    cout << a[knl] << '\n';
    cout << n - 1 << '\n';
    for (int i = n; i > knl ; i--) {
      cout << i << '\n';
    }
    for (int i = 1; i < knl; i++) {
      cout << 1 << '\n';
    }
    return 0;
  }
  long long sums[2] = {};
  vector<vector<int>> xs(2);
  for (int t = 0; t < 2; t++) {
    for (int i = 2 - t; i <= n; i += 2) {
      if (a[i] > 0) {
        sums[t] += a[i];
        xs[t].push_back(i);
      }
    }
  }
  int pty = sums[0] > sums[1] ? 0 : 1;
  cout << sums[pty] << '\n';
  vector<int> x = xs[pty];
  int s = x.size();
  vector<int> ret;
  for (int j = n; j > x[s - 1]; j--) {
    ret.push_back(j);
  }
  for (int i = s - 1; i >= 1 ; i--) {
    for (int j = (x[i - 1] + x[i]) / 2; j > x[i - 1]; j--) {
      ret.push_back(j);
    }
  }
  for (int j = 1; j < x[0]; j++) {
    ret.push_back(1);
  }
  cout << ret.size() << '\n';
  for (int crr : ret) {
    cout << crr << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(V) V.begin(),V.end()
#define Mod 1e9+7

using namespace std;

int main()
{
    ll i,j,k,l,m,n,q;
    cin >> n >> m;

    cout << (3*n+m)/2;

    return 0;
}


Measured memory_bytes: 256
s = input()
for i in range (int(input())):
    order = input().split()
    a, b = int(order[1]), int(order[2])
    if "print" in order:
        print(s[a:b+1])
    elif "replace" in order:
        s = s[:a] + order[3] + s[b+1:]
    else:
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]



Measured memory_bytes: 5620
s = input()

if s[0] == "A" and s[1].islower():
    if s[2:].count("C") == 1:
        idx = s.index("C")
        if s[1:idx].islower() and s[idx + 1 :].islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 3060
#include <stdio.h>
  
int main(int argc, char *argv[]) {
    int h, w;
    char s[52][52] = {0};

    scanf("%d%d ", &h, &w);

    for (int i = 1; i <= h; i++) {
        scanf("%s", &s[i][1]);
    }

    for (int j = 1; j <= h; j++) {
        for (int i = 1; i <= w; i++) {
            if (s[j][i] == '#' && s[j - 1][i] != '#' && s[j + 1][i] != '#' && s[j][i - 1] != '#' && s[j][i + 1] != '#') {
                printf("No\n");
                return 0;
            }
        }
    }

    printf("Yes\n");

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>

int main(){
  std::string s,t;
  int a,b;
  std::string u;
  
  std::cin>>s>>t;
  std::cin>>a>>b;
  std::cin>>u;
  
  if(s==u){
    --a;
  }else{
    --b;
  }
  
  std::cout<<a<<" "<<b<<std::endl;
  return 0;
}

Measured memory_bytes: 256
# FMT

omega = 565042129
n = 2 ** 20
mod = 998244353
rev = pow(omega, mod - 2, mod)

# バタフライ演算としてのbit反転処理
# in-placeで計算するために利用
def bit_reverse(d):
	n = len(d)
	ns = n >> 1; nss = ns >> 1
	ns1 = ns + 1
	i = 0
	for j in range(0, ns, 2):
		if j < i:
			d[i], d[j] = d[j], d[i]
			d[i + ns1], d[j + ns1] = d[j + ns1], d[i + ns1]
		d[i + 1], d[j + ns] = d[j + ns], d[i + 1]
		k = nss; i ^= k
		while k > i:
			k >>= 1; i ^= k
	return d

# FMTをループで計算
def fmt_bu(A, n, base, half, Q):
	N = n
	m = 1
	while n > 1:
		n >>= 1
		# ω^{2m} ≡ 1 となるω
		w = pow(base, n, Q)
		wk = 1
		for j in range(m):
			for i in range(j, N, 2 * m):
				# U = g(ω^{2k}), V = ω^k * h(ω^{2k})
				U = A[i]; V = (A[i + m] * wk) % Q
				A[i] = (U + V) % Q
				# half = ω^{N/2}
				A[i + m] = (U + V * half) % Q
			wk = (wk * w) % Q
		m <<= 1
	return A

# FMTの順変換
def fmt(f, l, Q = mod):
	if l == 1: return f
	A = f[:]
	# bit反転
	bit_reverse(A)
	return fmt_bu(A, n, omega, pow(omega, n // 2, Q), Q)

# FMTの逆変換
def ifmt(F, l, Q = mod):
	if l == 1: return F
	A = F[:]
	# bit反転
	bit_reverse(A)
	# 逆変換なので、ωの代わりにω^{-1}を渡す
	f = fmt_bu(A, n, rev, pow(rev, n // 2, Q), Q)
	# Nで割って返す
	n_rev = pow(n, Q - 2, Q)
	return [(e * n_rev) % Q for e in f]

# FMTを利用した畳込み処理
def convolute(a, b, l, Q = mod):
	A = fmt(a, l, Q)
	B = fmt(b, l, Q)
	C = [(s * t) % Q for s, t in zip(A, B)]
	c = ifmt(C, l, Q)
	return c

def getlist():
	return list(map(int, input().split()))

N, M = getlist()
A = getlist()
B = getlist()
# print(A)
# print(B)
A += [0] * (n - N)
B += [0] * (n - M)
fg = convolute(A, B, n)
print(*fg[:N + M - 1])

Measured memory_bytes: 234720
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};

int main() {

	
	string S;
	cin >> S;
	deque<char>k;
	for (char i : S)k.push_back(i);
		ll Q;
	cin >> Q;
	vector<int>q(Q);
	vector<int> f(Q);
	vector<char> c(Q);
	ll check = 1;
	ll check2 = 1;
	rep(i, Q) {
		cin >> q[i];
		if (q[i] == 1) {
			check2 *= -1;
		}
		else {
			cin>>f[i]>>c[i];
			if (f[i] == 2) {
				check = -1;
			}
			else {
				check = 1;
			}
			if (check*check2 == -1) {
				k.push_back(c[i]);
			}
			else {
				k.push_front(c[i]);
			}

		}

	}
	if (check2 == 1) {
	
	}
	else {
	reverse(k.begin(), k.end());
		
	}
	rep(i, k.size()) {
		cout << k[i];
	}
}


Measured memory_bytes: 2688
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
#define F first
#define S second
typedef pair<int,int> P;
int W,H,N;
P X[1001];
P Y[1001];
bool fld[3*1001][3*1001];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int compress(P *p,int s){
  vector<int> ps;
  ps.clear();
  for(int i=0;i<N;i++){
    for(int d=-1;d<=1;d++){
      int tx1 = p[i].F + d;
      int tx2 = p[i].S + d;
      if ( 0 <= tx1 && tx1 < s ) ps.push_back(tx1);
      if ( 0 <= tx2 && tx2 < s ) ps.push_back(tx2);
    }
  }
  sort(ps.begin(),ps.end());
  ps.erase( unique(ps.begin(),ps.end() ),ps.end() );
  for(int i=0;i<N;i++){
    p[i].F = find(ps.begin(),ps.end(), p[i].F) - ps.begin();
    p[i].S = find(ps.begin(),ps.end(), p[i].S) - ps.begin();
  }
  return ps.size();
}
int solve(){
  W = compress(X,W);
  H = compress(Y,H);
  
  memset(fld,0,sizeof(fld));
  for(int i = 0;i < N; i++){
    for(int y = Y[i].F; y < Y[i].S; y++){
      for(int x = X[i].F; x < X[i].S; x++){
	fld[x][y]=true;
      }
    }
  }
  
  int ans=0;
  for(int y=0;y < H;y++){
    for(int x=0;x < W;x++){
      if(fld[x][y]) continue;
      ans++;
      
      queue<P> q;
      q.push(P(x,y));
      while(!q.empty()){
	int sx = q.front().F, sy = q.front().S;
	q.pop();
	for(int i=0;i<4;i++){
	  int nx = sx + dx[i], ny = sy + dy[i];
	  if( nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
	  if(fld[nx][ny]) continue;
	  q.push(P(nx,ny));
	  fld[nx][ny]=true;
	}
      }
    }
  }
  printf("%d\n",ans);
}
int main(){
  while(1){
    scanf("%d %d",&W,&H);
    if(!W && !H) break;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
      scanf("%d %d %d %d",&X[i].F,&Y[i].F,&X[i].S,&Y[i].S);
    }
    solve();
  }
}

Measured memory_bytes: 10052
fn main() {
    let v = read_vec::<u64>();
    let n = v[0] as usize;
    let mut h = v[1];

    let mut aa = vec![];
    let mut bb = vec![];
    for _ in 0..n {
        let vv = read_vec::<u64>();
        aa.push(vv[0]);
        bb.push(vv[1]);
    }

    aa.sort();
    bb.sort();

    let a = aa[n-1];
    let mut ans = 0;

    while let Some(b) = bb.pop() {
        if a <= b {
            if h > b {
                h -= b;
                ans += 1;
            } else {
                h = 0;
                ans += 1;
                break;
            }
        } else {
            break;
        }
    }
    if h != 0 {
        ans += (h + a - 1) / a;
    }

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

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 6396
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(
            Solve(Console.ReadLine())
        );
    }

    static string Solve(params string[] args)
    {
        var txt = args[0];

        while (true)
        {
            if (txt == "") return "YES";
            if (txt.EndsWith("dreamer"))
            {
                txt = txt.Substring(0, txt.Length - "dreamer".Length);
            }
            else if (txt.EndsWith("dream"))
            {
                txt = txt.Substring(0, txt.Length - "dream".Length);
            }
            else if (txt.EndsWith("eraser"))
            {
                txt = txt.Substring(0, txt.Length - "eraser".Length);
            }
            else if (txt.EndsWith("erase"))
            {
                txt = txt.Substring(0, txt.Length - "erase".Length);
            }
            else
            {
                return "NO";
            }
        }


        var N = int.Parse(args[0].Split(' ')[0]);
        var Y = int.Parse(args[0].Split(' ')[1]);

        for (int x = N; x >= 0; x--)
        for (int y = (N - x); y >= 0; y--)
        for (int z = (N - x - y); z >= 0; z--)
        {
            if ((x + y + z) != N) continue;
            if (10000 * x + 5000 * y + 1000 * z == Y)
            {
                return $"{x} {y} {z}";
            }
        }

        return "-1 -1 -1";
    }
}

Measured memory_bytes: 32004
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,i,j,x;
            cin>>n;
            ll ar[n+1];
            map<ll,ll> mp;
            for(i=1;i<=n;++i)
            {
                cin>>ar[i];
                mp[ar[i]]++;
            }
            ll ans=0,ans2;
            for(auto it:mp)
            {
                ans=ans+(it.s)*(it.s-1)/2;
            }
            for(i=1;i<=n;++i)
            {
                x=mp[ar[i]];
                ans2=ans-x*(x-1)/2;
                ans2=ans2+(x-1)*(x-2)/2;
                cout<<ans2<<endl;
            }
        }
        return 0;
    }


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

using namespace std;

int main()
{
    int N,A[1000];
    cin >> N;
  
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    bool APPROVED = true;

    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0) {
            APPROVED = false;
        }   
    }

    if (APPROVED) {
        cout << "APPROVED" << endl;
    }
    else {
        cout << "DENIED" << endl;
    }

}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
using namespace std;

#define rep(i,n) for(i=0;i<n;i++)
int main(){
    int i;
    string a,b;
    cin>>a>>b;
    int c=stoi(a+b);
    rep(i,1000){
        if(i*i==c){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}


Measured memory_bytes: 3564
#include <algorithm>
#include <cstdint>
#include <iostream>

auto main() -> int {
  std::int64_t N;
  std::cin >> N;

  std::int64_t ms[5];
  for (int i = 0; i < 5; ++i) {
    std::cin >> ms[i];
  }

  const auto m = std::min_element(std::begin(ms), std::end(ms));

  std::cout << (((N - 1) / *m) + 5) << "\n";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n = int(input())\n"
"a = list(map(int, input().split()))\n"
"for i in range(n):\n"
"    a[i] -= 1\n"
"print(sum(a))\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define ll long long
#define Start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fr first
#define sc second
#define PI 3.14159265
#define ullt unsigned long long int
using namespace std;

void solve()
{
    int n,ans=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        int x;
        cin>>x;
        ans+=(x%2!=0&&i%2!=0);
    }
    cout<<ans;

}
int main()
{
    Start;
    int t=1;
    //cin>>t;
    while(t--)
        solve();




}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll w,d;

ll solve() {
	map<ll,ll> ma;
	ll ret = 0;
	REP(i,w) {
		ll tmp;
		cin >> tmp;
		ma[tmp]++;
		ret += tmp;
	}
	REP(i,d) {
		ll tmp;
		cin >> tmp;
		if(ma[tmp] != 0) ma[tmp]--;
		else ret += tmp;
	}
	return ret;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while(1) {
		cin >> w >> d;
		if(w == 0 && d == 0) break;
		cout << solve() << endl;
	}
	return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<(k);i++)
#define mp make_pair
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef long double ld;
//----head----
int main()
{
	ll a,b;
	scanf("%lld%lld",&a,&b);
	int ans=0;
	while(a<=b)b>>=1,ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

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

signed main() {
	int N, A, B;
	cin >> N >> A >> B;

	if (A > B) {
		cout << 0 << endl;
		return 0;
	}
	if (N == 1) {
		cout << (A == B ? 1 : 0) << endl;
		return 0;
	}

	cout << (B * (N - 1) + A) - (A * (N - 1) + B) + 1 << endl;

    return 0;
}


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

int main(){

	int H, W;
	
	while(1){
		cin >> H >> W;
		if( H == 0 && W == 0)break;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if( i == 0 || i == H - 1 || j == 0 || j == W - 1){
            		cout <<"#";
        				} else{
            		cout << "."; 
        }
    				
			}
					cout << endl;
			}
			cout << endl;
		}
		
	
return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

ll binpow(ll a, ll b) {
    if (b == 0)
    {
        return 1;
    }
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
    {
        return res * a;
    }
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h,w,n;
    cin>>h;
    cin>>w;
    cin>>n;
    cout<<n/max(h,w)+min(n%max(h,w),1);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

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

ll hi[1234567][2], omori[1234567][2];
ll par1[1234567], par2[1234567];//parと左右
ll ok[12345678];//2ならok

ll notfind[12345678];
signed main() {
	while (true) {
		ll n; cin >> n;
		if (n == 0) { break; }

		rep(i, 123456) { 
			hi[i][0] = 0; hi[i][1] = 0; omori[i][0] = 0; omori[i][1] = 0;
			par1[i] = 0; par2[i] = 0; ok[i] = 0; notfind[i] = 0;
		}

		queue<ll> que;
		rep2(i, n) {
			ll a, b, c, d; cin >> a >> b >> c >> d;
			notfind[c]++; notfind[d]++;
			//a,b
			ll k = gcd(a, b); a /= k; b /= k;
			hi[i][0] = b; hi[i][1] = a;
			//end

			//c,d
			if (c == 0) { ok[i]++; omori[i][0] = 1; }
			else { par1[c] = i; par2[c] = 0; }
			if (d == 0) { ok[i]++; omori[i][1] = 1; }
			else { par1[d] = i; par2[d] = 1; }
			//end
			if (ok[i] == 2) { que.push(i); }
		}
		ll ans = 0;
		while (que.size()) {
			ll a = que.front(); que.pop();
			ll cnt = 0;

			//cout << omori[a][0] << ' ' << omori[a][1] << endl;
			if (gcd(omori[a][0], hi[a][0]) != 1) { omori[a][0] /= gcd(omori[a][0], hi[a][0]); }
			if (gcd(omori[a][1], hi[a][1]) != 1) { omori[a][1] /= gcd(omori[a][1], hi[a][1]); }
			//cout << omori[a][0] << ' ' << omori[a][1] << endl;
			cnt = lcm(omori[a][0], omori[a][1]) * (hi[a][0] + hi[a][1]);

			if (notfind[a] == 0) { ans = cnt; break; }

			ok[par1[a]]++; omori[par1[a]][par2[a]] = cnt;
			if (ok[par1[a]] == 2) { que.push(par1[a]); }
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 10844
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		String S = scanner.next();
		String T = scanner.next();
		
		int min = T.length();
		
		int sLen = S.length();
		int tLen = T.length();
		
		for (int i = 0; i < sLen - tLen + 1; i++) {
			
			int sum = 0;
			
			for (int j = 0; j < tLen; j++) {
				if (S.charAt(i+j) == T.charAt(j)) continue;
				sum++;
			}
			
			min = Math.min(sum, min);
		}
		
		System.out.println(min);
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32528
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int n, i;
	cin >> n;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	sort(arr, arr + n);
	int a = arr[n / 2 - 1];
	int b = arr[n / 2];
	cout << b - a;
}

Measured memory_bytes: 640
using System;
using System.IO;

namespace Ex160506_1{
    public class Program{
        public static void Main(string[] args){
            var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};

            while(true){
                var input = Console.ReadLine().Split(' ');
                var h = int.Parse(input[0]);
                var w = int.Parse(input[1]);

                if(h == 0) break;
                for(var i = 1; i <= h; i++){
                    for(var j = 1; j <= w; j++){
                        if(i == 1 || i == h || j == 1 || j == w){
                            sw.Write('#');
                        } else{
                            sw.Write('.');
                        }
                    }
                    sw.WriteLine();
                }
                sw.WriteLine();
            }
            sw.Flush();
        }
    }
}

Measured memory_bytes: 8832
/**    epsileer 07 September 2019  23:05:42  **/    
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<LL,LL> PII;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define TEST int t = 1; while(t--) solve()

void solve(){
    LL n; cin>>n;
    cout<<(n*n*n);
}

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST;
return 0;
}

Measured memory_bytes: 256
'use strict'

function main(s) {

  s = s.split('\n');

  const N = Number(s[0].split(' ')[0]);
  const K = Number(s[0].split(' ')[1]);

  let ans = 0;

  if (N <= K) ans = 1;
  if (N > K) ans = Math.ceil((N - K) / (K - 1)) + 1;

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9292
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <list>
#include <list>

typedef long long ll;
using namespace std;
const int mod = 1000000007;
int main() {

    
    ll N, D, A; cin >> N >> D >> A;
    vector< pair<ll, ll> > P(N);
    for (int i = 0; i < N; i++) {
        ll x, h; cin >> x >> h;
        P[i] = make_pair(x, h);
    }

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

    list< pair<ll, ll> > L;

    ll ans = 0;
    ll tot = 0;

    // ダメージを累積和したらできそう．．．
    
    for (int i = 0; i < N; i++) {

        ll x = P[i].first;
        ll h = P[i].second;
        while (!L.empty() and x > L.front().first) {
            tot -= L.front().second;
            L.pop_front();
        }
        
        h -= tot;

        if (h > 0) {
            ll cnt = (h + A - 1) / A;
            ans += cnt;
            tot += cnt * A;
            L.push_back(make_pair(x + D * 2, cnt * A));
        }

    }

    cout << ans << '\n';

}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int N;
 
    while(cin >> N, N){
	int cnt = 0;
	string s;
	bool l = false, r = false, a = true, b = false;
	for(int i = 0 ; i < N ; i++){
	    cin >> s;
	    if(s == "lu"){
		if(r && a) cnt++, a = false, b = true;
		l = true;
	    }else if(s == "ru"){
		if(l && a) cnt++, a = false, b = true;
		r = true;
	    }else if(s == "ld"){
		if(!r && b) cnt++, a = true, b = false;
		l = false;
	    }else{
		if(!l && b) cnt++, a = true, b = false;
		r = false;
	    }
	}
	cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void){
  char s[3];
  int i;
  int bill=700;
  
  for(i=0;i<3;i++){
    s[i] = getchar();
  }
  
  for(i=0;i<3;i++){
    if(s[i]=='o'){
      bill += 100;
    }
  }
  
  printf("%d\n",bill);
  
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	static final int max=1000000;
	public static void main(String[] args) {
		boolean p[]=new boolean[max+1];
		for(int i=0;i<max;i++)p[i]=true;
		p[0]=false;p[1]=false;
		for(int t=2;t<max;t++){
			if(p[t]){
				for(int i=t*2;i<max;i+=t){
					p[i]=false;
				}
			}
		}
		Scanner n = new Scanner(System.in);
		while(n.hasNext()){
			long in = n.nextLong();
			int cnt=0;
			for(int i=2;i<=in;i++){
				if(p[i])cnt++;
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 22280
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    char a[100],b[100];
    int f=0,i,j;
    scanf("%s",a);
    scanf("%s",b);
    sort(a,a+strlen(a));
    sort(b,b+strlen(b));
    i=0;
    j=strlen(b)-1;
    while(i<strlen(a)&&j>=0)
    {
        if(b[j]!=a[i])
        {
            if(b[j]<a[i])
                printf("No");
            else
                printf("Yes");
            f=1;
            break;
        }
        i++;
        j--;
    }
    if(!f)
    {
        if(j>=0)
            printf("Yes");
        else
            printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#define BUFSIZE 10000
#include<math.h>
int N,K;
int live[BUFSIZE]={0};
int count[BUFSIZE]={0};

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}




void cal(){
	for(int i=0;i<100;i++){
		for(int j=0;j < N;j++){
			count[i]=count[i]+(live[j]-(i+1))*(live[j]-(i+1));
		}
	}
	
	
}

int main(void){
	 scanf(" %d",&N);
	for(int i=0;i<N;i++){
	 scanf(" %d",&live[i]);
	}
	cal();
	
	qsort(count,100,sizeof(int), compare_int);
    

	printf(" %d",count[0]);
}

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

using namespace std;

typedef pair<int, int> P;

bool solve()
{
  int M, N, K;
  cin >> M >> N;
  vector< vector<P> > conds(M);
  bool ans = false;
  for(int i = 0; i < M; i++) {
    int K; cin >> K;
    conds[i].resize(N, P(111, -1));
    for(int j = 0; j < K; j++) {
      int s, t; string cond;
      cin >> s >> cond >> t; --s;
      if(cond == "<=") {
	conds[i][s].first = min(conds[i][s].first, t);
      } else if(cond == ">=") {
	conds[i][s].second = max(conds[i][s].second, t);
      }
      if(conds[i][s].second > conds[i][s].first) ans = true;
    }
  }

  if(ans) return true;

  bool G[111][111] = {{false}};
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < M; j++) {
      if(i == j) continue;
      for(int k = 0; k < N; k++) {
	G[i][j] |= (conds[i][k].first < conds[j][k].second);
      }
    }
  }
  
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < M; j++) {
      for(int k = 0; k < M; k++) G[j][k] |= (G[j][i] & G[i][k]);
    }
  }
  
  for(int i = 0; i < M; i++) ans |= G[i][i];

  return ans;
}

int main()
{

  cout << (solve() ? "No" : "Yes") << endl;
  
  return 0;
}

Measured memory_bytes: 3256