akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef pair<ll, int> pli;
#define mp make_pair

const int N = 100100;
int n;
ll a[N][2];
bool used[N];
ll W;
ll ans = 0;
map<ll, set<pli>> b1, b2;
map<ll, vector<ll>> c1, c2;

void dfs(int v)
{
	used[v] = 1;

	ll x = a[v][0];
	ll y = a[v][1];

	while(true)
	{
		auto it = b1[x - W].lower_bound(mp(y - W, -1));
		if (it == b1[x - W].end() || it->first > y + W) break;
		int u = it->second;
		b1[x - W].erase(it);
		if (!used[u]) dfs(u);
	}


	while(true)
	{
		auto it = b1[x + W].lower_bound(mp(y - W, -1));
		if (it == b1[x + W].end() || it->first > y + W) break;
		int u = it->second;
		b1[x + W].erase(it);
		if (!used[u]) dfs(u);
	}


	while(true)
	{
		auto it = b2[y - W].lower_bound(mp(x - W, -1));
		if (it == b2[y - W].end() || it->first > x + W) break;
		int u = it->second;
		b2[y - W].erase(it);
		if (!used[u]) dfs(u);
	}


	while(true)
	{
		auto it = b2[y + W].lower_bound(mp(x - W, -1));
		if (it == b2[y + W].end() || it->first > x + W) break;
		int u = it->second;
		b2[y + W].erase(it);
		if (!used[u]) dfs(u);
	}

	return;
}

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

	scanf("%d", &n);
	int V, U;
	scanf("%d%d", &V, &U);
	V--;U--;
	for (int i = 0; i < n; i++)
	{
		ll x, y;
		scanf("%lld%lld", &x, &y);
		a[i][0] = x + y;
		a[i][1] = x - y;
		x = a[i][0];
		y = a[i][1];
		b1[x].insert(mp(y, i));
		c1[x].push_back(y);
		b2[y].insert(mp(x, i));
		c2[y].push_back(x);
	}
	for (auto it : c1)
		sort(c1[it.first].begin(), c1[it.first].end());
	for (auto it : c2)
		sort(c2[it.first].begin(), c2[it.first].end());
	W = max(abs(a[V][0] - a[U][0]), abs(a[V][1] - a[U][1]));
	dfs(V);

	for (int v = 0; v < n; v++)
	{
		if (!used[v]) continue;
//		printf("%d ", v);
		ll x = a[v][0], y = a[v][1];
		ans += upper_bound(c1[x - W].begin(), c1[x - W].end(), y + W) - lower_bound(c1[x - W].begin(), c1[x - W].end(), y - W);
		ans += upper_bound(c1[x + W].begin(), c1[x + W].end(), y + W) - lower_bound(c1[x + W].begin(), c1[x + W].end(), y - W);
		ans += lower_bound(c2[y - W].begin(), c2[y - W].end(), x + W) - upper_bound(c2[y - W].begin(), c2[y - W].end(), x - W);
		ans += lower_bound(c2[y + W].begin(), c2[y + W].end(), x + W) - upper_bound(c2[y + W].begin(), c2[y + W].end(), x - W);
	}
	printf("%lld\n", ans / 2);

	return 0;
}

Measured memory_bytes: 89088
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	fmt.Println(sum(iSScan(n)) - n)
}


Measured memory_bytes: 1812
def selectionSort(A, N):
    count = 0
    for i in range(N - 1):
        minValue = 100
        minIndex = 0
        for j in range(i, N):
            if A[j] < minValue:
                minValue = A[j]
                minIndex = j
        if minIndex != i:
            temp = A[i]
            A[i] = minValue
            A[minIndex] = temp
            count = count + 1

    for i in range(N):
        print A[i],
    print
    print count

N = input()
A = map(int, raw_input().split())

selectionSort(A, N)

Measured memory_bytes: 6336
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m

////////////////////////////////////////////////////////////

int main(){
	long x;
	cin >> x;
	long p = 0 , i = 0;
	while( p < x ){
		p += ++i;
	}
	P(i);
	ret 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
MOD = 10**9+7

if S[0]=="W" or S[-1]=="W":
    print(0)
else:
    l = [0]*(2*N)
    for i in range(1, 2*N):
        if S[i]==S[i-1]:
            l[i] = 0 if l[i-1] else 1
        else:
            l[i] = 1 if l[i-1] else 0
    pair = sum(l)

    facN = 1
    for i in range(2, N+1):
        facN *= i
        facN %= MOD

    ans = 0
    if pair==N:
        buf = 0
        ans = facN
        for i in l[::-1]:
            if i:
                buf += 1
            else:
                ans *= buf
                ans %= MOD
                buf -= 1
    print(ans)


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

int main(void)
{
	long long int a[100000][2], push_all = 0;
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld %lld", &a[i][0], &a[i][1]);
	}
	for (int i = n - 1;0 <= i; i--) {
		a[i][0] += push_all;
		if (a[i][0] % a[i][1] != 0) {
			push_all += a[i][1] - (a[i][0] % a[i][1]);
		}
	}
	printf("%lld\n", push_all);

	return 0;
}


