akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc133/tasks/abc133_f

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }

int n, k;
vector<vector<int>> v;

ll dfs(int now, int from) {
    ll ret = 1;
    ll cnt = (from == -1 ? k - 1 : k - 2);
    for (auto x : v[now]) {
        if (from != x) {
            ret *= dfs(x, now);
            ret %= MOD;
            ret *= (cnt--);
            ret %= MOD;
        }
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    v.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    cout << (dfs(0, -1) * k) % MOD << endl;

    return 0;
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    LL A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if ((V-W)*T >= abs(B-A)) cout << "YES\n";
    else cout << "NO\n";
}


Measured memory_bytes: 3652
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

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

LL f(LL A, LL B){
	if(A==B){
		return 2*(A-1);
	}
	LL low=1,hi=1e9+1;
	while(low+1<hi){
		LL m=(low+hi)/2;
		if(m*m<A*B){
			low=m;
		}
		else{
			hi=m;
		}
	}
	//cerr << A << ", " << B << ": " << low << endl;
	if(low*(low+1)<A*B){
		return 2*low-1;
	}
	return 2*low-2;
}
int main() {
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int a,b;
		cin >> a >> b;
		if(a>b){
			swap(a,b);
		}
		cout << f(a,b) << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 998244353;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, k; cin >> n >> k;
    ll l[k], r[k]; zep(i, 0, k)cin >> l[i] >> r[i];

    ll dp[2 * n + 1]; memset(dp, 0, sizeof(dp));
    ll dp2[2 * n + 1]; memset(dp2, 0, sizeof(dp2));
    dp[1] = 1;

    rep(i, 1, n - 1){
        zep(j, 0, k){
            dp2[i + l[j]] += dp[i]; dp2[i + l[j]] %= MOD;
            dp2[i + r[j] + 1] += MOD - dp[i]; dp2[i + r[j] + 1] %= MOD;
        }

        dp2[i + 1] += dp2[i]; dp2[i + 1] %= MOD;
        dp[i + 1] = dp2[i + 1];
    }

    print(dp[n])

    return 0;
}

Measured memory_bytes: 9852
/*
 * main.c
 *
 *  Created on: 2019/04/13
 *      Author: family
 */


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

int main()
{
    int A, B;
    int result = 0;
    scanf("%d %d", &A, &B);
    if(A > B) {
        result = A + (A - 1);
    } else if (A == B){
        result = A + B;
    } else {
        result = B + (B - 1);
    }
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
 
  string N;
  cin >> N;
  
  if(N.at(0) == '7'|| N.at(1) == '7' || N.at(2) == '7'){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}

Measured memory_bytes: 3628
#include <cstdio>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define MAX 60
#define NIL -1

int toHash(pair<int, int> p) {
	int x = p.first;
	int y = p.second;
	return x + y * 100;
}

int search(int G[MAX][MAX], int H, int W) {
	queue<pair<int, int>> Q;
	unordered_map<int, int> C;

	pair<int, int> s = make_pair(0, 0), g = make_pair(H - 1, W - 1);
	Q.push(s);	C[toHash(s)] = 1;
	
	while (!Q.empty()) {
		int x, y; x = Q.front().first; y = Q.front().second; Q.pop();
		pair<int, int> prev = make_pair(x, y);

		if (x != 0) { 
			pair<int, int> p = make_pair(x - 1, y);
			auto it = C.find(toHash(p));
			if ((it == C.end()) && G[x - 1][y] == 0) {
				Q.push(p); C[toHash(p)] = C[toHash(prev)] + 1;
			}
		}
		if (x + 1 != H) {
			pair<int, int> p = make_pair(x + 1, y);
			auto it = C.find(toHash(p));
			if ((it == C.end()) && G[x + 1][y] == 0) {
				Q.push(p); C[toHash(p)] = C[toHash(prev)] + 1;
			}
		}
		if (y != 0) {
			pair<int, int> p = make_pair(x, y - 1);
			auto it = C.find(toHash(p));
			if ((it == C.end()) && G[x][y - 1] == 0) {
				Q.push(p); C[toHash(p)] = C[toHash(prev)] + 1;
			}
		}
		if (y + 1 != W) {
			pair<int, int> p = make_pair(x, y + 1);
			auto it = C.find(toHash(p));
			if ((it == C.end()) && G[x][y + 1] == 0) {
				Q.push(p); C[toHash(p)] = C[toHash(prev)] + 1;
			}
		}

		auto it = C.find(toHash(g));
		if (it != C.end()) return C[toHash(g)];
	}
	
	return NIL;
}

int main() {
	int H, W; scanf("%d%d", &H, &W);
	int G[MAX][MAX]; int cnt = 0;

	FOR(i, 0, H) {
		char s[MAX]; scanf("%59s", &s);
		FOR(j, 0, W) {
			if (s[j] == '.') G[i][j] = 0;
			else {
				G[i][j] = 1;
				cnt++;
			}
		}
	}

	int s = search(G, H, W);
	if (s == NIL) printf("%d\n", -1);
	else printf("%d\n", H*W - s - cnt);

	return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N=II()
As=LI()

for i, j in sorted(map(lambda pair: (pair[1], pair[0]), enumerate(As))):
    print(j+1, end=' ')
print("")


Measured memory_bytes: 20268
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<ll> l;
    if (n==1){
        cout << 1 << endl;
        return 0;
    }
    l.push_back(2);
    l.push_back(1);
    for (int i=2;i<=n;i++){
        ll next_num = l[i-1]+l[i-2];
        l.push_back(next_num);
    }
    cout << l[n] << endl;
    
    
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 1e5 + 5;
const int MOD = 998244353; //1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "NO\n"; return 0;}

int N,M;
int A[MAXN];
pair<int,int> B[MAXN];

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> M;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < M; i++) cin >> B[i].se >> B[i].fi;

    sort(A,A+N);
    //reverse(A,A+N);

    sort(B,B+M);
    reverse(B,B+M);

    int i = 0, j = 0;
    while (i < N && j < M && A[i] < B[j].fi) {
        if (!B[j].se) j++;
        if (j == M || A[i] >= B[j].fi) break;
        A[i++] = B[j].fi;
        B[j].se--;
    }

    LL ans = 0;
    for (int i = 0; i < N; i++) ans += A[i];
    //for (int i = 0; i < N; i++) cout << A[i] << endl;

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>

int main(){
    int n,i,j,tmp,flag,count=0;
    int A[100];

    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
       scanf("%d",&A[i]); 
    }

    
 for(i=0;i<n;i++)
 {
    for(j=n-1;j>i;j--)
    {
        if(A[j] < A[j-1])
        {
            tmp = A[j-1];
            A[j-1] = A[j];
            A[j] = tmp;
            
            count++;
        }
    }
  }

    for(i=0;i<n;i++)
    {
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",count);

}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll n;
  vector<ll> v;
  cin >> n;
  double cnt = 0;
  REP(i, n) {
    ll p;
    cin >> p;
    v.pb(p);
    cnt += p;
  }
  cnt /= n;
  double mini = MOD;
  ll ans = 0, cc = 0;
  for (auto &a : v) {
    double b = a;
    if (abs(cnt - b) < mini) {
      mini = abs(cnt - b);
      ans = cc;
    }
    cc++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = list(map(int, reversed(list(input()))))

a = 0
b = 9999
for x in n:
  temp_a = min(a + x, b + x)
  b = min(a + 10 - x + 1, b + 10 - x - 1)
  a = temp_a

print(min(a, b))

Measured memory_bytes: 21348
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define fill(x,v) memset(x, v, sizeof(x))
#define PI (ld)acos(-1)
#define endl '\n'
#define dbg(x) cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl; 
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define IO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
const ld eps=(ld)1e-9;
const ll inf=(ll)1e18;
const ll mod=(ll)1e9+7;
string s,t;
int n,m;
int d[3001][3001];
void f(){
	for (int i = 0; i < n+1; ++i)
	{
		d[i][0]=0;
	}
	for (int i = 0; i < m+1; ++i)
	{
		d[0][i]=0;
	}
	for (int i = 1; i <=n; ++i)
	{
		for (int j = 1; j <=m; ++j)
		{
			if(s[i-1]==t[j-1]){
				d[i][j]=1+d[i-1][j-1];
			}
			else{
				d[i][j]=max(d[i-1][j],d[i][j-1]);
			}
		}
	}
	string ans="";
	int l=d[n][m],i,j;
	i=n;j=m;
	while(i>0 && j>0)
	{
		if(s[i-1]==t[j-1]){
			ans+=s[i-1];
			i--;j--;
		}
		else if(d[i-1][j]>d[i][j-1]){
			i--;
		}
		else j--;
	}
	reverse(all(ans));
	cout<<ans;

}


void solve(){
	cin>>s>>t;
	n=s.length();
	m=t.length();
	fill(d,0);
	f();
}

int main(){fio;
int test=1;
// cin>>test;
while(test--){
	solve();
	cout<<endl;
}
return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x, y;
string s;

// < ----------- func eh ---------------- ? //


// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,b,h;
	cin>>a>>b>>h;
	cout<<(a+b)*h/2;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
#define ll long long
#define W 1000000007
using namespace std;

int main(){
	int n;
	cin>>n;
	int a[n],min=101,max = -101;
	lp2(i,n){
		cin>>a[i];
		if(min>a[i])min=a[i];
		if(max<a[i])max=a[i];
	}
	//cout<<min<<max;
	int min1 = INT_MAX,sum;
	lp3(i,min,max+1){
		sum=0;
		lp2(j,n){
			sum=sum+(a[j]-i)*(a[j]-i);
		}
		if(min1>sum)min1=sum;
	}
	cout<<min1<<endl;
	return 0;
}


Measured memory_bytes: 256
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a > b:
    if a - v * t <= b - w * t:
        print('YES')
    else:
        print('NO')
elif a == b:
    print('YES')
else:
    if a + v * t >= b + w * t:
        print('YES')
    else:
        print('NO')




Measured memory_bytes: 61668
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <climits>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

int main() {
  string S, T;
  cin >> S >> T;

  if (S.length() + 1 != T.length()) {
    cout << "No" << endl;
    return 0;
  }

  rep(i, S.length()) {
    if (S[i] != T[i]) {
      cout << "No" <<endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 3068
n = int(input())

bits = []
for i in range(n):
    bit = int(input().replace(" ", ""), 2)
    bits.append(bit)
p = [[int(item) for item in input().split()] for _ in range(n)]

ans = - 10**9
for i in range(1,2**10):
    val = 0 
    for j, mise in enumerate(p):
        val += mise[bin(i & bits[j]).count("1")]
    ans = max(ans, val)

print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define Ans(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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; }

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

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

	cout << (a * 3 + p) / 2 << endl;
}

Measured memory_bytes: 256
s = input()
t_list = list(input())
ans = len(t_list)

for start in range(len(s) - len(t_list) + 1):
    diff = 0
    for i in range(len(t_list)):
        if(t_list[i] != s[start + i]):
            diff += 1
        
    ans = min(ans, diff)

print(ans)



Measured memory_bytes: 8976
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
template<typename T>vector<T> make_v(size_t a){ return vector<T>(a); }
template<typename T,typename... Ts>auto make_v(size_t a, Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL a, b;

LL calc(LL x, int i){
    LL ret = 0;
    ret += (x + 1)/(1LL << (i + 1))*(1LL << i);
    if((x + 1)%(1LL << (i + 1)) >= (1LL << i))ret += (x + 1)%(1LL << (i + 1)) - (1LL << i);
    //cout << i << " " << ret << endl;
    return ret;
}

int main(){
    cin >> a >> b;
    LL ans = 0;
    REP(i, 64){
        if((calc(b, i) - calc(a - 1, i) + 2) % 2)ans += 1LL << i;
    }
    cout << ans << endl;
}

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

int main(){
    int n,d; cin>>n>>d;
    vector<vector<int>> v;
    vector<int> temp;
    int k;
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            cin>>k;
            temp.push_back(k);
        }
        v.push_back(temp);
        temp.clear();
    }
    int cnt=0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            int sum=0;
            for(int k=0; k<d; k++){
                sum+=pow((v[i][k]-v[j][k]),2);
            }
            int sq=pow(sum, 0.5);
            if(sum-pow(sq,2)==0){cnt++;}
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Bean> list = new ArrayList<>();

		int N = in.nextInt();

		for ( int i = 0; i < N; i++ ) {
			Bean bean = new Bean(i, in.next(), in.nextInt());
			list.add(bean);			
		}
		
		Collections.sort(list, new MyComp());
		
		for ( Bean bean : list ) {
			System.out.println(bean.getNum() + 1);
		}


		in.close();
	}
}

class Bean {

	private int num = 0;
	private String	city;
	private int		point;

	public Bean(int num, String city, int point) {
		this.num = num;
		this.point = point;
		this.city = city;
	}
	
	public int getNum() {
		return num;
	}

	public int getPoint() {
		return point;
	}

	public String getCity() {
		return city;
	}
}

class MyComp implements Comparator<Bean> {

	public int compare(Bean b1, Bean b2) {
		if ( b1.getCity().compareTo(b2.getCity()) != 0 ) {
			return b1.getCity().compareTo(b2.getCity());
		} else {
			return Integer.compare(b2.getPoint(), b1.getPoint());
		}
	}
}


Measured memory_bytes: 20564
#include <iostream>

using namespace std;

constexpr int MOD = 1e9 + 7;

template <int MOD>
struct ModInt {
  int val;
  
  ModInt(long long v = 0) : val(v % MOD) {
    if (val < 0) val += MOD;
  };
 
  
  inline ModInt operator-() const { return ModInt(MOD - val); }
  inline ModInt inv() const { return this->pow(MOD - 2); }
  
 
  inline ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
  inline ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
  inline ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
  inline ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
  ModInt pow(long long n) const {
    ModInt x = ModInt(1);
    ModInt b = *this;
    while(n > 0){
      if(n & 1) x *= b;
      n >>= 1;
      b *= b;
    }
    return x;
  }
 
    
  inline ModInt& operator+=(const ModInt& x) {
    if((val += x.val) >= MOD)
      val -= MOD;
    return *this;
  }
  inline ModInt& operator-=(const ModInt& x) {
    if((val -= x.val) < 0)
      val += MOD;
    return *this;
  }
  inline ModInt& operator*=(const ModInt& x) {
    val = (long long)(val) * x.val % MOD;
    return *this;
  }
  inline ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
 
  
  inline bool operator==(const ModInt& b) const { return val == b.val; }
  inline bool operator!=(const ModInt& b) const { return val != b.val; }
 

  friend std::istream& operator>>(std::istream& is, ModInt& x) { return is >> x.val; }
  friend std::ostream& operator<<(std::ostream& os, const ModInt& x) { return os << x.val; }
};
 

using mint = ModInt<MOD>;
 
mint comb(int n, int r) {
    mint ret = 1;
    for(int i = 1; i <= r; i++){
        ret *= n - i + 1;
        ret /= i;
    }
    return ret;
}


int main(void){
  int n;
  long long a, b;
  cin >> n >> a >> b;

  mint ans = mint(2).pow(n) - 1;
  ans -= comb(n, a);
  ans -= comb(n, b);
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
S = sys.stdin.readline().rstrip()
n = len(S) - 1
ans = 0
for i in range(2 ** n):
    op = [""] * n
    tmp = S[0]
    for j in range(n):
        if (i >> j) & 1:
            tmp += "+"
        tmp += S[j + 1]
    ans += eval(tmp)
print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
    long long n,m;
    while(~scanf("%lld%lld",&n,&m))   
    {
        cout << ((m/2<n)? m/2 : n+(m-n*2)/4) << endl;  
    }
    return 0;
}

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

int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int a,b,c,k;cin>>a>>b>>c>>k;
   while(k--){
      if(b>a){
         c*=2;
      }
      else{
         b*=2;
      }
   }
   if(b>a && c>b){
      cout<<"Yes"<<endl;
   }
   else{
      cout<<"No"<<endl;
   }
   return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;

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

    // n == 0 での例外処理
    if (n == 0)
    {
        if (a[0] == 1)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << -1 << endl;
        }
        return 0;
    }
    // 根についての例外処理。
    if (a[0] != 0)
    {
        cout << -1 << endl;
        return 0;
    }

    vector<ll> MAX(n + 1); // 各深さで最大何個のノードを持ちうるのかを保持。

    // はじめは、深い方からMAXを更新。あとで浅い方からも更新する。
    MAX[n] = a[n];
    for (int i = n - 1; i >= 0; i--)
    {
        MAX[i] = MAX[i + 1] + a[i];
    }

    MAX[0] = 1;
    ll ans = 1;
    // 浅い方からMAXを更新。
    for (int i = 1; i <= n; i++)
    {
        MAX[i] = min((MAX[i - 1] - a[i - 1]) * 2, MAX[i]);
        ans += MAX[i];
        if (MAX[i] <= 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    if(MAX[n] < a[n]){
        cout << -1 << endl;
        return 0;
    }

    cout << ans << endl;
    // debug_vec(MAX);

    return 0;
}


Measured memory_bytes: 4808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int num = 0;
		int count = 0;

		for (int i = Math.min(a, b); i > 0; i--) {
			if (a % i == 0 && b % i == 0) {
				count++;
			}
			if (count == k) {
				num = i;
				break;
			}
		}

		System.out.print(num);
	}
}

Measured memory_bytes: 23764
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	n := len(s)
	ll := make([]int, n)
	ll[n-1] = n - 1
	rr := make([]int, n)
	for i := 0; i < n-1; i++ {
		rr[i+1] = rr[i]
		if s[i] == 'R' {
			rr[i+1] = i
		}
	}

	for i := n - 2; i >= 0; i-- {
		ll[i] = ll[i+1]
		if s[i+1] == 'L' {
			ll[i] = i + 1
		}
	}

	ans := make([]int, n)
	for i := 0; i < n; i++ {
		if s[i] == 'L' {
			r := rr[i]
			if (i-r)%2 == 1 {
				r++
			}
			ans[r]++
			continue
		}

		l := ll[i]
		if (l-i)%2 == 1 {
			l--
		}
		ans[l]++
	}
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, ans[i])
	}
}


