akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define MXN 20005
// #define debug

int mx[MXN], t[MXN], v[MXN], en;
double memo[MXN][105]; 
bool visited[MXN][105];
const int inf = 0x3f3f3f3f;

double dfs(int cur, int speed) {
    if (cur == en+1) {
        if (speed) return -inf;
        else return 0;
    }
    if (visited[cur][speed]) return memo[cur][speed];
    visited[cur][speed] = 1;
    double res = -inf;
    if (speed < mx[cur]) {
        res = max(res, dfs(cur+1, speed) + speed);
        res = max(res, dfs(cur+1, speed) + speed+0.25);
        res = max(res, dfs(cur+1, speed+1) + speed+0.5);
        if (speed) 
            res = max(res, dfs(cur+1, speed-1) + speed-0.5);
    } else if (speed == mx[cur]) {
        res = max(res, dfs(cur+1, speed) + speed);
        res = max(res, dfs(cur+1, speed-1) + speed-0.5);
    } 
    return memo[cur][speed] = res;
}

int main() { 
    int n;
    while (cin >> n) {
        en = 0;
        for (int i = 0; i < n; ++i) {
            cin >> t[i];
            en += t[i];
        }
        for (int i = 0; i < n; ++i) cin >> v[i];
        int cur = 1, tmp;
        for (int i = 0; i < n; ++i) {
            tmp = t[i];
            while (tmp--) {
                mx[cur++] = v[i];
            }
        }
#ifdef debug
        for (int i = 1; i <= en; ++i) {
            cout << mx[i] << " ";
        }
        cout << "\n";
#endif
        memset(visited, 0, sizeof(visited));
        printf("%.9lf\n", dfs(1, 0));
    }

    return 0;
}


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

struct node {
  int key;
  node *parent, *right, *left;
};

node *NIL, *root;

