akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL)x=x->left;
  return x;
}

Node treeMaximum(Node x){
  while(x->right!=NIL)x=x->right;
  return x;
}

Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key)return u;
  if(k<u->key)return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL)return treeMinimum(x->right);
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL || z->right==NIL)y=z;
  else y=treeSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)root=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;


  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL)preorder(u->left);
  if(u->right!=NIL)preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner t = new Scanner(System.in);
		int n = t.nextInt();
		int te = t.nextInt();
		int a = t.nextInt();
		double max = Math.abs((te - (t.nextInt()*0.006) - a));
		int pos = 1;
		for(int x=2;x<=n;x++){
			double h = (te - (t.nextInt()*0.006) - a);
			h = Math.abs(h);
			if (max >= h) {
				max = h;
				pos = x;
			}
		}		
		System.out.println(pos);
	}

}

Measured memory_bytes: 22612
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))

def pow(a,b):
	if(b==0):
		return 1
	else:
		val=pow(a,int(b/2))
		if(b%2==0):
			return val*val
		else:
			if(b>0):
				return a*val*val
			else:
				return (val*val)//a

n=int(input())
s=input()
c=1
prev=s[0]
for i in range(1,len(s)):
	if(prev!=s[i]):
		c=c+1
		prev=s[i]
print(c)

Measured memory_bytes: 5600
#include <cmath>
#include <functional>
#include <iostream>
#include <string>

using namespace std;
void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

int main() {
  int n, x, y;
  cin >> n >> x >> y;

  long cnts[n];
  for (int i = 0; i < n; i++) cnts[i] = 0;

  foreach_comb(n, 2, [&](int *indexes) {
    int i = indexes[0] + 1;
    int j = indexes[1] + 1;
    int dist = min(abs(i - j), abs(i - x) + abs(j - y) + 1);
    // cout << i << ' ' << j << ' ' << dist << endl;
    cnts[dist]++;
  });

  for (int i = 1; i < n; i++) { cout << cnts[i] << endl; }
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
# input
n, l = map(int, input().split())
o = [l+i-1 for i in range(1, n+1)]
oabs = [abs(l+i-1) for i in range(1, n+1)]
# calc
# output
o.pop(oabs.index(min(oabs)))
print(sum(o))


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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  rep(i, n) rep(j, d) cin >> x.at(i).at(j);

  int result = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      int sum = 0;
      rep(k, d) {
        sum += pow(x.at(i).at(k) - x.at(j).at(k), 2);
      }
      int sq = ceil(sqrt(sum));
      if (sq * sq == sum) {
        result++;
      }
    }
  }
  cout << result << endl;

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int a,st=0,ans=0,cnt=0;
    rep(i,n){
        cin >> a;
        if(st<1&&a==1){
            st = 1;
            cnt++;
        } else if(a==st+1){
            cnt++;
            st++; 
        }
    }
    cout << (st==0?-1:n - cnt) << endl;
}

Measured memory_bytes: 256
N = int(input())

A = list(map(int,input().split()))

minum = 0
minabs = float("inf")
allsum = 0

for i in A:

    if i < 0:
        minum += 1

    allsum += abs(i)
    minabs = min(minabs,abs(i))

if minum % 2 == 0:
    print (allsum)

else:
    print (allsum - 2 * minabs)


Measured memory_bytes: 64880
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value

ll bitNum(ll n, int i) {

	ll T = pow(2, i + 1);

	// iビット目について１の個数を求める
	ll bit = (n / T) * (T / 2);
	bit += n % T >= T / 2 - 1 ? n % T - (T / 2 - 1) : 0;

	return bit;
}

ll calc(ll A, ll B) {

	ll ret = 0;

	for (int i = 0; (B >> i) > 0; i++) {		

		ret += ((bitNum(B, i) - bitNum(A - 1, i)) % 2) << i;

	}

	return ret;

}

void solve() {

	ll A, B;
	cin >> A >> B;

	cout << calc(A, B) << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

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

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

int main() {
  int k;

  scanf("%d", &k);

  int ans = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      for (int c = 1; c <= k; c++) {
        ans += gcd(gcd(a, b), c);
      }
    }
  }

  printf("%d\n", ans);
}


