akhauriyash/Code-Regression huggingface dataset:
//
// Created by kota_ on 2019/12/28.
//
#include <stdio.h>
#include <stdlib.h>
#define max(x, y) (x > y ? x : y)

typedef struct node{
    int id;
    struct node *child_left;
    struct node *child_right;
    struct node *parent;
}Node;

typedef Node* Nodepointer;


Node make_1node(int id){
    Node ret;
    ret.id = id;
    ret.child_left = NULL;
    ret.child_right = NULL;
    ret.parent = NULL;
    return ret;
}

int get_parent_value(Nodepointer);
int get_degree(Nodepointer);
int get_sibling_value(Nodepointer);
int get_depth(Nodepointer);
int get_height(Nodepointer);

int main(){
    int i, j, n, id, depth;
    Nodepointer nodes, parent;
    scanf("%d", &n);
    nodes = malloc(sizeof(Node) * n);
    for(i = 0; i < n; i++){
        // nodeを全部初期化
        nodes[i] = make_1node(i);
    }
    for(i = 0; i < n; i++){
        scanf("%d", &id);
        parent = &nodes[id];
        for(j = 0; j < 2; j++){
            scanf("%d", &id);
            if(id == -1){
                continue;
            }
            if(j == 0){
                parent->child_left = &nodes[id];
            }
            else{
                parent->child_right = &nodes[id];
            }
            nodes[id].parent = parent;
        }

    }
    for(i = 0; i < n; i++){
        parent = &nodes[i];
        printf("node %d: parent = %d, sibling = %d, ",
                i, get_parent_value(parent), get_sibling_value(parent));
        printf("degree = %d, ", get_degree(parent));
        depth = get_depth(parent);
        printf("depth = %d, ", depth);
        printf("height = %d, ", get_height(parent));
        if(depth == 0){
            printf("root");
        }
        else if(parent->child_left != NULL || parent->child_right != NULL){
            printf("internal node");
        }
        else{
            printf("leaf");
        }
        printf("\n");

    }
    free(nodes);
    return 0;
}


int get_parent_value(Nodepointer target) {
    if (target->parent == NULL) {
        return -1;
    } else {
        return target->parent->id;
    }
}

int get_sibling_value(Nodepointer target){
    int ret, i;
    Nodepointer tmp;
    if(target->parent == NULL){
        return -1;
    }
    for(i = 0; i < 2; i++){
        tmp = target->parent;
        if(i == 0){
            tmp = tmp->child_right;
        }
        else{
            tmp = tmp->child_left;
        }
        if(tmp != NULL && tmp->id != target->id){
            return tmp->id;
        }
    }
    return -1;
}

int get_degree(Nodepointer target){
    return (target->child_right != NULL) + (target->child_left != NULL);
}

int get_depth(Nodepointer target){
    int depth = 0;
    while(target->parent != NULL){
        depth++;
        target = target->parent;
    }
    return depth;
}

int get_height(Nodepointer target){
    int ret1, ret2;
    ret1 = ret2 = 0;
    if(target->child_left != NULL){
        ret1 = get_height(target->child_left) + 1;
    }
    if(target->child_right != NULL){
        ret2 = get_height(target->child_right) + 1;
    }
    return max(ret1, ret2);
}



Measured memory_bytes: 2084
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <string>

#define MAX 20000
using namespace std;



int main(){
  int n;
  std::cin >> n;
  int a=n/1000;
  int b=(n-a*1000)/100;
  int c=(n-a*1000-b*100)/10;
  int d=n-a*1000-b*100-c*10;

  if((a+b+c+d)==7){
    std::cout << a<<"+"<<b<<"+"<<c<<"+"<<d <<"=7"<< '\n';
  }else if((a+b+c-d)==7){
    std::cout << a<<"+"<<b<<"+"<<c<<"-"<<d <<"=7"<< '\n';
  }else if((a+b-c+d)==7){
    std::cout << a<<"+"<<b<<"-"<<c<<"+"<<d <<"=7"<< '\n';
  }else if((a+b-c-d)==7){
    std::cout << a<<"+"<<b<<"-"<<c<<"-"<<d <<"=7"<< '\n';
  }else if((a-b+c+d)==7){
    std::cout << a<<"-"<<b<<"+"<<c<<"+"<<d <<"=7"<< '\n';
  }else if((a-b+c-d)==7){
    std::cout << a<<"-"<<b<<"+"<<c<<"-"<<d <<"=7"<< '\n';
  }else if((a-b-c+d)==7){
    std::cout << a<<"-"<<b<<"-"<<c<<"+"<<d <<"=7"<< '\n';
  }else if((a-b-c-d)==7){
    std::cout << a<<"-"<<b<<"-"<<c<<"-"<<d <<"=7"<< '\n';
  }
}

