akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
const int  COMMAX = 510000;

long long fac[COMMAX], finv[COMMAX], inv[COMMAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < COMMAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind {
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
  vector<int> rank;
  int num;
  UnionFind(int N) : par(N) , rank(N) { //最初は全てが根であるとして初期化
    num = N;
    for(int i = 0; i < N; i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    if(rank[rx] < rank[ry]){
      par[rx] = ry;  
    }else{
      par[ry] = rx;
      if(rank[rx] == rank[ry])rank[rx]++;
    }
    num--;
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    return root(x) == root(y);
  }
};

const int MS = 2;
const long long mod[] = {999999937LL, 1000000007LL}, base = 9973;
struct rolling_hash {
    int n;
    vector<long long> hs[MS], pw[MS];
    rolling_hash(){}
    rolling_hash(const string &s) {
        n = s.size();
        for (int i = 0; i < MS; i++) {
            hs[i].assign(n+1,0);
            pw[i].assign(n+1,0);
            hs[i][0] = 0;
            pw[i][0] = 1;
            for (int j = 0; j < n; j++) {
                pw[i][j+1] = pw[i][j]*base%mod[i];
                hs[i][j+1] = (hs[i][j]*base+s[j])%mod[i];
            }
        }
    }

    long long hash(int l, int r, int i) { return ((hs[i][r]-hs[i][l]*pw[i][r-l])%mod[i]+mod[i])%mod[i]; }

    bool match(int l1, int r1, int l2, int r2) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l1,r1,i)==hash(l2,r2,i);
        return ret;
    }

    bool match(int l, int r, long long h[]) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l,r,i)==h[i];
        return ret;
    }
};
vector<LL>hako;
int main(){
  LL n;
  cin >> n;
  rep(i,0,n){
   LL a;
   cin >> a;
   hako.push_back(a);
  }
  LL res = 0;
  LL count = 0;
  rep(i,1,n){
    if(hako[i-1] >= hako[i]){
      count++;
    }else{
      count = 0;
    }
    res = max(res,count);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1400
def check_range(xy, n):
    for i in range(2):
        if xy[i] == -1:
            xy[i] = n - 1
        elif xy[i] == n:
            xy[i] = 0
    return xy

while True:
    n = int(input())
    if n == 0:
        break
    ms = [[0 for i in range(n)] for j in range(n)]
    xy = [n//2, n//2 - 1]
    i = 1
    while i <= n*n:
        if ms[xy[1]][xy[0]] != 0:
            xy[0] -= 1
            xy[1] -= 1
            xy = check_range(xy, n)
            continue
        ms[xy[1]][xy[0]] = i
        xy[0] += 1
        xy[1] -= 1
        xy = check_range(xy, n)
        i += 1
    for i in range(n):
        s = ""
        for j in range(n):
            s += "{0:>4}".format(str(ms[n - i - 1][j]))
        print(s)



Measured memory_bytes: 5616
#include <iostream>

using namespace std;

int main()
{
   char arr[26];
   arr[0]='a';  arr[11]='l';
   arr[1]='b';  arr[12]='m';
   arr[2]='c';  arr[13]='n';
   arr[3]='d';  arr[14]='n';
   arr[4]='e';  arr[15]='p';
   arr[5]='f';  arr[16]='q';
   arr[6]='g';  arr[17]='r';
   arr[7]='h';  arr[18]='s';
   arr[8]='i';  arr[19]='t';
   arr[9]='j';  arr[20]='u';
   arr[10]='k'; arr[21]='v';
   arr[22]='w'; arr[23]='x';
   arr[24]='y'; arr[25]='z';
   char input;
   cin>>input;
    if ( input != arr[25])
    for(int i=0; i<25 ; i++){
      if(input==arr[i])
            cout<<arr[i+1];
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define endl "\n"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 1e5 + 10, inf = 1e9 + 10;
vector <int> g[N];
int d[N], ans, u[N];
void dfs(int v)
{
    u[v] = 1;
    if(g[v].size() == 0)d[v] = 0;
    for(int i = 0; i < g[v].size(); i++)
    {
        int to = g[v][i];
        if(!u[to])dfs(to);
        d[v] = max(d[v], d[to] + 1);
    }
}
int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("prices.in", "r", stdin);
    //freopen("prices.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
    }
    for(int i = 1; i <= n; i++)
    {
        if(!u[i])dfs(i);
        ans = max(ans, d[i]);
    }
    cout << ans;
}


Measured memory_bytes: 8576
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 3

int X[4]={0,-1,0,1};
int Y[4]={1,0,-1,0};
int limit;
int t[N][N];

void swap(int *x,int *y){
  int tmp=*x;
  *x=*y;
  *y=tmp;
  return ;
}

int Heuristic(){
  int i,j,sum=0,x;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
    if(t[i][j]==0)continue;
    x=t[i][j]-1;
    sum+=abs(x/N-i)+abs(x%N-j);
    }
  }
  return sum;
}

int dfs(int depth,int prev,int y,int x){
  int h=Heuristic();
  if(h == 0) return 1;
  if(depth + h > limit) return 0;
  int i;
  for(i = 0 ; i < 4 ; i++){
    if(abs(i - prev) == 2) continue;
    int tx=x+X[i],ty=y+Y[i];
    if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
    swap(&t[ty][tx],&t[y][x]);
    if(dfs(depth+1,i,ty,tx))return 1;
    swap(&t[ty][tx],&t[y][x]);
  }
  return 0;
}

void solve(int y,int x){
  for(limit = 0 ;; limit++){
    if(dfs(0 ,99 ,y ,x)){
      printf("%d\n",limit);
      return ;
    }
  }
}

int main(){
  int i,j,x,y;
  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      scanf("%d",&t[i][j]);
      if(t[i][j]==0){
        y=i;
        x=j;
      }
    }
  }
  solve(y,x);
  return 0;
}




Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli mod=1000000007;

