akhauriyash/Code-Regression huggingface dataset:
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e5+69, INF=2e9+6969;

int x,y,a,b,c;
int p[R],q[R],r[R];

int main()
{
	scanf("%d%d%d%d%d", &x, &y, &a, &b, &c);
	p[0]=q[0]=INF;
	for(int i=1;i<=a;++i) scanf("%d", &p[i]);
	for(int i=1;i<=b;++i) scanf("%d", &q[i]);
	for(int i=0;i<c;++i) scanf("%d", &r[i]);
	sort(p,p+a+1);
	sort(q,q+b+1);
	sort(r,r+c);
	reverse(p,p+a+1);
	reverse(r,r+c);
	reverse(q,q+b+1);
	int A,B,licz=0;
	A=x;
	B=y;
	while(r[licz]>p[A] || r[licz]>q[B])
	{
		if(p[A]<q[B])
		{
			p[A]=r[licz];
			A--;
		}
		else
		{
			q[B]=r[licz];
			B--;
		}
		++licz;
	}
	ll ans=0;
	for(int i=1;i<=x;++i) ans+=p[i];
	for(int i=1;i<=y;++i) ans+=q[i];
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 5024
import java.util.Scanner;
import java.math.BigDecimal;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W[] = new int[N];
        W[0] = sc.nextInt();
        for(int i = 1; i < N; i++){
            W[i] = W[i - 1] + sc.nextInt();
        }
        int result = 100000;
        for(int i = 0; i < N; i++){
            int S1 = W[i];
            int S2 = W[N - 1] - S1;
            int total = 0;
            if(S1 < S2){
                total = S2 - S1;
            }else{
                total = S1 - S2;
            }
            if(result > total){
                result = total;
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
const ll MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

	if (N >= 30){
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";		
	}


	return 0;
}


Measured memory_bytes: 3604
#include <cstdio>

int main(){
    int count = 0;
    int a,b;
    scanf("%d %d",&a,&b);
    for(int i = 1; i <= a; i++){
        if(i != a){
            for(int j = 1; j <= 31; j++){
                if(i == j){
                    count++;
                }
            }
        }else{
            for(int j = 1; j <= b; j++){
                if(i == j){
                    count++;
                }
            }
        }
    }
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 128
#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>;
int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    if (a >= k) {
        cout << k;
        return 0;
    }
    else {
        k -= a;
        if (b >= k) {
            cout << a;
            return 0;
        }
        else {
            k -= b;
            cout << a - k;
            return 0;
        }
    }
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VL vector < ll >
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
void bug()
{
    cout << "here\n";
}
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
#define N 10000009
bool prime[N];
vector<ll> prm;
void seive ()
{
    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {

        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;

}

ll countSum(ll x)
{
    ll res = 0;
    while (x != 0)
    {
        res += (x % 10);
        x /= 10;
    }
    return res;
}
ll used[111111];

int main()
{
    fast;

    ll n;
    cin >> n;
    if(n<30)
        cout <<"No\n";
    else
        cout << "Yes\n";
}






Measured memory_bytes: 3652
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    for i in range(2, int(N ** 0.5) + 1):
        c = 0
        while N % i == 0:
            c += 1
            N //= i
        i = 0
        while c > i:
            ans += 1
            i += 1
            c -= i
    if N > 1:
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 63492
n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
vl = [int(input()) for _ in range(m)]

for i in range(n):
	sum = 0
	for j in range(m):
		sum += vl[j] * l[i][j]
	print(sum)


Measured memory_bytes: 6016
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	var N int

	fmt.Scanf("%d", &N)
	H := make([]int, N)

	hstr := readLine()
	split := strings.Split(hstr, " ")

	for i:=0; i<N ; i++ {
		atoi, err := strconv.Atoi(split[i])
		if err != nil {
			panic(err)
		}
		H[i] = atoi
	}

	log.Printf("%+v", H)
	for i:=1; i<N-1; i++ {
		if H[i] - H[i - 1] >= 1 && H[i + 1] - H[i] <= 0 {
			H[i] -= 1
		}

		if H[i - 1] > H[i] || H[i + 1] < H[i] {
			log.Printf("Failed on 2 %+v", H)
			fmt.Printf("No")
			return
		}
	}

	log.Printf("Last:  %+v", H)
	fmt.Printf("Yes")
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

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

  int ans = B[0] + B[N-2];
  for (int i = N-2; i > 0; i--) {
    ans += min(B[i-1], B[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
li=[]
for i in range(M):
    a,b=map(int,input().split())
    li.append(a)
    li.append(b)
ans=[0]*N
for j in range(1,N+1):
    cj=li.count(j)
    ans[j-1]=cj
for k in range(N):
    print(ans[k])


Measured memory_bytes: 9064
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{ 
    fast;

    ll n,m,x;
    cin>>n>>m;

    vector<ll> s(n),t(m);
    for(ll i=0;i<n;i++)
      cin>>s[i];
    for(ll i=0;i<m;i++)
      cin>>t[i];

    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));

    for(ll i=0;i<=n;i++)
      dp[i][0]=1;
    for(ll i=0;i<=m;i++)
      dp[0][i]=1;

    for(ll i=1;i<=n;i++)
    {
      for(ll j=1;j<=m;j++)
      {
        dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+mod)%mod;

        if(s[i-1]==t[j-1])
         dp[i][j]=(dp[i][j]+dp[i-1][j-1])%mod;
      }
    }
    cout<<dp[n][m]<<endl;
 }


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

using namespace std;

int main()
{
  int n,b,sum;
  vector<int> a;

  while(cin>>n,n){

    sum = 0;
    a = {0};

    for(int i = 0;i < n/4;++i){
      cin>>b;
      a.push_back(b);
    }

    for(int e : a){
      sum += e;
    }

    cout<<sum<<endl;
  }

  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
using namespace std;


int calc(vector<vector<char>> F, int h, int w){
  int ans = 0;
  if (F[h-1][w-1]=='#') ans++;
  if (F[h-1][w]=='#') ans++;
  if (F[h-1][w+1]=='#') ans++;
  if (F[h][w-1]=='#') ans++;
  if (F[h][w+1]=='#') ans++;
  if (F[h+1][w-1]=='#') ans++;
  if (F[h+1][w]=='#') ans++;
  if (F[h+1][w+1]=='#') ans++;
  if (F[h][w]=='#') return -1;
  else return ans;
}

int main() {
  int H = 0, W = 0;
  int ans = 0;
  cin >> H >> W;
  vector<vector<char>> F(H+2, vector<char>(W+2));
  vector<vector<int>> ANS(H, vector<int>(W));
  rep(h, H+2){
    rep(w, W+2){
      F[h][w] = '0';
    }
  }

  repi(h, 1, H+1){
    repi(w, 1, W+1){
      cin >> F[h][w];
    }
  }

  repi(h, 1, H+1){
    repi(w, 1, W+1){
      ANS[h-1][w-1] = calc(F, h, w);
    }
  }

  rep(h, H){
    rep(w, W){
      if (ANS[h][w]==-1) cout << '#';
      else cout << ANS[h][w];
    }
    cout << endl;
  }

}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
C = {}
for i in range(N):
    a = A[i]
    if a not in C:
        C[a] = 0
    C[a] += 1
flag = 0
for a in C:
    if C[a]>1:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 109908
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
vector<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
vector<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

int main () {
    int n; double k; cin >> n >> k;
    V<double> a(n);
    double sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    sort(allr(a));
    /*
    if (k == 0) {
        cout << a[0] << endl;
        return 0;
    }
    */
    
    int ok = a[0];
    int ng = 0;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        ll cnt = 0;
        rep(i, n) {
            cnt += (int(a[i]) + mid - 1)/mid - 1;
        }
        if (cnt <= k) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    /*
    int r = sum/k + 5;
    int l = sum/(k+n) - 1;
    //printf("l = %d\nr = %d\n", l, r);
    ll ans = 1001001001;
    for (int x = l; x <= r; x++) {
        if (x <= 0) {
            x = 0;
            continue;
        }
        ll cnt = -n;
        rep(i, n) {
            cnt += (int(a[i]) + (int)x - 1)/(int)x;
        }
        if (cnt <= k) {
            ans = x;
            break;
        }
        //printf("max = %d\ncnt = %d\n", x, cnt);
    }
    cout << ans << endl;
    */
    return 0;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
const int N=1e5+5;
int main()
{
    ios::sync_with_stdio(false);
    ll x,ans=100;
    int i;
    scanf("%lld",&x);
    for(i=1;;i++)
    {
    	ans+=ans/100;
    	if(ans>=x)
    	{
    		printf("%d\n",i);
    		break;
		}
	}
    return 0; 
}

Measured memory_bytes: 3812
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

ll solve(ll n, ll b) {
  ll r = 0;
  while(n) {
    r += n%b;
    n /= b;
  }
  return r;
}

int main() {
  ll n, s;
  scanf("%lld %lld", &n, &s);
  for(int b = 2; b <= 1000000; b++) {
    if(solve(n, b) == s) {
      printf("%d\n", b);
      return 0;
    }
  }
  // a * base + (s-a)
  // b = n % a
  ll ret = -1;
  if(n == s) {
    printf("%lld\n", n+1);
    return 0;
  }
  for(ll a = 1; a <= 1000000 && a <= s; a++) {
    ll b = s-a;
    ll base = (n-b)/a;
    if(base == 1) continue;
    if(b >= base) continue;
    if(a >= base) continue;
    if(a*base+b != n) continue;
    if(ret == -1) {
      ret = base;
    }
    else {
      ret = min(ret, base);
    }
  }
  printf("%lld\n", ret);
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] input = new int[N + 1];
		for (int i = 0; i < N; i++) {
			int tmp = sc.nextInt();
			input[tmp] += 1;
		}
		int kinds = 0;
		for (int i = 0; i < input.length; i++) {
			if (input[i] == 0) {
				input[i] = 200001;
			} else {
				kinds++;
			}
		}
		Arrays.sort(input);
		int res = 0;
		for (int i = 0; i < kinds - K; i++) {
			res += input[i];
		}
		System.out.print(res);
	}
}


Measured memory_bytes: 64804
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n1 = Number(lines.shift());
  const arr1 = lines.shift().split(' ').map(Number);
  const n2 = Number(lines.shift());
  const arr2 = lines.shift().split(' ').map(Number);

  const solve = (i, m) => {
    if (m == 0) return true;
    if (i >= n1) return false;
    return solve(i + 1, m) || solve(i + 1, m - arr1[i]);
  };

  arr2.map(m => solve(0, m) ? 'yes' : 'no').forEach(res => console.log(res));
})();



Measured memory_bytes: 16904
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] as = new long[n], xs = new long[n];
        as[0] = sc.nextInt();
        long s = as[0];


        for (int i = 1; i < n; i++) {
            as[i] = sc.nextInt();
            s += i % 2 == 1 ? -as[i] : as[i];
        }
        PrintWriter out = new PrintWriter(System.out);
        out.print(s);
        for (int i = 1; i < n; i++) {
            s = 2 * as[i - 1] - s;
            out.print(" " + s);
        }
        out.println();
        out.flush();
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 63136
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {


	public static void main (String[] args)  {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int v = sc.nextInt();
		int p = sc.nextInt();
		int[] a = new int[n];
		for (int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		//reverse
		int[] b = new int[n];
		for (int i=0;i<n;i++) {
			b[i]=a[n-1-i];
		}
		a=b;

		//first appearance
		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int i=0;i<n;i++) {
			if (!map.containsKey(a[i])) {
				map.put(a[i], i);
			}
		}

		//ruisekiwa
		long[] c = new long[n+1];

		for (int i=0;i<n;i++) {
			c[i+1]=c[i]+a[i];
		}

		int left = 0;
		int right = n;

		/*
		System.out.println(Arrays.toString(a));
		System.out.println(Arrays.toString(c));

		for(int i=0;i<n;i++) {
			System.out.println(isLegal(a,i,map,c,n,m,v,p));
		}
		 */
		while (right-left>1) {
			int mid = (left+right)/2;


			if (isLegal(a,mid,map,c,n,m,v,p)) {
				left=mid;
			} else {
				right=mid;
			}
		}
		System.out.println(right);
	}

	public static boolean isLegal(int[]a, int pos, TreeMap<Integer,Integer> map, long[]c,
			int n, int m, int v, int p) {

		int allVote = p-1 + n-map.get(a[pos]);

		if (map.floorEntry(a[pos]+m).getValue()>=p) {
//			System.out.println("bunki1");
			return false;
		}

		if (allVote>=v) {
//			System.out.println("bunki2");
			return true;
		} else {
			long fM = ((long)(n-allVote)*(a[pos]+m)-(c[map.get(a[pos])]-c[p-1]))/m;
			if (fM >= v-allVote) {
//				System.out.println("bunki3");
				return true;
			} else {
//				System.out.println("bunki4");
				return false;
			}
		}
	}
}


Measured memory_bytes: 58988
#include<bits/stdc++.h>
#define mod 1000000007ll
using namespace std;

const int N = 1e5 + 10;

vector<int> adj[N];
vector<vector<long long>> dp(N, vector<long long> (2, 1));

template<typename T>
void self_add(T& a, T b)
{
  a += b;
  if(a > mod)
    a -= mod;
}

template<typename T>
T mul(T a, T b)
{
  return a * b % mod;
}

void dfs(int source, int parent = -1)
{
  for(auto u : adj[source])
  {
    if(u == parent)
    {
      continue;
    }
    dfs(u, source);
    dp[source][0] = mul(dp[source][0], (dp[u][0] + dp[u][1]) % mod);
    dp[source][1] = mul(dp[source][1], dp[u][0]);
  }
}

int main()
{
  int n;
  scanf("%d", &n);
  for(int i = 1; i < n; i++)
  {
    int x, y;
    scanf("%d%d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1);
  long long sol = dp[1][1] + dp[1][0];
  if(sol > mod)
    sol -= mod;
  printf("%lld", sol);
  return 0;
}


Measured memory_bytes: 18176
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){




string s,t;
cin>>s>>t;

int n = s.length();
int m = t.length();
ll ans = 1e8;


for(int i=0 ; i < n-m+1;i++){
	
	ll temp  =0 ;
	if( i+m-1>=n)
	continue;
	for(int j = 0 ; j<m;j++){
		
		if(s[i+j]!=t[j])
		temp ++;
		
		
		
		
	}
	
	
	
	ans= min(ans, temp ) ;
	
	
	
	
}

cout<<ans;


return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


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

int main() {
	long long x,y;
	cin>>x>>y;
	long long b=y;
	b-=(2*x);
	b/=2;
	long long a=x-b;
	if((a+b)==x && ((2*a)+(4*b))==y && a>=0 && b>=0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public void change() {

	}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        
        if((x + r <= W && y + r <= H) && (x - r >= 0 && y - r >= 0)) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
}


Measured memory_bytes: 26292
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(n-1,-1,-1):
  a,b=arr[i][0],arr[i][1]
  if (a+ans)%b==0:
    continue
  else:
    ans+=b-((a+ans)%b)
print(ans)

Measured memory_bytes: 27380
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=2e5+7;
const int mod=inf;

int v[N],nxt[N];
int head[N],fst[N],par[N],dep[N],n;
int tot[N],pw2[N];

struct dat{
	int a,b,c;
	il dat(const int &x=1,const int &y=0,const int &z=0):a(x),b(y),c(z){}
	il void operator +=(const dat &y){
		ll cnt0=y.a+y.c,cnt1=y.b;
		c=((cnt0+cnt1)*c+cnt1*b)%mod;
		b=(cnt0*b+cnt1*a)%mod;
		a=(cnt0*a)%mod;
	}
};
dat val[N];
int tp[N],succ[N],cnt;

il int newval(const int &u,const dat &d){
	++cnt;
	val[cnt]=d;
	tp[cnt]=u;
	succ[cnt]=0;
	return cnt;
}

il void merge(int &u,const int &v,const int &cur){
	if(!v) return;
	if(!u){
		u=v;
		return;
	}
	if(tp[u]!=cur){
		val[u].a+=val[u].c;
		if(val[u].a>=mod) val[u].a-=mod;
		val[u].c=0;
		tp[u]=cur;
	}
	val[u]+=val[v];
	merge(succ[u],succ[v],cur);
}

il void dfs(const int &u){
	dep[u]=(u?dep[par[u]]+1:0);
	++tot[dep[u]];
	fst[u]=newval(u,dat(1,1,0));
	for(int e=head[u];e;e=nxt[e]){
		dfs(v[e]);
		merge(succ[fst[u]],fst[v[e]],u);
	}
}

int main(){
//	fileio("test");
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d",par+i);
		v[i]=i,nxt[i]=head[par[i]],head[par[i]]=i;
	}
	dfs(0);
	pw2[0]=1;
	rep(i,1,n+1){
		pw2[i]=pw2[i-1]<<1;
		if(pw2[i]>=mod) pw2[i]-=mod;
	}
	ll res=0;
	for(int i=fst[0],cur=0;i;i=succ[i],++cur){
		res+=1ll*val[i].b*pw2[n+1-tot[cur]]%mod;
	}
	printf("%d\n",res%mod);
	return 0;
} 

Measured memory_bytes: 14208
#include <iostream>
#include <algorithm>
#include <math.h>
int main(){
  int n;
  char c[8];
  std::cin>>n;
  for(;n,std::cin>>c;n--){
    std::sort(c,c+8);
    int max=0,min=0;
    for(int i=0;i<8;i++){
      int k = 7-i;
      max=max+static_cast<int>(c[k]-'0')*pow(10,k);
      min=min+static_cast<int>(c[k]-'0')*pow(10,i);
    }
    std::cout<<max-min<<std::endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int a,b;
    cin >> a >> b;
	if(b%a == 0)cout << a+b << endl;
  	else cout << b-a << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;



struct aa {
	int id;
	int li;
	int cost;

	const bool operator<(const aa&r)const {
		return this->cost>r.cost;
	}
};
int main() {
	int W,H,N;cin>>W>>H>>N;

	vector<pair<int,int>>lights(N+1);

	lights[0]=make_pair(0,0);
	for (int i = 0; i < N; ++i) {
		int x,y;cin>>x>>y;
		lights[i+1]=make_pair(x-1,y-1);
	}
	lights.emplace_back(W-1,H-1);


	priority_queue<aa>que;
	vector<vector<int>>dp(N+2,vector<int>(1010,1e8));

	que.push(aa{ 0,0,0 });;
	dp[0][0]=0;

	while (!que.empty()) {
		aa atop(que.top());
		que.pop();

		const int now_id(atop.id);
		const int now_li(atop.li);
		const int now_cost=atop.cost;

		for (int next_id = 1; next_id < N + 2; ++next_id) {
			if(now_id==next_id)continue;
			if(now_id==0&&next_id==N+1)continue;

			int dis=abs(lights[now_id].first-lights[next_id].first)+abs(lights[now_id].second-lights[next_id].second);

			if (next_id != N + 1) {
				int next_li=max(1,dis-now_li+1);
				int next_cost=now_cost+(next_li-1);

				if (dp[next_id][next_li] > next_cost) {
					dp[next_id][next_li]=next_cost;
					que.push(aa{ next_id,next_li,next_cost });
				}
			}
			else {
				if (dis <= now_li-1) {
					dp[N+1][0]=min(dp[N+1][0],now_cost);

				}
				else {
					dp[N+1][0]=min(dp[N+1][0],now_cost+(dis-(now_li-1)));
				}
			}
		}
	}
	int ans=dp[N+1][0];
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 4232
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
ll n,a,res,l,r,mid,ans,w;
inline ll calc(R ll x,R ll y){
	R ll res=1;
	fp(i,1,x%y){
		res*=x/y+1;
		if(res>1e14)return 1e18; 
	}
	fp(i,1,y-x%y){
		res*=x/y;
		if(res>1e14)return 1e18;
	}
	return res;
}
int main(){
	scanf("%lld%lld",&n,&a),res=n;
	fp(i,1,40){
		l=1,r=2e6,ans=0;
		while(l<=r){
			mid=(l+r)>>1,w=calc(mid,i+1);
			w>=n?(ans=mid,r=mid-1):l=mid+1;
		}
		cmin(res,ans+i*a);
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll a[100005],b[100005],c[100005];
ll dp[100005][3],n;
//<<-----Implement Functions Here---->>//
ll solve(ll lp,ll i)
{
	if(i==n)return 0;
	else if(dp[i][lp]!=-1)return dp[i][lp];
	if(lp==0)dp[i][lp] = max({solve(1,i+1)+a[i],solve(2,i+1)+b[i],solve(3,i+1)+c[i]});
	else if(lp==1)dp[i][lp] = max(solve(2,i+1)+b[i],solve(3,i+1)+c[i]);
	else if(lp==2)dp[i][lp] = max(solve(1,i+1)+a[i],solve(3,i+1)+c[i]);
	else dp[i][lp] = max(solve(1,i+1)+a[i],solve(2,i+1)+b[i]);
	return dp[i][lp];
	
}

//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;
		for(ll i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
		mset(dp,-1);
		cout<<solve(0,0);
	}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

Measured memory_bytes: 12800
# -*- coding: utf-8 -*-
import numpy as np

k, x = map(int, input().split())

mi = x-k+1
mi = max(-1000000, mi)

ma = x+k
ma = min(1000000, ma)

list_1 = list(range(mi, ma))
print(" ".join(map(str,list_1)))

Measured memory_bytes: 20740
#include <iostream>

void quicksort(int array[], int left, int right) {
    int l = left;
    int r = right;
    int pivot = array[(left + right) / 2]; // 中央からピボットを選択
    int buf;

    while (1) {
        while (array[l] < pivot) l++;
        while (array[r] > pivot) r--;

        if (l > r) break;

        // pivotより小さい値を左、大きい値を右に入れ替え
        buf = array[l];
        array[l] = array[r];
        array[r] = buf;

        l++, r--;
    };

    // pivotより小さい領域と大きい領域をそれぞれ再帰的にソート
    if (left < r)  quicksort(array, left, r);
    if (l < right) quicksort(array, l, right);
}

int main() {

	int n;

	std::cin >> n;

	int *a;
	a = new int[n];

	int *b;
	b = new int[n];
	
	int i, tmp;
	
	for (i = 0; i < n; i++) {
		std::cin >> a[i];
		b[i] = a[i];
	}

	quicksort(a, 0, n-1);

	for (i = 0; i < n; i++) {
		if (b[i] < a[n/2])
			std::cout << a[n/2] << std::endl;
		else
			std::cout << a[n/2-1] << std::endl;
	}

	delete[] a;
	delete[] b;

	return 0;

}


Measured memory_bytes: 3712
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    vector<int> dp(3001, -1);
    vector<int> a{100*A, 100*B, C, D};
    dp[a[0]] = 0;
    dp[a[1]] = 0;
    REP(i, 4){
        REP(j, F + 1){
            if (i < 2 && dp[j] >= 0 && j + a[i] <= F) dp[j + a[i]] = 0;
            if (i >= 2 && dp[j] >= 0 && j + a[i] <= F && (100 + E) * (dp[j] + a[i]) <= E * (j + a[i]) && 
                dp[j + a[i]] < dp[j] + a[i]) dp[j + a[i]] = dp[j] + a[i];
        }
    }
    int tmp = min(a[0], a[1]), hoge = 0;
    double den = 0;
    rep(i, 1, F + 1){
        if (dp[i] >= 0 && dp[i] > (double)i * den){
            den = (double)dp[i]/(double)i;
            tmp = i;
            hoge = dp[i];
        }
    }
    cout << tmp << " " << hoge << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int Array[100];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&Array[i]);
	}
	for(i=n-1;i>0;i--){
		printf("%d ",Array[i]);
	}
	printf("%d\n",Array[0]);
}

Measured memory_bytes: 1808
#include <stdio.h>
int main(void) {
	char a[5];
	int i;

	for (i = 0; i < 4; i++) {
		a[i] = getchar();
	}

	if (a[0] == a[1] && a[2] == a[3] && a[0] != a[2])
		printf("Yes");
	else if (a[0] == a[2] && a[1] == a[3] && a[0] != a[1])
		printf("Yes");
	else if (a[0] == a[3] && a[1] == a[2] && a[0] != a[1])
		printf("Yes");
	else
		printf("No");

	return 0;
}

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

int main() {
  string s; cin >> s;
  int ans = 700;
  rep(i,3){
    if(s[i] == 'o')ans+= 100;
  }
  cout << ans;
}

Measured memory_bytes: 3572
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    correct_notA = ["KIH","B","R",""]
    set_c = set()
    for i in range(1<<4):
        res = ""
        for j in range(4):
            if i>>j&1:
                res += "A"
            res += correct_notA[j]
        set_c.add(res)

    S = ST()
    print(["YES","NO"][S not in set_c])

if __name__ == '__main__':
    main()

Measured memory_bytes: 65260
#include <iostream>
#define REP(i, a, n) for(int i = a; i < n; i++)
using namespace std;


int n;
int m;
int k;

int s[1001][201];

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

  REP(i, 1, 2 * n + 1) {
    s[0][i] = i;
  }

  REP(i, 0, m) {
    cin >> k;

    // REP(j, 1, 2 * n + 1) {
    //   cout << s[i][j] << endl;
    // }
    // cout << endl;

    if(k == 0) {
      REP(j, 1, n + 1) s[i + 1][2 * (j - 1) + 1] = s[i][j];
      REP(j, 1, n + 1) s[i + 1][2 * j] = s[i][n + j];
    } else {
      REP(j, 1, 2 * n - k + 1) s[i + 1][j] = s[i][j + k];
      REP(j, 1, k + 1) s[i + 1][2 * n - k + j] = s[i][j];
    }
  }

  REP(i, 1, 2 * n + 1) {
    cout << s[m][i] << endl;
  }

  return 0;
}

Measured memory_bytes: 1944
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define Max int(1e5+10)
ll x[Max],v[Max],a[Max],b[Max];
int main()  
{  
    ll n,c;
    while(~scanf("%lld%lld",&n,&c))
	{
	    for(ll i=1;i<=n;i++)
	     {
	     	scanf("%lld%lld",&x[i],&v[i]);
	     	a[i]=a[i-1]-x[i]+x[i-1]+v[i];
		 }
		 x[n+1]=c;
		 for(ll i=n;i>0;i--)
	     	b[i]=b[i+1]-x[i+1]+x[i]+v[i];
	     for(ll i=2;i<=n;i++)
		     a[i]=max(a[i-1],a[i]);
		for(ll i=n-1;i>0;i--)
		     b[i]=max(b[i+1],b[i]);	 	
		ll ma=0;
		 for(ll i=1;i<=n;i++)
		 {
		 	ma=max(ma,a[i]);
		 	ma=max(ma,b[i]);
		 	ma=max(ma,a[i]-x[i]+b[i+1]);
		 	ma=max(ma,b[i]-(c-x[i])+a[i-1]);
		 }
		 printf("%lld\n",ma);
	} 
    return 0;  
      
} 

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c;
  in3(a, b, c);
  out(a + b + c - max({a, b, c}));
  memi;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

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

int main(){

  int n;
  scanf("%d", &n);

  vector<int> l, r;
  REP(i,n){
    int a, b;
    scanf("%d %d", &a,  &b);
    l.pb(a); r.pb(b);
  }

  int prime[100001] = {};
  FOR(i,1,100001){
    if(i % 2 == 1 && is_prime(i) && is_prime((i + 1) / 2)){
      prime[i] = 1;
    }
  }

  REP(i,100001){
    prime[i + 1] += prime[i];
    //cout << prime[i + 1] << endl;
  }

  REP(i,n){
    printf("%d\n", prime[r[i]] - prime[l[i] - 1]);
  }

  return 0;
}



Measured memory_bytes: 2036
#include <iostream>
#include <cmath>
#include <algorithm>

constexpr int MAX_N = 2000;

long long N, Z, W;
long long a[MAX_N];

int main(){

	std::cin >> N >> Z >> W;

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

	if(N > 1){
		long long max = std::max(abs(a[N - 1] - a[N - 2]), abs(a[N - 1] - W));
		std::cout << max << std::endl;
	}
	else{
		std::cout << abs(a[N - 1] - W) << std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace _517_LongestSteps
{
	class Program
	{
		static void Main ( string[] args )
		{
			while (true)
			{
				//input
				int[] orderNumber = Console.ReadLine ().Split (' ').Select (str => int.Parse (str)).ToArray ();

				bool isEnd = orderNumber.All (item => item == 0);
				if (isEnd)
				{
					break;
				}

				int dealCardCount = orderNumber[1];
				int[] cardArray = new int[dealCardCount];
				for (int lp = 0; lp < cardArray.Length; lp++)
				{
					cardArray[lp] = int.Parse (Console.ReadLine ());
				}

				//process
				int whiteCardCount = cardArray.Count (item => item == 0);
				cardArray = cardArray.Where (item => item != 0).OrderBy (item => item).ToArray ();

				List<ChainNumber> list = new List<ChainNumber> (cardArray.Length / 10);

				int previousItem = cardArray[0];
				int count = 1;

				//????´?????????¨??????
				for (int lp = 1; lp < cardArray.Length; lp++)
				{
					//????????????
					int item = cardArray[lp];

					//???????????¨????????????= n + 1??§????????°
					if (previousItem + 1 == item)
					{
						//????????????????¢???????
						count++;
					}
					//!= n + 1??§????????°
					else
					{
						//?????¨?????? - ???????????§?¨???????????????????????????¢???????????????????????????
						int spaceCount = item - previousItem - 1;

						//????´??????°??????
						ChainNumber number = new ChainNumber (count, spaceCount);
						list.Add (number);

						//????????????
						count = 1;
					}

					previousItem = item;

					//????????????
					if (lp + 1 == cardArray.Length)
					{
						ChainNumber number = new ChainNumber (count, 0);
						list.Add (number);
					}
				}

				int loop = 0;
				int maxLength = 0;

				//?????¨??????????´?????????¨??????????????§?????????????±???????
				while (loop < list.Count)
				{
					//?????????
					int length = 0;
					int instanceWhiteCardCount = whiteCardCount;
					bool isPlus = false;

					//????´??????????????????????????´?????¶?????????????????????§
					while (loop < list.Count)
					{
						length += list[loop].Length;

						int needWhiteCardCount = list[loop].SpaceCount;

						//????????????????????????
						loop++;

						//????´?????¶?????????°
						if (needWhiteCardCount <= instanceWhiteCardCount)
						{
							//?¶????
							instanceWhiteCardCount -= needWhiteCardCount;
							length += needWhiteCardCount;

							isPlus = true;
						}
						else
						{
							//????????????????´?????????°?????´???
							if (isPlus)
							{
								loop--;
							}

							//?????????
							break;
						}
					}

					//????´?????????£???????????°
					if (0 < instanceWhiteCardCount)
					{
						length += instanceWhiteCardCount;
					}

					//??????
					if (maxLength < length)
					{
						maxLength = length;
					}
				}

				//output
				Console.WriteLine (maxLength);
			}
		}

		class ChainNumber
		{
			public ChainNumber ( int length,int spaceCount )
			{
				this.Length = length;
				this.SpaceCount = spaceCount;
			}

			public int Length { private set; get; }
			public int SpaceCount { private set; get; }
		}
	}
}

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

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 200010, M = 2 * N;

int n, a, b;
int s[N];

int main()
{
	scanf("%d%d%d", &n, &a, &b);
	for (int i = 1; i <= n; i ++ ) scanf("%d", s + i);
	sort(s + 1, s + 1 + n);
	
	LL res = 0;
	for (int i = 1; i < n; i ++ )
	{
		int d = s[i + 1] - s[i];
		if ((LL)d * a >= (LL)b) res += b;
		else res += (LL)d * a;
	}
	printf("%lld\n", res);
    return 0;
}


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

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

    if (b % a == 0) cout << a + b << endl;
    else cout << b - a << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e5 + 7;
const int maxm = 1e6 + 7;
const int ALP = 26;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;

vector<int> primes;
bool vis[maxn];

void init()
{
	for(int i=2;i<maxn;i++)
	{
		if(!vis[i])
			primes.push_back(i);
		for(int j=i;j<maxn;j+=i)
			vis[j]=1;
	}
}

int x;

int main()
{
	init();
	scanf("%d",&x);
	printf("%d\n",*(lower_bound(primes.begin(),primes.end(),x)));
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

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

    return i+1;
}

int main() {
    int i, q;

    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%d", &A[i]);
    }
    q = partition(0, n-1);

    for (i=0; i<n; i++) {
        if (i) printf(" ");
        if (i==q) printf("[");
        printf("%d", A[i]);
        if (i==q) printf("]");
    }
    printf("\n");

    return 0;
}


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

using namespace std;

int main() {

	vector<int> vec;

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

		int a; scanf("%d", &a);
		vec.push_back(a);

	}

	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());

	printf("%d", vec.size());

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin >> N;
  ;
}
void solve() {
  // if (N % 4 == 0) {
  //   int k = N / 4 * 3;
  //   cout << k << " " << k << " " << k << endl;
  //   return;
  // };
  // if (N % 3 == 0) {
  //   int h = N;
  //   // 3/N = 1/n + 1/w;
  //   // 1/N = 1/3n + 1/3w
  //   // 3 = N/n + N/w;

  //   // n = N/3 * 2,w = N/3*1
  //   int n = N / 3 * 2;
  //   int w = n;
  //   cout << h << " " << n << " " << w << endl;
  //   return;

  //   // 3nw =N(n+w)
  //   // m=N/3
  //   // nw = m(n+w)
  // }
  // if (N % 2 == 0) {
  //   int h = N;
  //   int n = N;
  //   // 2/N = 1/h
  //   int w = N / 2;
  //   cout << h << " " << n << " " << w << endl;
  // }
  rep(w, 1, 3500) {
    rep(n, 1, 3500) {
      if (4 * w * n - N * n - N * w != 0) {
        if ((N * w * n) % (4 * w * n - N * n - N * w) == 0) {
          int h = (N * w * n) / (4 * w * n - N * n - N * w);
          if (h > 0) {
            cout << w << " " << n << " " << h << endl;
            return;
          }
        }
      }
    }
  }

  // // 4 = N/h + N/n + N/w
  // rep(i, 1, 3500) {
  //   rep(j, 1, 3500) {
  //     if ((N % i == 0) && (N % j == 0)) {  // N/w = 4-N/i-N/j;

  //       int w = (4 - N / i - N / j);
  //       if (w <= 0) {
  //         continue;
  //       }
  //       if (N % w != 0) continue;
  //       w = N / w;
  //       if (w > 0) {
  //         cout << i << " " << j << " " << w << endl;
  //         return;
  //       }
  //     }
  //   }
  // }
  // if (N % 4 == 0) {
  //   int k = N / 4 * 3;
  //   cout << k << " " << k << " " << k << endl;
  // };
  // ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 384
/****************************************
	Sahil Gangurde
	Learning through WA, TLE, SIGESV
****************************************/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <numeric>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846264338327950
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b, h, m;
	cin>>a>>b>>h>>m;

	long double rad = PI * 2 * (
	                      (long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
	                              double)m / 60.0);

	long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
	                  b) * cosl(rad);

	printf("%20.20Lf\n", sqrtl(rsq));
	return 0;
}


Measured memory_bytes: 4088