akhauriyash/Code-Regression huggingface dataset:
//    _____ _     _                _           _     _ _     _     
//    \_   \ |_  (_)___  __      _| |__   __ _| |_  (_) |_  (_)___ 
//     / /\/ __| | / __| \ \ /\ / / '_ \ / _` | __| | | __| | / __|
//  /\/ /_ | |_  | \__ \  \ V  V /| | | | (_| | |_  | | |_  | \__ \
//  \____/  \__| |_|___/   \_/\_/ |_| |_|\__,_|\__| |_|\__| |_|___/
//                                                                 
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int sz=1e6+9;
string s;

int main(){
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes";else cout<<"No";	
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];

  int ans=0;
  while(!(a[0]==a[1] && a[1]==a[2])){
    sort(a.begin(),a.end());
    if(a[1]==a[2]){
      a[0]+=2;
      ++ans;
    }
    else if(a[0]==a[1]){
      ++a[0];
      ++a[1];
      ++ans;
    }
    else{
      a[0]+=2;
      ++ans;
    }
  }

  cout << ans << endl;
  
  return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int a, b;
  cin >> a >> b;
  cout << max(a + b, max(a + a - 1, b + b - 1)) << endl;
}


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

#define MAX_N 100000
#define INFTY 1000000000

typedef struct{
  int n;
  char c;
}card;

int partition(card *, int, int);
void swap(card *, card *);
void quickSort(card *, int, int);
void merge(card *, int, int, int);
void mergeSort(card *, int, int);

int main(){
  int i, q, n;
  card A[MAX_N], S[MAX_N];

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf(" %c %d", &A[i].c, &A[i].n);
    S[i].c = A[i].c;
    S[i].n = A[i].n;
  }
  
  quickSort(A, 0, n-1);
  mergeSort(S, 0, n);

  for(i=0; i<n; i++){
    if(A[i].c != S[i].c){
      printf("Not stable\n");
      break;
    }else if(i == n-1){
      printf("Stable\n");
    }
  }

  for(i=0; i<n; i++){
    printf("%c %d\n", A[i].c ,A[i].n);
  }

  return 0;
}

void quickSort(card *A, int p, int r){
  int q;

  if(p < r){
    q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }

}

int partition(card *A, int p, int r){
  int i, j, x;

  x = A[r].n;
  i = p-1;

  for(j=p; j<r; j++){
    if(A[j].n <= x){
      i = i+1;
      swap(&A[i], &A[j]);
    }
  }
  swap(&A[i+1], &A[r]);

  return i+1;
}

void swap(card *a, card *b){
  card temp;

  temp.n = a->n;
  a->n = b->n;
  b->n = temp.n;

  temp.c = a->c;
  a->c = b->c;
  b->c = temp.c;

}

void merge(card *A, int left, int mid, int right){
  int i, j, k;
  int n1, n2;
  card L[mid - left + 1], R[right - mid + 1];

  n1 = mid - left;
  n2 = right - mid;

  for( i=0; i < n1; i++){
    L[i] = A[left + i];
  }

  for( i=0; i < n2; i++){
    R[i] = A[mid + i];
  }

  L[n1].n = INFTY;
  R[n2].n = INFTY;

  i = 0;
  j = 0;

  for( k = left; k < right; k++){
    if(L[i].n <= R[j].n){
      A[k] = L[i];
      i++;
    }else{
      A[k] = R[j];
      j++;
    }
  }

}

void mergeSort(card *A, int left, int right){
  int mid;

  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }

}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;

int n, x, ans;
int a[N];

