akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdio.h>
#define MAX_V  1000000
int prime[MAX_V+1];
int a[MAX_V];
int n,count=0,k=0;

int main(void)
{
  int i, k, v;
  for(i = 2; i <= MAX_V; i++)
    prime[i] = 1;

  for(i = 2; i*i <= MAX_V; i++)
    if(prime[i])
      for(k = 2 * i; k <= MAX_V; k += i)
        prime[k] = 0;

  for (int i = 1; i < MAX_V; i++)
    prime[i] = prime[i] + prime[i-1];

  while(scanf("%d",&n)!=EOF)
    printf("%d\n",prime[n]);
}

Measured memory_bytes: 5692
#include <stdio.h>

class Dice4{
public:
	int number[6];

	void roll(char dst){
		switch(dst){
		case 'E':
			setNumber(number[3],number[1],number[0],number[5],number[4],number[2]);
			break;
		case 'N':
			setNumber(number[1],number[5],number[2],number[3],number[0],number[4]);
			break;
		case 'S':
			setNumber(number[4],number[0],number[2],number[3],number[5],number[1]);
			break;
		case 'W':
			setNumber(number[2],number[1],number[5],number[0],number[4],number[3]);
			break;
		}
	};

	bool isSameDice(int inputed[]){
		char order[25] = "NNNNWNNNWNNNENNNENNNWNNN";
		for(int i = 0; i < 24; i++){
			roll(order[i]);
			for(int j = 0; j < 6; j++){
				if(inputed[j] != number[j])
					break;
				if(j == 5)
					return true;
			}
		}
		return false;
	}

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

};

int main(){
	int n,k,j;
	scanf("%d",&n);
	Dice4 array[n];
	for(int i = 0; i < n; i++){
		scanf("%d %d %d %d %d %d",&array[i].number[0],&array[i].number[1],&array[i].number[2],
				&array[i].number[3],&array[i].number[4],&array[i].number[5]);
	}
	for(k = 0; k < n-1; k++){
		for(j = k+1; j < n; j++){
			if(array[k].isSameDice(array[j].number))
				break;
		}
		if(j < n) break;
	}
	if(k == n-1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}


Measured memory_bytes: 2624
//2018-6-5
//miaowey
//
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)

#define N (600 + 5)

struct node{int a, b;};
vector<node> ans[4];

bool vis[2][N][N];
int n, nn, t1, t2, t3, t4, d[2], col[2][N][N];

void Dfs(int x, int y, int o, int c){
	if(x > nn || y > nn || x < 0 || y < 0 || col[o][x][y]) return;
	vis[o][x][y] = true; col[o][x][y] = 3 - c;

	int a = -1;
	while(true){
		++a;
		if(a * a > d[o]) return;

		int b = sqrt(d[o] - a * a);
		if(a * a + b * b != d[o]) continue;
		
		Dfs(x + a, y + b, o, 3 - c); Dfs(x + a, y - b, o, 3 - c);
		Dfs(x - a, y - b, o, 3 - c); Dfs(x - a, y + b, o, 3 - c);
	}
}

void Print(int o){
	For(i, 0, n * n - 1) printf("%d %d\n", ans[o][i].a, ans[o][i].b);	
}

int main(){
	scanf("%d%d%d", &n, &d[0], &d[1]);

	nn = (n << 1) - 1;
	For(i, 0, nn) For(j, 0, nn) if(!vis[0][i][j]) Dfs(i, j, 0, 2);
	For(i, 0, nn) For(j, 0, nn) if(!vis[1][i][j]) Dfs(i, j, 1, 2);
	
	For(i, 0, nn) For(j, 0, nn){
		node o = (node){i, j};

		if(col[0][i][j] == 1){
			if(col[1][i][j] == 1) ans[0].pb(o); else ans[1].pb(o);
		}else{
			if(col[1][i][j] == 2) ans[2].pb(o); else ans[3].pb(o);
		}
	}

	if((int)ans[0].size() >= n * n) Print(0);
	else if((int)ans[1].size() >= n * n) Print(1);
	else if((int)ans[2].size() >= n * n) Print(2);
	else Print(3);
	
	return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);

