akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int N;
  int K;
  rd(N);
  rd(K);
  wt_L(N-K+1);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// {
//   int N, K;
//   rd(N,K);
//   wt(N-K+1);
// }


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>A(N);
	rep(i, N) in >> A[i];

	LL maxN1 = -1, maxN2 = -1, cnt = 0;
	rep(i, N) maxN1 = std::max(maxN1, A[i]);
	rep(i, N)
	{
		if (A[i] != maxN1) maxN2 = std::max(maxN2, A[i]);
	}
	rep(i, N)
	{
		if (maxN1 == A[i]) ++cnt;
	}

	rep(i, N)
	{
		LL ans;
		if (A[i] == maxN1)
		{
			if (cnt > 1) ans = maxN1;
			else ans = maxN2;
		}
		else ans = maxN1;
		out << ans << std::endl;
	}
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define endl enjoy_codeforces
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::vector<std::string>a(3);
    for(auto&&s:a)std::cin>>s;
    std::vector<std::vector<std::vector<lint>>>ok(3,
        std::vector<std::vector<lint>>(3)
    );
    for(lint i=0;i<3;i++){
        for(lint j=0;j<3;j++){
            if(i==j)continue;
            lint si=a.at(i).length(),sj=a.at(j).length();
            ok.at(i).at(j).resize(si+1);
            ok.at(i).at(j).at(si)=true;
            for(lint k=0;k<si;k++){
                lint max=std::min(si-k,sj);
                for(lint l=0;l<=max;l++){
                    if(l==max){
                        ok.at(i).at(j).at(k)=true;
                        break;
                    }
                    char x=a.at(i).at(k+l);
                    char y=a.at(j).at(l);
                    if(x!='?'&&y!='?'&&x!=y)break;
                }
            }
        }
    }
    lint ans=std::numeric_limits<lint>::max();
    std::vector<lint>ord={0,1,2};
    do{
        lint o0=ord.at(0),o1=ord.at(1),o2=ord.at(2);
        lint s0=a.at(o0).size(),s1=a.at(o1).size(),s2=a.at(o2).size();
        for(lint i=0;i<=s0;i++){
            for(lint j=i;j<=std::max(s0,i+s1);j++){
                if(ok.at(o0).at(o1).at(i)&&
                        (s0<=j||ok.at(o0).at(o2).at(j))&&
                        (i+s1<=j||ok.at(o1).at(o2).at(j-i))){
                    lint now=std::max({s0,s1+i,s2+j});
                    if(now<ans)ans=now;
                }
            }
        }
    }while(std::next_permutation(ord.begin(),ord.end()));
    std::cout<<ans<<'\n';
}
/*
 * a[0] に i 文字遅れて a[1] が始まったときに大丈夫かどうかを計算です。
 * これを ok[0][1][i] と書きます。（0<=i<len(a)）
 * 始まりが 0, 1, 2 の順番のとき、
 *     ok[0][1][i] &&
 *         o0<=j || ok[0][2][j]
 *         i+o1<=j || ok[1][2][i-j]
 * ならば、
 *     max(len(0), len(1)+i, len(2) + j)
 * です。
 */


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

bool cal() {
	bool flag = true;
	int prev_t = 0, prev_x = 0, prev_y = 0;
	int t, x, y;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> t >> x >> y;
		if ((t - prev_t) >= abs(prev_x - x + prev_y - y) && (t - prev_t) % 2 == abs(prev_x - x + prev_y - y) % 2) {
			
		}
		else {
			flag &= 0;
		}
		prev_t = t;
		prev_x = x;
		prev_y = y;
	}
	return flag;
}