Measured memory_bytes: 256
#input
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = str(input())

#output
dp = [True] * N
point = {"r": P, "s": R, "p": S}
answer = 0

for i in range(N):
    if i < K:
        answer += point[T[i]]
        dp[i] = False
    else:
        if T[i] == T[i-K]:
            if dp[i-K]:
                answer += point[T[i]]
                dp[i] = False
        else:
            answer += point[T[i]]
            dp[i] = False

print(answer)

Measured memory_bytes: 4084
from typing import List, Tuple


class RollingHash:
    """Rolling Hash"""

    __slots__ = ["_base", "_mod", "_hash", "_power"]

    def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
        self._base = base
        self._mod = mod
        self._hash, self._power = self._build(source)

    def _build(self, source: str) -> Tuple[List[int], List[int]]:
        """Compute "hash" and "mod of power of base" of interval [0, right)."""
        hash_, power = [0] * (len(source) + 1), [0] * (len(source) + 1)
        power[0] = 1
        for i, c in enumerate(source, 1):
            hash_[i] = (hash_[i - 1] * self._base + ord(c)) % self._mod
            power[i] = power[i - 1] * self._base % self._mod
        return hash_, power

    def get_hash(self, left: int, right: int):
        """Return hash of interval [left, right)."""
        return (
            self._hash[right] - self._hash[left] * self._power[right - left]
        ) % self._mod


def abc141_e():
    # https://atcoder.jp/contests/abc141/tasks/abc141_e
    N = int(input())
    S = input().rstrip()

    rh = RollingHash(S)
    ok, ng = 0, N // 2 + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        flg = False
        memo = set()
        for i in range(N - 2 * mid + 1):
            memo.add(rh.get_hash(i, i + mid))
            if rh.get_hash(i + mid, i + 2 * mid) in memo:
                flg = True
                break
        if flg:
            ok = mid  # next mid will be longer
        else:
            ng = mid  # next mid will be shorter

    print(ok)  # max length of substrings appeared twice or more


if __name__ == "__main__":
    abc141_e()


Measured memory_bytes: 11208
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

dif = [V[i]-C[i] for i in range(N)]
dif.sort(reverse=True)
ans = 0
for i in range(N):
    if dif[i] > 0:
        ans += dif[i]
    else:
        break

print(ans)

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n , T;
int c , t;

