akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class Monoid> struct SegTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;
    
    SegTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* update a, a is 0-indexed */
    void update(int a, const Monoid &v) {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1) dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* get [a, b), a and b are 0-indexed */
    Monoid get(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }

    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,q;
    cin>>N>>q;
    SegTree<long long> seg(N, [](long long a, long long b) {
        return min(a, b);
    },
    (1LL<<31)-1);
    seg.build();
    REP(i,q){
        int c,x,y;
        cin>>c>>x>>y;
        if(c==0){
            seg.update(x,y);
        }
        else cout<<seg.get(x,y+1)<<endl;
    }
}



Measured memory_bytes: 4932
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line
}

fn call(n: i32) {
    let mut i = 1;
    while i <= n {
        let mut x = i;
        if x % 3 != 0 {
            while x != 0 {
                if x % 10 == 3 {
                    print!(" {}", i);
                    break;
                }
                x /= 10;
            }
        } else {
            print!(" {}", i);
        }
        i += 1;
    }
    println!("");
}

fn main() {
    let num: i32 = get_line().trim().parse().unwrap();
    call(num);
}



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

int main() {
    int N;
    cin >> N;
    string ans = "No";
    
    vector<int> v(N);
    for (int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;

        if (a == b) {
            v.at(i) = 1;
        }
        else {
            v.at(i) = 0;
        }
    }

    for (int i = 0; i < N - 2; i++) {
        if (v.at(i) == 1 && v.at(i+1) == 1 && v.at(i+2) == 1) {
            ans = "Yes";
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    string S,T;
    cin >> S >> T;
    int A,B;
    cin >> A >> B;
    string U;
    cin >> U;
    
    if(U==S) {
        A--;
    }else{
        B--;
    }

    cout << A << ' ' << B << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */


void solve(){
    ll A,B,C,D,E,F; cin >> A >> B >> C >> D >> E >> F;
    vector<ll> mizu;
    for(int i = 0; i <= F; i++){
        for(int j = 0; j <= F; j++){
            if(100*A*i + 100*B*j>F)break;
            mizu.push_back(100*A*i+100*B*j);
        }
    }
    vector<ll> satou;
    for(int i = 0; i <= F; i++){
        for(int j = 0; j <= F; j++){
            if(C*i+D*j > F) break;
            satou.push_back(C*i+D*j);
        }
    }
    sort(mizu.begin(),mizu.end());
    sort(satou.begin(),satou.end());
    mizu.erase(unique(mizu.begin(),mizu.end()),mizu.end());
    satou.erase(unique(satou.begin(),satou.end()),satou.end());
    
    
    ll ans1 = 0, ans2 = 0;
    double noudo = -1;
    for(int i = 0; i < mizu.size();i++){
        for(int j = 0; j < satou.size();j++){
            if(mizu[i]+satou[j] > F)continue;
            if(E*mizu[i] < 100*satou[j]) continue;
            double tnoudo = 100*(double)satou[j]/(double)(mizu[i]+satou[j]);
            if(noudo < tnoudo){
                noudo = tnoudo;
                ans1 = mizu[i]+satou[j];
                ans2 = satou[j];
            }
        }
    }
    
    cout << ans1 << " " << ans2 << endl;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 2420
import bisect 

n=int(input())
l=list(map(int,input().split()))
l.sort()
if l[0]>=0:
    #print('hello')
    a=l[0]
    ans=0
    for i in range(n):
        ans+=l[i]
    print(ans-2*l[0])
    for i in range(1,n-1):
        print(a,l[i])
        a-=l[i]
    print(l[-1],a)
elif l[-1]<=0:
    #print('hello')
    a=l[-1]
    ans=l[-1]
    for i in range(n-1):
        ans-=l[i]
    print(ans)
    for i in range(n-1):
        print(a,l[i])
        a-=l[i]
else:
    #print('hello')
    idx=bisect.bisect(l,0)
    ans=0
    for i in range(n):
        if l[i]>=0:
            ans+=l[i]
        else:
            ans-=l[i]
    print(ans)
    a=l[0]
    for i in range(idx,n-1):
        print(a,l[i])
        a-=l[i]
    b=l[-1]
    for i in range(1,idx):
        print(b,l[i])
        b-=l[i]
        
    print(b,a)

Measured memory_bytes: 14060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin>>n;

    long long N = 1000000000 + 7;
    long long res = 1;
    for(int i = 1;i <= n;i++){
        res *= i;
        if(res > N){
            res = res % N;
        }
    }
    std::cout<<res<<std::endl;
    return 0;
}


Measured memory_bytes: 256
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>s;
		n=s.length();
		// ll a[n];
		rep(i,n)
		{
			if(s[i]=='7')
				c=1;
		}
		
		cout<<(c==1?"Yes":"No");

		
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3652
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")

import sys
sys.setrecursionlimit(1000000)
N,Q = map(int,sys.stdin.readline().split())
qs = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(Q)) # multi line with multi param

parents = list(range(N))
diffs = [0]*N

def root(x):
    if parents[x]==x:
        return x
    else:
        pr = root(parents[x])
        diffs[x] += diffs[parents[x]]
        parents[x] = pr
        return pr

def weight(x):
    root(x)
    return diffs[x]

def diff(x,y):
    return weight(y)-weight(x)

def issame(x,y):
    return root(x) == root(y)

# make sure weight(y)-weight(x)=w
def merge(x,y,w):
    # assume ry > rx
    rx = root(x)
    ry = root(y)
    # incase rx!=x and ry !=y
    diff = weight(x)+(w-weight(y))
    if rx == ry:
        return False
    if rx < ry:
        rx,ry,diff = ry,rx,-diff
    diffs[ry] = diff
    parents[ry] = rx
    return True

for q in qs:
    if q[0]==0:
        x,y,z = q[1:]
        merge(x,y,z)
    else:
        x,y = q[1:]
        if root(x)==root(y):
            print(diff(x,y))
        else:
            print("?")


Measured memory_bytes: 77024
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int x1, y1, x2, y2;

  std::cin >> x1 >> y1 >> x2 >> y2;

  int x12 = x2 - x1, y12 = y2 - y1, px = -y12, py = x12;

  std::cout <<
    x2 + px << ' ' <<
    y2 + py << ' ' <<
    x1 + px << ' ' <<
    y1 + py << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);


    string s;
    cin>>s;
    rep(i,s.size()){
        cout<<'x';
    }
    cout<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<pair<int,int>> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i].first;
    A[i].second = i + 1;
  }
  sort(A.begin(),A.end());
  for (int i = 0; i < N; i++) {
    cout << A[i].second << " ";
  }
  return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<iomanip>
