akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize "03"
    #include "bits/stdc++.h"
    using namespace std;
     
    #define int long long int
    #define ld long double
    #define pi pair<int, int>
    #define pb push_back
    #define fi first
    #define se second
    #define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
    #ifndef LOCAL
    #define endl '\n'
    #endif
     
    const int N = 1e5 + 5;
    const int mod = 1e9 + 7;
    const int inf = 1e18 + 9;
     
    signed main() {
        IOS;
        #ifdef LOCAL
            freopen("input.txt","r", stdin);
            freopen("output.txt","w",stdout);
        #endif
        int n, k;
        cin >> n >> k;  
        cout << (n-2)/(k-1) + 1;
        return 0;
    }

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

int main(){

  int m,f,b;
  cin >> m >> f >> b;

  if (m>=b){
      cout << 0 << endl;
  }else if (m+f>=b){
      cout << b-m << endl;
  }else{
      cout << "NA" << endl;
  }

  return 0;

}


Measured memory_bytes: 3120
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, A: "List[int]"):
    return ['DENIED', 'APPROVED'][all(a % 2 or a % 3 == 0 or a % 5 == 0 for a in A)]


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, A)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 70356
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u) {
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for(v=0;v<n;v++) {
    if(M[u][v] == 0)continue;
    if(color[v] == WHITE) {
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs() {
  int u;
  for(u = 0;u<n;u++) color[u] = WHITE;
  tt = 0;

  for(u = 0;u < n;u++) {
    if(color[u] == WHITE) dfs_visit(u);
  }
  for(u = 0;u<n;u++) {
    printf("%d %d %d\n", u+1,d[u],f[u]);
  }
}

int main() {
  int u,v,k,i,j;

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

  for(i = 0;i<n;i++) {
    scanf("%d%d\n",&u,&k );
    u--;
    for(j=0;j<k;j++) {
      scanf("%d\n", &v);
      v--;
      M[u][v] = 1;
    }
  }
  dfs();

  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N = 2002;
int a[N][N],lleft[N][N],rright[N][N],up[N][N],down[N][N];
int main(){
    int h,w,res=0;
    char s;
    cin>>h>>w;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>s;
            if(s=='.'){
                a[i][j] = 1;
                lleft[i][j] = lleft[i][j-1]+1;
                down[i][j] = down[i-1][j]+1;
            }
        }
    }

    for(int i=h;i>=1;i--){
        for(int j=w;j>=1;j--){
            if(a[i][j] == 1){
                rright[i][j] = rright[i][j+1]+1;
                up[i][j] = up[i+1][j]+1;
                res = max(res,lleft[i][j]+rright[i][j]+up[i][j]+down[i][j]-3);
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 78464
#include<bits/stdc++.h>
#define N 300050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;
string s; 
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    cin>>s;
    for(int i=0;i<3;i++)
        cout<<s[i];
  	return 0;
}



Measured memory_bytes: 3620
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    int N = S.length();
    String[] split = S.split("");
    int count = 0;
    for (int i = 0;i < N/2;i++) {
      if (split[i].equals(split[N - 1 - i])) {
      }
      else{
        count++;
      }
    }
    System.out.println(count);
  }
}


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

class Program
{
    //Constで定義すると警告が出るので、変数として定義
    static string InputPattern = "Input2";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 7");
            WillReturn.Add("1 99");
            WillReturn.Add("1000 99");
        }
        else {
            string wk;
            while ((wk = Console.ReadLine()) != null) WillReturn.Add(wk);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        foreach (string EachStr in InputList) {
            string[] IntArr = EachStr.Split(' ');
            int wkSum = int.Parse(IntArr[0])+int.Parse(IntArr[1]);
            int Ketasuu = (int)Math.Truncate(Math.Log10(wkSum))+1;

            Console.WriteLine(Ketasuu);
        }
    }
}

Measured memory_bytes: 5700
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	int l;
	cin >> l;
	vector<tuple<int, int, int>> ans;
	int tot = 0;
	for (int i = 0; l > 1; i++) {
		if (l & 1) {
			ans.push_back(make_tuple(i, -1, l - 1));
			l--;
		} 
		if (l > 0) {
			ans.push_back(make_tuple(i, i + 1, 0));
			ans.push_back(make_tuple(i, i + 1, l / 2));
			l /= 2;
		}
		tot = i + 1;
	}
	cout << tot + 1 << ' ' << ans.size() << endl;
	for (auto t : ans) {
		int u, v, c;
		tie(u, v, c) = t;
		if (v == -1) v = tot;
		cout << u + 1 << ' ' << v + 1 << ' ' << c << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static int h, w, c;
	static int[] change;
	static int[][] p, stamp;

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

	static int rec(int y, int x, int pos) {
		int res = stamp[y][x] == 6 ? 1 : 0;
		stamp[y][x] = pos;
		for (int k=0; k<4; k++) {
			int ny = y + dy[k];
			int nx = x + dx[k];
			if (ny < 0 || nx < 0 || h <= ny || w <= nx) continue;
			int ptmp = pos;
			while (ptmp < 6 && change[ptmp] != p[ny][nx]) ptmp++;
			if (stamp[ny][nx] <= ptmp) continue;
			res += rec(ny, nx, ptmp);
		}
		return res;
	}

	static boolean solve() {
		h = in.nextInt();
		w = in.nextInt();
		c = in.nextInt();
		if (h + w + c == 0) return false;

		p = new int[h][w];

		for (int i=0; i<h; i++) {
			for (int j=0; j<w; j++) {
				p[i][j] = in.nextInt();
			}
		}

		int ans = 0;

		for (int i=1; i<=6; i++) {
			for (int j=1; j<=6; j++) {
				for (int k=1; k<=6; k++) {
					for (int l=1; l<=6; l++) {
						change = new int[]{p[0][0], i, j, k, l, c};

						stamp = new int[h][w];
						for (int m=0; m<h; m++) {
							Arrays.fill(stamp[m],6);
						}
						ans = Math.max(ans, rec(0, 0, 0));
					}
				}
			}
		}

		out.println(ans);

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.currentTimeMillis();

		while(solve());
		out.flush();

		long end = System.currentTimeMillis();
		dump((end-start) + "ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 80704
//
// Created by nore on 2018/06/15.
//

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    int cnt=0;
    sort(a,a+3,greater<int>());
    cnt+=(a[0]-a[2])/2;
    cnt+=(a[0]-a[1])/2;
    if((a[0]-a[2])%2==1 && (a[0]-a[1])%2==1)cnt++;
    else if((a[0]-a[2])%2==1 || (a[0]-a[1])%2==1)cnt+=2;
    cout<<cnt<<endl;
}

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

//そのまま再帰にかけて実行しては間に合わない。先に各部分木の根に対して、子に分配する数値を加算しておき、
//根である1から子に対して、根の数値を加算していく作業を一回だけ行えば条件は満たされる

void DFS(const Graph &G,int v,vector<bool> &seen,vector<int> &counter){//深さ優先探索。
//引数は順にグラフ、始点(注目点)、探索済みかどうか、各点の持つ値を記録するカウンタ
  
  seen[v]=true;

  for(auto next_v : G[v]){
    if(seen[next_v]) continue;
    counter[next_v]+=counter[v];
    DFS(G,next_v,seen,counter);
  }

  return ;

}

 
int main() {

  int N ;  cin >> N ;

  Graph G(N+1);//頂点はn個。今回は数値にそのまま対応させるために+1した

  rep(i,N){
    int u,k;
    cin >> u >> k;//頂点番号、頂点の数
    rep(j,k){
      int x; cin >> x;
      G[u].push_back(x);
    }
  }//入力終了

  vector<int> dist(N+1,-1);//全地点を未訪問で初期化
  
  dist[1]=0;//頂点1（スタート）の距離を0にする

  queue<int> que;//BFS用キュー

  que.push(1);

  while(!que.empty()){
    int v = que.front();
    que.pop();          //先頭頂点を取り出す
    
    for(int nv : G[v]){
      if(dist[nv]!=-1) continue;//探索済みならスルー

      //初めて候補に挙がった点は距離を入力し、キューに入れる
      dist[nv]= dist[v]+1;
      que.push(nv);
    }

  }

  for(int i=1;i<=N;i++){
    cout << i << ' ' << dist[i] <<endl ;
  }

  return 0;
}


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

public class Main{
  public static void main(String[] args){
    try{
      BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
      String[] t = r.readLine().split(" ");
	  int H = Integer.parseInt(t[0]);
      int W = Integer.parseInt(t[1]);
	  char[] c = new char[W+2];
      Arrays.fill(c, '#');
      StringBuilder sb = new StringBuilder();
      sb.append(String.valueOf(c)+"\n");
      for(int i = 0; i < H; i++){
        sb.append("#");
        sb.append(r.readLine());
        sb.append("#\n");
      }
      sb.append(String.valueOf(c));
      System.out.println(sb);
    } catch(IOException e){}
  }
}

Measured memory_bytes: 21844
#include<stdio.h>
  
int main(void){
  int a[10],i,j,d;
  for(i=0;i<10;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<10;i++){
    for(j=i;j<10;j++){
      if(a[i] < a[j]){
	d = a[i];
      a[i] = a[j];
      a[j] = d;
      }
    }
  }
  for(i=0;i<3;i++)
    printf("%d\n",a[i]);
  return 0;
}

Measured memory_bytes: 2752
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    d = list(map(int, input().rstrip('\n').split()))
    d.sort()
    print(abs(d[n // 2] - d[n // 2 - 1]))


if __name__ == '__main__':
    slove()


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

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 107;
int a[maxn];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(i != j){
                ans = max(ans, abs(a[i] - a[j]));
            }
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main () {
    int n;
    cin >> n;
    int a[n];
    vector<pair<int, int> > vec[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0; j < a[i]; j++) {
            int x, y;
            cin >> x >> y;
            vec[i].push_back(make_pair(x - 1, y));
        }
    }
    int max = 0;
    for (int i = 0; i < (1 << n); i++) {
        int count = 0;
        int honest[n];
        for (int j = 0; j < n; j++) {
            honest[j] = (i >> j) & 1;
            count += (i >> j) & 1;
        }
        bool ok = true;
        for (int k = 0; k < n; k++) {
            if (honest[k]) {
                for (int l = 0; l < a[k]; l++) {
                    if (honest[vec[k][l].first] != vec[k][l].second) {
                        ok = false;
                    }
                }
            }
        }
        if (ok) {
            if (max < count) max = count;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    int a, b, k;
    cin >> a >> b >> k;

    if (b - a + 1 > k * 2) {
        for (int i = a; i < a + k; i++) {
            cout << i << '\n';
        }
        for (int i = b - k + 1; i <= b; i++) {
            cout << i << '\n';
        }
    } else {
        for (int i = a; i <= b; i++) {
            cout << i << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())

a_s = input().split()

for i in range(3*N):
  a_s[i] = int(a_s[i])
  
a_s = sorted(a_s)

a_1 = a_s[:N]
a_2 = a_s[N:]

ans = sum(a_2[0::2])

print(ans)


Measured memory_bytes: 28508
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main ()
{
  int N;cin>>N;
  int cake = 4;
  int donut = 7;
  int max_donut = N/donut + 1;
  for (int d = 0; d<=max_donut ; d++){
    int resi = N-donut * d;
    if(resi<0){
      cout<<"No"<<endl;
      break;
    }
    if(resi%cake == 0){
      cout<<"Yes"<<endl;
      break;
    }
  }
  return 0;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "YES" : "NO") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

char c[3];

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

  
  REP(wi, 3) {
    cin >> c[wi];
  }

  bool ok = true;
  char ch;
  RREP(wi, 3) {
    cin >> ch;
    ok &= (ch == c[wi]); 
  }
  OK(ok);

  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 100000;

int dx[4] = {1,-1, 0, 0};
int dy[4] = {0, 0, 1,-1};
int main()
{
    int H, W;
    cin >> H >> W;
    char s[H+3][W+3];
    for(int i = 0; i < H; ++i) cin >> s[i];

    int dp[H+3][W+3]; //ゴール:dp[H-1][W-1]
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            if(s[i][j] == '#') dp[i][j] = -1;
            else dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;
    bool flg = true;
    while(flg) {
        flg = false;
        for(int i = 0; i < H; ++i) {
            for(int j = 0; j < W; ++j) {
                int mn = INF;
                for(int k = 0; k < 4; ++k) {
                    int nx = i + dx[k], ny = j + dy[k];
                    if(0 <= nx && nx < H && 0 <= ny && ny < W)
                        if(dp[nx][ny] != -1)
                            mn = min(mn, dp[nx][ny] + 1);
                }
                if(mn < dp[i][j]) { dp[i][j] = mn; flg = true; }
            }
        }
    }

    if(dp[H-1][W-1] == INF) { cout << -1 << endl; return 0; }

    int white = dp[H-1][W-1] + 1;
    int black = 0;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            if(dp[i][j] == -1) ++black;
        }
    }
    cout << H*W - white - black << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int h, w, a, b;
	scanf("%d %d %d %d", &h, &w, &a, &b);
	int i, j;
	for (i = 0; i < h; i++)
	{
		for (j = 0; j < w; j++)
		{
			if (i < b && j < a)
				printf("1");
			else if (i >= b && j >= a)
				printf("1");
			else
				printf("0");
		}
		printf("\n");
	}
	return 0;
}

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

#define int long long
#define inf 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)

signed main() {
  int n, m;
  cin >> n >> m;
  int xa = 0;
  int xn = 0;
  int pre = -inf;
  rep(i, n) {
    int w;
    cin >> w;
    xn += i * (w - pre);
    pre = w;
    xa += xn;
  }
  int ya = 0;
  int yn = 0;
  pre = -inf;
  rep(i, m) {
    int w;
    cin >> w;
    yn += i * (w - pre);
    pre = w;
    ya += yn;
  }
  cout << (xa % inf) * (ya % inf) % inf << endl;
}


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

int main()
{
	long long n,a,jwb=0;
	cin >> n;
	map<long long, bool> m;
	while (n--) {
		cin >> a;
		if (m[a]) {
			m[a] = false;
			--jwb;
		} else {
			m[a] = true;
			++jwb;
		}
	}
	cout << jwb << endl;
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()
#define fcout cout << setprecision(10)

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) { cin >> a[i]; }
    int cnt = 0;
    REP(i, N) {
        if (a[i] == cnt + 1) {
            cnt += 1;
        }
    }

    cout << (cnt == 0 ? -1 : N - cnt) << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[n];
		long tot = 0;
		for(int b = 0;b<n;b++){
			a[b] = scan.nextInt();
			tot = tot + a[b];
		}
		int max = a[0];
		int min = a[0];
		for(int c = 1;c<n;c++){
			if(max < a[c]){
				max = a[c];
			}
			if(min > a[c]){
				min = a[c];
			}
		}
		System.out.println(min +" "+ max +" "+ tot);
	}
}

Measured memory_bytes: 31712
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
 
    public  static void main(String[] args)   throws Exception, IOException{
     
        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
     
        int n=sc.nextInt();
        int x=sc.nextInt();
        int y=sc.nextInt();
        // char c[][] = new char[h][w];
        int d[] = new int [n];  
        for (int i=0; i<n; i++ ) {
            d[i] = sc.nextInt();
        }
        int ans=abs(d[n-1]-y);
        if(n>1){
            ans = max(abs(d[n-1]-d[n-2]),ans);
        }
       
        out.println(ans);
        out.flush();
    }
     
    static void db(Object... os){
     
        System.err.println(Arrays.deepToString(os));
     
    }
     
    static boolean validpos(int x,int y,int r, int c){
        
        return x<r && 0<=x && y<c && 0<=y;
        
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}
 
class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21716
/**
 *    author:  skmonir
 *    created: 05-Oct-2017 23:09:10
**/
#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void Int(T &n) {
    n = 0; int f = 1; register int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}
template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void Int(T &x, W &y) {Int(x), Int(y);}
template <TN T, TN W, TN Q> inline void Int(T &x, W &y, Q &z) {Int(x, y), Int(z);}

const int N = (int) 1e5 + 5;
const int INF = (int) 1e9 + 7;
const long long MOD = (long long) 1e9 + 7;

int a[N];

int sq(int x) {
    return x * x;
}

int main() {
    int n; Int(n);
    FOR (i, 1, n) Int(a[i]);

    int mx = -200, mn = 200;
    FOR (i, 1, n) {
        umin(mn, a[i]);
        umax(mx, a[i]);
    }

    int res = INT_MAX;
    FOR (i, mn, mx) {
        int s = 0;
        FOR (j, 1, n) s += sq(i - a[j]);
        umin(res, s);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll r;
    cin >> r;
    cout << r*r;

    return 0;
}

Measured memory_bytes: 3136
#include<iostream>
using namespace std;
int main(){
  int day,homework;
  cin>>day;
  cin>>homework;
  int a[homework];
  for(int i=0;i<homework;i++){
    cin>>a[i];
  }
  int ans=day;
  for(int i=0;i<homework;i++){
    ans=ans-a[i];
  }
  if(ans<0){
    ans=-1;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	string a,b;
	cin >> a >> b;
	string s = a + b;
	int x = stoi(s);
	
	for(int i=0;i * i <= x;i++){
		if(i * i == x){
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;
	
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

//https://ja.wikipedia.org/wiki/%E6%9C%9F%E5%BE%85%E5%80%A4
int main()
{
	ll N, M;
	cin >> N >> M;
	ll x = (ll)pow(2, M);
	ll ans = (1900 * M + 100 * (N - M)) * x;
	cout << ans << endl;
	return 0;
}


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


int main(){
    string N;
    cin >> N;
    ll sum = 0;
    for(int i = 0; i < N.length(); i++){
        sum += N[i] - '0';
    }
    if(sum % 9 ==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3744
#include <stdio.h>
#include <math.h>
#define S_MAX 100000
#define T_MAX 50000
#define FALSE 0

int S[S_MAX] = {0};
int T[T_MAX] = {0};
int n,cnt = 0;
double d_cnt = 0;

void Search(double d, int i){
	if(pow( 2.0, d_cnt) <= n){
		d_cnt++;
		int divide = d * (double)n;
		if(S[divide] < T[i]){
			d = d + pow( 1.0 / 2.0, d_cnt + 1);
			Search(d, i);
		}else if(S[divide] > T[i]){
			d = d - pow( 1.0 / 2.0, d_cnt + 1);
			Search(d, i);
		}else{
			cnt++;
		}
	}
}

int main(void){
	int q,i,j;

	scanf("%d", &n);

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

	scanf("%d", &q);

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

	for(i = 0;i < q;i++){
		d_cnt = 0;
		Search(1.0 / 2.0, i);
	}

	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

ll ans;
ll used[100005], S[100005];

int main(void) {
    ll N, X, M;
    cin >> N >> X >> M;
    ll now = X%M;
    ll s=-1, t=-1;
    for (int i=0; i<=100005; i++) used[i] = -1;
    for (ll i=1; i<=N; i++) {
        if (used[now]!=-1) {
            s = (ll)used[now];
            t = (ll)i;
            break;
        }
        used[now] = i;
        S[i] = S[i-1] + now;
        now = (now*now)%M;
        
    }

    if (s==-1 && t==-1) ans = S[N]-S[0];
    else {
        ll L = t-s, k = N-s+1;
        ll Q = k/L, R = k%L;
        ans = (S[s-1]-S[0])+(S[t-1]-S[s-1])*Q+(S[s+R-1]-S[s-1]);
    }

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





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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

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

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	int maxv = -INF;
	for (int i = 0; i < N; i++) {
		int A; cin >> A;
		if (maxv-1 > A) {
			cout << "No" << endl;
			return;
		}
		chmax(maxv, A);
	}
	cout << "Yes" << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3632
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				push_back(z)
#define ff					/first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
//#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}

void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}

void solve()
{
 	 ll n;cin>>n;
 	 vector<string>v;
 	 map<string,ll>mp;
 	 while(n--){
 	 	string inp;cin>>inp;
 	 	mp[inp]++;
	  }
	  ll mx=0;
	  for(auto ele:mp){
	  	mx=max(mx,ele.second);
	  }
	  for(auto ele:mp){
	  	if(ele.second==mx){
	  		v.pb(ele.first);
		  }
	  }
	  sort(all(v));
	  for(auto x:v)cout << x << nl;
}

int main() {
	fast_io
	//start();
    //caset{
    	//cout << "Case " << tt << ": ";

		  solve();
	//}
	
	return 0;
}


Measured memory_bytes: 27228
#include<bits/stdc++.h>
using namespace std;
const int N=5005;
typedef long long LL;
int d[N];
int main(){
	int k,q,n,n1,m,x,w;LL sum;scanf("%d%d",&k,&q);
	for(int i=0;i<k;i++)scanf("%d",d+i);
	for(int i=0;i<q;i++){
		scanf("%d%d%d",&n,&x,&m),n--;
		x%=m,sum=w=0,n1=n/k;
		for(int j=0;j<k;j++){
			sum+=d[j]%m;
			if(d[j]%m==0)w+=n1;
		}
		sum*=n1,n1=n,n%=k;
		for(int j=0;j<n;j++){
			if(d[j]%m==0)w++;
			sum+=d[j]%m;
		}
		sum+=x;
		printf("%d\n",n1-sum/m-w);
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
#include <cstdlib>
#include <cstring>
#include<iostream>

using namespace std;

int main(){
	int A, B, K, i;
	scanf("%d %d %d", &A, &B, &K);

	if (A + K-1 < B - K+1){
		for (i = 0; i < K; i++){
			printf("%d\n", A + i);
		}
		for (i = 0; i < K; i++){
			printf("%d\n", B - K + i + 1);
		}
	}
	else{
		for (i = 0; i <= B - A;i++){
			printf("%d\n", A + i);
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    map<int, int> m;
    rep(i, 6){
        int x;
        cin >> x;
        m[x]++;
    }

    for(int i = 1; i <= 4; i++){
        if(m[i] >= 3){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 888
s= input()

flg = 1
if len(s)%2 == 0:
    for i in range(len(s)//2):
        if s[0+i*2:2+i*2] != "hi":
            break
        if i == len(s)//2 -1:
            print("Yes")
            flg = 0
    if flg == 1:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); i++)
typedef long long ll;
// Welcome to my source code!

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    int y = x;
    REP(i,10) {
        y = r * y - d;
        cout << y << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int key,N,mi,i,j,count=0;
  int A[100];

  scanf("%d",&N);
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<N-1;i++){
    mi = i;
    for(j=i+1;j<N;j++){
      if(A[j]<A[mi]){
	mi=j;
      }
    }
    
    key=A[i];
    A[i]=A[mi];
    A[mi]=key;
    if(A[i]!=A[mi]) count++;   
  }
  
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i<N-1) printf(" ");
  }
  
  printf("\n%d\n",count);
  return 0;
}

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

#define INFTY 1200000000

int num(char ch)
{
    if(ch == 'S'){ return 0; }
    else if(ch == 'H'){ return 1; }
    else if(ch == 'C'){ return 2; }
    else if(ch == 'D'){ return 3; }else{}
    return 0;
}

char suit(int i)
{
    if(i == 0){ return 'S'; }
    else if(i == 1){ return 'H'; }
    else if(i == 2){ return 'C'; }
    else if(i == 3){ return 'D'; }else{}
    return 'Z';
}

void Merge(int* A, int* s, int left, int mid, int right)
{
    int* L; int* R;
    int* ch_L; int* ch_R;
    int i, j, k, n1, n2;
    n1 = mid - left;
    n2 = right - mid;

    L = new int [n1 + 1]; R = new int [n2 + 1];
	ch_L = new int [n1];  ch_R = new int [n2];
    if(L == NULL || R == NULL || ch_L == NULL || ch_R == NULL) return;

    for(i = 0; i < n1; i++){ L[i] = A[i + left]; ch_L[i] = s[i + left]; }
    for(j = 0; j < n2; j++){ R[j] = A[j + mid]; ch_R[j] = s[j + mid]; }

    L[n1] = INFTY;
    R[n2] = INFTY;
    i = j = 0;

    for(k = left; k < right; k++){

		if(L[i] <= R[j]){ A[k] = L[i]; s[k] = ch_L[i]; i++; }

		else{ A[k] = R[j]; s[k] = ch_R[j]; j++; }
    }
    delete [] L; delete [] R;
    delete [] ch_L; delete [] ch_R;
}

void MergeSort(int* A, int* s, int left, int right)
{
    int mid;
    if(left + 1 < right){
        mid = (left + right) / 2;
        MergeSort(A, s, left, mid);
        MergeSort(A, s, mid, right);
        Merge(A, s, left, mid, right);
    }
    return;
}

int partition(int* A, int* s, int p, int r)
{
    int i, j, x;
    x = A[r];
    i = p - 1;
    for(j = p; j < r; j++){
        if(A[j] <= x){ i++; swap(A[i], A[j]); swap(s[i], s[j]); }
    }
    swap(A[i + 1], A[r]);
    swap(s[i + 1], s[r]);

    return i + 1;
}

void quicksort(int* A, int* s, int p, int r)
{
    if(!(p < r)) return;
    int q;
    q = partition(A, s, p, r);
    quicksort(A, s, p, q - 1);
    quicksort(A, s, q + 1, r);
}

bool is_stable(int* s, int* t, int n)
{
    int i = 0;
    while(i < n){ if(s[i] != t[i]) return false; i++; };
    return true;
}

int main()
{
    int i, n;
    char ch;
    int* A; int* B;
    int* s; int* t;
    cin >> n;
    A = new int [n]; B = new int [n];
    s = new int [n]; t = new int [n];
	if(A == NULL || B == NULL || s == NULL || t == NULL) return 0;

    for(i = 0; i < n; i++){
        cin >> ch; s[i] = num(ch); t[i] = s[i];
        cin >> A[i]; B[i] = A[i];
    }

    quicksort(A, s, 0, n - 1);
    MergeSort(B, t, 0, n);

    if(is_stable(s, t, n)){ cout << "Stable"; } else{ cout << "Not stable"; }
    cout << endl;

    for(int i = 0; i < n; i++){ cout << suit(s[i]) << " " << A[i] << endl; }

    delete [] A; delete [] B;
    delete [] s; delete [] t;

    return 0;
}

Measured memory_bytes: 3420
#include <iostream>
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    n++;
    ll l[n];
    l[0]=2; l[1]=1;
    for(int i=2; i<n; i++) l[i] = l[i-1] + l[i-2];
    cout << l[n-1] << endl;
    return 0;
}


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

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

    int min = 10000001, max = -1000001;
    long long sum = 0;
    int a;

    for(int i = 0; i < n; i++){
        cin >> a;
        if (a < min) min = a;
        if (a > max) max = a;
        sum += a;
    }

    cout << min << " " << max << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N ; cin >> N;
    vector<int> A(N);
    int maxA=0; int max2A = 0;
    for(int i=0;i<N;i++){
        cin >>A[i];
        if(A[i]>maxA) {max2A = maxA; maxA = A[i];} 
        else if(A[i]<=maxA && A[i] > max2A) max2A = A[i];
    }

    for(int i=0;i<N;i++){
        if(A[i] == maxA) cout << max2A<< endl;
        else cout << maxA<< endl;
    }
}


Measured memory_bytes: 2432
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val takahashi = sc.nextBigDecimal()
    val aoki = sc.nextBigDecimal()
    val total = sc.nextBigDecimal()

    val result = takahashi.subtract(total)

    if (result.compareTo(java.math.BigDecimal.ZERO) >= 0) {
      println(s"$result $aoki")
    } else {
      val aokiResult = aoki.add(result)
      val aokiFinalResult = aokiResult.max(java.math.BigDecimal.ZERO)

      println(s"0 $aokiFinalResult")
    }
  }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

ll h;

ll f(ll h)
{
        if(h==1)return 1;
        return 2*f(h/2)+1;
}

main()
{
        cin>>h;
        cout<<f(h)<<endl;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import qualified Data.Map as MP
import Data.Maybe
import Data.Char

make xs = VU.foldl' step MP.empty xs
    where
        step m x =
            case MP.lookup x m of
                Just _ -> MP.adjust (+1) x m
                Nothing -> MP.insert x 1 m

solve m
    | MP.null m = 0
    | odd v = 1 + solve m'
    | otherwise = solve m'
        where
            ((_,v), m') = MP.deleteFindMin m

main = do
    n <- readLn :: IO Int
    xs <- VU.replicateM n (fst . fromJust . B.readInt <$> B.getLine)
    let m = make xs
    print $ solve m

Measured memory_bytes: 19068
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

int main(void) {
	int tmp, max = 0, sum = 0, i;
	for (i = 0; i < 3; i++) {
		scanf("%d", &tmp);
		if (max < tmp) max = tmp;
		sum += tmp;
	}
	sum -= max;
	printf("%d\n", sum);
	return 0;
}


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

int main(){

  int a[3];
  cin>> a[0] >> a[1] >> a[2] ;

  int min = 100000;
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      if(i!=j){
        int sum=0;
        sum += abs(a[j]-a[i]);
        int k = 3-i-j;
        sum += abs(a[k]-a[j]);
          if(sum<min){min = sum;}
      }
    }
  }
  cout << min  << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define SIZE 16
 
int main(){
   char s[SIZE] = {0};
   scanf("%s",s);
   char * a = "CODEFESTIVAL2016";
   int x = 0;
int t =0;
   while(x < SIZE){
      if(s[x] != a[x]) t++;
      x++;
   }
 printf("%d",t);
return 0;
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    string S[3];
    int now = 0;
    string ans = "ABC";
    rep(i, 3) cin >> S[i];
    while (1) {
        if (S[now].size() == 0) {
            cout << ans[now] << endl;
            break;
        }
        char c = S[now].front();
        S[now] = S[now].substr(1, S[now].size() - 1);
        now = c - 'a';
    }

    return 0;
}


Measured memory_bytes: 256
mod=10**9+7
n,a,b=map(int,input().split())
pows=[2]
for _ in range(40):
  pows.append((pows[-1]**2)%mod)
ans=1
flag=format(n,'b')
if len(flag)<31:
  flag=(31-len(flag))*'0'+flag
flag=flag[::-1]
for i in range(31):
  if flag[i]=='1':
    ans*=pows[i]
    ans%=mod
ans-=1
rfacts=[pow(1,mod-2,mod)%mod,pow(1,mod-2,mod)%mod]
for i in range(2,2*(10**5)+1):
  rfacts.append((rfacts[-1]*pow(i,mod-2,mod))%mod)
if n<=2*10**5:
  fact=1
  for i in range(2,n+1):
    fact*=i
    fact%=mod
  ans-=(fact*rfacts[a]*rfacts[n-a])%mod
  ans%=mod
  ans-=(fact*rfacts[b]*rfacts[n-b])%mod
  ans%=mod
else:
  fact1=1
  for i in range(n,n-a,-1):
    fact1*=i
    fact1%=mod
  ans-=(fact1*rfacts[a])%mod
  ans%=mod
  fact2=1
  for i in range(n,n-b,-1):
    fact2*=i
    fact2%=mod
  ans-=(fact2*rfacts[b])%mod
  ans%=mod
print(ans)

Measured memory_bytes: 53488
#include <iostream>

using namespace std;

long long n, i, k, c;

int main()
{
	cin >> n >> k;
	int dp[n];
  	for (i ; i < n ; ++ i) {
        cin >> dp[i];
        if (dp[i] >= k) c++;
  	}
  	cout << c;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-/
import sys
def main():
    for line in sys.stdin:
        n, k, m = map(int, line.split()) # ??\???
        if not(n or k or m): # 0 0 0??§??????
            break
        stone = list(range(1, n + 1)) # 1 ~ n????????????????????§??¨???
        m -= 1 # ????????????????????¨????????????????????¬?????????
        while len(stone) > 1: # ??????1?????????????????§
            stone.pop(m) # ?????????????????????m???????´??????????
            m = (m + k - 1) % len(stone) # ?¬??????????????????????????±????
        print(stone[0]) # ?????£??????????????????

if __name__ == "__main__":
    main()

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

int main(){
	int a, b, c = 0;
	cin >> a >> b;
	for (a; a <= b; a++) {
		if (((a%100)-(a%10))*100+(a%10)*10000+a%1000 == a)
			c++;
	}
	cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
 
 
using namespace std;

const long long N = 100 * 1000;
long long value[N];
long long mark[N];
vector<long long> graph[N];
multiset<long long> comp[N];
long long ans = 0;
long long one = 0;
long long other = 0;
long long sz = 0;
long long n, m, mh, mm;
void input()
{
	cin >> n >> m;
	for (long long i = 0 ; i < n; i++)
	{
		cin >> value[i];
	}
	for (long long i = 0; i < m; i++)
	{
		long long u, v;
		cin >> u >> v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
}
void dfs(long long v)
{
	comp[mh].insert(value[v]);
	mark[v] = true;
	for (long long i = 0; i < graph[v].size(); i++)
	{
		long long u = graph[v][i];
		if (!mark[u])
		{
			dfs(u);
		}
	}
	sz++;
}
int main()
{
	input();
	for (long long i = 0; i < n; i++)
	{
		if (!mark[i])
		{
			sz = 0;
			dfs(i);
			if (sz == 1)
				one++;
			else
			{
				other += sz;
				mm++;
			}
			mh++;
		}
	}
	if (mh == 1)
	{
		cout << 0;
		exit(0);
	}
	if (one == 2 && other == 0)
	{
		cout << value[0] + value[1];
		exit(0);
	}
	if (one > other - (mm - 1) * 2)
	{
		cout << "Impossible";
		exit(0);
	}
	vector<long long> tmp;
	for (long long i = 0; i < mh; i++)
	{
		ans += *(comp[i].begin());
		comp[i].erase(comp[i].begin());
		for (auto nei: comp[i])
		{
			tmp.push_back(nei);
		}
	}
	sort(tmp.begin(), tmp.end());
	for (long long i = 0; i < mh - 2; i++)
	{
		ans += tmp[i];
	}
	cout << ans << endl;



}

Measured memory_bytes: 18300