akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <tuple>
#include <vector>

using lli=long long int;
const lli mod=1000000007;

constexpr lli mod_inv(lli a){
  lli b=mod, u=1, v=0, tmp=0;
  while(b){
    lli t = a/b;
    a -= t*b;
    tmp = a; a = b; b = tmp; //swap(a, b);
    u -= t*v;
    tmp = u; u = v; v = tmp; //swap(u, v);
  }
  return ((u%mod)+mod)%mod;
}

constexpr lli fac_pre_num = 100100;
struct fac_pre_struct{
  lli fac[fac_pre_num], finv[fac_pre_num];
  constexpr fac_pre_struct() : fac{}, finv{} {
    fac[0] = fac[1] = finv[0] = finv[1] = 1;
    for(int i = 2; i < fac_pre_num; i++) fac[i] = i*fac[i-1] % mod;
    finv[fac_pre_num-1] = mod_inv(fac[fac_pre_num-1]);
    for(int i = fac_pre_num-1; i > 2; i--) finv[i-1] = i*finv[i] % mod;
  }
};
constexpr fac_pre_struct fac_pre;

std::tuple<lli, lli, lli> fac_3_mod(lli a, lli b, lli c){
  lli t = 1;
  lli tb=1, tc=1;
  for(int i = 1; i <= a; i++){
    t = (t*i)%mod;
    if(i == b) tb = t;
    if(i == c) tc = t;
  }
  return std::make_tuple(t, tb, tc);
}

lli mod_comb(lli n, lli k){
  if(n < k || k < 0 || n < 0) return 0;
  if(n < fac_pre_num) return fac_pre.fac[n] * (fac_pre.finv[k] * fac_pre.finv[n-k] % mod) % mod;
  lli fn, fk1, fk2;
  std::tie(fn, fk1, fk2) = fac_3_mod(n, k, n-k);
  return fn * (mod_inv(fk1) * mod_inv(fk2) % mod) % mod;
}

class mod_comb_mul{
  std::vector<lli> fac, finv;
  public:
  mod_comb_mul() :
    fac(&fac_pre.fac[0], &fac_pre.fac[fac_pre_num]),
    finv(&fac_pre.finv[0], &fac_pre.finv[fac_pre_num]){}
  lli comb(lli n, lli k){
    if(n < k || k < 0 || n < 0) return 0;
    int pre_size = fac.size();
    if(n >= pre_size){
      fac.resize(n+1);
      finv.resize(n+1);
      for(int i = pre_size; i <= n; i++) fac[i] = i*fac[i-1] % mod;
      finv[n] = mod_inv(fac[n]);
      for(int i = n; i > pre_size; i--) finv[i-1] = i*finv[i] % mod;
    }
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
  }
} mcm;

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

  lli ans=0;
  for(int i=H-A-1, j=B; i>=0 && j<=W; --i,++j){
    (ans += (mcm.comb(i+j, i)*mcm.comb(H-i+W-j-2,H-i-1))%mod) %= mod;
  }

  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (b == 100) {
    a *= 1000;
  } else if (b >= 10) {
    a *= 100;
  } else {
    a *= 10;
  }
  int c = a + b, d = sqrt(c);
  if (d * d == c) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}


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

Q = []
for _ in range(N):
    x, y, h = map(int, input().split())
    Q.append((h, x, y))
Q.sort(reverse=True)

seikai = True
for yc in range(101):
    seikai = False
    for xc in range(101):
        valid = True
        h, x, y = Q[0]
        hc = abs(x-xc) + abs(y-yc) + h
        for (h, x, y) in Q:
            if h == 0:
                if hc > abs(x-xc) + abs(y-yc) + h:
                    valid = False
                    break
            else:
                if hc != abs(x-xc) + abs(y-yc) + h:
                    valid = False
                    break
        if not valid:
            continue
        seikai = True
        break
    if seikai:
        break

print(xc, yc, hc)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;

