akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int[] x = new int[3];
		int[] y = new int[3];
		int[] z = new int[3];
		String ans = "No";

		for (int i = 0; i < 3; i++) {
			x[i] = sc.nextInt();
		}
		for (int i = 0; i < 3; i++) {
			y[i] = sc.nextInt();
		}
		for (int i = 0; i < 3; i++) {
			z[i] = sc.nextInt();
		}
		
		if (x[0] - x[1] == y[0] - y[1] && z[0] - z[1] == y[0] - y[1] && x[0] - x[1] == z[0] - z[1]) {
			if (x[1] - x[2] == y[1] - y[2] && z[1] - z[2] == y[1] - y[2] && x[1] - x[2] == z[1] - z[2]) {
				if (x[2] - x[0] == y[2] - y[0] && z[2] - z[0] == y[2] - y[0] && x[2] - x[0] == z[2] - z[0]) {
					ans = "Yes";
				}
			}
		}

		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;
class Main {
	public void range() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a < b ) {
			if(a < c) {
				if(b < c) {
					System.out.println("Yes");
				}else { 
					System.out.println("No");
				}
			} else { 
				System.out.println("No");
			}
		} else { 
			System.out.println("No");
		}
	}
	public static void main(String[] args) {
		new Main().range();
	}
}

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

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

  vector<int> c(26);
  rep(i,0,25) cin >> c[i];

  vector<vector<int>> s(D);
  rep(i,0,D-1) {
    vector<int> tmp(26);
    rep(j,0,25) cin >> tmp[j];
    s[i] = tmp;
  }

  vector<int> t(D);
  rep(i,0,D-1) {
    int best = 0, best_j = 0;
    rep(j,0,25) {
      int term = s[i][j] - c[j];
      if (best < term) {
        best = term;
        best_j = j;
      }
    }
    t[i] = best_j + 1;
  };

  for (int i : t) cout << i << endl;
  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi acos(-1)
typedef long long ll;
using namespace std;

