akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    a = f.read_int()
    s = f.read_str()

    return 'red' if a < 3200 else s


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 4764
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N;
   cin >> N;
   vector<pair<pair<string, int>, int>> v;
   for(int i=0;i<N; i++){
      string s;
      int p;
      cin >> s >> p;
      v.push_back(make_pair(make_pair(s,-p), i+1));
   }
   sort(v.begin(),v.end());
   for(int i=0;i<N;i++){
      cout << v[i].second << endl;
   }
   return 0;
}


Measured memory_bytes: 256
import bisect

n, *l = map(int, open(0).read().split())

l.sort()
ans = 0

# a<b<c な三角形を探索する。

for i in range(n-2):
    a = l[i]
    for j in range(i+1, n-1):
        b = l[j]
        c_num = bisect.bisect_left(l, a+b)  # cとしてありうる辺の長さの数。(ただしb以下の長さの辺も含む)
        ans += c_num - (j+1)  # b以下の長さの辺の数(j+1本)を引く
print(ans)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;


int main()
{
	map<int, int> M;
	int n;
	scanf("%d", &n);
	REP(i, n)
	{
		int a;
		scanf("%d", &a);
		M[a]++;
	}

	for (auto it = M.end(); it != M.begin(); it--)
	{
		auto it1 = it; it1--;
		if (it1->second > 1)
		{
			if (it1->second > 3)
			{
				printf("%lld\n", it1->first*(LL)it1->first);
				return 0;
			}

			for (auto it2 = it1; it2 != M.begin(); it2--)
			{
				auto it3 = it2; it3--;
				if (it3->second > 1)
				{
					printf("%lld\n", it1->first*(LL)it3->first);
					return 0;
				}
			}
		}
	}

	printf("0\n");

	return 0;
}

Measured memory_bytes: 4992
//抄的题解，红题就不举报了吧……
#include<bits/stdc++.h>

using namespace std;

long long int n;

int main(){
    cin>>n;
    for(int i=sqrt(n);i>=1;i--)
    {
        if(n%i==0){
            int t=i,l=n/i;
            int s=1;
            while(l>=10){
                s++;
                l/=10;
            }
        cout<<s;
        return 0;
        }
    }
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll n; cin >> n;
    vl as(n+2, 0); REP(i, n) cin >> as[i+1]; as.push_back(LINF);
    sort(as.begin(), as.end());
    ll m = as[as.size()-2];
    auto it = upper_bound(as.begin(), as.end(), m/2);
    auto st = it-1;
    ll c1 = m - *it, c2 = *st;
    cout << m << " " << (c1 > c2 ? m - c1 : c2) << endstr;
    return 0;
}


Measured memory_bytes: 1792
def resolve():
    n,m=map(int,input().split())
    py=[[0]*3 for _ in range(m)]
    for i in range(m):
        p,y=map(int,input().split())
        py[i][0],py[i][1],py[i][2]=p,y,i
    py.sort()
    ans=[[''] for _ in range(m)]
    cnt=[0]*(n+1)
    for p,y,i in py:
        cnt[p]+=1
        ans[i]='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(cnt[p])))+str(cnt[p])
    for i in ans:
        print(i)


if __name__ == '__main__':
    resolve()

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

int main() {
    int N, M;
    cin >> N >> M;
    vector <int> k(N);
    vector <vector <int>> s(M, vector <int> (0));
    vector <int> p(M);

    for(int i = 0; i < M; i++)
    {
        cin >> k[i];
        for(int j = 0; j < k[i]; j++)
        {  
            int ss;
            cin >> ss;
            s[i].emplace_back(ss);
        }
    }
    for(int i = 0; i < M; i++)
    {
        cin >> p[i];
    }


    int state_num = pow(2, N);
    int count = 0;
    for(int i = 1; i < state_num + 1; i++)
    {//全てのスイッチの状態
        stringstream ss;
        ss << bitset<10>(i);
        string state = ss.str();
        for(int j = 0; j < M; j++)
        {//それぞれの電球について
            int switch_count = 0;
            for(int num = 0; num < k[j] ; num++)
            {//スイッチがいくつかカウント
                int index = 10 - s[j][num];
                switch_count += state[index] - '0';
            }

            if(switch_count % 2 != p[j]) break;

            if(j == M - 1)
                count++;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastio;
    int n, a;
    cin >> n >> a;
    cout << n * n - a << endl;
}

Measured memory_bytes: 3604
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var buf = new string[h];
        var p = 0;
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            if (s.Replace(".","").Length != 0) { buf[p++] = s; }
        }
        var ans = new List<int>();
        for (int i = 0; i < w; i++)
        {
            var wh = false;
            for (int j = 0; j < p; j++)
            {
                if (buf[j][i] == '#') wh = true;
            }
            if (!wh) ans.Add(i);
        }
        for (int i = 0; i < p; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (!ans.Contains(j) ) Console.Write(buf[i][j]);
                if (j == w -1) Console.WriteLine();
            }
        }
    }
}


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

