akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
struct point{
	double x,y;
	point(){}
	point(double _x,double _y){
		x=_x;y=_y;
	}
	point operator +(const point &b) const{
		return point(x+b.x,y+b.y);
	}
	point operator -(const point &b) const{
		return point(x-b.x,y-b.y);
	}
	double operator ^(const point &b) const{
		return (x*b.x)+(y*b.y);
	}
	double operator *(const point &b) const{
		return x*b.y-y*b.x;
	}
	point operator *(const double &b) const{
		return point(x*b,y*b);
	}
};
double len(point p){
	return (p.x*p.x+p.y*p.y);
}
int main(){
	point p0,p1,p2,p3;
	int q;
	cin>>q;
	while(q--){
		cin>>p0.x>>p0.y>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y;
		if((p1-p0)*(p3-p2)==0) puts("2");
		else if(((p1-p0)^(p3-p2))==0) puts("1");
		else puts("0");
	}
	return 0;
}


Measured memory_bytes: 3224
def maxvolume( s ): 
  
    # finding length 
    length = s / 3 
      
    s -= length 
      
    # finding breadth 
    breadth = s / 2
      
    # finding height 
    height = s - breadth 
      
    return round(length * breadth * height,12)
      
# Driven Program 
s = int(input())
print( maxvolume(s) ) 


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,char> P;
P a[9];

bool check(P x,P y,P z){
  if(x.second!=y.second||y.second!=z.second)return false;
  if(x.first==y.first&&y.first==z.first)return true;
  if(x.first+1==y.first&&y.first+1==z.first)return true;
  return false;
}

int main(){
  int Tc;
  cin>>Tc;
  while(Tc--){
    for(int i=0;i<9;i++)cin>>a[i].first;
    for(int i=0;i<9;i++)cin>>a[i].second;
    sort(a,a+9);
    int ans=0;
    do{
      ans=1;
      for(int i=0;i<9;i+=3){
        if(!check(a[i],a[i+1],a[i+2])){
          ans=0;
        }
      }
      if(ans==1)break;
    }while(next_permutation(a,a+9));
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int N = Integer.parseInt(in.next());
		SortedMap<Integer,Integer> list = new TreeMap<Integer,Integer>();
		for (int i = 0; i < N; i++){
			list.put(Integer.parseInt(in.next()),Integer.parseInt(in.next()));
		}
		System.out.println(list.lastKey()+list.get(list.lastKey()));
	}
}

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back

using namespace std;

typedef long long ll;
const int N = 1e6 + 5;
const int inf = 1e9 + 7;

int fac[N], bin[N];

ll binpow(int a, int b) {
	if (b == 0) return 1;
	if (b & 1) return (1ll * binpow(a, b - 1) * a) % inf;
	ll btwo = binpow(a, b / 2);
	return (1ll * btwo * btwo) % inf;
}

ll cnk(int n, int k) {
	return 1ll * fac[n] * binpow(fac[k], inf - 2) % inf * binpow(fac[n - k], inf - 2) % inf;
}

void solve() {
	int h, w, a, b;
	ll ans = 0;

	cin >> h >> w >> a >> b;
	a ++;
	
	fac[0] = fac[1] = 1;
	for (int i = 1; i < N; i ++) {
		fac[i] = (1ll * fac[i - 1] * i) % inf;
	}
	
	for (int i = b; i < w; i ++) {
		ans = (ans + 1ll * cnk(i + h - a, i) * cnk(w - i + a - 3, w - i - 1) % inf) % inf;
	}
	cout << ans << endl;
}

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





Measured memory_bytes: 6016
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;

struct TopologicalSort
{
    int V;
    vector<int> res, deg, used;
    vector<vector<int>> G;
    TopologicalSort(int v) : V(v)
    {
        deg.resize(V, 0);
        used.resize(V, 0);
        G.resize(V);
    }
    void add_edge(int s, int t)
    {
        G[s].push_back(t);
        deg[t]++;
    }
    void bfs(int s)
    {
        queue<int> que;
        used[s] = 1;
        que.push(s);
        while(que.size())
        {
            int v = que.front(); que.pop();
            res.push_back(v);
            for(auto &u : G[v])
            {
                if(used[u]) continue;
                deg[u]--;
                if(deg[u] == 0)
                {
                    used[u] = 1;
                    que.push(u);
                }
            }
        }
    }
    vector<int> build()
    {
        for(int i = 0; i < V; i++)
        {
            if(used[i] or deg[i] > 0) continue;
            bfs(i);
        }
        return res;
    }
};

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int V, E; cin >> V >> E;
    TopologicalSort topolo = TopologicalSort(V);
    for(int i = 0; i < E; i++)
    {
        int s, t; cin >> s >> t;
        topolo.add_edge(s, t);
    }
    auto ans = topolo.build();
    for(auto &x : ans) cout << x << endl;
    return 0;
}




Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
#define pb() push_back()
#define elif else if
#define all(x) x.begin(),x.end()
//function
int shizuku(int);
//UnionFind
struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};

