akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int t;
  cin>>t;
  for(int _=0;_<t;_++){
    int64_t n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    map<int64_t,int64_t> m;
    priority_queue<vector<int64_t>,vector<vector<int64_t>>,greater<vector<int64_t>>> q;
    q.push({0,n});
    while(!q.empty()){
      int64_t l=q.top().at(0);
      int64_t x=q.top().at(1);
      q.pop();
      if(m.count(x)&&l>=m.at(x))
        continue;
      m[x]=l;
      for(int i=-1;i<=1;i++)
        if(x+i>0&&(x+i)%2==0&&(x+i)/2<x&&(abs(i)*d+a)/(x-(x+i)/2)/d<1)
          q.push({l+abs(i)*d+a,(x+i)/2});
      for(int i=-2;i<=2;i++)
        if(x+i>0&&(x+i)%3==0&&(x+i)/3<x&&(abs(i)*d+b)/(x-(x+i)/3)/d<1)
          q.push({l+abs(i)*d+b,(x+i)/3});
      for(int i=-4;i<=4;i++)
        if(x+i>0&&(x+i)%5==0&&(x+i)/5<x&&(abs(i)*d+c)/(x-(x+i)/5)/d<1)
          q.push({l+abs(i)*d+c,(x+i)/5});
    }
    int64_t x,l;
    int64_t mi=-1;
    for(auto i:m){
      x=i.first;
      l=i.second;
      if(mi==-1||((mi-l)/d>=x&&mi>l+d*x))
        mi=l+x*d;
    }
    cout<<mi<<endl;
  }
}

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

using namespace std;

