akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(auto i=a;i<b;i++)
#define FORI(i,a,b) for(auto i=a;i<=b;i++)
#define RFOR(i,a,b) for(auto i=a;i>=b;i--)
#define FORV(i,a) for(auto i=a.begin();i!=a.end();i++)
#define VI vector<int>
#define PB push_back
#define VL vector<long>
#define VLL vector<long long>
#define VS vector<string>
#define VC vector<char>
#define READ(n) int n; cin>>n
#define READARR(a,n) FOR(i,0,n) {cin>>a[i];}
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

int main() {
  FAST;
  int a,b;
  cin>>a>>b;
  int m=max(a+b,a-b);
  m=max(m,a*b);
  cout<<m;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
#include<map>
using namespace std;

#define EPS (1e-9)
#define prev(P,i) P[(i+P.size()-1)%P.size()]
#define curr(P,i) P[i]
#define next(P,i) P[(i+1)%P.size()]
typedef complex < double > P; // P:点
struct L:public vector< P >{ // L:線分
  L(){resize(2);}
  L(const P& a,const P& b){push_back(a);push_back(b);}
};
struct C{ //C:円
  P p; double r;
  C():p(0),r(0){}
  C(const P& p, double r):p(p),r(r){};
};

double cross(const P& a,const P& b){
  return imag(conj(a) * b);
}
double dot(const P& a,const P& b){
  return real(conj(a) * b);
}
P projection(const L& l,const P& p){
  double t = dot(p-l[0],l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t * (l[0] - l[1]);
}
int ccw(P a,P b,P c){
  b -= a; c -= a;
  if(cross(b,c) > 0) return 1;
  if(cross(b,c) < 0) return -1;
  if(dot(b,c) < 0) return 2; // c--a--b
  if(norm(b) < norm(c)) return -2; // a--b--c
  return 0; // a--c--b
}
bool interectCC(const C& c,const C& d){
  return (norm(c.p - d.p) - (c.r + d.r)*(c.r + d.r) < EPS) &&
    (norm(c.p - d.p) - (c.r - d.r)*(c.r - d.r) > -EPS);
}
pair< P , P > crosspointCC(const C& c,const C& q){
  P a = conj(q.p - c.p);
  P b = q.r  * q.r - c.r * c.r - (q.p - c.p) * a;
  P C = c.r * c.r * (q.p - c.p);
  P d = b * b - 4.0 * a * C;
  P z1 = (-b * sqrt(d)) / (2.0 * a) + c.p;
  P z2 = (-b - sqrt(d)) / (2.0 * a) + c.p;
  return pair< P , P >( z1, z2);
}
int main(){
  int n;
  while(cin >> n , n){
    vector < P > pts(n);
    int ans = 1;
    for(int i = 0 ; i < n ; i++ ){
    cin >> pts[i].real() >> pts[i].imag();
    }
    for(int i = 0 ; i < n ; i++ ){
      C c1 = C( pts[i], 1);
      for(int j = 0 ; j < i ; j++ ){
        C c2 = C( pts[j], 1);
        if(interectCC(c1,c2)){
          pair< P , P > nnr = crosspointCC( c1, c2);
          int ret = 0, rec = 0;
          for(int k = 0 ; k < n ; k++ ){
            if(abs(nnr.first - pts[k]) <= 1 + EPS) ret++;
            if(abs(nnr.second - pts[k]) <= 1 + EPS) rec++;
          }
          ans = max( ans, max( ret, rec));
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1272
/*************************************
 *プログラム名：B.c
 *
 *************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <pthread.h>

//<<<<<>>>>>//

int main(void)
{
	int i, W, H, N;
	int *x, *y, *a;
	int num1, num2, num3, num4;
	int s1, s2;
	
	scanf("%d %d %d", &W, &H, &N);
	
	x = malloc(sizeof(int) * N);
	y = malloc(sizeof(int) * N);
	a = malloc(sizeof(int) * N);
	
	for (i = 0; i < N; i++) {
		scanf("%d %d %d", x + i, y + i, a + i);
	}
	
	num1 = W; num2 = H;
	num3 = 0; num4 = 0;
	
	for (i = 0; i < N; i++) {
		switch (*(a + i)) {
			case 1 : if (num3 < *(x + i)) { num3 = *(x + i); }
				break;
			case 2 : if (num1 > *(x + i)) { num1 = *(x + i); }
				break;
			case 3 : if (num4 < *(y + i)) { num4 = *(y + i); }
				break;
			case 4 : if (num2 > *(y + i)) { num2 = *(y + i); }
				break;
		}
	}
	
	s1 = 0; s2 = 0;
	
	if (num1 > num3) { s1 = num1 - num3; }
	if (num2 > num4) { s2 = num2 - num4; }
	
	printf("%d\n", s1 * s2);
	
	free(x);
	free(y);
	free(a);
	
	return (0);

}

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

ll h;

ll f(ll n) {
  if (n == 1) return 1;
  return 1 + 2 * f(n >> 1);
}

int main() { // claudio van
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  cin >> h;
  cout << f(h) << "\n";
  return 0;
}

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



 
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.in","w",stdout);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	int n,i,j;
   	string s,t;
   	cin>>s>>t;
   	int cnt(0);
   	for(i=0;i<s.size();i++){
   		if(s[i]!=t[i])cnt++;
   	}
   	cout<<cnt;
	
	
 
 
 
 
 
 
 
	return 0;
}

Measured memory_bytes: 3808
#include <cstdio>
#include <algorithm>

int main()
{
  long long a, b, q;
  scanf("%lld%lld%lld", &a, &b, &q);
  long long s[100000];
  long long t[100000];
  for (long long i = 0; i < a; ++i)
  {
    scanf("%lld", s + i);
  }
  for (long long i = 0; i < b; ++i)
  {
    scanf("%lld", t + i);
  }
  long long *ps, *pt;
  for (long long i = 0; i < q; ++i)
  {
    long long x;
    scanf("%lld", &x);
    long long d = 1e18;

    ps = std::lower_bound(s, s + a, x);
    if (ps - 1 >= s)
    {
      pt = std::lower_bound(t, t + b, *(ps - 1));
      if (pt - 1 >= t)
      {
        d = std::min(d, x - *(pt - 1));
      }
      if (pt != t + b)
      {
        d = std::min(d, x - *(ps - 1) + *pt - *(ps - 1));
      }
    }
    if (ps != s + a)
    {
      pt = std::lower_bound(t, t + b, *ps);
      if (pt - 1 >= t)
      {
        d = std::min(d, *ps - x + *ps - *(pt - 1));
      }
      if (pt != t + b)
      {
        d = std::min(d, *ps - x + *pt - *ps);
      }
    }

    pt = std::lower_bound(t, t + b, x);
    if (pt - 1 >= t)
    {
      ps = std::lower_bound(s, s + a, *(pt - 1));
      if (ps - 1 >= s)
      {
        d = std::min(d, x - *(ps - 1));
      }
      if (ps != s + a)
      {
        d = std::min(d, x - *(pt - 1) + *ps - *(pt - 1));
      }
    }
    if (pt != t + b)
    {
      ps = std::lower_bound(s, s + a, *pt);
      if (ps - 1 >= s)
      {
        d = std::min(d, *pt - x + *pt - *(ps - 1));
      }
      if (ps != s + a)
      {
        d = std::min(d, *pt - x + *ps - *pt);
      }
    }
    printf("%lld\n", d);
  }
  return 0;
}

Measured memory_bytes: 2816
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;

typedef long Int;
const Int M = 1000000007;

Int power(Int x, Int n)
{
	Int res;
	if (n == 0)
		return 1;
	res = power(x * x % M, n / 2);
	if ((n & 1) != 0)
	{
		res = res*x%M;
	}
	return res;
}
int main(){
	std::istream & c_in = cin;

	int m,n;
	c_in >> m >> n;
	cout << (int)power(m,n) << endl;
}

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

int main()
{
    int arr[100];
    long int  i, j=0, numb;

    scanf("%ld", &numb);
    for(i=0; i<numb; i++)
        {
        scanf("%d", &arr[i]);
        if(arr[i] != i+1)
        {
            j++;
        }
        }
    if(j > 2)
        printf("NO\n");
    else
        printf("YES\n");

    return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Little[] little= new Little[4];
		int omo=1;
		Main main = new Main();
		for (int i=0;i<4;i++) {
			Little l = main.new Little();
			l.l= omo;
			l.yen = sc.nextLong();
			little[i] = l;
			omo *=2;
		}
		Arrays.sort(little);
		long N = sc.nextLong();
		N*=4;
		long sum =0;
		for (int i=0;i<4;i++) {
			long num = N/little[i].l;
			sum +=num*little[i].yen;
			N -= N/little[i].l*little[i].l;
		}
		System.out.println(sum);
	}

	public class Little implements Comparable<Little> {
		int l;
		long yen;
		@Override
		public int compareTo(Little l) {
			long t= yen *(8/this.l);
			long li= l.yen*(8/l.l);
			if (t>li) {
				return 1;
			}
			if (t<li) {
				return -1;
			}
			if (this.l>l.l) {
				return 1;
			}
			return -1;
		}
	}
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using pp = pair<int, int>;
const int INF = 1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<ll> ruiseki(N + 1);
    vector<ll> NaM_r(N + 1);
    for (int i = 0; i < N; i++) {
        ruiseki[i + 1] = ruiseki[i] + A[i];
        NaM_r[i + 1] = NaM_r[i] + max(A[i], 0);
    }

    ll ans = -INF;
    for (int i = 0; i + K <= N; i++) {
        ll tmp = NaM_r[N];
        tmp += max(ruiseki[i + K] - ruiseki[i], 0LL);
        tmp -= NaM_r[i + K] - NaM_r[i];
        ans = max(tmp, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  string s;
  cin >> s;
  ll k;
  cin >> k;
  rep(i,min((ll)s.size(),k)) {
    if(s.at(i)!='1') {
      cout << s.at(i) << endl;
      return 0;
    }
  }
  cout << '1' << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N, M;
  cin>>N>>M;
  vector<int> even, odd;
  for(int i = M; i > 0; i--) {
    if(i % 2 ==	0) even.push_back(i);
    else odd.push_back(i);
  }
  int base = 1;
  REP(i, odd.size()) {
    cout << (i + base) << " " << (i + base + odd[i]) << endl;
  }
  base += odd[0] + 1;
  REP(i, even.size()) {
    cout << (i + base) << " " << (i + base + even[i]) << endl;
  }
  return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
ll mod = 1000000007;
P p[200005];

ll i, b, c, k, j, n, m,ss, z = 0,t, pa[305][305] = {}, l;
ll a,q;
vector<vector<ll>> v(305);
string s;
char ca[10000];


int main() {
	cin >>a>> b;
	if (a > 9 || b > 9) {
		cout << -1;
		return 0;
		}


	cout << a*b;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def main():
     n, m = map(int, input().split())
     n_list = list(map(int, input().split()))
     ans = [1 for i in range(n)]

     for i in range(m):
          path = list(map(int, input().split()))
          first = path[0]-1
          second = path[1]-1
          if n_list[first] < n_list[second]:
               ans[first] = 0
          elif n_list[second] < n_list[first]:
               ans[second] = 0
          else:
               ans[first] = 0
               ans[second] = 0
     
     print(sum(ans))

if __name__ == "__main__":
    main()


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

using namespace std;

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

	if (a == 1) {
		if (b == 1) {
			cout << "Draw" << endl;
		}
		else {
			cout << "Alice" << endl;
		}
	}

	else {
		if (b == 1) {
			cout << "Bob" << endl;
		}
		else {
			if (a < b) {
				cout << "Bob" << endl;
			}
			else if (a == b) {
				cout << "Draw" << endl;
			}
			else {
				cout << "Alice" << endl;
			}
		}
	}

    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
# inputを高速化する。
input = sys.stdin.readline
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
# dpの配列を作る。
dp = np.zeros(n, dtype=int)
# hの配列を作る。
h = np.array(h)
for i in range(1, n):
    # start は負になることはない。
    start = max(0, i-k)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
print(dp[n-1])

Measured memory_bytes: 23052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7

const ll MAX = 200003;


ll pow2(ll m){
    ll ret = 1;
    ll a = 2; //a=2^i
    while( m >= 1 ){
        if(m & 1){ //2進展開して下からi桁目が1ならaをかける
            ret = ret * a % MOD;
        }
        a = a * a % MOD;
        m >>= 1;
    }
    return ret;
}

int main() {
    vector<ll> inv(MAX);
    inv.at(1) = 1;
    for(int i = 2; i < 200003; i++){
        inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    }
    
    ll n,a,b;
    cin >> n >> a >> b;
    
    ll ans = pow2(n);
    ll nca,ncb;
    nca = 1;
    ncb = 1;
    
    for(ll i = 1; i <= a; i++){
        nca = nca * (n-i+1) % MOD;
        nca = nca * inv.at(i) % MOD;
    }
    for(ll i = 1; i <= b; i++){
        ncb = ncb * (n-i+1) % MOD;
        ncb = ncb * inv.at(i) % MOD;      
    }
    
    ans -= nca;
    ans -= ncb;
    ans -= 1;
    ans = (ans + 3*MOD) % MOD;
    
    printf("%lld\n", ans);
}


Measured memory_bytes: 1920
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string str;
    cin>>str;
    
    if(str[0]=='S')
    {
        cout<<"Cloudy"<<endl;
    }
    else if(str[0]=='C')
    {
        cout<<"Rainy"<<endl;
    }
    else
    {
        cout<<"Sunny"<<endl;
    }
}


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

const int maxn=1e5+10;

int n,mx,mn,a[maxn],cnt[maxn];

int main()
{
#ifdef h10
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
#endif
	int i;
	scanf("%d",&n);
	mx=0; mn=0x7fffffff;
	for (i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		mx=max(mx,a[i]);
		mn=min(mn,a[i]);
		cnt[a[i]]++;
	}
	if (mx-mn>1)
	{
		puts("No");
		return 0;
	}
	if (mn==mx)
	{
		puts(mx*2<=n||mn==n-1?"Yes":"No");
		return 0;
	}
	int p=cnt[mn];
	puts(p<mx&&p+2*(mx-p)<=n?"Yes":"No");
}


Measured memory_bytes: 1024
x,y=map(int,input().split())
g1=[1,3,5,7,8,10,12]
g2=[4,6,9,11]
if (x in g1) and (y in g1): print('Yes')
elif (x in g2) and (y in g2): print('Yes')
elif (x==y and x==2): print('Yes')
else: print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, x;
	cin >> a >> b >> x;
	int max_v = a * a * b;
	double t;
	if (2 * x >= max_v)
		t = 2.0 * (a * a * b - x) / a / a / a;
	else
		t = a * b * b / 2.0 / x;
	cout << setprecision(8) << atan(t) / PI * 180;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll A,B;
    cin>>A>>B;
    ll ANS=max(max(A+B,A-B),A*B);
    cout<<ANS;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

ll pow(ll x, ll n, ll mod)
{
	ll res = 1;
	while (n > 0)
	{
		if (n & 1) res = res * x % mod;
		x = x*x%mod;
		n >>= 1;
	}
	return res;
}

bool check(vi& v)
{
	int n = v.size();
	if (n % 2 == 1)
	{
		if (v[0] != 0) return false;
		FOR(i, 1, n)
		{
			if (i % 2 == 1 && v[i] != i + 1) return false;
			if (i % 2 == 0 && v[i] != i) return false;
		}
	}
	else
	{
		REP(i, n)
		{
			if (i % 2 == 0 && v[i] != i + 1) return false;
			if (i % 2 == 1 && v[i] != i) return false;
		}
	}
	return true;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n;
	cin >> n;
	vi v(n);
	REP(i, n) cin >> v[i];
	sort(ALL(v));
	if (!check(v))
	{
		cout << 0 << endl;
	}
	else
	{
		cout << pow(2, n / 2, MOD) << endl;
	}
	return 0;
}

Measured memory_bytes: 640
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N,M = inpl()
likes = [0]*M

for _ in range(N):
    kaa = inpl()
    for i in range(1,kaa[0]+1):
        likes[kaa[i]-1] += 1

#print(likes)
ans = 0
for k in likes:
    if k == N: ans += 1
print(ans)


Measured memory_bytes: 4212
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int ans=0;
    for (int i = 0; i < 3; i++)
    {
        if(n%10==1) ans++;
        n/=10;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#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>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    ll n; cin>>n;

    if(n == 2){
        cout << 1 << endl;
        return 0;
    }

    int ans = 2;
    for(ll i=2; i*i<=n; i++){
        ll num = n;
        bool div = false;
        while(num % i == 0){
            num /= i;
            div = true;
        }

        if(num % i == 1){
            if(!div && (num / i != i)) ans += 2; 
            else ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    cout<<(s.find('A')!=string::npos&&s.find('B')!=string::npos?"Yes":"No")<<'\n';
    return 0;
}

Measured memory_bytes: 256
//   //  /////       ///      
//  //   //  //     // //     
// //    //   //   //   //    
////     //   //  //     //   
// //    //   //  /////////    
//  //   //  //   //     //    
//   //  /////    //     //    

#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define iter(it,a,b) for(a::iterator it=b.begin(); it!=b.end();++it)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (binary me 1 kitne hai) (if longlong popcount ll)
#define ln "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(n) n.begin() , n.end() 
#define tfi first.first
#define tse first.second
#define tth second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef pair< pair<int,int> , int> tri;

#pragma GCC optimize ("-O2")
const ll LIM = 2e5+5;
const ll MOD = 1e9+7;
const ll inf = 1e10;

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

	int n, k;
	cin >> k >> n;

	int a[k];
	forn(i,k) cin >> a[i];

	bool dp[n+1];
	dp[0]=0;

	forsn(i,1,n+1){
		dp[i]=0;
		forn(j,k){
			if(a[j]>i) break;
			else if(!dp[(i-a[j])]){
				dp[i]=1;
				break;
			}
		}
	}

	if(dp[n]) cout << "First";
	else cout << "Second";


}


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

using namespace std;

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

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

    return gcd(b, a%b);
}

const ll L = 1e5+5;

vector <ll> adj[3*L];
ll visited[3*L];
ll dis[3*L];

void bfs(ll s, ll t, ll N)
{
    queue <ll> q;
    visited[s] = 1;
    ll cnt = 0;
    q.push(s);
    dis[s] = 0;

    while(!q.empty())
    {
        cnt++;
        ll u = q.front();
        q.pop();

        for(auto i: adj[u])
        {
            if(!visited[i])
            {
                dis[i] = dis[u]+1;
                // if(i<=N)
                // {
                    // cout << i << " ";
                // }

                // else if(i<=2*N)
                // {
                //     cout << i-N << " ";
                // }

                // else
                // {
                //     cout << i-2*N << " ";
                // }

                visited[i] = 1;
                q.push(i);

                if(i == t)
                {
                    // cout << dis[i] << endl;
                    cout << dis[i]/3 << endl;
                    return;
                }
            }
        }
        // cout << endl;
    }

    cout << -1 << endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll N, M;
    cin >> N >> M;

    for(ll i=0; i<M; i++)
    {
        ll u, v;
        cin >> u >> v;

        // u--;
        // v--;

        adj[u].pb(v+N);
        adj[u+N].pb(v+2*N);
        adj[u+2*N].pb(v);
    }

    ll s, t;
    cin >> s >> t;

    bfs(s, t, N);


    return 0;
}

Measured memory_bytes: 21376
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

struct slidemax {
	ll que[MAX_N];
	int s, e;
	void init() {
		s = 0; e = 0;
		memset(que, 0, sizeof(que));
	}
	void add(ll x) {
		while(s < e && que[e - 1] < x) e--;
		que[e++] = x;
	}
	void remove(ll x) {
		if(s < e && que[s] == x) s++;
	}
	bool empty() {
		return s == e;
	}
	ll get() {
		if(s == e) return -linf;
		else return que[s];
	}
	void show() {
		debug(vi(que + s, que + e));
	}
};

int N, M, K;
ll dp[2][100010];
ll A[100010];
slidemax que;

void solve() {
	cin >> N >> M >> K;
	rep(i, 0, N) cin >> A[i];
	int now = 0, nex = 1;

	rep(i, 0, N) dp[now][i] = A[i];
	rep(k, 2, K + 1) {
		// debug(vl(dp[now], dp[now] + N));
		que.init();
		rep(i, 0, k - 1) {
			que.add(dp[now][i]);
			if(i >= M) que.remove(dp[now][i - M]);
		}
		// que.show();
		rep(i, 0, k - 1) dp[nex][i] = -linf;
		rep(i, k - 1, N) {
			dp[nex][i] = que.get();
			dp[nex][i] += A[i] * k;
			que.add(dp[now][i]);
			if(i >= M) que.remove(dp[now][i - M]);
		}
		swap(now, nex);
	}
	ll res = 0;
	rep(i, 0, N) {
		MAX(res, dp[now][i]);
	}
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  ll n;cin>>n;
  ll a,b;cin>>a>>b;
  vector<ll>num(n);
  for(int i=0;i<n;i++){cin>>num[i];
  }
  sort(ALL(num));
  int cnt=0,ans=0;
  bool used[n+100]={};
  bool flag=true;
  while(flag){
    flag=false;
    for(int i=0;i<n;i++){
      if(used[i])continue;
      if(cnt==0){
	if(num[i]<=a){
	  cnt++;
	  used[i]=true;
	}
      }else if(cnt==1){
	if(num[i]>=a+1&&num[i]<=b){
	  cnt++;
	  used[i]=true;
	}
      }else{
	if(num[i]>b){
	  flag=true;
	  cnt=0;
	  ans++;
	  used[i]=true;
	  break;
	}
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
H, N = map(int,input().split()) # 複数の数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

attack = 0

for i in range(N):
    attack += List[i]
    
if attack >= H:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 13964
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 205
struct node {
	int x,y;
}red[MAXN],blue[MAXN];
int N;
vector<int> bag[MAXN];
bool vis[MAXN];
int matched[MAXN];
bool un(int u) {
	for(int i=0;i<int(bag[u].size());i++)
		if(!vis[bag[u][i]]) {
			int v=bag[u][i];
			vis[v]=1;
			if(!matched[v]||un(matched[v])){
				matched[u]=v;
				matched[v]=u;
				return 1;
			}
		}
	return 0;
}
int result() {
	int ans=0;
	for(int i=1;i<=2*N;i++){
		if(!matched[i]) {
			memset(vis,0,sizeof vis);
			ans+=un(i);
		}
	}
	return ans;
}
int main() {
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
		scanf("%d%d",&red[i].x,&red[i].y);
	for(int i=1;i<=N;i++)
		scanf("%d%d",&blue[i].x,&blue[i].y);
	
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++)
			if(red[i].x<blue[j].x&&red[i].y<blue[j].y){
				bag[i].push_back(j+N);
				bag[j+N].push_back(i);
			}
	int ans=result();
	printf("%d\n",ans);
	return 0;
}

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

namespace Student
{
    class Program
    {
         static void Main(string[] args)
        {
            Test4();
            Console.ReadKey();
        }
                private static void Test4()
        {
            string str=Console.ReadLine();
            string str2 = Console.ReadLine();
            char[] ch = str.ToArray();
            Array.Reverse(ch);
            string str3 = new StringBuilder().Append(ch).ToString();
            if(str2==str3)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main()
{
  string S;
  cin >> S;
  int Num_Ini = 0; // Number of Initial
  bool flag = true;
  //  cout << "size of S; " << S.size() << "\n";

  while(S.size() != Num_Ini){
    //    cout << "check" << "\n";
    if(S.compare(Num_Ini,7,"dreamer") == 0){
      if(S.compare(Num_Ini,10,"dreamerase") == 0){
      Num_Ini += 5;
      }else{
	Num_Ini += 7;
      }
    }else if(S.compare(Num_Ini,6,"eraser") == 0){
      Num_Ini += 6;
    }else if(S.compare(Num_Ini,5,"dream") == 0){
      Num_Ini += 5;
    }else if(S.compare(Num_Ini,5,"erase") == 0){
      Num_Ini += 5;
    }else{
      flag = false;
      break;
    }
    //    cout << "Num_Ini: " << Num_Ini << "\n";
  }

  if(flag == true){
    cout << "YES" << "\n";
  }else{
    cout << "NO" << "\n";
  }

  return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<bitset>
#include<deque>
#define eps 1e-15
#define maxn 100010
#define maxm 200010
#define mod 1000000007
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int main()
{
    int n=read();
    int flag=0;
    for(int i=1;i<=n;i++)
    {
        int x=read();
        if(x%2==0)
        {
            if(x%3&&x%5)  flag=1;
        }
    }
    if(flag)  puts("DENIED");
    else      puts("APPROVED");
    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

int[] Gen(int S, int N, int W) {
    auto a = new int[N];
    int g = S;
    for(int i=0; i<N; i++) {
        a[i] = (g/7) % 10;
        if( g%2 == 0 ) { g = (g/2); }
        else           { g = (g/2) ^ W; }
    }
    return a;
}

int len(int x) {
    return cast(int)x.to!string.length;
}

long _C(int n, int r) {
    alias memoize!_C C;
    if (n < r) return 0;
    if (r == 1) return n;
    if (n == r) return 1;
    return C(n - 1, r - 1) + (n - 1, r);
}
alias memoize!_C C;

void main() {
    int N, Q;
    int[] A;

    long Pow(long x, int n) {
        x %= Q;
        if (n == 0) return 1;
        if (n % 2 == 1) return (x * Pow(x, n - 1)) % Q;
        return Pow((x * x) % Q, n / 2);
    }

    bool input() {
        int S, W;
        scanf("%d %d %d %d\n", &N, &S, &W, &Q);
        if (N == 0 && S == 0 && W == 0 && Q == 0) return false;
        A = Gen(S, N, W);
        return true;
    }
    void solve() {

        if (Q == 2 || Q == 5) {
            int Ans = 0;
            int X = 0;
            foreach (i; 0 .. N) {
                if (A[i] != 0) {
                    X++;
                }
                if (A[i] % Q == 0) {
                    Ans += X;
                }
            }
            Ans.writeln;
            return;
        }

        reverse(A);

        int[] L = new int[N + 1];
        L[0] = 0;
        foreach (i; 0 .. N) {
            L[i + 1] = L[i] + len(A[i]);
        }
        int[] S = new int[N + 1];
        S[0] = 0;
        foreach (i; 0 .. N) {
            S[i + 1] = (A[i] * Pow(10, L[i]) + S[i]) % Q;
        }

        long Ans = 0;
        int[int] M;
        foreach_reverse (i; 0 .. N + 1) {
            int x = M.get(S[i], 0);
            Ans += x;
            if (i > 0 && A[i - 1] == 0) {
                // do nothing;
            } else {
                M[ S[i] ] = x + 1;
            }
        }
        writeln(Ans);
    }
    while (input) solve;
}

Measured memory_bytes: 12452
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin>>s;
    int n=s.size();
    int st,end;
    for(int i=0;i<n;i++){
      if(s.at(i)=='A'){
        st=i;
        break;
      }
    }
    for(int i=0;i<n;i++){
      if(s.at(i)=='Z'){
        end=i;
      }
    }
  cout<<end-st+1<<endl;
}


Measured memory_bytes: 640
n = gets.chomp.reverse
s = n.size - 1

ans = 0
pre = 0
n.each_char.with_index do |c,i|
    c = c.to_i

    if c == 5
        if pre == 0 && (i == s || (i < s && n[i+1].to_i < 5))
            ans += c + pre
            pre = 0
        else
            pre = 11 - c + (pre == 0 ? 0 : pre - 2)
        end
    elsif c == 4
        if pre == 0 || (i == s || i < s && n[i+1].to_i < 5)
            ans += c + pre
            pre = 0
        else
            pre = 11 - c + (pre == 0 ? 0 : pre - 2)
        end
    elsif c < 4
        ans += c + pre
        pre = 0
    else
        pre = 11 - c + (pre == 0 ? 0 : pre - 2)
    end
end

puts ans + pre

Measured memory_bytes: 4876
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 int a[n];
 int i;
 for(i=0;i<n;i++)
 {
	cin>>a[i];
 }
 int b[n];
 b[0]=a[0];
 for(i=1;i<n;i++)
 {
   b[i]=min(a[i-1],b[i-1]);	
   //cout<<b[i]<<endl;
 }
 int ans=0;
 for(i=0;i<n;i++)
 {
 	if(b[i]>=a[i])
 	ans++;
 }
 cout<<ans<<endl;
 return 0;
}



Measured memory_bytes: 1792
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a,b = Ss()
for e in [a[i]+b[i] for i in range(N)]:
    print(e,end="")
print()


Measured memory_bytes: 4584
def solve():
    a, b = read()
    result = think(a, b)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, b):
    if a >= 10 or b >= 10:
        return -1
    return a * b


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))

N = ri()
h = rl()
hl = len(h)

ans = 0
flag = 0
for _ in range(sum(h)):
    if sum(h) == 0:
        break
    flag = 1
    for i in range(hl):
        if flag == 1 and h[i] != 0:
            flag = 0
            h[i] = h[i] - 1
            ans += 1
        elif flag == 0 and h[i] == 0:
            flag = 1
        elif flag == 0 and h[i] != 0:
            h[i] = h[i] - 1

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(li i=0;i<n;i++)
#define li long long int
#define ll long long int
#define pb push_back
#define all(v) sort(v.begin(),v.end())
const int N = 40043;
const ll mod = 1e9 + 7;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define s second
const ll INF=(1LL<<60)-1;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    return (a*b)/gcd(a,b);
}
li pow(li a,li b,li mo)
{
    if(a==0)
    return 1;
    li u=pow(a,b/2,mo);
    u=(u%mod*u%mod)%mo;
    if(b%2==1)
    u=(u%mod*a%mod)%mod;
    return u;
}
ll power(ll a,ll b)
{
    ll ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
 
li xx,yy,dd;
void equation(li a,li b)
{
    if(b==0)
    {
        xx=1;
        yy=0;
        dd=a;
    }
    else
    {
        equation(b,a%b);
        li temp=xx;
        xx=yy;
        yy=temp-(a/b)*yy;
    }
}
li inverse(li a,li m)
{
    equation(a,m);
    return(xx%m+m)%m;
}
bool compare(const pair<li,li> &i, pair<li,li> &j)
{
    if(i.f==j.f)
    return i.s > j.s;
    else
    return i.f<j.f;
    
}

void solve()
{
    
    li n;
    cin>>n;
    li d=ceil(n/1000.0);
    cout<<d*1000-n;
    
}
int main()
{
    FAST_IO;
    li t;
    t=1;
  
    while(t--)
    {
        solve();
        cout<<endl;
        
    }
    
}


Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <cstdlib>
using namespace std;
stack<double> st;

double func(char c){
	double y = st.top();st.pop();
	double x = st.top();st.pop();
	//printf("%c %f %f ", c, x, y);
	if(c == '+')return x + y;
	if(c == '-')return x - y;
	if(c == '*')return x * y;
	if(c == '/')return x / y;
}

int main(){
	char s[100];
	while(scanf("%s", s) != EOF){
		if(strlen(s)==1 && (s[0]=='+' || s[0]=='-' || s[0]=='*' || s[0]=='/')){
			st.push(func(s[0]));
		}
		else{
			double d = atof(s);
			st.push(d);
		}
		if(getchar()=='\n'){
			printf("%.10f\n",st.top());
			st.pop();
		}
		//if(s[0] == ':')break;
		//printf("%d", strlen(s));
	}
	//st.pop();
	//printf("%.10f\n", st.top());
	//while(!st.empty()){printf("%.10f ", st.top());st.pop();}
	/*char s[10];
	scanf("%s", s);
	double a = atof(s);
	printf("%f", a);*/
	
	return 0;
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
 
    int N;
    cin>>N;
 
    vector<int> H(N);
    for(int i=0;i<N;i++){
        cin>>H.at(i);
    }
 

    for(int i=N-1;i>=1;i--){
        if(H.at(i-1)-H.at(i)>=1)
            H.at(i-1)--;
    }
  
    bool flag=true;
     for(int i=N-1;i>=1;i--){
        if(H.at(i-1)-H.at(i)>=1){
            flag=false;
            break;
        }
    }

    if(flag)
        cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
 
    return 0;
}  

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

int table[13] = {0};

bool chk(int x, int y)
{
    return table[x] == table[y];
}

int main()
{
    table[2] = 2;
    table[4] = 3;
    table[6] = 3;
    table[9] = 3;
    table[11] = 3;

    int x, y;
    cin >> x >> y;

    cout << (chk(x, y) ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 256
import numpy as np
import bisect
n = int(input())
A = list(map(int,input().split()))
cs = np.cumsum(A).tolist()
mid = sum(A)//2
idx = bisect.bisect_left(cs, mid)
ans = float('inf')
for i in range(max(1, idx-1), min(idx+2, n)):
    x = A[:i]
    y = A[i:]
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)

Measured memory_bytes: 34216
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize, k: usize,
        a: [[usize1]; k],
    }
    let mut sn = vec![0; n];
    for a in &a {
        for &a in a {
            sn[a] += 1;
        }
    }
    let count = sn.iter().filter(|&&x| x == 0).count();
    puts!("{}\n", count);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

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

  int64_t sum = 0;
  
  for (int i = 0; i < N; i++) {
    sum = sum + (i+1);
  }
  
  int64_t fb = N / 15 ;
  int64_t f = N / 3 ;
  int64_t b = N / 5 ;
  
  int64_t fizzbuzz = 0;
  int64_t fizz = 0 ;
  int64_t buzz = 0;
  
  for (int i = 0; i < fb; i++) {
    fizzbuzz = fizzbuzz + 15*(i+1);
  }

  for (int i = 0; i < f; i++) {
    fizz = fizz + 3*(i+1);
  }

  for (int i = 0; i < b; i++) {
    buzz = buzz + 5*(i+1);
  }
  
  cout << sum - fizz - buzz + fizzbuzz << endl;
  
  
}

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

using namespace std;


int main()
{
    int a , b , c , k , s;
    cin >> a >> b >> c >> k;
    s = min(a , k);
    k -= a;
    if(k > 0)
        k -= b;
    if(k > 0)
        s -= min(c , k);
    cout << s << "\n";
    return 0;
}


Measured memory_bytes: 3624
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <list>
#include <string>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

typedef struct _data
{
    int indexA;
    int indexB;
    int indexC;
} Data;

int main()
{
    ll X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    ll A[X], B[Y], C[Z];
    REP(i, X)
    {
        cin >> A[i];
    }
    REP(i, Y)
    {
        cin >> B[i];
    }
    REP(i, Z)
    {
        cin >> C[i];
    }

    //sort(A, A + X, greater<int>());
    //sort(B, B + Y, greater<int>());
    //sort(C, C + Z, greater<int>());

    //int indexA = 0;
    //int indexB = 0;
    //int indexC = 0;

    vector<ll> AB;
    for (int i = 0; i < X; i++)
    {
        for (int j = 0; j < Y; j++)
        {
            AB.push_back(A[i] + B[j]);
        }
    }

    sort(AB.begin(), AB.end());
    reverse(AB.begin(), AB.end());

    vector<ll> ABC;
    for (int i = 0; i < min(K, (ll)AB.size()); i++)
    {
        for (int j = 0; j < Z; j++)
        {
            ABC.push_back(AB[i] + C[j]);
        }
    }

    sort(ABC.begin(), ABC.end());
    reverse(ABC.begin(), ABC.end());

    for (int i = 0; i < K; i++)
    {
        cout << ABC[i] << endl;
    }
}

void cheatsheet()
{
    // loop
    // vector<int> vec(10);
    vector<int> vecloop;
    REP(i, 10)
    {
        vecloop.push_back(i);
    }

    // swap
    int a = 1;
    int b = 5;
    swap(a, b); // -> a = 5, b = 1

    // sort
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(arr, arr + 9, greater<int>()); // 9 8 7 6 5 4 3 2 1

    // lower
    vector<int> vec(arr, end(arr));
    sort(vec.begin(), vec.end());
    cout << lower_bound(vec.begin(), vec.end(), 2)[0]; // 2

    // map
    map<Pll, ll> m;
    m[Pll(10, 100)] = 100;
}

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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

const int X=400;

int N,Q;
int T[44444],A[44444],B[44444],id[44444];

int ans[44444];

int col[44444];
vpint G[44444];
bool ex[44444];

vpint GG[44444];
bool used[44444];
bool rel[44444];
bool dfs(int v,int t,vint &lis){
    used[v]=true;
    lis.pb(v);
    if(v==t)return true;

    for(auto &e:GG[v]){
        if(!ex[e.se])continue;
        if(used[e.fi])continue;
        if(dfs(e.fi,t,lis))return true;
    }
    return false;
}
void q(int ql,int qr){
    memset(col,-1,sizeof(col));

    for(int i=ql;i<qr;i++)if(T[i]!=3)rel[id[i]]=true;

    int n=0;
    for(int i=0;i<N;i++){
        if(col[i]!=-1)continue;
        queue<int>que;
        col[i]=n++;
        que.push(i);
        while(que.size()){
            int v=que.front();
            que.pop();
            for(auto &e:G[v]){
                if(ex[e.se]&&col[e.fi]==-1&&!rel[e.se]){
                    col[e.fi]=col[v];
                    que.push(e.fi);
                }
            }
        }
    }



    rep(i,n)GG[i].clear();
    for(int i=ql;i<qr;i++)if(T[i]!=3){
        GG[col[A[i]]].pb({col[B[i]],id[i]});
        GG[col[B[i]]].pb({col[A[i]],id[i]});
    }

    for(int i=ql;i<qr;i++){
        if(T[i]!=3){
            ex[id[i]]^=1;
        }
        else{
            vint lis;
            ans[i]=dfs(col[A[i]],col[B[i]],lis);
            for(auto u:lis)used[u]=0;
        }
    }

    for(int i=ql;i<qr;i++)if(T[i]!=3)rel[id[i]]=false;
}

signed main(){
    scanf("%lld%lld",&N,&Q);
    rep(i,Q)scanf("%lld%lld%lld",&T[i],&A[i],&B[i]);

    vector<pint>v;
    rep(i,Q)if(T[i]!=3)v.pb({A[i],B[i]});
    sort(all(v));v.erase(unique(all(v)),v.end());
    rep(i,Q)if(T[i]!=3)id[i]=lower_bound(all(v),pint(A[i],B[i]))-v.begin();

    rep(i,Q)if(T[i]!=3){
        G[A[i]].pb({B[i],id[i]});
        G[B[i]].pb({A[i],id[i]});
    }

    for(int i=0;i*X<Q;i++){
        q(i*X,min(Q,(i+1)*X));
    }
    rep(i,Q)if(T[i]==3)puts(ans[i]?"YES":"NO");
    return 0;
}

Measured memory_bytes: 9364