int main(void)
{
    IOS
    int n, k;
    cin >> n >> k;

    double ans = 0;

    for(int i = 1 ; i <= n; i++) {
        double coin;
        if (i < k){
            coin = ceil(log2( (double) k/i));
        } else {
            ans += 1.0 / n;
            continue;
        }
        //cerr << fixed << setprecision(11)<< coin << endl;
        double d = 1.0 / n / pow(2,coin);
        //cerr << "0." << setfill('0') << setw(12) << d << endl;
        //cerr << d << endl;
        ans += d;
    }
    
    cout << fixed << setprecision(11) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#include <cassert>
#include <chrono>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void solve() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r/d - (l-1)/d << "\n";
}

int main() {
    #ifdef LOCAL
    auto t1 = std::chrono::high_resolution_clock::now();
    #endif

    io;
    int t = 1;
    tc(t) {
        solve();
    }

    #ifdef LOCAL
    auto t2 = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();

    std::cout << "Time Taken: " << duration << "\n";
    #endif

}
//check for edge cases in limits
//printing double may print 1.223232e9 like values, beware of that


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

using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define ff first
#define ss second
#define pb push_back

const int N = 100005;

int main(){
	ll n, p;
	scanf("%lld %lld", &n, &p);
	map<ll, int> fat;
	ll div = 2;
	ll lim = sqrt(p);
	while(p > 1 && div <= lim){
		while(p % div == 0){
			p /= div;
			fat[div]++;
		}
		div++;
	}
	if(p != 1){
		fat[p]++;
	}
	ll ans = 1;
	for(auto i : fat){
		ll x = i.ss / n;
		while(x){
			ans *= i.ff;
			x--;
		}
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 764
#include<stdio.h>


main()
{
    int a,b,c,d,ar1,ar2;
    scanf("%d %d %d %d",&a,&b,&c,&d);

    ar1=a*b;
    ar2=c*d;

    if(ar1>ar2 || ar1==ar2)
        printf("%d",ar1);
    else if(ar1<ar2)
        printf("%d",ar2);

return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <climits>
#include <cmath>
#include <algorithm>
#include <cassert>

#define TEST_ASSERT(msg, cond) do { if (cond) { cout << msg << " => pass" << endl;} else { cout << msg << " => failed" << endl;} } while(0)

using namespace std;

int main() {

  long long X,Y;
  cin >> X >> Y;

  int cnt = 0;
  long long n = X;
  while (n <= Y) {
    n *= 2;
    cnt++;
  }
  cout << cnt << endl;

  return 0;
}

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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    i64 a = 0, b = 1;
    for(int i=0;i<n;++i){
        i64 q, x;
        cin >> q >> x;
        if(q == 1){
            a *= x;
            b *= x;
        }else if(q == 2) a -= x;
        else a += x;
    }

    cout << a << " " << b << endl;

    return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

ll MAX =  55555;
int main() {
  ll N;
  cin >> N;
  vector<ll> primes;
  bool isPrime[MAX + 1];
  isPrime[0] = false;
  isPrime[1] = false;
  for (ll i = 2; i <= MAX; i++) {
    isPrime[i] = true;
  }
  for (ll i = 2; i <= sqrt(MAX); i++) {
    if (isPrime[i]) {
      // cout << i << endl;
      for (ll j = i*2; j <= MAX; j += i) {
        isPrime[j] = false;
      }
    }
  }

  for (ll i = 0; i <= MAX; i++) {
    if (isPrime[i]) {
      primes.push_back(i);
    }
  }

  vector<ll> ans;
  for (ll i = 0; i < (ll)primes.size(); i++) {
    ll p = primes[i];
    if (p % 5 == 1) {
      ans.push_back(p);

      if ((ll)ans.size() == N) {
        break;
      }
    }
  }

  for (ll i = 0; i < N; i++) {
    if (i == N - 1) {
      cout << ans[i] << endl;
    } else {
      cout << ans[i] << ' ';
    }
  }

  return 0;
}


Measured memory_bytes: 384
/*
[dp] P - Independent Set
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

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

int N;
int x[MAX_N], y[MAX_N];
vector<int> g[MAX_N];
bool visited[MAX_N];

pll dfs(int v) {
    if (visited[v]) {
        return {-1, -1};
    }
    visited[v] = true;

    pll ret = {1, 1};
    for (int to : g[v]) {
        pll p = dfs(to);
        if (p == pll{-1, -1}) {
            continue;
        }
        (ret.first *= ((p.first + p.second) % MOD)) %= MOD;
        (ret.second *= (p.first)) %= MOD;
    }

    return ret;
}

ll solve() {
    for (int i = 0; i < N - 1; i++) {
        g[x[i]].push_back(y[i]);
        g[y[i]].push_back(x[i]);
    }

    pll ans = dfs(0);
    return (ans.first + ans.second) % MOD;
}

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
#define task "atcoder"
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define BIT(x, i) (((x) >> (i)) & 1)
#define lb lower_bound
#define ub upper_bound
#define lla(v) (v).begin(),(v).end()
#define zs(v) int((v).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ar array
#define endl '\n'
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1000000007; /// 998244353
const int base=311;
const int N=1e5+5;

void solved()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int &i:a) cin>>i;
    ll ans=0;
    for(int i=1;i<n;++i)
        if(a[i]<a[i-1]) ans+=a[i-1]-a[i],a[i]=a[i-1];
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    solved();
}










Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll h,w;cin >> h >>w;
    vvl v(10,vl(10));
    rep(i,10){
        rep(j,10){
            cin >> v[i][j];
        }
    }
    vl cost(10);
    rep(i,10)cost[i]=v[i][1];
    vector<bool> check(10,false);
    rep(i,10){
        ll mini=inf;
        ll index;
        rep(j,10){
            if(check[j]==false){
                mini=min(mini,cost[j]);
                if(mini==cost[j])index=j;
            }
        }
        rep(j,10){
            cost[j]=min(mini+v[j][index],cost[j]);
        }
        check[index]=true;
    }
    ll ans=0;
    rep(i,w*h){
        ll a;cin>>a;
        if(a!=-1)ans+=cost[a];
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
// -- Nitin
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define llu unsigned long long int
#define ll long long
#define ld long double
#define foi(a,n) for(int i = a; i < (int)n; i++)
#define foj(a,n) for(int j = a; j < (int)n; j++)
#define foin(a,n) for(int i = n; i >= a; i--)
#define fojn(a,n) for(int j = n; j >= a; j--)
#define bug(x) cerr << #x << " is " << x << endl;
#define isp2(x) x&&(!(x&(x-1)))
#define ln '\n'
#define ee 1000000007
#define eem 998244353
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define cases int tests; cin >> tests; while(tests--)

using namespace std;

ll fast(ll n,ll k){
    ll res = 1;
    n = n;
    while(k > 0){
        if ((k&1) == 1)
            res = (res * n);
        k = k>>1;
        n = (n * n);
    }
    return res;
}
 
//~ ll strsum(string s){
    //~ ll sm = 0, r = s.size();
    //~ foi(0,r)    sm += int(s[i]-'a');
    //~ return sm;
//~ }
 
//~ set <ll, greater <ll> > ss; //Prime Factors
//~ void pF(ll n)  {    
    //~ while (n % 2 == 0)  {  
        //~ ss.insert(2);  
        //~ n = n/2;  
    //~ }  
    //~ for (int i = 3; i <= sqrt(n); i = i + 2)  {   
        //~ while (n % i == 0)  {  
            //~ ss.insert(i); 
            //~ n = n/i;  
        //~ }  
    //~ }    
    //~ if (n > 2)  ss.insert(n);  
//~ }

//~ ll pre[1001][1001];

//~ ll go(ll n, ll k){
	//~ if(n==1) return 1;
	//~ else {
		//~ pre[n][k] = (go(n - 1, k) + k - 1) % n + 1;
		//~ return pre[n][k];
	//~ }
//~ }

//~ int dp[1002][1002];
//~ bool pal(string s){
	//~ for(int i = 0, j = s.size() - 1; i < s.size(); i++, j--){
		//~ if(s[i] != s[j]) return 0;
	//~ }
	//~ return 1;
//~ }

//~ void solve(){
	//~ int n;
	//~ cin >> n;		
//~ }


void go(){
	ll x, k, d;
	cin >> x >> k >> d;
	ll val = abs(x);
	val = (val)%d;
	x = abs(x);
	if(val == 0 && x/d <= k && (x/d + k)%2 == 0){
		cout << 0;
		return;
	}
	if(val == 0 && x/d <= k){
		cout << d;
		return;
	}
	if(val == 0 && x/d > k){
		cout << abs(x - k*d);
		return;
	}
	if(x/d < 1){
		d -= x;
		if(k % 2 == 0) cout << x;
		else cout << d;
		return;
	}
	if(x/d < k){
		if((x/d+k)%2 == 0) cout << val;
		else cout << d - val;
		return;
	}
	cout << abs(x - k*d);
	return;
}

int main(){
    fio;
	//~ ll q, n, x, m , y;
	//~ string t;
	//~ for(int i = 1; i <= 1000; i++){
		//~ pre[1][i]=1;
		//~ go(1000,i);
	//~ }
	ll n, m, k;
    //~ cases
    {	
		go();
		cout << "\n";
	}
}
       
        


Measured memory_bytes: 3652
import java.util.*;
import java.io.*;
public class Main {
	static int n = 0;
	
	public static void bubble_sort(int[] a) {
		int swapCount = 0;
		for (int i = 0; i < n; i++) {
			
			// search for unsorted pairs from the back
			for (int j = n-1; j > i; j--) {
				if (a[j] < a[j-1]) {
					
					// swap a[j], a[j-1]
					int tmp = a[j];
					a[j] = a[j-1];
					a[j-1] = tmp;
					
					// increase swapCount
					swapCount++;
				}
			}
			
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		
		// print swapCount on a new line
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		bubble_sort(a);
	}
}

Measured memory_bytes: 19096
import sys
a,b,k = map(int,input().split())
c = 0
if a > b:    
    for i in range(b,0,-1):
        if (b%i == 0) and (a%i == 0):
            c += 1
            if c == k:
                print(i)
                sys.exit()
else:
    for i in range(a,0,-1):
        if (b%i == 0) and (a%i == 0):
            c += 1
            if c == k:
                print(i)
                sys.exit()

Measured memory_bytes: 3064
#pragma GCC optimize "O3"
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#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>
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define REP_FROM(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define REP_REV(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define REP_FROMREV(i,m,n) for (int i = (n)-1; (i) >= int(m); --(i))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#ifndef LOCAL
#define cerr if (false) cerr
#endif
using namespace std;
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();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <class T> inline void setmin(T & a, T const & b) { a = min(a, b); }
template <class T> T sq(T x) { return x * x; }
template <class T> T clamp(T a, T l, T r) { return min(max(a, l), r); } // [l, r]
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(int argc, char *argv[]) {
	// Something to do
	priority_queue<int> pq;
	REP(i, 10) {
		int height;
		cin >> height;
		pq.push(height);
	}
	REP(i, 3) {
		cout << pq.top() << endl;
		pq.pop();
	}
	return 0;
}

Measured memory_bytes: 3128
// CppPractice.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int n, a[1000], b[1000], c[1000];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
	for (int i = 0; i < n - 1; i++)
	{
		cin >> c[i];
	}

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += b[a[i] - 1];
		if (i != n - 1) {
			//cout << i << endl;
			if (a[i] + 1 == a[i + 1]) ans += c[a[i] - 1];
		}
	}
	
	cout << ans << endl;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
#define mp make_pair
#define pb push_back
#define se second
#define fi first
#define N 100007
ll a[200007];
//string a, b;
//ll dp[200007];
vector<ll> v[200007];
ll vis[200007];
ll cnt=0, ans=0, maxi=-1, m;

void dfs(ll node, ll cnt, ll maxi) {
    vis[node]=1;
    if(a[node]>0) cnt++;
    else cnt=0;
    maxi=max(maxi,cnt);
    if(v[node].size()==1 && node!=1) {
        if(maxi<=m) ans++;
        //maxi=-1;
        //return;
    }  
    for(int i=0;i<v[node].size();i++) {
        if(!vis[v[node][i]]) {
            dfs(v[node][i], cnt, maxi);
        }
    }
}
 
void solve() {
    ll i, j, k, l, test, n, q, x, y, z;
    cin>>n;
    if(n>=30) cout<<"Yes\n";
    else cout<<"No\n";
}
int main() { 
    #ifndef ONLINE_JUDGE
        freopen("input1.txt", "r", stdin);
        freopen("output1.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0; 
}


Measured memory_bytes: 8340
#include<cstdio>
using namespace std;
int main()
{
    int n,x,y,ans=0;
    scanf("%d\n",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d\n",&x,&y);
        ans+=y-x+1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		char[] N = sc.next().toCharArray();
		String ans = "Yes";
		int d = 0;
		for (int i = 0; i < N.length; i++) {
			d += Character.getNumericValue(N[i]);
		}
		if (Integer.parseInt(new String(N)) % d != 0) ans = "No";
		System.out.println(ans);
	}



	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

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: 21204
#include <cstdio>

int main()
{
	int h, n;
	scanf("%d%d", &h, &n);
	int sum = 0;
	for (int i = 0; i < n; ++i)
	{
		int a;
		scanf("%d", &a);
		sum += a;
	}
	puts(sum >= h ? "Yes" : "No");
	return 0;
}


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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define sz(x)          (int) x.size()
#define MOD 1000000007
#define EPS 1e-7


typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    ll n, a, b; cin>>n>>a>>b;
    ll cnt = 1, sum;
    cnt = n/(a+b) + (n%(a+b)!=0);
    sum  = (cnt-1) * a;
    n -= (cnt-1)*(a+b);
    sum += min(n, a);
    cout<<sum;
	return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
l = len(S)
right = True
dic = {}
for i in range(l):
    if T[i] not in dic:
        dic[T[i]] = set()
    dic[T[i]].add(S[i])
for key, st in dic.items():
    if len(st) > 1:
        right = False
dic = {}
for i in range(l):
    if S[i] not in dic:
        dic[S[i]] = set()
    dic[S[i]].add(T[i])
for key, st in dic.items():
    if len(st) > 1:
        right = False
print("Yes" if right else "No")

Measured memory_bytes: 3632
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  std::cin>>s;
  int i=0;
  for(i=0;i<s.size();i++)
  {
    if(s[i]=='U'||s[i]=='D')
      continue;
    if(i%2==0&&s[i]!='R')
    {
        std::cout<<"No";
        return 0;
    }
    if(i%2!=0&&s[i]!='L')
    {
        std::cout<<"No";
      return 0;
    }
  }
  std::cout<<"Yes";
  return 0;
}
      

Measured memory_bytes: 256
fun main(args: Array<String>) {
	val (n, m) = (readLine() ?: return).split(" ").map { it.toInt() }.toIntArray()
	val a = (readLine() ?: return).split(" ").map { it.toInt() }.sorted()
	val input = Array(m) { (readLine() ?: return).split(" ").map { it.toInt() }.toIntArray() }
	val index = input.withIndex().sortedByDescending { it.value[1] }.map { it.index }.toIntArray()
	var count = 0L
	var id = 0
	loop@ for (i in index) {
		for (j in 0 until input[i][0]) {
			if (id >= n) {
				println(count)
				return
			}
			if (a[id] < input[i][1]) {
				count += input[i][1]
				id++
			} else break@loop
		}
	}
	for (i in id until n) count += a[i]
	println(count)
}

Measured memory_bytes: 86368
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> p;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n, m;
  cin >> n >> m;
  bool d1[200010], d2[200010];
  rep(i, 200010) d1[i] = 0, d2[i] = 0;

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    if(a == 1) d1[b] = true;
    if(b == n) d2[a] = true;
  }
  bool ans = false;
  rep(i, 200010) if(d1[i] && d2[i]) ans = true; 

  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<char> ans;

    //　数字と文字の対応表　a = 0 ~ z = 25
    char alpabet[26];
    char temp = 'a';
    for(int i = 0; i < 26; ++i) {
        alpabet[i] = temp;
        temp++;
    }

    ll amari = 0;
    ll syou = 0;
    while(n != 0) {
        n = n - 1;
        amari = n % 26;
        syou = n / 26;
        n = n / 26;
        ans.push_back(alpabet[amari]);
    }

    for(int i = ans.size() - 1; i >= 0; --i) {
        cout << ans[i];
    }
    cout << endl;
}

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

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll x = c - a - b;
    if(x < 0){
        cout << "No";
        return 0;
    }
    if(4*a*b < x*x){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
 int W,H,x,y,r;

 scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
 
 if( x-r < 0 || x+r > W || y-r < 0 || y+r > H ){
   printf("No\n");
 }else{
   printf("Yes\n");
 }

 return 0;
}

Measured memory_bytes: 1812
#include<cstdio>

int b[200];
int c[200];
int steps[200];

int main(void) {
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++) {
        int bb;
        scanf("%d",&c[i]);
        b[i] = i-c[i]+1;
    }

    for(int i=0; i<n; i++) {
        int j;
        for(j=n-1; j>=0; j--)
            if(b[j] == 0) break;
        if(j == -1) {
            printf("-1\n");
            return 0;
        }
        steps[i] = c[j];
        for(; j<n; j++)
            b[j]--;

    }
    for(int i=0; i<n; i++)
        printf("%d\n", steps[n-1-i]);
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<utility>
#include<cctype>
using namespace std;



int main(void)
{
  char s[10];
  int ans=0;
  cin>>s;
  for(int i=0;i<4;i++){
    if(s[i]=='+'){
      ans++;
    }
    else{
      ans--;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = IR(n)
LIS = deque([A[0]])
for i in range(1, n):
    if A[i] <= LIS[0]:
        LIS.appendleft(A[i])
    else:
        LIS[bisect_left(LIS, A[i]) - 1] = A[i]


print(len(LIS))



Measured memory_bytes: 46172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetLongNum();
            var str = "zabcdefghijklmnopqrstuvwxyz";
            var a = N / 26;
            var b = N % 26;
            var ans = string.Empty;

            while (true)
            {
                ans = str[(int)b].ToString() + ans;
                if (b == 0)
                {
                    a = a - 1;
                }
                if (1 <= a && a <= 26)
                {
                    ans = str[(int)a].ToString() + ans;
                    break;
                }
                else if (a == 0)
                {
                    break;
                }

                b = a % 26;
                a = a / 26;
            }
            Console.WriteLine(ans);
        }

        private static long[] GetLongNumArray()
        {
            var input = Console.ReadLine().Split(' ');
            return input.Select(x => long.Parse(x)).ToArray();
        }

        private static long GetLongNum()
        {
            return long.Parse(Console.ReadLine());
        }

        private static string[] GetStringArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static string GetString()
        {
            return Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27504
n,u,v=map(int,input().split())
u,v=u-1,v-1
e=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(lambda x:int(x)-1,input().split())
  e[a].append(b)
  e[b].append(a)

mt=[-1 for i in range(n)]
de=[-1 for i in range(n)]
dpl=[]
s=[v]
t=0
while s:
  dpl.append([])
  ns=[]
  for i in s:
    de[i]=t
    dpl[-1].append(i)
    for j in e[i]:
      if de[j]!=-1:
        continue
      ns.append(j)
      mt[j]=i
  s=ns
  t+=1

maxd=[de[i] for i in range(n)]
for i in dpl[:0:-1]:
  for j in i:
    maxd[mt[j]]=max(maxd[mt[j]],maxd[j])

t=de[u]//2+1
while de[u]!=t:
  u=mt[u]
print(maxd[u]-1)

Measured memory_bytes: 104872
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, K = list(map(int, sys.stdin.buffer.readline().split()))
ans = 0
while N > 0:
    ans += 1
    N //=K
print(ans)


Measured memory_bytes: 25692
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
using namespace std;
pii pos1[100], pos2[100];

int dist(pii p1, pii p2){
	return abs(p1.x-p2.x) + abs(p1.y-p2.y);
}
int main() {
	// your code goes here
	string O,E;
	cin>>O>>E;
	int olen = O.length(), elen = E.length();
	int oddPos=0, evenPos = 0;
	for(int iter=0;iter<olen+elen;iter++){
		if(iter&1){
			printf("%c",E[evenPos++]);
		}
		else printf("%c",O[oddPos++]);
	}
	
	printf("\n");
	return 0;
}

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

int main()
{
    ll s;
    cin >> s;
    if(s == 1000000000000000000){
        cout << 0 << " " << 0 << " " << 1000000000 << " " << 0 << " " << 0 << " " << 1000000000 << endl;
        return 0;
    }
    ll x1 = 1000000000;
    ll y2 = s / x1 + 1;
    ll x2 = x1 * y2 - s;
    ll y1 = 1;
    cout << 0 << " " << 0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
}

Measured memory_bytes: 256
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
using namespace std;

void test() {
    int n;
    cin >> n;
    int cur = 0;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        if (x == y) {
            ++cur;
            if (cur == 3) {
                cout << "Yes\n";
                return;
            }
        } else {
            cur = 0;
        }
    }
    cout << "No\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    return 0;
}


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

int main(){
long long n,t,a;
string s,s1;
cin>>s>>s1;
n=1;
for(int i=0;i<s.length();i++){
    if(s[i]!=s1[i]){n=0;break;}
}
if(n==1)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}


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

using namespace std;

class minCostFlow
{
    using type = int;
    using pii = std::pair<int, int>;
    const int INF = 1e9;
    struct Edge
    {
        type to, cap, cost, rev;
        Edge(type to_, type cap_, type cost_, type rev_)
            : to(to_), cap(cap_), cost(cost_), rev(rev_) {}
    };
    int V;
    std::vector<std::vector<Edge>> G;
    // ポテンシャル
    std::vector<int> h;
    // 最短距離
    std::vector<int> dist;
    // 直前の頂点, 辺
    std::vector<int> prevv, preve;

  public:
    minCostFlow(int _V) : V(_V), G(_V), h(_V), dist(_V), prevv(_V), preve(_V) {}
    void add(int from, int to, int cap, int cost)
    {
        G[from].push_back(Edge(to, cap, cost, G[to].size()));
        G[to].push_back(Edge(from, 0, -cost, G[from].size() - 1));
    }
    int calc(int s, int t, int f)
    {
        int res = 0;
        fill(h.begin(), h.end(), 0);
        while (f > 0)
        {
            std::priority_queue<pii, std::vector<pii>, std::greater<pii>> que;
            fill(dist.begin(), dist.end(), INF);
            dist[s] = 0;
            que.push(pii(0, s));
            while (!que.empty())
            {
                pii p = que.top();
                que.pop();
                int v = p.second;
                if (dist[v] < p.first)
                    continue;
                for (size_t i = 0; i < G[v].size(); i++)
                {
                    Edge &e = G[v][i];
                    if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to])
                    {
                        dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
                        prevv[e.to] = v;
                        preve[e.to] = i;
                        que.push(pii(dist[e.to], e.to));
                    }
                }
            }
            if (dist[t] == INF)
                return -1;
            for (int v = 0; v < V; v++)
                h[v] += dist[v];
            int d = f;
            for (int v = t; v != s; v = prevv[v])
            {
                d = std::min(d, G[prevv[v]][preve[v]].cap);
            }
            f -= d;
            res += d * h[t];
            for (int v = t; v != s; v = prevv[v])
            {
                Edge &e = G[prevv[v]][preve[v]];
                e.cap -= d;
                G[v][e.rev].cap += d;
            }
        }
        return res;
    }
};

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

    int V, E, F;
    cin >> V >> E >> F;
    minCostFlow mcf(V);
    while (E--)
    {
        int st, gt, cap, d;
        cin >> st >> gt >> cap >> d;
        mcf.add(st, gt, cap, d);
    }
    cout << mcf.calc(0, V - 1, F) << endl;
}



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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}


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

  int n; cin >> n;
  if(n == 1) {
    cout << 1 << endl;
    return 0;
  }
  map<pair<ll, ll>, int> mp;
  vll x(n), y(n);
  for(int i=0;i<n;++i) {
    cin >> x[i] >> y[i];
  }
  for(int i=0;i<n;++i) {
    for(int j=0;j<n;++j) {
      if(i == j) continue;
      mp[{x[i] - x[j], y[i] - y[j]}]++;
    }
  }

  int ans = INF;
  for(auto &e: mp) {
    ans = min(ans, n - e.second);
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
using namespace std;
int a[10];
int l[]={3,5,7};
int c[3]={0,0,0};
int wnu(int n,int &cnt,int p,int i=0){
    if(i==p){
        if(c[0]*c[1]*c[2]==0)return 0;
        int N=0;
        for(int j=0;j<p;j++){
            N*=10;
            N+=a[j];
        }
        if(N<=n)cnt++;
        else return 4;
        return 1;
    }
    for(int j=0;j<3;j++){
        a[i]=l[j];
        c[j]++;
        if(wnu(n,cnt,p,i+1)==4)return 4;
        c[j]--;
    }
    return 2;
}

int main(){
    int n;
    cin>>n;
    int cnt=0;
    for(int i=3;i<10;i++)
        if(wnu(n,cnt,i)==4)break;
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

//ここからAtCoder向けdefine
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 632
import scala.io.StdIn._
import scala.annotation.tailrec
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = (n - 3) / 2 + 1
    private[this] val (cmpsts, sqrtLmtNdx) = (new Array[Int]((top >>> 5) + 1), (Math.sqrt(n).toInt - 3) / 2)

    def isCmpst(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) != 0
    def setCmpst(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    @tailrec
    private def cull(cmpstId: Int, p: Int): Unit = {
      if(cmpstId <= top){
        setCmpst(cmpstId)
        cull(cmpstId + p, p)
      }
    }

    @tailrec
    private def get(cndId: Int): Unit = {
      if(cndId <= sqrtLmtNdx){
        if(!isCmpst(cndId)){
          val p = 2 * cndId + 3
          cull((p * p - 3) >>> 1, p)
        }
        get(cndId + 1)
      }
    }

    @tailrec
    private def next(cndId: Int): Int =
      if ((cndId > top) || !isCmpst(cndId)) 2 * cndId + 3 else next(cndId + 1)

    def exec: Iterator[Int] = {
      get(0)
      Iterator.single(2) ++ Iterator.iterate(3)(p => next((p - 1) >>> 1)).takeWhile(_ <= n)
    }
  }

  @tailrec
  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

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

int main(void) {
  int N, D;
  cin >> N >> D;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    double p, q;
    cin >> p >> q;
    if (sqrt(p * p + q * q) <= D) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

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

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  vector<int> left(N + 1, 0), right(N + 1, 0);
  for (int i = 0; i < N; ++i){
    left[i + 1] = gcd(left[i], a[i]);
  }
  for (int i = N - 1; i >= 0; --i){
    right[i] = gcd(right[i + 1], a[i]);
  }
  int ans = 0;
  for (int i = 0; i < N; ++i){
    ans = max(ans, gcd(left[i], right[i + 1]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<map>
#include<queue>
#include<iterator>
#include<set>
#include<vector>
using namespace std;
#define  M 100050
#define LL long long
#define Max 260 * 260
LL a[Max], b[Max], c[Max], ans[Max];

LL gcd(LL a,LL b){
	return b?gcd(b,a%b):a;
}

int main ()
{
	int n, i, j, k;
	LL len;
	while (scanf ("%d", &n) == 1)
	{
		if (n == 0) break;
		j = 0; k = 0;
		for (i = 0;i < (n + 1) * n / 2;i ++)
		{
			scanf ("%lld", &a[i]);
			if (a[i] % 2 == 0)
				b[j ++] = a[i];
			else c[k ++] = a[i];
		}

		sort (b, b + j);
		sort (c, c + k);

		LL temp = (LL)(sqrt ((b[0]*1.0) / c[0] * (b[1]*1.0)) + 0.001);

		printf ("%lld\n", temp);
		printf ("%lld", b[0] / temp);
		for (i = 1;i < n;i ++)
			printf (" %lld", b[i] / temp);
		printf ("\n");
	}
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


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

    int k;
    cin >> k;
    int h=k/2;
    int ans=h*(k-h);
    cout << ans << endl; 

    return 0; 
}


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

#define ll long long

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

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

	swap(a, b);
	swap(a, c);

	cout << a << ' ' << b << ' ' << c;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

int main()
{
    char a[4];

    while(scanf("%s",a) != EOF)
    {
        getchar();
        if(a[0] == a[1] && a[0] == a[2])
            printf("Yes\n");
        else if(a[1] == a[2] && a[1] == a[3])
            printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}




Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap.Strict    as M
import qualified Data.Sequence         as S

readi :: B.ByteString -> Int
readi bs | Just (n, _) <- B.readInt bs = n

data Tree a
    = Empty
    | Node a (Tree a) (Tree a)
    deriving Show

insert :: Ord a => a -> Tree a -> Tree a
insert x Empty = Node x Empty Empty
insert x (Node y l r)
    | x < y     = Node y (insert x l) r
    | otherwise = Node y l (insert x r)

preOrder :: Tree a -> [a]
preOrder Empty = []
preOrder (Node x l r) = x : preOrder l ++ preOrder r

inOrder :: Tree a -> [a]
inOrder Empty = []
inOrder (Node x l r) = inOrder l ++ [x] ++ inOrder r

solve :: Tree Int -> [[B.ByteString]] -> IO ()
solve _ [] = return ()
solve !t (bs:bss)
    | length bs == 1 = do
        putStrLn . (' ':) . unwords $ fmap show (inOrder t)
        putStrLn . (' ':) . unwords $ fmap show (preOrder t)
        solve t bss
    | otherwise =
        let [_, n] = bs
         in solve (insert (readi n) t) bss

main :: IO ()
main = do
    B.getLine
    xss <- fmap B.words . B.lines <$> B.getContents
    solve Empty xss



Measured memory_bytes: 106092
N = int(input())
A, B = list(map(int, input().split()))
P = [int(i) for i in input().split()]

m1, m2, m3 = 0,0,0
for p in P:
    if p <= A:
        m1 += 1
    elif p <= B:
        m2 += 1
    else:
        m3 += 1
print(min(m1, m2, m3))

Measured memory_bytes: 3064