akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    LL K;cin >> K;

    int ans = -1;

    LL tmp = 0;
    rep(i,3000000){
        tmp *= 10;
        tmp += 7;
        if(tmp % K == 0){
            ans = i+1;
            break;
        }
        tmp %= K;
    }

    cout << ans << endl;

}

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

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

  int count = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == '1') {
      count++;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"os"
	"strings"
	"sync"
)

const scBufSize = 1 * 1024 * 1024 // 1MB

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, scBufSize), scBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}()
var w = []string{"dream", "dreamer", "erase", "eraser"}

var done = make(chan interface{}, 1)
var wg = &sync.WaitGroup{}

func main() {
	s := scans()

	go func() {
		for {
		}
	}()

	wg.Add(1)
	go check(done, s)
	wg.Wait()
	select {
	case <-done:
		os.Stdout.WriteString("YES")
	default:
		os.Stdout.WriteString("NO")
	}

}

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

func check(done chan<- interface{}, s string) {
	defer wg.Done()
	for _, v := range w {
		if v == s {
			done <- struct{}{}
			return
		}
		if strings.HasPrefix(s, v) {
			wg.Add(1)
			go check(done, s[len(v):])
		}
	}
}


Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 100;
char a[N][N];
const int d[8][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1},
                     {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (a[i][j] != '.') continue;
      int cnt = 0;
      for (int k = 0; k < 8; ++k) {
        int x = i + d[k][0];
        int y = j + d[k][1];
        if (x < 0 || x >= n || y < 0 || y >= m) continue;
        if (a[x][y] == '#') ++cnt;
      }
      a[i][j] = (char)('0' + cnt);
    }
  }
  for (int i = 0; i < n; ++i) {
    puts(a[i]);
  }
  return 0;
}


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

int main() {
  int q; cin>>q;
  int m=1e5+5;
  vector<int> p(m,1);
  for(int i=2;i<m;i++){
    if(p[i]){
      for(int j=i*2;j<m;j+=i) p[j]=0;
    }
  }
  
  vector<int> a(m,0);
  for(int i=3;i<m;i+=2){
    if(p[i]&&p[(i+1)/2]) a[i]++;
  }
  
  vector<int> s(m+1,0);
  for(int i=0;i<m;i++){
    s[i+1]=s[i]+a[i];
  }
  
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    r++;
    cout<<s[r]-s[l]<<endl;
  }
}
  

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

using namespace std;

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

int main(){
  int h,w,res = -1;
  cin >> h >> w;
  vector<string> v(h);
  queue<pair<int,int>> que;
  for(int i = 0;i < h;i++)cin >> v[i];
  for(int y1 = 0;y1 < h;y1++){
    for(int x1 = 0;x1 < w;x1++){
      for(int y2 = 0;y2 < h;y2++){
        for(int x2 = 0;x2 < w;x2++){
          if(v[y1][x1] == '#' || v[y2][x2] == '#')continue;
          memset(dist,-1,sizeof(dist));
          dist[y1][x1] = 0;
          que.push({y1,x1});
          while(!que.empty()){
            pair<int,int> ov = que.front();que.pop();
            for(int i = 0;i < 4;i++){
              pair<int,int> nv = {ov.first+dy[i],ov.second+dx[i]};
              if(nv.first < 0 || nv.first >= h || nv.second < 0 || nv.second >= w)continue;
              if(v[nv.first][nv.second] == '#')continue;
              if(dist[nv.first][nv.second] != -1)continue;
              dist[nv.first][nv.second] = dist[ov.first][ov.second] + 1;
              que.push(nv);
            }
          }
          res = max(res,dist[y2][x2]);
        }
      }
    }
  }
  cout << res;
  return 0;
}

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

const ll INF = 1e18;

int main(){
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--; t--;
  vector<vector<P>> G1(n), G2(n);
  rep(i,m) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--; v--;
    G1[u].push_back({v,a});
    G1[v].push_back({u,a});
    G2[u].push_back({v,b});
    G2[v].push_back({u,b});
  }

  auto dijkstra = [&](int s, vector<vector<P>> &G) {
    vector<ll> d(n,INF);
    priority_queue<pair<ll, int>, vector<pair<ll,int>>, greater<pair<ll,int>>> pq;
    d[s] = 0;
    pq.push({0,s});

    while (!pq.empty()) {
      auto p = pq.top(); pq.pop();
      ll cost = p.first;
      int u = p.second;
      if (d[u] < cost) continue;
      for (auto v : G[u]) {
        if (d[u] + v.second < d[v.first]) {
          d[v.first] = d[u] + v.second;
          pq.push({d[v.first], v.first});
        }
      }
    }
    return d;
  };

  auto d1 = dijkstra(s,G1);
  auto d2 = dijkstra(t,G2);
  vector<ll> res;
  ll tmp = 1e18;
  for (int i = n-1; i >= 0; i--) {
    res.push_back(min(tmp, d1[i] + d2[i]));
    tmp = res.back();
  }
  for (int i = n-1; i >= 0; i--) {
    cout << 1000000000000000 - res[i] << endl;
  }
  return 0;
} 