Measured memory_bytes: 3968
import std.stdio, std.math, std.conv, std.array, std.string, std.algorithm;

void main() {
    uint c = to!uint(readln().chomp);
    for (uint i = 0; i < c; ++i) {
        double[] dx = map!(to!double)(readln().chomp.split).array;
        double[] ap = dx[0..2];
        double[] bp = dx[3..5];
        double ar = dx[2];
        double br = dx[5];
        double d = dist(ap, bp);
        if (d < (ar-br)^^2) {
            if (br < ar) {
                writeln(2);
            } else {
                writeln(-2);
            }
        } else if (d > (ar+br)^^2) {
            writeln(0);
        } else {
            writeln(1);   
        }
    }
}

double dist(double[] ax, double[] bx) {
    return (ax[0]-bx[0])^^2 + (ax[1]-bx[1])^^2;
}

Measured memory_bytes: 1064
using System;
using System.Collections.Generic;
using System.Linq;

class Program {

    static int Main(string[] args) {
        List<decimal[]> list = new List<decimal[]>();

        while (true) {
            string v = Console.ReadLine();
            if (string.IsNullOrEmpty(v) == true) { break; }

            decimal a = decimal.Parse(v.Split(' ')[0]);
            decimal b = decimal.Parse(v.Split(' ')[1]);

            list.Add(new decimal[] { a, b });
        }

        for (int i = 0; i < list.Count; i++) {
            List<decimal> aList = GetYakusu(list[i][0]);
            List<decimal> bList = GetYakusu(list[i][1]);

            decimal max = GetMaxYakusu(aList, bList);
            decimal min = GetMinBaisu(aList, bList);

            Console.WriteLine("{0} {1}", max, min);
        }

        return 0;
    }

