akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<vector>
using namespace std;
int main() {
	//C
	/*long long int x;
	cin >> x;
	long long int y;
	y = x % 11;
	x = x / 11;
	if (y == 0) {
		cout << 2 * x << endl;
	}
	else if (y < 7) {
		cout << 2 * x + 1 << endl;
	}
	else {
		cout << 2 * x + 2 << endl;
	}
	return 0;
	*/

	//D
	int n;
	int a[100000];
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int l, lnum, r, rnum;
	l = 0; lnum = a[l];
	r = n - 1; rnum = a[r];
	//l++;
	//r--;
	int cards = n;
	while (1) {
		l++;
		if (a[l] != lnum) {
			//cout << 1;
			lnum = a[l];
			if (l >= r) {
				cout << cards << endl;
				return 0;
			}
		}
		else {
			while (1) {
				r--;
				if (a[r] != rnum) {
					
					rnum = a[r];
					if (r <= l) {
						cout << cards - 2 << endl;
						return 0;
					}
				}
				else {
					cards = cards - 2;
					if (r <= l) {
						cout << cards << endl;
						return 0;
					}
					break;
				}
			}
		}

	}

}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll; 
#define endl "\n"
#define pb push_back
int main(){
  string s; 
  cin>>s; 
  if(s=="RRR"){
    cout<<3;
  }
  else if(s=="SSS"){
    cout<<0;
  }
  else if(s=="RRS" or s=="SRR"){
    cout<<2;
  }
  else{
    cout<<1;
  }
  return 0;
}