Measured memory_bytes: 3816
def main():
    n, q = input().split()
    n = int(n)
    q = int(q)
    nums = [i for i in range(n)]
    rank = [0 for i in range(n)]

    def find_top(x):
        if (nums[x] != x):
            nums[x] = find_top(nums[x])
        return nums[x]

    def unite(x, y):
        x = find_top(x)
        y = find_top(y)
        if rank[x] > rank[y]:
            nums[y] = x
        else:
            nums[x] = y
            if (rank[x] == rank[y]):
                rank[y] += 1

    def same(x, y):
        return find_top(x) == find_top(y)

    for _ in range(q):
        query = input().split()
        com, x, y = tuple(map(int, query))
        if com == 0:
            unite(x, y)
        else:
            print(same(x, y) * 1)


if __name__ == "__main__":
    main()



Measured memory_bytes: 6140
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(1,n-1):
    if p[i] < p[i-1] and p[i] > p[i+1]  :
        count += 1
    if p[i] > p[i-1] and p[i] < p[i+1] :
        count += 1

print(count)

Measured memory_bytes: 3060
import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String[] s = new String[n];

    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    Arrays.sort(s);

    int[] c = new int[n];
    int max = 0;

    for (int i = 0; i < n-1; i++) {
      if (s[i].equals(s[i+1])) {
        c[i+1] += c[i] + 1;
        max = Math.max(max,c[i+1]);
      }
    }

    for (int i = 0; i < n; i++) {
      if (c[i] == max) {
        System.out.println(s[i]);
      }
    }


  }

}


Measured memory_bytes: 79020
from bisect import bisect_right

N, M = map(int, input().split())

Ps, Ys, vals = [], [], {}
for i in range(M):
  P, Y = map(int, input().split())
  Ps.append(P)
  Ys.append(Y)

  if P not in vals:
    vals[P] = []
  vals[P].append(Y)

for P in vals:
  vals[P].sort()

for i in range(M):
  pref = str(Ps[i]).zfill(6)
  city = str(bisect_right(vals[Ps[i]], Ys[i])).zfill(6)
  print(pref + city)


Measured memory_bytes: 30296
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<string>

using namespace std;