signed main(void)
{
	string s;
	cin >> s;
	cin >> s;
	cout << 'A' << s[0] << 'C' << endl;
	return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%d", $b);
fscanf(STDIN, "%d", $c);
fscanf(STDIN, "%d", $d);
fscanf(STDIN, "%d", $e);
fscanf(STDIN, "%d", $k);
echo ($e - $a <= $k) ? 'Yay!' : ':(';


Measured memory_bytes: 4728
n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
t = a-b
r = (max(h)+b-1)//b
l = 0
while r-l > 1:
    m = (r+l)//2
    mi = m*b
    count = 0
    for i in h:
        if i > mi:
            count += (i-mi+t-1)//t
    if count <= m:
        r = m
    else:
        l = m
print(r)

Measured memory_bytes: 50392
n, x = map(int, input().split())

lis = []
for i in range(n):
    lis.append(int(input()))

lis = sorted(lis)
cnt = 0

for i in range(n):
    if x < lis[i]:
        print(cnt)
        exit()
    x = x - lis[i]
    cnt += 1

m = min(lis)

while x >= m:
    x -= m
    cnt += 1

print(cnt)

Measured memory_bytes: 9200
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int k, n;
	vector<int> l;
	
	cin >> n >> k;
	
	for (int i = 0; i < n; i++)
	{
		int tmp;
		cin >> tmp;
		l.push_back(tmp);
	}
	
	sort(l.begin(), l.end(), greater<int>());
	
	int sum = 0;
	for (int i = 0; i < k; i++)
	{
		sum += l[i];
	}
	
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long int;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 main(){
	while(1){
		int t,p,r;
		cin>>t>>p>>r;
		if(t==0)return 0;
		V<ll> score(t,0),time(t,0);
		V<V<ll>> wa(t,V<ll>(p,0));
		V<V<bool>> ac(t,V<bool>(p,false));
		for(int i=0;i<r;i++){
			ll a,b,c;
			cin>>a>>b>>c;
			a--;b--;
			string s;
			cin>>s;
			if(s=="CORRECT"){
				if(ac[a][b])continue;
				ac[a][b]=true;
				score[a]++;
				time[a]-=wa[a][b]*1200+c;
			}else{
				wa[a][b]++;
			}
		}
		map<P,V<int>,greater<P>> mp;
		for(int i=0;i<t;i++){
			mp[P(score[i],time[i])].emplace_back(i+1);
		}
		for(auto p: mp){
			for(int v:p.se){
			cout<<v<<" "<<p.fi.fi<<" "<<-p.fi.se<<"\n";
			}
		}
	}
}


Measured memory_bytes: 3264
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        Integer a = Integer.parseInt(st.nextToken());	/* 胃袋耐久期間 */
        Integer b = Integer.parseInt(st.nextToken());	/* 賞味期限期間 */

        /* 賞味期限までに食べた場合 */
        if ( (a <= 8)&&(b<=8)) {
        	System.out.println("Yay!");
        }else {
        	System.out.println(":(");
        }

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
}

Measured memory_bytes: 21076
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int Arr[200005];
    int Elements,i,j,flag=0;
    cin>>Elements;
    for(i=0; i<Elements; i++)
    {
        cin>>Arr[i];
    }
    int n = Elements;
    sort(Arr,Arr+n);
    for(i=0; i<=(Elements-2); i++)
    {
        if(Arr[i]==Arr[i+1])
        {
            flag = 1;
            break;
        }
    }
    if(flag == 0)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

bool d[3][3][2005];
vector<string> s(3);

bool check(int i,int j,int k){
	if (k >= s[i].size())return true;
	return d[i][j][k];
}