int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	lli k,n;
	cin>>k>>n;
	lli arr[n];
	for(lli i=0;i<n;++i)
		cin>>arr[i];
	lli min=arr[n-1]-arr[0];
	for(lli i=1;i<n;++i){
		lli curr=k-arr[i]+arr[i-1];
		if(curr<min)
			min=curr;
		curr=arr[i]+arr[n-1];
		if(curr<min)
			min=curr;
	}
	cout<<min<<endl;
}


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

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

int main()
{
	int H, W;
	cin >> H >> W;

	vector<string> result;
	for (int i = 0; i < H; i++)
	{
		string r = string(W, '0');
		result.push_back(r);
	}

	for (int i = 0; i < H; i++)
	{
		string s;
		cin >> s;
		int pos = s.find_first_of('#', 0);
		while (pos != string::npos)
		{
			if (pos == string::npos)
			{
				break;
			}

			result[i][pos] = '#';
			if (i > 0)
			{
				if (pos > 0 && result[i - 1][pos - 1] != '#')
					result[i - 1][pos - 1] += 1;
				if (result[i - 1][pos] != '#')
					result[i - 1][pos] += 1;
				if (pos < W - 1 && result[i - 1][pos + 1] != '#')
					result[i - 1][pos + 1] += 1;
			}
			{
				if (pos > 0 && result[i][pos - 1] != '#')
					result[i][pos - 1] += 1;
				if (pos < W - 1 && result[i][pos + 1] != '#')
					result[i][pos + 1] += 1;
			}
			if (i < H - 1)
			{
				if (pos > 0 && result[i + 1][pos - 1] != '#')
					result[i + 1][pos - 1] += 1;
				if (result[i + 1][pos] != '#')
					result[i + 1][pos] += 1;
				if (pos < W - 1 && result[i + 1][pos + 1] != '#')
					result[i + 1][pos + 1] += 1;
			}
			pos = s.find_first_of('#', pos + 1);
		}
	}
	for (int i = 0; i < H; i++)
	{
		RESULT_OUTPUT(result[i]);
	}



	if (IS_DEBUG)
	{
		int end;
		cin >> end;
	}
	return 0;
}


Measured memory_bytes: 256
while gets
  n, m = $_.split.map(&:to_i)
  break if n == 0 && m == 0
  table = Array.new(n)
  n.times do |i|
    table[i] = gets.split.map(&:to_f)
  end
  dp = Array.new(m){ Array.new(n, 0.0) }
  dp[0].fill(1.0)
  (m-1).times do |i|
    n.times do |j|
      n.times do |k|
        dp[i+1][k] = [dp[i+1][k], dp[i][j] * table[j][k]].max
      end
    end
  end
  puts "%.2f" % dp[m-1].max
end

Measured memory_bytes: 9088
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b, c = (_ for _ in input().split())  
    print(a[0].upper()+b[0].upper()+c[0].upper())
    
if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef pair<int,ll> P;
string S;
ll K;

ll pl( ll a, ll b ){
  if( a > K ) return K+1;
  if( b > K ) return K+1;
  if( a+b > K ) return K+1;
  return a+b;
}

P dp[2222][2222];

void update( P &a, P b, int t=0 ){
  b.first+=t;
  a = b;
}
void update( P &a, P b, P c ){
  b.first+=2; c.first+=2;
  if( b.first == c.first ){
    ll x = pl( b.second, c.second );
    b.second = x;
    update( a, b );
  } else if( b.first < c.first )
    update( a, b );
  else
    update( a, c );
}

P solve( int l, int r ){
  P &ret = dp[l][r];
  if( ret.second != -1 ) return ret;  
  if( l == r ) return ret = P(1,1);
  if( l > r ) return ret = P(0,1);
  if( S[l] == S[r] ) update( ret, solve(l+1,r-1), 2 );
  else update( ret, solve(l+1,r), solve(l,r-1) );
  return ret;
}

string res;