int main() {
    scanf("%d%d", &n, &x);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + n + 1);
    ans = 0;
    for(int i = 1; i <= n; i++) {
        if(x >= a[i]) {
            x -= a[i];
            ans++;
        } else if(x < a[i]) break;
        if(i == n && x > 0) ans--;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
constexpr int INF = 100100100;

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

using namespace std;

void solve(long long int n) {
  long long int sum = 0;
  for (long long int q = 1; q * q < n; ++q) {
    if (n % q == 0) {
      long long int d = n / q;
      long long int m = d - 1;
      if (m > q) {
        sum += m;
      }
    }
  }
  cout << sum << endl;
}

int main() {
  // cout << fixed << setprecision(10);
  long long int n;
  cin >> n;
  solve(n);
  return 0;
}


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

int n;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    string s; cin >> s;
    for (char& c: s) {
        c = ((c-'A'+n)%26) + 'A';
    }
    cout << s << '\n';
}



Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] S = new long[N+1];
		for(int i = 1; i <= N; i++)
			S[i] = (S[i-1] + sc.nextInt() - 1) % K;
		long ans = 0;
		Map<Long, Integer> m = new HashMap<>();
		int j = 0;
		for(int i = 0; i <= N; i++) {
			if(i - j == K) {
				m.put(S[j], m.get(S[j]) - 1);
				j++;
			}
			ans += m.getOrDefault(S[i], 0);
			m.put(S[i], m.getOrDefault(S[i], 0) + 1);
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 96216
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    string s; cin >> s;
    deque <char> Q;
    rep(i,s.size()){
        if (s[i]=='0') Q.push_back(s[i]);
        else if (s[i]=='1') Q.push_back(s[i]);
        else {
            if (Q.empty()) continue;
            else Q.erase(Q.end());
        }
    }
    string ans="";
    rep(i,Q.size()) ans+=Q[i];
    cout << ans << endl;
}

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

int main() {
    int N, P;
    cin >> N >> P;
    int m = 0;
    for (int i = 0; i < N; ++i) {
        int A; cin >> A;
        if (A % 2 == 1) ++m;
    }
    if (m == 0) cout << (P == 0 ? (1LL<<N) : 0) << endl;
    else cout << (1LL<<(N-1)) << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

// Q1 = P1 ( 1 + Q2)
// Q2 = P2 (1 + Q3)
// Q3 = P3 (1 + Q4)
// Qn = Pn(1 + Qr) --> r = n+1

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


void test_case(){
	int n , s; cin >> n >> s;
	vector<int> a(n);
	for(auto &x : a)
		cin >> x;
	vector<mint> q(s+1);
	mint ans = 0;
	for(int i = 0 ; i < n ; i++){
		q[0] += 1; // q += 1
		{
		vector<mint> q2(s+1);
		for(int j = 0 ; j < s+1 ; j++){
			q2[j] += q[j];
			if(j+a[i] <= s)
				q2[j+a[i]] += q[j];
			}
			q = q2;
		}
		ans += q[s];
	}
	cout<<ans<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
//#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <cmath>
//#include <algorithm>
using namespace std;


#define F first
#define PB push_back
#define MP make_pair

typedef long long ll;

ll p = pow(10, 9) + 7;





int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> arr(n);
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
    }
    sort(arr.begin(), arr.end(), greater<int>());
    bool yap = true;
    int comp = ceil(double((double)(sum) /(double) (4 * m)));
    for(int i = 0; i < m; i++)
    {
        if(arr[i] < comp)
        {
            yap = false;
        }
    }
    if(yap)
    {
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }


}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll p,q,r; cin >> p >> q >> r;

    cout << p+q+r-max({p,q,r}) << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll dp[1001][100001] = {0};
ll w[110], v[110];

