akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main (void) {
    string S;
    string T;

    cin >> S >> T;

    int i;
    bool exist;
    for (i = S.size() - 1; i >= 0; i--) {
        exist = true;
        for (int j = 0; j < T.size(); j++) {
            if (i - j < 0) {
                exist = false;
                break;
            }
            if (!(S[i - j] == '?' || S[i - j] == T[T.size() - 1 - j])) exist = false;
        }
        if (exist) break;
    }

    if (exist) {
        for (int j = 0; j < T.size(); j++) S[i - j] = T[T.size() - 1 - j];
        for (int j = 0; j < S.size(); j++) {
            if (S[j] == '?') S[j] = 'a';
        }
        cout << S << endl;
    } else cout << "UNRESTORABLE" << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod


int n, m, t;
int a[105];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> t;
    rep(i, n) cin >> a[i];
    int pos = 0;
    int now = 0;
    int ans = 0;
    int i = 0;
    while (i < n) {
        if (pos == 0) {
            ans += a[i] - (now + m);
            now = a[i];
            pos = 1;
            i++;
        }
        else {
            if (a[i] - now > 2 * m) {
                pos = 0;
                now += m;
            }
            else {
                pos = 1;
                now = a[i];
                i++;
            }
        }
    }
    ans += max(0, t - (a[n - 1] + m));
    cout << ans << endl;
}

Measured memory_bytes: 3168
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
int main() {
  int n;
  cin >> n;
  vector<vector<int>> edge(n);
  rep(i, n) {
    rep(j, n) {
      if(i == j) continue;
      if(n % 2 == 0 && i + j == n - 1) continue;
      if(n % 2 == 1 && i + j == n - 2) continue;
      edge[i].emplace_back(j);
    }
  }
  if(n % 2 == 0) cout << n * (n - 2) / 2 << endl;
  else cout << (n - 1) * (n - 3) / 2 + n - 1 << endl;
  rep(i, n) {
    for(auto& node : edge[i]) {
      if(i > node) continue;
      cout << i+1 << ' ' << node + 1 << endl;
    }
  }
  return 0;
}


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

#define ll long long
#define f(i, a, b) for(ll i=a;i<b;i++)
#define fi(i, a, b) for(ll i=b-1;i>=a;i--)
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define ml map<ll,ll>
#define pll pair<ll,ll>
int main(){
  int k=0;
  for(int i=1;i<=5;i++){
    int a;
    cin>>a;
    if(a==0)
    k=i;
  }
  cout<<k;
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%f %f",&a,&b)!=EOF){
		if(a<35.5 && b<71){
			printf("AAA\n");
		}
		else if(a<37.5 && b<77){
			printf("AA\n");
		}
		else if(a<40 && b<83){
			printf("A\n");
		}
		else if(a<43 && b<89){
			printf("B\n");
		}
		else if(a<50 && b<105){
			printf("C\n");
		}
		else if(a<55 && b<116){
			printf("D\n");
		}
		else if(a<70 && b<148){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	//	scanf("%d %d",&a,&b);
	}
	return 0;
}

Measured memory_bytes: 1032
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    a, b = list(map(int,input().split()))
    if a > b:
        a, b = b, a

    print(str(a)*b)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
# A - Frog1
import numpy as np

N = int(input())
h = list(map(int, input().split()))
dp = [10 ** 9 for i in range(N + 2)]
dp[0] = 0

for i in range(N):
    if i+1<N:
        dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]))
    if i+2<N:
        dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]))
print(dp[N-1])

Measured memory_bytes: 22696
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, k;
ll ans;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> k;
    ll a = 0, b = 0;
    if (k%2) {
        a = n/k;
        ans = a*a*a;
    } else {
        a = n/k;
        b = n*2/k-n/k;
        ans = a*a*a + b*b*b;        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,k,yuusya;
  cin>>n;
  k=0;
  vector<long> vec(n+1);
  vector<long> yuu(n);
  for(long i=0; i<n+1; i++){
    cin>>vec.at(i);
  }
  for(long i=0; i<n; i++){
    cin>>yuu.at(i);
  }
  for(long i=0; i<n; i++){
    if(yuu.at(i)<vec.at(i)){
      k=k+yuu.at(i);
    }
    else if(yuu.at(i)<vec.at(i)+vec.at(i+1)){
      k=k+yuu.at(i);
      vec.at(i+1)=vec.at(i+1)+vec.at(i)-yuu.at(i);
    }
    else{
      k=k+vec.at(i+1)+vec.at(i);
      vec.at(i+1)=0;
    }
  }
  cout<<k;
}

