akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int L = 20;
const int H = 5;
const int W = 4;
int dp[1<<L];
int num[L];
vector<int> G(L);

void shift() {
  for(int i = 0, j = 0; i < L; ++i) {
    if(G[i] != -1) {
      int tmp = G[i];
      G[i] = -1;
      G[j++] = tmp;
    }
  }
}

void show(const vector<int> &g) {
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      int k = i * W + j;
      int val = g[k] == -1 ? 0 : num[g[k]];
      if(j) cout << " ";
      cout << val;
    }
    cout << endl;
  }
}

int rec(int bit) {
  int &res = dp[bit];
  if(res != -1) return res;
  res = 0;
  for(int i = 0; i < L; ++i) {
    if(G[i] == -1) break;
    int x = i % W;
    int y = i / W;
    for(int dx = -1; dx <= 1; ++dx) {
      for(int dy = -1; dy <= 1; ++dy) {
        if(dx == 0 && dy == 0) continue;
        int nx = x + dx;
        int ny = y + dy;
        if(nx < 0 || nx >= W) continue;
        if(ny < 0 || ny >= H) continue;
        int j = nx + ny*W;
        if(G[j] == -1) continue;
        if(num[G[i]] == num[G[j]]) {
          vector<int> g = G;
          int nbit = (bit|(1<<G[i])|(1<<G[j]));
          G[i] = G[j] = -1;
          shift();
          res = max(res, rec(nbit)+1);
          G = g;
        }
      }
    }
  }
  return res;
}

int main() {
  int T;
  cin >> T;
  while(T--) {
    for(int i = 0; i < L; ++i) {
      cin >> num[i];
      G[i] = i;
    }
    fill(dp, dp+(1<<L), -1);
    cout << L-2*rec(0) << endl;
  }
  return 0;
}

Measured memory_bytes: 5312
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

//#define scanf scanf_s
int n, s;
int cnt;

void dfs(int i, int j, int sum)
{
	if (i == n)
	{
		if (sum == s) cnt++;
	}
	else if (j <= 9&&sum<=s)
	{
		dfs(i + 1, j + 1, sum + j);
		dfs(i, j + 1, sum);
	}
}

