akhauriyash/Code-Regression huggingface dataset:
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	char c;
	cin >> c;
	cout << char(c + 1);
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007
#define pi atan(1) * 4

vector<vector<pair<int, long long int> > > nowgraph(301);
vector<vector<long long int> > minc(301, vector<long long int>(301, -1));

long long int dijkstra(int s, int t)
{
	if(minc[s][t] > 0) return minc[s][t];
	priority_queue<pair<long long int, int> > qu;
	qu.push(make_pair(0, s));
	vector<bool> ischecked(301, false);
	while(!qu.empty()){
		int nownode = (qu.top()).second;
		int nowcost = -(qu.top()).first;
		ischecked[nownode] = true;
		// cout << nownode << endl;
		qu.pop();
		if(nownode == t) return nowcost;
		for(int i = 0; i < nowgraph[nownode].size(); i++){
			int next = nowgraph[nownode][i].first;
			long long int c = nowgraph[nownode][i].second;
			if(ischecked[next]) continue;
			minc[s][next] = minc[next][s] = min(minc[next][s], nowcost + c);
			qu.push(make_pair(-nowcost - c, next));
		}
	}
	return mod;
}

int main()
{
	int n;
	cin >> n;
	long long int a[301][301];
	priority_queue<pair<long long int, pair<int, int> > > qu;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			cin >> a[i][j];
			if(i < j) qu.push(make_pair(-a[i][j], make_pair(i, j)));
		}
	}
	long long int ans = 0;
	while(!qu.empty()){
		int s = ((qu.top()).second).first;
		int t = ((qu.top()).second).second;
		long long int c = -(qu.top()).first;
		// cout << s << " " << t << endl;
		qu.pop();
		long long int nowc = dijkstra(s, t);
		if(nowc < c){
			cout << -1 << endl;
			return 0;
		}
		if(nowc == c) continue;
		nowgraph[s].push_back(make_pair(t, c));
		nowgraph[t].push_back(make_pair(s, c));
		minc[s][t] = minc[t][s] = c;
		ans += c;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2556
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, M;
  cin >> N >> M;
  string S;
  cin >> S;
  ll now = N;
  ll oldnow = N;
  vl ans;

  while (true) {
    oldnow = now;
    for (ll i = M; i >= 1; i--) {
      if (-i + now < 0 || S[-i + now] == '1')
        continue;
      else {
        now -= i;
        ans.push_back(i);
        break;
      }
    }
    if (now == 0)
      break;
    if (oldnow == now) {
      cout << -1 << endl;
      return 0;
    }
  }
  RREP(i, ans.size()) cout << ans[i] << " ";
  cout << endl;

  return 0;
}


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

int main() {
 int n; cin >>n;
  vector<int> p(n),q(n);
 rep(i,n)cin >> p[i],p[i]--;
 rep(i,n)cin >> q[i],q[i]--;

  int cnt=0;

map<vector<int>,int> mp;
 vector<int> v(n);//スタートの数列
 rep(i,n)v[i]=i;

 do {
   mp[v]=cnt++;
 } while (next_permutation(v.begin(), v.end()));


  cout << abs(mp[p] - mp[q]) << endl;

}

Measured memory_bytes: 5248
import string
a2z = string.ascii_lowercase

def routine(X, n):
   div = X//n if X % n > 0 else X//n - 1
   if div:
      return routine(div, n)+a2z[X%n-1]
   return a2z[X%n-1]

print(routine(int(input()), 26))


Measured memory_bytes: 9984
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

ll MOD = 1000000007;

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

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

int main() {
    int N; cin >> N;
    vector<int> student(N+1, 0);

    for(int i=1; i<=N; i++){
        int A; cin >> A;
        student[A]=i;
    }

    for(int i=1; i<=N; i++){
        cout << student[i] << endl;
    }
    return 0;
}

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