Measured memory_bytes: 17144
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <cstdio>
using namespace std;
typedef complex<double> P;

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

double getArea(const vector<P> &g) {
  double res = 0.0;
  for(int i = 0; i < g.size(); ++i) {
    res += cross(g[i], g[(i+1)%g.size()]);
  }
  return res / 2.0;
}

int main() {
  int n;
  while(cin >> n && n) {
    vector<P> ps;
    for(int i = 0; i < n; ++i) {
      P p;
      cin >> p.real() >> p.imag();
      ps.push_back(p);
    }
    reverse(ps.begin(), ps.end());
    static int tc = 0;
    printf("%d %.1f\n", ++tc, getArea(ps));
  }
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rrep1(i,x,n) for(int i=((int)(x)-1);i>=(n);i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
//typedef pair<int,int> P;

//少数点表示
//cout << std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );

    string s;
    cin >> s;
    vector<int> a(s.size()+1,0);
    rep(i,s.size()){
        if(s[i] == '<'){
            a[i+1] = max(a[i+1],a[i] + 1); 
        } 
    }
    rrep(i,s.size()){
        if(s[i] == '>'){
           a[i] = max(a[i],a[i+1] + 1);
        }
    }
    ll cnt=0;
    rep(i,s.size()+1){
        //cout << a[i] << " ";
        cnt+=a[i];
    }
    cout << cnt;

}

Measured memory_bytes: 2844
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <deque>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#define pi acos(-1)

const int maxn = 1000000 + 5;

int main()
{
    int len;
    string s;

    cin >> len >> s;

    int _max = -maxn;

    for (int i = 1; i <= len; i++)
    {
        string l, r;
        int cnt = 0;

        for (int j = 0; j < i; j++)
            l += s[j];

        for (int k = i; k < len; k++)
            r += s[k];

        for (int o = 0; o < 26; o++)
            if (l.find('a' + o) != -1 && r.find('a' + o) != -1)
                cnt++;

        if (cnt > _max)
            _max = cnt;
    }

    cout << _max << endl;

    return 0;
}


Measured memory_bytes: 256
(defun safe-aref (array discript err)
  (if (not (minusp discript))
      (aref array discript)
      err))
(let* ((x (read))
       (arr (make-array (1+ x) :element-type 'bit :initial-element 0)))
  (setf (aref arr 0) 1)
  (loop :for k :from 0 :upto x :do(cond ((= (safe-aref arr (- k 100) 0) 1) (setf (aref arr k) 1))
                                        ((= (safe-aref arr (- k 101) 0) 1) (setf (aref arr k) 1))
                                        ((= (safe-aref arr (- k 102) 0) 1) (setf (aref arr k) 1))
                                        ((= (safe-aref arr (- k 103) 0) 1) (setf (aref arr k) 1))
                                        ((= (safe-aref arr (- k 104) 0) 1) (setf (aref arr k) 1))
                                        ((= (safe-aref arr (- k 105) 0) 1) (setf (aref arr k) 1))
                                        (t nil)))
  (princ (aref arr x)))


Measured memory_bytes: 6504
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <queue>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	for(int h, w; cin >> w >> h, w | h;){
		VVI table(h, VI(w));
		PII goal;
		REP(i, h){
			string line;
			cin >> line;
			REP(j, w){
				char letter = line[j];
				int value = 0;
				if(letter == '@'){
					goal = MP(i, j);
					value = -1;
				}else if(letter == '#'){
					value = -1;
				}
				table[i][j] = value;
			}
		}
		queue<PII> q;
		q.push(goal);
		int total = 1;
		while(!q.empty()){
			PII p = q.front();
			q.pop();
			int x = p.second, y = p.first;
			int cv = table[y][x];
			REP(i, 4){
				int dx = x + DX[i];
				int dy = y + DY[i];
				if(0 <= dx && dx < w &&
					0 <= dy && dy < h &&
					table[dy][dx] == 0){
					total++;
					table[dy][dx] = 1;
					q.push(MP(dy, dx));
				}
			}
		}

		cout << total << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
n = int(input())
a0 = list(map(int, input().strip().split()))
a1 = list(map(int, input().strip().split()))

for i in range(1,n):
  a0[i] += a0[i-1]
  a1[n-1-i] += a1[n-i]

print(max(a0[i]+a1[i] for i in range(n)))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 505;
const int M = N * N;
int n;
int a[N][N];
pii ord[M];
int dist[N][N];
pii q[M];
int L, R;
bool inQ[N][N];
const int DX[] = {-1, 1, 0, 0};
const int DY[] = {0, 0, -1, 1};

bool checkCell(int x, int y) {
	return min(x, y) >= 0 && max(x, y) < n + 2;
}

void addBack(int x, int y) {
	if (inQ[x][y]) return;
	inQ[x][y] = 1;
	q[R++] = mp(x, y);
	if (R == M) R = 0;
}
void addFront(int x, int y) {
	if (inQ[x][y]) return;
	inQ[x][y] = 1;
	if (L == 0) L = M;
	L--;
	q[L] = mp(x, y);
}

void BFS(int x, int y) {
	//eprintf("BFS %d %d\n", x, y);
	L = R = 0;
	addBack(x, y);
	while(L != R) {
		x = q[L].first;
		y = q[L].second;
		inQ[x][y] = false;
		L++;
		if (L == M) L = 0;
		for (int j = 0; j < 4; j++) {
			int xx = x + DX[j], yy = y + DY[j];
			if (!checkCell(xx, yy)) continue;
			//eprintf("%d %d\n", xx, yy);
			int w = dist[x][y] + a[xx][yy];
			if (dist[xx][yy] <= w) continue;
			dist[xx][yy] = w;
			if (a[xx][yy] == 0)
				addFront(xx, yy);
			else
				addBack(xx, yy);
		}
	}
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n * n; i++) {
		int v;
		scanf("%d", &v);
		v--;
		int x = v / n + 1, y = v % n + 1;
		ord[i] = mp(x, y);
		a[x][y] = 1;
	}
	for (int x = 0; x < n + 2; x++)
		for (int y = 0; y < n + 2; y++)
			dist[x][y] = N;
	dist[0][0] = 0;
	BFS(0, 0);
	int ans = 0;
	for (int i = 0; i < n * n; i++) {
		int x = ord[i].first, y = ord[i].second;
		a[x][y] = 0;
		dist[x][y]--;
		ans += dist[x][y];
		BFS(x, y);
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 9336
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,W+1):
        if j < wv[i-1][0]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],  wv[i-1][1] + dp[i-1][j - wv[i-1][0]])
        
print(dp[-1][-1])

Measured memory_bytes: 120172
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int N,M,Q;
  cin>>N>>M>>Q;
  VI A(Q),B(Q),C(Q),D(Q);
  rep(i,Q) cin>>A[i]>>B[i]>>C[i]>>D[i];
  VVL X(N+1,VL());
  rep(i,M) X[0].pb(i);
  rep(i,N){
    rep(j,X[i].size()){
      ll tmp=X[i][j];
      ll iti=X[i][j]%10;
      rep(k,M){
        if(k>=iti) X[i+1].pb(tmp*10+k);
      }
    }
  }
  ll ans2=0;
  rep(k,X[N-1].size()){
    VL Y(N);
    ll tmp=X[N-1][k];
    rep(i,N){
      Y[N-1-i]=tmp%10;
      tmp/=10;
    }
    ll ans=0;
    rep(i,Q){
      if(Y[B[i]-1]-Y[A[i]-1]==C[i]) ans+=D[i];
    }
    ans2=max(ans2,ans);
  }
  cout<<ans2<<endl;
}


Measured memory_bytes: 7744
#include<iostream>
#include<stdio.h>
#include<set>
#include<map>
#include<utility>
#include<math.h>
#include<iomanip>
#include<string>
#include<vector>
using namespace std ;
using ll = long long ;
using vll = vector<ll> ;
using vi = vector<int> ;
using ld = long double ;
using pii = pair<int,int> ;

int main(){
	int n,m ;
	cin >> n >> m ;
	vi num(n,-1) ;
	for(int i=0;i<m;i++){
		int s,c ;
		cin >> s >> c ;
		if(s==1&&c==0&&n!=1){
			cout << -1 << endl ;
			return 0 ;
		}
		if(num.at(s-1)==-1) num.at(s-1) = c ;
		else{
			if(num.at(s-1)!=c){
				cout << -1 << endl ;
				return 0 ;
			}
		}
	}
	if(n==1){
        if(num.at(0)==-1) num.at(0) = 0 ;
        cout << num.at(0) << endl ;
    }
	else{
		if(num.at(0)==-1) num.at(0) = 1 ;
		for(int i=0;i<n;i++){
			if(num.at(i)==-1) num.at(i) = 0 ;
			cout << num.at(i) ;
		}
		cout << endl ;
	}
}


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

int main() {
  string str;
  cin >> str;
  int q;
  cin >> q;
  rep(i, q) {
    string s;
    int a, b;
    cin >> s >> a >> b;
    if (s == "replace") {
      string t;
      cin >> t;
      str = str.replace(a, b - a + 1, t);
      //cout << "replace:" << str << endl;
    }
    if (s == "reverse") {
      reverse(str.begin() + a, str.begin() + b + 1);
      //cout << "reverse:"<< str << endl;
    }
    if (s == "print") {
      cout << str.substr(a, b - a + 1) << endl;
    }
  }
}

/*

abcdefghij
abc gfedh ij

abc edfgh ij

*/


Measured memory_bytes: 3208
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;

const int N = 1e5 + 20;
int n, ans;
int x[N], y[N], C[N];
vector <int> g[N];

void dfs (int v, int par = -1, int col = -1)
{
	int cur = 0;
	for (int i : g[v])
	{
		int u = x[i] ^ y[i] ^ v;
		if (u == par) continue;

		if (cur == col) cur++;

		C[i] = cur;
		ans = max(ans, cur + 1);
	
		dfs(u, v, cur);

		cur++;
	}
}

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

	cin >> n;

	for (int i = 0, u, v; i < n - 1; i++)
	{
		cin >> u >> v;
		u--, v--;
		g[u].pb(i);
		g[v].pb(i);

		x[i] = u, y[i] = v;
	}

	dfs(0);

	cout << ans << '\n';
	for (int i = 0; i < n - 1; i++) cout << C[i] + 1 << '\n';
}


Measured memory_bytes: 9856
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}