int main(void){
    string str1,str2,temp;
    int count = 0;
    cin >> str1;
    temp = "";
    while(true){
        cin >> str2;
        if (str2 == "END_OF_TEXT"){
            break;
        }
        if ((tolower(str2[0]) == tolower(str1[0])) && (str2.size() == str1.size())){
            for (int j = 0; j < str1.size(); j++){
                temp += tolower(str2[j]);
            }
            if (temp == str1){
                count += 1;
            }            
            temp = "";
        }
    }
    cout << count << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

#define INF 1e10

using namespace std;

struct edge{int to; ll cost; };

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; cin>>n>>m;
	ll l; cin>>l;
	vector<vector<edge> > adj(n+1);
	rep(i, m){
		int a, b; cin>>a>>b;
		ll c; cin>>c;
		edge e;
		e.to = b; e.cost = c;
		adj[a].pb(e);
		e.to = a;
		adj[b].pb(e);
	}

	vector<vi> G(n+1);
	for(int i=1; i<=n; i++){
		using P = pair<ll, int>;
		priority_queue<P, vector<P>, greater<P> > que;
		vector<ll> dist(n+1, INF);
		dist[i] = 0;
		que.emplace(0ll, i);
		while(que.size()){
			ll cost; int v;
			tie(cost, v) = que.top(); que.pop();
			if (dist[v] < cost) continue;
			for(auto e:adj[v]){
				if (dist[e.to] > dist[v]+e.cost){
					dist[e.to] = dist[v]+e.cost;
					que.emplace(dist[e.to], e.to);
				}
			}
		}
		for(int j=0; j<dist.size(); j++){
			if (dist[j]<=l) G[i].pb(j);
		}
	}

	vector<vi> ans(n+1, vi(n+1, INT_MAX));
	for(int i=1; i<=n; i++){
		queue<pi> que;
		vector<bool> use(n+1, false);
		use[i] = true;
		que.push(mp(0, i));
		while(que.size()){
			pi p = que.front(); que.pop();
			ans[i][p.se] = min(ans[i][p.se], p.fi-1);
			for(auto e:G[p.se]){
				if (!use[e]){
					que.emplace(p.fi+1, e);
					use[e] = true;
				}
			}
		}
	}

	int Q; cin>>Q;
	rep(i, Q){
		int s, t; cin>>s>>t;
		if (ans[s][t] != INT_MAX){
			cout << ans[s][t] << "\n";
		}else{
			cout << "-1\n";
		}
	}
	return 0;
}


Measured memory_bytes: 6084
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var a = Int32.Parse(Console.ReadLine());
        var b = Int32.Parse(Console.ReadLine());
        var ansl = new List<Int32>() { 1, 2, 3 };
        ansl.Remove(a);
        ansl.Remove(b);
        Console.WriteLine(ansl[0]);
    }
}

Measured memory_bytes: 13268
N=int(input())
A=[0]*N
B=[0]*N
x,y=0,0
for i in range(N):
  x,y=map(int,input().split())
  A[i]=x
  B[i]=y
