akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define All(x) (x).begin(), (x).end()
#define lowbit(x) ((x) & -(x))
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const ll mod = 1e9 + 7;
const int N = 4e6 + 10;
const db pi = acos(-1);
list<int> a[1010];
int main()
{
	int n = read();
	int Q = read();
	
	while(Q --)
	{
		int op = read();
		if(op == 0) {int x = read();a[x].pb(read());}
		if(op == 1) 
		{
			int x = read();
			if(!sz(a[x])) {puts(""); continue;}
			printf("%d",*a[x].begin());
            for(list<int>::iterator i = ++ a[x].begin(); i != a[x].end(); i ++) printf(" %d",*i);
			puts("");
		}
		if(op == 2) 
		{
			int x = read();
			int y = read();
			a[y].splice(a[y].end(),move(a[x]));
		}
	}
	return 0;
}



Measured memory_bytes: 18800
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] num =new int[3];
            string[] inputLine = Console.ReadLine().Split();
            
            for(int i=0;i<3;i++)
            {
                num[i] = int.Parse(inputLine[i]);
            }
            
            if(num[0]<num[1])
            {
                if(num[2]<num[0])
                {
                    Console.WriteLine(num[2] + " " + num[0] + " " + num[1]);
                }
                else if (num[1]<num[2])
                {
                    Console.WriteLine(num[0] + " " + num[1] + " " + num[2]);
                }
                else
                {
                    Console.WriteLine(num[0] + " " + num[2] + " " + num[1]);
                }
            }
            else
            {
                if (num[2] < num[1])
                {
                    Console.WriteLine(num[2] + " " + num[1] + " " + num[0]);
                }
                else if (num[0] < num[2])
                {
                    Console.WriteLine(num[1] + " " + num[0] + " " + num[2]);
                }
                else
                {
                    Console.WriteLine(num[1] + " " + num[2] + " " + num[0]);
                }

            }


        }
    }
}



Measured memory_bytes: 17968
b = [int(i) for i in input().split()]
if b[0] == 1 or b[1] == 1:
    print(1)