void insert(int k) {
  node *y = NIL;
  node *x = root;
  node *z = (node *)malloc(sizeof(node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if (y == NIL) {
    root = z;
  } else if (z->key < y->key) {
    y->left = z;
  } else {
    y->right = z;
  }
}

void inorderBody(node *u) {
  if (u == NIL) return;
  inorderBody(u->left);
  cout << " " << u->key;
  inorderBody(u->right);
}

void inorder() {
  inorderBody(root);
  cout << endl;
}

void preorderBody(node *u) {
  if (u == NIL) return;
  cout << " " << u->key;
  preorderBody(u->left);
  preorderBody(u->right);
}

void preorder() {
  preorderBody(root);
  cout << endl;
}

int main() {
  int m, tmp;
  string s;
  root = NIL;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> s;
    if (s == "insert") {
      cin >> tmp;
      insert(tmp);
    } else if (s == "print") {
      inorder();
      preorder();
    }
  }
}


Measured memory_bytes: 26464
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;

  scanf("%d",&n);

  for(int i=1;;i++){
    if( i * (i+1) /2 >= n){
      printf("%d\n",i);
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
int n,a,cnt[2][100002],m[2],n1[2];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int a;
		scanf("%d",&a);
		cnt[i&1][a]++;
		if(m[i&1]<cnt[i&1][a]) {
			m[i&1]=cnt[i&1][a];
			n1[i&1]=a;
		}
	}
	sort(cnt[0],cnt[0]+100001);
	sort(cnt[1],cnt[1]+100001);
	int ans=0;
	if(n1[0]!=n1[1])
		ans=n-m[0]-m[1];
	else ans=n-max(m[0]+cnt[1][100001-2],m[1]+cnt[0][100001-2]);
	printf("%d\n",ans);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define kaj_start int main()
#define kaj_shesh return 0

kaj_start{
    vector<int> v;
    int p, q, r;
    cin >> p >> q >> r;

    v.push_back(p + q);
    v.push_back(p + r);
    v.push_back(r + q);
    v.push_back(r + p);
    v.push_back(q + r);
    v.push_back(q + p);

    sort(v.begin(), v.end());

    cout << v[0] << endl;
    kaj_shesh;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int line = sc.nextInt();
        if(line==25)
        System.out.println("Christmas");
        if(line==24)
        System.out.println("Christmas Eve");
        if(line==23)
        System.out.println("Christmas Eve Eve");
        if(line==22)
        System.out.println("Christmas Eve Eve Eve");
    }
}


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

int main(){
    int p,q,r;

    cin >> p >> q >> r;



    int mini=INF;

    int ab,bc,ca;

    ab = p+q;
    bc=q+r;
    ca=r+p;

    mini = min(mini,ab);
    mini = min(mini,bc);
    mini = min(mini,ca);

    cout << mini << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

int n,h,w;

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	n=rd(); h=rd(); w=rd();
	printf("%d",(n-h+1)*(n-w+1));
	return 0;
}//Faze


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
int main()
{
	
   int s,ss;
   cin>>s>>ss;
   int k=0;
   if(ss==1)
   {
   	cout<<0<<endl;
   	return 0;
   }
   if(s>=ss)
   {
   	cout<<1<<endl;
   }
   else
   {
   	ss=ss-s;
   	k=ss/(s-1);
   	if(ss%(s-1)!=0)
   	k=k+2;
    else
   	 k++;
   	cout<<k<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;

string str;

void recursive(ll num,ll &su, string op) {
    if (num == str.size() - 1) {
        vector<ll> OP;
        for (int i = 0; i < op.size(); i++) OP.push_back(op[i] - '0');
        vector<ll> vec;
        int j = 0;
        for (int i : OP) {
            vec.push_back(stoll(str.substr(j, i + 1 - j)));
            j = i + 1;
        }
        vec.push_back(stoll(str.substr(j, str.size() - j)));

        for (int i = 0; i < op.size() + 1; i++) su += vec[i];
        return;
    }

    recursive(num + 1, su, op + to_string(num));
    recursive(num + 1, su, op);
    return;
}

int main() {
    cin >> str;
    ll su = 0, num = 0;
    string op = "";
    recursive(0, su, "");
    cout << su << endl;
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define ar array
#define pii pair<int, int>

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

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

    int n, ans = 0;
    cin >> n;
    for (int i = 1, a; i <= n; i++) {
        cin >> a;
        ans += (a % 2 == 1 && i % 2 == 1);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3612
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    long[] CS, xs;
    CS.length = 16;
    xs.length = 20000;
    auto DP = new long[][](20000, 256);

    for (;;) {
        auto nm = readln.split.to!(int[]);
        auto N = nm[0];
        auto M = nm[1];

        if (N == 0 && M == 0) return;
        foreach (i; 0..M) CS[i] = readln.chomp.to!long;
        foreach (i; 0..N) xs[i] = readln.chomp.to!long;

        foreach (ref dp; DP) dp[] = -1;
        long solve(int i, long n) {
            if (i == N) return 0;
            if (DP[i][n] == -1) {
                auto r = long.max/3;
                foreach (c; CS[0..M]) {
                    auto m = max(0, min(255, n+c));
                    r = min(r, solve(i+1, m) + (xs[i] - m)^^2);
                }
                DP[i][n] = r;
            }
            return DP[i][n];
        }
        writeln(solve(0, 128));
    }
}


Measured memory_bytes: 86532
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
const int N = 1e5+4 , M=N,inf=(int)1e9;
const ll mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
int ans = INT_MAX;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
int n ;
vector < ll > a(3004);
ll dp[3001][3001][2];
ll fun( int l , int r , int choice ){
	if(dp[l][r][choice]!=-1) return dp[l][r][choice];
	if(l>r)
		return 0 ;
	if(l==r)	return a[l];
	if(choice==0){
		dp[l][r][choice] = max(a[l]-fun(l+1,r,1),a[r]-fun(l,r-1,1));
		return dp[l][r][choice];
	}
	else{
		dp[l][r][choice] = max(a[l]-fun(l+1,r,0),a[r]-fun(l,r-1,0));
		return dp[l][r][choice];
	}
}
void solve(){
	cin >> n ;
	for( int i = 0 ;i < n;  i++)	cin >> a[i] ;
	for ( int i = 0 ; i < 3001 ; i++){
			for( int j = 0 ;j < 3001 ; j++){
				dp[i][j][0] = -1 ;
				dp[i][j][1] = -1;
			}
	}
	cout << fun(0,n-1,0);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())

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

	string S = "", ans = "abcdefghijklmnopqrstuvwxyz";
	set<char> st;
	for (auto& x : s) st.insert(x);
	for (auto& x : st) S += x;
	SORT(S);

	if (S == ans) cout << "None" << endl;

	S += 'Z';
	rep(i, 0, ans.size()) {
		if (S[i] == 'Z') {
			cout << ans[i] << endl;
			return 0;
		}
		if (ans[i] < S[i]) {
			cout << ans[i] << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------

string S;

int main() {

  cin >> S;

  string now = "";
  string before = "";
  ll cnt = 0;

  for(int i=0; i<S.size(); ++i) {
    now += S[i];
    if(now!=before) {
      before = now;
      ++cnt;
      now = "";
    }
  }

  cout << cnt << endl;

  return 0;
}


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

int N, M, P[1 << 18]; string S[1 << 18];
int flag[1 << 18], penalty[1 << 18];

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		cin >> P[i] >> S[i];
		if (S[i] == "AC") flag[P[i]] = 1;
		else if (flag[P[i]] == 0) penalty[P[i]]++;
	}
	int sum1 = 0, sum2 = 0;
	for (int i = 1; i <= N; i++) {
		sum1 += flag[i];
		if (flag[i] == 1) sum2 += penalty[i];
	}
	cout << sum1 << " " << sum2 << endl;
	return 0;
}

Measured memory_bytes: 8064
fun main (args:Array<String>){
    var strLen = readLine()!!.toInt()
    val(strS, strT) = readLine()!!.split(" ")
    var strNew = ""

    for (i in 0..strLen-1){
        strNew += strS.elementAt(i)
        strNew += strT.elementAt(i)
    }
    println(strNew)
}

Measured memory_bytes: 35888
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    int ans = 0;
    rep(i,N){
        int cnt = 0;
        while(A[i]>=A[i+1] && i+1<N){
            cnt ++ ;
            i++;
        }
        ans = max(ans,cnt);
    }
    cout << ans << endl;
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int n;
   cin >> n;
   int a[n];
   f(i,0,n) cin >> a[i];
   map<int,int> m1;
   int ans = 0;
   f(i,0,n) {
      ans += m1[ i - a[i]];
      m1[i + a[i]]++;
   }
   cout << ans;
}

int32_t main(){
   fast;
   int t = 1;
//   cin >> t;
   while(t--)  solve();   
}

Measured memory_bytes: 27924
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	if(n==3){
		cout << 2 << " " << 3 << " " << 25 << endl;
		return 0;
	}
	if(n%2==0){
		int cnt=n/8;
		int q=n%8;
		for(int i=0;i<cnt;i++){
			int j=12*i;
			cout << 2+j << " " << 10+j << " " << 3+j << " " << 9+j << " " << 4+j << " " << 8+j << " " << 6+j <<" " << 12+j << " " ;
		}
		vector<int> ans;
		ans.push_back(2+cnt*12);
		ans.push_back(10+cnt*12);
		ans.push_back(3+cnt*12);
		ans.push_back(9+cnt*12);
		ans.push_back(4+cnt*12);
		ans.push_back(8+cnt*12);
		ans.push_back(6+cnt*12);
		ans.push_back(12+cnt*12);
		for(int i=0;i<q;i++){
			cout << ans[i] << " ";
		}
		cout << endl;
		return 0;
	}
	else{
		int cnt=n/8;
		int q=n%8;
		for(int i=0;i<cnt;i++){
			int j=12*i;
			cout << 6+j << " " << 2+j << " " << 10+j << " " << 3+j << " " << 9+j << " " << 4+j << " " << 8+j <<" " << 12+j << " " ;
		}
		vector<int> ans;
		ans.push_back(6+cnt*12);
		ans.push_back(2+cnt*12);
		ans.push_back(10+cnt*12);
		ans.push_back(3+cnt*12);
		ans.push_back(9+cnt*12);
		ans.push_back(4+cnt*12);
		ans.push_back(8+cnt*12);
		ans.push_back(12+cnt*12);
		for(int i=0;i<q;i++){
			cout << ans[i] << " ";
		}
		cout << endl;
		return 0;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  int n;
  cin>>n;
  ll a[n];
  ll m=1;
  ll mn=1e18;
  for(int i=0;i<n;i++){
    cin>>a[i];
    mn=min(mn,a[i]);
  }
  if(mn==0){
	cout<<0<<endl;
    return 0;
  }
  for(int i=0;i<n;i++){
    if(1000000000000000000/m<a[i]){
      cout<<-1<<endl;
      return 0;
    }
    m*=a[i];
  }
  cout<<m<<endl;
}


Measured memory_bytes: 4372
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> adj[100005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,m,i,j,x,y,ans=0,flag;
    cin>>n>>m;
    ll arr[n+5];
    for(i=1;i<=n;i++)
        cin>>arr[i];
    map<ll,map<ll,ll> > m1;
    for(i=0;i<m;i++){
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
        m1[x][y]+=1;
        m1[y][x]+=1;
    }
    for(i=1;i<=n;i++){
        bool ok = true;
        for(j=0;j<adj[i].size();j++){
            if(arr[adj[i][j]]>=arr[i])
                ok = false;
        }
        if(ok)
            ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 30836
#include<bits/stdc++.h>
#define STDIO
using namespace std;
stack<pair<int,int> > stk;
int MOD=998244353;
int n;
pair<int,int> robo[200100];
int dp[200100];
int main(){
	#ifndef STDIO
		freopen("input.in","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>robo[i].first>>robo[i].second;
		robo[i].second+=robo[i].first;
	}
	sort(robo,robo+n);
	dp[n]=1;
	stk.emplace(2e9,1);
	for(int i=n-1;i>=0;i--){//处理机器人
		while(stk.size()&&stk.top().first<robo[i].second)
			stk.pop();
		if(stk.size())
			dp[i]=stk.top().second;
		dp[i]+=dp[i+1];
		dp[i]%=MOD;
		stk.emplace(robo[i].first,dp[i]);
	}
	cout<<dp[0]<<endl;
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int a,b;
  while(cin>>a>>b,a) {
    int c = b-a;
    cout<< (c%500)/100 << " " <<(c%1000)/500 <<  " "   << c/1000 << endl;
  }
}

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

using ll =                   long long int;
using pll =                  pair<ll, ll>;
using vll =                  vector<ll>;
#define endl                 "\n"
#define space                " "
#define TLE_na_ho            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MAX_SIZE             1024
#define MOD                  1000000007
#define pb                   push_back
#define fi                   first
#define se                   second
#define all(v)               v.begin(),v.end()
#define f(n)                 for(ll i=0;i<n;i++)
#define rep(i,a,n)           for(ll i=a;i<n;i++)
#define repe(i,a,n)          for(ll i=a;i<=n;i++)
#define repr(i,a,n)          for(ll i=a;i>=n;i--)
#define ain(arr,n)           for(ll i1=0;i1<n;i1++ ) cin>>arr[i1]
#define aout(arr,n)          for(ll i1=0;i1<n;i1++ ) cout<<arr[i1]<<space




int main()
{
    TLE_na_ho;
    //READ THE QUESTION PROPERLY!!
    ll t;
    t = 1;
    //cin>>t;
    while(t--)
    {
        ll n;
    cin >> n;

    vll a(n);
    for(auto &i : a)
    	cin>>i;

    vll prefix(n),suffix(n);
    prefix[0]=a[0];

    rep(i,1,n)
    {
    	prefix[i]=__gcd(prefix[i-1],a[i]);
    }

    suffix[n-1]=a[n-1];

    repr(i,n-2,0)
    {
    	suffix[i]=__gcd(suffix[i+1],a[i]);
    }

    ll ans=max(prefix[n-2],suffix[1]);

    rep(i,1,n-1)
    {
    	ans=max(ans,__gcd(prefix[i-1],suffix[i+1]));
    }

    cout<<ans;
    }

}


Measured memory_bytes: 5556
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    string S;
    cin>>S;
    S[3]='8';
    cout<<S<<endl;
    return 0;
}

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

using namespace std;

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.14159265358979323846;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int l, r;
string L, R;
int dp[220][2][2][2];
int mod = 1e9 + 7;

signed main() {
    cin >> l >> r;
    L = bitset<110>(l).to_string(), R = bitset<110>(r).to_string();
    dp[0][0][0][0] = 1;
    for (int i = 0; i < 110; i++) {
        bool Li = L[i] - '0', Ri = R[i] - '0';
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                for (int s = 0; s < 2; s++) {
                    // 0 0
                    if (j || !Li) {
                        if (Ri)(dp[i + 1][j][1][s] += dp[i][j][k][s]) %= mod;
                        else (dp[i + 1][j][k][s] += dp[i][j][k][s]) %= mod;
                    }
                    // 0 1
                    if ((j || !Li) && (k || Ri) && s) {
                        (dp[i + 1][j][k][s] += dp[i][j][k][s]) %= mod;
                    }
                    // 1 1
                    if (k || Ri) {
                        if (!Li)(dp[i + 1][1][k][1] += dp[i][j][k][s]) %= mod;
                        else (dp[i + 1][j][k][1] += dp[i][j][k][s]) %= mod;
                    }
                }
            }
        }
    }
    int ans = 0;
    for (int j = 0; j < 2; j++)for (int k = 0; k < 2; k++)(ans += dp[110][j][k][1]) %= mod;
    cout << ans << endl;
}


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

int n,d1,d2,cnt;
bool bo[610][610];

void solve(int xl,int yl,int len,int n,int m,int d1,int d2)
{
	if (m==1)
	{
		for (int x=xl,i=1; i<=n; i++,x+=len) 
		{
			bo[x][yl]=1;
			for (int X=xl,j=1; j<i; j++,X+=len)
				if (bo[X][yl]&&((i-j)*(i-j)==d1||(i-j)*(i-j)==d2)) {bo[x][yl]=0; break;}
		}
		return;
	}
	if (n==1)
	{
		for (int y=yl,i=1; i<=m; i++,y+=len) 
		{
			bo[xl][y]=1;
			for (int Y=yl,j=1; j<i; j++,Y+=len)
				if (bo[xl][Y]&&((i-j)*(i-j)==d1||(i-j)*(i-j)==d2)) {bo[xl][y]=0; break;}
		}
		return;
	}
	if ((d1&1)&&(d2&1))
	{
		for (int i=0; i<n; i++)
			for (int j=(i&1); j<m; j+=2)
				bo[xl+i*len][yl+j*len]=1;
		return;
	}
	if (d1&1)
	{
		if ((d2&3)==2)
		{
			for (int i=0; i<n; i+=2)
				for (int j=0; j<m; j+=2)
					bo[xl+i*len][yl+j*len]=1;
			return;
		}
		solve(xl,yl,len<<1,n+1>>1,m+1>>1,d2>>2,-1);
		solve(xl+len,yl+len,len<<1,n>>1,m>>1,d2>>2,-1);
		return;
	}
	if (d2&1)
	{
		if (d2==-1)
		{
			if ((d1&3)==2)
			{
				for (int i=0; i<n; i+=2)
					for (int j=0; j<m; j++)
						bo[xl+i*len][yl+j*len]=1;
				return;
			}
			solve(xl,yl,len<<1,n+1>>1,m+1>>1,d1>>2,-1);
			solve(xl,yl+len,len<<1,n+1>>1,m>>1,d1>>2,-1);
			solve(xl+len,yl,len<<1,n>>1,m+1>>1,d1>>2,-1);
			solve(xl+len,yl+len,len<<1,n>>1,m>>1,d1>>2,-1);
			return;
		}
		if ((d1&3)==2)
		{
			for (int i=0; i<n; i+=2)
				for (int j=0; j<m; j+=2)
					bo[xl+i*len][yl+j*len]=1;
			return;
		}
		solve(xl,yl,len<<1,n+1>>1,m+1>>1,d1>>2,-1);
		solve(xl+len,yl+len,len<<1,n>>1,m>>1,d1>>2,-1);
		return;
	}
	if ((d2&3)==2) swap(d1,d2);
	if ((d1&3)==2)
	{
		if ((d2&3)==2)
		{
			for (int i=0; i<n; i+=2)
				for (int j=0; j<m; j+=2)
					bo[xl+i*len][yl+j*len]=1;
			return;
		}
		if ((n>>1)*(m+1>>1)>(n+1>>1)*(m>>1)) solve(xl+len,yl,len<<1,n>>1,m+1>>1,d2>>2,-1);
		else solve(xl,yl+len,len<<1,n+1>>1,m>>1,d2>>2,-1);
		solve(xl,yl,len<<1,n+1>>1,m+1>>1,d2>>2,-1);
		return;
	}
	solve(xl,yl,len<<1,n+1>>1,m+1>>1,d1>>2,d2>>2);
	solve(xl+len,yl,len<<1,n>>1,m+1>>1,d1>>2,d2>>2);
	solve(xl,yl+len,len<<1,n+1>>1,m>>1,d1>>2,d2>>2);
	solve(xl+len,yl+len,len<<1,n>>1,m>>1,d1>>2,d2>>2);
}

int main()
{
	scanf("%d%d%d",&n,&d1,&d2);
	memset(bo,0,sizeof(bo)),cnt=0;
	solve(0,0,1,n<<1,n<<1,d1,d2);
	for (int i=0; i<2*n&&cnt<n*n; i++)
		for (int j=0; j<2*n&&cnt<n*n; j++)
			if (bo[i][j]) cnt++,printf("%d %d\n",i,j);
	return 0;
}

Measured memory_bytes: 1280
n,m = map(int,input().split())

al = [0 for i in range(n+1)]
for _ in range(m):
    a = int(input())
    al[a] = 1

dp = [0 for i in range(n+1)]

for i in range(n+1):
    if i == 0:
        dp[0] = 1
    elif i == 1 and al[1] == 0:
        dp[1] = dp[0]
    else:
        if al[i] == 0:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= 1000000007

print(dp[-1])

Measured memory_bytes: 51180
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

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

signed main(){
  int x,t; cin>>x>>t;
	cout << max(x-t,0)<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static int N;
	static int[] A ;
	static int[][] x ;
	static int[][] y ;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		A = new int[N];
		x = new int[N][];
		y = new int[N][];
		for(int i=0;i<N;i++) {
			A[i] = sc.nextInt();
			x[i] = new int[A[i]];
			y[i] = new int[A[i]];
			for(int j=0;j<A[i];j++) {
				x[i][j]=sc.nextInt();
				y[i][j]=sc.nextInt();
			}
		} 
		ArrayList<Pair> useTestimonyList = new ArrayList<>();
		ArrayList<Integer> honestList=new ArrayList<>();
		System.out.println(count(useTestimonyList,honestList));
	}
	
	static int count(ArrayList<Pair> useList,ArrayList<Integer> honestList) {
		if(honestList.size()==N) {
			if(!check(useList,honestList)) {
				return 0;
			}else {
				int tmp = 0;
				for(int tmp1:honestList) {
					if(tmp1==1) {
						tmp++;
					}
				}
				return tmp;
			}
		}else {
			ArrayList<Pair> tmpUseList = (ArrayList<Pair>) useList.clone();
			ArrayList<Integer> tmpHonestList = (ArrayList<Integer>) honestList.clone();
			for(int i=0;i<A[honestList.size()];i++) {
				Pair pair = new Pair();
				pair.x = x[honestList.size()][i];
				pair.y = y[honestList.size()][i];
				tmpUseList.add(pair);
			}
			tmpHonestList.add(1);
			honestList.add(0);
			return Math.max(count(useList,honestList), count(tmpUseList,tmpHonestList));
		}
	}
	
	static boolean check(ArrayList<Pair> useList,ArrayList<Integer> honestList) {
		boolean flag =true;
		for(Pair pair:useList) {
			if(!(honestList.get(pair.x-1)==pair.y)) {
				flag = false;
			}
		}
		return flag;
	}
}
class Pair{
	int x;
	int y;
}

Measured memory_bytes: 50836
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();

            var ans = 0L;
            for (int a = 1; a < n; a++)
            {
                long ok = 1;
                long ng = n+1;

                while (Math.Abs(ok - ng) > 1)
                {
                    long mid = (ok + ng) / 2;

                    if (a * mid<n) ok = mid;
                    else ng = mid;
                }

                ans += ok;
            }            
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 27548
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h> 
using namespace std;
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 5e2+1;
 
#define ll int
// typedef long long ll;
typedef long double ld;

void test_case()
{
	ll h, w, ch, cw, dh, dw;
	cin >> h >> w >> ch >> cw >> dh >> dw;
	string s[h];
	for(int i = 0; i < h; i++)
	{
		cin >> s[i];
	}
	if(s[ch-1][cw-1] == '#')
	{
		cout << -1 << '\n';
		return;
	}
	ch--, cw--, dh--, dw--;
	ll dp[h][w];
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
			dp[i][j] = INT_MAX;
	}
	priority_queue<array<ll,3>> q;
	q.push({0,ch, cw});
	dp[ch][cw] = 0;
	ll dx[] = {-2, -1, 0, 1, 2};
	ll dy[] = {-2, -1, 0, 1, 2};
	ll dxx[] = {-1, 1, 0, 0};
	ll dyy[] = {0, 0, -1, 1};
	while(!q.empty())
	{
		int x = q.top()[1], y = q.top()[2], z = -q.top()[0];
		q.pop();
		if(x == dh && y == dw)
		{
			cout << dp[dh][dw] << '\n';
			return;
		}
		if(dp[x][y] < z)
			continue;
		for(int i = 0; i < 4; i++)
		{
			if((x + dxx[i] >= 0) && (x + dxx[i] < h) && (y + dyy[i] >= 0) && (y + dyy[i] < w))
			{
				if((s[x + dxx[i]][y + dyy[i]] != '#') && (dp[x + dxx[i]][y + dyy[i]] > dp[x][y]))
				{
					dp[x+dxx[i]][y+dyy[i]] = dp[x][y];
					q.push({-dp[x+dxx[i]][y+dyy[i]], x+dxx[i], y+dyy[i]});
				}
			}
		}
		for(int i = 0; i < 5; i++)
		{
			for(int j = 0; j < 5; j++)
			{
				if((x + dx[i] >= 0) && (x + dx[i] < h) && (y + dy[j] >= 0) && (y + dy[j] < w))
				{
					if((s[x + dx[i]][y + dy[j]] != '#') && (dp[x + dx[i]][y + dy[j]] > dp[x][y] + 1))
					{
						dp[x+dx[i]][y+dy[j]] = dp[x][y] + 1;
						q.push({-dp[x+dx[i]][y+dy[j]], x+dx[i], y+dy[j]});
					}
				}
			}
		}
	}
	if(dp[dh][dw] == INT_MAX)
		cout << -1 << '\n';
	else
		cout << dp[dh][dw] << '\n';
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 8652
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
string get_name(long long N){
  if(N < 26){
    string ret = "";
    ret.push_back('a' + N);
    return ret;
  }
  char tmp = (char) ('a' + N % 26);
  string ret;
  ret.push_back(tmp);
  return get_name(N / 26 - 1) + ret;

}
int main(){
  long long N;
  cin >> N;
  cout << get_name(N - 1) << endl;
  return 0;
}


Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <stdio.h>
#include<string.h>
#include <stdlib.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846264338327950L


int main(){
  int A,B, H, M;
  scanf("%d%d%d%d", &A, &B, &H, &M);
  int  sumtime = H*60+M;
  long double  sumangle = fabs(6* M - (30 * H + 0.5*M));
  //double  sumangle = 5.5*(M+60*H);
    /*if(sumangle >= 180){
      sumangle = sumangle -180;
    } */
    double sumrad = (PI *sumangle)/180;
    double sumcos = cos((PI *sumangle)/180);
  double x = pow (A, 2.0);
  double y = pow (B, 2.0);
  //double z = 2*A*B* cos(M_PI *sumangle)/180);
  long double ans = sqrtl(x+y-2*A*B*cos((PI *sumangle)/180));
  //printf("%d\n",sumtime);
  //printf("%f\n",sumangle);
  //printf("%lf\n",ans);
 // printf("%lf\n",x);
  //printf("%lf\n",y);
  printf("%20.20Lf\n",ans);
  //printf("%lf\n",sumrad);
  //printf("%lf\n",z);

  
return 0;
}

Measured memory_bytes: 2580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String s = scan.next();
		int x = 0;
		int max = x;
		for(int i = 0; i < n; i++) {
			if(s.charAt(i) == 'I') {
				x++;
			} else {
				x--;
			}
			if(max < x) {
				max = x;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 21716
n = int(input())
s= []
for _ in range(n):
    x = input()
    s.append(x)
s.sort()
mydict = {}
for i in range(n):
    x = s[i]
    if x in mydict:
        mydict[x]+=1
    else :
        mydict[x] = 1

max_n = -1
for v in mydict.values():
    max_n = max(max_n,v)
aa = []
for k in mydict:
    if mydict[k] == max_n:
        aa.append(k)
aa = sorted(aa)
for i in aa:
    print(i)


Measured memory_bytes: 35216
loop do
    t, d, l = gets.split.map(&:to_i)
    break if t == 0
    a = 0
    r = 0
    t.times do
        a += 1 if r > 0
        r = [r - 1, 0].max
        i = gets.to_i
        if i >= l
            r = d
        end
    end
    p a
end


Measured memory_bytes: 6868
#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
#define Vec vector

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


int Compare(Vec<int> a, Vec<int> b){
	int ta = 0;
	for(int i=1;i<10;i++) ta += a[i];
	int tb = 0;
	for(int i=1;i<10;i++) tb += b[i];
	if(ta != tb) return ta > tb ? 1 : -1;
	for(int i=9;i>0;i--){
		if(a[i] != b[i]){
			return a[i] > b[i] ? 1 : -1;
		}
	}
	return 0;
}

int main(){
	
	int N, M;
	cin >> N >> M;
	Vec<int> A(M);
	for(int i=0;i<M;i++) cin >> A[i];
	
	Vec<int> C{0,2,5,5,4,5,6,3,7,6};
//for(int i=0;i<10;i++) cerr << C[i] << endl;
	
	Vec<Vec<int>> dp(N + 1);
	for(int i=0;i<=N;i++){
		dp[i].resize(10);
		for(int j=0;j<10;j++) dp[i][j] = 0;
	}
	Vec<int> Zero(10, 0);
	
	
	
	Vec<int> nv(10);
	for(int i=0;i<N;i++){
		if(i > 0 && Compare(Zero, dp[i]) == 0) continue;
		for(int j=0;j<M;j++){
			if(i + C[A[j]] > N) continue;
			for(int k=0;k<10;k++) nv[k] = dp[i][k];
			nv[A[j]]++;
			if(Compare(nv, dp[i + C[A[j]]]) > 0){
				for(int k=1;k<10;k++) dp[i + C[A[j]]][k] = nv[k];
			}
		}
	}
	
//for(int j=0;j<10;j++) cout << dp[N][j] << endl;
	
	vector<char> ca;
	for(int i=9;i>=1;i--){
		for(int j=0;j<dp[N][i];j++) ca.push_back((char)('0' + i));
	}
	string ret(ca.begin(), ca.end());
	cout << ret << endl;
    return 0;
}


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

using namespace std;

const long long INF = 1e18;

int a[305];
long long dp[305][305];

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) dp[i][j] = INF;
	}
	
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			for (int lt = 0; lt < i; lt++) {
				if (i - lt - 1 > j) continue;
				int cost;
				if (a[i] < a[lt]) cost = 0;
				else cost = a[i] - a[lt];
				
				dp[i][j] = min(dp[i][j], dp[lt][j - (i - lt - 1)] + cost);
			}
		}
	}
	
	long long res = INF;
	
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			if (j + n - i > k) continue;
			res = min(res, dp[i][j]);
		}
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 1024
#line 1 "dijkstra.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

