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

int main() {
  int N, K;
  cin >> N >> K;
  vector < int > A(N+1);
  for (int i = 1; i <= N; i++) {
	int temp = i;
    while (temp < K) {
      temp *= 2;
      A[i] += 1;
    }
  }
  
  double ans = 0.0;
  for (int i = 1; i <= N; i++) {
    ans += (1.0 / N) * pow(0.5, A[i]);
  }

  cout << setprecision(10) <<  ans << endl;
}

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

int main(){
  ll h,w,m,i;
  cin >> h >> w >> m;
  vector<ll> x(m),y(m),a(h,0),b(w,0);
  for(i=0;i<m;i++){
    cin >> x.at(i) >> y.at(i);
    x.at(i)--;
    y.at(i)--;
    a.at(x.at(i))++;
    b.at(y.at(i))++;
  }
  
  ll maxh=0,maxw=0,numh=0,numw=0;
  for(i=0;i<h;i++){
    if(a.at(i)==maxh){
      numh++;
    }else if(a.at(i)>maxh){
      maxh=a.at(i);
      numh=1;
    }
  }
  for(i=0;i<w;i++){
    if(b.at(i)==maxw){
      numw++;
    }else if(b.at(i)>maxw){
      maxw=b.at(i);
      numw=1;
    }
  }
  
  ll maxaim=0;
  for(i=0;i<m;i++){
    if(a.at(x.at(i))==maxh&&b.at(y.at(i))==maxw){
      maxaim++;
    }
  }
  
  if(maxaim<numh*numw){
    cout << maxh+maxw << endl;
  }else{
    cout << maxh+maxw-1 << endl;
  }
}

Measured memory_bytes: 12744
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
int coins[] = { 500, 100, 50, 10, 5, 1 };

int main()
{
//	cut here before submit 
//	freopen ("testcase.change2", "r", stdin );
	string str = "";

	while (getline (cin, str ) ){
		int money;
		stringstream ss(str);
		ss >> money;
		
		if (money == 0 ){
			break;
		} // end if
		int change = 1000 - money;
		int res = 0;
		int i;

		for (i = 0; i < sizeof(coins)/sizeof(coins[0]); ++i) {
			while (change >= coins[i] ){
				change -= coins[i];
				++res;
			} // end while
		} // end for

		cout << res << endl;		
		
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

A = [a // 400 for a in A]

C = [0 for _ in range(9)]
for a in A:
    if a > 8:
        a = 8
    C[a] += 1

cnt_0 = 0
cnt_n0 = 0
for c in C:
    if c == 0:
        cnt_0 += 1
    else:
        cnt_n0 += 1


if C[-1] == 0:
    ans_min = cnt_n0
    ans_max = cnt_n0
else:
    if sum(C) == C[-1]:
        ans_min = 1
    else:
        ans_min = cnt_n0 - 1

    ans_max = cnt_n0 - 1 + C[-1]


print(ans_min, ans_max)


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 1e9;

int main() {
  ll n, k, t = 0;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll l = 0, r = 1e9, m;
  while (r - l > 1) {
    m = (l + r) / 2;
    t = 0;
    rep(i, n) t += (a[i] - 1) / m;
    if (t <= k)
      r = m;
    else
      l = m;
  }

  cout << r << endl;
  return 0;
}


Measured memory_bytes: 4752
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


N, A, B = map(int, input().split())
s = input()

yes = "Yes"
no = "No"

nai = 0
gai = 0
for c in s:
	if c == 'a':
		if nai + gai < A + B:
			print(yes)
			nai += 1
		else:
			print(no)
	elif c == 'b':
		if nai + gai < A + B and gai < B:
			print(yes)
			gai += 1
		else:
			print(no)
	else:
		print(no)

Measured memory_bytes: 4040
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	d := nextInt()
	ans := 0
	for i := 0; i < n; i++ {
		x := float64(nextInt())
		y := float64(nextInt())

		a := math.Sqrt(x*x + y*y)
		if a <= float64(d) {
			ans++
		}
	}
	fmt.Println(ans)
}

var sc = bufio.NewScanner(os.Stdin)

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


Measured memory_bytes: 4904
import sys
from collections import defaultdict
import math

def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int,input().split()))
    g = A[0]
    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g)





if __name__ == "__main__":
    main()