int main() {
	if (cal()) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

template <typename T>
std::vector<T> comb(T list, int r)
{
  int i = 0;
  auto result = std::vector<T>{};
  for (auto &&el : list) {
    if (r == 1) {
      result.push_back(T{el});
    } else {
      auto clone = list;
      clone.erase(clone.begin(), clone.begin() + i + 1);
      for (auto &&rest : comb(clone, r - 1)) {
        rest.insert(rest.begin(), el);
        result.push_back(rest);
      }
    }
    i++;
  }
  return result;
}

auto range(int n)
{
  auto v = std::vector<int>{};
  for (int i = 0; i < n; i++) {
    v.push_back(i);
  }
  return v;
}

int main(void)
{
  auto s = std::string{};
  std::cin >> s;
  unsigned long long result = std::stoll(s);
  for (int i = 0; i < s.size() - 1; i++) {
    for (auto &&p : comb(range(s.size() - 1), i + 1)) {
      p.insert(p.begin(), -1);
      p.push_back(s.size());
      for (int idx = 0; idx + 1 < p.size(); idx++) {
        result += std::stoll(s.substr(p[idx] + 1, p[idx + 1] - p[idx]));
      }
    }
  }
  std::cout << result << std::endl;
}


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

using namespace std;

typedef long long ll;
// typedef pair<ll, ll> P;
typedef pair<int, int> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n, k;
  cin >> n >> k;
  int mx = (n - 2) * (n - 1) / 2;
  if (mx < k) {
    cout << -1 << endl;
  } else {
    vector<P> ans;
    REP1(i, n - 1) ans.push_back(P(i, n));
    int a = 1, b = 2;
    REP(i, mx - k) {
      ans.push_back(P(a, b));
      b++;
      if (b == n) {
        a++;
        b = a + 1;
      }
    }
    cout << ans.size() << endl;
    REP(i, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}

Measured memory_bytes: 384
# coding: utf-8
# Your code here!
_ = input()
A = list(map(int, input().split()))

numerator = 1
for a in A:
    numerator *= a


denominator = 0
for a in range(len(A)):
    denominator += (numerator / A[a])


# print(numerator, denominator)
print(numerator / denominator)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;
const int MAX_N = 100000;

ll T[MAX_N];
int n, k;

int check(ll p){
  int i = 0;
  
  for(int j = 0; j < k; j++){
    ll s = 0;

    while(s + T[i] <= p){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }

  return i;
}

int solve(){
  ll left = 0;
  ll right = 100000 * 10000;
  ll mid;

  while(right - left > 1){
    mid = (left + right) / 2;

    int v = check(mid);

    if(v >= n){
      right = mid;
    }else{
      left = mid;
    }
  }

  return right;
}

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

  for(int i = 0; i < n; i++){
    cin >> T[i];
  }

  ll ans = solve();
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1948
//
//  main.cpp
//  20190815lesson
//
//  Created by Priscilla Leang on 8/15/19.
//  Copyright © 2019 Priscilla Leang. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int x, y, z, f, m;
    cin>> x >> y >> z;
    x = x - z;
    f = y + z;
    m = x /f;
    cout << m;
    return 0;
}


Measured memory_bytes: 256
//
//  lib.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T>
vector<vector<T>> alloc_double_vec(size_t rows, size_t cols, T init) {
    vector<vector<T>> ret;
    vector<T> ret_elem;
    ret_elem.resize(cols, init);
    ret.resize(rows, ret_elem);
    return ret;
}

struct Graph {
    struct Edge {
        size_t from;
        size_t to;
    };
    vector<vector<Edge>> edges;
    Graph(size_t size) {
        edges.resize(size);
    }
    void add_edge(size_t from, size_t to) {
        edges[from].push_back(Edge{from, to});
        edges[to].push_back(Edge{to, from});
    }
};

void dfs(const Graph& graph, size_t now, vector<bool>& used, int& answer) {
    used[now] = true;
    bool some_false = false;
    for (int i = 0; i < used.size(); i++) {
        if (!used[i]) {
            some_false = true;
            break;
        }
    }
    if (some_false) {
        for (Graph::Edge e : graph.edges[now]) {
            if (used[e.to]) {
                continue;
            }
            dfs(graph, e.to, used, answer);
        }
    } else {
        answer++;
    }
    used[now] = false;
}

int main() {
    int N, M;
    cin >> N >> M;
    Graph graph(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        graph.add_edge(a, b);
    }
    vector<bool> used(N, false);
    int answer = 0;
    dfs(graph, 0, used, answer);
    cout << answer << endl;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1LL<<60
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main(){
  ll n;
  cin >> n;
  cout << 50 << endl;
  ll a[50];
  REP(i, 50) a[i] = 49 + (n/50);
  n %= 50;
  REP(i, n){
    REP(j, 50){
      if(i == j) a[j] += 50;
      else a[j]--;
    }
  }
  REP(i, 50){
    cout << a[i];
    if(i == 49) cout << endl;
    else cout << " ";
  }
	return 0;
}


Measured memory_bytes: 256
N = int(input())
T = list(map(int,input().split()))
M = int(input())

sum = 0
for i in range(N):
    sum += T[i]

D = []
for i in range(M):
    x = list(map(int,input().split()))
    D.append(x)

for i in range(M):
    sumx = 0
    sumx = sum-(T[D[i][0]-1]-D[i][1])
    print(sumx)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int     long long int

int32_t main() {

    int n;cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    int sum=0;
    for(int i=0;i<n;i++){
        arr[i]=(arr[i]-(i+1));
        // sum+=arr[i];
    }

   sort(arr,arr+n);
   int val=(arr[n/2]);

   for(int i=0;i<n;i++){
        sum+=abs(arr[i]-val);
   }
   cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 5208
#include<stdio.h>
int main(void){
	char str[3][3];
	int i,j;
	int flag = 0;
	while(scanf(" %c",&str[0][0])){
		if(str[0][0] == '0'){
			break;
		}
		else{
			scanf(" %c",&str[0][1]);
			scanf(" %c",&str[0][2]);
			for(i = 1;i < 3;i++){
				for(j = 0;j < 3;j++){
					scanf(" %c",&str[i][j]);
				}
			}
				
				//debug
				/*for(i = 0;i < 3;i++){
					for(j = 0;j < 3;j++){
						printf(" %c",str[i][j]);
					}
					puts("");
				}*/
				
				
			if(str[0][0] == str[0][1] && str[0][1] == str[0][2]){
				if(str[0][0] != '+' && flag == 0){
					printf("%c\n",str[0][0]);
					flag = 1;
				}
			}		
			if(str[1][0] == str[1][1] && str[1][1] == str[1][2]){
				if(str[1][0] != '+' && flag == 0){
					printf("%c\n",str[1][0]);
					flag = 1;
				}
			}
			if(str[2][0] == str[2][1] && str[2][1] == str[2][2]){
				if(str[2][0] != '+' && flag == 0){
					printf("%c\n",str[2][0]);
					flag = 1;
				}
			}
			if(str[0][0] == str[1][0] && str[1][0] == str[2][0]){
				if(str[0][0] != '+' && flag == 0){
					printf("%c\n",str[0][0]);
					flag = 1;
				}
			}
			if(str[0][1] == str[1][1] && str[1][1] == str[2][1]){
				if(str[0][1] != '+' && flag == 0){
					printf("%c\n",str[0][1]);
					flag = 1;
				}
			}
			if(str[0][2] == str[1][2] && str[1][2] == str[2][2]){
				if(str[0][2] != '+' && flag == 0){
					printf("%c\n",str[0][2]);
					flag = 1;
				}
			}
			if(str[0][0] == str[1][1] && str[1][1] == str[2][2]){
				if(str[0][0] != '+' && flag == 0){
					printf("%c\n",str[0][0]);
					flag = 1;
				}
			}
			if(str[0][2] == str[1][1] && str[1][1] == str[2][0]){
				if(str[0][2] != '+' && flag == 0){
					printf("%c\n",str[0][2]);
					flag = 1;
				}
			}
			if(flag == 0){
				printf("NA\n");
			}
		}
		flag = 0;
	}
	return 0;
}
	

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

using pi = pair<int, int>;

int main(){
    for(;;){
        int n;
        cin>> n;
        if(n==0) return 0;
        map<char,int> m;
        bool f = true;
        rep(i, n){
            string s;
            cin >> s;
            m[s[0]]++;
            vector<pi> v;
            for(auto p:m){
                v.push_back(pi{p.second, p.first });
            }
            sort(v.begin(), v.end());
            pi fi = v.back();
            int sc = v.size() == 1 ? 0 : v[v.size()-2].first;

            //cout << "# " << fi.first << " " << sc << endl;

            if(f && sc + n-i-1 < fi.first){
                cout << (char)fi.second << " " << i+1 << endl;
                f = false;
            }
        }
        if(f) cout << "TIE" << endl;
    }

}


Measured memory_bytes: 3104
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

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

int main() {
    int r,g,b;
    cin >> r >> g >> b;
    if ((r * 100 + g * 10 + b) %4 == 0 ) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>


using namespace std;


int main()
{
    int a,b,c,d,ans=0;
    cin>>a>>b>>c>>d;
    for(int i=0;i<=a;i++)
    for(int j=0;j<=b;j++)
    for(int k=0;k<=c;k++)
    if((500*i+100*j+50*k)==d) 
    ans++;
    cout<<ans;
    system("pause");
    return 0;
}             

Measured memory_bytes: 504
N = int(input())
x2 = input()
x10 = int(x2, 2)
popc =  x2.count("1")
#print("x10", x10)
#print("popc", popc)
#popc: Nを2進数で表したときの1の個数

#以下で1つフリップさせた時の入力に対する余りを事前に計算
if popc <= 1:
    xp = x10%(popc+1)
    xm = 0
else:
    xp = x10%(popc+1)
    xm = x10%(popc-1)
#print("xp", xp)
#print("xm", xm)

#以下でフリップさせた場所のみを計算
for i in range(N):
    if x2[i] == "1":
        if popc == 1:
            print(0)
            continue
        tmp = (xm - pow(2, N-i-1, popc-1))%(popc-1)
    else:
        tmp = (xp + pow(2, N-i-1, popc+1))%(popc+1)
        
    #print("tmp", tmp)
    ans = 1
    while tmp > 0:
        tmp %= bin(tmp).count("1")
        ans += 1
    print(ans)


Measured memory_bytes: 81628
n,k=map(int,input().split())
d=input().split()
stopcode=False
while stopcode==False:
  for i in range(len(str(n))):
    if str(n)[i] in d:
      n+=1
      break
    elif i+1==len(str(n)):
      stopcode=True
      break
print(n)

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


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}





/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int l,r,d;
  scanf("%d%d%d",&l,&r,&d);
  /*
  ushitapunichiakunwarai
  */
  int ans=r/d;
  ans-=(l-1)/d;

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

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mat vector<vector<ll> >

const int N = 1e6+15;

int Next[N][2];

int pos = 1;


ll ret = 0;

ll grundyNumber(ll x){
	assert(x>=0);
	ll ret = x&(-x);
	return ret;
}

void dfs2(int node,int h,ll L){
	for(int i=0;i<2;++i){
		int id = Next[node][i];
		if(id!=0){
			dfs2(id,h+1,L);
		} else {
			ret ^= grundyNumber(L-h);
		}
	}
}

void dfs(string &s,int node,int ind){
	if(ind == s.size()){
		return;
	}
	if(!Next[node][s[ind]-'0']){
		Next[node][s[ind]-'0'] = pos++;
	}
	int id = Next[node][s[ind]-'0'];
	dfs(s,id,ind+1);
}

void solve(){
	int n;
	ll L;
	scanf("%d%lld",&n,&L);
	for(int i=0;i<n;++i){
		string s;
		cin>>s;
		dfs(s,0,0);
	}
	dfs2(0,0,L);
	if(ret==0){
		printf("Bob\n");
	} else {
		printf("Alice\n");
	}
}

int main(){
	//freopen("input.txt","r",stdin);
	solve();
}

Measured memory_bytes: 7452
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, m;
    cin >> n >> m;
    ll a[n];
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i];
    }
    sort(a, a+n);
    ll ans=0;
    for (int i = 0; i < m; ++i)
    {
    	ans+=a[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <string>
int main(void) {
	int n,k=9999999;
	std::cin >> n;
	
	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			if (i * j == n) { k = n; }
		}
	}

	if (k == n) { std::cout << "Yes" << std::endl; }
	else { std::cout << "No" << std::endl; }
	return 0;
}

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

const int p = 998244353;

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

    int *l, *r;
    l = new int[k];
    r = new int[k];
    for (int i = 0; i < k; ++i)
        std::cin >> l[i] >> r[i];

    int *f, *s;
    f = new int[n + 1]();
    s = new int[n + 1]();
    f[1] = 1;
    s[1] = 1;
    for (int i = 2; i <= n; ++i)
    {
        for (int j = 0; j < k; ++j)
            f[i] = ((f[i] + s[std::max(i - l[j], 0)] - s[std::max(i - r[j] - 1, 0)]) % p + p) % p;
        s[i] = (s[i - 1] + f[i]) % p;
    }
    std::cout << f[n] << std::endl;
    return 0;
}

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

int main(void){
  long long n,k;
  cin >> n >> k;
  double ans=0.0;

  for(long long i=1;i<=n;i++){
    long long tmp = i,count = 0;
    double d = 1.0/n;
    while(tmp < k){
      tmp *= 2;
      d/=2;
    }
    ans += d;
  }
  cout << setprecision(10) << ans << endl;
  return 0;
}


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


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

    int a;
    string s;
    cin>>a>>s;
    if(a>=3200) cout<<s<<endl;
    else cout<<"red"<<endl;
    return 0;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7; 
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
	char ch=getchar();s="";
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
string s;
int n,dp[3003][3003],ans;
int main(){
	read(n),reads(s);
	dp[1][1]=1;
	for (int i=2;i<=n;i++){
		if (s[i-2]=='<'){
			for (int j=2;j<=i;j++)
				dp[i][j]=(dp[i][j-1]+dp[i-1][j-1])%MOD;
		}else{
			for (int j=i-1;j>=1;j--)
				dp[i][j]=(dp[i][j+1]+dp[i-1][j])%MOD; 
		}
	}
	for (int i=1;i<=n;i++) ans=(ans+dp[n][i])%MOD;
	write(ans);
}

Measured memory_bytes: 34176
<?php
	$n = trim(fgets(STDIN));
	$x = explode(" ", trim(fgets(STDIN)));
	$y = explode(" ", trim(fgets(STDIN)));

	$p1 = $p2 = $p3 = $pp = 0.0;
	for ($i = 0; $i < $n; $i++) {
		$d = abs($x[$i] - $y[$i]);
		$p1 += $d;
		$p2 += pow($d, 2);
		$p3 += pow($d, 3);
		if ($d > $pp) $pp = $d;
	}
	echo $p1 . "\n";
	echo sqrt($p2) . "\n";
	echo pow($p3, 1/3) . "\n";
	echo $pp . "\n";

Measured memory_bytes: 6668
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if (s[0] == '7' ||s[1] == '7' ||s[2] == '7'){
        cout << "Yes";
    }else {
        cout <<"No";
    }
    
}