#line 1 "../dijkstra.cpp"
ll INF = 1LL<<60;
using pll = pair<ll, ll>;

vl dijkstra(ll n, ll s, vector<vector<pll>> G) {
  priority_queue<pll, vector<pll>, greater<pll>> que;
  vl d(n, INF);
  d[s] = 0;
  que.push(pll(0, s));

  while(!que.empty()) {
    pll p = que.top();
    que.pop();
    ll v = p.second;
    if (d[v] < p.first) continue;
    for (auto&& e : G[v]) {
      if (d[e.first] > d[v] + e.second) {
        d[e.first] = d[v] + e.second;
        que.push(pll(d[e.first], e.first));
      }
    }
  }
  return d;
}
#line 15 "dijkstra.test.cpp"

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

  ll v, e, r;
  cin >> v >> e >> r;
  vector<vector<pll>> g(v);
  rep(i, e) {
    ll s, t, d;
    cin >> s >> t >> d;
    g[s].emplace_back(t, d);
  }

  vl vec = dijkstra(v, r, g);

  for (auto&& i : vec) {
    if (i == INF) cout << "INF" << endl;
    else cout << i << endl;
  }
}



Measured memory_bytes: 30696
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<algorithm>
#include<iostream>
#include<set>
#pragma comment(linker, "/STACK:102400000,102400000")
#define IOS ios::sync_with_stdio(false);cin.tie(0)
//#define ll long long
#define ll unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-6
#define pi acos(-1)
#define mea (memset(a,0,sizeof(a)))
#define myit set<ll>::iterator
#define mysets multiset<ll>
#define myits multiset<ll>::iterator
#define v30 (1<<30)-1
#define all(x) (x).begin(),(x).end()
#define maxs *s.rbegin()
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define ee exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
using namespace std;
inline ll read(){
   ll s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
void put1(){ puts("YES") ;}
void put2(){ puts("NO") ;}
void put3(){ puts("-1"); }
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
using namespace std;

const int manx=3e5+5;
ll a[manx];
int main()
{
    ll n=read();
    ll ans=inf;
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=1;i<=100;i++){
            ll res=0;
        for(int j=1;j<=n;j++){
            res+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,res);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n,m;
  cin >> n >> m;
  vector<ll> x(n);
  vector<ll> y(n);
  vector<ll> z(n);
  rep(i,n){
    cin >> x[i] >> y[i] >> z[i];
  }
  vector<ll> v(n);
  priority_queue<ll> q;
  //1
  rep(i,n) v[i]=x[i]+y[i]+z[i];
  sort(all(v));
  reverse(all(v));
  ll sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //2
  rep(i,n) v[i]=-x[i]+y[i]+z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //3
  rep(i,n) v[i]=x[i]-y[i]+z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //4
  rep(i,n) v[i]=x[i]+y[i]-z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //5
  rep(i,n) v[i]=-x[i]-y[i]+z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //6
  rep(i,n) v[i]=-x[i]+y[i]-z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //7
  rep(i,n) v[i]=x[i]-y[i]-z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  //8
  rep(i,n) v[i]=-x[i]-y[i]-z[i];
  sort(all(v));
  reverse(all(v));
  sum=0;
  rep(i,m) sum+=v[i];
  q.push(sum);
  cout << q.top() << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  i64 x, a ,b;
  cin >> x >> a >> b;
  i64 p = -a+b;

  if (p <= 0) {
    puts("delicious");
  } else if (p <= x) {
    puts("safe");
  } else {
    puts("dangerous");
  }


  return 0;
}



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

int main(){
  ll N;
  cin >> N;
  
  ll ans = 0;
  for (ll i = 1; i <= N / 2; i++){
    ll kouho = (N - i) / i;
    if (kouho > i){
      if ((N - i) % i == 0){
        ans += kouho;
      }
    }
    else{
      break;
    }
  }

  cout << ans << endl;
}

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

int main()
{
	int num,people[4][3][10];
	cin >> num;
	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 10;k++) {
				people[i][j][k] = 0;
			}
		}
	}

	int b, f, r, v;
	v = 0;
	for (int i = 0; i < num; i++) {
		cin >> b >> f >> r >> v;
		b -= 1;f -= 1;r -= 1;
		people[b][f][r] += v;
	}

	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 10;k++) {
				cout << " " << people[i][j][k];
			}
			cout <<endl;
		}
		if (i==3) break;
		for (int l = 0; l < 20; l++) {
			cout << "#";
		}
		cout << endl;
	}
}


