akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main{
		
	int[][] paper = new int[10][10];
	
	public void new_paper(){
		for(int x=0;x<10;x++){
			for(int y=0;y<10;y++){
				paper[x][y]=0;
			}
		}
	}
	
	public void drop_small(int x1,int y1){
		paper[x1][y1]++;
		if(y1-1 >= 0)
			paper[x1][y1-1]++;
		if(x1-1 >= 0)
			paper[x1-1][y1]++;
		if(x1+1 < 10)
			paper[x1+1][y1]++;
		if(y1+1 < 10)
			paper[x1][y1+1]++;
	}
	
	public void drop_medium(int x1,int y1){
		drop_small(x1,y1);
		if(x1-1 >= 0 && y1-1 >= 0)
			paper[x1-1][y1-1]++;
		if(x1+1 < 10 && y1-1 >= 0)
			paper[x1+1][y1-1]++;
		if(x1-1 >= 0 && y1+1 < 10)
			paper[x1-1][y1+1]++;
		if(x1+1 < 10 && y1+1 < 10)
			paper[x1+1][y1+1]++;
	}
	
	public void drop_large(int x1,int y1){
		drop_medium(x1,y1);
		if(y1-2 >= 0)
			paper[x1][y1-2]++;
		if(x1-2 >= 0)
			paper[x1-2][y1]++;
		if(x1+2 < 10)
			paper[x1+2][y1]++;
		if(y1+2 < 10)
			paper[x1][y1+2]++;
	}
	
	public void drop_ink(ArrayList<Integer> list){
		int x1,y1,size;
		new_paper();
		
		for(int i=0;i<list.size()/3;i++){
			x1 = list.get(i*3);
			y1 = list.get(i*3+1);
			size = list.get(i*3+2);
			if(size == 1)drop_small(x1,y1);
			else if(size == 2)drop_medium(x1,y1);
			else drop_large(x1,y1);
		}
	}
	
	public void print_paper(){
		int count_zero,max;
		count_zero = 0;
		max = 0;
		
		for(int x=0;x<10;x++){
			for(int y=0;y<10;y++){
				if(max < paper[x][y])
					max = paper[x][y];
			}
		}
		
		for(int x=0;x<10;x++){
			for(int y=0;y<10;y++){
				if(paper[x][y] == 0)
					count_zero++;
			}
		
		}
		System.out.println(count_zero);
		System.out.println(max);
	}
		
	public static void main(String args[]) throws IOException{
		String str;
		ArrayList <Integer> inp = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNext()){
			
			str = scan.next();
			
			String [] strAry = new String[str.length()];
			strAry = str.split(",");
			for(int j=0;j<strAry.length;j++){
				Pattern p = Pattern.compile("[0-9]*");
				Matcher m = p.matcher(strAry[j]);
				if(m.find()){
					int x = Integer.valueOf(m.group(0)).intValue();
					inp.add(x);
				}
			}
		}
		
		Main object = new Main();
		object.drop_ink(inp);
		object.print_paper();
	}
}

Measured memory_bytes: 11000
#include <iostream>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N=3e3+5,Mod=1e9+7;
int f[N][N],n,m,a[N],r[N];
int Plus(int &x,int y){ return x=(x+y)%Mod; }
int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n){
		char c=getchar();
		while(c!='0'&&c!='1') c=getchar();
		a[i]=c-'0';
	}
	rep(i,1,n+1) a[i]=a[i]+a[i-1],r[i]=i;
	rep(i,1,m){
		int u,v;
		scanf("%d%d",&u,&v);
		r[u]=max(v,r[u]);
	}
	f[1][a[r[1]]]=1;
	rep(i,1,n) r[i]=max(r[i],r[i-1]);
	rep(i,1,n) rep(j,0,a[n]) if(f[i][j]){
		int L=r[i]+1,R=r[i+1],x=L-i-j,y=j;//x->0 y->1
		if(x) Plus(f[i+1][j+a[R]-a[L-1]],f[i][j]);
		if(y) Plus(f[i+1][j-1+a[R]-a[L-1]],f[i][j]);
	}
	printf("%d",f[n+1][0]%Mod);
	return 0;
}

Measured memory_bytes: 33920
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}/*swap 交換*/
ll max2(ll a,ll b){return a>=b?a:b;}/*2つのうち大きい数を返す*/ 
ll min2(ll a,ll b){return a>=b?b:a;}/*2つのうち小さい数を返す*/ 
ll ABS(ll a){return a>=0?a:(-a);}/*絶対値*/ 
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

/*  ll t=1;
    while(t<n) t*=2;
木の最底辺の大きさを決める*/ 
#define MAX_N (1 << 17)
ll seg[2*MAX_N-1];
void segmake(ll n, ll a[n] ,ll t){
    rep(i,0,t) seg[t-1+i]=i<n?a[i]:0;
    while(t/=2) rep(i,0,t) seg[t+i-1]=seg[2*(t+i)]+seg[2*(t+i)-1]; 
}

ll segsum(ll from, ll to, ll a, ll l, ll r){
    return (l>=from && r<=to) ? seg[a] : (l>to || r<from) ? 0 : segsum(from,to,2*a+1,l,(l+r)/2)+segsum(from,to,2*a+2,(l+r)/2+1,r);
}