int main()
{
    Fast;
    ll n,m,i,j,k,ans=0;
    string s;
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=n;j++)
        {
            for(ll k=1;k<=n;k++)
            {
                m=__gcd(i,j);
                ll mm=__gcd(m,k);
                ans=ans+mm;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string n;
    cin >> n;
    int sum = 0;
    rep(i, 0, n.size()) {
        sum += n[i] - '0';
    }
    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int main() {
    int n, flag = 0;
    cin >> n;

    for (int i = 0; i <= n/4; i++) {
        for (int j = 0; j <= n/7; j++) {
            if (n == i*4+j*7) {
                flag = 1;
                break;
            }
        }
        if (flag) break;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (int)1.01e9;
const int N = 1 << 19;
const int MOD = (int)1e9 + 7;


int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    int n, m, k;
    while (cin >> n >> m >> k) {
        bool ok = 0;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                int cur = 0;
                cur += i * m;
                cur += j * n;
                cur -= 2 * i * j;
                ok |= cur == k;
            }
        }
        string ans = ok ? "Yes" : "No";
        cout << ans << endl;
    }

#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, x, A):
    A.sort()
    ans = 0
    for a in A:
        x -= a
        if x >= 0:
            ans += 1
        else:
            break
    else:
        if x != 0:
            ans -= 1
    return ans


def main():
    # N = read_int()
    N, x = read_int_n()
    A = read_int_n()
    print(slv(N, x, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 7764
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<ll, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

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_){//sizeがn_のsegtreeを作る
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }

  void build(const vector<T> &v){//vによってsegtreeをbuildする
    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){//k番目を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){//区間[a,b)に対しFを適応した値を返す
    if(a>=b) return ti;
    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);
  }

  template<typename C>
  int find(int st,C &check,T &acc,int k,int l,int r){//
    if(l+1==r){
      acc=f(acc,dat[k]);
      return check(acc)?k-n:-1;
    }
    int m=(l+r)>>1;
    if(m<=st) return find(st,check,acc,(k<<1)|1,m,r);
    if(st<=l&&!check(f(acc,dat[k]))){
      acc=f(acc,dat[k]);
      return -1;
    }
    int vl=find(st,check,acc,(k<<1)|0,l,m);
    if(~vl) return vl;
    return find(st,check,acc,(k<<1)|1,m,r);
  }

  template<typename C>
  int find(int st,C &check){
    T acc=ti;
    return find(st,check,acc,1,0,n);
  }

  T &operator [] (int i) {return dat[i+n];};
};

int n,m;
vector<P> ls[100010];

void solve(){
    cin >> n >> m;
    rep(i,m){
        int l,r;ll c;cin >> l >> r >> c;l--;r--;
        ls[r].emplace_back(c,l);
    }
    SegmentTree<ll> seg([](ll a,ll b){return min(a,b);},INF);
    seg.init(n-1);
    seg.set_val(0,0);
    Rep(i,1,n){
        ll res=INF;
        for(P p:ls[i]){
            int l=p.second;ll c=p.first;
            res=min(res,seg.query(l,i)+c);
        }
        seg.set_val(i,res);
    }
    if(seg[n-1]<INF)cout << seg[n-1] << endl;
    else cout << -1 << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* dlm = "";
  for(const auto& x:v) os << exchange(dlm, " ") << x;
  return os;
}
struct UnionFind{
  using val_t=size_t;
  vector<val_t> par;
  explicit UnionFind(size_t n): par(n) {
    iota(begin(par),end(par),0);
  }
  void connect(val_t s, val_t t){
    // par[root(s)]=t;
    par[root(s)]=root(t);
  }
  val_t root(val_t s){
    if(par[s]!=s) par[s]=root(par[s]);
    return par[s];
  }
  bool visit(val_t s, val_t t){
    return root(s)==root(t);
  }
};
int32_t main(){
  size_t n,m; cin>>n>>m;
  UnionFind tree(n);
  size_t s,t;
  // cout<<tree.par<<endl;;
  for(size_t i=0; i<m; ++i){
    cin>>s>>t;
    tree.connect(s,t);
  }
  // cout<<tree.par<<endl;
  size_t q; cin>>q;
  for(size_t i=0; i<q; ++i){
    cin>>s>>t;
    cout<<(tree.visit(s,t)?"yes\n":"no\n");
  }
}


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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N,K;
int A[5555];

bitset<5555>pre[5555],suf[5555];
signed main(){
    cin>>N>>K;
    rep(i,N)cin>>A[i];

    pre[0][0]=1;
    for(int i=0;i<N;i++){
        pre[i+1]=pre[i];
        if(A[i]<=K)pre[i+1]|=pre[i]<<A[i];
    }

    suf[N][0]=1;
    for(int i=N-1;i>=0;i--){
        suf[i]=suf[i+1];
        if(A[i]<=K)suf[i]|=suf[i+1]<<A[i];
    }

    int ans=0;
    rep(i,N){
        int d=K-1;
        int cnt=0;
        bool flag=false;
        for(int j=0;j<K;j++){
            while(d>=0&&j+d>=K-A[i]){
                cnt+=suf[i+1][d];
                d--;
            }
            if(pre[i][j]&&cnt)flag=true;
            if(suf[i+1][K-1-j])cnt--;
        }
        ans+=!flag;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 7424
#include <iostream>
#include <iomanip>
#include <queue>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    repi(i, n, 0)
    {
        int a;
        cin >> a;
        q.push(a);
    }
    repi(i, m, 0)
    {
        int a = q.top();
        q.pop();
        q.push(a / 2);
    }
    ll ans = 0;
    repi(i,n,0){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
//Pyramid

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    vector<int>x,y,h;
    rep(i,0,n){
        int a,b,c;cin>>a>>b>>c;
        if(c!=0)x.pb(a),y.pb(b),h.pb(c);
    }
    n=x.size();
    rep(i,0,101)rep(j,0,101){
        int r=h[0]+abs(i-x[0])+abs(j-y[0]);
        bool flag=true;
        rep(k,1,n){
            if(r!=h[k]+abs(i-x[k])+abs(j-y[k]))flag=false;
        }
        if(x.size()>1&&flag){
            cout<<i<<spa<<j<<spa<<r<<nnn;
            return 0;
        }
    }
    rep(i,0,n){
        if(h[i]>0)cout<<x[i]<<spa<<y[i]<<spa<<h[i]<<nnn;
    }
    return 0;
}

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

int main() {
    string s = "";
    for (int i = 0; i < 9; i++) {
        char a;
        cin >> a;
        if (i == 0 || i == 4 || i == 8) {
            s += a;
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int a[200],b;
int a_num,b_num,j=0;

int solve(int, int);
int main()
{

  int b_num,i,j = 0;


  scanf("%d",&a_num);
  for(i = 0;i < a_num; i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&b_num);
  for(i = 0;i < b_num; i++){
    scanf("%d",&b);
    j = 0;
    if(solve(j,b) == 1){
      printf("yes\n");
    }
    if(solve(j,b) == 0){
      printf("no\n");   
    }
  }
  
  return 0;
}


int solve(int i,int m)
{
  int res;
  if(m == 0)return 1;
  if(i >= a_num)return 0;
  res = solve(i+1,m) || solve(i+1,m-a[i]);
}
      

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL N, A, B;
  cin >> N >> A >> B;
  if(A > B){
	cout << 0 << endl;
	return 0;
  }

  if(N == 1 || A == B){
	cout <<(A != B? 0: 1) << endl;
	return 0;
  }
  
  N -= 2;
  cout << (N*(B - A) + 1) << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	if( s == "A" ){
		cout << "T" << endl;
	}
	if( s == "T" ){
		cout << "A" << endl;
	}
	if( s == "C" ){
		cout << "G" << endl;
	}
	if( s == "G" ){
		cout << "C" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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



	string S;
	cin >> S;
	int N = S.size();

	ll mod = 1e9 + 7;
	ll dp[100001][13] = {};
	dp[0][0] = 1;

	rep(i, N) {
		rep(j, 13) {
			if (S[i] == '?') {
				rep(k, 10) {
					int t = (j * 10 + k) % 13;
					dp[i + 1][t] += dp[i][j];
					dp[i + 1][t] %= mod;
				}
			}
			else {
				int t = (j * 10 + S[i] - '0') % 13;
				dp[i + 1][t] += dp[i][j];
				dp[i + 1][t] %= mod;
			}
		}
	}
	co(dp[N][5]);

	Would you please return 0;
}

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

struct UnionFind{
  vector<int> data;
  int __size;
  UnionFind(int sz) {
  data.assign(sz, -1);
  __size = sz;
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);//親は負でサイズを保存
    __size--;
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }

  int union_count() {
    return (__size);
  }
};

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

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> g(h);
  rep(i,h) cin >> g[i];

  UnionFind uf(h * w);

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

      for (int k = 0; k < 4; k++) {
        int x = dx[k] + i, y = dy[k] + j;
        if (x < 0 || y < 0 || x >= h || y >= w) continue;
        if (g[x][y] == '.') continue;
        uf.unite(i * w + j, x * w + y);
      }

    }
  }

  bool ok = true;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (g[i][j] == '.') continue;
      ok &= (uf.size(i * w + j) != 1);
    }
  }

  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
} 

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

    bool ans = true;
    int count = 0;
    int upper_count = 0;
    rep(i, s.length()){
        if(s[0] != 'A'){
            ans = false;
            break;            
        }
        if(i >= 2 && i <= s.length()-2){
            if(s[i] == 'C'){
                count++;
            }
        }
        if(isupper(s[i])){
            upper_count++;
        }
    }

    if(upper_count == 2 && count == 1 && ans){
        cout << "AC";
    }
    else{
        cout << "WA";
    }

    return 0;
}

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