int main()
{
    _FastIO;

    cin >> n >> T;
    vector<pair<int , int> > v;
    while(n--){
        cin >> c >> t;
        v.push_back({t , c});
    }
    sort(v.begin() ,v.end());
    if(v[0].first > T){
        cout << "TLE" << endl;
        return 0;
    }
    int ans = 1000;
    for(int i = 0; i < v.size(); i++){
        if(v[i].first > T)
            break;
        ans = min(ans , (v[i].second));
    }
    cout << ans << endl;
    return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

map<int, int> cnt;

void solve(){
	int n, a;
	scanf("%d", &n);
	REP(i, 0, n){
		scanf("%d", &a);
		cnt[a]++;
	}
	ll last = 0, cur = 0, ans = 0;
	FA(it, cnt){
		if (it->_2 >= 4){
			last = cur = it->_1;
		} else if (it->_2 >= 2){
			last = cur;
			cur = it->_1;
		}
	}
	ans = last * cur;
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 4992
n=int(input())
li=list(map(int,input().split()))
r={0:0}
l={0:0}
ans=0
for i in range(len(li)):
    if l.get(i+li[i])!=None:
        ans+=l[i+li[i]]
    if r.get(i-li[i])!=None:
        ans+=r[i-li[i]]
    if r.get(i+li[i])!=None:
        r[i+li[i]]+=1
    else:
        r[i+li[i]]=1
    if l.get(i+li[i])!=None:
        l[i-li[i]]+=1
    else:
        l[i-li[i]]=1
print(ans)

Measured memory_bytes: 56736
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>

int main(){
    int A,B,a,b,c,d,sum=0;;
    
    std::cin >> A >> B;
    for(int i=A;i<=B;i++){
        a=i/10000;
        b=(i%10000)/1000;
        c=(((i%10000)%1000)%100)/10;
        d=(((i%10000)%1000)%100)%10;
        if(a==d&&b==c){
            sum++;
        }
    }
    std::cout << sum <<std::endl;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   int a, b;
   cin >> a >> b;
   cout << a * b - a - b + 1 << endl;

   return 0;
}

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

int main() {
    long long w, h, x, y;
    cin >> w >> h >> x >> y;

    if (x == 0 && y == 0 || x == 0 && y == h || x == w && y == 0 || x == w && y == h) {
        cout << fixed << setprecision(10) << h * w / 2.0 << " " << 0 << endl;
        return 0;
    }



    long long mx1 = 1000000000000000000;
    long long mx2 = 1000000000000000000;
    mx1 = min(h * x, h * (w - x));

    mx2 = min(w * y, w * (h - y));

    long long ans = max(mx1, mx2);

    //cout << mx1 << " " << mx2 << endl;

    if (h == w) {
        cout << fixed << setprecision(10) << max(ans, h * w / 2) / 1.0 << " ";
    }
    else {
        cout << fixed << setprecision(10) << ans / 1.0 << " ";
    }
    if (mx1 == mx2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
   /* ll t;
    cin>>t;
    while(t--)
    {
       
    }*/
    ll k;
    cin>>k;
    ll sum=0;
    for(ll i=1;i<=k;i++)
    {
        for(ll j=1;j<=k;j++)
        {
            for(ll n=1;n<=k;n++)
            {
                sum+=__gcd(i,__gcd(j,n));
            }
        }
    }
    cout<<sum;
}


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

int main(){
  int n;
  int sq[10000],fr[5000];
  vector<int> com;
  int tmp;

  while(1){
    cin >> n;
    if(!n)break;

    for(int i=1;i<n;i++)sq[i] = (i*i)%n;
    com.clear();

    for(int i=1;i<n;i++){
      bool f = true;
      for(int j=0;j<com.size();j++){
	if(com[j]==sq[i]){
	  f = false;
	  break;
	}
      }
      if(f)com.push_back(sq[i]);
    }
 
    for(int i=0;i<=(n-1)/2;i++)fr[i] = 0;

    for(int i=0;i<com.size();i++){
      for(int j=0;j<com.size();j++){
	if(i!=j){
	  tmp = com[i]-com[j];
	  if(tmp<0)tmp+=n;
	  if(tmp>(n-1)/2)tmp = n - tmp;
	  fr[tmp]++;
	}
      }
    }

    for(int i=1;i<=(n-1)/2;i++)cout << fr[i] << endl;
  }
}

Measured memory_bytes: 1016
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	An := make(map[int]int)
	for i := 0; i < N; i++ {
		An[nextInt()] = i + 1
	}
	Ansl := make([]int, N)
	for i := 0; i < N; i++ {
		Ansl[i] = An[i+1]
	}
	fmt.Println(strings.Trim(fmt.Sprint(Ansl), "[]"))
}

func nextLine() 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 abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 10112
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<cmath>
#include<utility>


using namespace std;

void eslam()

{
	ios_base::sync_with_stdio;
	cin.tie(0);
	cout.tie(0);
}

int main()


{

	eslam();

	string x;
	cin >> x;
	bool b = false;
	for (int i = 0; i < x.length(); i++)
	{
		if (x[i] == '7')
		{
			b = true;
			cout << "Yes" << endl;
			break;
		}
	}
	if (b == false)
		cout << "No" << endl;


}





Measured memory_bytes: 3520
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();



        out.println(a*n < b ? a*n:b);
        out.flush();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 21076
#include <iostream>
#include <vector>
using namespace std;
int poi[50][50], a[51], b[51], c[51], d[51];
int main(void){
    // Your code here!
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
    for (int i = 1; i <= m; i++) cin >> c[i] >> d[i];
    for (int i = 1; i <= n; i++) {
        int ans, x;
        for (int j = 1; j <= m; j++) {
            int len = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (j == 1 || len < ans) {
                ans = len;
                x = j;
            }
        }
        cout << x << endl;
    }
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::collections::BinaryHeap;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize, usize); n],
    }
    let mut ab = ab;
    let mut q = BinaryHeap::new();
    let mut total = 0;
    ab.sort();
    ab.reverse();
    let mut t = m + 1;
    while t >= 1 {
        t -= 1;

        while let Some(&(a, b)) = ab.last() {
            if t + a > m {
                break;
            }
            q.push(b);
            ab.pop();
        }
        if let Some(b) = q.pop() {
            total += b;
        }
    }
    println!("{}", total);
}

