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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=5000+5,D=1e9+7;
s64 dp[N][N],f[N];
int sz[N];
vector<int>lk[N];

void dfs(int x,int fr)
{
	sz[x]=1;
	dp[x][1]=1;
	for(auto y:lk[x])
	if(y!=fr)
	{
		dfs(y,x);
		int sz0=sz[x]; 
		sz[x]+=sz[y];
		s64 sum=0;
		rep(j,1,sz[y])(sum+=dp[y][j]*f[j])%=D;
		per(i,sz[x],1)
		{
			s64 ans=-dp[x][i]*sum%D;
			rep(j,max(1,i-sz0),min(i,sz[y]))(ans+=dp[x][i-j]*dp[y][j])%=D;
			dp[x][i]=ans;
		}
	}
}

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,1,n-1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		lk[x].push_back(y);lk[y].push_back(x);
	}
	f[0]=1;
	rep(i,2,n)f[i]=f[i-2]*(i-1)%D;
	dfs(1,0);
	s64 ans=0;
	rep(i,1,n)(ans+=dp[1][i]*f[i])%=D;
	cout<<(ans+D)%D;
}

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

using namespace std;

int main(void) {
    int times;
    while (1) {
        cin >> times;
        if (times == 0) {
            break;
        }
        int min = 1e09;
        vector<int> v(times);
        for (int i = 0; i < times; i++) {
            cin >> v[i];
        } 
        sort(v.begin(), v.end());
        for (int i = 0; i < times - 1; i++) {
            if (v[i + 1] - v[i] < min) {
                min = v[i + 1] - v[i];
            }
        } 
        cout << min << endl;
    } 

    return 0;
}

Measured memory_bytes: 3108
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
cnt = 0

for i in range(n):
    a = list(map(int, input().split()))
    tmp = c
    for k in range(m):
        tmp += b[k] * a[k]
    if tmp > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
N = int(input())
L = list(map(int, input().split()))

ans = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a, b, c = sorted([L[i], L[j], L[k]])
            if a != b and b != c and a + b > c:
                ans += 1
print(ans)

Measured memory_bytes: 9196
dic={}
alp_lst=list('abcdefghijklmnopqrstuvwxyz')

for alp in alp_lst:
    dic[alp]=0
try:
    while True:
        sen=input()
        if sen=='':
            break
        sen=sen.lower()
        for i in sen:
            if i in alp_lst:
                dic[i]+=1
except EOFError:
    pass
for i in alp_lst:
    print(i+' : '+str(dic[i]))


Measured memory_bytes: 5564
n,x = gets.split(" ").map(&:to_i)
child = gets.split(" ").map(&:to_i).sort
y = 0
if child.inject(:+) == x
    puts n
else
    for i in 0..n-1 do
        x = x - child[i]
        if (x > 0 && i != n-1)
            y += 1
        elsif x > 0 && i == n-1
            puts y
            break
        elsif x == 0
            puts y + 1
            break
        else
            puts y
            break
        end
    end
end

Measured memory_bytes: 3836
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

int main(){
	int a,b,h;
	scanf("%d %d %d",&a ,&b, &h);

	printf("%d\n",(a+b)*h/2);

	return 0;
}


Measured memory_bytes: 256
# include <stdio.h>

int main ()
{
	int n; 
	int a[10], b[10], c[10] ;
	while(scanf("%d", &n) != EOF)
	{
		while(n --)
		{
			int m = 0 ;
			int k = 0 ;
			int maxn ;
			for(int i = 0; i < 10; i ++)
				scanf("%d", &a[i]) ;
			int f = 0 ;
			maxn = 0 ;
			for(int i = 0; i < 10; i ++)
			{
				if(a[i] > maxn)
				{
					maxn = a[i] ;
					b[m++] = a[i] ;
				}
				else
				{
					if(a[i] > f)
					{
						f = a[i] ;
						c[k++] = a[i] ;
					}					
				}
			}
			if(m + k == 10)
				puts("YES") ;
			else
				puts("NO") ;
		
		}	
	}
	return 0 ;
}

Measured memory_bytes: 1008
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <ccomplex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	vector<int> x(n);
	for (int i = 0; i < n; i++) cin >> x[i];
	int ans = 1e9;
	for (int i = 0; i <= 100; i++) {
		int s = 0;
		for (int j = 0; j < n; j++) {
			s += (x[j] - i)*(x[j] - i);
		}
		ans = min(ans, s);
	}
	cout << ans << endl;
	return 0;
}

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

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

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