static void B_task()
{
	LLONG A, V;
	LLONG B, W, T;

	getint(A, V);
	getint(B, W);
	getint(T);
	
	long double time = 0;
	if (A < B) {
		if (V == W) {
			printf("NO\n");
			return;
		}
		time = (long double)(B - A) / (long double)(V - W);
	}
	else if (A > B) {
		if (W == V) {
			printf("NO\n");
			return;
		}
		time = (long double)(A - B) / (long double)(V - W);
	}
	else {
		printf("YES\n");
		return;
	}

	if ((time <= T) && (time > 0.0)) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
enum {WEST=1,NORTH=2,EAST=4,SOUTH=8};
int vx[]={-1,0,1,0};
int vy[]={0,-1,0,1};

int w,h;
int map[30][30];
int cost[30][30];
struct Pos{
	int y,x;
}que[900];
int head,tail;

int main(){
	int tmp;
	int i,j;
	struct Pos a,b;
	while(scanf("%d%d",&w,&h)==2&&(w|h)){
		memset(cost,-1,sizeof(cost));
		memset(map,0,sizeof(map));
		for(i=0;i<2*h-1;i++){
			if(i&1){
				for(j=0;j<w;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= SOUTH;
						map[i/2+1][j] |= NORTH;
					}
				}
			}
			else{
				for(j=0;j<w-1;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= EAST;
						map[i/2][j+1] |= WEST;
					}
				}
			}
		}
		head=0;
		tail=0;
		a.y=a.x=0;
		cost[0][0]=1;
		que[tail++]=a;
		while(head < tail){
			a= que[head++];
			for(i=0;i<4;i++){
				b.y = a.y+vy[i];
				b.x = a.x+vx[i];
				if( (map[a.y][a.x]&1<<i) && cost[b.y][b.x]==-1){
					cost[b.y][b.x] = cost[a.y][a.x] + 1;
					que[tail++] = b;
				}
			}
		}
		if(cost[h-1][w-1]!=-1)printf("%d\n",cost[h-1][w-1]);
		else puts("0");
	}
	return 0;
}

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

