akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>

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

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

//     vector<int> P(N);
    
    ll min = 10000005;
    ll ans = 0;
    repo(i,N){
//         cin >> P[i];
        ll p;
        cin >> p;
        
        if(min > p){
            ans++;
            min = p;
        } 

    }
//     int ans = 0;
//     for(int i = 0; i < N; i++){
//         bool ok = true;
//         for(int j = 0; j < i; j++){
//            if(P[i] >  P[j]){
//                ok = false;
//            } 
//
//         }
//         if(ok) ans++;
//     }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n, x := intScanner(), intScanner()
	if x == 1 || x == 2*n-1 {
		fmt.Println("No")
	} else {
		if n == x {
			fmt.Println("Yes")
			for i := 1; i < 2*n; i++ {
				fmt.Println(i)
			}
		} else if x < n {
			fmt.Println("Yes")
			ans := make([]int, 2*n-1)
			ans[n] = x - 1
			ans[n-1] = x
			ans[n+1] = x + 1
			ans[n-2] = x + 2
			idx := 0
			y := 1
			for {
				if n-2 <= idx && idx <= n+1 {
					idx = n + 2
				}
				if idx >= 2*n-1 {
					break
				}
				if x-1 <= y && y <= x+2 {
					y = x + 3
				}
				ans[idx] = y
				idx++
				y++
			}
			for _, v := range ans {
				fmt.Println(v)
			}
		} else {
			fmt.Println("Yes")
			ans := make([]int, 2*n-1)
			ans[n] = x + 1
			ans[n-1] = x
			ans[n+1] = x - 1
			ans[n-2] = x - 2
			idx := 0
			y := 1
			for {
				if n-2 <= idx && idx <= n+1 {
					idx = n + 2
				}
				if idx >= 2*n-1 {
					break
				}
				if x-2 <= y && y <= x+1 {
					y = x + 2
				}
				ans[idx] = y
				idx++
				y++
			}
			for _, v := range ans {
				fmt.Println(v)
			}
		}
	}
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int x1, x2, x3, x4, x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    int ans;
    if (x1 == 0) ans = 1;
    if (x2 == 0) ans = 2;
    if (x3 == 0) ans = 3;
    if (x4 == 0) ans = 4;
    if (x5 == 0) ans = 5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
//---------------------------------------------
 
 
int main(void)
{
	ll h;
	cin>>h;
	ll ans =0;
	ll n=1;
	while(h!=1)
	{
		ans+=n;
		h/=2;
		n*=2;
	}
	cout<<ans+n<<endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
if N*2>=M:
    print(M//2)
else:
    ans = N
    M -= N*2
    ans += M//4
    print(ans)

Measured memory_bytes: 61816
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	int N;
	cin >> N;

	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}

	return 0;
}


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

vector<ll> divisor(ll n) {
  vector< ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end(), greater<ll>());
  return (ret);
}

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

    vector<ll> div = divisor(M);

    for(ll e : div){
        if(e * N <= M){
            cout << e << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
N = int(input())
def ff(x,y,z):
    n = x**2+y**2+z**2+x*y+y*z+z*x
    return n
maxx=99

c=[]
ans = [0]*N
for i in range(1,maxx+1):
    for j in range(1,maxx+1):
        for k in range(1,maxx+1):
            r=ff(i,j,k)
            c.append(r)
cc = [i for i in c if i<=N]

for i in cc:
    ans[i-1] += 1

for i in ans:
    print(i)

Measured memory_bytes: 49368
// https://atcoder.jp/contests/

#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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  int A, P;
  cin >> A >> P;
  cout << (A * 3 + P) / 2 << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
    #include <iomanip>
    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <deque>
    #include <list>
    #include <queue>
    #include <stack>
    #include <vector>
    #include <utility>
    #include <algorithm>
    #include <map>
    #include <set>
    #include <complex>
    #include <cmath>
    #include <limits>
    #include <climits>
    #include <ctime>
    #include <cassert>
    using namespace std;
     
    #define rep(i,a,n) for(int i=a; i<n; i++)
    #define repq(i,a,n) for(int i=a; i<=n; i++)
    #define repr(i,a,n) for(int i=a; i>=n; i--)
    #define pb(a) push_back(a)
    #define fr first
    #define sc second
    #define INF 2000000000
     
    #define X real()
    #define Y imag()
    #define EPS (1e-10)
    #define EQ(a,b) (abs((a) - (b)) < EPS)
    #define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
    #define LE(n, m) ((n) < (m) + EPS)
    #define LEQ(n, m) ((n) <= (m) + EPS)
    #define GE(n, m) ((n) + EPS > (m))
    #define GEQ(n, m) ((n) + EPS >= (m))
     
    typedef vector<int> VI;
    typedef vector<VI> MAT;
    typedef pair<int, int> pii;
    typedef long long int ll;
     
    typedef complex<double> P;
    typedef pair<P, P> L;
    typedef pair<P, double> C;
     
    int dy[]={0, 0, 1, -1};
    int dx[]={1, -1, 0, 0};
    int const MOD = 1000000007;
     
    namespace std {
        bool operator<(const P& a, const P& b) {
            return a.X != b.X ? a.X < b.X : a.Y < b.Y;
        }
    }
     
    int main() {
        int n; cin >> n;
        string s[110];
        map<string, int> m;
        m["A"] = 0, m["Un"] = 1;
        rep(i,0,n) cin >> s[i];
        int cnt1 = 0, cnt2 = 0;
     
        rep(i,0,n) {
            if(m[s[i]] == 0) cnt1++;
            else if(m[s[i]] == 1) cnt2++;
            if(cnt2 > cnt1) {
                cout << "NO" << endl;
                return 0;
            }
        }
        if(cnt1 == cnt2) cout << "YES" << endl;
        else cout << "NO" << endl;
        return 0;
    }

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

int fun(vector <vector<int>> &dp, int n){
	
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			if(j==0){
				dp[i][j] += max(dp[i-1][j+1],dp[i-1][j+2]);
			}else if(j==1){
				dp[i][j] += max(dp[i-1][j-1],dp[i-1][j+1]);
			}else{
				dp[i][j] += max(dp[i-1][j-1],dp[i-1][j-2]);
			}	
		}
	}
	
	int maxi = -999999999;
	for(int i=0;i<3;i++){
		maxi = max(maxi,dp[n-1][i]);
	}
	return maxi;
}