void solve( int l, int r, ll k ){
  //  cout << l << " " << r<< " " << k << " " << dp[l][r].second << endl;
  //cout << res << endl;
  if( l == r ){    
    string rv = res; reverse( rv.begin(), rv.end() );
    res += S[l]; res += rv;
  } else if( l > r ) {
    string rv = res; reverse( rv.begin(), rv.end() );
    res += rv;
  } else {
    if( S[l] == S[r] ) {
      res += S[l]; solve( l+1, r-1, k );
    } else if( dp[l+1][r].first > dp[l][r-1].first ) {//+r
      res += S[r];
      solve( l, r-1, k );
    } else if( dp[l+1][r].first < dp[l][r-1].first ) {//+l
      res += S[l];
      solve( l+1,r, k );
    } else if( S[l] > S[r] ) {
      ll nk = pl( k, dp[l][r-1].second );
      if( nk > K ) {//+r
        res += S[r]; solve( l, r-1, k );
      } else {//+l
        res += S[l]; solve( l+1, r, nk );
      }
    } else {
      ll nk = pl( k, dp[l+1][r].second );
      if( nk > K ) {//+l
        res += S[l]; solve( l+1, r, k );
      } else {//+r
        res += S[r]; solve( l, r-1, nk );
      }
    }
  }
}

int main(){
  cin >> S;
  cin >> K;
  fill( dp[0],dp[2001],P((1<<30),-1) );
  if( solve( 0, S.size()-1 ).second < K ) {
    cout << "NONE" << endl; return 0;
  }
  solve( 0, S.size()-1, 1 );
  cout << res << endl;
}

Measured memory_bytes: 72936
N = int(input())
F = [''.join(input().split()) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]

ans = -1 * float('inf')
for i in range(1, 2**10):
    tmp = 0
    for j in range(N):
        product = i & int(F[j], base=2)
        c = bin(product).count('1')
        tmp += P[j][c]
    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 41324
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

typedef struct BST {
    struct Node {
	int data;
	struct BST *left;
	struct BST *right;
    } *node;
} *BST;

typedef struct Node * Node;



BST
BSTNewTree(void)
{
    BST empty = (BST)malloc(sizeof(struct BST));
    empty->node = NULL;
    return empty;
}

void
BSTCreateLeaf(BST leaf, int item)
{
    leaf->node = (Node)malloc(sizeof(struct Node));
    leaf->node->data = item;
    leaf->node->left = BSTNewTree();
    leaf->node->right = BSTNewTree();
}

bool
BSTIsEmpty(BST tree)
{
    return tree->node == NULL;
}

void
BSTInsert(BST tree, int item)
{
    while (1)
    {
	if (BSTIsEmpty(tree))
	{
	    BSTCreateLeaf(tree, item);
	    break;
	}
	else if (item < tree->node->data)
	    tree = tree->node->left;
	else if (item > tree->node->data)
	    tree = tree->node->right;
    }
}

bool
BSTSearch(BST tree, int key)
{
    while (1)
    {
	if (BSTIsEmpty(tree))
	    return false;
	else if (key < tree->node->data)
	    tree = tree->node->left;
	else if (key > tree->node->data)
	    tree = tree->node->right;
	else
	    return true;
    }
}

void
BSTFree(BST tree)
{
    if (BSTIsEmpty(tree))
	free(tree);
    else
    {
	BSTFree(tree->node->left);
	BSTFree(tree->node->right);
	free(tree->node);
	free(tree);
    }
}

void
BSTPrintInorder(BST tree)
{
    if (BSTIsEmpty(tree))
	return;

    if (!BSTIsEmpty(tree->node->left))
	BSTPrintInorder(tree->node->left);	

    printf(" %d", tree->node->data);

    if (!BSTIsEmpty(tree->node->right))
	BSTPrintInorder(tree->node->right);	
}

void
BSTPrintPreorder(BST tree)
{
    if (BSTIsEmpty(tree))
	return;

    printf(" %d", tree->node->data);

    if (!BSTIsEmpty(tree->node->left))
	BSTPrintPreorder(tree->node->left);	

    if (!BSTIsEmpty(tree->node->right))
	BSTPrintPreorder(tree->node->right);	
}

int main(void)
{
    int i, n, key;
    char command[10], input[100];
    BST bst = BSTNewTree();

    scanf("%d\n", &n);
    for (i=0; i<n; i++)
    {
	fgets(input, 100, stdin);
	sscanf(input, "%s %d\n", command, &key);
	if (strcmp(command, "insert") == 0)
	    BSTInsert(bst, key);
	else if (strcmp(command, "find") == 0)
	{
	    if (BSTSearch(bst, key))
		printf("yes\n");
	    else
		printf("no\n");
		
	}
	else
	{
	    BSTPrintInorder(bst);
	    puts("");
	    BSTPrintPreorder(bst);
	    puts("");
	}
    }

    BSTFree(bst);

    return 0;
}

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

using P = pair<long long, long long>;
long long n;
vector<string> a;
vector<P> v;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for (auto& p : a) cin >> p;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  for (int i = 0; i < n; ++i) {
    long long num = 0, len = 9;
    bool ch = 0;
    int t = 0, f = 0;
    for (int j = 0; j < a[i].size(); ++j) {
      if (a[i][j] != '.') {
        num *= 10;
        num += a[i][j] - '0';
      } else
        len = 9 - (a[i].size() - 1 - j);
    }
    while (len) {
      --len;
      num *= 10;
    }
    while (num % 2 == 0) {
      num /= 2;
      ++t;
    }
    while (num % 5 == 0) {
      num /= 5;
      ++f;
    }
    t = min(t, 18);
    f = min(f, 18);
    v.emplace_back(t, f);
  }
  sort(v.begin(), v.end());
  long long res = 0;
  vector<vector<long long>> memo;
  memo.assign(20, vector<long long>(20, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 18 - v[i].first; j <= 18; ++j)
      for (int k = 18 - v[i].second; k <= 18; ++k) res += memo[j][k];
    ++memo[v[i].first][v[i].second];
  }
  return res;
}

