akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

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

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> a(3 * N); rep(i, 0, 3 * N) {
		cin >> a[i];
	}
	vector<int> b1(3 * N);
	vector<int> b2(3 * N);
	priority_queue<int, vector<int>, greater<int>> pq1;
	rep(i, 0, N) {
		pq1.emplace(a[i]);
	}
	int sum = accumulate(a.begin(), a.begin() + N, 0LL);
	rep(i, N, 2 * N + 1) {
		b1[i] = sum;
		pq1.push(a[i]);
		sum += a[i];
		sum -= pq1.top(); pq1.pop();
	}
	priority_queue<int> pq2;
	rep(i, 2 * N, 3 * N) {
		pq2.emplace(a[i]);
	}
	sum = accumulate(a.begin() + 2 * N, a.end(), 0LL);
	b2[2 * N] = sum;
	rrep(i, N, 2 * N) {
		pq2.push(a[i]);
		sum += a[i];
		sum -= pq2.top(); pq2.pop();
		b2[i] = sum;
	}
	int maxi = -INF;
	dump(b1, b2);
	rep(i, N, 2 * N + 1) {
		chmax(maxi, b1[i] - b2[i]);
	}
	cout << maxi << endl;
	return 0;
}

Measured memory_bytes: 9588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		final String sf = " ";
		final String s = " ";
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int i = Integer.parseInt(in.readLine());
			if(i == 0){
				break;
			}
			else{
				String[][] is = new String [i][i];
				int[] r = new int[i];
				int[] g = new int[i+1];
				Arrays.fill(r, 0);
				Arrays.fill(g, 0);
				
				for(int x = 0; x < i ;x++){
					String[]  ss = in.readLine().split(s);
					for(int y = 0;y < i;y++){
						int a = Integer.parseInt(ss[y]);
						is[x][y] = ss[y];
						r[x] =r[x] + a;
						g[y] =g[y] + a;
						g[i] =g[i] + a;
					}
				}
				for(int x = 0 ; x < i ; x++){
					for(int y = 0 ; y < i ; y++){
						for(int z = 0; z < 5 - is[x][y].length(); z++){
							System.out.print(sf);
						}
						System.out.print(is[x][y]);
					}
					for(int z = 0; z < 5 - String.valueOf(r[x]).length(); z++){
						System.out.print(sf);
					}
					System.out.print(r[x]);
					System.out.println();
				}
				for(int x = 0 ; x < i+1 ; x++){
					for(int z = 0; z < 5 - String.valueOf(g[x]).length(); z++){
						System.out.print(sf);
					}
					System.out.print(g[x]);
				}
				System.out.println();
			}
			
		}
		

	}

}