int main(){

	for(int i = 0; i < 3; i++) {
		cin>>s[i];
	}
	sort(ALL(s));
	int res = 100000;
	do{
		for(int i = 0; i < 3; i++) {//文字列1
			for(int j = 0; j < 3; j++) {//文字列2
				// 文字列１に対する文字列２の相対的な関係を求める
				for(int k = 0; k < s[i].size(); k++) {//ズレ幅
				if(i >= j)continue;//組み合わせの数は減らせる
					bool flag = true;
					for(int ni = k; ni < s[i].size(); ni++) {
						int nj = ni - k;
						if(nj >= s[j].size())break;
						if(s[i][ni] == '?' || s[j][nj] == '?')continue;
						if(s[i][ni] != s[j][nj])flag = false;
					}
					d[i][j][k] = flag;//jをiからkだけずらしたときに一致するか
				}
			}
		}

		for(int x = 0; x < 2005; x++) {
			for(int y = 0; y < 2005; y++) {
				if (!check(0,1,x))continue;
				if (!check(1,2,y))continue;
				if (!check(0,2,x + y))continue;
				int ans = 0;
				ans = max<int>(ans,s[0].size());
				ans = max<int>(ans,x + s[1].size());
				ans = max<int>(ans,x + y + s[2].size());
				res = min(res, ans);
			}
		}
	}while(next_permutation(ALL(s)));
	cout << res << endl;

	


	return 0;
}

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

namespace Number
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();

            long[] l = Console.ReadLine()
                              .Split(' ')
                              .Select(e => long.Parse(e))
                              .ToArray();
            
            Console.WriteLine("{0} {1} {2}", l.Min(), l.Max(), l.Sum());
        }
    }
}

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

int main(){
	double N,K;
	cin >> N >> K;
	
	double ans = 0;
	
	REP(i,N){
		int temp = i;
		int count = 0;
		while(temp<K){
			count++;
			temp*=2;
		}
		ans += pow(0.5,count)/N;
	}
	
	printf("%.13f", ans);
	puts("");
	
    return 0;
}



Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    
number_list = list(map(int, input().split()))
N = number_list[0]
M = number_list[1]
K = number_list[2]

M_list = [list(map(int, input().split())) for _ in range(M)]

K_list = [list(map(int, input().split())) for _ in range(K)]

uf = UnionFind(N)
for i in range(M):
    uf.union(M_list[i][0]-1,M_list[i][1]-1)

fbcnt = [0]*N

for k in range(M):
    fbcnt[M_list[k][0]-1] += 1
    fbcnt[M_list[k][1]-1] += 1
for j in range(K):
    if uf.same(K_list[j][0]-1,K_list[j][1]-1):
        fbcnt[K_list[j][0]-1] += 1
        fbcnt[K_list[j][1]-1] += 1

result = []
for l in range(N):
    result.append(uf.size(l)-fbcnt[l]-1)

result = [str(a) for a in result]
result = ' '.join(result)
print(result)


Measured memory_bytes: 66976
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  if (N % 2 == 0) {
    N--;
  }
  cout << N / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ull i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;


int main() {
    #ifndef ONLINE_JUDGE
	// freopen("test.in", "r", stdin);
    #endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    double l; cin >> l;
    l = l/3;
    cout << fixed << setprecision(12) << pow(l, 3) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long dp[1111][1111],mod=1e9+7;
main()
{
	int n,k;cin>>n>>k;
	dp[0][0]=1;
	for(int i=0;i<=n;i++)
	{
		for(int j=!i;j<=k;j++)
		{
			dp[i][j]=((j?dp[i][j-1]:0)+(i<j?0:dp[i-j][j]))%mod;
		}
	}
	cout<<dp[n][k]<<endl;
}



Measured memory_bytes: 11792
#include<bits/stdc++.h>
using namespace std;
int d[5];
int main()
{
    int k , a , b;cin>>k>>a>>b;
    long long ans ;
    if(b - a <= 2) {
        ans = k + 1 ;
    }
    else{
        if(k + 1 < a) {
            ans = k + 1 ;
        }
        else{
            k -= (a - 1) ;ans = a;
            ans += 1LL * (k/2) * (b - a) ;
            if(k & 1) ans++;
        }
    }
    cout<<ans ;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    
    bool flag = true;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] != t[i]) {
            flag = false;
            break;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3584
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

op = ['', '+', '-']

for i in [1, -1]:
    for j in [1, -1]:
        for k in [1, -1]:
            if a + b*i + c*j + d*k == 7:
                print(str(a)+op[i]+str(b)+op[j]+str(c)+op[k]+str(d)+'=7')
                exit(0)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
using namespace std;
int N;
int A[3][3];
int h[3][3];
int b;

void check(int);
bool bingo();
int main()
{
  int n;
  int ret=0;

  for (int i=0; i<3; i++)
    for (int j=0; j<3; j++)
      cin >> A[i][j];

  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> b;
    check(b);
  }

  if (bingo())
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}
void check(int x) {

  for (int i=0; i<3; i++)
    for (int j=0; j<3; j++)
      if (A[i][j] == x) {
        h[i][j] = 1;
        return;
      }
  return;
}
bool bingo() {
  for (int i=0; i<3; i++) {
    if (h[i][0] * h[i][1] * h[i][2] == 1) return true;
  }
  for (int i=0; i<3; i++) {
    if (h[0][i] * h[1][i] * h[2][i] == 1) return true;
  }
  if (h[0][0] * h[1][1] * h[2][2] == 1) return true;
  if (h[0][2] * h[1][1] * h[2][0] == 1) return true;
  
  return false;
}