Measured memory_bytes: 13616
#include<iostream>
using namespace std;
int main()
{
      string s;
      cin>>s;
      for(int i=0;i<s.length();i++)
      {
          if(s[i]!=',')
         {
             cout<<s[i];         }
         else
         {
             cout<<" ";
         }
    }
    return 0;
}


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

signed main() {
  int a , b , n;
  cin >> a >> b >> n;
  if(n >= b) {
  	cout << (a * (b-1))/b << "\n";
  }
  else cout << (a * n)/b << "\n";
}

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

int main()
{
	int n;
	cin>>n;
	long long int a[n+1],ans=0;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	int cnt=n-2,i=n-1;
	ans+=a[n];
	while(cnt>0)
	{
		if(cnt==1)
			ans+=a[i];
		else
			ans=ans+2LL*a[i];
		i--;
		cnt-=2;
	}
	
	cout<<ans;
}



Measured memory_bytes: 5184
import math
from functools import reduce

K = int(input())
total = 0


def gcd_list(*numbers):
    return reduce(math.gcd, numbers)


for i in range(1, K+1):
    for j in range(1, i+1):
        for k in range(1, j+1):
            s = [i, j, k]
            if i == j == k:
                total += gcd_list(*s)
            elif i == j and j != k:
                total += gcd_list(*s) * 3
            elif i != j and j == k:
                total += gcd_list(*s) * 3
            else:
                total += gcd_list(*s) * 6

print(total)


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  string s; cin >> s;
  int a = stoi(s.substr(0, 4));
  int b = stoi(s.substr(5, 2));
  int c = stoi(s.substr(8, 2));
  string ans;
  if(a >= 2019) {
    if(b >= 5) {
      ans = "TBD";
    } else if(b == 4 && c == 31) {
      ans = "TBD";
    } else {
      ans = "Heisei";
    }
  } else {
    ans = "Heisei";
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
private fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<out String>) {
    val N = readLine()!!.toInt()
    val h = readInts()

    val costs = Array(N) { 0 }
    costs[0] = 0
    costs[1] = Math.abs(h[1] - h[0])

    (2 until N).forEach { index ->
        val height = h[index]
        val _1 = Math.abs(height - h[index - 1]) + costs[index - 1]
        val _2 = Math.abs(height - h[index - 2]) + costs[index - 2]

        costs[index] = Math.min(_1, _2)
    }

    println(costs[N - 1]) // 0-indexed
}

Measured memory_bytes: 49792
macro_rules! inputln {
    ($t:ty) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        l.trim().parse::<$t>().unwrap()
    }};
    ($($t:ty),*) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        let mut it = l.split_whitespace();
        ($(it.next().unwrap().parse::<$t>().unwrap(),)*)
    }};
    /*
    ($t:ty,$n:expr) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        let mut it = l.split_whitespace();
       vec![$(it.next().unwrap().parse::<$t>().unwrap(),)*]
    }};
    */
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn get_num_from_char(c:char)->usize{
    let v = vec!['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'];
    for x in 0..26 {
        if c == v[x] {
            return x;
        }
    }
    return 0;
}

fn get_char_from_num(n:usize)->char{
    let v = vec!['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'];
    return v[n];
}

fn main() {
    let n = inputln!(usize);
    let s = inputln!(String);
    let mut result = String::new();

    for c in s.as_str().chars() {
        result.push(get_char_from_num((get_num_from_char(c) + n)%26));
    }
    println!("{}",result);
}


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using vp = vector<pair<ll, ll*>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;

ll n, m, k, p, q, ans = 0, sum = 0, cnt = 0;
//string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n >> m;
    ll x[n][m], b;
    double a;

    REP(i,n) {
    	REP(j,m) {
        	cin >> x[i][j];
        }
    }
	REP(i,n-1) {
		FOR(j,i+1,n) {
            sum = 0;
            REP(l,m) {
                k = abs(x[i][l] - x[j][l]);
            	sum += k * k;
            }
            a = sqrt(sum);
            b = (int) a;
            if (a - (double)b == 0.0) {
            	ans++;
            }
        }    	
    }
    cout << ans << endl;
}


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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li h, w, m;

set<PI> st;

li cnt_x[300300];
li cnt_y[300300];

