akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
 
int n,m,u,k,i,j,g[100][100];
 
int main(){
 
  for(i = 0;i < 100;i++)
    {
      for(j = 0; j < 100;j++){
	g[i][j]=0;
      }
    }
 
  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d%d",&m,&u);
    for(j = 0;j < u;j++){
      scanf("%d",&k);
      g[m-1][k-1]=1;
    }
  }

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      printf("%d",g[i][j]);
      if(j != n - 1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(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 FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

LL sum(LL n){ return n * (1 + n) / 2; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL X;
	cin >> X;

	int l = 0, r = 1e9, m;
	while(l + 1 < r){
		m = (l + r) / 2;
//		cout << m << " " << sum(m) << endl;
		if(sum(m) < X){
			l = m;
		}
		else{
			r = m;
		}
	};

	m = (l + r) / 2;
	if(sum(m) < X) m++;
	cout << m << endl;



	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<array>
int main()
{
	while (true)
	{
		int num, sum;
		std::cin >> num >> sum;
		if (num == 0 && sum == 0)
		{
			break;
		}
		std::array<int, 9>nums{ 0,0,0,0,0,0,0,0,0 };
		auto calc_sum = [&nums]()
		{
			int s = 0;
			for (auto i : nums)
			{
				s += i;
			}
			return s;
		};
		int cnt = 0;
		for (int i = 0; i <= 10 - num; i++)
		{
			nums[0] = i;
			if (num == 1)
			{
				if (calc_sum() == sum)
				{
					cnt++;
				}
				continue;
			}
			for (int j = i + 1; j <= 11 - num; j++)
			{
				nums[1] = j;
				if (num == 2)
				{
					if (calc_sum() == sum)
					{
						cnt++;
					}
					continue;
				}
				for (int k = j + 1; k <= 12 - num; k++)
				{
					nums[2] = k;
					if (num == 3)
					{
						if (calc_sum() == sum)
						{
							cnt++;
						}
						continue;
					}
					for (int l = k + 1; l <= 13 - num; l++)
					{
						nums[3] = l;
						if (num == 4)
						{
							if (calc_sum() == sum)
							{
								cnt++;
							}
							continue;
						}
						for (int m = l + 1; m <= 14 - num; m++)
						{
							nums[4] = m;
							if (num == 5)
							{
								if (calc_sum() == sum)
								{
									cnt++;
								}
								continue;
							}
							for (int n = m + 1; n <= 15 - num; n++)
							{
								nums[5] = n;
								if (num == 6)
								{
									if (calc_sum() == sum)
									{
										cnt++;
									}
									continue;
								}
								for (int o = n + 1; o <= 16 - num; o++)
								{
									nums[6] = o;
									if (num == 7)
									{
										if (calc_sum() == sum)
										{
											cnt++;
										}
										continue;
									}
									for (int p = o + 1; p <= 17 - num; p++)
									{
										nums[7] = p;
										if (num == 8)
										{
											if (calc_sum() == sum)
											{
												cnt++;
											}
											continue;
										}
										for (int q = p + 1; q <= 18 - num; q++)
										{
											nums[8] = q;
											if (calc_sum() == sum)
											{
												cnt++;
											}
											continue;
										}
									}
								}
							}
						}
					}
				}
			}
		}
		std::cout << cnt << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <cstring>
#define STA 1000000
using namespace std;

bool prime[STA];

int main(){
    memset(prime,true,sizeof(prime));
    for(int i=2;i<STA/2;i++){
        for(int j=2;i*j<STA;j++) prime[i*j] = false;
    }
    int n;
    while(cin >> n){
        int cnt = 0;
        for(int i=2;i<=n;i++){
            if(prime[i]) cnt++;
        }
        cout << cnt << endl;
    }
}

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

using namespace std;

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

    int g = 1, p = 0;
    int sz = s.size();
    int ans = 0;
    string w = "g";
    for (int i = 1; i < sz; i++) {
        if (g - p > 0) {
            ans += (s[i] == 'g');
            p++;
        } else {
            ans -= (s[i] == 'p');
            g++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
  var N, A, B int
  var S string
  fmt.Scan(&N,&A,&B)
  fmt.Scan(&S)

  count := 0
  countF := 0
  for i:=0; i<len(S); i++ {
    if S[i] == 97 {
      if count < A+B {
        fmt.Println("Yes")
        count++
      } else {
        fmt.Println("No")
      }
    } else if S[i] == 98 {
        if count < A+B && countF<B {
          fmt.Println("Yes")
          count++
          countF++
        } else {
          fmt.Println("No")
        }
    } else {
      fmt.Println("No")
    }
  }
}

Measured memory_bytes: 3200
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX_N 200100
#define MAX_B 1001001//6
#define MAX_S 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define mian() main()
#define greater greater<int>()
VI findAll(string S,string pattern){VI P;ll pos=(ll)S.find(pattern);
while(pos!=string::npos){P.push_back(pos);pos=(ll)S.find(pattern,pos+1);}return P;}
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
bool is_prime(ll n){if(n<2)return 0;for(int i=2;i*i<n;i++)if(n%i==0)return 0;return 1;}
inline void eratosthenes(VB& p){rep(i,SZ(p))p[i]=1;p[0]=p[1]=0;
rep(i,SZ(p)/2+1){if(p[i])for(ll j=i+i;j<SZ(p);j+=i)p[j]=0;}}
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
using Graph=vector<vector<P> >;
ll nCr(ll n,ll k,ll MOD_=1000000007){
    //assert(n>=0&&k>=0&&MOD_>=2);
    ll size=k;
    ll ans=1;
    vector<ll>fact_inv,inv;
    fact_inv.resize(size+5);
    inv.resize(size+5);
    fact_inv[0]=fact_inv[1]=1;
    inv[1]=1;
    for(int i=2;i<size+5;i++){
        inv[i]=MOD_-inv[MOD_%i]*(MOD_/i)%MOD_;
        fact_inv[i]=fact_inv[i-1]*inv[i]%MOD_;
    }
    for(int i=n;i>=n-k+1;i--){
        ans*=i;ans%=MOD_;
    }
    return ans*fact_inv[k]%MOD_;
}
int k,n;
int main(){
    cin>>n>>k;
   for(int i=1;i<=k;i++){
       ll a=nCr(n-k+1,i);
       ll b=nCr(k-1,i-1);
       ll x=a*b%MOD;
       cout<<x<<endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& stream, const mint& n){
  stream << n.x;
  return stream;
};

struct comb{
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll n;
  cin >> n;
  mint ans(1);
  REP(i, n) ans *= i+1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY.sort(key=lambda x:(x[0], x[1]))
#print(PY)

b = 0
c = []
pre = -1
for i in range(M):
  if PY[i][0] != pre:
    b = 0
  pre = PY[i][0]
  b += 1
  c.append([PY[i][2], "{0}{1}".format(str(PY[i][0]).zfill(6), str(b).zfill(6))])
#print(c)

c.sort(key=lambda x:(x[0]))
for i in range(M):
  print(c[i][1])


Measured memory_bytes: 100568
#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 rall(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()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
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;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll digsum(ll n){
    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main()
{
    ll n;
    cin >> n;
    vll p(n),tmp(n);
    rep(i,n){
        cin >> p[i];
        tmp[i] = p[i];
    }

    sort(all(p));
    
    ll cnt = 0;

    rep(i,n)if(p[i] != tmp[i])cnt++;

    if(cnt <= 2)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
r = float(input())

#円の面積 = πr^2
#円周の長さ=直径*π=2πr
#print(c,d,"{:.5f}".format(e)) 

m = 3.141592653589 * r * r
l = 3.141592653589 * r * 2

print("{:.6f}".format(m),"{:.6f}".format(l)) 



Measured memory_bytes: 5568
class UnionFind:
    # 初期化
    def __init__(self, n):
        # 根なら-size, 子なら親の頂点
        self.par = [-1] * n
        # 木の高さ
        self.rank = [0] * n

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 異なる集合に属する場合のみ併合
        if x != y:
            # 高い方をxとする。
            if self.rank[x] < self.rank[y]:
                x,y = y,x
            # 同じ高さの時は高さ+1
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            # yの親をxとし、xのサイズにyのサイズを加える
            self.par[x] += self.par[y]
            self.par[y] = x

    # 同集合判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 集合の大きさ
    def size(self, x):
        return -self.par[self.find(x)]


from operator import itemgetter

n = int(input())

xy = []
for i in range(n):
    x,y = map(int, input().split())
    xy.append([i,x,y])

x = sorted(xy,key=itemgetter(1))
y = sorted(xy,key=itemgetter(2))

xx = []
yy = []

for i in range(n-1):
    xx.append([x[i][0],x[i+1][0],x[i+1][1]-x[i][1]])
    yy.append([y[i][0],y[i+1][0],y[i+1][2]-y[i][2]])

xx.sort(key=itemgetter(2))
yy.sort(key=itemgetter(2))
xx.reverse()
yy.reverse()

a = UnionFind(n)

ans = 0

i = 0
xxx = xx.pop()
yyy = yy.pop()
while i!=n-1:
    if xxx[2] < yyy[2]:
        if not a.same(xxx[0],xxx[1]):
            a.unite(xxx[0],xxx[1])
            ans += xxx[2]
            i += 1
        if xx:
            xxx = xx.pop()
        else:
            xxx = [0,0,float('inf')]
    else:
        if not a.same(yyy[0],yyy[1]):
            a.unite(yyy[0],yyy[1])
            ans += yyy[2]
            i += 1
        if yy:
            yyy = yy.pop()
        else:
            yyy = [0,0,float('inf')]
print(ans)

Measured memory_bytes: 53440
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;
template <typename T>
T sq(T x){
  return x * x;
}

signed main (){
  ll N,M,L;
  ll A,B,C;
  string s;
  vector<ll> v(10);
  vector<vector<ll>> vv(10,vector<ll>(10));
  cin >> A >> B >> C >> N;
if(A > N ){
  cout << N << endl;
}else if(A + B > N){
 cout << A << endl;
}else{
cout << A -(N -(A + B)) << endl;
}
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N, Q; cin >> N >> Q; 
	long long A[200010], B[200010]; 
	for(int i = 0; i < N*2; i++) cin >> A[i]; 
	for(int i = 0; i < N*2; i++) cin >> B[i]; 
	long long sumA = 0; // 全部Aだった場合
	long long sumP = 0; // 変えた方が得なものを全部Bに変えたときの得
	multiset<long long> P, M; 
	for(int i = 0; i < N*2; i++) sumA += A[i]; 
	for(int i = 1; i < N*2-1; i++){
		if(A[i] <= B[i]){
			P.insert(B[i] - A[i]); sumP += B[i] - A[i]; 
		}
		else M.insert(A[i] - B[i]); 
	}
	while(Q--){
		int p; long long x, y; 
		cin >> p >> x >> y; p--; 
		if(p == 0 || p == N*2 - 1){
			sumA += x - A[p]; 
			A[p] = x; 
		}else{
			if(A[p] <= B[p]){
				P.erase(P.find(B[p] - A[p])); 
				sumP -= B[p] - A[p]; 
				sumA -= A[p]; 
				A[p] = x; B[p] = y; 
			}else{
				M.erase(M.find(A[p] - B[p])); 
				sumA -= A[p]; 
				A[p] = x; B[p] = y; 
			}
			sumA += A[p]; 
			if(A[p] <= B[p]){
				P.insert(B[p] - A[p]); sumP += B[p] - A[p]; 
			}
			else M.insert(A[p] - B[p]); 
		}
		long long ans = sumA + sumP; 
		int s = (int) P.size(); 
		if(s & 1){
			long long d = *P.begin(); 
			long long e = *M.begin(); 
			ans -= min(d, e); 
		}
		cout << ans << "\n"; 
	}
}

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

using namespace std;

int64_t Lucas_Num(int, vector<int64_t>&);

int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int64_t ans;  // output

  int i;    // subscript


  /* Input, Array_Proclamation */
  cin >> N;
  vector<int64_t> L(N+1, -1);



  /* Initialize */
  ans = 0;


  /* Calculation */
  ans = Lucas_Num(N, L);


  /* Output */
  cout << ans << endl;


  return 0;

}


int64_t Lucas_Num (int digits, vector<int64_t> &lucas)
{


  int64_t L;
  int64_t l1, l2;


  if( lucas.at(digits) != -1 )
  {
    L = lucas.at(digits);
    return L;
  }
  else if(digits == 0)
  {
    lucas.at(digits) = 2;
    L = lucas.at(digits);
    return L;
  }
  else if(digits == 1)
  {
    lucas.at(digits) = 1;
    L = lucas.at(digits);
    return L;
  }
  else if(digits >= 2)
  {
    // l2 = Lucas_Num(digits -2, lucas);
    // l1 = Lucas_Num(digits -1, lucas);

    // lucas.at(digits -2) = Lucas_Num(digits -2, lucas);
    // lucas.at(digits -1) = lucas.at(digits -2) + lucas.at(digits -3);
    // L  = lucas.at(digits -1) + lucas.at(digits -2);

    // cout << "***\n";

    lucas.at(digits) = Lucas_Num(digits -1, lucas) + Lucas_Num(digits -2, lucas);
    L = lucas.at(digits);
    return L;
  }

}



Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
#define fcout cout << fixed << setprecision(10)

using namespace std;

int N, K, A[100005];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N >> K;

    int ans = 0;
    REP(i, N) {
        cin >> A[i];
        if (A[i] > 0) ans += A[i];
    }

    int s = -INF;

    // 白塗り
    int tmp = 0;
    REP(i, K - 1) {
        if (A[i] > 0) tmp += -A[i];
    }
    int l = 0;
    int r = K - 1;
    while (r < N) {
        if (A[r] > 0) tmp += -A[r];
        s = max(tmp, s);

        if (A[l] > 0) tmp += A[l];
        l++;
        r++;
    }

    // 黒塗り
    tmp = 0;
    REP(i, K - 1) {
        if (A[i] < 0) tmp += A[i];
    }
    l = 0;
    r = K - 1;
    while (r < N) {
        if (A[r] < 0) tmp += A[r];
        s = max(tmp, s);

        if (A[l] < 0) tmp += -A[l];
        l++;
        r++;
    }

    cout << ans + s << endl;

    return 0;
}


Measured memory_bytes: 1024
n = gets.to_i
a = gets.split.map(&:to_i)
sum = a.inject(:+)
x = a[0]
y = sum - x
min = (x - y).abs
for i in 1..(n - 2) do
  x += a[i]
  y -= a[i]
  diff = (x - y).abs
  min = diff if diff < min
end
puts min


Measured memory_bytes: 16540
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll x,y;
    cin>>x>>y;
    
    if(abs(x-y)<=1){ cout1("Brown");}
    else{ cout1("Alice");}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
bool a[101];
int i,j;
int main()
{
	getline(cin,s);
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='C') a[0]=true;
		if(s[i]=='F'&&a[0]==true) a[1]=true;
	}
	if(a[0]==true&&a[1]==true) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
set<string> sss;
void brute(string s){
  if(sss.find(s) != sss.end())return;
  sss.insert(s);
  for(int i = 0;i < s.size() - 1;i++){
    string cp = s;
    if(s[i] != s[i + 1]){
      cp[i] = cp[i + 1] = 'a' ^ 'b' ^ 'c' ^ s[i] ^ s[i + 1];
    }
    brute(cp);
  }
}
const int N = 2 * 1e5;
const int C = 3;
const int S = 3;
int dp[N][C][S][2];
int n;
int ss;
const int MOD = 998244353;
int ans(int in, char lst, int sum, bool y){
  if(in == -1)
    return (sum == ss && y ? 1 : 0);
  int& res = dp[in][lst][sum][y];
  if(res != -1)
    return res;
  res = 0;
  for(int i = 0;i < 3;i++){
    (res += ans(in - 1, i, (sum + i) % 3, y || (in != n - 1 && i == lst))) %= MOD;
  }
  return res;
}
int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
////  brute("a");
////  cout << ss.size() << endl;ss.clear();
////  brute("ab");
////  cout << ss.size() << endl;ss.clear();
////  brute("aba");
////  cout << ss.size() << endl;ss.clear();
////  brute("abab");
////  cout << ss.size() << endl;ss.clear();
////  brute("ababa");
////  cout << ss.size() << endl;ss.clear();
////  brute("ababab");
////  cout << ss.size() << endl;ss.clear();
////  brute("abababa");
////  cout << ss.size() << endl;ss.clear();
////  brute("abababab");
////  cout << ss.size() << endl;ss.clear();
////
////  return 0;
//
//
//  brute(s);
//  vector<pair<int, string>> v;
//  n = 3;
//  for(int i = 0;i < pow(3, n);i++){
//    string s;
//    int x = i;
//    for(int j = 0;j < n;j++){
//      s += 'a' + (x % 3);
//      x /= 3;
//    }
//    ss.clear();
//    brute(s);
//    cout << s << ' ' << ss.size() << endl;
//    for(auto el : ss)
//      cout << el << endl;
//
//  }
//  sort(v.begin(), v.end());
//  for(auto el : v){
//    cout << el.first << ' ' << el.second << endl;
//    int mx = v.back().first;
//    bool b = 1;
//    for(int i = 0;i < el.second.size() - 1;i++){
//      if(el.second[i] == el.second[i + 1])b = 0;
//    }
//    if(b && el.first != mx || !b && el.first == mx){
////      cout << "123 " << el.first << ' ' << el.second << endl;
//    }
//  }
////  cout << ss.size();
//  return 0;
  memset(dp, -1, sizeof(dp));
  string s;
  cin >> s;

  n = s.size();
  if(n <= 3){
    brute(s);
    cout << sss.size() << endl;
    return 0;
  }
  int cnt = 0;
  for(int i = 1;i < s.size();i++){
    if(s[i] == s[i - 1])cnt++;
  }
  if(cnt == n - 1){
    cout << 1 << endl;
    return 0;
  }
  int dp[n][3];
  for(auto el : s)
    (ss += (el - 'a')) %= 3;
  cout << ans(n - 1, 0, 0, 0) + (cnt == 0 ? 1 : 0);
  return 0;
}


Measured memory_bytes: 30212
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var r = RInts();
        int Ha = r[0];
        int Ma = r[1];
        int Hb = r[2];
        int Mb = r[3];
        int K = r[4];

        int timea = Ha * 60 + Ma;
        int timeb = Hb * 60 + Mb;
        if (timea <= timeb)
        {
            WriteLine(Max(0,timeb-timea-K));
        }
        else
        {
            WriteLine(Max(0,24*60+timeb-timea-K));
        }
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27436
#include <iostream>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
const int MAXN = 2e5 + 5;
const int INF = 0x3f3f3f3f;
typedef long long ll;
int vis[MAXN], cnt[26];
int main() {
	ios::sync_with_stdio(false);
	cout.tie(0), cin.tie(0);
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define MOD 998244353
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}
 
ll pow(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;
}
 
 
 
/*const int N=200000;
 
ll fac[N+1];
ll inv[N+1];
ll p=998244353;
 
ll c(ll a, ll b,ll m)
{
  if(a<b)return 0;
  return (fac[a]*inv[b]%m)*(inv[a-b])%m;
}
 
*/


ll coeff[3005];
  

int main()
{ fast

ll n,s;cin>>n>>s;

coeff[0]=1;

ll p=998244353;

vl a(n+1);

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

for(int i=1;i<=n;i++)
{
  vl temp(3001);
  
  for(int j=0;j<=3000;j++)temp[j]=coeff[j]*2%p;

   for(int j=0;j<=3000;j++)
   {
    if(j+a[i]<=s)temp[j+a[i]]+=coeff[j];
    coeff[j]=temp[j];
    coeff[j]%=p;
   }
//if(i==1)for(int j=0;j<=10;j++)cout<<temp[j]<<endl;
}

cout<<coeff[s]<<endl;



 return 0;
 
 
}

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

using namespace std;

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

Measured memory_bytes: 256
local List = {}
function List.new ()
    return {first = 0, last = -1}
end

function List.pushleft (list, value)
    local first = list.first - 1
    list.first = first
    list[first] = value
end

function List.pushright (list, value)
    local last = list.last + 1
    list.last = last
    list[last] = value
end

function List.popleft (list)
    local first = list.first
    local value = list[first]
    list[first] = nil
    list.first = first + 1
    return value
end

function List.popright (list)
    local last = list.last
    local value = list[last]
    list[last] = nil
    list.last = last - 1
    return value
end

function List.empty (list)
    return list.first > list.last
end

----------

local h,w=io.read("n","n")
local ch,cw=io.read("n","n")
local dh,dw=io.read("n","n","l")

local s={}
for i=1,h do
    local input=io.read()
    s[i]={}
    for j=1,w do
        s[i][j]=input:sub(j,j)
    end
end

local checkin=List.new()
local checked=List.new()
List.pushright(checkin,{ch,cw})

local cost={}
local INF=10^13
for i=1,h do
    cost[i]={}
    for j=1,w do
        cost[i][j]=INF
    end
end
cost[ch][cw]=0
local dx={1,0,-1,0}
local dy={0,1,0,-1}

while (not List.empty(checkin)) or (not List.empty(checked)) do
    if not List.empty(checkin) then
        local q=List.popleft(checkin)
        List.pushright(checked,q)
        local x,y=q[1],q[2]
        for i=1,4 do
            local nx,ny=x+dx[i],y+dy[i]
            local checker=(nx<1 or nx>h or ny<1 or ny>w)
            if not checker and s[nx][ny]~="#"then
                if cost[x][y]<cost[nx][ny] then
                    cost[nx][ny]=cost[x][y]
                    List.pushright(checkin,{nx,ny})
                end
            end
        end
    else
        local q=List.popleft(checked)
        local x,y=q[1],q[2]
        for dx=-2,2 do
            for dy=-2,2 do
                local nx,ny=x+dx,y+dy
                local checker=(nx<1 or nx>h or ny<1 or ny>w)
                if not checker and s[nx][ny]~="#"then
                    if cost[x][y]+1<cost[nx][ny] then
                        cost[nx][ny]=cost[x][y]+1
                        List.pushright(checkin,{nx,ny})
                    end
                end
            end
        end
    end
end

print(cost[dh][dw]<INF and cost[dh][dw] or -1)

Measured memory_bytes: 41616
#include<cstdio>
#include<map>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>

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

using namespace std;

int main(){
	int n,x[100];cin>>n;
	double k;cin>>k;
	int ans=0;
	REP(i,n){
		cin>>x[i];
		if(x[i]<=k/2){
			ans+=(x[i]*2);
		}
		else ans+=((k-x[i])*2);
	}
	cout<< ans <<endl;
	return 0;
}




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

using namespace std;

typedef long long ll;
typedef vector<ll> V;
typedef pair<ll,ll> P;
typedef map<ll,ll> M;

#define REP(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define FOR(i,j,n) for(ll (i) = (j); (i) < (n); ++(i))
#define REPR(i,n) for(ll (i) = (n); (i) >= 0; --i))


signed main(){
    int n,t;
    cin >> n >> t;
    V x(n);
    V h(n);
    double ans = 0;
    REP(i,n){
        cin >> x[i] >> h[i];
        ans = max(ans, 1.0 * t / x[i] * h[i]);
    }
    printf("%.8lf\n", ans);
}



Measured memory_bytes: 3244
#include <iostream>
using namespace std;
int main(void){
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(x-r<0||x+r>w){
        cout<<"No"<<endl;
    }
    else{
        if(y-r<0||y+r>h){
           cout<<"No"<<endl; 
        }
        else{
           cout<<"Yes"<<endl;
        }
    }
}

Measured memory_bytes: 1156
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
    }

    let mut mat = vec![vec![0; 9]; 9];
    let mut ans = 0;

    for i in 1..10 {
        for j in 1..10 {
            for n in 1..n+1 {
                if i == get_head_dig(n) && j == n % 10 {
                    mat[i-1][j-1] += 1;                    
                }
            }
        }
    }

    for i in 1..10 {
        for j in 1..10 {
            ans += mat[i-1][j-1] * mat[j-1][i-1];
        }
    } 

    println!("{}", ans);
}

fn get_head_dig(mut num : usize) -> usize {
    while num >= 10 {
        num /= 10;
    }
    num
}

Measured memory_bytes: 4352
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7,MAX = 1e6+5;
const ll INF = 1e18+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
///////////////SegmentTree/////////////////
struct SegTree 
{
	int n;
	vector<ll> Tree;
	void init(int sz)
	{
		n = sz;
		Tree.resize(4*n);
	}
	void set(int k, ll x) 
	{
		k+=n;
		Tree[k]=x;
		for(k=k/2;k>=1;k/=2)
		{
			Tree[k]=Tree[2*k]+Tree[2*k+1];
		}
	}
	ll sum(int a, int b)
	{
		a+=n;b+=n;
		ll s=0;
		while(a<=b)
		{
			if(a%2==1) s+=Tree[a++];
			if(b%2==0) s+=Tree[b--];
			a/=2;b/=2;
		}
		return s;
	}
};
///////////////SegmentTree/////////////////
///////////////////PnC/////////////////////
struct PnC
{
	int n;
	vl F,I;
	void init(int n)
	{
		F.resize(n+1);
		I.resize(n+1);
		F[0]=I[0]=1;
		for(int i=1;i<=n;i++)
		{
			F[i]=(F[i-1]*i)%MOD;
			I[i]=powN(F[i],MOD-2);
		}
	}
	ll nCr(int n,int r)
	{
		if(r>n) return 0;
		return (((F[n]*I[r])%MOD)*I[n-r])%MOD;
	}
};
///////////////////PnC/////////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vi MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	ll x,k,d;
	cin>>x>>k>>d;
	if(x>0)
	{
		if(x/d>=k)
		{
			cout<<x-k*d<<endl;
		}
		else
		{
			k -= x/d;
			x %= d;

			if(k%2==0) cout<<x<<endl;
			else cout<<d-x<<endl;
		}

	}
	else
	{
		if(-x/d>=k)
		{
			cout<<abs(x+k*d)<<endl;
		}
		else
		{
			k += x/d;
			x %= d;

			if(k%2==0) cout<<abs(x)<<endl;
			else cout<<d+x<<endl;
		}
	}
}	

Measured memory_bytes: 7080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        char a = s.next().charAt(0),b=s.next().charAt(0);
        if(a=='H'){
            if(b=='H') System.out.println("H");
            else System.out.println("D");
        }
        else {
            if(b=='H') System.out.println("D");
            else System.out.println("H");
        }
    }


}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25340
N = int(input())
a = []
for i in range(N):
    x,y = map(int,input().split())
    a.append((x,y))
ans = "No"
for i in range(N-2):
    if a[i][0] == a[i][1] and a[i+1][0] == a[i+1][1] and a[i+2][0] == a[i+2][1]:
        ans = "Yes"
print(ans)

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

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

  int ans = 0;
  int tmp = 0;
  for(int i = 0; i < N-1; i++){
    if(H[i] >= H[i+1]){
      tmp++;
    }else{
      chmax(ans, tmp);
      tmp = 0;
    }
  }

  chmax(ans, tmp);

  cout << ans << endl;

  return 0;
}



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