int main(void)
{
    int n; cin >> n;

    int F[50];
    F[0] = F[1] = 1;
    for ( int i = 2; i <= n; ++i) F[i] = F[i - 1] + F[i - 2];
    cout << F[n] << endl;
    return 0;
}



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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<int,int> p;

int n;
ll a[100100];
map<ll, int> mp;
vector <ll> v;

int main(){
  cin >> n;
  rep(i,0,n){
    cin >> a[i];
    mp[a[i]]++;
    if(mp[a[i]] == 2)v.push_back(a[i]);
  }
  ll ans;
  if(v.size()<2)ans=0;
  else{
    sort(rall(v));
    if(mp[v[0]] >= 4)ans = v[0]*v[0];
    else ans = v[0]*v[1];
  }
  cout << ans << endl;

}


Measured memory_bytes: 7296
#include <stdio.h>

int A[50],n;

//総当たり
int solve(int i,int m){
  if(m==0) return 1;
  if(i>= n) return 0;
  int res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}

int main(){
  int i,j,q,m;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&m);
    if(solve(0,m)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}

    
    



Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 200005, mod = 998244353;

ll n, s, dt[N][2][3][3];
char a[N];

int main()
{
	scanf("%s",a+1);
	n = strlen(a+1);
	if(n == 2) {
		if(a[1] == a[2]) puts("1");
		else puts("2");
		return 0;
	}
	if(n == 3) {
		bool A = (a[1] != a[2]), B = (a[2] != a[3]), C = (a[3] != a[1]);
		if(A && B && C) puts("3");
		else if(!A && !B && !C) puts("1");
		else if(C) puts("6");
		else puts("7");
		return 0;
	}
	ll F = 1, G = 1;
	for(int i=2;i<=n;i++) {
		if(a[i] == a[i-1]) F = 0;
		if(a[i] != a[i-1]) G = 0;
	}
	if(G) {puts("1"); return 0;}
	for(int i=1;i<=n;i++) {
		a[i] -= 'a';
		s += a[i];
	}
	s %= 3;
	dt[1][0][0][0] = 1;
	dt[1][0][1][1] = 1;
	dt[1][0][2][2] = 1;
	for(int i=2;i<=n;i++) {
		for(int x=0;x<2;x++) for(int j=0;j<3;j++) for(int k=0;k<3;k++) for(int l=0;l<3;l++) {
			dt[i][x|(k==l)][(j+l)%3][l] += dt[i-1][x][j][k];
			dt[i][x|(k==l)][(j+l)%3][l] %= mod;
		}
	}
	printf("%lld",(dt[n][1][s][0]+dt[n][1][s][1]+dt[n][1][s][2]+F)%mod);
}