A.sort()
B.sort()
if N&1:
  print(B[N//2]-A[N//2]+1)
else:
  print(B[N//2]+B[N//2-1]-A[N//2]-A[N//2-1]+1)

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

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


Measured memory_bytes: 256
def main():
    MOD=10**9+7
    n=int(input())
    x=[0 for i in range(60)]
    a=list(map(int,input().split()))

    for i in range(n):
        k=0
        while a[i]>0:
            if a[i]&1:
                x[k]+=1
            a[i]>>=1
            k+=1
    ans=0
    b=1
    for i in range(60):
        ans+=x[i]*(n-x[i])*b
        ans%=MOD
        b=(b*2)%MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 125624
/*
    if you can't see the repay
    Why not just work step by step
    rubbish is relaxed
    to ljq
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
using namespace std;

#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define lc (rt<<1)
#define rc (rt<<11)
#define mid ((l+r)>>1)

typedef pair<int,int> pll;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll _INF = 0xc0c0c0c0c0c0c0c0;
const ll mod =  (int)1e9+7;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll ksm(ll a,ll b,ll mod){int ans=1;while(b){if(b&1) ans=(ans*a)%mod;a=(a*a)%mod;b>>=1;}return ans;}
ll inv2(ll a,ll mod){return ksm(a,mod-2,mod);}
void exgcd(ll a,ll b,ll &x,ll &y,ll &d){if(!b) {d = a;x = 1;y=0;}else{exgcd(b,a%b,y,x,d);y-=x*(a/b);}}//printf("%lld*a + %lld*b = %lld\n", x, y, d);
const int MAX_N = 100025;
int dp[MAX_N],in[MAX_N];
vector<int > G[MAX_N];
int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    queue<int > q;
    int n,m,a,b,ans = 0;scanf("%d%d",&n,&m);
    for(int i = 1;i<=m;++i) scanf("%d%d",&a,&b),in[b]++,G[a].push_back(b);
    for(int i = 1;i<=n;++i) if(!in[i]) q.push(i);
    while(!q.empty())
    {
        int now = q.front();
        q.pop();
        int sz = G[now].size();
        for(int i = 0;i<sz;++i)
        {
            dp[G[now][i]] = max(dp[G[now][i]],dp[now]+1);
            in[G[now][i]]--;
            if(in[G[now][i]]==0) q.push(G[now][i]);
        }
    }
    for(int i = 1;i<=n;++i) ans = max(ans,dp[i]);
    printf("%d\n",ans);
    //fclose(stdin);
    //fclose(stdout);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 9952
#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 ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll mypow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}

void solve() {
  ll n, m; cin >> n >> m;
  outl(mypow(2, m) * 100 * (18 * m + n));
}

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

  solve();
}


Measured memory_bytes: 256
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	K := sc.i()
	X := sc.i()

	if 500*K >= X {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

vector<int> enum_prime(int n){   // containing n
    vector<int> res;
    if (n <= 1) return res;
    vector<bool> p(n + 1);
    fill(p.begin() + 2, p.end(), true);
    for(int i = 2; i <= n; i++){
        if(p[i]){
            res.push_back(i);
            for(int j = i * 2; j <= n; j += i) p[j] = false;
        }
    }
    return res;
}

vector<int> Zalgorithm(string &s){
    int n = s.size();
    vector<int> a(n);
    a[0] = n;
    int i = 1, j = 0;
    while(i < n){
        while(i + j < n && s[i + j] == s[j]) j++;
        a[i] = j;
        if(j == 0){
            i++;
            continue;
        }
        int k = 1;
        while(i + k < n && k + a[k] < j){
            a[i + k] = a[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return a;
}

int main()
{
    string w;
    cin >> w;
    int n = w.size();
    bool f = true;
    for(int i = 1; i < n; i++){
        if(w[i] != w[i - 1]) f = false;
    }
    if(f){
        cout << n << endl;
        cout << 1 << endl;
        return 0;
    }
    vector<int> a = Zalgorithm(w);
    bool b[500005]{0};
    int r = -1;
    for(int i = 1; i < n; i++){
        int j;
        for(j = i; j < n; j += i){
            if(a[j] < i) break;
            b[j + i] = true;
        }
        if(j == n){
            r = i;
            break;
        }
    }
    if(r == -1){
        cout << 1 << endl;
        cout << 1 << endl;
        return 0;
    }
    reverse(w.begin(), w.end());
    a = Zalgorithm(w);
    for(int i = 1; i < n; i++){
        int j;
        for(j = i; j < n; j += i){
            if(a[j] < i) break;
            b[n - (j + i)] = true;
        }
        if(j == n){
            r = i;
            break;
        }
    }
    int ans = n + 1;
    for(int i = 0; i <= n; i++){
        ans -= b[i];
    }
    cout << 2 << endl;
    cout << ans << endl;
}


Measured memory_bytes: 5252
#include <bits/stdc++.h>
#include <cstdlib> // abs(x-y)
#include <iomanip> // 出力の桁数指定
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  
  rep (i, 0, n-2) {
    if (s.at(i) == 'A' and s.at(i+1) == 'B' and s.at(i+2) == 'C')
      ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int main(){
  int j,n,i,count=0,flag,temp;
  int A[N];

  scanf("%d",&n);
  i=0;
  while(i<n){
    scanf("%d",&A[i]);
    if(A[i]>=0 && A[i]<=100)i++;
  }
  flag = 1;
  j=0;
  while(flag == 1){
    flag = 0;
    for(i=n-1; i > j; i--){
      if(A[i] < A[i-1]){
      temp = A[i];
      A[i] = A[i-1];
      A[i-1] = temp;
      flag = 1;
      count++;
      }
    }
      j++;
  }
  
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2128
#include <iostream>

using namespace std;


int main()
{
	int H[100], W[100], count,count1;
	count = 0;
	count1 = 0;

	while (count < 100)
	{
		cin >> H[count] >> W[count];
		if (H[count] == 0 && W[count] == 0)
		{
			break;
		}
		count++;
		count1++;
	}
	for (count= 0; count <count1 ; count++)
	{
		for (int loopH = 0; loopH <H[count]; loopH++)
		{
			if (loopH == 0||loopH ==H[count]-1)
			{
				for (int loopW = 0; loopW <W[count]; loopW++)
				{
					cout << "#";
				}
			}
			else
			{
				for (int loopW = 0; loopW <W[count]; loopW++)
				{
					if (loopW == 0 || loopW == W[count]-1)
						cout << "#";
					else
						cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}




Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    string s;
    cin >> n >> s;
    if (n >= 3200) cout << s;
    else cout << "red";
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int a,b; char op; cin >> a >> op >> b;
    cout << ((op == '+')? a+b:a-b);
}


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

using namespace std;
#define ll long long

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

    vector<long long> arr(n + 1);
    for(int i=0;i<=n;i++)
        cin>>arr[i];

    if(arr[n] == 0)
        {
            cout<<-1<<endl;
            return 0;
        }

    vector<long long > maxVal(n+1);
    vector<long long> minVal(n+1);

    minVal[n] = maxVal[n] = arr[n]; 

    for(int i = n-1 ; i>=0;i--)
    {
        maxVal[i] = maxVal[i+1] + arr[i];
        minVal[i] = (minVal[i+1] + arr[i] + 1)/2;
    }
/*
    for(auto it:minVal)
        cout<<it<<" ";
    
    cout<<endl;
    for(auto it:maxVal)
        cout<<it<<" ";
    cout<<endl;
*/
    if((arr[0] > 0) && (n > 0))
    {
        cout<<-1<<endl;
    }
    else if( n == 0)
    {
        if(arr[0] == 1)
            cout<<1<<endl;
        else
            cout<<-1<<endl;
    }
    else
    {
        long long ans = 1;
        long long count = 1;
        bool flag = false;

        if(minVal[0] > 1)
            flag = true;

        for(int i=1;i<=n;i++)
        {
            if(minVal[i] > 2*count || (arr[i] > 2 * count) || (count == 0))
            {
                flag = true;
                break;
            }
            count = min(2*(count -arr[i-1]), maxVal[i]);
            ans +=count ;
        }
        if(flag)
            cout<<-1<<endl;
        else
            cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 5636
#C - Back and Forth
sx, sy, tx, ty = map(int,input().split())

route = ''

updown_num = ty - sy # 0>なら goalは上方向
rightleft_num = tx - sx #0>ならgoalは右方向

#route1
for i in range(updown_num):
    route += 'U'
for i in range(rightleft_num):
    route += 'R'
#route2
for i in range(updown_num):
    route += 'D'
for i in range(rightleft_num):
    route += 'L'
#route3
route += 'L'
for i in range(updown_num + 1):
    route += 'U'
for i in range(rightleft_num + 1):
    route += 'R'
route += 'D'
#route4
route += 'R'
for i in range(updown_num + 1):
    route += 'D'
for i in range(rightleft_num + 1):
    route += 'L'
route += 'U'

print(route)

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

int main(){
    int n,l; cin >> n >> l;
    int ans;
    if(l >= 0){
        ans = l*(n-1) + ((n-1)*n)/2;
    }else{
        if(n+l-1 >= 0){
            ans = ((l + l-1+n)*n)/2;
        }else{
            ans = ((l + l-1+(n-1))*(n-1))/2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
data = [[0 for i in range(3)] for j in range(N)]
for i in range(N):
    data[i][0],data[i][1],data[i][2] = [int(s) for s in input().split()]


for p in data:
    if p[2] != 0:
        base_x = p[0]
        base_y = p[1]
        base_height = p[2]


for Cx in range(0,101):
    for Cy in range(0,101):
        height = abs(base_x-Cx)+abs(base_y-Cy)+base_height
        for p in data:
            if p[2] != max([height-abs(Cx-p[0])-abs(Cy-p[1]),0]):
                break
        else:
            print(str(Cx)+' '+str(Cy)+' '+str(height))
            exit()
     

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<cstring>
#include<stdio.h>
#include<algorithm>
using namespace std;
	char a[100];
    char b[50];
    char c[100];
int main()
{
    string s[100];
	int i,k,l,L,n,M,m,h,flag,j;
    cin>>a;
    cin>>b;
	l=strlen(a);
	L=strlen(b);
	h=0;
	flag=0;
	for(i=0;i<l;i++)
	{
		if(a[i]=='?'||a[i]==b[0])
		{
			n=1;
			for(k=1,m=i+1;k<L;k++,m++)
			{
				if(a[m]=='?'||a[m]==b[k])
					n++;
			}
		}
		if(n==L)
		{   M=i;
            strcpy(c,a);
            for(j=0;j<l;j++)
            {
                if(j==M)
                {
                    for(k=0;k<L;k++)
                    {
                    c[j]=b[k];
                    j++;
                    }
                    j--;
                }
                else if(a[j]=='?')
                    c[j]='a';
            }
            s[h]=c;
            h++;
            n=0;
            flag=1;
            continue;
		}
	}
	if(flag==0)
		cout<<"UNRESTORABLE";
		else{
            sort(s,s+h);
            cout<<s[0];
		}
}


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




#define MOD 1000000007
typedef long long ll;
ll modpow(ll a, ll n) {
	a %= MOD;
	if (a == 0) return 0;
	ll r = 1;
	while (n) r = r*((n % 2) ? a : 1) % MOD, a = a*a%MOD, n >>= 1;
	return r;
}
vector<ll> enumdiv(ll n) {
	vector<ll> S;
	for (ll i = 1; i*i <= n; i++) if (n%i == 0) { S.push_back(i); if (i*i != n) S.push_back(n / i); }
	sort(S.begin(), S.end());
	return S;
}
//-----------------------------------------------------------------
ll N, K;
map<ll, ll> memo;
ll num(ll d) {
	if (memo.find(d) != memo.end()) return memo[d];

	ll ret = modpow(K, (d + 1) / 2);
	
	auto v = enumdiv(d);
	for (ll dd : v) if (dd != d) {
		ret = (ret - num(dd) + MOD) % MOD;
	}

	return memo[d] = ret;
}
//-----------------------------------------------------------------
int main() {
	cin >> N >> K;

	ll ans = 0;
	auto v = enumdiv(N);
	for (ll d : v) {
		if (d % 2)
			ans = (ans + num(d) * d) % MOD;
		else
			ans = (ans + num(d) * d / 2) % MOD;
	}

	cout << ans << endl;
}

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

using namespace std;

const int MOD = 1e9 + 7;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> pref(k+1), dp(k+1);
  dp[0] = 1;
  for(int kid = 1;kid<=n;kid++){
    int c;
    cin >> c;
    pref[0] = dp[0];
    for(int i=1; i<=k; ++i) {
      pref[i] = (pref[i-1] + dp[i]) % MOD;
      dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0)) % MOD;
    }
  }

  int ans = dp[k];
  if(ans < 0) ans += MOD; 
  printf("%d\n",ans);

  return 0;
}

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

int main(){
  int n,m,a[100][100],b[100],c[100];
  cin>>n>>m;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  
  for(int j=0;j<m;j++) cin>>b[j];

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      c[i]+=a[i][j]*b[j];
    }
  }
 
  for(int i=0;i<n;i++) cout<<c[i]<<endl;

  return 0;
}



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

int main() {
  int a, b, c, x, y;
  scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
  c *= 2;
  int ans = 0;
  if (c < a + b) {
    int t = min(x, y);
    ans += t * c;
    x -= t;
    y -= t;
    if (x > 0)
      ans += min(a, c) * x;
    if (y > 0)
      ans += min(b, c) * y;
  } else {
    ans = a * x + b * y;
  }
  printf("%d\n", ans);
  return 0;
}

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

int main(){
    int N ;
    cin >> N;
    vector<int> num(N);
    for(int i = 0 ; i < N; i++){
        cin >> num.at(i);
    }
    sort(num.begin(), num.end());
    reverse(num.begin(), num.end());

    int alice = 0;
    int bob = 0;
    bool aliceFlag = true;
    for(int n : num){
        if(aliceFlag == true){
            alice += n;
            aliceFlag = false;
        }else{
            bob += n;
            aliceFlag = true;
        }

    }

    cout << alice - bob << endl;
}

Measured memory_bytes: 3612
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

inf = float('inf')
closest = inf
closest_i = inf
for i, v in enumerate(h):
    if abs(a - (t - 0.006*v)) < closest:
        closest = abs(a - (t - 0.006*v))
        closest_i = i + 1
print(closest_i)

Measured memory_bytes: 9248
// VSCF.cpp : Defines the entry point for the console application.
//
#include <cassert>
#include <functional>
#include <cmath>
#include <list>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <sstream>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define int long long
#define MAXN 1000010
typedef long double LD;

template <typename T>
T modpow(T base, T exp, T modulus) {
	base %= modulus;
	T result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % modulus;
		base = (base * base) % modulus;
		exp >>= 1;
	}
	return result;
}

#undef int
int main() {
#define int long long
	int n;
	cin >> n;
	vector<int> mtn(n);
	vector<int> inp1(n);
	vector<int> inp2(n);
	REP(i, n) {
		cin >> inp1[i];
	}
	REP(i, n) {
		cin >> inp2[i];
	}
	mtn[0] = inp1[0];
	mtn[n - 1] = inp2[n - 1];
	REP(i, n - 1) {
		if (inp1[i] < inp1[i + 1]) {
			mtn[i + 1] = inp1[i + 1];
		}
	}
	REP(i, n - 1) {
		if (inp2[n - i - 2] > inp2[n - i - 1]) {
			mtn[n - i - 2] = inp2[n - i - 2];
		}
	}
	{
		int mx = 0;
		REP(i, n) {
			mx = max(mx, mtn[i]);
			if (mx != inp1[i]) {
				goto no;
			}
		}
		mx = 0;
		REP(i, n) {
			mx = max(mx, mtn[n - i - 1]);
			if (mx != inp2[n - i - 1]) {
				goto no;
			}
		}
		int result = 1;
		int mod = 1e9 + 7;
		int lastSet = mtn[0];
		int len = 0;
		for (int i = 1; i < n; i++) {
			if (mtn[i]) {
				if (mtn[i] >= lastSet) {
					result *= modpow(lastSet, len, mod);
					result %= mod;
				} else {
					result *= modpow(mtn[i], len, mod);
					result %= mod;
				}
				len = 0;
				lastSet = mtn[i];
			} else {
				len++;
			}
		}
		cout << result;
		return 0;
	}
no:
	cout << 0;
	return 0;
}



Measured memory_bytes: 2560
use std::io;
use std::str::FromStr;

fn input_vec() -> Vec<usize> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn input_vec_i64() -> Vec<i64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}


fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::usize;

#[derive(Copy, Clone, Eq, PartialEq)]
struct State {
    cost: usize,
    position: usize,
}

impl Ord for State {
    fn cmp(&self, other: &State) -> Ordering {
        other.cost.cmp(&self.cost)
            .then_with(|| self.position.cmp(&other.position))
    }
}

impl PartialOrd for State {
    fn partial_cmp(&self, other: &State) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

#[derive(Clone)]
struct Edge {
    node: usize,
    cost: usize,
}

// Dijkstra's shortest path algorithm.
fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: usize) -> Vec<usize> {
    // dist[node] = current shortest distance from `start` to `node`
    let mut dist: Vec<usize> = (0..adj_list.len()).map(|_| usize::MAX).collect();

    let mut heap = BinaryHeap::new();

    dist[start] = 0;
    heap.push(State { cost: 0, position: start });

    while let Some(State { cost, position }) = heap.pop() {

        if cost > dist[position] { continue; }

        for edge in &adj_list[position] {
            let next = State { cost: cost + edge.cost, position: edge.node };

            if next.cost < dist[next.position] {
                heap.push(next);
                dist[next.position] = next.cost;
            }
        }
    }
    dist
}

fn main() {
    let (h, w) = input_tuple();
    let mut edges: Vec<Vec<Edge>> = vec![Vec::new(); 10];
    for i in 0..10 {
        let row = input_vec();
        for j in 0..10 {
            edges[j].push(Edge {node: i, cost: row[j]});
        }
    }
    let shortest_paths = shortest_path(&edges, 1);
    let mut sum = 0;
    for i in 0..h {
        let row = input_vec_i64();
        for j in row {
            if j != -1 {
                sum += shortest_paths[j as usize];
            }
        }
    }
    println!("{}", sum);
}

Measured memory_bytes: 2184
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    k: usize,
    a: [i64; n],
  }
  let mut pos = vec![0; n + 1];
  let mut neg = vec![0; n + 1];
  for (i, &x) in a.iter().enumerate() {
    pos[i+1] = pos[i];
    neg[i+1] = neg[i];
    if x > 0 {
      pos[i+1] += x;
    } else {
      neg[i+1] += x;
    }
  }
  let mut penalty = -(1 << 60);
  for i in 0 .. n - k + 1 {
    penalty = cmp::max(penalty, cmp::max(- (pos[i + k] - pos[i]), neg[i + k] - neg[i]));
  }

  puts!("{}\n", pos[n] + penalty);
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