Measured memory_bytes: 10492
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define inf 1e9
#define pi 3.1415926536
#define mod 1000000007
#define fr(i,a,b,in) for(int i=a;i<b;i+=in)
#define frn(i,a,b,dc) for(int i=a;i>=b;i-=dc)
#define test(t) int t; cin>>t; while(t--)
int main()
{
	fastio();
	int d,t,sp;
	cin>>d>>t>>sp;
	if(sp*t>=d) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3648
n = int(input())
h = list(map(int, input().split()))

ans, cnt = 0, 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
        
ans = max(ans, cnt)

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

int main(){
    string s, t;
    cin >> s >> t;

    bool ans = true;

    for (int i = 0; i < s.size(); ++i){
        if (s[i] != t[i]) ans = false;
    }

    if (ans) cout << "Yes" << endl;
    if (!ans) cout << "No" << endl;

    return 0;
    
}

Measured memory_bytes: 3624
#include <iostream>
#include <map>
#include <string>
#include <algorithm>

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

using namespace std;

int main() {
    int n = 0;
    cin >> n;
    map<int, int>A;
    map<int, int>B;
    REP(i, n) {
        int num = 0;
        cin >> num;
        A[i] = num;
    }
    for (auto itr = A.begin(); itr != A.end(); itr++){
        B[itr->second] = itr->first;
    }
    for (auto itr = B.begin(); itr != B.end(); itr++){
        cout << itr->second << endl;
    }
}

Measured memory_bytes: 10240
#include<cmath>
#include<cstdlib>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;

int main(){
    int N;
    long long x;
    vector<pair<long long, int>> X;
    vector<pair<int, long long>> ans;

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> x;
        X.push_back(make_pair(x, i));
    }

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

    for(int i=0; i<N; i++){
        int n = X[i].second;
        if(i <= N/2 - 1) ans.push_back(make_pair(n, X[N/2].first));
        else ans.push_back(make_pair(n, X[N/2 - 1].first));
    }

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

    for(int i=0; i<N; i++){
        cout << ans[i].second << endl;
    }
}


Measured memory_bytes: 12140
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}


int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a;
    cin >> a;
    cout << a + a*a + a*a*a;
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
intt lcm(intt a, intt b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res%mod) * (a%mod))%mod;
      a = ((a%mod) * (a%mod))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("o.txt","w",stdout);
  #endif
}
///////////U L R D
int dx[4]={0,-1,1,0};
int dy[4]={1,0,0,-1};

template <typename T1, typename T2>
struct less_second {
    typedef pair<T1, T2> type;
    bool operator ()(type const& a, type const& b) const {
        return a.second > b.second;
    }
};