Measured memory_bytes: 28544
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
    	while (sc.hasNextInt()) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; ++i) {
					System.out.print("#");
				for (int k = 2; k < W; k++) {
					if(i==0 |i+1==H)
						System.out.print("#");
					else 	
					System.out.print(".");
				}
					System.out.print("#");
					System.out.println();
			}
					System.out.println();
    	}
    }
}

    



Measured memory_bytes: 36628
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int N;
    cin >> N;
    ll A[N];
    bool inc = false;
    bool dec = false;
    int cnt = 1;//ラストの分
    REP(i, N) {
        cin >> A[i];
        if (i) {
            if (A[i] == A[i - 1]) { continue; }
            if (A[i] > A[i - 1]) {
                if (dec == true) {
                    cnt++;
                    dec = false;
                    continue;
                } else {
                    inc = true;
                    continue;
                }
            } else {
                if (inc == true) {
                    cnt++;
                    inc = false;
                    continue;
                } else {
                    dec = true;
                    continue;
                }
            }

        }
    }
    cout << cnt << endl;

}


Measured memory_bytes: 1024
#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 uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

#include<unistd.h>
struct Buffer{
    int idx;
    enum { chunk = 1 << 8 };
    char buf[chunk];
    Buffer(){ init(); }
    void init(){ idx = 0; read(0, buf, chunk); }
    void check(){ if(idx == chunk){ init(); } }
    int next(){
        static char notDigits[256] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,};
        int ret = 0;//, sign = 1;
        // while(check(), notDigits[(int)buf[idx]]){ idx++; }
        // if(check(), buf[idx] == '-'){ sign = -1; idx++; }
        while(check(), !notDigits[(int)buf[idx]]){ ret = ret * 10 + buf[idx++] - '0'; }
        check(), idx++;
        return /*sign **/ ret;
    }
};

string ans;
void out(int num){
    if(!num){
        // putchar('0');
        ans += '0';
        return;
    }
    char buf[16];
    int idx = 0;
    while(num){
        auto ret = div(num, 10);
        buf[idx] = ret.rem + '0';
        num = ret.quot;
        idx++;
    }
    for(int i = idx - 1; i >= 0; i--){
        // putchar(buf[i]);
        ans += buf[i];
    }
}

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    Buffer buf;
    const int lim = 1e5;
    vector<char> prime(lim + 1, true);
    prime[0] = prime[1] = false;
    for(int i = 2; i <= lim; i++){
        if(prime[i]){
            for(int j = i + i; j <= lim; j += i){
                prime[j] = false;
            }
        }
    }
    vector<int> accs(lim + 1);
    // for(int i = 1; i <= lim; i++){
    //     accs[i] = accs[i - 1] + (i & 1 && prime[i] && prime[(i + 1) >> 1]);
    // }
    for(int i = 1; i <= lim; i += 2){
        accs[i] = prime[i] && prime[(i + 1) >> 1];
    }
    for(int i = 1; i <= lim; i++){
        accs[i] += accs[i - 1];
    }
    // printd(accs[lim]);
    // int q; cin >> q;
    int q = buf.next();
    // stringstream ss;
    ans.reserve(4 * q);
    for(int i = 0; i < q; i++){
        // int l, r;
        // cin >> l >> r;
        int l = buf.next(), r = buf.next();
        // cout << accs[r] - accs[l - 1] << '\n';
        // ss << accs[r] - accs[l - 1] << '\n';
        out(accs[r] - accs[l - 1]);
        // putchar('\n');
        ans += '\n';
    }
    // cout << ss.str();
    cout << ans;
    // write(1, ans.data(), ans.size());
}