int main()
{
	while (cin >> n >> s)
	{
		if (n == 0 && s == 0) return 0;
		cnt = 0;
		dfs(0, 0, 0);
		cout << cnt << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

    ll n, k;
    cin >> n >> k;

    ll ret = 0;
    REP(i, n) {
        ll h;
        cin >> h;
        if(h >= k) ret++;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
using ll = long long;

const int MOD = (int)1e9 + 7;
struct mint { int n; mint(int n = -1) : n(n) { } };     // default: -1
mint operator+(mint a, mint b) { return (a.n += b.n) >= MOD ? a.n - MOD : a.n; }
bool operator!=(mint a, mint b) { return a.n != b.n; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
ostream &operator<<(ostream &os, mint a) { return os << a.n; }

map<pair<ll, ll>, mint> memo;

mint func(ll s, ll x) {
    if (memo[{s, x}] != -1) return memo[{s, x}];
    if (s == 0) return 1;
    mint res = func(s / 2, x / 2);
    if (s && x) res += func((s - 1) / 2, (x - 1) / 2);
    if (s > 1) res += func((s - 2) / 2, x / 2);
    return memo[{s, x}] = res;
}

int main() {
    ll n; cin >> n;
    cout << func(n, n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ll long long
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll gcd(ll p,ll q){for(ll t;q;)t=p%q,p=q,q=t;return p;}
ll lcm(ll p,ll q){return p/gcd(p,q)*q;}
ll asc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
// qsort(array, length, sizeof(int), asc);

int main(void) {
    char S[101];
    scanf("%s", S);
    int f=0;
    for(int i=0;i<strlen(S);i++){
        if(i%2==0){
            if(S[i]=='R' || S[i]=='U' || S[i]=='D') continue;
            f=1; break;
        }else{
            if(S[i]=='L' || S[i]=='U' || S[i]=='D') continue;
            f=1; break;
        }
    }
    if(f==0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
	int a, b, c;
	int ans = 0;
	
	cin >> a >> b >> c;
	
	a -= b + 2 * c;
	ans++;
	
	ans += a / (b + c);
	
	cout << ans << endl;
	
	return (0);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = 0;
		for (int k = 1; k <= n; k+=2){
			int cnt = 0;
			for (int h = 1; h <= k; h++) {
				if (k % h == 0) { cnt++;}
			}
			if (cnt == 8) {q++;}
		}
		System.out.println(q);
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    ll MOD=1e9+7;
    ll ans=0;
    int N; cin>>N;
    int A[N];
    rep(i,N)cin>>A[i];
    ll SUM[N];
    ll a=0;
    rep(i,N-1){
        a+=A[i+1];
    }
    SUM[0]=0;
    SUM[1]=a;
    rep(i,N-2){
        SUM[i+2]=SUM[i+1]-A[i+1];
    }
    rep(i,N-1){
        ll b=(SUM[i+1]%MOD)*A[i]%MOD;
        ans+=b;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5972
#include <cstdio>
#include <utility>
#include <vector>
#include <complex>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;

using Point=complex<double>;
using Plane=vector<Point>;
using Polygon=vector<Point>;

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

double get_distance(const Line &l, const Point &p) {
    return abs(cross_prod(l.second-l.first, p-l.first))/abs(l.second-l.first);
}

template <class LineType>
pair<pair<double, double>, double> get_stdform(const LineType &l) {
    double dx=real(l.second)-real(l.first);
    double dy=imag(l.second)-imag(l.first);
    double k=-dx*imag(l.first)+dy*real(l.first);

    return make_pair(make_pair(-dy, dx), k);
}

template <class LineType>
pair<Point, Point> get_ipoints(const Circle &c, const LineType &l) {
    double a=imag(l.first)-imag(l.second);
    double b=real(l.second)-real(l.first);
    double k=-b*imag(l.first)-a*real(l.first);

    double d=a*real(c.p)+b*imag(c.p)+k;
    double r=c.r;

    double R=a*a+b*b;
    double D=sqrt(R*r*r-d*d);
    Point p1=c.p+polar(1/sqrt(R), atan2(b, a))*Point(-d, D);
    Point p2=c.p+polar(1/sqrt(R), atan2(b, a))*Point(-d, -D);

    if (p2 < p1)
        swap(p1, p2);

    return make_pair(p1, p2);
}

int main() {
    double x, y, r;
    scanf("%lf %lf %lf", &x, &y, &r);
    Circle c(Point(x, y), r);

    size_t q;
    scanf("%zu", &q);

    for (size_t i=0; i<q; ++i) {
        double x, y;
        scanf("%lf %lf", &x, &y);
        Point p1(x, y);

        scanf("%lf %lf", &x, &y);
        Point p2(x, y);

        Line l(p1, p2);
        pair<Point, Point> ps=get_ipoints(c, l);
        printf("%.9f %.9f ", real(ps.first), imag(ps.first));
        printf("%.9f %.9f\n", real(ps.second), imag(ps.second));
    }

    return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  vector<int> X(N);
  rep(i, N) {
    cin >> X[i];
  }

  int ans = INF;
  repp(P, 1, 100) {
    int sum = 0;
    rep(i, N) {
      sum += pow(P - X[i], 2);
    }
    chmin(ans, sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
int main(){
  int N, C[500], S[500], F[500], T[500], i, j;
  scanf("%d", &N);

  for(i=0; i<N-1; i++){
    scanf(" %d%d%d", &C[i], &S[i], &F[i]);
  }

  for(i=0; i<N-1; i++){
    T[i]=0;
    for(j=i; j<N-1; j++){
      if(T[i]<S[j])
        T[i]=S[j];
      else
        T[i]=(T[i]%F[j])?(T[i]/F[j]+1)*F[j]:T[i];
      T[i]+=C[j];
    }
    printf("%d\n",T[i]);
  }
  printf("0\n");

}


Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;

int main(){
  ll n,m; cin >> n >> m;
  ll a[n];
  REP(i,n) cin >> a[i];
  sort(a,a+n);
  vector<p> replace;
  REP(i,m){
    ll b,c; cin >> b >> c;
    replace.push_back(p(c,b));
  }
  sort(replace.begin(),replace.end(),greater<p>());
  int card_num = 0;
  int card_cnt = 0;
  ll ans = 0;
  bool finished = false;
  REP(i,n){
    if(finished) ans += a[i];
    else ans += max(a[i],replace[card_num].first);
    card_cnt++;
    if(card_cnt==replace[card_num].second){
      card_num++;
      card_cnt = 0;
      if(card_num==m){
        finished = true;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3188
n, m = map(int, input().split())
list_MAP = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    list_MAP[a-1][b-1] = 1
    list_MAP[b-1][a-1] = 1

dp = [[0]*n for _ in range(1<<n)]
dp[1][0] = 1
for num in range(1<<n):
    for v in range(n):
        if num & (1<<v) == 0:
            continue
        sub = num ^ (1<<v)

        for u in range(n):
            if sub & (1<<u) and list_MAP[v][u]:
                dp[num][v] += dp[sub][u]
ans = sum(dp[(1 << n) - 1][u] for u in range(1, n))
print(ans)

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,m,ans=0,c=0; cin>>n>>m;
    vector<vector<int>> q(m);
    rep(i,m){
        int k; cin>>k;
        q[i].assign(k,0);
        rep(j,k) cin>>q[i][j];
    }
    rep(i,m){
        int p; cin>>p;
        c^=(p<<i);
    }
    rep(i,(1<<n)){
        int cnt=0;
        rep(j,m)rep(k,q[j].size()){
            if(i&(1<<(q[j][k]-1))) cnt^=(1<<j);
        }
        if(c==cnt) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Print(bool c)
{
    if (c)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int count(int x)
{
    if (x == 0)
        return 0;
    else
        return count(x >> 1) + (x & 1);
}

int main()
{
    int x;
    int prime[1000000];
    rep(i, 0, 1000000) prime[i] = 1;
    cin >> x;
    for (int i = 2;; i++)
    {
        if (i >= x)
        {
            for (int j = x;; j++)
            {
                if (prime[j])
                {
                    cout << j << endl;
                    return 0;
                }
            }
        }
        if (prime[i])
        {
            for (int j = 0; j < 1000000 / i + 1; j++)
                prime[i * j] = 0;
        }
    }
}


Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (56)
ll n, k, s, t, B[MAXN], ans, A[MAXN], co, C[MAXN][MAXN], ways[MAXN];
bool inc(ll x,ll bit) { return bool(x&(1<<bit)); }
int main(){
	FAST
	cin>>n>>k>>s>>t;
	FOR(j,0,17)if(inc(s,j) && !inc(t,j)) { cout<<"0\n"; return 0; }
	FOR(i,1,n)cin>>B[i];
	FOR(i,1,n){
		bool in=1;
		FOR(j,0,17){
			if(inc(s,j)==inc(t,j)){
				if(inc(B[i],j) ^ inc(s,j)) in=0;
			}
		}
		if(in)A[++co]=B[i];
	}
	n=co;
	FOR(i,0,MAXN-1)C[i][0]=1;
	FOR(i,1,MAXN-1)FOR(j,1,MAXN-1)C[i][j]+=C[i-1][j-1]+C[i-1][j];
	FOR(i,1,MAXN-1){
		FOR(j,1,min(i,k)){
			ways[i] += C[i][j];
		}
	}
	FOR(k,0,(1<<18)-1){
		bool bad=0;
		FOR(j,0,17)if(1<<j&k)if(inc(s,j)==inc(t,j))bad=1;
		if(bad)continue;
		vector<ll> v;
		FOR(i,1,n){
			v.eb(A[i] & k);
		}
		ll sign=((__builtin_popcount(k) & 1) ? -1 : 1);
		sort(all(v));
		for(ll s=0,e=0;s<v.size();s=e+1,++e){
			while(e+1<siz(v) && v[e] == v[e+1]) ++ e;
			ans += sign * ways[e-s+1];
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define shalaby ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);cerr.tie(0);
#define mod 100000000
using namespace std;

inline int D()
{
    int t;
    scanf("%d",&t);
    return t;
}
inline ll llD()
{
    ll t;
    scanf("%lld",&t);
    return t;
}
 ll Max=1e18+8;
const int OO=-1e6;
int xt[4]= {1,0,0,-1};
int yt[4]= {0,1,-1,0};
////////////////////////////////////////////////////////////////////////////////////

ll mem[100005][3],a[105],b[105],n,m,k;
bool valid(int x,int y)
{
    return x>-1 && y>-1 && x<n && y<m;
}
void init()
{
    memset(mem,-1,sizeof mem);
}
string st[100005],rev[100005];
/////////////////////////////////////////////////////////////////////




int main()
{
    init();
    int T=1;
///   T=D();
    while(T-->0)
    {
        double a,b,c;
        cin >> a>>b>>c;
        if((a/b)<=c)
            cout<<"Yes";
        else cout<<"No";



    }
}


Measured memory_bytes: 12276
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i; i < n; i++) cin >> A[i];
  int ans = -1;
  for (int curr = 1 - 1, cnt = 1, i = 0; i < n; i++, cnt++) {
    if (A[curr] - 1 == 2 - 1) {
      ans = cnt;
      break;
    }
    curr = A[curr] - 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#1 コマは片方の方向に動かした方が効果的
#2 コマをはじめにおく位置は訪れるべき整数の方がよい
#3 M個の区間で覆うその長さの総和がコマの総移動距離になる
#4 M個の区間の最小値=M個の区間で覆われてない区間の最大値を最大にすればいい
#5 M個の区間で覆うということは覆われてない区間はmー１個ある
#6 よって区間の最大値を求めて上からm-1個選べばいい

n,m=list(map(int,input().split()))
x=list(map(int,input().split()))
x.sort()

if n>=m:
  print(0)
else:
  h=[]
  for i in range(1,m):
    h.append(x[i]-x[i-1])
  h.sort(reverse=True)
  print(x[m-1]-x[0]-sum(h[:n-1]))
  
  

Measured memory_bytes: 20276
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define bolt ios::sync_with_stdio(0)
#define light cin.tie(0);cout.tie(0)
#define umll unordered_map<ll,ll>
#define mll map<ll,ll>
#define forr(i,p,n) for(ll i=p;i<(ll)n;i++)
#define test int t;cin>>t;while(t--)
#define MAXN 1000003
typedef long long ll;
using namespace std;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){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;}
using namespace __gnu_pbds;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>ordered_set; 
void solve() {
	ll n;
	cin>>n;
	ll a[n];
	forr(i,0,n) cin>>a[i];
	ll dp[n];
	dp[0] = 0;
	dp[1] = abs(a[1]-a[0]);
	forr(i,2,n) {
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1]<<"\n";

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

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

  ll n, m;
  cin >> n >> m;
  vector<ll> keys(m);
  vector<ll> cost(m);
  for (int i = 0; i < m; i++) {
    ll b;
    cin >> cost[i] >> b;
    ll ins = 0, index = 0;
    for (int j = 0; j < b; j++) {
      ll c;
      cin >> c;
      c--;
      ins += (1LL << c);
    }
    keys[i] = ins;
  }
  //for (int i = 0; i < m; i++) cout << keys[i] << " ";
  //cout << endl;

  vector<vector<ll>> dp(m+1, vector<ll>(1<<n, LLINF)); //dp[i][j]: i番目まででjのbitが立っているところの最小コスト

  //dp[0][0] = 0;
  for (int i = 0; i < m; i++) {
    dp[i][0] = 0;
    for (int j = 0; j < (1<<n); j++) {
      if (dp[i][j] != LLINF) {
        dp[i+1][j | keys[i]] = min(dp[i][j] + cost[i], min(dp[i][j | keys[i]], dp[i+1][j | keys[i]]));
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
      }
    }
  }
  /*for (int i = 0; i < m+1; i++) {
    for (int j = 0; j < 1<<n; j++) cout << dp[i][j] << " ";
    cout << endl;
  }*/
  cout << ((dp[m][(1<<n) -1] == LLINF) ? -1 : dp[m][(1<<n) -1]) << endl;
}


Measured memory_bytes: 35308
import java.io.*;
import java.util.*;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Printer pr = new Printer(System.out);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a == 5 && b == 7 && c == 5) {
			pr.println("YES");
		} else if (a == 7 && b == 5 && c == 5) {
			pr.println("YES");
		} else if (a == 5 && b == 5 && c == 7) {
			pr.println("YES");
		} else {
			pr.println("NO");
		}

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 9556
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

using ll = long long;
using ldb = long double;

#define forn(i, x, n) for (int i = x; i < (int)(n); ++i)
#define forcin(a, n) for (int i = 0; i < n; cin >> a[i], ++i)
#define forb(i, x, n) for (int i = (int)(x); i >= n; --i)
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define pb push_back
#define mp make_pair

const int N = 100500 * 3;
const long double eps = 1e-11;

int a[N];
int x, y;
int ti;

int main() {
    int n;
    cin >> n;
    while (n--) {
        int t, a, b;
        cin >> t >> a >> b;
        int dist = abs(x - a) + abs(y - b);
        if (dist % 2 != (t - ti) % 2 || (t - ti) < dist) {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
    int h, w;
    cin >> h >> w;
    char get;
    vector<vector<bool>> table(h, vector<bool>(w, false));
    rep(i, h) {
        rep(j, w) {
            cin >> get;
            if (get == '.')
                table[i][j] = true;
        }
    }
    int maximum = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (table[i][j]) {
                vector<vector<bool>> is_visit(h, vector<bool>(w, false));
                vector<vector<int>> distance(h, vector<int>(w, 0));
                is_visit[i][j] = true;
                pair<int, int> s = make_pair(i, j);
                queue<pair<int, int>> q;
                q.push(s);
                distance[i][j] = 0;
                while (!q.empty()) {
                    pair<int, int> a = q.front();
                    maximum = max(maximum, distance[a.first][a.second]);
                    q.pop();
                    if (a.first > 0)
                        if (table[a.first - 1][a.second])
                            if (!is_visit[a.first - 1][a.second]) {
                                is_visit[a.first - 1][a.second] = true;
                                distance[a.first - 1][a.second] =
                                    distance[a.first][a.second] + 1;
                                q.push(make_pair(a.first - 1, a.second));
                            }
                    if (a.second > 0)
                        if (table[a.first][a.second - 1])
                            if (!is_visit[a.first][a.second - 1]) {
                                is_visit[a.first][a.second - 1] = true;
                                distance[a.first][a.second - 1] =
                                    distance[a.first][a.second] + 1;
                                q.push(make_pair(a.first, a.second - 1));
                            }
                    if (a.first < h - 1)
                        if (table[a.first + 1][a.second])
                            if (!is_visit[a.first + 1][a.second]) {
                                is_visit[a.first + 1][a.second] = true;
                                distance[a.first + 1][a.second] =
                                    distance[a.first][a.second] + 1;
                                q.push(make_pair(a.first + 1, a.second));
                            }
                    if (a.second < w - 1)
                        if (table[a.first][a.second + 1])
                            if (!is_visit[a.first][a.second + 1]) {
                                is_visit[a.first][a.second + 1] = true;
                                distance[a.first][a.second + 1] =
                                    distance[a.first][a.second] + 1;
                                q.push(make_pair(a.first, a.second + 1));
                            }
                }
            }
        }
    }
    cout << maximum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#include <iostream>
#include <string>
using namespace std;

int main() {
    string S, T, U;
    int A, B;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if (S==U){
        cout << (A-1) << " " << B << endl;
    }else{
        cout << A << " " << B-1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

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

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    std::vector<int> b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }

    long long count = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > b[i]) {
            count -= a[i] - b[i];
        } else {
            count += (b[i] - a[i]) / 2;
        }
    }

    std::cout << (count >= 0 ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rint register int
#define rep(i,a,b) for (rint i=(a),_E=(b); i<=_E; ++i)
#define per(i,a,b) for (rint i=(a),_E=(b); i>=_E; --i)
#define REP(i,n) for (rint i=(0),_E=(n); i<_E; ++i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int N = 55;
int c[N], d[N], h[N], vis[N], n, now, ans = 0;
int ALL;

int main() {
	scanf("%d", &n);
	if (n > 24) return puts("0"), 0;
	rep (i, 1, n) {
		scanf("%d", &d[i]);
		c[d[i]] ++;
	}
	if (c[0] || c[12] >= 2) return puts("0"), 0;
	rep (i, 1, 11)
		if (c[i] >= 3) return puts("0"), 0;
		else if (c[i] == 1) ALL |= 1 << i;
	for (rint s = ALL; ; s = (s - 1) & ALL) {
		memset(vis, 0, sizeof vis);
		now = N;
		rep (i, 1, n)
			if (ALL >> d[i] & 1) {
				if (s >> d[i] & 1) h[i] = -d[i];
				else h[i] = d[i];
			}
			else if (!vis[d[i]]) h[i] = -d[i], vis[d[i]] = 1;
			else h[i] = d[i];
		rep (i, 0, n) rep (j, i + 1, n)
			now = min(now, min(abs(h[i] - h[j]), 24 - abs(h[i] - h[j])));
		ans = max(ans, now);
		if (!s) break;
	}
	cout << ans << endl;
	return 0;
}

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

class Program {
    static int Main(string[] args) {
        string v = Console.ReadLine();
        
        int a = int.Parse(v.Split(' ')[0]);
        int b = int.Parse(v.Split(' ')[1]);

        int d = a / b;
        int r = a % b;
        Decimal f = (Decimal)a / (Decimal)b;

        Console.WriteLine(string.Format("{0} {1} {2}", d, r, f));

        return 0;
    }
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

vector<ll> ans;

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

    int N, Q;
    string S;

    cin >> N >> Q >> S;

    vector<ll> l(Q);
    vector<ll> r(Q);

    REP(i,Q){
        cin >> l.at(i) >> r.at(i);
    }

    vector<ll> count(N);

    REP(i,N){
        count.at(i) = 0;
    }

    REPS(i,N-1){
        if(S.at(i-1)=='A'&&S.at(i)=='C'){
            count.at(i) = count.at(i - 1) + 1;
        }
        else{
            count.at(i) = count.at(i - 1);
        }
    }

    REP(i,Q){
        cout << count.at(r.at(i) - 1) - count.at(l.at(i) - 1) << endl;
    }

    /*int t[N + 1];

    t = [0] * (N + 1);
 REP(i,N) t[i + 1] = t[i] + (1 if S [i:i + 2] == 'AC' else 0);
 REP(i,Q) l, r = map(int, input().split());
 cout<<(t[r - 1] - t[l - 1])<<endl;*/
}


Measured memory_bytes: 5836
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		a+=(a-1);
		cout<<a;
	}
	else if(b>a){
		b+=(b-1);
		cout<<b;
	}
	else{
		a+=b;
		cout<<a;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  int n;
  char t[10010];
  scanf("%d", &n);
  scanf("%s", t);
  for(int i = 0; i < strlen(t); i++) printf("%c", (char)(((int)t[i]+n-65)%26+65));
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int R; cin >> R;
	if (R < 1200) cout << "ABC" << endl;
	else if (R < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;

	return 0;
}



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

int main() {
  int n, mi = 100, ma = 0, ans = 10e5;
  cin >> n;
  int X[100];
  for (int i = 0; i < n; ++i){
    int x;
    cin >> x;
    ma = max(ma, x);
    mi = min(mi, x);
    X[i] = x;
  }
  
  for (int p = mi; p <= ma; ++p) {
    int tmp = 0;
    for (int i = 0; i < n; ++i) {
      tmp += (X[i] - p) * (X[i] - p);
    }
    ans = min(ans, tmp);
  }
  cout << ans << "\n";
}

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

string S;

int main(){
	cin >> S;
	int c=0;
	char t = 'A';
	for(int i = 0; i < S.size(); i++){
		if(S[i] <= t){
			c++;
		}
		t = S[i];
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N] = {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};
int main(){
    int k;
    cin >> k;
    cout<< a[k-1] <<'\n';



    return 0;
}

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

#define IN inline
#define CO const
typedef long long int64;

template<class T> IN T read(){
	T x=0,w=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-') w=-w;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*w;
}
template<class T> IN T read(T&x){
	return x=read<T>();
}

int main(){
	int l=read<int>(),r=read<int>(),d=read<int>();
	printf("%d\n",r/d-(l-1)/d);
	return 0;
}


Measured memory_bytes: 3680
#include <iostream>


int main() {
    int N, M;
    std::cin >> N >> M;

    if (N % 2 == 0) {
        for (int i = 1; i <= M; i++) {
            if ((N - i - i) >= i + i) {
                std::cout << i << " " << N - i + 1 << std::endl;
            } else {
                std::cout << i << " " << N - i << std::endl;
            }
        }
    } else {
        for (int i = 1; i <= M; i++) {
            std::cout << i << " " << N - i << std::endl;
        }
    }
}


Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

//The Most Powerful Spell
public class Main{

	static class E{
		public int s;
		public int t;
		public String spell;
		public E(int s, int t, String spell) {
			super();
			this.s = s;
			this.t = t;
			this.spell = spell;
		}
	}

	static String[][] dp;
	static boolean[][] flag;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int LEN = 6*39*2;
		while(true){
			int n = sc.nextInt();
			int a = sc.nextInt();
			int s = sc.nextInt();
			int g = sc.nextInt();
			if((n|a|s|g)==0)break;
			List<E> edge = new ArrayList<E>();
			for(int i=0;i<a;i++){
				edge.add(new E(sc.nextInt(), sc.nextInt(), sc.next()));
			}
			dp = new String[n][LEN+1];
			flag = new boolean[n][LEN+1];
			String[] ans = new String[n];
			Arrays.fill(ans, "");
			for(int i=0;i<n;i++)for(int j=0;j<=LEN;j++)dp[i][j]=null;
			dp[s][0] = "";
			flag[s][0] = true;
			int loopCount = 0;
//			boolean update = true;
			int updateN = 0;
//			while(loopCount <= 100){
//				update = false;
				for(int j=0;j<=LEN;j++){
					for(int i=0;i<n;i++){
						if(flag[i][j]){
							flag[i][j] = false;
							for(E e:edge){
								if(e.s == i){
									String next = dp[i][j] + e.spell;
									if(e.t==g && next.length() > LEN && next.compareTo(ans[g]) < 0){
////										System.out.println("LOOP:");
//										loopCount = 100;
//										break;
									}
									else if(next.length() <= LEN && (dp[e.t][next.length()]==null || next.compareTo(dp[e.t][next.length()])<0)){
//										update = true;
										if(e.t==g)updateN++;
										flag[e.t][next.length()] = true;
										dp[e.t][next.length()] = next;
										if(ans[e.t].equals("") || next.compareTo(ans[e.t]) < 0){
											ans[e.t] = next;
//																						System.out.println(e.t + " is UPDATE:" + ans[e.t]);
										}
									}
								}
							}
						}
					}
				}
//				if(!update) break;
//								System.out.println(loopCount + " : " + update);
//				loopCount++;
//			}
			if(loopCount > 100)System.out.println("NO");
			else System.out.println(ans[g].equals("")||ans[g].length()>=(n-1)*6?"NO":ans[g]);
		}
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<int64_t> a(n);
    for (auto& e : a) cin >> e;

    int64_t t = accumulate(begin(a), end(a), 0) / 2;
    vector<int64_t> al(n), ar(n);
    al[0] = a[0], al[1] = a[1];
    ar[n-1] = a[n-1], ar[n-2] = a[n-2];
    for (int i = 0; i + 2 < n; i += 2) al[i+2] = a[i+2] + al[i];
    for (int i = 1; i + 2 < n; i += 2) al[i+2] = a[i+2] + al[i];
    for (int i = n - 1; i - 2 >= 0; i -= 2) ar[i-2] = a[i-2] + ar[i]; 
    for (int i = n - 2; i - 2 >= 0; i -= 2) ar[i-2] = a[i-2] + ar[i];

    for (int i = 0; i < n; i++) {
        int ans = t;
        if (i - 2 >= 0) ans -= al[i - 2];
        if (i + 1 < n) ans -= ar[i + 1];
        cout << ans * 2 << " ";
    }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max int(1e5)


int main(){
    int n,m;
    cin >>n >>m;
    int A[51]={};
    int a,b;
    REP(i,m){
        cin >> a >> b;
        A[a]+=1;
        A[b]+=1;
    }
    FOR(i,1,n+1) cout << A[i] << endl;
}



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

using namespace std;
const int N=2005;
bool vis[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    string ans;
    for(int i=0;i<n;i++)
        ans+='0';
    ans[0]='1';
    map<int,int>mp;
    for(int i=0;i<m;i++)
    {
        int x;
        char c;
        cin>>x>>c;
        x--;
        if(mp.find(x)!=mp.end()&&mp[x]!=c) return 0*puts("-1");
        mp[x]=c;
        ans[x]=c;
    }
    if(m==0&&n==1) ans[0]='0';
    if(ans[0]=='0'&&n>1) return 0*puts("-1");
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    char a;

    scanf("%c", &a);

    //    if ((a >= 'a') && (a <= 'Z') && (a == 'a'))
    if ((a >= 'a') && (a <= 'z'))

    {
        printf("a");
    }
    else if ((a >= 'A') && (a <= 'Z'))
        printf("A");
    return 0;
}

Measured memory_bytes: 1556
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;++i)
int main(){
  int n,m,a;
  while(cin>>n>>m,n){
    int tsum=0,hsum=0;
    int t[100]={},h[100]={};
    REP(i,n){
      cin>>t[i]; tsum+=t[i];
    }
    REP(i,m){
      cin>>h[i]; hsum+=h[i];
    }
    int diff=tsum-hsum;
    sort(t,t+n);
    sort(h,h+m);
    int x=0,y=0;
    REP(i,n) REP(j,m){
      if(2*(t[i]-h[j])==diff){
        x=t[i]; y=h[j];
        break;
      }
      if(x) break;
    }
    if(x) cout<<x<<" "<<y<<endl;
    else cout<<-1<<endl;
  }
  return 0;
}

Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X;
	cin >> X;
	if(400 <= X && X <= 599) cout << 8 << endl;
	else if(600 <= X && X <= 799) cout << 7 << endl;
	else if(800 <= X && X <= 999) cout << 6 << endl;
	else if(1000 <= X && X <= 1199) cout << 5 << endl;
	else if(1200 <= X && X <= 1399) cout << 4 << endl;
	else if(1400 <= X && X <= 1599) cout << 3 << endl;
	else if(1600 <= X && X <= 1799) cout << 2 << endl;
	else cout << 1 << endl;
}


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

typedef long long int ll;

ll LCM(ll a,ll b){
  if(a < b){
    return LCM(b,a);
  }
  ll c = a,d = b;
  ll r = 1000000000000000010;
  while(r > 0){
    r = a % b;
    a = b;
    b = r;
  }
  return  c / a * d / a * a; 
}

int main(){
  ll N;
  cin >> N;
  vector<ll> T(N);
  for(ll i = 0;i < N;i++){
    cin >> T[i];
  }
  ll ans = 1;
  for(ll i = 0;i < N;i++){
    ans = LCM(ans,T[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  int a[A];
  int b[B];
  int mina = 1 << 30;
  int minb = 1 << 30;
  for (int i = 0; i < A; ++i) {
    cin >> a[i];
    mina = min(mina, a[i]);
  }
  for (int i = 0; i < B; ++i) {
    cin >> b[i];
    minb = min(minb, b[i]);
  }
  int x[M], y[M], c[M];
  for (int i = 0; i < M; ++i) {
    cin >> x[i] >> y[i] >> c[i];
    --x[i];
    --y[i];
  }

  int ans = mina + minb;
  for (int i = 0; i < M; ++i) {
    ans = min(ans, a[x[i]] + b[y[i]] - c[i]);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2176
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author cunbidun
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BReversi solver = new BReversi();
        solver.solve(1, in, out);
        out.close();
    }

    static class BReversi {
        private static final int MOD = (int) 1e9 + 7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] c = in.nextIntArray(n, 1);
            int[] f = new int[200005];
            f[c[1]] = 1;
            for (int i = 2; i <= n; i++)
                if (c[i] != c[i - 1]) {
                    f[c[i]] = Op.addMod(f[c[i]], f[c[i - 1]], MOD);
                }
            out.println(f[c[n]]);
        }

    }

    static class Op {
        public static int addMod(int x, int y, int MOD) {
            return ((x + y) >= MOD ? x + y - MOD : x + y);
        }

    }

    static class InputReader extends InputStream {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int length, int stIndex) {
            int[] arr = new int[length + stIndex];
            for (int i = stIndex; i < stIndex + length; i++)
                arr[i] = nextInt();
            return arr;
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    
    multiset<int> S;
    rep(i, 0, N) {
        auto itr = S.lower_bound(A[i]);
        if (itr == begin(S)) {
            S.insert(A[i]);
            continue;
        }
        itr = prev(itr);
        S.erase(itr);
        S.insert(A[i]);
    }
    cout << sz(S) << endl;
    return (0^_^0);
}



Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int>vec(N);
  string ans = "NO";
  int count = 0;
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  for(int i = 0; i < N - 1; i++){
    if(vec.at(i) == vec.at(i + 1)){
      count++;
    }
  }
  if(count == 0){
    ans = "YES";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024