int main() 
{ 
    fast_io
    go();
    int n;cin>>n;
    if(n>=400&&n<=599)
      cout << "8" <<"\n";
    else if(n>=600&&n<=799)
      cout << "7" <<"\n";
    else if(n>=800&&n<=999)
      cout << "6" <<"\n";
    else if(n>=1000&&n<=1199)
      cout << "5" <<"\n";
    else if(n>=1200&&n<=1399)
      cout << "4" <<"\n";
    else if(n>=1400&&n<=1599)
      cout << "3" <<"\n";
    else if(n>=1600&&n<=1799)
      cout << "2" <<"\n";
    else if(n>=1800&&n<=1999)
      cout << "1" <<"\n";




} 





/*
From 
400
 through 
599
: 
8
-kyu
From 
600
 through 
799
: 
7
-kyu
From 
800
 through 
999
: 
6
-kyu
From 
1000
 through 
1199
: 
5
-kyu
From 
1200
 through 
1399
: 
4
-kyu
From 
1400
 through 
1599
: 
3
-kyu
From 
1600
 through 
1799
: 
2
-kyu
From 
1800
 through 
1999
: 
1
-kyu

*/






Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

namespace Printer{
    void print(vector<int> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    void print(vector<vector<int> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }
};

//--global--//



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

bool calc(ll n, ll m, ll v, ll p, ll *s, int index) { //条件判定
	ll i = upper_bound(s, s+n, s[index]) - s - 1;
	ll a = s[i] + m, now = 0;
	ll k = upper_bound(s, s+n, a) - s - 1;
	if (k < n - p) return false;
	if (i >= n - p) return true;
	rep(j, n) {
		if (j >= n - p + 1) now += m;
		else now += min(a - s[j], m);
	}
	//cout << i << " " << now << endl;
	if (now >= m * v)return true;
	return false;
}

bool calc(ll n, ll m, ll v, ll p, ll *a, ll mid, ll nextMax){
    ll fm = a[mid] + m;
    ll allselect = m * (v-p+1LL);
    // cout << allselect << ", " << mid << endl;
    // cout << fm << endl;
    //if(fm < nextMax)return false;

	ll i = upper_bound(a, a+n, a[mid]) - a - 1;
	ll k = upper_bound(a, a+n, fm) - a - 1;

	if (k < n - p) return false;
	//if (i >= n - p) return true;
    rep(i, n-(p-1LL)){
        //if(fm-a[i] <= 0LL)continue;
        allselect -= (min(fm-a[i], m));
    }

    if(allselect <= 0LL)return true;
    return false;
}

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    ll *a;
    a = new ll[MAX];
    ll nextMax = -1;
    ll Ma = -1;
    rep(i, n){
        cin >> a[i];
        if(Ma == -1){
            Ma = a[i];
            nextMax = Ma;
        }
        if(Ma < a[i]){
            nextMax = Ma;
            Ma = a[i];
        }
    }
    //cout << nextMax << endl;

    sort(a, a+n);

    ll ansNum = LLINF;
    ll l = -1LL;
    ll r = n;
    while(r - l > 1LL){
        ll mid = (l + r) / 2LL;
        // cout << mid << ", " << a[mid] << endl;
        if(calc(n, m, v, p, a, mid, 1LL)){
            // できていたら
            r = mid;
            ansNum = min(ansNum, mid);
        }
        else{
            l = mid;
        }
    }

    //cout << ansNum << endl;

    cout << n - ansNum << endl;
    
    return 0;
}


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