Measured memory_bytes: 1536
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int ex;
    if (N <= K){
      ex = N*X;
    }else{
      ex = K*X + (N-K)*Y;
    }
    System.out.println(ex);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n,k;
	while(1){
		cin>>n>>k;
		if(n+k==0) break;
		vi s(k),d(k);
		rep(i,0,k) cin>>s[i];
		rep(i,0,n){
			rep(j,0,k){
				int a;
				cin>>a;
				d[j]+=a;
			}
		}
		rep(i,0,k){
			if(s[i]<d[i]){
				o("No");
				break;
			}
			if(i==k-1) o("Yes");
		}
	}
}

Measured memory_bytes: 1188
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
int main() {
	string s, t;
	cin >> s >> t;
	bool f = true;
	int len = s.length();
	int now = -1;
	for (int i = 0; i < len; i+=2) {
		now++;
		while (now<len&&t[now] != s[i])now++;
		if (now == len) {
			f = false; break;
		}
	}
	now = -1; bool g = true;
	for (int i = 1; i < len; i += 2) {
		now++;
		while (now<len&&t[now] != s[i])now++;
		if (now == len) {
			g = false; break;
		}
	}
	if (f||g)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	ll w,h,n,x,y,a;
	cin>>w>>h>>n;
	ll x1=0,x2=w,y1=0,y2=h;
	
	while(n--)
	{
		cin>>x>>y>>a;
		if(a==1)
			x1=max(x1,x);
		else if(a==2)
			x2=min(x2,x);
		else if(a==3)
			y1=max(y1,y);
		else
			y2=min(y2,y);
	}
	// cout<<x1<<x2<<y1<<y2;
	if(x2>x1&&y2>y1)
	cout<<abs((x1-x2)*(y1-y2));
	else
	cout<<0;
	return 0;
}



Measured memory_bytes: 3600
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=_I()

def F(A,B):
	return max(len(str(A)),len(str(B)))

#高々10**5まで見れば良い
ans=inf
for i in range(1,min(N+1,10**5+3)):
	if N%i==0:
		ans=min(ans,F(i,int(N/i)))
#ans=min(ans, F(1,N))
print(ans)
	


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

int A[1000000], n;

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    int q, k, sum = 0;
    cin >> q;
    for(int i = 0; i < q; i++){
        scanf("%d", &k);
        // lower_bound(A, A+n, k) はA[0]からA[n]のうち、k以上となる最初のアドレスを返す。
        if(*lower_bound(A, A + n, k) == k){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3520
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <ctime>
#include <complex>

#define enp 	printf("**Entry Point**\n")
#define A		first
#define B		second
#define MP		make_pair

using namespace std;

typedef long long ll;

const int INF = 0x6fffffff;
const int MINF = 0x80000000;
const ll mod = 100003;
const int cons = 100001;
const double pi = 3.141592653589793;



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

	int ar[1001];

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &ar[i]);
	}

	sort(ar, ar + n);

	int t = lower_bound(ar, ar + n, a) - ar;
	int t2 = lower_bound(ar, ar + n, b) - ar;

	if (t == n)
	{
		printf("%d\n", n);
	}
	else if (t2 == n)
	{
		printf("%d\n", t);
	}
	else
	{
		printf("%d\n", n - (t2 - t));
	}


	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
#define PI 3.1415926535

int main() {
    double a, b, x; cin >> a >> b >> x;
    x /= a;
    cout << fixed << setprecision(10);

    if (x > a * b / 2) {
        cout << atan2((a * b - x) * 2, a * a) * 180 / PI << endl;
    } else {
        cout << atan2(b * b, x * 2) * 180 / PI << endl;
    }
    return 0;
}

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

#define ul unsigned long long
#define ll long long

ll td[8][2]={{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1}};

void dfs(int p[50][50],ll w,ll h,ll cx,ll cy){
  if (cx < 0 || cx >= w || cy < 0 || cy >= h)
    return;
  //cout << cx << "," << cy <<":"<<(int)p[cy][cx]<< endl;
  if (p[cy][cx] == 0)
    return;
  p[cy][cx]=0;
  ll nx,ny;
  for (ll i = 0; i < 8; i++)
  {
    nx = cx + td[i][0];
    ny = cy + td[i][1];
    dfs(p,w,h,nx,ny);
  }
}