int main(){
	int n;
	cin>>n;
	vector <vector<int>> arr(n,vector<int>());

	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			int temp;
			cin>>temp;
			arr[i].push_back(temp);
		}
	}

	cout<<fun(arr,n);

}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=int_fast64_t;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double EPS=1e-9;
const int MOD=1e9+7;
int main(){
    int x,y,z;cin>>x>>y>>z;
    int n=x+y+z;
    vector<ll> a(n),b(n),c(n);
    vector<P> v;
    ll s=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
        v.push_back(P(b[i]-a[i],i));
    }
    sort(all(v));
    reverse(all(v));
    priority_queue<ll> q1,q2;
    ll ans=0;
    vector<ll> s1(n,0),s2(n,0);
    for(int i=0;i<y+z;i++){
        int id=v[i].second;
        if(i<y){
            q1.push(c[id]-b[id]);
            s1[i]+=b[id];
            s1[i+1]=s1[i];
            continue;
        }
        if(q1.top()>c[id]-b[id]){
            s1[i]+=q1.top();
            q1.pop();
            s1[i]+=b[id];
            q1.push(c[id]-b[id]);
        }else{
            s1[i]+=c[id];
        }
        s1[i+1]=s1[i];
    }
    for(int i=n-1;i>=y;--i){
        int id=v[i].second;
        if(i>=y+z){
            q2.push(c[id]-a[id]);
            s2[i]+=a[id];
            s2[i-1]=s2[i];
            continue;
        }
        if(q2.top()>c[id]-a[id]){
            s2[i]+=q2.top();
            q2.pop();
            s2[i]+=a[id];
            q2.push(c[id]-a[id]);
        }else{
            s2[i]+=c[id];
        }
        s2[i-1]=s2[i];
    }
    for(int i=y-1;i<y+z;i++){
        ans=max(ans,s1[i]+s2[i+1]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7536
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

long double deg(long double px, long double py) {
	long double T = px / sqrtl(px * px + py * py);
	long double E = acos(T) * 180.0L / 3.14159265358979L;
	if (py >= 0) return E;
	return 360.0L - E;
}

int N, x[1009], y[1009];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> x[i] >> y[i];

	bool ok = false;

	for (int i = 0; i < N - 1; i++) {
		// ---------------------------- 辺の最初で判定 ----------------------------
		long double maxa = 0, maxb = 0, maxc = 0, maxd = 0;
		for (int j = 0; j < i; j++) {
			long double D1 = deg(x[i] - x[i + 1], y[i] - y[i + 1]);
			long double D2 = deg(x[j] - x[i], y[j] - y[i]);

			long double SA = D1 - D2; if (SA < -180.0L) SA += 360.0L; else if (SA > 180.0L) SA -= 360.0L;
			if (SA < 0.0L) maxa = max(maxa, -SA);
			else maxb = max(maxb, SA);
		}
		for (int j = i + 1; j < N; j++) {
			long double D1 = deg(x[i + 1] - x[i], y[i + 1] - y[i]);
			long double D2 = deg(x[j] - x[i], y[j] - y[i]);

			long double SA = D1 - D2; if (SA < -180.0L) SA += 360.0L; else if (SA > 180.0L) SA -= 360.0L;
			if (SA < 0.0L) maxc = max(maxc, -SA);
			else maxd = max(maxd, SA);
		}
		if (maxa + maxb > 180.0L || maxb + maxc > 180.0L || maxc + maxd > 180.0L || maxd + maxa > 180.0L) {
			ok = true;
		}

		// -------------------------- 辺の最後で判定 -----------------------------
		maxa = 0; maxb = 0; maxc = 0;
		for (int j = 0; j <= i; j++) {
			long double D1 = deg(x[i] - x[i + 1], y[i] - y[i + 1]);
			long double D2 = deg(x[j] - x[i + 1], y[j] - y[i + 1]);

			long double SA = D1 - D2; if (SA < -180.0L) SA += 360.0L; else if (SA > 180.0L) SA -= 360.0L;
			if (SA < 0.0L) maxa = max(maxa, -SA);
			else maxb = max(maxb, SA);
		}
		for (int j = i + 2; j < N; j++) {
			long double D1 = deg(x[i + 1] - x[i], y[i + 1] - y[i]);
			long double D2 = deg(x[j] - x[i + 1], y[j] - y[i + 1]);

			long double SA = D1 - D2; if (SA < -180.0L) SA += 360.0L; else if (SA > 180.0L) SA -= 360.0L;
			if (SA < 0.0L) maxc = max(maxc, -SA);
			else maxd = max(maxd, SA);
		}
		if (maxa + maxb > 180.0L || maxb + maxc > 180.0L || maxc + maxd > 180.0L || maxd + maxa > 180.0L) {
			ok = true;
		}
	}
	if (ok == true) cout << "Impossible" << endl;
	else cout << "Possible" << endl;
	return 0;
}


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

using namespace std;

typedef long long LL;

const int N = 2e5 + 10;

int a[N];
int n;

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

	LL suma = 0, sumb = 0;
	LL ans = 0;

	for (int i = 1, j = 1; i <= n; i++)  //枚举左端点
	{
		while (j - 1 <= n && suma == sumb) //滑动右窗口
		{
			suma ^= a[j], sumb += a[j];
			j++;
		}

		ans += j - 1 - i;

		suma ^= a[j - 1], sumb -= a[j - 1];	
		suma ^= a[i], sumb -= a[i];	
		j--;
	}

	printf("%lld\n", ans);

	return 0;
}



