akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<deque>
using namespace std;

using ll = long long;

int main(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);

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

    map<ll, ll> m;
    vector<ll> num;

    for (int i = 0; i < n; i++) {
        if (m[a[i]] == 0) {
            num.push_back(a[i]);
        }
        m[a[i]]++;
    }

    ll maxNum = 0;
    for (int i = 0; i < num.size(); i++) {
        ll tmp = m[num[i]];
        maxNum += (tmp * (tmp - 1)) / 2;
    }


    for (int i = 0; i < n; i++) {
        ll tmp = maxNum;
        tmp -= (m[a[i]] * (m[a[i]] - 1)) / 2;
        tmp += ((m[a[i]] - 1) * (m[a[i]] - 2)) / 2;
        cout << tmp << endl;
    }
}


Measured memory_bytes: 12020
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll a,b,ans;
int32_t main(){
CODE_START;
cin>>a;
for(ll i=0;i<=a;i++)
if(i%2==1){
        b=0;
        for(ll j=1;j<=i;j++)
        if(i%j==0){
            b++;
        }
if(b==8){
    ans++;
}
}
cout<<ans;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	p, q, r := nextInt(), nextInt(), nextInt()
	fmt.Println(min(p+q, q+r, r+p))
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

P p1,p2,p3;

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

	cin>>p1.fi>>p1.se>>p2.fi>>p2.se>>p3.fi>>p3.se;
	double a=hypot(p1.fi-p2.fi,p1.se-p2.se);
	double b=hypot(p2.fi-p3.fi,p2.se-p3.se);
	double c=hypot(p3.fi-p1.fi,p3.se-p1.se);
	double r=fabs((p2.fi-p1.fi)*(p3.se-p1.se)-(p3.fi-p1.fi)*(p2.se-p1.se))/(a+b+c);
	//double r=2*S/(a+b+c);
	double ma=max(a,max(b,c));
	double lb=0,ub=INF;
	REP(i,200) {
		double mid=(ub+lb)/2;
		if(ma*(r-mid)>=2*mid*r) lb=mid;
		else ub=mid;
	}
	printf("%.15f\n",lb);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n >> m;
    intl l[n];
    cin(i,l);
    intl cnt = 1;
    intl d = 0;
    rep(i,n){
        d = d + l[i];
        if(d <= m)cnt++;
        else break;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  int zle = 1;
  int all = 1;
  R(i,n){
    all *= 3;
    int pom;
    cin >> pom;
    if(pom & 1){
      zle *= 1;
    }else{
      zle *= 2;
    }
  }
  cout << all - zle << "\n";
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final int N = in.nextInt();
		final int K = in.nextInt();

		double p = solve(N, K);
		System.out.println(p);
	}

	private static final double LOG_2 = Math.log(2);

	static double solve(int N, int K) {
		double p = 0;
		for (int n = 1; n <= N; ++n) {
			if (n >= K) {
				p += 1;
			} else {
				// n*2^x = K
				final double x = Math.ceil(Math.log(K / (double) n) / LOG_2);
				p += Math.pow(0.5, x);
			}
		}
		return p / N;
	}
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 3005;
const int INF = (LL)1e9 + 5;
const LL MOD = 998244353;

int dp[MAXN][MAXN], choice[MAXN][MAXN];
string s, t;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> s >> t;
	for (int i = 1; i <= s.size(); i++) {
		for (int j = 1; j <= t.size(); j++) {
			if (s[i - 1] == t[j - 1]) {
				choice[i][j] = 0;
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else if (dp[i - 1][j] > dp[i][j - 1]) {
				choice[i][j] = 1;
				dp[i][j] = dp[i - 1][j];
			}
			else {
				choice[i][j] = 2;
				dp[i][j] = dp[i][j - 1];
			}
		}
	}
	
	int p1 = s.size(), p2 = t.size();
	string ans;
	ans.resize(dp[s.size()][t.size()]);
	while (p1 > 0 && p2 > 0) {
		if (choice[p1][p2] == 0) {
			ans[dp[p1][p2] - 1] = s[p1 - 1];
			p1--;
			p2--;
		}
		else if (choice[p1][p2] == 1) {
			p1--;
		}
		else {
			p2--;
		}
	}
	
	cout << ans << "\n";
}


Measured memory_bytes: 70784
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, atan, sqrt, tan, cos, pi
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


mod = 10 ** 9 + 7



h, w, k = LI()
ans = 0
C = SR(h)
for hbit in range(2 ** h):
    for wbit in range(2 ** w):
        ret = 0
        for hi in range(h):
            for wi in range(w):
                if (hbit >> hi & 1) and (wbit >> wi & 1) and C[hi][wi] == "#":
                    ret += 1
        if ret == k:
            ans += 1



print(ans)


Measured memory_bytes: 77796
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=200009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

int n;
int clr[M+4];
vector<int>adj[M+5];
int yo[M+4];
int sub[M+2];
int ses[M+2];
void dfs(int u,int par)
{
    int save=yo[clr[u]];
    sub[u]=1;
    int last_yo=save;
    int path=0;
    int sum=0;
    for(auto v:adj[u])
    {
        if(v==par)continue;
        dfs(v,u);
        int nw_same=yo[clr[u]]-last_yo;
        path+=(sum*(sub[v]-nw_same));
        sum+=(sub[v]-nw_same);
        sub[u]+=sub[v];
        last_yo=yo[clr[u]];
    }
    int up=n-save-sub[u]+1;
    int down=sub[u]-(yo[clr[u]]-save);
    path+=(up*down);
    ses[clr[u]]+=path;
    yo[clr[u]]=save+sub[u];
}
 main()

{
    fast
    cin>>n;
    f(i,1,n)cin>>clr[i];
    f(i,1,n-1)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1,0);
    f(i,1,n)
    {
        cout<<ses[i]<<endl;
    }

















    return 0;

}