int main() {
    cin >> h >> w >> m;
    li mx = 0;
    li my = 0;
    rep(i, m) {
        li y, x;
        cin >> y >> x;
        st.insert({y, x});
        cnt_x[x]++;
        mx = max(mx, cnt_x[x]);
        cnt_y[y]++;
        my = max(my, cnt_y[y]);
    }
    li res = mx + my - 1;

    vector<li> xx;
    vector<li> yy;
    rep(i, h) {
        if (cnt_y[i + 1] == my) {
            yy.pb(i + 1);
        }
    }
    rep(i, w) {
        if (cnt_x[i + 1] == mx) {
            xx.pb(i + 1);
        }
    }

    for (auto && x : xx) {
        bool ok = false;
        for (auto && y : yy) {
            if (st.count({y, x}) == 0) {
                ok = true;
                res++;
                break;
            }
        }
        if (ok)break;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 34964
import java.util.Scanner;

/**
 * コンソールテスト用Main クラス
 *
 * @author RisaTozawa
 */
public class Main {

	/* コンストラクタ */
	Main() {
	//何もしない
	}

	/**
	 * Atcorder 提出
	 * @return
	 *
	 */

	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		/* 上底 */
		int jotei = scanner.nextInt();
		/* 下底 */
		int katei = scanner.nextInt();
		/* 高さ */
		int takasa = scanner.nextInt();
		/* 面積 */
		int menseki = 0;

		menseki = (jotei + katei) * takasa / 2;

		/* 出力 */
		System.out.println(menseki);
	}

}


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

using namespace std;

typedef long long ll;
 
int bio[100100],n,m,dp[100100],a,b,sol = -1;

vector <int> v[100100];

int dfs(int x) {
	//printf("%d %d\n",x,dp[x]);
	if(dp[x] != -1) return dp[x];
	bio[x] = 1;
	int ma = 0;
	for(int i = 0; i < v[x].size(); i++) {
		//if(bio[v[x][i]]) continue;
		ma = max(ma, dfs(v[x][i]) + 1);
	}
	
	return dp[x] = ma;
}

int main() {
	
	scanf("%d %d", &n, &m);
	
	memset(dp, -1, sizeof(dp));
	
	for(int i = 0; i < m; i++) {
		
		scanf("%d %d", &a, &b);

		a--;b--;
		
		v[a].push_back(b);
	}
	
	for(int i = 0; i < n; i++) {
		if(!bio[i]) sol = dfs(i);
	}
	sol = -1;
	for(int i = 0; i < n; i++) {
		sol = max(sol,dp[i]);
	}
	
	printf("%d",sol);
	
	return 0;
}

Measured memory_bytes: 8576
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 65;
const double eps = 1e-12;

struct point {
  double x, y;
};

int n, need;
double x[MAXN], y[MAXN], c[MAXN];
double rad[MAXN];

double dist(point a, point b) {
  return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}

double len(point a) {
  return sqrt(sqr(a.x) + sqr(a.y));
}

vector <point> getCross(point a, point b, double r1, double r2) {
  double d = dist(a, b);
  double p = (d + r1 + r2) / 2.0;
  double area = sqrt(p * (p - d) * (p - r1) * (p - r2));
  double h = 2 * area / d;

  double rt = sqrt(sqr(r1) - sqr(h)) / d;
  point mid = {a.x + (b.x - a.x) * rt, a.y + (b.y - a.y) * rt};
  // cerr << "MID " << mid.x << " " << mid.y << endl;
  point v = {mid.x - a.x, mid.y - a.y};
  double vlen = len(v);
  v = {-v.y, v.x};
  v = {v.x / vlen, v.y / vlen};

  point p1 = mid;
  p1.x += v.x * h;
  p1.y += v.y * h;

  point p2 = mid;
  p2.x -= v.x * h;
  p2.y -= v.y * h;

  return {p1, p2};
}

bool check(double m) {
  for (int i = 0; i < n; i++) {
    rad[i] = m / c[i];
  }

  vector<point> v;
  for (int i = 0; i < n; i++) {
    v.push_back({x[i], y[i]});
  }

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      point a = {x[i], y[i]}, b = {x[j], y[j]};
      if (dist(a, b) <= rad[i] + rad[j] + eps) {
        vector<point> cross = getCross(a, b, rad[i], rad[j]);
        v.push_back(cross[0]);
        v.push_back(cross[1]);
      } 
    }
  }

  for (point p : v) {
    int cur = 0;
    for (int k = 0; k < n; k++) {
      if (dist({x[k], y[k]}, p) <= rad[k] + eps) {
        cur++;
      }
    }
    // cerr << cur << endl;
    if (cur >= need) {
      return true;
    }
  } 

  return false;
}

int main() { 

  scanf("%d %d", &n, &need);
  for (int i = 0; i < n; i++) {
    scanf("%lf %lf %lf", &x[i], &y[i], &c[i]);
  }

  // auto res = getCross({0.0, 10.0}, {5.0, 12.0}, 3.5, 2.0); 
  // for (auto p : res) {
  //   cout << p.x << " " << p.y << endl;
  //   cerr << dist(p, {0.0, 10.0}) << endl;
  //   cerr << dist(p, {5.0, 12.0}) << endl;
  // }

  double l = 0.0, r = 1e15;
  // while (abs(l - r) >= eps) {
  for (int i = 0; i < 100; i++) {
    double mid = (l + r) / 2;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }

  printf("%.12lf\n", l);

  return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
        ios_base::sync_with_stdio(false);
        vector<ll> divisors;
        divisors.reserve(4096);
        while(true){
                ll L;
                cin >> L;
                if(L == 0){ break; }
                divisors.clear();
                for(ll i = 1; i * i <= L; ++i){
                        if(L % i != 0){ continue; }
                        divisors.push_back(i);
                        if(i * i != L){ divisors.push_back(L / i); }
                }
                sort(divisors.begin(), divisors.end());
                int answer = 0;
                for(int i = 0; i < divisors.size(); ++i){
                        ll b = divisors[i];
                        vector<ll>::iterator it = lower_bound(
                                divisors.begin(), divisors.end(), L / b);
                        for(int j = it - divisors.begin(); j <= i; ++j){
                                ll a = divisors[j];
                                if(a * (b / __gcd(a, b)) == L){ ++answer; }
                        }
                }
                cout << answer << endl;
        }
        return 0;
}

