akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int n;
int get(vector<int>a,vector<int>b,const int k){
    int res = 0;
    rep(i,n){
        a[i] %= (1<<(k+1));
        b[i] %= (1<<(k+1));
    }
    sort(b.begin(),b.end());
    const int c = 1<<k;
    for(auto x:a){
        res += (int)(lower_bound(b.begin(),b.end(),2*c-x)-lower_bound(b.begin(),b.end(),c-x));
        res += (int)(lower_bound(b.begin(),b.end(),4*c-x)-lower_bound(b.begin(),b.end(),3*c-x));
    }
    return res;
}
int main(){
    cin >> n;
    int ans = 0;
    vector<int>a(n),b(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    for(int i = 0; i <= 28; i++){
        if(get(a,b,i)%2){
            ans += 1<<i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3432
#include<cstdio>
const int N=605;
int n,d1,d2,tot;
bool col[2][N][N];
int s[2][2];
inline void work(int te,int ts,int len,int lim)
{
	if(ts%4==1)
	{
		for(int i=0;i<lim;i++)
			for(int j=0;j<lim;j++)
				if((i+j)&1)
					for(int k=0;k<len&&i*len+k<2*n;k++)
						for(int l=0;l<len&&j*len+l<2*n;l++)
							col[te][i*len+k][j*len+l]=1;
		return;
	}
	else if(ts%4==2)
	{
		for(int i=0;i<lim;i+=2)
			for(int j=0;j<lim;j++)
				for(int k=0;k<len&&i*len+k<2*n;k++)
					for(int l=0;l<len&&j*len+l<2*n;l++)
						col[te][i*len+k][j*len+l]=1;
		return;
	}
	else
		work(te,ts/4,len*2,(lim+1)/2);
}
int main()
{
	scanf("%d%d%d",&n,&d1,&d2);
	work(0,d1,1,2*n);
	work(1,d2,1,2*n);
	for(int i=0;i<2*n;i++)
		for(int j=0;j<2*n;j++)
			s[col[0][i][j]][col[1][i][j]]++;
	int tx=0,ty=0;
	for(int i=0;i<=1;i++)
		for(int j=0;j<=1;j++)
			if(s[i][j]>s[tx][ty])
			{
				tx=i;
				ty=j;
			}
	for(int i=0;i<2*n&&tot<n*n;i++)
		for(int j=0;j<2*n&&tot<n*n;j++)
			if(col[0][i][j]==tx&&col[1][i][j]==ty)
			{
				printf("%d %d\n",i,j);
				++tot;
			}
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long ll;

struct Edge
{
    int to, id;
};

vector<vector<Edge>> g;
vector<int> ans;

void dfs(int v, int c = -1, int p = -1)
{
    int k = 1;
    REP(i, g[v].size())
    {
        int u = g[v][i].to, ei = g[v][i].id;
        if (u == p) // 親
            continue;
        if (k == c) // 
            ++k;

        ans[ei] = k;
        ++k;
        dfs(u, ans[ei], v);
    }
}

int main()
{
    
    int n;

    cin >> n;
    g.resize(n);
    ans = vector<int>(n);

    REP(i, n - 1)
    {
        int a, b;
        cin >> a;
        cin >> b;
        a--, b--;
        g[a].push_back((Edge){b, i});
        g[b].push_back((Edge){a, i});
    }
    dfs(0);

    int mx = 0;
    REP(i, n)
    mx = max(mx, int(g[i].size()));
    cout << mx << endl;
    REP(i, n - 1)
    {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 8320
def main():
    n = int(input())
    max_a, max_b = 0, 0 # type:int
    for _ in range(n):
        a, b = input().split()
        a = int(a)
        if max_a < a:
            max_a = a
            max_b = int(b)
    print(max_a + max_b)


if __name__ == "__main__":
    main()

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

#define MAX 100000

int main(void){
  int n, x, A[MAX];
  int i, j;
  bool flag;

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

  for(i=0, j=0; i<n-1; i++){
    if(A[i]<=x){
      swap(A[i], A[j]);
      j++;
    }
  }

  swap(A[j], A[n-1]);

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

  printf("\n");
  
  return 0;
}



Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String original = "CODEFESTIVAL2016";
		int num = 0;
		for (int i = 0; i < original.length(); i++) {
			if(S.charAt(i) != original.charAt(i))
				num ++;
		}
		System.out.println(num);

	}

}

Measured memory_bytes: 10192
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>
#define fol(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N,c,d;
    long long K;
    cin >> N>>K;
    vector <pair<int,int>>a;
    fol(i,N){
        cin >>c >>d;
        a.push_back(make_pair(c,d));
    }
    sort(a.begin(),a.end());
    for (int i=0;K>0;i++){
        K -= a[i].second;
        if (K<=0)cout << a[i].first<<endl;
    }
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> inline T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    // n = 1700;
    cin >> n;
    vector<int> a(n);
    // rep(i, n) a[i] = 1000;
    rep(i, n) cin >> a[i];
    
    ll acc[2004] = {0};
    rep(i, n) acc[a[i]]++;
    rep(i, 2003) acc[i + 1] += acc[i];
    // rep(i, 5) cout << acc[i] << " "; cout << endl;
    ll sum = 0;
    rep(i, n) rep3(j, i + 1, n) {
        int s = a[i] + a[j]; // 未満
        int t = max(a[i] - a[j], a[j] - a[i]); // より大きい
        // cout << s << " " << t << endl;
        
        ll tmp = acc[s - 1] - acc[t];
        // cout << tmp << endl;
        if (t < a[i] && a[i] < s) tmp--;
        if (t < a[j] && a[j] < s) tmp--;
        // cout << tmp << endl;
        
        sum += max(0LL, tmp);
    }
    // cout << sum << endl;
    cout << sum / 3 << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

const int maxn = 305;
ll d[maxn][maxn];
int c[maxn][maxn];

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n, m, l;
  cin >> n >> m >> l;
  for(int i = 0; i < m; i++){
    int u, v, w;
    cin >> u >> v >> w;
    d[u][v] = d[v][u] = w;
  }
  for(int i = 0; i < maxn; i++){
    for(int j = 0; j < maxn; j++){
      if(i != j && !d[i][j]) d[i][j] = inf;
    }
  }
  for(int k = 1; k <= n; k++){
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(d[i][j] <= l){
        c[i][j] = 1;
      }
      else{
        c[i][j] = mod;
      }
    }
  }
  for(int k = 1; k <= n; k++){
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }
  int q;
  cin >> q;
  while(q--){
    int u, v;
    cin >> u >> v;
    if(c[u][v] == mod){
      cout << -1 << "\n";
    }
    else{
      cout << c[u][v] - 1 << "\n";
    }
  }
}

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

int main() {
  int N, M; cin >> N >> M;
  int max_l = 0, min_r = N;
  for (int i = 0; i < M; i++) {
    int l, r; cin >> l >> r;
    max_l = max(max_l, l); min_r = min(min_r, r);
  }
  cout << max(0, min_r - max_l + 1);
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,l;
  cin >> n >> l;
  int x = 1000000;
  int ans = 0;
  FOR(i,l,l+n){
    ans += i;
    if(abs(i)<abs(x)){
      x = i;
    }
  }
  cout << ans - x << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    N, M, P = mis()
    
    to = [[] for _ in range(N)]
    ot = [[] for _ in range(N)]
    edges = []

    for i in range(M):
        a,b,c = mis()
        a -= 1
        b -= 1
        c = -(c-P)
        #
        to[a].append(b)
        ot[b].append(a)
        edges.append((a,b,c))

    reachableFrom0 = set()
    reachableToN = set()

    # dfs
    reachableFrom0.add(0)
    nodes = [0]
    while nodes:
        node = nodes.pop()
        for i in to[node]:
            if i not in reachableFrom0:
                nodes.append(i)
                reachableFrom0.add(i)

    #rdfs
    reachableToN.add(N-1)
    nodes = [N-1]
    while nodes:
        node = nodes.pop()
        for i in ot[node]:
            if i not in reachableToN:
                nodes.append(i)
                reachableToN.add(i)


    ok = reachableFrom0 & reachableToN

    edges = tuple((a, b, c) for a, b, c in edges if a in ok and b in ok)

    V = [float('inf')] * N
    V[0] = 0

    def bf(n):
        for _ in range(n):
            upd = False
            for a, b, c in edges:
                if V[b] > V[a] + c:
                    V[b] = V[a] + c
                    upd = True
            if not upd:
                return False
        return True

    bf(N)

    if not bf(1):
        print(max(-V[-1], 0))
    else:
        print(-1)

main()


Measured memory_bytes: 5236
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, N);
    vector<i64> a(N), b(N);
    rep(i, 0, N) { read(a[i], b[i]); }

    i64 ans = 0;
    repr(i, N - 1, 0) {
        a[i] += ans;
        const i64 k = (a[i] + b[i] - 1) / b[i];
        dump(i, a[i], b[i], k);
        ans += b[i] * k - a[i];
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 1792
def rren(): return list(map(int, input().split()))


H, W = rren()
if(H % 3 == 0 or W % 3 == 0):
    print(0)
else:
    lis = []
    ans = 114514810
    for i in range(H):
        a = H - i
        b = i
        c = W // 2
        lis = [W*a, b*c, (W-c)*b]
        ans = min(ans, max(lis) - min(lis))
        lis.clear()
    for i in range(W):
        a = W - i
        b = i
        c = H // 2
        lis = [H*a, b*c, (H-c)*b]
        ans = min(ans, max(lis) - min(lis))
        lis.clear()
    for i in range(W//4, W//2):
        ans = min(ans, abs(i - (W-i*2))*H)
    for i in range(H//4, H//2):
        ans = min(ans, abs(i - (H-i*2))*W)
    print(ans)


Measured memory_bytes: 3064
r,c = map(int,input().split())
matrix = []
for i in range(r):
    inp = list(map(int,input().split()))
    matrix.append(inp)

for row in matrix:
    c_sum = 0
    for col in row:
        c_sum += col
    row.append(c_sum)

r_sum_list =[]
for col in range(c+1):
    r_sum = 0
    for row in range(r):
        r_sum += matrix[row][col]
    r_sum_list.append(r_sum)
matrix.append(r_sum_list)

for i in matrix:
    map_result = map(str,i)
    result = " ".join(map_result)
    print(result)


Measured memory_bytes: 5696
#include<bits/stdc++.h>
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define int long long
#define mp make_pair
#define fr(i,a,b) for(i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;

int n, q;
string s;

void solve(int k)
{
	int ans = 0;
	int i, d = 0, m = 0, l = 0, dm = 0;

	fr(i,0,n)
	{
		if(i - l == k)
		{
			if(s[l] == 'D')  d--, dm-=m;
			if(s[l] == 'M') m--;
			l++;
		}
		if(s[i] == 'C')
		{
			ans += dm;
		}
		if(s[i] == 'D') d++;
		if(s[i] == 'M') m++;
		if(s[i] == 'M') dm += d;
	}
	cout<<ans<<"\n";
}
signed main()
{
 	start_routine
	cin>>n>>s>>q;
	while(q--)
	{
		int k;
		cin>>k;
		solve(k);
	}
 	end_routine
}


Measured memory_bytes: 1948
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;

int h, w, n;
char maze[1001][1001];
int x[10];
int y[10];

char Map[1001][1001];
int d[1001][1001];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int bfs(int sx,int sy,int gx,int gy) {
	queue<pair<int, int>> que;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			d[i][j] = INF;
		}
	}
	que.push(pair<int, int>(sx, sy));
	d[sy][sx] = 0;
	while (que.size()) {
		pair<int, int> p = que.front();
		que.pop();
		if (p.first == gx&&p.second == gy) {
			break;
		}

		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if (0 <= nx&&nx < w && 0 <= ny&&ny <= h&&Map[ny][nx] != 'X'&&d[ny][nx] == INF) {
				que.push(pair<int, int>(nx, ny));
				d[ny][nx] = d[p.second][p.first] + 1;
			}
		}
	}
	return d[gy][gx];
}

void copy() {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			Map[i][j] = maze[i][j];
		}
	}
}

int main() {
	cin >> h >> w >> n;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> maze[i][j];
			if (maze[i][j] == 'S')x[0] = j, y[0] = i;
			if (maze[i][j] == '1')x[1] = j, y[1] = i;
			if (maze[i][j] == '2')x[2] = j, y[2] = i;
			if (maze[i][j] == '3')x[3] = j, y[3] = i;
			if (maze[i][j] == '4')x[4] = j, y[4] = i;
			if (maze[i][j] == '5')x[5] = j, y[5] = i;
			if (maze[i][j] == '6')x[6] = j, y[6] = i;
			if (maze[i][j] == '7')x[7] = j, y[7] = i;
			if (maze[i][j] == '8')x[8] = j, y[8] = i;
			if (maze[i][j] == '9')x[9] = j, y[9] = i;
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		copy();
		ans += bfs(x[i], y[i], x[i + 1], y[i + 1]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 8936
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	int N = scan.nextInt();
      	String s = scan.next();
      	int k = scan.nextInt();
      	String b = s.substring(k-1, k);
      	String anstring = s;
      	for(int i = 0; i < N; i++){
        	if(!s.substring(i, i+1).contains(b)){
              	String replaced = s.substring(i, i+1);
            	anstring = anstring.replace(replaced, "*");
            }
        }
     	System.out.print(anstring);
      
      
    }
 
}

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

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

  int64_t ans = (1 + N) * N / 2;
  ans -= (1 + N / 3) * (N / 3) / 2 * 3;
  ans -= (1 + N / 5) * (N / 5) / 2 * 5;
  ans += (1 + N / 15) * (N / 15) / 2 * 15;

  cout << ans << endl;
}


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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long