#include<algorithm>

using namespace std;

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

int main(){
    long long int Q,H,S,D;
    long long int N;
    cin >> Q >> H >> S >> D;
    cin >> N;
    long long int c2,c1,c500,c250=Q;
    c500 = min(H,2*Q);
    c1 = min(S,2*c500);
    c2 = min(D,2*c1);
    long long int ans;
    ans = (N/2)*c2 + (N%2)*c1;
    cout << ans;
}

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

using namespace std;
using ll = long long;
int gcd(ll a,ll b){
    if (b > a) swap(a,b);
    ll c = a%b;
    if (c != 0){
        return(gcd(b,c));
    }else{
        return(b);
    }
}
int main(){
    ll k,ans;
    cin >> k;
    ans = 0;
    for (int a=1; a<=k; a++){
         for (int b=1; b<=k; b++){
              for (int c=1; c<=k; c++){
                  ans += gcd(gcd(a,b),c);
              }
         }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3180
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    ll N; cin >> N;
    vector<Pl> m;
    for(ll i = 1; i*i <= N; i++){
        if(N % i == 0){
            m.emplace_back(i,N/i);
        }
    }
    int ans = INF;
    for(auto u : m){
        string a = to_string(u.first);
        string b = to_string(u.second); 
        int now = max(a.size(),b.size()); 
        ans = min(ans,now); 
    }
    cout << ans << endl;
    
}



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

void swap(int *p, int *q){
    int tmp = *p;
    *p = *q;
    *q = tmp;
}

int partision(int *A, int p, int r){
    int x = A[r], i = p - 1;
    for (int j = p; j < r; j++){
        if (A[j] <= x){
            i++;
            swap(&A[i], &A[j]);
        }
    }
    swap(&A[i+1], &A[r]);
    return i+1;
}
int main(int argc, char* argv[]) {
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++) cin >> A[i];
    int x = A[n-1], index = 0;
    partision(A, 0, n-1);
    for (int i = 0; i < n; i++){
        if (x == A[i]) index = i;
    }
    for (int i = 0; i < n; i++){
        index == i? cout << "[" << A[i] << "]": cout << A[i];
        i == n-1? cout << "\n": cout << " ";
    }

    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> A(N);
  
  for (int i = 0; i < N; i++){
    string S;
    int P;
    cin >> S >> P;
    A.at(i) = make_tuple(S, 100-P, i+1);
  }
  
  sort(A.begin(), A.end());
  
  for (tuple<string, int, int> x : A){
    int ans = get<2>(x);
    cout << ans << endl;
  } 
}


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