Measured memory_bytes: 4608
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  ll n;
  cin >> n;
  string s;
  cin >> s;
  map<ll, ll> m;
  rep(i, s.size()) {
    ll d = s[i] - '0';
    if (m.find(d) == m.end())
      m[d] = 1;
    else
      m[d]++;
  }
  ll ans = 0;
  REP(x, 0, 1000) {
    vl cnt(10, 0);
    ll d3 = x / 100;
    ll d2 = (x % 100) / 10;
    ll d1 = (x % 100) % 10;
    ll cur = 0;
    while (cur < s.size() && s[cur] - '0' != d3) cur++;
    if (cur == s.size()) continue;
    cur++;
    while (cur < s.size() && s[cur] - '0' != d2) cur++;
    if (cur == s.size()) continue;
    cur++;
    while (cur < s.size() && s[cur] - '0' != d1) cur++;
    if (cur == s.size()) continue;
    // cerr << x << endl;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	int n,i,minm,k,j;
  cin>>n>>k;
  int arr[n];
  int sum[n];
  for(i=0;i<n;i++)
    cin>>arr[i];
  sum[0]=0;
  sum[1]=abs(arr[0]-arr[1]);
  
  for(i=2;i<n;i++){
    minm=INT_MAX;
    for(j=i-1;j>=0 && j>=i-k;j--)
      minm=min(minm,sum[j]+abs(arr[j]-arr[i]));
    sum[i]=minm;
  }
  cout<<sum[n-1]<<"\n";
  return 0;
}

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

const unsigned int MAX = 50010;
char prime[MAX];