int main(){
    int n, m, x;
    int mas[110] = {};
    cin >> n >> m >> x;

    int a;
    for(int i = 0;i < m;i++){
        cin >> a;
        mas[a] = 1;
    }

    int a1 = 0, a2 = 0;

    for(int i = x-1;i > 0;i--){
        a1 += mas[i];
    }

    for(int i = x+1;i < n;i++){
        a2 += mas[i];
    }

    cout << min(a1, a2) << endl;

    return 0;
}


Measured memory_bytes: 256
import com.sun.org.apache.xpath.internal.operations.Bool
import java.lang.Math.*

const val MOD = 1000000007L

fun main(args: Array<String>) {
    val n = readInt()
    val sp = mutableListOf<Pair<Int, Pair<String, Int>>>()
    n.rep {
        val l = readList()
        sp.add(Pair(it, Pair(l.first(), l[1].toInt())))
    }

    sp.sortedByDescending {
        it.second.second
    }.sortedBy {
        it.second.first
    }.forEach {
        println(it.first + 1)
    }


}


fun readList() = readLine()!!.split(' ')
fun readInt() = readLine()!!.split(' ').map(String::toInt).first()
fun readIntList() = readList().map(String::toInt)
fun readLongList() = readList().map(String::toLong)
fun readDoubleList() = readList().map(String::toDouble)