int main()
{
  IOS;
  char c;
  cin >> c;
  cout << static_cast<char>(c+1) << endl;
  return 0;
}


Measured memory_bytes: 3652
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A2.reverse()

for i in range(N-1):
  A1[i+1] += A1[i]
  A2[i+1] += A2[i]
  
ans = 0
for i in range(N):
  ans = max(ans, A1[i]+A2[N-1-i])
  
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>

int main(){
	std::vector<int> v;
	for (auto i = 0; i < 10; ++i){
		int t;
		std::cin >> t;
		v.push_back(t);
	}
	std::sort(v.begin(), v.end(), std::greater<int>());
	for (auto i = 0; i < 3; ++i){
		std::cout << v[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3052
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        String message = "";
        for (int i = 0; i < 25 - a; i++) {
            message += " Eve";
        }
        System.out.println("Christmas" + message);
    }
}


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

long long s[1000000],s2[10000000];

int main()
{

    long long a,n,i,sum=0,mn=1000000000000000,d;
    scanf("%lld",&n);
    scanf("%lld",&sum);
    s[0]=sum;

    for(i=1; i<n; i++)
    {
        scanf("%lld",&a);
        sum+=a;
        s[i]=sum;
    }

    for(i=0; i<n; i++)
    {
        s2[i]=sum-s[i];
    }

    for(i=0; i<n-1; i++)
    {
        d=abs(s[i]-s2[i]);
        if(d<mn)
        {
            mn=d;
        }
    }

    printf("%lld",mn);
    return 0;
}



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

using namespace std;

int n,t,x,y;
int dp[3010][3010][2];
vector<pair<int,int> > v;


int main() {
    scanf("%d %d", &n, &t);

    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &x, &y);
        v.emplace_back(x,y);
    }

    for (int i = n - 1; i >= 0; i--) {
        for (int j = 1; j <= t; ++j) {
            for (int k = 0; k < 2; ++k) {
                if(k) {
                    dp[i][j][k] = max(dp[i][j][k], dp[i + 1][j][0] + v[i].second);
                    if(j - v[i].first >= 0) 
                        dp[i][j][k] = max(dp[i][j][k], dp[i + 1][j - v[i].first][k] + v[i].second);
                } else {
                    if(j - v[i].first > 0)
                        dp[i][j][k] = max(dp[i][j][k], dp[i + 1][j - v[i].first][k] + v[i].second);
                }
                dp[i][j][k] = max(dp[i][j][k], dp[i + 1][j][k]);
            }
        }
    }
    
    printf("%d\n", dp[0][t][1]);
    return 0;
}