Measured memory_bytes: 87232
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> x(M);
  std::vector<long long> y(M);
  for (int i = 0; i < M; i++)
  {
    scanf("%lld", &x[i]);
    scanf("%lld", &y[i]);
    x[i]--;
    y[i]--;
  }
  vector<ll> t(N, 1);
  set<ll> st;
  st.insert(0);
  for (int i = 0; i < M; ++i)
  {
    t[x[i]]--;
    t[y[i]]++;
    if (st.find(x[i]) != st.end())
    {
      st.insert(y[i]);
      if (t[x[i]] == 0)
      {
        st.erase(x[i]);
      }
    }
  }
  cout << st.size() << endl;

  return 0;
}


Measured memory_bytes: 7296
N=int(input())
a=[int(input())-1 for i in range(N)]
f=[0]*N

i=0
cnt=1
while a[i]!=0:
    if f[a[i]]==1:
        print(-1)
        exit()
    f[a[i]]=1
    if a[i]==1:
        print(cnt)
        exit()
    cnt+=1
    i=a[i]
print(-1)


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

//#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int res = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x >= k) res++;
    }
    cout << res << '\n';
}
/*

 */

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007

long long int dp[101][4][2] = {0}, arr[101] = {0};

long long int getsum(int index, int n, int flag, int sum, int k){
    if(index>n){
        return sum==k;
    }
    if(sum==k) return 1;
    if(dp[index][sum][flag]!=-1){
        return dp[index][sum][flag];
    }
    int limit = 0;
    if(flag) limit = arr[index];
    else limit = 9;
    long long int ans = 0;
    for(int i = 0; i <= limit; i++){
       if(i==limit && flag){
           if(i>0) ans += getsum(index + 1, n, 1, sum + 1, k);
           else if(i==0) ans += getsum(index+1, n, 1, sum, k);
       }
       else{
           if(i>0) ans += getsum(index + 1, n, 0, sum + 1, k);
           else if(i==0) ans += getsum(index+1, n, 0, sum, k);
       }
    }
    return dp[index][sum][flag] = ans;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int k;
    string s;
    cin >> s >> k;
    
        memset(dp, -1, sizeof(dp));
        for(int i = 1; i <= s.size(); i++){
            arr[i] = s[i-1]-'0';
        }
        cout << getsum(1, s.size(), 1, 0, k);
        
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

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

struct UF
{
	vector<int> par; // 親のインデックスを記憶する配列
	vector<int> sz; // サイズを記憶する。
	vector<int> rank;
	// 初期化
	UF(int n):par(n),sz(n),rank(n){
		for(int i = 0; i < n; i++){
			par[i] = i;sz[i] = 1;rank[i] = 0;
		}
	}
	// 親を求める
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	// xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if(rank[x] < rank[y]){
			par[x] = y;
			sz[y] += sz[x];
		}
		else{
			par[y] = x;
			sz[x] += sz[y];
			if(rank[x] == rank[y])rank[x]++;
		}
	}
	// xとyが同じ集合ならtrue
	bool same(int x, int y) { return find(x) == find(y); }
	// 素の集合のサイズを求める
	int size(int n){return sz[find(n)];}
};

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

	ll n;cin >> n;
	vector<pair<P, ll> > v;

	REP(i, n){
		ll a, b;cin >> a >> b;
		v.PB(MP(MP(a, b), i));
	}

	sort(ALL(v));
	UF uf(n);
	set<P> s;
	REP(i, n) {
		ll num = v[i].FI.SE;
		ll id = v[i].SE;
		ll min_num = num;
		s.insert(MP(num, id));
		vector<P> tmp;
		for (auto const ele: s) {
			if (ele.FI > num) break;
			uf.unite(id, ele.SE);
			if(min_num < ele.FI) {
				tmp.PB(ele);
			}
			min_num = min(min_num, ele.FI);
		}

		for (auto const ele: tmp) {
			s.erase(ele);
		}
	}

	REP(i, n) {
		cout << uf.size(i) << endl;
	}

	return 0;
}


Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007