fun readPair(): Pair<String, String> {
    val splite = readLine()!!.split(' ')
    return Pair(splite[0], splite[1])
}

fun <T> List<T>.copy() = this.map { it }

// 速度のためforEachは避ける
inline fun Int.rep(start: Int = 0, shiftLast: Boolean = false, body: (Int) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

inline fun Long.rep(start: Long = 0, shiftLast: Boolean = false, body: (Long) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

// 約数のList
fun divisor(value: Long): List<Long> {
    val max = sqrt(value.toDouble()).toLong()
    val former = mutableListOf<Long>()
    val latter = mutableListOf<Long>()
    (1..max).filter { value % it == 0L }
        .forEach {
            former.add(it)
            latter.add(value / it)
        }
    former.addAll(latter.reversed())
    return former
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from: Long, to: Long = from): List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j -> i % j != 0L }
    }
}

// 素因数分解
fun decom(value: Long): List<Long> {
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a: Long, b: Long): Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base: String, a: String, b: String): String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

// 二分探索
fun Array<Long>.binarySearch(target: Long, _start: Int = 0, _end: Int = this.size): Int {
    var start = (_start - 1).toLong()
    var end = _end.toLong()
    while (end - start > 1) {
        val mid = (start + end) / 2
        if (this[mid.toInt()] < target) {
            start = mid
        } else {
            end = mid
        }
    }
    return end.toInt()
}