ll q, h, s, d, n;

int main() {
  ios::sync_with_stdio(0);
  cin >> q >> h >> s >> d;
  cin >> n;
  n*=4;
  h = min(h, q*2);
  s = min(s, h*2);
  d = min(d, s*2);
  ll anw = (n / 8) * d;
  n %= 8;
  anw += (n/4)*s;
  n %= 4;
  anw += (n/2)*h;
  n %= 2;
  anw += n*q;
  cout << anw << endl;
}

Measured memory_bytes: 256
def main():
    N, M, X = map(int, input().split())
    A = [[] for _ in range(N)]
    C = []
    for i in range(N):
        x = input().split()
        C.append(int(x[0]))
        A[i] = list(map(int, x[1:]))
    mn = 1e12 
    for i in range(1<<N):
        K = [0 for _ in range(M)]
        c = 0
        for j in range(N):
            if i>>j & 1:
                K = [x+y for (x, y) in zip(K, A[j])]
                c += C[j]
        if all([k >= X for k in K]):
            mn = min(mn, c)
    if mn > 1e10:
        print("-1")
    else:
        print(mn)

if __name__ == '__main__':
    main()

Measured memory_bytes: 69012
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

namespace modexp
{
	const ll mod = LLONG_MAX;

	long long p (long long x, long long y)
	{
		long long ans = 1;
		while(y)
		{
			if(y & 1)
				(ans *= x) %= mod;
			(x *= x) %= mod;
			y /= 2;
		}
		return ans;
	}