int main() {
  long long int N;
  cin >> N;
  vector<long long int> X(N), Y(N);
  for (long long int i = 0; i < N; i++) {
    long long int A, B, C;
    cin >> A;
    B = i - A;
    C = i + A;
    if (B > 0) X.at(B)++;
    if (C < N) Y.at(C)++;
  }
  long long int ans = 0;
  for (long long int i = 0; i < N; i++) {
    ans += X.at(i) * Y.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e15;
template<typename T> void cmax(T &a, T b) {a = max(a, b);}
template<typename T> void cmin(T &a, T b) {a = min(a, b);}
bool mp[900][900]={};
bool vis[900][900]={};
int dx[6]={1,0,-1,-1,0,1};
int dy[6]={1,1,0,-1,-1,0};

int bfs(int y,int x,int t){
  vis[y][x]=true;
  queue<tuple<int,int,int>> q;
  q.emplace(x,y,t);
  while(!q.empty()){
    int a,b,c;
    tie(a,b,c)=q.front();
    q.pop();
    rep(i,6){
      int na=a+dx[i];
      int nb=b+dy[i];
      if(0<c&&!mp[nb][na]&&!vis[nb][na]){
        vis[nb][na]=true;
        q.emplace(na,nb,c-1);
      }
    }
  }
  int cnt=0;
  rep(i,900)rep(j,900)cnt+=vis[i][j];
  return cnt;
}
signed main(){
  int t,n;
  while (cin>>t>>n,t) {
    memset(vis,0,sizeof(vis));
    memset(mp,0,sizeof(mp));
    rep(i,n){
      int x,y;
      cin>>x>>y;
      x+=100;y+=100;
      mp[y][x]=true;
    }
    int sx,sy;
    cin>>sx>>sy;
    sx+=100;sy+=100;
    cout<<bfs(sy,sx,t)<<endl;

  }

 return 0;
}



Measured memory_bytes: 4640
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
string s;
int x, y;

bool solve(vector<int> &v, int p, int sp) {
  bool memo[v.size() + 1][16001];
  REP(i, v.size() + 1) REP(j, 16001) memo[i][j] = false;
  memo[0][8000 + sp] = true;
  REP(i, v.size()) {
    REP(j, 16001) {
      if(memo[i][j]) {
        memo[i + 1][j - v[i]] = true;
        memo[i + 1][j + v[i]] = true;
      }
    }
  }

  return memo[v.size()][8000 + p];
}

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

  cin >> s >> x >> y;

  int c = 0;
  int sum = 0;
  int sp = 0;
  vector<int> xv;
  vector<int> yv;
  s.push_back('T');
  REP(i, s.length()) {
    if(s[i] == 'T') {
      if(c == 0) sp = sum;
      else if(c % 2 == 0) xv.push_back(sum);
      else yv.push_back(sum);
      c++;
      sum = 0;
    } else {
      sum++;
    }
  }

  cout << ((solve(xv, x, sp) && solve(yv, y, 0)) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 62336
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int count = 1;
		int max = 1000;



		while(true) {
			if(max*count>=n) {
				break;
			}
			count++;
		}

		System.out.println(max*count-n);

	}

}


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        char[] s=cin.next().ToArray();
        Array.Sort(s);
        string ans="No";
        if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[3])ans="Yes";
        Console.WriteLine(ans);
        
    }
}



class Scanner
{
    string[] s;
    int i;

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

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

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

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

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

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

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


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}



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

void dfs(int n, tree& t, vector<bool>& visited, vector<ll>& cost, ll acc) {
  visited[n] = true;
  cost[n] = acc;
  for (auto next : t[n])
    if (!visited[next.first])
      dfs(next.first, t, visited, cost, acc + next.second);
}

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

  tree t(N);
  rep(i, N - 1) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    t[a].emplace_back(b, c);
    t[b].emplace_back(a, c);
  }

  int Q, K;
  cin >> Q >> K;
  --K;

  vector<bool> visited(N);
  vector<ll> cost(N);
  dfs(K, t, visited, cost, 0);

  rep(i, Q) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    cout << cost[x] + cost[y] << endl;
  }
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + b < c + d) {
        cout << "Right" << endl;
    } else if (a + b == c + d) {
        cout << "Balanced" << endl;
    } else
        cout << "Left" << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>

using namespace std;
using llng = long long;

/* Declarations */
int N, M;
vector<string> A, B;

void solve() {
    bool flg = false;
    for (int i=0; i<=N-M; i++) {
        for (int j=0; j<=N-M; j++) {
            flg = true;
            for (int k=0; k<M; k++) {
                for (int l=0; l<M; l++) {
                    if (A[i+k][j+l] != B[k][l]) {
                        flg = false;
                        break;
                    }
                }
                if (!flg) break;
            }
            if (flg) break;
        }
        if (flg) break;
    }
    cout << (flg ? "Yes" : "No") << endl;
}