Measured memory_bytes: 3620
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, m] = input[0].split(" ").map((x: string): number => +x);

let sep = Math.floor(n / 2) + (n % 2 === 1 && ((n - 1) / 2) % 2 === 1 ? 1 : 0);

let cnt = 0;

let l_right = sep - 1;
if (l_right % 2 === 0) l_right -= 1;
for (let i = 0; i < l_right - i && cnt < m; i++) {
	console.log(`${i + 1} ${l_right - i + 1}`);
	cnt++;
}

let r_left = sep;
let r_right = n - 1;
if ((r_right - r_left) % 2 === 1) r_right -= 1;

for (let i = 0; r_left + i < r_right - i && cnt < m; i++) {
	console.log(`${r_left + i + 1} ${r_right - i + 1}`);
	cnt++;
}


Measured memory_bytes: 41304
function Main(input) {
  input = input.split("\n");
  var a = parseInt(input[0]);
  var ans = a + Math.pow(a,2) + Math.pow(a,3);

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29652
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		long a=sc.nextLong(),b=sc.nextLong();
		a+=b;
		out.println(a%2==0?a/2:"IMPOSSIBLE");
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}

Measured memory_bytes: 22484
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input_string = '';

process.stdin.on('data', function(chunk) {
    input_string += chunk;
});