int main(void)
{
	int y, m, d, sum[1000];
	int i, t, p;
	int n;
	cin >> n;
	for (int k = 0; k < n; k++)
	{
		sum[k] = 0;
		cin >> y >> m >> d;
		for (i = y; i < 1000; i++)
		{
			if (i == y)
			{
				if (i % 3 == 0)
				{
					for (t = m; t < 11; t++)
					{
						if (t == m)
						{

							for (p = d; p < 21; p++)
							{
								sum[k]++;
							}
						}
						else
						{
							for (p = 1; p < 21; p++)
							{
								sum[k] ++;
							}
						}
					}
				}
				else
				{
					for (t = m; t < 11; t++)
					{
						if (t == m)
						{

							if (t % 2 == 1)
							{
								for (p = d; p < 21; p++)
								{
									sum[k]++;
								}
							}
							else
							{
								for (p = d; p < 20; p++)
								{
									sum[k]++;
								}
							}
						}
						else
						{
							if (t % 2 == 1)
							{
								for (p = 1; p < 21; p++)
								{
									sum[k]++;
								}
							}
							else
							{
								for (p = 1; p < 20; p++)
								{
									sum[k]++;
								}
							}
						}
					}
				}
			}
			else
			{
				if (i % 3 == 0)
				{
					for (t = 1; t < 11; t++)
					{
						for (p = 1; p < 21; p++)
						{
							sum[k]++;
						}
					}
				}
				else
				{
					for (t = 1; t < 11; t++)
					{
						if (t % 2 == 1)
						{
							for (p = 1; p < 21; p++)
							{
								sum[k]++;
							}
						}
						else
						{
							for (p = 1; p < 20; p++)
							{
								sum[k]++;
							}
						}
					}
				}

			}

		}
	}
	for (i = 0; i < n; i++)
	{
		cout << sum[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	int n,m;
	int h[100000];
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	bool f[100000]={};
	for(int i=0;i<n;i++){
		f[i]=1;
	}
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		if(h[a]<h[b]){
			f[a]=0;
		}else if(h[a]>h[b]){
			f[b]=0;
		}else{
			f[a]=0;
			f[b]=0;
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(f[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4108
#include <iostream>

int main(void){
    int n, i, min=0, max=0;
    long sum=0;
    std::cin >> n;
    std::cin >> i;
    min=i, max=i, sum=i;
    while(n>1){
        n--;
        std::cin >> i;
        if(i<min) min=i;
        if(i>max) max=i;
        sum+=i;
    }
    std::cout << min << " " << max << " " << sum << std::endl;
    return 0;
}


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

#define ll long long
// #define endl '\n'

void max_self(int &a, int b){ a = max(a, b);}
void min_self(int &a, int b){ a = min(a, b);}

void solve(){
	int n; cin>>n;
	ll prev, x, ans = 0; cin>>prev;
	for(int i = 1; i<n; i++){
		cin>>x;
		if(x < prev){
			ans += prev - x;
		}else{
			prev = x;
		}
	}
	cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;// cin>>t;
	for(int i = 1; i<=t; i++){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
using namespace std;

int INF = 1e9 + 7;

string s, t, kari;

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

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

	if (s.size() < t.size()) {
		cout << "UNRESTORABLE" << endl;
		return 0;
	}

	string ans(s.size(), 'z');

	int sum = 0, token = 0;
	for (int i = 0; i <= s.size() - t.size(); i++) {
		for (int j = i; j < t.size() + i; j++) {
			if (s[j] == t[j - i] || s[j] == '?') {
				sum++;
			}
		}
		
		kari = s;
		if (sum == t.size()) {
			token = 1;
			for (int j = 0; j < i; j++) {
				if (s[j] == '?') {
					kari[j] = 'a';
				}
			}
			for (int j = i; j < t.size() + i; j++) {
				kari[j] = t[j - i];
			}
			for (int j = t.size() + i; j < s.size(); j++) {
				if (s[j] == '?') {
					kari[j] = 'a';
				}
			}

			for (int j = 0; j < s.size(); j++) {
				if (kari[j] < ans[j]) {
					ans = kari;
					break;
				}
			}
		}
		sum = 0;
	}
	
	if(token == 0) cout << "UNRESTORABLE" << endl;
	else cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef long long int lli;

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

int main(){

	fast_io();
	//code starts here
	
	int n;
	cin >> n;
	
	vector<bool> D(n);
	for(int i = 0; i < n; i++){
		int x, y;
		cin >> x >> y;
		if(x==y){
			D[i] = true;
		} else {
			D[i] = false;
		}
	}
	
	bool check = false;
	for(int i = 2; i < n; i++){
		if(D[i] && D[i-1] && D[i-2]){
			check = true;
			break;
		}
	}
	
	if(check){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	return 0;

}



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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 200010 ;
const int MOD = 1000000007;
const int LOG = 20;

int pnt = 0, n, k;
bool f = 0, mark[N]; // marked B unmarked A
string s;


int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	cin >> s;
	for (int i = 0; i < n; i++) mark[i] = (s[i] == 'B');
	for (int i = 1;  i <= min(k, 10000000 + (k % 2)); i++){
		if ((mark[pnt] ^ f)){
			pnt++;
			pnt %= n;
			f ^= 1;
		}else{
			mark[pnt] ^= 1;
		}
	}
	for (int i = 1; i <= n; i++){
		cout << ((mark[pnt] ^ f) ? 'B' : 'A');
		pnt ++;
		pnt %= n;
	}


	return 0;
}

Measured memory_bytes: 920
from collections import deque
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

class Node:
    def __init__(self):
        self.parent_id = -1
        self.depth = 0
        self.children = []

global nodes

def calc_depth(node_id,arg_depth):

    nodes[node_id].depth = arg_depth
    for child in nodes[node_id].children:
        calc_depth(child, arg_depth+1)


V = int(input())

nodes = []
#あらかじめ、V個のノードを用意しておく
for loop in range(V):
    node = Node()
    nodes.append(node)

#親子関係の取得
for loop in range(V):

    table = list(map(int,input().split()))
    node_id = table[0]
    num = table[1]

    for i in range(num):
        child_id = table[2+i]
        nodes[node_id].children.append(child_id)
        nodes[child_id].parent_id = node_id


#根を探して、深さを計算する
for i in range(V):
    if nodes[i].parent_id == -1:
        calc_depth(i,0)
        break


for i in range(V):

    print("node %d: parent = %d, depth = %d, "%(i,nodes[i].parent_id,nodes[i].depth),end = "")

    if nodes[i].parent_id == -1:
        print("root,",end = "")
    else:
        if len(nodes[i].children) == 0: #葉
            print("leaf,",end = "")
        else: #節
            print("internal node,",end = "")

    print(" [",end = "")
    print(', '.join(map(str,nodes[i].children)),end = "")
    print("]")




Measured memory_bytes: 41504
n, q = map(int, input().split())
tree_candidate = [[] for _ in range(n)]

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree_candidate[a].append(b)
    tree_candidate[b].append(a)

tree = [[] for _ in range(n)]

app = set([0])

import queue
next = queue.Queue()
next.put(0)
# print(tree_candidate)
while not next.empty():
    i = next.get()
    for j in tree_candidate[i]:
        if not j in app:
            tree[i].append(j)
            app.add(j)
            next.put(j)

cnts = [0 for _ in range(n)]
for i in range(q):
    p, x = map(int, input().split())
    cnts[p-1] += x
    # print(x, p, tree[p-1], cnts)

next = queue.Queue()
next.put(0)

while not next.empty():
    i = next.get()
    for j in tree[i]:
        cnts[j] += cnts[i]
        next.put(j)

for i in cnts:
    print(i, end=' ')

Measured memory_bytes: 170040
import math
N,K=map(int,input().split())
anssub=0
for i in range(N,0,-1):
  a=0
  while i*(2**a)<K:
    a+=1
  for i in range(a):
    anssub+=(1/N)*(1/2)**(i+1)
ans=1-anssub
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define mod 1000000007
#define pb(a) push_back((a))
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
//#define INF 931931114518101
using namespace std;
typedef pair<ll, ll> P;
typedef pair<ll, P> lP;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//
ll h, w;
vector<ll> grid[301];
//-------------------関数----------------------//
ll cnt() {
  ll hoge[500] = {};
  REP(i, h) {
    if (grid[i].size() == 0) {
      return -1;
    }
    hoge[*grid[i].begin()]++;
  }
  ll m = 0, c = 0; //最大の
  REP(i, 301) {
    if (hoge[i] > m) {
      c = i;
      m = hoge[i];
    }
  }
  REP(i, h) { grid[i].erase(find(grid[i].begin(), grid[i].end(), c)); }
  return m;
}
int main() {
  cin >> h >> w;
  REP(i, h) {
    REP(j, w) {
      ll hoge;
      cin >> hoge;
      grid[i].pb(hoge);
    }
  }
  ll h = INF;
  while (1) {
    ll a = cnt();
    if (a == -1) {
      break;
    }
    h = min(h, a);
  }
  cout << h << endl;
}


Measured memory_bytes: 1408
#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 ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 3e5 + 5;
const int MAXN = 1e5 + 5;
const int M = 1e5;
const int mod = 998244353;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;

int arr[N];
int query = 1;
 


void print(int ret)
{
    cout << "Case #" << query++ << ": " << ret << endl;
}

void solve() 
{
	int a, b, n;
	cin >> a >> b >> n;
	int x = min(b - 1, n);
	int ret = (a * x) / b;
	ret -= a * (x / b);
	cout << ret << endl;
}

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

	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main(){
	int y,x,s[10000],d,i,j=0;
	
	while(scanf("%d",&d)!=EOF){
		j++;
		for(i=1;(i*d)<=600-d;i++){
			s[j]+=(d*i*d*i)*d;
		}
	}
	for(i=1;i<=j;i++)printf("%d\n",s[i]);
return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vz;
typedef vector<vz> vvz;
typedef pair<ll, ll> pll;
#define sz(x) int((x).size())
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(ll i=(a); i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<"\n"
#define nl cout<<"\n"
#define maxe(x) max_element(all(x))-(x).begin()
#define mine(x) min_element(all(x))-(x).begin()

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\input1.txt", "r", stdin);
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\output1.txt", "w", stdout);
#endif

	int tc=1;
	// cin>>tc;
	fo(q, tc)
	{
		ll sum=0;
		string s;
		cin>>s;
		fo(i, sz(s)){
			sum+=ll(s[i]-'0');
		}
		if(sum%9) on("No");
		else on("Yes");
	}
	cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

int main()
{
    string str;
    cin >> str;
    bool ok = 1;
    if(str == "AAA" or str == "BBB")ok = 0;

    for(int i = 0;i < str.size();i++){
        for(int j = i + 1;j < str.size();j++){
            int d = j - i;
            if(d == 2)d = 1;
            if(str[i] != str[j] and d > 1){
                ok = 0;
            }
        }
    }
    if(ok)cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    h,n=INTM()
    a=LIST()
    if sum(a)>=h:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Measured memory_bytes: 14092
#include <bits/stdc++.h>
using namespace std;
    
int main(){
  int ban = 0;
  string a,b,c;
  cin >> a >> b >> c;
  while(1){
    if(ban == 0){
      if(a.size() == 0){
        cout << 'A' << endl;
        return 0;
      }
      if(a.at(0) == 'a'){
        ban = 0;
      }
      if(a.at(0) == 'b'){
        ban = 1;
      }
      if(a.at(0) == 'c'){
        ban = 2;
      }
      a.erase(a.begin());
    }
    if(ban == 1){
      if(b.size() == 0){
        cout << 'B' << endl;
        return 0;
      }
      if(b.at(0) == 'a'){
        ban = 0;
      }
      if(b.at(0) == 'b'){
        ban = 1;
      }
      if(b.at(0) == 'c'){
        ban = 2;
      }
      b.erase(b.begin());
    }
    if(ban == 2){
      if(c.size() == 0){
        cout << 'C' << endl;
        return 0;
      }
      if(c.at(0) == 'a'){
        ban = 0;
      }
      if(c.at(0) == 'b'){
        ban = 1;
      }
      if(c.at(0) == 'c'){
        ban = 2;
      }
      c.erase(c.begin());
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  int n,q;
  cin >> n >> q;
  vector <int> res;
  int a[n]={0};
  int sq = sqrt(n);
  int nsq = n/sq+3;
  int lazy[nsq];
  fill(lazy,lazy+nsq,0);
  REP(i,q){
    int z;
    cin >> z;
    if(z == 0){
      int s,t,x;
      cin >> s >> t >> x;
      s--;
      t--;

      /*if(s == t){
	a[s] = x;
	}*/
      if(t/sq == s/sq){
	
	if(t-s+1 == sq){
	  lazy[t/sq] += x;
	}
	else{
	  for(int i = s;i < t+1;i++){
	    a[i] += x;
	  }
	}
	//cout << "debug1" <<endl;
      }

      else{
	//cout << "debug3" << endl;
	int f = s,to = t;
	while(to%sq != (sq - 1)){
	  to--;
	}
	
	while(f%sq != 0){
	  f++;
	  }
	
	
	if(sq != 1){
	  
	}
	
	if(sq != 1){
	  for(int i = s;i < f;i++){
	    a[i] += x;
	  }
	  for(int i = to+1;i < t+1;i++){
	    a[i] += x;
	  }
	}

	f = f/sq;
	to = to/sq;
	if(f <= to){
	  for(int i = f;i < to+1;i++){
	    lazy[i] += x;
	  }
	}
	
      }
      /*REP(i,n)
	cout << a[i] << "  ";
      cout << endl;
      REP(i,nsq){
	cout << lazy[i] << "  ";
      }
      cout << endl;*/
	
    }
    else{
      int x;
      cin >> x;
      x--;
      int te = x / sq;
      
      
     
      res.pb(a[x]+lazy[te]);
      //cout << a[x] << endl;


      
      
    }
    
  }
  for(int i = 0;i < res.size();i++){
    cout << res[i] << endl;
  }
  //cout << res.size() << endl;
  return 0;
}

Measured memory_bytes: 3784
import numpy as np
N,K = map(int, input().split())
p = [(int(i)+1)/2 for i in input().split()]
s = [0]*N
s[0] = p[0]
if N==K:
    print(sum(p))
else:
    for i in range(N-1):
        s[i+1] = s[i]+p[i+1]
    ans=max(s[i+K]-s[i] for i in range(N-K))
    print(ans)


Measured memory_bytes: 32392
#include<cstdio>
#include<cstdlib>
#include<iostream>

int main(){
    int n, q;
    std::cin >> n;
    int* S = new int[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    std::cin >> q;
    int* T = new int[q];
    for(int i =0; i < q; i++){
        scanf("%d", &T[i]);
    }
    int cnt = 0;

    for(int j = 0; j < q; j++){
        int i = 0;
        while(i < n){
            if(S[i] == T[j]){
                cnt++;
                break;
            }
            i++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 3220
#include <iostream>

using namespace std;

int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

int main() {
    int n = 0, ans = 0;
    string buf;
    cin >> buf;
    while (buf[n] != '\0') {
        ans += ctoi(buf[n]);
        n++;
    }
    if (buf == "10" or buf == "100" or buf == "1000" or buf == "10000" or buf == "100000") {
        ans *= 10;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

#   .
# . # .
#   .
# を探す

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            temp = set()
            if i != 0:
                temp.add(S[i-1][j])
            if i != H-1:
                temp.add(S[i+1][j])
            if j != 0:
                temp.add(S[i][j-1])
            if j != W-1:
                temp.add(S[i][j+1])
            if temp == set("."):
                print("No")
                exit()

print("Yes")

Measured memory_bytes: 9124
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<cctype>
using namespace std;
typedef pair< int , int > Pt;
typedef pair< pair<int , Pt > , Pt > P; // Pt(cost,bit) , Pt(y,x)
#define fr first
#define sc second
#define INF ( 1 << 30 )
const int dx[] = { 0, 1, -1, 0}, dy[] = { 1, 0, 0, -1};
struct edge{
  int prime,st,ed;
  edge(){};
  edge(int prime,int st,int ed):prime(prime),st(st),ed(ed){}
};
edge info[11];
int x, y;
char mas[21][21];
bool no_over(int ny,int nx){
  return ny >= 0 && ny < y && nx >= 0 && nx < x;
}
int Dijkstra(Pt& start){
  int ret = 0;
  bool used[21][21][1<<11];
  fill_n(used[0][0],20*20*(1<<11),false);
  //  priority_queue< P , vector<P> , greater<P> > que;
  queue< P >que;
  que.push(P(make_pair(0,Pt((1<<10)-1,0)),start));
  used[start.fr][start.sc][(1<<10)-1] = true;
  while(!que.empty()){
    P p = que.front();
    que.pop();
    //if(used[p.sc.fr][p.sc.sc][p.fr.sc.fr]++) continue;
    for(int i = 0 ; i < 4 ; i++ ){
      int ny = p.sc.fr + dy[i], nx = p.sc.sc + dx[i];
      if(!no_over(ny,nx)) continue;
      if(isdigit(mas[ny][nx])){
        edge e = info[mas[ny][nx]-'0'];
        int no = mas[ny][nx] - '0';
        ny = p.sc.fr, nx = p.sc.sc;
        if( !(p.fr.sc.fr & (1 << no)) || p.fr.fr >= e.ed) continue;
        if(p.fr.fr >= e.st){
          ret = max(ret,p.fr.sc.sc + e.prime);
          if(used[ny][nx][p.fr.sc.fr&~(1<<no)]++) continue;
          que.push(P(make_pair(p.fr.fr,Pt(p.fr.sc.fr&~(1<<no),p.fr.sc.sc + e.prime)),Pt(ny,nx)));
        }else que.push(P(make_pair(e.st,Pt(p.fr.sc.fr,p.fr.sc.sc)),Pt(ny,nx)));
      }else{
        if(used[ny][nx][p.fr.sc.fr]++) continue;
        que.push(P(make_pair(p.fr.fr+1,Pt(p.fr.sc.fr,p.fr.sc.sc)),Pt(ny,nx)));
      }
    }
  }
  return ret;
}

int main(){
  while(cin >> x >> y , x){
    Pt st;
    for(int i = 0 ; i < y ; i++ ){
      for(int j = 0 ; j < x ; j++ ){
        cin >> mas[i][j];
        if(mas[i][j] == 'P') st = Pt(i,j);
      }
    }
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      int g,d,s,e;
      cin >> g >> d >> s >> e;
      info[g] = edge(d,s,e);
    }
    cout << Dijkstra(st) << endl;
  }
}

Measured memory_bytes: 2192
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define ALL(co) co.begin(), co.end()

typedef long long LL;
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> Array;
typedef vector<int> LArray;

const int INF = 1 << 29;
const LL LINF = 1LL << 60;

int itiv;
inline int getInt() { return (cin >> itiv, itiv); }
void readAll(Array& vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; }
inline bool between(int first, int last, int n) { return first <= n && n <= last; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }

int m, n;
int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
int dr[] = { 0, -1, 0, 1 }, dc[] = { -1, 0, 1, 0 };

vector<vector<bool> > stage;

int dfs(int r, int c)
{
	if(!stage[r][c]) return 0;
	stage[r][c] = false;

	int ret = 0;
	for (int i = 0; i < 4; i++)
	{
		int nr = r + dr[i], nc = c + dc[i];
		if(!inRange(n, nr) || !inRange(m, nc)) continue;
		ret = max(ret, dfs(nr, nc));
	}

	stage[r][c] = true;
	return ret + 1;
}

int main(void)
{
	while(cin >> m >> n && n)
	{
		stage = vector<vector<bool> >(n, vector<bool>(m));
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				stage[i][j] = getInt();
			}
		}

		int ans = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				ans = max(ans, dfs(i, j));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Q = sc.nextInt();
    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
    int parent;
    for(int i = 0; i < N - 1; i++) {
      parent = sc.nextInt() - 1;
      map.put(sc.nextInt() - 1, parent);
    }
    int[] ans = new int[N];
    for(int i = 0; i < Q; i++)
      ans[sc.nextInt() - 1] += sc.nextInt();
    for(int i = 1; i < N; i++)
      ans[i] += ans[map.get(i)];
    System.out.println(Arrays.stream(ans).boxed().map(v -> String.valueOf(v)).collect(Collectors.joining(" ")));
  }
}

Measured memory_bytes: 184540
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;

bool A[110][110],flag[110];
int d[110];
int n;

void bfs(){
	queue<int> Q;
	Q.push(1);
	d[1]=0;
	while(Q.empty()==0){
		int u=Q.front();
		Q.pop();
		for(int i=2;i<=n;i++){
			if(A[u][i]==true && flag[i]==false ){
				flag[i]=true;
				Q.push(i);
				d[i]=d[u]+1;
			}
		}
	}
	for(int i=2;i<=n;i++) if(flag[i]==false) d[i]=-1;
	return ;
}

int main(){
	int a,b,c;
	cin>>n;
	for(int i=1;i<=n;i++){
		flag[i]=false;
			for(int j=1;j<=n;j++){
				A[i][j]=false;
		}
	}
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		for(int j=1;j<=b;j++){
			cin>>c;
			A[a][c]=true;
		}
	}
	bfs();
	for(int i=1;i<=n;i++) cout<<i<<" "<<d[i]<<endl;	
	return 0;
}



Measured memory_bytes: 3092
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var A = one[0];
  var B = one[1];
  var K = one[2];
  if(A >= K){
    A -= K;
    K = 0;
  }else{
    K -= A;
    A = 0;
  }

  if(B >= K){
    B -= K;
  }else{
    B = 0;
  }
  myout(A + " " + B);

}


Measured memory_bytes: 29876
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val cs = mutableListOf<Int>()
    val ss = mutableListOf<Int>()
    val fs = mutableListOf<Int>()

    for (i in 0..(n-2)) {
        val (c, s, f) = readLine()!!.split(" ").map { it.toInt() }
        cs.add(c)
        ss.add(s)
        fs.add(f)
    }
    for (i in 0..(n-2)) {
        var ans = 0
        for (j in i..(n-2)) {
            var next = ss.get(j)
            while (ans > next) {
                next += fs.get(j)
            }
            ans = next
            ans += cs.get(j)
        }
        println(ans)
    }
    println(0)
}

Measured memory_bytes: 38104
#pragma GCC target("avx2")
#pragma GCC optimize("O3")

# include <x86intrin.h>
# 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;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
   SpeedForce;
	cin >> n;      
	cin >> s;
	cur = (n / 2);
	if (n % 2 == 0 && s.substr(0, cur) == s.substr(cur)) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

   return Accepted;
}

// B...a

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




int main(){
	int n,a,b,c;
	cin >> n >> a >> b;
	b--;
	c=b-a;
	if(c%2) cout << "Alice" << endl;
	else  cout << "Borys" << endl;
	
	return 0;
}

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


void solve(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int ans = min(n, k)*x;
    ans += max(n-k, 0)*y;
    cout << ans << "\n";
}


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

    bool multitest = false;
    //multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int r,l,k,c=0;
    cin>>r>>l>>k;
    if(k>(l-r+1)) k=l-r+1;
    vector<long long int>v,u;
    set<long long int>s;
    set<long long int>:: iterator it;
    for(long long int i=r;i<(r+k);i++)
    {
        v.push_back(i);
    }
    for(long long int i=l;i>(l-k);i--)
    {
        v.push_back(i);
    }
    sort(v.begin(),v.end());
    for(long long int i=0;i<v.size();i++)
    {
        s.insert(v[i]);
    }
    for( it=s.begin();it!=s.end();it++)
    {
        cout<<*it<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
// AOJ 1276 "Prime Gap" (ICPCアジア地区予選 2007 Problem B)
import java.util.Scanner;
import java.util.BitSet;
import java.util.ArrayList;

public class Main {
    static BitSet isNotPrime; // 素数でないならtrue
    static ArrayList<Integer> primeList;
    static final int MAX_N = 1299709;
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        isNotPrime = new BitSet(MAX_N);
        primeList = new ArrayList<Integer>();
        sieve();
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            
            if (!isNotPrime.get(n)) {
                System.out.println(0);
            } else {
                int pos = 0;
                while (primeList.get(pos) < n) {
                    pos++;
                }
                System.out.println(primeList.get(pos) - primeList.get(pos - 1));
            }
        }
    }
    
    // ここのsieveはふるいにかけると同時に、素数だけのリストを生成する
    public static void sieve() {
        isNotPrime.set(0);
        isNotPrime.set(1);
        for (int i = 2; i <= MAX_N; i++) {
            if (!isNotPrime.get(i)) {
                primeList.add(i);
                for (int j = i * 2; j <= MAX_N * 2; j += i) {
                    isNotPrime.set(j);
                }
            }
        }
    }
}

Measured memory_bytes: 28476
using System;
namespace AT
{
  class B
  {
    static void Main()
    {
      var readline = Console.ReadLine();
      string[] a=readline.Split(' ');
      int k = int.Parse(a[0]);
      int x = int.Parse(a[1]);
      Range(k,x);
    }
    static void Range(int k,int x)
    {
      int limit=k*2-1;
      for(int i=0;i<limit;i++)
      {
        if(i==limit-1)
        {
          Console.WriteLine(x-(k-1)+i);
        }
        else
        {
          Console.Write(x-(k-1)+i);
          Console.Write(" ");
        }
      }
    }
  }
}


Measured memory_bytes: 27372
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;
#[allow(dead_code)]
const N_PRIME : i64 = 1000000007;

////////////////////////////////////////////////

fn g(a:i64,b:i64,n:i64)->i64{
    b/n-(a-1)/n
}

fn gcd(a:i64,b:i64)->i64{
    if b<a{
        gcd(b,a)
    }else if b%a == 0{
        a
    }else{
        gcd(b%a,a)
    }
}

fn main(){
    let xs = read_ints();
    let (a,b,n1,n2) = (xs[0],xs[1],xs[2],xs[3]);
    let n1_div = g(a,b,n1);
    let n2_div = g(a,b,n2);
    let n3_div = g(a,b,n1*n2/gcd(n1,n2));

    println!("{}",(b-a+1)-n1_div-n2_div+n3_div);
}

Measured memory_bytes: 4352
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	X := getInt()

	ans := 0
	for X >= 500 {
		ans += 1000
		X -= 500
	}
	for X >= 5 {
		ans += 5
		X -= 5
	}
	out(ans)
}


Measured memory_bytes: 640
using System;

namespace GCDandLCM
{
    class Program
    {
        static void Main(string[] args)
        {
            string buf;
            while (!string.IsNullOrEmpty(buf = Console.ReadLine()))
            {
                double[] inputs = Array.ConvertAll(buf.Split(' '), double.Parse);
                double gcd;
                if (inputs[0] > inputs[1])
                {
                    gcd = Myfunc(inputs[0], inputs[1]);
                }
                else
                {
                    gcd = Myfunc(inputs[1], inputs[0]);

                }
                Console.WriteLine("{0} {1}", gcd, inputs[0] * inputs[1] / gcd);
            }
        }


        public static double Myfunc(double a, double b)
        {
            double r = a % b;
            if (r != 0)
            {
                b = Myfunc(b, r);
            }
            return b;
        }
    }
}



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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1



// PowMod( base, index, modulo) return base ** index % modulo {{{
// PowMod = base ** index % mod ( natural numbers )
long long unsigned int PowMod( long long unsigned int base, long long unsigned int index){
    if( index == 0 ) return 1;
    // O( log(index) )
    if( index % 2 ){
        return base * PowMod(base, index - 1);
    }else{
        long long unsigned int Phalf = index / 2;
        long long unsigned int half = PowMod(base, Phalf);
        return half * half;
    }
}
// }}}

// Comb( n, r, modulo ) return nCr % modulo {{{
// Comb(ination) = nCr % mod ( natural number )
long long unsigned int Comb( long long unsigned int n, long long unsigned int r){
    if( n == r ) return 1;
    if( n < r ) return Comb(r,n);
    long long unsigned int Upper = 1;
    long long unsigned int Lower = 1;
    for(long long unsigned int i = 0; i < r; i++){
        Upper = Upper * (n-i);
        Upper /= (i+1);
    }
    // Return (Upper / Lower)
    return Upper;
}
// }}}


int main() {

    int n,p;
    int a[100];
    int count[2] = {};

    Scd2(n,p);
    Rep(i,n){
        Scd(a[i]);
        count[a[i]%2]++;
    }

    ll ans = 0;
    ll even = PowMod(2,count[0]);
    ll odd = 0;

    Repe( i ,count[1]+1, 0 ){
        if( ( count[1] - i ) % 2 == p ){
            odd += Comb(count[1],i);
        }
    }

    ans = even * odd;

    printf ("%llu\n", ans);


    return 0;
}



Measured memory_bytes: 256