Measured memory_bytes: 1792
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

#include <iostream>

int main()
{
	string b;
	cin >> b;
	int N = b.size();

	string X = "";

	rep(i,N) 
		if (b[i] == 'A') { X += "T"; }
	else if (b[i] == 'T') { X += "A"; }
	else if (b[i] == 'G') { X += "C"; }
	else if (b[i] == 'C') { X += "G"; }

	cout << X << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int n,h;
int l[220],r[220],fa[420],siz[420],L,R;
int find(int x){
	if(fa[x]==x)return x;
	return fa[x]=find(fa[x]);
}
int main(){
	scanf("%d%d",&n,&h);
	for(int i=1;i<=400;i++)fa[i]=i;
	for(int i=1;i<=n;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if(c==0)l[a]++,L=a;
		else r[c]--,L=c+200;
		if(d==0)r[b]++,R=b+200;
		else l[d]--,R=d;
		if(find(L)==find(R)){
			siz[find(L)]++;
			continue;
		}
		siz[find(R)]+=siz[find(L)]+1;
		siz[find(L)]=0;
		fa[find(L)]=find(R);
	}
	int ans=0,cns=0;
	for(int i=1;i<=200;i++){
		if(l[i]<0||r[i]<0){
			printf("NO\n");
			return 0;
		}
		if(l[i])ans+=siz[find(i)],siz[find(i)]=0;
		if(r[i])ans+=siz[find(i+200)],siz[find(i+200)]=0;
	}
	if(ans!=n)printf("NO\n");
	else printf("YES\n");
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll N;
    cin >> N;
    for (ll i = -1000; i < 1000; i++)
    {
        for (ll j = -1000; j < 1000; j++)
        {
            if((ll)pow(i,5)-(ll)pow(j,5)==N){
                pr(i,j);
                return 0;
            }
        }
    }
    
}

Measured memory_bytes: 4100
#include <stdio.h>

int main()
{
 long long a,b,n;
 scanf("%lld%lld%lld",&a,&b,&n);
 
 long long x;
 
 
 if(b>n)
 {
     x=n;
 }
 else
 {
     x=b-1;
 }

 printf("%lld\n",a*x/b-a*(x/b));
 
  return 0;
}

Measured memory_bytes: 1728
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

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

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	string res;
	for (int i = 0; i < t.length(); i++)
	{
		res = res + s[i];
		res = res + t[i];
	}

	if (s.length() > t.length())
	{
		res = res + s.back();
	}

	println(res);
}

Measured memory_bytes: 256
fun main() {
    val nk = nextInt()
    val pn = nextIntList()
    val ans = solve(pn)
    println(ans)
}

fun solve(pn: List<Int>): Int {
    val a = createNewList(pn)
    return a
}

fun createNewList(pn: List<Int>): Int {
    val listLength = pn.size

    tailrec fun innerFunction(index: Int, list: MutableList<Int>, movingCountSum: Int): Int {
        return if (index == listLength) {
            movingCountSum
        } else {
            var currentMovingCount2 = 0

            val newList = if (list[index] == index + 1 && index + 1 != listLength) {
                val a = list[index]
                val b = list[index + 1]
                list[index] = b
                list[index + 1] = a
//                val beforeList = if (index == 0) listOf() else list.take(index)
//                val afterList = if (index + 2 == listLength) listOf() else list.takeLast(listLength - index - 2)
                currentMovingCount2++
                list
//                beforeList.union(listOf(list[index + 1], list[index])).union(afterList).toList()
//                listOf(*beforeList.toTypedArray(), list[index + 1], list[index], *afterList.toTypedArray())
            } else if (index + 1 == listLength && list[index] == index + 1) {
                val beforeList = list.take(index - 1)
                currentMovingCount2++
                val a = list[index]
                val b = list[index - 1]
                list[index] = b
                list[index - 1] = a
                list
            } else {
                list
            }
            val newMovingCountSum = movingCountSum + currentMovingCount2
            val newIndex = index + 1

            innerFunction(newIndex, newList, newMovingCountSum)
        }
    }

    return innerFunction(0, pn.toMutableList(), 0)
}


fun nextInt(): Int {
    return readLine()!!.toInt()
}

fun nextIntList(): List<Int> {
    return readLine()!!.split(" ").map { it.toInt() }
}

fun nextLongList(): List<Long> {
    return readLine()!!.split(" ").map { it.toLong() }
}