int main()
{
    int n,m;
    cin>>n>>m;
    int sum=0;
    for(int i=0;i<m;i++)
    {
        int x;
        cin>>x;
        sum+=x;
    }
    if(sum>n)
    {
        cout<<-1<<endl;
    }
    else{
        cout<<n-sum<<endl;
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N;
    cin >> N;
    vector<ll> A(N,0);
    for(auto& a:A){
        cin >> a;
    }
    vector<ll> M(N,0);
    for(int i=0; i<N; i++){
        if(i%2){
            M[0]-=(ll)2*A[i];
        }else{
            M[0]+=(ll)2*A[i];
        }
    }
    M[0]/=(ll)2;
    for(int i=1; i<N; i++){
        M[i]=2*A[i-1]-M[i-1];
    }
    cout_vec(M);
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int a[N],b[N],g,m,n,l = 1e9+7,r,mid;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=2*n-1; i++) {
		scanf("%d",&a[i]);
		l=min(l,a[i]);
		r=max(r,a[i]);
	}
	while (l <= r) {
		mid = l + r >> 1;
		int f = 1e8 + 7,q = 1e8 + 7, cnt = 0;
		for(int i=1; i<=2*n-1; i++)
			if(a[i]>=mid)b[i]=1,cnt++;
		for(int i=n+1,j=n-1; i<=n*2-1&&j>=1; i++,j--) {
			if(b[j]==0&&b[j+1]==0)f=min(f,n-j);
			if(b[i]==0&&b[i-1]==0)f=min(f,i-n);
			if(b[j]==1&&b[j+1]==1)q=min(q,n-j);
			if(b[i]==1&&b[i-1]==1)q=min(q,i-n);	
		}
		if(q<f)l=mid+1;
		else if(q>f) r=mid-1;
		else {
			if(cnt>=n)l=mid+1;
			else r=mid-1;
		}
		memset(b, 0, sizeof b);
	}
	printf("%d", l - 1);
}

Measured memory_bytes: 6400
import java.util.*;
import java.io.PrintWriter;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int res = 0;
    	for (int i = 0; i < n; ++i) {
        	String T = s.substring(i,n);
        	int[] lcp = Zalgo(T);

			for (int j = 0; j < T.length(); ++j) {
            	int l = Math.min(lcp[j], j);
            	res = Math.max(res, l);
        	}
		}
		System.out.println(res);
	}
	static int[] Zalgo(String T){
		char[] S=T.toCharArray();
		int N = S.length;
    	int[] res=new int[N];
    	res[0] = N;
    	int i = 1, j = 0;
    	while (i < N) {
        	while (i+j < N && S[j] == S[i+j]) ++j;
        	res[i] = j;
        	if (j == 0) {++i; continue;}
        	int k = 1;
        	while (i+k < N && k+res[k] < j) {res[i+k] = res[k]; ++k;}
        	i += k; j -= k;
    	}
    	return res;
	}
}



Measured memory_bytes: 55160
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,M,X; 
    cin>>N>>M>>X;

    int ans1=0,ans2=0;
    REP(i,M){
        int a; cin>>a;
        if(a<X) ans1++;
        if(a>X) ans2++;
    }
    cout<<min(ans1,ans2)<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int a,b,c,x,s,i,k,j,t,suma,sumb,y,z;
  suma=0; sumb=0;
  
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&x);
  for(i=0;i<=a;i++){
    if(x-i*500 >= 0){
      y=x-i*500;
	  s=y/100;
	  if(s >= b){
	    for(j=0;j<=b;j++){
	      z=y-j*100;
		  t=z/50;
		  if(t > c){
		    suma=suma;
			}
		  if(t <= c){
		    suma=suma+1;
		  }
	    }
	  }
	  if(s < b){
	    for(j=0;j<=s;j++){
	      z=y-j*100;
		  t=z/50;
		  if(t > c){
		    sumb=sumb;
		  }
		  if(t <= c){
		    sumb=sumb+1;
		  }
        }
	  }
	}
	else{}
  }
  printf("%d\n",suma+sumb);
  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int arr[n+1]={0};
    int ar[n+1];
    for(int i=2;i<=n;i++)
    cin>>ar[i];
    for(int i=2;i<=n;i++)
    ++arr[ar[i]];
    for(int i=1;i<=n;i++)
    cout<<arr[i]<<"\n";
}

Measured memory_bytes: 5244
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