process.stdin.on('end', function() {
    const lines = input_string;
    // console.log(lines);
    const regexp = /[a-z]/;
    if (regexp.test(lines)) {
      console.log('a');
    } else {
      console.log('A');
    }
});

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

int main()
{
	char a[5];

	cin >> a;

	if (a[0] == a[1] || a[1] == a[2] || a[2] == a[3])
		cout << "Bad" << endl;
	else
		cout << "Good" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	string s;
	int c = 0;
	cin >> s;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '+')
			c++;
		else
			c--;
	}
	cout << c << endl;
}

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

public class Main {
	private class Position {
		int x;
		int y;

		Position() {
		}

		Position(int x, int y) {
			setPosition(x, y);
		}

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

		int getDistance(Position target) {
			return Math.abs(this.x - target.x) + Math.abs(this.y - target.y);
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + x;
			result = prime * result + y;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (!(obj instanceof Position)) {
				return false;
			}
			Position other = (Position) obj;
			if (x != other.x)
				return false;
			if (y != other.y)
				return false;
			return true;
		}

	}

	private Position currentPosition = new Position();
	private int currentSecond;

	public boolean isEven(int number) {
		return (number % 2 == 0);
	}

	public boolean isAvailablePlan(int second, int positionX, int positionY) {
		Position targetPostion = new Position(positionX, positionY);
		int distance = currentPosition.getDistance(targetPostion);
		int time = second - currentSecond;
		if (distance > time) {
			return false;
		}
		if (distance == time) {
			return true;
		}
		if (isEven(distance)) {
			if (isEven(time)) return true;
			else return false;
		} else {
			if (isEven(time)) return false;
			else return true;
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					System.in));
			String inputLine1 = reader.readLine();
			int maxLine = Integer.valueOf(inputLine1);
			Main main = new Main();
			for (int i = 0; i < maxLine; i++) {
				String inputLine2 = reader.readLine();
				String numbers[] = inputLine2.split(" ");
				if (!main.isAvailablePlan(Integer.valueOf(numbers[0]),
						Integer.valueOf(numbers[1]),
						Integer.valueOf(numbers[2]))) {
					System.out.println("No");
					System.exit(0);
				}
			}
			System.out.println("Yes");
		} catch (IOException ignore) {
		}
	}
}


