akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


void solve(ll N, vector<ll> A) {
    int bit = 0;
    int r = 0;
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        while (r < N && (A[r] & bit) == 0) {
            bit |= A[r];
            r++;
        }
        bit ^= A[i];
        ans += r - i;
    }
    cout << ans << endl;
}


void main_(istream &cin) {
    ll N;
    cin >> N;
    vector<ll> A(N - 1 + 1);
    for (int i = 0; i <= N - 1; i++) {
        cin >> A[i];
    }
    solve(N, A);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 3456
#include<cstdio>
#include<cstring>
#include<algorithm>
int n;
char s[500005];
int t[500005],sm;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;++i)s[i]&=15;
	std::reverse(s+1,s+n+1);
	for(int i=1;i<=n;++i){
		t[i]+=s[i]*9;
		t[i+1]+=t[i]/10;
		t[i]%=10;
	}
	n+=!!t[n+1];
	for(int i=1;i<=n;++i)sm+=t[i];
	for(int k=1;;++k){
		t[1]+=9;sm+=9;
		for(int i=1;t[i]>9;++i)++t[i+1],t[i]-=10,sm-=9;
		n-=!t[n];
		if(k*9>=sm)return printf("%d\n",k),0;
	}
}

Measured memory_bytes: 2560
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		
		long sum = 0;
		
		for(int i=1;i<=n;i++){
		    if(i%3==0||i%5==0) continue;
		    else sum+=i;
		}
		
		System.out.println(sum);
	}
}


Measured memory_bytes: 35780
import java.util.Scanner;

public class Main {

	/** 雨を表す符号 */
	private static final char RAIN = 'R';

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			int max = 0, count = 0;
			for (char c : s) {
				if (RAIN == c) {
					max = Math.max(max, ++count);
				} else {
					count = 0;
				}
			}
			System.out.println(max);
		}
	}
}


Measured memory_bytes: 35604
/*{{{*/
//#define HOME
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define F first
#define S second

template<class T> void _R(T &_x) { cin >> _x; }
void _R(int &_x) { scanf("%d", &_x); }
void _R(int64_t &_x) { scanf("%" SCNd64, &_x); }
void _R(double &_x) { scanf("%lf", &_x); }
void _R(char &_x) { scanf(" %c", &_x); }
void _R(char *_x) { scanf("%s", _x); }
template<class T, class U> void _R(pair<T, U> &_x) {_R(_x.F); _R(_x.S);}
void R() {}
template<class T, class... U> void R(T &_head, U &... _tail) { _R(_head); R(_tail...); }