Measured memory_bytes: 3624
def make_pairs(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            pairs.append((i, n//i))

N = int(input())
pairs = []
make_pairs(N)

res = N
p = (1, N)
for pair in pairs:
    if res > pair[0]+pair[1]:
        p = (pair[0], pair[1])
        res = pair[0]+pair[1]

if p[0] > 1:
    res -= 1
if p[1] > 1:
    res -= 1

print(res)


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

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

	int N;
	int i,k;
	int ans=0;
	int ctr=0;

	cin >> N;
	
	if(400<=N && N<=599) ans=8;
	else if(600<=N && N<=799) ans=7;
	else if(800<=N && N<=999) ans=6;
	else if(1000<=N && N<=1199) ans=5;
	else if(1200<=N && N<=1399) ans=4;
	else if(1400<=N && N<=1599) ans=3;
	else if(1600<=N && N<=1799) ans=2;
	else if(1800<=N && N<=1999) ans=1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> h(n+1),ans(n+1);
    for(int i=1;i<=n;i++) cin>>h[i];
    ans[1]=0;ans[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
        ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<ans[n];
    return 0;
}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

ll l, r, x;

int main() {
//    freopen("input.in", "r", stdin);
	cin >> l >> r >> x;
	ll res = ((r/x) - (l/x));
	if(!(l%x))res++;
	cout << res << '\n';
	return 0;
}

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


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

vector<long int> A(n,0);
vector<long int> B(n,0);
for(int i=0;i<n;i++)
cin>>A[i];
B[0] = 0;
if(n!=1)
{ B[1] = abs(A[1]-A[0]);
    for(int i=2;i<n;i++)
     B[i] = min(B[i-2]+abs(A[i]-A[i-2]),B[i-1]+abs(A[i]-A[i-1]));
     cout<<B[n-1];
  }
else
  cout<<0;
  
return 0;   
}





Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <atcoder/segtree>

using namespace std;
using namespace atcoder;

int xx;

int merge(int a, int b) {
  return max(a, b);
}

int single() {
  return INT_MIN;
}

bool check(int x) {
  return x < xx;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (auto& foo : a) {
    cin >> foo;
  }
  segtree<int, merge, single> st(a);
  while (q--) {
    int op, x;
    cin >> op >> x >> xx;
    if (op == 1) {
      st.set(x - 1, xx);
    } else if (op == 2) {
      cout << st.prod(x - 1, xx) << '\n';
    } else {
      cout << st.max_right<check>(x - 1) + 1 << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 6068
#include <bits/stdc++.h>
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int a, b;
   cin >> a >> b;
    double x = a + b;
    cout <<  round(x / 2) << endl;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int,input().split())) #値段
c = list(map(int,input().split())) #コスト

nedan = 0
cost = 0
for i in range(n):
    if v[i] - c[i] > 0:
        nedan += v[i] - c[i]
print(nedan)




Measured memory_bytes: 3060
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離

a, b = imn()

ta = ''
for i in range(a):
    ta += str(b)
tb = ''
for i in range(b):
    tb += str(a)

ans = sorted([ta, tb])

print(ans[0])

Measured memory_bytes: 5292
//	Totally unrelated and not AT ALL stolen from hohohaha's template
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>

using namespace std;

#pragma GCC optimize("03")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define arctan atan
#define arccos acos
#define arcsin asin
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define vt vector
#define pr pair
#define u_map unordered_map
#define endl "\n"
//	Until next time, remember:
//			You are closer than you think.
//						_Dan Lok_

typedef double db;			typedef long long ll;		typedef long double ld;			typedef string str;
typedef pr<int, int> pii;	typedef pr<ll,ll> pll;		typedef pr<ld,ld> pdd;
typedef vt<int> vi;			typedef vt<ll> vll;			typedef vt<bool> vb;
typedef vt<str> vs;			typedef vt<pii> vpii;		typedef vt<pll> vpll;
typedef map<int, int> mii;	typedef map<int, bool> mib;	typedef map<int, str> mis;		typedef map<int, char> mic;
typedef complex<db> cpx;	typedef vt<cpx> vcpx;
//const int mod = 1e9+7;		const ll inf = 9223372036854775807;
#define pi 3.1415926535897932	//faster than pi = acos(-1); but sometimes doesn't work
//	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//	srand(chrono::steady_clock::now().time_since_epoch().count());
//	freopen("input.txt","r",stdin);

const int MAX_N = 1007;
//const int MAX_K = MAX_N*(MAX_N-1) / 2;
ll a[MAX_N];
int n,k, last = 40;
vll beauty;

void make_beauties()
{
	for(int i = 1; i < n+1; ++i)
	{
		ll sum = 0;
		for(int j = i; j < n+1; ++j)
		{
			sum += a[j];
			beauty.pb(sum);
		}
		
	}
}

ll MAX_AND()
{
	ll ans = 0, i = 39;
	for(vll temp; i > -1; --i)
	{
		ll cunt = 0;
		for(ll& j: beauty)
		{
			if (j & (1LL << i)) ++cunt;
		}
		
		if (cunt >= k)
		{
			ans |= (1LL << i); temp.clear();
			for(ll j : beauty)
			{
				if (j & (1LL << i)) temp.pb(j);
			}
			beauty = temp;
		}
	}
	return ans;
}

void input()
{
	cin >> n >> k;
	for(int i = 1; i < n+1; ++i)
	{
		cin >> a[i];
	}
	make_beauties();
	cout << MAX_AND();
}

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//	freopen("FILE.inp","r",stdin); freopen("FILE.out","w",stdout);
//	freopen("input.txt","r",stdin);
	input();
	return 0;
}
// with the aura of Dora, AC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1!!!!!!!!!!!!!!!!!!!!!!!!!
// Why is there node one in my row of exclamation marks?



Measured memory_bytes: 6384
#! /usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)


INF=10**20
def solve(S: int, W: int):
    print("unsafe" if W >= S else "safe" )
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(S, W)



if __name__ == "__main__":
    main()


Measured memory_bytes: 61868
#include <bits/stdc++.h>
using namespace std;
struct Max{
	int a,b;
	bool operator <(Max &X_Y){
		if(a-b>X_Y.a-X_Y.b)return true;
		//else if(a>=X_Y.a)return true;
		return false;
	}
};
int main(){
	int N;
	cin>>N;
	Max ar[N];
	int ma=0;
	for(int i=0;i<N;i++){
		cin>>ar[i].a;
	}
	for(int i=0;i<N;i++){
		cin>>ar[i].b;
	}
	int x=0,y=0;
	for(int i=0;i<N;i++){
		if(ar[i].a>ar[i].b){
			x+=ar[i].a;
			y+=ar[i].b;
		}
	}
	cout<<x-y<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,K,ans;
    ans=0;
    cin>>N>>K;
    int X[N];
    for(int i=0;i<N;i++){
        cin>>X[i];
    }
    for(int i=0;i<N;i++){
        ans+=2*min(X[i],K-X[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
S = input()
S_list = list(S)
n = len(S) 
a = []

list_0or1 = [0] * (n-1)
check = []

def f(i):
    if i == n-1 :
        check.append(list_0or1.copy())
    if i != n-1:
        list_0or1[i] = 0
        f(i+1)
    if i != n-1:
        list_0or1[i] = 1
        f(i+1)
f(0)

sum_list = []
s_list = []
for i in range(len(check)):
    S_list_copy = S_list.copy()
    for j in range(n-1) :
        if check[i][j] == 1 :
            S_list_copy[j+1] = '+' + S_list_copy[j+1]
        if check[i][j] == 0 :
            S_list_copy[j+1] = '-' + S_list_copy[j+1]
    S_list_copy = ''.join(S_list_copy)
    sum_list.append(S_list_copy)
    S_list_copy = [int(S_list_copy[0]), int(S_list_copy[2]), int(S_list_copy[4]), int(S_list_copy[6])]
    s = S_list_copy[0]
    for j in range(n-1) :
        if check[i][j] == 1 :
            s = s + S_list_copy[j+1]
        if check[i][j] == 0 :
            s = s - S_list_copy[j+1]
    s_list.append(s) 
if 7 in s_list:
    print(sum_list[s_list.index(7)]+'=7')

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int main()
{
  fastio;
  int X, n; cin >> X >> n;
  vector <bool> mark(101, false);
  for (int i = 1; i <= n; i++){
    int x; cin >> x;
    mark[x] = true;
  }
  int res = 0; int diff = X;
  for (int i = 0; i <= 101; i++){
    if (mark[i]) continue;
    if (abs(i - X) < diff){
      diff = abs(i - X);
      res = i;  
    }
  }
  cout << res;
  return 0;
}

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

int main(){
	string s;
	cin >> s;
	bool flag = true;
	if(s.size() % 2 == 0) {
		for(int i=0;i<s.size()-1;i+=2) {
			if(s[i] == 'h' and s[i+1] == 'i') {

			} else {
				flag = false;
			}
		}
	} else {
		flag = false;
	}

	cout << ((flag) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
I=lambda : list(map(int,input().split()))
a,=I();f=0
r=[pow(j,5) for j in range(-1000,1001)]
for i in range(len(r)):
    for j in range(len(r)):
        if r[i]-r[j]==a:
            print(i-1000,j-1000);f=1;break
    if f:
        break

Measured memory_bytes: 9260
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


int N;
MII cnt;


int solve(){
	int ans = 0;
	for(PII p : cnt) ans = max(ans, p.second);
	return ans;
}


signed main(){
	cin >> N;
	rep(i, 0, N){
		int a;
		cin >> a;
		cnt[a]++;
		cnt[a+1]++;
		cnt[a-1]++;
	}

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

vvint g;
vector<bool> used;

void dfs(int v) {
    used[v] = true;
    for (int n_v : g[v]) {
        if (used[n_v]) continue;
        dfs(n_v);
    }
}

int main() {
    int n, m; cin >> n >> m;
    g.resize(n+m);
    used.assign(n+m,false);
    rep(i,n) {
        int k; cin >> k;
        rep(j,k) {
            int l; cin >> l;
            l--;
            g[i].push_back(n+l);
            g[n+l].push_back(i);
        }
    }
    dfs(0);
    bool ans = true;
    rep(i,n) ans &= used[i];
    if (ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 11284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,k;cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)cin>>a[i];
    long double ans=0,cur=0;
    for(ll i=0;i<k;i++)cur+=(a[i]+1.0);
    ans=cur;
    for(ll i=k;i<n;i++){
        cur-=(a[i-k]+1.0);
        cur+=(a[i]+1.0);
        ans=max(ans,cur);
    }
    cout<<fixed<<setprecision(18)<<ans/2.0;
}




Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
int main()
{
	char a[100];
	int n,flag=1;
	scanf("%s",&a);
	n=strlen(a);
	int p,q,m;
	m=n;
	p=(n-1)/2;
	q=(n+1)/2;
	for(int i=0;i<n;i++)
	{
		if(a[i]!=a[n-1])
		flag=0;
		n--;
	}
	for(int i=0;i<p;i++)
	{
		if(a[i]!=a[p-1])
		flag=0;
		p--;
	}
	for(int i=q;i<m;i++)
	{
		if(a[i]!=a[m-1])
		flag=0;
		m--;
	}
	if(flag==1)
	printf("Yes\n");
	else
	printf("No\n");
}

Measured memory_bytes: 128
X, K,D = map(int, input().split())

if X >= K * D:
    print(X - K * D)
elif X <= K * (- D):
    print(abs(X + K * D))
else:
    if X >= 0:
        pos = X % D
        neg = X % D - D
        if K % 2 == (X // D) % 2:
            print(pos)
        else:
            print(abs(neg))
    elif X <= 0:
        pos = D - (abs(X) % D)
        neg = - (abs(X) % D)
        if K % 2 == (abs(X) // D) % 2:
            print(abs(neg))
        else:
            print(pos)

Measured memory_bytes: 9076
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>

using namespace std;
const int INF =1001001001;
#define rep(i,n) for(int i=0;i<n;i++)
int N;



int main(){
	scanf("%d",&N);
	do{
		pair<bool,int> Rs[100000];//色と連続している個数
		int cursol=-1;//今のRS内での要素番号
		rep(i,N){
			int a;
			scanf("%d",&a);
			if(i==0){Rs[++cursol]=make_pair(a,1);continue;}
			if(i%2){   //iが偶数
				if(a==Rs[cursol].first)Rs[cursol].second++;//右端と一致
				else{
					if(cursol>0){Rs[--cursol].second+=Rs[cursol+1].second+1;Rs[cursol+1].second=0;}
					else{Rs[cursol].first=a;Rs[cursol].second+=1;}
				}
			}else{      //iが奇数・・・そのまま置く
				if(a==Rs[cursol].first)Rs[cursol].second++;
				else{Rs[++cursol].first=a;Rs[cursol].second=1;}
			}
		}
		int ans=0;
		rep(i,cursol+1){
			if(Rs[i].first==0)ans+=Rs[i].second;
		}
		printf("%d\n",ans);
		scanf("%d",&N);
	}while(N);
	return 0;
}

Measured memory_bytes: 1808
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(a < 10 && b < 10 ? a * b : -1);
	}
}


Measured memory_bytes: 35720
s = input()

def judge(S):
   if (len(S) % 2 == 0) and (S[:len(S) // 2] == S[(-1) * len(S) // 2:]):
      return True
   else:
      return False

for i in range(len(s)):
   s = s[:-1]
   if judge(s):
      print(len(s))
      break

Measured memory_bytes: 9048
#include<iostream>
#include<stdio.h>
#include<fstream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<iomanip>
#include<cassert>
#include<complex>
#include<functional>
#include<list>
#include<cmath>
#include<stack>
#include<assert.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define F first
#define S second 
using namespace std;
int n;
LL a[100010],b[100010];
LL ans;
int main(){
  cin>>n;
  for(int i=0;i<=n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
    cin>>b[i];
  for(int i=0;i<n;i++){
  	if(b[i]<=a[i])
  	  ans+=b[i];
	else{
	  ans+=a[i];
	  b[i]-=a[i];
	  if(b[i]<=a[i+1]){
	    ans+=b[i];
	    a[i+1]-=b[i];
	  }
	  else{
	    ans+=a[i+1];
	    a[i+1]=0;
	  }
	}
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1792
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>


#define ll long long
#define ull unsigned long long
#define int ll
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 1e6 + 123, K = 501;
int a[N];
int n , m ;
int c[N] , u[N] , v[N];

vector < pii > gr[N];
set < int > st[N];
int id ;
map < int , int > gid[N];
int d[N];
void flex(int x){
	for(auto to : st[x])
		gid[x][to] = ++id;
}
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n >> m;
	id = n;
	for(int i = 1 ;i <= m; i++){
		cin >> u[i] >> v[i] >> c[i];
		st[u[i]].insert(c[i]);
		st[v[i]].insert(c[i]);
	}
	
	for(int i = 1 ; i <= n; i++)
		flex(i);							
	for(int i = 1; i <= m ; i++){
		int u1 = gid[u[i]][c[i]] , v1 = gid[v[i]][c[i]];
		gr[u1].pb({v1,0});
		gr[v1].pb({u1,0});
		gr[u1].pb({u[i],1});
		gr[v1].pb({v[i],1});
		gr[u[i]].pb({v1,0});
		gr[v[i]].pb({u1,0});
	}
	set < pii > ds;
	for(int i = 1; i <= id; i++)
		d[i] = 1e9 ;
	d[1] = 1;
	ds.insert({d[1] , 1});
	while(sz(ds) != 0){
		int u = (*ds.begin()).se;
		ds.erase(ds.begin());
		for(auto to : gr[u])
			if(d[to.fi] > d[u] + to.se){
				ds.erase({d[to.fi],to.fi});
                d[to.fi] = d[u] + to.se;
				ds.insert({d[to.fi],to.fi});
			}
	}
	int ans = d[n];
	for(auto to : st[n]){
		ans = min(ans , d[gid[n][to]]);
	}

	if(ans >= 1e9)ans = -1;
	cout << ans;

}


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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n) cin>>a[i];
	int ans=0;
	bool odd=false;
	while(true){
		rep(i,n){
			if(a[i]%2==1) odd=true;
		}
		if(odd) break;
		rep(i,n){
			a[i]/=2;
		}
		++ans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i, b, n) for(int i=b;i<(int)n;i++)
#define rep(i, n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it, o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

const int MAX_N = 1e5+1;

int N;
ll t[3][MAX_N];
ll memo[3][MAX_N];

int prei = -1;
ll preRet = 0;

ll solve(int now, int pre){
    if(memo[now][pre] >= 0)return memo[now][pre];
    if(now == 2){
        return memo[now][pre] = lower_bound(t[now], t[now] + N, t[now-1][pre]) - t[now];
    }
    ll ret = preRet;
    REP(i, prei+1, N){
        if(t[now][i] >= t[now-1][pre])break;
        prei = i;
        ret += solve(now+1, i);
    }

    return preRet = ret;
}

int main() {
    cin >> N;
    rep(i, 3)rep(j, N)cin >> t[2-i][j];
    rep(i, 3)sort(t[i], t[i]+N);
    rep(i, 3)rep(j, N)memo[i][j] = -1;
    ll ans = 0;
    rep(i, N)ans += solve(1, i);
    cout << ans << endl;


    return 0;
}

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

namespace ABC176B
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            int l = N.Length;
            int sum = 0;
            for(int i = 0; i < l; i++)
            {
                sum += int.Parse(N[i].ToString());
            }
            if (sum % 9 == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 32960
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll gyaku(ll x){
  return pow(x,mod-2);
}
vector<ll> frac,gfrac;
void set_frac(ll n){
  frac.push_back(1);
  gfrac.push_back(1);
  for(ll i=1;i<=n;i++){
    frac.push_back(frac[i-1]*i%mod);
    gfrac.push_back(gyaku(frac[i]));
  }
}
ll nCr(ll n,ll r){
  ll res=frac[n]*gfrac[r]%mod;
  res*=gfrac[n-r];
  return res%mod;
}
int main(){
  ll n;
  cin>>n;
  vector<ll> vec;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }
  sort(vec.begin(),vec.end(),greater<ll>());
  ll p2=pow(2,n);
  ll g4=gyaku(4);
  ll ans=0;
  for(ll i=1;i<=n;i++){
    ll kans=vec[i-1];
    kans*=i+1;
    kans%=mod;
    kans*=g4;
    kans%=mod;
    ans+=kans;
    ans%=mod;
  }
  ans*=p2;
  ans%=mod;
  ans*=p2;
  ans%=mod;
  cout<<ans<<endl;
}


Measured memory_bytes: 2420
import java.util.*;

class Main{

    int n, m, sz;
    char[] kakko;
    int[] a, bkt, add;

    void solve(){
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        m = sc.nextInt();
        kakko = sc.next().toCharArray();

        sz = Math.max(1, (int)Math.sqrt(n) - 1);
        a = new int[n];
        bkt = new int[n/sz+10];
        add = new int[n/sz+10];
        TreeSet<Integer> set = new TreeSet<Integer>();

        for(int i=0; i<n; i++){
            if(i==0) a[i] = 1;
            else{
                if(kakko[i]=='(') a[i] = a[i-1] + 1;
                else{
                    a[i] = a[i-1] - 1;
                    set.add(new Integer(i));
                }
            }
            bkt[i/sz] = Math.min(a[i], bkt[i/sz]);
        }

        for(int i=0; i<m; i++){
            int q = sc.nextInt()-1;
            int idx = 0;
            if(kakko[q]=='('){
                kakko[q] = ')';
                set.add(new Integer(q));
                add(q, n, -2);
                idx = set.higher(new Integer(-1));
                kakko[idx] = '(';
                set.remove(new Integer(idx));
                add(idx, n, 2);
            }else{
                kakko[q] = '(';
                set.remove(new Integer(q));
                add(q, n, 2);
                idx = search(q);
                kakko[idx] = ')';
                add(idx, n, -2);
                set.add(new Integer(idx));
            }
            //System.out.println(Arrays.toString(kakko));
            System.out.println(idx+1);
        }
    }

    void add(int start, int last, int num){
        int from = start - start%sz;
        int to = from + sz;
        for(int i=start/sz; i<=last/sz; i++){
            if(start<=from && to<=last){
                add[i] += num;
            }else{
                for(int j=from; j<to; j++){
                    if(start<=j && j<last){
                        a[j] += num;
                    }
                }
                int min = Integer.MAX_VALUE;
                for(int j=from; j<to && j<a.length; j++){
                    min = Math.min(min, a[j]);
                }
                bkt[i] = min;
            }
            from = to;
            to += sz;
        }
    }

    int search(int f){        
        int from = f - f%sz;
        int to = from + sz;
            
        for(int i=f/sz; i>=0; i--){
            if(bkt[i]+add[i]<=1){
                for(int j=Math.min(f-1, to-1); j>=from; j--){
                    if(a[j]+add[i]==1) return j+1;
                }
            }
            to = from;
            from -= sz;
        }
        return 0;
    }

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

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

using namespace std;
vector<int> adj[100010];
int dp[100005];
int n,m;

int lp(int n)
{
    int &ret = dp[n];
    if(ret!=-1)
        return ret;

    ret = 0;

    for(int i=0;i<adj[n].size();i++)
    {
        ret = max(ret,lp(adj[n][i])+1);
    }
    return ret;
}
int main()
{
    cin>>n>>m;

    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);

    }

    memset(dp,-1,sizeof dp);
    int mx =-1;

    for(int i=1;i<=n;i++)
    {
        mx = max(mx,lp(i));
    }

    cout<<mx<<endl;
}


Measured memory_bytes: 8192
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: i32,
        d: i32,
    }
    let ans = (n + 2 * d + 1 - 1) / (2 * d + 1);
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
int n, m, d[500005], cnt;
map<int, int> g[500005];
deque<int> q;
vector<pair<int, int> > E[500005];
int get(int x, int y) {
	if (g[x].count(y)) {
		return g[x][y];
	}
	g[x][y] = ++cnt;
	E[cnt].clear();
	return cnt;
}
void add(int u, int v, int w) {
	E[u].push_back(make_pair(v, w));
	E[v].push_back(make_pair(u, w));
}
int main() {
	while (~scanf("%d%d", &n, &m)) {
		cnt = 0;
		for (int i = 1; i <= n; ++i)
			g[i].clear();
		for (int i = 1; i <= n; ++i)
			get(i, 0);
		for (int i = 1; i <= m; ++i) {
			int x, y, c;
			scanf("%d%d%d", &x, &y, &c);
			int x0 = get(x, 0), y0 = get(y, 0);
			int xc = get(x, c), yc = get(y, c);
			add(x0, xc, 1);
			add(y0, yc, 1);
			add(xc, yc, 0);
		}
		memset(d, -1, sizeof(d));
		d[1] = 0;
		q.push_back(1);
		while (!q.empty()) {
			int u = q.front();
			q.pop_front();
			for (int i = 0; i < E[u].size(); ++i) {
				pair<int, int> e = E[u][i];
				if (d[e.first] == -1 || d[e.first] > d[u] + e.second) {
					d[e.first] = d[u] + e.second;
					if (e.second) {
						q.push_back(e.first);
					} else
						q.push_front(e.first);
				}
			}
		}
		printf("%d\n", d[n] >> 1);
	}
	return 0;
}

Measured memory_bytes: 79232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static int N;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        System.out.println( solve() );
    }

    private static String solve() {
        boolean[] prime = new boolean[55555 + 1];
        Arrays.fill(prime, true);
        prime[2] = true;
        for (int i = 2; i < 55555; i++) {
            if( prime[i] ) {
                for (int d = 2; d*i <= 55555; d++) {
                    prime[i*d] = false;
                }
            }
        }

        List<Integer> ans = new ArrayList<>();
        for (int i = 2; i <= 55555 ; i++) {
            if( prime[i] && i % 5 == 1 ) {
                ans.add(i);
                if( ans.size() == N ) break;
            }
        }

        StringJoiner j = new StringJoiner(" ");
        for (Integer each : ans) {
            j.add(each.toString());
        }
        return j.toString();
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

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

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 19412
#include <iostream>

using namespace std;

struct Node{
    int data;
    Node *next,*prev;
};

class List{
    Node* nil;
    Node* searchNode(int x){
        Node* p = nil->next;
        while (p != nil && p->data != x){
            p = p->next;
        }
        return p;
    }
    void deleteNode(Node *node){
        if(node == nil)return;
        node->prev->next = node->next;
        node->next->prev = node->prev;
        delete(node);
    }
public:
    List() {
        nil = new Node();
        nil->next = nil;
        nil->prev = nil;
    }
    void insertFirst(int x){
        Node* node = new Node();
        node->data = x;
        node->next = nil->next;
        node->prev = nil;

        nil->next->prev = node;
        nil->next = node;
    }
    void deleteData(int x){
        deleteNode(searchNode(x));
    }
    void deleteFirst(){
        deleteNode(nil->next);
    }
    void deleteLast(){
        deleteNode(nil->prev);
    }
    void print(){
        Node *p = nil->next;
        while (p != nil){
            if(p != nil->next) cout << " ";
            cout << p->data;
            p = p->next;
        }
        cout << endl;
    }
};

int main(){
cin.tie(0);
    ios::sync_with_stdio(false);
    
    List l;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int num;
        string command;
        cin >> command;
        if (command == "insert") {
            cin >> num;
            l.insertFirst(num);
        } else if (command == "delete") {
            cin >> num;
            l.deleteData(num);
        } else if (command == "deleteFirst") {
            l.deleteFirst();
        } else if (command == "deleteLast") {
            l.deleteLast();
        }
    }
    l.print();
    return 0;
}

Measured memory_bytes: 34472
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, d ] <- readInts
	xs <- replicateM n readInts
	print $ ( `div` 2 ) $ length $ do
		p <- xs
		q <- xs
		guard $ p /= q && isSquare ( dist_sq p q )
		return ()

squares = [ i * i | i <- [ 1 .. 1000000 ] ]
isSquare = flip elem squares

dist_sq [] _ = 0
dist_sq (a:as) (b:bs) = ( a - b ) ^ 2 + dist_sq as bs

Measured memory_bytes: 80252
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

#define REP(i, n) for(int i = -1; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    long long N, X, M;
    cin >> N >> X >> M;

    vector<long long> b, l;
    vector<bool> is_appeared(M, false);
    REP(i, M){
        if(is_appeared[X]) break;
        is_appeared[X] = true;
        b.push_back(X);
        X *= X;
        X %= M;
    }
    while(!b.empty()){
        long long tmp = b.back();
        b.pop_back();
        l.push_back(tmp);
        if(tmp == X) break;
    }
    reverse(l.begin(), l.end());

    long long ans = accumulate(b.begin(), b.end(), (long long) 0);
    if((long long) b.size() < N){
        N -= (long long) b.size();
        long long s = accumulate(l.begin(), l.end(), (long long) 0);
        long long len = l.size();
        ans += s * (N/len);
        for(int i = 0; i < N%len; ++i) ans += l[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4232
class Combination():
    def __init__(self, n, mod=10**9+7):
        self.mod = mod
        self.fac = [1]*(n+1)
        for i in range(1,n+1):
            self.fac[i] = self.fac[i-1] * i % self.mod
        self.invfac = [1]*(n+1)
        self.invfac[n] = pow(self.fac[n], self.mod - 2, self.mod)
        for i in range(n-1, 0, -1):
            self.invfac[i] = self.invfac[i+1] * (i+1) % self.mod
    
    def combination(self, n, r):
        ans = self.fac[n] * self.invfac[r] % self.mod * self.invfac[n-r] % self.mod
        if n >= r:
            return ans
        else:
            return 0
    
    def factorial(self, i):
        return self.fac[i]
    
    def invfactorial(self, i):
        return self.invfac[i]


def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n, m, k = map(int, input().split())
    mod = 998244353
    c = Combination(n,mod)
    ans = 0
    mex = [0]*(k+1)
    mex[0] = pow(m-1,n-k-1,mod)
    for i in range(1,k+1):
        mex[i] = mex[i-1]*(m-1)%mod
    mex = mex[::-1]
    for i in range(k+1):
        ans += c.combination(n-1, i)*mex[i]
        ans %= mod
    ans *= m
    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 34044
#include<stdio.h>

int main(void){

int a,b,c,x;

scanf("%d %d %d",&a,&b,&c);

if(a>b){

x=a;

a=b;

b=x;

}

if(a>c){

x=a;

a=c;

c=x;

}

if(b>c){

x=b;

b=c;

c=x;

}

printf("%d %d %d\n",a,b,c);

return 0;

}  

Measured memory_bytes: 596
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"

	"sort"
	"strconv"
	"strings"
)

//  長い入力を読む
func ReadLongLines(times int) ([]string, error) {
	result := make([]string, times)
	reader := bufio.NewReader(os.Stdin)
	buffer := bytes.NewBuffer(make([]byte, 0))
	readBytes := int64(2)
	for i := 0; i < times; i++ {
		for {
			readBuf, isPrefix, err := reader.ReadLine()
			// fmt.Printf("Reader.Read: %d\n", len(readBuf))
			readBytes += int64(len(readBuf) + 1)
			if err != nil {
				if err == io.EOF {
					fmt.Println("EOF")
					break
				} else {
					return result, err
				}
			}
			_, err = buffer.Write(readBuf)
			if err != nil {
				return result, err
			}
			// end of line
			if !isPrefix {
				result[i] = buffer.String()
				buffer.Reset()
				// reader = bufio.NewReader(os.Stdin)
				break
			}
		}
	}
	// 先読みしてしまうようなので、戻しておく
	os.Stdin.Seek(-int64(reader.Buffered()), os.SEEK_CUR)
	return result, nil
}

// 出力 for 競プロ
type Console struct {
	writer *bufio.Writer
}

func NewConsole() Console {
	return Console{bufio.NewWriter(os.Stdout)}
}
func (this *Console) Printf(format string, a ...interface{}) {
	fmt.Fprintf(this.writer, format, a...)
}
func (this *Console) Println(s string) {
	fmt.Fprintln(this.writer, s)
}
func (this *Console) Close() {
	this.Flush()
}
func (this Console) Flush() {
	this.writer.Flush()
}

func PrintList(list []int) {
	con := NewConsole()
	defer con.Flush()
	for i := range list {
		if i == 0 {
			con.Printf("%d", list[i])
		} else {
			con.Printf(" %d", list[i])
		}
	}
	con.Println("")
}

func main() {
	con := NewConsole()
	defer con.Flush()

	m := make(map[int]struct{})
	lines, _ := ReadLongLines(4)
	a := strings.Split(lines[1], " ")
	for i := range a {
		n, _ := strconv.Atoi(a[i])
		m[n] = struct{}{}
	}

	result := make([]int, 0, 200000)
	b := strings.Split(lines[3], " ")
	for i := range b {
		n, _ := strconv.Atoi(b[i])
		if _, ok := m[n]; ok {
			delete(m, n)
		} else {
			m[n] = struct{}{}
		}
	}
	for k, _ := range m {
		result = append(result, k)
	}
	sort.Slice(result, func(lhs, rhs int) bool {
		return result[lhs] < result[rhs]
	})
	for j := range result {
		con.Printf("%d\n", result[j])
	}
}



Measured memory_bytes: 32012
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){

    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  rep(i, h) cin >> grid[i];
  rep(i, h) rep(j, w) {
    if (grid[i][j] == '#') {
      vector<vector<bool>> used(h, vector<bool>(w));
      queue<pair<int, int>> que;
      que.push({i, j});
      used[i][j] = true;
      int cnt = 1;
      while (!que.empty()) {
        int x, y;
        tie(x, y) = que.front();
        que.pop();
        rep(k, 4) {
          if (x+dx[k] < 0 || x+dx[k] >= h || y+dy[k] < 0 || y+dy[k] >= w)
            continue;
          if (grid[x+dx[k]][y+dy[k]] == '.' || used[x+dx[k]][y+dy[k]])
            continue;
          used[x+dx[k]][y+dy[k]] = true;
          que.push({x+dx[k], y+dy[k]});
          cnt++;
        }
      }
      if (cnt == 1) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
use std::collections::*;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut g: Vec<Vec<Edge>> = vec![vec![]; n];
    for _ in 0..m {
        let a: usize = sc.read();
        let b: usize = sc.read();
        g[a - 1].push(Edge::new(b - 1, 1));
        g[b - 1].push(Edge::new(a - 1, 1));
    }
    let mut dist: Vec<i32> = vec![std::i32::MAX; n];
    dist[0] = 0;
    let mut bfs: VecDeque<usize> = VecDeque::new();
    bfs.push_back(0);
    while !bfs.is_empty() {
        let now = bfs.pop_front().unwrap();
        for e in g[now].iter() {
            if dist[now] + 1 < dist[e.to] {
                dist[e.to] = dist[now] + 1;
                bfs.push_back(e.to);
            }
        }
    }
    let mut ans: Vec<usize> = vec![0; n];
    for i in 1..n {
        for e in g[i].iter() {
            if dist[e.to] + 1 == dist[i] {
                ans[i] = e.to;
                break;
            }
        }
    }
    println!("Yes");
    for i in 1..n {
        println!("{}", ans[i] + 1);
    }
}

struct Edge {
    to: usize,
    cost: i64,
}
impl Edge {
    pub fn new(to: usize, cost: i64) -> Edge {
        Edge { to: to, cost: cost }
    }
}
impl Clone for Edge {
    fn clone(&self) -> Self {
        Edge {
            to: self.to,
            cost: self.cost,
        }
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 16184
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long

int main() {
    IO;

    int t;
    cin>>t;

    int ans = 1;

    ans = t+t*t+t*t*t;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;

int main() {

    int r;
    cin >> r;

    int h, m, s;

    h = r / 3600;
    m = (r - h * 3600) / 60;
    s = (r - h * 3600 - m * 60);

    cout << h << ":" << m << ":" << s << endl;

    return 0;
}



Measured memory_bytes: 3100