akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = Integer.parseInt(sc.next());
        int X = Integer.parseInt(sc.next());
        String answer = new String();
        for(int i = X-K+1 ; i < X+K ; i++){
            answer += i+ " ";
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 38736
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
//エラトステネスの篩
vector<bool> IsPrime(1000010,true);
void sieve(ll n){
    IsPrime[0]=0;
    IsPrime[1]=0;
    REP(i,2,n+1){
        if(IsPrime[i]){
            ll k=2;
            while(k*i<=n){
                IsPrime[k*i]=0;
                k++;
            }
        }
    }
}
signed main(){
    ll n;cin>>n;
    sieve(1000010);
    ll ans=0;
    REP(i,2,1000010){
        if(IsPrime[i]){
            ll p=i;
            ll cnt=0;
            while(n%p==0){
                cnt++;
                n/=p;
            }
            ll l=0,r=inf;
            while(r-l>1){
                ll mid=(r+l)/2;
                if((mid*mid+mid)<=cnt*2)l=mid;
                else r=mid;
            }
            ans+=l;
        }
        if(n==1)break;
    }
    if(n>1)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

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

int main()
{
    ll N;
    cin >> N;
    vector<bool> is_prime(55555+1, true);
    is_prime[0] = false;
    is_prime[1] = false;
    for(ll i = 2; i*i <= 55555; i++)
       if(is_prime[ i ])
           for(ll j = i*2; j <= 55555; j += i)
               is_prime[ j ] = false;

    vector<ll> ans;
    rep(i, 55556) {
        if(is_prime[i] && i % 5 == 1) {
            ans.push_back(i);
            if (ans.size() == N) break;
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<functional>
#include<iostream>
#define rep(i,a) for(i=0;i<a;i++)
using namespace std;
int glid[91][91];
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
int m,n,mx,cnt;
void func(int,int);
int main(void)
{
	int i,j,k;
	while(cin>>m>>n && m && n ) {
		mx=-1;
		rep(i,n)rep(j,m) cin>>glid[i][j];
		rep(i,n)rep(j,m) if(glid[i][j]==1) {cnt=0;func(i,j);}
		cout<<mx<<endl;
	}
	return 0;
}
void func(int x,int y)
{
	int i,j,k,xx,yy;
	rep(i,4) {
		xx=dx[i]+x; yy=dy[i]+y;
		if(xx<=m && xx>=0 && yy<=n && yy>=0 && glid[yy][xx]==1) {
			cnt++;
			mx=max(mx,cnt);
			glid[yy][xx]=0;
			func(xx,yy);
			cnt--;
			glid[yy][xx]=1;
		}
	}
}

Measured memory_bytes: 2952
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int N;
  cin>>N;
  set<char> SET;
  for (int i = 0; i < N; i++)
  {
    char A;
    cin>>A;
    SET.insert(A);
  }
  if(SET.size() == 3)
  {
    cout<<"Three"<<endl;
  }
  else
  {
    cout<<"Four"<<endl;
  }
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// ATCODER BEGINNERS PROBLEMS
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.flush();
     string s;
    cin >> s;
    int m;
    m = (s[5]-'0')*10 + (s[6]-'0');
    int d;
    d = (s[8]-'0')*10 + (s[9]-'0');
//    cout<<m<<" "<< d;
    if(m>4 || (m>=4 && d==31))
       cout<<"TBD";
    else
       cout<<"Heisei";
    return 0;
    // Bye Bye 2019
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e16;
using Graph = vector<vector<int>>;

signed main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  Graph G(N);
  map<pair<int, int>, int> hen;
  for( int i = 0; i < N-1; i++ ){
    int A, B, C;
    cin >> A >> B >> C;
    A--;
    B--;
    G.at(A).push_back(B);
    G.at(B).push_back(A);
    hen[make_pair(A, B)] = C;
    hen[make_pair(B, A)] = C;
  }
  
  int Q, K;
  cin >> Q >> K;
  
  //BFS
  vector<int> dist(N, -1);
  queue<int> que;
  dist.at(K-1) = 0;
  que.push(K-1);
  while( !que.empty() ){
    int v = que.front();
    que.pop();
    
    for( int nv : G.at(v) ){
      if( dist.at(nv) != -1 ) continue;
      dist.at(nv) = dist.at(v) + hen.at(make_pair(v, nv));
      que.push(nv);
    }
  }
  
  for( int i = 0; i < Q; i++ ){
    int X, Y;
    cin >> X >> Y;
    X--;
    Y--;
    cout << dist.at(X) + dist.at(Y) << endl;
  }

  
}


Measured memory_bytes: 22784
n=int(input())
def f(a,b):
    a=str(a)
    b=str(b)
    return(max(len(a),len(b)))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

l=make_divisors(n)
ans=10**9+7
for i in l:
    ans=min(ans,f(i,n//i))

print(ans)



Measured memory_bytes: 3188
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int N;
    const int rate = 380000.0;
    cin >> N;
    vector<pair<double, string> > gift(N);
    for(int i = 0; i < N; i++) {
        cin >> gift[i].first >> gift[i].second;
    }
    double sum = 0;

    for(int i = 0; i < N; i++) {
        if(gift[i].second == "JPY") {
            sum += gift[i].first;
        } else {
            sum += gift[i].first * rate;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    private final int N;

    AtCoder(FastScanner sc) {
        N = sc.nextInt();

    }

    void solve(PrintWriter out) {
        int cnt = 0;
        for (int i = 1; i <= N; i++) {
            if (Integer.toString(i).length() % 2 != 0) {
                cnt++;
            }
        }
        out.println(cnt);
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vll = V<ll>;
using VVll = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

const ll MOD = 1e9+7;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

std::vector<long long> divisors(long long n) {
    std::vector<long long> divisors;
    long long i = 1;
    while (i * i <= n) {
        if (n % i == 0) {
            divisors.push_back(i);
            // if (i * i != n) {
            //     divisors.push_back(n/i);
            // }
        }
        i++;
    }

    sort(divisors.begin(), divisors.end());
    return divisors;
}

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

    std::vector<ll> v = divisors(n);

    ll mini = 1e12;
    FOR(i, v) {
        ll rest = n / *i;
        if (rest + *i -2 < mini) {
            mini = rest + *i -2;
        }
    }
    std::cout << mini << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> t(n), x(n), y(n);
  for(int i = 0; i < n; i++) cin >> t[i] >> x[i] >> y[i];
  int nx = 0, ny = 0, nt = 0;
  for(int i = 0; i < n; i++) {
    int d = abs(x[i] - nx) + abs(y[i] - ny);
    nx = x[i]; ny = y[i];
    if(d <= (t[i] - nt) && ((t[i] - nt) - d) % 2 == 0) {
      nt = t[i];
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005

ll BIGMOD ( ll a, ll p, ll m )
{
    ll result = 1;
    ll x = a;

    while ( p )
    {
        if ( p & 1 ) //p is odd
        {
            result = ( result * x ) % m;
        }
        x = ( x * x ) % m;
        p = p >> 1;
    }

    return result;
}

int main()
{
  // fastread;
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
      cin>>arr[i];
  }
  int sum=0;
  for(int i=0;i<n-1;i++)
  {
    for(int j=i+1;j<n;j++)
    {
        sum=sum+(arr[i]*arr[j]);
    }
  }
  cout<<sum<<endl;

  return 0;
}


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

#define rep(i,a,b)                for(ll i=a;i<b;i++)
#define re(i,b)                for(ll i=0;i<b;i++)
#define repr(i,n)                for(ll i=n-1;i>=0;i--)
#define ll long long
#define ld long double
#define llu long long unsigned
#define pll std::pair<ll, ll> 
#define ppll std::pair<ll, pll>
#define vll std::vector<ll> 
#define vpll std::vector<pll> 
#define vppll std::vector<ppll> 
#define mll std::map<ll, ll> 
#define mpll std::map<pll, ll>
#define mppll std::map<ppll, ll>
#define sll std::set<ll>
#define ff first
#define ss second
#define msll std::multiset<ll>
#define all(c) c.begin(), c.end()
#define allr(c) c.rbegin(), c.rend()
#define srt(x) sort(all(x))
#define rsrt(x) sort(allr(x))
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define s(yy) ll yy;cin>>yy
#define mod 1e9+7
#define maxlong 1e18+5


/*
###################################################### 
#                                                    #
#                     @author                        #
#                  Parth Lathiya                     #
#      https://www.cse.iitb.ac.in/~parthiitb/        #
#                                                    #
###################################################### 
*/


int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef PARTH_LATHIYA_HOME

		freopen("A_in.txt","r",stdin);
	
		ll ttt,bkkk;
		cin>>ttt;
		bkkk=ttt;
		while(ttt--) {
			cout<<"Testcase - "<<bkkk-ttt<<"\n";
	#endif

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

	// std::vector<int> v[100];
	// std::vector<int> temp(100,4);
	// rep(i,0,100)
	// 	v[i] = temp;

	s(n);
	ll a[n];
	re(i,n)
		cin>>a[i+1];
	if(n&1){
		//odd 
		for(ll i=n;i>=1;i-=2)
			cout<<a[i]<<" ";
		for(ll i=2;i<n;i+=2)
			cout<<a[i]<<" ";
	}
	else{
		//odd 
		for(ll i=n;i>=2;i-=2)
			cout<<a[i]<<" ";
		for(ll i=1;i<n;i+=2)
			cout<<a[i]<<" ";

	}

//--------------------------------------------------------------------------------------
	
	#ifdef PARTH_LATHIYA_HOME
		cout<<"\n"; }
	#endif

	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int N;
	int	A = 0;
	int B = 0;
	int a[110];

	cin >> N;

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

	sort(a, a + N, greater<int>());

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

		if (i % 2 == 0) {
			A += a[i];
		}
		else {
			B += a[i];
		}
	}

	cout << A - B << endl;

    return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(string s) {
    int ans = int.max;
    for (int i = 0; i + 3 <= s.length; i++) {
        int x = s[i..i + 3].to!int;
        ans = min(ans, abs(753 - x));
    }
    return ans;
}

void main() {
    string s = read!string;
    writeln(calc(s));
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)

	ok := false
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if j*i == N {
				ok = true
				break
			}
		}
	}
	if ok {
		fmt.Println("Yes")

	} else {
		fmt.Println("No")

	}
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

        int ans = 0;

        long kP = 1;

        while (kP <= N) {
            kP *= K;
            ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
main = do
    _ <- getLine
    (h:hs) <- fmap (map read . words) getLine :: IO [Int]
    putStrLn $ show $ solve h hs + 1

solve :: Int -> [Int] -> Int
solve _ [] = 0
solve x (h:hs) = if x <= h then 1 + solve h hs else solve x hs


Measured memory_bytes: 508
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a[200000+50],bj[200000+50];
int main ()
{
	int n,i;
	while(scanf("%d",&n)!=EOF)
	{	
		memset(bj,0,sizeof(bj));
		for(i=0;i<n;i++)
			cin>>a[i];
		int mx=-1;
		for(i=0;i<n;i++)
			bj[a[i]]=bj[a[i]-1]+1,mx=max(mx,bj[a[i]]);
		cout<<n-mx<<endl;
	}
	return 0;
 } 

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

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

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)



int main() {
	map<char,ll> dic;
	string S;
	std::cin >> S;

	ll cnt=0;
	rep(i, 0, S.length()) {
		dic[S[i]]++;
		cnt = max(cnt, dic[S[i]]);
	}
	if (cnt == 2 && dic.size() == 2) {
		std::cout << "Yes" << endl;
	}
	else {
		std::cout << "No" << endl;
	}

	return 0;
}


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

#define ll long long
#define INF 2147483647
#define Inf 9223372036854775807
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
inline void Fail(){
	printf("0");
	exit(0);
}

const int maxn=2005;
int n,A,B;
int a[maxn],dp[maxn][2];

int main(){
	scanf("%d%d%d",&n,&A,&B);
	rep(i,n)scanf("%d",&a[i]);
	for(int i=n-2;i>=0;i--){
		for(int j=i;j<n-1;j++)dp[i][0]=max(dp[i][0],min(abs(a[n-1]-a[j]),j+1==n-1?INF:dp[j+1][1]));
		dp[i][1]=INF;
		for(int j=i;j<n-1;j++)dp[i][1]=min(dp[i][1],max(abs(a[n-1]-a[j]),j+1==n-1?0:dp[j+1][0]));
//		cout<<i<<" "<<dp[i][0]<<" "<<dp[i][1]<<endl;
	}
	printf("%d",max(dp[0][0],abs(a[n-1]-B)));
	return 0;
}

/*
Input:
5 2 3
1 2 3 4 5
-----------------
Output:
*/

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


int main() {
    int N;
    cin >> N;
    int ans = 0;
    if (N <= 9) ans += N;
    if (N >= 10) ans += 9;
    if (N >= 100 && N < 1000) ans += N - 99;
    if (N >= 1000) ans += 900;
    if (N >= 10000 && N < 100000) ans += N - 9999;
    if (N == 100000) ans += 90000;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

void Main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    sort(all(h));
    int ans = *max_element(all(h));
    rep(i, n - k + 1)
    {
        int tmp = h[i + k - 1] - h[i];
        ans = min(ans, tmp);
    }

    cout << ans << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 640
list=[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]
num = int(input())
print(list[num-1])

Measured memory_bytes: 3060
N = int(input())
S = [int(s) for s in input().split()]

snt = 10 ** 9 + 1
cnt = 0

# L, R = [0] * 500000, [0] * 500000

def merge(S, N, left, mid, right):
    global cnt
    # N1 = mid - left
    # N2 = right - mid
    # for i in range(N1):
    #     L[i] = S[left + i]
    # for i in range(N2):
    #     R[i] = S[mid + i]
    # L[N1] = R[N2] = snt
    L = S[left:mid] + [snt]
    R = S[mid:right] + [snt]
    i, j = 0, 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1

def merge_sort(S, N, left, right):
    if left + 1 < right:
        mid = int((left + right) / 2)
        merge_sort(S, N, left, mid)
        merge_sort(S, N, mid, right)
        merge(S, N, left, mid, right)

merge_sort(S, N, 0, N)

print(*S)
print(cnt)


Measured memory_bytes: 61652
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e5+10,mod=1e9+7,inf=1e9+10;
int a[M];
main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	if(a[n]!=2)return cout<<-1,0;
	int need1=2,need2=3;
	for(int i=n-1;i>=1;i--)
	{
		//int last=need1;
		int tmp=need1/a[i];
		if(need1%a[i]!=0)tmp++;
		need1=a[i]*tmp;
		//if(need1>=last+a[i+1])return cout<<-1,0;
		int tmp2=(need2)/a[i];
		need2=tmp2*a[i];
		need2+=a[i]-1;
	}	
	int sv=need1;
	for(int i=1;i<=n;i++)
	{
		need1-=(need1%a[i]);
	}
	if(need1!=2)return cout<<-1,0;
	cout<<sv<<" "<<need2;
}

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


long long dp[1<<17] = {0};

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, W; cin >> n >> W;
  for (int i = 0; i < n; ++i) {
    int w, v; cin >> w >> v;
    for (int j = W; j >= w; --j) {
      dp[j] = max(dp[j], dp[j - w] + v);
    }
  }
  cout << dp[W] << '\n';
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,x,t;
    cin>>n>>x>>t;
    if ((n%x)==0)
    {
        cout<<t*(n/x)<<endl;
    }
    else
    {
        cout<<t*((n/x)+1)<<endl;
    }

    return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))

    # See:
    # https://www.youtube.com/watch?v=hetSRNLGOtk
    print(min(m // 2, (2 * n + m) // 4))


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

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

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

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

int main() {
  int x;
  cin >> x;
  int ans = 0;

  ans = x / 500;
  x -= ans * 500;
  ans *= 1000;

  int fiveCnt = x / 5;
  ans += fiveCnt * 5;
  x -= fiveCnt * 5;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
def input_int():
    return map(int, input().split())

def input_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

S=one_str()

flg = False
if S[0]=="A":
    if "C" in S[2:-1]:
        indC = S[2:-1].index("C")+2
        ss = S[1:indC] + S[indC+1:]
        if ss.islower():
            flg =True

if flg:
    print("AC")
else:
    print("WA")

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
    cout << "Left" << endl;
  }
  else if(A+B == C+D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

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

using namespace std;

int main(void){
    string s, t;
    cin >> s >> t;
    int res = 0;

    for(int i = 0; i < (int)s.size(); i++){
        char ch1 = s[i];
        char ch2 = t[i];
        if(ch1 == ch2){
            res++;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
public class Hello
{
    
    public static int[] dx = {1,0};
    public static int[] dy = {0,1};
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[,] board = new int[2, N];
        int[,] boardMax = new int[2, N]; //累積和の最大値を保存
        
        for(int i = 0; i < 2; i++)
        {
            int[] line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            for(int j = 0; j < N; j++)
            {
                board[i, j] = line[j];
            }
            
        }
        
        boardMax[0, 0] = board[0, 0];
        dfs(board, boardMax, 0, 0, ref N);
        Console.WriteLine(boardMax[1, N - 1]);
        
        
        
        //デバッグ用　
        /*
        for(int i = 0; i < 2; i++)
        {
            for(int j = 0; j < N; j++)
            {
                Console.Write(board[i, j] + " ");
            }
            Console.WriteLine();
        }
        */
    }
    
    public static void dfs(int[,] board, int[,] boardMax, int x, int y, ref int N)
    {
        for(int j = 0; j < 2; j++)
        {
            int next_y = y + dy[j];
            int next_x = x + dx[j];
            if(next_y >= 2 || next_x >= N )
            {
                continue;
            }
            //次の移動先に現在いるマスの数を加える
            int nextSum = boardMax[y, x] + board[next_y, next_x];
            if(nextSum > boardMax[next_y, next_x]) //現在の累積和のmaxより大きければ更新
            {
                boardMax[next_y, next_x] = nextSum;
            }
            
            dfs(board, boardMax, next_x, next_y, ref N);
        }
        return;
    }
}


Measured memory_bytes: 13396
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def cmp1(a,b):
    l = []
    for i in range(len(a)):
        ok = True
        for j in range(min(len(b),len(a)-i)):
            #ddprint("a {} b {} i {} j {}".format(a,b,i,j))
            #ddprint("aij {} bj {}".format(a[i+j],b[j]))
            if a[i+j]!='?' and b[j]!='?' and a[i+j]!=b[j]:
                ok = False
                break
        if ok:
            l.append(i)
    #ddprint("cmp1 a {} b {} l {}".format(a,b,l))
    return l

def chk3(mn,a,b,c,ab,ac,bc):
    for i in ab:
        v = max(len(a),len(b)+i)+len(c)
        mn = min(mn,v)
        for j in bc:
            if len(a)-i<=j or (j+i) in ac:
                v = max([len(a),len(b)+i,len(c)+i+j])
                mn = min(mn,v)
        for j in ac:
            if len(b)+i<=j:
                v = max(len(a),len(c)+j)
                mn = min(mn,v)

    for i in bc:
        v = max(len(b),len(c)+i)+len(a)
        mn = min(mn,v)
    return mn

def solve(a,b,c):
    ab = cmp1(a,b)
    ac = cmp1(a,c)
    bc = cmp1(b,c)
    ba = cmp1(b,a)
    ca = cmp1(c,a)
    cb = cmp1(c,b)
    mn = len(a)+len(b)+len(c)
    ddprint(mn)
    mn = chk3(mn,a,b,c,ab,ac,bc)
    ddprint(mn)
    mn = chk3(mn,a,c,b,ac,ab,cb)
    ddprint(mn)
    mn = chk3(mn,b,a,c,ba,bc,ac)
    ddprint(mn)
    mn = chk3(mn,b,c,a,bc,ba,ca)
    ddprint(mn)
    mn = chk3(mn,c,a,b,ca,cb,ab)
    ddprint(mn)
    mn = chk3(mn,c,b,a,cb,ca,ba)
    return mn

a = ins()
b = ins()
c = ins()
mn = solve(a,b,c)
print(mn)


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

public class Main {

	public static void main(String[] args) {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		try {
			String line;
			
			while((line=r.readLine())!=null){
				ArrayList<String> push = new ArrayList<String>();
				
				int index=0;
				
				for(int i=index;i<line.length();i++){
					if(i==line.length()-1){
						push.add(line.substring(index,i+1));
						break;
					}
					if(line.charAt(i)!=line.charAt(i+1)){
						push.add(line.substring(index,i+1));
						index = i+1;
					}
				}

				
				
				for(String p:push){
					System.out.print(pushButton(p));
				}
				System.out.println();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static String pushButton(String push){
		if(push.length()==0||push==null){
			return "";
		}
		String[][] keys = {{" "},
				{"'",",",".","!","?"},
				{"a","b","c","A","B","C"},
				{"d","e","f","D","E","F"},
				{"g","h","i","G","H","I"},
				{"j","k","l","J","K","L"},
				{"m","n","o","M","N","O"},
				{"p","q","r","s","P","Q","R","S"},
				{"t","u","v","T","U","V"},
				{"w","x","y","z","W","X","Y","Z"}
				};
		int index=push.length(),l=Integer.parseInt(push.substring(0,1));
		if(l==0){
			return push.substring(1).replaceAll("0", " ");
		}
		while(index>keys[l].length){
			index-=keys[l].length;
		}
		return keys[l][index-1];
	}
}

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

primes = set()
for i in range(2,N+1):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)

len_prime = len(primes)
d = dict(zip(list(primes), [1 for i in range(len_prime)]))

for i in range(2, N+1):
    while i != 1:
        for p in primes:
            if i % p == 0:
                d[p]+= 1
                i //= p
res = 1
for i in d.values():
    res*=i
print(res % 1000000007)

Measured memory_bytes: 3064
N, A, B, C = map(int, input().split())
ls = [int(input()) for i in range(N)]

def dfs(cur, a, b, c):
  if cur==N:
    return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else 10**9
  ret0 = dfs(cur+1, a+ls[cur], b, c)+10
  ret1 = dfs(cur+1, a, b+ls[cur], c)+10
  ret2 = dfs(cur+1, a, b, c+ls[cur])+10
  ret3 = dfs(cur+1, a, b, c)
  return min(ret0, ret1, ret2, ret3)
print(dfs(0,0,0,0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair <int, int>
#define iiii pair <int, pii >
#define mp make_pair
#define INF 1000000000
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
  int x = 0, p = 1; char c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
const int mod = 1e9 + 7;
inline void reduce(int &x) { x += x >> 31 & mod; }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
//ruogu_alter
//
int main() {
  string s; cin >> s;
  rep(i, s.size()) if (s[i] == '?') s[i] = 'D';
  cout << s; return 0;
  int res = 0;
  rep(i, s.size()) {
    if (s[i] == 'D') {
      if (i && s[i - 1] == 'P') ++res;
      ++res;
    }
  }
  cout << res << endl;
  return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    int R, G;
    std::cin >> R >> G;

    std::cout << (2 * G - R) << std::endl;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

for _ in range(tx-sx):
    print('R', end = '')

for _ in range(ty-sy):
    print('U', end = '')

for _ in range(tx-sx):
    print('L', end = '')

for _ in range(ty-sy):
    print('D', end = '')

print('D', end = '')

for _ in range(tx-sx+1):
    print('R', end = '')

for _ in range(ty-sy+1):
    print('U', end = '')

print('LU', end='')

for _ in range(tx-sx+1):
    print('L', end = '')

for _ in range(ty-sy+1):
    print('D', end = '')

print('R')


Measured memory_bytes: 4468
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

class Restaurant{
 public:
    string name;
    int score;
    int index;
    bool operator<(const Restaurant& rhs) const
    {
        int comparison = this->name.compare(rhs.name);
        if(comparison == 0)
        {
            return this->score > rhs.score;
        }
        else
        {
            return comparison < 0 ? true : false;
        }
    }
};



int main(){
    std::ios::sync_with_stdio(false);
    int n, p;
    string s;
    cin >> n;
    vector<Restaurant> vr;
    for(int i=0;i<n;++i)
    {
        Restaurant r;
        cin >> s >> p;

        r.name = s;
        r.score = p;
        r.index = i + 1;
        vr.push_back(r);
    }

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

    for(int i=0;i<n;++i)
    {
        cout << vr[i].index << endl;
    }
}

Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;
#define int long long
const int N = (int) 5005, M = 205, mod = (int) 0;
int prof[N][M], pt[M], s[N], cur[N], cmx[M], mx[N][M];
int seg[N << 2], ch[N << 2];

void build(int v, int b, int e) {
    seg[v] = ch[v] = 0;
    if (e - b == 1) {
        return;
    }
    int m = b + e >> 1, l = v << 1, r = l | 1;
    build(l, b, m);
    build(r, m, e);
}


void update(int i, int j, int x, int v, int b, int e) {
    if (i >= e || b >= j) return;
    if (i <= b && e <= j) {
        ch[v] += x;
        seg[v] += x;
        return;
    }
    int m = b + e >> 1, l = v << 1, r = l | 1;
    update(i, j, x, l, b, m);
    update(i, j, x, r, m, e);
    seg[v] = max(seg[l], seg[r]) + ch[v];
}

int n, m;
int solve(int l, int r) {
    if (r - l == 1) {
        int res = 0;
        for (int j = 0; j < m; ++j)
            res += prof[l][j];
        return res;
    }
    int mid = l + r >> 1;
    int res = 0;
    res = max(res, solve(l, mid));
    res = max(res, solve(mid, r));
    for (int j = 0; j < m; ++j) {
        mx[mid - 1][j] = prof[mid - 1][j];
        pt[j] = mid - 1;
    }
    for (int j = mid - 2; j >= l; --j) {
        for (int i = 0; i < m; ++i) {
            mx[j][i] = max(mx[j + 1][i], prof[j][i]);
        }
    }
    build(1, l, mid);
    for (int j = l; j < mid; ++j) {
        cur[j] = s[j];
        for (int i = 0; i < m; ++i)
            cur[j] += mx[j][i];
        update(j, j + 1, cur[j], 1, l, mid);
    }
    memset(cmx, 0, sizeof cmx);
    
    for (int j = mid; j < r; ++j) {
        for (int i = 0; i < m; ++i) {
            if (prof[j][i] > cmx[i])
                update(pt[i] + 1, mid, prof[j][i] - cmx[i], 1, l, mid);
            cmx[i] = max(cmx[i], prof[j][i]);
            while (pt[i] >= l && cmx[i] >= mx[pt[i]][i]) {
                update(pt[i], pt[i] + 1, cmx[i] - mx[pt[i]][i], 1, l, mid);
                pt[i]--;
            }
        }
        res = max(res, -s[j] + seg[1]);
    }
    return res;
}

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int j = 0; j < n - 1; ++j) cin >> s[j + 1], s[j + 1] += s[j];
    for (int j = 0; j < n; ++j)
        for (int i = 0; i < m; ++i)
            cin >> prof[j][i];
    cout << solve(0, n) << endl;

}


Measured memory_bytes: 16512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>

using namespace std;

int main(){
    int a[5];
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    int t[5];
    for(int i = 0; i < 5; i++){
        if(a[i] % 10 != 0){
            t[i] = 10 - a[i] % 10;
        }else{
            t[i] = 0;
        }
    }
    int sum = 0;
    for(int i = 0; i < 5; i++){
        sum += a[i];
    }
    sort(t, t + 5);
    int sumt = 0;
    for(int i = 0; i < 4; i++){
        sumt += t[i];
    }
    cout << sum + sumt;
}


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

int main() {
  int N = 1;
  cin >> N;
  int V[N], C[N], Z[N], k;
  int total = 0;
  
  for (k = 0; k < N; k++)
    cin >> V[k];
  
  for (k = 0; k < N; k++)
    cin >> C[k];
  
  for (k = 0; k < N; k++)
    Z[k] = V[k] - C[k]; //各宝石のX-Yを計算した。
  
  for (k = 0; k < N; k++) {
    if (Z[k] > 0)
      total += Z[k];
  }
  cout << total;
  return 0;
}

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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N; cin >> N;
    map<string,int> mp;
    while(N--){
        string S; cin >> S;
        mp[S]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}

int main(){
    ll n,a,b; cin>>n>>a>>b;
    ll x=n/(a+b);
    if(x*(a+b)==n){
        cout<<x*a;
        
    }
    else{
        ll y=n-x*(a+b);
        if(y>a)
            cout<<x*a+a;
        else 
        cout<<x*a+y;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int solve(int N)
{
    int ans = 0;
    do
    {
        ans += (N % 10);
        N /= 10;
    } while (N);
    return ans == 1 ? 10 : ans;
}

int main()
{

    int N, resposta;
    scanf("%d", &N);
    resposta = solve(N);
    printf("%d", resposta);

    return 0;
}

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


signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    int n, m;
    cin >> m >> n;
    vector<string> S(m);
    for (auto &s: S) cin >> s;
    int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

    for (int i = 0; i < m; i++){
        for (int j = 0; j < n; j++){
            if (S[i][j] == 'x'){
                for (auto &x: dx){
                    for (auto &y: dy){
                        int ny = i + y;
                        int nx = j + x;
                        if (ny < 0 or nx < 0 or ny >= m or nx >= n)
                            continue;
                        if (S[ny][nx] != '-')
                            continue;
                        S[ny][nx] = '0';
                    }
                }
            }
            else if (S[i][j] == 'o'){
                if (j - 1 >= 0)
                    S[i][j - 1] = '0';
                if (j + 1 < n and S[i][j + 1] == '-')
                    S[i][j + 1] = '0';
            }
        }
    }

    int ans = 0;
    for (int i = 1; i < m; i++){
        for (auto &t: S[i]){
            if (t == '-')
                ans++;
        }
    }

    cout << ans << endl;
}


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int N, K;
int ans;

void solve() {
    cin >> N >> K;
    vector<int> a(N);
	for (auto& i : a) {
		cin >> i;
		ans += (i >= K);
	}
	cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

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

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

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

// GCC __gcd(long long A, long long B)

ll gcd(ll a, ll b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}


int main() {
  int N, M, A[SIZE];

  scanf("%d%d", &N, &M);

  ll g = 1;

  for (int i=0; i<N; i++)
    scanf("%d", A+i);

  for (int i=0; i<N; i++) {
    g = lcm(g, A[i]);
    if (M * 2 < g) {
      puts("0");
      return 0;
    }
  }

  bool ok = true;

  for (int i=0; i<N; i++) {
    debug(g / A[i]);
    ok &= g / A[i] % 2;
  }

  debug(ok);

  int t = 2 * M / g;

  if (ok) {
    cout << (t + 1) / 2 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 640