int main()
{
    ll N, W; cin >> N >> W;
    //vector<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    rep(i, N)
    {
        rep(j, W + 1)
        {
            if (j - w[i] >= 0) dp[i+1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
            else dp[i + 1][j] = dp[i][j];
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define ll long long int
#define MOD (ll) (1e9+7)
#define in_arr(ar) for(int i=0;i<sizeof(ar)/sizeof(ar[0]);i++)cin>>ar[i];
#define val(x) cout<<"Value of "<<(#x)<<" is "<<x<<endl;




ll bigmod(ll a, ll e)
{
    ll ret = 1LL;
    while (e>0)
    {
        if (e%2==1) ret = ret * a % MOD;
        a = a*a % MOD;
        e/=2;
    }
    return ret;
}



int solve()
{
   int ar[5];
   in_arr(ar);
   for(int i=0;i<5;i++)
   {
       if(ar[i]==0)
       {
           cout<<i+1<<endl;
           break;
       }
   }

    return 0;
}


int main()
{
    int t=1;
//    cin>>t;
    while(t--)
    {
        int x = solve();
    }
    return 0;
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
        
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
        cout << *it << " = " << a <<" , ";
        err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;string str;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    const string yes="YES\n";
    const string no="NO\n";
    int main()
    {
        boost vars
        //freopen("input.txt","r",stdin);
        //freopen("input.txt","w",stdout);
        string stra,strb;
        cin>>stra>>strb;
        n=stra.length();
        m=strb.length();
        ans=10000;
        for(i=0;i<=n-m;i++)
        {
            s=0;
            for(j=0;j<m;j++)
            {
                if(stra[i+j]!=strb[j])s++;
            }
            ans=min(ans,s);
        }
        cout<<ans;
    }

Measured memory_bytes: 3660
#include <stdio.h>
#include <string.h>
 
int main(){
  int i;
  char a[512];
  int chk=0;
  scanf("%s",a);
  if(strlen(a)%2!=0)chk=1;
  for(i=0;i<strlen(a);i+=2){
    if(a[i]!='h' || a[i+1]!='i')chk=1;
  }
  if(chk==0){
    printf("Yes\n");
  }else{
	printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
  int n,i,k,m;
  k = 0;
  m = 0;
  scanf("%d",&n);
  for(i = 3;i <= n;i ++){
    if(i % 100 == 0){
      k++;
    }
    if(i % 1000 == 0){
      m++;
    }
    if(i % 3 ==0){
      printf(" %d",i);
    }else if(i >= 1000 && i - m*1000 >=300 &&i- m*1000<400){
      printf(" %d",i);
    }else if(i % 10 == 3){
      printf(" %d",i);
    }else if(i - k*100>= 30 && i - k*100< 40){
      if(i - k*100 - 30 == 0||i - k*100 - 30 == 1||i - k*100 - 30 == 2||i - k*100 - 30 == 3||i - k*100 - 30 == 4||i - k*100 - 30 == 5||i - k*100 - 30 == 6||i - k*100 - 30 == 7||i - k*100 - 30 == 8||i - k*100 - 30 == 9){
        printf(" %d",i);
      }
    }else if(i >= 300 && i<400){
      printf(" %d",i);
    }else if(i >= 3000 && i<4000){
      printf(" %d",i);
    }
  }
  printf("\n");
  return 0;
}

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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int x3, y3, x4, y4;
    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x3 - (x2 - x1);
    y4 = y3 - (y2 - y1);

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

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

using namespace std;
typedef long long ll;

int main(void){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if(A+B > C+D) cout << "Left" << endl;
    else if(A+B < C+D) cout << "Right" << endl;
    else cout << "Balanced" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

    if(s[2]==s[3]&&s[4]==s[5])  cout << "Yes"<<endl;
    else    cout<<"No"<<endl;

 return 0;
}

Measured memory_bytes: 256
use proconio::*;

fn run() {
    input! {
        n: usize,
        a: [[u8; n]; n],
    }
    let mut b = vec![0usize; n];
    for (b, a) in b.iter_mut().zip(a.into_iter()) {
        for (i, a) in a.into_iter().enumerate() {
            *b |= (a as usize) << i;
        }
    }
    const MOD: u64 = 1_000_000_007;
    let mut ans = 0;
    for i in 0usize..(1 << n) {
        let mut way = 1;
        for &b in b.iter() {
            way = way * (b & i).count_ones() as u64 % MOD;
        }
        if (n - i.count_ones() as usize) & 1 == 0 {
            ans += way;
        } else {
            ans += MOD - way;
        }
    }
    ans %= MOD;
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 2144
#include<cstdio>

using namespace std;

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

    if (n == 1) {
        puts("Hello World");
    }else{
        int a, b;
        scanf("%d %d", &a, &b);
        printf("%d\n", a + b);
    }

    
}

Measured memory_bytes: 128
# ABC043 C - Be Together
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()
A = nl()

s = min(A)
l = max(A)

ans = 10**9
cost= 0
for i in range(s,l+1):
    cost= 0
    for a in A:
        cost += (a-i)**2
    ans = min(ans,cost)

print(ans)

Measured memory_bytes: 3064
def main():
    N = int(input())
    h = list(map(int, input().split()))
    r = 0
    while sum(h) > 0:
        m = max(h)
        t = 0
        for i in range(len(h)):
            if h[i] == m:
                h[i] -= 1
                if t == 0:
                    r += 1
                    t = 1
            else:
                t = 0
    print(r)
main()


Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ld a,b,x,ans=0;
    scanf("%Lf%Lf%Lf",&a,&b,&x);
    ld v,tanj;
    if(x==a*b*a){
        printf("0\n");
        return 0;
    }
    if(x>=a*a*b/2){
        v=a*a*b-x;
        tanj=a*a*a/2/v;
        ans=90 - atanl(tanj)*180/(atanl(1)*4.0);
    }else{
        v=x;
        tanj=2*v/a/b/b;
        ans=90 - atanl(tanj)*180/(atanl(1)*4.0);
    }
    printf("%.8Lf\n",ans);
    return 0;
}


Measured memory_bytes: 128
S = input()
F = True
if S[0] != "A":
  F =False
if not("C" in S[2:-1]):
  F = False
if S[1:].count("C")==1:
  for i in range(1,len(S)):
    if S[i] != "C" and S[i].isupper():
      F = False
elif S[1:].count("C")>1:
  F = False
print("AC" if F else "WA")
      

Measured memory_bytes: 3060
// kyopro.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int main(){
	cout.precision(16);
	int L;
	cin >> L;
	double k;
	k = (double)L / 3;
	cout << k * k*k;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int d[2005],n;
const int mod=1e9+7;
int main(){
  
    cin>>n;
    d[0]=1;
    for(int i=1;i<=n;i++){
    	for(int j=0;j<=i-3;j++){
    		d[i]+=d[j];
    		d[i]%=mod;
    	}
    }
    cout<<d[n];

	return 0;
}


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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int k, a, b;
	cin >> k >> a >> b;
	a += (k - a % k) % k;
	cout << (a <= b ? "OK" : "NG") << endl;
	return 0;
}



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

int cnt = 0;
int n;
int a[1'000'100];
void res(int g){
	for (int i = g; i < n; i++){
		int j = i-g;
		while (j >= 0 and a[j] > a[j+g]){
			swap(a[j], a[j+g]);
			j -= g;
			cnt++;
		}
	}
}
			
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	int h = 1;
	int m = 1;
	for (h = 1; h <= n/9; h = 3*h +1) m++;
	cout << m << endl;
	while (h >= 1){
		cout << h  << " ";
		res(h);
		h /= 3;
	}

	cout << endl <<  cnt << endl;

	for (int i = 0; i < n; i++) cout << a[i] << endl;
}



Measured memory_bytes: 6996
int main(void){
  int i,n;
  float ans,bx,by,x0,y0,x,y;

  for(i=1;;i++){
    scanf("%d",&n);
    if(!n) break;

    ans = 0;
    scanf("%f%f",&x0,&y0);
    bx=x0,by=y0;
    for(n--;n--;){
      scanf("%f%f",&x,&y);
      ans += bx*y - by*x;
      bx=x,by=y;
    }
    ans += x*y0 - y*x0;

    printf("%d %.1f\n",i,-ans/2);
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
    ll n;
    cin>>n;
    ll ans=100;
    for(int i=1;i<=100000&&i<=n;i++){
        if(n%i==0){
            ll cnt=0;
            ll now=i;
            while(now>0){
                cnt++;
                now/=10;
            }
            ll cnt2=0;
            now=n/i;
            while(now>0){
                cnt2++;
                now/=10;
            }
            ans=min(ans,max(cnt,cnt2));
        }
    }
    op(ans);
    return 0;
}

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

using namespace std;
#define endl "\n"

const int MOD = 1000000007;
int main()
{
	int a, b, m = 0;
	cin >> a >> b;
	if(a > b){
		for(int i = 0; i < a; i++){
			cout << b;
		}
	}
	else {
		for(int i = 0; i < b; i++){
			cout << a;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3576
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      if (i+j) % 2 == 0:
        print("#", end="")
      else:
        print(".", end="")
    print()
  print()


Measured memory_bytes: 7000
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;

int vis[1000010];
void solve()
{
    int n, m;
    cin >> n >> m;
    int pos = 1;
    int x = (n - 1) / 2;
    int f = 0, l = 1, r = n;
    for (int i = 1; i <= m;i++)
    {
        if(f)
            cout << l << " " << l + x << "\n", l++, x--;
        else
            cout << r << " " << r - x << "\n", r--, x--;
        f ^= 1;
    }
}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

Measured memory_bytes: 3668
N = gets.chomp.to_i

Q = 2 ** N

hash = {}
N.times do |i|
  hash[i] = []
  gets.chomp.to_i.times do
    x, y = gets.chomp.split.map(&:to_i)
    hash[i] << [x-1, y]
  end
end

max = 0

[0, 1].repeated_permutation(N).each do |tf_ary|
  ans = 0
  flag = true
  tf_ary.each_with_index do |b, i|
    next unless b == 1
    hash[i].each do |ary|
      next if tf_ary[ary[0]] == ary[1]
      flag = false
      break
    end
    break if !flag
  end
  max = tf_ary.count(1) if flag && tf_ary.count(1) > max
end

p max

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
struct point{double x;double y;};
int i,j,k,count1=0,count2=0;

int main(void){
    int n,t;
    cin>>n>>t;
    int d;
    long long int ans=0;
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>vec[i];
        if(i>=1){
            d=vec[i]-vec[i-1];
            if(d<=t){
                ans+=d;
            }else{
                ans+=t;
            }
        }
    } 
    ans+=t;
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> v(M + 1);
  for (int i = 0; i < N; ++i) {
    int A, B; cin >> A >> B;
    if (A > M) continue;
    v[A].push_back(B);
  }

  LL total = 0;
  priority_queue<LL> que;
  for (int i = M-1; i >= 0; --i) {
    for (int x : v[M-i]) que.push(x);
    if (!que.empty()) {
      total += que.top(); que.pop();
    }
  }
  cout << total << endl;
}


Measured memory_bytes: 8428
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   int n,m;
   cin>>n>>m;
   vector<int> l(m),r(m);
   int max_l=1,min_r=1000001;
   for(int i=0;i<m;i++){
	    cin>>l[i]>>r[i];
	    max_l=max(max_l,l[i]);
	    min_r=min(min_r,r[i]);
	  }
	 int ans=min_r-max_l;
	 ans++;
	 cout<<max(0ll,ans)<<endl;	
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    map<int, int> mp;
    rep(i, 0, n) {
        mp[a[i]]++;
    }
    
    if(n == mp.size()) {
        cout << n << endl;
    }
    else {
        if(mp.size()%2 == 1) {
            cout << mp.size() << endl;
        }
        else {
            cout << mp.size()-1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define MS(a) memset(a,0,sizeof(a))
#define MP make_pair
#define PB push_back
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//////////////////////////////////////////////////////////////////////////
const int maxn = 1e5+10;
const ll mod = 1e9+7;

ll x[maxn],y[maxn];

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

	for(int i=1; i<=m; i++)
		cin >> y[i];

	ll a1=0,a2=0;
	for(int i=1; i<=n; i++){
		ll t = ((x[i]+mod)%mod)*((2*i-n-1+mod)%mod);
		while(t<0) t += mod;
		a1 = (a1+(t+mod)%mod)%mod;
	}

	for(int i=1; i<=m; i++){
		ll t = ((y[i]+mod)%mod)*((2*i-m-1+mod)%mod);
		while(t<0) t += mod;
		a2 = (a2+(t+mod)%mod)%mod;
	}
	ll ans = ((a1%mod)*(a2%mod))%mod;
	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static long MOD = 1_000_000_007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] s = new int[n];
		int[] t = new int[m];
		
		
		long[][] dp = new long[n+1][m+1];
		long[][] dp2 = new long[n+1][m+1];
		HashMap<Integer,TreeSet<Integer>> map = new HashMap<>();
		
		
		for (int i=0;i<n;i++) {
			s[i]=sc.nextInt();
		}
		for (int j=0;j<m;j++) {
			t[j]=sc.nextInt();
			if (!map.containsKey(t[j])) {
				map.put(t[j], new TreeSet<Integer>());
			}
			map.get(t[j]).add(j);
			
		}
		
		for (int j=0;j<=m;j++) {
			dp[0][j]=1;
			if (j<m) {
				if( map.get(t[j]).lower(j)!=null) {
					dp2[0][j]=dp2[0][map.get(t[j]).lower(j)]+1;
				} else {
					dp2[0][j]=1;
				}
			}
			
		}
		
		for (int i=0;i<n;i++) {
			
			for (int j=0;j<=m;j++) {
				dp[i+1][j]=dp[i][j];
				
				if (map.get(s[i]) != null
						&& map.get(s[i]).lower(j) != null) {
					dp[i+1][j]+=dp2[i][map.get(s[i]).lower(j)];
					dp[i+1][j]%=MOD;
					
				}
				if (j<m) {
					if( map.get(t[j]).lower(j)!=null) {
						dp2[i+1][j]=dp2[i+1][map.get(t[j]).lower(j)]+dp[i+1][j];
						dp2[i+1][j]%=MOD;
					} else {
						dp2[i+1][j]=dp[i+1][j];
					}
				}
				
				
			}
		}
		
		System.out.println(dp[n][m]);


	}



}




Measured memory_bytes: 235984
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    if S[-1] in ['2','4','5','7','9']:
        print('hon')
    elif S[-1] in ['0', '1', '6', '8']:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10100
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	lli N,A,B;
	cin>>N>>A>>B;
	lli X[MAX+1];
	rep1(i,N)cin>>X[i];
	lli ans=0;
	rep1(i,N-1){
		ans+=min(B,A*(X[i+1]-X[i]));
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
		--a[i];
	}
	int cur = 0, cnt = 0;
	vector<bool> used(n, false);
	while(cur != 1){
		used[cur] = true;
		cur = a[cur];
		if(used[cur]){
			cout << -1 << endl;
			return 0;
		}
		++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
const int mo=1e9+7,inv=5e8+4;
int main(){
	int sum=0,sum1=0,n,x;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&x),(sum+=x)%=mo,(sum1+=1ll*x*x%mo)%=mo;
	printf("%d",((1ll*sum*sum-sum1)%mo*inv%mo+mo)%mo);
	return 0;
}

Measured memory_bytes: 3812
import sys
input = sys.stdin.readline

A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))

n = int(input())

for _ in range(n):
    b = int(input())
    if b in A1:
        A1[A1.index(b)]=0
    if b in A2:
        A2[A2.index(b)]=0
    if b in A3:
        A3[A3.index(b)]=0
if sum(A1)==0 or sum(A2)==0 or sum(A3)==0 or A1[0]+A2[1]+A3[2]==0 or A1[2]+A2[1]+A3[0]==0 or A1[0]+A2[0]+A3[0]==0 or A1[1]+A2[1]+A3[1]==0 or A1[2]+A2[2]+A3[2]==0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9200
#include <stdio.h>
#include <math.h>
int main(void) {
	int N, x[8], y[8], i, j; double s = 0;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {scanf("%d %d", &x[i], &y[i]);}
	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			s += sqrt(pow((x[i]-x[j]), 2.0)+pow((y[i]-y[j]), 2.0));
        }
	}
	printf("%.10lf", 2 * s / N);
}

Measured memory_bytes: 128
from itertools import product
import numpy as np

h, w = map(int, input().split())
notwall = []
for _ in range(h):
    s = input()
    notwall.append([int(c == '.') for c in s])

notwall = np.array(notwall)


def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls


def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls


def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls


def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls


ll = getll()
lr = getlr()
lu = getlu()
ld = getld()

m = max([0, np.max(ll + lr + lu + ld) - 3])

print(m)



Measured memory_bytes: 249648
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
int mod = 1000000007;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
template<class... T> int add(int x, T... y) { return add(x, add(y...)); }
int mul(int x, int y) { return 1LL * x * y % mod; }
template<class... T> int mul(int x, T... y) { return mul(x, mul(y...)); }
int sub(int x, int y) { return add(x, mod - y); }
int modpow(int a, long long b) { int ret = 1; while (b > 0) { if (b & 1) ret = 1LL * ret * a % mod; a = 1LL * a * a % mod; b >>= 1; } return ret; }
int modinv(int a) { return modpow(a, mod - 2); }

#define FAC_MAX 201010
int fac[FAC_MAX], ifac[FAC_MAX];
void initfac() {
    fac[0] = ifac[0] = 1;
    rep(i, 1, FAC_MAX) fac[i] = 1LL * i * fac[i - 1] % mod;
    rep(i, 1, FAC_MAX) ifac[i] = modinv(fac[i]);
}
int aCb(int a, int b) {
    if (b < 0 || a < b) return 0;
    return (1LL * fac[a] * ifac[a - b] % mod) * ifac[b] % mod;
}
int nHk(int n, int k) {
    if (n == 0 && k == 0) return 1;
    if (n <= 0 || k < 0) return 0;
    return aCb(n + k - 1, k);
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int X, Y;
//---------------------------------------------------------------------------------------------------
map<int,int> G;
void _main() {
    cin >> X >> Y;

    G[1] = G[3] = G[5] = G[7] = G[8] = G[10] = G[12] = 1;
    G[4] = G[6] = G[9] = G[11] = 2;
    G[2] = 3;

    if (G[X] == G[Y]) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, q;
    cin >> n >> q;
    int a[n];
    rep(i,n)cin >> a[i];

    sort(a,a+n);

    rep(i,q){
        int l, r;
        cin >> l >> r;
        int ans = lower_bound(a, a+n, r+1) - lower_bound(a, a+n, l);
        cout << ans << endl;
    }

    return 0;
}
 
 



Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main() {
  int a[3][3];
  rep(i, 3) {
    rep(j, 3) { cin >> a[i][j]; }
  }

  int n;
  cin >> n;

  rep(k, n) {
    int b;
    cin >> b;
    rep(i, 3) {
      rep(j, 3) {
        if (b == a[i][j]) {
          a[i][j] = -1;
        }
      }
    }
  }
  rep(i, 3) {
    if (a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  rep(i, 3) {
    if (a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3604
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n;
	cin >> n;
	long long ans = 1e15;
	for(long long i=1;i*i<=n;i++) {
		if(n % i == 0) {
			ans = min(ans, i + n/i);
		}
	}
	cout << ans-2;
	return 0;
}


Measured memory_bytes: 256
import queue


class UnionFind:

    def __init__(self, N):
        self.sizes = [1 for _ in range(N)]
        self.par = [i for i in range(N)]

    def find(self, x):
        if x == self.par[x]:
            return x

        self.par[x] = self.find(self.par[x])

        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.sizes[x] < self.sizes[y]:
            x, y = y, x

        self.par[y] = x
        self.sizes[x] += self.sizes[y]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self.sizes[self.find(x)]


def main():
    N, Q = map(int, input().split())
    uf = UnionFind(N)

    for _ in range(Q):
        com, x, y = map(int, input().split())
        if com == 0:
            uf.unite(x, y)
        else:
            print(int(uf.same(x, y)))

    return


if __name__ == '__main__':
    main()



Measured memory_bytes: 7400
N, M = map(int, input().split())
PS = []
for i in range(M):
    p, s = input().split()
    PS.append([int(p), s])

a_w = []
for i in range(N+1):
    a_w.append([False, 0])

for p, s in PS:
    if s == 'AC':
        a_w[p][0] = True
    else:
        if not a_w[p][0]:
            a_w[p][1] += 1

a_cnt = 0
w_cnt = 0
for a, w in a_w:
    if a:
        a_cnt += 1
        w_cnt += w
print(a_cnt, w_cnt)

Measured memory_bytes: 32160
#include<bits/stdc++.h>
#define int long long int
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define inf 10000000000001
#define all(x) (x).begin(),(x).end()
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(auto i=s;i<n;i++)
#define rloop(i,n,b) for(auto i=n-1;i>=b;i--)
using namespace std;
	
signed main()
{
	fastio(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	loop(i,0,n) cin>>a[i];
	int dp[k+1][n+1];
	init(dp,0);
	//no of ways for n=1, fill upto a[0], is 1.
	loop(i,0,k+1)
	{
		if(i<=a[0]) dp[i][1] = 1;
		else dp[i][1] = 0;
		// use dp[k][0] as prefix array
		if(i==0) dp[i][0] = dp[i][1];
		else dp[i][0] = (dp[i-1][0] + dp[i][1])%mod;
	}

	

	// dp[k][n] = sum(dp[k-ai][n-1]) ; ai E [0,min(k,an)].
	for(int N=2;N<=n;N++)
	{
		for(int K=0;K<=k;K++)
		{
			if(a[N-1]<K)
				dp[K][N] = (dp[K][0] - dp[K-a[N-1]-1][0] + mod)%mod; 
			else dp[K][N] = dp[K][0]%mod;
		}
		// update prefix array
		for(int K=0;K<=k;K++)
		{
			if(K==0) dp[K][0] = dp[K][N]%mod;
			else dp[K][0] = (dp[K-1][0] + dp[K][N])%mod;
		}
	}

	// ans = dp[k][n]
	cout<<dp[k][n]%mod<<endl;
	return 0;	
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    string s,t;
    i32 n,m;
    rep1(i,5) {
        cin >> n;
        if(n == 0) {
            cout << i << '\n';
            return 0;
        }
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ls ch[x][0]
#define rs ch[x][1]
#define ll long long
using namespace std;

inline ll read(){
	ll num=0,neg=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')neg=-1;c=getchar();}
	while(isdigit(c)){num=(num<<3)+(num<<1)+c-'0';c=getchar();}
	return num*neg;
}

ll d,t,s;

int main(){
	d=read(),t=read(),s=read();
	if(t*s<d)printf("No\n");
	else printf("Yes\n");
}


Measured memory_bytes: 3632