Measured memory_bytes: 256
#include <iostream>

int main (){
  int H, W;
  std::cin >> H >> W;

  while( H!=0 && W!=0 ){
 //************************************//
    for(int i=0; i<W; i++){
      std::cout << "#";
    }
    std:: cout << std::endl;
 //************************************//
    for(int i=0; i<H-2; i++){
       std::cout << "#" ;
      for(int j=0; j<W-2; j++){
        std::cout << "." ;
      }
      std::cout << "#" << std::endl;
    }
 //************************************//
     for(int i=0; i<W; i++){
      std::cout << "#";
    }
    std:: cout << std::endl;
 //************************************//
    std::cout << std::endl;
    std::cin >> H >> W;
  }

  return 0;
}



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

int main(){
   string s;
   cin >> s;
   ll l=0,r=s.size()-1;
   ll ans=0;
   while (1) {
     if (l>=r) break;
     if (s[l]==s[r]){
            l++;r--;
     }
     else if (s[l]=='x'){
        ans++;
        l++;
     }
     else if (s[r]=='x'){
        ans++;
        r--;
     }
     else {
        ans=-1;
        break;
     }
   }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

const int maxn = 2007;

int f[maxn][maxn];
int g[maxn][maxn];
int Max[maxn];
int Min[maxn];
int a[maxn];
int n;
int z,w;
int main(){
	memset(Max,-0x7f,sizeof Max);
	memset(Min,0x7f,sizeof Min);
	scanf("%d%d%d",&n,&z,&w);
	for(int i = 1; i <= n; ++i)scanf("%d",&a[i]);
	a[0] = w;
	for(int i = 0; i < n; ++i)
		f[n][i] = g[n][i] = Max[i] = Min[i] = abs(a[n] - a[i]);
	for(int i = n - 1; ~i; --i){
		for(int j = 0; j < i; ++j){
			f[i][j] = Min[i],Max[j] = max(Max[j],f[i][j]);
			g[i][j] = Max[i],Min[j] = min(Min[j],g[i][j]);
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; ++i)ans = max(ans,f[i][0]);
	printf("%d\n",ans);
	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    string n;
    cin >> n;

    for (const auto &ele : n)
    {
        if (ele == '7')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<math.h>
int main(void){
  int x1,y1,x2,y2,sum_x,sum_y,l;
  scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
  sum_x=x2-x1;
  sum_y=y2-y1;
  printf("%d ",x2-sum_y);
  printf("%d ",y2+sum_x);
  printf("%d ",x1-sum_y);
  printf("%d",y1+sum_x);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    string s;
    cin >> s;
    if( s == "KIHBR" || s == "KIHBRA" || s == "KIHBAR" || s == "KIHBARA" || s == "KIHABR" || s == "KIHABRA" || s == "KIHABAR" || s == "KIHABARA" || s == "AKIHBR" || s == "AKIHBRA" || s == "AKIHBAR" || s == "AKIHBARA" || s == "AKIHABR" || s == "AKIHABRA" || s == "AKIHABAR" || s == "AKIHABARA"){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

ll modFact(ll n, ll m){
	if(!n){ return 1; }
    static vector<ll> memo = {1, 1};
    if(n < (ll)memo.size()){ return memo[n]; }
    for(int i=memo.size();i<=n;i++){
        memo.push_back(memo.back() * i % m);
    }
    return memo[n];
}

int main(){
    ll n, m;
    cin >> n >> m;
    if(abs(n - m) > 1){
        cout << 0 << '\n';
    }else if(n == m){
        cout << (2 * modFact(n, M) * modFact(m, M) % M) << '\n';
    }else{
        cout << (modFact(n, M) * modFact(m, M) % M) << '\n';
    }
    return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
int main(void){
    // Here your code !
    int Point,SUM=0,i=0,MinS=1000,MinG=1000;
    for(i=0;i<4;i++){
    scanf("%d",&Point);
    if(MinS>Point)MinS=Point;
    SUM+=Point;
    }
    for(i=4;i<6;i++){
    scanf("%d",&Point);
    if(MinG>Point)MinG=Point;
    SUM+=Point;
    }
    //intf("%d",SUM);
 printf("%d\n",SUM-MinS-MinG);
    return 0;
}
 

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

int main()
{
  int n;
  cin >> n;
  
  vector<int> a_times(200001);
  vector<int> a(n);
  int tmp;
  rep(i, n)
  {
    cin >> tmp;
    a.at(i) = tmp;
    a_times.at(--tmp) ++;
  }
  
  int max = *max_element(a.begin(), a.end());
  
  rep(i, n)
  {
    if (a.at(i) < max)
    {
      cout << max << endl;
      continue;
    }
    else if (a_times.at(max - 1) > 1)
    {
      cout << max << endl;
      continue;
    }
    
    for (int j = max - 2; j >= 0; -- j)
    {
      if (a_times.at(j) > 0)
      {
        cout << j + 1 << endl;
        break;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=1e6+7;
typedef long long ll;
const int mod=1e9+7;
int read(){int c = getchar(),Nig = 1,x = 0;while(!isdigit(c))c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()

char s[maxn];
int Sheryang()
{
    string s,str="keyence";
    cin>>s;


    if(s.substr(s.length()-7)==str){
        printf("YES\n");
        return 0;
    }

    for(int i=0;i<s.length()-7;i++){
        if(s.substr(i,i+7)==str){
            printf("YES\n");
            return 0;
        }
    }

    for(int i=1;i<=6;i++){
        string ss=s.substr(0,i)+s.substr(s.length()-7+i);
        if(ss==str){
            printf("YES\n");
            return 0;
        }
    }
    puts("NO");
    return 0;
}


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

int main(){
 string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  string an;
transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
	transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
	transform(s3.begin(), s3.end(), s3.begin(), ::toupper); 
  cout << s1[0] << s2[0] << s3[0]<< endl;
  return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    k: usize,
  	s: String,
  }
  
  let mut ans: String = "".to_string();
  if s.len() <= k {
  	ans = s;
  }
  else {
    ans = (&s[0..k]).to_string();
    ans.push_str("...");
  }
  
  println!("{}", ans);
}

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

using namespace std;
typedef long long int LL;

#define MOD 1000000007
const int MAX = 2000;
LL fac[MAX], finv[MAX], inv[MAX];
 
void Cinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (LL i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

LL C(const LL& n, const LL& r) { 
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main()
{
  LL N, K; cin >> N >> K;
  Cinit();
  for (LL i=1; i <= K; i++) {
    LL ans = C(N-K+1, i) * C(K-1, i-1) % MOD;
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????§??¬?´???°
??????????????¶??° x, y ?????\?????¨???????????????????????§??¬?´???°????±???????????????°????????????????????????????????????

?????????
??´??° x, y ???????????????x ??\ y ????????° x ??¨ y ????????§??¬?´???°??? y ??¨ x % y ????????§??¬?´???°???????????????
????????§ x % y ??? x ??? y ??§?????£???????????§????????????
"""

# ?????????
x,y = list(map(int,input().strip().split()))
if x < y:
    z = x
    x = y
    y = z

while y > 0:
    z = x % y
    if z == 0:
        print(y)
        break
    x = y
    y = z

Measured memory_bytes: 7684
import java.util.Scanner;
class Main{
	public static void main(String artgs[]){
    	int A;
        int B;
        int C;
        Scanner s = new Scanner(System.in);
        A = s.nextInt();
        B = s.nextInt();
        C = s.nextInt();
        if((A < C &&  C < B )||( A > C &&C > B)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }  
}

Measured memory_bytes: 21972
k= int(input())
 
if k % 2 == 0 or k % 5 == 0:
    print("-1")
    
else:
    ans = 1
    s = 7
    while True:
        if s % k == 0:
            print(ans)
            break
        else:
            s = (s % k)*10 + 7
            ans += 1


Measured memory_bytes: 9152
#include <stdio.h>

int main(void){
    int a,b,c;
    int rect=0;
    int dia=0;
    while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
        if(a*a+b*b==c*c){
            rect+=1;
        }
        if(a==b){
            dia+=1;
        }
    }
    printf("%d\n%d\n",rect,dia);
}



Measured memory_bytes: 2044
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    int n;cin >> n;
    cout << max(ketasum(n),(9*(keta(n)-1))+ (int)(n/(pow(10,(keta(n)-1))))-1)<< endl;
    // cout << (n/(pow(10,(keta(n)-1)))) << endl;
    return 0;
}

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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int A;
	int B;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		A = Integer.parseInt(strArr[1]);
		B = Integer.parseInt(strArr[2]);
		// System.out.println(N);
		HP = new int[N];
	}

	public boolean hasNext() {
		return cnt < N;
	}

	int[] HP;

	public void readBody(String str) {
		// System.out.println(str);
		HP[cnt] = Integer.parseInt(str);
		cnt++;
	}

	public void solve() {
		int max = 0;
		for (int s : HP) {
			if (s > max)
				max = s;
		}
		int min = 0;
		max = max / B + 1;
		for (; max - min > 1;) {
			int t = (max - min) / 2 + min;
			if (enough(t))
				max = t;
			else
				min = t;
		}
		System.out.println(max);
	}

	private boolean enough(int t) {
		long cnt = 0;
		for (int h : HP) {
			if (h > B * t) {
				long add = h - B * t;
				cnt += add / (A - B);
				if (add % (A - B) != 0)
					cnt++;
			}
		}
		return cnt <= t;
	}

}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N, K;
bool card[100010];

int main() {
	while(scanf("%d %d", &N, &K), N || K) {
		memset(card, false, sizeof(card));
		bool unknown = false;
		rep(i, K) {
			int c;
			scanf("%d", &c);
			if(c == 0) {
				unknown = true;
				continue;
			}
			card[c] = true;
		}
		bool flag = false;
		int cnt = 0, now, prev = 0, mini = 0;
		int ans = 0;
		FOR(i, 1, N + 1) {
			if(card[i]) {
				if(i == mini + 2) flag = true;
				++cnt;
			}
			else {
				now = cnt;
				if(unknown && flag) {
					ans = max(ans, prev + now + 1);
				}
				else ans = max(ans, now);
				cnt = 0;
				flag = false;
				prev = now;
				mini = i;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3280
#include <iostream>

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

  int tak = (c/b) + (c%b != 0);
  int aok = (a/d) + (a%d != 0);

  if(tak <= aok)
    std::cout << "Yes";
  else
    std::cout << "No";
  
  std::cout << std::endl;
  return 0;
}



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

const int64_t MOD = 998244353;

//Segment Tree改
int INF = -1e9;
int64_t n = 1;

vector<int64_t> value; // ノードの値を持つ配列

void update(int64_t i, int64_t x, int64_t n) { //nは上にあるn(0-indexのはず)
  // i 番目の葉の値を x に変える
  i += n - 1; 
  value[i] = x;
  while (i > 0) {
    i = (i - 1) / 2;
    value[i] = max(value[i * 2 + 1],value[i * 2 + 2]);
  }
}

int64_t query(int64_t a, int64_t b, int64_t k, int64_t l, int64_t r) { //a,b,0,0,n
  if (r <= a || b <= l) return INF; 
  if (a <= l && r <= b)
    return value[k];
  else {
    int64_t c1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
    int64_t c2 = query(a, b, 2 * k + 2, (l + r) / 2, r); 
    return max(c1, c2);
  }
}

void init(int64_t N){
  while(n < N){
    n *=2 ;
  }
  value = vector<int64_t>(2*n - 1, INF);
}

int64_t access(int64_t x, int64_t n){
  return value[x+n-1];
}

int main(){
  int N;
  cin >> N;
  vector<vector<int64_t>> vec(N,vector<int64_t>(2));
  for(int i=0; i<N; i++){
    for(int j=0; j<2; j++){
      cin >> vec[i][j];
    }
  }
  sort(vec.begin(),vec.end());
  
  vector<int64_t> dist(N);
  for(int i=0; i<N; i++){
    dist[i] = vec[i][0];
  }
  
  //Segにはiを動かした時に最大どこまで動くかを記録する
  init(N);
  
  vector<vector<int64_t>> ans(N+1,vector<int64_t>(2));
  //0は存在しない、1は存在する
  ans[N-1][0] = 1;
  ans[N-1][1] = 1;
  ans[N][0] = 1;
  
  for(int i=0; i<N; i++){
    update(i,i,n);
  }
  
  vector<int64_t>::iterator pos;
  int64_t idx;
  
  for(int i=N-2; i>=0; i--){
    int64_t x = vec[i][0];
    int64_t y = vec[i][1];
    pos = lower_bound(dist.begin(),dist.end(),x+y);
    idx = distance(dist.begin(),pos);
    int64_t q = query(i,idx,0,0,n);
    //cout << i << " " << idx << " " << q << endl;
    update(i,access(q,n),n);
    //cout << query(i,idx,0,0,n) << endl;
    ans[i][0] = ans[q+1][0] + ans[q+1][1];
    ans[i][0] %= MOD;
    ans[i][1] = ans[i+1][0] + ans[i+1][1];
    ans[i][1] %= MOD;
  }
  cout << (ans[0][0] + ans[0][1]) %MOD << endl;
}

Measured memory_bytes: 30696
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;



int main(int argc, const char * argv[]) {

  int n;
  cin >> n;

  ll ans = 0;
  
  ll a[n+1], b[n];
  rep(i,n+1) {
    cin >> a[i];
  }
  rep(i,n) {
    cin >> b[i];
  }
  for(int i=n; i>0; --i){
    if ( ((a[i] + a[i-1]) <= b[i-1])  ){
      ans += (a[i] + a[i-1]);
      a[i-1] = 0;
    }else{
      if (a[i] <= b[i-1]){
        ans += a[i];
        // cout << ans << endl;
        b[i-1] -= a[i];
        ans += b[i-1];
        a[i-1] -= b[i-1];
        // cout << b[i-1] << endl;
        // b[i-1] -= a[i-1] - b[i-1];
      }else{
        ans += b[i-1];
        b[i-1] = 0;
      }
    }
  }

  // if (a[0] <= b[0]){
  //   ans += a[0];
  //   ans += a[0] - b[0];
  // }else{
  //   ans += b[0];
  // }


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


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,k;
  cin >> n >> k;
  vector<int32> a(n);
  REP(i,n)cin >> a[i];
  int32 l = 0, r = inf;
  while(r - l > 1){
    int32 m = (l + r) / 2;
    int32 need = 0;
    REP(i,n){
      if(a[i] > m)
        need += a[i] / m;
    }
    // cout << m << " " << need << endl;
    if(need <= k){
      r = m;
    }else{
      l = m;
    }
  }
  ANS(r);
  return 0;
}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
using namespace std;
const int maxn=6e5+10,mod=924844033,G=5;
int n,m,k,t,fac[maxn],inv[maxn],ret[maxn];
long long c[maxn],d[maxn],tmp[maxn],wn[maxn];
vector<int>e[maxn];
int qpow(int x,int y)
{
    int ret=1;
    while(y)
    {
        if(y&1)ret=1LL*ret*x%mod;
        x=1LL*x*x%mod;
        y>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)fac[i]=1LL*i*fac[i-1]%mod;
    inv[maxn-1]=qpow(fac[maxn-1],mod-2);
    for(int i=maxn-2;i>=0;i--)inv[i]=1LL*inv[i+1]*(i+1)%mod;
}
void getwn(int len)
{
    wn[0]=1;
    wn[1]=qpow(G,(mod-1)/len);
    int i;
    for(i=2;i<=len;i++) wn[i]=wn[i-1]*wn[1]%mod;
}
void NTT(long long *a,int len,int on){
    int i;
    long long ni=qpow(len,mod-2);
    for(i=0;i<len;i++){
        int p=0;
        double ce=log(len)/log(2);
        for(int j=0,tp=i;j<ce;j++,tp/=2) p=(p<<1)+(tp%2);
        tmp[p]=a[i];
    }
    for (int m=2;m<=len;m*=2){
        int half=m/2,bei=len/m;
        for(i=0;i<half;i++){
            long long wi=on>0?wn[i*bei]:wn[len-i*bei];
            for(int j=i;j<len;j+=m){
                long long u=tmp[j],v=tmp[j+half]*wi%mod;
                tmp[j]=(u+v)%mod;
                tmp[j+half]=(u-v+mod)%mod;
            }
        }
    }
    if (on==-1)
        for(i=0;i<len;i++) tmp[i]=tmp[i]*ni%mod;
    for(i=0;i<len;i++) a[i]=tmp[i];
}
int dfs(int x,int y=0)
{
    int sz=1;
    for(int i=0;i<e[x].size();i++)
    {
        int z=e[x][i];
        if(z==y)continue;
        sz+=dfs(z,x);
    }
    c[sz]++;c[n-sz]++;
    return sz;
}
int C(int x,int y)
{
    return 1LL*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
    int i,j;
    init();
    scanf("%d",&n);
    for(i=1;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        e[x].push_back(y),
        e[y].push_back(x);
    }
    dfs(1);
    for(i=0;i<=n;i++)
        c[i]=c[i]*fac[i]%mod,
        d[i]=inv[n-i-1];
    int len=1;
    while(len<n*2)len<<=1;
    getwn(len);
    NTT(c,len,1);
    NTT(d,len,1);
    for(i=0;i<len;i++)c[i]=c[i]*d[i]%mod;
    NTT(c,len,-1);
    for(i=n;i<n<<1;i++)
        printf("%d\n",(1LL*C(n,i-n+1)*(n+1)%mod-c[i]*inv[i-n+1]%mod+mod)%mod);
    return 0;
}


Measured memory_bytes: 56832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans;

int main()
{
ll n,k;
cin >> n>>k;
ll t[n] = {};
ll sum=0;
ll nn=0;
rep(i, n)
{
    cin >> t[i];
    sum+=t[i];
    if(t[i]<k)nn++;
}
if(sum<k){
    cout << n<< endl;
    return 0;
}
if(nn==0){
    cout << 0<< endl;
    return 0;
}
sort(t,t+n);
int lower=0,upper=nn;
int seenow=lower,oklowest;
bool ok2butan;
vector<bool> vv(k, false);

vv[0]=true;
rep(i,nn){
    if(i==seenow)continue;
    rep(j,k){
        if(vv[k-1-j]&&k-1-j+t[i]<k){vv[k-1-j+t[i]]=true;
        }
    }
}
ok2butan=false;
for(ll i=k-t[seenow];i<k;i++){
    if(vv[i])ok2butan=true;
}
if(ok2butan){
    cout << 0<< endl;
    return 0;
}

while(true){
seenow=(lower+upper)/2;

//todo:seenowに対して処理
//条件を満たすならok2butan=trueにする
vector<bool> v(k, false);
v[0]=true;
rep(i,nn){
    if(i==seenow)continue;
    rep(j,k){
        if(v[k-1-j]&&k-1-j+t[i]<k){v[k-1-j+t[i]]=true;
        }
    }
}
ok2butan=false;
for(ll i=k-t[seenow];i<k;i++){
    if(v[i])ok2butan=true;
}

if(ok2butan){
    upper=seenow;
    if(upper==lower+1){oklowest=seenow;break;}
    }
else {
    lower=seenow;
    if(upper==lower+1){oklowest=seenow+1;break;}
    }
}
cout << oklowest << endl;
return 0;
}

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

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    while(true){
        C-=B;
        if(C<=0){
            cout<<"Yes"<<endl;
            break;
        }
                A-=D;
        if(A<=0){
            cout<<"No"<<endl;
            break;
        }
    }
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

ll N;
ll A[333333];
ll ruiS[333333];
ll ruiX[333333];

int solve(int i) {
   auto check = [&](ll mid) -> bool {
      // 判定処理を書く
      // 閉区間の方を >=, <= にする
      ll x = ruiX[mid]^ruiX[i-1], sum = ruiS[mid]-ruiS[i-1];
      return x == sum;
   };

   ll l = i; // ok
   ll r = N+1; // ng

   // [l, r)
   while (r - l > 1) { // 答えの整数範囲が1つになるまで繰り返し
      ll mid = (l + r) / 2;
      if (check(mid)) {
         l = mid; // 場合によって異なる
      } else {
         r = mid; // 場合によって異なる
      }
   }

   // debug3(i, l, r)
   // return (r-i+1); // 場合によって異なる
   return (l-i+1); // 場合によって異なる
}

int main() {
   cin >> N;
   rep (i, N) { cin >> A[i]; ruiS[i+1] = A[i]; ruiX[i+1] = A[i]; }
   repp (i, 1, N+1) { ruiX[i] ^= ruiX[i-1]; ruiS[i] += ruiS[i-1]; }

   ll ans = 0;
   for (int i = 1; i <= N; i++) {
      ans += solve(i);
      // for (int j = i; j <= N; j++) {
      //    ll x = ruiX[j]^ruiX[i-1], sum = ruiS[j]-ruiS[i-1];
      //    if (x == sum) {
      //       debug3(i, j, x)
      //       ans++;
      //    }
      // }
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 6528
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ll((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define roF(i,a,b) for(ll i = ll(a); i >= ll(b); i--)
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll N=1e6;

int main(){
	fastio;
	ll a; cin>>a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}



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

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    int d = 0;
    int ans = 0;
    rep(i,n){
        d += l[i];
        if(d > x){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << n+1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

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

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


    return 0;
}

Measured memory_bytes: 256