Measured memory_bytes: 18932
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int k, x;
    cin >> k >> x;
    int min = x - (k - 1);
    int max = x + (k - 1);
    for(int i = min; i<=max; i++){
        cout << i << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    double x1,y1,x2,y2;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    printf("%.8f\n",(double)sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
    return 0;
}




Measured memory_bytes: 2048
//#include<string.h>
//#include<queue>
//#include<algorithm>
//using namespace std;
//#include<bits/stdc++.h>
//#include<map>
#include<stdio.h>
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
#include<queue>
using namespace std;
map <string,int> st;
queue<string> sd;
string a,aa;
int ar[4]={1,-1,4,-4}; 
void bfs(){
	while(!sd.empty()){
		aa=sd.front();
		sd.pop();
		int fla;
		for(int i=0;i<8;i++){
			if(aa[i]=='0'){
				fla=i;
				break;
			}
		}
		for(int i=0;i<4;i++){
		int x=fla+ar[i];
		if(x>=0&&x<=7&&!(fla==3&&i==0)&&!(fla==4&&i==1)){
			string ss=aa;
		 	swap(ss[fla],ss[x]);
		 	if(st.find(ss)==st.end()){
//		 		cout<<aa<<endl;
				st[ss]=st[aa]+1;
				sd.push(ss);	
			 }
		}	
		}
	} 
}
int main() {
	a="01234567";
	st[a]=0;
	sd.push(a);
	bfs();
//	printf("%d\n",st.size());
	int n;
	int q;
	while(scanf("%d",&q)!=EOF){
		string bb;
		bb+=(q+'0');
		for(int i=1;i<=7;i++){
		scanf("%d",&q);
			bb+=(q+'0');
		}
//		cout<<bb<<endl;
		printf("%d\n",st[bb]);
	}
	return 0;
}













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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
/*----------------------------------------------------------------------*/

const int N = 1001;
vi g[N];
vi res;

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	int n,m,a,b; cin>>n>>m;
	FOR(i, 0, m) {
		cin>>a>>b; a--; b--;
		g[a].push_back(b);
	}

	FOR(i, 0, n) {
		queue<int> q;
		vector<int> dist(n, -1);
		vector<int> p(n, -1);

		q.push(i); dist[i] = 0; bool found = false;
		while(!q.empty() && !found) {
			int curr = q.front(); q.pop();
			for(int nxt : g[curr]) {
				if(dist[nxt] == -1) {
					dist[nxt] = dist[curr] + 1;
					p[nxt] = curr;
					q.push(nxt);
				} else if(nxt == i) {
					vector<int> nodes;
					int c = curr;
					while(c != -1) {
						nodes.push_back(c);
						c = p[c];
					}
					if(res.empty() || nodes.size() < res.size()) {
						res = nodes;
					}
					found = true;
					break;
				}
			}
		}
	}
	if(res.empty()) cout<<-1;
	else {
		cout<<res.size()<<endl;
		FOR(i, 0, res.size()) cout<<res[i] + 1<<endl;
	}
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
typedef long long int ll;


int main(void){
	bool ok = true;
	int N;
	ll res = 1, a, max_value = 1000000000000000000;
	std::cin >> N;
	
	for(int i = 0; i < N; i++){
		std::cin >> a;
		if(a == 0){
			std::cout << 0 << std::endl;
			return 0;
		}
		if(!ok) continue;
		if(res > max_value / a) ok = false;
		res *= a;
	}
	std::cout << (ok ? res : -1) << std::endl;
	return 0;
}
// WA


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();

            long n1 = calc(s[0], s[1], s[2]);
            long n2 = calc(s[0], s[1], s[3]);
            long n3 = calc(s[0], s[1], Lcm(s[2],s[3]));



            WriteLine(
                (s[1] - s[0] + 1) + n3 - n1 - n2
                ) ;
        }

        static long calc(long a, long b, long c)
        {
            long n = b - a + 1;
            long ans = b / c - (a - 1) / c;

            return ans;
        }


        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }

        /*
         * Lcm (Last Common Multiple) 最小公倍数 
         * Gcdライブラリの仕様が前提
        */

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


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,k;
    cin>>n;
    int flag=0;
    for(int i=-120;i<=120;i++){
        for(int j=-120;j<=120;j++)
        {
            ll a=pow(i,5);
            ll b=pow(j,5);
            if((a-b)==n)
            {
                cout<<i<<" "<<j<<endl;
                flag=1;
                break;
            }
        }
        if(flag==1)
            break;
    }
    return 0;
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
bool isprime(long long n){
    if(n==1)return false;
    else{
    for(long long i=2;i*i<=n;i++){
        if(n%i==0) return false;
        else continue;
    }
    return true;
    }
}
int main(){
    ll n;
    cin>>n;
    ll cnt = 0;
    for (ll i = 0; i < n;i++){
        ll t;
        cin >> t;
        if (isprime(t)) cnt++;
 
    }
    cout << cnt << endl;
}


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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)