	long long inv (long long x)
	{
		return p (x, mod - 2);
	}
}
using modexp::p;
using modexp::inv;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int x;
	cin >> x;

	rep(i,-121,121)
		rep(j,-121,121)
		{
			if(p(i, 5) - p(j, 5) == x)
			{
				ret(i << ' ' << j);
			}
		}
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, k;
    while (cin >> a >> b >> c >> k) {
        int ans = 0;
        int t = 0;
        t = min(a, k);
        ans += t;
        k -= t;
        t = min(b, k);
        k -= t;
        t = min(c, k);
        ans -= t;
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int sweetKind, sunukeNum, haveNothing;
	int haveSweet;
	int sunuke[100], sweetNum[100];
	int i, j;

	scanf("%d%d", &sunukeNum, &sweetKind);

	for (i = 0; i < sunukeNum; i++)
	{
		sunuke[i] = 1;
	}

	/* お菓子の種類ごとに、そのお菓子の個数を入力させる */
	for (i = 0; i < sweetKind; i++)
	{
		scanf("%d", &sweetNum[i]);

		/* お菓子を持っているすぬけ君をカウント対象から除外する */
		for (j = 0; j < sweetNum[i]; j++)
		{
			scanf("%d", &haveSweet);
			sunuke[haveSweet - 1] = 0;
		}
		
	}

	haveNothing = 0;

	for (i = 0; i < sunukeNum; i++)
	{
		if (sunuke[i] == 1)
		{
			haveNothing++;
		}
	}
	
	printf("%d\n", haveNothing);

	return 0;

}