int main() {
    cin >> N >> M;
    string tmp;
    for (int i=0; i<N; i++) {
        cin >> tmp;
        A.push_back(tmp);
    }
    for (int i=0; i<M; i++) {
        cin >> tmp;
        B.push_back(tmp);
    }

    solve();

    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<float> v(n);
    for(int iv=0;iv<n;iv++){
        cin >> v[iv];
    }

    sort(v.begin(),v.end(),std::greater<float>());
    float ans=0;

    for(int ians=0;ians<n-1;ians++){
        ans= ans+v[ians]*pow(0.5,ians+1);
    }
    cout << ans+v[n-1]/pow(2.0,n-1) <<endl;

}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	for (int i=-(a-1); i<=a-1; i++)
		cout<<b+i<<" ";
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            int N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long ans = 0;
            for(var i = 0; i < N; i++)
            {
                ans += a[i] - 1;
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
    


    public class Calculation
    {
        
    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 13396
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k;
	cin >> n >> k;
	ll r = INF * INF, l = 0;
	while (r - l > 1) {
		ll mid = (r + l) / 2;
		ll m = mid;
		REP(i, n - 1) {
			m -= (m-1) / k+1;
		}
		if (m <= 0)l = mid;
		else r = mid;
	}
	cout << l << endl;
}



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


int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }

    long sum = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            sum += vec.at(i) * vec.at(j);
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define kd int
#define fors(i,a,b) for(int i=(a);i<=(b);++i)
int main(){
    ios::sync_with_stdio(0);
    register int a,wh[9],b,c,d,e,f,g,h,i;
	cin>>a>>b>>e;
	fors(c,0,600){
		wh[1]=a+b+c;
		if(wh[1]<a+e) continue;
		fors(i,-100,200){
			wh[7]=a+e+i;
			if(wh[7]!=wh[1]) continue;
			fors(f,-100,200)
			{
				wh[6]=c+f+i;
				if(wh[6]!=wh[7]) continue;
				fors(d,-100,200){
					wh[2]=d+e+f;
					if(wh[2]!=wh[6]) continue;
					fors(g,-100,200)
					{
						wh[4]=g+d+a;
						wh[8]=c+e+g;
						if((wh[8]!=wh[4])) continue;
						fors(h,-100,200){
							wh[3]=g+h+i;
							wh[5]=b+e+h;
							if((wh[3]!=wh[5]) || (wh[3]!=wh[4]) || (wh[3]!=wh[8])) continue;
								cout<<a<<" "<<b<<" "<<c<<endl;
								cout<<d<<" "<<e<<" "<<f<<endl;
								cout<<g<<" "<<h<<" "<<i<<endl;
								return 0;
						}
					}		
				}
			}
		}
	}
    return 0;
}

Measured memory_bytes: 256
from copy import copy

def bubbleSort(arr):
    cp_arr = copy(arr)
    indices = list(range(len(cp_arr)))
    
    finished_flag = False
    while not finished_flag:
        finished_flag = True

        for i in range(len(cp_arr)-1):
            if cp_arr[i] > cp_arr[i+1]:
                finished_flag = False

                t = cp_arr[i]
                cp_arr[i] = cp_arr[i+1]
                cp_arr[i+1] = t

                t = indices[i]
                indices[i] = indices[i+1]
                indices[i+1] = t
    return indices

def selectionSort(arr):
    cp_arr = copy(arr)
    indices = list(range(len(cp_arr)))

    for i in range(len(cp_arr)):
        min = i
        for j in range(i+1, len(cp_arr)):
            if cp_arr[j] < cp_arr[min]:
                min = j

        t = cp_arr[i]
        cp_arr[i] = cp_arr[min]
        cp_arr[min] = t

        t = indices[i]
        indices[i] = indices[min]
        indices[min] = t

    return indices