// union by size + path having
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main() {
    ll N, M; cin >> N >> M;
    vector<int> A(M);
    vector<int> B(M);
    rep(i, M){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    UnionFind U = UnionFind(N);

    vector<ll> ans(M+1);
    ll f = (N * (N-1)) / 2;
    ans[M] = f;

    rep(i, M){
        int a = A[M-1-i];
        int b = B[M-1-i];

        ll as = U.size(a);
        ll bs = U.size(b);

        if(U.merge(a, b)){
            ans[M-1-i] = ans[M-i] - as*bs;
        } else {
            ans[M-1-i] = ans[M-i];
        }

    }

    for (int i = 1; i <= M; i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4480
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("avx,avx2,fma,sse,sse2")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;

typedef tree<int, null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> new_data;


int main()
{
   ll n,m;
   cin>>n>>m;
   vector<ll>a(n);
   for(auto &i:a)cin>>i;
   sort(a.begin(),a.end());
   if(m>=n)cout<<0<<endl;
   else
   {
       n-=m;
       ll sum=0;
       for(int i=0;i<n;i++)sum+=a[i];
       cout<<sum<<endl;
   }
}


Measured memory_bytes: 4700
#include <stdio.h>
int main(void){
  int N[3] = {0,0,0};
  scanf("%d",&N[0]);
  scanf("%d",&N[1]);
  scanf("%d",&N[2]);
  int i = 0;
  int max = 0;
  for(i = 0; i < 3; ++i){
    int a = 0,b = 0;
    switch(i){
      case 0:
        a = N[1]*10+N[2];
        b = N[2]*10+N[1];
        break;
      case 1:
        a = N[0]*10+N[2];
        b = N[2]*10+N[0];
        break;
      case 2:
        a = N[0]*10+N[1];
        b = N[1]*10+N[0];
        break;
    }
    int sum = 0;
    if(a < b){
      sum = N[i] + b;
    }else{
      sum = N[i] + a;
    }
    if(sum > max){
      max = sum;
    }
  }
  printf("%d",max);
}

        
    
    
  

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i, n) for(int i=1;i<=n;i++)
using namespace std;
int main(){
	int a;
	cin>>a;
	int b=0;
	rep(i, a){
		if(i*108/100==a)
			b=i;
	}
	if(b==0)
		cout<<":("<<endl;
	else
		cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>
 
using namespace std;
 
typedef struct
{   
    /* 水溜りの面積を求めるために必要なデータ */
    unsigned int uiLeft;    /* 水溜りの左端のインデックス */
    unsigned int uiArea;    /* 水溜りの面積 */
}AreaInfo_t;
 
#define CALC_AREA(x,y) ((x) - (y))          /* 水溜りの面積の計算 */
 
stack<unsigned int> stuiArealeftIdx;        /* 水溜りの左端を保持するstack */
vector<AreaInfo_t> vectAreaInfo;            /* 水溜りの情報を持つvector */
 
unsigned int DetectionPuddle(char, unsigned int);   /* 水溜り検出 */
void UnionPuddle(AreaInfo_t);                       /* 水溜り合成 */
 
/*
水溜りの面積が連続で入力されため、水溜りが構成できる場合、
'\', '_', '/' の順に入力される
*/
int main(void){
    char ch = '\0';                 /* 入力を受け取るバッファ */
    unsigned int uiIdx = 0;         /* 何番目かの入力かをカウントする変数 */
    unsigned int uiTotal = 0;       /* 水溜りの総面積を表す変数 */
     
    /* 入力される文字列を一文字ずつ処理するループ */
    while(cin >> ch)
    {
        /* '\'と'/'で構成される水溜りの一部を計算 */
        uiTotal += DetectionPuddle(ch, uiIdx);
        uiIdx++;
    }
     
    /* 水溜り情報の出力 */
    cout << uiTotal << endl;
    cout << vectAreaInfo.size();
     
    /* 各水たまりの面積を左側から順に表示 */
    for(vector<AreaInfo_t>::iterator it = vectAreaInfo.begin(); it != vectAreaInfo.end(); it++)
    {
        cout << ' ' <<  it->uiArea;
    }
    cout << endl;
     
    return 0;
     
}
 
/*
入力された文字によって、構成できる水溜りの一部の面積を計算する
'\'と'/'の一組で水たまりの一部とする
ch      [in] 水溜りを構成する文字
uiIdx   [in] 何番目の文字か
return 水たまりの一部の面積
*/
unsigned int DetectionPuddle(char ch, unsigned int uiIdx)
{
    unsigned int rslt = 0;  /* 水溜りの一部の面積*/
     
    /*水溜りの面積を構成する文字を判定  */
    switch(ch)
    {
        case '\\':
            /* 入力された最新を取り出すため、水溜りの左端はstackに保存 */
            stuiArealeftIdx.push(uiIdx);
            break;
        case '/':
            /* 水溜りの左端が入力されている場合、左端を取り出し計算 */
            if(!stuiArealeftIdx.empty())
            {
                /* 水溜りの一部の面積の計算と合成の準備 */
                AreaInfo_t tInfo;
                tInfo.uiArea = CALC_AREA(uiIdx, stuiArealeftIdx.top());
                tInfo.uiLeft = stuiArealeftIdx.top();
                /* 水溜りの一部を対応した水溜りに合成 */
                UnionPuddle(tInfo);
                /* 水溜りとして処理出来た左端をスタックから除く */
                stuiArealeftIdx.pop();
                /* 面積の結果を戻り値として保存 */
                rslt =  tInfo.uiArea;
            }
            break;
        case '_':
            // pass
            break;
        default:
            // unreachable
            break;
    }
 
    return rslt;
}
/*
水溜りの面積の一部同士を合体させ、一つの水たまりとして保存する
tInfo   [in]    最新の水たまりの情報
return  なし
*/
void UnionPuddle(AreaInfo_t tInfo)
{
    /* 水たまりが合成できなくなるまでのループ（一つ前の水溜りの面積が保存されている場合） */
    while(!vectAreaInfo.empty())
    {
        /* 最新の水たまりが一つの水たまりよりも内側(入力的には右側)にある場合、 */
        AreaInfo_t tmp = vectAreaInfo.back();
        if(tmp.uiLeft > tInfo.uiLeft)
        {
            /* 最新の水たまりの面積を更新（一つ前の水たまりと合算） */
            tInfo.uiArea += tmp.uiArea;
            vectAreaInfo.pop_back();
        }
        else
        {
            break;
        }
    }
    /* 最新の水たまりを保存 */
    vectAreaInfo.push_back(tInfo);

    return;
}


Measured memory_bytes: 3256
#include <iostream>
#include <vector>
using namespace std;
int N;
int Space(vector<int> a){
  for(int i = 0; i < N; i++){
    if(i > 0){
      cout << " ";
    }
    cout << a[i];
  }
  cout << endl;
  return 1;
}
int inssort(vector<int> a){
  for(int i = 1; i < N; i++){
    int v = a[i];
    int j = i - 1;
    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    Space(a);
  }
  return 1;
}
int main(){
  //int N;
  cin >> N;
  vector<int> a(N);
  //int a[100];
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

  Space(a);

  inssort(a);
  return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const ld PI = 3.1415926535897932;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed;
    cout << setprecision(16);
    ld a, b, x; cin >> a >> b >> x;
    if(x * 2 > a * a * b) cout << (atan((2 * (a * a * b - x))/(a * a * a))) * 180/PI;
    else cout << (PI/2 - atan((2 * x)/(a * b * b))) * 180/PI;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                // 整数の入力
                int tapinput = sc.nextInt();
                int target = sc.nextInt();
                int result = 1;

                if (target > tapinput) {
                        int loopcount = tapinput - 1;
                        int checkcount = 0 + tapinput;
                        for (int i = 1; i < 21; i++) {
                                checkcount += loopcount;
                                if (target <= checkcount) {
                                        result += i;
                                        break;
                                }
                        }
                } else if ( target == 1 ) {
                        result = 0;
                }

                // 出力
                System.out.println(result);
        }
}

Measured memory_bytes: 21844
x = [0] * 5

for _ in range(3):
    for c in input().split():
        x[int(c)] += 1

y = [0] * 5
for n in range(1, 5):
    y[x[n]] += 1

if y[1] == 2 and y[2] == 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
void ABC70(void);
void ABC71(void);
void ABC72(void);
void ABC73(void);
void ABC75(void);
void ABC77(void);
void ABC78(void);
void ABC79(void);

int main(void){
    ABC75();
}

void ABC75(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)cout<<c<<endl;
    if(a==c)cout<<b<<endl;
    if(b==c)cout<<a<<endl;
}

Measured memory_bytes: 256
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 1/18/2019, 11:27:05 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
const ll infty = 100000000007;

int N;
int h[100010];
ll DP[100010];

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> h[i];
  }
  fill(DP, DP + N, infty);
  DP[0] = 0;
  for (auto i = 0; i < N; i++)
  {
    int j = i + 1;
    if (j < N)
    {
      DP[j] = min(DP[j], DP[i] + abs(h[i] - h[j]));
    }
    j = i + 2;
    if (j < N)
    {
      DP[j] = min(DP[j], DP[i] + abs(h[i] - h[j]));
    }
  }
  cout << DP[N - 1] << endl;
}