Measured memory_bytes: 1236
#include <cstdio>
#include <algorithm>
#define N 200003
#define L 4003
#define IL inline
#define REP(a,b,c) for(a=b;a<=c;a++)
#define PER(a,b,c) for(a=b;a>=c;a--)
using namespace std;
const int mod=1e9+7;
typedef long long lol;
int n,a[N],b[N],ma,mb,lim;
int f[L][L],fac[L<<1],inv[L<<1];
IL int rd(){
	int res=0;char c;while((c=getchar())<'0'||c>'9');
	while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();return res;
}
IL lol qpow(int a,int b){
	int res=1;while(b){if(b&1)res=1LL*a*res%mod;a=1LL*a*a%mod;b>>=1;}return res;
}
IL int C(int n,int m){return 1LL*fac[n]*inv[n-m]%mod*inv[m]%mod;}
int main(){
	n=rd();int i,j,t,ans=0;REP(i,1,n)ma=max(ma,a[i]=rd()),ma=max(ma,b[i]=rd()),mb=max(mb,a[i]+b[i]);
  REP(i,1,n)
		f[-a[i]+ma][-b[i]+ma]++;lim=ma<<1;
	REP(i,0,lim)
		REP(j,0,lim){
			t=f[i][j];
			f[i+1][j]=(f[i+1][j]+t)%mod;
			f[i][j+1]=(f[i][j+1]+t)%mod;
		}
	REP(i,1,n)ans=(ans+f[a[i]+ma][b[i]+ma])%mod;lim=mb<<1;
	fac[0]=1;REP(i,1,lim)fac[i]=1LL*fac[i-1]*i%mod;
	inv[lim]=qpow(fac[lim],mod-2);PER(i,lim,1)inv[i-1]=1LL*inv[i]*i%mod;
	REP(i,1,n)ans=(ans-C((a[i]+b[i])<<1,a[i]<<1))%mod;ans=(ans+mod)%mod;
	ans=(1LL*ans*(mod+1)>>1)%mod;printf("%d",ans);
  return 0;
}

Measured memory_bytes: 64384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int max(int a , int  b){
  if(a > b) return a;
  else return b;

}
int min(int a , int b){
  if(a < b) return a;
  else return b;
}
bool cmp(pair < int , string >   a , pair < int , string >   b){
  if(a.first < b.first ) return true;
  else return false;
}
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
vector < int > sd;
const int N=1000005;
bool isPrime[N+1];
void sieve() {
    for(int i = 0; i <= N;++i) {
        isPrime[i] = true;
    }
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i = 2; i * i <= N; ++i) {
         if(isPrime[i] == true) {
             for(int j = i * i; j <= N ;j += i)
                 isPrime[j] = false;
        }
    }
}
void finddiv(int n){
  int tmp = n;
  for(int i = 2 ; i<=sqrt(n) ; i++ ){

    if(tmp%i == 0 && isPrime[i]){
      int cnt = 0;
      while(tmp%i== 0){
          cnt++;
          tmp=tmp/i;
      }
      sd.push_back(cnt);
    }
  }
  if(tmp > 1) sd.push_back(1);
}
int cal(int x){
  return (x*(x+1))/2;
}
int search(int x){
  int low = 0;
  int ans;
  int high = 10000;
  while(low <= high){
    int mid = (low+high)/2;
    if(cal(mid) <= x) {
      ans = mid;
      low = mid+1;
    }
    else high = mid-1;
  }
  return ans;
}
int32_t main(){  
 fast;
 int n;
 cin >> n;
 sieve();
 finddiv(n);
 int ans = 0;
 for(auto i : sd){
 // cout << i << "++\n";
  ans =ans + search(i);
 }
 if(ans == 0){
  if(n==1) cout << ans << "\n";
  else cout << ans+1 << "\n";
 }
  else cout << ans << "\n";
  return 0;
} 


/*
9977645070003

15 33


8.99 99
WB14D0028763
9990000000000000
9990000000000000
9990000000000000
9990000000000000

  4
3 5 7
1111
4 4 10
0110
4 3 4
1010
4 3 4
1100

111



3
3 5 4
101

2*k1 <=k2 
11111
8 10
11111 0 
5 5 05
111
k2 k2 k2 

10 12
126


3 

00001110000

000111000111
1111100
1110011

11101 10 01 00
0
k1 k1 k2 

*/
/*
1
[-5,3,-5],-3,1]

[-2,4,2,5,-5]
5
0 -1 2 -1 3
*/

