akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
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();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
double dp[301][301][301];

double rec(int a, int b, int c) {
  if (a == 0 && b == 0 && c == 0) return 0.0;
  if (dp[a][b][c]) return dp[a][b][c];

  double s = a + b + c;
  double res = N / s;
  if (a > 0) res += (double)a / s * rec(a - 1, b, c);
  if (b > 0) res += (double)b / s * rec(a + 1, b - 1, c);
  if (c > 0) res += (double)c / s * rec(a, b + 1, c - 1);

  return dp[a][b][c] = res;
}

signed main() {
  cin >> N;
  int a, b, c;
  a = 0, b = 0, c = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    if (tmp == 1) a++;
    if (tmp == 2) b++;
    if (tmp == 3) c++;
  }

  cout << fixed << setprecision(14) << rec(a, b, c) << endl;
  return 0;
}


Measured memory_bytes: 213248
use std::io;
use std::io::Read;

fn main() {
    let mut stdin = io::stdin();
    let mut lines = String::new();
    let _ = stdin.read_to_string(&mut lines);
    let vec = lines.lines().collect::<Vec<&str>>();
    let vec2 = vec[0].split(' ').collect::<Vec<&str>>();
    let a :i64 = vec2[0].trim().parse().unwrap();
    let b :i64 = vec2[1].trim().parse().unwrap();

    if a*b <= 0 {
        println!("Zero");
    } else if a > 0 {
        println!("Positive");
    } else {
        if (b-a+1) % 2 == 0 {
            println!("Positive");
        } else {
            println!("Negative");
        }
    }
}



Measured memory_bytes: 380
<?php

fscanf(STDIN, '%d %d %d', $A, $B, $K);

// A, Bの約数を全て挙げる
// 共通のものにしぼる
// そのうちK番目のものをとってくる

$aArray = [];
for($i = $A; $i > 0; $i--){
    if($A % $i === 0){
        $aArray[] = $i;
    }
}

$bArray = [];
for($i = $B; $i > 0; $i--){
    if($B % $i === 0){
        $bArray[] = $i;
    }
}

$array = array_intersect($aArray, $bArray);
$array = array_values($array);

$ans = $array[$K - 1];

echo $ans.PHP_EOL;

Measured memory_bytes: 4728
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int H,W,h,w;
  cin>>H>>W>>h>>w;
  cout<<(H-h)*(W-w)<<endl;
  return 0;
}


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

using namespace std;

