akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define forr(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define oo 1000000000000000000LL
using namespace std;



void _sol(){
    int n; cin >> n;
    int a[n];
    forr(i,n) cin >> a[i];
    sort(a,a+n,greater<int>());
    ll ans = a[0] , i=1;
    n-=2;
    while(n>0){
        ans = (ans + (ll)a[i]*min(2LL,(ll)n));
        n-=2;
        i++;
    }
    cout << ans;
    
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t = 1; //cin >> t;
    while(t--) _sol();
}


Measured memory_bytes: 4448
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

num = na()
num.sort(reverse=True)
print(int(str(num[0])+str(num[1])) + num[2])

Measured memory_bytes: 5076
#include <stdio.h>

int main(void) {

	int a = 0, b = 0;
	int i = 0, j = 0;
	int flg = 1;
	char zip[100] = "";
	
	scanf("%d %d", &a, &b);
	scanf("%s", zip);

	while (zip[i] != '\0') {
		
		if (i < a && (zip[i] == '-')) {
			flg = 0;
			break;
		}
		else if ((i == a) && !(zip[i] == '-')) {
			flg = 0;
			break;
		}
		else if ((i > (a + 1)) && (zip[i] == '-')) {
			flg = 0;
			break;
		}

		if (i > (a + 1)) {
			j++;
		}
		i++;
	}

	if (j > 5)
		flg = 0;

	if (((a + b + 1) == i) && flg == 1) {
		printf("Yes\n");
	}
	else
		printf("No\n");


	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(input())
char = "".join(chr(97+i) for i in range(n))

def dfs(s, idx):
    if len(s) == n:
        print(s)
    else:
        for i in range(idx):
            dfs(s+char[i], idx if i+1 != idx else idx+1)


dfs("a", 2)

Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =2e5+10;
const int mod=1e9+7;

int mp[3005];



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int n=s.size();
    ll ans=0;
    ll now=0;
    mp[0]=1;
    ll c=1;
    for(int i=0;i<n;i++)
    {
        int x=s[i]-'0';
        if(i!=0)
            c*=10;
        c%=2019;
        x*=c;
        x%=mod;
        now+=x;
        now%=2019;
        ans+=mp[now];
        mp[now]++;

    }
    cout<<ans<<'\n';





}


Measured memory_bytes: 3724
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int d = a / b;
		int r = a % b;
		String f = String.format("%.5f", (double)a / b);

		System.out.println(d + " " + r + " " + f);		
	}
}

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int N;


// *********************************************************
int main(){

    cin >>  N;

    cout << N + pow(N,2) + pow(N,3)<< endl;




    return 0;
}