int main()
{
  ll w,h;
  int p[50][50];
  ul ct = 0;

  cin >> w >> h;
  while (w | h)
  {
    ct=0;
    for (ll i = 0; i < h; i++)
    {
      for (ll j = 0; j < w; j++)
      {
        cin >> p[i][j];
      }
    }

    for (ll i = 0; i < h; i++)
    {
      for (ll j = 0; j < w; j++)
      {
        if (p[i][j])
          ct++;
        dfs(p, w, h, j, i);
      }
    }
    cout << ct << endl;
    cin >> w >> h;
  }

  return 0;
}



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

#define MAXN 710
typedef long long LL;


int n, t;
int d[MAXN][MAXN];
int a[MAXN], b[MAXN], c[MAXN];


int flag;

void dfs(int x, int color)
{
	c[x] = color;
	if (color == 1) ++a[t];
	else ++b[t];
	
	for (int i = 1; i <= n; ++i)
	{
		if (i == x || d[x][i] == 1) continue;
		//cout << x << " " << i << endl;
		if (!c[i]) dfs(i, 3 - color);
		else if (c[i] != 3 - color)
			 flag = 1;
	}
}

int main()
{
	int m, x, y;
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= m; ++i)
	{
		scanf("%d %d", &x, &y);
		d[x][y] = d[y][x] = 1;
	}

	for (int i = 1; i <= n; ++i)
	{
		if (!c[i]) ++t,  dfs(i, 1);
		if (flag) return puts("-1"), 0;
	}
	static int dp[MAXN][MAXN];
	dp[0][0] = 1;


	for (int i = 0; i < t; ++i)
	{
	 	for (int j = 0; j <= n; ++j)
		{
			if (!dp[i][j]) continue;
			dp[i + 1][j + a[i + 1]] = 1;
			dp[i + 1][j + b[i + 1]] = 1;
		}	
	}
	int ans = 1e9;
	for (int i = 1; i < n; ++i)
	{
		if (dp[t][i]) ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>

#define IN 3

int main(void)
{
    int w,h,x,y,r;
    
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    
    if(0 <= x-r && x+r <= w)
    {
        if(0 <= y-r && y+r <= h)
        {
            printf("Yes\n");
            return 0;
        }
    }
    
    printf("No\n");
    return 0;
}


Measured memory_bytes: 2112
'use strict';

function Main(input) {
    const tmp = input.trim().split('\n');
    const [H, W, K] = tmp[0].split(' ').map((v) => Number(v));
    let [_, ...C] = tmp;
    C = C.reduce((str, cul) => (str += cul), '')
        .split('')
        .map((v) => (v === '#' ? 0 : 1));

    const masks = createMasks(W, H);

    let answer = 0;
    for (let i = 0; i < masks.length; i++) {
        const arr = [];
        for (let j = 0; j < C.length; j++) {
            arr.push(masks[i][j] | C[j]);
        }
        const result = arr.filter((v) => v === 0).length;
        if (result === K) {
            answer += 1;
        }
    }
    console.log(String(answer));
    return;
}

function createMasks(width, height) {
    const maskArray = [];
    for (let y = 0; y < 2 ** height - 1; y++) {
        const row = y.toString(2).padStart(height, 0);
        for (let x = 0; x < 2 ** width; x++) {
            const col = x.toString(2).padStart(width, 0);
            const rc = [row, col];
            maskArray.push(correctMask(rc));
        }
    }
    return maskArray;
}

function correctMask(rc) {
    const [row, col] = rc;
    const mask = [];
    for (let y = 0; y < row.length; y++) {
        for (let x = 0; x < col.length; x++) {
            mask.push(Number(row[y]) | Number(col[x]));
        }
    }
    return mask;
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 37588
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる
//時間を意識しろ
//コードテストちゃんとして
//画面とにらめっこするな書け
//WA出すたびにABCは五億円払え
//わからない問題はとばせ
//躊躇なくぐぐれ

//ここから
int main(){
    ll N;
    cin>>N;
    vl A(N);
    rep(i,N) cin>>A.at(i);
    vl rGCD(N);
    vl lGCD(N);
    rep(i,N){
        if(i==0){
            lGCD.at(0)=A.at(0);
            rGCD.at(N-1)=A.at(N-1);
        }else{
            lGCD.at(i)=__gcd(A.at(i),lGCD.at(i-1));
            rGCD.at(N-1-i)=__gcd(A.at(N-1-i),rGCD.at(N-i));
        }
    }
    ll Ans;
    rep(i,N){
        if(i==0){
            Ans=rGCD.at(1);
        }else if(i==N-1){
            chmax(Ans,lGCD.at(i-1));
        }else{
            ll x=__gcd(lGCD.at(i-1),rGCD.at(i+1));
            chmax(Ans,x);
        }
    }
    cout<<Ans<<endl;
}



Measured memory_bytes: 2560
#include "bits/stdc++.h"
//#include <iostream>
//#include <vector>
//#include <string>
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;

const int
	dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
	dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
	dx4[4] = { 0,1,0,-1 },
	dy4[4] = { 1,0,-1,0 };

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




lint w, h;
vector<ivec> m;
lint p, q;

int dfs(int x, int y) {//x, yからつながっている陸(1)をすべて2にし、1を返す
	if (m[x][y] != 1)return 0;
	m[x][y] = 2;
	rep(i, 8) {
		p = x + dx8[i], q = y + dy8[i];
		if (0 <= p && p < w && 0 <= q && q < h)dfs(p, q);
	}
	return 1;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);

	ivec in;
	lint ctr;
	while (cin >> h >> w) {
		if (h == 0 && w == 0)return 0;
		in.resize(h);
		rep(i, w) {
			rep(j, h) {
				cin >> in[j];
			}
			m.push_back(in);
		}
		ctr = 0;
		rep(i, w)rep(j, h) {
			ctr += dfs(i, j);
		}
		co(ctr);
		m.clear();
		vector<ivec>().swap(m);
	}
	gc();
}


Measured memory_bytes: 3240
#include <iostream>
#include <map>
using namespace std;
int main()
{
	multimap<int,int> score;
	multimap<int,int>::reverse_iterator mp,lb,ub;
	while(1)
	{
		int m,n; char ch; cin >> n >> ch >> m ;
		if(m==0 && n==0) break;
		score.insert(pair<int,int>(m,n));
	}
	int rank[101]={0}; int r=1;
	mp=score.rbegin(); int tmp=mp->first;
	for( ;mp!=score.rend();mp++)
	{
		if(tmp!=mp->first) {tmp=mp->first; rank[mp->second]=++r;}
		else rank[mp->second]=r;
	}
	int an;
	//for(int i=1;i<100;i++) cout << rank[i] << ' ' ; cout << endl;
	while(cin>>an) { cout << rank[an] << endl; }
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int r0, w0, c, r;

int main() {
    while(1) {
        cin >> r0 >> w0 >> c >> r;
        if(r0 == 0 && w0 == 0 && c == 0 && r == 0) break;
        int rest = c*w0-r0;
        if(rest <= 0) cout << 0 << endl;
        else {
            int ans = (rest+r-1)/r;
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 3076
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
//using
using namespace std;
/*using vi = vector<int>;
using vs = vector<string>;
using vc = vector<char>;*/
//define
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
//グローバル変数宣言
long long a=0,b=0,c=0,d=0,n=0;

signed main(){
    cin>>a>>b;
    if(a==1 || b==1)print(1)
    else if(a%2==1&&b%2==1){print((a*b+1)/2)}
    else print(a*b/2);
    
}

Measured memory_bytes: 3568
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 21001
#define int long long
using namespace std;

int read_p,read_ca;
inline int read(){
	read_p=0;read_ca=getchar();
	while(read_ca<'0'||read_ca>'9') read_ca=getchar();
	while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
	return read_p;
}
const int MOD=1e9+7;
int n,a[MN],B[MN],x,mmh=0,mm[20][20][2][2];
inline int M(int x){return x<0?x+10:x;}
inline void work(int p,int n,int a,int b){
	if (mm[p][n][a][b]!=-1) {mmh+=mm[p][n][a][b];return;}
	int u=mmh;
	if (p+p-1==n){
		if (a==0&&b==0) mmh+=10*(B[p]==0);else
		if (a==1&&b==1) mmh+=10*(B[p]==9);
		return;
	}
	if (p+p-1>n){
		mmh+=a==b;
		return;
	}
	for (int i=p==1;i<=9;i++)
	for (int j=0;j<=9;j++)
	if (M(i-j-b)==B[p]&&(a==(j<i)||j==i)&&(M(j-i)==B[n+1-p]||M(j-1-i)==B[n+1-p])){
		if (a){
			if (j==i&&B[n+1-p]==0) continue;
			work(p+1,n,M(j-1-i)==B[n+1-p],i-b-j<0);
		}else{
			if (j==i&&B[n+1-p]==9) continue;
			work(p+1,n,M(j-1-i)==B[n+1-p],i-b-j<0);
		}
	}
	mm[p][n][a][b]=mmh-u;
}
signed main(){
	int i,j,k;
	x=n=read();
	if (n%9) return puts("0"),0;
	for (k=1;k<=10&&x;k++) B[k]=x%10,x/=10;k--;
	for (int i=k;i<=18;i++) memset(mm,-1,sizeof(mm)),work(1,i,0,0);
	printf("%lld\n",mmh);
}

Measured memory_bytes: 128