void segupdate(ll a, ll b, ll t){
    ll c=t-1+a;
    seg[c]+=b;
    while(c>0){
        c--; c/=2;
        seg[c]=seg[2*(c+1)]+seg[2*(c+1)-1];
    }
}

int main(void){
    ll n,q;
    scanf("%lld%lld",&n,&q);
    ll b[n],query[q],t=1,x[q],y[q];
    while(t<n) t*=2;
    rep(i,0,n) b[i]=0;
    segmake(n,b,t);
    rep(i,0,q) scanf("%lld%lld%lld",&query[i],&x[i],&y[i]);
    rep(i,0,q){
        if(query[i]==0){
            segupdate(x[i]-1,y[i],t);
        }else{
            printf("%lld\n",segsum(x[i]-1,y[i]-1,0,0,t-1) );
        }
    }
    return 0;
}



Measured memory_bytes: 6976
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

#define PT pair<ll,ll>

unordered_map<ll, ll> MP;
//map<ll, ll> MP;
priority_queue<PT> PQ;

void keisan(ll n, ll k) {
	if (k > MP[n]) {
		MP[n] = k;
		PQ.push(mp(k, n));
	}
}

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


	int T;
	cin >> T;

	rep(t, T) {
		ll N, A, B, C, D;
		cin >> N >> A >> B >> C >> D;

		MP.clear();
		PQ = priority_queue<PT>();
		MP[N] = 1e18;
		PQ.push(mp(ll(1e18), N));

		while (PQ.size()) {
			auto p = PQ.top();
			PQ.pop();

			ll n = p.second;
			ll k = p.first;

			if (MP[n] != k) continue;
			if (n == 1) break;

			if (n > 1 && k - __int128(n - 1) * D >= 0) {
				ll tmp = k - (n - 1) * D;
				if (tmp > MP[1]) {
					MP[1] = tmp;
				}
			}

			ll k2 = k - A;
			keisan(n / 2, k2 - D * (n % 2));
			if (n % 2) {
				keisan(n / 2 + 1, k2 - D * (n % 2));
			}

			k2 = k - B;
			int r = n % 3;
			keisan(n / 3, k2 - D * r);
			if (r) {
				keisan(n / 3 + 1, k2 - D * (3 - r));
			}

			k2 = k - C;
			r = n % 5;
			keisan(n / 5, k2 - D * r);
			if (r) {
				keisan(n / 5 + 1, k2 - D * (5 - r));
			}

		}
		co(ll(1e18) - MP[1] + D);
	}

	Would you please return 0;
}

Measured memory_bytes: 4160
#include<bits/stdc++.h>
using namespace std;
long long countOfSubarrays(vector<int>&arr)
{	
	int n = arr.size();
	
vector<vector<int>>dp(n,vector<int>(20));
vector<int>maxRange(n,n);
for(int bit=0;bit<20;bit++)
{
	int lastIdx = n;
	for(int i = n-1;i>=0;i--)
	{
			if((arr[i]>>bit)&1)
			{
				dp[i][bit] = lastIdx;
				lastIdx = i;
}
else{
	if(i==n-1) dp[i][bit] = n;
	else{
		dp[i][bit] = dp[i+1][bit];
}
}
maxRange[i] = min(maxRange[i] , dp[i][bit]);
}
}

long long reqCnt = 0;
for(int i=0;i<n;i++)
{
	reqCnt+=maxRange[i] - i;
}
return reqCnt;
}

void solve()
{
	int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++)
	cin>>arr[i];
	long long ans = countOfSubarrays(arr);
	cout<<ans<<endl;
	
}
int main()
{
	solve();
}



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

int main(){
   int x, y, z;
   cin >> x >> y >> z;
   cout << z << " " << x << " " <<  y;

   return 0;  
}

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

using namespace std;
typedef long long ll;

ll N,W;
ll w[101];
ll v[101];
ll dp[101][100001];

int main(){
    cin >> N >> W;
    for(int i=0;i<N;i++) cin >> w[i] >> v[i];
    for(int i=0;i<=N;i++) dp[i][0] = 0;
    for(int i=0;i<=W;i++) dp[0][i] = 0;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=W;j++){
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            if(j - w[i-1] >= 0){
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]] + v[i-1]);
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 79104
n = int(input())
a = list(map(int, input().split()))
ans = 1
flag = True
if 0 in a:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            flag = False
            print(-1)
            break
    if flag:
        print(ans)

Measured memory_bytes: 21496
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 200005

using namespace std;

int A[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int a;
		scanf("%d",&a);
		int to;
		if(i%2==(n-1)%2)
		{
			to=i+(n-i-1)/2;
		}
		else
		{
			to=(n-i)/2-1;
		}
		A[n-to-1]=a;
	}
	for(int i=0;i<n;i++)
	{
		if(i!=0) printf(" ");
		printf("%d",A[i]);
	}puts("");
	return 0;
}


Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (true) {
            int n = Integer.parseInt(scan.next());
            int x = Integer.parseInt(scan.next());
            if (n == 0 && x == 0) {
                break;
            }
            int count = 0;
            for (int i = 1; i <= n; i++) {
                for (int j = i + 1; j <= n; j++) {
                    for (int k = j + 1; k <= n; k++) {
                        if (i + j + k == x) {
                            count++;
                        }
                    }
                }
            }
            System.out.println(count);
        }
        scan.close();
    }

}