void func(long long N, long long R){
    long long I = 0;
    if (N >= 10) {
        I = R;
    } else {
        I = R + 100*(10-N);
    }
    cout << I << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long R;
    scanf("%lld",&R);
    func(N, R);
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<cmath>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define INF (3000)
#define MAX 100000
int X, Y, A, B, C;
int main() {
	scanf("%d%d%d%d%d", &X, &Y, &A, &B, &C);
	vector<int> p(A), q(B), r(C);
	rep(i, 0, A)scanf("%d", &p[i]);
	rep(i, 0, B)scanf("%d", &q[i]);
	rep(i, 0, C)scanf("%d", &r[i]);
	sort(all(p), std::greater<int>());
	sort(all(q), std::greater<int>());
	vector<int> d;
	rep(i, 0, X)d.push_back(p[i]);
	rep(i, 0, Y)d.push_back(q[i]);
	for (auto it : r)d.push_back(it);
	sort(all(d), std::greater<int>());
	ll ans = 0;
	rep(i, 0, X + Y)ans += (ll)d[i];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
char s[1000010];int a[1000010];
int main(){
    scanf("%s",s);int n=strlen(s),i,j,sum=0,k;
    for(i=1;i<=n;i++) a[i]=(s[n-i]-'0')*9;
    for(i=1;i<=n;i++){
        a[i+1]+=a[i]/10;a[i]%=10;}
    if(a[n+1]) n++;
    for(i=1;i<=n;i++) sum+=a[i];
    for(k=1;k<=n*10;k++){
        a[1]+=9;sum+=9;j=1;
        while(j<=n){
            if(a[j]<10)break;
            sum-=10;a[j]-=10;
            sum++;a[j+1]++;j++;
            if(j==n&&a[j+1]) n++;}//别忘了有可能加一位
        if(sum<=9*k){//注意这里一定不要写成等于了
            printf("%d\n",k);return 0;}}
	return 0; 
}

Measured memory_bytes: 4608
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
using namespace std;
int _P=1000000007;
long long _gcd(long long a, long long b) {
	a = abs(a);
	b = abs(b);
	if(a>b) {long long tmp = a; a = b; b = tmp;}
	if(b==0) return 0;
	while(b%=a) {
		long long tmp = a;
		a = b;
		b = tmp;
	}
	return a;
}
const int magic = 19260817;
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator() (const pair<T1, T2> &pair) const
	{
		return std::hash<T1>()(pair.first%magic*magic) + std::hash<T2>()(pair.second%magic);
	}
};
template<class T, class P>
void addto(T& x, P& p) {
  	++x[p];
//	if(x.count(p)) ++x[p];
//	else x[p]=1;
}
long long tpp(int n) {
	long long res=1;
	long long p=2;
	while(n>0){
		if(n&1) res=(res*p)%_P;
		n>>=1;
		p = (p*p)%_P;
	}
	return res;
}
int main(){
//	freopen("\\sub1_21.txt", "r", stdin);
	typedef pair<long long, long long> pl;
	int N;
	cin >> N;
	unordered_map<pl, int, pair_hash> pool;
	for(int i=1;i<=N;++i) {
		long long a, b;
		cin >> a >> b;
		pl p;
//		cout << "(a,b) = (" << a << ',' << b << ")\n";
		if(a==0) {
			p.first = 0;
			if(b==0) {
				p.second=0;
				addto(pool, p);
			}
			else {
				p.second = 1;
				addto(pool, p);
			}
			continue;
		}
		if(b==0) {
			p.first = 1;
			p.second = 0;
			addto(pool, p);
			continue;
		}
		long long d = _gcd(a,b);
		if(a<0) {a=-a; b=-b;}
		p.first = a/d;
		p.second = b/d;
		addto(pool, p);
	}
	vector<vector<long long>> stat;
	unordered_set<pl, pair_hash> flag;
	long long reszero=0;
	for(auto& x:pool) {
//		cout << x.first.first << ',' << x.first.second << ','
//				<< x.second << '\n';
		if(x.first.first==0 && x.first.second==0) reszero=x.second;
		else if(flag.count(x.first)) continue;
		else
		{
			pl p;
			if(x.first.second<=0) {
				p.first = -x.first.second;
				p.second = x.first.first;
			}
			else {
				p.first = x.first.second;
				p.second = -x.first.first;
			}
//			cout << "p=" << p.first <<','<< p.second <<'\n';
			flag.insert(p);
			stat.push_back({x.second, pool.count(p)?pool[p]:0});
		}
	}
//	cout << "next" << '\n';
	long long res=1;
	for(auto& x:stat) {
//		cout << x[0] << ',' <<  x[1] << '\n';
		long long tmp = tpp(x[0]);
		if(x[1])
			tmp = (tmp + tpp(x[1])-1) %_P;
		res = (res * tmp) %_P;
//		cout << "res=" << res << '\n';
	}
	cout << (_P+res+reszero-1)%_P << endl;
	return 0;
}

Measured memory_bytes: 35596
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    if(a>=b&&a>=c){
    ans=b+c;
    }
    else if(a>=c&&a>=b){
    ans=c+b;
    }
    else if(b>=c&&b>=a){
    ans=c+a;    
    }
    else if(b>=a&&b>=c){
    ans=a+c;
    }
    else if(c>=a&&c>=b){
    ans=a+b;
    }
    else if(c>=b&&c>=a){
    ans=b+a;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int h, w;
    cin >> h >> w;
    ll ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ll x;  cin >> x;
            ans += x*(i+1)*(h-i)*(j+1)*(w-j);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3124
/*
   THE DARK NIGHT RISES
I LOVE YOU 72 AND WILL FOREVER DO SO
Patience, Persistence, Perseverance, Passion, Purpose
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
const int N = 1e5 + 20 ;
#define F first
#define S second
# define all(v) v.begin(),v.end()          
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mk make_pair
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define sz(x)       (int)x.size()
const long long int mod=1e9 + 7;
const long double EPS=1e-12;
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )
 
const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};


 
int solve()
{
	ll sum = 0 ;
	ll k ;
	cin >> k ;
	for(ll i = 1 ; i <= k ; i++)
		for(ll j = 1 ; j <= k ; j++)
			for(ll m = 1 ; m <= k ; m++)
    			sum += __gcd(i,__gcd(j,m));
    
    cout << sum ;
    return 0 ;
}
int main()
{
    fast;
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
 
    return 0;
}
// Patience, Persistence, Perseverance, Passion, Purpose
// I LOVE YOU 72 AND WILL FOREVER DO SO.

Measured memory_bytes: 3648
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
typedef tuple<int,int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[2][7]={
	{0,1,1,0,-1,-1,0},
	{0,1,1,0,-1,-1,0}
};
int dy[2][7]={
	{1,0,-1,-1,-1,0,0},
	{1,1,0,-1,0,1,0}
};

Def d[220][220][6];
class DIJ{
	public: 
	struct edge{
		Def x,y,cost,t;
	};
	Def lx,ly;
	vvi G;
	DIJ(vvi tG,int x,int y){
		lx=x,ly=y;
		G=tG;
	}
	void dij(Def sx,Def sy,Def gx,Def gy){
		rep(i,220)rep(j,220)rep(k,6)
			d[i][j][k]=inf;

		d[110+sx][110+sy][0]=0;
		priority_queue<tp> q;
		q.push(tp(0,110+sx,110+sy,0));
		while(!q.empty()){
			Def cost,x,y,t;
			tie(cost,x,y,t)=q.top();
			cost*=-1;
			q.pop();
			if(cost>d[x][y][t])continue;
			rep(i,7){
				Def nx=x+dx[x%2][i];
				Def ny=y+dy[x%2][i];
				if(abs(nx-110)>lx||abs(ny-110)>ly)continue;
				if(G[nx][ny])continue;
				Def nt=(t+1)%6;
				Def ncost=cost+(i!=(abs((x-110)*(y-110)*t)%6));
				if(ncost<d[nx][ny][nt]){
					d[nx][ny][nt]=ncost;
					q.push(tp(-ncost,nx,ny,nt));
				}
			}
		}
		int out=inf;
		rep(i,6)out=min(out,d[110+gx][110+gy][i]);
		if(out==inf)out=-1;
		cout<<out<<endl;
	}
	
};

int main(){
	int sx,sy,gx,gy,n;
	cin>>sx>>sy>>gx>>gy>>n;
	vvi G(220,vi(220));
	rep(i,n){
		int a,b;cin>>a>>b;
		G[a+110][b+110]=true;
	}
	int lx,ly;
	cin>>lx>>ly;
	DIJ dij(G,lx,ly);
	dij.dij(sx,sy,gx,gy);
}







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

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == b){
		cout << a + b << endl;
	}
	else if(a > b) {
		cout << a + a - 1 << endl;
	}
	else {
		cout << b + b - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    
    if(a>b){
        for(int i=0;i<a;i++){
            cout<<b;
        }
    }
    else if(b>a){
        for(int i=0;i<b;i++){
            cout<<a;
        }
    }else{
        for(int i=0;i<b;i++){
            cout<<a;
        }
    }
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    int N; cin >> N;
    ll ans = 0;
    map<string, ll> d;
    rep(i, N) {
        string s; cin >> s;
        sort(all(s));
        ans += d[s];
        d[s]++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 11136
n,a,b,c,d=map(int,input().split())
s=input()
ans="Yes"
if c<b:
    for i in range(a-1,c-1):
        if s[i]=="#" and s[i+1]=="#":
            ans="No"
            break
    if ans=="Yes":
        for i in range(b-1,d-1):
            if s[i]=="#" and s[i+1]=="#":
                ans="No"
                break
elif c<d:
    for i in range(a-1,d-1):
        if s[i]=="#" and s[i+1]=="#":
            ans="No"
            break
else:
    cnt=0
    for i in range(a-1,c-1):
        if s[i]=="#" and s[i+1]=="#":
            ans="No"
            break
    if ans=="Yes":
        for i in range(b-2,d+1):
            if s[i]==".":
                cnt+=1
                if cnt==3:
                    break
            else:
                cnt=0
        if cnt!=3:
            ans="No"
print(ans)

Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<algorithm>
#include<map>
#include<set>

using namespace std;

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

int r, D, x;
int ans[10];

int main() {
	cin >> r >> D >> x;
	ans[0] = r*x - D;
	for (int i = 1; i < 10; i++) {
		ans[i] = r*ans[i - 1] - D;
	}
	for (int i = 0; i < 10; i++) {
		cout << ans[i] << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

int main() {
  int A, B, C, K;
  std::cin >> A >> B >> C >> K;

  if (A >= K) {
    std::cout << K << std::endl;
  } else if (A + B >= K) {
    std::cout << A << std::endl;
  } else {
    std::cout << A - (K - A - B) << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		string str = cin.next();
		bool b1 = false, b2 = false;
		for (int i = 0; i < str.Length; i++)
		{
			if (!b1 && str[i] == 'C')
			{
				b1 = true;
			}
			if (b1 && !b2 && str[i] == 'F')
			{
				b2 = true;
				break;
			}
		}
		if (b2)
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 2904
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define _for(i,a,b) for(int i = (a);i<(b);i++)
#define endl  '\n'
#define inf 0x3f3f3f3f
#define ull unsigned long long  
using namespace std;
const int mod=1e9+7;
const int MAX=2e5+7;
int a[MAX];
int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	int n;
 	cin>>n;
 	for(int i=0;i<n-1;i++)
 	{
 		ll x;
 		cin>>x;
 		a[x]++;
 	}
 	for(int i=1;i<=n;i++)
 	cout<<a[i]<<endl;
}

Measured memory_bytes: 4372
#include <iostream>

int main() {
    int a, b, c;
    std::cin >> a >> b >> c;

    if ((a == b and a != c)
            or (b == c and b != a)
            or (c == a and c != b)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    bool sosu_check = true;
    int i = n;
    while( sosu_check )
    {
        for( int j = 2; j <= i; j++ )
        {
            if( i % j == 0 && j < i )
            {
                break;
            }
            else if( i % j == 0 && j == i )
            {
                sosu_check = false;
            }
        }
        i++;
    }
    cout << i-1 << endl;
    return 0;
}



Measured memory_bytes: 256
/// You just can't beat the person who never gives up
/// ICPC next year


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};


// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
int32_t main() {
    fio
    int h,a;
    cin >> h >> a;
    int cnt = 0;
    while(h > 0) {
        h-=a;
        cnt++;
    }
    cout << cnt << endl;


    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;


}






Measured memory_bytes: 3888
class SegTree():
    # init_valは配列の初期値、self.numはn以上の最小のべき乗 O(N)
    def __init__(self,init_val,segfunc,ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n-1).bit_length()
        # self.treeは0～2n-2の配列を使う
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i - 1] = init_val[i]

        for i in range(self.num-2,-1,-1):
            self.tree[i]=self.segfunc(self.tree[2*i+1],self.tree[2*i+2])

    # k番目をxに更新 O(logN)
    def update(self,k,x):
        k += self.num - 1
        self.tree[k]=x
        while k:
            k=(k-1)//2
            self.tree[k]=self.segfunc(self.tree[2*k+1],self.tree[2*k+2])

    # 区間[l,r)でsegfuncした結果を返す O(logN)
    def query(self,l,r):
        res = self.ide_ele

        l += self.num-1
        r += self.num-2
        while r>=l:
            if l & 1 == 0:
                res = self.segfunc(res,self.tree[l])
            if r & 1 == 1:
                res = self.segfunc(res,self.tree[r])
                r -= 1
            l = l // 2
            r = (r-1) // 2
        return res

N=int(input())
h=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]


dp=[0 for _ in range(N+1)]

def segfunc(x,y):
    return max(x,y)

ide_ele=-100

seg=SegTree(dp,segfunc,ide_ele)

for i in range(0,N):
    x=h[i]
    A=seg.query(0,x+1)
    seg.update(x,A+a[i])


print(seg.query(0,N+1))

Measured memory_bytes: 127492
use std::io::*;

fn main() {
    let scan = stdin();
    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();

    let mut n: Vec<i32> = Vec::new();

    for x in vec {
        n.push(x.parse().unwrap());
    }

    let l = n[0] + n[1];
    let r = n[2] + n[3];

    if l > r {
        println!("Left");
    } else if l < r {
        println!("Right");
    } else {
        println!("Balanced");
    }


}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define pp pair<ll, ll>
#define pps pair<ll, string>
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define fi first
#define se second
const ll INF = 1e9;
string s;
ll ct, ans;
int main()
{
    cin >> s;
    rep(i, s.size()) if (s[i] == 'W') ans += i - ct, ++ct;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define fast            ios_base::sync_with_stdio(false)
#define mems(x, y)      memset(x, y, sizeof x)
#define pii             pair < int, int >
#define prec(x)         << fixed << setprecision(x)
#define itf             it->first
#define its             it->second
#define it(x)           it = x.begin(); it != x.end(); it++
#define pq_max(x)       priority_queue < x >
#define pq_min(x)       priority_queue < x, vector < x >, greater < x > >
#define ll              long long
#define nl              << "\n"
#define spc             << " "
#define pb              push_back
#define inf             0x3f3f3f3f
#define PI              3.14159265358979323846
#define E               2.71828182845904523536
#define gamma           0.5772156649
#define EPS             1e-9
#define toint(st, x)    stringstream ss(st); ss >> x
// =======Debug========//
#define watch(x)        cout << (#x) spc << x nl
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};
const int mod=1e9+7;
const int mxn=1e5+9;
int cases = 1;
//ll BigMod(ll n,ll power) {ll ans=1;assert(power>=0);n%=mod;while(power>0){if(power&1) ans=(ans*n)%mod;n=(n*n)%mod;power>>=1;}return ans%mod;}
//ll ModInverse(int n)  { return BigMod(n, mod - 2); }
int sz1, sz2;
int dp[3004][3004];
string st1, st2;
int func(int i, int j)
{
    if(i >= sz1 || j >= sz2)    return 0;
    if(dp[i][j])    return dp[i][j];
    if(st1[i] == st2[j])    return dp[i][j] = 1 + func(i + 1, j + 1);
    else    return dp[i][j] = max(func(i + 1, j), func(i, j + 1));
}
int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    int emni = func(0, 0);
    cin >> st1 >> st2;
    sz1 = st1.size(), sz2 = st2.size();
    for(int i = 1; i <= sz1; i++) {
        for(int j = 1; j <= sz2; j++) {
            if(i == 0 || j == 0)    dp[i][j] = 0;
            else
                dp[i][j] = (st1[i - 1] == st2[j - 1]) ? dp[i - 1][j - 1] + 1 : max(dp[i - 1][j], dp[i][j - 1]);
        }
    }

    string res = "";
//    for(int i = 0; i < sz1; i++)    { for(int j = 0; j < sz2; j++)    cout << dp[i][j] spc; cout nl; }
    int i = sz1, j = sz2;
    while(i > 0 && j > 0) {
        if(st1[i - 1] == st2[j - 1])    res += st1[i - 1], i--, j--;
        else {
            if(dp[i - 1][j] > dp[i][j - 1]) i--;
            else    j--;
        }
    }
    reverse(res.begin(), res.end());
    cout << res nl;
    return 0;
}


Measured memory_bytes: 35456
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<cmath>
#include<cstring>
#include<queue>
using namespace std;
#define MAXN 2000
#define LL long long
#define INF 1000000000
int n,ans;
char s[MAXN+5];
vector<int> G[MAXN+5];
int Min[MAXN+5],Max[MAXN+5],siz[MAXN+5];
LL read(){
   	LL x=0,F=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
   	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*F;
}
void dfs(int x,int fa){
	siz[x]=Min[x]=Max[x]=0;
	for(int i=0;i<G[x].size();i++){
		int nxt=G[x][i];
		if(nxt==fa)continue;
		dfs(nxt,x);
		siz[x]+=siz[nxt];
		Max[nxt]+=siz[nxt];
		Min[nxt]+=siz[nxt];
		if(max(Min[x],Min[nxt])<=min(Max[x],Max[nxt]))
            Min[x]=(Min[x]%2!=Min[nxt]%2);
        else Min[x]=max(Min[x],Min[nxt])-min(Max[x],Max[nxt]);
		Max[x]+=Max[nxt];
	}
	if(s[x]=='1')siz[x]++;
}
int main()
{
	n=read();ans=INF;
	scanf("%s",s+1);
	for(int i=1;i<n;i++){
		int u=read(),v=read();
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=1;i<=n;i++){
		dfs(i,0);
		if(!Min[i])ans=min(ans,Max[i]/2);
	}
	printf("%d\n",ans==INF?-1:ans);
}

Measured memory_bytes: 512
if __name__ == '__main__':
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	k = int(s[2])


	l1 = [a+x for x in range(k) if a+x <= b]
	l2 = [b-x for x in range(k) if b-x >= a]
	nums = set(l1+l2)

	for elm in sorted(nums):
		print(elm)


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

int main() {
    int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
    int h,w;cin>>h>>w;
    string s[h];
    for (int i=0;i<h;i++)
        cin>>s[i];
    int mx=0;
    for (int i=0;i<h;i++)
        for (int j=0;j<w;j++)
            if (s[i][j]=='.') {
                int d[h][w];
                for (int k=0;k<h;k++)
                    for (int l=0;l<w;l++)
                        d[k][l]=-1;
                d[i][j]=0;
                queue<pair<int,int>> q;
                q.push({i,j});
                while (!q.empty()) {
                    auto p=q.front();
                    int y=p.first,x=p.second;
                    q.pop();
                    for (int k=0;k<4;k++) {
                        int ny=y+dy[k],nx=x+dx[k];
                        if (0<=ny&&ny<h&&0<=nx&&nx<w&&s[ny][nx]=='.'&&d[ny][nx]==-1) {
                            d[ny][nx]=d[y][x]+1;
                            mx=max(mx,d[ny][nx]);
                            q.push({ny,nx});
                        }
                    }
                }
            }
            cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = scan.nextInt();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		int op = 0;
		for (int i = 0; i < a.length; i++)
			for (int j = a.length - 1; j > i; j--)
				if (a[j] < a[j - 1]) {
					int tmp = a[j];
					a[j] = a[j - 1];
					a[j - 1] = tmp;
					op++;
				}
		for (int i = 0; i < a.length; i++)
			if (i == 0)
				System.out.print(a[i]);
			else
				System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(op);

	}

}

Measured memory_bytes: 26340
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

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

    cout << N - (K-1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
//int const INF=1001001001;
//ll const INF=1001001001001001001;
ll const MOD=1000000007;

int H,W;
char A[1000][1000];
int I[]={0,-1,0,1};
int J[]={1,0,-1,0};

int main(){
    cin>>H>>W;
    rep(i,H) rep(j,W) cin>>A[i][j];

    queue<P> q;
    rep(i,H) rep(j,W){
        if(A[i][j]=='#') q.push(P(i,j));
    }
    q.push(P(-1,-1));

    int ans=0;
    while(!q.empty()){
        P p=q.front(); q.pop();
        if(p.first==-1 && p.second==-1){
            if(q.empty()) break;
            ans++;
            q.push(P(-1,-1));
        }else{
            rep(k,4){
                int i=p.first+I[k];
                int j=p.second+J[k];
                if(0<=i && i<=H && 0<=j && j<=W && A[i][j]=='.'){
                    A[i][j]='#';
                    q.push(P(i,j));
                }
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 12072
//
//AtCoder Beginner Contest 130
//A - Rounding
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    cout <<  ((x>=a) ? 10 : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int a,b,k;
  cin>>a>>b>>k;
  for(int i=a;i<=b;i++){
    if(i<=a+k-1 || i>=b-k+1){
      cout<<i<<endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
using namespace std;
//using namespace boost::multiprecision;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int n;
  cin>>n;
  if(n == 1){
    cout<<"No"<<endl;
    return 0;
  }
  REPP(i,20){
    if(n == (1<<i)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  if(n%2 == 1){
    cout<<"Yes"<<endl;
    cout<<3<<' '<<n+1<<endl;
    REPP(i,2){
      cout<<i<<' '<<i+1<<endl;
      cout<<n+i<<' '<<n+i+1<<endl;
    }
    for(int i = 4; i<n; i+=2){
      cout<<i<<' '<<i+1<<endl;
      cout<<i+1<<' '<<n+1<<endl;
      cout<<n+1<<' '<<n+i<<endl;
      cout<<n+i<<' '<<n+i+1<<endl;
    }
  }else{
    cout<<"Yes"<<endl;
    cout<<3<<' '<<n+1<<endl;
    REPP(i,2){
      cout<<i<<' '<<i+1<<endl;
      cout<<n+i<<' '<<n+i+1<<endl;
    }
    for(int i = 4; i<n; i+=2){
      cout<<i<<' '<<i+1<<endl;
      cout<<i+1<<' '<<n+1<<endl;
      cout<<n+1<<' '<<n+i<<endl;
      cout<<n+i<<' '<<n+i+1<<endl;
    }
    int msb;
    for(int i = 20; i>=0; i--){
      if((n+1) & (1<<i)){
        msb = i;
        break;
      }
    }
    int a = (1<<msb);
    int b = a^(n + 1);
    cout<<a+n<<' '<<n<<endl;
    cout<<b<<' '<<2*n<<endl;
  }
  return 0; 
}


Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int kotae =0;
        
        kotae = a+b/2;
        
        System.out.println(kotae);
        
        
	}

}


Measured memory_bytes: 23252
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

int A, B, M;
int a[100000];
int b[100000];
int x[100000];
int y[100000];
int c[100000];



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

	cin >> A >> B >> M;
	rep(i, A)cin >> a[i];
	rep(i, B)cin >> b[i];

	rep(i,M) {
		cin >> x[i] >> y[i] >> c[i];
		x[i]--; y[i]--;
	}

	int ans = *min_element(a, a + A) + *min_element(b, b + B);
	rep(i,M) {
		ans = min(ans, a[x[i]] + b[y[i]] - c[i]);
	}
	cout << ans << endl;




	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;

vector<vector<pair<int, int>>> g;
vector<int> c;

void dfs(int v, int w)
{
    c[v] = w;
    for (int i = 0; i < g[v].size(); ++i)
    {
        int nextv = g[v][i].first;
        int nextw = (w + g[v][i].second) % 2;
        if (c[nextv] == -1)
        {
            dfs(nextv, nextw);
        }
    }
    return;
}


int main() {
    

    
    int n;
    cin >> n;
    
    g = vector<vector<pair<int, int>>>(n, vector<pair<int, int>>());
    c = vector<int>(n, -1);
    
    for (int i = 0; i < n - 1; ++i)
    {
        int u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        g[u].push_back(make_pair(v, w));
        g[v].push_back(make_pair(u, w));
    }
    
    dfs(0, 0);
    
    for (int i = 0; i < n; ++i)
    {
        cout << c[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 7424
#include <iostream>
#include <algorithm>
#include <numeric>
#include <utility>
#include <unordered_set>
#include <vector>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main() {
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> li;
  for (int i = 0; i < n; ++i) {
    int c;
    scanf("%d", &c);
    li.push_back(c);
  }
  
  sort(li.begin(), li.end());
  printf("%d\n", li[n/2] - li[n/2-1]);
  
  return 0;
}

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

int solve(int N) {
    int const INF = 10000000;
    vector<int> dp(1<<N, INF);
    
    vector<vector<int>> t(N, vector<int>(N+1));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= N; j++) {
            cin >> t[i][j];
        }
    }
    
    dp[0] = 0;
    vector<int> flags(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (j < i) {
                flags[j] = 1;
            } else {
                flags[j] = 0;
            }
        }
        sort(flags.begin(), flags.end());
        do {
            int crt = 0;
            for (int j = 0; j < N; j++) {
                if (flags[j]) {
                    crt += (1 << j);
                }
            }
            for (int j = 0; j < N; j++) {
                if ((crt & (1 << j)) == 0) {
                    int next = crt + (1 << j);
                    int cost = t[j][0];
                    for (int k = 1; k <= N; k++) {
                        if (crt & (1 << (k-1))) {
                            cost = min(cost, t[j][k]);
                        }
                    }
                    dp[next] = min(dp[next], dp[crt] + cost);
                }
            }
        } while (next_permutation(flags.begin(), flags.end()));
    }
    
    return dp[(1<<N)-1];
}

int main(void) {
    int N;
    while (1) {
        cin >> N;
        if (!N) break;
        cout << solve(N) << endl;
    }
}


Measured memory_bytes: 3324
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i, N) cin >> H.at(i);

    int count = 0;
    rep(i, N) {  // 対象の山
        bool isTallest = true;
        for (int j = 0; j < i; j++) {  // 対象の山の一つ前の山
            if (H.at(i) < H.at(j)) {
                isTallest = false;
            }
        }
        if (isTallest == true) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int n;
	cin >> n;

	vector<ll> a(n + 1);
	for(int i = 1; i <= n; i++)
		cin >> a[i];

	vector<ll> L(n + 5), R(n + 5);
	for(int i = 1; i <= n; i++)
		L[i] = L[i - 1] ^ a[i];
	for(int i = n; i >= 1; i--)
		R[i] = R[i + 1] ^ a[i];

	for(int i = 1; i <= n; i++){
		ll val = L[i - 1] ^ R[i + 1];
		cout << val << " \n"[i == n];
	}

	return 0;
}

Measured memory_bytes: 7908