int main(){
    prime[0] = prime[1] = 1;
    for(unsigned int i = 4; i < MAX; i += 2){
        prime[i] = 1;
    }
    unsigned int rt = sqrt(MAX);
    for(unsigned int i = 3; i <= rt; i += 2){
        if(prime[i]) continue;
        for(unsigned int j = i+i; j < MAX; j += i){
            prime[j] = 1;
        }
    }
    unsigned int n;
    while(cin >> n, n){
        unsigned int c = 0;
        if(!prime[n-2]) c++;
        for(unsigned int p = 3; p <= MAX; p += 2){
            if(prime[p]) continue;
            if(n < p+p) break;
            if(!prime[n-p]) c++;
        }
        cout << c << endl;
    }

    return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,a,h,i,c=0;
    double s=0,dif=0;
    vector<double>v,vc,vcc;
    cin>>n>>t>>a;
    for(i=0; i<n; i++)
    {
        cin>>h;
        s=h*0.006;
        //cout<<t-s<<" ";
        v.push_back(t-s);
    }
    //cout<<endl;
    for(i=0; i<n; i++)
    {
        dif=abs(a-v[i]);
        //cout<<dif<<" ";
        vc.push_back(dif);
    }
    vcc=vc;
    sort(vcc.begin(),vcc.end());
    for(i=0; i<n; i++)
    {
        if(vc[i]==vcc[0])
        {
            c=i+1;
            break;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
r,c = map(int, input().split()) 

tbl = [[0 for i in range(c+1)] for j in range(r+1)]

for i in range(r):
    ls = list(map(int, input().split()))
    for j in range(c):
        tbl[i][j] = ls[j]
        tbl[r][j] += ls[j]
        tbl[i][c] += ls[j]
    tbl[r][c] += tbl[i][c]


for i, row in enumerate(tbl):
    for j, col in enumerate(row):
        print (tbl[i][j],end='')
        if j != c:
            print(' ',end='')
    print()


Measured memory_bytes: 6744
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        
        for(int i=1; i<=9; i++){
            for(int j=1; j<=9; j++){
                list.add(i*j);
            }
        }
        
        System.out.println(list.contains(n)?"Yes":"No");
    }
}

Measured memory_bytes: 22612
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

bool _floor[2010][2010] = {false};
long w_light[2010][2010] = {0};
long h_light[2010][2010] = {0};

int main(void) {
  cout.precision(12);

  long H, W;
  cin >> H >> W;


  rep (h, H) {
    string tmp;
    cin >> tmp;
    rep (w, W) {
      _floor[h][w] = tmp[w] == '.';
    }
  }

  rep (h, H) {
    long start = 0;
    long light_count = 0;
    long pos = 0;

    while (true) {
      while (pos < W and _floor[h][pos]) {
        pos++;
        light_count++;
      }
      while (start < pos) {
        w_light[h][start] = light_count;
        start ++;
      }
      if (start == W) break;
      light_count = 0;
      start ++;
      pos = start;
    }
  }

  rep (w, W) {
    long start = 0;
    long light_count = 0;
    long pos = 0;

    while (true) {
      while (pos < H and _floor[pos][w]) {
        pos++;
        light_count++;
      }
      while (start < pos) {
        h_light[start][w] = light_count;
        start ++;
      }
      if (start == H) break;
      light_count = 0;
      start ++;
      pos = start;
    }
  }

  long result = 0;
  rep (h, H) rep (w, W) result = max(result, w_light[h][w] + h_light[h][w] - 1);

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 67328
num = int(input())
length = [int(s) for s in input().split(' ')]

count = 0

for i in range(num):
    for j in range(i+1, num):
        for k in range(j + 1, num):
            l = [length[i], length[j], length[k]]
            if len(l) == len(set(l)) and max(l) < sum(sorted(l)[:2]):
                count += 1

print(str(count))


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int S, W;
signed main() {
    cin >> S >> W;
    if (W >= S) { cout << "unsafe" << endl; }
    else { cout << "safe" << endl; }
}

Measured memory_bytes: 3624
/** 
 *  Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,s1,s2;
    cin>>s;
    int i;
    for(i=0;i<(s.length()/2);++i)
    {
        s1 += s[i];
        s2 += s[(s.length()/2)+i+1];
    }
    string s3,s4,s5;
    s3 = s1;
    s4 = s2;
    s5 = s;
    reverse(s1.begin(),s1.end());
    reverse(s2.begin(),s2.end());
    reverse(s.begin(),s.end());
    if(s == s5 && s1 == s3 && s2 == s4) cout<<"Yes";
    else    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <numeric>
#include <type_traits>
#include <limits>
#include <random>
#include <iomanip>

using namespace std;

using ll = long long;

typedef pair<int, int> P;

#define rep(i,N) for(long long i = 0;i < (long long)N; ++i)

static int mod = 1000000007;
static int large = 1000000000;

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


int N;
int h[100000];
int dp[100000];

int main() {
	cin >> N;
	rep(i, N) {
		cin >> h[i];
	}
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[N - 1] << endl;
	return 0;
}


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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define MAXAS(x,v) x = max(x,v)

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

#define PI 3.141592653589793

#define MOD 1000000007L
// #define INF 100000000000

#define MAX_V 2000
#define INF 2147483647
//to,cost
typedef pair<long, long> P;

signed main() {
	int h, w;
	cin >> h >> w;
	cout << string(w + 2, '#') << endl;
	for (size_t i = 0; i < h; i++) {
		string s;
		cin >> s;
		cout << '#' << s << '#' << endl;
	}
	cout << string(w + 2, '#') << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans;
int n,m;
vector<int> v[1111];
void dfs(int i,map<int,int> flag,int cnt){
	flag[i]=1;
	for(auto x:v[i]){
		if(!flag[x])dfs(x,flag,cnt+1);
	}
	if(cnt==n)ans++;
}

signed main(){
	
	cin>>n>>m;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	map<int,int> hoge;
	dfs(0,hoge,1);
	cout<<ans<<endl;
	

	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    vector<int>dp(n);
    ll ans=0;
    rep(i,n){
        if(i-a[i]>=0)ans+=dp[i-a[i]];
        if(i+a[i]<n)dp[i+a[i]]++;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4736
#include<cstdio>

typedef long long LL;

inline LL Max(LL i, LL j) {
	return i > j ? i : j;
}

int N,M;
LL A[5005];
int B[5005][205];

int Lm[5005][205], Rm[5005][205];
int stk[5005], top;

void init() {
	
	scanf("%d%d", &N, &M);
	
	for(int i = 2; i <= N; ++i) {
		scanf("%d", &A[i]);
	}
	
	for(int i = 1; i <= N; ++i) {
		for(int j = 1; j <= M; ++j) {
			scanf("%d", &B[i][j]);
		}
	}
}

void pre() {
	
	for(int i = 2; i <= N; ++i) {
		A[i] += A[i - 1];
	}
	
	for(int j = 1; j <= M; ++j) {
		top = 0;
		for(int i = 1; i <= N; ++i) {
			while(top > 0 && B[stk[top]][j] < B[i][j]) {
				Rm[stk[top]][j] = i - 1;
				--top;
			}
			Lm[i][j] = stk[top] + 1;
			stk[++top] = i;
		}
		while(top > 0) {
			Rm[stk[top]][j] = N;
			--top;
		}
	}
}

namespace _120pts {
	
	namespace SegmentTree {
		
		LL mx[1<<18], tg[1<<18];
		
		void P(int id, LL x) {
			mx[id] += x;
			tg[id] += x;
		}
		
		void Combine(int id) {
			mx[id] = Max(mx[id << 1], mx[id << 1 | 1]);
		}
		
		void PushDown(int id) {
			P(id << 1, tg[id]);
			P(id << 1 | 1, tg[id]);
			tg[id] = 0;
		}
		
		void Add(int id, int lb, int rb, int a, int b, LL x) {
			if(a <= lb && rb <= b) {
				P(id, x);
				return ;
			}
			PushDown(id);
			int mid = lb + rb >> 1;
			if(a <= mid) Add(id << 1, lb, mid, a, b, x);
			if(b > mid) Add(id << 1 | 1, mid + 1, rb, a, b, x);
			Combine(id);
		}
		
		LL Qur(int id, int lb, int rb, int a, int b) {
			if(a <= lb && rb <= b) return mx[id];
			PushDown(id);
			int mid = lb + rb >> 1;
			LL Ans = -1ull << 63;
			if(a <= mid) Ans = Max(Ans, Qur(id << 1, lb, mid, a, b));
			if(b > mid) Ans = Max(Ans, Qur(id << 1 | 1, mid + 1, rb, a, b));
			return Ans;
		}
	}
	using SegmentTree :: Add;
	using SegmentTree :: Qur;
	
	int head[100005], nxt[2000005], lb[2000005], rb[2000005], tot;
	LL val[2000005];
	inline void addq(int pos, int l, int r, LL v) {
		nxt[++tot] = head[pos];
		lb[tot] = l;
		rb[tot] = r;
		val[tot] = v;
		head[pos] = tot;
	}
	
	LL Ans = 0;
	
	void solve() {
		
		for(int i = 1; i <= N; ++i) {
			for(int j = 1; j <= M; ++j) {
				addq(i, Lm[i][j], i, B[i][j]);
				addq(Rm[i][j] + 1, Lm[i][j], i, -B[i][j]);
			}
		}
		
		for(int i = 1; i <= N; ++i) {
			Add(1, 1, N, i, i, A[i]);
		}
		
		for(int i = 1; i <= N; ++i) {
			for(int j = head[i]; j; j = nxt[j]) {
				Add(1, 1, N, lb[j], rb[j], val[j]);
			}
			Ans = Max(Ans, Qur(1, 1, N, 1, i) - A[i]);
		}
		
		printf("%lld\n", Ans);
	}
}

int main() {
	
	init();
	pre();
	
//	_100pts :: solve();
	_120pts :: solve();
	
	return 0;
}

Measured memory_bytes: 55808
a = Array.new()
op = Array.new()
b = Array.new()
i = 0
c, op[0], d = gets.split
a[0] = c.to_i
b[0] = d.to_i
while op[i] != "?" do
	i += 1
	c, op[i], d = gets.split
	a[i] = c.to_i
	b[i] = d.to_i
end
i = 0
while op[i] != "?" do
	if op[i] == "+" then
		puts "#{a[i] + b[i]}"
	end
	if op[i] == "-" then
		puts "#{a[i] - b[i]}"
	end
	if op[i] == "*" then
		puts "#{a[i] * b[i]}"
	end
	if op[i] == "/" then
		puts "#{a[i] / b[i]}"
	end
	i += 1
end

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

void solve(){
    int k,x;
    cin >> k >> x;
    int mi,ma;
    mi = x-k+1;
    ma = x+k-1;
    while(mi<=ma){
        cout << mi << " ";
        mi++;
    }
    cout << endl;
}


int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
package main

import (
  "bufio"
  "container/heap"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const INF = 1000000000

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n := input.NextInt()
  g := make([][]int,n)
  for i:=0;i<n-1;i++ {
    a,b := input.NextInts()
    g[a-1] = append(g[a-1],b-1)
    g[b-1] = append(g[b-1],a-1)
  }
  m := make([]int,n)
  for i:=0;i<n;i++ { m[i] = -INF }
  k := input.NextInt()
  root := INF
  for i:=0;i<k;i++ {
    v,p := input.NextInts()
    m[v-1] = p
    if root > v-1 { root = v-1 }
  }
  d := dijkstra(g,root)
  l := make([]int,n)
  u := make([]int,n)
  for i:=0;i<n;i++ {
    if m[i] != -INF && (m[i]+d[i])%2 != m[root]%2 { fmt.Println("No");return }
    l[i],u[i] = -INF,INF
    if m[i] != -INF { l[i],u[i] = m[i],m[i] }
  }
  var btmup func(int,int)
  btmup = func(v,p int) {
    x,y := l[v],u[v]
    for _,e := range g[v] {
      if e == p { continue }
      btmup(e,v)
      if x < l[e]-1 { x = l[e]-1 }
      if y > u[e]+1 { y = u[e]+1 }
    }
    if x > y { fmt.Println("No");os.Exit(0) }
    l[v],u[v] = x,y
  }
  btmup(root,-1)
  var topdn func(int,int,int)
  topdn = func(v,p,c int) {
    m[v] = c
    for _,e := range g[v] {
      if e == p { continue }
      if l[e] <= c-1 && c-1 <= u[e] { topdn(e,v,c-1);continue }
      if l[e] <= c+1 && c+1 <= u[e] { topdn(e,v,c+1);continue }
    }
  }
  topdn(root,-1,m[root])
  fmt.Println("Yes")
  for i:=0;i<n;i++ { fmt.Println(m[i]) }
}

func dijkstra(g [][]int,start int) []int {
  n := len(g)
  c := make([]int,n)
  for i:=0;i<n;i++ { c[i] = INF }
  var pq PriorityQueue
  heap.Init(&pq)
  heap.Push(&pq,&Item{start,0})
  c[start] = 0
  for pq.Len() > 0 {
    s := heap.Pop(&pq).(*Item)
    if s.cost > c[s.pos] { continue }
    for _,e := range g[s.pos] {
      if c[e] > s.cost+1 {
        c[e] = s.cost+1
        heap.Push(&pq,&Item{e,c[e]})
      }
    }
  }
  return c
}
type Item struct { pos,cost int }
type PriorityQueue []*Item
func(pq PriorityQueue) Len() int { return len(pq) }
func(pq PriorityQueue) Less(i,j int) bool { return pq[i].cost < pq[j].cost }
func(pq PriorityQueue) Swap(i,j int) { pq[i],pq[j] = pq[j],pq[i] }
func(pq *PriorityQueue) Push(x interface{}) {
  item := x.(*Item)
  *pq = append(*pq,item)
}
func(pq *PriorityQueue) Pop() interface{} {
  old := *pq
  n := len(old)
  item := old[n-1]
  *pq = old[:n-1]
  return item
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  x,_ := strconv.Atoi(i.NextLine())
  return x
}
func(i *Input) NextInts() (int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}

Measured memory_bytes: 72960
#include<stdio.h>
     
    int main(){
    	int H,W;
      	int h,w;
    	scanf("%d %d\n%d %d", &H, &W, &h, &w);
      	int black = (h * W) + (w * H) - (h * w);
      	int white = (H * W) - black;
      	printf("%d",white);
      	return 0;
    }

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        for(int i=3;i<=n;i++){
            if(check(i)){
                System.out.print(" "+i);
            }
        }
        System.out.print("\n");
    }
    public static boolean check(int n){
        if(n%3==0){
            return true;
        }else if(n%10==3){
            return true;
        }else{
            int x = n / 10;
            while(x>0){
                if(x%10==3){
                    return true;
                }
                x = x /10;
            }
            return false;
        }
    } 
}

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

const int N=200100;
typedef long long ll;
ll ans;

int b[N],a[N],col[N],c[N],fa[N],vis[N],G[N],ne[N*2],to[N*2],n,m,xb;

void dfs(int x,int fa=-1){
	for(int i=G[x];~i;i=ne[i])if(to[i]!=fa){
		dfs(to[i],x);
		col[x]-=col[to[i]];
	}
	++col[x];ans+=abs(col[x]);	
}

int cnt;
void find_cir(int x,int y){
	assert(x);
	c[++cnt]=x;if(x==y)return;
	find_cir(fa[x],y);
}

void tj(int x){
	vis[x]=1;
	for(int i=G[x];~i;i=ne[i])if(to[i]!=fa[x]){
		if(!cnt&&vis[to[i]])find_cir(x,to[i]);
		else if(!vis[to[i]])fa[to[i]]=x,tj(to[i]);
	}
}
void add(int x,int y){ne[xb]=G[x];to[xb]=y;G[x]=xb++;}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	if(n&1){
		cout<<-1<<'\n';
		return 0;
	}
	memset(G,-1,sizeof G);
	for(int i=1;i<=m;++i){
		int x,y;cin>>x>>y;
		add(x,y);add(y,x);
	}
	if(m==n-1){
		dfs(1);
		if(col[1])cout<<-1<<'\n';
		else cout<<ans<<'\n';
		return 0;
	}
	tj(1);
	c[0]=c[cnt];c[cnt+1]=c[1];
	for(int i=1;i<=cnt;++i){
		a[i]=1;
		for(int j=G[c[i]];~j;j=ne[j])if(to[j]!=c[i-1]&&to[j]!=c[i+1]){dfs(to[j],c[i]);a[i]-=col[to[j]];}
	}
	int nx=1,ny=0;
	for(int i=1;i<=cnt;++i){
		nx=-nx;ny=a[i]-ny;
		if(nx==1)b[i]=-ny;
		else b[i]=ny;
	}
	if(nx==1&&ny){
		cout<<-1<<'\n';
		return 0;
	}
	if(nx==-1&&(ny&1)){
		cout<<-1<<'\n';
		return 0;
	}
	sort(b+1,b+cnt+1);
	int val=b[(cnt+1)/2];
	if(nx==-1)val=ny/2;
	for(int i=1;i<=cnt;++i)ans+=abs(val-b[i]);
	cout<<ans<<'\n';	
	return 0;
}


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

typedef long long ll;

int main() {
    ll X, Y;
    cin >> X >> Y;
    if (abs(X - Y) > 1) cout << "Alice\n";
    else cout << "Brown\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N;
	cin >> N;
	vector<ll> vec(N);
	ll sum = 0;
	rep(i, N) {
		cin >> vec[i];
		sum += vec[i];
	}

	ll mid = 0;
	ll tmp = 0;
	ll pre = 0;
	rep(i, N) {
		tmp += vec[i];
		if (sum % 2 == 0 && tmp == sum / 2) {
			cout << 0;
			return;
		}
		if (tmp > sum / 2) {
			mid = i;
			pre = tmp - vec[i];
			break;
		}
	}

	if (mid == 0) {
		cout << vec[0] - (sum - vec[0]);
		return;
	}
	if (mid == N - 1) {
		cout << vec[N - 1] - (sum - vec[N - 1]);
		return;
	}

	ll cont1 = sum - pre - pre;
	ll cont2 = pre + pre + vec[mid] + vec[mid] - sum;
	cout << min(cont1, cont2);

	return;
}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
typedef long long ll;
using namespace __gnu_pbds;

typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;

lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll dp[1005][1005];
ll h,w,i,j;
char a[1005][1005];
ll solve(ll i,ll j)
{
    if(i>h||j>w)
        return 0;
    if(dp[i][j]!=-1)
        return dp[i][j];
    if(i==(h-1)&&j==w&&a[h-1][w]=='.')
        return 1;
    if(j==(w-1)&&i==h&&a[h][w-1]=='.')
        return 1;
    ll x=0;
    if(a[i+1][j]=='.')
        x=(x+(solve(i+1,j)%hell))%hell;
    if(a[i][j+1]=='.')
        x=(x+(solve(i,j+1)%hell))%hell;
    dp[i][j]=x;
    return x;
}

int main()
{
    for(i=0;i<1005;i++)
        for(j=0;j<1005;j++)
            dp[i][j]=-1;
    cin>>h>>w;
    for(i=1;i<=h;i++)
        for(j=1;j<=w;j++)
            cin>>a[i][j];
    cout<<solve(1,1);
    return 0;
}






Measured memory_bytes: 9216
#import sys
#input = sys.stdin.readline
from collections import deque
def main():
    H, W = map( int, input().split())
    Ch, Cw = map( lambda x: int(x)-1, input().split())
    Dh, Dw = map( lambda x: int(x)-1, input().split())
    S = [ input() for _ in range(H)]
    k = 10**7
    R = [ [k]*W for _ in range(H)]

    for i in range(H):
        for j in range(W):
            if S[i][j] == "#":
                R[i][j] = -1
    R[Ch][Cw] = 0
    T = [ [False]*W for _ in range(H)]
    d = deque([(Ch, Cw)])
    MW = [(-2,-2), (-2,-1), (-2,0), (-2,1), (-2,2),(-1,-2), (-1,-1), (-1,1), (-1,2),(0,-2), (0,2), (1,-2), (1,-1), (1,1), (1,2),(2,-2), (2,-1), (2,0), (2,1), (2,2)]
    while d:
        # print(d)
        # print(R)
        x, y = d.popleft()
        if T[x][y]:
            continue
        else:
            T[x][y] = True
        magic = R[x][y]
        if x == Dh and y == Dw:
            break
        if x > 0:
            if R[x-1][y] > magic:
                R[x-1][y] = magic
                d.appendleft((x-1,y))
        if x < H-1:
            if R[x+1][y] > magic:
                R[x+1][y] = magic
                d.appendleft((x+1,y))
        if y > 0:
            if R[x][y-1] > magic:
                R[x][y-1] = magic
                d.appendleft((x,y-1))
        if y < W-1:
            if R[x][y+1] > magic:
                R[x][y+1] = magic
                d.appendleft((x,y+1))
        for a, b in MW:
            tx, ty = x+a, y+b
            if tx < 0 or tx > H-1:
                continue
            if ty < 0 or ty > W-1:
                continue
            if R[tx][ty] > magic:
                R[tx][ty] = magic+1
                d.append((tx,ty))

    if R[Dh][Dw] == k:
        print(-1)
    else:
        print(R[Dh][Dw])
        
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 126260
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}
ll lpow(ll a,ll b){
  ll i,res=1;
  rep(i,b){
    res*=a;
  }
  return res;
}
int main(){
  ll i,j,N,M,K,res;
  cin>>N;
  set<ll> se;
  vec v(N);
  rep(i,N){
    cin>>v[i];
  }
  K=lpow(2,N);

  while(--K){
    M=K;
    res=0;
    rep(j,N){
      if(M%2){
        res+=v[j];
      }
      M/=2;
    }
    se.insert(res);
  }
  cin>>N;
  rep(i,N){
    cin>>M;
    auto p=se.insert(M);
    if(!p.second){
      cout<<"yes"<<endl;
    }else{
      se.erase(M);
      cout<<"no"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3108
use std::io;

fn main() {
  let stdin = io::stdin();
  let mut buf = String::new();
  stdin.read_line(&mut buf).unwrap();

  let mut iter = buf.trim().split_whitespace()
    .map(|x| x.parse::<i32>().unwrap());
  let a = iter.next().unwrap();
  let b = iter.next().unwrap();

  println!("{} {} {}", a / b, a % b, a as f64 / b as f64);
}



Measured memory_bytes: 5040
#include<bits/stdc++.h>
using namespace std;
#define start ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define rr return 0 ;
const int N = (int)(1*1e6+10);
int fen[N];
typedef long long ss;
int main()
{
   ss a,b,c,i,j,m,n;
   cin>>a>>b>>c;
   m=a-b;
   if(m>=c) cout<<0<<endl;
   else
   {
       cout<<c-m<<endl;
   }
   rr;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define rg register
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
using namespace std;
const int N=1e4+10,M=1e6+10,V=(1<<3)+10,inf=1e9;
inline void dn(int&x,int y){if(y<x)x=y;}
int n,m,num[4],nid[N],nps,ans2;
struct Graph{
	int tot,head[N],to[M],next[M];
	void ins(int a,int b){to[++tot]=b;next[tot]=head[a];head[a]=tot;}
	void addedge(int a,int b){ins(a,b);ins(b,a);}
	int dp[V][N],q[N],ql,qr,inq[N];
	void spfa(int t){
		ql=qr=0;
		rep(i,1,nps)q[qr++]=i,inq[i]=1;
		while(ql!=qr){
			int k=q[ql++];inq[k]=0;if(ql==N)ql=0;
			for(int p=head[k];p;p=next[p])if(dp[t][to[p]]>dp[t][k]+1){
				dp[t][to[p]]=dp[t][k]+1;
				if(inq[to[p]])continue;
				inq[to[p]]=1;
				if(dp[t][to[p]]<dp[t][q[ql]]){
					if(ql==0)ql=N;
					q[--ql]=to[p];
				}else{
					q[qr++]=to[p];
					if(qr==N)qr=0;
				}
			}
		}
	}
	int Steiner(){
		rep(i,1,7)rep(j,1,nps)dp[i][j]=inf;
		rep(i,0,2)dp[1<<i][i+1]=0;
		rep(i,1,7){
			rep(k,1,nps){
				for(int j=(i-1)&i;j;j=(j-1)&i)dn(dp[i][k],dp[j][k]+dp[i^j][k]);
			}
			spfa(i);
		}
		int ans=inf;
		rep(i,1,n)if(dp[7][nid[i]]<ans)ans=dp[7][nid[i]],ans2=i;
		return ans;
	}
}G;
int main(){
	scanf("%d",&n);rep(i,1,3)scanf("%d",&num[i]);
	rep(i,1,3)rep(j,1,num[i]){
		int x;scanf("%d",&x);nid[x]=i;
	}
	nps=3;
	rep(i,1,n)if(!nid[i])nid[i]=++nps;
	scanf("%d",&m);
	rep(i,1,m){
		int a,b;scanf("%d%d",&a,&b);
		G.addedge(nid[a],nid[b]);
	}
	int ans=G.Steiner();
	printf("%d %d\n",ans,ans2);
	return 0;
}

Measured memory_bytes: 11064
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
char ch[1000005];
int len,bj[30];
int main()
{	scanf("%s",ch);
	len=strlen(ch);
	for(int i=0;i<=len-1;i++)
	{	int x=ch[i]-'a';
		bj[x]=1;
	}
	for(int i=0;i<=25;i++)
	{	if(!bj[i])
		{	printf("%c",i+'a');
			return 0;
		}
	}
	printf("None");
	return 0;
}

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

int selection(int A[], int n)
{
	int i,j, count = 0,buff,minj;
	for (i = 0; i < n-1; i++) {
		minj = i;
		for ( j = i; j < n; j++) {
			if (A[j] < A[minj]) minj = j;
		}
		buff = A[i];
		A[i] = A[minj];
		A[minj] = buff;
		if (minj != i)count++;
	}
	return count;
}

int main()
{
	int n, i, count, A[100];

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

	count = selection(A, n);
	
	for (i = 0; i < n; i++) {
		if (i != 0)cout << " ";
		cout << A[i];
	}
	cout << endl << count << endl;

	return 0;
}


Measured memory_bytes: 3216
#include <stdio.h>
#include <string.h>

int main()
{
    char s[5];
    char a=0,b=0,x;
    int countA=0,countB=0;
    int i,flag=0;

    scanf("%s",s);
    for(i=0;i<4;i++)
    {
        x=s[i];
        if(x==a)countA++;
        else if(x==b)countB++;
        else if(!a)
        {
            a=x; countA++;
        }
        else if(!b)
        {
            b=x; countB++;
        }
        else break;
    }
    if(countA==2&&countB==2)flag=1;
    if(flag)printf("Yes");
    else printf("No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
int main(){
IOS;
lli n,i,j,k;
cin>>n;
lli a[n][3],dp[n+1][3]={0};
for(i=0;i<n;i++){
    cin>>a[i][0];
    cin>>a[i][1];
    cin>>a[i][2];
}
for(i=1;i<=n;i++){
    for(j=0;j<3;j++){
            lli maxi=0;
        for(k=0;k<3;k++){
            if(k==j)
                continue;
            maxi=max(maxi,dp[i-1][k]+a[i-1][k]);
        }
        dp[i][j]=maxi;
    }
}
cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}


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

int main() {
   int N;
   cin >> N;
   int A[N];
   for(int i = 0; i < N; i++) {
       cin >> A[i];
   }

   int count = 0;
   for(int j = 1; j <= N; j++) {
       if(j % 2 == 1 && A[j - 1] % 2 == 1) {
           count++;
       }
   }  

   cout << count << endl;  
}

Measured memory_bytes: 3592