// bit全探索
inline fun Int.bitAllSearch(body: (Array<Int>) -> Unit) {
    for (bit in 0 until (1 shl this)) {
        val s = mutableListOf<Int>()
        for (i in 0 until this) {
            if ((bit and (1 shl i)) == 1 shl i) { // i が bit に入るかどうか
                s.add(i)
            }
        }
        body(s.toTypedArray())
    }
}

Measured memory_bytes: 38312
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String[] s = sc.next().split("");
		int sum = 0;
		int max = 0;

		for(int i = 0;i < n;i++){
			if(s[i].equals("I")){
				sum++;
			}else{
				sum--;
			}

			if(sum > max)max = sum;
		}
		
		System.out.println(max);
	}
}


Measured memory_bytes: 9684
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#define INF 1e8
using namespace std;
#define ll long long

#define MAX 100020
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#define INF 1e8
using namespace std;
#define ll long long

#define MAX 100020

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

cout<<r*r;

}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#include <iomanip>
#include <unordered_map>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  int h, w; cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  vector<vector<int>> distance(h, vector<int>(w, -1));
  vector<vector<int>> prex(h, vector<int>(w, -1));
  vector<vector<int>> prey(h, vector<int>(w, -1));
  rep(i, h){
    rep(j, w) {
      cin >> s[i][j];
    }
  }
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  distance[0][0] = 0;
  while(!que.empty()){
    pair<int, int> current_pos = que.front();
    int x = current_pos.first;
    int y = current_pos.second;
    que.pop();

    for(int d = 0; d<4; d++) {
      int nx = x + dx[d];
      int ny = y + dy[d];
      if(nx<0||nx>=h||ny<0||ny>=w) continue;
      if(s[nx][ny] =='#') continue;
      if(distance[nx][ny] == -1) {
        que.push(make_pair(nx, ny));
        distance[nx][ny] = distance[x][y] + 1;
      } 
    }
  }
  int kabe = 0;
  rep(i, h){
    rep(j, w) {
      if(s[i][j] == '#') kabe++;
    }
  }
  if(distance[h-1][w-1] == -1) cout<< -1 << endl;
  else cout << h * w - (distance[h-1][w-1] + 1 + kabe) << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 2147483647;