Measured memory_bytes: 45988
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) {
        int a;
        cin >> a;
        A[a]++;
    }
    sort(A.rbegin(), A.rend());
    int dif = 0;
    rep(i, K) { dif += A[i]; }
    cout << N - dif << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;

bool check(string s,long long begin,long long end);
int main(){
    string s;
    cin >> s;
    long long size = s.size();
    string l =s.substr(0,(size - 1)/2);
//    string r =s.substr((size + 3)/2,size - (size + 3)/2);
    if(check(s,0,size - 1) && check(s,0,(size - 1)/2 - 1) && check(s,(size + 3)/2 - 1,size - 1)){
        cout << "Yes"<< endl;
    }else{
        cout << "No" << endl;
    }
}
bool check(string s,long long begin,long long end){
    while (begin < end){
        if(s.at(begin++)!=s.at(end--))
            return false;
    }
    return true;
}




Measured memory_bytes: 3588
N = int(input())
P = [int(i) for i in input().split()] 

S = 0

for i in range(N-2):
	if P[i] <= P[i+1]:
		if P[i+1] < P[i+2]:
			S += 1
			continue
	if P[i+2] <= P[i+1]:
		if P[i+1] < P[i]:
			S += 1
			continue
	if (P[i+2] == P[i]) & (P[i+1] > P[i]):
		S += 1
print(S)

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

int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int count = 0;
  while(a >= b){
    count++;
    b *= 2;
  }
  while(b >= c){
    count++;
    c *= 2;
  }
  if (count <= k) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}
    
    

Measured memory_bytes: 3648
#input
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])
#print(S)
L = len(S)

sum_counter = 0
for i in range(L-1):
    for k in range(L-i-1):
        sum_counter += int(S[i] * (10**k) * (2**(L-i-2-k)) * (2**i))
        #print(sum_counter)
    sum_counter += int(S[i] * (10 ** (L-(i+1)) * (2**i - 1)))

#print(sum_counter)

#saigo no ketal
sum_counter += S[-1] * (2**(L-1)-1)

#print(sum_counter)

#zentai
for i in range(L):
    sum_counter += S[i] * (10**(L-i-1))

print(sum_counter)