Measured memory_bytes: 1664
notify = int(input())
b1 = list()
b2 = list()
b3 = list()
b4 = list()

for f in range(30):
    b1.append(0)
    b2.append(0)
    b3.append(0)
    b4.append(0)
    
whole = list()
whole.append(b1)
whole.append(b2)
whole.append(b3)
whole.append(b4)

for n in range(notify):
    b, f, r, v = input().split()
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    place = (f-1)*10 + r - 1
    whole[b-1][place] = int(whole[b-1][place]) + v

sh = ''
times = 0
for m in range(20):
    sh += '#'
    
for s in whole:
    ccc = ''
    for p in range(len(s)):
        if p == 10 or p == 20:
            ccc += '\n'
        ccc += ' ' + str(s[p])
    print(ccc)
    if times < 3:
        print(sh)
    times += 1


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, H;
  cin >> N >> H;
  vector<int> a(N), b(N);
  for (int i = 0; i < N; i++){
    cin >> a[i] >> b[i];
  }
  vector<pair<int, int>> d;
  for (int i = 0; i < N; i++){
    d.push_back(make_pair(a[i], 0));
    d.push_back(make_pair(b[i], 1));
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  int ans = 0;
  for (int i = 0; i <= N * 2; i++){
    if (d[i].second == 1){
      H -= d[i].first;
      ans++;
      if (H <= 0){
        break;
      }
    } else {
      ans += (H + d[i].first - 1) / d[i].first;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll w, a, b;
	cin >> w >> a >> b;
	if (a < b) {
		if (b - (a + w) <= 0) cout << "0\n";
		else cout << b - (a + w) << endl;
	}
	else {
		swap(a, b);
		if (b - (a + w) <= 0) cout << "0\n";
		else cout << b - (a + w) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

int max_calc(std::vector<int> v, std::vector<int> c){
  int output = 0;
  int N = v.size();
  for(int i = 0; i < N; i++){
    if(v[i] > c[i]){
      output += (v[i] - c[i]);
    }
  }
  return output;
}

int main(){
  int n, input;
  std::cin >> n;
  std::vector<int> v(n, 0), c(n, 0);
  for(int i = 0; i < n; i++){
    std::cin >> input;
    v[i] = input;
  }
  for(int i = 0; i < n; i++){
    std::cin >> input;
    c[i] = input;
  }

  std::cout << max_calc(v, c) << std::endl;
  return 0;
}


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

#define NIL -2
#define INF 1000000001

using namespace std;

void prim(const vector<vector<int> > &link_weight,vector<int> &color, vector<int> &mincost_array,vector<int> &parents){
    int n = mincost_array.size();
    int mincost;
    int u;
    while(true){
        mincost = INF;
        for(int i = 0;i < n;i++){
            if(color[i] != 1 && mincost_array[i] < mincost){
                mincost = mincost_array[i];
                u = i;      
            }
        }
        if(mincost == INF) break;
        color[u] = 1;

        for(int v = 0;v < n;v++){
            if(color[v] != 1 && link_weight[u][v] < INF){
                if(link_weight[u][v] < mincost_array[v]){
                    mincost_array[v] = link_weight[u][v];
                    parents[v] = u;
                    color[v] = 0;
                }
            }
        }
    }
}

int main(){
    int mat_size;
    int temp;
    int cost = 0;

    scanf("%d",&mat_size);
    vector<vector<int> > link_weight(mat_size,vector<int>(mat_size,INF));
    vector<int> color(mat_size,-1);
    vector<int> mincost_array(mat_size,INF);
    vector<int> parents(mat_size,-1);

    for(int i = 0;i < mat_size;i++){
        for(int j = 0;j < mat_size;j++){
            scanf("%d",&temp);
            if(temp != -1) link_weight[i][j] = temp;
        }
    }
    mincost_array[0] = 0;
    prim(link_weight,color,mincost_array,parents);
    for(int i = 0;i < mat_size;i++) cost += mincost_array[i];
    printf("%d\n",cost);

    return 0;   
}



Measured memory_bytes: 3272
#include<iostream>
using namespace std;
 
int main(){
	string a;
 
  	cin >> a;
  	
  	for(int i = 0;i <= ((a.length() - 1) / 2) -1; i++){
      	if(a[i] != a[a.length() - 1 - i]){
          cout << "No";
          return 0;
        }
    }
  	
  	if(a.length() == 3) {
      cout << "Yes";
      return 0;
    }
  
  	for(int i = 0;i <= ((((a.length() - 1) / 2) -1) -1 ) /2; i++){
      	if(a[i] != a[((a.length() - 1) / 2) - 1 - i]){
          cout << "No";
          return 0;
        }
    }
  	
  
  	cout << "Yes";

	return 0;		 
}

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

long long solve() {
    int n; cin >> n;
    int max_val{0}, val;
    long long res;
    for (int i = 0; i <n; ++i) {
        cin >> val;
        if (i == 0) {
            max_val = val;
            continue;
        }
        if (val < max_val) {
            res += max_val - val;
        }
        max_val = max(max_val, val);
    }
    
    return res;
}

int main() {
	cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 3188
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
P = set(map(int, input().split()))
t = float("inf")
for i in range(-200, 201):
    if i not in P and abs(i-x) < t:
        t = abs(i-x)
        ans = i
print(ans)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    int a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    int a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 1000005;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    int N, X, T;
    cin >> N >> X >> T;
    int ans = ((N + X-1)/X)*T;
    cout << ans << "\n";
}


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

#define MAX 100002

int n;

vector<int> v[MAX];

set<int> dp[MAX];
int over[MAX];


inline void dfs(int b,int pr=-1){
	over[b] = -1;
	dp[b].clear();
	for (int i = 0; i < v[b].size(); i++){
		if (v[b][i] == pr)continue;
		dfs(v[b][i],b);
		if (dp[b].size() < dp[v[b][i]].size()){
			swap(dp[b], dp[v[b][i]]);
		}
		for (int i2 : dp[v[b][i]]){
			if (dp[b].count(i2)){
				over[b] = max(over[b], i2);
			}
			dp[b].insert(i2);
		}
		dp[v[b][i]].clear();
	}
	auto it = dp[b].begin();
	int ex = 0;
	while (it != dp[b].end()){
		if (ex == (*it)){
			it = dp[b].erase(it);
			ex++;
			continue;
		}
		else{
			if ((*it) <= over[b]){
				it = dp[b].erase(it);
				ex = over[b]+1;
				continue;
			}
			else{
				dp[b].insert(ex);
				return;
			}
		}
	}
	dp[b].insert(ex);
}

int main(){
	cin >> n;
	for (int i = 1; i < n; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(0);
	auto r = (*dp[0].rbegin());
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 18816
#include <stdio.h>
#define N 10000

struct Node{
  int parent;
  int left;
  int right;
};

struct Node node[N];
int n,D[N],H[N];

void setDepth(int u,int d){
  if(u==-1)return;
  D[u] = d;
  setDepth(node[u].left,d+1);
  setDepth(node[u].right,d+1);
}

int setHeight(int u){
  int h1 = 0;
  int h2 = 0;
  if(node[u].left != -1){
    h1 = setHeight(node[u].left) + 1;
  }
  if(node[u].right != -1){
    h2 = setHeight(node[u].right) + 1;
  }
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u){
  if(node[u].parent == -1) return -1;
  if(node[node[u].parent].left != u && node[node[u].parent].left != -1){
    return node[node[u].parent].left;
  }
  if(node[node[u].parent].right != u && node[node[u].parent].right != -1){
    return node[node[u].parent].right;
  }
  return -1;
}

void print(int u){
  int degree = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",node[u].parent);
  printf("sibling = %d, ",getSibling(u));

  if(node[u].left != -1) degree++;
  if(node[u].right != -1) degree++;

  printf("degree = %d, ",degree);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(node[u].parent == -1){
    printf("root\n");
  }
  else if(node[u].left == -1 && node[u].right == -1){
    printf("leaf\n");
  }
  else {
    printf("internal node\n");
  }
}

int main(){
  int i,v,l,r;
  int root=0;
  scanf("%d",&n);

  for(i=0; i<n; i++) node[i].parent = -1;

  for(i=0; i<n; i++){
    scanf("%d%d%d",&v,&l,&r);
    node[v].left = l;
    node[v].right = r;
    if(l != -1) node[l].parent = v;
    if(r != -1) node[r].parent = v;
  }

  for(i=0; i<n; i++){
    if(node[i].parent == -1) root = i;
  }
  setDepth(root,0);
  setHeight(root);

  for(i=0; i<n; i++) print(i);

  return 0;
}



Measured memory_bytes: 2104
x, y = map(int, input().split())
if x == 2 or y == 2:
  print('No')
elif (x in [4, 6, 9, 11] and y in [4, 6, 9, 11]) or (x not in [4, 6, 9, 11] and y not in [4, 6, 9, 11]):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  deque<char> d;
  string s;
  cin>>s;
  int p=s.size();
  rep(i,p) d.pb(s[i]);
  int q,count=0;
  cin>>q;
  rep(i,q){
    int t;
    cin>>t;
    if(t==1) count++;
    else{
      int f;
      char c;
      cin>>f>>c;
      if((f+count)%2==1) d.push_front(c);
      else d.pb(c);
    }
  }
  int a=d.size();
  if(count%2==0){
    rep(i,a) cout<<d[i];
  }
  else{
    for(int i=a-1;i>=0;i--) cout<<d[i];
  }
  cout<<endl;
}

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


Measured memory_bytes: 976
#include<iostream>
#include<cstdio>
#include<cstdlib> 
#include<cstring>
using namespace std;
int read()
{
	int x=0,f=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int main()
{
	int n,m;
	n=read(); m=read();
	cout<<n*n-m;
	return 0;
}

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

int main(){
    int x;
    cin >> x;
    int ans = 0;
    int a,b;
    int l = sqrt(x);
    for(int i = 1;i <= l;i++){
        for(int j = 1;j <= x;j++){
            ll y = pow(i,j);
            if(y<=x){
                if(ans<y)ans = y;
                a = i;b = j;
            }
        }
    }
    cout << ans << endl;
    //cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
import heapq
import math

n, m = map(int, input().split())
A = list(map(lambda x: -x, map(int, input().split())))
heapq.heapify(A)
for _ in range(m):
    tmp = heapq.heappop(A)
    tmp = math.ceil(tmp / 2)
    heapq.heappush(A, tmp)
print(-sum(A))

Measured memory_bytes: 14536
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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 main() {
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	vector<int> acc(n);
	acc[0] = 0;
	rep(i,n) {
		if(i==0) continue;
		else if(h[i-1] >= h[i]) acc[i] = acc[i-1]+1;
		else acc[i] = 0;
	}
	int maxi = -1;
	rep(i,n) chmax(maxi, acc[i]);
	cout << maxi << endl;


  return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char S[200002];
char T[100002];
int Slen;
int Tlen;
int nx[26][200002];
int main(){
  int c, i, j, k;
  long long res;
  Slen = rd(S);
  Tlen = rd(T);
  for(i=0;i<(Slen);i++){
    S[i] -= 'a';
  }
  for(i=0;i<(Tlen);i++){
    T[i] -= 'a';
  }
  for(i=0;i<(Slen);i++){
    S[i+Slen] = S[i];
  }
  for(k=0;k<(26);k++){
    nx[k][2*Slen-1] = 1073709056;
    for(i=2*Slen-2;i>=0;i--){
      nx[k][i] = nx[k][i+1];
      if(S[i+1]==k){
        nx[k][i] = i+1;
      }
    }
  }
  k = Slen-1;
  res = -1;
  for(i=0;i<(Tlen);i++){
    c = T[i];
    if(nx[c][k]==1073709056){
      wt_L(-1);
      wt_L('\n');
      return 0;
    }
    k = nx[c][k];
    if(k >= Slen){
      k -= Slen;
      res++;
    }
  }
  res = res * Slen + k + 1;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190818-1

// --- original code ---
// char S[200002], T[100002];
// int Slen, Tlen;
// 
// int nx[26][200002];
// 
// {
//   int i, j, k, c;
//   ll res;
// 
//   rd(S@Slen, T@Tlen);
// 
//   rep(i,Slen) S[i] -= 'a';
//   rep(i,Tlen) T[i] -= 'a';
//   rep(i,Slen) S[i+Slen] = S[i];
// 
//   rep(k,26){
//     nx[k][2Slen-1] = int_inf;
//     for(i=2Slen-2;i>=0;i--){
//       nx[k][i] = nx[k][i+1];
//       if(S[i+1]==k) nx[k][i] = i+1;
//     }
//   }
// 
//   k = Slen-1;
//   res = -1;
//   rep(i,Tlen){
//     c = T[i];
//     if(nx[c][k]==int_inf){ wt(-1); return 0; }
//     k = nx[c][k];
//     if(k >= Slen) k -= Slen, res++;
//   }
//   res = res * Slen + k + 1;
//   wt(res);
// }


Measured memory_bytes: 20992
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
int n,m,cnt,t1,t2,vis[N][N];
struct data{int x,y;}A[N*N],B[N*N];
char s[N];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int main(){
//	freopen("A.in","r",stdin);
//	freopen("A.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%s",s+1);
		for(int j=1;j<=m;++j){
			vis[i][j]=s[j]=='#';
			if(!vis[i][j])continue;
			A[++t1]=(data){i,j};
		}
	}
	int idx=0;
	while(1){
		for(int i=1;i<=t1;++i){
			cnt++;
			int x=A[i].x,y=A[i].y;
			for(int j=0;j<4;++j){
				int nx=x+dx[j],ny=y+dy[j];
				if(nx<1||ny<1||nx>n||ny>m||vis[nx][ny])continue;
				vis[nx][ny]=1;
				B[++t2]=(data){nx,ny};
			}
		}
		++idx;if(cnt==n*m)break;
		for(int j=1;j<=t2;++j)A[j]=B[j];t1=t2;t2=0;
	}
	cout << idx - 1 << endl; 
	return 0;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
int time_sum[100][100],
    is_ac[100][100];
signed main() {
  int N, T, P, R;
  while (cin>>N>>T>>P>>R, N+T+P+R) {
    for (int i = 0; i < 100; i++) {
      for (int j = 0; j < 100; j++) {
        time_sum[i][j] = 0;
        is_ac[i][j] = 0;
      }
    }

    for (int i = 0; i < R; i++) {
      int m, t, p, j;
      cin >> m >> t >> p >> j;
      t--;p--;
      if (j != 0) {
        time_sum[t][p] += 20; 
      } else {
        time_sum[t][p] += m;
        is_ac[t][p] = 1;
      }
    }
    
    vector<pair<int,int>> ans(T);
    for (int i = 0; i < T; i++) {
      int time = 0;
      for (int j = 0; j < P; j++) {
        time += is_ac[i][j]*time_sum[i][j];
        time -= is_ac[i][j]*R*100;
      }
      ans[i] = make_pair(time, -(i+1));
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < T-1; i++) {
      cout << -ans[i].second;
      if (ans[i+1].first == ans[i].first) {
        cout << "=";
      } else {
        cout << ",";
      }
    }
    cout << -ans[T-1].second << endl;
     
  }
}



Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 924844033LL;
const int MAXN = 5000;

int dp[4010][2010][2] = {};

int mod_pow(int x, int n) {
    int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

int fact[MAXN], inv[MAXN];

void init_fact() {
    fact[0] = 1;
    for(int i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(int i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

int comb(int n, int r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

signed main(){

    init_fact();
    
    //長さ q のパスが r 本あるはず
    // k := 1 直前に辺をとった
    int n, k; cin >> n >> k;

    vector<int> pathsize(k * 2, 0);
    for(int j = 0; j < k*2; j++){
        for(int i = j; i < n; i += k*2) {
            if (i - k >= 0) pathsize[j]++;
            if (i + k < n) pathsize[j]++;
        }
    }

    for(int i = 0; i < pathsize.size(); i++){
        if(pathsize[i] == 0) pathsize.erase(pathsize.begin() + i--);
    }

    dp[0][0][0] = 1;
    int kireme = pathsize[0];
    int kireme_ind = 0;
    for(int i = 0; i <= n*2; ++i){
        for(int j = 0; j <= min(n, i); j++){
            dp[i + 1][j][0] += dp[i][j][0];
            dp[i + 1][j][0] %= MOD;
            dp[i + 1][j + 1][1] += dp[i][j][0];
            dp[i + 1][j + 1][1] %= MOD;
            dp[i + 1][j][0] += dp[i][j][1];
            dp[i + 1][j][0] %= MOD;
            if(i == kireme){
                dp[i+1][j+1][1] += dp[i][j][1];
                dp[i + 1][j + 1][1] % MOD;
            }
        }

        if(i == kireme){
            kireme_ind++;
            if(kireme_ind == (int)pathsize.size()) break;
            kireme += pathsize[kireme_ind];
        }
    }



    int ans = 0;
    for(int x = 0; x <= n; x++){

        //M := サイズ x のマッチングのサイズ

        int M = (dp[kireme][x][0] + dp[kireme][x][1]) % MOD;
        if(x % 2 == 0) ans = ans + (M * fact[n - x]) % MOD + MOD;
        else           ans = ans - (M * fact[n - x]) % MOD + MOD;
        ans %= MOD;
    }

    cout << ans % MOD << endl;

    return 0;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

  vector<int> r;
  vector<int> g;
  vector<int> b;
  rep(i, n) {
    if (s[i] == 'R') {
      r.push_back(i);
    } else if (s[i] == 'G') {
      g.push_back(i);
    } else {
      b.push_back(i);
    }
  }

  ll res = r.size() * g.size() * b.size();
  // j-i == k-j の場合を引く
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int k = j + (j - i);
      if (k >= n) {
        continue;
      }
      if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) {
        res--;
      }
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3640
import sys
import heapq
import copy


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


N = int(input())
A = list(map(int, sys.stdin.readline().split()))

sum_h1 = [0] * (N+1)
sum_h2 = [0] * (N+1)

'''
N=2
0 1 2 3 4 5 6
3 1 4 1 5 9
'''

h1 = A[0:N]
h2 = A[N*2:N*3]

heapq.heapify(h1)
heapq._heapify_max(h2)

#print("h1", h1)
#print("h2", h2)
sum_h1[0] = sum(h1)
sum_h2[N] = sum(h2)

for k in range(N):
    #print("A[N+k]", A[N+k])
    #print("k+1", k+1)

    sum_h1[k+1] = sum_h1[k]
    sum_h1[k+1] += A[N+k]
    a = heapq.heappushpop(h1, A[N+k])
    sum_h1[k+1] -= a

    #sum_h1[k+1] = sum(h1)

    #print("A[2*N-k-1]", A[2*N-k-1])
    #print("N-k-1", N-k-1)

    sum_h2[N-k-1] = sum_h2[N-k]
    sum_h2[N-k-1] += A[2*N-k-1]
    _heappush_max(h2, A[2*N-k-1])
    sum_h2[N-k-1] -= _heappop_max(h2)

    #sum_h2[N-k-1] = sum(h2)


mx = None

#print("sum_h1", sum_h1)
#print("sum_h2", sum_h2)

for i in range(N+1):
    a = sum_h1[i] - sum_h2[i]

    if(mx == None or a > mx):
        mx = a

print(mx)

'''
for i in range(N+1):
    h1 = A[0:N+i]
    h2 = A[N+i:N*3]

    heapq.heapify(h1)
    heapq._heapify_max(h2)

    for k in range(N):
        if i <= k:
            _heappop_max(h2)
        else:
            heapq.heappop(h1)

    s = sum(h1) - sum(h2)

    if (mx == None or s > mx):
        mx = s
'''


Measured memory_bytes: 39236
#include<iostream>
#include<queue>
#include<utility>

using namespace std;

queue<pair<int,int> > Q;
pair<int,int> P;
int sum=0;
int W,H;
int ai,aj;
char x[25][25];
int y[25][25];
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

bool valid(int a,int b){
    if(0<=a && a<H && 0<=b && b<W && x[a][b]=='.'){
        return 1;
    }
    else{
        return 0;
    }
}

int solve( ){
    sum++;y[ai][aj]=1;
    while(!Q.empty()){
        pair<int,int> P2=Q.front();
        Q.pop();
        for(int i=0;i<4;i++){
            if(valid(P2.first+dx[i],P2.second+dy[i])==1&&y[P2.first+dx[i]][P2.second+dy[i]]==0){
                sum++;
                y[P2.first+dx[i]][P2.second+dy[i]]=1;
                P=make_pair(P2.first+dx[i],P2.second+dy[i]);
                Q.push(P);
            }
        }
    }
    return sum;
}
void inits(){
    sum=0;
    for(int i=0;i<25;i++ ){
        for(int j=0;j<25;j++){
            x[i][j]=0;
            y[i][j]=0;
        }
    }
}

int main(){
    while(cin>>W>>H&&W!=0){
        inits();
        for(int i=0;i<H;i++)
            for(int j=0;j<W;j++){
                cin>>x[i][j];
                if(x[i][j]=='@'){
                    ai=i;aj=j;
                }
            }
        P=make_pair(ai,aj);
        Q.push(P);
        cout<<solve()<<endl;
    }
    return 0;
}



Measured memory_bytes: 3128
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        int t = n;
        int s = 0;
        while ( t ) {
            s += (t%10);
            t /= 10;
        }
        if ( n % s ) echo "No" fin;
        else echo "Yes" fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

int main()
{
    string w, t;
    int count=0;
    cin >> w;

    while(1)
    {
        cin >> t;
        if(t == "END_OF_TEXT") break;
        if(w.size() != t.size()) continue;
        for(int i=0; i<t.size(); i++)
        {
            if('A' <= t[i] && t[i] <= 'Z') t[i] += 'a'-'A';
        }
        if(w == t) count++;
    }
    
    cout << count << endl;
    return 0;
}



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

using namespace std;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int H, W; cin >> H >> W;
  string grid[H];
  for(int i = 0; i<H; ++i) {
    cin >> grid[i];
  }

  vector<vector<int> > dist(H, vector<int>(W, INT_MAX));

  /*
  queue<pair<int, int> > q;
  dist[0][0] = grid[0][0] == '#' ? 1 : 0;
  q.push(make_pair(0, 0));

  while(!q.empty()) {
    pair<int, int> cell = q.front(); q.pop();

    if(cell.first >= H || cell.second >= W) continue;

    int d = dist[cell.first][cell.second];
    if(cell.first != H-1) {
      int add = (grid[cell.first][cell.second] == '.' && grid[cell.first+1][cell.second] == '#') ? 1 : 0;
      if(dist[cell.first+1][cell.second] > d+add) {
        dist[cell.first+1][cell.second] = d+add;
        q.push(make_pair(cell.first+1, cell.second));
      }
    }
    if(cell.second != W-1) {
      int add = grid[cell.first][cell.second+1] == '#' ? 1 : 0;
      if(dist[cell.first][cell.second+1] > d+add) {
        dist[cell.first][cell.second+1] = d+add;
        q.push(make_pair(cell.first, cell.second+1));
      }
    }
  }*/

  priority_queue<pair<pair<int, int>, int> > q;
  q.push(make_pair(make_pair(0, 0), grid[0][0] == '#' ? -1 : 0));

  while(!q.empty()) {
    pair<int, int> cell = q.top().first;
    int d = -1*q.top().second;
    q.pop();

    if(cell.first >= H || cell.second >= W) continue;
    if(dist[cell.first][cell.second] <= d) continue;
    dist[cell.first][cell.second] = d;
    if(cell.first != H-1) {
      int add = (grid[cell.first][cell.second] == '.' && grid[cell.first+1][cell.second] == '#') ? 1 : 0;
      q.push(make_pair(make_pair(cell.first+1, cell.second), -1*(d+add)));
    }
    if(cell.second != W-1) {
      int add = (grid[cell.first][cell.second] == '.' && grid[cell.first][cell.second+1] == '#') ? 1 : 0;
      q.push(make_pair(make_pair(cell.first, cell.second+1), -1*(d+add)));
    }
  }

  cout << dist[H-1][W-1] << endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> vec(N);
    rep(i, N) cin >> vec[i];

    int ans;
    int tmp = 1000000000;
    rep2(P, 1, 101){
        int B = 0;
        rep(i, N){
            B += (vec[i] - P) * (vec[i] - P);
        }
        B = min(tmp, B);
        tmp = B;
        ans = B;
    }

    cout << ans << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 256
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort()
    f = list(map(int, input().rstrip('\n').split()))
    f.sort(reverse=True)
    cor_v = 10 ** 20
    inc_v = -1
    while cor_v - inc_v > 1:
        bin_v = (cor_v + inc_v) // 2
        cost = 0
        #条件を満たすcostを全検索
        for i in range(n):
            t = a[i] * f[i]
            if t > bin_v:
                cost += (t - bin_v + f[i] - 1) // f[i]
        #costが制約を満たすか
        if cost <= k:
            cor_v = bin_v
        else:
            inc_v = bin_v
    print(cor_v)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 126448
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
int main(){
    int n; cin >> n;
    vector<P> d(n);
    rep(i,n){
        int a,b; cin >> a >> b;
        d[i].fi=a+b;
        d[i].se=max(0,a-b);
    }
    sort(d.begin(),d.end());
    int ans=0;
    int s=-1;
    rep(i,n){
        P p=d[i];
        if(s<=p.se){
            ans++;
            s=p.fi;
            //cout << s << endl;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N){
        cin >> a[i];
    }
    ll sum = 0;
    rep(i,N){
        sum = sum ^ a[i];
    }
    vector<ll> v;
    rep(i,N){
        v.push_back(sum ^ a[i]);
    }
    PR(v,N);
}


Measured memory_bytes: 7908
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


int main(){
  string s;
  cin >> s;
  ll q;
  cin >> q;
  string s1,s2;
  bool oppo = false;
  rep(i,q){
    int a;
    cin >> a;
    if(a == 1){
      if(oppo) oppo = false;
      else oppo = true;
    }
    else{
      int b;
      cin >> b;
      char f;
      cin >> f;
      if(oppo){
        if(b == 1){
          s2.push_back(f);
        }
        else{
          s1 = f + s1;
        }
      }
      else{
        if(b == 1){
          s1 = f + s1;
        }
        else{
          s2.push_back(f);
        }
      }
    }
  }
  if(oppo){
    reverse(s.begin(),s.end());
    reverse(s1.begin(),s1.end());
    reverse(s2.begin(),s2.end());
    cout << s2 << s << s1 << endl;
  }
  else{
    cout << s1 << s << s2 << endl;
  }
}


Measured memory_bytes: 1104
# include <iostream>
# include <cmath>
# include <vector>
# include <algorithm>
# include <string>
# include <set>
# include <map>
# include <bitset>
# include <queue>

# define FILE
using namespace std;

int main()
{
    # ifdef FILEs
        freopen( "input.txt", "r", stdin );
        freopen( "output.txt", "w", stdout );
    # endif // FILE
    ios_base::sync_with_stdio( false );

    int n, b[111] = {};
    cin >> n;

    for( int i = 1; i < n; i ++ )
        cin >> b[i];

    int a[111] = {}, sm = 0;
    a[n] = b[n-1];
    a[1] = b[1];
    for( int i = n-1; i >= 2; i -- ){
        a[i] = min( b[i], b[i-1] );
    }
    for( int i = 1; i <=n ;i ++ ) sm += a[i];
    cout << sm;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

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

using namespace std;

int main(){
	for(char s[80001];scanf("%s",s);){
		int len=strlen(s);
		if(len==1 && s[0]=='0')	break;

		int ans=0;
		static int cnt[80000][11];
		rep(i,len)rep(j,11)	cnt[i][j]=0;
		rep(i,len){
			int jj=s[i]-'0'; if(i%2) jj=(-jj+11)%11;
			if(jj!=0)	cnt[i][jj]++;
			if(i>0)rep(j,11){
				cnt[i][(j+jj)%11]+=cnt[i-1][j];
			}
			ans+=cnt[i][0];
		}

		printf("%d\n",ans);
	}

	return 0;
}

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

using namespace std;

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

  // ここにプログラムを追記
  for(int i; i < N ; i++){
    char A;
    cin >> A;
    if(A == 'Y'){
      cout << "Four" << endl;
      break;
    }
    if(i == N-1){
      cout << "Three" << endl;
    }
  }
}


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

using namespace std;

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

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()

int main(){
    int A[3][3];
    rep(i,3){
        rep(j,3){
            cin>>A[i][j];
        }
    }
    int N;
    cin>>N;
    vector<int> B(N);
    rep(i,N)cin>>B[i];
    bool ss[3][3]={false};
    for(auto x:B){
        rep(i,3){
            rep(j,3){
                if(A[i][j]==x)ss[i][j]=true;
            }
        }
    }

    if((ss[0][0]&&ss[1][1]&&ss[2][2])||(ss[2][0]&&ss[1][1]&&ss[0][2])){
        cout<<"Yes"<<endl;
        return 0;
    }
    rep(i,3){
        bool c=true;
        rep(j,3){
            if(!ss[i][j])c=false;
        }
        if(c){
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    rep(i,3){
        rep(j,3){
        bool c=true;
        rep(j,3){
            if(!ss[j][i])c=false;
        }
        if(c){
            cout<<"Yes"<<endl;
            return 0;
        } 
        }
    }

    cout<<"No"<<endl;

    return 0;
}

//a=97,z=122
/*
  0 1 2
0  
1
2



*/

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	int N, a;
	cin >> N;
	ll ans = 0;
	REP(i, N) {
		cin >> a;
		while (a % 2 == 0) {
			ans++;
			a /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int x, y;
  ci(x, y);
  ve<int> A = {0,2,0,1,0,1,0,0,1,0,1,0};
  if(A.at(x - 1) == A.at(y - 1)){
    co("Yes");
  }
  else{
    co("No");
  }
}

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

int main(){
    int h, a;
    cin >> h >> a;
    int sum = 0;
    for (int i=0; i<a; i++){
        int temp;
        cin >> temp;
        sum += temp;
    }
    if (sum >= h){
        cout <<  "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    // cout << (( h%a == 0) ? (h/a):((h/a) + 1 ) )<< endl;
}

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

int main(){
    long long int a,b;
    cin>>a>>b;
    for(long long int i=b-a+1;i<b+a-1;i++){
        cout<<i<<" "<<flush;
    }
    cout<<b+a-1<<endl;
   return 0;
}

Measured memory_bytes: 256
# まじでわからんので解説読んだ
N = int(input())
xyh = []
for i in range(N):
    xyh.append(list(map(int, input().split())))
max_xyh = max(xyh, key=lambda x: x[2])  # hが一番大きいxyhの組み合わせを抽出
for Cx in range(101):
    for Cy in range(101):
        h = abs(max_xyh[0] - Cx) + abs(max_xyh[1] - Cy) + max_xyh[2]
        frag = True
        for ex_xyh in xyh:
            if max([h - abs(ex_xyh[0] - Cx) - abs(ex_xyh[1] - Cy), 0]) == ex_xyh[2]:
                continue
            else:
                frag = False
                break
        if frag:
            print(Cx, Cy, h)
            break


Measured memory_bytes: 3064