    static decimal GetMinBaisu(List<decimal> a, List<decimal> b) {
        decimal v = 1;
        for (int i = 0; i < a.Count; i++) {
            v *= a[i];
        }
        for (int i = 0; i < b.Count; i++) {
            v *= b[i];
        }
        return v;
    }

    static decimal GetMaxYakusu(List<decimal> a, List<decimal> b) {
        decimal v = 1;

        for (int i = 0; i < a.Count; i++) {
            if (b.Contains(a[i]) == true) {
                v *= a[i];
                b.Remove(a[i]);
            }
        }

        return v;
    }

    static List<decimal> GetYakusu(decimal v) {
        List<decimal> list = new List<decimal>();

        decimal c = 2;
        while (true) {
            if (v < 2) { break; }

            if (v % c == 0) {
                list.Add(c);
                v = v / c;
            }
            else {
                c++;
            }
        }

        return list;
    }

    static int InputN() {
        string v = Console.ReadLine();
        return int.Parse(v);
    }

    static int[] InputInt() {
        string v = Console.ReadLine();
        string[] vs = v.Split(' ');

        return new int[] { int.Parse(vs[0]), int.Parse(vs[1]) };
    }

    static void Check(int n, List<int[]> list) {
        SortedDictionary<int, int> v = new SortedDictionary<int, int>();

        int maxValue = 0;
        for (int i = 0; i < list.Count; i++) {
            int id = list[i][0];
            if (v.ContainsKey(id) == false) {
                v.Add(id, 0);
            }

            v[id] += list[i][1];

            if (maxValue < v[id]) {
                maxValue = v[id];
                Console.WriteLine("{0} {1}", id, maxValue);
            }
            else {
                maxValue = v.Values.Max();
                var q = v.Where((x) => x.Value == maxValue);
                foreach (var item in q) {
                    Console.WriteLine("{0} {1}", item.Key, maxValue);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 9632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; typedef long double ld;
const int INF32 = 1e9+10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, A, B; cin >> K >> A >> B;
  if (B-A <= 2 || K <= A-1) {
    cout << K + 1 << endl;
  } else {
    ll ans = A + (ll)((K-(A-1))/2)*(B-A) + (K-(A-1))%2;
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    double x1, x2, y1, y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    double dis = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
    cout << setprecision(10);
    cout << dis << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr int MAX_N_ROW = 100000;
constexpr int MAX_N_COLUMN = 60;

struct BitMatrix {
    int n, m;
    bitset<MAX_N_COLUMN> a[MAX_N_ROW];
    BitMatrix(int n, int m): n(n), m(m) {};
    inline bitset<MAX_N_COLUMN> &operator[](int i) {return a[i];}
};

int GaussJordan(BitMatrix &a) {
    int rank = 0;
    for(int j=a.m-1;j>=0;--j) {
        int pivot = -1;
        for(int i=rank;i<a.n;++i) {
            if(a[i][j]) {
                pivot = i;
                break;
            }
        }
        if(pivot == -1) continue;

        swap(a[pivot], a[rank]);
        for(int i=0;i<a.n;++i) {
            if(i != rank && a[i][j]) {
                a[i] ^= a[rank];
            }
        }

        ++rank;
    }
    return rank;
}

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    BitMatrix a(n, MAX_N_COLUMN);
    ll ai;
    for(int i=0;i<n;++i) {
        cin >> ai;
        a[i] = bitset<MAX_N_COLUMN>(ai);
    }

    vector<bool> is_interesting(MAX_N_COLUMN, false);
    for(int j=0;j<MAX_N_COLUMN;++j) {
        for(int i=0;i<n;++i) {
            is_interesting[j] = is_interesting[j] ^ a[i][j];
        }
        if(is_interesting[j]) {
            for(int i=0;i<n;++i) a[i][j] = 0;
        }
    }

    int rank = GaussJordan(a);

    bitset<MAX_N_COLUMN> ansbits(0);
    for(int i=0;i<n;++i) {
        ansbits ^= a[i];
    }

    ll ans = 0;
    for(int j=0;j<MAX_N_COLUMN;++j) {
        if(ansbits[j]) ans |= (1LL << j);
    }
    ans <<= 1;

    for(int j=0;j<MAX_N_COLUMN;++j) {
        if(is_interesting[j]) {
            ans += (1LL << j);
        }
    }

    cout << ans << endl;
    

}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, K; cin >> N >> K; 
	long long H[200010] = {}; 
	for(int i = 0; i < N; i++) cin >> H[i]; 
	sort(H, H+N, greater<long long>()); 
	long long ans = 0; 
	for(int i = K; i < N; i++) ans += H[i]; 
	cout << ans << endl; 
}

Measured memory_bytes: 1792
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;

template<typename T, int size>
class Bit {
  public:
    Bit(T z): zero(z) {
      for (int i = 0; i <= N; ++i) {
        bit[i] = zero;
      }
    }

    T sum(int k) const {
      T s = zero;
      for (int i = k; i > 0; i -= i&(-i)) {
        s += bit[i];
      }
      return s;
    }

    // [l,r)
    T sum(int l, int r) const {
      return sum(r-1) - sum(l-1);
    }

    void add(int k, T x) {
      for (int i = k; i <= N; i += i&(-i)) {
        bit[i] += x;
      }
    }

  private:
    int const N = size;
    T const zero;
    std::array<T, size+1> bit;
};

int main() {
  Bit<int, 100100> bit(0);
  int N, Q;
  cin >> N >> Q;
  REP(i, Q) {
    int COM, X, Y;
    cin >> COM >> X >> Y;
    if (COM) {
      cout << bit.sum(X, Y+1) << endl;
    } else {
      bit.add(X, Y);
    }
  }
  return 0;
}



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

string s;

int main() {
  cin >> s;
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] == ',')
      cout << " ";
    else
      cout << s[i];
  }
  cout << endl;
  return 0;
}

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

int main(){
    int n,k;
    cin >> n>>k;
    vector<int> h(n);
    rep(i,n){
        cin>>h[i];
    }
    sort(h.begin(),h.end());
    
    int ans = 1e9;
    for(int i=0;i<=n-k;i++){
        ans = min(ans, h[k+i-1]-h[i]);
    }
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

signed main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x = 0, max = INT_MIN;
	char s[100];
	cin >> n;
	REP(i, n) cin >> s[i];

	if(x > max) max = x;
	REP(i, n){
		if(s[i] == 'I') x++;
		else x--;
		if(x > max) max = x;
	}
	cout << max << endl;
	rtn 0;
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int gcd(int a, int b);

int main(){
  ll K;
  cin >> K;
  ll ans = 0;
  for(int i = 1; i <=K; i++){
    for(int j = 1; j <= K; j++){
      for(int k = 1; k <= K; k++){
        ans += gcd(gcd(i,j),k);
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}

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


Measured memory_bytes: 3780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {

	final static int SIZE = 8;
	final static int MARGIN = 3;
	final static char BOMB = 1;
	final static char BOMBED = 0;
	static Deque<int[]> bombs;
	static byte[][] map;

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null) {

			int n = Integer.parseInt(line);

			br.readLine();
			for (int i = 0; i < n; ++i) {
				bombs = new ArrayDeque<int[]>();
				map = new byte[SIZE + MARGIN * 2][SIZE + MARGIN * 2];

				for (int j = MARGIN; j < SIZE + MARGIN; ++j) {
					line = br.readLine();
					for (int k = MARGIN; k < SIZE + MARGIN; ++k) {
						map[j][k] = (byte) (line.charAt(k - MARGIN) - '0');
					}
				}

				int x = Integer.parseInt(br.readLine());
				int y = Integer.parseInt(br.readLine());

				bombs.offer(new int[] { y + MARGIN - 1, x + MARGIN - 1 });
				map[y + MARGIN - 1][x + MARGIN - 1] = BOMBED;
				while (!bombs.isEmpty()) {
					bomb();
				}
				System.out.print(print(i + 1, map));
				br.readLine();
			}
		}
	}

	static void bomb() {

		final int[] V = { 1, -1, 0, 0 };
		final int[] H = { 0, 0, 1, -1 };

		int[] yx = bombs.poll();
		int y = yx[0];
		int x = yx[1];

		// map[y][x] = BOMBED;

		for (int i = 0; i < 4; ++i) {
			for (int j = 1; j <= 3; ++j) {
				int yv = y + V[i] * j;
				int xh = x + H[i] * j;
				if (map[yv][xh] == BOMB) {
					bombs.offer(new int[] { yv, xh });
					map[yv][xh] = BOMBED;
				}
			}
		}
	}

	static String print(int n, byte[][] map) {

		StringBuilder sb = new StringBuilder();
		sb.append("Data " + n + ":\n");
		for (int i = MARGIN; i < SIZE + MARGIN; ++i) {
			for (int j = MARGIN; j < SIZE + MARGIN; ++j) {
				sb.append(map[i][j]);
			}
			sb.append("\n");
		}

		return sb.toString();
	}

}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M), L(N);
  for (int i=0; i < M; i++){
    cin >> a.at(i) >> b.at(i);
  }
  for (int i=0; i < N; i++){
    for (int j = 0; j < M; j++){
      if (a.at(j) == i+1)
        L.at(i) += 1;
      if (b.at(j) == i+1)
        L.at(i) +=1;
    }
  }
  for (int i=0; i < N; i++){
    cout << L.at(i) << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int ans = 0;
		if(n < 10) {
			ans = 100 * (10 - n) + r;
		}else {
			ans = r;
		}
		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 35660
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend() 
#define pb(x) push_back(x)

using namespace std;
using ll=long long;

long mod=1e9+7;

ll N,Q;

struct Unionfind{
  vector<ll> par,siz;
  //Constructor
  Unionfind(ll sz_):par(sz_),siz(sz_,1){
    for(ll i=0;i<sz_;i++)par[i]=i;
  }
  
  ll root(ll x){
    return par[x]==x?x:
    par[x]=root(par[x]);
  }

  bool same(ll x,ll y){
    return root(x)==root(y);
  }

  void unite(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    par[y]=x;
  }

  ll size(ll x){
    return siz[root(x)];
  }

};

int main() {
  int n;cin>>n;
  int sum=0;
  int mx=0;
  rep(i,n){
    int p;cin>>p;
    sum+=p;
    mx=max(mx,p);
  }
  int ans=sum-mx/2;
  cout<< ans<<endl;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        String line = Io.read();
        String answer = null;

        switch(line) {
            case "A":
                answer = "T";
                break;

            case "T":
                answer = "A";
                break;

            case "C":
                answer = "G";
                break;

            case "G":
                answer = "C";
                break;

            default:
                break;
        }

        Io.write(answer);
    }
}

class Io {

    /**
     * 標準入力から1行ずつ受け取る
     * @return
     * @throws IOException
     */
    public static String read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();

        br.close();
        return line;
    }

    /**
     * 標準出力
     * @param answer
     */
    public static void write(String answer)
    {
        System.out.println(answer);
    }
}

Measured memory_bytes: 20820
//  Twitter@KonoLv1 2020年春からエンジニア見習いデビュー！（修正版）
 
//  標準入出力を扱うヘッダーファイルの読み込み
#include <stdio.h>
 
int main(void){
 
    unsigned long int a;
    unsigned long int b;
    unsigned long int n;
    unsigned long int ans = 0;
 
    scanf("%lu %lu %lu",&n,&a,&b);
    
    //  aとbの間隔が奇数か偶数かの判定
    if ((b - a) % 2 == 0){
        
        //  偶数なら間隔÷２で最小
        printf("%lu",((b - a) / 2));
        
    }else{

        //  奇数ならbとaのどちらが対なる端に近いか判定
        //  aかbが一度端に2連続で存在することによりその後交差することなく合流できる。
        
        if (b - 1 <= n - a){
            ans = (((b - a) / 2) + 1) +  (a - 1);
        }else{
            ans = (((b - a) / 2) + 1) + (n - b);
        }
        printf("%lu",ans);
    }
}
 

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <unordered_map>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr int INF = 1 << 30;
ll gcd(ll a,ll b) {return b==0 ? a : gcd(b, a%b);}
ll lcm(ll a,ll b) {return a / gcd(a,b) * b;}
int gcd(const vector<int> &v) {
  int ret = v[0];
  for(int i = 1; i < (int)v.size(); ++i) ret = gcd(ret, v[i]);
  return ret;
}
ll lcm(const vector<ll> &v) {
  ll ret = v[0];
  for(int i = 1; i < (int)v.size(); ++i) ret = lcm(ret, v[i]);
  return ret;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll a, b; cin >> a >> b;
  cout << lcm(a, b);
  return 0;
}



Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
def search(c):
    bar = N
    r = 0
    res_nega = 0
    dp_arr = [0]*(2*N+1)
    for i in range(N):
        dp_arr[bar] += 1
        if a_list[i] < c:
            r += dp_arr[bar]
            bar += 1
        else:
            r -= (dp_arr[bar-1])
            bar -= 1
        res_nega += r
    return res_nega
# binary search
a_sorted = sorted(a_list)
left = 0
right = N
mid = N // 2
C = N*(N+1) // 2
while True:
    if search(a_sorted[mid]) <= C // 2:
        if mid == N-1:
            break
        elif search(a_sorted[mid+1]) > C // 2:
            break
        else:
            left = mid
            mid = (mid + right) // 2
    else:
        right = mid + 1
        mid = (mid + left) // 2
print(a_sorted[mid])


Measured memory_bytes: 14468
import sys
input = sys.stdin.readline
from operator import itemgetter
import heapq
n, k = map(int, input().split())
TD = sorted([list(map(int, input().split())) for _ in range(n)], reverse=True, key=itemgetter(1))
L = [[] for _ in range(n+1)]
P = []
a = 0
cnt = 0
F = [-float("inf")]*(n+1)
B = 0
for t, d in TD[:k]:
  if B>>t & 1:
    heapq.heappush(P, d)
  else:
    B |= 1 << t
    a += 1
  cnt += d
F[a] = cnt
for i in range(a, n):
  if len(P) == 0:
    break
  while k < n and B>>TD[k][0] & 1:
    k += 1
  if k == n:
    break
  t, d = TD[k]
  B |= 1 << t
  F[i+1] = F[i] - heapq.heappop(P) + d
ans = 0
for i in range(a, n+1):
  ans = max(ans, F[i] + i*i)
print(ans)

Measured memory_bytes: 78684
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        scan.close();

        int num2 = num % 10;

        if (num2 == 3) {
            System.out.println("bon");
        } else if (num2 == 0 || num2 == 1 || num2 == 6 || num2 == 8) {
            System.out.println("pon");
        } else {
            System.out.println("hon");
        }
    }
}


Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
int main() {
    int ans;
    int r, g, b, n; cin >> r >> g >> b >> n;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if ((n-i*r-j*b) >= 0 && (n-i*r-j*b) % g == 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
char str[10];
int ans,n;
 
inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}
 
signed main()
{
	n=read();
	ans=n/500*1000;
	n%=500;
	ans+=n/5*5;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256