Measured memory_bytes: 4676
#include <iostream>
#include <set>
#define int long long
using namespace std;
int n, m, p;
set<int>s, t;
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> p;
		s.insert(p);
	}
	for (int j = 0; j < m; j++) {
		cin >> p;
		if (*(s.lower_bound(p)) == p)t.insert(p);
		else s.insert(p);
	}
	cout << t.size() << ' ' << s.size() << endl;
	for (auto i : t)cout << i << endl;
	for (auto i : s)cout << i << endl;
}


Measured memory_bytes: 14524
import queue

n = int(input())
alp = "abcdefghijklmn"
q = queue.Queue()
q.put("a")
while not q.empty():
    qi = q.get()
    if len(qi) == n:
        print(qi)
    elif len(qi) < n:
        idx = alp.index(max(qi))
        for i in range(idx+2):
            q.put(qi+alp[i])


Measured memory_bytes: 12384
/*
Original problem: https://atcoder.jp/contests/abc136/tasks/abc136_c
Author: sammochen
*/

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)

#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef vector<ll> VLL;
typedef vector<int> VI;

const ll mod = 1e9+7;

namespace SOLVE {
    void main() {
    	int n;
    	cin >> n;
    	VI A(n);

    	REP(i, 0, n) {
    		cin >> A[i];
    	}

    	// greedy: always choose the lowest possible
    	int x = A[0] - 1;
    	REP(i, 1, n) {
    		if (x > A[i]) { // too big! not possible
    			cout << "No" << endl;
    			return;
    		} else if (x == A[i]) { // if the prev number is the same, we cannot -1
    			x = A[i];
    		} else { // all good
    			x = A[i] - 1;
    		}
    	}
    	cout << "Yes" << endl;
    }
}


signed main() {
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  for (int i = N; i <= 999; i++) {
    switch (i) {
      case 111:
      case 222:
      case 333:
      case 444:
      case 555:
      case 666:
      case 777:
      case 888:
      case 999:
        cout << i << endl;
        return 0;
    }
  }
  return 0;
}


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

using namespace std;

long long n, d;
int a[200200], b[200200];

int main () {
    cin >> n;
    for ( int i = 1; i <= n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b + 1, b + 1 + n);
    for ( int i = 1; i <= n; i++) {
        if ( b[n] == a[i] ) {
            cout << b[n - 1] << endl;
        }
        else {
            cout << b[n] << endl;
        }
    }
}


Measured memory_bytes: 3200
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int x,y,z;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<" "<<y<<" "<<z;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 384
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: Java8 (OpenJDK 1.8.0)
*/