const long long mod = 998244353;
long long inv[200200] = { 0,1 }, fact[200200] = { 1,1 }, ifact[200200] = { 1,1 }, pw[200200] = { 1 };

int N, M, K;

int main()
{
	for (int i = 2; i < 200200; i++){
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
		fact[i] = fact[i - 1] * i % mod;
		ifact[i] = ifact[i - 1] * inv[i] % mod;
	}

	cin.tie(NULL); ios_base::sync_with_stdio(false);
	cin >> N >> M >> K;

	for (int i = 1; i <= N; i++) pw[i] = pw[i - 1] * (M - 1) % mod;

	long long ans = 0;
	for (int k = 0; k <= K; k++){
		long long c = fact[N - 1] * ifact[k] % mod * ifact[N - 1 - k] % mod * pw[N - 1 - k] % mod;
		ans = (ans + c) % mod;
	}
	ans = ans * M % mod;

	cout << ans << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int h,w,k;
    cin>>h>>w>>k;
    string s[h];
    for(int i=0;i<h;i++)
        cin>>s[i];
    int ans=1e9;
    for(int mask=1;mask<(1<<h);mask+=2)
    {
        int res=__builtin_popcount(mask)-1;
        int sum[h]={};
        bool bad=false;
        for(int j=0;j<w;j++)
        {
            int cur[h]={};
            int last=0;
            for(int i=0;i<h;i++)
            {
                if((mask>>i)&1)
                    last=i;
                if(s[i][j]=='1')
                    cur[last]++;
            }
            for(int i=0;i<h;i++)
                if(cur[i]>k)
                {
                    bad=true;
                    break;
                }
            if(bad)
                break;
            bool cut=false;
            for(int i=0;i<h;i++)
                if(sum[i]+cur[i]>k)
                {
                    cut=true;
                    break;
                }
            if(cut)
            {
                res++;
                memset(sum,0,sizeof(sum));
            }
            for(int i=0;i<h;i++)
                sum[i]+=cur[i];
        }
        if(bad)
            res=1e9;
        ans=min(ans,res);
    }
    cout<<ans;
}


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