Measured memory_bytes: 26356
#include<bits/stdc++.h>
#define v(i,s,n) for(int i=s;i<n;i++)
#define z while(1)
using namespace std;int n,t[100][100],h[5100][8],w,dp[100][5100],a;void Nh(int n){w=0;int c[7]={0},i;z{c[0]++,i=0;z{if(c[i]==n){if(i==n-1)goto op;c[i+1]++,c[i]=0;}else break;i++;}bool ok=1;v(f,0,n-1)v(g,f+1,n)if(c[f]==c[g])ok=0;if(ok){v(k,0,n)h[w][k]=c[k];w++;}}op:;return;}int main(){cin>>n;v(i,0,n)v(j,0,n)t[i][j]=0;v(i,0,n){cin>>a;v(j,max(0,i-a),min(a+i+1,n))t[i][j]=1;}v(i,0,n){cin>>a;v(j,0,n)t[i][j]*=a;}Nh(min(n,7));v(i,0,n)v(j,0,w)dp[i][j]=0;int ns=0;v(i,0,w){int nt=0;v(f,0,min(n,7))v(g,0,min(n,7))if(h[i][f]>h[i][g])nt+=t[g][f];dp[6][i]=nt,ns=max(ns,nt);}v(r,7,n)v(i,0,w)v(j,0,8){int nt=0,c[7];v(k,0,7){c[k]=h[i][k];if(h[i][k]<j)nt+=t[r-7+k][r];else nt+=t[r][r-7+k],c[k]++;if(k>0){if(h[i][k]>h[i][0])c[k]--;c[k-1]=c[k];}}c[6]=j;if(h[i][0]<j)c[6]--;int l=0,ri=w,m;z{if(l>=ri-1)break;m=(l+ri)/2;int s=0,q=6;v(k,0,7){if(h[m][q]<c[q]){s=1;break;}if(h[m][q]>c[q]){s=-1;break;}q--;}if(s==0)break;if(s==1)l=m;else ri=m;}dp[r][m]=max(dp[r][m],dp[r-1][i]+nt);}v(i,0,w)ns=max(ns,dp[n-1][i]);cout<<ns<<endl;return 0;}

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

int main(){

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int x = int.Parse(input[0]);

		int k = 360;
		int a = k, b = x;
		while(a%b!=0)
		{
			int tmp = b;
			b = a % b;
			a = tmp;
		}
		int kMax = k * x / b;

		Console.WriteLine(kMax/x);
	}
}



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

void poem_term_counter(int poem_term, int &five_count, int &seven_count){
	if (poem_term == 5){
		five_count++;
	}else if(poem_term == 7){
		seven_count++;
	}
}