int main() {
  int N, ABC[3];
  cin >> N >> ABC[0] >> ABC[1] >> ABC[2];
  vector<string> s(N);
  for (int i = 0; i < N; ++i) {
    cin >> s[i];
  }

  vector<char> result(N);
  if (ABC[0] + ABC[1] + ABC[2] == 2) {
    int i = 0;
    do {
      int l, r;
      if (s[i] == "AB") {
        l = 0; r = 1;
      } else if (s[i] == "BC") {
        l = 1; r = 2;
      } else if (s[i] == "AC") {
        l = 2; r = 0;
      }

      if ((ABC[l] == 0) && (ABC[r] == 0)) {
        cout << "No" << endl;
        return 0;
      } else if ((ABC[l] == 1) && (ABC[r] == 1) && (i + 1 < N)) {
        int l2;
        if (s[i + 1] == "AB") {
          l2 = 0;
        } else if (s[i + 1] == "BC") {
          l2 = 1;
        } else if (s[i + 1] == "AC") {
          l2 = 2;
        }
        if (l == l2) {
          result[i] = 'A' + l; result[i + 1] = 'A' + r;
        } else if ((l == 0) && (l2 == 1)) /* AB BC */ {
          result[i] = 'B'; result[i + 1] = 'C';
          --(ABC[0]); ++(ABC[2]);
        } else if ((l == 0) && (l2 == 2)) /* AB AC */ {
          result[i] = 'A'; result[i + 1] = 'C';
          --(ABC[1]); ++(ABC[2]);
        } else if ((l == 1) && (l2 == 0)) /* BC AB */ {
          result[i] = 'B'; result[i + 1] = 'A';
          --(ABC[2]); ++(ABC[0]);
        } else if ((l == 1) && (l2 == 2)) /* BC AC */ {
          result[i] = 'C'; result[i + 1] = 'A';
          --(ABC[1]); ++(ABC[0]);
        } else if ((l == 2) && (l2 == 0)) /* AC AB */ {
          result[i] = 'A'; result[i + 1] = 'B';
          --(ABC[2]); ++(ABC[1]);
        } else if ((l == 2) && (l2 == 1)) /* AC BC */ {
          result[i] = 'C'; result[i + 1] = 'B';
          --(ABC[0]); ++(ABC[1]);
        }
        i += 2;
      } else if (ABC[l] < ABC[r]) {
        result[i] = 'A' + l;
        ++(ABC[l]); --(ABC[r]);
        ++i;
      } else {
        result[i] = 'A' + r;
        --(ABC[l]); ++(ABC[r]);
        ++i;
      }
    } while (i < N);
  } else {
    for (int i = 0; i < N; ++i) {
      int l, r;
      if (s[i] == "AB") {
        l = 0; r = 1;
      } else if (s[i] == "BC") {
        l = 1; r = 2;
      } else if (s[i] == "AC") {
        l = 2; r = 0;
      }

      if ((ABC[l] == 0) && (ABC[r] == 0)) {
        cout << "No" << endl;
        return 0;
      } else if (ABC[l] < ABC[r]) {
        result[i] = 'A' + l;
        ++(ABC[l]); --(ABC[r]);
      } else {
        result[i] = 'A' + r;
        --(ABC[l]); ++(ABC[r]);
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < N; ++i) {
    cout << result[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 6440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int lim = 1e5+5;

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

    int n,l;
    cin>>n>>l;
    vector<int> apples;
    for(int i=1;i<=n;i++)
    	apples.push_back(l+i-1);
    for(int i=0;i<n;i++) 
    	if(apples[i]==0) {
    		cout<<accumulate(apples.begin(),apples.end(),0);
    		return 0;
    	}
    if(apples[n-1]<0)
    	cout<<accumulate(apples.begin(),apples.end(),0)-apples[n-1];
   	else
   		cout<<accumulate(apples.begin(),apples.end(),0)-apples[0];
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int w,h,n,sx[102]={0},sy[102]={0},xn=0,yn=0;
	cin>>w>>h>>n;
	for(int i=0;i<n;i++){
		int x,y,a;
		cin>>x>>y>>a;
		if(a==1){
//			cout<<a<<"j:"<<endl;
			for(int j=0;j<x;j++){
//				cout<<j<<endl;
				sx[j]=1;
			}
		}else if(a==2){
//			cout<<a<<"j:"<<endl;
			for(int j=x;j<w;j++){
//				cout<<j<<endl;
				sx[j]=1;
			}
		}else if(a==3){
//			cout<<a<<"j:"<<endl;
			for(int j=0;j<y;j++){
//				cout<<j<<endl;
				sy[j]=1;
			}
		}else{
//			cout<<a<<"j:"<<endl;
			for(int j=y;j<h;j++){
//				cout<<j<<endl;
				sy[j]=1;
			}
		}
	}
	for(int i=0;i<w;i++){
//		cout<<"#@!"<<sx[i]<<endl;
		if(sx[i]==0){
			xn++;
		}
	}
	for(int i=0;i<h;i++){
//		cout<<sy[i]<<"#@!"<<endl;
		if(sy[i]==0){
			yn++;
		}
	}
	cout<<xn*yn;
	return 0;
}

Measured memory_bytes: 256
use std::io;

fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split(' ').flat_map(str::parse).collect()
}

fn main() {
    for i in 1.. {
        let l1 = read::<i32>();
    
        let x = l1[0];

        if x == 0 {
            break
        }

        println!("Case {}: {}", i, x);
    }
}



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

bool cmp(const char* lhs, const char* rhs, const int len){
    for(int i=0; i<len; ++i){
        if(lhs[i]!=rhs[i]){ return false; }
    }
    return true;
}

int main(){
    string str; cin >> str; std::reverse(str.begin(), str.end());
    
    string d2 = "dreamer"; // odered by greter length
    string e2 = "eraser";
    string d1 = "dream";
    string e1 = "erase";
    vector<string> vecDE = {d2, e2, d1, e1};
    for(int i=0; i<vecDE.size(); ++i){ std::reverse(vecDE[i].begin(), vecDE[i].end()); }
    
    for(int i=0; i!=str.size();){
        bool TF=false;
        for(int v=0; v<vecDE.size(); v++){
            if( cmp(&str[i], vecDE[v].c_str(), vecDE[v].size()) ){
                i += vecDE[v].size();
                TF=true;
                break;
            }
        }
        if(TF==false){ cout << "NO"; return 0; }
    }
    cout << "YES"; 
    
    return 0;
}

Measured memory_bytes: 512
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main implements Runnable {

	public static void main(String[] args) {

		new Thread(null, new Main(), "", 16 * 1024 * 1024).start();

	}

	@Override
	public void run() {
		exec();
	}

	private void exec() {

		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i = 0 ; i < n ; i++) {
			d[i] = sc.nextInt();
		}

		int ans = 0;
		for(int i = 0 ; i < n - 1 ; i++) {
			for(int j = i + 1 ; j < n ; j++) {
				ans += d[i] * d[j];
			}
		}

		System.out.println(ans);

	}

}

class FastScanner {

	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	public FastScanner(InputStream in) {
		this.in = in;
	}

	private boolean hasNextByte() {
		if(ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if(buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if(hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while(hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){
				return minus ? -n : n;
			}else{
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

}


Measured memory_bytes: 23380
#include<iostream>
	#include<vector>
	#include<algorithm>
	#include<string>
	#include<cmath>
	#include<map>
	#include<cstdio>
	#include<stack>
	#include<queue>
	#include<fstream>
	#include<cstdio>
	#include<deque>
	#include<iomanip>
	#include <numeric>
	//#include<bits/stdc++.h>

	using namespace std;
	#define ok1 printf("ok1\n");
	#define ok2 printf("ok2\n");
	#define M 1000000000000000000LL
	#define rep(i,n) for(int i=0;i<n;i++)
	#define REP(i,s,n) for(int i=(s);i<(n);i++)
	#define repr(i,n) for(int i=n-1;i>=0;i--)
	#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
	#define all(a) (a).begin(),(a).end()
	#define reall(a) (a).rbegin(),(a).rend()
	#define pb push_back
	#define pf push_front
	#define MIN(a,b) a=min((a),(b))
	#define MAX(a,b) a=max((a),(b))
	#define SIZE(v) (int)v.size()
	const double pi = acos(-1.0);

	typedef vector<int> vi;
	typedef vector<string> vs;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<vi> vvi;
	typedef vector<vll> vvll;
	typedef deque<ll> dll;
	typedef pair<ll, ll> P;
	const ll mod = 1e9 + 7;
	ll dx[4] = {1,0,-1,0};
	ll dy[4] = {0,1,0,-1};


	int main() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		
		string s;
		cin >> s;
		map<char, ll> m;
		rep(i, s.size()) m[s[i]]++;
		for (auto p : m) {
			if (p.second % 2 != 0) {
				cout << "No\n";
				return 0;
			}
		}
		cout << "Yes\n";
		return 0;
	}	
	

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N;
    scan(N);
    readln.split.map!(to!int).enumerate.array.sort!"a.value < b.value"
                    .map!(ai => (ai.index + 1).to!string).joiner(" ").writeln;
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 5820
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=1e9+7;
const double pi=3.1415926535;
char s[maxn];


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    cin>>(s+1);
    if(n%2)
    {
        cout<<"No"<<'\n';
    }
    else
    {
        int k=n/2;
        for(int i=1;i<=n/2;i++)
        {
            if(s[i]!=s[i+k])
            {
                cout<<"No"<<'\n';
                return 0;
            }
        }
        cout<<"Yes"<<'\n';
    }



}


Measured memory_bytes: 3596
def main():
    k = int(input())
    a, b = map(int, input().split())

    is_ok = False
    for i in range(a, b+1):
        if i % k == 0:
            is_ok = True
            break

    print('OK' if is_ok else 'NG')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,-1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<int> suzu(M);
    int sum = 0;
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        sum += max(0,b-N);
        suzu[i] = b-N;
    }
    sort(suzu.begin(),suzu.end(),greater<int>());
    cout << sum - suzu[0] << endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main() {
	char s[105];
	cin >> s;
	int l = strlen(s);
	bool fc = 0;
	int tarc,tarf;
	for(int i = 0;i < l;++i) {
		if(s[i] == 'C'&&fc == 0){
			fc = 1;tarc = i;
		}
		if(s[i] == 'F') {
			tarf = i;
		}
	}
	if(tarc < tarf)
		cout << "Yes" << endl;
	else
		cout << "No" << endl; 
}

Measured memory_bytes: 256
#![allow(unused_macros, unused_imports, dead_code)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

struct State {
    y: i32,
    x: i32,
    d: i32,
}

fn main() {
    from_line!(h : i32, w : i32);
    let s: Vec<String> = (0..h).map(|_| read_line()).collect();

    let mut cnt = 0;
    for i in 0..h {
        for j in 0..w {
            let c = s[i as usize].chars().nth(j as usize).unwrap();
            if c == '.' {
                cnt += 1;
            }
        }
    }

    let mut visited: Vec<Vec<bool>> = (0..h).map(|_| vec![false; w as usize]).collect();
    let mut q: Vec<State> = Vec::new();
    q.push(State { y: 0, x: 0, d: 1 });
    while q.len() > 0 {
        let x = q[0].x;
        let y = q[0].y;
        let d = q[0].d;
        q.remove(0);

        if visited[y as usize][x as usize] {
            continue;
        }
        visited[y as usize][x as usize] = true;

        if y == h - 1 && x == w - 1 {
            println!("{}", cnt - d);
            return;
        }

        let dd = vec![0, 1, 0, -1, 0];
        for i in 0..4 {
            let ny = y + dd[i as usize];
            let nx = x + dd[(i + 1) as usize];
            if 0 <= ny && ny < h && 0 <= nx && nx < w && !visited[ny as usize][nx as usize] && s[ny as usize].chars().nth(nx as usize).unwrap() != '#' {
                q.push(State { y: ny, x: nx, d: d + 1 });
            }
        }
    }

    println!("{}", -1);
}


Measured memory_bytes: 4352
S = input()
K = int(input())
a = {s:[] for s in 'abcdefghijklmnopqrstuvwxyz'}
for i in range(len(S)):
    a[S[i]].append(S[i:i+K])
tmp = []
for c in 'abcdefghijklmnopqrstuvwxyz':
    for s in sorted(a[c]):
        for i in range(1,len(s)):
            if s[:i] in tmp:
                K += 1
        if len(s) >= K:
            print(s[:K])
            exit()
        else:
            K -= len(s)
            for i in range(1,len(s)+1):
                tmp.append(s[:i])
    

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

typedef long long ll;
using namespace std;

int gcd(int a, int b) {
	if (a%b == 0) return b;
	return gcd(b, a - (a / b)*b);
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, ma, mb;
	cin >> n >> ma >> mb;
	vector<int> a(n), b(n), c(n);
	REP(i, n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	int dp[41][401][401];
	REP(i, n+1)REP(j, 401)REP(k, 401)dp[i][j][k] = INF;

	dp[0][0][0] = 0;
	REP(i, n) {
		REP(j, 10 * n) {
			REP(k,10 * n) {
				if (j<a[i]||k<b[i])dp[i+1][j][k] = dp[i][j][k];
				else dp[i + 1][j][k] = min(dp[i][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
			}
		}
	}
	int ans = INF;
	FOR(i,1,INF){
		if (i*ma > 400 || i*mb > 400)break;
		if (i*ma == 1 && i*mb == 1)continue;
		ans = min(ans, dp[n][i*ma][i*mb]);
	}
	if (ans == INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;

    int w = 0, r = 0;
    for(auto is:s) {
        if(is=='R') r++;
    }

    int ans = n, anstmp;
    for(int in=0;in<n+1;in++) {
        anstmp = max(w, r);
        ans = min(ans, anstmp);
        if(in==n) break;
        if(s[in]=='W') w++;
        else r--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <stdio.h>
#include <set>

using namespace std;

#define ll long long
#define rep(i, n) for (ll i = 1; i < (n+1); i++)



int main()
{
    int N;
    ll n = 0;
    cin >> N;
    rep(i, N) {
        if (i % 3 != 0 && i % 5 != 0) {
            n += i;
        }
    }
    cout << n << endl;
}

Measured memory_bytes: 3156
#include<cstdio>
#include<vector>

using namespace std;

class ExhaustiveSearch
{
public:
	void solve(int n, int A[], int q, int M[])
	{
		for (int i = 0; i < q; i++)
		{
			if (search(n, A, 0, M[i]))
				printf("yes\n");
			else
				printf("no\n");
		}
	}

	bool search(int n, int A[], int i, int m)
	{
		if (m == 0)
			return true;
		else if (i >= n)
			return false;

		return (search(n, A, i + 1, m) || search(n, A, i + 1, m - A[i]));
	}
};

int main()
{
	int n, tmp;
	scanf("%d", &n);
	vector<int> A;
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &tmp);
		A.push_back(tmp);
	}
	int q;
	scanf("%d", &q);
	vector<int> M;
	for (int i = 0; i < q; i++)
	{
		scanf("%d", &tmp);
		M.push_back(tmp);
	}

	auto es = ExhaustiveSearch();
	es.solve(n, A.data(), q, M.data());
}

Measured memory_bytes: 2672
#include<cstdio>
#include<cstring>
using namespace std;
char s[10001];
int main()
{
    gets(s);
    for(int i=0;i<strlen(s);i++)
    {
        printf("%c",s[i]);
        if(i==3)
        printf(" ");
    }
    printf("\n");
    return 0;
}

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

int main(){
  long long int S;
  cin >> S;
  
  double rt = (double)sqrt(S);
  
  int x_1, x_2, x_3, y_1, y_2, y_3;
  x_1 = 0;
  y_1 = 0;
  
  long long int tmp1, tmp2;
  
  tmp1 = ceil(rt);
  tmp2 = floor(rt);
  
  if (S == tmp2 * tmp2) {
    cout << 0 << " " << 0 << " " << tmp2 << " " << 0 << " " << 0 << " " << tmp2 << endl;
  }
  
  else if (S < tmp1 * tmp2) {
    cout << 0 << " " << 0 << " " << tmp1 << " " << 1 << " " << tmp1 * tmp2 - S << " " << tmp2 << endl;
  }
  
  else {
    cout << 0 << " " << 0 << " " << tmp1 << " " << 1 << " " << tmp1 * tmp1 - S << " " << tmp1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(W<x+r||H<y+r||0>x+r||0>y+r||x<0||y<0){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include<cstdio>
#include<algorithm>
using namespace std;
int a[105];
int main(){
	int n,x,i,sum=0;
	scanf("%d%d",&n,&x);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	sort(a,a+n);
	for(i=0;i<n;i++)if(sum+a[i]>x)break;
	else sum+=a[i];
	if(i==n&&sum!=x)i--;
	printf("%d\n",i);
	return 0;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    string s;
    cin >> s;
    if(s[s.size()-1] == 's') s+="es";
    else s+="s";
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main{

	boolean[] right = new boolean[0x100];

	void run(){
		right['y'] = true;
		right['u'] = true;
		right['i'] = true;
		right['o'] = true;
		right['p'] = true;
		right['h'] = true;
		right['j'] = true;
		right['k'] = true;
		right['l'] = true;
		right['n'] = true;
		right['m'] = true;


		Scanner in = new Scanner(System.in);
		for(;;){
			String line = in.nextLine();
			if(line.equals("#")) return ;
			System.out.println(solve(line));
		}
	}

	int solve(String str){
		int ret = 0;
		boolean isRight = right[str.charAt(0)];
		for(int i=1; i<str.length(); i++){
			if(isRight ^ right[str.charAt(i)]){
				ret++;
			}
			isRight = right[str.charAt(i)];
		}
		return ret;
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    cout<<(n%k!=0)<<endl;
    return 0;
}


Measured memory_bytes: 256
symbols = ['S', 'H', 'C', 'D']

n = gets.chomp.to_i

cards = []
n.times do
  cards << gets.chomp
end

symbols.each do |s|
  for i in 1..13 do
    c = "#{s} #{i}"
    puts c  unless cards.include?(c)
  end
end

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

#define ll long long 
#define pb push_back
#define mp make_pair
#define F first
#define S second 
#define pl pair<long ,long >
#define pi pair<int ,int >
#define lb(v,x) lower_bound(v.begin(),v.end(),x)-v.begin()
#define ub(v,x) upper_bound(v.begin(),v.end(),x)-v.begin()
#define ct(i) cout<< i << "\n"
#define sv(v) sort(v.begin(),v.end())
#define mod 1000000007
#define M 100005
#define endl "\n"

void answer(){
	int n,m;
	cin>>n;
	if(n%1000==0){ cout<<0; return; }
	cout<<1000-n%1000;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    int q;
    //cin>>q; while(q--)
        answer();
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a;
    cin >> b;
    string ans;
    if (a == b) {
        string s = to_string(a);
        for (int i = 0; i < a; i++) {
            ans += s;
        }
    }else {
        int min, max;
        if (a < b) {
            min = a;
            max = b;
        }else {
            min = b;
            max = a;
        }
        string s = to_string(min);
        for (int i = 0; i < max; i++) {
            ans += s;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define all(C) C.begin(),C.end()
typedef long long int Long;
typedef long double Double;
const int MAXN = 1e5 + 5;

int main() {
  int n, k;
  cin >> n >> k;

  Long ans = 0;
  if(k == 0) {
    ans = n * 1LL * n;
  } else {
    for(int b = k + 1; b <= n; ++b) {
      ans += (n / b) * 1LL * (b - k);
      ans += max(0, (n % b) - k + 1);
    }
  }

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

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

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

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long N;
	scanf("%lld",&N);
	long long A;
	scanf("%lld",&A);
	long long B;
	scanf("%lld",&B);

	ll sum = N / (A + B) * A;
	sum += min(A, N % (A + B));
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
res = []

for i in range(n):
    city, rate = map(str,input().split())
    rate = int(rate) * -1
    res.append([city,rate,i+1])
res.sort(key=lambda x: (x[0],x[1]))
for i in range(n):
    print(res[i][2])

Measured memory_bytes: 3060
main(){float a,b;for(;~scanf("%f%f",&a,&b);)puts(a<35.5&&b<71?"AAA":a<37.5&&b<77?"AA":a<40&&b<83?"A":a<43&&b<89?"B":a<50&&b<105?"C":a<55&&b<116?"D":a<70&&b<148?"E":"NA");}

Measured memory_bytes: 0
#include <iostream>
#include <map>
using namespace std;
int main(void){
   
   
   long long N, K;
   cin >> N >> K;
   
   map<int, long long> data;
   int a, b;
   for(int i = 0; i < N; i++){
       cin >> a >> b;
       data[a] += b;
   }
   
   for(auto x : data){
       
       auto key = x.first;
       auto value = x.second;
       
       K -= value;
       if(K <= 0){
            cout << key << endl;
            return 0;
       }

   }
    
}


Measured memory_bytes: 4224
//When I wrote this, only God and I understood what I was doing
//Now, God only knows :-)
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ch char
#define vc vector
#define mod 1000000007
int main() {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,k;
    cin>>t>>k;
    ll a[t],dp[t];
    for(int i=0;i<t;i++)
    {
    	cin>>a[i];
		dp[i]=INT_MAX;	
	}

    dp[0]=0;
   for(int i=0;i<t;i++)
   {
   	for(int j=i+1;j<=i+k;j++)
      {  if(j<t)
      	dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
	  }
   }
   cout<<dp[t-1];

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e11;

int main() {
  ll A, B, Q; cin >> A >> B >> Q;
  vector<ll> s;
  s.push_back(-INF);
  for (ll i = 0; i < A; i++) {
    ll a; cin >> a; s.push_back(a);
  }
  s.push_back(INF);
  
  vector<ll> t;
  t.push_back(-INF);
  for (ll i = 0; i < B; i++) {
    ll b; cin >> b; t.push_back(b);
  }
  t.push_back(INF);
  
  for (ll i = 0; i < Q; i++) {
    ll x; cin >> x;
    ll sf = *lower_bound(s.begin(), s.end(), x);
    ll si = *(lower_bound(s.begin(), s.end(), x)-1);
    ll tf = *lower_bound(t.begin(), t.end(), x);
    ll ti = *(lower_bound(t.begin(), t.end(), x)-1);
    
    ll res = max(sf,tf)-x;
    res = min(res, x-min(si,ti));
    res = min(res, 2*sf-ti-x);
    res = min(res, sf+x-2*ti);
    res = min(res, 2*tf-si-x);
    res = min(res, tf+x-2*si);
    cout << res << endl;
  }
}

Measured memory_bytes: 3060
// C++ 14
#include <math.h>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <string>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.00000001
#define fequals(a,b) (fabs((a) - (b)) < EPS)

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (const Vector2 v) const { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (const Vector2 v) const { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (const double k) const { return Vector2(x * k, y * k); }
  Vector2 operator / (const double k) const { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 const v) { return x * v.x + y * v.y; }
  double cross (Vector2 const v) { return x * v.y - y * v.x; }
  
  bool parallel(Vector2 &other) {
    return fequals(fabs(dot(other)), length() * other.length());
  }
  
  bool orthogonal(Vector2 &other) {
    return fequals(0, dot(other));
  }
  
  bool operator < (const Vector2 &v) {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;
double R1, R2;
Vector2 C1, C2;

pair<Vector2, Vector2> crossPoints() {
  Vector2 baseVec = C2 - C1;
  double baseLen = baseVec.length();
  double cos_ = (baseLen*baseLen + R1*R1 - R2*R2) / (2 * baseLen * R1);
  double sin_ = sqrt(1 - cos_*cos_);
  Vector2 a_(cos_ * baseVec.x + -sin_ * baseVec.y, sin_ * baseVec.x + cos_ * baseVec.y);
  Vector2 b_(cos_ * baseVec.x + sin_ * baseVec.y, -sin_ * baseVec.x + cos_ * baseVec.y);
  Vector2 a = C1 + a_ * R1 / baseLen;
  Vector2 b = C1 + b_ * R1 / baseLen;
  if (fabs(a.x) < EPS) a.x = 0.0;
  if (fabs(a.y) < EPS) a.y = 0.0;
  if (fabs(b.x) < EPS) b.x = 0.0;
  if (fabs(b.y) < EPS) b.y = 0.0;
  if (a < b) return make_pair(a, b);
  return make_pair(b, a);
}

void solve() {
  auto points = crossPoints();
  cout << points.first.x << ' ' << points.first.y << ' ';
  cout << points.second.x << ' ' << points.second.y << endl;
}

void input() {
  cin >> C1 >> R1 >> C2 >> R2;
}

int main() {
  cout.precision(15);
  input();
  solve();
}


Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N; cin >> N;
  vec d(N); rep(i, N) cin >> d[i];

  int res = 0;
  rep(i, N) {
    rep(j, N) {
      if(i!=j) res+=d[i]*d[j];
    }
  }

  cout << res/2 << endl;

  return 0;
}

Measured memory_bytes: 256
N, X, Y = map(int, input().split())
ans = [0] * N
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        dist = min(abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
        ans[dist] += 1
for a in ans[1:]:
    print(a)


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

int main()
{
  int work[3];
  cin >> work[0] >> work[1] >> work[2];

  sort(work,work+3);

  int res = 0;
  if(work[1]-work[0] >= 0) res += work[1]-work[0];
  else res -= work[1] - work[0];

  if(work[2]-work[1] >= 0) res += work[2]-work[1];
  else res -= work[2] - work[1];

  cout << res << endl;

}


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

int ss(string s, int len){
	if(len<2){
		return 0;		
	}else if(len%2){
		s.pop_back();
		return ss(s, len-1);
	}else{
		string s1,s2;
		s1 = s.substr(0, len/2);
		s2 = s.substr(len/2, len/2);
		if(s1==s2){
			return len;
		}else{
			s.pop_back();
			return ss(s, len-1);
		}
	}
}

int main(){
	string s;

	getline(cin, s, '\n');
	s.pop_back();
	printf("%d\n", ss(s, s.length()));

}

Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    ll pre[n + 5] = {};
    ll mx = 0;
    f1(n){
        ll add;
        cin >> add;
        pre[i] = pre[i - 1] + add;
        if(i >= k){
            mx = max(mx,pre[i] - pre[i - k]);
        }
    }
    mx += k;
    cout << fixed << setprecision(10) <<(double)mx/(2.0)<<'\n';
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007


int main() {
	int n,m,ans;
	cin>>n>>m;
	if(abs(n-m)>1){
		cout << 0;
		return 0;
	}
	long long P[100010];
	P[0]=1;
	for(long long i=1;i<100009;i++){
		P[i]=P[i-1]*(i+1)%M;
	}
	ans=P[n-1]*P[m-1]%M;
	cout << (n==m? 2*ans%M:ans%M);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int mod=1e9+7;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
const int N=205,M=61;
int n;
LL a[N];
char s[N];
LL x[M];
LL gao(LL a){
	Fod(i,60,0)
		if (a>>i&1LL)
			a^=x[i];
	return a;
}
void Ins(LL a){
	Fod(i,60,0)
		if (a>>i&1LL){
			if (x[i])
				a^=x[i];
			else {
				x[i]=a;
				break;
			}
		}
}
void Solve(){
	n=read();
	For(i,1,n)
		a[i]=read();
	clr(x);
	cin>>(s+1);
	Fod(i,n,1){
		if (s[i]=='1'){
			if (gao(a[i])){
				puts("1");
				return;
			}
		}
		else
			Ins(a[i]);
	}
	puts("0");
}
int main(){
	int T=read();
	while (T--)
		Solve();
	return 0;
}


Measured memory_bytes: 3552
// AtCoder
// ABC 171 B - Mix Juice

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <random>
#include <vector>
#include <chrono>

using namespace std;
//using namespace std::chrono;

int main()
{
	//steady_clock::time_point start = steady_clock::now();
	int N,  K;

	cin >> N >> K;
	int p[N];
	for (int i=0; i<N; i++) {
		cin >> p[i];
	}
	
	// 計算
	sort(p, p+N);
	int minprice = 0;
	for (int i = 0; i<K; i++) {
		minprice += p[i];
	}
	cout << minprice << endl;
	//計算時間集計
	/*
	steady_clock::time_point end = steady_clock::now();
    steady_clock::duration d = end - start;
	cout << "計算時間は" << duration_cast<milliseconds>(d).count() << "ミリ秒です。\n";
	*/
}

Measured memory_bytes: 3596
from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque

setrecursionlimit(1000000)

#dp[x][y] 最終日にyを選択した際のx日目までの最大の幸福度
def main():
	n = int(input())
	abc = [list(map(int, input().split())) for i in range(n)]
	dp = [[0,0,0]]
	for i in range(1,n+1):
		temp = []
		temp.append(max(dp[i-1][1], dp[i-1][2]) + abc[i-1][0])
		temp.append(max(dp[i-1][0], dp[i-1][2]) + abc[i-1][1])
		temp.append(max(dp[i-1][1], dp[i-1][0]) + abc[i-1][2])
		dp.append(temp)
	print(max(dp[-1]))

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	#競プロ用のQueue
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)

class Stack():
	#怯プロ用のStack
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)

main()

Measured memory_bytes: 73428
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll b,c,d,e,k,l,m,n,o=0,p,q,x,y,z,max1=0,ans;
    string s,t,u;
    
    cin>>n;
    ll a[n];
    for (ll i=0; i<n; i++) {
        cin>>a[i];
        if(max1<=a[i]){
            o++;
            max1=a[i];
        }
    }
    cout<<o<<endl;
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()


int main(){
  real1024 a,b;
  cin >> a >> b;
  cout << (bint)(a*b) << endl;
}


Measured memory_bytes: 3908
#include <stdio.h>
#include <math.h>
 
int main(int argc, const char * argv[]) {
    double x1=0.0,x2=0.0,y1=0.0,y2=0.0;
    double x=0.0,y=0.0,z=0.0;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    x = x2-x1;
    y = y2-y1;
    z = x*x + y*y;
    z = sqrt(z);
     
    printf("%.8f\n",z);
    return 0;
}

Measured memory_bytes: 656
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int a;
int main(){
  cin >> a;
  cout << "Christmas";
  for(int i=0;i<25-a;i++)cout << " Eve";
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>  
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
string s;
ll* red=new ll[4001]();
ll* gre=new ll[4001]();
ll* blu=new ll[4001]();
void ltor(char a,ll n)
{
    ll cur=0;
    for(ll i=0;i<n;++i)
    {
        if(s[i]==a)
        {
            ++cur;
        }
            if(a=='R')
            {
                red[i]=cur;
            }
            else if(a=='G')
            {
                gre[i]=cur;
            }
            else
            {
                blu[i]=cur;
            }
    }
}
int main()
{
    ll n;
    cin>>n;
    cin>>s;
    ltor('R',n);
    ltor('G',n);
    ltor('B',n);
    ll ans=0;
    for(ll i=0;i<n;++i)
    {
        ll end=n-1;
        while(end>i+2)
        {
            if((s[i]=='R'&&s[end]=='B')||(s[i]=='B'&&s[end]=='R'))
            {
                ans+=(gre[end]-gre[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='G')
                    {
                        --ans;
                    }
                }
            }
            else if((s[i]=='R'&&s[end]=='G')||(s[i]=='G'&&s[end]=='R'))
            {
                ans+=(blu[end]-blu[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='B')
                    {
                        --ans;
                    }
                }
            }
            else if((s[i]=='G'&&s[end]=='B')||(s[i]=='B'&&s[end]=='G'))
            {
                ans+=(red[end]-red[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='R')
                    {
                        --ans;
                    }
                }
            }
            --end;
        }
    }
    cout<<ans<<endl;
}














Measured memory_bytes: 3724
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}




int N, K;
ll a[210000];

void update() {
  ll tmp[210000];

  Rep(t, N) {
    tmp[t] = 0;
  }

  Rep(i, N) {
    ll y = a[i];
    int left = i - y;
    int right = i + y + 1;

    //cout << i << "\n";
    //cout << left << " " << right << "\n";

    if (left >= 0) {
      tmp[left] += 1;
    } else {
      tmp[0] += 1;
    }
    if (right < N) {
      tmp[right] -= 1;
    }
    //cout << i << "\n";
  }

  ll re = 0;

  Rep(i, N) {
    re += tmp[i];
    a[i] = re;
  }
}


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

  Rep(i, N) cin >> a[i];

  if (K < 100) {
    Rep(q, K) update();

    Rep(i, N) {
      cout << a[i] << ((i + 1 < N) ? ' ' : '\n');
    }
  } else {
    Rep(i, N) {
      cout << N << ((i + 1 < N) ? ' ' : '\n');
    }
  }
}

Measured memory_bytes: 6680
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

bool s(string x){
	
	for(int i = 0; i < x.size(); i++){
		if(x[i] != x[x.size()-i-1]) return false;
	}
	
	return true;
}

signed main(){
	cout<<fixed<<setprecision(10);
	
	string S;
	string a, b;
	bool flag = true;
	
	cin>>S;
	
	int n = S.size();
	
	a = S.substr(0, n/2);
	b = S.substr((n+1)/2, n/2);
	
	// cout<<a<<" "<<b<<endl;
	if(s(S) && s(a) && s(b)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256