Measured memory_bytes: 4140
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, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

	x, y := next(), next()
	if x[0] == y[2] && x[1] == y[1] && x[2] == y[0] {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll n,m,s;
ll sum;
class V
{
	public: ll to,cost,time;
	public: V(ll to,ll cost,ll time)
	{
		this->to = to;
		this->cost = cost;
		this->time = time;
	}
};
vector<V> G[50];
ll C[50],D[50];
ll DIS[50][2501];
const ll INF = 1e18;

class P
{
	public: ll v,time,gin;
	public: P(ll v,ll time,ll gin)
	{
		this->v = v;
		this->time = time;
		this->gin = gin;
	}
	
};
bool operator<(const P &a,const P &b)
{
	return a.time>b.time;
}

void dijkstra(ll gin)
{
	
	priority_queue<P> PQ;
	PQ.emplace(0,0,min(0LL+2500,gin));
	DIS[0][min(0LL+2500,gin)]=0;
	/*
	for(ll i = 0 ;;i++)
	{
		if(gin+i*C[0]>2500)
		{
			DIS[0][2500] = i*D[0];
			PQ.emplace(0,DIS[0][2500],2500);
			break; 
		}
			DIS[0][gin+i*C[0]] = i*D[0];
			PQ.emplace(0,DIS[0][gin+i*C[0]],gin+i*C[0]);
	}
	*/
	while(!PQ.empty())
	{
		//cout<<PQ.size()<<endl;
		auto now = PQ.top();
		ll v = now.v;
		PQ.pop();
		
		//cout<<v<<endl;
		//今交換できる分交換する；
		if(DIS[v][now.gin]<now.time)continue;
		for(ll i = 1;i<2;++i)
		{
			if(now.gin+i*C[v]>2500)
			{
				
				if(DIS[v][2500]>now.time+i*D[v])
				{
					DIS[v][2500] = now.time+ i*D[v];
					PQ.emplace(v,DIS[v][2500],2500);
				}
				break;
			}
			if(DIS[v][now.gin+i*C[v]]>now.time+i*D[v])
			{
				DIS[v][now.gin+i*C[v]] = now.time + i*D[v];
				PQ.emplace(v,DIS[v][now.gin+i*C[v]],now.gin+i*C[v]);
			}
		}
		for(auto &next:G[v])
		{
			//	if(v==0&&now.time==10)cout<<';'<<next.to<<' '<<now.time+next.time<<' '<<gin<<endl
			//	<<DIS[next.to][now.gin-next.cost]<<endl;
			if(now.gin-next.cost<0)continue;
			if(DIS[next.to][now.gin-next.cost]>now.time+next.time)
			{
				DIS[next.to][now.gin-next.cost]=now.time+next.time;
				PQ.emplace(next.to,DIS[next.to][now.gin-next.cost],now.gin-next.cost);
			}
		}
		
	}
}

int main()
{
	for(ll i = 0;i<50;i++)
	{
		for(ll j = 0;j<2501;j++)
		{
			DIS[i][j] = INF;
		}
	}
	cin >> n >> m >> s;
	for(ll i = 0;i<m;i++)
	{
		ll u,v,a,b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		G[u].emplace_back(v,a,b);
		G[v].emplace_back(u,a,b);
		sum +=a;
	}

	for(ll i = 0;i<n;++i)
	{
		cin >> C[i] >> D[i];
	}
	dijkstra(s);
	for (ll i = 1; i < n; i++)
	{
		ll ans = INF;
		for (ll j = 0; j < 2501; j++)
		{
			ans = min(ans,DIS[i][j]);
			//if(DIS[i][j]==15)cout<<';'<<j<<endl;
		}
		cout<<ans<<endl;
	}
	//cout<<DIS[2][0]<<endl;

	
}

Measured memory_bytes: 7332
// 基本のinclude
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define invrep(i,n) for(int i = (int)(n); i > 0; i++)
using ll = long long;

int main() {
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];

    ll ans = 0;
    rep(i, n-1) {
        if (a[i+1] - a[i] < 0){
            ans += abs(a[i+1] - a[i]);
            a[i+1] += abs(a[i+1] - a[i]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5196
n = input()
num_list = list(n)
num_list = [int(i) for i in num_list]
for i in range(3):
  if num_list[i] == 1:
    num_list[i] = 9
  elif num_list[i] == 9:
    num_list[i] = 1
print(''.join([str(i) for i in num_list]))

Measured memory_bytes: 3060
#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 fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 998244353
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 100003
#define pc(x) putchar_unlocked(x);
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int n,m,p[mx],par[mx],jaw,u,v,di[mx];

int find(int aa){
	if(aa==par[aa])return aa;
	return par[aa]=find(par[aa]);
}

int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		par[i]=i;
	}
	for(int i=1;i<=m;i++){
		cin>>u>>v;
		int x=find(u);
		int y=find(v);
		if(x==y)continue;
		par[x]=y;
	}
	for(int i=1;i<=n;i++){
		di[p[i]]=find(i);
	}
	for(int i=1;i<=n;i++){
		if(di[i]==find(i)){
			jaw++;
		}
	}
	cout<<jaw;
}




Measured memory_bytes: 1408
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

// aaabcca/aaabcca
int main(void) {
    string str;
    cin >> str;
    int len =str.length();
    str.push_back('\n');
    int k;
    cin >> k;
    vector<int> arr;
    char prev = str[0];
    int cnt = 1;
    for(int i = 1; i < str.length(); i++) {
        char cur = str[i];
        if(prev == cur) {
            cnt++;
        } else {
            arr.push_back(cnt);
            cnt = 1;
        }
        prev = cur;
    }
    ps(arr);

    int64_t sum = 0;
    if(arr.size() == 1) {
        sum = ((int64_t)arr[0] * k)/2;
    } else {
        for(int i = 1; i < arr.size()-1; i++) {
            sum += (arr[i]/2);
        }
        sum *= k;
        int64_t edge = (*arr.begin())/2 + (*(arr.end()-1))/2;
        if(str[0] != str[len-1]) {
            // (head + tail) * k
            sum += edge * k;
        } else {
            // head + (conn)*(k-1) + tail
            int conn = ((*arr.begin()) + (*(arr.end()-1)))/2;
            sum += edge + (int64_t)conn * (k-1);
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  char c;
  while(cin>>n){
    if(n==0) break;
    int a[n],b=0;
    for(int i=0;i<n;i++) a[i] = 0;
    for(int i=0;i<100;i++){
      cin >> c;
      a[i%n]++;
      if(c=='S'){
	b += a[i%n];
	a[i%n] = 0;
      }
      else if(c=='L'){
	a[i%n] += b;
	b = 0;
      }
    }
    sort(a,a+n);
    for(int i=0;i<n;i++) cout << a[i] << ' ';
    cout << b << endl;
  }
  return 0;
}

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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var cin = GetIntArray();
            var ans = cin[2] / cin[0] * cin[1];

            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

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

int main()
{
    int n,x,fx = 0;
    cin >> n;
    x = n;
    while(n){
        fx += n % 10;
        n /= 10;
    }

    cout << (x % fx == 0 ? "Yes" : "No") << endl;

    return 0;
}

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

//vector <long long> v[1000001];

//stack <long long> s, s2;

//queue <long long> s;

long long int  x[2000000], y[10000], m=0, szu, wy;
//char s[10000000];

int main()
{
    long long int d, e, f, i, j, q, t, n, k, a, b, c, w, p, aa, bb, cc, dd, nn, kk;
    t=1;
 //   scanf("%lld", &t);
    for(q=1; q<=t; q++)
    {
        scanf("%lld", &n);

        a=1;
        b=2;
        c=1;

        for(i=0; i<n; i++)
        {
            a*=10;
            b*=9;
            c*=8;
            a%=1000000007;
            b%=1000000007;
            c%=1000000007;
        }

        w=a-b+c+1000000007;
        w%=1000000007;

        printf("%lld\n", w);
    }
    return(0);
}



Measured memory_bytes: 3756
from collections import deque
def bfs(G, s):
    cost=[-1]*len(G)
    cost[s]=1
    deq=deque([s])
    while deq:
        u=deq.popleft()
        for v in G[u]:
            if cost[v]<0:
                cost[v]=cost[u]+1
                deq.append(v)
            elif abs(cost[u]-cost[v])!=1:
                return -1
    return max(cost)

def main():
    N=int(input())
    S=[[bool(int(i)) for i in input()] for _ in range(N)]
    G=[[] for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if S[i][j]:
                G[i].append(j)
    print(max(bfs(G,i) for i in range(N)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3956
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n = read::<usize>();
    let p:Vec<u32> = (0..n).map(|_| read()).collect();

    let mut ans:u32 = 0;
    for i in 1..n-1 {
        if p[i-1] < p[i] && p[i] < p[i+1] || p[i-1] > p[i] && p[i] > p[i+1] {
            ans+=1;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>

#define INT unsigned long long int
#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define PINT(d) printf("%d\n", d);
#define PDOUBLE(lf) printf("%lf\n", lf);
#define PSTR(s) printf("%s\n", s);
#define ALL(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX_N 100000

using namespace std;

main(){
	INT n;
	cin >> n;
	priority_queue<INT, vector<INT>, greater<INT>> queue;
	map<INT, INT> m;
	INT tmp;
	
	FOR1(n){
		cin >> tmp;
		queue.push(tmp);
		m[tmp] = i;
	}
	INT ans = 0;
	FOR1(n){
		tmp = queue.top(); queue.pop();
		if(i % 2 != m[tmp] % 2){
			ans++;
		}
	}
	cout << ans / 2;
}

Measured memory_bytes: 7412
#include<stdio.h>
int main(){
  int h;
  int w;
  int n;
  int ans;
  scanf("%d %d %d",&h,&w,&n);
  if(h>w){
    if(n%h==0){
      ans=n/h;
    }
    else ans=1+n/h;
  }
  else {
    if(n%w==0){
      ans=n/w;
    }
    else ans=1+n/w;
  }
  printf("%d",ans);
  return 0;
}

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

using namespace std;

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i)
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i)

#define DEBUG(...) fprintf(stderr , __VA_ARGS__)

template<typename T>inline int chkmin(T &x , const T &y){ return x > y ? x = y , 1 : 0; }
template<typename T>inline int chkmax(T &x , const T &y){ return x < y ? x = y , 1 : 0; }

template<typename T>inline T read(T &f)
{
	f = 0 ; int x = 1 ; char c = getchar();
	while(!isdigit(c)) x = c == '-' ? -1 : 1 , c = getchar();
	while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
	return f *= x;
}

using int64 = long long;
using uint64 = unsigned long long;

int64 n , Ans;

int main()
{
	read(n);
	Ans = n * (n - 1) / 2;
	cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 256
s=raw_input()
str="".join(reversed(s))

dict={}

dict[0]=1

ans=0

sumee=0
ans22=1


for i in str:
	x=sumee+ans22*(ord(i)-ord('0'))
	x=x%2019
	if x in dict:
		ans+=dict[x]
	if x not in dict:
		dict[x]=0
	dict[x]+=1
	sumee=x
	ans22=(ans22*10)%2019

print(ans)


Measured memory_bytes: 86264
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    Int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }
    return 0;
}



Measured memory_bytes: 3576
#include<iostream>

using namespace std;

typedef unsigned long long ULL;

typedef struct{
    ULL time;
    ULL deadline;
}WORK;
void margsort(WORK *work, int start,int end);
int main(){
    int N;
    int i;
    WORK *work;
    ULL time;
    cin >> N;
    work = new WORK[N];
    for(i=0;i<N;i++){
        cin >> work[i].time >> work[i].deadline;
    }
    
    margsort(work,0,N-1);
    time = 0;
/*
    cout << endl;
    for(i=0;i<N;i++){
        cout << work[i].time << " " << work[i].deadline << endl;
    }
*/
    for(i=0;i<N;i++){
        time += work[i].time;
        if( time > work[i].deadline){
            break;
        }
    }
    if( i == N){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}
void margsort(WORK *work, int start,int end){
    int mid = ( start + end ) / 2;
    WORK temp;
    WORK *temps;
    int left,right,num,i;
    
    if( start >= end)
        return;
    margsort(work,start,mid);
    margsort(work,mid+1,end);
  //  cout << "start:" << start << " mid:"<<  mid << " end:" << end << endl;
    temps = new WORK[end - start + 1];
    num = 0;
    left = start;
    right = mid+1;
    while(left <= mid || right <= end){
        if( left <= mid && right <= end){
            if( work[left].deadline < work[right].deadline ){
                temps[num++] = work[left++];
            }else{
                temps[num++] = work[right++];
            }
        }else if( left <= mid){
            temps[num++] = work[left++];
        }else{
            temps[num++] = work[right++];
        }
    }
    for(i=0;i<num;i++){
        work[start + i] = temps[i];
    }
    delete [] temps;
}


Measured memory_bytes: 8072
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = in.nextInt();
			}
			int[] b = new int[n];
			for (int i = 0; i < n; i++) {
				b[i] = in.nextInt();
			}
			int[] c = new int[n];
			for (int i = 0; i < n; i++) {
				c[i] = in.nextInt();
			}
			Arrays.sort(a);
			Arrays.sort(b);
			Arrays.sort(c);
			long ans = 0;
			int pa = 0;
			int pc = 0;
			for (int x : b) {
				pa = Math.max(pa, 0);
				while (pa < n && a[pa] < x) {
					++pa;
				}
				--pa;
				while (pc < n && c[pc] <= x) {
					++pc;
				}
				long u = pa + 1;
				long v = Math.max(n - pc, 0);
				ans += u * v;
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

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

	}
}



Measured memory_bytes: 54380
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll i,j,k,m,n,t;
	cin>>k>>n;
	ll ar[n];
	for(i=0;i<n;i++)
	{
		cin>>ar[i];
	}
	ll mx=0;
	sort(ar,ar+n);
	for(i=1;i<n;i++)
	mx=max(mx,ar[i]-ar[i-1]);
	mx=max(mx,k-(ar[n-1]-ar[0]));
	cout<<k-mx;
}

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

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



int main() {
    int K;
    cin >> K;
    long long sum = 0;
    for(int i=1; i<=K; i++){
        for(int j=1; j<=K; j++){
            for(int k=1; k<=K; k++){
                sum += __gcd(__gcd(i,j),k);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <fstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
using namespace std;
  
struct point {
	double x,y;
} p[8];  
double dist(point a, point b) {
	return sqrt(pow((b.x-a.x),2) + pow((b.y-a.y),2));
}
int main() {
	int n;
	cin>>n;
	vector<int> v;
	for (int i=0; i<n; i++) {
		double x,y;
		cin>>x>>y;
		p[i].x = x;
		p[i].y = y;
		v.push_back(i);
	}
	
	vector<double> d;
	int cnt = 0;
	do {
		for (int i=0; i<(int)v.size()-1; i++) {
			//cout <<"dist=>"<< v[i]+1 <<"-" << v[i+1]+1 <<" "; 
			double distance = dist(p[v[i]], p[v[i+1]]);
			d.push_back(distance);
		}
		cnt++;
	} while(next_permutation(v.begin(), v.end()));
	
	double ans = 0.0;
	for (int i=0; i<(int)d.size(); i++) {
		ans+=d[i];
	}
	printf("%.6f", ans/(double)cnt);
  return 0;
}

Measured memory_bytes: 6384
/* ***********************************************
Author        :yang12138
Created Time  :2017年05月06日 星期六 20时47分46秒
File Name     :1.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};

const int N=805;
char s[N][N];
int dis[N][N];

queue<pii>que;

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	int h,w,k;
	scanf("%d%d%d",&h,&w,&k);

	pii S;
	for(int i=1;i<=h;i++){
		scanf("%s",s[i]+1);
		for(int j=1;j<=w;j++)
			if(s[i][j]=='S') S.first=i,S.second=j,s[i][j]='.';
	}


	mem(dis,0x3f);

	que.push(S);
	dis[S.first][S.second]=0;

	while(!que.empty()){
		int x,y;
		tie(x,y)=que.front();
		que.pop();
		for(int i=0;i<4;i++){
			int nx=x+dx[i];
			int ny=y+dy[i];
			if(nx>=1 && nx<=h && ny>=1 && ny<=w){
				if(s[nx][ny]=='#') continue;
				if(dis[nx][ny]!=0x3f3f3f3f) continue;
				dis[nx][ny]=dis[x][y]+1;
				if(dis[nx][ny]>k) continue;
				que.push(pii(nx,ny));
			}
		}
	}

	int ans=10000000;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(dis[i][j]>k) continue;
			int tmp=1000000;
			tmp=min(tmp,i-1);
			tmp=min(tmp,j-1);
			tmp=min(tmp,h-i);
			tmp=min(tmp,w-j);
			ans=min(ans,(tmp+k-1)/k+1);
		}
	}
	printf("%d\n",ans);


}


Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		int count =0;
		while (A>=B) {
			B*=2;
			count ++;
		}
		while (B>=C) {
			C*=2;
			count ++;
		}
		if (count <=K) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35652
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 1e9+7;
//}}}

int p[10];
int c[10];

int main(){
  int D, G;
  cin >> D >> G;
  int ans = 10000;
  rep(i, D){
    cin >> p[i];
    cin >> c[i];
  }
  rep(i, 1 << D){
    int sum = 0;
    int count = 0;
    rep(j, D){
      if((i >> j) & 1){
        count += p[j];
        sum += c[j];
        sum += p[j] * (j + 1) * 100;
      }
    }
    for(int j = D - 1; j >= 0; j--){
      if(sum >= G)break;
      if(!((i >> j) & 1)){
        if(sum + p[j] * (j + 1) * 100 < G){
          count += p[j];
          sum += p[j] * (j + 1) * 100;
        }else{
          int n = (G - sum + (((j + 1) * 100) - 1)) / ((j + 1) * 100);
          count += n;
          break;
        }
      }
    }
    ans = min(count, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
      int W,H,x,y,r;
      scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
        if (x-r<0)
            printf("No\n");
        else if (W<x+r)
            printf("No\n");
        else if (y-r<0)
            printf("No\n");
        else if (H<y+r)
            printf("No\n");
        else printf ("Yes\n");

return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int n;
ll dp[101][21];

int main(void){
  int a;
  cin>>n;
  cin>>a;
  dp[0][a] ++;

  for(int i = 1 ; i < n - 1 ; i ++){
    cin>>a;
    for(int j = 0 ; j <= 20 ; j ++){
      if( j - a >= 0){
	dp[i][j-a] += dp[i-1][j];
      }
      if( j + a <= 20){
	dp[i][j+a] += dp[i-1][j];
      }
    }
  }
  cin>>a;
  cout<<dp[n-2][a]<<endl;

}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
int i,j,k,n;
int x;
bool y;
char a[20000];
int main()
{
	gets(a);
	n=strlen(a);
	for(i=0;i<n;i++)
	{
		if(a[i]=='C')
			x=-1;
		if(a[i]=='F' && x==-1)
		{
			cout<<"Yes";
			return 0;
		}	
	}
	cout<<"No";
	return 0;
}

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

int main() {
    char a, b;
    cin >> a;
    for (int i = 1; i < 4; i++) {
        cin >> b;
        if (a == b) {
            cout << "Bad" << endl;
            break;
        }
        else if (i == 3) cout << "Good" << endl;
      	else a = b;
    }
}

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

int main() {
    ll N, M;
    cin >> N >> M;
    vector<vector<ll>> G(N);
    for (ll i=0; i<M; i++) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<ll> dist(N,-1);
    queue<ll> que;
    ll ans = 0;
    for (ll i=0; i<N; i++) {
        if (dist[i]!=-1) continue;
        dist[i] = 1;
        que.push(i);
        while(!que.empty()) {
            ll v = que.front();
            que.pop();
            for (ll nv : G[v]) {
                if (dist[nv] == -1) {
                    dist[nv] = 1;
                    que.push(nv);
                }
            }
        }
        ans++;
    }
    ans--;
    cout << ans << endl;
}

Measured memory_bytes: 10140
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
ll n; 
struct node
{
	vll adj;
    ll colour;
};
void dfs(node N[], bool vis[], ll i, ll parent=-1)
{
    vis[i]=true;
    if(parent!=-1)
    {
        N[i].colour = 1 - N[parent].colour;
    }
    for(auto x: N[i].adj)
    {
        if(!vis[x])
        {
            dfs(N,vis,x,i);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n=3,k;
    cin>>k;
    ll dp[k+1];
    ll tot=0;
    for(ll i=k;i>k/2;i--)
    {
        dp[i]=1;
        tot = mymod(tot + i*dp[i], num);
    }
    for(ll i=k/2;i>=1;i--)
    {
        dp[i] = mod_exp((k/i),n,num);
        for(ll j=2*i;j<=k;j+=i)
        {
            dp[i] = mymod(dp[i] - dp[j], num);
        }
        tot=mymod(tot+ i*dp[i], num);
    }
    cout<<tot<<endl;
    return 0;
}


Measured memory_bytes: 3664
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let s: Vec<String> = (0..n).map(|_| read()).collect();

    let mut ans = String::new();

    for c in 0..26 {
        let c = (c + 97u8) as char;
        let cn = s
            .iter()
            .map(|s| s.chars().filter(|&c_| c_ == c).count())
            .min()
            .unwrap_or(0);
        for _ in 0..cn {
            ans.push(c);
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=1e9+7;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
int N,M;
vi p;
vi concomp[114514];
struct UnionFind {
	vector<int> data;
	void init(int n) { data.assign(n, -1); }
	bool 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;
		}
		return x != y;
	}
	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)]; }
};
int main(){
	cin>>N>>M;
	for(int i=0;i<N;i++){
		int x;
		cin>>x;x--;
		p.pb(x);
	}
	UnionFind Uf;
	Uf.init(N);
	for(int i=0;i<M;i++){
		int x,y;
		cin>>x>>y;x--;y--;
		Uf.unionSet(x,y);
	}
	for(int i=0;i<N;i++){
		int oya=Uf.root(i);
		concomp[oya].pb(i);
	}
	int ans=0;
	for(int i=0;i<N;i++){
		set<int> ktya;
		for(int j=0;j<concomp[i].size();j++){
			int now=concomp[i][j];
			ktya.insert(now);
			ktya.insert(p[now]);
		}
		ans+=(2*concomp[i].size()-ktya.size());
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 9080
from itertools import accumulate
Q = int(input())
m = 0
ls = []
for i in range(Q):
    l, r = map(int, input().split())
    m = max(m, max(l, r))
    ls.append((l, r))

def sieve_eratosthenes(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

a = sieve_eratosthenes(m)
b = [0 for i in range(m+1)]
for i in range(2, m+1):
    if i%2 == 1 and a[i] == 1 and a[(i+1)//2] == 1:
        b[i] = 1
c = list(accumulate(b))
for l, r in ls:
    print(c[r] - c[l-1])


Measured memory_bytes: 27236
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 300005;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
  IOS
   
  ld a,b;
  cin>>a>>b;
  a*=b;
  ll x = floor(a);
  cout<<x<<endl;

  
  

}
 

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  int i,min=1;
  for(i=0;i<N;i++){
    if( (min+K)<=(min*2) ){
      min += K;
    }else{
      min *= 2;
    }
  }
  cout << min << endl;
 
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};



int main()
{
    llong a,b;
    cin>>a>>b;
    if(abs(a-b)<=1) cout<<"Brown"<<endl;
    else cout<<"Alice"<<endl;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if((x - r >= 0 && y - r >= 0) && (x + r <= W && y + r <= H))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define repe(i, a, b) for (ll i = (a); i <= (b); i++)

template<class T> inline bool chmax(T& a, T b){
  if (a < b) { a = b; return true; } return false;
}
ll INF = 1LL<<60;

int dp[100010] = {0};

int
main(void)
{
  int n; cin >> n;
  repe(i, 0, n) dp[i] = i;

  for(int i = 0; i <= n; i++){
    for(int k = 1; i + pow(6, k) <= n; k++){
      int index = pow(6, k);
      dp[i + index] = min(dp[i + index], 1 + dp[i]);
    }
  }

  for(int i = 0; i <= n; i++){
    for(int k = 1; i + pow(9, k) <= n; k++){
      int index = pow(9, k);
      dp[i + index] = min(dp[i + index], 1 + dp[i]);
    }
  }


  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 640
import sys

I = list(map(int, input().split()))
H = I[0]
A = I[1]
count = 0

if not 1 <= H or not H <= 10**4 or not 1 <= A or not A <= 10**4:
    print("error:1≤H≤10000,1≤A≤10000である必要があります")
    sys.exit()
# print("H =",H, "A =",A)

while True:
    H -= A
    count += 1
    # print("H =",H, "A =",A)
    if H <= 0:
        break
print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

void dfs(int v, const vector<vector<int>>& to, const int& label,
         vector<bool>& isvisit, vector<int>& labels,
         unordered_map<int, int>& mp)
{
    isvisit[v] = true;
    labels[v] = label;
    for (auto& u : to[v]) {
        if (isvisit[u]) continue;
        isvisit[u] = true;
        labels[u] = label;
        mp[label]++;
        dfs(u, to, label, isvisit, labels, mp);
    }
    return;
}

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> to(n);
    vector<bool> isvisit(n, false);
    vector<int> labels(n);
    vector<int> ans(n, 0);
    unordered_map<int, int> mp;
    int a, b, c, d;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
        ans[a]--;
        ans[b]--;
    }
    int label = 0;
    for (int i = 0; i < n; i++) {
        if (!isvisit[i]) {
            mp[label] = 0;
            dfs(i, to, label, isvisit, labels, mp);
            label++;
        }
    }
    for (int i = 0; i < n; i++) { ans[i] += mp[labels[i]]; }
    for (int i = 0; i < k; i++) {
        cin >> c >> d;
        c--;
        d--;
        if (labels[c] == labels[d]) {
            ans[c]--;
            ans[d]--;
        }
    }
    for (int i = 0; i < n; i++) { cout << ans[i] << " "; }
    cout << endl;
}

Measured memory_bytes: 9472
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		int ans = 0;
		for(int i = 0;i<s.length();i++) {
			if(i==s.length()-2) {
				if(s.charAt(i)==s.charAt(i+1)) {
					i++;
				}
			}else if(i!=s.length()-1){
				if(s.charAt(i)==s.charAt(i+1)) {
					i++;
					ans++;
					i++;
				}
			}
			ans++;
		}
		System.out.println(ans);
		scn.close();
	}
}

Measured memory_bytes: 25936
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }



main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    for (int i = -4000; i < 4000; i++) {
        for (int j = -4000; j < 4000; j++) {
            if (i * i * i * i * i - j * j * j * j * j == x) {
                cout << i << ' ' << j << '\n';
                rr;
            }
        }
    }
    throw 4;
}


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

typedef long long ll;

const ll M = 1000000000+7;

int main() {
    int K;
    ll x;
    cin >> K;
    queue<ll>Q;
    for (int i = 1; i <= 9; i++) {
        Q.push(i);
    }

    for (int i = 0; i < K; i++) {
        x = Q.front();
        Q.pop();
        if (x % 10 != 0) {
            Q.push(10*x+(x%10)-1);
        }
        Q.push(10*x+(x%10));
        if (x % 10 != 9) {
            Q.push(10*x+(x%10)+1);
        }
    }
    cout << x << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int count = 0;
    for(int i=1;i<=N;i++){
      String lit = Integer.toString(i);
      if(lit.length()%2==1){
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 27604
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll a[L];
void fff()
{
	int n;
	cin >> n;
	ll x = 0;
	FOR(i,0,n)
	{
		cin >> a[i];
		x ^= a[i];
	}
	FOR(i,0,n)cout<<(x^a[i])<<" ";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 5148