int main() {
	int A, B, C;
	int five_count = 0;
	int seven_count = 0;
	cin >> A >> B >> C;

	poem_term_counter(A, five_count, seven_count);
	poem_term_counter(B, five_count, seven_count);
	poem_term_counter(C, five_count, seven_count);

	if (five_count == 2 && seven_count == 1){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}


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

int main(){
    int a[6];
    int x = 0,b = 0,c = 0,d = 0;
    for(int i = 0; i < 6; i++){
        cin >> a[i];
        if(a[i] == 1){
            x++;
        }else if (a[i] == 2){
            b++;
        }else if(a[i] == 3){
            c++;
        }else if(a[i] == 4){
            d++;
        }
    }
    if(x>2||b>2||c>2||d>2){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}

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

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif

namespace std {
template<class S, class T>
ostream &operator <<(ostream& out, const pair<S, T>& a) {
	out << '(' << a.fi << ", " << a.se << ')';
	return out;
}
}


typedef string::const_iterator State;

bool atom(State& it, int mask);
bool term(State& it, int mask);
bool formula(State& it, int mask);

bool atom(State& it, int mask) {
	auto c = *it;
	it++;
	if (c == '0') return false;
	if (c == '1') return true;
	assert(c >= 'a' && c <= 'd');
	return mask & (1 << (c - 'a'));
}

bool term(State& it, int mask) {
	bool ret = formula(it, mask);
	auto c = *it;
	it++;
	if (c == '*') return ret & formula(it, mask);
	if (c == '^') return ret ^ formula(it, mask);
	assert(false);
}
bool formula(State& it, int mask) {
	if (((*it) >= 'a' && (*it) <= 'd') || *it == '0' || *it == '1') {
		return atom(it, mask);
	}
	auto c = *it;
	it++;
	if (c == '-') return !formula(it, mask);
	if (c == '(') {
		bool tmp = term(it, mask);
		it++;
		return tmp;
	}
	assert(false);
}


int main() {
	string s;
	vi ans((1 << 16) + 10, 1e9);
	auto calc = [](const string & t) {
		int ret = 0;
		rep(mask, (1 << 4)) {
			auto it = t.begin();
			if (formula(it, mask)) ret |= (1 << mask);
		}
		return ret;
	};
	{
		set<string> used[20];
		queue<string> q;
		vector<char> atoms = {'a', 'b', 'c', 'd', '0', '1'};
		vector<char> opes = {'*', '^'};
		for (auto& c : atoms) {
			q.push(string(1, c));
			used[1].insert(string(1, c));
		}
		while (!q.empty()) {
			string s = q.front(); q.pop();
			int bits = calc(s);
			ans[bits] = min(ans[bits], (int)s.size());
			if (s[0] != '-' && s.size() < 16) {
				q.push("-" + s);
				used[s.size() + 1].insert("-" + s);
			}
			for (auto ope : opes) {
				for (int i = 1; i + s.size() < 16; i++) {
					for (auto a : used[i]) {
						string nxt;
						nxt = ("(" + s + ope) + a + ")";
						if (nxt.size() <= 16 && used[nxt.size()].count(nxt) == 0) {
							q.push(nxt);
							used[nxt.size()].insert(nxt);
						}
						nxt = ("(" + s + ope) + "-" + a + ")";
						if (nxt.size() <= 16 && used[nxt.size()].count(nxt) == 0) {
							q.push(nxt);
							used[nxt.size()].insert(nxt);
						}
					}
				}
			}
		}
	}
	while (cin >> s) {
		if (s == ".") break;
		assert(s.size() >= ans[calc(s)]);
		cout << ans[calc(s)] << endl;
	}
	return 0;
}

Measured memory_bytes: 254444
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,t[110],v[110];
double dp[20010][310];

int main(){
	cin >> n;
	REP(i,0,n) cin >> t[i];
	REP(i,0,n) t[i+1]+=t[i];
	REP(i,0,n) cin >> v[i]; 
	
	int c=0, s[20010];
	REP(i,0,t[n]){
		if(t[c]==i) c++;
		s[i]=v[c];
	}
	
	REP(i,0,t[n]) REP(j,0,310) dp[i][j]=-(double)INF;
	dp[0][0]=0;
	REP(i,0,t[n]){
		REP(j,0,310){
			if(dp[i][j]==-(double)INF) continue;
			REP(k,-1,2){
				if(j+k>s[i+1] or j+k<0) continue;
				if(k==1 and j==s[i]) continue;
				dp[i+1][j+k]=max(dp[i+1][j+k], dp[i][j]+j+k*0.5);
			}
			if(s[i]>j and s[i+1]>=j) dp[i+1][j]=max(dp[i+1][j], dp[i][j]+0.25+j);
		}
	}
	
	cout << fixed << setprecision(9);
	cout << dp[t[n]][0] << endl;
	return 0;
}



Measured memory_bytes: 48768
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

std::size_t distance(boost::dynamic_bitset<>const& bit, std::size_t s, std::size_t g)
{
	std::size_t min = std::numeric_limits<std::size_t>::max();
	std::size_t last = s;
	for (auto i : boost::irange(s, g + 1))
	{
		if (bit[i])
		{
			if (bit[last])
			{
				auto d = i - last - 1;
				min = std::min(min, d);
			}
			last = i;
		}
	}
	return min;
}

bool run(std::size_t N, std::size_t A, std::size_t B, std::size_t C, std::size_t D, boost::dynamic_bitset<> bit)
{
	if (C < D)
	{
		if (std::min(distance(bit, A, C), distance(bit, B, D)) == 0)
		{
			return false;
		}
	}
	else//D < C
	{
		for (auto i : boost::irange(B, D + 1))
		{
			if (!bit[i - 1] && !bit[i] && !bit[i + 1])
			{
				bit[i] = true;
				B = i;
				break;
			}
		}
		if (!bit[B])
		{
			return false;
		}
		if (distance(bit, A, C) == 0)
		{
			return false;
		}
	}
	return true;
}

void Main()
{
	std::size_t N, A, B, C, D;
	std::cin >> N >> A >> B >> C >> D;
	boost::dynamic_bitset<> bit(N);
	std::string str;
	std::cin >> str;
	for (auto i : boost::irange<std::size_t>(0, N))
	{
		bit[i] = str[i] == '#';
	}
	--A; --B; --C; --D;
	if (run(N, A, B, C, D, std::move(bit)))
	{
		std::cout << "Yes" << std::endl;
	}
	else
	{
		std::cout << "No" << std::endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 592
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

vvi G;

int dfs(int pos, int par) {
	int ret = 0;
	if (pos != 0 && G[pos].size() == 1) {
		// 葉
		return 0;
	}
	rep(i, G[pos].size()) {
		if (G[pos][i] == par)continue;
		ret ^= dfs(G[pos][i], pos) + 1;
	}
	return ret;
}

int main() {
	int N;
	cin >> N;
	G = vvi(N);
	rep(i, N - 1) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}

	if (dfs(0, -1) == 0) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Alice" << endl;
	}

	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
#define rep(i, n) for(ll (i)=0;(i)<(n);(i)++)
void cm(ll &a,ll b){if(a>b)a=b;}

int main(void){
  ll n,s,k,v;cin>>n;vl x(n),y(n),p(n),a(n+1,1LL<<60);vector<vl>X(n),Y(n);
  rep(i,n)cin>>x[i]>>y[i]>>p[i];
  rep(i,n){
    X[i]=vl(1<<n,abs(x[i])),Y[i]=vl(1<<n,abs(y[i]));
    rep(b,1<<n)rep(j,n)if(b&1<<j)cm(X[i][b],abs(x[i]-x[j])),cm(Y[i][b],abs(y[i]-y[j]));
  }
    
  rep(b,1<<n){
    s=b;
    do{
      k=__builtin_popcountl(b),v=0;
	  rep(i,n)v+=p[i]*min(X[i][s],Y[i][b&~s]);
      cm(a[k],v),s=(s-1)&b;
    }while (s!=b);
  }
    rep(i,n+1)cout<<a[i]<<endl;
    return 0;
}

Measured memory_bytes: 11104
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

long long int saiki ( int N , int M , int O )
{
	if( N == 1 )
	{
		return M > O&&M<=9;
	}

	long long int ans = 0;
	for( int i = O + 1; i <= min ( 9 , M ); i++ )
	{
		ans += saiki ( N - 1 , M - i , i );
	}
	return ans;
}

int main ()
{
	int N , M;
	while( cin >> N >> M , N || M )
	{
		cout << saiki ( N , M , -1 ) << endl;
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define REPZ(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12
#define MOD 1000000007    //合同式の法

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 setprecision()
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
using namespace std;
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int a,b; cin >> a >> b;
  REPZ(i,1,10000){
    if(i*8/100==a and i/10==b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			String[] ab = s.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int c = x[a];
			x[a] = x[b];
			x[b] = c;
		}
		for (int i = 0; i < x.length; i++) {
			System.out.println(x[i]);
		}
	}
}

Measured memory_bytes: 26200
import sys
from io import StringIO
import unittest

def resolve():

    hp_max = (10**4)*3

    dp=[-1]*hp_max
    dp[0]=0

    h,n = list(map(int,input().split()))
    a=[0]*n #damage
    b=[0]*n #syouhi

    for i in range(n):
        a[i],b[i]=list(map(int,input().split()))

    for hp in range((10**4)*2):
        if dp[hp]==-1:
            continue
        for i in range(n):
            nhp = hp+a[i]
            cost = dp[hp]+b[i]
            if dp[nhp]==-1:
                dp[nhp]=cost
            elif cost <= dp[nhp]:
                dp[nhp]=cost

    min_cost=0

    for hp in range(h,hp_max):
        if dp[hp]==-1:
            continue

        cost = dp[hp]

        if min_cost == 0:
            min_cost = cost
        elif cost<min_cost:
            min_cost = cost
    
    print(min_cost)

    return

resolve()

Measured memory_bytes: 54508
#include <bits/stdc++.h>
using namespace std;
#define int long long

int x[105];

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m = LLONG_MAX;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> x[i];
	for (int i = 1; i <= 100; i++) {
		int s = 0;
		for (int j = 1; j <= n; j++) s += (i - x[j]) * (i - x[j]);
		m = min(m, s);
	}
	cout << m << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int n,m,q;
vector<vector<vector<int>>> rv(10);

int A[10];
int score=0;
int search(int k, int s){
  for(auto& r:rv[k-1]){
    if(A[r[1]]-A[r[0]]==r[2]) score+=r[3];
  }
  if(k==n) return score;
  int ans=0;
  int _score=score;
  rep_range(i,s,m){
    A[k]=i;
    score=_score;
    chmax(ans,search(k+1, i));
  }
  return ans;
}

int app() {
  cin>>n>>m>>q;

  rep(i,q){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a--;b--;
    rv[b].push_back({a,b,c,d});
  }

  return search(0,0);
}

int main(){cout<<app()<<endl;return 0;}


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

int main(){
  string s,t; cin>>s>>t;
  int ans=t.size();
  
  for (int i=0; i<s.size()-t.size()+1; i++){
    string ss=s.substr(i,t.size());
    int t_ans=0;
    for (int j=0; j<t.size(); j++){
      if (ss[j]!=t[j]) t_ans+=1;
    }
    ans=min(ans,t_ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>

using namespace std;
typedef pair<int, int> P;

int N, H;
vector<P> dmg;

int main(void)
{
	cin >> N >> H;
	int a, b;
	for(int i = 0; i < N; i++){
		cin >> a >> b;
		dmg.push_back( make_pair(a, 0) );
		dmg.push_back( make_pair(b, 1) );
	}
	sort(dmg.begin(), dmg.end());
	reverse(dmg.begin(), dmg.end());
	
	int ans = 0;
	for(int i = 0; i < dmg.size(); i++){
		if(dmg[i].second == 1){
			ans++;
			H -= dmg[i].first;
		}
		else{
			ans += (H + dmg[i].first-1) / dmg[i].first;
			H = 0;
		}
		if(H <= 0) break;
	}
	
	cout << ans << endl;
	return 0;
}

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

int a , b , c , d , s1 , s2 ;

int main() {
	scanf("%d %d %d %d" , &a , &b , &c , &d) ;
	s1 = a + b ; s2 = c + d ;

	if (s1 > s2) printf("Left\n") ;
	else if (s1 < s2) printf("Right\n") ;
	else printf("Balanced\n") ;

	return 0 ;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>x;
        for(int j=0;j<x;j++){
            cin>>ac[i][j];
            aa[ac[i][j]]++;
        }
    }
    y=0;
    for(int i=1;i<=m;i++){
        if(aa[i]==n)y++;
    }
    C y E;
    
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
// #define mp make_pair
#define S second
#define F first
// ll mod=1e9+7 ;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define input_from_file  freopen("input.txt", "r", stdin);
using namespace std::chrono; 

int main(){                fastIO
  // input_from_file
  ll n,w;cin>>n>>w;ll vec[n][2];
  for(int i=0;i<n;i++) cin>>vec[i][0]>>vec[i][1];
  vector<ll> dp(w+1,-1);
  dp[0]=0;
  for(int i=0;i<n;i++){
    for(int j=w;j-vec[i][0]>=0;j--){
      if(j-vec[i][0]!=-1) dp[j]=max(dp[j],dp[j-vec[i][0]]+vec[i][1]);
    }
  }  
  ll ans=0;
  for(int i=0;i<=w;i++) ans=max(ans,dp[i]);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3964
//
//  main.c
//  ITP1_4_D
//
//  Created by ??±??°?????? on 2015/09/29.
//  Copyright ?? 2015??´ HamadaShogo. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>

long long intSum(int *num, int size);
int intMax(int *num, int size);
int intMin(int *num, int size);

int main(int argc, const char * argv[]) {
    int *num;
    int size;
    long long sum;
    int max;
    int min;
    int i;
    
    scanf("%d", &size);
    num = (int *)malloc(sizeof(int) * size);
    if (num == NULL) {
        printf("?????¢???????¢??????§????????????\n");
        exit(1);
    }
    
    for (i=0; i<size; i++) {
        scanf("%d", &num[i]);
    }
    
    sum = intSum(num, size);
    max = intMax(num, size);
    min = intMin(num, size);
    
    printf("%d %d %lld\n", min, max, sum);
    
    free(num);
    
    return 0;
}

long long intSum(int *num, int size){
    int i;
    long long sum = 0;
    
    for(i=0; i<size; i++){
        sum += num[i];
    }
    
    return sum;
}

int intMax(int *num, int size){
    int i;
    int max = num[0];
    
    for (i=0; i<size; i++) {
        if (max < num[i]) {
            max = num[i];
        }
    }
    
    return max;
}

int intMin(int *num, int size){
    int i;
    int min = num[0];
    
    for (i=0; i<size; i++) {
        if (num[i] < min) {
            min = num[i];
        }
    }
    
    return min;
}

Measured memory_bytes: 1064
#include<bits/stdc++.h>
using namespace std;
int n,cnt[62];
string alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int qry(string s){
	cout<<"? "<<s<<endl;
	int v; cin>>v; return v;
}
bool subsequence(string s){
	return (int)s.size()+qry(s)==n;
}
string combine(string a,string b){
	if(!a.size()||!b.size()) return a+b;
	string ret="";
	for(int i=0,j=0,s1=a.size(),s2=b.size();i<s1||j<s2;)
		if(i<s1&&(j==s2||subsequence(a.substr(0,i+1)+b.substr(j)))) ret+=a[i++];
		else ret+=b[j++];
	return ret;
}
string solve(int l,int r){
	if(l==r) return string(cnt[l],alphabet[l]);
	int mid=(l+r)>>1;
	return combine(solve(l,mid),solve(mid+1,r));
}
int main()
{
	for(int i=0;i<62;i++) cnt[i]=128-qry(string(128,alphabet[i])),n+=cnt[i];
	string ans=solve(0,61);
	cout<<"! "<<ans<<endl;
}

Measured memory_bytes: 3784
#define __LOCAL_DEBUG__
#include<bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(x) { cerr << "\033[94m" << __func__ << " " << #x << ": " << (x) << "\n\033[0m"; }
#else
# define _debug(x) {((void) 0);}
#endif
#define rep(i, n) for (int i = (0); i < (n); i++)
#define repp(i, a, b) for (int i = (a); i < (b); i++)
#define CLR(x, v) memset(x, v, sizeof (x))
#define all(x) x.begin(), x.end()
#define SZ(x) (int) x.size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
using ll = signed long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAXN = 700;

const int N = 100005;

// #define __LOCAL_DEBUG__
int n;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    scanf("%d",&n);
    ll res = n / 500 * 1000 + 1ll * n % 500 / 5 * 5;
    printf("%lld\n", res);

    return 0;
}




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

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> g(H);
  for (int i = 0; i < H; i++) {
    cin >> g.at(i);
  }
  int result = 0;

  for (int i = 0; i < (1 << H); i++) {
    for (int j = 0; j < (1 << W); j++) {
      bitset<6> hb(i);
      bitset<6> wb(j);
      int count = 0;
      for (int k = 0; k < H; k++) {
        for (int l = 0; l < W; l++) {
          if ((g.at(k).at(l)) == '#' && (hb[k] == 0) && (wb[l] == 0)) {
            count++;
          }
        }
      }
      if (count == K) result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

LL const MAXN = 2e5 + 5, mod = 1e9 + 7;
LL frac[MAXN], invfrac[MAXN];

LL qpow(LL a, LL k) {
  LL re = 1;
  for (; k; k >>= 1, a = a * a % mod)
    if (k & 1) re = re * a % mod;
  return re;
}
LL C(int n, int m) { return frac[n] * invfrac[m] % mod * invfrac[n - m] % mod; }
LL Solve(int a, int b, int c, int d) { return C(c - a + d - b, c - a); }

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  frac[0] = 1;
  for (RI i = 1; i <= 2e5; ++i) frac[i] = frac[i - 1] * i % mod;
  invfrac[int(2e5)] = qpow(frac[int(2e5)], mod - 2);
  for (RI i = 2e5; i; --i) invfrac[i - 1] = invfrac[i] * i % mod;
  
  int h, w, a, b;
  scanf("%d %d %d %d", &h, &w, &a, &b);
  LL ans = Solve(1, 1, h, w);
  for (RI i = h - a + 1; i <= h; ++i)
    ans = (ans - Solve(1, 1, i, b) * Solve(i, b + 1, h, w) % mod + mod) % mod;
  printf("%lld\n", ans);

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 4352
#include <stdio.h>
int main(void)
{
	int n;
	int a[100];
	int i;
	int max = -1, min = 1001;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] > max) max = a[i];
		if (a[i] < min) min = a[i];
	}
	// printf("max = %d\n", max);
	// printf("min = %d\n", min);
	printf("%d\n", max - min);
	return 0;
}

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

using namespace std;

const int maxN = 8005;

int n, x, y;
vector<int> dx, dy;
char s[maxN];

bool Check(int x, const vector<int> &d) {
    if (x < -n || x > n) return false;
    vector<bool> dp[2];
    for(int i = 0; i < 2; ++i)
        dp[i].assign(2*n+1, false);
    dp[0][n] = true;

    for(int i = 0; i < d.size(); ++i) {
        for(int j = 0; j < 2*n; ++j) {
            if (dp[0][j]) dp[1][j-d[i]] = dp[1][j+d[i]] = true;
        }
        for(int j = 0; j < 2*n; ++j) {
            dp[0][j] = dp[1][j];
            dp[1][j] = false;
        }
    }

    return dp[0][n+x];
}

int main() {
    scanf("%s", s);
    n = strlen(s);
    scanf("%d%d", &x, &y);

    dx.clear(); dy.clear();
    int cur = 0, group = 0;
    for(int i = 0; i <= n; ++i) {
        if (i < n && s[i] == 'F') ++cur;
        else {
            ++group;
            if (group == 1) x -= cur;
            else if (group%2 == 0) dy.push_back(cur);
            else dx.push_back(cur);
            cur = 0;
        }
    }

    bool ans = Check(x, dx) && Check(y, dy);
    puts((ans) ? "Yes" : "No");
}


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

int main()
{
     string str ;
     cin >> str ;
     ll s= 0 ;
     for( ll i =0  ; str[i]; ++i ){
        ll x = str[i] - 48 ;
        s+=x ;
     }
     ll f = 0;
     ll sz = str.size();
     for( ll i = 0 ; i<sz; ++i  ){
         f*=10 ;
         ll x = str[i]-48 ;
         f+=x ;
     }

     if( f%s==0 ){
        cout << "Yes" <<endl;
     }
     else{
        cout <<"No" <<endl;
     }




}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int N,Alice = 0,Bob = 0;
    scanf("%d",&N);
    int a[N];
    for(int i = 0; i < N; i++){
        scanf("%d",&a[i]);
    }
    int str;
    for(int j = 0; j <= N; j++){
        for(int i = 0; i < N - 1; i++){
            str = a[i];
            if(a[i] < a[i + 1]){
                a[i] = a[i + 1];
                a[i + 1] = str;
            }
        }
    }
    /*if(N % 2 == 0){
        for(int i = 0; i < N; i += 2){
            Alice += a[i];
            Bob += a[i + 1];
        }
    } else {
        Alice += a[0];
        for(int i = 1; i < N; i += 2){
            Alice += a[i];
            Bob += a[i + 1];
        }
    }*/
    for(int i = 0; i < N; i++){
        if(i % 2 == 0){
            Alice += a[i];
        } else {
            Bob += a[i];
        }
    }
    int ans = Alice - Bob;
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1704
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<string,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
map<string,int> mp;
int dp[5005][5005];
int main(){
int n;
cin>>n;
vector<ll> a(n);
ll ans=0;
for(int i=0;i<n;i++){cin>>a[i];}
bool check=true;
if(a[0]!=0)check=false;
for(int i=1;i<n;i++){
    if(a[i]>a[i-1]){
        if(a[i]-a[i-1]!=1)check=false;
    }
    else ans+=a[i-1];
}
ans+=a[n-1];
if(!check)cout<<-1<<endl;
else{
    cout<<ans<<endl;
}
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto N=in();
	int M=(1<<N);
	
	bitset<18> mask(0);
	int K=in();
	REP(i,K){
		mask[in()] = true;
	}
	REP(i,M){
		bitset<18> bs(i);
		if((bs&mask)!=mask) continue;
		cout << i <<":";
		int v=i;
		int n=0;
		while(v){
			if(v&1) cout << ' ' << n;
			v >>= 1;
			n++;
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3196
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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 n;
	cin >> n;
	vector<int> a(n);
	REP(i,n) cin >> a[i];
	
	const ll MOD = 1e9+7;
	int c[3] ={-1,-1,-1};
	ll ans=1;
	REP(i,n){
		int count=0;
		REP(j,3){
			if(a[i]==c[j]+1){
				count++;
			}
		}
		ans = ans*count%MOD;
		REP(j,3){
			if(a[i]==c[j]+1){
				c[j] = a[i];
				break;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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

  std::vector<char> slimes(1, s[0]);
  for(int i=1;i<n;i++){
    if(s[i] != slimes[slimes.size()-1]) slimes.push_back(s[i]);
  }

  cout << slimes.size() << "\n";
  return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int A, B, C, D;
            cin >> A >> B >> C >> D;
                if(A*B > C*D){
                    cout << A*B << endl;
                }else if(A*B < C*D){
                    cout << C*D << endl;
                }else{
                    cout << A*B << endl;
                }
    return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define PI acos(-1)
#define ld long double
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9+7, N = 2e5+5;

int a[N], n, k;
bool check(int m){
	int c = 0;
	for(int i=0;i<n;i++){
		if(a[i]<=m)continue;
		c += (floor)(a[i]-1)/m;
	}
	return (c <= k);
}
void solve(int test_case){
	int i, j;
	int mx = 0;
	cin >> n >> k;
	for(i=0;i<n;i++){
		cin >> a[i];
		mx = max(a[i], mx);
	}
	if(k == 0){
		cout << mx;
		return;
	}
	int l = 0, r = mx;
	while(l+1 < r){
		int mid = (l+r)/2;
		if(check(mid)){
			r = mid;
		}else {
			l = mid;
		}
	}
	cout << r;
	return;
}

signed main(){
	FASTIO;
#define MULTITEST 0
#if MULTITEST
	int ___T;
	cin >> ___T;
	for(int T_CASE = 1; T_CASE <= ___T; T_CASE++)
		solve(T_CASE);
#else
	solve(1);
#endif
	return 0;
}



Measured memory_bytes: 5196
#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
using namespace std;


class Dice {
public:
    int num[6] = { 0,0,0,0,0,0 };
    void setnum(int*);
    void roll(char);
};

void Dice::setnum(int* a) {
    for(int i=0;i<6;i++){
        num[i] = a[i];
    }
}

void Dice::roll(char c) {
    switch
        (c) {
        int tmp;
    case'N':
        tmp = num[0];
        num[0] = num[1];
        num[1] = num[5];
        num[5] = num[4];
        num[4] = tmp;
        break;
    case'S':
        tmp = num[0];
        num[0] = num[4];
        num[4] = num[5];
        num[5] = num[1];
        num[1] = tmp;
        break;
    case'E':
        tmp = num[0];
        num[0] = num[3];
        num[3] = num[5];
        num[5] = num[2];
        num[2] = tmp;
        break;
    case'W':
        tmp = num[0];
        num[0] = num[2];
        num[2] = num[5];
        num[5] = num[3];
        num[3] = tmp;
        break;
    }
}

bool same(Dice dice1, Dice dice2) {
    int flag=1;
    for (int i = 0; i < 6; i++) {
        if (dice1.num[i] != dice2.num[i]) flag = 0;
    }
    if (flag) return true;
    else return false;
}

bool ans_check(Dice dice1, Dice dice2) {
    bool flag=false;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            if (same(dice1, dice2)) {
                flag = true;
                break;
            }
            dice1.roll('N');
        }
        dice1.roll('E');
    }
    dice1.roll('N');
    dice1.roll('W');
    for (int i = 0; i < 4; i++) {
        if (same(dice1, dice2)) {
            flag = true;
            break;
        }
        dice1.roll('N');
    }
    dice1.roll('E');
    dice1.roll('S');
    dice1.roll('S');
    dice1.roll('W');
    for (int i = 0; i < 4; i++) {
        if (same(dice1, dice2)) {
            flag = true;
            break;
        }
        dice1.roll('N');
    }
    if (flag) return true;
    else return false;
}

int main() {
    int dice1[6] = { 0 }, dice2[6] = { 0 }, i;

    for (i = 0; i < 6; i++) {
        int dice_num;
        cin >> dice_num;
        dice1[i] = dice_num;
    }
    for (i = 0; i < 6; i++) {
        int dice_num;
        cin >> dice_num;
        dice2[i] = dice_num;
    }
    Dice d1, d2;
    d1.setnum(dice1);
    d2.setnum(dice2);
    if (ans_check(d1, d2))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String str = scan.nextLine();
    String str2[] = str.split(" ");
    int a = new Integer(str2[0]) + new Integer(str2[1]);
    int b = new Integer(str2[1]) + new Integer(str2[2]);
    int c = new Integer(str2[2]) + new Integer(str2[0]);

    if (a <= b && a <= c){
      System.out.println(a);
    } else if(b <= c && b <= a){
      System.out.println(b);
    } else if(c <= b && c <= a){
      System.out.println(c);
    }


  }
}

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

using namespace std;

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  vector<int> vec(n);
  for (auto &v : vec)
    cin >> v;

  double delta_min = 1e9;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    double tmp = t - vec[i] * 0.006;
    double delta = abs(tmp - a);
    if (delta_min < delta)
      continue;
    delta_min = delta;
    ans = i + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define x first
#define y second
int main(){
  int n,res=0;
  cin>>n;
  auto compb=[](pii a,pii b){return a.x>b.x;};
  priority_queue<pii,vector<pii>,decltype(compb)> blue(compb);
  vector<pii> red(n);
  for(int i=0;i<n;++i)cin>>red[i].x>>red[i].y;
  for(int i=0;i<n;++i){
    pii c;
    cin>>c.x>>c.y;
    blue.push(c);
  }
  while(!blue.empty()){
    pii qb=blue.top();
    blue.pop();
    int index=-1;
    for(int i=0;i<(int)red.size();++i){
      if(red[i].x<qb.x&&red[i].y<qb.y){
        if(index<0)index=i;
        else if(red[index].y<red[i].y)index=i;
      }
    }
    if(index<0)continue;
    res++;
    red[index].x=2*n;
  }
  cout<<res;
  return 0;
}

Measured memory_bytes: 256