int main() {
  int n;  // 読み込む整数の個数
  int min, max;  // 合計, 最小, 最大
  long long sum = 0;

  // 整数の個数を読み込み
  cin >> n;

  for (int i = 0; i < n; i++) {
    int value;  // 読み込み対象の整数
    cin >> value;

    // 合計の積み上げ
    sum += value;

    // 最小・最大の更新
    if (i == 0) {
      // 最初の要素は必ず最大・最小とする
      min = max = value;
    } else {
      if (value < min)
        min = value;
      if (max < value)
        max = value;
    }
  }

  cout << min << " " << max << " " << sum << endl;
  return 0;
}



Measured memory_bytes: 3092
n = int(input())
L = list(map(int, input().split()))
#l, r, d = map(int, input().split())
#p = list(set(L))
q = sorted(L)
ans = 0
if n < 3:
  ans  = 0
elif n >= 3:
  for i in range(n - 2):
    for j in range(i+1, n -1 ):
      for k in range(j+1,n):
        if q[k] < q[i] + q[j] and q[i] != q[j] and q[j]  != q[k] and q[k] != q[i]:
          ans += 1

print(ans)

Measured memory_bytes: 9220
#include<stdio.h>
int main(void)
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(abs(a-c)<=d || (abs(a-b)<=d && abs(c-b)<=d))
        printf("Yes\n");