elif b[0] * b[1] % 2 == 0:
    print(b[0] * b[1] // 2)
else:
    print(b[0] * b[1] // 2 + 1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N,ans=0;
    cin>>N;
    vector<int> a(N,0);
    REP(i,N)cin>>a[i];
    REP(i,N){
        REP(y,N){
            if(i!=y)ans=max(ans,abs(a[i]-a[y]));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# abc172_c.py
'''
尺取り法、二分探索、両方良問なので両方で解けるようにする。
'''
N, M ,K= map(int,input().split())
A = [0] + list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
cnt = []
b_idx = M-1
# A を１冊ずつ増やす→B の読める場所を後ろにずらしていくイメージで実装する
# 両方累積和で管理して、計算を減らす(Bは特に後ろにずらすと再計算が必要) 
b_cum = []
cum = 0
for b in B:
    cum += b
    b_cum.append(cum)
a_sum = 0
for i,a in enumerate(A):
    a_sum += a
    if a_sum > K:
        break
    while b_idx >= 0 and a_sum + b_cum[b_idx] > K:
        b_idx -= 1
    ans = max(ans, i + b_idx + 1)
print(ans)

Measured memory_bytes: 115736
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

#define N 1024

long int ppp[N];
long int ppn[N];
long int pnp[N];
long int pnn[N];
long int npp[N];
long int npn[N];
long int nnp[N];
long int nnn[N];
long int pos[8][N];

int main(){
  int n,m;
  cin >> n >> m;
  long int a,b,c;
//  int* x = (int*)calloc(sizeof(int),n);
//  int* y = (int*)calloc(sizeof(int),n);
//  int* z = (int*)calloc(sizeof(int),n);
  for (int i = 0; i < n;  ++i) {
    cin >> a>>b>>c;
    pos[0][i] = a+b+c;
    pos[1][i] = a+b-c;
    pos[2][i] = a-b+c;
    pos[3][i] = a-b-c;
    pos[4][i] = -a+b+c;
    pos[5][i] = -a+b-c;
    pos[6][i] = -a-b+c;
    pos[7][i] = -a-b-c;
  }

  for (int i = 0; i < 8; ++i) {
    sort(pos[i],pos[i]+n,greater<long int>());
  }

  long int maxi = 0;
  for (int i = 0; i < 8; ++i) {
    a=0;
    for (int j = 0; j < m; ++j) {
      a += pos[i][j];
    }
    if(a>maxi){
      maxi = a;
    }
  }

  cout << maxi <<endl;
//longにする必要あり!!!
  return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll

int N, A[maxn];

int32_t main(){
	fast;
	
	cin>>N;
	FOR(i,1,N) cin>>A[i];
	
	int ans = 0;
	FOR(i,2,N){
		ans += max(0LL,A[i-1] - A[i]);
		A[i] += max(0LL,A[i-1] - A[i]);
	}
	cout<<ans;
}


Measured memory_bytes: 5164
#include<stdio.h>
#include<stdlib.h>


int main() {
	int i, j, k, f = 0, n, s, t;
	int mp = 0, a, b, c, d, e, x, y, z;
	char g[12000000];

	scanf("%s", g);
	d = 0;
	e = 0;
	for (i = 0;i<11000000;i++) {
		if (g[i]=='0') {
			d++;
		}
		else if (g[i] == '1') {
			e++;
		}
	}
	if (d > e) {
		y = e;
	}
	else {
		y = d;
	}
	
	x = 2 * y;

	printf("%d", x);
	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
using namespace std;
int main(){
	int N,T;
	cin>>N;
	cin>>T;
	int ans=1;
	N=N-T;
	if(N<=0){
		cout<<ans;
		return 0;
	}
	T=T-1;
	ans+=N/T;
	if(N%T!=0)ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#define MAX 100
using namespace std ;
 
int main()
{
    int n;
    int t=0,h=0,comp=0;
    char tarou[MAX], hanako[MAX];
     
    cin >> n ;
     
    for(;n>0;n--)
	{     
        cin >> tarou >> hanako;

		comp = strcmp(tarou,hanako);
         
        if(comp>0){
            t+=3;
        }
         
        if(comp==0){
            t++;
            h++;
        }
         
        if(comp<0){
            h+=3;
        }
    }    
     
    cout << t << ' ' << h << endl ;
     
    return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(void){
    int n,count = 0,check = 0;
    scanf("%d",&n);
    int import[n];
    for (int i = 0; i < n; ++i) {
        scanf("%d",&import[i]);
    }

    do {
        check = 0;
        for (int i = 0; i < n; ++i) {
            if (import[i]%2 == 0){
                import[i] = import[i]/2;
                check++;
            }
            else{
                break;
            }
        }
        count++;
    }while (check == n);

    printf("%d",count - 1);
    return 0;
}

Measured memory_bytes: 1692
def cf(n1,n2):
    cf=[1]
    for i in range(2,min(n1,n2)+1):
        if n1%i==0 and n2%i==0:
            cf.append(i)
    return cf
a, b, k = map(int, input().split())
nums = cf(a,b)
print(nums[-k])

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

#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

//????°?????????°???(c/c++?????¶??????????°???°???)
int modulo(int x, int mod) {
	return (x%mod < 0) ? x%mod + abs(mod) : x%mod;
}

string f(int n) {
	string ret = "";
	while (n != 0) {
		int mod = n%-10;
		n /= -10;
		dump(mod)dumpl(n);
		if (mod < 0) {
			mod += 10;
			n++;
		}
		char c = '0' + mod;
		ret += c;
		dump(mod)dump(n)dumpl(ret);
	}
	reverse(all(ret));
	return ret;
}

signed main() {
	for (int n; cin >> n&&n;) {
		cout << f(n) << endl;
	}
	return 0;
}

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

int main (){
  int x;
  vector<int> v;
  while (cin >> x) {
    v.push_back(x);
  }

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

  cout << v[0] << ' '<< v[1] << ' '<< v[2] << endl;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> class RPQ : public priority_queue<T, vector<T>, greater<T>> { };
template<typename C> void dijkstra(int s, vector<vector<pair<int, C>>> const & g, vector<C> & d) {
	RPQ<pair<C, int>> q;
	d[s] = 0;
	q.emplace(d[s], s);
	while(! q.empty()) {
		C   c = q.top().FI;
		int v = q.top().SE;
		q.pop();
		if(d[v] != c) { continue; }
		for(auto & e : g[v]) {
			int ev = e.FI;
			C   ec = e.SE;
			if(setmin(d[ev], d[v] + ec)) { q.emplace(d[ev], ev); }
		}
	}
}

int main() {
	IN(int, n, m, s);
	const int M = 50 * 2 * m;
	const int V = n * (M + 1);
	auto id = [&](int i, int j) { return (M + 1) * i + j; };
	vector<vector<pair<int, LL>>> g(V);
	inc(i, m) {
		IN(int, x, y, a, b);
		x--; y--;
		incII(j, a, M) {
			g[id(x, j)].EB(id(y, j - a), b);
			g[id(y, j)].EB(id(x, j - a), b);
		}
	}
	inc(i, n) {
		IN(int, c, d);
		inc(j, M) {
			g[id(i, j)].EB(id(i, min(j + c, M)), d);
		}
	}
	
	const LL INF = 1e18;
	vector<LL> d(V, INF);
	dijkstra<LL>(id(0, min(s, M)), g, d);
	incID(i, 1, n) {
		LL ans = INF;
		incII(j, 0, M) { setmin(ans, d[id(i, j)]); }
		OUT(ans);
	}
}


Measured memory_bytes: 84112
open Batteries
module Myset = Set.Make(Int)

let () =
  let s = Scanf.scanf "%s " (fun a -> a) in
  let x,y = Scanf.scanf "%d %d " (fun a b -> a,b) in

  let c_lst = String.to_list s in

  let rec re_x cnt = function
      [] -> x-cnt, []
    | 'F'::tl -> re_x (cnt+1) tl
    | 'T'::tl -> (x-cnt), tl
  in

  let x,c_lst = re_x 0 c_lst in

  let rec aux xl yl cnt is_x = function
      [] -> if is_x then (cnt::xl),yl else xl,(cnt::yl)
    | 'F'::tl -> aux xl yl (cnt+1) is_x tl
    | 'T'::tl -> 
      if is_x = true then aux (cnt::xl) yl 0 (not is_x) tl else
        aux xl (cnt::yl) 0 (not is_x) tl
  in
  let xl,yl = aux [] [] 0 false c_lst in

  let xl = List.filter (fun x -> x <> 0) xl in
  let yl = List.filter (fun x -> x <> 0) yl in

  let xset_ = (Myset.add 0 Myset.empty) in
  let x_ans_ = List.fold_left (fun set1 dy -> 
      Myset.fold (fun el set2 -> 
          let retset = Myset.add (el-dy) (Myset.add (el+dy) set2) in retset
        ) set1 (Myset.empty)
    ) xset_ xl in

  let yset_ = (Myset.add 0 Myset.empty) in
  let y_ans_ = List.fold_left (fun set1 dy -> 
      Myset.fold (fun el set2 -> 
          let retset = Myset.add (el-dy) (Myset.add (el+dy) set2) in retset
        ) set1 (Myset.empty)
    ) yset_ yl in

  Printf.printf "%s\n" @@
  if (Myset.mem x x_ans_) && (Myset.mem y y_ans_) then "Yes" else "No"


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

int main(){
	int h, w;
	cin>>h>>w;
	char A[h+2][w+2];
	
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			cin>>A[i][j];
		}
	}
	
	//borda
	for(int i=0; i<=h+1; i++){
		for(int j=0; j<=w+1; j++){
			if((i==0)or(i==h+1)){
				A[i][j] = '#';
			}else if((j==0)or(j==w+1)){
				A[i][j] = '#';
			}
		}
	}
	
	for(int i=0; i<h+2; i++){
		for(int j=0; j<w+2; j++){
			cout<<A[i][j];
			if(j==w+1){
				cout<<"\n";
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

#define TRACE(x) std::cout << #x << " = " << x << "\n"
#define _ << " _ " <<

template <int32_t P>
struct IntModT {
  int32_t value;

  explicit IntModT(int32_t value) : value(value){};

  IntModT& operator+=(const IntModT& other) {
    value += other.value;
    if (value >= P) value -= P;
    return *this;
  }

  IntModT& operator-=(const IntModT& other) {
    value -= other.value;
    if (value < 0) value += P;
    return *this;
  }

  IntModT& operator*=(const IntModT& other) {
    int64_t result =
        static_cast<int64_t>(value) * static_cast<int64_t>(other.value);
    value = static_cast<int32_t>(result % P);
    return *this;
  }
};

template <int32_t P>
IntModT<P> operator+(const IntModT<P>& a, const IntModT<P>& b) {
  auto res = a;
  return res += b;
};

template <int32_t P>
IntModT<P> operator-(const IntModT<P>& a, const IntModT<P>& b) {
  auto res = a;
  return res -= b;
};

template <int32_t P>
IntModT<P> operator*(const IntModT<P>& a, const IntModT<P>& b) {
  auto res = a;
  return res *= b;
};

template <int32_t P>
bool operator==(const IntModT<P>& a, const IntModT<P>& b) {
  return a.value == b.value;
};

template <int32_t P>
std::ostream& operator<<(std::ostream& os, const IntModT<P>& a) {
  os << a.value;
  return os;
}

using IntMod = IntModT<1000000007>;

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

  int N;
  std::cin >> N;

  std::string S;
  std::cin >> S;

  std::vector<int> count(26, 0);
  for (char c : S) {
    count[static_cast<int>(c) - 'a']++;
  }

  IntMod ret{1};
  for (int x : count) {
    ret *= IntMod{x + 1};
  }

  ret -= IntMod{1};
  std::cout << ret << "\n";
  return 0;
}


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

typedef long long ll;
typedef tuple<int,int,int> tiii;

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }

  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};



int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int N, Q;
    cin >> N >> Q;
    vector<int> c(N);
    for (int i = 0; i < N; ++i) cin >> c[i];
    SegmentTree<int> seg(N, [](int a, int b) { return a + b; }, 0);
    vector<tiii> que(Q);
    for (int i = 0; i < Q; i++) {
        int l, r; cin >> l >> r;
        que[i] = tiii(l, r, i);
    }
    sort(que.begin(), que.end(), [](tiii a, tiii b) { return get<1>(a) < get<1>(b); });
    vector<int> ans(Q);
    vector<int> place(N+1, -1);
    int read = 0;
    for (int i = 0; i < Q; i++) {
        int l, r, ind; tie(l, r, ind) = que[i];
        while (read < r) {
            if (place[c[read]] != -1) {
                seg.update(place[c[read]], 0);
            }
            place[c[read]] = read;
            seg.update(read, 1);
            read++;
        }
        ans[ind] = seg.query(l-1, r);
    }
    for (int i = 0; i < Q; ++i) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 19584
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int a, b, c, d, e, k; cin>>a>>b>>c>>d>>e>>k;
    if(e - a <= k) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/(double)b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}


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

using namespace std;
using ll = long long int;

ll powmod(ll base, ll exp, ll mod) {
    if (exp == 0) {
        return 1;
    }
    if (exp % 2 == 0) {
        ll t = powmod(base, exp / 2, mod);
        return (t * t) % mod;
    }
    return (base * powmod(base, exp - 1, mod)) % mod;
}

unordered_map<ll, ll> primefactordecomp(ll n) {
    unordered_map<ll, ll> ans = unordered_map<ll, ll>();
    ll m = pow(n, 0.5) + 1;
    for (ll i = 2; i < m; i++) {
        while (n > 1) {
            if (n % i != 0) {
                break;
            } else {
                if (ans.count(i) == 0) {
                    ans[i] = 0;
                }
                ans[i] += 1;
                n = ll(n / i);
                continue;
            }
        }
    }
    if (n > 1) {
        ans[n] = 1;
    }
    return ans;
}

int main() {
    int N;
    unordered_map<ll, ll> total_primes = unordered_map<ll, ll>();
    vector<unordered_map<ll, ll>> each_primes = vector<unordered_map<ll, ll>>();

    ll M = pow(10, 9) + 7;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        ll c;
        cin >> c;
        A[i] = c;

        unordered_map<ll, ll> primes = primefactordecomp(c);
        for (pair<ll, ll> p: primes) {
            if (total_primes.count(p.first) == 0) {
                total_primes[p.first] = 0;
            }
            total_primes[p.first] = max(p.second, total_primes[p.first]);
        }
    }

    ll lcm = 1;
    for (pair<ll, ll> p: total_primes) {
        lcm *= powmod(p.first, p.second, M);
        lcm %= M;
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += (lcm * powmod(A[i], M - 2, M)) % M;
        ans %= M;
    }
    cout << ans << endl;
}

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

int N;
long long sum=0;
int arr[300000];
int main(){
  cin >> N;
  for (int i=0;i<3*N;i++){
    cin >> arr[i];
  }
  //Second last, decrement by -2
  sort(arr,arr+(3*N));
  
  int index = 3*N-2;
  for (int i=0;i<N;i++){
    sum += arr[index];
    index -=2;
  }
  cout << sum;
  return 0;
}

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

#define MOD 1000000007

using namespace std;

int main() {
	
	int n, m, x;
	cin >> n >> m;
	vector<int> a(1, 0), b(1, 0);
	for (int i = 0; i < n; i++) {
		cin >> x;
		a.push_back(x);
	}
	for (int i = 0; i < m; i++) {
		cin >> x;
		b.push_back(x);
	}
	vector<vector<int>> f(n + 1, vector<int>(m + 1, 0));
	for (int i = 0; i <= n; i++) {
		f[i][0] = 1;
	}
	for (int j = 0; j <= m; j++) {
		f[0][j] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
		    f[i][j] = (f[i - 1][j] + f[i][j - 1]) % MOD;
		    if (a[i] != b[j]) {
		      f[i][j] = (f[i][j] + MOD - f[i - 1][j - 1]) % MOD;
		    }
		}
	}
	cout << f[n][m] << endl;
}

Measured memory_bytes: 16000
N,M,S = map(int,input().split())
edges = [[] for _ in range(2500*50 + 100)]
def indexer(city,coin):
    return 50*coin + city

for _ in range(M):
    u,v,a,b = map(int,input().split())
    u -= 1
    v -= 1
    for scoin in range(a,2501):
        edges[indexer(u,scoin)].append((b,indexer(v,scoin-a)))
        edges[indexer(v,scoin)].append((b,indexer(u,scoin-a)))
## 両替
for i in range(N):
    c,d = map(int,input().split())
    for scoin in range(c,2501):
        edges[indexer(i,scoin-c)].append((d,indexer(i,scoin)))

def dijkstra(s,n,edges):
    import heapq
    INF = float('inf')
    d = [INF]*n
    d[s] = 0
    pq = [(0,s)]
    while len(pq):
        c,v = heapq.heappop(pq)
        if d[v] < c:
            continue
        for v2nvcost, nv in edges[v]:
            if c + v2nvcost < d[nv]:
                d[nv] = c + v2nvcost
                heapq.heappush(pq,(d[nv],nv))
    return d


d=dijkstra(indexer(0,min(2500,S)),2500*50 + 100,edges)
for i in range(1,N):
    ans = float('inf')
    for j in range(2501):
        ans = min(ans,d[indexer(i,j)])
    print(ans)

Measured memory_bytes: 120804
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    
    rep(i, N){
        cin >> A[i];
    }
    
    vector<vector<ll>> dp(N, vector<ll>(2, 0));
    dp[0][0] = 1;
    dp[0][A[0] % 2] += 1;
    
    rep(i, 1, N){
        dp[i] = dp[i - 1];
        int b = A[i] % 2;
        dp[i][b] += dp[i - 1][0];
        dp[i][b ^ 1] += dp[i - 1][1];
    }
    
    output(dp[N - 1][P]);
    
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        HashMap<Character,Integer> map = new HashMap<>();
        for(int i=0;i<26;i++){
            map.put((char)('a'+i),0);
        }
        String str,str1;
        while((str = br.readLine())!=null){
            str1 = str.toLowerCase();
            for(int i=0;i<str1.length();i++){
                char c = str1.charAt(i);
                if(map.containsKey(c)){
                    map.put(c,map.get(c)+1);
                }
            }
        }
        for(HashMap.Entry<Character,Integer> entry:map.entrySet()){
            System.out.println(entry.getKey()+" : "+entry.getValue());
        }
    }
}

Measured memory_bytes: 24204
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int X;
    cin>>X;

    if(X==5||X==3||X==7){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }


}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int gcd(int x,int y){return (y==0)?x:gcd(y,x%y);}
int n;
int a[2010];
int in[2010];
int vis[2010];
int ed[2010][2010];
vector<int> e[2010];
priority_queue<int,vector<int>,less<int> > q;
void dfs(int x)
{
	vis[x]=1;
	for(int i=1;i<=n;i++)
		if(!vis[i]&&ed[x][i])
		{
			in[i]++;
			e[x].push_back(i);
			dfs(i);
		}
}
signed main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(gcd(a[i],a[j])!=1)
				ed[i][j]=1,ed[j][i]=1;
	for(int i=1;i<=n;i++)
		if(!vis[i])
			dfs(i);
	for(int i=1;i<=n;i++)
		if(in[i]==0)
			q.push(i);
	while(!q.empty())
	{
		int u=q.top();
		q.pop();
		printf("%d ",a[u]);
		for(int i=0;i<e[u].size();i++)
		{
			int to=e[u][i];
			in[to]--;
			if(in[to]==0)
				q.push(to);
		}
	}
	return 0;
}


Measured memory_bytes: 16256
s=input()
t=input()
S,T=len(s),len(t)
dp=[[0]*(T+1) for _ in range(S+1)]
for i in range(S):
    for j in range(T):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

l=dp[S][T]
x,y=S,T
ans=[0]*l
while l>0:
    if s[x-1]==t[y-1]:
        ans[l-1]=s[x-1]
        l-=1
        x-=1
        y-=1
    else:
        if dp[x][y]==dp[x-1][y]:x-=1
        else:y-=1
print("".join(ans))

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

// clang-format off
#define range(i, l, r) for (int i = (int)l; i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = ((int)(r) - 1); i >= (int)l; --(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

inline void br(ostream &os = cerr) { os << endl; }

using int32 = int;
using int64 = long long;

const int mod     = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
  int N = input();

  auto cnt = make_v(N + 1, 0);
  range(i, 2, N + 1) {
    int x = i;
    range(j, 2, x + 1) {
      while(x % j == 0) {
        cnt[j]++;
        x /= j;
      }
    }
  }

  int64 ans = 1;
  range(i, 1, N + 1) {
    (ans *= cnt[i] + 1) %= mod;
  }
  
  cout << ans << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#define int long long
using namespace std;

signed main(){
	int a,b;
	cin>>a>>b;
	int ans=max(a+b,max(a*b,a-b));
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define P1 31
#define EPS 0.00000000001
#define MOD int(10e9 + 9)
#define PI acos(-1)
#define INF 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

int main()
{
    int n;
    cin>>n;
    LL a[n], c[n+1] = {0};
    loop(i,0,n) {cin>>a[i]; ++c[a[i]];}

    LL nw[n+1], ans = 0;
    loop(i,1,n+1)
    {
        if(c[i]) nw[i] = (c[i] * (c[i]-1))/2;
        else nw[i] = 0;
        ans += nw[i];
    }

    LL ans1;
    loop(i,0,n)
    {
        ans1 = ans - nw[a[i]];
        --c[a[i]];
        if(c[a[i]]) ans1 += (c[a[i]] * (c[a[i]]-1))/2;
        ++c[a[i]];
        cout<<ans1<<'\n';
    }

    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> w(n);
  for (size_t i = 0; i < n; i++) {
    cin>>w[i];
  }
  vector<int> l(n), r(n);
  for (size_t i = 0; i < n; i++) {
    if(i==0){
      l[0]=w[0];r[0]=w[n-1];
    }else{
      l[i]=l[i-1]+w[i];
      r[i]=r[i-1]+w[n-1-i];
    }
  }
  int t = 1145141919;
  for (size_t i = 0; i < n-1; i++) {
    t=min(t,abs(l[i]-r[n-2-i]));
  }
  cout<<t;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう

N=3
M=3
i=0
j=0
k=0
x=0
y=0
z=0
xy=0
V=0
c=[]
number_list=list(map(int, input().split(" ")))
L=number_list[0]
#M=number_list[1]
#print(L)
z=0.25*L
z1=0.75*L
for i in range(10**12):
    z += i*(10**(-12))*L
    if z>z1:
        break
    #print(z)
    V1=((L-z)**2)/4*z
    c.append(float(V1))
    #if V1 >= V:
    #    V=V1
#print(V1)
print(max(c))

#N=int(input())
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"




#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


Measured memory_bytes: 34760
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/


int main(){
  ll N, K;
  cin >> N >> K;
  if(N >= 2 * K - 1) cout << "YES" << endl;
  else cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    vector<int> cs(N + 1);
    cs[0] = -1;
    for (int i = 1; i <= N; ++i)
    {
        cin >> cs[i];
    }
    // dp[i]:i番目の石まで考えたときの塗り分け方の総和
    vector<LLONG> dp(N + 1, 0);
    // 各色に対するdp[j](j<i)の総和
    map<int, LLONG> color2dpSumMap;
    for (const int ci : cs)
    {
        color2dpSumMap[ci] = 0;
    }
    dp[0] = 1;
    for (int i = 1; i <= N; ++i)
    {
        // i番目を右端とする塗り替えができる場合
        // これまでの塗り分け方に(i-1)番目までの塗り方の総和を足したものが総塗り分け方
        if (cs[i - 1] != cs[i])
        {
            dp[i] = color2dpSumMap[cs[i]] + dp[i - 1];
            color2dpSumMap[cs[i]] += dp[i - 1];
        }
        // 前の石と色が同じ場合は，どちらを右端にしても変わらないので塗り分け方も引き継ぎ
        else
        {
            dp[i] = color2dpSumMap[cs[i]];
        }
        dp[i] %= MOD;
        color2dpSumMap[cs[i]] %= MOD;
        //// i番目を右端とした塗り替えを考える
        //// j番目までを飛ばし，j番目より後を塗り替えられるとき，
        //// （それ以前（j番目まで）の塗り方）×（j番目より後～i番目までの塗り方：１通り）だけ
        //// dp[i]を増やす
        //// ->単純に実装するとO(N^2)で間に合わない！
        //for (int j = 0; j < i; ++j)
        //{
        //    if (cs[j] != cs[i] && cs[j + 1] == cs[i])
        //    {
        //        dp[i] += dp[j];
        //    }
        //}
    }
    cout << color2dpSumMap[cs.back()] << endl;
}


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

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int kMaxDay = 101;

int main(void){
    for(int n, q, res; cin >> n >> q, n; cout << res << endl){
        res = 0;

        vi numCommittee(kMaxDay);

        rep(i, n){
            int m; cin >> m;

            rep(j, m){
                int d; cin >> d;

                if(q <= ++numCommittee[d]) q = 0;
            }
        }

        if(!q) res = max_element(all(numCommittee)) - numCommittee.begin();
    }

	return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,digit,tmp,sum = 0;
  cin>>N;
  tmp=N;
  digit=log10(N);
  for(int i=digit;i>=0;i--){
    int num;
    num = int(tmp/pow(10,i));
    sum+=num;
    tmp-=num*pow(10,i);
  }
  N%sum ? cout<<"No"<<endl : cout<<"Yes"<<endl;
}


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

int main(void){
	int r,c;
	int work = 0;
	cin >> r >> c;
	int sheet[r + 1][c + 1];
	for(int i = 0; i < r + 1; i++){
		for(int j = 0; j < c + 1; j++){
			sheet[i][j] = 0;
		}
	}
	for(int i = 0; i < r; i++){
		for(int j = 0; j < c; j++){
			cin >> sheet[i][j];
		}
	}
	for(int i = 0; i < r; i++){
		work = 0;
		for(int j = 0; j < c; j++){
			work += sheet[i][j];
		}
		sheet[i][c] = work;
	}
	for(int i = 0; i < c + 1; i++){
		work = 0;
		for(int j = 0; j < r; j++){
			work += sheet[j][i];
		}
		sheet[r][i] = work;
	}
	for(int i = 0; i < r + 1; i++){
		for(int j = 0; j < c + 1; j++){
			if(j == c){
				cout << sheet[i][j] << endl;
			}else{
				cout << sheet[i][j] << " ";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1200
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) ((x)%2)
typedef long long ll;
typedef long double ld;
const ll oo=2*1000*1000*1000;
const int _cnt=1000*1000;
const int _p=1000*1000*1000+7;
int o(int x) { return x%_p; }
int gcd(int a,int b) { return (b)?gcd(b,a%b):a; }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
using namespace std;

void file_put(){
	freopen("filename.in","r",stdin);
	freopen("filename.out","w",stdout);
}

int n,k,a[105],p[16];
ll ans=oo*oo;

bool check(int x){
	
	for (int i=1; i<=n; i++){
		p[i]=x&1;
		x>>=1;
	}
	int sum=0;
	for (int i=1; i<=n; i++) sum+=p[i];
	if (sum<k) return false;
	return true;
}

void pat(){
	int t=0;
	for (int i=1; i<=n; i++){
		if (p[i]) break;
		t=max(t,a[i]);
	}
	ll sum=0;
	for (int i=1; i<=n; i++) {
		if (!p[i]) {
			t=max(t,a[i]);
			continue;
		}
		sum+=max(t+1-a[i],0);
		t=(a[i]>=t+1) ? a[i]:t+1;
	}
	ans=min(ans,sum);
}

int main(){
	//file_put();
	
	scanf("%d%d",&n,&k);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	for (int x=0; x<=(1<<n)-1; x++){
		if (!check(x)) continue;
		pat();
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	// freopen("inf.txt", "r", stdin); 
	// freopen("out.txt", "w", stdout);
	
	string a,b;
	cin>>a>>b;
	int cnt=0;
	for(int i=0;i<3;i++)
	{
		if(a[i]==b[i])cnt++;
	}
	cout<<cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, H;
  cin >> N;
  vector<int> height(N);
  for (int i=0; i<N; i++){
    cin >> height.at(i);
  }
  int ht;
  int hotel = 0;
  for (int i=0; i<N; i++){
    ht = height.at(i);
    sort(height.begin(),height.begin() + (i+1));
    //cout << ht << height.at(i);
    if (ht == height.at(i)) hotel++;
    else continue;
  }
  cout << hotel << endl; 
}

Measured memory_bytes: 256
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
c = list(Counter(A).most_common())
c = c[::-1]
num = len(c)
i = 0
ans = 0
while K<num:
    num -= 1
    ans += c[i][1]    
    i += 1
print(ans)

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

int main() {
  int N, M;
  cin >> N;
  vector <string> blue(N);
  for (int i = 0; i < N; i++) cin >> blue.at(i);
  
  cin >> M;
  vector <string> red(M);
  for (int i = 0; i < M; i++) cin >> red.at(i);
  
  int answer = 0;
  
  for (int i = 0; i < N; i++){
    int count = 0;
    for(int j = 0; j < N; j++){
      if (blue.at(i) == blue.at(j)) count ++;
    }
    for(int j = 0; j < M; j++){
      if (blue.at(i) == red.at(j)) count --;
    }  
    if (answer < count) answer = count;
  }
  cout << answer << endl;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

ll A[1<<20];

int main() {
  std::ios::sync_with_stdio(false);
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);
  A[0]=1;
  rep(i, 100005) A[i+1]=((i+1)*A[i])%mod;

  ll n,m;
  cin>>n>>m;
  if(n > m) swap(n, m);

  if(m-n > 1) {
      cout<<0<<endl;
      return 0;
  }

  if(m == n) {
    cout<<(2*((A[m]*A[m])%mod))%mod<<endl;
    return 0;
  }

  cout<<(A[m]*A[n])%mod<<endl;

  return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = scan.nextInt();
        long[] a = new long[n];
        long total = 0;
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextLong();
            total += a[i];
        }
        long[] s = new long[n+1];
        for (int i = 0; i < n; i++) {
            s[i+1] = s[i] + a[i];
        }
        long answer = Long.MAX_VALUE;
        for (int i = 1; i < n; i++) {
            if (Math.abs(2 * s[i] - total) < answer) {
                answer = Math.abs(2 * s[i] - total);
            }
        }
        System.out.println(answer);
    }
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(long.Parse).ToList();
            var A = input[0] - 1;
            var B = input[1];
            var C = input[2];
            var D = input[3];

            var lcm = Lcm(C, D);
            Func<long, long> count = i => (B / i) - (A / i);
            Console.WriteLine(B - A - (count(C) + count(D) - count(lcm)));
        }

        private static long Gcd(long a, long b)
        {
            if (b == 0) return a;
            return Gcd(b, a % b);
        }

        private static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}


Measured memory_bytes: 13268