Measured memory_bytes: 70912
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 20 20:19:33 2017

@author: syaga
"""

if __name__ == "__main__":
    n, q = map(int, input().split())
    a = []
    for i in range(n):
        b = input().split()
        b[1] = int(b[1])
        a.append(b)
    ans = []
    time = 0
    while len(a) != 0:
        x = a.pop(0)
        if x[1] <= q:
            time += x[1]
            ans.append([x[0], time])
        else:
            x[1] -= q
            time += q
            a.append(x)
    for i in ans:
        print(" ".join(map(str, i)))

Measured memory_bytes: 21272
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main(){
  int n,m;
  cin>>n>>m;
  int h[100005];
  rep(i,n) cin>>h[i];
  bool f[100005];
  rep(i,n) f[i]=true;
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--; b--;
    if(h[a]<h[b]){
      f[a]=false;
    }
    else if(h[a]>h[b]){
      f[b]=false;
    }
    else{
      f[a]=false;
      f[b]=false;
    }
  }
  int ans=0;
  rep(i,n){
    if(f[i]==true) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4120
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	int N;
	string A,B;
	vector<char> ANS;
	cin >> N >> A >> B;

	for(int i=0;i<N;i++){
		ANS.push_back(A[i]);
		ANS.push_back(B[i]);
	}
	for(int i=0;i<ANS.size();i++){
		cout << ANS[i];
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include<iostream>
#include <math.h>
using namespace std;
int main(void) {   
    double a,b,c,d,x,y,z;
    cin>>a>>b>>c>>d;
    x=c-a;
    y=d-b;
    z=x*x+y*y;
    printf("%8f\n", pow(z, 0.5));
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<char> S(N);
  string color = "Three";
  rep(i,N) {
    cin >> S[i];
    if(S[i] == 'Y') {
      color = "Four";
      break;
    }
  }
  cout << color << endl;
}


Measured memory_bytes: 3592
# https://atcoder.jp/contests/agc008/tasks/agc008_a
x, y = map(int, input().split())

ans = float('inf')
for i in range(4):
    t = 0
    if i == 0:
        tx = -1 * x
        ty = y
        t += 1
    elif i == 1:
        tx = x
        ty = -1 * y
        t += 1
    elif i == 2:
        tx = -1 * x
        ty = -1 * y
        t += 2
    else:
        tx = x
        ty = y
    if tx <= ty:
        t += ty - tx
        ans = min(ans, t)

print(ans)

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

int main() {
  string S,T;
  int ans=0;
  cin>>S>>T;
  
  for(int i=0;i<S.size();i++){
  	if(S.at(i)!=T.at(i))ans++;
  }
  
  cout << ans << endl;
}

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

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

bool f(int x, int y)
{
	return x > y;
}
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int ans(int x)
{
	cout << x << endl;
	cout.flush();
	string s;
	cin >> s;

	if (s == "yes")
		return 1;
	return 0;
}
int32_t main()
{
	//c_p_c();
	FIO;

	int a, b, c, d;

	cin >> a >> b >> c >> d;

	cout << max(a * c, max(a * d, max(b * c, b * d)));
	// if (a >= 0 && c >= 0)
	// {
	// 	cout << max(a * c, b * d);

	// }
	// else if (a >= 0 && c <= 0)
	// {
	// 	cout << max(a * d, b * c);

	// }
	// else if (a <= 0 && c <= 0)
	// {
	// 	cout << max(a * c, b * d);
	// }
	// else if (a <= 0 && c >= 0)
	// {
	// 	cout << max(b * d, b * c);
	// }


}

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

int main(){
    int N;
    cin >> N;
    int H[21];
    
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    
    int ans = 1;
    int cnt = 0;
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < i; j++) {
            if(H[i] < H[j]) ++cnt;
        }
        if(cnt == 0) ++ans;
        cnt = 0;
    }
    
    cout << ans << endl;
    
}


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

int main(void){
    int i,j,k;
    char S[10];
    bool flag = false;
    
    scanf("%s",S);
    
    for(i = 0;i < 4;i++){
        flag = false;
        for(j = 0;j < 4;j++){
            if(S[i] == S[j] && i != j){
                if(flag){
                    printf("No\n");
                    return 0;
                }
                flag = true;
            }
        }
        if(flag == false){
            printf("No\n");
            return 0;
        }
    }

    
    printf("Yes\n");
    return 0;
}



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

typedef pair<int, int> P;
typedef long double ld;
typedef long long ll;
const int N = 105;

int n;
vector<int> G[N];
int dis[N];
int id[N];

pair<int, ld> get(vector<int> vs) {
    memset(dis, 0x3f, sizeof(dis));
    queue<int> que;
    for(int i : vs) dis[i] = 0, que.push(i);
    int mx_dis = 0;
    while(!que.empty()) {
        int v = que.front(); que.pop();
        for(int nxt : G[v]) {
            if(dis[nxt] > dis[v] + 1) {
                dis[nxt] = dis[v] + 1;
                que.push(nxt);
            }
        }
    }
    for(int i = 0; i < n; i++) id[i] = i;
    sort(id, id + n, [](const int a, const int b) {
        return dis[a] > dis[b];
    });
    mx_dis = dis[id[0]] + 1;
    int r = 0;
    ld sz = 1;
    for(int i = 0; i < n; i = r) {
        while(r < n && dis[id[r]] == dis[id[i]]) r++;
        if(i == 0) continue;
        int mx_bc = 0;
        for(int j = i; j < r; j++) {
            int cnt = 0;
            for(int nxt : G[id[j]]) if(dis[nxt] > dis[id[j]]) cnt++;
            mx_bc = max(mx_bc, cnt);
        }
//        cout << dis[id[i]] << ", " << mx_bc << endl;
        sz = mx_bc * sz;
    }
    sz *= vs.size();
    return {mx_dis, sz};
}

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


    pair<int, ld> res = {N, 0};
    for(int i = 0; i < n; i++) {
        res = min(res, get({i}));
        for(int nxt : G[i]) {
            if(nxt > i) res = min(res, get({i, nxt}));
        }
    }
    cout << res.first << " " << (ll)res.second << endl;
}

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

int main(){
   int n,a,c[100010]={0};
   cin>>n;
   for(int i=0;i<n;i++){ 
       cin>>a;
       c[a]++;
       if(c[a]%2) c[a]=1;
   }
   int s1=0,s2=0;
   for(int i=0;i<100004;i++){
       if(c[i]==1) s1++;
       else if(c[i]==2) s2++;
   }
   int ans=s1+s2;
   if(s2%2) ans--;
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())
E = [set() for _ in range(N)]
C = {}
for i in range(N-1):
  a,b,c = map(int,input().split())
  E[a-1].add(b-1)
  E[b-1].add(a-1)
  C[min(a-1,b-1)*N+max(a-1,b-1)] = c
  
Q,K = map(int,input().split())
K -= 1
#print(E)
#print(C)
#print(K)

Kcost = [0 for _ in range(N)]
def dfs(u,v):
  if v != -1:
    Kcost[u] = Kcost[v] + C[min(u,v)*N+max(u,v)]
  for t in E[u]:
    if t != K and Kcost[t] == 0:
      dfs(t,u)
dfs(K,-1)

for i in range(Q):
  x,y = map(int,input().split())
  print(Kcost[x-1]+Kcost[y-1])


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

typedef long long ll;
const int maxn = 1e5+100;

int a[maxn],b[maxn];
priority_queue<int,vector<int>,greater<int> > q;
int n;

int main(){
    scanf("%d",&n);
    ll sum = 0;
    ll sum2 = 0;
    int res = 0;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    ll l = 0;
    int f = 0;
    for(int i=0;i<n;i++){
        scanf("%d",&b[i]);
        sum2+=b[i];
        if(b[i]<=a[i]){
            q.push(a[i]-b[i]);
        }
        else{
            f = 1;
        }
    }
    l+=sum-sum2;
    if(sum2>sum){
        puts("-1");
        return 0;
    }
    while(!q.empty()&&l>=q.top()){
        l-=q.top();
        q.pop();
        res++;
    }
    if(l&&!f)res--;
    printf("%d\n",n-res);
    return 0;
}

Measured memory_bytes: 1532
import sys
pin = sys.stdin.buffer.readline

N = int(pin())
seqcount = 0
ans = 'No'
for i in range(N):
    d1, d2 = map(int, pin().split())
    if d1 == d2 and seqcount <2:
        seqcount += 1
    elif d1 == d2 and seqcount == 2:
        ans = 'Yes'
        break
    else:
        seqcount = 0

print(ans)

Measured memory_bytes: 9144
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int a[212345],b[212345];
int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin>>n;
    int i;
    vi vec1,vec2;
    rep(i,n){
    	cin>>a[i]>>b[i];
    	vec1.pb(a[i]);
    	vec2.pb(b[i]);
    }
    sort(all(vec1));
    sort(all(vec2));
    if(n%2==1){
    	cout<<vec2[n/2]-vec1[n/2]+1<<endl;
    }
    else{
    	cout<<vec2[n/2-1]+vec2[n/2]-vec1[n/2-1]-vec1[n/2]+1<<endl;
    }
    return 0;   
}


Measured memory_bytes: 6696
N, K = map(int, input().split())
A_array = list(map(int, input().split()))
F_array = list(map(int, input().split()))

A_array.sort()
F_array.sort()
F_array = F_array[::-1]

X = 0
Y = 10 ** 12

while(Y - X > 0):
    mid = (X + Y) // 2
    k = 0
    for a, f in zip(A_array, F_array):
        m = mid // f
        # print(a, f, k)
        k += max(0, a - m)
    if k <= K:
        Y = mid
    else:
        if Y - X == 1:
            break
        X = mid

print(Y)


Measured memory_bytes: 119500
#include <iostream>
#include <vector>

using namespace std;

long long int countPatty(long long int N, long long int X, vector<long long int> &layer, vector<long long int> &patty) {
  long long int res = 0;
  if (N == 0) {
    if (X == 0) {
      return 0;
    } else {
      return 1;
    }
  }
  
  if (X >= 1) {
    X--;
  }
  
  if (X >= layer[N - 1]) {
    res += patty[N - 1];
    X -= layer[N - 1];
    if (X >= 1) {
      res++;
      X--;
    }
  }
  
  res += countPatty(N - 1, X, layer, patty);
  
  return res;
}

int main() {
  long long int N, X;
  cin >> N >> X;
  
  vector<long long int> layer(N + 1), patty(N + 1);
  layer[0] = 1;
  patty[0] = 1;
  
  // cout << N << endl;
  for (int i = 1; i <= N; i++) {
    layer[i] = 2 * layer[i - 1] + 3;
    patty[i] = 2 * patty[i - 1] + 1;
    //cout << layer[i] << " " << patty[i] << endl;
  }
  
  cout << countPatty(N, X, layer, patty) << endl;
  
  return 0;
}

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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out,false);
        int n = scanner.nextInt(), m = scanner.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>(Collections.reverseOrder());
        for(int i =0; i < n; i++) queue.offer(scanner.nextInt());
        while(m-->0) {
            int max = queue.poll();
            queue.offer(max/2);
        }
        long sum = 0;
        while(!queue.isEmpty()) {
            sum += queue.poll();
        }
        out.println(sum);
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 45580
K, N = map(int, input().split())
A = list(map(int, input().split()))
d = [0] * N
for i in range(N-1):
  d[i] = A[i+1] - A[i]
d[N-1] = K - A[N-1] + A[0]
print(K - max(d))

Measured memory_bytes: 26436
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

int main()
{
    int X,t;
    cin >> X >> t;
    cout << X - min(X,t) << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int n, i, j, a, b, l, cnt = 1;

    string s;

    cin >> n;

    if(n%2 == 0)
        cout << fixed << setprecision(10) << (double)(n/2)/n << endl;
    else
        cout << fixed << setprecision(10) << (double)((n/2)+1)/n << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int N, W; cin >> N >> W;
  vector<int> w(N), v(N); REP(i, N) cin >> w[i] >> v[i];
  vector<vector<long long> > dp(N+1, vector<long long>(100001, LINF));
  dp[0][0] = 0;
  REP(i, N) REP(j, 100001) {
    if (j - v[i] >= 0) dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
    else dp[i+1][j] = dp[i][j];
  }
  for (int j = 100000; j >= 0; --j) if (dp[N][j] <= W) {
    cout << j << '\n';
    return 0;
  }
}


Measured memory_bytes: 80256
import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer a = Integer.parseInt(scanner.next());
        Integer b = Integer.parseInt(scanner.next());

        Integer result;
        Integer total = Integer.sum(a, b);

        if (total > 3) {
            result = Math.abs(a - b);
        } else {
           result = a + b;
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main() {
  string ST;
  cin>>ST;
  int N,W,S,E;
  N=0;
  W=0;
  S=0;
  E=0;
  for(int i=0;i<ST.size();i++){
    if(ST[i]=='N'&&N==0)N=10;
    if(ST[i]=='W'&&W==0)W=1;
    if(ST[i]=='S'&&S==0)S=-10;
    if(ST[i]=='E'&&E==0)E=-1;
  }
  if(N+W+S+E==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int N, K;
  cin >> N >> K;
  int A[N];
  REP(i, N) { cin >> A[i]; }
  int x = (N - 1) / (K - 1);
  int ans = ((N - 1) % (K - 1) == 0) ? x : x + 1;
  cout << ans;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define vi vector < int >
#define pii pair < int, int >
#define INF (int)1e9
#define pb push_back
#define fastIO ios::sync_with_stdio(0); cin.tie(0);

int main()
{
    fastIO
    
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    if(k <= a)
        cout << k;
    else if(k <= a + b)
        cout << a;
    else if(k <= a + b + c)
        cout << a - (k - a - b);

    return 0;
}

Measured memory_bytes: 3608
import numpy as np
N, K = map(int, input().split())
member = np.ones(N, dtype=int)
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        member[A[j]-1] = 0
print(sum(member))


Measured memory_bytes: 27176
N = parse(Int, readline())
str = readline()
str = split(str)
a = similar(str, Int)
for i = 1:length(str)
    a[i] = parse(Int, str[i])
end

max = a[1]
total = 0
for i = 2:length(a)
    if a[i] >= max
        global max = a[i]
    else
        global total += max - a[i]
    end
end
println(total)


Measured memory_bytes: 199792
n, k = map(int, input().split())

N = list(range(1,n +1))
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for p in a:
        N[p - 1] = 0

cnt = 0                    
for q in N:
    if q != 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 9140
/* gcc acG019A.c -o acG019A */
/*
あなたは行きつけの店、インフバリューにアイスティーを買いに来ています。
この店では、様々なサイズのボトル入りアイスティーが様々な価格で売られています。具体的な価格は、0.25 リットルサイズが一つ Q 円、0.5 リットルサイズが一つ H 円、1 リットルサイズが一つ S 円、2 リットルサイズが一つ D 円です。各サイズの在庫は無限にあります。
あなたはちょうど N リットルのアイスティーを買いたいです。これに必要な金額は何円でしょうか？

制約
1≤Q,H,S,D≤108
1≤N≤109
入力値はすべて整数である。
入力は以下の形式で標準入力から与えられる。
Q H S D
N
*/


#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>


int main()
{
int a[4];// 2ℓあたりの値段
/*
int Q, H, S, D;
int N;
int i;
int min1, min2;
int ans;
*/
unsigned long Q, H, S, D;
unsigned long N;
int i;
unsigned long min1, min2;
unsigned long long ans;



  scanf("%d%d%d%d", &Q, &H, &S, &D);
scanf("%d", &N);
a[0] = 8*Q;
a[1] = 4*H;
a[2] = 2*S;
a[3] = D;

min1 = a[0]/2;
for(i = 1; i <= 2; i++){
  if(min1 > a[i]/2){
    min1 = a[i]/2;
  }
}

min2 = a[0];
for(i = 1; i <= 3; i++){
  if(min2 > a[i]){
    min2 = a[i];
  }
}

ans = min2 * (N / 2) + min1 * (N % 2);
//printf("min1 = %d, min2 = %d, ans =%d", min1, min2, ans);
printf("%llu", ans);
return 0;
}


Measured memory_bytes: 128
function main(input){
  var num = 0;//合計スライム
  var i = 0;//文字列カウンタ
  var inputN;
  var inputD;
  input = input.split('\n');
  inputN = parseInt(input[0]);
  inputD =  input[1];

  while(i<inputN){
    if(inputD.charAt(i) == inputD.charAt(i+1)){
      i++;
      continue;
    }
    i++;
    num++;
  }
  console.log(num);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

const int mid = 50000;
const int haba = 4000;
bool match(char a, char b) {
	return (a == b or a == '?' or b == '?');
}
bool ab[100000], bc[100000], ac[100000];

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	string S,T,U; cin >> S >> T >> U;
	int N = S.size();
	int M = T.size();
	int K = U.size();

	for (int i = - haba; i <= haba; ++i) {
		rep(j,N) {
			if (j-i < 0 || j-i >= M) continue;
			if (!match(S[j],T[j-i])) ab[mid+i] = true;
		}
	}
	for (int i = - 2*haba; i <= 2*haba; ++i) {
		rep(j,M) {
			if (j-i < 0 || j-i >= K) continue;
			if (!match(T[j],U[j-i])) bc[mid+i] = true;
		}
	}
	for (int i = - haba; i <= haba; ++i) {
		rep(j,N) {
			if (j-i < 0 || j-i >= K) continue;
			if (!match(S[j],U[j-i])) ac[mid+i] = true;
		}
	}

	int ans = 1e9;
	for (int i = -haba; i <= haba; ++i) {
		for (int j = -haba; j <= haba; ++j) {
			if (!ab[mid+i] and !ac[mid+j] and !bc[mid+j-i]) {
				int left = min({mid,mid+i,mid+j});
				int right = max({mid+N,mid+i+M,mid+j+K});
				chmin(ans,right - left);
			}
		}
	}

	cout << ans << ln;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int ans = 0;
    for(int i = S.length()-2; i > 0; i-=2){
      S = S.substring(0, i);
      String s1 = S.substring(0, i/2);
      String s2 = S.substring(i/2, i);
      if(s1.equals(s2)){
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 #define PI acos(-1)
 #define MOD ((int)1e9+7)
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
 

 
const int N=2e5+100;
ll visited[100005];
//ll a[200000];
 

#define lop(i,n) for(int i=0;i<n;++i)
//ll n,m,mod;

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

const int MAX = 2e5 + 10 ;
void finis(){cout<<-1;}
vector<ll>v[1000000];


ll h,w,n,m;
ll wa,tle,re,ac;
int main()
{  ios::sync_with_stdio(0);
cin.tie(0);
cin>>n;
    for(int i=0;i<n;i++){
        string x;
        cin>>x;
        if(x=="AC"){ac++;}if(x=="WA"){wa++;}if(x=="TLE"){tle++;}if(x=="RE"){re++;}
        
    }cout<<"AC x "<<ac<<endl;cout<<"WA x "<<wa<<endl;cout<<"TLE x "<<tle<<endl;cout<<"RE x "<<re<<endl;
    
}


Measured memory_bytes: 27104
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	k, s := nextInt(), next()
	if k >= len(s) {
		fmt.Println(s)
	} else {
		fmt.Print(s[:k])
		fmt.Println("...")
	}

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

func max(a, b int) int {
	return int(max64(int64(a), int64(b)))
}

func max64(a int64, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func min(a, b int) int {
	return int(min64(int64(a), int64(b)))
}

func min64(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1756
#include<bits/stdc++.h>
    using namespace std;
    #define PAIN___ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define ll long long int
    #define fi first
    #define se second
    #define pb push_back
    #define pii pair < int , int >
    #define mp make_pair
    #define vec vector < ll >
    #define vecp vector < pii  >
    #define forl(i,q1,n,q2) for(ll i=q1;i<q2;i++)
    #define null NULL
    #define mm 1000005


    int main()
    {
        PAIN___;
        ll t;
        t=1;
        while(t--)
        {
            ll x,a;
            cin>>a>>x;
            if(x>a)cout<<0<<endl;
            else{
                cout<<10<<endl;
            }

    }
    }



Measured memory_bytes: 256