else printf("No\n");

return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if (a<b&&b<c){
cout<<"Yes"<<endl;
} else if (a>b&&b<c){
cout<<"No"<<endl;
} else if (a>b&&b>c){
cout<<"No"<<endl;
} else if (a<b&&b>c){
cout<<"No"<<endl;
} else if (a>b&&b==c){
cout<<"No"<<endl;
} else if (a==b&&b>c){
cout<<"No"<<endl;
} else if (a<b&&b==c){
cout<<"No"<<endl;
} else if (a==b&&b<c){
cout<<"No"<<endl;
} else if (a==b&&b==c){
cout<<"No"<<endl;
}
return 0;
}


Measured memory_bytes: 3080
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define N 51
using namespace std;
char Change(char,char);
bool Check(vector<int>,vector<char>,vector<int>,vector<char>);

int main(){
  int n,m,x,y,bx,by;
  char d;
  vector<int> v[N];
  vector<char> c[N],dir[N];
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<=n;i++){
      cin>>m;
      for(int j=0;j<m;j++){
	cin>>x>>y;
	if(j){
	  v[i].push_back(max(abs(bx-x),abs(by-y)));
	  if(by==y){
	    if(x-bx>0) d='r';
	    else d='l';
	  }else{
	    if(y-by>0) d='u';
	    else d='d';
	  }
	  c[i].push_back(d);
	}
	bx=x,by=y;
      }
      for(int j=0;j<c[i].size()-1;j++) dir[i].push_back(Change(c[i][j],c[i][j+1]));
    }
    for(int i=1;i<=n;i++)
      if(Check(v[0],dir[0],v[i],dir[i])) cout<<i<<endl;
    cout<<"+++++"<<endl;
    for(int i=0;i<=n;i++) v[i].clear(),c[i].clear(),dir[i].clear();
  }
  return 0;
}

char Change(char a,char b){
  if((a=='u'&&b=='r')||(a=='r'&&b=='d')||(a=='d'&&b=='l')||(a=='l'&&b=='u')) return 'l';
  return 'r';
}

bool Check(vector<int> a,vector<char> b,vector<int> c,vector<char> d){
  if(a.size()!=c.size()) return false;
  if(a==c&&b==d) return true;
  reverse(c.begin(),c.end());
  reverse(d.begin(),d.end());
  for(int i=0;i<d.size();i++) d[i]=='l'?d[i]='r':d[i]='l';
  if(a==c&&b==d) return true;
  return false;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, k;
  cin >> n >> k;
  int in;
  rep(i, n) {
    int a;
    cin >> a;
    if(a == 1) in = i;
  }
  int ans = (n + k - 3) / (k - 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
int ans=0;
for(int _n=1;_n<=n;_n+=2){
    int cnt=0;
    for(int i=1;i<=_n;i+=2){
        if(_n%i==0){
            cnt++;
        }
    }
    if(cnt==8)ans++;
}
cout<<ans<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
N=gets.to_i
S=gets
pc=S.count ?1
X=S.to_i(2)
xl=pc==1 ? 0 : X%~-pc
xr=X%-~pc
f=[0]
1.upto(N){f<<f[_1%('%b'%_1).count(?1)]+1}
N.times{nc=S[_1][?1] ? pc-1 : pc+1
p nc==0 ? 0 : f[nc==pc+1 ? (xr+2.pow(N+~_1,nc))%nc : (xl-2.pow(N+~_1,nc))%nc]+1}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int i;
  for (int i = A.size() - 1; i >= 0; i -= 2) {
    cout << A[i] << " ";
  }
  i += (N % 2 == 0 ? 0 : 1);
  for (; i < A.size(); i += 2) {
    cout << A[i] << " ";
  }
  return 0;
}


Measured memory_bytes: 3072
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        /*int s = in.nextInt();
        String S = Integer.toString(s);*/
        String S = in.nextToken();
        int count = 0;

        for (int i = 0; i < 3; i++)
        {
            char digit = S.charAt(i);
            if (digit == '1') //'x' char, "x" string.  Use == for primitive types (char, int, double, long, etc) and .equals() for others (String, ArrayList, etc)
            {
                count ++;
            }


        }
        System.out.println(count);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 21332
#include <iostream>
 
using namespace std;
 
int main() {
  string s = "";
  cin >> s;
  int a = 0;
  int b = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'A') {
      a = 1;
    } else if (s[i] == 'B') {
      b = 1;
    }
  }
  
  if (a == 1 && b == 1) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc167/tasks/abc167_c
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N, M, X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));

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

        for(int j = 0; j < M; ++j) {
            cin >> A[i][j];
        }
    }

    int minima = 1<<30;

    for(int mask = 0; mask <= (1<<N)-1; ++mask) {
        int total = 0;
        vector<int> level(M);

        for(int bit = 0; bit < N; ++bit) {
            if(mask&(1<<bit)) {
                total += C[bit];

                for(int i = 0; i < M; ++i) {
                    level[i] += A[bit][i];
                }
            }
        }

        if(none_of(level.begin(),
                    level.end(),
                    [=](int x) { return x < X; })
          ) {
            minima = min(minima, total);
        }
    }

    if(minima == 1<<30)
        minima = -1;

    cout << minima << endl;

    return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;