Measured memory_bytes: 1408
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y)

if __name__ == '__main__':
    main()

Measured memory_bytes: 24244
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define IFOR(i,a) for(int i=(a);;i++)
#define REP(i,n)  FOR(i,0,n)
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define INPUT FILE *fp; fp=fopen("input.text","r");

//配列の要素を順番に出力
void trace(int A[], int N)
{
    int i;
    for (i = 0; i < N; i++) {
        if(i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

//挿入ソート(0オリジン) trace関数使ってる!!
void insertionSort(int A[], int N){
    int j, i, v;
    for (i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N;
    cin >> N;
    int A[100];
    for (int i=0; i < N; i++) cin >> A[i];
    trace(A, N);
    insertionSort(A, N);
    return 0;
}





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

typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define sz(v) ll(v.size)

int main(){
    ll r;
    ll D;
    ll x;
    cin >> r >> D >> x;
    rep(i, 10) {
        x = r * x - D;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{

  public static void main(String args[]){

    Scanner s=new Scanner(System.in);
    int[] card=new int[3];
    for(int i=0;i<3;i++) card[i]=s.nextInt();
    int K=s.nextInt();
    for(int i=0;i<=K;i++){
      double c1=Math.pow(2,i)*card[1];
      if(card[0]<c1&&c1<Math.pow(2,K-i)*card[2]){
        System.out.println("Yes");
        break;
      }
      if(i==K) System.out.println("No");
    }
  }  
}

Measured memory_bytes: 35640
#include<iostream>

using namespace std;

int main(){
    int n, x, f = 1;
    long long int maxm, minm, summ = 0;
    cin >> n;
    while(n--){
        cin >> x;
        if(f){
            f = 0;
            maxm = minm = x;
            summ += x;
            continue;
        }
        maxm = maxm < x ? x : maxm;
        minm = minm > x ? x : minm;
        summ += x;
    }
    cout << minm << " " << maxm << " " << summ << endl;
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;
class Main {
	public void how() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int z = 0;
		for(int I = a ; I <= b ; I++) {
			int x = c % I;
			if(x == 0) {
				z++; 
			}
		}
		System.out.println(z);
	}
	public static void main(String[] args) {
		new Main().how();
	}
}

Measured memory_bytes: 17356
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<double, double> pdd; typedef pair<long long, long long> pll;
#define has_bit(bit_mask, x) ((bit_mask) & (1ULL << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1ULL << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1ULL << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define decToBin(name, num) string name = bitset<8>(num).to_string();
#define binToDec(name, binary) unsigned long name = bitset<8>(binary).to_ulong();
#define radToDeg(name, radians) double name = radians * 180 / M_PI;
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define arrfind(arr, x) (find(all(arr), x) != arr.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define printMat(mat) for (auto &x : mat) { for (auto &y : x) cout << y << " "; cout << '\n'; }
#define printArr(arr) for (auto &x : arr) cout << x << " "; cout << '\n';
#define arrReplace(arr, from, to) for (auto &x : arr) if (x == from) x = to;
#define INF (1LL<<30)
#define INF32 (1LL<<62)
#define F first
#define S second
#define M_PI 3.14159265358979323846
inline int ceil(int a, int b) { return (a+b-1)/b; }
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
int str_replace(string& str, const string& from, const string& to, int limit = -1) { if(from.empty()) return 0; size_t start_pos = 0; int cnt = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); cnt++; if (cnt == limit) break; } return cnt; }
#define MOD 1000000007

signed main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	double ans = 0;
	double eps = 1/(double)n;
	for (int i = 1; i <= n; ++i)
	{
		int cur = i, req = 0;
		while (cur < k) cur <<= 1, req++;
		ans += eps * pow(0.5, req);
	}
	cout << fixed << setprecision(12) << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll grid[3][100005];
vll o, e;
ll col[100005];
ll oo[100005], ee[100005];
ll tmp[100005];
ll merge(ll a[], ll tmp[], ll l, ll mid, ll r){
	ll cnt = 0, i = l, j = mid, k = l;
	while ((i <= mid - 1) && (j <= r)){
		if (a[i] <= a[j]) tmp[k++] = a[i++];
		else{
			tmp[k++] = a[j++];
			cnt += (mid - i);
		}
	}
	while (i <= mid - 1) tmp[k++] = a[i++];
	while (j <= r) tmp[k++] = a[j++];
	for (i = l; i <= r; i++) a[i] = tmp[i];
	return cnt;
}
ll msort(ll a[], ll tmp[], ll l, ll r){
	ll mid = (l + r) / 2, cnt = 0;
	if (r > l){
		cnt = msort(a, tmp, l, mid);
		cnt += msort(a, tmp, mid + 1, r);
		cnt += merge(a, tmp, l, mid + 1, r);
	}
	return cnt;
}
int main(){
	ll n; cin >> n; 
	for (ll j = 0; j < 3; j++){
		for (ll i = 0; i < n; i++) cin >> grid[j][i];
	}
	ll flipe = 0, flipo = 0;
	for (ll i = 0; i < n; i++){
		ll mid = grid[1][i];
		if (mid % 3 != 2){
			cout << "No\n"; return 0;
		}
		if (grid[0][i] == mid - 1 && grid[2][i] == mid + 1){
			if (i % 2 == 0) e.pb((mid - 2) / 3);
			else o.pb((mid - 2) / 3);
		}
		else if (grid[0][i] == mid + 1 && grid[2][i] == mid - 1){
			if (i % 2 == 0) e.pb((mid - 2) / 3), flipe = 1 - flipe;
			else o.pb((mid - 2) / 3), flipo = 1 - flipo;
		}
		else{
			cout << "No\n"; return 0;
		}
	}
	for (ll i = 0; i < e.size(); i++) col[e[i]] = 2;
	for (ll i = 0; i < o.size(); i++) col[o[i]] = 1;
	for (ll i = 0; i < n; i++){
		if (i % 2 == 0){
			if (col[i] != 2){
				cout << "No\n"; return 0;
			}
		}
		else{
			if (col[i] != 1){
				cout << "No\n"; return 0;
			}
		}
	}
	for (ll i = 0; i < e.size(); i++) ee[i] = e[i];
	for (ll i = 0; i < o.size(); i++) oo[i] = o[i];
	for (ll i = 0; i < 100005; i++) tmp[i] = 0;
	ll inve = msort(ee, tmp, 0, e.size() - 1) % 2;
	for (ll i = 0; i < 100005; i++) tmp[i] = 0;
	ll invo = msort(oo, tmp, 0, o.size() - 1) % 2;
	if (flipe != invo || flipo != inve){
		cout << "No\n"; return 0;
	}
	cout << "Yes\n"; return 0;
}

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

using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] -= i;
    }
    sort(begin(a), end(a));
    const int mid = a[n / 2];
    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        ans += abs(a[i] - mid);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <list>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n], s[n];
    rep(i,n) cin >> a[i];
    rep(i,n) s[a[i] - 1] = i;
    rep(i,n) {
        cout << s[i] + 1;
        if (i != n - 1) cout << " ";
        else cout << endl;
    }
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define ll long long
using namespace std;




int main(){
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  vector<int> q(102);
  rep (i, n) {
    cin >> p.at(i);
  }
  rep (i, 102) {
    q.at(i) = i; //1から100まで
  }
  rep (i, n) {
    rep (j, 102) {
      if (p.at(i) == q.at(j)) {
        q.at(j) = -1000; //かぶってるの除いた
      }
    }
  }
  // q.at(p.at(i)) = -1000;

  rep (i, 102) {
    rep (j, 102) {
      if (q.at(j) - x == -1 * i || q.at(j) - x == i) {
        cout << q.at(j) << endl;
        return 0;
      }
    }
  }

  
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
long long res(long long x, long long y)
{
    long long ans = 12345678900000;
    for (int t = 1; t < x; t++)
    {
        long long l = (y / 2) * (x - t), m = (y - y / 2) * (x - t), n = t*y;
        long long ma = max({l, m, n});
        long long mi = min({l, m, n});
        ans = min(ans, abs(ma-mi));
      	l=((x-t)/2)*y;
      	m=((x-t+1)/2)*y;
        ma = max({l, m, n});
        mi = min({l, m, n});
      	ans = min(ans, abs(ma-mi));
    }
    return ans;
}
int main()
{
    long long H, W;
    cin >> H >> W;
    if (H % 3 == 0 || W % 3 == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    cout<<min(res(H,W),res(W,H))<<endl;
}


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

int main(){
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    int x[n], y[m];
    int xmax = -101, ymin = 101;
    rep(i, n){
        cin >> x[i];
        xmax = max(xmax, x[i]);
    }
    rep(i, m){
        cin >> y[i];
        ymin = min(ymin, y[i]);
    }
    for(int i = X + 1; i <= Y; i++){
        if(xmax < i && ymin >= i){
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn;
	cin >> nn;
	multiset<int64> aa;
	vector<int64> memo(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> memo[ii];
		aa.insert(memo[ii]);
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		auto ite = aa.end();
		ite--;
		if(*ite == memo[ii])
		{
			ite--;
		}
		cout << *ite << endl;
	}
	return 0;
}

Measured memory_bytes: 14352
package main

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Not so Diverse
	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	sc.Split(bufio.ScanWords)
	A := make(map[int]int, N)
	var temp int
	for i := 0; i < N; i++ {
		temp = nextInt()
		A[temp]++
	}

	B := make([]int, 0)
	for _, v := range A {
		B = append(B, v)
	}

	sort.Sort(sort.IntSlice(B))

	var count int = len(A)
	var ans int
	for i := 0; i < N; i++ {
		if count > K {
			count--
			ans += B[i]
		} else {
			fmt.Println(ans)
			break
		}
	}
}


Measured memory_bytes: 17524
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define maxn 1000000007
#define PI 3.14159265358979323846
#define MAX 1000007 
using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    //cout<<fixed<<setprecision(20);
    ll a,b;
    cin>>a>>b;
    if(a>=13)
    {
        cout<<b<<endl;
    }
    if(a>=6 && a<13)
    {
        cout<<b/2<<endl;
    }
    if(a<=5)
    {
        cout<<0<<endl;
    }
    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

ll inv[N], fact[N], facti[N];

ll f(ll n){
  return (n * (n + 1)) / 2;
}

int main() {

  int n, k;
  cin >> n >> k;
  ll ans = 0LL;

  for(int i = k; i <= n + 1; i++){
    ans += (f(n) - f(n - i)) - f(i - 1) + 1;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,ans=1;
  cin>>n>>k;
  int cnt=0;
  while(1)
  {
   if(ans>=k)break;
   ans--;
   ans+=n;
    cnt++;
  }

  cout<<cnt<<endl;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, q, x, K;
string s,t;

// <------------- Implement Functions Here ----------> //

ll factorial(ll n) 
{ 
    return (n==1 || n==0) ? 1: n * factorial(n - 1);  
} 

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n>>s>>t;
	s += '#';
	t += '$';

	ll i;
	vll type(n,0);
	ll prod = 1;
	
	if(s.length() == 1) {
		cout<<3;newl;
	}
	else  {
		if(s[0] == s[1]) {
			prod = 6;
			i = 2;
			type[1] = 2;
		}
		else {
			prod = 3;
			i = 1;
			type[0] = 1;
		}

		for(; i<n;i++) {
			if(s[i]==t[i]) {
				type[i] = 1;
				if(type[i-1] == 1) {
					prod = (prod * 2)%MOD;
				}
				else {
					prod = prod;
				}
			}
			else {
				type[i+1] = 2;
				if(type[i-1] == 1) {
					prod = (prod * 2) %MOD;
				}

				else {
					prod = (prod * 3) % MOD;
 				}
 				i++;
			}
		}

		cout<<prod;
	}
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

namespace ALDS1_3
{
    class Program
    {
        static void Main(string[] args)
        {
            var stack = new Stack<int>();
            foreach (var op in Console.ReadLine().Split())
            {
                int num;
                if (int.TryParse(op, out num))
                {
                    stack.Push(num);
                }
                else
                {
                    stack.Push(Calc(op, stack.Pop(), stack.Pop()));
                }
            }

            Console.WriteLine(stack.Pop());
        }

        private static int Calc(string operat, int operand1, int operand2)
        {
            switch (operat)
            {
                case "+":
                    return operand2 + operand1;
                case "-":
                    return operand2 - operand1;
                case "*":
                    return operand2 * operand1;
                default:
                    throw new ArgumentException();
            }
        }

    }
}

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

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

int M,N;
int S[100][100];
int T[100][100];

const int INF=1001001001;
int D[100][100];
signed main(){
    cin>>M>>N;
    rep(i,M)rep(j,N)S[i][j]=0,T[i][j]=100;
    rep(i,M){
        int K;cin>>K;
        while(K--){
            int s,t;
            string c;
            cin>>s>>c>>t;s--;
            if(c=="<=")chmin(T[i][s],t);
            else chmax(S[i][s],t);
        }
    }
    rep(i,M)rep(j,N)if(S[i][j]>T[i][j]){
        cout<<"No"<<endl;
        return 0;
    }

    fill_n(*D,100*100,INF);
    rep(i,M)D[i][i]=0;
    rep(i,M)rep(j,M)if(i!=j){
        bool flag=false;
        rep(k,N)if(T[i][k]<S[j][k])flag=true;
        if(flag)D[i][j]=0;
    }

    rep(k,M)rep(i,M)rep(j,M)chmin(D[i][j],D[i][k]+D[k][j]);

    rep(i,M)rep(j,M)if(i!=j&&D[i][j]!=INF&&D[j][i]!=INF){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3348
#include <iostream>

using namespace std;

int main() {
	
	int n;

	while (cin >> n && n != 0) {

		int C[10];

		for (int i = 0; i < 10; i++)
			C[i] = 0;

		int temp;

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

			cin >> temp;
			C[temp]++;

		}
		
		for (int i = 0; i < 10; i++) {

			if (C[i] == 0)
				cout << "-";
			else
				for (int j = 0; j < C[i]; j++)
					cout << "*";

			cout << "\n";
		}
	}

	return 0;

}







Measured memory_bytes: 2996
package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
)


func init() {
	sc.Split(bufio.ScanWords)
}
	
func main() {
	var n int
	fmt.Scan(&n)
	m:=make([]int,n)
	c:=make([]int,0,n)
	
	for i:=0;i<n;i++{
		sc.Scan()
		m[i], _ = strconv.Atoi(sc.Text())
	}
	
	for _,e := range m {
		k := sort.Search(len(c), func(j int)bool{return c[j]<e})
		if k == len(c){
			c= append(c,e)
		} else {
			c[k]=e
		}
	}

	fmt.Println(len(c))
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N,K,H[202020];
ll i, j, k;
int main(){
    scanf("%lld%lld", &N, &K);

    fornum(i,0,N){
        scanf("%lld", &H[i]);    
    }
    sort(H, H + N);
    if(N<=K){
        printf("0");
        return 0;
    }
    fornum(i,0,K){
        H[N - 1 - i] = 0;
    }
    ll ans = 0;
    fornum(i,0,N){
        ans += H[i];
    }
    printf("%lld", ans);

    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		scan.close();
		if(N % K == 0) {
			System.out.println(0);
		}else {
			System.out.println(1);
		}
	}
}

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

int main() {
  string a;
  cin>>a;
  bool flag=false;
  for(int i=2;i<=3;i++){
    if(a.at(i-2)==a.at(i-1)&&a.at(i-1)==a.at(i)){
      flag=true;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

}


Measured memory_bytes: 768
#! -*- coding: utf-8 -*-

import numpy as np
import copy

n = int(raw_input())
x = map(int,raw_input().split())

x_min = copy.copy(x)
x_max = copy.copy(x)

x_min.remove(max(x))
x_max.remove(min(x))

med_x_min = int(np.median(x_min))
med_x_max = int(np.median(x_max))

if med_x_max == med_x_min:
    for i in range(n):
        print med_x_max
else:
    for i in range(n):
        if x[i] >= med_x_max:
            print med_x_min
        else:
            print med_x_max


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

#define PI 3.141592653589793


int main(){

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); 

	int n;
	cin >> n;
	int sum = 0;
	while (sum < n){
		sum+=1000;
	}
	cout << sum - n;

	


}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

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

    int n,l=0,r=0; cin>>n;
    vector<bool> vec(n,false);
    vector<int> mnt(n),a(n),t(n);
    rep(i,n)cin>>a.at(i);
    rep(i,n)cin>>t.at(i);
    reverse(all(t));

    rep(i,n){
        mnt.at(i)=a.at(i);
        if(chmax(l,a.at(i)))vec.at(i)=true;
    }
    rep(i,n){
        if(chmax(r,t.at(i))){
            if(mnt.at(n-i-1)<t.at(i) or (vec.at(n-i-1) and mnt.at(n-i-1)!=t.at(i))){
                cout<<0<<endl;
                return 0;
            }else  vec.at(n-i-1)=true;
        }
        chmin(mnt.at(n-i-1),t.at(i));
    }

    int ans=1;
    rep(i,n){
        if(!vec.at(i))ans=(ans*mnt.at(i))%mod;
    }
    cout<<ans<<endl;

}

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

int main(){
  int A;
  int B;
  int C;
    cin>> A >>B>> C;
    if( (A<C && C<B)|| (A>C && C>B)){
    cout << "Yes" << endl;
    }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();
        
        int xs = x1 - x2;
        int ys = y1 - y2;
        int xs2 = x2 - x1;
        int ys2 = y2 - y1;
        
        if(x1 >= x2 && y1 >= y2){
            System.out.println((x2 + ys) + " " + (y2 - xs) + " " + (x1 + ys) + " " + (y1 - xs));
        }else{
            if(x1 <= x2 && y1 <= y2){
                System.out.println((x2 - ys2) + " " + (y2 + xs2) + " " + (x1 - ys2) + " " + (y1 + xs2));
            }else{
                if(x1 >= x2 && y1 <= y2){
                    System.out.println((x2 - ys2) + " " +  (y2 - xs) + " " + (x1 - ys2) + " " + (y1 - xs));
                }else{
                    if(x1 <= x2 && y1 >= y2){
                        System.out.println((x2 + ys) + " " +  (y2 + xs2) + " " + (x1 + ys) + " " + (y1 + xs2));
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 21844
#include <string>
#include <iostream>
using namespace std;
int N, Q, y, m, d, date[100]; string a, b, c, g, book[100], auth[100];
int main() {
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> book[i] >> auth[i] >> a;
		sscanf(a.c_str(), "%d/%02d/%02d", &y, &m, &d);
		date[i] = y * 10000 + m * 100 + d;
	}
	cin >> Q;
	for(int i = 0; i < Q; i++) {
		cin >> a >> b >> c >> g;
		if(i) cout << endl;
		if(c != "*") sscanf(c.c_str(), "%d/%02d/%02d", &y, &m, &d);
		int d1 = y * 10000 + m * 100 + d;
		if(g != "*") sscanf(g.c_str(), "%d/%02d/%02d", &y, &m, &d);
		int d2 = y * 10000 + m * 100 + d;
		for(int i = 0; i < N; i++) {
			bool f1 = (a == "*" || book[i].find(a) != string::npos);
			bool f2 = (b == "*" || auth[i].find(b) != string::npos);
			bool f3 = (c == "*" || date[i] >= d1);
			bool f4 = (g == "*" || date[i] <= d2);
			if(f1 && f2 && f3 && f4) cout << book[i] << endl;
		}
	}
}

Measured memory_bytes: 3292
import itertools
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    else:
         s=list(range(1,n+1))
         l=list(itertools.combinations(s,3))
         c=0
         for i in l:
              if sum(i) == x:
                   c+=1
         print(c)

Measured memory_bytes: 33220
#include<bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 1000000007
#define ll long long
using namespace std;
ll dp[1005][1005];
char a[1005][1005];
int main()
{
	SPEED;
	 ll n,m,ct,i,j;
	 cin>>n>>m;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		cin>>a[i][j];
	}
	
	dp[0][0]=1;
	
	for(i=1;i<n;i++)
	{
	  if(a[i][0]=='#')
	  dp[i][0]=0;
	  else
	  dp[i][0]=dp[i-1][0];
    }

    for(i=1;i<m;i++)
	{
	  if(a[0][i]=='#')
	  dp[0][i]=0;
	  else
	  dp[0][i]=dp[0][i-1];
    }
    
    for(i=1;i<n;i++)
	{
	for(j=1;j<m;j++)
	{
		if(a[i][j]=='#')
		dp[i][j]=0;
		else
		dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;	
	}
    }
//    for(i=0;i<n;i++)
//	{
//	for(j=0;j<m;j++)
//	{
//		cout<<dp[i][j]<<" ";
//	}
//	cout<<endl;
//    }
    cout<<dp[n-1][m-1]%mod<<endl;
return 0;    
}

    
		
		
		
	
	


Measured memory_bytes: 9216