Measured memory_bytes: 42724
main(a,b,c,p,q,r,s,S,i){for(;scanf("%d%d%d",&a,&b,&c),a;){
if(!c)a==1&&b<0?printf("1 0 %d %d\n",a,b):printf("%d %d 1 0\n",a,b);
else{
	for(r=1;r*r<=a;r++)if(a%r==0)for(p=a/r,S=1;S*S<=abs(c);S++)if(c%S==0){
		for(s=S,i=0;i<2;i++,s=-s)if(q=c/s,p*s+q*r==b){
			p==r&&q<s?printf("%d %d %d %d\n",r,s,p,q):printf("%d %d %d %d\n",p,q,r,s);
			goto next;
		}
		for(s=c/S,i=0;i<2;i++,s=-s)if(q=c/s,p*s+q*r==b){
			p==r&&q<s?printf("%d %d %d %d\n",r,s,p,q):printf("%d %d %d %d\n",p,q,r,s);
			goto next;
		}
	}
	puts("Impossible");
}next:;}exit(0);}

Measured memory_bytes: 608
def main():
    import sys
    input=sys.stdin.readline
    sys.setrecursionlimit(100000000)

    n,u,v=map(int,input().split())
    u-=1
    v-=1
    tree=[[] for i in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        a-=1
        b-=1
        tree[a].append(b)
        tree[b].append(a)
    
    depth_u=[0]*n #uからの距離
    depth_v=[0]*n #vからの距離
    
    def dfs1(i,before=-1):
        for e in tree[i]:
            if e!=before:
                depth_u[e]=depth_u[i]+1
                dfs1(e,i)
    
    def dfs2(i,before=-1):
        for e in tree[i]:
            if e!=before:
                depth_v[e]=depth_v[i]+1
                dfs2(e,i)
    
    dfs1(u)
    dfs2(v)

    ans=depth_v[u]-1
    for i in range(n):
        if len(tree[i])==1 and depth_u[i]<depth_v[i]:
                ans=max(ans,depth_v[i]-1)
    print(ans)

if __name__=='__main__':
    main()

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

namespace ABC082
{
    class ProblemA
    {
        static void Main(string[] args)
        {
            string[] inputs = Console.ReadLine().Split();
            int a = int.Parse(inputs[0]);
            int b = int.Parse(inputs[1]);
            double x = (a + b) / 2.0;
            double mod = (a + b) % 2.0;

            if (mod == 0)
            {
                Console.WriteLine(x);
            }
            else
            {
                Console.WriteLine((a + b) / 2 + 1);
            }

        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main(){
  int N,M,a,b;
  cin>>N>>M;
  int city[N];
  for(int i=0;i<N;i++)
    city[i]=0;
  for(int i=0;i<M;i++){
    cin>>a>>b;
    city[a-1]++; city[b-1]++; 
  }
  for(int i=0;i<N;i++)
    cout<<city[i]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
string A,B,C;
int type(int i){
	if(A[i]==B[i]&&B[i]==C[i]) return 4;
	if(B[i]==C[i]) return 0;
	if(C[i]==A[i]) return 1;
	if(A[i]==B[i]) return 2;
	return 3;
}
int main(){
	while(true){
		int N,d;
		cin>>N>>d;
		if(N==0) break;
		cin>>A>>B>>C;
		int a=d,b=d,c=d;
		int t[5]={};
		string ans;
		rep(i,N) t[type(i)]++;
		rep(i,N){
			vector<char> cand;
			cand.pb(A[i]);
			cand.pb(B[i]);
			cand.pb(C[i]);
			cand.pb('A');
			sort(all(cand));
			t[type(i)]--;
			for(char ch:cand){
				int l[3]={a,b,c};
				if(ch!=A[i]) l[0]--;
				if(ch!=B[i]) l[1]--;
				if(ch!=C[i]) l[2]--;
				bool hoge=true;
				rep(j,3) if(l[j]<0) hoge=false;
				if(!hoge) continue;
				int nt[5];
				rep(j,5) nt[j]=t[j];
				rep(j,3){
					if(l[j]<nt[j]) nt[j]-=l[j],l[j]=0;
					else l[j]-=nt[j],nt[j]=0;
				}
				l[0]-=nt[1]+nt[2];
				l[1]-=nt[2]+nt[0];
				l[2]-=nt[0]+nt[1];
				bool can=true;
				rep(j,3) if(l[j]<0) can=0;
				if(l[0]+l[1]+l[2]<2*nt[3]) can=0;
				int h=0;
				rep(j,3) h+=max(0,l[j]-nt[3]);
				if(h>l[0]+l[1]+l[2]-2*nt[3]) can=0;
				if(can){
					ans+=ch;
					if(ch!=A[i]) a--;
					if(ch!=B[i]) b--;
					if(ch!=C[i]) c--;
					break;
				}
			}
			if(ans.size()==0){
				ans="-1";
				break;
			}
		}
		cout<<ans<<endl;
	}
}

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

int main() {
  int h,n;
  cin>>h>>n;
  for(int i=0; i<n; i++) {
  	int a;
    cin>>a;
    h -= a;
    if(h<=0) {
    	cout << "Yes" << endl;
      	return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    auto inp = sread();
    auto A = new long[](4);
    foreach (i; 0 .. 4)
        A[i] = inp[i] - '0';
    // writeln(A);
    foreach (x; 0 .. (1 << 3))
    {
        long sum = A[0];
        foreach (i; 0 .. 3)
        {
            sum += A[i + 1] * ((-1) ^^ ((x & (1 << i)) != 0));
            // writeln(A[i + 1] * ((-1) ^^ ((x & (1 << i)) != 0)));
        }
        // writeln(sum);
        if (sum == 7)
        {
            write(A[0]);
            foreach (i; 0 .. 3)
            {
                write(['+', '-'][((x & (1 << i)) >> i)]);
                write(A[i + 1]);
            }
            writeln("=7");
            return;
        }
        // else
        // writeln(sum);
    }
}


Measured memory_bytes: 256
fun main(arr:Array<String>) {
    println(getAns(readLine()!!.toLong()))
}

fun getAns(target:Long):Long {
    var ans = 0L
    for(i in (0..target)) {
        if(i*i>target) {
            break
        }
        ans = i*i
    }
    return ans
}

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

int main(){
	int n,k,count=1,ans=1;
	string s;
	cin >> n >> k >> s;
	
	s += '.';
	vector<int> v,x;
	for(int i=1;i<s.size();i++){
		if(s[i] != s[i-1]){
			v.push_back(count);
			x.push_back(s[i-1]=='0');
			count = 0;
		}
		count++;
	}

	int l=0,r=1,p=v[0];
	count = x[0];
	while(1){
		ans = max(ans,p);
		if(r==x.size())break;
		if(count<k || (x[r]==0 && count==k)){
			count += x[r];
			p += v[r];
			r++;
		}else{
			count -= x[l];
			p -= v[l];
			l++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

vector<int> G[1<<17];

int dfs(int u,int v){
    int ret = 0,z=0;
    for (int i = 0; i < G[u].size(); i++) {
        if(G[u][i] == v) continue;
        int tmp = dfs(G[u][i],u);
        ret += tmp;
        if(tmp == 0) z++;
    }
    if(z > 1) ret += z - 1;
    return ret;
}



int main(){
    int n;cin >> n;
    for (int i = 0; i < n-1; i++) {
        int a,b;cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }
    int mx=-1,r=-1;
    for (int i = 0; i < n; i++) {
        if((int)G[i].size()>mx) mx=G[i].size(),r=i;
    }
    cout << max(1,dfs(r,r)) << endl;
    return 0;
}



Measured memory_bytes: 14208
A,B = map(int,input().split())
A = A-1
a = A % 2 
b = B % 2

if a == 1:
  A = (A+1)//2%2
else:
  A += (A//2)%2
if b == 1:
  B = (B+1)//2%2
else:
  B += (B//2)%2

ans = [0 for i in range(100)]

bin_a = format(A, 'b')
bin_b = format(B, 'b')

for i in range(len(bin_a)):
  ans[len(bin_a)-i-1] += int( bin_a[i] )
for i in range(len(bin_b)):
  ans[len(bin_b)-i-1] += int( bin_b[i] )
for i in range(100):
  ans[i] = ans[i]%2

a=0
for i in range(100):
  a += ans[i] * (2**i)
print(int(a))

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

void solve(){
	
	int n ;
	cin>>n ;

	vector<int> v(n) ;

	for(int i=0;i<n;i++){
		cin>>v[i] ;
	}

	sort(v.begin(),v.end()) ;

	reverse(v.begin(),v.end()) ;

	vector<ll> b; 

	for(int i=0;i<n;i++){
		b.push_back(v[i]) ;
		if(i!=0)
			b.push_back(v[i]) ;
	}

	ll ans=0 ;

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

	cout<<ans ;
	
		
}	

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 8160
#include <bits/stdc++.h>
//#include "stcd++.h"

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep2(i,a,b) for(ll i=a; i<=b; i++)
#define drep2(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back


int main ()
{
  string s;
  int k;
  cin >> s;
  cin >> k;
  vector<string> subs;
  rep(i, s.size())
    rep(j, 6) 
      subs.pb(s.substr(i,j));
  sort(subs.begin(), subs.end());

  auto u = unique(subs.begin(), subs.end());
  subs.erase(u, subs.end());
  cout << subs[k] << endl;
//  rep(i, subs.size()) 
//    cout << subs[i] << endl;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define X first
#define Y second
#define sz(v) (int)v.size()

void solve();

main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ONPC
	freopen("in.txt", "r", stdin);
#endif
	int t = 1;
	//cin >> t;
	while (t--) solve();
	return 0;
}



void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, c - (a - b));	
}

Measured memory_bytes: 256
import math
N, D = map(int, input().split())
X = []
Y = []
ans = 0
for i in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)

for i in range(N):
    if math.sqrt(X[i]** 2 + Y[i]** 2) <= D:
        ans += 1
print(ans)

Measured memory_bytes: 24936
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <numeric>

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef long long i64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using namespace std;

int main() {

	const int n = read_item();
	const int k = read_item();

	int d = 0;
	i64 maxi = 1;
	while(n >= maxi) {
		d += 1;
		maxi = maxi * k;
	}
	printf("%d\n", max(d, 1));

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  t = "abcdefghijklmnopqrstuvwxyz";
  SORT(s);
  REP(i,s.size()){
    if(s[i]==t[z]) z++;
  }
  if(z==26) OUT("None");
  else OUT(t[z]);
}

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

const int N = 1e5 + 7;
int a[N];
vector<int> ans;

int main()
{
	ios::sync_with_stdio(false);

	int n, l;
	cin >> n >> l;
	for (int i=0; i<n; i++)
		cin >> a[i];
	for (int i=0; i+1<n; i++)
		if (a[i] + a[i+1] >= l)
		{
			cout << "Possible\n";
			for (int j=0; j<i; j++)
				cout << j+1 << "\n";
			for (int j=n-1; j>i; j--)
				cout << j << "\n";
			return 0;
		}

	cout << "Impossible\n";
	return 0;
}


Measured memory_bytes: 1280
# coding: utf-8
# Your code here!
N = int(input())
VList = list(map(int, input().split()))
CList = list(map(int, input().split()))
ANS=0
for i in range(N):
    if VList[i]>CList[i]:
        ANS+=VList[i]-CList[i]
print(ANS)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
  int n;
  scanf("%d", &n);
  vector<int> v[100000];
  for(int i=0; i<n-1; i++){
    int a, b;
    scanf("%d %d", &a, &b);
    a--; b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int d[100000];
  fill(d, d+n, -1);
  d[0]=0;
  queue<int> que;
  que.push(0);
  while(!que.empty()){
    int x=que.front();
    que.pop();
    for(int i=0; i<v[x].size(); i++){
      if(d[v[x][i]]<0){
        d[v[x][i]]=d[x]+1;
        que.push(v[x][i]);
      }
    }
  }
  vector<P> dist;
  for(int i=0; i<n; i++){
    dist.push_back(P(d[i], i));
  }
  sort(dist.begin(), dist.end(), greater<P>());
  bool used[100000]={};
  bool e=0;
  for(int i=0; i<n; i++){
    int x=dist[i].second;
    if(used[x]==1) continue;
    bool e1=0;
    used[x]=1;
    for(int j=0; j<v[x].size(); j++){
      int y=v[x][j];
      if(d[y]>d[x]) continue;
      if(used[y]==0){
        e1=1;
        used[y]=1;
        break;
      }
    }
    if(e1==0){
      e=1;
      break;
    }
  }
  if(e==1){
    printf("First\n");
  }else{
    printf("Second\n");
  }
	return 0;
}


Measured memory_bytes: 7416
#include <stdio.h>
#include <string.h>

int main(void)
{
	int score[31];
	int ten[500];
	int num, tmp;
	int i, j, max = 0;
	int m;
	int num2;
	int rank;
	
	memset(score, 0, sizeof(score));
	memset(ten, 0, sizeof(ten));
	
	while (1){
		scanf("%d,%d", &num, &tmp);
		if ((num == 0) && (tmp == 0)){
			break;
		}
		score[tmp] = 1;
		ten[num] = tmp;
	}
	
	while (scanf("%d", &num2) != EOF){
		rank = 0;
		for (i = 0; i < 31; i++){
			if (ten[num2] <= i){
				rank += score[i];
//				printf(" // %d -> %d", i, score[i]);
			}
		}
		
		printf("%d\n", rank);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n;
	cin >> n;
	vi h(n), f(n);
	Foz(i, n) cin >> h[i];
	f[n - 1] = 0;
	Doz(i, n - 1) {
		f[i] = (h[i + 1] > h[i] ? 0 : 1 + f[i + 1]);	
	}
	int ans = 0;
	Foz(i, n) ckmax(ans, f[i]);
	cout << ans << '\n';
}



Measured memory_bytes: 1024
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
	char  S[51],T[51];
	cin>>S;
	cin>>T;
	int sLen=strlen(S);
	
	int tLen=strlen(T);
	int s;
	bool bFind=false;	
	for(s=0;s<sLen;s++){
		if (S[s]=='?'){
			bFind=true;
		}
	}
	if (!bFind){
		if (strstr(S,T)){
			cout<<S<<endl;
		}else{
			cout<<"UNRESTORABLE"<<endl;
		}
		return 0;
	}
	bFind=false;
	int t=tLen-1;
	for (s=sLen-1;s>=0;s--){
		if (S[s]=='?'){
			t--;
			if (t<0){
				memcpy(S+s,T,tLen);
				bFind=true;
				t=tLen-1;
				break;
			}
			if (s<t){
				break;
			}
			continue;
		}
		if (S[s]==T[t]){
			t--;
			if (t<0){
				memcpy(S+s,T,tLen);
				bFind=true;
				t=tLen-1;
				break;
			}
			if (s<t){
				break;
			}
			continue;
		}
		s+=tLen-1-t;
		t=tLen-1;
		if (s<t){
			break;
		}
	}
	if (!bFind){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for (s=0;s<sLen;s++){
		if (S[s]=='?'){
			S[s]='a';
		}
	}
	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main() {
	string s;
	cin >> s;
	string t;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0')t += '0';
		if (s[i] == '1')t += '1';
		if (s[i] == 'B'&& t.size() != 0)t.pop_back();
	}

	cout << t << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;

void quicksort(int low, int high,long long *a)
{
  if(low<high){
    int mid=(low+high)/2;
    int x=a[mid];
    int i=low;
    int j=high;
    while(i<=j){
      while(a[i]<x)i=i+1;
      while(a[j]>x)j=j-1;
      if(i<=j) swap(a[i++],a[j--]);
    }
    quicksort(low,j,a);
    quicksort(i,high,a);
  }
}

int main()
{
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i=0; i<n; i++)
    cin >> a[i];
  quicksort(0,n-1,&a[0]);
  
  long long ans=a[n-1];
  int cnt=3;
  int i=n-1;
  while(cnt<n){
    i--;
    cnt+=2;
    ans+=a[i]*2;
  }
  if(n%2==1)ans+=a[i-1];

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4828
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;
ll n,q,m,k,l,ans;
vll a,b;
map<ll, vll> bits;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);

    cin >> n >> m;
    vll x(n);
    rep(i,n) {
        ll t;cin >> t;
        x[i]=abs(t-m);
    }

    if(n==1) ans=x[0];
    else{
        ans = gcd(x[0],x[1]);
        rng(i,2,n) ans = gcd(ans,x[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
using System;
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            if (s[2] == s[3] && s[4] == s[5])
                System.Console.WriteLine("Yes");
            else
                System.Console.WriteLine("No");
        }
    }
}


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


int main(){
    int N;
    cin >> N;
    
    int a[3 * N];
    vector<lint> sum(N + 1);
    
    priority_queue<int> q1, q2;
    
    sum[0] = 0;
    
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        q1.push(-a[i]);
        sum[0] += a[i];
    }
    
    for(int i = N; i < 2 * N; ++i){
        cin >> a[i];
        int temp =  -q1.top();
        if(temp >= a[i]){
            sum[i - N + 1] = sum[i - N];
        } else {
            sum[i - N + 1] = sum[i - N] - temp + a[i];
            q1.pop();
            q1.push(-a[i]);
        }
    }
    
    lint sub = 0;
    for(int i = 2 * N; i < 3 * N; ++i){
        cin >> a[i];
        q2.push(a[i]);
        sub += a[i];
    }
    
    for(int i = 0; i < N + 1; ++i){
        sum[N - i] = sum[N - i] - sub;
        int temp = q2.top();
        if(temp <= a[2 * N - i - 1]){
        } else {
            q2.pop();
            q2.push(a[2 * N - i - 1]);
            sub = sub - temp + a[2 * N - i - 1];
        }
    }
    sort(sum.begin(), sum.end());
    cout << sum[N] << endl;
    
}


Measured memory_bytes: 3192
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
typedef long long int ll;
using namespace std;
#define maxN 1000005
#define mod 1000000007

//ll all[maxN]= {};
int n;
string s;

void solve() {
	ll ans=0;
	ll r,g,b;
	r=g=b=0;
	for(int i=0; i<s.length(); i++) {
		if(s[i]=='R'){
			r++;
		}else if (s[i]=='G'){
			g++;
		}else if(s[i]=='B'){
			b++;
		}
	}
	ans=r*g*b;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<s.length();j++){
			int temp =2*i+j;
			if(temp<s.length()){
				if(s[i+j]!=s[j]&&s[i+j]!=s[temp]&&s[j]!=s[temp]){
					ans--;
				}
			}
		}
	}
	cout<<ans<<endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>s;
	solve();
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
#define M 1000000007
using namespace std;
ll t;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll power(ll x,ul y,ll p){ll res = 1;x = x % p;if(x == 0)return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
void solve(){
	string a;
	cin>>a;
	if(a=="ARC") cout<<"ABC";
	else cout<<"ARC";
	
 }
int main(){
	fast();
	solve();
	return 0;
}



Measured memory_bytes: 3620
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a1, a2, a3;
    cin>>a1>>a2>>a3;
    if(a1 + a2 + a3 >= 22) {
    	cout<<"bust\n";
    }
    else {
    	cout<<"win\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 5 != 0) ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    rep(i,N) cin >> p[i];
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,K) ans += p[i];
    cout << ans << endl;
}

Measured memory_bytes: 3592
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func isInt(f float64) bool {
	return math.Floor(f) == f
}

func main() {
	scanner.Split(bufio.ScanWords)

	x := nextInt()
	max := 0
	for i := 1; i <= 32; i++ {
		for j := 2; j <= 10; j++ {
			if n := math.Pow(float64(i), float64(j)); isInt(n) {
				if int(n) <= x && int(n) > max {
					max = int(n)
				}
			}
		}
	}
	fmt.Println(max)
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


Measured memory_bytes: 640
//
//  main.cpp
//  ProgrammingContestChallengeBook2
//
//  Created by Hisaki Kobayashi on 2020/04/04.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <string>
#include <bits/stdc++.h>
#include <stdlib.h>
//#include "mylibrary.hpp"



using namespace std;


int main(){
    int A,B;
    cin >> A >> B;
    
    for(int x=1.0;x<1300;x++){
        int floor_x_A = (int)floor((double)((x*8.0)/100.0));
        int floor_x_B = (int)floor((double)((x*10.0)/100.0));
        
        if(floor_x_A == A && floor_x_B == B){
            cout << x << endl;
            return 0;
        }
    }
    cout <<-1<<endl;
    return 0;
 
}


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

using ll=long long;

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

const ll INF = 1LL << 60;

int N;
ll h[100010];
ll dp[100010];

int main(){
  cin >> N;
  for (int i=0;i<N;i++)
    cin >> h[i];
  for (int i=0;i<100010;i++)
    dp[i]=INF;
  dp[0]=0;
  for (int i=0;i<N;i++){
    chmin(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
    chmin(dp[i+2],dp[i]+abs(h[i+2]-h[i]));
  }
  cout << dp[N-1] << endl;
  
}

Measured memory_bytes: 1920
import sys
# input = sys.stdin.buffer.readline
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    """ Union-Find木の実装（ランクあり） """
    def __init__(self, n):
        self.n = n
        self.parent = [-1]*(n+1)    # parent 親 マイナスだったら根で、絶対値が集合の数
        self.rank   = [0]*(n+1)     # rank 深さ

    def root(self, x):
        """ 木の根を求める """
        if self.parent[x] < 0:      # xが根
            return x
        else:
            self.parent[x] = self.root(self.parent[x])  # 経路圧縮
            return self.parent[x]
            
    def unite(self, x, y):
        """ xとyの属する集合を併合 """
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return 0
        elif self.rank[x] > self.rank[y]:
            self.parent[x] += self.parent[y]
            self.parent[y] = x
        else:
            self.parent[y] += self.parent[x]
            self.parent[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def isSame(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.root(x) == self.root(y) or x==y
    
    def size(self, x):
        """ xと同じ集合に属する数 """
        return -self.parent[self.root(x)]


N, M, K = map(int, input().split())
uf = UnionFind(N)
friends = [[] for _ in range(N)]
blocks = [[] for _ in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    A -= 1; B -= 1
    uf.unite(A, B)
    friends[A].append(B)
    friends[B].append(A)
for i in range(K):
    C, D = map(int, input().split())
    C -= 1; D -= 1
    blocks[C].append(D)
    blocks[D].append(C)

ans = [0] * N
for i in range(N):
    ans[i] = uf.size(i) - 1   # 自分を除外
    ans[i] -= len(friends[i]) # 既に友達を除外
    block_num = 0
    for j in blocks[i]:
        if uf.isSame(i,j):
            block_num += 1
    ans[i] -= block_num

print(*ans)


Measured memory_bytes: 47588
#include <bits/stdc++.h>
using namespace std ;
const int maxn = 105 ;
int n ;
int t[maxn] ;
char s[maxn][maxn] ;
char sl[maxn] ;
bool same(int now)
{
	int len = strlen(sl) ;
	if(strlen(s[now]) != len)  return 0 ;
	for(int i = 0 ; i < len ; i ++)
	  if(sl[i] != s[now][i])  return 0 ;
	return 1 ;
}
int main()
{
	scanf("%d" , &n) ;
	for(int i = 1 ; i <= n ; i ++)
	  scanf("%s%d" , s[i] , &t[i]) ;
	scanf("%s" , sl) ;
	int ans = 0 ;
	for(int i = 1 ; i <= n ; i ++)
	{
		if(same(i))
		{
			for(int j = i + 1 ; j <= n ; j ++)
			  ans += t[j] ;
		}
	}
	printf("%d\n" , ans) ;
	return 0 ;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
str_list=[list(input()) for i in range(h)]


str_list.append(["."]*w)
str_list.insert(0,["."]*w)
for i in range(h+2):
    str_list[i].append(".")
    str_list[i].insert(0,".")

ans = [[0]*w for i in range(h)]

baku = 0

for i in range(h):
    for j in range(w):
        if str_list[i+1][j+1] == "#":
            ans[i][j] = "#"
            continue
        
        baku = 0
        for a in range(3):
            for b in range(3):

                if a == 1 and b==1:
                    continue
                if str_list[i+a][j+b]=="#":
                    baku += 1
        
        ans[i][j] = baku
            

for i in range(h):
    a = ""
    a = str(a)
    for j in ans[i]:
        a += str(j)

    print(a)


Measured memory_bytes: 42224
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

int main() {
	IOS;
	ll x;
	cin >> x;
	int ans = 114514;
	for (ll i = 1; i <= sqrt(x); i++) {
		if (x % i == 0) {
			int a = getdigit(i), b = getdigit(x / i);
			ans = min(max(a, b), ans);
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $n);
$l = array_map('intval', explode(' ', trim(fgets(STDIN))));
$max = $sum = 0;
for ($i = 0; $i < $n; $i++) {
    $sum += $l[$i];
    $max = max($l[$i], $max);
}
$ans = 2 * $max < $sum ? 'Yes' : 'No';
echo $ans . PHP_EOL;

Measured memory_bytes: 4604
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
ll count(ll x){
    if(x<10)return x;
    return x%10 + count(x/10);
}
int main(){
    ll n;
    cin >> n;
    ll ans = 1000000;
    for(int i=1; i<n; ++i){
        ans = min(ans, (count(i)+count(n-i)));
    }
    cout << ans << endl;
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  string s[h];
  for (int i = 0; i < h; i++)
  {
    cin >> s[i];
  }

  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
    {
      if (s[i][j] != '#')
      {
        int c = 0;
        for (int a = -1; a <= 1; a++)
        {
          for (int b = -1; b <= 1; b++)
          {
            if (0 <= i + a && i + a < h && 0 <= b + j && b + j < w && s[i + a][b + j] == '#')
            {
              c++;
            }
          }
        }
        s[i][j] = '0' + c;
      }
    }
  }
  for (int i = 0; i < h; i++)
  {
    cout << s[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string team[10];
int point[10];
bool isfirst = true;
int main(){
  int n,temp,cur;
  string name;
  while(1){
    cin >> n;
    if(n == 0)return 0;
    if(!isfirst){
      cout << endl;
    }
    for(int i = 0;i < n;i++){
      cin >> team[i];
      cin >> temp;
      point[i] += temp*3;
      cin >> temp;
      cin >> temp;
      point[i] += temp;
    }
    for(int j = 0;j < n;j++){
      for(int i = cur = 0;i < n;i++){
	if(point[i] > point[cur]) cur = i;
      }
      cout << team[cur] << ',' << point[cur] << endl;
      point[cur] = -1;
    }
    for(int i = 0;i < 10;i++){
      point[i] = 0;
    }
    isfirst = false;
  }
  return 0;
}

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

int main(){
    int n,k; cin >> n >> k;
    if(k>((n-1)*(n-2)/2)){
        cout << -1 << endl;
        return 0;
    }
    int count=(n-1)*(n-2)/2;
    cout << ((n*(n-1))/2)-k << endl;
    rep(i,n-1){
        for(int j=i+1; j<n; j++){
            if(i==0){
                cout << i+1 << ' ' << j+1 << endl;
                continue;
            }
            if(count<=k) return 0; 
            cout << i+1 << ' ' << j+1 << endl;
            k++;
        }
    }
return 0;
}


Measured memory_bytes: 256