long long int MOD = 1000000007;
using namespace std;

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

#define MAX_N 200000

using namespace std;

int const TREE_SIZE = 1 << 20;
long long int seg_tree[TREE_SIZE];

void change(int a, long long int w){
	
	// a番目の要素をwに変更する O(log N)
	
	a += TREE_SIZE / 2;
	
	seg_tree[a] = w;
	
	for(int x = a / 2; x > 0; x /= 2){
		seg_tree[x] = min(seg_tree[2 * x], seg_tree[2 * x + 1]);
	}
}

long long int query(int a, int b, int index, int l, int r){
	
	// 区間 [a, b) の要素の最小値を返す O(log N)
	// 外からは max_query(a, b, 1, 0, TREE_SIZE / 2) のように呼ぶ
	
	if(r <= a || b <= l){
		return INF;
	}
	if(a <= l && r <= b){
		return seg_tree[index];
	}
	
	return min(query(a, b, index * 2, l, (l + r) / 2), query(a, b, index * 2 + 1, (l + r) / 2, r));
}

int main(){
	
	int n, q;
	cin >> n >> q;
	
	for(int i = 0; i < TREE_SIZE; i++){
		seg_tree[i] = INF;
	}
	
	for(int i = 0; i < q; i++){
		long long int num, a, b;
		cin >> num >> a >> b;
		if(num == 0){
			change(a, b);
		}else{
			cout << query(a, b + 1, 1, 0, TREE_SIZE / 2) << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 11312
#include<stdio.h>

int main(){
    int N;
    long long A[110000];
    long long ans=0;

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

    for(int i=0; i<N; i++){
        ans += A[i]/2;
        A[i] = A[i]%2;
        if(i<N-1){
            if(A[i]<A[i+1]){
                ans += A[i];
                A[i+1]= A[i+1]-A[i];
            }else{
                ans += A[i+1];
                A[i+1] = 0;
            }
        }
    }
    printf("%lld", ans);

    return 0;
}

Measured memory_bytes: 896