Measured memory_bytes: 3104
//    ######     ######    ######     ######
//    ######    ######     ######    ######
//    ######   ######      ######   ######
//    ######  ######       ######  ######
//    ############         ############
//    ############         ############
//    ######  ######       ######  ######
//    ######   ######      ######   ######
//    ######    ######     ######    ###### 
//    ######     ######    ######     ######
#include<bits/stdc++.h>
#define int           long long
#define pb            push_back
#define ppb           pop_back
#define si            set <int>
#define endl          '\n'
#define fr            first
#define sc            second
#define mii           map<int,int>
#define msi           map<string,int >
#define mis           map<int,string>
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define f(i,n)            for(int  i=0;i<n;i++)
#define all(v)        v.begin(),v.end()
//#define sort(v)       sort(all(v))
#define sm(v)           accumulate(v.begin(),v.end(),0)
#define pii           pair<int ,int >
#define vi            vector<int >
#define vii           vector<pair<int , int >>
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define bs            binary_search
#define mp            make_pair
#define sp(n)         setprecision(n)
#define spl           " "
#define arr(a,n)      rep(i,0,n) cin>>a[i]
#define mod           998244353
#define MAX           1000000
#define pi            3.1415926536
using namespace std;

signed main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            #ifndef ONLINE_JUDGE
         //  freopen("input.txt","r",stdin);
          //  freopen("output.txt","w",stdout);
            #endif
            int t=1;
           // cin>>t;
            while(t--)
            {
                int n,x,y,z=0,c=0;
               cin>>n;
               int a[n];
               rep(i,0,n)
               {
                cin>>a[i];
                if(i!=0)
                {
                    if(a[i-1]>=a[i])
                        c++;
                    else
                     {z=max(z,c);   c=0;}
                    if(i==n-1)
                        z=max(z,c);

                }
               }
               cout<<z;

}}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> t(N),d(N);
    priority_queue<P, vector<P>, greater<P>> useque;
    priority_queue<P> que;
    vector<ll> vec[N];
    rep(i,0,N){
        cin >> t[i] >> d[i];
        t[i]--;
        //vec[t[i]].push_back(d[i]);
        que.push(P(d[i],t[i]));
    }
    /*
    rep(i,0,N){
        vec[i].sort(vec[i].rbegin(), vec[i].rend());
    }
    */
    int usecnt[N] = {};
    ll maxi = 0, sum = 0, kind = 0;
    //とりあえず大きい数を選ぶ
    rep(i,0,K){
        auto q = que.top();
        que.pop();
        sum += q.first;
        if(!usecnt[q.second]){
            kind++;
        }
        usecnt[q.second]++;
        useque.push(q);
    }
    maxi = sum + kind * kind;
    //cout << maxi << endl;
    //cout << sum << " " << kind << endl;
    while(!useque.empty() && !que.empty()){
        auto q = que.top();
        que.pop();
        //cout << "q:" << q.first << " " << q.second << endl;
        while(usecnt[q.second]){
            if(que.empty()){
                //cout << "que" << endl;
                cout << maxi << endl;
                return 0;
            }
            q = que.top();
            que.pop();
        }
        auto p = useque.top();
        useque.pop();
        while(usecnt[p.second] <= 1){
            if(useque.empty()){
                //cout << "use" << endl;
                cout << maxi << endl;
                return 0;
            }
            p = useque.top();
            useque.pop();
        }
        usecnt[p.second]--;
        usecnt[q.second]++;
        sum -= p.first - q.first;
        kind++;
        maxi = max(maxi, sum + kind * kind);
        //cout << kind << ":" << maxi << endl;
    }
    cout << maxi << endl;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    double a_d = double(a);
    double b_d = double(b);
    cout << (a/b) <<" " << (a%b)<< " ";
    cout << fixed << setprecision(5)<<(a_d/b_d) << endl;
}


Measured memory_bytes: 3272