Measured memory_bytes: 1712
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>

using namespace std;

typedef long long ll;
const int maxn = 5005;

char str[maxn];
string str1="YAKI";

int main(){
	scanf("%s",&str);
	int len=strlen(str);
	int cnt=0;
	for(int i=0;i<min(len,4);i++){
		if(str[i]==str1[i]) cnt++;
	}
	if(cnt==4) printf("Yes\n");
	else printf("No\n");
	return 0;
} 

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


using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

typedef pair<ll, ll> P;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n, m;
    cin >> n >> m;

    vector<ll> castels(n);
    rep(i, n) cin >> castels[i];

    vector<vector<ll>> edges(n);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;

        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    int ans = 0;
    rep(i, n) {
        bool b = [&]() {
            for (int j  : edges[i]) {
                if (castels[i] <= castels[j]) return false;
            }
            return true;
        }();
        if (b) ans++;

    }
    cout << ans << endl;

}

Measured memory_bytes: 9864
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        final int N = in.nextInt();
        final int K = in.nextInt();
        final String s = in.next();

        int ans = 0;
        int len = s.length();
        int left = 0;
        int right = 0;
        int countZeros = 0;

        while (right < len) {
            if (s.charAt(right) == '0') {
                countZeros++;
                while (right+1 < len && s.charAt(right+1) == '0') right++;

                while (countZeros > K) {
                    if (s.charAt(left++) == '0') {
                        countZeros--;
                        while (left < len && s.charAt(left) == '0') left++;
                    }
                }

            }
            ans = Math.max(ans, right - left + 1);
            right++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23908
#include "bits/stdc++.h"
using namespace std;
int main() {
	int n;
	scanf("%d",&n);
	int ans=-(1<<30);
	int min_v,R;
	scanf("%d",&min_v);
	for(int i=1;i<n;i++) {
		scanf("%d",&R);
		ans=max(ans,R-min_v);
		min_v=min(min_v,R);
	}
	printf("%d\n",ans);
}

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

int main()
{
	ll n,w;
	cin>>n>>w;
	ll val[n];
	ll wt[n];
	ll i,j;
	for(i=0;i<n;i++)
	{
		cin>>wt[i]>>val[i];
	}
	vector < vector <ll> > dp(n+1, vector<ll>(w+1,0));  //n+1 dp's, each denoting choice at ith option

	for(i=1;i<=n;i++)
	{
		for(j=1;j<=w;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j-wt[i-1]>=0)
				dp[i][j]=max(dp[i][j],val[i-1]+dp[i-1][j-wt[i-1]]);
		}
	}
	cout<<dp[n][w]; 		
}