Measured memory_bytes: 3064
#include <iostream>

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

  if (a == b && b == c && c == a) {
    std::cout << 1 << "\n";
  } else if ((a == b && b != c && c != a) || (a != b && b != c && c == a) || (a != b && b == c && c != a)) {
    std::cout << 2 << "\n";
  } else {
    std::cout << 3 << "\n";
  }

  return 0;
}

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

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

   int ans;
   for(int i=0; i < N-1; i++){
     ans += B[i];
     if(A[i+1] == A[i]+1){
       ans += C[A[i]-1];
     }
   }
   ans += B[N-1];

   cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int BASE = 300000;

char input[100005];
char buf[600005];

int main(){

	scanf("%s",input);

	int head = BASE;
	int tail = BASE-1;

	for(int i = 0; input[i] != '\0'; i++){
		buf[BASE+i] = input[i];
		tail++;
	}

	int num_query;
	bool is_REV = false;

	scanf("%d",&num_query);

	int T,F;
	char work[2];

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d",&T);

		if(T == 1){

			is_REV = not is_REV;
			continue;
		}

		scanf("%d %s",&F,work);

		if((!is_REV && F == 1) ||(is_REV && F==2)){
			head--;
			buf[head] = work[0];
		}else{
			tail++;
			buf[tail] = work[0];
		}
	}

	if(!is_REV){

		for(int i = head; i <= tail; i++){

			printf("%c",buf[i]);
		}
	}else{

		for(int i = tail; i >= head; i--){

			printf("%c",buf[i]);
		}
	}

	printf("\n");

	return 0;
}


Measured memory_bytes: 896
#include <iostream>

using namespace std;

int n, k;

int main(int argc, char** argv)
{
    scanf("%d%d", &n, &k);
    for (int i = 0; i < k; ++i)
    {
        int v;
        scanf("%d", &v);
        n -= v;
    }
    printf(n > 0 ? "No" : "Yes");
    return 0;
}

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

int main()
{
  int n,m;cin>>n>>m;
  vector<int> p(m);
  vector<string> s(m);
  int i;
  for(i=0;i<m;i++)cin>>p.at(i)>>s.at(i);
  vector<bool> ac(n,false);
  vector<int> miss(n,0);
  int msum=0;
  for(i=0;i<m;i++)
  {
    if(!ac.at(p.at(i)-1))
    {
      if(s.at(i)=="WA")
      {
        miss.at(p.at(i)-1)++;
      }
      else
      {
        ac.at(p.at(i)-1)=true;
        msum+=miss.at(p.at(i)-1);
      }
    }
  }
  int acount=0;
  for(i=0;i<n;i++)if(ac.at(i))acount++;
  cout<<acount<<' '<<msum<<endl;
}

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		//int bitArray[] = new int[n];

		int k = sc.nextInt();
		int mask[] = new int[k];
		for(int i = 0; i < k; i++) {
			mask[i] = sc.nextInt();
		}

		for(int i = 0; i < Math.pow(2, k); i++) {  //maskがkの大きさなら2^kの大きさのビット列を作り、順列を求める
			int bitArray[] = new int[n];
			int temp = i;
			int index = 0;  //実際に表示されるindexはビットが1の値のjに対して2^mask[j]を足していったもの
			for(int j = 0; temp > 0; j++) {
				if(temp % 2 == 1) {
					bitArray[mask[j]] = 1;
					index += Math.pow(2, mask[j]);
				}
				temp /= 2;
			}

			//////////////////////////////////////////////////////////

			System.out.print(index + ":");  //順列のインデックス
			for(int j = 0; j < k; j++) {
				if(bitArray[mask[j]] == 1) System.out.print(" " + mask[j]);
			}
			System.out.println();
		}
	}

}



Measured memory_bytes: 94056
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t H,W,N;
int32_t X[103];
int32_t Y[103];

template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}


#include <queue>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <iterator>

using COST_T = uint32_t;
constexpr COST_T INF = 1000000;//std::numeric_limits<double>::infinity()

#if defined(_MSC_VER) && defined(_DEBUG)
//static_assert(false, "リリースでコンパイルしないと遅いよ！！");
#endif

struct pos_t {
	int h, w, r,i,last;
};
struct P{
	COST_T first;
	pos_t second;
};
bool operator<(const P& l, const P& r) {
	return l.first < r.first;
}
bool operator>(const P& l, const P& r) {
	return l.first > r.first;
}
//ダイクストラ
COST_T D[103][1030];
void Dijkstra()
{
	std::priority_queue<P, std::vector<P>, std::greater<>> que;
	fill_all(D, INF);

	D[0][0] = 0;
	que.push({ 0, pos_t{0,0,-1,0,0} });
	while (!que.empty())
	{
		auto p = que.top(); que.pop();
		const auto& nowpos = p.second;
		const auto& nowcost = p.first;
		if (D[nowpos.i][nowpos.r] < nowcost) { continue; }

		//for (int32_t to = 0; to < N; ++to)
		//{
		//	auto cost = nowcost + graph[nowpos][to];
		//	if (cost < D[to]) {
		//		D[to] = cost;
		//		que.emplace(D[to], to);
		//	}
		//}

		for (int32_t to = 1; to < N; to++)
		{
			pos_t to_pos{ Y[to] , X[to] , std::max(0,std::abs(Y[to] - nowpos.h) + std::abs(X[to] - nowpos.w) - nowpos.r-1) ,to, nowpos.i };
			auto cost = nowcost + to_pos.r;
			if (to == 1) {
				to_pos.r = 0;
				cost = nowcost + std::max(0, std::abs(Y[to] - nowpos.h) + std::abs(X[to] - nowpos.w) - nowpos.r);
			}
			auto& D_to = D[to_pos.i][to_pos.r];
			if (D_to > cost) {
				D_to = cost;
				que.push({ cost, to_pos });
			}
		}
	}
}