if __name__ == "__main__":
    input()
    cards = input().split()
    values = list(map(lambda x: int(x[1]), cards))
    bubbleSorted_indices = bubbleSort(values)
    selectionSorted_indices = selectionSort(values)
    bubble_stable = True
    selection_stable = True
    for i in range(len(values)-1):
        if values[bubbleSorted_indices[i]] == values[bubbleSorted_indices[i+1]] and bubbleSorted_indices[i] > bubbleSorted_indices[i+1]:
            bubble_stable = False
        if values[selectionSorted_indices[i]] == values[selectionSorted_indices[i+1]] and selectionSorted_indices[i] > selectionSorted_indices[i+1]:
            selection_stable = False
    bubble_sorted = [cards[i] for i in bubbleSorted_indices]
    selection_sorted = [cards[i] for i in selectionSorted_indices]
    print(" ".join(bubble_sorted))
    print("Stable" if bubble_stable else "Not stable") 
    print(" ".join(selection_sorted))
    print("Stable" if selection_stable else "Not stable") 





Measured memory_bytes: 6352
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    Num = 0
    for i in range(len(S)):
        if S[i] == "+": Num += 1
        else: Num -= 1
    print(Num)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

d = []
for x, l in XL:
    d.append([x + l, l])

d.sort()

inf = float('inf')

pre = - inf
ans = N
for dd in d:
    if dd[0] - 2 * dd[1] < pre:
        ans -= 1
    else:
        pre = dd[0]

print(ans)


Measured memory_bytes: 73048
n = int(input())
a = list(map(int, input().split()))
res = 0
odd = 0
while odd ==0:
  for i in range(n):
    if a[i] % 2==0:
      a[i]= a[i]/2
    else:
      odd = 1
  res = res + 1 - odd
print(res)

Measured memory_bytes: 3060
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int a[114514];
int main()
{
	int n=0,k=0;lint out=0;
	scanf("%d",&n);
	rep(i,n) scanf("%d",&a[i]);
	rep(i,n){
		if(k>0 && a[i]>0) a[i]--,out++;
		out+=a[i]/2;k=a[i]%2;
	}
	cout<<out<<endl;
}


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

int main() {
  int n, y;
  cin >> n >> y;
  int aa = -1, bb = -1, cc = -1;
  int c;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; i + j <= n; j++) {
      c = n - i - j;
      if ((10000*i + 5000*j + 1000*c) == y) {
        aa = i;
        bb = j;
        cc = c;
      }
    }
  }
  cout << aa << " " << bb << " " << cc << endl;
}



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

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

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

import qualified Data.ByteString.Char8 as B

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

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

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

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = readInteger >>= print . solve 1

solve k 1 = k
solve k n = k + solve ( k * 2 ) ( n `div` 2 )

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define lli long long int
#define MAX 1000000000
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int k, a, b;
    bool flag = false;
    cin>>k>>a>>b;
    for(int i=a; i<=b; i++){
        if(i%k==0){
            flag = true;
            break;
        }
    }
    if(flag)
        cout<<"OK";
    else
        cout<<"NG";
    return 0;
}


Measured memory_bytes: 3692
import java.util.*;
import java.io.*;

/*
   AtCoder contest code
   coder : yoichidon
 */

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] happy = new int[3][N];
        for(int n=0; n<N; n++){
            happy[0][n] = sc.nextInt();
            happy[1][n] = sc.nextInt();
            happy[2][n] = sc.nextInt();
        }
        int[][] dp = new int[3][N];
        //dp[i][n] : the max happiness in 'n' days when the 'n'-th activity is 'i'
        for(int i=0;i<3;i++) dp[i][0]=happy[i][0];
        for(int n=1;n<N;n++)
            for(int i=0;i<3;i++)
                for(int j=0; j<3;j++) if(i!=j){
                    dp[i][n] = Math.max(dp[i][n], dp[j][n-1] + happy[i][n]);
        }


        //for(int i=0;i<3;i++) System.err.println(Arrays.toString(dp[i]));
        System.out.println(Math.max(Math.max(dp[0][N-1], dp[1][N-1]),dp[2][N-1]));




    }
}


Measured memory_bytes: 92736