Measured memory_bytes: 80256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
d = deque()
flag = False
for i in range(n):
    if flag:
        d.appendleft(A[i])
    else:
        d.append(A[i])
    flag = ~flag
if flag:
    d = reversed(d)
print(*d)


Measured memory_bytes: 32528
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <utility>
#include <numeric>
#include <iomanip>
#include <locale>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>

using namespace std;

vector<string> read();
int think(const vector<string> &);
void write(int);

void debug(vector< vector<int> >);

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

  auto input = read();
  auto output = think(input);
  write(output);

  return 0;
}

vector<string> read() {
  int h, w;
  string buf;
  auto input = vector<string>();

  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    cin >> buf;
    buf = buf.substr(0, w);
    input.push_back(buf);
  }
  return input;
}

int think(const vector<string> &input) {
  char WALL = '#';
  auto h = input.size();
  auto w = input.at(0).size();

  auto left = vector< vector<int> >(h, vector<int> (w, 0));
  auto right = vector< vector<int> >(h, vector<int> (w, 0));
  auto up = vector< vector<int> >(h, vector<int> (w, 0));
  auto down = vector< vector<int> >(h, vector<int> (w, 0));

  // update left
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (input.at(y).at(x) == WALL) {
        continue;
      }
      if (x == 0) {
        continue;
      }
      left.at(y).at(x) = (input.at(y).at(x - 1) == WALL ? 0 : left.at(y).at(x - 1) + 1);
    }
  }

  // update left
  for (int y = 0; y < h; y++) {
    for (int x = w - 1; x >= 0; x--) {
      if (input.at(y).at(x) == WALL) {
        continue;
      }
      if (x == w - 1) {
        continue;
      }
      right.at(y).at(x) = (input.at(y).at(x + 1) == WALL ? 0 : right.at(y).at(x + 1) + 1);
    }
  }

  // update up
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (input.at(y).at(x) == WALL) {
        continue;
      }
      if (y == 0) {
        continue;
      }
      up.at(y).at(x) = (input.at(y - 1).at(x) == WALL ? 0 : up.at(y - 1).at(x) + 1);
    }
  }

  // update down
  for (int y = h - 1; y >= 0; y--) {
    for (int x = 0; x < w; x++) {
      if (input.at(y).at(x) == WALL) {
        continue;
      }
      if (y == h - 1) {
        continue;
      }
      down.at(y).at(x) = (input.at(y + 1).at(x) == WALL ? 0 : down.at(y + 1).at(x) + 1);
    }
  }

  // debug(left);
  // cout << endl;
  // debug(right);
  // cout << endl;
  // debug(up);
  // cout << endl;
  // debug(down);
  // cout << endl;

  int maximumBrightCells = 0;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (input.at(y).at(x) == WALL) {
        continue;
      }
      maximumBrightCells = max(maximumBrightCells, left.at(y).at(x) + right.at(y).at(x) + up.at(y).at(x) + down.at(y).at(x) + 1);
    }
  }
  return maximumBrightCells;
}

void write(int output) {
  cout << output << endl;
}

void debug(vector< vector<int> > what) {
  auto h = what.size();
  auto w = what.at(0).size();

  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      cout << " " << what.at(y).at(x);
    }
    cout << endl;
  }
}


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