int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> W>>H>>N;
	X[0] = Y[0] = 0;
	X[1] = W-1; Y[1] = H-1;
	N += 2;
	for (int32_t i = 2; i < N; i++)
	{
		in >> X[i] >> Y[i]; --X[i]; --Y[i];
	}

	Dijkstra();

	//COST_T min = INF;
	//for (int i = 2; i < 1000; i++)
	//{
	//	min = std::min(min, D[1][i]);
	//}
	out << D[1][0] << endl;

	return 0;
}
#endif



Measured memory_bytes: 5032
#include<cstdio>
#include<vector>
#include<cstdlib>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef vector<int> vi;
typedef vector<vi>  vvi;

const int INF=(1<<31)-1;

template<class T> struct Interval{
	T a,b;
	Interval(){}
	Interval(T A,T B):a(A),b(B){}
};

template<class T>
class RMQ{
	int n;
	T *a;

	T query(const Interval<int> &I,const Interval<int> &J,int u){
		if(J.b<=I.a || I.b<=J.a) return INF;
		if(I.a<=J.a && J.b<=I.b) return a[u];

		int m=(J.a+J.b)/2;
		T tl=query(I,Interval<int>(J.a,m),2*u+1);
		T tr=query(I,Interval<int>(m,J.b),2*u+2);
		return tl<tr?tl:tr;
	}

public:
	RMQ(){}

	RMQ(const vector< vector<T> > &v,int k,int b):n(1){
		int N;
		if(!b) N=v[0].size();
		else   N=v.size();

		while(n<N) n<<=1;
		a=(T *)malloc((2*n-1)*sizeof(T));
		rep(i,2*n-1) a[i]=0;

		if(!b) rep(i,N) a[n+i-1]=v[k][i];
		else   rep(i,N) a[n+i-1]=v[i][k];

		for(int i=n-2;i>=0;i--) a[i]=min(a[2*i+1],a[2*i+2]);
	}

	T query(int a,int b){
		return query(Interval<int>(a,b),Interval<int>(0,n),0);
	}
};

int main(){
	for(int h,w,q;scanf("%d%d%d",&h,&w,&q),h||w||q;){
		vvi a(h,vi(w));
		rep(i,h) rep(j,w) scanf("%d",&a[i][j]);

		RMQ<int> *rmq1=(RMQ<int> *)malloc(h*sizeof(RMQ<int>));
		RMQ<int> *rmq2=(RMQ<int> *)malloc(w*sizeof(RMQ<int>));
		rep(i,h) rmq1[i]=RMQ<int>(a,i,0);
		rep(j,w) rmq2[j]=RMQ<int>(a,j,1);

		rep(_,q){
			int t,l,b,r; scanf("%d%d%d%d",&t,&l,&b,&r); b++; r++;

			int ans=INF;
			if(b-t<r-l) for(int i=t;i<b;i++) ans=min(ans,rmq1[i].query(l,r));
			else        for(int j=l;j<r;j++) ans=min(ans,rmq2[j].query(t,b));
			printf("%d\n",ans);
		}

		free(rmq1);
		free(rmq2);
	}

	return 0;
}

Measured memory_bytes: 58000
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
#define DBG(str) cerr<<(str)<<endl;
int main() {
	int h,w;
	cin>>h>>w;
	auto a =mat(char,h+1,w+1,0);
	rep(i,1,h+1){
		rep(j,1,w+1){
			cin>>a[i][j];
		}
	}
	bool all=0;
	rep(i,1,h+1){
		all=true;
		rep(j,1,w+1){
			if(a[i][j]!='.'){
				all=false;
			}
		}
		if(all)a[i][0]=1;
	}
	rep(i,1,w+1){
		all=true;
		rep(j,1,h+1){
			if(a[j][i]!='.'){
				all=false;
			}
		}
		if(all)a[0][i]=1;
	}
	rep(i,1,h+1){
		if(a[i][0]!=1){
			rep(j,1,w+1){
				if(a[0][j]==0) cout<<a[i][j];
			}
			cout<<endl;
		}
	}
	
	return 0;
}





Measured memory_bytes: 256
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
I = I + 1
for num in range(I):
    if num%3 == 0 and num%5 == 0:
        a = a
    elif num%3 == 0:
        a = a
    elif num%5 == 0:
        a = a
    else:
        a = a + num