int main2() {
  int N; cin >> N;
  vector<string> s(N);
  REP(i, N) cin >> s[i];

  int black = -1;
  REP(i, N) if (count(ALL(s[i]), '#') > 0) black = i;
  if (black == -1) {
    cout << -1 << endl;
    return 0;
  }

  int ans = 1001001001;
  int black_row = false;
  REP(r, N) {
    if (count(ALL(s[r]), '#') == N) black_row = true;
  }
  if (black_row) {
    int val = 0;
    REP(c, N) {
      bool all_black = true;
      REP(r, N) if (s[r][c] == '.') all_black = false;
      if (!all_black) val++;
    }
    chmin(ans, val);
  }
  else
  {
    REP(r, N) {
      int val = 0;

      vector<string> t = s;
      int src = -1;
      REP(i, N) {
        if (s[i][r] == '#') src = i;
      }

      if (src == -1) {
        val++;
        REP(i, N) {
          t[i][r] = s[black][i];
        }
        REP(i, N) {
          if (t[i][r] == '#') src = i;
        }
      }

      string src_row = s[src];

      REP(c, N) {
        if (s[r][c] == '.') {
          val++;
          REP(i, N) {
            t[i][c] = src_row[i];
          }
        }
      }

      REP(c, N) {
        bool all_black = true;
        REP(r, N) if (t[r][c] == '.') all_black = false;
        if (!all_black) val++;
      }

      chmin(ans, val);
    }
  }


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

int main() {

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


Measured memory_bytes: 848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int n;
double sum;
double x[20];
str u[20];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>u[i];
        if(u[i]=="JPY"){sum+=x[i];}
        else{sum+=x[i]*380000;}
    }
    printf("%.4lf\n",sum);
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>>m(h, vector<char>(w));
  vector<vector<char>>copy1(h, vector<char>(w));
  vector<vector<char>>copy2(h, vector<char>(w));
  vector<vector<char>>copy3(h, vector<char>(w));
// mに入力
  for (int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> m.at(i).at(j);
    }
  }
// 特定の行だけ書き換えてコピー
  for (int i=0; i<h; i++){
    bool a=1;
    for(int j=0; j<w; j++){
     if (m.at(i).at(j)=='#') {
       for(int k=0; k<w; k++){
         copy1.at(i).at(k)=m.at(i).at(k);
       }
       a=0;
       break;
     }
      if(a){
        for(int l=0; l<w; l++){
          copy1.at(i).at(l)='x';
        }
      }
    }
  }
//特定の列だけ
   for (int i=0; i<w; i++){
    bool a=1;
    for(int j=0; j<h; j++){
     if (m.at(j).at(i)=='#') {
       for(int k=0; k<h; k++){
         copy2.at(k).at(i)=m.at(k).at(i);
       }
       a=0;
       break;
     }
      if(a){
        for(int l=0; l<h; l++){
          copy2.at(l).at(i)='x';
        }
      }
    }
  }
//まとめ  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if (copy1.at(i).at(j)=='x' || copy2.at(i).at(j)=='x'){
        copy3.at(i).at(j)='x';
      }
      else copy3.at(i).at(j)=m.at(i).at(j);
    }
  }
//出力
for (int i=0; i<h; i++){
  bool b=0;
    for(int j=0; j<w; j++){
      if(copy3.at(i).at(j)!='x'){
       cout << copy3.at(i).at(j);
       b=1;
      }
    }
  if(b)  cout << endl;
  } 

/*  for (int i=0; i<h; i++){
    for(int j=0; j<w; j++){
       cout << copy3.at(i).at(j);
      if (j==w-1) cout << endl;
    }
  }  */
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

static const std::string tle = "TLE";