template<class T> void _W(const T &_x) { cout << _x; }
void _W(const int &_x) { printf("%d", _x); }
void _W(const int64_t &_x) { printf("%" PRId64, _x); }
void _W(const double &_x) { printf("%.16f", _x); }
void _W(const char &_x) { putchar(_x); }
void _W(const char *_x) { printf("%s", _x); }
template<class T, class U> void _W(const pair<T, U> &_x) {_W(_x.F); putchar(' '); _W(_x.S);}
template<class T> void _W(const vector<T> &_x) { for (auto i = _x.begin(); i != _x.end(); _W(*i++)) if (i != _x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &_head, const U &... _tail) { _W(_head); putchar(sizeof...(_tail) ? ' ' : '\n'); W(_tail...); }
template<class T, class... U> void DB(const T &_head, const U &... _tail) {
#ifdef HOME
    W('#', _head, _tail...);
#endif
}

#define SZ(x) (int)((x).size())
#define ALL(x) (x).begin(), (x).end()
#define RAN(x,n) (x).begin(), (x).begin()+(n)
#define UNIQUE(x) {sort(ALL(x)); (x).erase(unique(ALL(x)), (x).end());}

#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
//#define ITER(i,t) for (auto i = t.begin(); i != t.end(); ++i)
#define IT3(i,st,ed) for (auto i = st; i != ed; ++i)
#define IT2(i,range) IT3(i,range)

#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define MS(X, v) memset((X), (v), sizeof((X)))

template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

inline int LG (const unsigned int &_x) { return 31-__builtin_clz(_x); }  // floor: LG(x), ceil: LG(x-1)+1
/*}}}*/

int n;

int main(){
    R(n);
    REP(a, 1, 9) REP(b, 1, 9){
        if(n == a * b){
            W("Yes");
            return 0;
        }
    }
    W("No");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<map>
#include<vector>
std::vector<std::pair<int, long long>> pq;
int main() {
	int n, i, e;
	long long p, q;
	bool match;
	while (true) {
		scanf("%d", &n);
		if (n == 0)break;
		for (i = 0; i < n; i++) {
			scanf("%d%lld%lld", &e, &p, &q);
			match = false;
			for (auto itr = pq.begin(); itr != pq.end(); itr++) {
				if (itr->first == e) {
					itr->second += p*q;
					match = true;
					break;
				}
			}
			if (!match)pq.push_back(std::make_pair(e, p*q));
		}
		match = false;
		for (auto itr = pq.begin(); itr != pq.end(); itr++) {
			if (itr->second >= 1000000) {
				printf("%d\n", itr->first);
				match = true;
			}
		}
		if (!match)printf("NA\n");
		pq.clear();
	}
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        int sum = 0;
        if (i % 2 == 0){
            continue;
        }else{
            for (int j = 1; j <= i; j++){
                if (i % j == 0){
                    sum++;
                }
            }
        }
        if (sum == 8){
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int N;
  int M;
  cin >> N >> M;
  vector<int> num(N,-1);
  bool exist = true;
  for(int i = 0; i < M; i++){
    int s;
    int c;
    cin >> s >> c;
    if(num[s-1] == -1){
      num[s-1] = c;
    }else if(num[s-1] != c){
      exist = false;
    }
  }
  if(num[0] == 0 && N != 1){
    exist = false;
  }
  if(exist){
    int intnum = 0;
    for(int i = 0; i < N; i++){
      intnum *= 10;
      if(num[i] == -1){
        if(i == 0 && N > 1){
          num[i] = 1;
        }else{
          num[i] = 0;
        }
      }
      intnum += num[i];
    }
    cout << intnum << endl;
  }else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 220005;

ll inv[MAX_N],fac[MAX_N],finv[MAX_N];

void make()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++){
		inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
}

ll comb(int a,int b)
{
	if(a<b){
		return 0;
	}
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}


int main()
{
    ll n,m,K;
    cin >> n >> m >> K;
    make();
    ll ans = 0;
    for(int i=0;i<=K;i++){
        ll val1 = ((n+1)*comb(n+2*i,i)%MOD)*inv[n+i+1]%MOD;
        ll val2 = ((m+1)*comb(m+2*(K-i),(K-i))%MOD)*inv[m+(K-i)+1]%MOD;
        ll val3 = comb(n+m+2*K,n+2*i);
        ans = (ans + (val1*val2%MOD)*val3%MOD) % MOD;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 8252
using System;
using System.Collections.Generic;
//using atcorder.DataStructure;
namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            atcorder.Test.Run();
        }
    }


    public class Test
    {
        public static void Run()
        {
            long N = long.Parse(Console.ReadLine());
            List<long> num = new List<long>();

            List<long> time = new List<long>();
            List<long> first = new List<long>();
            long min = long.MaxValue;
            for (int i = 0; i < 5; i++)
            {
                num.Add(long.Parse(Console.ReadLine()));
                if (min > num[i]) min = num[i];
            }
            long ret = (long)Math.Ceiling((double)N / min) + 4;
            Console.WriteLine(ret);
        }
    }




    public class Input
    {
        int arg;
        int length;
        string s;
        string[] ss;
        char sep;
        public Input(char _sep = '\0')
        {
            sep = _sep;
        }
        public void ReadLine()
        {
            s = Console.ReadLine();
            if (sep != '\0') ss = s.Split(sep);
            else
            {
                ss = new string[1];
                ss[0] = s;
            }
            arg = 0;
            length = ss.Length;
        }
        public T Next<T>()
        {
            if (arg == length) throw new IndexOutOfRangeException();
            return (T)Convert.ChangeType(ss[arg++], typeof(T));
        }
        public void SetSeparater(char _sep)
        {
            sep = _sep;
        }
    }
}


Measured memory_bytes: 11220
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void)
{
	double x1, y1, x2, y2;
	
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

	printf("%lf\n", hypot(x1-x2, y1-y2));
	
    return (0);
}


Measured memory_bytes: 2100
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int max = 0;
        for (int i = 0; i < S.length(); i++) {
            int j = i;
            while( j < S.length() && isACGT(S.charAt(j))){
                j++;
            }
            max = Math.max(max, j - i);
        }

        out.println(max);
    }

    public static boolean isACGT(char a) {
        return a == 'A' || a == 'C' || a == 'G' || a == 'T';
    }
}

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

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector< vector<int> > vvi;

set<int> dp[51];
bool at[51][31];