signed main(){
    int pow,D,G,N,M,X,count=0,count2=0;
    double d;
    int C='A'-'a';
    char op;
    str S,T;
    cin>>N>>M;
    vint x(N);
    vint ab(N);
    rep(0,N){
      cin>>x[i];
      ab[i]=abs(M-x[i]);
    }
    sort(all(ab));
    D=__gcd(ab[0],ab[1]);
    rep(0,N){
      D=__gcd(ab[i],D);
    }
    cout<<D<<endl;
}


Measured memory_bytes: 1792
//“ In order to be irreplaceable, one must always be different”
#include<bits/stdc++.h>
using namespace std;
#define ll long long
# define pi 3.14159265359
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
//assign() assignes new value
//emplace(position,x) inserting
//erase(position) to remove an element
//swap() for swapping
//reverse(position,position) for reversing
# define pb push_back
# define popb pop_back
# define pf push_front
# define popf pop_front
# define sll set<ll>
# define schar set<char>
//find()
//erase(x) removes element x
//erase(position,position)
# define qll queue<ll>
# define qstr queue<str>
//front(),back()
# define stll stack<ll>
# define ststr stack<str>
//top()
# define dll deque<ll>
//at()
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define mss map<str,str>
# define mci map<char,ll>
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
ll lcm(ll a, ll b)  
{  
    return (a*b)/gcd(a, b);  
}

vstr v;
void permute(string a, int l, int r) 
{ 
	// Base case 
	if (l == r) 
		v.pb(a); 
	else
	{ 
		// Permutations made 
		for (int i = l; i <= r; i++) 
		{ 

			// Swapping done 
			swap(a[l], a[i]); 

			// Recursion called 
			permute(a, l+1, r); 

			//backtrack 
			swap(a[l], a[i]); 
		} 
	} 
} 



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll x;
    cin>>x;
    str s="";
    vchar vc,vc1,vc2;
    str s1,s2;
    s1="";
    s2="";
   for(ll i=0;i<x;i++){
       char f;
       cin>>f;
       s1+=f;       vc.pb(f);
       vc2.pb(f);
   }
   for(ll i=0;i<x;i++){
       char f;
       cin>>f;
       s2+=f;
       vc1.pb(f);
   }
   sort(vc2.begin(),vc2.end());
   for(ll i=0;i<vc2.size();i++){
       s+=vc2[i];
   }
   ll k,k1;
    permute(s, 0, s.length()-1); 
    sort(v.begin(),v.end());
    for(ll i=0;i<v.size();i++){
       // cout<<v[i]<<" ";
        if(v[i]==s1){
            k=i+1;
        }
        if(v[i]==s2){
            k1=i+1;
        }
    }
    cout<<abs(k-k1);
    return 0;
}
   

		
	
	
	
	
	
	
	
	
	
	
	