fun nextString(): String {
    return readLine()!!
}

Measured memory_bytes: 52044
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



int main(){
  int n;
  cin >> n;
  vl a(n);
  rep(i,n) cin >> a.at(i);
  sort(all(a));
  long g = __gcd(a.at(0), a.at(1));
  vl list;
  REP(i, 1, sqrt(g)+1){
    if(g % i == 0){
      list.push_back(i);
      list.push_back(g/i);
    }
  }
  long ans = 1;
  
  for(long v : list){
    int ikkai = 1;
    REP(i,2,n){
      if(a.at(i) % v != 0){
        if(ikkai) ikkai--;
        else {
          ikkai--;
          break;
        }
      }
    }
    if(ikkai >= 0) chmax(ans, v);
  }
  vl list2;
  REP(i, 1, sqrt(a.at(0))+1){
    if(a.at(0) % i == 0){
      list2.push_back(i);
      list2.push_back(a.at(0)/i);
    }
  }
  for(long v : list2){
    int ikkai = 1;
    rep(i,n){
      if(i == 0) continue;
      if(a.at(i) % v != 0){
        if(ikkai) ikkai--;
        else{
          ikkai--;
          break;
        }
      }
    }
    if(ikkai >= 0) chmax(ans, v);
  }
  vl list3;
  REP(i, 1, sqrt(a.at(1))+1){
    if(a.at(1) % i == 0){
      list3.push_back(i);
      list3.push_back(a.at(1)/i);
    }
  }
  for(long v : list3){
    int ikkai = 1;
    rep(i,n){
      if(i == 1) continue;
      if(a.at(i) % v != 0){
        if(ikkai) ikkai--;
        else{
          ikkai--;
          break;
        }
      }
    }
    if(ikkai >= 0) chmax(ans, v);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4112
#include <cstdio>
#include <set>

int a[1000005];

int main()
{
    int s, i = 1;
    scanf("%d", &s);
    int pre = s;
    int tmp;
    a[s] = 1;
    while(1)
    {
        if(pre % 2 == 0)
        {
            tmp = pre / 2;
            if(a[tmp])
                break;
            else
            {
                i++;
                a[tmp] = 1;
            }
        }
        else
        {
            tmp = pre * 3 + 1;
            if(a[tmp])
                break;
            else
            {
                i++;
                a[tmp] = 1;
            }
        }
        pre = tmp;
    }
    printf("%d\n", i+1);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
using ll = long long;
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    if ((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0)cout << "Possible";
    else cout << "Impossible";
    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 int long long int

#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 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;
    }
}

// Range Minimum Query (??????????°??????¨??????RMQ)
// Verified: AOJ DSL_2_A: Range Minimum Query (int?????????)

template <typename T>
class rmq {
    public:
        int n;
        vector<T> dat;

        // ????´???° m ??? RMQ ?????????
        rmq(int m) {
            n = 1;
            while(n < m) n *= 2;
            dat.resize(2*n-1);
            rep(i,0,2*n-1) dat[i] = INT_MAX;
        }

        // k?????? (0-indexed) ????????? a ?????´??°
        void update(int k, T a) {
            k += n - 1;
            dat[k] = a;
            while(k > 0) {
                k = (k - 1) / 2;
                dat[k] = min(dat[k*2+1], dat[k*2+2]);
            }
        }

        // [a, b) ???????°?????????????
        // ???????????????????????¨?????? XX.query(a, b, 0, 0, -1) ??¨??????
        T query(int a, int b, int k, int l, int r) {
            if(r == -1) r = n;
            if(r <= a || b <= l) return INT_MAX;
            if(a <= l && r <= b) return dat[k];
            else {
                T vl = query(a, b, k*2+1, l, (l+r)/2);
                T vr = query(a, b, k*2+2, (l+r)/2, r);
                return min(vl, vr);
            }
        }
};

signed main() {
    int n, q; cin >> n >> q;
    rmq<int> r(n);
    int c, x, y;
    rep(i,0,q) {
        cin >> c >> x >> y;
        if(c == 0) r.update(x, y);
        else cout << r.query(x, y+1, 0, 0, -1) << endl;
    }
    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
string s[510];

int main() {
	cin >> N;

	bool all = 1;

	rep(i, N) {
		cin >> s[i];
		rep(j, N) {
			if (s[i][j] != '.') {
				all = 0;
			}
		}
	}

	if (all) {
		puts("-1");
		return 0;
	}

	int ns = 0;

	rep(j, N) {
		int f = 0;
		rep(i, N) {
			if (s[i][j] == '.') {
				++f;
			}
		}
		ns += (f > 0);
	} 

	int ret = N * 2;

	rep(i, N) {
		int w = 0;
		rep(j, N) {
			if (s[i][j] == '.') {
				++w;
			}
		}
		bool can = 0;
		rep(ii, N) if (s[ii][i] == '#') {
			can = 1;
		}
		int t = w + ns + (!can);
		ret = min(ret, t);
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+10,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int dec(int x,int y){x-=y;return x<0?x+p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=mul(x,x))
		if (y&1) ans=mul(ans,x);
	return ans;
}
int fac[N],ifac[N];
int C(int n,int m){
	return mul(fac[n],mul(ifac[m],ifac[n-m]));
}
//从[(0,0),(rx,ry)]中一点到(0,0)和(s,t)路径数乘积之和
int query(int rx,int ry,int s,int t){
	int ans=0;
	for (int x=0;x<=rx;x++) ans=inc(ans,mul(x+ry+1,mul(C(x+ry,ry),C(s-x+t-ry-1,t-ry-1))));
	for (int y=0;y<=ry;y++) ans=inc(ans,mul(rx+y+1,mul(C(rx+y,rx),C(s-rx-1+t-y,s-rx-1))));
	return ans;
}
//从[(lx,ly),(rx,ry)]中一点到(0,0)和(s,t)路径数乘积之和
int query(int lx,int ly,int rx,int ry,int s,int t){
	return dec(inc(query(rx,ry,s,t),query(lx-1,ly-1,s,t)),inc(query(lx-1,ry,s,t),query(rx,ly-1,s,t)));
}
int x[7],y[7];
int main()
{
	fac[0]=1;
	for (int i=1;i<N;i++) fac[i]=mul(fac[i-1],i);
	ifac[N-1]=power(fac[N-1],p-2);
	for (int i=N-1;i;i--) ifac[i-1]=mul(ifac[i],i);
	for (int i=1;i<=6;i++) cin>>x[i];x[1]--;x[6]++;
	for (int i=1;i<=6;i++) cin>>y[i];y[1]--;y[6]++;
	int ans=0;
	for (int a=1;a<=2;a++)
	for (int b=1;b<=2;b++)
	for (int c=5;c<=6;c++)
	for (int d=5;d<=6;d++){
		int sig=((a!=b)!=(c!=d)?p-1:1);
		ans=inc(ans,mul(sig,query(x[3]-x[a],y[3]-y[b],x[4]-x[a],y[4]-y[b],x[c]-x[a],y[d]-y[b])));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 15872
N,M=map(int,input().split())
xyz=[tuple(map(int,input().split())) for i in range(M)]
class unionFind:
    parent = []
    num=0
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.num=N
    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.num-=1
            return
G=unionFind(N)
for x,y,z in xyz:
  G.unite(x,y)
print(G.num)

Measured memory_bytes: 21384
import java.util.*;
 
public class Main {
    static int[] numbers = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    System.out.println(numbers[K - 1]);
  }
}

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

using namespace std;

typedef long long ll;
typedef pair < int, int > ii;

const int N = 1e5 + 5;

int n;
bool h[N];
int ida[N], idb[N];
ii a[N];

int dist(int &pos, ii a) {
  int x = a.first, y = a.second;
  if(x <= pos and pos <= y)
    return 0;
  if(pos > y) {
    int ret = pos - y;
    pos = y;
    return ret;
  }
  int ret = x - pos;
  pos = x;
  return ret;
}

int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    ida[i] = idb[i] = i;
  }
  sort(ida + 1, ida + n + 1, [&](int x, int y){
    return a[x].first > a[y].first;
  });
  sort(idb + 1, idb + n + 1, [&](int x, int y){
    return a[x].second < a[y].second;
  });
  ll ans = 0;
  {
    ll res = 0;
    int pos = 0;
    for(int i = 1; i <= n; i++) {
      if(!h[ida[i]]) {
        res += dist(pos, a[ida[i]]);
        h[ida[i]] = 1;
      }
      if(!h[idb[i]]) {
        res += dist(pos, a[idb[i]]);
        h[idb[i]] = 1;
      }
    }
    res += abs(pos);
    ans = max(ans, res);
  }
  {
    memset(h, 0, sizeof(h));
    ll res = 0;
    int pos = 0;
    for(int i = 1; i <= n; i++) {
      if(!h[idb[i]]) {
        res += dist(pos, a[idb[i]]);
        h[idb[i]] = 1;
      }
      if(!h[ida[i]]) {
        res += dist(pos, a[ida[i]]);
        h[ida[i]] = 1;
      }
    }
    res += abs(pos);
    ans = max(ans, res);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string N;
	cin >> N;

	int sum = 0, digisum = 0, div = 1;
	for (int i = N.size() - 1; i >= 0 ; i--) {

		sum += (N[i] - '0') * div;
		div *= 10;
		digisum += (N[i] - '0');

	}

	cout << ((sum%digisum) ? "No" : "Yes") << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int gcd(int a, int b){
    if(!b)return a;
    return gcd(b,a%b);
}

int main(){
    int a,b;

    cin >> a >> b;
    if(a<b){
        int swap = a;
        a = b;
        b = swap;
    }
    cout << gcd(a,b) << endl;
    return 0;
}

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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0)
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    int64_t t,n,m,a,b,c,d,e,i,j,k,x,y,cnt=0,cnt1=0;
    bool flag = false;   
    
    cin>>a>>b>>c;
    if(a*b>=c) cout<<c<<endl;
    else cout<<a*b<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


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

using namespace std;

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

ll n, k;

int main(){
    cin >> n >> k;
    double ans=0;
    if(n-k+1 > 0)ans = double(n-k+1)/double(n);
    for(ll i = 1; i < min(k, n+1); i++){
        ll ii = i;
        ll j;
        for(j = 1; ; j++){
            ii*=2;
            if(ii >= k)break;
        }
        ans += double(1)*double(pow(2,-j))/double(n);
    }
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


static int desc(const void *a, const void *b);
static int asc(const void *a, const void *b);

int main (void){
    int n,k,i,j;
    int x,y,z;
    int count = 0;
    double dx;
    int box[200001]={};
    char text[200001]={};
    char s[200001]={};
    char t[200001]={};
    char alf[256] = {"abcdefghijklmnopqrstuvwxyz"};
    char alfb[256] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    char sample_text[256];
    i = 0;j = 0;
    // Input Area //
   // scanf("%d %d",x,y);
    scanf("%s %s",s,t);
    scanf("%d %d",&x,&y);
    scanf("%s",text);

    
    if(strcmp(text,s)==0){
        x--;
    }else if(strcmp(text,t)==0){
        y--;
    }
    printf("%d %d",x,y);
    //scanf("%s",&sample_text);
    //scanf("%s",&text);

    /*
    scanf("%d",&n);
    for(i = 0; i < n; i++){
        scanf("%d",&box[i]);
    }
    for(i = 0; i < n; i++){
        printf("%d",box[i]);
    }
    printf("\n");
    qsort(box,n,sizeof(int),desc);
    
    */
    // Output Area //
    
    /*
    for(i = 0; i < n; i++){
        printf("%d",box[i]);
    }
    */

}

static int desc(const void *a, const void *b){
    return *(int *) b - *(int *) a;
}

static int asc(const void *a, const void *b){
    return *(int *) a - *(int *) b;
}


/* KonoLvBANK

配列降順ソート
qsort(box,n,sizeof(int),desc);
配列昇順ソート
qsort(box,n,sizeof(int),asc);

アルファベットを次の単語に変えるやつ
    while(1){
        if (text[i] == '\0'){
            break;
        }
        for(j = 0; j < 26; j++){
            if (text[i] == alf[j]){
                if (j != 25){
                    text[i] = alf[j + 1];
                }else{
                    text[i] = alf[0];
                }
                break;
            }
        }
        i++;
    }

*/


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  ll m = 0;
  rep(i,n) m+=a[i];
  ll m1 = m+(n-1);
  m1/=n;
  ll m2 = m/n;
  ll ans1=0,ans2=0;
  rep(i,n) ans1+=(a[i]-m1)*(a[i]-m1);
  rep(i,n) ans2+=(a[i]-m2)*(a[i]-m2);
  cout << min(ans1,ans2)<<endl;
  return 0;
}


Measured memory_bytes: 256
n, x = map(int,input().split())
def ABC115D(n,x):
    if x == 0:
        return 0
    if n == 0:
        return 1
    elif x == 1:
        return 0
    elif x >= 2**(n+1)-1:
        return ABC115D(n-1,x-2**(n+1)+1) + 2**n
    else:
        return ABC115D(n-1,x-1)
print(ABC115D(n,x))

Measured memory_bytes: 3060
import java.util.BitSet;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.stream.IntStream;

public class Main{
	static Scanner s=new Scanner(System.in);
	public static void main(String[] __){
		TreeSet<Integer> set=new TreeSet<>();
		new PrimeIterator(1000000).forEach(set::add);
		while(true){
			int a=s.nextInt(),d=s.nextInt(),n=s.nextInt();
			if(a+d+n==0)return;
			System.out.println(
					IntStream.iterate(a,i->i+d).filter(set::contains).skip(n-1).findFirst().getAsInt());
		}
	}
}
class PrimeIterator implements Iterable<Integer>,PrimitiveIterator.OfInt{
	private BitSet	bitSet;
	private int		nextV;
	private int		limit;
	public PrimeIterator(int limit){
		this.limit=limit;
		bitSet=new BitSet(limit+1);
		nextV=limit<2?-1:2;
	}
	@Override
	public boolean hasNext(){
		return nextV>=0;
	}
	@Override
	public int nextInt(){
		if(!hasNext())
			throw new NoSuchElementException();
		int r=nextV;
		final long buf=nextV;
		if(buf*buf<=limit)
			for(int i=nextV*nextV;i<=limit;i+=nextV)
			bitSet.set(i);
		nextV=bitSet.nextClearBit(nextV+1);
		if(nextV>limit) nextV=-1;
		return r;
	}
	@Override
	public PrimitiveIterator.OfInt iterator(){
		return this;
	}
}

Measured memory_bytes: 41852
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#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 INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
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);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll a,b;
int main(){
	scanf("%lld%lld",&a,&b);
    printf("%lld",a<b?0:10);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_N = 1e4 + 50, INF = 1e15, MOD = 1e9 + 7, max_Mod = 100;
string K;
ll N, D;
ll DP[max_N][max_Mod][2];

ll num_integers(ll pos, ll mod, bool tight)
{
    if (pos == N)
        return (mod == 0);
    ll &res = DP[pos][mod][tight];
    if (res != -1)
        return res;
    res = 0;
    ll curr_digit = K[pos] - '0';
    ll up_digit = 9;
    if (tight)
        up_digit = curr_digit;
    for (ll d = 0; d <= up_digit; ++d)
    {
        res += num_integers(pos + 1, (mod + d) % D, tight && (d == up_digit));
        res %= MOD;
    }
    return res;
}

int main()
{
    cin >> K >> D;
    N = K.length();
    memset(DP, -1, sizeof(DP));
    ll ans = num_integers(0, 0, 1);
    ans = (ans -1 + MOD) % MOD;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 20092
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int
		a, b,c,d;
	//string s="error";
	cin >> a; cin >> b; cin >> c; cin >> d;
	cout<<max(a*b,c*d)<<endl;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func dfs(s []string, cost [][]int, h, w, x, y int) {
	ways := [][]int{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}
	for _, way := range ways {
		nextX, nextY := x+way[0], y+way[1]
		if nextX < 0 || w <= nextX || nextY < 0 || h <= nextY {
			continue
		}
		if s[nextY][nextX] == '.' && cost[y][x]+1 < cost[nextY][nextX] {
			cost[nextY][nextX] = cost[y][x] + 1
			dfs(s, cost, h, w, nextX, nextY)
		}
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	h, w := nextInt(), nextInt()
	s := make([]string, h)
	for i := range s {
		s[i] = next()
	}

	cost := make([][]int, h)
	for i := range cost {
		cost[i] = make([]int, w)
		for j := range cost[i] {
			cost[i][j] = 2 * h * w
		}
	}
	cost[0][0] = 0
	dfs(s, cost, h, w, 0, 0)

	white := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if s[i][j] == '.' {
				white++
			}
		}
	}

	if cost[h-1][w-1] > h*w {
		puts(-1)
	} else {
		puts(white - 1 - cost[h-1][w-1])
	}
}


Measured memory_bytes: 2560
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

const Mod = 1000000007

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func main() {
	sc.Split(bufio.ScanWords)

	n := readInt()
	a := make([]uint64, n)

	for i := 0; i < n; i++ {
		a[i] = uint64(readInt64())
		if a[i] == 0 {
			fmt.Println("0")
			return
		}
	}

	var ans uint64 = 1
	for i := 0; i < n; i++ {
		ans *= a[i]
		if ans > 1e18 || ans < a[i] {
			fmt.Println("-1")
			return
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5840
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	string S, Y;
	cin >> S >> Y;
	for (int i = 0; i < N; i++) {
		cout << S.at(i) <<Y.at(i);
		
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
l=sorted(list(map(int,input().split())))
count=1
sum=n
now=l[0]
for i in range(1,n):
  if now*2<l[i]:
    sum-=count
    now=now+l[i]
    count=1
  else:
    count+=1
    now+=l[i]
print(sum)

Measured memory_bytes: 14320
#include <iostream>
#include <string>

using namespace std;

int main () {
	string s;
	cin >> s;
	if (s.size() == 2) {
		cout << s << endl;
	} else if (s.size() == 3) {
		cout << s[2] << s[1] << s[0] << endl;
	}
	return 0;
}



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

int main()
{
  int64_t n, t;
  cin >> n >> t;
  valarray<int64_t> a(n);
  for (auto&& e : a) cin >> e;
  a = a.cshift(1) - a;
  a[n - 1] = t;
  a[a > t] = t;
  cout << a.sum() << endl;
}


Measured memory_bytes: 3328
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();



int32_t main(){
	fast;

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

	int ans = 0;
	int n;
	cin >> n;
	vector<int>d(n);
	FOR(i,0,n-1)cin >> d[i];
	FOR(i,0,n-1) {
		FOR(j,i+1,n-1) {
			ans = ans + d[i] * d[j];
		}
	}
	cout << ans << "\n";

	time_p=clock()-time_p;
	cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 整数の入力


def main():
    n = int(input())
    h = list(map(int, input().split()))

    if n == 1:
        print(0)
        return

    result = []
    count = 0
    for i in range(n - 1):
        if h[i] < h[i + 1]:
            result.append(count)
            count = 0
            continue

        count += 1
        if i == n - 2:
            result.append(count)

    print(max(result))


if __name__ == "__main__":
    main()


Measured memory_bytes: 14252
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		int[] a, b;
		a = new int[4];
		b = new int[4];
		
		int hit, blow;
		
		while(scan.hasNextInt()){
			for(int i = 0; i < 4; i++){
				a[i] = scan.nextInt();
			}
			
			for(int i = 0; i < 4; i++){
				b[i] = scan.nextInt();
			}
			
			hit = 0;
			blow = 0;
			for(int i = 0; i < 4; i++){
				for(int j = 0; j < 4; j++){
					if(a[i] == b[j]){
						if(i == j)hit++;
						else blow++;
					}
				}
			}
			
			System.out.println(hit + " " + blow);
		}
	}
}

Measured memory_bytes: 26392
n = int(input())
a = [int(x) for x in input().split()]

def printlist(l):
    print(' '.join(map(str, l)))

def insertion_sort(a, n):
    for i in range(1, n):
        printlist(a)
        v = a[i]
        j = i-1
        while j >= 0 and a[j] > v:
            a[j+1] = a[j]
            j -= 1
        a[j+1] = v

insertion_sort(a,n)
printlist(a)


Measured memory_bytes: 5608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    bool flag=true;
    if(n%2!=0) cout<<"No";
    else{
        vector<char> a(n/2),b(n/2);
        rep(i,n/2) a[i]=s[i];
        rep(i,n/2) b[i]=s[n/2+i];
        rep(i,n/2){
            if(a[i]!=b[i]) flag=false;
        }
        if(flag) cout<<"Yes";
        else cout<<"No";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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

int B[50][3001];

int main(){

	int N,M,S;
	while(1){

		cin >> N >> M >> S;
		if(N==0 && M==0 && S==0) break;


    int mod=100000;

        B[0][0]=1;

		for(int k=1;k<=M;k++){
			for(int n=N*N;n>=1;n--){
				for(int s=S;s>=1;s--){

				if(s-k>=0 && n-1>=0)
					B[n][s]=B[n-1][s-k]%mod+B[n][s]%mod;
				else
					B[n][s]=B[n][s]%mod;

		    }
		  }
		}

		cout << B[N*N][S]%mod << endl;

		REP(n,0,N*N) REP(s,0,S) B[n][s]=0;

	}

	return 0;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[],int n,int g) {
    for (int i=g; i<n; i++) {
        int v=A[i];
        int j=i-g;
        while (j>=0 && A[j]>v) {
            A[j+g]=A[j];
            j-=g;
            cnt++;
        }
        A[j+g]=v;
    }
}
void shellSort(int A[],int n) {
    for (int h=1;  ; ) {
        if (h>n) {
            break;
        }
        G.push_back(h);
        h=3*h+1;
    }
    for (int i=G.size()-1; i>=0; i--) {
        insertionSort(A,n,G[i]);
    }
}
int main() {
    cin >> n;
    for (int i=0; i<n; i++) {
        scanf("%d",&A[i]);
    }
    cnt=0;
    shellSort(A,n);
    printf("%d\n",G.size());
    for (int i=G.size()-1; i>=0; i--) {
        printf("%d",G[i]);
        if (i) {
            printf(" ");
        }
    }
    printf("\n");
    printf("%d\n",cnt);
    for (int i=0; i<n; i++) {
        printf("%d\n",A[i]);
    }
    return 0;
}

Measured memory_bytes: 7100
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
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;
}
int main(){
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    rep(i,N) cin>>A[i];
    priority_queue<int> que;
    rep(i,N){
        que.push(A[i]);
    }
    rep(i,M){
        int b=que.top();
        b/=2;
        que.pop();
        que.push(b);
    }
    ll ans=0;
    rep(i,N){
        int b=que.top();
        ans+=b;
        que.pop();
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 1276
H,W,K = map(int,input().split())
S = [input() for i in range(H)]

ans = H+W
for b in range(1<<(H-1)):
    gs = [[0]]
    for k in range(H-1):
        if b&(1<<k):
            gs.append([k+1])
        else:
            gs[-1].append(k+1)
    tmp = bin(b).count('1')
    ws = [0] * len(gs)
    for x in range(W):
        for i,g in enumerate(gs):
            for h in g:
                if S[h][x] == '1':
                    ws[i] += 1
        if any(w>K for w in ws):
            tmp += 1
            ws = [0] * len(gs)
            for i,g in enumerate(gs):
                for h in g:
                    if S[h][x] == '1':
                        ws[i] += 1
            if any(w>K for w in ws):
                tmp = H+W
                break
    ans = min(ans,tmp)
print(ans)

Measured memory_bytes: 50572
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

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

	vector<long long> v(5);
	for (int i = 0; i < (int)v.size(); i++)
		cin >> v[i];

	sort(v.begin(), v.end());

	long long ans = (N + v[0] - 1) / v[0];
	ans += 4;

	cout << ans << endl;

	return 0;
}


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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

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

signed main(){

	int x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;

	return 0;
}



Measured memory_bytes: 3088
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

struct Graph
{
    int n;
    vector<vector<int>> g;
    
    Graph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to){
        g[from].push_back(to);
    }
};

struct Tree	//create tree(directed) from graph(undirected)
{
    int n;
    int root;
    vector<vector<int>> t;
    vector<int> par;
    vector<int> dpt;
    
    void init(Graph &g, int root_){
        n = g.n;
        root = root_;
        t.resize(n);
        par.resize(n);
        dpt.resize(n);
        fill(dpt.begin(), dpt.end(), -1);
        queue<int> que;
        par[root] = -1;
        dpt[root] = 0;
        que.push(root);
        while(que.size()){
            int pa = que.front();
            que.pop();
            for(int ch : g.g[pa]){
                if(dpt[ch] == -1){
                    t[pa].push_back(ch);
                    par[ch] = pa;
                    dpt[ch] = dpt[pa] + 1;
                    que.push(ch);
                }
            }
        }
    }

    Tree(){}
    
    Tree(Graph &g, int root_){
        init(g, root_);
    }
};

int main()
{
    int n;
    cin >> n;
    Graph g(n);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g.add_edge(a, b);
        g.add_edge(b, a);
    }
    ll a[100005];
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++){
        ll b;
        cin >> b;
        a[i] -= b;
    }
    Tree t(g, 0);
    P p[100005];
    for(int i = 0; i < n; i++){
        p[i] = P(t.dpt[i], i);
    }
    sort(p, p + n, greater<P>());
    ll ans[100005]{0};
    for(int i = 0; i < n; i++){
        int u = p[i].second;
        int v = t.par[u];
        if(v != -1){
            ans[u] = a[u];
            a[v] += a[u];
        }
    }
    sort(p, p + n);
    for(int i = 0; i < n; i++){
        int u = p[i].second;
        int v = t.par[u];
        if(v != -1){
            ans[u] += ans[v];
        }
    }
    ll l = 0;
    ll s = 0;
    for(int i = 0; i < n; i++){
        l = min(l, ans[i]);
        s += ans[i];
    }
    cout << s - n * l << endl;
}


Measured memory_bytes: 16880
#include <iostream>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	if((A+B)%2 == 1)
	{
		cout << "IMPOSSIBLE" << endl;
	}
	else
	{
		cout << (A+B)/2 << endl;
	}

	return 0;
}


Measured memory_bytes: 256