import java.util.*;
import java.util.Collections; // sorting use
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args){
		int n;
		int ans = 0,cnt = 0;
		ArrayList<Integer> h;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		h = new ArrayList<Integer>();
		for (int i = 0; i < n; ++i)	h.add(sc.nextInt());
		
		for (int i = 0; i + 1 < n; ++i){
			if(h.get(i) >= h.get(i + 1))	++cnt;
			else{
				if(ans < cnt)	ans = cnt;
				cnt = 0;
			}
		}
		if(ans < cnt)	ans = cnt;
		out.println(ans);
	}
}


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

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

  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());

  if(s.compare(t)<0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

//以下回答
int main(){
    ll N;
    cin>>N;
    ll ans = 1;
    rep(i,N){
        ll T;
        cin>>T;
        ans=ans/__gcd(ans,T)*T;
    }
    cout<<ans<<endl;
}


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

	int main(){

	int K,S;
	cin>>K>>S;
	
	int X,Y,Z,keep1,result=0;
	
		for(X=0;X<=K;X++){
			
			keep1 = S - X;		//keep = Y + Z
			if(keep1 < 0) break;
		
				for(Y=0;Y<=keep1 && Y<=K;Y++){
					Z = keep1 - Y;
					if(Z <= keep1 && Z <= K) result++;
				}
		}
		
		cout<<result<<endl;
		
		return 0;
	}


Measured memory_bytes: 256
a, b, c = map(int, input().split());
ans = 0;

ans = a + b 
if a + c < ans: ans = a + c
if b + a < ans: ans = b + a
if b + c < ans: ans = b + c
if c + a < ans: ans = c + a
if c + b < ans: ans = c + b


print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
   	
int main() {
	int n, l, sum = 0, val, ind;

	cin >> n >> l;
	int a[n];
    val = l;
	for (int i = 1; i < n+1; i++)
	{
		sum = sum + l + i - 1;
		a[i - 1] = l + i - 1;
		if (a[i-1] < 0)
		{
			if (val < 0)
			{
				if (((-1) * a[i-1]) < ((-1)*val))
				{
					val = a[i-1];
				}
			}
			else
			{
				if (((-1) * a[i-1]) < val)
				{
					val = a[i-1];
				}
			}
		}
		else
		{
			if (val < 0)
			{
				if (a[i-1] < ((-1)*val))
				{
					val = a[i-1];
				}
			}
			else
			{
				if (a[i-1] < val)
				{
					val = a[i-1];
				}
			}
		}
	}

	sum = sum - val;
	cout << sum ;

	return 0;
}



Measured memory_bytes: 256
// ░█████╗░░░░░░░░░░░░░░░
// ██╔══██╗░░██╗░░░░██╗░░
// ██║░░╚═╝██████╗██████╗
// ██║░░██╗╚═██╔═╝╚═██╔═╝
// ╚█████╔╝░░╚═╝░░░░╚═╝░░
// ░╚════╝░░░░░░░░░░░░░░░
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define f(ii,n) for(ii=0;ii<n;ii++)
#define F(ii,a,n) for(ii=a;ii<n;ii++)
#define read(array,n) for(ll i=0;i<n;i++) cin>>array[i];
#define inf 1000000007;
// function to transform string to lowercase --> transform(s.begin(),s.end(),s.begin(),::tolower)
//(a + b ) % m = (a % m + b % m ) %m
//(a - b ) % m = ( (a % m - b % m ) + m ) %m
//(a * b ) % m = (a % m * b % m ) %m
//(a / b ) % m = (a % m * inv(b) ) %m where inv(b) = pow(b,m,m-2)



ll power(ll i,ll j){
	ll prod=1;
	while(j>0){
		if(j&1){
			prod=prod*i;
		}
		j=j>>1;
		i=i*i;
	}
	return prod;
}


void solve(){
	ll a,b,c,k;
	ll i,j;
	cin>>a>>b>>c>>k;
	ll count=0,sum=0;
	if(k<=a){
		cout<<k<<endl;
	}
	else{
		count=count+a;
		sum=sum+a;
		if(count+b>=k){
			cout<<sum<<endl;
			return;
		}
		else{
			count=count+b;
			ll rem=k-count;
			sum=sum-rem;
			cout<<sum<<endl;
			return;
		}
	}
	
}
int main(){
	// freopen("filename.txt","r",stdin);
	solve();
	
	// ll t;
	// cin>>t;
	// while(t--){
	// 	solve();
	// }
}

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

int n, k, h[100005], dp[100005];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) {
        cin >> h[i];
        if(i > 1) dp[i] = 1e9;
    }
    for(int i = 2; i <= n; ++i){
        for(int j = i - 1; j >= max(1, i - k); --j) {
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n] << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll N;
ll A,B;

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

  cin>>N;
  ll gg=0;
  rep(i,N){
    cin>>A>>B;
    ll g=0;
    if(B%2==1){
      if(A%2==1)g^=0;
      else{
        ll d=0;
        ll crt=A;
        while(crt*2<=B){
          d++;
          crt*=2;
        }
        if(d%2==0) g^=1;
        else g^=2;
      }
    }else{
      vector<P> ps;
      ll lb=(B/4)+1;
      ll ub=B/2;

      //dbg(lb); dbg(ub);

      while(1){
        if(lb<=A&&A<=ub){
          if(A%2==1) g^=1;
          else g^=2;
          break;
        }else if(A>ub){
          if(A%2==1) g^=1;
          else g^=0;
          break;
        }else{
          if(lb%2==1){
            B=lb-1;
            lb=(B/4)+1;
            ub=B/2;
          }else{
            if(A%2==1) g^=0;
            else{
              ll d=0;
              ll crt=A;
              while(crt*2<=B){
                d++;
                crt*=2;
              }
              if(d%2==0) g^=1;
              else g^=2;
            }
            break;
          }
        }
      }
    }
    //dbg(g);
    gg^=g;
  }

  if(gg==0)cout<<"tubuann"<<endl;
  else cout<<"mo3tthi"<<endl;

  return 0;
}



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

int main() {
    long R;
    cin >> R;
    
    cout << R * 2 * 3.141592 << endl;
}


Measured memory_bytes: 3800
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll inf = 10e17;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);

int main(void)
{
	while (solve())
	{
	}
	return 0;
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}


ll solve(void)
{
	ll x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;

	vector<ll> p(a), q(b), r(c);
	for (auto& tp :p)
		cin >> tp;
	for (auto& tq: q)
		cin >> tq;
	for (auto& tr :r)
		cin >> tr;

	sort(p.begin(), p.end(), std::greater<ll>());
	sort(q.begin(), q.end(), std::greater<ll>());
	sort(r.begin(), r.end(), std::greater<ll>());

	ll ip = x - 1, iq = y - 1;
	for (ll ir = 0; ir < c; ir++)
	{
		auto tp = ip >= 0 ? p[ip] : inf;
		auto tq = iq >= 0 ? q[iq] : inf;
		auto tr = r[ir];

		if (tr < tp && tr < tq) { continue; }
		if (tr - tp >= tr - tq && ip >= 0)
		{
			p[ip] = tr;
			ip --;
			continue;
		}
		if (tr - tp < tr - tq && iq >= 0)
		{
			q[iq] = tr;
			iq --;
			continue;
		}

	}

	ll ans = 0;
	for (ll i = 0; i < x; i++)
		ans += p[i];
	for (ll i = 0; i < y; i++)
		ans += q[i];

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2560
import scala.io.Source

object Main{
  def main(args: Array[String]){
    var list = List[String]()
    for(in <- Source.stdin.getLines.toList){
      list = in :: list
    }

    for(i <- 0 until list.length){
      val arr = list(list.length - i - 1).split(Array(' '))

      if(!(arr(0).toInt == 0 && arr(1).toInt == 0)){
        for(i <- 0 until arr(0).toInt){
          for(j <- 0 until arr(1).toInt){
            print("#")
          }
          println
        }
        println
      }
    }
  }
}

Measured memory_bytes: 54676