akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;

	int h[n];
	int dp[n];

	for(int i=0;i<n;i++)
		cin>>h[i];

	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);

	for(int i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));
	}

	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
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>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void OUT(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void OUT(T t,Ts... ts){cout<<t<<" ";OUT(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type FILL(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type FILL(T&t,const V&v){for(auto &e:t)FILL(e,v);}
constexpr long long INF = 1e18;

template <typename T>
struct SegmentTree{
	using F = function<T(T,T)>;
	int n;
	F f;
	T ti;
	vector<T> dat;
	SegmentTree(){};
	SegmentTree(F f,T ti):f(f),ti(ti){}
	void init(int n_){
		n=1;
		while(n<n_) n<<=1;
		dat.assign(n<<1,ti);
	}
	void build(const vector<T> &v){
		int n_=v.size();
		init(n_);
		for(int i=0;i<n_;i++) dat[n+i]=v[i];
		for(int i=n-1;i;i--)
			dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
	}
	void set_val(int k,T x){
		dat[k+=n]=x;
		while(k>>=1)
			dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
	}
	T query(int a,int b){
		T vl=ti,vr=ti;
		for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
			if(l&1) vl=f(vl,dat[l++]);
			if(r&1) vr=f(dat[--r],vr);
		}
		return f(vl,vr);
	}
};

signed main(){
	int N;
	cin>>N;
	auto t = mv(N),a = t;
	REP(i,N)cin>>t[i]>>a[i];
	int Q;
	cin>>Q;
	auto l = mv(Q),r = l;
	REP(i,Q)cin>>l[i]>>r[i];
	map<int,int>mp;
	int cnt = 0;
	set<int>st;
	REP(i,N){
		st.insert(t[i]);
	}
	REP(i,Q){
		st.insert(l[i]);
		st.insert(r[i]);
	}
	for(auto e:st)mp[e]=cnt++;
	auto seg = SegmentTree<double>([](double a,double b){return a*b;},1.0);
	vector<double>time(mp.size(),1.0);
	REP(i,N){
		time[mp[t[i]]]=(10.0-1.0*a[i])/10.0;
	}
	seg.build(time);
	vector<int>ans;
	REP(_,Q){
		printf("%.20lf\n",1e9*seg.query(mp[l[_]],mp[r[_]]+1));
	}
}


Measured memory_bytes: 49276
n,m=map(int,input().split())
a=[[i for i in input()] for l in range(n)]
b=[[i for i in input()] for l in range(m)]
bs=""
for p in b:bs+="".join(p)
s=""
for TopX in range(n-m+1):
    for TopY in range(n-m+1):
        s=""
        for x in range(m):
            for y in range(m):
                s+=a[TopY+y][TopX+x]
        if bs==s:
            print("Yes")
            exit(0)
print("No")

Measured memory_bytes: 3064
N = int(input())
point = [int(i) for i in input().split()] 
flag = 0
for i in range(N-1):
    if point[i] < point[i+1]:
        point[i+1] -= 1
    elif point[i] == point[i+1]:
        continue
    else:
        flag = 1
if flag == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14396
x=int(input())
ans=0
if 400<=x<=599:
    ans=8
elif 600<=x<=799:
    ans=7
elif 800<=x<=999:
    ans=6
elif 1000<=x<=1199: 
    ans=5
elif 1200<=x<=1399:
    ans=4
elif 1400<=x<=1599:
    ans=3
elif 1600<=x<=1799:
    ans=2
elif 1800<=x<=1999:
    ans=1
print(ans)


Measured memory_bytes: 9180
g = int(input())
data = [int(i) for i in input().split(" ")]

count = 0
for i in range(1,g-1):
    if (data[i] > data[i-1] and data[i] < data[i+1]) or (data[i] < data[i-1] and data[i] > data[i+1]):
        count += 1

print(count)

Measured memory_bytes: 3060
n=int(input())
s=input()
ans=0
r=0
g=0
b=0
rl=[]
gl=[]
bl={-2*n}
for k,i in enumerate(s):
    if i=="R":
        r+=1
        rl.append(k)
    elif i=="G":
        g+=1
        gl.append(k)
    else:
        b+=1
        bl|={k}
ans=r*b*g
for i in rl:
    for j in gl:
        if (i+j)/2 in bl:
            ans-=1
        if 2*i-j in bl:
            ans-=1
        if 2*j-i in bl:
            ans-=1
print(ans)
    

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define f first
#define s second

ll N,A,B,C,D,E;
ll X;

int main(){

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

cin>>N>>A>>B>>C>>D>>E;

X=A;
X=min(X,B);
X=min(X,C);
X=min(X,D);
X=min(X,E);

if(N%X){
	cout<<5+N/X<<endl;
}else{
	cout<<4+N/X<<endl;
}

}
	


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

#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int N;
	cin >> N;
	
	int D1[101];
	int D2[101];
	
	cin >> D1[0] >> D2[0];
	cin >> D1[1] >> D2[1];
	
	bool flag = false;
	for(int i = 2; i < N; i++) {
		cin >> D1[i] >> D2[i];
		if((D1[i-2] == D2[i-2]) && (D1[i-1] == D2[i-1]) && (D1[i] == D2[i])) {
			flag = true;
			
		}
	}
	if(flag) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define FIR first
#define SEC second
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}

const int N=5010;
const int mod=1e9+7;
int n,m,f[N][N],pw[N],ipw[N];
int s[N][N];
// f[j][i]: total number of elements is i, range is [0,2^j)

int main() {
	rd(m),rd(n);
	pw[0]=1; for(int i=1;i<=n;++i) pw[i]=pw[i-1]*2ll%mod;
	ipw[0]=1; for(int i=1;i<=n;++i) ipw[i]=ipw[i-1]*1ll*(mod+1>>1)%mod;
	for(int i=0;i<=n;++i) f[0][i]=1;
	for(int j=1;j<=m;++j) {
		f[j][0]=1;
//		for(int i=1;i<=n;++i) {
//			f[j][i]=1ll*(i+1)*f[j-1][i]%mod;
//			for(int k=2;k<=i;++k)
//				f[j][i]=(f[j][i]+1ll*f[j-1][i-k+1]*(i-k+1)%mod*pw[k-2])%mod;
//		}
		
		for(int i=1;i<=n;++i) s[j-1][i]=(s[j-1][i-1]+1ll*f[j-1][i]*i%mod*ipw[i+1])%mod;
		for(int i=1;i<=n;++i)
			f[j][i]=(1ll*(i+1)*f[j-1][i]+1ll*s[j-1][i-1]*pw[i])%mod;
	}
	printf("%d",f[m][n]);
	return 0;
}

Measured memory_bytes: 199484
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(list[k - 1])

Measured memory_bytes: 3060
use proconio::input;
use std::collections::HashMap;
 
fn main() {
  input! {
    N: usize,
    M: usize,
    K: usize,
    A: [(usize, usize);M],
    B: [(usize, usize);K],
  }
  
  let mut friends: Vec<Vec<usize>> = vec![vec![];N+1];
  for a in A.iter() {
    friends[a.0].push(a.1);
    friends[a.1].push(a.0);
  }
  
  let mut group_num = 1;
  let mut map: HashMap<usize, usize> = HashMap::new();
  let mut connect_map: HashMap<usize, usize> = HashMap::new();
  for i in 1..=N {
    if map.get(&i).is_none() {
      let mut stack: Vec<usize> = vec![i];
      let mut count = 0;
      while 0 < stack.len() {
        let v = stack.pop().unwrap();
        for a in friends[v].iter() {
          if map.get(&a).is_none() {
            map.insert(*a, group_num);
            count += 1;
            stack.push(*a);
          }
        }
      }
      connect_map.insert(group_num, count);
      group_num += 1;
    }
  }
  
  let mut blocks: Vec<usize> = vec![0;N+1];
  for b in B.iter() {
    if map.get(&b.0) == map.get(&b.1) {
      blocks[b.0] += 1;
      blocks[b.1] += 1;
    }
  }

  let mut result: Vec<usize> = vec![0;N];
  for i in 1..=N {
    if let Some(v) = map.get(&i) {
      let cv = connect_map.get(&v).unwrap();
      result[i-1] = cv - friends[i].len() - blocks[i] - 1;
    } else {
      result[i-1] = 0;
    }
  }
  
  println!("{}", result
    .into_iter()
    .map(|v| v.to_string())
    .collect::<Vec<String>>()
    .join(" ")
  );
}

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
ll inf = 1e18;


ll N;
map<pair<ll, ll>, ll> tf_to_r;
pair<ll, ll> pos_ht[210][210]; //h, t;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
void dfs(ll ny, ll nx, ll top, ll front){
	ll r = tf_to_r[{top, front}];
	ll dir_num[4] = {front, r, 7 - front, 7 - r};
	ll mx = 0;
	ll dir = 0;
	REP(k,0,4){
		ll next_x = nx + dx[k];
		ll next_y = ny + dy[k];
		if(pos_ht[next_y][next_x].first >= pos_ht[ny][nx].first) continue;
		if(mx < dir_num[k]){
			mx = dir_num[k];
			dir = k;
		}
	}
	if(mx>3){
		ll next_front = front;
		if(dir==0) next_front = top;
		else if(dir==2) next_front = 7 - top;
		dfs(ny + dy[dir], nx + dx[dir], 7 - dir_num[dir], next_front);
	}else{
		pos_ht[ny][nx].first++;
		pos_ht[ny][nx].second = top;
	}
}

int main() {
	tf_to_r[{1,2}] = 3; tf_to_r[{1,3}] = 5; tf_to_r[{1,4}] = 2; tf_to_r[{1,5}] = 4;
	tf_to_r[{2,6}] = 3; tf_to_r[{2,3}] = 1; tf_to_r[{2,1}] = 4; tf_to_r[{2,4}] = 6;
	tf_to_r[{3,1}] = 2; tf_to_r[{3,2}] = 6; tf_to_r[{3,6}] = 5; tf_to_r[{3,5}] = 1;
	tf_to_r[{4,1}] = 5; tf_to_r[{4,5}] = 6; tf_to_r[{4,6}] = 2; tf_to_r[{4,2}] = 1;
	tf_to_r[{5,1}] = 3; tf_to_r[{5,3}] = 6; tf_to_r[{5,6}] = 4; tf_to_r[{5,4}] = 1;
	tf_to_r[{6,2}] = 4; tf_to_r[{6,4}] = 5; tf_to_r[{6,5}] = 3; tf_to_r[{6,3}] = 2;

	while (cin >> N && N > 0) {
		REP(i,0,210){
			REP(j,0,210){
				pos_ht[i][j] = {0, 0};
			}
		}
		int sx=100, sy=100;
		REP(i,0,N){
			ll t, f;
			cin >> t >> f;
			dfs(sy, sx, t, f);
		}
		ll ans[10] = {};
		REP(i,0,210){
			REP(j,0,210){
				if(pos_ht[i][j].first > 0){
					ans[pos_ht[i][j].second]++;
				}
			}
		}
		REP(i,1,7){
			cout << ans[i] << (i<6?' ': '\n');
		}
	}

	return 0;
}


Measured memory_bytes: 3784
#include <iostream>
#include <map>
#include <string>
#include <queue>
using namespace std;

char WinHand(char hand) {

    if(hand == 'r')
        return 'p';
    else if(hand == 's')
        return 'r';

    return 's';    

}

int main() {

    int n, k;
    map<char, int> hand;
    long long int sum = 0;
    int r, s, p;
    queue<char> oldHands;
    string hands;

    cin >> n >> k;

    cin >> r >> s >> p;

    hand['r'] = r;
    hand['s'] = s;
    hand['p'] = p;

    cin >> hands;

    for(int i = 0; i < k; ++i) {
        
        int j = i;
        while(j < n) {


            int sameCount = 1;
            int index;
            char nowHand = hands[j];
            for(index = j; index + k < n && hands[index] == hands[index + k]; index += k)
                sameCount++;

            

            if(sameCount == 1) {
                sum += hand[WinHand(nowHand)];
                j += k;
            }
            else {
                if(sameCount % 2 == 0) {
                    sum += hand[WinHand(nowHand)] * sameCount / 2;
                }
                else {
                    sum += hand[WinHand(nowHand)] * (sameCount / 2 + 1);
                }

                j = index + k;
            }


        }

    }
    cout << sum << endl;
    return 0;

}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
#define N 100
using namespace std;
int n,c,inv[N],p,l,dat[N],ans,flag;
vector<int> s[N],v[N];
int visited[N];
void func(int);

int main(){
  while(1){
    cin>>n>>c;
    if(!n&&!c) break;
    for(int i=0;i<n*(n+1)/2;i++) cin>>inv[i];
    p=0;
    for(int i=1;i<=n;i++)
      for(int j=0;j<i;j++,p++) s[i-1].push_back(inv[p]);
    p=0;
    for(int i=1;i<=n;i++){
      for(int j=0;j<s[i-1].size();j++,p++){
	if(i!=n){
	  v[p].push_back(p+i);
	  v[p].push_back(p+1+i);
	  v[p+i].push_back(p);
	  v[p+1+i].push_back(p);
	}
	if(j==s[i-1].size()-1) continue;
	v[p].push_back(p+1);
	v[p+1].push_back(p);
      }
    }
    ans=-1000000000;
    for(int i=0;i<n*(n+1)/2;i++){
      if(inv[i]) continue;
      for(int j=0;j<n*(n+1)/2;j++) dat[j]=0,visited[j]=0;
      inv[i]=c;
      l=1;
      for(int j=0;j<v[i].size();j++){
	if(!inv[v[i][j]]||visited[v[i][j]]) continue;
	flag=1;	
	func(v[i][j]);
	if(flag==1&&inv[v[i][j]]==c) flag=-1;
	for(int k=0;k<n*(n+1)/2;k++)
	  if(visited[k]==l) dat[k]=flag;
	l++;
      }
      int f=0;
      for(int j=0;j<v[i].size();j++){
	if(inv[v[i][j]]==0) f=1;
      }
      if(visited[i]==0&&!f) dat[i]=-1;
      inv[i]=0;
      int sum=0;
      for(int j=0;j<n*(n+1)/2;j++) sum+=dat[j];
      ans=max(ans,sum);
    }
    cout<<ans<<endl;
    for(int i=0;i<N;i++) s[i].clear(),v[i].clear();
  }
  return 0;
}

void func(int d){
  visited[d]=l;
  for(int i=0;i<v[d].size();i++){
    if(inv[v[d][i]]==0) flag=0;
    if(visited[v[d][i]]) continue;
    if(inv[v[d][i]]==inv[d]||inv[v[d][i]]==0) func(v[d][i]);
  }
}

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

int main() {
    int a,b,c;
    cin>>a>>b;
    if(b<10)c=a*10+b;
    else if(b<100)c=a*100+b;
    else {c=a*1000+b;}
    for (size_t i = 0; i*i <= c; i++)
    {
        if(i*i==c){cout<<"Yes"<<endl; return 0;}
    }
    
    cout << "No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, l;
    cin >> n >> l;
    int sum = n * (l-1) + n * (n+1) / 2;
    if(l >= 0){
        sum -= l;
    }
    else if(l+n-1 >= 0){
    }
    else {
        sum -= l+n-1;
    }

    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn maxi(vs: Vec<u32>) -> (usize, u32) {
    let mut max = (0, 0);
    for (i, v) in vs.iter().enumerate() {
        if v > &max.1 {
            max = (i, *v);
        }
    }
    max
}

fn main() {
    input! {
        a: u32,
        b: u32,
        c: u32,
        k: u32,
    }
    let mut v = vec![a, b, c];
    let (i, _) = maxi(v.clone());
    v[i] *= 2_u32.pow(k);
    println!("{}", v.iter().sum::<u32>());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  
  cin >> N >> A >> B;
  
  if(N*A>B)
  {
  	cout << B << endl;
  }
  else
  {
  	cout << N*A << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  if(n%10==7||(n/10)%10==7||n/100==7){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3596
#include "bits/stdc++.h"
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P =pair<int,int>;

int main(){
    int n;
    cin >> n;
    int ax,ay,ah;
    vector <int> x(n),y(n),h(n);
    rep(i,n){
        cin >> x[i] >> y[i] >> h[i];
    }
    int h2;
    rep(i,101){
        rep(j,101){
            rep(k,n){
                if(h[k]!=0){
            h2=h[k]+abs(x[k]-i)+abs(y[k]-j);
            break;
                }
            }
            rep(k,n){
                if(h2-abs(x[k]-i)-abs(y[k]-j)==h[k] or (h[k]==0 and h2-abs(x[k]-i)-abs(y[k]-j)<=0)){
                    h2=h2;
                }
                else{
                    break;
                }
                if(k==n-1){
                    //cout << 5 << endl;
                    ax=i;
                    ay=j;
                    ah=h2;
                }
            }
        }
    }

    cout << ax << " " <<  ay  <<" " << ah << endl;
    

    return 0;
}

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

int main(){

    int n, m, x;
    set<int> a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.insert(x);
    }
    
    cin >> m;
    set<int> b;
    for(int i = 0; i < m; i++){
        cin >> x;
        b.insert(x);
    }

    set<int> uni;
    set_intersection(a.begin(), a.end(), b.begin(), b.end(), inserter(uni, uni.end()));

    for(auto x : uni){
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 23688
#include <stdio.h>

int main(void){
  int n,m;
  int i,j;
  int A[100][100];
  int b[100];
  long sum;

  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%d", &A[i][j]);
    }
  }
  for (j = 0; j < m; j++) {
    scanf("%d", &b[j]);
  }

  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = 0; j < m; j++) {
      sum += A[i][j] * b[j];
    }
    printf("%ld\n", sum);
  }


  return (0);
}



Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
std::vector<int> v;
std::vector<int> best;
int INF = 9999999;
int solve(int x,int sum){
     // cout << sum <<" " << x <<  endl;
     if(x<0){
          return INF;
     }
     if(x==2){
          return abs(v[0]-v[2]);
     }
     if(x==0){
          return min(abs(v[0]-v[1]),abs(v[0]-v[2]));
     }
     if(x==1){
          return abs(v[0]-v[1]);
     }
     if(best[x]==-1){
          best[x] = sum+min(abs(solve(x-1,sum))+abs(v[x]-v[x-1]),abs(solve(x-2,sum))+abs(v[x]-v[x-2]) );
     }
     return best[x];  
}
int main() {
     int n;
     cin >> n;
     vector<int> moon(n,-1);
     best = moon;
     for(int i=0;i<n;i++){
          int x;
          cin >> x;
          v.push_back(x);
     }
     cout << solve(n-1,0);
}


Measured memory_bytes: 7740
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, m, a[114514];
int dp[114514];
bool ta[114514];

signed main() {
	cin >> n >> m;
	dp[0] = 1;
	rep(i, m) {
		cin >> a[i];
		ta[a[i]] = true;
	}
	for (int i = 1; i <= n; i++) {
		if (ta[i])dp[i] = 0;
		else dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
	}
	cout << dp[n] << endl;
}

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

using namespace std;

long long int calc(vector<bool> &B, string &s){
  //逆向きにパースしていく。
  long long int tmp = 0LL;
  long long int fac = 1;
  for(int i = s.size()-1; i >= 0; i--){
    int j = i;
    fac = 1;
    while(j >= 1 && B[j-1] != true){ //条件式の書き順が逆だとエラーになる
      tmp += (s[j]-'0') * fac;
      fac *= 10;
      j -= 1;
    }
    tmp += (s[j]-'0') * fac;
    i = j;
  }
  return tmp;
}

long long int dfs(int depth, vector<bool> &B, string &s){
  if(depth == B.size()-1){
    return calc(B, s);
  }else{
    long long int tmp = 0LL;
    B[depth + 1] = false;
    tmp += dfs(depth + 1, B, s);
    B[depth + 1] = true;
    tmp += dfs(depth + 1, B, s);
    return tmp;
  }
}

int main(){
  string s;
  cin >> s;
  
  vector<bool> B(s.size()-1, false);
  long long int ans = dfs(-1, B, s);
  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=123;
int a[mx];
int main(){
  int k,t;
  scanf("%d %d",&k,&t);
  for(int i=0;i<t;i++){
    scanf("%d",a+i);
  }
  sort(a,a+t);
  int maxi=a[t-1];
  int rem=0;
  for(int i=0;i<t-1;i++){
    rem+=a[i];
  }
  if(rem>=maxi-1){
    puts("0");
    return 0;
  }
  else{
    printf("%d\n",maxi-rem-1);
  }
  return 0;  
}


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

int main() {
    long long S;
    cin >> S;
    long long L = 1e9;
    long long M = (L - S % L) % L;
    printf("0 0 %lld %lld %lld %lld\n", L, 1, M, (S + M) / L);
    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) FOR(i, 0, n - 1)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

void solve(long long N, vector<long long> a, vector<long long> b, vector<long long> c){
    vector< vector<ll> > dp(N+100000, vector<ll>(3));

    vector< vector<ll> > act(N, vector<ll>(3));
    rep(i, N) {
        act[i][0] = a[i];
        act[i][1] = b[i];
        act[i][2] = c[i];
    }

    rep(i, N) {
        rep(j, 3) {
            rep(k, 3) {
                if (j == k) continue;
                chmax(dp[i + 1][k], dp[i][j] + act[i][k]);
            }
        }
    }

    ll res = 0;
    rep(j, 3) chmax(res, dp[N][j]);
    cout << res << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    cin >> N;
    vector<long long> a(N);
    vector<long long> b(N);
    vector<long long> c(N);
    for(int i = 0 ; i < N ; i++){
        cin >> a[i];
        cin >> b[i];
        cin >> c[i];
    }
    solve(N, move(a), move(b), move(c));
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  int B;
  cin >> A;
  
  vector<int> OOTJNY(A);
  
  for(int YUNI = 0; YUNI < A - 1; YUNI++){
    cin >> B;
    OOTJNY.at(B) ++;
  }
  
  for(int YUNI = 1; YUNI < A; YUNI++){
  cout << OOTJNY.at(YUNI) << endl;
  }
  cout << 0 << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, m;
  cin >> n >> m;
  vector<pll> vec(n);
  REP(i,n) cin >> vec[i].first >> vec[i].second;

  sort(ALL(vec));
  deque<pll> deq;
  REP(i,n) deq.push_back(vec[i]);
  ll ans = 0;

  bpqll que;
  for(ll i = m; i >= 0; i--){
    while(!deq.empty() && m - i >= deq.front().first){
      que.push(deq.front().second);
      deq.pop_front();
    }
    if(!que.empty()){
      ans += que.top(); que.pop();
    }
  }

  cout << ans <<endl;


  return 0;
}



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


int bfs(vector<string> A,int H,int W)
{
	queue<pair<int,int>> que;
	vector<vector<int>> cost(H,vector<int>(W,-1));
	int lp=H*W;
	rep(i,H)
	{
		rep(j,W)
		{
			if(A[i][j]=='#')
			{
				que.push(make_pair(j,i));
				cost[i][j]=0;
				lp--;
			}
		}
	}
	int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
	int ret=0;
	while(lp!=0)
	{
		int n=que.size();
		rep(i,n)
		{
			pair<int,int> p=que.front();que.pop();
			for(auto d : dir)
			{
				int x=d[0]+p.first;
				int y=d[1]+p.second;
				if(0>x||x>=W||0>y||y>=H||cost[y][x]!=-1) continue;
				cost[y][x]=0;
				que.push(make_pair(x,y));
			}
		}
		lp-=que.size();
		ret++;
	}
	return ret;
}
int main()
{
	int H,W;
	cin>>H>>W;
	vector<string> A(H);
	rep(i,H)
	{
		cin>>A[i];
	}
	cout<<bfs(A,H,W)<<endl;
	return 0;
}


Measured memory_bytes: 18244
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
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;}
const ll INF = 1LL<<60;
//const int dy[4] = {0, 1, 0, -1};
//const int dx[4] = {1, 0, -1, 0};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

void solve(){
    bool flag = true;
    string s, t; cin >> s >> t;
    map<char, int> mp1, mp2;
    ll n = s.size();
    REP(i, n){
        char cs = s[i], ts = t[i];
        if(mp1[ts] == 0) mp1[ts] += cs - '0';
        else{
            if(mp1[ts] != cs - '0'){
                flag = false;
                break;
            }
        }
        if(mp2[cs] == 0) mp2[cs] += ts - '0';
        else{
            if(mp2[cs] != ts - '0'){
                flag = false;
                break;
            }
        }
    }
    if(flag) Yes();
    else No();
}

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

Measured memory_bytes: 3792
#include<cstdio>
#include<iostream>
using namespace std;
int n;
int con,tot;
int a[200005],maxn,maxn2; 
int main() 
{ 
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)
	{
	    scanf("%d",&a[i]);
	    if(maxn<a[i])
	        maxn=a[i];
	}
	for(register int i=1;i<=n;i++)
	    if(maxn==a[i])
	        ++tot,con=i;
    if(tot==1)
	{
	    for(register int i=1;i<=n;i++)
	        if(i!=con)
	            if(maxn2<a[i])
	                maxn2=a[i];
	    for(register int i=1;i<=n;i++)
	        if(i!=con) printf("%d\n",maxn);
	        else printf("%d\n",maxn2);
	}
	else
	    for(register int i=1;i<=n;i++)
	        printf("%d\n",maxn);	    
	return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007; //998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void D();

int main()
{
	D();
	fflush(stdout);
	return 0;
}
class UnionFindTree
{
protected:
	int* _par = 0;
	int* _rank = 0;
	int* _count = 0;
	int* _flag = 0;

	void init(int size) {
		_par = new int[size];		//	親ノード
		_rank = new int[size];		//	高さ
		_count = new int[size];		//	結合グループの要素数
		_flag = new int[size];
		for (int i = 0; i < size; i++) {
			_par[i] = i;
			_rank[i] = 0;
			_count[i] = 1;
			_flag[i] = 0;
		}
	}

public:
	UnionFindTree(int size) {
		init(size);
	}

	~UnionFindTree() {
		delete[] _par;
		delete[] _rank;
		delete[] _count;
	}

	//	木の根を求める
	int root(int x) {
		if (_par[x] == x) {
			return x;
		}
		else {
			return(_par[x] = root(_par[x]));
		}
	}

	//	x と y の属する集合を併合
	void Unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) {
			//	すでに同じ集合だった
			return;
		}

		//	flag
		_flag[x] = std::max(_flag[x], _flag[y]);
		_flag[y] = _flag[x];

		if (_rank[x] < _rank[y]) {
			//	数をまず加算しておく
			_count[y] = _count[y] + _count[x];
			_par[x] = y;
		}
		else {
			//	数をまず加算しておく
			_count[x] = _count[y] + _count[x];

			_par[y] = x;
			if (_rank[x] == _rank[y]) {
				_rank[x]++;
			}
		}
	}

	bool IsUnion(int x, int y) {
		return (root(x) == root(y));
	}

	int count(int x) {
		return _count[root(x)];
	}

	void setFlag(int x, int flag) {
		_flag[root(x)] = flag;
	}

	int getFlag(int x) {
		return _flag[root(x)];
	}
};

static void D()
{
	int N, M;
	get(N, M);

	UnionFindTree uf(N);

	int a, b;
	for (int i = 0; i < M; i++) {
		get(a, b); a--; b--;
		uf.Unite(a, b);
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = std::max(ans, uf.count(i));
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 6428
import javax.tools.*;
import java.io.*;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;

public class Main{

    public static void main(String[] args)  {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int res = a/b;
            if(res*b<a){
                ++res;
            }
            System.out.println(res);
    }
}



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

int main(){
  int N;
  cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  sort(v.begin(),v.end());
  int c=0;
  for(int i=1;i<N;i++)if(v[i]==v[i-1])c++;
  cout<<N-((c+1)/2)*2<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
typedef struct proces{
char name[10];
int time;
int flag;
}P;
P S[100005];
int head,tail,n;

void enqueue(P x){
  S[tail]=x;
  tail=(tail+1)%100005;

}
P dequeue(){
  P x=S[head];
  head=(head+1)%100005;
  return x;
}
int min(int a,int b){
  if(a>b) return b;
  else return a;
}
int main(){
int spend=0,c,i,qp;
P in;



scanf("%d %d",&n,&qp);
for(i=1;i<=n;i++){
  scanf("%s",S[i].name);
  scanf("%d",&S[i].time);
  S[i].flag=1;
}
head=1;
tail=n+1;
while(head != tail){
  in=dequeue();
  c=min(qp,in.time);
  in.time-=c;
  spend+=c;
  if(in.time>0){
    enqueue(in);
  }
  else if(in.flag==1){
    printf("%s %d\n",in.name,spend);
    in.flag=0;
  }

}
return 0;
}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    bool moji = true;
    rep(i, s.size()){
        if((i + 1) % 2 == 0 && (s[i] == 'R'))moji = false;
        else if((i + 1) % 2 != 0 && s[i] == 'L') moji = false;
    }
    if(moji) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(false);

    string s; cin >> s;
    int n = s.size();
    string t = "CODEFESTIVAL2016";

    int cnt = 0;
    REP(i, n)
        if (s[i] != t[i]) cnt++;

    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

unsigned int s[100000000 / 8 + 1];

int bget(int n) {
	return (s[n / 32] >> (n % 32)) & 1;
}

int bset(int n) {
	s[n / 32] |= 1 << (n % 32);
}

void sieve(int n) {
	int m = sqrt(n);
	bset(0);
	bset(1);
	for (int k = 2; k <= m; k ++) {
		if (bget(k)) continue;
		for (int i = 2 * k; i <= n; i += k) {
			bset(i);
		}
	}
}

int main(void) {
	int n;
	sieve(100000000);
	scanf("%d", &n);
	int count = 0;
	for (int i = 0; i < n; i ++) {
		int x;
		scanf("%d", &x);
		if (!bget(x)) count ++;
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 13308
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define mp make_pair
#define ll long long
#define pb push_back


void solve()
{
   long long n;
   cin>>n;

   vector<long long>v(n);

   long long i,j;
   for(i=0;i<n;i++)cin>>v[i];

   long long maxi = v[0];

   long long ans = 0;

   for(i=1;i<n;i++)
   {
       if(maxi > v[i])
       {
           ans = ans +maxi-v[i];

       }
       else
       {
           maxi = max(maxi, v[i]);
       }

   }
   cout<<ans;
}


int main()
{

  int t = 1;
  //cin>>t;

  while(t--)
    solve();

  return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    ll a;
    double b;
    cin >>a >>b;
    b*=100+0.1;
    ll bb = b;
    a*=bb;
    a/=100;
    cout <<a<<endl;
}
    



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

int n, N[15];

int main() {
	cin >> n;
	int a = 0, b = 0;
	while (n--) {
		bool t = true;
		a = 0, b = 0;
		for (int i = 0; i < 10; i++) {
			cin >> N[i];
		}
		for (int i = 0; i < 10; i++) {
			if (a > N[i] && b > N[i]) {
				cout << "NO" << endl;
				t = false;
				break;
			} else if (a < N[i]) {
				if (a < b) {
					b = N[i];
				} else {
					a = N[i];
				}
			} else {
				b = N[i];
			}
		}
		if(t) {
			cout << "YES" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2988
a,b,c=map(int,input().split())
ma=max(a,b,c)
co=0
l=[a,b,c]
l.sort()
co+=ma-l[1]
if (ma-(l[0]+co))%2==0:
  co+=(ma-(l[0]+co))//2
else:
  co+=(ma-(l[0]+co))//2+2
print(co)

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,31)-1;


int main() {
  int N; cin >> N;
  ll A[N], B[N]; rep(i,N) cin >> A[i] >> B[i];
  ll result = 0; rep(i,N) result += A[i];
  bool ok = false;
  ll mb = LLINF;
  rep(i,N) {
    if (B[i]!=A[i]) ok = true;
    if (A[i]>B[i]) mb = min(mb, B[i]);
  }
  result = (ok) ? result-mb : 0;
  cout << result << endl;
}

Measured memory_bytes: 512
n = int(input())
l = list(map(int, input().split()))
l.insert(0,0)
l.append(0)
num = 1
sum = 0

for i in range(n+1):
  sum += abs(l[i+1]-l[i])
#print(sum)
    
for i in range(1,n+1):
  s1 = abs(l[i+1]- l[i-1])
  s2 = abs(l[i]- l[i-1])
  s3 = abs(l[i+1]- l[i])
  print(sum + s1 - (s2 + s3))

Measured memory_bytes: 14048
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  // abピザは買わない
  if (2 * c >= a + b) {
    cout << a * x + b * y << endl;
  } else { // abピザ買う
    int money = 0;
    int min_xy = min(x, y);
    money += min_xy * 2 * c;
    x -= min_xy;
    y -= min_xy;
    if (x > 0) {
      if (a < 2 * c) {
        money += x * a;
      } else {
        money += 2 * x * c;
      }
    } else {
      if (b < 2 * c) {
        money += y * b;
      } else {
        money += 2 * y * c;
      }
    }
    cout << money << endl;
  }
  return 0;
}

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

int main(){
    int a,b; cin >> a >> b;
    int tmp1=min(a,b);
    int tmp2=max(a,b);
    string ans="";
    
    for (int i=0; i<tmp2; i++) ans+=to_string(tmp1);
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    string a,b; cin >> a >> b;
    int A = a.size(),B = b.size();
    if(A == B){
        if(a > b){
            cout << "GREATER" << endl;
        }else if(a < b){
            cout << "LESS" << endl;
        }
    }else{
        if(A < B){
            cout << "LESS" << endl;
        }else{
            cout << "GREATER" << endl;
        }
    }
    if(a == b){
        cout << "EQUAL" << endl;
    }
}

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

// #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
// #define FORR(i, a, b) for (int i = (a); i > (b); --i)
// #define REP(i, n) for (int i = 0; i < (n); ++i)
// #define REPR(i, n) for (int i = n; i >= 0; i--)
// #define FOREACH(x, a) for (auto &(x) : (a))
// #define VECCIN(x)            \
// 	for (auto &youso_ : (x)) \
// 	cin >> youso_
// #define mp make_pair
// #define bitcnt __builtin_popcount
// #define All(a) (a).begin(), (a).end()
// template <typename T = long long>
// inline T IN()
// {
// 	T x;
// 	cin >> x;
// 	return (x);
// }
// inline void CIN() {}
// template <class Head, class... Tail>
// inline void CIN(Head &&head, Tail &&... tail)
// {
// 	cin >> head;
// 	CIN(move(tail)...);
// }
// #define CINT(...)    \
// 	int __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define LCIN(...)   \
// 	ll __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define SCIN(...)       \
// 	string __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define Yes(a) cout << (a ? "Yes" : "No") << "\n"
// #define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
// typedef vector<int> V;
// typedef vector<ll> VL;
// typedef pair<int, int> P;
// typedef pair<ll, ll> PL;
// typedef priority_queue<int> PQ;
// typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

vector<int> a;
int n, k;
vector<ll> ret;
int main()
{
	while (true)
	{
		cin >> n >> k;
		if (n == 0 && k == 0)
			break;
		a.resize(n);
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		int l, r;
		l = 0;
		r = 0;
		ll ans = 0, res = 0;
		while (l < n)
		{
			while (r - l < k && r < n)
			{
				ans += a[r++];
			}
			if (l == 0)
				res = ans;
			if (r - l == k)
				res = max(res, ans);
			ans -= a[l++];
		}
		ret.push_back(res);
	}
	for (int i = 0; i < ret.size(); i++)
	{
		cout << ret[i] << "\n";
	}
	return 0;
}


Measured memory_bytes: 3124
// by syu
package main

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

var in = NewScanner(os.Stdin, 0)

func main() {

	N, X := in.Int(), in.Int()
	x := in.ArrayInt(N)

	x = append(x, X)
	sort.Ints(x)
	ans := x[1] - x[0]
	for i := 0; i < len(x)-1; i++ {
		gcd := Gcd(ans, x[i+1]-x[i])
		if gcd < ans {
			ans = gcd
		}
	}

	Pln(ans)
}

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)

	s.Split(bufio.ScanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}

func (s *Scanner) Int() int {
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

func (s *Scanner) ArrayInt(n int) (r []int) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int())
	}
	return
}

func Pln(s ...interface{}) {
	fmt.Println(s...)
}

func Gcd(a, b int) int {
	t := 0
	for b != 0 {
		t = a % b
		a = b
		b = t
	}
	return a
}


Measured memory_bytes: 6656
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

ll dp[60][60][3000];
ll N,A;
ll x[60];

int main(){
    cin>>N>>A;
    FOR(i, 0, N) cin>>x[i];
    FOR(i, 0, 60) FOR(j, 0, 60) FOR(k, 0, 3000) dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    FOR(i, 0, N){
        FOR(j, 0, N){
            FOR(k, 0, 3000){
                if(dp[i][j][k]==0) continue;
                //使わない時
                dp[i+1][j][k] += dp[i][j][k];
                //使う時
                dp[i+1][j+1][k+x[i]] += dp[i][j][k];
            }
        }
    }
    ll ans = 0;
    FOR(i, 1, N+1){
        ans += dp[N][i][i*A];
    }
    cout << ans << endl;
}

Measured memory_bytes: 84736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using v  = vector<int>;
using vv = vector<v>;

int main(){
    ll n; cin >> n;
    
    ll ans = 0;
    
    for(ll i=1; i*i<=n; i++){
        if(n%i)continue;
        if(n/i-i<2)continue;
        
        ans += n/i -1;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip> 
using namespace std; 
#define rep(i,a,b)		for(long int i=a;i<=b;i++)
#define MOD 1e9+7

long long a,b;
int main() 
{ 
	ios::sync_with_stdio(false);
    cin.tie(NULL);  
    
    
    cin>>a>>b;
    cout<<((b-a)*(b-a+1))/2-b;
}
	

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N, T; cin >> N >> T;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<int> mxs(N);
    mxs[N-1] = A[N-1];
    rep(i, N-1) mxs[N-i-2] = max(mxs[N-i-1], A[N-i-2]);
    int ans = 0;
    int tmp = 0;
    //rep(i, N) cout << mxs[i] << " ";
    //cout << endl;
    rep(i, N) {
        if (tmp > mxs[i] - A[i]) continue;
        if (tmp == mxs[i] - A[i]) ans++;
        else {
            ans = 1;
            tmp = mxs[i] - A[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4012
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {

    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    char b;
    cin >> b;
    
    switch (b) {
        case 'A':
            cout << 'T' << endl;
            break;
        case 'T':
            cout << 'A' << endl;
            break;
        case 'C':
            cout << 'G' << endl;
            break;
        case 'G':
            cout << 'C' << endl;
            break;
        default:
            break;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll a, b, c, d, k;
    cin>>a>>b>>c>>d>>k;
    ll ans = (c - a - 1) * 60;
    ll minutes = 60 - b + d;
    ans += minutes;
    ans -= k;
    cout<<ans<<endl;
}

Measured memory_bytes: 3584