int main(){
	LL n,m;
	cin>>n>>m;
	char ar[n+1][m+1];
	for(LL i=1;i<=n;i++) for(LL j=1;j<=m;j++) cin>>ar[i][j];
	for(LL i=1;i<=n;i++){
		LL titik=0;
		for(LL j=1;j<=m;j++){
			if (ar[i][j]=='.') titik++;
		}
		if (titik==m) for(LL j=1;j<=m;j++)ar[i][j]='x';
	}
	for(LL j=1;j<=m;j++){
		LL titik=0;
		for(LL i=1;i<=n;i++){
			if (ar[i][j]=='.' || ar[i][j]=='x') titik++;
		}
		if (titik==n) for(LL i=1;i<=n;i++) ar[i][j]='x';
	}
	for(LL i=1;i<=n;i++){
		bool ada=0;
		for(LL j=1;j<=m;j++) if (ar[i][j]!='x') {
			cout<<ar[i][j];
			ada=1;
		}
		if (ada) cout<<endl;
	}
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import numpy as np

EDPC = "https://atcoder.jp/contests/DP/"
TDPC = "https://atcoder.jp/contests/tdpc/tasks"

############### TESTCASE ###############
test = ""
#test = \
"""
3 8
3 3
4 5
5 6
ans 9
"""

"""
6 15
6 5
5 6
6 4
6 6
3 5
7 2
ans 17
"""

"""
N<100, W<10*9
wi<10**9, vi<10**3 
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################
#np.maximum(*arrays) == np.max(np.vstack(*arrays), axis=0)
#(np.maximum(np.array([1,3,2]), np.array([2, 1, 3])) == 
# np.max(np.vstack([np.array([1,3,2]), np.array([2, 1, 3])]), axis=0)).all()
################# MAIN #################

N, W = map(int, input2().split())
WV = np.array([tuple(map(int, input2().split())) for _ in range(N)], dtype="int64")
Wsum = np.sum(WV[:, 0])
Vsum = np.sum(WV[:, 1])

dp = np.full(Vsum+1, Wsum, dtype="int64")
for w, v in WV:
    dp[:Vsum-v+1] = np.min(np.vstack([dp[:Vsum-v+1], dp[v:] - w]), axis=0)
    
########################################
print(dp[dp < W+1].size - 1) # == np.where(dp < W+1)[0][-1]


Measured memory_bytes: 15568
n=int(input())
a=list(map(int,input().split()))
tmp=[]
all_sum=sum(a)
tmp_sum=0
tmp_sum2=all_sum
for i in range(n-1):
    tmp_sum+=a[i]
    tmp_sum2-=a[i]
    tmp.append(abs(tmp_sum-tmp_sum2))
print(min(tmp))


Measured memory_bytes: 24832
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main() {
    ll n, m, c;
    cin >> n >> m >> c;
    vector<ll> b(m);
    REP(i, m){
        cin >> b[i];
    }
    ll ans = 0;
    REP(i, n){
        ll sum = 0;
        REP(j, m){
            ll a;
            cin >> a;
            sum += a * b[j];
        }
        if(sum + c > 0){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x,y = y,x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x

def main():
    n, m = map(int,input().split())
    uf = UnionFind(n)
    for i in range(m):
        a,b = map(int,input().split())
        uf.union(a-1,b-1)
    print(-min(list(uf.parents)))
    
main()

Measured memory_bytes: 15824
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	map<int, int> me, mo;
	for (int i = 0; i < n; i++) {
		int v;
		cin >> v;
		if (i%2==0)
			me[v]++;
		else
			mo[v]++;
	}
	int maxev;
	int maxe = 0, lmaxe = 0;
	for (auto e : me) {
		if (e.second > maxe) {
			maxe = e.second;
			maxev = e.first;
		}
	}
	for (auto e : me) {
		if (e.second > lmaxe && e.first != maxev)
			lmaxe = e.second;
	}
	int maxo = 0, lmaxo = 0;
	int maxov;
	for (auto e : mo) {
		if (e.second > maxo) {
			lmaxo = maxo;
			maxo = e.second;
			maxov = e.first;
		}

	}
	for (auto e : mo) {
		if (e.second > lmaxo && e.first != maxov)
			lmaxo = e.second;
	}
	if (maxev != maxov)
		cout << n - (maxe+maxo) << endl;
	else {
		cout << n - max(maxe+lmaxo, lmaxe+maxo) << endl;
	}
	return 0;
}

Measured memory_bytes: 8256
s = str(input())
n = len(s)

cum = [[0]*(n+1) for _ in range(26)]

for i in range(26):
    c = chr(i + ord('a'))
    for j in range(n):
        if s[j] == c:
            cum[i][j+1] = cum[i][j]+1
        else:
            cum[i][j+1] = cum[i][j]


for i in range(26):
    for j in range(n+1):
        cum[i][j] = 2*cum[i][j] -j

from collections import deque

for i in range(26):
    min_ = 10**6
    min_id = -1
    q = deque()
    for j in range(n+1):
        if j == 0:
            q.append((cum[i][j], j))
        elif j == 1:
            q.append((cum[i][j], j))
        else:
            temp, temp_id = q.popleft()
            if temp <= min_:
                min_ = temp
                min_id = temp_id
            if cum[i][j] - min_ > 0:
                print(min_id+1, j)
                exit()
            q.append((cum[i][j], j))
else:
    print(-1, -1)

Measured memory_bytes: 72924
#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for(int i=0;i<n;i++){
    cin >> p[i];
  }
  int ans=0;
  for(int i=1; i<=n-2;i++){
    if(max({p[i-1],p[i],p[i+1]}) != p[i] && min({p[i-1],p[i],p[i+1]}) != p[i]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val S = next()
    val deque = java.util.LinkedList<Char>()
    S.forEach { deque.addLast(it) }
    val Q = nextInt()
    var reverse = false
    repeat(Q) {
        val query = listOfString()
        when (query[0]) {
            "1" -> {
                reverse = !reverse
            }
            "2" -> {
                when (query[1]) {
                    "1" -> {
                        if (reverse)
                            deque.addLast(query[2][0])
                        else
                            deque.addFirst(query[2][0])
                    }
                    "2" -> {
                        if (reverse)
                            deque.addFirst(query[2][0])
                        else
                            deque.addLast(query[2][0])
                    }
                }
            }
        }
    }
    val ans = deque.joinToString(separator = "")
    println(if (reverse) ans.reversed() else ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta


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

using namespace std;

int main()
{ 
	int a[3];
	for(int i=0;i<3;i++){
		cin>>a[i];
	}
	int sum=a[0]*100+a[1]*10+a[2];
	if(sum%4==0){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 3584
#include <iostream>

using namespace std;

int main()
{
    int n;
    int a[105];
    int ans = 0;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            for(int k=j+1; k<=n; k++){
                if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k]){
                    if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]){
                        ans++;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int l[2100];
int n;
int cntltk(int k,int lef){
  int lb=lef,ub=n;
  while(ub-lb>1){
    int mid=(lb+ub)/2;
    if(l[mid]<k) lb=mid;
    else ub=mid;
  }
  return lb;
}
int cntmtk(int k,int lef){
  int lb=lef,ub=n;
  while(ub-lb>1){
    int mid=(lb+ub)/2;
    if(l[mid]>k) ub=mid;
    else lb=mid;
  }
  return ub;
}

int main()
{
  cin >> n;
  rep(i,n) cin >> l[i];
  sort(l,l+n);
  ll res = 0;
  rep(i,n) rep(j,n){
    if(i >= j) continue;
    int x = abs(l[i] - l[j]);
    ll tmp = (ll)cntltk(l[i] + l[j],j) - cntmtk(x,j) + 1;
    res += tmp;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace noteCsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,,] condition = new int[4, 3, 10];
            int trynum = int.Parse(Console.ReadLine());
            for(int maincycle = 0; maincycle < trynum; maincycle++)
            {
                string[] input = Console.ReadLine().Split(char.Parse(" "));
                condition[int.Parse(input[0])-1, int.Parse(input[1])-1, int.Parse(input[2])-1] += int.Parse(input[3]);
            }
            Console.Write(output(condition));
        }
        static string output(int[,,] condition)
        {
            string output = "";
            for(int building = 0; building < 4; building++)
            {
                for(int floor = 0; floor < 3; floor++)
                {
                    for(int room = 0; room < 10; room++)
                    {
                        output += " " + condition[building, floor, room];
                    }
                    output += "\n";
                }
                if (building != 3)
                {
                    output += "####################\n";
                }
            }
            return output;
        }
    }
}



Measured memory_bytes: 15944
#include "bits/stdc++.h"
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    x2-=x1;
    y2-=y1;
    x1=0;y1=0;
    string ans="";
    REP(i,x2)ans+='R';
    REP(i,y2)ans+='U';
    REP(i,x2)ans+='L';
    REP(i,y2)ans+='D';
    ans+='D';
    REP(i,x2+1)ans+='R';
    REP(i,y2+1)ans+='U';
    ans+="LU";
    REP(i,x2+1)ans+='L';
    REP(i,y2+1)ans+='D';
    ans+='R';
    cout<<ans<<endl;
}

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

int main(){
    long long i, j, k;
    long long N;
    cin >> N;
    string S;
    cin >> S;

    map<string, long long> hash1[20];
    for(i=0; i<(1<<N); i++){
        string str1 = "";
        string str2 = "";
        long long ones = 0;
        for(j=0; j<N; j++){
            if((i>>j) & 1){
                str1 += S[j];
                ones += 1;
            }else{
                str2 += S[j];
            }
        }
        reverse(str2.begin(), str2.end());
        string key = str1 + str2;
        hash1[ones][key] += 1;
    }

    long long ans = 0;
    for(i=0; i<(1<<N); i++){
        string str1 = "";
        string str2 = "";
        long long ones = 0;
        for(j=0; j<N; j++){
            if((i>>j) & 1){
                str1 += S[N+j];
                ones += 1;
            }else{
                str2 += S[N+j];
            }
        }
        reverse(str1.begin(), str1.end());
        string key = str1 + str2;
        ans += hash1[ones][key];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 68224
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

// #include <unordered_set>
// #include <unordered_map>

#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

#define pb push_back
#define mp make_pair

int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}

typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;

// #define int long long

signed main(){
  

    ios::sync_with_stdio(false);
    cin.tie(0);
	//cin高速化

	
	int a;
	cin>>a;

	cout<<48-a<<endl;
 	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, L;
    cin >> n >> L;

    ll ans = 0;
    exrep(i, L, L+n-1) {
        ans += i;
    }

    if(L+n-1 <= 0) {
        ans -= L+n-1;
    }
    else if(0 <= L) {
        ans -= L;
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n;
	cin >> n;
	pll* robot = new pll[n];
	rep(i, n) cin >> robot[i].first >> robot[i].second;
	rep(i, n) {
		ll t = robot[i].first;
		robot[i].first -= robot[i].second;
		robot[i].second += t;
	}
	sort(robot, robot + n);

	int ans = 0;
	ll x = robot[0].first;
	rep(i, n) {
		if (x <= robot[i].first) {
			++ans;
			x = robot[i].second;
		}
		else {
			if (x > robot[i].second) {
				x = robot[i].second;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

struct UnionFind {
  vector<int> par, rank;
  UnionFind(int n): par(n), rank(n) {
    rep(i,n) par[i] = i;
  }
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) par[x] = y;
    else {
      par[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
};

void solve() {
  int n, k, l;
  cin >> n >> k >> l;
  vector<int> p(k), q(k);
  rep(i,k) {
    cin >> p[i] >> q[i];
    p[i]--, q[i]--;
  }
  vector<int> r(l), s(l);
  rep(i,l) {
    cin >> r[i] >> s[i];
    r[i]--, s[i]--;
  }
  UnionFind road(n);
  UnionFind rail(n);
  rep(i,k) road.unite(p[i], q[i]);
  rep(i,l) rail.unite(r[i], s[i]);
  vector<pii> sav(n);
  map<pii, int> mp;
  rep(i,n) {
    sav[i].first = road.find(i);
    sav[i].second = rail.find(i);
    mp[sav[i]]++;
  }
  rep(i,n) {
    cout << mp[sav[i]] << " ";
  }
  cout << endl;
}

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

Measured memory_bytes: 20544
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  cin>>N;
  int x,y,p;
  int x1,x2,y1,y2;
  int x_y;
  rep(num_set,N){
    cin>>x>>y;
    x_y = (x+1)*(y+1);
    vector<vector<ll> > dp(y+2,vector<ll>(x+2,0));
    vector<bool> way(2*x_y,true);
    cin>>p;
    rep(i,p){
      cin>>x1>>y1>>x2>>y2;
      if(x1<x2) way.at(x_y + (x+1)*y1 + x2) = false;
      if(x1>x2) way.at(x_y + (x+1)*y1 + x1) = false;
      if(y1<y2) way.at((x+1)*y2 + x1) = false;
      if(y1>y2) way.at((x+1)*y1 + x1) = false;
    }

    /*rep(i,2*x_y){
      if(!way.at(i)) cout << i << ' ';
      }*/
    
    reps(i,1,y+2){
      reps(j,1,x+2){
	ll &now = dp.at(i).at(j);
	if(i == 1 && j == 1){
	  now = 1;
	  //cout<<dp.at(i).at(j)<<' ';
	  continue;
	}
	if(way.at((i-1)*(x+1)+j-1)) now += dp.at(i-1).at(j);
	if(way.at(x_y+(i-1)*(x+1)+j-1)) now += dp.at(i).at(j-1);
	//cout<<dp.at(i).at(j)<<' ';
      }
      //cout<<endl;
    }
    if(dp.at(y+1).at(x+1) != 0){
      cout<<dp.at(y+1).at(x+1)<<endl;
    }else{
      cout<<"Miserable Hokusai!"<<endl;
    }
  }	
}



Measured memory_bytes: 3160
package main

import (
	"fmt"
	"math"
)

func main(){
	n := 100.0
	var X int
	fmt.Scanf("%d",&X)
	i := 0
	for{
		n = math.Trunc(n*1.01)
		i++
		t := int(n)
		if t >= X{
			fmt.Println(i)
			break
		}
	}
}


Measured memory_bytes: 1820
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
  int l,r;
} range;

int cmp(const void *a,const void *b){
  range *p=(range *)a;
  range *q=(range *)b;
  return (p->r-p->l)-(q->r-q->l);
}

void add(int *bit,int l,int r){
  int n=bit[0];
  int i;
  for(i=l;i<=n;i+=i&-i) bit[i]++;
  for(i=r;i<=n;i+=i&-i) bit[i]--;
  return;
}

int get(int *bit,int index){
  int res=0;
  int i;
  for(i=index;i>0;i-=i&-i) res+=bit[i];
  return res;
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  range *a=(range *)malloc(sizeof(range)*n);
  int i;
  for(i=0;i<n;i++){
    int l,r;
    scanf("%d%d",&l,&r);
    a[i].l=l;
    a[i].r=r;
  }
  qsort(a,n,sizeof(range),cmp);
  int *bit=(int *)calloc(m+2,sizeof(int));
  bit[0]=m+1;
  int d;
  for(d=1,i=0;d<=m;d++){
    while(i<n && a[i].r-a[i].l+1<d){
      add(bit,a[i].l,a[i].r+1);
      i++;
    }
    int ans=n-i;
    int j;
    for(j=d;j<=m;j+=d) ans+=get(bit,j);
    printf("%d\n",ans);
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 4860
#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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    ll x, m;
    cin >> n >> x >> m;
    vector<ll> cnt(m, -1), c;
    ll ans = 0;
    ll num = x;
    ll sum = 0;
    ll idx = -1;
    for(ll i = 0; i < n; i++){
        if(cnt[num] != -1){
            idx = i;
            break;
        }
        else cnt[num] = i;
        c.push_back(num);
        if(i == n-1) break;
        num *= num;
        num %= m;
    }

    if(idx == -1){
        for(auto p: c) ans += p;
        cout << ans << endl;
        return 0;
    }

    for(int i = 0; i < cnt[num]; i++) ans += c[i];
    
    n -= cnt[num];
    for(int i = cnt[num]; i < idx; i++) sum += c[i];
    ans += sum*(n/(idx-cnt[num]));
    
    for(int i = 0; i < n%(idx-cnt[num]); i++) ans += c[i+cnt[num]];
    cout << ans << endl;
}

Measured memory_bytes: 4652
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

vector<string>sts(10);

int main() {
	sts[1] = ".,!? ";
	sts[2] = "abc";
	sts[3] = "def";
	sts[4] = "ghi";
	sts[5] = "jkl";
	sts[6] = "mno";
	sts[7] = "pqrs";
	sts[8] = "tuv";
	sts[9] = "wxyz";
	int n; cin >> n;
	while (n--) {
		string st; cin >> st;
		int select = 0;
		int now = -1;
		for (int i = 0; i < st.size(); ++i) {
			if (st[i] == '0') {
				if (select) {
					cout << sts[select][now];
				}
				select = 0;
				now = -1;
			}
			else {
				select = (st[i]-'0');
				now++;
				now %= sts[select].size();
				
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	int w[n];
	int sum = 0;
	for(int i=0;i<=n-1;i++){
		cin>>w[i];
		sum += w[i];
	}
	int minsum = sum;
	int prefixSum = 0;
	for(int j=0;j<=n-1;j++){
		prefixSum += w[j];
		minsum = min(minsum,(abs(2*prefixSum - sum)));
	}
	cout<<minsum<<endl;
}

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

int main() {
	string S;
	cin >> S;
	string res;
	int count_C = 0;
	for (int i=0; i<S.size(); ++i) {
		if (i==0) {
			if (S[i] != 'A') {
				res = "WA";
				break;
			}
		} else if (i>=2 && i< S.size()-1) {
			if (S[i] == 'C') {
				count_C++;
				if (count_C > 1) break;
			}
		}	else if (!(S[i] >= 'a' && S[i] <= 'z')) { 
			res = "WA";
		}
	}
	//cout << res << "lll" << endl;
	//cout << count_C << endl;
	if (res != "WA") {
		res = count_C == 1 ? "AC" : "WA"; 
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 256
H, W = map(int, input().split())
a = [""] * H
for i in range(H):
    a[i] = input()

row = [False] * H
col = [False] * W
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end = "")
        print()


Measured memory_bytes: 4468
using System;
using System.Linq;
using System.Collections.Generic;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();

            var maxVal = h[0];
            var count = 0;
            for(var i = 0; i < n; i++){
                if(maxVal <= h[i]){
                    count++;
                }
                maxVal = Math.Max(maxVal, h[i]);
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main(void){
   long long x;
   cin>>x;
   long long ans=x/11;
   ans*=2;
   if(x<=6){
      cout<<1<<endl;
   }else{
      if(x%11==0){
         cout<<ans<<endl;
      }else if(1<=x%11&&x%11<=6){
         cout<<ans+1<<endl;
      }else{
         cout<<ans+2<<endl;
      }
   }
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		int count = 0;
		boolean c = true;

		Scanner sc = new Scanner(System.in);

		while(sc.hasNext()){

			int sum=sc.nextInt();

			for(int i=0; i<10; i++){
				for(int j=0; j<10; j++){
					for(int k=0; k<10; k++){
						for(int l=0; l<10; l++){
							if(i+j+k+l==sum) count++;
						}
					}
				}
			}
			System.out.println(count);
			count=0;
		}
	}
}

Measured memory_bytes: 17028
/*input
2 3
1 2 3
0 1 1
*/

#include <bits/stdc++.h>
using namespace std;
int grid[505][505];

int main()
{
	int n, x;
	scanf("%d %d", &n, &x);
	int g = 0;
	for(int i = 1; i<=n; i++){
        int a;
        scanf("%d", &a);
        a = abs(a - x);
        if(a != 0) g = __gcd(g, a);
	}
	printf("%d\n", g);

	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	int N, Q;
	string S;
	cin >> N >> Q >> S;
	vector<lint>L(Q);
	vector<lint>R(Q);
	rep(i, Q) {
		cin >> L[i] >> R[i];
	}
	vector<lint>sum(N);
	int s = 0;
	for (int i = 1; i < N; i++) {
		if (S[i - 1] == 'A' && S[i] == 'C')s++;
		sum[i] = s;
	}
	lint ans = 0;
	vector<lint>ANS(Q);
	rep(i, Q) {
		if (L[i] != 1) {
			ans = sum[R[i] - 1] - sum[L[i] - 2];
		}
		else {
			ans = sum[R[i] - 1];
		}
		if (L[i] != 1) {
			if (S[L[i] - 2] == 'A' && S[L[i] - 1] == 'C') {
				ans--;
			}
		}
		
		ANS[i] = ans;
		ans = 0;
	}
	rep(i, Q) {
		cout << ANS[i] << endl;
	}
}


Measured memory_bytes: 4224
#include <math.h>
#include <stdio.h>
int main(void){
    double x1,y1,x2,y2;
    double distance;
    
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    
    distance=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    
    printf("%f\n",distance);
    
    return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n;
  cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  ll arr[n];
  fi(0, n)
    cin >> arr[i];

  int doing = 1;
  while(doing) {
    int all0 = 1;
    int tostart = 1;
    fi(0, n) {
      if(arr[i]) {
        all0 = 0;
        arr[i]--;
        if(tostart) {
          tostart = 0;
          ans++;
        }
      }
      else{
        tostart = 1;
      }
    }
    doing = all0 == 0;
  }
  cout << ans << endl;
  return 0;
}



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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    //cin>>testcase;
    for(int p=0;p<testcase;p++){
    ll n;
    cin>>n;
    int array[n]={0};
    float sum=0;
    for(int i=0;i<n;i++){
        cin>>array[i];
        sum+=array[i];
    }
    //sort(array,array+n);
    sum=sum/n;
    int xy=floor(sum);
    int xz=ceil(sum);
    ll stamina1=0;
    ll stamina2=0;
    for(int i=0;i<n;i++){
        stamina1+=pow((xy-array[i]),2);
        stamina2+=pow((xz-array[i]),2);
        
    }
    cout<<min(stamina2,stamina1);
    
      
        
    }

    return 0;
}


Measured memory_bytes: 256