using namespace std;
typedef long long int ll;
ll mod = 1e9+7;

ll N;
ll A[300005];
ll B[300005][65][2];
ll d[61];
// B[n][k][l],n番目までにk桁目にlをもつ数の総和

ll Pow(ll x,ll n){
    ll res=1;
    for(int i=0;i<n;++i)res*=x;
    return res;
}

int main(){
    for(int i=0;i<61;++i)d[i]=Pow(2,i);
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    for(int i=0;i<N;++i){
        //cout<<"i="<<i<<endl;
        for(int k=0;k<61;++k){
            int b=((A[i]&d[k])==d[k]);
            B[i][k][b]++;
            //cout<<"k="<<k<<" b="<<b<<endl;
            if(i!=0){
                B[i][k][0]+=B[i-1][k][0];
                B[i][k][1]+=B[i-1][k][1];
                B[i][k][0]%=mod;
                B[i][k][1]%=mod;
            }
            //cout<<"cnt="<<B[i][k][b]<<endl;
        }
    }
    ll ans=0;
    for(int i=0;i<N-1;++i){
        //cout<<"i="<<i<<endl;
        for(int k=0;k<60;++k){
            int b=((A[i]&d[k])==d[k]);
            //cout<<"k="<<k<<" b="<<b<<endl;
            //cout<<"cnt="<<(B[N-1][k][!b]-B[i][k][!b])<<endl;
            ans+=(d[k]%mod)*(B[N-1][k][!b]-B[i][k][!b]);
            ans%=mod;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 307328
//
// Created by munaiyi on 2020/3/30.
//
#include <bits/stdc++.h>

using namespace std;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;

int h[maxn], mem;
struct {
    int v, next;
} e[maxn << 1];

void add(int u, int v) {
    e[mem].v = v;
    e[mem].next = h[u];
    h[u] = mem++;
}

long long fac[maxn], inv[maxn];

void init() {
    memset(h, -1, sizeof(h));
    mem = 0;
    fac[0] = fac[1] = inv[0] = inv[1] = 1;
    for (int i = 2; i < maxn; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = (mod - mod / i) * inv[mod % i] % mod;
    }
    for (int i = 2; i < maxn; i++) {
        inv[i] = inv[i] * inv[i - 1] % mod;
    }
}

long long C(int c, int a) {
    if (c < 0 || a < 0 || a > c) return 0;
    return fac[c] * inv[a] % mod * inv[c - a] % mod;
}

long long fast(long long num, int ci) {
    long long ans = 1;
    while (ci) {
        if (ci & 1) ans = ans * num % mod;
        ci = ci >> 1;
        num = num * num % mod;
    }
    return ans;
}

int siz[maxn];
long long ans[maxn];
long long dp[maxn];

void dfs(int u, int fa) {
    dp[u] = 1;
    for (int i = h[u]; i + 1; i = e[i].next) {
        int v = e[i].v;
        if (v == fa) continue;
        dfs(v, u);
        siz[u] += siz[v];
        dp[u] = dp[u] * C(siz[u], siz[v]) % mod * dp[v] % mod;
    }
    siz[u]++;
}

void dfs_ans(int u, int fa, long long fdp, int fsiz) {
    ans[u] = dp[u] * C(siz[u] - 1 + fsiz, fsiz) % mod * fdp % mod;
    for (int i = h[u]; i + 1; i = e[i].next) {
        int v = e[i].v;
        if (v == fa) continue;
        dfs_ans(v, u,
                dp[u] * fast(C(siz[u] - 1, siz[v]) * dp[v] % mod, mod - 2) % mod * C(siz[u] - siz[v] - 1 + fsiz, fsiz) %
                mod * fdp % mod, fsiz + siz[u] - siz[v]);
    }
}

int main() {
    init();
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        add(u, v);
        add(v, u);
    }
    dfs(1, 1);
    dfs_ans(1, 1, 1, 0);
    for (int i = 1; i <= n; i++) {
        printf("%lld\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 3e5 + 10;
const int INF = 1e9;
int mod = 1e9 + 7;
using namespace std;
int n, d;
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	n = read(); d = read();
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		int x = read(), y = read();
		long long temp = 1ll * x * x + 1ll * y * y;
		if (temp <= 1ll * d *d) ans ++;
	}
	cout << ans << endl;
	return 0;	
}
 	

Measured memory_bytes: 3760
W, H, x, y = map(int, input().split())
l = [0] * 4
if x*2 == W and y*2 == H:
    print(W*H*0.5, 1)
else:

#     l[0] = W - x
#     l[1] = x
#     l[2] = H - y
#     l[3] = y
    #l.clear(0)
    
    print(W*H*0.5 ,0)


Measured memory_bytes: 2940
import java.util.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		if (a + b > c + d) {
			System.out.println("Left");
		} else if (a + b < c + d) {
			System.out.println("Right");
		} else {
			System.out.println("Balanced");
		}
	}
}


Measured memory_bytes: 21716