signed main() {
	int n, p;
	int a[200005];
	string s;
	cin >> n >> p >> s;
	rep(i, n) a[i] = s[i] - '0';

	if (p == 2 || p == 5) {
		int ans = 0;
		rep(i, n) {
			if (a[i] % p == 0) {
				ans += i + 1;
			}
		}
		cout << ans << endl;
	}
	else {
		int x[200005];
		int ans = 0;
		map<int, int>mp;
		x[n] = 0;
		mp[0]++;
		for (int i = n - 1; i >= 0; i--) {
			x[i] = (x[i + 1] + mod_pow(10, n - i - 1, p) * a[i]) % p;
			mp[x[i]]++;
		}
		for (auto now : mp) {
			//cout << now.first << " " << now.second << endl;
			ans += (now.second) * (now.second - 1) / 2;
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 4100
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll x, y; cin >> x >> y;

  ll ans = INFll;
  if (x <= y) chmin(ans, y-x);
  if (-x <= y) chmin(ans, y+x+1);
  if (x <= -y) chmin(ans, -y-x+1);
  if (-x <= -y) chmin(ans, -y+x+2);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N,A,B,C,D,E;
  cin>>N>>A>>B>>C>>D>>E;
  int64_t Min=min(min(min(A,B),C),min(D,E));
  int64_t ans=((N-1)/Min)+5;
  cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
import collections as cl
import itertools as it
# import more_itertools as mit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(100000)

n = int(readline())
w = [input().strip() for _ in range(n)]
dic = set()

for num, i in enumerate(w):
    if num == 0:
        dic.add(i)
        continue
    if i in dic or w[num-1][-1] != i[0]:
        print('No')
        sys.exit()
    dic.add(i)
print('Yes')

Measured memory_bytes: 27076
# coding: utf-8

# In[4]:


import numpy as np


# In[13]:


n = int(input())
t,a = map(int, input().split())
h = [int(x) for x in input().split()]


# In[14]:


h = np.array(h)


# In[15]:


print(np.argmin(abs((t - h * 0.006) - a)) + 1)



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

int main() {
  int N;
  cin >> N;

  vector<vector<int>> data(N, vector<int>(2));

   for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> data.at(i).at(j);
    }
  }
  
  bool answer = false;
  
  for (int i = 0; i < N-2; i++) {
    for (int j = 0; j < 2; j++) {
  if (data.at(i).at(0) == data.at(i).at(1) && 
      data.at(i+1).at(0) == data.at(i+1).at(1) && 
      data.at(i+2).at(0) == data.at(i+2).at(1) ) {
    answer = true;
  }
    }
  }
  
  if (answer) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
     
#define int long long 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<typename T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<typename T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T> bool Min(T a, T b) { return a > b ? b : a; }
template<typename T> bool Max(T a, T b) { return a < b ? b : a; }
template<typename T> void de(T a ){
#ifdef LOCAL
	cout<<a<<" ";
#endif
}
const int INF = 2e5+1;

void dfs(int v, vi &par , vi &ans , vi arr[] ){
	if(par[v]==-1 && v<ans.size()) par[v] = v;
	else return;
	de(v);
	ans[par[v]]++;
	for( auto i: arr[v])
		dfs(i,par,ans,arr);
}

void solve(){
	string s ;
	cin>>s;
	if(s[0]=='S') cout<<"Cloudy"<<endl; 
	if(s[0]=='C') cout<<"Rainy"<<endl;
	if(s[0]=='R') cout<<"Sunny"<<endl;
}
 
int32_t main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    	cout.precision(10);
    	cout << fixed;
#ifdef LOCAL
    freopen("input.txt", "rt", stdin);
    freopen("output.txt","w",stdout);
#endif
        int q=1;
#ifdef LOCAL 
        cin>>q;
#endif
        while(q--){
            solve();
        }
               
#ifdef LOCAL
    cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
 
	return 0;
}	
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305,mod=998244353;
int n,k,m,a[N],sum[N];
int dp[N][N][N];
//dp[i][j][h] 第i个坑，用了j个1，移动了k次的方案数
char s[N];
int main()
{
    scanf("%s%d",s+1,&k);
    for(int i=1;s[i];i++) m+=s[i]=='1';
    int t=0;
    for(int i=1;s[i];i++)
        if(s[i]=='0') a[++n]=t,t=0;
    else t++;
    a[++n]=t;
    for(int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
    k=min(k,m);
    dp[0][0][0]=1;
    for(int i=0;i<n;i++)
        for(int j=sum[i];j<=sum[n];j++)
            for(int h=0;h<=k;h++)
        {
            if(!dp[i][j][h]) continue;
            for(int f=max(j,sum[i+1]);f<=sum[n];f++)
                if(h+f-j-a[i+1]<=k)
            {
                if(i+1==n&&f-j>a[i+1]) break;
                int cost=f-j<=a[i+1]?0:f-j-a[i+1];
                dp[i+1][f][h+cost]=(dp[i+1][f][h+cost]+dp[i][j][h])%mod;
            }
        }
    ll ans=0;
    for(int i=0;i<=k;i++) ans=(ans+dp[n][m][i])%mod;
    printf("%lld\n",ans);
}


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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

int N,A[100],a[102];;
const char *possible="Possible",*impossible="Impossible";

int main(){
  cin>>N;
  REP(N)cin>>A[i];
  sort(A,A+N);
  int max=A[N-1];
  int min=A[0];
  if((max/2+max%2)>min){
    cerr<<"err1"<<endl;
    goto IMP;
  }
  REP(N)a[A[i]]++;
  if((a[A[0]]==1)!=(A[N-1]%2==0)){
    cerr<<a[A[0]]<<":"<<A[N-1]<<endl;
    cerr<<"err2"<<endl;
    goto IMP;
  }
  if(a[A[0]]>2){
    cerr<<"err4"<<endl;
    goto IMP;
  }
  for (int i = min+1; i <= max; i++) {
    cerr<<"err3"<<endl;
    if(a[i]<2)goto IMP;
  }
  cout<<possible<<endl;
  return 0;
IMP:
  cout<<impossible<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll a[3],b[3] = {};
    ll c[3][3] = {};
    ll test[3][3] = {};
    rep(i,0,3) rep(j,0,3) cin >> c[i][j];
    b[0] = 0; 
    a[0] = c[0][0]; a[1] = c[0][1] - b[0]; a[2] = c[0][2] - b[0];
    b[1] = c[1][0] - a[0]; b[2] = c[2][0] - a[0];

    rep(i,0,3){
        rep(j,0,3){
            if(c[i][j] != a[j] + b[i]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;


    return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long n; cin >> n;
    long m = (sqrt(8*n + 1) - 1)/2;
    while(m*(m+1)/2 < n){
        m++;
    }
    long q = m*(m+1)/2 - n;
    for(long i = m; i > 0; i--){
        if(i != q) cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// ----------------------In the name of Allah-------------------------- \\

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

#define ll long long

const ll MAXlog = 20, MAX = 1e5+1, mod = 1e9+7, inf = 2e9+2;

ll n, arr;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	ll a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr;
		if (arr % 4 == 0) a ++;
		else if (arr % 2 == 0) b ++;
	}
	ll res = (a + b/2) * 2 ;
	if (res >= n) return cout << "Yes" << endl, 0;
	res = n - res;
	if (res < 2) cout << "Yes" << endl;
	else
		cout <<"No" << endl;

	return 0;
}


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

int main() {
	vector<int> array;
	int stock;

	while (cin >> stock) {
		if (stock == 0) break;
		array.push_back(stock);
	}

	int time[101] = { 0 };

	for (int i = 0;i < array.size();i++) {
		time[array.at(i)]++;
	}

	int max = 0;
	for (int j = 0;j < 100;j++) {
		if (time[j + 1] > max) {
			max = time[j + 1];
		}
	}
	for (int k = 0;k < 100;k++) {
		if (time[k + 1] == max) {
			cout << k + 1 << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int N,d[200010],dp[200010],ans[200010];
vector<int> edge[200010];

void dfs(int now,int prv){
    int curr=lower_bound(dp,dp+N,d[now])-dp, save=dp[curr];
    ans[now]=max(ans[now],curr);
    dp[curr]=min(dp[curr],d[now]);
    for(auto i:edge[now]) if(i!=prv) ans[i]=max(ans[i],ans[now]), dfs(i,now);
    dp[curr]=save;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N;
    for(int i=1;i<=N;i++) cin>>d[i];
    for(int i=1;i<N;i++){
        int u,v; cin>>u>>v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    memset(dp,inf,sizeof(dp));
    dp[0]=-1; dfs(1,0);
    for(int i=1;i<=N;i++) cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 31212
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int d = in.nextInt();
        int[] ci = new int[26];
        HeuristicsTuple[] cTuples = new HeuristicsTuple[26];
        int[][] sdi = new int[d][26];
        for(int i=0; i<26; i++) {
            ci[i] = in.nextInt();
            HeuristicsTuple tuple = new HeuristicsTuple();
            tuple.type = i;
            tuple.c = ci[i];
            cTuples[i] = tuple;
        }
        for(int day=0; day<d; day++) {
            for(int i=1; i<26; i++) {
                sdi[day][i] = in.nextInt();
            }
        }
        
        Arrays.sort(cTuples);
        
        int[] ans = new int[d];
        for(int day=d-1; day>=d-26 && day>=0; day--) {
            int tupleIndex = d-day-1;
            ans[day] = cTuples[tupleIndex].type;
        }
        for(int day=0; day<d-26; day++) {
            int maxS = 0;
            int maxStype = 1;
            for(int i=0; i<26; i++) {
                if(maxS < sdi[day][i]) {
                    maxS = sdi[day][i];
                    maxStype = i;
                }
            }
            ans[day] = maxStype;
        }
        for(int day=0; day<d; day++) {
            System.out.println(ans[day]+1);
        }
    }
}

class HeuristicsTuple implements Comparable<HeuristicsTuple>{
    int type;
    int c;
    
    @Override
    public int compareTo(HeuristicsTuple o) {
        return o.c - this.c; // desc
    }
}


Measured memory_bytes: 46396
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

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

int oeis[5] = {105, 135, 165, 189, 195};


int main() {
  int n;
  cin >> n;
  if (n < 105) cout << "0" << endl;
  else if (n < 135) cout << "1" << endl;
  else if (n < 165) cout << "2" << endl;
  else if (n < 189) cout << "3" << endl;
  else if (n < 195) cout << "4" << endl;
  else cout << "5" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N; i++ ) {
   if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
 }
printf("\n");
}


void insertionSort(int A[], int N) {
  int j, i, v;
  for ( i = 1; i < N; i++) {
   v = A[i];
   j = i - 1;
  while ( j >= 0 && A[j] > v) {
    A[j + 1] = A[j];
    j--;
}
A[j + 1] = v;
trace(A, N);
}
}

int main() {
int N, i, j;
int A[100];

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

trace(A, N);
insertionSort(A, N);

return 0;
}


Measured memory_bytes: 2072
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	short n, m;
	BitSet[] yes, no;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			m = sc.nextShort(); n = sc.nextShort();
			if( (m|n) == 0 ) break;
			
			yes = new BitSet[m];
			no = new BitSet[m];
			for(int i=0;i<m;i++) {
				yes[i] = new BitSet(n); no[i] = new BitSet(n);
			}
			
			for(int i=0;i<n;i++) {
				String l = sc.next();
				for(int j=0;j<m;j++) {
					if(l.charAt(j) == '0') no[j].set(i);
					else yes[j].set(i);
				}
			}
			mem = new short[1<<m][1<<m]; 
			for(short[] a: mem) fill(a, (short)-1);
			System.out.println(solve(0, 0));
		}
	}
	short[][] mem;
	short solve(int S, int Y) {
		if(mem[S][Y] >= 0) return mem[S][Y];
		BitSet bs = new BitSet(n);
		bs.set(0, n, true);
		for(int i=0;i<m;i++) if(((S>>i)&1)==1) {
			if(((Y>>i)&1)==1) bs.and(yes[i]);
			else bs.and(no[i]);
		}
		
		if(bs.cardinality()<=1) return mem[S][Y] = 0;
		short min = m;
		for(int i=0;i<m;i++) if(((S>>i)&1) == 0) {
			min = (short)min(min, max(solve(S|(1<<i), Y), solve(S|(1<<i), Y|(1<<i))) + 1);
		}
		
		return mem[S][Y] = min;
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 166864
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int max = 0;
		int temp = 0;
		long pre = sc.nextLong();
		long next = 10000000000L;
		for (int i = 0; i < n - 1; i++) {
			next = sc.nextLong();
			if (pre >= next) {
				temp++;
				if (temp >= max) {
					max = temp;
				}
			} else {
				temp = 0;
			}
			pre = next;
		}
		System.out.println(max);
		sc.close();
	}
}


Measured memory_bytes: 50260
import math

n, q = map(int, input().split())

# make a list whose length is 2^i - 1.
n = pow(2, math.ceil(math.log2(n)))
max_v = 2147483647

A = [max_v for i in range(2 * n - 1)]


def update(i, x):
    i += n - 1
    A[i] = x

    while i > 0:
        i = (i - 1) // 2
        A[i] = min(A[i * 2 + 1], A[i * 2 + 2])

def find(a, b, k, l, r):
    if r <= a or b <= l:
        return max_v
    if a <= l and r <= b:
        return A[k]
    else:
        vl = find(a, b, k * 2 + 1, l, (l + r) // 2)
        vr = find(a, b, k * 2 + 2, (l + r) // 2, r)
        return min(vl, vr)


for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        update(x, y)
    else:
        ans = find(x, y + 1, 0, 0, n)
        print(ans)

Measured memory_bytes: 11232
#include <stdio.h>
#include <math.h>

int main(void)
{
  int n;
  
  scanf("%d", &n);
  
  if( n % 10 == 3 ){
      printf("bon\n");
  } else if( n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8 ){
      printf("pon\n");
  } else {
      printf("hon\n");
  }

  return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,k,j;
    bool flag = true;
    cin >> n >> m >> k;
    for(int i = 0; i <= m; i++){
        j=0;
        if((m-2*i)!=0){
            j=(k-i*n)/(m-2*i);
        }
        //cout << i << " " << j << endl;
        if(i*n+j*m-2*i*j == k && 0<=j && j<=n){
            cout << "Yes" << endl;
            flag = false;
            break;
        }
    }
    if(flag) cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,a,b,q;

int main(){
  cin >> a>>b>>q;

  vi s(a);
  vi t(b);
  vi x(q);

  REP(i,a){
	  cin>>s[i];
  }
  REP(i,b){
	  cin>>t[i];
  }
  REP(i,q){
	  cin>>x[i];
  }

	

	REP(i,q){
		ll ans=1e11;
		int lIters = upper_bound(s.begin(),s.end(), x[i])-s.begin()-1;
		int lItert = upper_bound(t.begin(),t.end(), x[i])-t.begin()-1;
		ll s0,s1;
		ll t0,t1;
		if ((lIters>=0)&(lIters<a-1)){
			s0=s[lIters];
			s1=s[lIters+1];
		}else{
			s0=s1=s[max(min(lIters,(int)a-1),0)];
		}
		if ((lItert>=0)&(lItert<b-1)){
			t0=t[lItert];
			t1=t[lItert+1];
		}else{
			t0=t1=t[max(min(lItert,(int)b-1),0)];
		}
		//8パターン考える
		//xi s0 t0
		ans=min(ans,abs(x[i]-s0)+abs(s0-t0));
		//xi s0 t1
		ans=min(ans,abs(x[i]-s0)+abs(s0-t1));
		//xi s1 t0
		ans=min(ans,abs(x[i]-s1)+abs(s1-t0));
		//xi s1 t1
		ans=min(ans,abs(x[i]-s1)+abs(s1-t1));


		//xi t0 s0
		ans=min(ans,abs(x[i]-t0)+abs(s0-t0));
		//xi t0 s1
		ans=min(ans,abs(x[i]-t0)+abs(s1-t0));
		//xi t1 s0
		ans=min(ans,abs(x[i]-t1)+abs(s0-t1));
		//xi t1 s1
		ans=min(ans,abs(x[i]-t1)+abs(s1-t1));
		
		//cout<<" "<<lIters<<" "<<lItert<<" "<<ans<<endl;
		cout<<ans<<endl;
	}


  
  return 0;
}



Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>

typedef long long ll;
using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (b % a == 0) cout << a + b << endl;
    else cout << b - a << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX 500003
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=998244353;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a);
        }
        a=(a*a);
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;
    
    int t;
    t=1;
    while(t--)
    {   
        int n,val;
        vi v;
        int sum=0;
        cin>>n;

        rep(i,n)
        {
            cin>>val;
            sum^=val;
            v.pb(val);
        }

        rep(i,n)
        {
            cout<<(sum^v[i])<<" ";
        }
    }
}


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

int main(){
    int a,b;
    cin>>a>>b;
    if (a+b>=10)
    {
        /* code */
        cout<<"error"<<endl;
    }
    else
    {
        cout<<a+b<<endl;
    }
    
    
    
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define ios       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define forn(i,a,n) for (ll i = a; i < (ll)(n); i++)
#define fon(i,n) for (ll i = (ll)n-1; i >=0; i--)
#define vi          vector<ll>
#define vii vector<pair<ll,ll>>
#define all(a)      (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ciin(v) forn(i,0,v.size()) cin>>v[i]
#define coutt(v) forn(i,0,v.size()) cout<<v[i]<<" "
using namespace std;
ll mod=1e9+7;
int main(){
    ios
    ll test;
    test=1;
    // cin>>test;
    while(test--){
        ll n,m;
        cin>>n>>m;
        vector<vector<char>> v(n,vector<char> (m));
        vector<vector<int>> dp(n,vector<int> (m,0));
        forn(i,0,n){
            forn(j,0,m){
                cin>>v[i][j];
            }
        }
        forn(i,0,n) {
            if(v[i][0]=='.') dp[i][0]=1;
            else break;
        }
        forn(i,0,m) {
            if(v[0][i]=='.') dp[0][i]=1;
            else break;
        }
        forn(i,1,n){
            forn(j,1,m){
                if(v[i][j-1]!='#')
                dp[i][j]=dp[i][j-1]%mod;
               if(v[i-1][j]!='#')
                dp[i][j]+=dp[i-1][j]%mod;
            }
        }
        cout<<dp[n-1][m-1]%mod;



 
 }}


Measured memory_bytes: 8180
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  deque<char> s;
  string ff;
  cin >> ff;
  for(int i = 0;i < ff.size();i++){
  s.push_back(ff.at(i));}
  int d;
  cin >> d;
  int f = 0;
  for(int i = 0;i < d;++i)
  {int q;
   cin >> q;
   if(q == 1){++f;}
   else{int r;
        char x; cin >> r >> x;
        if((f + r) % 2 == 1){  
          s.push_front(x);}       
        else{
          s.push_back(x);}
       }
   
  }
  if (f % 2 == 1){
    reverse(s.begin(), s.end());}
  for(int i = 0;i < s.size();i++){
    
  cout << s.at(i);}
    cout << endl;
}

Measured memory_bytes: 896
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  ll n, a, b; cin >> n >> a >> b;

  if ((b - a) % 2 == 0) outl((b - a) / 2);
  else outl(min((a + b - 1) / 2, n - (a + b - 1) / 2));
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){__
	int x,y;
	cin >> x >> y;
	if(y < x){
		cout << "No\n";
		return 0;
	}
	if(y%2){
		cout << "No\n";
		return 0;
	}
	if((y-2*x) % 2 != 0 || (4*x - y)%2 != 0){
		cout << "No\n";
	}
	int b = (y-2*x)/2;
	int a = (4*x - y)/2;
	if(a<0 || b < 0){
		cout << "No\n";
		return 0;
	}
	if(a+b == x && (2*a + 4*b) == y){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
	return 0;
}



Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    int a, b; cin >> a >> b;
    string s, t;
    for(int i = 0; i < b; i++)
    {
        s += to_string(a);
    }
    for(int i = 0; i < a; i++)
    {
        t += to_string(b);
    }
    if(s > t) cout << t << endl;
    else cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

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


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,d,m,n,o,p;
    cin>>a>>b>>c>>d;
    m=a*c;
    n=a*d;
    o=b*c;
    p=b*d;
    a=max(m,n);
    b=max(o,p);
    c=max(a,b);
    cout<<c;
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
using lint = long long;
const int INF = 1 << 29;
const double EPS = 1e-9;
using namespace std;

class UnionFind {
  std::vector<int> parent_;

 public:
  UnionFind(int size_num) : parent_(size_num, -1) {}
  int find(int x) {
    if (parent_[x] < 0) return x;
    return parent_[x] = find(parent_[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (parent_[x] > parent_[y]) std::swap(x, y);
    parent_[x] += parent_[y];
    parent_[y] = x;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int size(int x) {
    return -parent_[find(x)];
  }
  int group_size(void) {
    int sum = 0;
    rep(i, parent_.size()) {
      if (parent_[i] < 0) ++sum;
    }
    return sum;
  }
};

int main(void) {
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    --x;
    --y;
    uf.unite(x, y);
  }
  cout << uf.group_size() << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans=0;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n-1) cin >> c[i];
    int before = a[0];
    rep(i,n){
        ans+=b[a[i]-1];
        if(a[i]==before+1){
            ans+=c[before-1];
            // cout << c[before-1] <<endl;
        }
        before = a[i];
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);
	    String s=gs();

        
	    System.out.println(s.substring(0,4) + " " + s.substring(4,12));
//	    if (n%10==3) {
//	    	System.out.print("bon");
//	    }else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
//	    	System.out.print("pon");
//	    } else {
//	    	System.out.print("hon");
//	    }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 39112
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main() {
    int k;
    cin>>k;
    int gu=0;
    int ki=0;
    for(int i=1; i<=k;i++)
    {
      if(i%2==1)
        ++ki;
      else ++gu;
    }
cout<<ki*gu<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
  long long H;
  long long W;
  cin >> H >> W;
  long long S;
  long long answer;
  S=H*W;
  if(H==1||W==1){
    answer = 1;
  }else{
  if(S%2==0){
    answer = S/2;
  }else if(S%2==1){
    answer = S/2 + 1;
  }
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256