akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll a,b,c=0,d=0,n,m1,n2,m2,min=100000,k=0,ans=0;
    string s,s2;
    cin >> n;
    a=2;
    b=1;
    for(int i=0;i<n-1;i++){
        c = a + b;
        a = b;
        b = c;
    }
    cout << b <<endl; 
    return 0;
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))

from collections import Counter
c = Counter(As)
ans = []
for a, c in c.most_common():
    if c<2:
        break
    ans.append(a)
    if c>=4:
        ans.append(a)

if len(ans)<2:
    print(0)
else:
    ans.sort()
    print(ans[-1]*ans[-2])

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

const long mod = 1000000007;

long fact[1000001];

void fact_table()
{
  for (long i = 1; i <= 1000000; i++)
    fact[i] = fact[i - 1] * i % mod;
}

long pow(long a, long b)
{
  if (b == 0)
    return 1;
  if (b % 2 == 0)
  {
    long half = pow(a, b / 2);
    return half * half % mod;
  }
  else
  {
    return a * pow(a, b - 1) % mod;
  }
}

long inv(long n)
{
  return pow(n, mod - 2);
}

long comb(long n, long r)
{
  if (n - r < r)
    return comb(n, n - r);
  return fact[n] * inv(fact[n - r] * fact[r] % mod) % mod;
}