int main(void){
	long A,B,C,K;
	long ans;
	std::cin>>A>>B>>C>>K;
	if(K % 2 == 0){
		ans = A - B;
	}else{
		ans = B - A;
	}

	if(ans > 1e+18){
		std::cout<<"Unfair"<<std::endl;
	}else{
		std::cout<<ans<<std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
O=input()
E=input()

o=list(O)
e=list(E)

str=[0 for i in range(len(o)+len(e))]
j=0
for i in range(0,len(o)):
    str[j]=o[i]
    j+=2
j=1
for i in range(0,len(e)):
    str[j]=e[i]
    j+=2
s=""
for i in range(len(str)):
    s=s+str[i]
print(s)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//#define int long long
signed main() {
  int H, W;
  string S[52];
  int dH[]={1,1,1,0,0,-1,-1,-1};
  int dW[]={1,0,-1,1,-1,1,0,-1};
  cin >> H >> W;
  for(int i=0; i<H; i++) {
    cin >> S[i];
  }
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(S[i][j]=='.') {
        int cnt=0;
        for(int k=0; k<8; k++) {
          int y=i+dH[k];
          int x=j+dW[k];
          if(y>=0&&y<H&&x>=0&&x<W&&S[y][x]=='#') {
            cnt++;
          }
      S[i][j]='0'+cnt;
        }
      }
    }
  }
  for(int i=0; i<H; i++) {
    cout << S[i] << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

#define MAX_N (100000L)

using namespace std;

int main() {
  // read inputs
  long N, K, as[MAX_N], bs[MAX_N];
  scanf("%ld %ld", &N, &K);
  for (long i = 0; i < N; i++) {
    scanf("%ld %ld", &as[i], &bs[i]);
  }

  // enumerate the masks that need to be considered
  vector<long> masks;
  masks.push_back(K);
  for (long k = 0; k < 30; k++) {
    if (K & (1 << k)) {
      masks.push_back((K & ~(1 << k)) | ((1 << k) - 1));
    }
  }

  // solve
  long ans = 0;
  for (long mask : masks) {
    long score = 0;
    for (long i = 0; i < N; i++) {
      if ((as[i] & ~mask) == 0) {
        score += bs[i];
      }
    }
    ans = max(ans, score);
  }
  printf("%ld\n", ans);
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) {
		IO io = new IO();
		while(true) {
			int d = io.nextInt();
			if (d == 0) {
				break;
			}
			int n = io.nextInt();
			int m = io.nextInt();
			int[] a = new int[n+1];
			for(int i=1;i<n;i++) {
				a[i] = io.nextInt();
			}
			a[n] = d;
			Arrays.sort(a);
			int ans = 0;
			for(int i=0;i<m;i++) {
				int x = io.nextInt();
				int ind = Arrays.binarySearch(a, x);
				if (ind < 0) {
					ind = (ind + 2) * -1;
				}
				ans += Math.min(Math.abs(x-a[ind]),Math.abs(x-a[ind+1]));
			}
			io.println(ans);
		}
		io.flush();
	}
}
class IO {
	BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
	StringBuilder out = new StringBuilder();
	int index = 0;
	String bfl = null;
	String[] bf = new String[0];
	private boolean read() {
		try {
			bfl = bi.readLine();
			if (bfl == null) {
				return false;
			}
			bf = bfl.split("\\s");
			index = 0;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return true;
	}
	public boolean hasNext() { return index < bf.length ? true : read(); }
	public boolean hasNextLine() { return read(); }
	public String next() { return hasNext() ? bf[index++] : null; }
	public String nextLine() { if (hasNextLine()) {index = bf.length; return bfl; }else return null; }
	public int nextInt() { return Integer.parseInt(next()); }
	public long nextLong() { return Long.parseLong(next()); }
	public double nextDouble() { return Double.parseDouble(next()); };
	public char nextChar() { return next().charAt(0); }
	public void println(long x) { out.append(x); out.append("\n"); }
	public void println(double x) { out.append(x); out.append("\n"); }
	public void println(String s) { out.append(s); out.append("\n"); }
	public void println() { out.append("\n"); }
	public void print(long x) { out.append(x); }
	public void print(double x) { out.append(x); }
	public void print(String s) { out.append(s); }
	public void print(char c) {out.append(c);}
	public void flush() {System.out.print(out); out = new StringBuilder(); }
	public int[] arrayInt(int n) {
		int[] a = new int[n];
		for(int i=0;i<n;i++) {
			a[i] = nextInt();
		}
		return a;
	}
	public long[] arrayLong(int n) {
		long[] a = new long[n];
		for(int i=0;i<n;i++) {
			a[i] = nextLong();
		}
		return a;
	}
	public double[] arrayDouble(int n) {
		double[] a = new double[n];
		for(int i=0;i<n;i++) {
			a[i] = nextDouble();
		}
		return a;
	}
}

Measured memory_bytes: 69968
#include <iostream>
#include <string>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int main()
{
    int N;
    cin>>N;
    map<string,int> str;
    rep(i,N)
    {
        string sss;
        cin>>sss;
        str[sss]++;
    }
    for(string s:{"AC","WA","TLE","RE"})
    {
        cout<<s<<" x "<<str[s]<<endl;
    }
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int k;
	cin >> k;
	if (k % 2 == 0)
	{cout << -1; return 0;}
	int f = 1; int r = 7;
	for (int i = 1; i <= 1e6; i++)
	{
		if (r % k == 0)
		{
			cout << i;
			f = 0; break;
		}
		r %= k;
		r *= 10;
		r += 7;
	}
	if (f == 1)
		cout << -1;

	return 0;
}



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

const int maxn = 200005;
const int q = 100000;

int n, x, y;
long long ans, sz_x, sz_y, edges;
vector < int > g[maxn];
bool used[maxn];

void dfs (int u) {
	used[u] = 1;
	if (u > q)
		++sz_y;
	else
		++sz_x;
	for (int v: g[u]) {
		++edges;
		if (!used[v])
			dfs(v);
	}
}

signed main () {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d", &x, &y);
		g[x].push_back(q + y);
		g[q + y].push_back(x);
	}
	for (int i = 1; i <= q; ++i) {
		if (!used[i]) {
			sz_x = sz_y = edges = 0;
			dfs(i);
			ans += sz_x * sz_y - edges / 2;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 10240
#include<cstdio>
int main(){
    int n,h,w,a,b,ans=0;
    scanf("%d%d%d",&n,&h,&w);
    for(int i=0;i<n;i++){
        scanf("%d%d",&a,&b);
        if(h<=a&&w<=b)ans++;
    }
    printf("%d",ans);
    return 0;
}

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

using namespace std;

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

  sort(v, v+N);
  double value = v[0];
  for(int i = 1;i < N;i++){
    value = (value + v[i])/2;
  }
  cout << value << endl;
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
void f(double& v,double& w,double& x,double& y,int& n,int bx,int by,int ex,int ey,int cx,int cy,int cr){
  double vx,vy,px,py,ds;
  ds=sqrt((ex-bx)*(ex-bx)+(ey-by)*(ey-by));
  vx=(ex-bx)/ds;
  vy=(ey-by)/ds;
  ds=((ey-by)*cx+(bx-ex)*cy+(by-ey)*bx+(ex-bx)*by)/((ey-by)*vy-(bx-ex)*vx);
  px=cx-vy*ds;
  py=cy+vx*ds;
  if(0){
  }else if(cr>ds){
    n=2;
    ds=sqrt(cr*cr-ds*ds);
    v=px+vx*ds;
    w=py+vy*ds;
    x=px-vx*ds;
    y=py-vy*ds;
  }else if(cr<ds){
    n=0;
  }else{
    n=1;
    v=px;
    w=py;
  }
  return;
}
int g(int bx,int by,int ex,int ey,int cx,int cy,int cr){
  int n;
  double v,w,x,y;
  f(v,w,x,y,n,bx,by,ex,ey,cx,cy,cr);
  if(0){
  }else if(n==0){
    return 0;
  }else if(n==1){
    if(bx==ex)
      return min(by,ey)<=w&&w<=max(by,ey);
    else
      return min(bx,ex)<=v&&v<=max(bx,ex);
  }else{
    if(bx==ex)
      return min(by,ey)<=min(w,y)&&max(w,y)<=max(by,ey);
    else
      return min(bx,ex)<=min(v,x)&&min(v,x)<=max(bx,ex);
  }
}
int main(){
  int i,j;
  int cb[100],ce[100],cx[100],cy[100],cr[100],bx,by,ex,ey,m,n;
  int *a;
  while(cin>>n&&n){
    for(i=0;i<n;i++)
      cin>>cx[i]>>cy[i]>>cr[i];
    cin>>m;
    a=new int[m];
    for(i=0;i<m;i++){
      cin>>bx>>by>>ex>>ey;
      for(j=0;j<n;j++){
	cb[j]=(cx[j]-bx)*(cx[j]-bx)+(cy[j]-by)*(cy[j]-by)>cr[j]*cr[j];
	ce[j]=(cx[j]-ex)*(cx[j]-ex)+(cy[j]-ey)*(cy[j]-ey)>cr[j]*cr[j];
	if(cb[j]^ce[j])
	  break;
	if(cb[j]&&ce[j]&&g(bx,by,ex,ey,cx[j],cy[j],cr[j]))
	  break;
      }
      if(j==n)
	a[i]=1;
      else
	a[i]=0;
    }
    for(i=0;i<m;i++)
      cout<<(a[i]?"Danger":"Safe")<<endl;
  }
  return 0;
}

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

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            int count = 0;

            for(int i = 0; i < S.Length; i++)
            {
                if(S[i] == '+')
                {
                    count++;
                }
                else
                {
                    count--;
                }
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 27184
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

class C {
	int ROWS, COLUMNS;
	vector<string> picture;

public:
	void solve()
	{
		for (int y{ 0 }; y < ROWS; y++)
		{
			for (int x{ 0 }; x < COLUMNS; x++)
			{
				if ((picture[y][x] == '#') && !dfs(x, y, true))
				{
					cout << "No" << endl;
					return;
				}
			}
		}
		cout << "Yes" << endl;
	}
	
	bool dfs(const int& x, const int& y, bool isFirstElem)
	{
		if (picture[y][x] == '.')
			return false;

		if (!isFirstElem)
		{
			picture[y][x] = '.';

			int x_visiting, y_visiting;
			for (int i{ 0 }; i < 4; i++)
			{
				x_visiting = x + dx[i];
				y_visiting = y + dy[i];
				if ((0 <= x_visiting && x_visiting < COLUMNS) && (0 <= y_visiting && y_visiting < ROWS) && picture[y_visiting][x_visiting] == '#')
					dfs(x_visiting, y_visiting, false);
			}

			return true;
		}
		else
		{
			bool flag{ false };
			int x_visiting, y_visiting;

			for (int i{ 0 }; i < 4; i++)
			{
				x_visiting = x + dx[i];
				y_visiting = y + dy[i];
				if ((0 <= x_visiting && x_visiting < COLUMNS) && (0 <= y_visiting && y_visiting < ROWS))
					flag |= dfs(x_visiting, y_visiting, false);
			}

			return flag;
		}
	}


	C()
	{
		cin >> ROWS >> COLUMNS;
		picture.resize(ROWS);

		for (int y{ 0 }; y < ROWS; y++)
		{
			cin >> picture[y];
		}
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  cout << "ABC" << N << endl;
  return 0;
}


Measured memory_bytes: 256
const INF: i64=std::i64::MAX/2;
fn main() {
    let (n,m) = {
        let t = rv::<usize>();
        (t[0], t[1])
    };
    let mut g = vec![vec![];n];
    for _ in 0..m {
        let t = rv::<usize>();
        let (l,r,c) = (t[0]-1,t[1]-1,t[2]as i64);
        g[l].push((r,c));
    }
    for i in 1..n {
        g[i].push((i-1,0));
    }
    let mut q = std::collections::BinaryHeap::new();
    q.push((INF-0,n-0));
    let mut d = vec![INF;n];
    while let Some((s,v)) = q.pop() {
        let s=INF-s;
        let v=n-v;
        if d[v]<=s {continue;}
        d[v]=s;
        if v==n-1 {break;}
        for &(u,c) in &g[v] {
            q.push((INF-(s+c),n-u));
        }
    }
    let t = d[n-1];
    println!("{}",if t<INF {t} else {-1});
}
fn rl() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s
}
fn rv<T>() -> Vec<T>
  where T: std::str::FromStr, T::Err: std::fmt::Debug, {
    rl().split_whitespace().map(|x|x.parse::<T>().unwrap()).collect()
}

Measured memory_bytes: 18684
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const string YES = "Yes";
const string NO = "No";



// ***************************************


int main(){
    int X;
    cin >> X;
    if(X >= 30) cout << YES << endl;
    else cout << NO << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main(){
    int N;
    string s, t;
    cin >> N
        >> s >> t;

    bool cs; // common substring. false if s[i:N] != t[0:i]
    int ans = 2 * N;
    for (int i = 0; i < N; i++){
        cs = true;

        for (int j = i; j < N; j++){
            if (s[j] != t[j - i]){
                cs = false;
                break;
            }
        }

        if (cs){
            ans -= N - i; // N - i is the length of the common substring
            break;
        }
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define mem(a,val) memset(a,val,sizeof(a))

using namespace std;

int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int dp[n+1][3+1];
    mem(dp, 0);
    int a, b, c;
    for (int i = 1; i < n + 1; ++i) {
        cin>>a>>b>>c;
        dp[i][1] = max(dp[i-1][2], dp[i-1][3]) + a;
        dp[i][2] = max(dp[i-1][1], dp[i-1][3]) + b;
        dp[i][3] = max(dp[i-1][1], dp[i-1][2]) + c;
    }

    int ans;
    ans = max(dp[n][1], dp[n][2]);
    ans = max(ans, dp[n][3]);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    long long n;
    long long k;
    long long q;
    long long a[100005];
    long long p[100005] = {0};
    
    cin >> n >> k >> q;
    for (long long i = 0;i < q;i++){
        cin >> a[i];
        p[a[i]-1]++;
    }
    for (long long i = 0;i < n;i++){
        if (q-p[i] >= k){
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}


Measured memory_bytes: 2176
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    int x = 1, y = 1;
    int vx = 0, vy = 1;
    int m, n;

    scanf ( " %d %d", &m, &n );
    if ( !( m | n ) ) break ;

    for ( ; ; )
    {
      char cmd[ 16 ];
      int d;

      scanf ( " %s", cmd );
      if ( *cmd == 'S' )  break ;

      switch ( *cmd )
      {
        case 'F':
        case 'B':
          scanf ( "%d", &d );
          x += ( *cmd == 'F' ? 1 : -1 ) * vx * d;
          if ( x < 1 ) x = 1; else if ( x > m ) x = m;
          y += ( *cmd == 'F' ? 1 : -1 ) * vy * d;
          if ( y < 1 ) y = 1; else if ( y > n ) y = n;
          break ;
        case 'L':
          d  = vx;
          vx = -vy;
          vy = d;
          break ;
        case 'R':
          d  = vx;
          vx = vy;
          vy = -d;
          break ;
      }
    }

    printf ( "%d %d\n", x, y );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

int main() {
	int n, k[100005];
	cin >> n;
	for (int i = 0; i < n; ++i) { cin >> k[i]; }
	sort(k, k + n);
	if (k[n - 1] - k[0] >= 2) {
		cout << "No" << endl;
		return 0;
	}

	if (k[0] == k[n - 1]) {
		if (2 * k[0] <= n || k[0] == n - 1) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	}
	else {
		int mon;
		for (int i = 0; i < n; ++i) {
			if (k[i] != k[0]) {
				mon = i;
				break;
			}
		}
		if (mon < k[n - 1] && 2 * (k[n - 1] - mon) <= n - mon) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	}
}

Measured memory_bytes: 640
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

static class Program
{
    static void Main()
    {
        ReadLine();
        int[] input = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int sum = input.Sum();
        int[] input2 = input.Select(n => n * input.Length).ToArray();

        if (input2.Contains(sum))
        {
            WriteLine(Array.IndexOf(input2, sum));
        }
        else
        {
            int minDef = input2.Min(n => Math.Abs(n - sum));
            WriteLine(Array.IndexOf(input2, input2.First(n => (n > sum ? n - minDef : n + minDef) == sum)));
        }

        ReadKey();
    }
}

Measured memory_bytes: 13396
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

const double EPS = 1e-10;

typedef vector<int> vi;

int main()
{
	int c1, c2, c3;
	while(scanf("%d%d%d", &c1, &c2, &c3) != EOF){
		int okay = 0;
		for(int i=1; i<=20-c1-c2; ++i){
			if(c1==i || c2==i || c3==i) continue;
			++okay;
		}
		puts(okay>3 ? "YES" : "NO");
	}

	return 0;
}

Measured memory_bytes: 0
#これがたぶん速い
require 'prime'
ary = Array.new(10**5+1,0)
for i in 1..10**5
  if i.prime? && ((i+1)/2).prime?
    ary[i] = ary[i-1]+1
  else
    ary[i] = ary[i-1]
  end
end

q = gets.to_i
q.times do 
  l,r = gets.strip.split.map(&:to_i)
  puts ary[r]-ary[l-1]
end

Measured memory_bytes: 15152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  vvi F(N, vi(10));
  vvi P(N, vi(11));
  
  rep(i, N) {
    rep(j, 10) {
      cin >> F[i][j];
    }
  }
  rep(i, N) {
    rep(j, 11) {
      cin >> P[i][j];
    }
  }
  
  ll pmax = LLONG_MIN;
  
  for(int bit=1; bit < (1<<10); bit++) {
    vi ct(N, 0);
    for(int i = 0; i < 10; i++) {
      if(bit & (1 << i)) {
        rep(j, N) {
          if(F[j][i]) ct[j] ++;
        }
      }
    }
    
    ll profit = 0;
    rep(j, N) {
      profit += P[j][ct[j]];
    }
    
    chmax(pmax, profit);
  }
  
  fin(pmax);
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int K;
	cin >> K;
	int X, Y;
	cin >> X >> Y;

	vector<pair<int, int>> kotae;
	int m = abs(X) + abs(Y);
	int xpn, ypn;

	if (K & 1) {

		while (m / K >= 2) {
			if (abs(X) < abs(Y)) {
				if (Y > 0) {
					kotae.pb(mp(0, K));
					Y -= K;
				}
				else {
					kotae.pb(mp(0, -K));
					Y += K;
				}
			}
			else {
				if (X > 0) {
					kotae.pb(mp(K, 0));
					X -= K;
				}
				else {
					kotae.pb(mp(-K, 0));
					X += K;
				}
			}
			m = abs(X) + abs(Y);
		}
		if (m == K) {
			kotae.pb(mp(X, Y));
		}
		else {
			if (m & 1) {
				if (abs(X) < abs(Y)) {
					if (Y > 0) {
						kotae.pb(mp(0, K));
						Y -= K;
					}
					else {
						kotae.pb(mp(0, -K));
						Y += K;
					}
				}
				else {
					if (X > 0) {
						kotae.pb(mp(K, 0));
						X -= K;
					}
					else {
						kotae.pb(mp(-K, 0));
						X += K;
					}
				}
			}

			int yorimiti = (2 * K - abs(X) - abs(Y)) / 2;
			if (abs(X) < abs(Y)) {
				xpn = (X >= 0) ? 1 : -1;
				ypn = (Y >= 0) ? 1 : -1;

				kotae.pb(mp(X + xpn * yorimiti, ypn * (K - abs(X + xpn * yorimiti))));
				Y -= ypn * (K - abs(X + xpn * yorimiti));
				X -= X + xpn * yorimiti;
				kotae.pb(mp(X, Y));
			}
			else {
				xpn = (X >= 0) ? 1 : -1;
				ypn = (Y >= 0) ? 1 : -1;
				kotae.pb(mp(xpn * (K - abs(Y + ypn * yorimiti)), Y + ypn * yorimiti));
				X -= xpn * (K - abs(Y + ypn * yorimiti));
				Y -= Y + ypn * yorimiti;
				kotae.pb(mp(X, Y));
			}
		}
	}
	else {
		if (m & 1) {
			co(-1);
			return 0;
		}
		while (m / K >= 2) {
			if (abs(X) < abs(Y)) {
				if (Y > 0) {
					kotae.pb(mp(0, K));
					Y -= K;
				}
				else {
					kotae.pb(mp(0, -K));
					Y += K;
				}
			}
			else {
				if (X > 0) {
					kotae.pb(mp(K, 0));
					X -= K;
				}
				else {
					kotae.pb(mp(-K, 0));
					X += K;
				}
			}
			m = abs(X) + abs(Y);
		}
		if (m == K) {
			kotae.pb(mp(X, Y));
		}
		else {
			int yorimiti = (2 * K - abs(X) - abs(Y)) / 2;
			if (abs(X) < abs(Y)) {
				xpn = (X >= 0) ? 1 : -1;
				ypn = (Y >= 0) ? 1 : -1;

				kotae.pb(mp(X + xpn * yorimiti, ypn * (K - abs(X + xpn * yorimiti))));
				Y -= ypn * (K - abs(X + xpn * yorimiti));
				X -= X + xpn * yorimiti;
				kotae.pb(mp(X, Y));
			}
			else {
				xpn = (X >= 0) ? 1 : -1;
				ypn = (Y >= 0) ? 1 : -1;
				kotae.pb(mp(xpn * (K - abs(Y + ypn * yorimiti)), Y + ypn * yorimiti));
				X -= xpn * (K - abs(Y + ypn * yorimiti));
				Y -= Y + ypn * yorimiti;
				kotae.pb(mp(X, Y));
			}
		}
	}

	co(kotae.size());
	int xp = 0, yp = 0;;
	rep(i, kotae.size()) {
		xp += kotae[i].first;
		yp += kotae[i].second;
		cosp(xp);
		co(yp);
	}



	Would you please return 0;
}

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll m=1e9+7;
ll power(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1) res=(res*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return res;
}
int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
	{
		string s;
	  cin>>s;
	  if(s[s.length()-1]=='s') s+="es";
	  else s+='s';
	  cout<<s<<endl;
	}
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vs a(3);
    rep(i, 3) cin >> a[i];
    cout << a[0][0];
    cout << a[1][1];
    cout << a[2][2];
    cout << endl;
}

Measured memory_bytes: 256
main = do
  l <- getLine
  let (a:b:[]) = map read $ words l :: [Int]
  putStrLn $ comp a b

comp :: Int->Int->String
comp a b
  | result == LT = "a < b"
  | result == EQ = "a == b"
  | result == GT = "a > b"
  where result = compare a b



Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

int main() {
    LL n, aa = 10000000000;
    cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        LL ans = 0;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            ans++;
        }
        aa = min(aa, ans);
    }

    cout << aa << endl;

    return 0;
}


Measured memory_bytes: 256
<?php 
list($h, $w) = explode(" ", trim(fgets(STDIN)));
for($i = 0; $i < $h; $i++){
    $str = fgets(STDIN);
    for($j = 0; $j < $w; $j++){
        $map[$i][$j] = $str[$j];
    }
}
for($i = 0; $i < $h; $i++){
    $str = fgets(STDIN);
    for($j = 0; $j < $w; $j++){
        if($map[$i][$j] == "#"){
            echo "#";
        }else{
            $c = 0;
            for($x = -1; $x <= 1; $x++){
                for($y = -1; $y <= 1; $y++){
                    if($x != 0 || $y != 0){
                        if(@$map[$i+$y][$j+$x] == "#")$c++;
                    }
                }
            }
            echo $c;
        }
    }
    echo "\n";
}


Measured memory_bytes: 4728
def modinv(a, m):
    b, u, v = m, 1, 0
    while(b):
        a, b, u, v = b, a%b, v, u-(a//b)*v
    return u % m

def gcd_base(x, y):
    if x % y:
        return gcd_base(y, x%y)
    return y

a, b = map(int, input().split())
a1 = a//gcd_base(a,b)
b1 = b//gcd_base(a,b)
x = modinv(a1, b1)
y = (1-a1*x)//b1
if abs(x)+abs(y) < abs(x-b1)+abs(y+a1):
    print(x, y)
elif abs(x)+abs(y) > abs(x-b1)+abs(y+a1):
    print(x-b1, y+a1)
elif x <= y:
    print(x, y)
else:
    print(x-b1, y+a1)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps=1e-6;
long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll mn=1000000000000000;
int main() {

ll n;
cn n;

ll r=sqrt(n)+10;

for (ll i = 1; i <r; ++i)
{
  if(n%i==0){
  //  _(i);
    mn=min(mn,i-1+n/i-1);
  }
}


ct mn;
nl;

    return 0;
}


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

int main() {
    long double a,b,x;cin >> a >> b >> x;
    long double t;
    if (a * a * b > x * 2) t = (a * b * b) / (2 * x);
    else t = (((a * a * b) - x) * 2) / (a * a * a) ;
    long double res = atan(t);
    long double PI = 3.141592653589793;
    cout << setprecision(10) << res * 180.0 / PI << endl;
}

Measured memory_bytes: 512
h = 1
w = 1
while not(h == 0 and w == 0):
    z = input()
    h,w = [ int(a) for a in z.split()]
    preh = h
    line1 = ""
    line2 = ""
    prew = w
    while preh > 0:
        if w % 2 == 0:
            if (h % 2) - (preh % 2) != 0:
                print (".#" * int((w // 2)))
                preh = preh - 1
            else:
                print ("#." * int((w // 2)))
                preh = preh - 1
        else:
            if (h % 2) - (preh % 2) != 0:
                print (".#" * int(((w - 1) // 2)) + ".")
                preh = preh - 1
            else:
                print ("#." * int(((w - 1) // 2)) + "#")
                preh = preh - 1
               
    if not(h == 0 and w == 0):
        print()


Measured memory_bytes: 5624
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
#define REP(i, a, b) for(int i = int(a); i <= int(b); i++)
#define LOOP(i, v) for(int i = 0; i < v.size(); i++)
#define EPS 1e-9
#define INF 1e12
#define debug(x) cerr << "DEBUG : " << (#x) << " => " << (x) << endl

int main()
{
  int x;
  string s;
  scanf("%d\n", &x);
  
  REP(i, 1, x)
  {
    cin >> s;
    if(s[0] == 'Y')
    {
      printf("Four\n");
      return 0;
    }
  }
  printf("Three\n");
  
  return 0;
}

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

using namespace std;
typedef vector<int> vii;

int main(){
	string w;
	cin >> w;
	vii letters(26,0);
	for(int i=0;i<w.size();++i){
	    int index = w[i] - 'a';
		letters[index]++;
	}
	bool even = true;
	for(int i=0;i<letters.size();++i){
	    if(letters[i]%2!=0){
	        even = false;
	        break;
	    } 
	}
	
	cout << (even==true?"Yes":"No") << endl;

	return 0;
}

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

int main() {
	int n;
	cin>>n;
	vector<int>vec(n);
	for(int i=0;i<n;i++) {
		int a;
		cin>>a;
		vec.at(i)=a;
	}
	sort(vec.begin(),vec.end());
	cout<<vec.at(n-1)-vec.at(0)<<endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskT solver = new TaskT();
        solver.solve(1, in, out);
        out.close();
    }
    
    

    static class TaskT {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	
        	int N = in.nextInt();
        	int X = in.nextInt();
        	int T = in.nextInt();
        	
        	
        	int ans = 0; 
        	while(N > 0){
        		N =  N - X;
        		ans += T;
        	}
        	
        	out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}



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

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

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

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

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

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

	return true;
}

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

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll N;
	std::cin >> N;
	vll A(N);
	rep(i, 0, N) {
		std::cin >> A[i];
	}


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

	ll ans = A[N - 1] - A[0];
	repeq(i, 1, N / 2) {
		ans += A[N - 1 - i] + A[N - i] - A[i] - A[i - 1];
	}
	if (N & 1) {
		ans += max(A[N / 2 - 1]- A[N / 2], A[N / 2] - A[N / 2 + 1]);
	}

	std::cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<list>
#include<set>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  string s;
  while(getline(cin, s)){
    string t=s,u;
    while(getline(cin,s)){
      if(s.length()==0)
	break;
      t+=s;
    }
    if(t.length()==0)
      break;
    while(getline(cin,s)){
      if(s.length()==0)
	break;
      u+=s;
    }
    /*
  string s;
  while(getline(cin,s)){
    string t=s;
    while(getline(cin,s)&&s!="")
      t+=s;
    string u;
    getline(cin,u);
    getline(cin,s);
    */
    char z[256];
    memset(z,0,sizeof(z));
    int uln=u.length();
    for(i=0;i<uln;i++)
      z[(int)u[i]]=u[i];
    list<pair<int,set<char> > > a;
    int tln=t.length();
    int imn;
    unsigned nmn=-1;
    int ct=0;
    for(i=0;i<tln;i++){
      if(z[(int)t[i]]){
	set<char> b;
	b.insert(t[i]);
	a.push_back(make_pair(i,b));
	list<pair<int,set<char> > >::iterator it;
	for(it=a.begin();it!=a.end();it++){
	  (*it).second.insert(t[i]);
	  if((int)(*it).second.size()==uln){
	    if(nmn>(unsigned)(i-(*it).first+1)){
	      imn=(*it).first;
	      nmn=i-(*it).first+1;
	      ct=1;
	    }else if(nmn==(unsigned)(i-(*it).first+1)){
	      ct++;
	    }
	    it=a.erase(it);
	    it--;
	  }
	}
      }
    }
    if(nmn==(unsigned)-1){
      cout<<0<<endl<<endl;
    }else{
      cout<<ct<<endl<<endl;
      string v=t.substr(imn,nmn);
      int vln=v.length();
      for(i=0;i<vln/72;i++)
	cout<<v.substr(i*72,72)<<endl;
      if(vln%72)
	cout<<v.substr(i*72)<<endl;
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1516
import sys

w, h, *pq = map(int, sys.stdin.buffer.read().split())
vertical_split = 0
horizontal_split = 0
costs = []
costs.extend((p, 0) for p in pq[:w])
costs.extend((q, 1) for q in pq[w:])
costs.sort(reverse=True)

ans = 0
for c, t in costs:
    if t == 0:
        ans += c * (horizontal_split + 1)
        vertical_split += 1
    else:
        ans += c * (vertical_split + 1)
        horizontal_split += 1
print(ans)


Measured memory_bytes: 27584
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
long long read(){
	long long x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		if (ch=='-') w=-1;
		ch=getchar();
	}
	while (ch>='0' && ch<='9'){
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	return x*w;
}
long long Abs(long long x){
	return x>0?x:(-x);
}
long long s[200010];
int main(){
	long long n;
	n=read();
	for (long long i=1;i<=n;++i)
		s[i]=s[i-1]+read();
	long long ans=1e18;
	for (long long i=1;i<n;++i)
		ans=ans<Abs(s[n]-s[i]-s[i])?ans:Abs(s[n]-s[i]-s[i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
S = input()
T = input()

s = len(S)
t = len(T)

answer = t
for i in range(s-t+1):
  subS = S[i:i+t]
  count = 0
  for j in range(t):
    if subS[j] != T[j]:
      count += 1
  answer = min(answer,count)

print(answer)

Measured memory_bytes: 9064
int main(void)
{
  while(1){
    int w;
    int s=0,t=0,f=0;
    int sum;
    scanf("%d",&w);
    if(w==-1)
      break;
    w=w-10;
    if(w>10)
      s=10;
    else if(w>0)
      s=w;
    w=w-10;
    if(w>10)
      t=10;
    else if(w>0)
      t=w;
    w=w-10;
    if(w>0)    
      f=w;
    sum=1150+s*125+t*140+f*160;
    printf("%d\n",4280-sum);
  }

  return 0;
}

Measured memory_bytes: 600
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(string, S);
    ll ans = 1;
    REP(i, N - 1)
    {
        ans += S[i] != S[i + 1];
    }
    OUT(ans);
}

Measured memory_bytes: 512
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    int N;

    cin >> N;

    int first = 0;

    int second = 0;

    int judge = 0;

    for(int i = 1; i <= N; i++) {
        int p;
        cin >> p;

        if(p != i) {
            if(first == 0){
                first = i;
                second = p;
            }else if(first != 0 && judge == 0) {
                judge = 1;
                if(first != p || second != i) {
                    cout << "NO" << endl;  
                    return 0;
                }
            }else{
                judge = 2;
                cout << "NO" << endl;
                return 0;
            }
        }
    }

    if(judge != 2) 
    cout << "YES" << endl;

}

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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  for(int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

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

public class Main {
	
	static Scanner sc =  new java.util.Scanner(System.in);
	
	public static void main(String[] args) {
	
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int d = sc.nextInt();
	int e = sc.nextInt();
	int f = sc.nextInt();
	int g = sc.nextInt();
	int h = sc.nextInt();
	int i = sc.nextInt();
	int j = sc.nextInt();
			
	int [] array = new int [] {a,b,c,d,e,f,g,h,i,j};
	Arrays.sort(array);
	
	for ( int n = 9; n >= 7 ; n--){
		System.out.println( array[n] );
	}
}

}

Measured memory_bytes: 26256
li = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
li = list(map(int, li.split(',')))
k = int(input())
print(li[k - 1])

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

	int N, K, Q, tmp;
	cin >> N >> K >> Q;
	int initial_score = K - Q;
	vector<int> A(N, initial_score);

	for (int i = 0; i < Q; i++) {
		cin >> tmp;
		A[tmp - 1] = A[tmp - 1] + 1;
	}

	for (int i = 0; i < N; i++) {
		if (A[i] > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

    if (d == 25) {
        cout << "Christmas" << endl;
    } else if (d == 24) {
        cout << "Christmas Eve" << endl;
    } else if (d == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if (d == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
    return 0;
}



Measured memory_bytes: 256