Measured memory_bytes: 2552
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
	int n,k;
	cin>>n;
	while(cin>>n>>k){
		vector<int> x(n);
		REP(i,n)cin>>x[i];
		sort(x.begin(),x.end());
		vector<int> diff(n-1);
		REP(i,n-1)diff[i] = x[i+1]-x[i];
		sort(diff.begin(),diff.end());
		int ans = 0;
		for(int i = 0; i < (n-1) - (k-1); i++){
			ans += diff[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <queue>
using namespace std;
int n;
bool flag=false;
void bfs(){
	queue<long long>q;
	for(int i=1;i<=9;++i){
		q.push(i);
	}
	while(!q.empty()){
		long long cur=q.front();
		q.pop();
		--n;
		if(n==0){
			printf("%lld\n",cur);
			return;
		}
		if(cur%10!=0)q.push(cur*10+cur%10-1);
		q.push(cur*10+cur%10);
		if(cur%10!=9)q.push(cur*10+cur%10+1);
	}
}
int main(){
	scanf("%d",&n);
	bfs();
	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll n;
    cin >> n;
    ll m = 100;
    ll ans = 0;
    while(m<n){
        m*=1.01;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)

int N;
string S[10100];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>S[i];
	}
	int ans=0;
	REP(i,N){
		REP(j,S[i].size()-1){
			if(S[i][j]=='A'&&S[i][j+1]=='B'){
				ans++;
			}
		}
	}
	int a=0,b=0,ab=0;
	REP(i,N){
		if(S[i][0]=='B'&&S[i][S[i].size()-1]!='A'){
			b++;
		}
		else if(S[i][S[i].size()-1]=='A'&&S[i][0]!='B'){
			a++;
		}
	}
	REP(i,N){
		if(S[i][0]=='B'&&S[i][S[i].size()-1]=='A'){
			ab++;
		}
	}
	if(ab>0){
		ans+=ab-1;
		DEB(ans)END
		if(a>0){
			ans++;
			a--;
		}
		if(b>0){
			ans++;
			b--;
		}
		ans+=min(a,b);
		cout<<ans<<endl;
	}
	else{
		ans+=min(a,b);
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 768
use petgraph::graph::{NodeIndex, UnGraph};
use proconio::{fastout, input};
use std::cmp::max;
use std::collections::HashMap;
use std::collections::VecDeque;

#[fastout]
fn main() {
    input! {
        n: usize,
        edges: [(u32, u32); n - 1]
    }
    let mut max_color = 1u32;
    let graph = UnGraph::<u32, ()>::from_edges(&edges);
    let mut colors_map = HashMap::new();
    let mut queue = VecDeque::new();
    queue.push_back((NodeIndex::new(1), 0u32));
    let mut visited = vec![false; n + 1];
    while !queue.is_empty() {
        let poped: (NodeIndex, u32) = queue.pop_front().unwrap();
        let i = poped.0;
        let used_color = poped.1;
        let mut color = 1u32;
        for j in graph.neighbors_undirected(i) {
            if visited[j.index()] {
                continue;
            }
            if color == used_color {
                color += 1;
            }
            if i.index() < j.index() {
                colors_map.insert((i.index(), j.index()), color);
            } else {
                colors_map.insert((j.index(), i.index()), color);
            }
            max_color = max(max_color, color);
            queue.push_back((j, color));
            color += 1;
        }
        visited[i.index()] = true;
    }
    println!("{}", max_color);
    for (i, j) in edges.iter() {
        println!("{}", colors_map.get(&(*i as usize, *j as usize)).unwrap());
    }
}


Measured memory_bytes: 11760
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

int inputValue();
void inputArray(int *, int);
void inputVector(vector<int> *, int);
template <typename T> void output(T, int);
int gcd(int a, int b);

int main() {
    // source
    int a, b;
    cin >> a >> b;

    cout << max(a + b, max(a - b, a * b)) << endl;
    return 0;
}

int inputValue() {
    int a;
    cin >> a;
    return a;
}

void inputArray(int *p, int a) {
    rep(i, a) { cin >> p[i]; }
}

void inputVector(vector<int> *p, int a) {
    rep(i, a) {
        int input;
        cin >> input;
        p->push_back(input);
    }
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

int gcd(int a, int b) {
    if (b > a) {
        int temp = a;
        a = b;
        b = temp;
    }
    if (b == 0) {
        return a;
    }
    return (b, b % a);
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  cout << 3 * r * r << endl;

  return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int n, T;
	cin >> n >> T;
	int start = 0;
	int end = 0;
	int count = 0;
	rep(i, n) {
		int now;
		cin >> now;
		if (now >= end) {
			count += end - start;
			start = now;
			end = now + T;
		}
		else if (start <= now && now < end) {
			end = now + T;
		}
		if (i == n - 1) {
			count += end - start;
		}
	    //cout << "s" << start << endl;
		//cout <<"e"<< end << endl;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
import numpy as np

rate = [0,2,5,5,4,5,6,3,7,6]

N,M = list(map(int, input().split()))
a = list(map(int, input().split()))
# a = np.sort(a)[::-1]

dp = [-1e+8] * (N + 1)
dp[0] = 0
for i in range(N+1):
    for aa in a:
        if i >= rate[aa]:
            dp[i] = max([dp[i], dp[i-rate[aa]]*10 + aa])
print(dp[-1])

Measured memory_bytes: 23464
#include<iostream>
using namespace std;
int main()
{
  //文字列s,tの入力
  string s, t;
  cin >> s >> t;
  //s,tの数の入力
  int a, b;
  cin >> a >> b;
  //文字列uの入力
  string u;
  cin >> u;
  
  if (u == s) {
    a = a - 1;
  } else {
    b = b - 1;
  }
  
  cout << a << " " << b << endl;
  
  return 0;
}

Measured memory_bytes: 256
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####
def solve(K,S):
    if len(S) <= K: return S
    return S[:K] + '...'
print solve(rri(), rr())


Measured memory_bytes: 64292
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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

int inival=INT32_MAX;

struct RMQ{
    vector<int> data;
    int nodes;

    RMQ(int N){
        nodes=1;
        while(nodes<N) nodes*=2;
        data.resize(nodes*2);
        for(int i=0;i<data.size();++i) data[i]=inival;
    }

    void update(int k,int a){  //要素kをa
        k+=nodes-1;
        data[k]=a;
        while(k>0){
            k=(k-1)/2;
            data[k]=min(data[k*2+1],data[k*2+2]);
        }
    }

    int query(int a,int b,int k,int l, int r){ //mainから呼び出すときは(a,b,0,0,n)
        if(r<=a||b<=l)return INT32_MAX;

        if(a<=l&&r<=b) return data[k];
        int vl=query(a,b,k*2+1,l,(l+r)/2);
        int vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }

};


int main() {
    int N,Q; cin>>N>>Q;
    RMQ rmq(N);
    int com,x,y;
    for (int i = 0; i < Q; ++i) {
        cin>>com>>x>>y;
        if(com==0){
            rmq.update(x,y);
        }else{
            cout<<rmq.query(x,y+1,0,0,rmq.nodes)<<endl;
        }
    }
    /*
    for (int i = 0; i < 2 * N; ++i) {
        cout<<i<<":"<<rmq.data[i]<<endl;
    }
    */

    return 0;
}


Measured memory_bytes: 3812
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

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

    auto cnt = 0;
    for (auto i = 0; i < s.length(); ++i)
        cnt += (s[i] != t[i]);

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3920
import java.lang.reflect.Array;
import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int h = scanner.nextInt();
        final int w = scanner.nextInt();

        final char[][] board = new char[h][w];

        scanner.nextLine();

        for (int i = 0; i < h; i++) {
            board[i] = scanner.nextLine().toCharArray();
        }

        final int[][] tate = new int[h][w];
        final int[][] yoko = new int[h][w];

        for (int i = 0; i < h; i++) {
            int accum = 0;
            int start = 0;
            for (int j = 0; j < w; j++) {
                if (board[i][j] == '.') {
                    accum++;
                    continue;
                }

                for (int k = start; k < j; k++) {
                    yoko[i][k] = accum;
                }
                accum = 0;
                start = j + 1;
            }

            for (int k = start; k < w; k++) {
                yoko[i][k] = accum;
            }
        }
        
        for (int i = 0; i < w; i++) {
            int accum = 0;
            int start = 0;
            for (int j = 0; j < h; j++) {
                if (board[j][i] == '.') {
                    accum++;
                    continue;
                }

                for (int k = start; k < j; k++) {
                    tate[k][i] = accum;
                }
                accum = 0;
                start = j + 1;
            }

            for (int k = start; k < h; k++) {
                tate[k][i] = accum;
            }
        }

        int result = 0;
        for(int i = 0;i<h;i++){
            for(int j = 0;j<w;j++){
                if(result < tate[i][j] + yoko[i][j] - 1){
                    result = tate[i][j] + yoko[i][j] -1;
                }
            }
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 92496
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = Math.abs(x - sc.nextInt());
		int b = Math.abs(x - sc.nextInt());

		if(a < b) {
			System.out.println("A");
		} else {
			System.out.println("B");
		}
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;

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

    int ans = 0;

    switch (str_scan) {
      case "RSS":
        ans=1;
        break;
      case "SRS":
        ans=1;
        break;
      case "RSR":
        ans=1;
        break;
      case "SSR":
        ans=1;
        break;
      case "SRR":
        ans=2;
        break;
      case "RRS":
        ans=2;
        break;
      case "RRR":
        ans=3;
        break;
      default:
        ans=0;
    }

    System.out.println(ans);
    scan.close();
  }
}

Measured memory_bytes: 35660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int  a,b;
  cin >> a>>b;
  
  cout << (a%500<=b? "Yes":"No") << endl;

  
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    if (!(cin >> N)) { return; }
    map<ll, ll> f;
    ll count = 1;
    auto fun = [](ll k){ return k % 2 ? 3* k + 1: k / 2;};
    while(f.count(N) == 0){
        f[N]++;
        N = fun(N);
        count++;
    }
    cout << count << endl;

}

int main(int argc, char *argv[]) {
    string FileName("D"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    // /home/USER/.../MEPH_X -> MEPH_X
    if (sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size() - ExecutionName.size(), ExecutionName.size());

    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while (cin) { solve(cin); }
    } else {
        cerr << sub << " test" << endl;
        string inFile = FileName + ".txt";
        auto fs = fstream(inFile, fstream::in);
        while (fs) { solve(fs); }
    }
}


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

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

int cnt[10000], kek[200001][10];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, p;
    string s;
    cin >> n >> p >> s;
    int rem = 0;
    cnt[0] = 1;
    reverse(s.begin(), s.end());
    ll ans = 0, a1 = 0, a2 = 0, dv = 1;
    for (int i = 0; i < n; i++) {
        rem += (s[i] - '0') * dv;
        rem %= p;
        dv *= 10;
        dv %= p;
        ans += cnt[rem];
        cnt[rem]++;
        if (i != 0)
            for (int j = 0; j < 10; j++)
                kek[i][j] = kek[i-1][j];
        kek[i][s[i]-'0']++;
        a1 += kek[i][0] + kek[i][2] + kek[i][4] + kek[i][6] + kek[i][8];
        a2 += kek[i][0] + kek[i][5];
    }
    if (p == 2)
        cout << a1;
    else if (p == 5)
        cout << a2;
    else
        cout << ans;

    return 0;
}


Measured memory_bytes: 8468
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long d = long.Parse(input[0]);
		long g = long.Parse(input[1]);
    long[,] vertexes = new long[d,2];
    long answer = long.MaxValue;
    long scoreMemo = 0;//得点
    long tookCountMemo = 0;//とった数
    for(long i = 0; i < d; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
      vertexes[i,0] = nums[0];
      vertexes[i,1] = nums[1];
    }

    for(long i = 0; i < (1 << (int)d); i++)//bit全探索
    {
      scoreMemo = 0;
      tookCountMemo = 0;
      for(long checkDigit = 0; checkDigit < d; checkDigit++)//右からcheckDigit桁目を見る
      {
        if((i & (1<<(int)checkDigit)) != 0)//右からcheckDigit番目が1ならば
        {
          scoreMemo += vertexes[checkDigit,0]*(checkDigit+1)*100 + vertexes[checkDigit,1];
            //checkDigit番目はすべてとったと仮定
            tookCountMemo += vertexes[checkDigit,0];
        }
      }
      //Console.WriteLine(i + " " + scoreMemo + " " + tookCountMemo);
      if(scoreMemo >= g)
      {
        answer = Math.Min(answer, tookCountMemo);
      }
      else
      {
        for(long checkDigit = 0; checkDigit < d; checkDigit++)//右からcheckDigit桁目を見る
        {
          if((i & (1<<(int)checkDigit)) == 0)//右からcheckDigit番目が0ならば
          {
            if(g-scoreMemo <= (vertexes[checkDigit,0]-1)*(checkDigit+1)*100)
              //1種の追加で得点が可能ならば
            {
              long t = tookCountMemo + (g-scoreMemo+checkDigit*100) / ((checkDigit+1)*100);
              //Console.WriteLine(i + " " + scoreMemo + " " + t);
              answer = Math.Min(answer, t);
            }
          }
        }
      }
    }
    
		Console.WriteLine(answer);
	}
}


Measured memory_bytes: 13268
N = int(input())
S = list(input())

w = S.count('W')
r = N - w
bad_w = S[:r].count('W')
bad_r = S[r:].count('R')

if w == 0 or r == 0:
    print(0)
else:
    print(min(bad_r, bad_w))


Measured memory_bytes: 77940
str = gets.strip.chars

longest = 0

str.length.times do |i|
  len = 0
  i.upto(str.length - 1) do |j|
    if %w(A C G T).include?(str[j])
      len += 1
    else
      break
    end
  end
  longest = [longest, len].max
end

puts longest


Measured memory_bytes: 1788
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num, cnt = 1, [], 0

if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        ans = ans * i % mod
    print(ans)
    exit()

for _ in range(k):
    if len(mia) == 0 or (len(pla) > 0 and abs(mia[-1]) <= pla[-1]):
        tmp = pla.pop()
    elif len(pla) == 0 or (len(mia) > 0 and abs(mia[-1]) > pla[-1]):
        tmp = mia.pop()
        cnt += 1
    num.append(tmp)
    ans = ans * tmp % mod

if cnt % 2 == 1:
    p, q, r, s = 1, 0, -1, 0
    if len(mia) > 0 and cnt != k:
        p, q = min(i for i in num if i >= 0), mia[-1]
    if len(pla) > 0:
        r, s = max(i for i in num if i < 0), pla[-1]
    if len(mia) > 0 or (len(pla) > 0 and cnt != k):
        if q * r >= p * s:
            ans *= q * pow(p, mod - 2, mod)
        if q * r < p * s:
            ans *= s * pow(r, mod - 2, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 31772
N, K = map(int,input().split())
C = list(map(int,input().split()))

K -= 1
D = 10**9
for i in range(N-K):
    d = C[i+K] - C[i]
    L = d + abs(0 - C[i])
    R = d + abs(0 - C[i+K])
    D = min(D,min(L,R))

print(D)


Measured memory_bytes: 19992
#include <bits/stdc++.h>
#include <iostream>
#define M 101

using namespace std;

int main(){
	deque<char> S, rS;
	string ts;
	cin >> ts;
	for (int i = 0; i<ts.length(); i++){
		S.push_back((char)ts[i]);
	}
	rS = S;
	reverse(rS.begin(), rS.end());
	int Q;
	int T, F;
	char C;
	cin >> Q;
	for (int i = 0; i<Q; i++){
		cin >> T;
		if (T == 1){
			swap(S, rS);
		} else {
			cin >> F >> C;
			if (F == 1){
				S.push_front(C);
				rS.push_back(C);
			} else {
				rS.push_front(C);
				S.push_back(C);
			}
		}
	}
	for (int i = 0; i<S.size(); i++){
		cout << S[i];
	}
	cout << endl;
}
			
		


Measured memory_bytes: 1280
from sys import stdin

# 1行だけ読むやつ

N = int(stdin.readline().rstrip().split()[0])
Sum = 0

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
        continue
    else:
        Sum += i

print(Sum)

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

int main(){
   int n;
   int ans=0;
   cin >>n;
   vector<int> a(n);
   for(int i=0;i<n;i++){
      cin >>a.at(i);
   }
   int i=1;
   bool flag_ud=true;
   bool flag_up=false;
   bool flag_down=false;
   while(i<n){
      if(flag_ud){
         if(a.at(i)>a.at(i-1)){
            flag_up=true;
            flag_ud=false;
         }
         else if(a.at(i)<a.at(i-1)){
            flag_down=true;
            flag_ud=false;
         }
      }
      if(flag_up){
         if(a.at(i-1)>a.at(i)){
            ans++;
            flag_ud=true;
            flag_up=false;
         }
      }
      if(flag_down){
         if(a.at(i-1)<a.at(i)){
            ans++;
            flag_ud=true;
            flag_down=false;
         }
      }
      i++;
   }
   cout <<ans+1 <<endl;
}

Measured memory_bytes: 640
n = str(input())
if(n[-1] == '3'):
    print('bon')
if(n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9'):
    print('hon')
if(n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8'):
    print('pon')

Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k){
        cout << s << endl;
    }
    else{
        cout << s.substr(0, k) << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3644
#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<ll,ll>;

int main(){
    int n,m;
    cin >> n >>m;
    vector<vector<int>> to(n,vector<int>(n));
    rep(i,n) rep(j,n) to[i][j]=0;
    
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        to[a][b]=1;
        to[b][a]=1;
    }
    
    vector<int> perm;
    rep(i,n-1){
        perm.push_back(i+1);
    }
    int res = 0;
    do{
        int temp = 0;
        bool flag = true;
        rep(i,perm.size()){
            if(to[temp][perm[i]]!=1){
                flag=false;
                continue;
            }
            temp = perm[i];
        }

        if(flag){
            res++;
        }

    }while(next_permutation(perm.begin(),perm.end()));

    cout << res << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
ll euclidean_gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  rep(i,n){
    int x;
    cin >> x;
    int s = min(x,k-x);
    ans += 2*s;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iomanip>
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
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


vector<string> grid(50);
mat dist(50,vec(50,-1));
vector<vector<bool> > used(50,vector<bool>(50,false));
bool check(ll y, ll x){
    if(x < 0 || x >= W) return false;
    if(y < 0 || y >= H) return false;
    if(grid[y][x] == '#') return false;
    if(dist[y][x] != -1) return false;
    if(used[y][x] == true) return false;
    return true;
}

int main(){
    cin>>H>>W;
    rep(i,H) cin>>grid[i];
    queue<P> que;
    que.emplace(0,0);
    vec dy = {-1,0,1,0}, dx = {0,-1,0,1};
    while(!que.empty()){
        P p = que.front();
        que.pop();
        ll y = p.fi / W, x = p.fi % W;
        dist[y][x] = p.se;
        used[y][x] = true;
        if(y == H-1 && x == W-1) break;
        ++p.se;
        rep(i,4) {
            if (check(y + dy[i], x + dx[i])) {
                que.emplace(p.fi + dy[i]*W + dx[i], p.se);
                used[y + dy[i]][x + dx[i]] = true;
            }
        }
    }
    /*rep(i,H){
        rep(j,W) cout<<dist[i][j]<<' ';
        cout<<endl;
    }*/
    if(dist[H-1][W-1] == -1) {
        cout<<-1<<endl;
    }else {
        ll ans = 0;
        rep(i, H) rep(j, W) ans += grid[i][j] == '.';
        ans -= dist[H-1][W-1] + 1;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		
		int len[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			len[i] = sc.nextInt();
		}
		
		int count = 0;
		int tmpArray[] = new int[3];
		for(int i = 0; i < n; i++) {
			for(int j = i + 1; j < n; j++) {
				for(int k = j + 1; k < n; k++) {
					tmpArray[0] = len[i];
					tmpArray[1] = len[j];
					tmpArray[2] = len[k];
					
					Arrays.sort(tmpArray);
					
					if(tmpArray[0] != tmpArray[1] && 
							tmpArray[1] != tmpArray[2] && 
							tmpArray[0] + tmpArray[1] > tmpArray[2]) {
						count++;
					}
				}
			}
		}
		
		System.out.println(count);
	}
}


Measured memory_bytes: 28232
s = input()
t_list = ['dream', 'dreamer', 'erase', 'eraser']
ans = 'YES'
while len(s) > 0:
  for t in t_list:
    if s.endswith(t):
      s = s[:-len(t)]
      break
  else:
    ans = 'NO'
    break
print(ans)

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

typedef long long ll;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ll MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0) ;

ll arrA[100005], arrB[100005], price[100005] ;

int main()
{
    ll a, b, m, x, y, z ;
    cin >> a  >> b >> m ;
    for (int i = 1; i <= a; i++)    cin >> arrA[i] ;
    for (int i = 1; i <= b; i++)    cin >> arrB[i] ;
    for (int i = 1; i <= m; i++) {
        cin >> x >> y >> z ;
        price[i - 1] = arrA[x] + arrB[y] - z ;
    }
    sort(arrA + 1, arrA + a + 1) ;
    sort(arrB + 1, arrB + b + 1) ;
    sort(price, price + m) ;
    cout << min(price[0], arrA[1] + arrB[1]) ;

    return 0 ;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

template <typename T>
class SegmentTree {
    public:
        int n;
        vector<T> data;
        T e;
        function<T(T, T)> operation;
        function<T(T, T)> process;

        SegmentTree() {}
        SegmentTree(int n_, T e_, function<T(T, T)> operation_, 
            function<T(T, T)> process_) : e(e_), operation(operation_), process(process_) {
            n = 1;
            while (n < n_) n <<= 1;
            data.assign(2 * n, e);
        }

        T query(int a, int b) {
            return query(a, b + 1, 1, 0, n);
        }

        T query(int a, int b, int k, int l, int r) {
            if (a >= r || b <= l) return e;
            if (a <= l && b >= r) return data[k];
            T c = query(a, b, 2 * k + 0, l, (l + r) / 2);
            T d = query(a, b, 2 * k + 1, (l + r) / 2, r);
            return operation(c, d);
        }

        void update(int idx, T v) {
            idx += n;
            data[idx] = process(data[idx], v);
            while (idx >>= 1) {
                data[idx] = operation(data[2 * idx + 0], data[2 * idx + 1]);
            }
        }

        T operator[](int idx) {
            return data[idx];
        }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, q;
    string s;
    cin >> n >> s >> q;
    SegmentTree<ll> seg = SegmentTree<ll>(n, 0LL, 
            [](ll a, ll b) {return a | b; }, [](ll a, ll b) { return 1 << b; });
    rep (i, s.size()) seg.update(i, s[i] - 'a');
    rep (_, q) {
        int t;
        cin >> t;
        if (t == 1) {
            int idx;
            char c;
            cin >> idx >> c;
            idx--;
            seg.update(idx, c - 'a');
        } else {
            int res = 0;
            int l, r;
            cin >> l >> r;
            l--, r--;
            auto t = seg.query(l, r);
            cout << __builtin_popcount(t) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 11888
// Code by ajcxsu
// Problem: namori grundy

#include<bits/stdc++.h>
using namespace std;

const int N=2e5+10;
int h[N], to[N], nexp[N], p=1;
inline void ins(int a, int b) { nexp[p]=h[a], h[a]=p, to[p]=b, p++; }

char tak[N], vis[N], viis[N];
int mex[N], smex[N], cir[N], nd[N], fa[N], idx, flag;
void dfs2(int x) {
    int siz=0;
    for(int u=h[x];u;u=nexp[u])
        if(!cir[to[u]]) dfs2(to[u]), ++siz;
    fill(tak, tak+siz+5, 0);
    for(int u=h[x];u;u=nexp[u])
        if(!cir[to[u]]) tak[mex[to[u]]]=1;
    for(mex[x]=0;tak[mex[x]];mex[x]++);
    for(smex[x]=mex[x]+1;tak[smex[x]];smex[x]++);
}

int rm[N];

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    cin>>n;
    int u;
    for(int i=1;i<=n;i++) cin>>fa[i], ins(fa[i], i);
    int na=1, rt;
    while(!vis[na]) vis[na]=1, na=fa[na];
    rt=na;
    do { cir[na]=++idx, nd[idx]=na, na=fa[na]; } while(rt!=na);
    for(int i=1;i<=idx;i++) dfs2(nd[i]);
    rm[1]=mex[nd[1]];
    for(int i=2;i<=idx;i++)
        rm[i]=(rm[i-1]==mex[nd[i]]?smex[nd[i]]:mex[nd[i]]);
    if(rm[idx]!=rm[1]) cout<<"POSSIBLE"<<endl, exit(0);
    rm[1]=smex[nd[1]];
    for(int i=2;i<=idx;i++)
        rm[i]=(rm[i-1]==mex[nd[i]]?smex[nd[i]]:mex[nd[i]]);
    // for(int i=1;i<=idx;i++) cout<<mex[i]<<" \n"[i==idx];
    if(rm[idx]==mex[nd[1]]) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 7680
#include <iostream>
#include <cmath>
#include <vector>

int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<bool> vec(N);

    for (int i = 0; i < K; ++i) {
        int d;
        std::cin >> d;
        for (int j = 0; j < d; ++j) {
            int A;
            std::cin >> A;
            vec.at(A-1) = true;
        }
    }

    int sum = 0;
    for (auto v : vec){
        if (!v) sum++;
    }

    std::cout << sum << std::endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<list>
#include<set>
using namespace std;
//配列の要素を順番に出力
void trace(int a[],int n){
  int i;
  for(i=0;i<n;i++){
    if(i>0){
      printf(" ") ; //隣接する要素の間に一つの空白を出力
    }
    cout << a[i];
  }
  printf("\n");
}
void insertionSort(int a[],int n){
  int j,i,v;
  for(int i=1;i<n;i++){
    v=a[i];
    j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    trace(a,n);
  }
}
int main(){
  int n,i,j;
  int a[100];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  trace(a,n);
  insertionSort(a,n);

  return 0;
}



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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	string n; cin >> n;

	int hon[] = {2,4,5,7,9};
	int pon[] = {0,1,6,8};
	int bon = 3;
	for(int t : hon){
		if((n.back()-'0') == t){
			cout << "hon" << endl;
			return 0;
		}
	}
	for(int t : pon){
		if((n.back()-'0') == t){
			cout << "pon" << endl;
			return 0;
		}
	}
	cout << "bon" << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main() {

  int n;
  int a[1000000];
  int i,j,k,t;
  int b,c;


  while(1) {
    scanf("%d",&n);

    if(n == 0) break;

    k = 0;
    c = 0;
  
    for(i=0;i<n;i++) {

      scanf("%d",&a[i]);

    }



      
    while(1) {

      if(k == n-1) break;

      k = 0;
      for(j=0;j<n-1;j++) {

	//printf("a[%d](%d) a[%d](%d)\n",j,a[j],j+1,a[j+1]);

	if(a[j] > a[j+1]) {
	  t = a[j];
	  a[j] = a[j+1];
	  a[j+1] = t;
	    c++;
	} else k++;

      }
    }

    

    printf("%d\n",c);

  }

}
	  

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

int main() {
	int x, n;
  cin>>x>>n;
  vector <int> p(n);
  if(n>0) {
    for (int i=0; i<n; i++) {
      cin>>p[i];
    }  
    sort (p.begin(), p.end());
    int szamlalo=0;
    int mini=101;
    int sum=0;
    for (int i=0; i<102; ++i) {
      if(i==p[szamlalo]) {
        szamlalo++;
        while(i==p[szamlalo]){
          szamlalo++;
        }
      }
      else{
        if (mini>abs(x-i)) {
          mini=abs(x-i);
          sum=i;
        }
      }
    }
    cout<<sum;
  }
  else cout<<x;
	return 0;
}


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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(int, N);

  vector<int> d(N);
  rep(i, N) {
    input(d[i]);
  }

  sort(all(d), greater<>());
  d.erase(unique(all(d)), d.end());

  outl(d.size());

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long A, B, C;
  cin >> A >> B >> C;
  cout << ((C-A)*(B-C) > 0 ? "Yes" : "No") << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256