int main()
{
  long N, M;
  cin >> N >> M;
  map<long, long> prime;
  for (long i = 2; i * i <= M; i++)
  {
    while (M % i == 0)
    {
      if (prime.find(i) == prime.end())
        prime[i] = 1;
      else
        prime[i] = prime[i] + 1;
      M /= i;
    }
  }
  if (M != 1)
  {
    if (prime.find(M) == prime.end())
      prime[M] = 1;
    else
      prime[M] = prime[M] + 1;
  }
  fact[0] = 1;
  fact_table();
  long ans = 1;
  for (auto p : prime)
  {
    ans *= comb(p.second + N - 1, N - 1);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
const int md=1e9+7;
int n,dep,p[200005],cc[200005];
long long pw[200005];
vector<int>g[200005];
deque<long long>dp[3][200005];
void dfs(int v,int d)
{
	cc[d]++;dep=max(dep,d);
	int pos=0;
	for(int i=0;i<g[v].size();i++)
	{
		int u=g[v][i];
		dfs(u,d+1);
		//swap
		if(dp[0][v].size()<dp[0][u].size())for(int j=0;j<3;j++)swap(dp[j][v],dp[j][u]);
		int sz=dp[0][u].size();
		pos=max(pos,sz);
		for(int i=0;i<sz;i++)
		{
			long long t[3]={};
			long long r=dp[0][v][i]+dp[1][v][i]+dp[2][v][i];
			r%=md;
			long long s=dp[0][u][i]+dp[1][u][i]+dp[2][u][i];
			s%=md;
			t[0]=dp[0][v][i]*dp[0][u][i]%md;
			t[1]=(dp[1][v][i]*dp[0][u][i]%md+dp[0][v][i]*dp[1][u][i]%md)%md;
			t[2]=(r*s-t[0]-t[1])%md;
			t[2]=(t[2]+md)%md;
			for(int j=0;j<3;j++)dp[j][v][i]=t[j];
		}
		//clear
		for(int j=0;j<3;j++)dp[j][u].clear();
	}
	dp[0][v].push_front(1);
	dp[1][v].push_front(1);
	dp[2][v].push_front(0);
	for(int i=0;i<=pos;i++)
	{
		dp[0][v][i]=(dp[0][v][i]+dp[2][v][i])%md;
		dp[2][v][i]=0;
	}
}
int main()
{
	pw[0]=1;
	for(int i=1;i<=200000;i++)pw[i]=pw[i-1]*2%md;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){scanf("%d",&p[i]);g[p[i]].push_back(i);}
	dfs(0,0);
	long long ans=0;
	for(int i=0;i<=dep;i++)
	{
		long long t=dp[1][0][i];
		ans=(ans+t*pw[n+1-cc[i]])%md;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 503680
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
using namespace std;     
int main()
{
	ios::sync_with_stdio(0);
	ll a,b,c,d,t;
	cin>>a>>b>>c>>d>>t;
	if(abs(a-c)<=t*(b-d))
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	return 0;                                                                                                                                     
}

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

int main() {
  int X, gohyaku, go;
  cin >> X;
  gohyaku = X / 500;
  go = (X - 500 * gohyaku) / 5;
  cout << gohyaku * 1000 + go * 5 << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "7" ].solve == 3 );
	assert( [ "2" ].solve == 0 );
	assert( [ "1729" ].solve == 294867501 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( long );
	
	// 数列の長さを決め打ち
	const M = 10L ^^ 9 + 7;
	auto ans = ModWorld!M( 0L );
	foreach( i; 1L .. s / 3 + 1 )
	{
		// 各項に3ずつ割り振って残った分を割り振るパターン数を計算
		auto r = s - i * 3;
		ans += ( r + i - 1 ).combination!M( i - 1 );
	}
	return ans;
}

// モジュラ整数型（n mod M）
struct ModWorld( long M )
{
	long n;
	
	this( long n ){ this.n = n % M; }
	void opUnary( string OP )() if( OP == "++" ){ this.n = ( this.n + 1 ) % M; }
	void opUnary( string OP )() if( OP == "--" ){ this.n = ( this.n + M - 1 ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "+"  ){ this.n = ( this.n + r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "-"  ){ this.n = ( this.n + M - r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "*"  ){ this.n = ( this.n * r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "/"  ){ this *= r ^^ ModWorld( M - 2 ); }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "^^" )
	{
		auto a = this.n;
		this.n = 1L;
		for( auto i = r.n; 0 < i; i >>= 1 )
		{
			if( i & 1 ) this.n = ( this.n * a ) % M;
			a = ( a * a ) % M;
		}
	}
	auto opBinary( string OP )( ModWorld r ){ auto l = this; l.opOpAssign!OP( r ); return l; }
	auto opEquals( ModWorld r ){ return this.n == r.n; }
	
	void opAssign( long r ){ this.n = r % M; }
	void opOpAssign( string OP )( long r ){ this.opOpAssign!OP( ModWorld( r ) ); }
	auto opBinary( string OP )( long r ){ return this.opBinary!OP( ModWorld( r ) ); }
	auto opBinaryRight( string OP )( long l ){ return ModWorld( l ).opBinary!OP( this ); }
	auto opEquals( long r ){ return this.n == r; }
	
	auto toString(){ return this.n.to!string; }
}

// 階乗
auto factorial( long M )( long n )
{
	static memo = [ ModWorld!M( 1L ) ];
	if( memo.length <= n )
	{
		auto i = memo.length.signed;
		memo.length = n + 1;
		for( ; i < memo.length; i++ ) memo[ i ] = memo[ i - 1 ] * i;
	}
	return memo[ n ];
}

// 組み合わせ数
auto combination( long M )( long n, long k )
{
	if( n < k ) return ModWorld!M( 0L );
	else        return n.factorial!M / ( k.factorial!M * ( n - k ).factorial!M );
}


Measured memory_bytes: 2884
//Versão do Edson
#include <iostream>

using namespace std;

void solve(int K)
{
    // Há K/2 números pares entre 1 e K
    // Há (K + 1)/2 números ímpares entre 1 e K
    int even = K / 2, odd = (K + 1)/2;

    // Cada par escolhe um par e um ímpar, logo a resposta é o produto dos totais de ambos tipos
    cout << even * odd << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int K;
    cin >> K;

    solve(K);

    return 0;
}

Measured memory_bytes: 3580
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
const double PI = acos(-1);
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

struct Edge {
    int u, v, w;
    bool operator<(const Edge &other) const {
        return w < other.w;
    }
} e[N];

std::map< String, int > map;
int end, n;
std::pair< int, String > a[N * 2];

inline bool cmp(const std::pair< int, String > &a, const std::pair< int, String > &b) {
    if (a.fi != b.fi) return a.fi > b.fi;
    else return a.se < b.se;
}

int main() {
    std::ios::sync_with_stdio(false);
    // scanf("%d", &n);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        String tmp;
        cin >> tmp;
        if (!map.count(tmp)) {
            map[tmp] = ++end;
            a[map[tmp]].se = tmp;
            a[map[tmp]].fi = 1;
        } else {
            a[map[tmp]].fi++;
        }
    }
    std::sort(a + 1, a + end + 1, cmp);
    int max = a[1].fi;
    for (int i = 1; i <= end; i++) {
        if (a[i].fi != max) break;
        // cout << a[i].se << endl;
        for (int j = 0; j < a[i].se.size(); j++) {
            putchar(a[i].se[j]);
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 37376
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 100;
const int inf = 0x3f3f3f3f;

const int SZ = 1 << 20;  //快速io
struct fastio {
    char inbuf[SZ];
    char outbuf[SZ];

    fastio() {
        setvbuf(stdin, inbuf, _IOFBF, SZ);
        setvbuf(stdout, outbuf, _IOFBF, SZ);
    }
} io;

void read(int &x) {
    x = 0;
    char ch, c = getchar();
    while (c < '0' || c > '9') ch = c, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    if (ch == '-') x = -x;
}

int main() {
    //freopen("in.txt", "r", stdin);
    int n;
    ll x, ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;
        ans ^= x;
    }

    if (ans == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = b / a;
        if(ans > c) ans = c;
        System.out.println(ans);
    }
}

Measured memory_bytes: 35820
function Main(input) {
    var S = parseInt(input);
    var h = parseInt(S / 3600); //秒を時間へ　1時間=60分　60分=3600秒
    var x = S % 3600;
    var m = parseInt( x / 60);
    var z = x % 60;
    var s = z;

    var answer = h + ":" + m + ":" + s;
    console.log(answer);
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug() {
    var input = document.getElementById("input").value;
    Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define da(arr,N){if(isDebugMode){rep(i,N+1){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back
#define s(a) cout<<a<<endl;

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
int n;
int b[100001];
vector<int> t;
void solve(){
	int c=1;
	for(int i=2;c<=100000;i++){
		b[c]=i-1;
		c+=i;
	}
	if(b[n]==0){cout<<"No"<<endl;return;}
	vector<int> v;
	c=0;
	int A=b[n];
	int a=A;
	int p=1;
	cout<<"Yes"<<endl;
	cout<<A+1<<endl;
	while(a>=0){
		t.clear();
		t.pb(A);
		rep(i,a){
			t.pb(p+i);
		}
		rep(i,v.size()){
			t.pb(v[i]+c-1);
		}
		v.pb(p-c);
		p+=a;
		a--;
		c++;
		rep(i,t.size()){
			if(i!=t.size()-1) 
				printf("%d ",t[i]);
			else
				printf("%d\n",t[i]);
		}
	}
}

int main(){
	cin>>n;
	solve();
	return 0;
}


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

int main(){
    int a,b;
    string s;
    bool ans(true);

    cin >> a >> b >> s;

    if(s[a]!='-'){
        puts("No");
        return 0;
    }

    rep(i,a+b){
        if(s[i]=='-'){
            
            if(i!=a){
                ans = false;
            }
        }
    }

    if(ans){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn = 2e5+20, maxm=2e5+20;  
int  c[maxn], a[maxn];
ll mod=1e9 + 7;
const ll inf=1e9;
queue <int> q;
set <int> s;
set <int> s1;
int dp[maxn];

int X[]={119, 18, 93, 91, 58, 107, 111, 82, 127, 123};
 
int main()
{		 
	
	ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	
	for(int i=1;i<=n;i++)
		cin >> a[i];
	
	dp[0]=1;
	a[0]=a[1];	
	for(int i=1;i<=n;i++)	
	{
		if(a[i] == a[i-1])
			dp[i]=dp[i-1], c[a[i]]=i;
		else
			if(c[a[i]] != 0)
				dp[i]=(dp[c[a[i]]]+dp[i-1])%mod, c[a[i]]=i;		
			else
				dp[i]=dp[i-1]%mod, c[a[i]]=i;
	}
		
	cout << dp[n];
}
	
 
	

	
	
	


Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M, ans=0, max=0, min=100000;
  cin >> N >> M;
  int L[M], R[M];
  
  for(int i=0; i<M; i++){
			cin >> L[i] >> R[i];
	}

	for(int i=0; i<M; i++){
			if(L[i] >= max) max = L[i];
			if(R[i] <= min) min = R[i];
	}

	for(int i=1; i<=N; i++){
			if(max <= i && min >= i) ans++;
	}
  
  cout << ans << endl;
  
  
  return 0;
}


Measured memory_bytes: 4364
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define endl "\n" 
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int N = 10;
int main(){
    int n;
    cin >> n;
    while(n--) {
        bool ans = true;
        int a, b=-1, c=-1;
        for(int i=1; i<=N; i++) {
            cin >> a;
            if(ans) {
                if(a > b)
                    b = a;
                else if(a > c)
                    c = a;
                else
                    ans = false;
       }
    }
    if(ans) puts("YES");
    else puts("NO");
}
}


Measured memory_bytes: 2900
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int N;
  int games[200][3];
  int scores[200];

  fill(scores, scores+200, 0);

  cin >> N;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 3; ++j){
      cin >> games[i][j];
    }
  }

  bool flag;
  for(int i = 0; i < 3; ++i){
    for(int j = 0; j < N; ++j){
      flag = true;

      for(int k = 0; k < N; ++k){
	if(j != k && games[j][i] == games[k][i]){
	  flag = false;
	  break;
	}
      }

      if(flag){
	scores[j] += games[j][i];
      }
    }
  }

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

  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


int main(){
    ll a;   cin >> a;
    double b;   cin >> b;
    ll b1 = b;
    ll b2 = ((b + 0.0001) - b1) * 100;

    cout << a * b1 + a * b2 / 100 << endl;


    return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>
int main(void)
{
	int a,b,c;
	int count=0;
	int i;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i=a;i<=b;i++)
	{
		if(c%i==0) count++;
	}
	
	printf("%d\n",count);
	
	return 0;
		
}

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

int main(){
  string s, ret="";
  int w;
  cin >> s >> w;
  for(int i=0; i<(s.length()+w-1)/w; i++){
    ret.push_back(s[i*w]);
  }
  cout << ret;
  return 0;
}

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

int main() {
	// your code goes here
	int s;
	int a[5];
	for(int i=0;i<5;i++){
		cin>>a[i];
		if(a[i]==0){
			s=i+1;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll N =1e5+5;
const ll inf=1e15;
ll h[N],dp[N],n,k;


int main()
{
    ios_base::sync_with_stdio(false);

	cin>>n>>k;forn(i,n){cin>>h[i];dp[i]=inf;}
	dp[0]=0;
	forn(i,n)for(int j=i+1;j<=min(i+k,n-1);j++)dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
	cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
n = int(input())

dp = [10**6] *(n+1)
dp[0] = 0
power = 1

for i in range(1,n+1):
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 6

for i in range(1,n+1):
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 9

print(dp[n])

Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){

	int a,b;
	cin >> a >> b;

	double tmpa,tmpb;
	tmpa = (double)a*100/8;
	tmpb = (double)b*10;

	int mi,ma;
	mi = min(tmpa,tmpb);
	ma = max(tmpa,tmpb) + 1;

	bool flag = false;
	int ans;

	for(int i = mi;i <= ma;i++){

		if((int)(i*0.08) == a && (int)(i*0.1) == b){
			flag = true;
			ans = i;
			break;
		}

	}

	if(flag){
		cout << ans << endl;
	}
	else{
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 5e3+5;

string s;
int z[N];

void buildZ(string a){
    int n = a.size();
    memset(z , 0 , sizeof z);
    int x = 0 , y = 0;
    for(int i = 1; i < n; i++){
        z[i] = max(0 , min(z[i - x] , y - i + 1));
        while(i + z[i] < n && a[i + z[i]] == a[z[i]]){
            x = i;
            y = i + z[i];
            z[i]++;
        }
    }
}

int main(){
    int sz;
    cin >> sz;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < sz; i++){
        string trial = "";
        for(int j = i; j < sz; j++){
            trial += s[j];
        }
        buildZ(trial);
        for(int j = 0; j < trial.size(); j++){
            ans = max(ans , min(z[j] , j));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
#define LL long long


void solve(long long Q, std::vector<long long> l, std::vector<long long> r){
    auto rmax = *max_element(r.begin(), r.end());
    vector<bool> tab(rmax+1, true);
    for(LL i=2; i<=sqrt(rmax); i++){
        LL j=2;
        while(i*j <= rmax){
            tab[i*j]=false;
            j++;
        }
    }

    vector<LL> total(rmax+1, 0);
    LL acc = 0;
    for(LL i=3; i<=rmax; i+=2){
        if(tab[i] && tab[(i+1)/2])acc++;
        total[i]=acc;
    }

    for(LL i=0; i<Q; i++){
        auto tmp = total[r[i]]-total[l[i]];
        if(l[i]>=2 && total[l[i]]-total[l[i]-2]>0)tmp+=1;
        cout << tmp << endl;
    }

}

int main(){
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> l(Q);
    std::vector<long long> r(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&l[i]);
        scanf("%lld",&r[i]);
    }
    solve(Q, std::move(l), std::move(r));
    return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define ET cout << "\n"
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef bbq
#define debug(...) {\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}
#define DB(a,s,e) {for(int _i=s;_i<e;++_i) cerr << a[_i] << " ";cerr << "\n";}
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T,typename ...S> void _do(T &&x,S &&...t){cerr<<x<<", ";_do(t...);}
template<typename a,typename b> ostream& operator << (ostream &s,const pair<a,b> &p){return s<<"("<<p.X<<","<<p.Y<<")";}
#else
#define debug(...)
#define DB(a,s,e)
#endif

int main()
{
    IOS();
    int a,b;
    cin >> a >> b;
    if(a<=0&&b>=0)
        return cout << "Zero\n",0;
    if(~(b-a)&(b<0))
        cout << "Negative\n";
    else
        cout << "Positive\n";
}

Measured memory_bytes: 256
N = int(input())
if N >= 0 and N < 10:
    print(N)
elif  N >= 10 and N < 100:
    print("9")
elif  N >= 100 and N <= 999:
    print(N-90)
elif  N >= 1000 and N <= 9999:
    print("909")
elif  N >= 10000 and N <= 99999:
    print(909+(N-9999))
elif N >= 100000:
    print("90909")


Measured memory_bytes: 2940
K = int(input())
X = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(X[K-1])

Measured memory_bytes: 3060
#include <iostream>
#include <string>

using namespace std;

int main(){
	while(true){
		string red, green, output;
		cin >> red;
		if(red == "-"){ break; }
		cin >> green >> output;
		char center = green[0];
		int rp = 0, gp = 1, op = 0;
		while(rp < red.size() || gp < green.size()){
			if(output[op] == center){
				center = red[rp++];
				++op;
			}else{
				while(center != output[op]){
					cout << center;
					center = green[gp++];
				}
			}
		}
		if(center != '\0'){ cout << center; }
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int,int> ii;


int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    int d=1;
    ll ans=0;
    if (n<10) ans=n; else
    {
        while (n>d*10-1)
        {
            ans+=d*10-d;
            d*=100;
        }
        if (n>=d)
        {
            ans+=n-d+1;
        }
    }
        cout << ans;
    return 0;
}


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

int main()
{
    int N, K;
    int ans = 1;
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        if (ans > K)
        {
            ans += K;
        }
        else
        {
            ans *= 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

map<ll, int> prime_factor(ll n){
    map<ll, int> res;
    for(ll i = 2; i*i <= n; i++){
        while (n % i == 0){
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n]++;
    return res;
}

bool is_prime(int n){
    for (int i = 2; i * i <= n; i++) {
        if(n % i == 0) return false;
    }
    return true;
}

int main(void)
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    SORT(A);
    vector<int> p(1000010);
    vector<int> ok(N, 1);
    REP(i, N-1){
        //同じものを除去
        if(A[i+1]==A[i]){
            ok[i+1] = ok[i] = 0;   
            p[A[i]] = 1;
        }
    }

    int ans = 0;
    REP(j, N){
        if(ok[j]==1){
            vector<ll> d;
            for (ll i = 1; i*i <= A[j]; i++) {
                if(A[j]%i==0) {
                    d.pb(i);
                    if(i*i != A[j]) d.pb(A[j]/i); //Nが平方数である時の対策
                }
            }
            bool f = true;
            for(auto&& di:d){
                if(p[di]==1){
                    f = false;
                    break;
                }
            }
            if(f) ans++;
            p[A[j]] = 1;
        }
    }
    pr(ans);
}

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

int main()
{
	int test[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int i;

	cin >> i;
	cout << test[i-1];
}

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

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

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define f(i,a,b) for(int i=a;i<b;i++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd_ll(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int fiv(int n){
  if(n==0){
    return 0;
  }
  else if(n==1){
    return 1;
  }
  return fiv(n-1)+fiv(n-2);
}
ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int main(){
  string s,t;
  cin>>s>>t;
  string alp ="abcdefghijklmnopqrstuvwxyz";
  map<char, int> p,q;
  rep(i,26){
    p[alp[i]] =0;
    q[alp[i]] =0;
  }
  
  rep(i,s.size()){
    p[s[i]] ++;
  }
  rep(i,s.size()){
    q[t[i]] ++;
  }
  bool ok =true;

  vi pn(26),qn(26);
  rep(i,26){
    pn[i] = p[alp[i]];
    qn[i] = q[alp[i]];
  }
  sort(all(pn));
  sort(all(qn));
  rep(i,26){
    if(pn[i] != qn[i]){
      ok =false;
      break;
    }
  }
  if(ok) cout<< "Yes"<<endl;
  else cout<< "No"<<endl;

}





Measured memory_bytes: 776
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    rep(i, n) {
        int p;
        cin >> p;
        s.emplace(p);
    }

    int l = x, r = x;
    while (s.count(l))
        --l;
    while (s.count(r))
        ++r;
    cout << (abs(x - l) <= abs(x - r) ? l : r) << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define DBG(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

signed main(){
	acc_io;
	string s,t;
	cin>>s>>t;
	string p,ans;
	ans="zzzz";
	int ng=0;
	for(int i=0;i<s.size()-t.size()+1;i++){
		p=s;
//		DBG(i,p,0,0);
		rep(j,0,t.size()){
			p.at(i+j)=t.at(j);
		}
//		DBG(i,p,0,1);
		rep(j,0,p.size()){
			if(s.at(j)!='?'&&p.at(j)!=s.at(j)){
				ng=1;
				break;
			}
		}
		if(ng){
			rep(j,0,t.size()){
				p.at(i+j)=s.at(i+j);
			}
		}
		else{
			rep(i,0,p.size()){
				if(p.at(i)=='?') p.at(i)='a';
			}
			ans=min(p,ans);
			//i+=t.size()-1;
		}
//		DBG(i,p,0,2);
		ng=0;
	}
	if(ans=="zzzz"){
		ans="UNRESTORABLE";
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
   string s;
   cin >> s;
   rep(i,3){
       if(s[i]=='1') s[i]='9';
       else if(s[i]=='9') s[i]='1';
   }
   cout << s << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

vector<pair<int,int>> hws(90001);

int dist(int a, int b) {
    int h1, w1, h2, w2;
    tie(h1, w1) = hws[a];
    tie(h2, w2) = hws[b];
    // printf("dist of %d and %d is %d\n", a, b, abs(h1 - h2) + abs(w1 - w2));
    return abs(h1 - h2) + abs(w1 - w2);
    
}

int main(void)
{
    cin.sync_with_stdio(false);
    int H, W, D;
    cin  >> H >> W >> D;

    REP(h, H) {
        REP(w, W) {
            int a;
            cin >> a;
            hws[a] = mp(h, w);
        }
    }
    
    map<int, map<int, int>> table;

    FOR(start, 1, 1 + D) {
        table[start][start] = 0;
        int to = start + D;
        while (to <= 300*300+1) {
            table[start][to]
                = table[start][to - D]
                + dist(to, to - D);
            // printf("table[%d][%d] = %d\n", start, to, table[start][to]);
            to += D;
        }
    }

    int Q;
    cin >> Q;
    REP(q, Q) {
        int l, r;
        cin >> l >> r;
        auto base = l % D;
        if (base == 0) base += D;
        cout << (table[base][r] - table[base][l]) << endl;
    }

    return 0;
}


Measured memory_bytes: 13824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

ll A, B, N;

inline ll f(ll n)
{
	return ((A * n) / B) - A * (n / B);
}


int main(int argc, char **argv)
{
	cin >> A >> B >> N;
	std::cout << f(min(N, B-1))<< std::endl;
}

Measured memory_bytes: 3576
A, B = map(int, input().split())


def is_kaibunsu(num):
    s_num = str(num)
    # 条件が6桁限定
    if s_num[0:2] == s_num[-2:][::-1]:
        return True
    else:
        return False


res = 0
for _n in range(A, B + 1):
    if is_kaibunsu(_n): res += 1
print(res)


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

#define N 500001
#define NIL NULL

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

typedef struct node *Node;

Node root;

void insert(int k){
    Node z;
    Node y=NIL;
    Node x=root;

    z=malloc(sizeof(struct 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 Preorder(Node u){
    if(u!=NIL){
    printf(" %d",u->key);
    if(u->left != NIL) Preorder(u->left);
    if(u->right != NIL) Preorder(u->right);
    }
}

void Inorder(Node u){
    if(u!=NIL){
        Inorder(u->left);
        printf(" %d",u->key);
        Inorder(u->right);
    }
}

Node find(Node r, int k){
    if(r == NIL || k == r->key) return r; 
    if(k < r->key) return find(r->left,k);
    else if(k > r->key) return find(r->right,k);
}

int main ()
{
    int n,i,x;
    char s[10];

    scanf("%d",&n);


    for(i=0;i<n;i++){
        scanf("%s",s);
        if(strcmp(s,"insert")==0){
            scanf("%d",&x);
            insert(x);
        }
        else if(strcmp(s,"find")==0){
            scanf("%d",&x);
            if(find(root,x)!=NIL) printf("yes\n");
            else printf("no\n");
        }
        else if(strcmp(s,"print")==0){
            Inorder(root);
            printf("\n");
            Preorder(root);
            printf("\n");
        }
    }

    return 0;
}

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

int main() {
  
	string s;
   cin >> s;
  
  int ans =0,ant=0;
  
  for(int i=0;i<s.size();i++){
    
    
    if(s[i] == 'p' && ant>0){
      
      ant --;
    }
    
    else if(s[i] == 'p' && ant ==0){
      ans--;
      ant++;
    }
    else if(s[i] == 'g' && ant>0){
      ans++;
      ant--;
    }
    else if(s[i] == 'g' && ant==0){
      ant++;
      
    }
  }
    cout << ans << endl;
  }
    
      
      
    
    
    
   

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>

int main(){
	
	double x1,x2,y1,y2;
	double distance;
	
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	
	distance = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
	
	printf("%f",distance);
	
    return 0;

}

Measured memory_bytes: 652
import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	long sum = 0;
	for(int i = 0; i < N; ++i) {
	    sum += (long)s.nextInt();
	}
	System.out.println(sum/N);
    }
}

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

void convert(int x, int b){
    if (x == 0) {
        return;
    }
    int p, q = x % 10;
    if (q < 0) {
        q *= -1;
    }
    if (q == 0) {
        p = 0;
    }else if (x * b < 0){
        p = 10 - q;
        x -= 10 * b;
    }else{
        p = q;
    }
    convert(x / 10, b * (-1));
    cout << p;
}

int main()
{
    int x;
    while (cin >> x && x) {
        convert(x, 1);
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int bingo[3][3];
  rep(i,3) rep(j,3) cin>>bingo[i][j];
  int n;
  cin>>n;
  rep(time,n){
    int a;
    cin>>a;
    rep(i,3) rep(j,3){
      if(bingo[i][j]==a)
        bingo[i][j]=-1;
    }
  }
  
  bool count=0;;
  if(bingo[0][0]==-1 && bingo[0][1]==-1 && bingo[0][2]==-1) count++;
  if(bingo[1][0]==-1 && bingo[1][1]==-1 && bingo[1][2]==-1) count++;
  if(bingo[2][0]==-1 && bingo[2][1]==-1 && bingo[2][2]==-1) count++;
  if(bingo[0][0]==-1 && bingo[1][0]==-1 && bingo[2][0]==-1) count++;
  if(bingo[0][1]==-1 && bingo[1][1]==-1 && bingo[2][1]==-1) count++;
  if(bingo[0][2]==-1 && bingo[1][2]==-1 && bingo[2][2]==-1) count++;
  if(bingo[0][0]==-1 && bingo[1][1]==-1 && bingo[2][2]==-1) count++;
  if(bingo[0][2]==-1 && bingo[1][1]==-1 && bingo[2][0]==-1) count++;
  
  if(count) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int N,K;
  cin >> N >> K;
  int mid=K/2;
  int a;
  int ans=0;
  for(int i=0;i<N;i++){
    cin >> a;
    if (a>mid){
      ans=ans+abs(a-K);
      continue;
    }
    ans=ans+a;
  }
  cout << ans*2;
}

Measured memory_bytes: 256
n = int(input())
l = []
for i in range(n) :
    l.append(input())
print('AC x ' + str(l.count('AC')))
print('WA x ' + str(l.count('WA')))
print('TLE x ' + str(l.count('TLE')))
print('RE x ' + str(l.count('RE')))

Measured memory_bytes: 16204
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> T& chmin(T &a, const U &b){return a = (a<=b?a:b);}
template <typename T, typename U> T& chmax(T &a, const U &b){return a = (a>=b?a:b);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const LLI mod = 1e9+7;

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

  int N;
  while(cin >> N){
    vector<int> c(N); cin >> c;
    for(auto &x : c) --x;

    vector<LLI> dp(N+1);

    vector<int> prev(N,-1);
    vector<vector<int>> chain(200000);
    
    REP(i,N){
      if(!chain[c[i]].empty()) prev[i] = chain[c[i]].back();
      chain[c[i]].push_back(i);
    }
    /*
    dump(chain);
    dump(prev);
    */
    dp[0] = 1;
    
    REP(i,N){
      dp[i+1] = dp[i];
      if(prev[i] >= 0 and prev[i] < i-1) (dp[i+1] += dp[prev[i]+1]) %= mod;
    }

    cout << dp[N] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 14336
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a ,&b);
    if (a < b)
    {
        printf("a < b\n");
    }
    else if (a > b)
    {
        printf("a > b\n");
    }
    else if (a == b)
    {
    printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2068
#include<bits/stdc++.h>
using namespace std;
int a,b,s1,s2,s3;
int main(){
  cin>>a>>b;
  s1=a+a-1;
  s2=b+b-1;
  s3=a+b;
  cout<<max(s1,max(s2,s3));
}

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

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> h(N);
    for (int i = 0; i < N; ++i) {
        std::cin >> h[i];
    }

    std::vector<int> dp(N, 0);
    dp[0] = 0;
    dp[1] = std::abs(h[0] - h[1]);

    for (int i = 2; i < N; ++i) {
        dp[i] = std::min(dp[i - 1] + std::abs(h[i] - h[i - 1]), dp[i - 2] + std::abs(h[i] - h[i - 2]));
    }

    std::cout << dp[N - 1] << std::endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#define INF 10000000
#define N 1000
using namespace std;

int n,M[N][N],d[N];
void dijkstra(int s){
  int use[N],min,u;
  for(int i=0;i<n;i++) use[i]=0,d[i]=INF;
  d[s]=1;
      while(1){
    min=INF;
    for(int i=0;i<n;i++) if(use[i]!=1 && d[i]<min ) min=d[i],u=i;
    if(min==INF) break;
        use[u]=1;
    for(int i=0;i<n;i++)
      if(use[i]!=1 && M[u][i]!=INF)
	if(d[u]+M[u][i]<d[i])
	  d[i]=d[u]+M[u][i];
    }
}

int main(){
  while(1){
  vector<int> wallh,wallw;
  int h,w,wall;
  cin>>w>>h;
  if(w+h==0) break;
  n=w*h;
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) M[i][j]=INF;
  for(int i=0;i<w*h;i++){
    M[i][i+1]=1,M[i][i+w]=1;
    if(i-1>=0) M[i][i-1]=1;
    if(i-w>=0) M[i][i-w]=1;
  }
    
  int cntw=0,cnth=0;
  for(int i=0;i<(w*(h-1))+((w-1)*h);i++){
    cin>>wall;
    if(cntw==w-1 && cnth<=w)  wallh.push_back(wall),cnth++;
    else if(cnth==0 && cntw<w)  wallw.push_back(wall),cntw++;
      if(cntw==w-1 && cnth==w) cntw=0,cnth=0;
  }
  int cnt=0;
   for(int i=0;i<wallw.size();i++){
     if((i+cnt+1)%w==0){
       M[i+cnt][i+1+cnt]=INF;
       M[i+1+cnt][i+cnt]=INF;
       cnt++;
     }
     if(wallw[i]==1) M[i+cnt][1+i+cnt]=INF,M[i+1+cnt][i+cnt]=INF;
   }   
   for(int i=0;i<wallh.size();i++) if(wallh[i]==1)M[i][i+w]=INF,M[i+w][i]=INF;
       dijkstra(0);
       if(d[w*h-1]==INF) d[w*h-1]=0;
    cout<<d[w*h-1]<<endl;
    wallh.clear(),wallw.clear();
  }
   return 0;
}

Measured memory_bytes: 5140
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod    1000000007
#define PI 2*acos(0.0)
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};
//======================================ASIFAZAD==========================================//

bool ck(int n, int pos)
{
    return bool(n&(1<<pos));
}

int32_t main()
{
    io;
    int n, m, k;
    cin>>n>>m>>k;
    int book[n][m+1];
    for(int i = 0; i<n; i++)
        for(int j = 0; j<=m;j++)
            cin>>book[i][j];
    int ans = INT_MAX;
    for(int i = 0; i < (1<<n); i++)
    {
        vi ac(m+1);
        for(int pos = 0; pos < 13; pos++)
        {
            if(ck(i, pos))
                for(int a = 0; a <= m; a++)
                    ac[a] += book[pos][a];
        }
        int c;
        for(c = 1; c<=m; c++)
            if(ac[c] < k)
                break;
        if(c > m)
            ans = min(ans, ac[0]);
    }
    cout<<(ans==INT_MAX?-1:ans);
    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    a=b-a;
    c=c-b;
    if(a==c){
        printf("YES");
    }
    else {
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main() {
    char s[10+1];
    scanf("%s", s);

    for (int i = 0; i < strlen(s); i++) {
        if (s[i] == 'B') {
            int j = i-1;
            while (j >= 0 && s[j] == 'X') {
                j -= 1;
            }
            if (j >= 0) {
                s[j] = 'X';
            }
            s[i] = 'X';
        }
    }

    for (int i = 0; i < strlen(s); i++) {
        if (s[i] != 'X') {
            printf("%c", s[i]);
        }
    }
    puts("");

    return 0;
}

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

int main(){
	// sengen
	int a,b,t;
	// nyuryoku
	cin >> a >> b >> t;
	// keisan
	t = t/a;
	cout << t*b << endl;
	// syutsuryoku
}

Measured memory_bytes: 3592