int main() {
	int n;
	while(cin >> n, n) {
		rep(i,51) dp[i].clear();
		memset(at, 0, sizeof(at));
		rep(j, n) {
			int f;
			cin >> f;
			rep(i, f) {
				int x;
				cin >> x;
				at[j][x] = true;
			}
		}
		rep(i,n) {
			dp[i].insert(i);
		}
		bool found = false;
		for(int i=1; i<=30; i++) {
			for(int j=0; j<n; j++) {
				if( !at[j][i] ) continue;
				for(int k=0; k<n; k++) {
					if( !at[k][i] ) continue;
					for(set<int>::iterator it=dp[k].begin(); it!=dp[k].end(); it++) {
						dp[j].insert(*it);
					}
				}
			}
			for(int j=0; j<n; j++) {
				if( dp[j].size() == n ) {
					cout << i << endl;
					found = true;
					break;
				}
			}
			if(found) break;
		}
		if(!found) {
			cout << "-1" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1320
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s = s.trim().to_string();

    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    let n: i32 = n.trim().parse().unwrap();

    for _ in 0..n {
        let mut t = String::new();
        io::stdin().read_line(&mut t).unwrap();
        let mut iter = t.trim().split_whitespace();

        let command = iter.next().unwrap().trim();
        let a: usize = iter.next().unwrap().parse().unwrap();
        let b: usize = iter.next().unwrap().parse().unwrap();

        match command  {
            "replace" => {
                let p = iter.next().unwrap();

                let f = s[0..a].to_string();
                let t = s[b+1..].to_string();

                s = f + p;
                s = s + &t;
            },
            "reverse" => {
                let f = s[0..a].to_string();
                let m = s[a..b+1].to_string().chars().rev().collect::<String>();
                let t = s[b+1..].to_string();

                s = f + &m;
                s = s + &t;
            },
            _ => {
                println!("{}", &s[a..b+1]);
            }
        }
    }
}



Measured memory_bytes: 5036
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    vector<int> group = {0,1,2,1,3,1,3,1,1,3,1,3,1};
    int x,y;
    cin >> x >> y;

    cout << (group[x] == group[y]? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 400


int main(){
  int n,m;
  int a[SIZE][SIZE];
  int people[SIZE];
  bool choose[SIZE] = {};
  int count[SIZE] = {};

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

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      scanf("%d",a[i]+j);
      a[i][j]--;
    }

    count[a[i][0]]++;
    people[i] = 0;
  }

  int ans = n;
  
  for(int i=0;i<m-1;i++){
    int max_count = 0;
    int max_sport = 0;
    
    for(int j=0;j<m;j++){
      if(max_count < count[j]){
        max_count = count[j];
        max_sport = j;
      }
    }
    
    ans = min(ans, max_count);
    
    choose[max_sport] = true;
    
    for(int j=0;j<n;j++){
      while(choose[a[j][people[j]]] == true){
        count[a[j][people[j]]]--;
        people[j]++;
        count[a[j][people[j]]]++;
      }
    } 
  }

  printf("%d\n",ans);
  
  return 0;
}


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

namespace AtCoder_ABC157
{
    class A
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int ans = N / 2;
            if (N%2==1)
            {
                ans += 1;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27116
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
}


Measured memory_bytes: 21844
#include <stdio.h>
int main(void)
{
	char s[4];
	scanf("%s", s);
	if (s[0] == s[1] && s[1] == s[2])
	{
		printf("No\n");
	}
	else
	{
		printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int x;cin>>x;
	if (x >=30){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
n, m = map(int, input().split())
c = [[] for i in range(n)]
d = [0]
e = [-1]*n
for i in range(m):
    a, b = map(int, input().split())
    c[a-1].append(b-1)
    c[b-1].append(a-1)
while d:
    f = d.pop(0)
    for i in c[f]:
        if e[i] == -1:
            d.append(i)
            e[i] = f
print("Yes")
for i in range(n-1):
    print(e[i+1]+1)

Measured memory_bytes: 33644
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int t, x;
  cin >> t >> x;
  double ans = (double)t/x;
  cout << fixed << setprecision(5) << ans << endl;
  return 0;
}


Measured memory_bytes: 3744
#include<stdio.h>

int main(){
  char word[100];
  scanf("%[^\n]", word);
	int ctr = 0;
	
  for(int i= 0; word[i] != '\0'; i++){
    if(word[i] == ' '){
		if(word[i - 1] == word[i + 1]){
			ctr++;
		}
    }
  }
  if(ctr == 2){
  	printf("YES\n");
  }
  else{
  	printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 1564
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H - h) * (W - w) << endl;



    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#define ll long long
#define rep(i,n) for(int i=0;i<n;++i) 
using namespace std;
static const long long MOD=1000000007;
static const int MAX = 2010;

vector<bool> seen;
ll dfs(vector<vector<int>> &g,int p,int v,int k, int  K){
    seen[v]=true;
    ll ret=k;
    int b= K-1 -((p!=-1)?1:0);
        for(auto a: g[v]){
            if(seen[a])
            continue;
            ret*=dfs(g,v,a,max(0,b),K);
            ret%=MOD;
            b--;
            
        }
        
        return ret;
    
    
 
}

int main(void){
    int n,k;
    cin>>n>>k;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    seen.assign(n, false);
   cout<<dfs(g,-1,0,k,k);
    
}


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

using namespace std;

int main()
{
    int h, n, a;

    cin >> h >> n;

    int s = 0;

    while (n--)
    {
        cin >> a;
        s += a;
    }

    if (s >= h)
        cout << "Yes";
    else
        cout << "No";

    cout << "\n";

    return 0;
}

Measured memory_bytes: 764
<?php
  
$n = trim(fgets(STDIN));
$s = str_split(trim(fgets(STDIN)));

if ($n%2 !== 0){
  echo 'No';
} else {

  $l = array_slice($s, 0, $n/2);
  $r = array_slice($s, $n/2);

  echo $l == $r? 'Yes' : 'No';
  
}

?>

Measured memory_bytes: 4728
N = int(input())

def solve() :
    for a in range(1, 3501) :
        for b in range(1, 3501) :
            if 4 * a * b <= (a + b) * N :
                continue
                
            if a * b * N % (4 * a * b - (a + b) * N) == 0 :
                return a, b, a * b * N // (4 * a * b - (a + b) * N)
                
print(*solve())

Measured memory_bytes: 39024
#include <algorithm>
#include <cstdint>
#include <functional>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <std::uint_fast64_t Modulus>
class ModInt {
    using u64 = std::uint_fast64_t;

   public:
    u64 a;

    constexpr ModInt(const u64 x = 0) noexcept : a(x % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr ModInt operator+(const ModInt rhs) const noexcept { return ModInt(*this) += rhs; }
    constexpr ModInt operator-(const ModInt rhs) const noexcept { return ModInt(*this) -= rhs; }
    constexpr ModInt operator*(const ModInt rhs) const noexcept { return ModInt(*this) *= rhs; }
    constexpr ModInt operator/(const ModInt rhs) const noexcept { return ModInt(*this) /= rhs; }
    constexpr ModInt &operator+=(const ModInt rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr ModInt &operator/=(ModInt rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};

using mint = ModInt<MOD>;

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

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }

    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

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

long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int>> a(N + 1, vector<int>(N + 1, 0)), v;
    v = a;
    REP(i, M) {
        int l, r;
        cin >> l >> r;
        v[l - 1][r - 1] += 1;
    }

    REP(i, N) {
        REP(j, N) { a[i + 1][j + 1] = a[i + 1][j] + a[i][j + 1] - a[i][j] + v[i][j]; }
    }

    REP(i, Q) {
        int p, q;
        cin >> p >> q;;
        cout << a[q][q] - a[q][p - 1] - a[p - 1][q] + a[p - 1][p - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
/**Author:Sagor*/

#include<bits/stdc++.h>
#include<numeric>

using namespace std;
#define pri(n)          printf("%d\n",n)
#define prll(n)         printf("%lld\n",n)
#define prd(n)          printf("%lf\n",n)
#define scll(n)         scanf("%lld",&n)
#define sci(n)          scanf("%d",&n)
#define scd(n)          scanf("%lf",&n)
#define pi              acos(-1)//inbuilt M_PI
#define ll              long long
#define pb              push_back
#define vsort(v)        sort(v.begin(),v.end())
#define asort(n)        sort(ar,ar+n)
#define for1(i,n)       for(i=1;i<=n;i++)
#define for0(i,n)       for(i=0;i<n;i++)
#define mod             1000000007
#define watch(x)        cout << (#x) << " is " << (x) <<"\n";

/** for print with quote \"hello world\"
    1LL is used to convert into long long*/

bool isprime(int n)
{
    if(n%2==0 && n!=2)
    {
        return 0;
    }
    else
    {
        int root=sqrt(n);
        for(int i=3; i<=root; i+=2)
        {
            if(n%i==0)
            {
                return 0;
            }
        }
        return 1;
    }

}

int main()
{
    /**freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);/**Dont't use scanf of printf*/
    ll n,i;
    cin>>n;
    if(n==2){
        cout<<"2\n";
        return 0;
    }
    if(n & 1){
        for(i=n; ;i+=2){
            if(isprime(i)){
                cout<<i<<"\n";
                return 0;
            }
        }
    }
    else{
        for(i=n+1; ;i+=2){
            if(isprime(i)){
                cout<<i<<"\n";
                return 0;
            }
        }
    }


    return 0;
}


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

int main() {
	
	int n, k;
	
	cin >> n >> k;
	
	int height[n];
	int minCost[n];
	
	for(int i=0; i<n; ++i)
	{
	    minCost[i] = INT_MAX;
	    cin >> height[i];
	}
	
	minCost[0] = 0;
	for(int i=0; i<n; ++i)
	{
	    for(int j=1; j<=k && i+j < n; ++j)
	    {
	        minCost[i+j] = min(minCost[i+j], minCost[i] + abs(height[i] - height[i+j]));
	    }
	}
	
	cout << minCost[n-1] << "\n";
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const int MAXN = 1e5 + 10;
modint dp[MAXN][26];

int main(){
    iosetup;
    int N; cin >> N;
    string S; cin >> S;
    map<char, int> M;
    rep(i, 0, N) M[S[i]]++;
    modint ans = 1;
    for(auto e: M){
        ans *= (e.second + 1);
    }
    cout << ans - 1 << endl;

    return 0;
}

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

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    long long A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < int(n);++i)
#define pb push_back
#define vi vector<int>
#define pll pair<ll,ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define ff first
#define ss second

void solve() {

}

int countLen(int x){
    int cnt = 0;
    while(x > 0){
        x/=10;
        cnt++;
    }
    return cnt;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    /*ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }*/
    ll n; cin >> n;
    int ans = 0 ;
    for(int i = 1; i <= n; ++i){
        if(countLen(i) % 2){
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    if(n%11==0) cout<<n/11*2<<endl;
    else if(n%11<=6) cout<<n/11*2 + 1<<endl;
    else cout<<n/11*2 + 2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>

int main(){
   int N, M;
   std::cin >> N >> M;
   std::map<int, int> mp;
   for (int i=0; i<N; i++){
      int k;
      std::cin >> k;
      for (int j=0; j<k; j++){
         int key;
         std::cin >> key;
         mp[key]++;
      }
   }
   int cnt = 0;
   for (auto x : mp){
      if (x.second == N){
         cnt++;
      }
   }
   std::cout << cnt << std::endl;
}



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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef long long lint;
template< typename T > void modMul(T& a, T b, T m) { a = (a*b)%m; }
template< typename T > void modAdd(T& a, T b, T m) { a = (a+b+m)%m; }

class Combination {
private:
	const int MAX_NUM;
	vector< lint > fact, inv;
	const lint MOD;
	
	lint powMod(lint x, lint k) {
		lint res = 1;
		while (k) {
			if (k&1) modMul(res, x, MOD);
			modMul(x, x, MOD);
			k >>= 1;
		}
		return res;
	}
	
	void pre() {
		fact[0] = fact[1] = 1;
		for_(i,2,MAX_NUM) fact[i] = (fact[i-1] * i) % MOD;
		for_(i,0,MAX_NUM) inv[i] = powMod(fact[i], MOD-2);
	}
	
public:
	Combination(int __MAX_NUM, lint __MOD)
	: MAX_NUM(__MAX_NUM), fact(__MAX_NUM, 0), inv(__MAX_NUM, 0), MOD(__MOD) { pre(); }
	
	lint calc(int n, int k) {
		if (n < k) return 0;
		lint res = fact[n];
		modMul(res, inv[n-k], MOD);
		modMul(res, inv[k], MOD);
		return res;
	}
};

int n, a[100005];
const lint mod = (lint)1e9 + 7;

int main() {
	cin >> n;
	for_(i,0,n+1) cin >> a[i];
	
	lint x = accumulate(a, a+n+1, lint()) - (lint)n*(n+1)/2;
	
	int L = -1, R = -1;
	for_(i,0,n+1) {
		if (a[i] == x) {
			if (L == -1) L = i;
			else R = n-i;
		}
	}
	
	Combination comb(n+2, mod);
	
	cout << n << endl;
	for_(k,2,n+2) {
		lint ans = comb.calc(n+1,k);
		modAdd(ans, -comb.calc(L+R, k-1), mod);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int X;
    cin >> X;
    int mx = 0; //X以下の最大のべき乗数
    int limit = (int)sqrt(1000);
    if(X == 1){
        cout << 1 << endl;
        return 0;
    }
    for(int i = 1; i <= sqrt(X); i++){
        int m_num = pow(i, 2);
        if(i == 1){
            m_num = 1;
            mx = max(mx, m_num);
            continue;
        }
        for(int j = 2; pow(i, j) <= X; j++){
            m_num = pow(i, j);
        }
        mx = max(mx, m_num);
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

long min(long x,long y){
  if(x<y) return x;
  else return y;
}

int main(){
  long a,b,c,x,y,sum=0;
  scanf("%ld %ld %ld %ld %ld",&a,&b,&c,&x,&y);
  sum+=min(2*c,a+b)*min(x,y);
  if(x<y) sum+=(y-x)*min(2*c,b);
  else if(x>y) sum+=(x-y)*min(2*c,a);
  printf("%ld\n",sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INF 1001001001001001
int main() {
    long long n,s;
    cin >> n >> s;

    if(n < s) {
        cout << -1 << endl;
        return 0;
    } else if(n == s) {
        cout << n+1 << endl;
        return 0;
    }

    long long res = INF;
    for(long long b=2; b<sqrt(n)+1; ++b) {
        long long cnt = 0;
        long long tmp = n;
        while(tmp > 0) {
            cnt += tmp % b;
            tmp /= b;
        }
        if(cnt == s) {
            res = b;
            break;
        }
    }
    if(res != INF) {
        cout << res << endl;
        return 0;
    }

    for(long long p = (int)sqrt(n); p>=1; --p) {
        if((n-s) % p != 0) continue;
        long long b = 1 + (n - s) / p;
        long long q = n - p * b;
        if(p + q == s && p < b && q >= 0 && q < b) {
            res = b;
            break;
        }
    }
    if(res != INF) cout << res << endl;
    else cout << -1 << endl;
}

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

using namespace std;

typedef long long int li;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}
    
int main()
{    
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        li a;

        cin>>a;

        vi v;

        f(i,1,9)
        {
            f(j,1,9)
            {
                v.PB(i*j);
            }
        }

        li n=v.size();

        f(i,0,n-1)
        {
            if(v[i]==a)
            {
                cout<<"Yes";
                return 0;
            }
        }

        cout<<"No";

    return 0;
}

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

int main() {
    char num[1000];
    scanf("%s", &num);
    while (strlen(num) != 0 && num[0] != '0') {
        int sum = 0;
        for (int i = 0; i < strlen(num); i++) {
            sum += (int) num[i] - 48;
        }
        printf("%d\n", sum);
        scanf("%s", &num);
    } 
}


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

int main() {
  vector<vector<int>> G(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cin >> G.at(i).at(j);
  }
  int N; cin >> N;
  for (int i = 0; i < N; i++) {
    int b; cin >> b;
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (G.at(j).at(k) == b) G.at(j).at(k) = -1;
      }
    }
  }
  bool ans = false;
  for (int i = 0; i < 3; i++) {
    if (G.at(i).at(0) == -1 && G.at(i).at(1) == -1 && G.at(i).at(2) == -1) {
      ans = true;
    }
  }
  for (int i = 0; i < 3; i++) {
    if (G.at(0).at(i) == -1 && G.at(1).at(i) == -1 && G.at(2).at(i) == -1) {
      ans = true;
    }
  }
  if (G.at(0).at(0) == -1 && G.at(1).at(1) == -1 && G.at(2).at(2) == -1) {
    ans = true;
  }
  if (G.at(0).at(2) == -1 && G.at(1).at(1) == -1 && G.at(2).at(0) == -1) {
    ans = true;
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
a,b,m=map(int,input().split())
sa=list(map(int,input().split()))
sb=list(map(int,input().split()))
t=min(sa)+min(sb)
for i in range(m):
	x,y,c=map(int,input().split())
	t=min(t,sa[x-1]+sb[y-1]-c)
print(t)

Measured memory_bytes: 70892
/*
author : seryu
title : ABC168B_"Triple dots"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;


void solve()
{
	int k;
	cin >> k;
	string s;
	cin >> s;
	if(sz(s) <= k)cout << s << endl;
	else cout << s.substr(0, k)+"..." << endl;
	return;	
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <stack>
#include <functional>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

#define ASIZE(arr) (sizeof(arr)/sizeof(arr[0])

//int dp[1000][1000];
//int n, W, w[1000], v[1000];
//void solve() {
//	for (int i = n - 1; i >= 0; i--)
//	{
//		for (int j = 0; j <= W; j++)
//		{
//			if (j < w[i]) {
//				dp[i][j] = dp[i + 1][j];
//			}
//			else {
//				dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
//			}
//		}
//	}
//}

vector<ll> p = { 1 }, b = { 1 };

ll solve(ll n, ll x) {
	if (n == 0)return x <= 0 ? 0 : 1;
	else if (x <= 1 + b[n - 1]) return solve(n - 1, x - 1);
	else return p[n - 1] + 1 + solve(n - 1, x - 2 - b[n - 1]);
}

int main() {
	ll n;
	cin >> n;
	vector<ll> a(100001, 0), b(100001, 0);

	for (ll i = 0; i < n / 2; i++)
	{
		ll temp;
		cin >> temp;
		a[temp - 1]++;
		cin >> temp;
		b[temp - 1]++;
	}

	auto max_a = max_element(a.begin(), a.end()), max_b = max_element(b.begin(), b.end());
	ll ans = 1000000;
	if (max_a - a.begin() == max_b - b.begin()) {
		if (*max_a == *max_b && *max_a == n / 2)
		{
			cout << *max_a << endl;
		}
		else {
			vector<pair<ll, ll> > _a, _b;
			_a.push_back(make_pair(max_a - a.begin(),*max_a)), _b.push_back(make_pair(max_b - b.begin(), *max_b));
			//a.erase(max_a), b.erase(max_b);
			*max_a = 0, *max_b = 0;
			max_a = max_element(a.begin(), a.end()), max_b = max_element(b.begin(), b.end());
			_a.push_back(make_pair(max_a - a.begin(), *max_a)), _b.push_back(make_pair(max_b - b.begin(), *max_b));
			for (ll i = 0; i < 2; i++)
			{
				for (ll k = 0; k < 2; k++)
				{
					if (_a[i].first != _b[k].first) {
						ans = min(ans, n - _a[i].second - _b[k].second);
					}
				}
			}
			cout << ans << endl;
		}
		//else {
		//	ans = n - max(*max_a, *max_b);
		//	if (*max_a < *max_b)
		//	{
		//		a.erase(max_a);
		//		ans -= *max_element(a.begin(), a.end());
		//	}
		//	else
		//	{
		//		b.erase(max_b);
		//		ans -= *max_element(b.begin(), b.end());
		//	}
		//	cout << ans << endl;
		//}
	}
	else {
		cout << n - *max_a - *max_b << endl;
	}

}

Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

int s[200001], x[200001];

int subsum(int l, int r) {
  if (l > 0)
    return s[r] - s[l - 1];
  else
    return s[r];
}

int subxor(int l, int r) {
  if (l > 0)
    return x[r] ^ x[l - 1];
  else
    return x[r];
}

int n, a;
int sum = 0;
int xr = 0;
int l = 0;
int r = 0;
ll ans = 0;

int main() {
  //
  scanf("%d", &n);
  rep(i, n) {
    scanf("%d", &a);
    sum += a;
    s[i] = sum;
    xr = xr ^ a;
    x[i] = xr;
  }
  while (l < n) {
    while (r < n - 1 && subsum(l, r + 1) == subxor(l, r + 1)) {
      r++;
    }
    ans += r - l + 1;
    l++;
  }
  printf("%lld\n", ans);
  return 0;
}


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

// * XYツ催?標
#define X real()
#define Y imag()

// * ツ点ツづ個表ツ個サ
typedef complex<double> P;

// * ツ仰鳴容ツつキツづゥツ古ォツ債キツε?
const double EPS = 1e-10;
// * Infinity
const double INF = 1e12;
// * ツ円ツ偲シツ猟ヲ
const double PI = acos(-1.0);
// * 
const P INF_P(INF,INF);

// * complex<double> ツづ個渉?渉伉づーツ津ィツ義ツつキツづゥ
namespace std {
	bool operator < (const P& a, const P& b) {
		return (real(a) != real(b))? real(a) < real(b) : imag(a) < imag(b);
	}
}

// * ツ点ツ催?標ツづ個デツバツッツグツ出ツ療?
void print(P p) {
	cout << "point" << p << ";" << endl;
}

// * 2ツ湘ヲツつキツづゥ
double sq(double x) {
	return x * x;
}

// * 2ツ点ツ甘板づ個仰猟猟」
double dist(P p1, P p2) {
	return abs(p1 - p2);
}

// * 2ツづつづ個スツカツδ可ーツつェツ督卍つオツつ「ツつゥツづ?つ、ツつゥ
bool equal(double a, double b) {
	return ( fabs( a - b ) < EPS );
}
// * 2ツづつづ個ベツクツトツδ仰つェツ督卍つオツつ「ツつゥツづ?つ、ツつゥ
bool eq_v(P a, P b) {
	return ( equal( a.X, b.X ) && equal( a.Y, b.Y ) );
}

// * ツ禿?静?(dot product) : aツ・b = |a||b|cosツδヲ
double dot(P a, P b) {
	return real( conj(a) * b );
}

// * ツ外ツ静?(cross product) : aツ×b = |a||b|sinツδヲ
double cross(P a, P b) {
	return imag( conj(a) * b ) ;
}

// ツベツクツトツδ?a ツづ個単ツ暗環法ツ静シツベツクツトツδ仰づーツ仰?づ淞づゥ
vector<P> normal_unit(P a) {
	vector<P> vp;
	vp.push_back( (a * P(0,  1)) / abs(a) );
	vp.push_back( (a * P(0, -1)) / abs(a) ) ;
	return vp;
}

// ツ個エツ点ツづーツ篠イツづ可点 p ツづーツ角ツ度 a (ツδ可ジツアツδ?ツつセツつッツ嘉アツ転ツつウツつケツつスツ点ツづーツ陛板つキ
P rot(P p, double a){
	double x = p.X * cos(a) - p.Y * sin(a);
	double y = p.X * sin(a) + p.Y * cos(a);
	return P(x,y);
}

int main(){
	int n;
	while( cin >> n , n ){
		vector<P> v;
		int ans=1;
		for(int i=0 ; i < n ; i++ ){
			double x, y;
			scanf("%lf %lf", &x, &y);
			v.push_back( P(x,y) );
		}
		for(int i=0 ; i < v.size() ; i++ ){
			for(int j=i+1 ; j < v.size() ; j++ ){
				if( i == j ) continue;
				P p1 = v[i];
				P p2 = v[j];
				double d = dist(p1,p2);
				if( d >= 2.0 ) continue;
				
				double angle = atan2( p2.Y-p1.Y , p2.X-p1.X );
				P mid = rot( p2-p1 , -angle ) / 2.0;
				double h = sqrt(1.0 - sq(d/2.0));
				P p3 = P( mid.X , h );
				P p4 = P( mid.X , -h );
				int cnt1=0, cnt2=0;
				for(int k=0 ; k < v.size() ; k++ ){
					P p = rot( v[k]-p1 , -angle );
					if( dist(p3,p) <= 1.0 ) cnt1++;
					if( dist(p4,p) <= 1.0 ) cnt2++;
				}
				ans = max( ans , max(cnt1,cnt2) );
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn pow_mod(base: usize, power: usize, modulo: usize) -> usize {
    let mut base = base;
    let mut power = power;
    let mut ans = 1;
    while power > 0 {
        if power & 1 == 1 { ans = ans * base % modulo; }
        power >>= 1;
        base = base * base % modulo;
    }
    ans
}

const MOD: usize = 1e+9 as usize + 7;

fn calc_small(s: usize, v: usize) -> usize {
    let mut v = v;
    let mut w = 1;
    let mut base = 1;
    while base * 10 <= v { w += 1; base *= 10; }
    let mut sum = 0;
    loop {
        let rest = base * 10 - v;
        let need = (s - sum) / w;
        if need <= rest {
            v += need;
            sum += need * w;
            break;
        }
        sum += rest * w;
        base *= 10;
        v = base;
        w += 1;
    }
    if sum == s { 1 } else { 0 }
}

fn calc(s: usize, w: usize) -> usize {
    let mut ret = 0;
    if w < 9 {
        let left = std::cmp::max(1, usize::pow(10, w as u32 - 1));
        let right = usize::pow(10, w as u32);
        for i in left..right {
            ret += calc_small(s, i);
        }
    } else {
        let cnt = s / w;
        let rest = s % w;
        if rest == 0 {
            ret = (pow_mod(10, w, MOD) + MOD - pow_mod(10, w - 1, MOD) + MOD - cnt) % MOD;
        }
        if rest < cnt {
            ret = (ret + 1 + (cnt - rest - 1) / (w + 1)) % MOD;
        }
        // println!("{} {} {}", w, cnt, rest);
    }
    ret % MOD
}

fn main() {
    let s: usize = read();
    // println!("{}", calc(123, 3));
    //return;
    let mut min_digit = 1;
    let mut ans = 0;
    loop {
        ans = (ans + calc(s, min_digit)) % MOD;
        if min_digit * min_digit > s { break; }
        min_digit += 1;
    }
    for i in 1.. {
        let target = s / i;
        if target <= min_digit { break; }
        ans = (ans + calc(s, target)) % MOD;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4476
A, B, K = gets.split.map(&:to_i)

if B-A < K*2
  (A..B).each do |num|
    unless num.between?(A+K, B-K)
      puts num
    end
  end
else
  (A..(A+K-1)).each do |num|
    puts num
  end
  ((B-K+1)..B).each do |num|
    puts num
  end
end


Measured memory_bytes: 1788