print(a)


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

int main(void) {
  int n, k;
  string s;
  cin >> n >> s >> k;

  for (int i = 0; i < n; i++) {
    if (s[i] != s[k-1]) s[i] = '*';
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
S = list(input())
W = []
for i in S:
    if i == "0":
        W.append("0")
    elif i == "1":
        W.append("1")
    elif i == "B":
        if len(W) == 0:
            W = W
        else:
            W.pop(-1)
print(*W, sep="")

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



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

    vector<int> v(n);
    for(auto& i : v) cin >> i;

    ll ans = 1;

    vector<int> cnt(3, 0);

    REP(i, n){
        ans *= (cnt[0] == v[i]) + (cnt[1] == v[i]) + (cnt[2] == v[i]);
        ans %= MOD;
        REP(j, 3){
            if(cnt[j] == v[i]){
                cnt[j]++;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int,null_type, less<int>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=1e6+10, mod=1e9+7;


int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,i;
	cin>>n;
	long double x,sum=0;
	for(i=0;i<n;i++){
		cin>>x;
		sum+=(long double)1/x;
	}
	cout<<fixed<<setprecision(12)<<(long double)1/sum;
}
// check for any potential overflow before submitting

	


Measured memory_bytes: 256
void main() {
	auto N = readAs!ulong;
	auto k = 1;
	ulong a = 0;
	if(N % 2 == 1) {
		writeln(0);
		return;
	}
	N /= 2;
	for(ulong i = 5; N / i >= 1; i *= 5) a += N / i;
	a.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main(){
  int n,m;
  cin >> n >> m;
  
  int ac[n], wa[n];
  rep(i,n){
    ac[i]=0;
    wa[i]=0;
  }
  
  rep(i,m){
    int pi;
    string si;
    cin >> pi >> si;
    pi = pi - 1;
    if(si=="AC"){
      ac[pi]++;
    }else{
      if(ac[pi] == 0) wa[pi]++;
    }
  }
  
  int cor=0,pen=0;
  rep(i,n){
    if(ac[i] > 0){
      cor++;
      pen += wa[i];
    }
  }
  
  cout << cor << " " << pen << endl;
  
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_146
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            List<int[]>[] graph = new List<int[]>[n];
            for (int i = 0; i < n; i++) graph[i] = new List<int[]>();
            for (int i = 0; i < n - 1; i++)
            {
                int[] ab = ReadInts();
                int a = ab[0] - 1;
                int b = ab[1] - 1;
                graph[a].Add(new int[3] { b, 0, i });
                graph[b].Add(new int[3] { a, 0, i });
            }
            int maxColor = 0;
            int[] colors = new int[n - 1];
            Queue<int[]> que = new Queue<int[]>();
            que.Enqueue(new int[3] { 0, -1, 0 });
            while (que.Count > 0)
            {
                int[] val = que.Dequeue();
                int now = val[0];
                int prev = val[1];
                int prevC = val[2];
                int nowC = 1;
                for(int i = 0; i < graph[now].Count; i++)
                {
                    if (graph[now][i][0] == prev) continue;
                    if (nowC == prevC) nowC++;
                    graph[now][i][1] = nowC;
                    colors[graph[now][i][2]] = nowC;
                    maxColor = Max(maxColor, nowC);
                    que.Enqueue(new int[3] { graph[now][i][0], now, nowC });
                    nowC++;
                }
            }
            WriteLine(maxColor);
            for (int i = 0; i < n - 1; i++) WriteLine(colors[i]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 36672
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
int main(){
	int H,W;cin>>H>>W;
	string S[H];int a,b;
	vector<vector<pair<int,int>>> ans(H,vector<pair<int,int>>(W));
	rep(i,0,H){
		cin>>S[i];
		b=0;
		rep(j,0,W){
			if(S[i].at(j)=='#'){
				b=0;
				ans[i][j].second=0;
			}else{
				b++;
				ans[i][j].second=b;
			}
		}for(int j=W-2;j>=0;j--){
			if(S[i].at(j)!='#'&&S[i].at(j+1)!='#'){
				ans[i][j].second=ans[i][j+1].second;
			}
		}
	}rep(j,0,W){
		a=0;
		rep(i,0,H){
			if(S[i].at(j)=='#'){
				a=0;
				ans[i][j].first=0;
			}else{
				a++;
				ans[i][j].first=a;
			}
		}for(int i=H-2;i>=0;i--){
			if(S[i].at(j)!='#'&&S[i+1].at(j)!='#'){
				ans[i][j].first=ans[i+1][j].first;
			}
		}
	}
	int temp,sum=0;
	rep(i,0,H){
		rep(j,0,W){
			temp=ans[i][j].first+ans[i][j].second;
			sum=max(sum,temp);
		}
	}cout<<sum-1<<endl;

	/*rep(i,0,W){
        cout<<ans[0][i].second<<" ";
    }*/
}

Measured memory_bytes: 35712