int64_t solve(int64_t n, int64_t t, std::vector<int64_t> cs,
              std::vector<int64_t> ts) {
  int64_t ret = INT64_MAX;
  for (int i = 0; i < n; ++i) {
    if (ts[i] > t) {
      continue;
    }
    ret = std::min(cs[i], ret);
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t t;
  std::cin >> t;
  std::vector<int64_t> cs(n);
  std::vector<int64_t> ts(n);
  for (int i = 0; i < n; i++) {
    std::cin >> cs[i];
    std::cin >> ts[i];
  }
  auto const res = solve(n, t, std::move(cs), std::move(ts));
  if (res > 1000) {
    std::cout << tle << std::endl;
  } else {
    std::cout << res << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
// ※※※ 解答不能 ※※※
// ecnerwal氏
// https://atcoder.jp/contests/agc040/submissions/8280134
#include<bits/stdc++.h>
using namespace std;
using LL = long long;

const int MAXN = 2.1e5;
int N;
int A[MAXN];
int D[MAXN];

int main(){
    scanf("%d", &N);
    for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
    for(int i = 0; i <= N; i++) D[i] = A[i + 1] - A[i];
    N++;
    int ans = 0;
    // min amount of non-source-flow for ans + cost
    LL v0 = 0, v1 = 0; // v2 is 0
    for(int i = 0; i < N; i++){
        // tot flow is A[i]
        int totFlow = A[i];
        if(D[i] == 0){
            continue;
        }else if(D[i] > 0){
            // automatically adds D[i], pay 1 to not add, pay 2 to make it 0
            LL nv0 = v0 + D[i];
            LL nv1 = min(v0, v1 + D[i]);
            v0 = nv0;
            v1 = nv1;
        }else if(D[i] < 0){
            // pay nothing to charge D[i], pay 1 to decrease non-source-flow, pay 2 to make it 0
            LL v = -D[i];
            LL nv0 = LL(1e18);
            LL nv1 = max(0LL, v0 - v);
            if(totFlow - v1 >= v) nv1 = min(nv1, v1);
            if(totFlow - v0 >= v){
                nv0 = v0;
            }else{
                // not feasible to keep
                ans++;
                nv0 = nv1;
                nv1 = 0;
            }
            v0 = nv0;
            v1 = nv1;
        }else{
            assert(false);
        }
    }
    printf("%d\n", ans);
    return 0;
}
// +1 +1 -1 +1 -1 -1
// +2 -1 +1 -1 +1 -2

Measured memory_bytes: 1920
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



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


string s,t;
cin>>s;
t=s;
//cout<<t;
reverse(s.begin(),s.end());
//cout<<s<<" "<<t;
int cnt=0;
for(int i=0;i<s.size();i++)
{
	if(s[i]!=t[i])
	{
		cnt++;
	}
}


cout<<cnt/2<<endl;







	
	
	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}

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

int n, m;
int a[1000];

int main() {
	int i, cnt = 0;
	
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> a[i];
		if (a[i] > m) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3140
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
	ll r;
	cin >> r;

	if (r < 1200)
	{
		println("ABC");
	}
	else if (r < 2800)
	{
		println("ARC");
	}
	else
	{
		println("AGC");
	}
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#ifdef __APPLE__
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...)
#endif

const int N = (int)1e6 + 123;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;

int a[N];
int cnt[N];
int fact[N];



int add(int a, int b) {
    long long res = a * 1ll + b;
    return (res % MOD + MOD) % MOD;
}

int mul(int a, int b) {
    return (a * 1ll * b) % MOD;
}

int powmod(int a, int n) {
    int res = 1;
    while (n > 0) {
        if (n & 1) {
            res = mul(res, a);
        }
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}

void precalc() {
    fact[1] = fact[0] = 1;
    for (int i = 2; i < N - 1; ++i) {
       fact[i] = mul(fact[i - 1], i);
    }
}

int inv(int n) {
    return powmod(n, MOD - 2);
}

int c(int k, int n) {
    if (k > n) {
        return 0;
    }
    return mul(fact[n], inv(mul(fact[n - k], fact[k])));
}

void solve() {
    int n;
    scanf("%d", &n);
    int vl = -1;
    for (int i = 0; i < n + 1; ++i) {
        scanf("%d", &a[i]);
        ++cnt[a[i]];
        if (cnt[a[i]] == 2) {
            vl = a[i];
        }
    }
    vector<int> pos;
    for (int i = 0; i < n + 1; ++i) {
        if (a[i] == vl) {
            pos.push_back(i);
        }
    }
    int left = pos[0];
    int right = n - pos[1];
    for (int i = 1; i <= n + 1; ++i) {
        int ans = c(i, n + 1);
        if (left + right >= i - 1) {
            ans = add(ans, -c(i - 1, left + right));
        }
        printf("%d\n", ans);
    }
}

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    precalc();
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 11392
package main

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

func solve() {
	s := getRunes()

	ans := ""
	for _, r := range s {
		switch r {
		case '0', '1':
			ans += string(r)
		case 'B':
			if len(ans) != 0 {
				ans = ans[0 : len(ans)-1]
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

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

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

vector<int>g[2333],seq[2333],tmp;
bool use[2333];
int n,a[2333];

void dfs(int x)
{
	use[x]=1;
	for(auto v:g[x])if(!use[v])
	{
		dfs(v);
		tmp.resize(seq[x].size()+seq[v].size());
		merge(seq[x].begin(),seq[x].end(),seq[v].begin(),seq[v].end(),tmp.begin());
		seq[x]=tmp;
	}
	seq[x].resize(seq[x].size()+1);for(int i=seq[x].size()-2;i>=0;i--)seq[x][i+1]=seq[x][i];
	seq[x][0]=-a[x];
}

int main()
{
	get1(n);
	for(int i=1;i<=n;i++)
		get1(a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(i!=j&&__gcd(a[i],a[j])>1)
	{
		g[i].pb(j);
		g[j].pb(i);
	}
	for(int i=1;i<=n;i++)sort(g[i].begin(),g[i].end());
	vector<int> ans;
	for(int i=1;i<=n;i++)
	{
		if(use[i])continue;
		dfs(i);
		tmp.resize(ans.size()+seq[i].size());
		merge(ans.begin(),ans.end(),seq[i].begin(),seq[i].end(),tmp.begin());
		ans=tmp;
	}
	for(auto x:ans)printf("%d ",-x);
	return 0;
}

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

int main() {

    int N, D;
    cin >> N >> D;

    cout << (N + 2*D) / (2*D + 1) << endl;



    return 0;
}

Measured memory_bytes: 3616
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
string s;


int main() {
  cin>>s;
  for(LL i = 0; i< s.size()-8 ; ++i)printf("%c",s[i]);
  cout<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,K; cin>>N>>K;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    int ans=1;
    ans+=(N-K)/(K-1);
    if((N-K)%(K-1)) ans++;

    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define maxn 1<<18|5
#define mod 998244353
#define rep(i,j,k) for(int i=(j),LIM=(k);i<=LIM;i++)
#define per(i,j,k) for(int i=(j),LIM=(k);i>=LIM;i--)
using namespace std;

int n,N;
int a[maxn],b[maxn];

int Pow(int b,int k){ int r=1;for(;k;k>>=1,b=1ll*b*b%mod) if(k&1) r=1ll*r*b%mod; return r; }
void FWT(int *a){
	rep(i,0,n-1) rep(j,0,N-1) if(!(j>>i&1)){
		int v = j ^ (1 << i) , x = (a[j] + a[v]) % mod , y = (a[j] - a[v]) % mod;
		a[j] = x , a[v] = y;
	}
}

int main(){
	scanf("%d",&n);N = 1 << n;int S=0;
	rep(i,0,N-1) scanf("%d",&a[i]),S+=a[i];
	S = Pow(S , mod-2);
	rep(i,0,N-1) a[i] = 1ll * a[i] * S % mod;
	a[0]-- , b[0] = 1 << n;
	rep(i,0,N-1) b[i]--;
	FWT(a),FWT(b);
	rep(i,0,N-1) a[i] = 1ll * Pow(a[i],mod-2) * b[i] % mod;
	FWT(a);int ivN = Pow(N , mod-2);
	rep(i,0,N-1) a[i] = 1ll * a[i] * ivN % mod;
	per(i,N-1,0) a[i] = (a[i] - a[0]) % mod;
	rep(i,0,N-1) printf("%d\n",(a[i]+mod)%mod);
}

Measured memory_bytes: 5820
for(i=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/),j=1;i[0]-j+1;j++){for(a=b=0,k=10;k--;)(l=+i[10*j-k])>a?a=l:l>b?b=l:a=11;console.log(a==11?'NO':'YES')}

Measured memory_bytes: 7644
N,M = map(int,input().split())
x = []
for i in range(M):
    a,b=[int(i) for i in input().split()]
    x.append([a,b])
x = sorted(x, key=lambda x:x[1])
no = 0
ans = 0
for i in range(M):
  a = x[i]
  if (a[0] <= no and a[1] >= no):
    pass
  else:
    no = a[1] -1
    ans += 1
print(ans)

Measured memory_bytes: 22036
# -*- coding: utf-8 -*-
"""
B - YYMM or MMYY
https://atcoder.jp/contests/abc126/tasks/abc126_b

"""
import sys


def solve(S):
    is_YYMM = True
    is_MMYY = True
    first = int(S[:2])
    second = int(S[2:])
    if second > 12:
        is_YYMM = False
    if first > 12:
        is_MMYY = False
    if first == 0:
        is_MMYY = False
    if second == 0:
        is_YYMM = False

    if (not is_YYMM) and (not is_MMYY):
        return 'NA'
    if not is_YYMM:
        return 'MMYY'
    if not is_MMYY:
        return 'YYMM'
    return 'AMBIGUOUS'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
n, t = map(int, input().split())
a = list(map(int, input().split()))
max_a = 0
profit = 0
ans = 0
for i in range(n)[::-1]:
    max_a = max(max_a, a[i])
    tmp_profit = max_a - a[i]
    if tmp_profit > profit:
        profit = tmp_profit
        ans = 1
    elif tmp_profit == profit:
        ans += 1
print(ans)

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

const ll N = 2e6 + 7;

ll n , m , cnt , a;
vector<int>g[N];
ll used[N] , p[N];
string s;
int main(){
    cin >> n >> m;
    for( int i = 0; i < m;i ++ ){
            ll x , y;
        cin >> x >> y;
    g[x].pb(y);
    g[y].pb(x);
    }
    queue<int>q;
    q.push(1);
    p[1] = 1;
    used[1] = 1;
    while( !q.empty() ){
        int v = q.front();
        q.pop();
        for( int i = 0;i < g[v].size();i ++ ){
            int to = g[v][i];
            if( !used[to] ){
                used[to] ++;
                q.push(to);
                p[to] = (v);
            }
        }
    }
    for( int i = 2;i <= n;i ++ ){
        if( !used[i] )
            return cout << "No" , 0;
    }
    cout << "Yes" << endl;
    for( int i = 2;i <= n;i ++ ){
        cout << p[i] << "\n";
    }
}


Measured memory_bytes: 56076
x, y = map(int, input().split())
if x == 1 and y == 1:
    print(100000 * (8 - (x + y)) + 400000)
elif x <= 3 and y <= 3:
    print(100000 * (8 - (x + y)))
elif x <= 3:
    print(100000 * (4 - x))
elif y <= 3:
    print(100000 * (4 - y))
else:
    print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  int march[5];
  memset(march, 0, sizeof(march));
  string ss = "MARCH";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 5; j++) march[j] += ss[j] == s[i][0];
  }
  int cc = 0;
  for (int i = 0; i < 5; i++) cc += march[i] != 0;
  if (cc < 3) {
    cout << 0 << "\n";
    return 0;
  }
  sort(march, march + 5);
  reverse(march, march + 5);
  int res = 0;
  int t[cc];
  memset(t, 0, sizeof(t));
  for (int i = 0; i < 3; i++) t[i] = 1;
  sort(t, t + cc);
  do {
    int tmp = 1;
    for (int i = 0; i < cc; i++) {
      if (t[i]) tmp *= march[i];
    }
    res += tmp;
  } while (next_permutation(t, t + cc));
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 5760
import sys


def det(mat):
  t = 1 / (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0])
  a = t * mat[1][1]
  b = t * -1 * mat[0][1]
  c = t * -1 * mat[1][0]
  d = t * mat[0][0]
  return [[a, b], [c, d]]


for line in sys.stdin:
  try:
    a, b, c, d, e, f = [int(i) for i in line.split()]
    A = [[a, b], [d, e]]
    P = [c, f]
    detA = det(A)
    print("%.3lf %.3lf" % (detA[0][0] * P[0] + detA[0][1] * P[1], detA[1][0] * P[0] + detA[1][1] * P[1]))
  except:
    break

Measured memory_bytes: 5624
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main(){
	int r, c;
	cin >> r >> c;
	vector<vector<int>> v(r, vector<int>(c));
	for(auto &vv:v) for(auto &a:vv) cin >> a;
	for(auto &vv:v) vv.emplace_back(accumulate(vv.begin(), vv.end(), 0));
	vector<int> puni(c + 1);
	for(int i = 0; i < c; i++) for(int j = 0; j < r; j++) puni[i] += v[j][i];
	for(int i = 0; i < c; i++) puni[c] += puni[i];
	v.emplace_back(puni);
	for(int i = 0; i < r + 1; i++){
		for(int j = 0; j < c + 1; j++){
			if(j) cout << ' ';
			cout << v[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 19930726;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
inline int in() { char ch = getchar();int x = 0, f = 1;while (ch<'0' || ch>'9') { if (ch == '-')f = -1;ch = getchar(); }while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0';ch = getchar(); }return x * f; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 4;

int main()
{
	//freopen("in.txt", "r", stdin);
	string s, t;
	while (cin >> s >> t)
	{
		int gp = (int)s.size();
		gp -= (int)t.size();
		int len = t.size();
		int mi = 2e9;
		f(i, 0, gp)
		{
			int dif = 0;
			f(j, 0, (int)t.size() - 1)
			{
				if (s[i + j] != t[j])dif++;
			}
			mi = min(mi, dif);
		}
		cout << mi << endl;
	}
	return 0;
}

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

int main(){
    int a, b;
    
    /* forループを用いた場合の解法
    cin >> a >> b;
    for(int i = 0 ; a != 0 && b != 0 ; i++){
        //もしaの方が大きかったら交換
        if(a > b){
          int t;
          t = a;
          a = b;
          b = t;
        }
        
        cout << a << " " << b << endl;
        
      cin >> a >> b;
    }
    */
    
    while(cin >> a >> b){
      //もしaもbも0だったらwhileループを脱出する
      if(a == 0 && b == 0){
        break;
      }
        
      //もしaの方が大きかったら交換
      if(a > b){
        int t;
        t = a;
        a = b;
        b = t;
      }
        
      cout << a << " " << b << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
N = int(input())

lst = [ int(i) for i in input().split() ]

lstr = [ str(c) for c in lst ]
print(" ".join(lstr))

for i in range(1, N):
  v = lst[i]
  j = i - 1
  while 0 <= j and v < lst[j]:
    lst[j + 1] = lst[j]
    j -= 1
  
  lst[j + 1] = v

  lstr = [ str(c) for c in lst]
  print(" ".join(lstr))


Measured memory_bytes: 5608
s = input()

tmp_index = 0

while(len(s) - tmp_index > 4) :

	if( s[tmp_index] == 'd' ) :
		if s[tmp_index:tmp_index+7] == 'dreamer' :
			if ( s[tmp_index + 5:tmp_index + 10] == 'erase' ):
				tmp_index += 5
			else :
				tmp_index += 7
		elif s[tmp_index:tmp_index+5] == 'dream' :
			tmp_index += 5
		else :
			tmp_index = len(s) - 1
			
	elif( s[tmp_index] == 'e' ) :
		if  s[tmp_index:tmp_index + 6] == 'eraser' :
			tmp_index += 6
		elif s[tmp_index:tmp_index+5] == 'erase' :
			tmp_index += 5
		else :
			tmp_index = len(s) - 1
	else :
		tmp_index = len(s) - 1
	if len(s) == tmp_index :
		print('YES')
	elif len(s) - tmp_index < 5 :
		print('NO')

Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a); (i)<=(b); (i)++)
#define REP(i,N) FOR((i), 0, (N)-1)
int gcd(int a, int b){if(a>b) swap(a,b); return a==0 ? b : gcd(b%a,a);}

int main(){
    int a=0,b=0;
    string s;
    cin >> s;
    REP(i,s.size()){
        if(s[i] == i%2 + '0') a++;
        else b++;
    }
    cout << min(a,b);
    return 0;
}

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

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


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


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




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





signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	if (n == 0) {
		cout << 0 << endl; return 0;
	}
	int i = 1;
	string s = "";
	while (n != 0) {
		if (n % (i * (-2)) != 0) {
			n -= i; s += '1';
		}
		else s += '0';
		i *= (-2);
	}
	reverse(ALL(s));
	cout << s << endl;
	return 0;
}

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

int n;
long long int a[300000];
long long int sM[100001], sm[100001];

int main(void){
  cin >> n;
  for(int i = 0; i < 3 * n; i++){
    cin >> a[i];
  }
  priority_queue<long long int, vector<long long int>, greater<long long int> > l;
  priority_queue<long long int> u;
  for(int i = 0; i < n; i++){
    l.push(a[i]);
    sM[0] += a[i];
    u.push(a[3 * n - i - 1]);
    sm[n] += a[3 * n - i - 1];
  }
  for(int i = 0; i < n; i++){
    l.push(a[i + n]);
    sM[i + 1] = sM[i] + a[i + n] - l.top();
    l.pop();
    u.push(a[2 * n - i - 1]);
    sm[n - i - 1] = sm[n - i] + a[2 * n - i - 1] - u.top();
    u.pop();
  }
  long long int ans = sM[0] - sm[n - 1];
  for(int i = 0; i <= n; i++){
    ans = max(ans, sM[i] - sm[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 5996
#include<bits/stdc++.h>
using namespace std;
//int nums(int a,int b,int n){
	//if(n<1||a>b)	return 0;
	//if(a==b||n==2) return 1;
	//return nums(a,b-1,n-1)+nums(a+1,b,n-1)+nums(a+1,b-1,n-2);
//} 
int main(){
	int N,A,B,num;
	scanf("%d %d %d",&N,&A,&B);
	//printf("%d\n",nums(A,B,N));
	if(N==1){
		if(A==B)	printf("1\n");
		else 	printf("0\n");
	}
	else{
		if(A>B)	printf("0\n");
		else	printf("%lld\n",(long long)(B-A)*(N-2)+1);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    double r,area,cir;
    cin >> r;
    
    cir = r * 2 * M_PI;
    area = M_PI * pow(r,2);

    cout << fixed << setprecision(6) << area << " " << cir << endl;
    return 0;
    
    
    
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (U == S)
    cout << A - 1 << " " << B << endl;
  else if (U == T)
    cout << A << " " << B - 1 << endl;
}
  

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char s[19];
	int i,a,b;
	for(i=0;i<9;++i)
		scanf("%s%d%d",s,&a,&b),printf("%s %d %d\n",s,a+b,a*200+b*300);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <map>
#include <vector>
using namespace std;

int a[100001];
int N;
map<int, int> m;

int main() {
	scanf("%d", &N);

	for (int i = 0; i < N; ++i) {
		scanf("%d", a + i);
		m[a[i]]++;
	}

	int res = 0;

	for (auto i : m) {
		if (i.second > i.first) res += i.second - i.first;
		else if (i.second < i.first) res += i.second;
	}

	cout << res;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define fr(i,n) for(lli i=0;i<n;++i)
#define rep(i,a,b) for(lli i=a;i<=b;++i)
#define per(i,a,b) for(lli i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b))) 
#define sz(x) (lli)(x).size()
#define endl '\n'
typedef long long lli;        typedef long double ld;
typedef pair<lli,lli> ii;     typedef vector<lli> vi;
typedef vector<ii> vii;       typedef vector<vi> graph;
long long MOD=1000000007;     long double EPS=1e-9;
#define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
lli binpow(lli b,lli p,lli mod){lli ans=1;b%=mod;for(;p;p>>=1){if(p&1)ans=ans*b%mod;b=b*b%mod;}return ans;}

void pre(){

}
lli knap[100+1][100000+1];
void solve(){
	lli N,W;
	cin>>N>>W;
	lli w[N],v[N];
	fr(i,N){
		cin>>w[i]>>v[i];
	}
	rep(i,0,N)rep(j,0,W){
		knap[i][j]=-MOD*MOD;
	}
	knap[0][0]=0;
	fr(i,N){
		rep(j,0,W){
			if(knap[i][j]>=-MOD*MOD){
				remax(knap[i+1][j],knap[i][j]);
				if(j+w[i]<=W){
					remax(knap[i+1][j+w[i]],knap[i][j]+v[i]);
				}
			}
		}
	}
	lli ans=0;
	rep(j,0,W){
		remax(ans,knap[N][j]);
	}
	cout<<ans<<endl;
}	

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);
	pre();lli t=1;//cin>>t;
	for(lli i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}

Measured memory_bytes: 79232
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAXN 100010
const int INF = 0x3F3F3F3F;
int n, head[MAXN], to[MAXN << 1], next[MAXN << 1], tot = 0;
inline void $(int u, int v) {
	next[tot] = head[u], to[tot] = v, head[u] = tot++;
	next[tot] = head[v], to[tot] = u, head[v] = tot++;
}
int d[MAXN], c[MAXN], b[MAXN];
void pre(int x, int fa) {
	b[x] = c[x];
	for (int i = head[x]; ~i; i = next[i]) {
		if (to[i] == fa) continue;
		pre(to[i], x);
		if (!b[to[i]]) d[x]++, d[to[i]]++;
		b[x] &= b[to[i]];
	}
}
int f[MAXN][2], all, max, root;
void dp(int x, int fa) {
	int g = ((d[x] + c[x]) & 1) ? 0 : 2;
	all += d[x] + (g >> 1);
	int now0 = 0, now1 = 0, flag = 0;
	for (int i = head[x]; ~i; i = next[i]) {
		if (to[i] == fa || b[to[i]]) continue;
		flag = 1;
		dp(to[i], x);
		max = std::max(max, f[to[i]][0] + now1 + g);
		max = std::max(max, f[to[i]][1] + now0 + g);
		now0 = std::max(now0, f[to[i]][0]);
		now1 = std::max(now1, f[to[i]][1]);
	}
	f[x][0] = now0 + g;
	if (flag) f[x][1] = now1 + g;
}
char buf[MAXN];
int main() {
	memset(head, -1, sizeof(head));
	scanf("%d", &n);
	for (int i = 1, u, v; i < n; i++) scanf("%d%d", &u, &v), $(u, v);
	for (int i = (scanf("%s", buf + 1), 1); i <= n; i++)
		if (!(c[i] = (buf[i] == 'B'))) root = i;
	if (!root) return puts("0"), 0;
	memset(f, 0x80, sizeof(f));
	pre(root, 0);
	dp(root, 0);
	printf("%d\n", all - max);
	return 0;
}

Measured memory_bytes: 12032
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->arrayIn();
		
		$a = $s[0];
		$b = $s[1];

		if(8 < $a ||
		   8 < $b){
			echo ":(\n";
		}else{
			echo "Yay!\n";
		}
	}
}
?>


Measured memory_bytes: 4728
import java.util.*;

public class Main {

    public static void main(String[] args)
    {
        //変数
        int count=0;
        boolean sw=false;
        int max=Integer.MIN_VALUE;
        int min=Integer.MAX_VALUE;
        int answer=0;
        int tmp=0;
        List<Integer> list1=new ArrayList<>();
        int array1[]=new int[5];
        int flag=0;
        String s1="";
        String s2="";
        //入力
        Scanner sc=new Scanner(System.in);
        String S=sc.next();
        //処理
        int slength=S.length();
        for(int i=1;i<slength;i++)
        {
            s1=S.substring(i,i+1);
            s2=S.substring(i-1,i);
            if(s1.equals(s2))
            {
                if(flag==0)
                {
                    count++;
                    flag=1;
                }else//flag==1
                {
                    flag=0;
                }
            }else
            {
                if(flag==1)
                {
                    count++;
                }
            }
        }
        answer=count;
        //Collections.sort(a);
        //System.out.println(Arrays.toString(a.toArray()));
        //System.out.println(Arrays.toString(array1));
		//System.out.println(Arrays.deepToString(a));
        System.out.println(answer);
    }
}

Measured memory_bytes: 36808
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

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

int main(void){
  long long int cam;
  while(cin>>cam){
    
    if(cam%39==0){
      cout<<"3C39";
    }else{
      cout<<"3C";
      if(cam%39<=10)
	cout<<"0"<<cam%39;
      else 
	cout<<cam%39;
    }    
    cout<<endl;
  }
}

Measured memory_bytes: 1156
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	char c; cin>>c;
	if(c=='A') cout<<'T';
	else if(c=='T') cout<<'A';
	else if(c=='G') cout<<'C';
	else cout<<'G';
	return 0;
}



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


int main() {
    string n;
    cin>>n;
    long long sum=0;
    for(int i=0;i<n.length();i++){
        sum+=(n.at(i)-48);
    }
    if(sum%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
   
    
    
    
    return 0;
}



Measured memory_bytes: 3740
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;

int divs(int N){
    int cnt= 0 ;
    for(int i=1;i<=sqrt(N);i++){
        if(N%i==0){
            cnt++ ;
            if(i!=(N/i)) cnt++ ;
        }
    }
    return cnt ;
}
int main() {
    
    int N;
    cin >> N ;
    int cnt =0 ;
    for(int i=1;i<=N;i+=2)
        if(divs(i)==8) cnt++ ;
    
    cout<<cnt<<endl;
    
    return 0 ;
    
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int a,b;
  cin>>a>>b;
  if(b>=a)cout<<a<<endl;
  else cout<<a-1<<endl;
}

Measured memory_bytes: 384
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#define rep(i,x,y) for(register int i=(x);i<=(y);++i)
#define dwn(i,x,y) for(register int i=(x);i>=(y);--i)
#define view(u,k) for(int k=fir[u];~k;k=nxt[k])
#define maxn 2000007
using namespace std;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-')f=-1,ch=getchar();
    while(isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
    return x*f;
}
void write(int x)
{
    if(x==0){putchar('0'),putchar('\n');return;}
    int f=0;char ch[20];
    if(x<0)putchar('-'),x=-x;
    while(x)ch[++f]=x%10+'0',x/=10;
    while(f)putchar(ch[f--]);
    putchar('\n');
    return;
}
int n,a[maxn],b[maxn],c[maxn],l=2147483647,r=0,ans=0;
int check(int x)
{
	rep(i,1,2*n-1)b[i]=(a[i]>=x)?1:0;
	c[1]=(b[1]==b[2])?1:0,c[2*n-1]=(b[2*n-1]==b[2*n-2])?1:0;
	rep(i,2,2*n-2){if(b[i]==b[i-1]||b[i]==b[i+1])c[i]=1;else c[i]=0;}
//	cout<<"b:";rep(i,1,2*n-1)cout<<b[i]<<" ";cout<<endl;
//	cout<<"c:";rep(i,1,2*n-1)cout<<c[i]<<" ";cout<<endl;
	if(c[n])return b[n];
	int L,R;L=R=n;
	while(!c[L]&&L>1)L--;while(!c[R]&&R<2*n-1)R++;
//	cout<<"L:"<<L<<" R:"<<R<<" CL:"<<c[L]<<" CR:"<<c[R]<<endl;
	if(c[L]&&c[R])
	{
		if(b[L]==b[R])return b[L];
		int pos=(n-L)<(R-n)?L:R;
		return b[pos];
	}
	else if(c[L]||c[R]){return (c[L]&b[L])|(c[R]&b[R]);}
	else return (n&1)^b[n]^1;
}
int main()
{
	//freopen("10.in","r",stdin);
    n=read();
    rep(i,1,2*n-1)a[i]=read(),l=min(a[i],l),r=max(a[i],r);
    while(l<=r)
    {
    	int mid=(l+r)/2,f=check(mid);
    //	cout<<"mid:"<<mid<<" f:"<<f<<endl;
    	if(f)ans=max(ans,mid),l=mid+1;
    	else r=mid-1;
    }
    write(ans);
	return 0;
}
/*
4
1 6 3 7 4 5 2
*/

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

int main() {
    long long K;
    string S;
    cin >> K >> S;
    if (S.length() <= K) {
        cout << S << endl;
    } else {
        cout << S.substr(0, K) + "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
    int i, hand[6]={};
    
    while(1){
    int x[4]={0, 0, 0, 0};
    for(i=1; i<=5; i++){
        scanf("%d", &hand[i]);
        if(hand[i] == 1) x[1]=1;  //グー
        else if(hand[i] == 2) x[2]=1; //チョキ
        else if(hand[i] == 3) x[3]=1; //パー
        else return 0;
    }
    
    if(x[1] == 1){ //グーが出た
        if(x[2] == 1){ //チョキが出た
            if(x[3] == 1){ //パーが出た
                //あいこ
                for(i=1; i<=5; i++){
                    printf("3\n");
                }
            }
            else{   //グーとチョキだけ
                for(i=1; i<=5; i++){
                    if(hand[i] == 1) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                    }
            }
        }
        else{ //チョキは出ない
            if(x[3] == 1){ //グーとパーだけ
                for(i=1; i<=5; i++){
                    if(hand[i] == 3) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                }
            }
            else{ //パーも出ない＝グーだけ
                for(i=1; i<=5; i++){
                    printf("3\n"); //あいこ
                }
            }
        }
    }
    else{ //グーは出ない
        if(x[2] == 1){ //チョキが出た
            if(x[3] == 1){ //パーが出た
                for(i=1; i<=5; i++){
                    if(hand[i] == 2) printf("1\n"); //勝ち
                    else printf("2\n"); //負け
                }
            }
            else{ // パーが出ない＝チョキだけ
                for(i=1; i<=5; i++){
                     printf("3\n"); //あいこ
                }
            }
        }
        else{ //チョキもでない＝パーだけ
            for(i=1; i<=5; i++){
                 printf("3\n"); //あいこ
            }
        }
    }
    }
    return 0;
}



Measured memory_bytes: 2020