const ll INF = 1e9+10;

const double PI = acos(-1);

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 
	int a, b, h, m; cin >> a >> b >> h >> m;

	double ang = (abs(11*m-60*h)/2.0)*(PI/180.0);
	//if(ang >= PI) ang=2*PI-ang;
	cout << setprecision(10) << fixed;
	cout << sqrt(a*a + b*b - 2*a*b*cos(ang)) << '\n';

	return 0;
}

Measured memory_bytes: 4140
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
long long const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            // res = res*a;
            res = (res*a)%m;
        }
        a=(a*a)%m;
        // a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x , int m){
    return power(x,m-2,m);
}

int const N = 5e5+5;
int const inf = 2e9;

void solve(){  
    int i,j;   
    int n,k;
    cin >> n >> k;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=k;i<n;i++){
        if(a[i] > a[i-k]) {
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}        



int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;  
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*


*/

Measured memory_bytes: 5220
import qualified Data.Map as MP
import Data.Char
import Data.List
import Control.Monad
import Debug.Trace

step :: MP.Map Int Bool -> Int -> MP.Map Int Bool
step m i = 
    case MP.lookup i m of
        Just _ -> MP.adjust (||True) i m
        Nothing -> m

step' :: Bool -> (Int, Int, Int) -> MP.Map Int Bool -> Bool
step' j (a,b,c) m =
    let
        Just x = MP.lookup a m
        Just y = MP.lookup b m
        Just z = MP.lookup c m
    in
        j || (and [x,y,z])

main = do
    [a,b,c] <- map read . words <$> getLine :: IO [Int]
    [d,e,f] <- map read . words <$> getLine :: IO [Int]
    [g,h,i] <- map read . words <$> getLine  :: IO [Int]
    n <- readLn :: IO Int
    xs <- replicateM n readLn :: IO [Int]
    let m = foldl' (\m k -> MP.insert k False m) MP.empty [a,b,c,d,e,f,g,h,i]
    let m' = foldl' step m xs
    let res = foldl' (\b x -> step' b x m') False [(a,b,c), (d,e,f), (g,h,i), (a,d,g), (b,e,h), (c,f,i), (a,e,i), (c,e,g)]
    putStrLn $ if res then "Yes" else "No"

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
signed main(){
  cin>>n>>m;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int x[m],y[m];
  for(int i=0;i<m;i++) cin>>x[i]>>y[i];
  int c[n+1],d[n+1];
  memset(c,0,sizeof(c));
  memset(d,0,sizeof(d));
  for(int i=0;i<n;i++) c[a[i]]++;
  for(int i=1;i<=n;i++)
    for(int j=0;j<c[i];j++)
      if(i-j>0) d[i-j]++;

  int ans=0;
  for(int i=1;i<=n;i++)
    if(d[i]==0) ans++;

  //cout<<ans<<endl;
  //for(int i=1;i<=n;i++) cout<<i<<" "<<d[i]<<endl;
    
  for(int i=0;i<m;i++){
    x[i]--;
    
    c[a[x[i]]]--;
    if(a[x[i]]-c[a[x[i]]]>0){
      d[a[x[i]]-c[a[x[i]]]]--;
      //cout<<a[x[i]]-c[a[x[i]]]<<" "<<d[a[x[i]]-c[a[x[i]]]]<<endl;
      if(d[a[x[i]]-c[a[x[i]]]]==0) ans++;
    }
    
    a[x[i]]=y[i];

    if(a[x[i]]-c[a[x[i]]]>0){
      d[a[x[i]]-c[a[x[i]]]]++;
      //cout<<a[x[i]]-c[a[x[i]]]<<" "<<d[a[x[i]]-c[a[x[i]]]]<<endl;
      if(d[a[x[i]]-c[a[x[i]]]]==1) ans--;
    }
    c[a[x[i]]]++;

    //for(int j=1;j<=n;j++) cout<<j<<" "<<d[j]<<endl;
    
    cout<<ans<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 10240
stack = []

q = int(input())
for i in range(q):
    op = list(map(int, input().split(' ')))
    if op[0] == 0:
        stack.append(op[1])
    elif op[0] == 1:
        print(stack[op[1]])
    elif op[0] == 2:
        stack.pop()


Measured memory_bytes: 13360
N, M, Q = (int(i) for i in input().split())  
ABCD = []
ans = -1

for _ in range(Q):
  ABCD.append([int(i) for i in input().split()] )

comb_list = []

import sys
sys.setrecursionlimit(100000000)
def recur(N, lis, c):
  if len(lis) == N:
    comb_list.append(lis)
    return

  if lis == []:
    for i in range(1, M+1):
      recur(N, [i], c+1)
  else:
    for i in range(lis[c], M+1):
      recur(N, lis + [i], c+1)     

recur(N, [], -1)
for x in comb_list:
    tmp = 0
    for a, b, c, d in ABCD:
        if x[b-1] - x[a-1] == c:
             tmp += d           
    ans = max(ans, tmp)   
print(ans)

Measured memory_bytes: 22912
#include <string.h>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 2e5+7;
long long a[maxn],f[maxn],n;
int check(long long mid,long long k)
{
    int F = n;
    for(int i =0; i< n; i++)
    {
        F--;
        if(a[i]*f[F]>mid)
        {
            k -= (a[i]*f[F]-mid)/f[F];
            if((a[i]*f[F] - mid) % f[F] != 0) k--;
        }
    }
    if(k<0)
        return 0;
    else
        return 1;

}
int main()
{

    long long k,Min;
    scanf("%lld%lld",&n,&k);
    for(int i=0 ; i<n ; i++)
    {
        scanf("%lld",&a[i]);
    }
    for(int i=0 ; i<n ; i++)
    {
        scanf("%lld",&f[i]);
    }
    sort(a,a+n);
    sort(f,f+n);
    long long l = 0, r = a[n-1] * f[n-1];
    long long ans;
    while(l<=r)
    {

        long long  mid = (l + r + 1)/2;
        if(check(mid,k)==1)
        {
            ans = mid;
            r = mid - 1;

        }
        else
            l = mid + 1;

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

}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(i,p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//B

int main(void) {
	ll n;
	cin >> n;
	vector<ll> p = vector<ll>(n);
	rep(i, 0, n)cin >> p[i];
	ll count = 0;
	rep(i, 1, n - 1) {
		ll pi = p[i];
		ll pMx = max(p[i - 1], p[i + 1]);
		ll pMn = min(p[i - 1], p[i + 1]);
		if (pMn < pi && pi <= pMx)count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
#define plll pair<ll,pll>
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
FO
void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    int xxor=0;
    for(int i=0;i<n;i++){
        xxor=xxor^arr[i];
    }
    for(int i=0;i<n;i++) cout<<(xxor^arr[i])<<" ";
    return;
}
int main(){
    //IO FO
    //TEST
    solve();

    return(0);
}


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

int main(void){
    string s;
    cin >>s;
    if (s[1]==s[2])
    {
        if (s[0]==s[1]||s[2]==s[3])
        {
            cout << "Yes";
        }else
        {
            cout << "No";
        }
    }
    else
    {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mod 1000000007

int Max(int x, int y)
{
    return (((y-x)>>(32-1))&(x^y))^y;
}

int Min(int x, int y)
{
    return (((y-x)>>(32-1))&(x^y))^x;
}

struct job
{
    int dur, dl;
};

bool cmp(job a, job b)
{
    if(a.dl==b.dl)
    {
        // if(a.st==b.st)
            return a.dur<b.dur;
        // return a.st<b.st;
    }
    return a.dl<b.dl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //Initialize variables while declaring them
    int n;
    cin>>n;
    job arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i].dur>>arr[i].dl;
        // arr[i].dur=i+1;
    }
    sort(arr, arr+n, cmp);
    int tim=0;
    for(int i=0; i<n; i++)
    {
        if(tim+arr[i].dur>arr[i].dl)
        {
            cout<<"No";
            return 0;
        }
        tim+=arr[i].dur;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3328
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
data = [0] * N
if N != 1:
    for _ in range(N):
        A,B = [int(x) for x in stdin.readline().rstrip().split()]
        data[_] = (A,B)
    data=sorted(data)
    max_value = 0
    diff = []
    for j in range(0,N-1):
        for i in range(j+1,N):
            diff.append((data[j][0]-data[i][0],data[j][1]-data[i][1]))
    d=Counter(diff)
        #max_value = max(max_value,max(d.values()))
    print(N-max(d.values()))
else:
    print(1)

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

int main() {
    string S;
    cin >> S;
    int N;
    N = S.size();
    int count  = 0;
    int ans = 0;

    for(int i = 0;i<N;i++){
        if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T'){
            count++;
            if(ans <= count){
                ans = count;
            }
        }
        else{
            count = 0;
        }
        
    }
    cout << ans << 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);

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--; b--; c--; d--;
    string s;
    cin >> s;

    int mini = min(a, b);
    int maxi = max(c, d);

    bool ok = true;
    for(int i = mini; i < maxi - 1; i++)
        if (s[i] == '#' && s[i + 1] == '#') {
            ok = false;
            break ;
        }

    if (ok) {
        if (c > d) {
            bool okD = false;
            for (int i = b - 1; i < d; i++)
                if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') {
                    okD = true;
                    break ;
                }
            if (!okD) ok = false;
        }
    }

    if (ok) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int n;
vvi to;
vi cost;
vi ans;
int cnt;

void dfs(int v, int p=-1) {
    ans[v] = cost[cnt++];
    for (int nv : to[v]) {
        if (nv == p) continue;
        dfs(nv, v);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n;
    to.resize(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].pb(b);
        to[b].pb(a);
    }
    cost.resize(n);
    rep(i, n) cin >> cost[i];
    sort(cost.rbegin(), cost.rend());

    ans.resize(n);
    dfs(0);
    cout << accumulate(cost.begin()+1, cost.end(), 0) << endl;
    rep(i, n) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
}

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

int needPushNum(std::vector<int>& as) {
  std::vector<bool> visited(as.size(), false);
  int i = 0;
  int cnt = 1;
  while(1) {
    if (visited[i])
      return -1;
    visited[i] = true;
    i = as[i] - 1;
    if (i == 1)
      return cnt;
    cnt++;
  }
}

int main() {
  int N;
  std::cin >> N;
  std::vector<int> as;
  for (int i = 0; i < N; ++i)  {
    int a;
    std::cin >> a;
    as.push_back(a);
  }
  std::cout << needPushNum(as) << std::endl;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, k,a1,a2;
    cin>>n>>k>>a1>>a2;
    long long ans;
    if(k<n)ans=k*a1+(n-k)*a2;
    else
        ans=n*a1;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func insertionSort(a []int) {
	for i := 1; i < len(a); i++ {
		printArr(a)

		v := a[i]
		j := i - 1
		for ; j >= 0 && a[j] > v; j-- {
			a[j+1] = a[j]
		}
		a[j+1] = v
	}
}

func main() {
	var n int
	fmt.Scan(&n)
	var a []int
	for i := 0; i < n; i++ {
		var e int
		fmt.Scan(&e)
		a = append(a, e)
	}
	insertionSort(a)
	printArr(a)
}

func printArr(a []int) {
	for i := 0; i < len(a); i++ {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(a[i])
	}
	fmt.Println()
}



Measured memory_bytes: 1212
// Marcin Knapik
#include<bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp> // order_of_key
//#include <ext/pb_ds/tree_policy.hpp> // find by order
//using namespace __gnu_pbds; 
//#define ordered_set tree< int , null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)
#define losuj_real(a, b) uniform_real_distribution<long double>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second
#define rr "\e[31m "
#define bb "\e[m "

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll BIG_INF = 1e18 + 7;

ll n, m;

ll dp[3004][3005];
ll pref[3004][3005];
ll suf[3004][3005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);	
	
	cin >> n;
	string s;
	cin >> s;

	dp[1][1] = suf[1][1] = pref[1][1] = 1;

	for(int i = 2; i <= n; i++){
		for(int j = 1; j <= i; j++){
			if(s[i-2] == '>')
				dp[i][j] = suf[i-1][j];
			else
				dp[i][j] = pref[i-1][j-1];
		}
		for(int j = 1; j <= i; j++)
			pref[i][j] = (pref[i][j-1] + dp[i][j])%INF;
		for(int j = i; j >= 1; j--)
			suf[i][j] = (suf[i][j+1] + dp[i][j])%INF; 
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += dp[n][i];
	cout << ans % INF;
}	


Measured memory_bytes: 210048
#include <iostream>
#define ll long long
using namespace std;
ll min(ll a,ll b)
{
	return a<b?a:b;
}
ll abs_val(ll a)
{
	return a<0?(-1*a):a;
}
int main() {
	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	ll dp[n+1];
	dp[0]=0;
	for(ll i=1;i<n;i++)
	{
		if(i==1)
		{
			dp[i]=abs_val(arr[i]-arr[i-1]);
		}
		else
		{
			dp[i] = min(dp[i-1]+(abs_val(arr[i]-arr[i-1])),dp[i-2]+abs_val(arr[i]-arr[i-2]));
		}
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    string s,t;
    cin>>s>>t;
    string ans="";
    ans+=t;
    ans+=s;
    cout<<ans<<endl;
}

Measured memory_bytes: 3616
/******************************************
* AUTHOR : AAYUSH GARG*
* NICK : aayushgarg_03 *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define dd double
#define ld long double
#define for0(i, n) for(ll i = 0; i < n; i++)
#define for2(a,b,c) for(ll i=a;i<b;i+=c)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define vec vector<ll>
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define VP vector< pii >
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define ascii(c) (int)char (c)
#define all(v) (v).begin(),(v).end()
#define Sort(v) sort(v.begin(), v.end(), sortbysec)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define N 1000000

ll prime[N];

ll mulmod(ll a, ll b, ll m) 
{ 
    ll res = 0;  
    a = a % m; 
    while (b > 0) 
    { 
       
        if (b % 2 == 1) 
            res = (res + a) % m; 
  
        
        a = (a * 2) % m; 
  
        
        b /= 2; 
    } 
  
    return res % m; 
} 

ll modInverse(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        
        ll q = a / m; 
        ll t = m; 
  
        m = a % m, a = t; 
        t = y; 
  
        
        y = x - q * y; 
        x = t; 
    } 
  
    
    if (x < 0) 
       x += m0; 
  
    return x; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;  
  
    while (y > 0) 
    { 
        
        if (y & 1) 
            res = (res*x) % p; 
  
         
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
}

void sieve() {
    for(ll i = 0;i < N;i++)
        prime[i] = 1;
    prime[0] = 0;
    prime[1] = 0;
    for(ll i = 2;i*i < N;i++) {
        if(prime[i] == 0)
            continue;
        for(ll j = i*i;j < N;j+=i) {
            prime[j] = 0;
        }
    }
    for(ll i = 1;i < N;i++)
        prime[i] += prime[i-1];
}



bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

int main() 
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);


//ll t; cin>>t; while(t--){}

ll n,W;
cin>>n>>W;

ll wt[n];
ll val[n];
for0(i,n)
 cin>>wt[i]>>val[i];

ll K[n+1][W+1]; 
  
   
   for (ll i = 0; i <= n; i++) 
   { 
       for (ll w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 

   cout<<K[n][W];




return 0;
}


Measured memory_bytes: 79104