akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;
use std::cmp;

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

fn main() {
    let n = read::<i64>();
    if n % 2 == 0 {
        println!("{}", n);
    } else {
        println!("{}", n * 2);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
// sum of multiples of a upto N
ll sumOfMultiple(int a, int N){
    ll m=N/a;
    return a*m*(m+1)/2;
}
 
int main(){
    int N;
    cin>>N;
    ll sum=sumOfMultiple(1,N);
    sum-=sumOfMultiple(3,N);
    sum-=sumOfMultiple(5,N);
    sum+=sumOfMultiple(15,N);
    cout<<sum<<endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int maxN = 3009,INF=-10;
long long int dp[maxN][maxN][4],c[maxN][maxN];
int n,m;
long long int f(int i,int j,int d){
    if(i<=0||j<=0||i>n||j>m||d<0)return INF;
    if(i==n && j==m)return d?c[i][j]:0;
    if(dp[i][j][d]!=-1)return dp[i][j][d];
    long long int ret ;
    if(d>0) ret = max( c[i][j] + max( f(i+1,j,3) , f(i,j+1,d-1) ) , f(i,j+1,d) );
    else ret = max(  f(i+1,j,3) , f(i,j+1,d) );
    return dp[i][j][d]=ret;
}
int main(){
    int k;
    cin >> n >> m >> k ;
    for(int i=0;i<k;i++){
        int ni,mi,vi;
        cin >> ni >> mi >> vi ;
        c[ni][mi]=vi;
    }
    memset(dp,-1,sizeof(dp));
    cout << f(1,1,3) << endl ;
}

Measured memory_bytes: 357532
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
 
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
#define setpr(x) cout << setprecision((x))
#define PI atan(1)*4
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk(a , b) { min((a) , (b)) , max((a) , (b)) }
#define flush cout.flush()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endc "\n"
#define MOD 1000000007
#define meme(x) memset((x), 0, sizeof((x)))
#define memo(x) memset((x),-1, sizeof((x)))
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

// #define int ll

ll egcd(ll a, ll b, ll &x, ll &y){
    if (a == 0LL){  
        x = 0LL;  
        y = 1LL;  
        return b;  
    }
    ll xx, yy;
    ll val = egcd(b % a, a, xx, yy);  
    x = yy - (b / a) * xx;  
    y = xx;  
    return val;
}

ll gcd(ll a, ll b){
    while(true){
        if(a>b)
            swap(a,b);
        if (a == 0) 
            return b; 
        ll p = b % a  , q = a;
        a = p;
        b = q;
    }
}
 
ll powerMod(ll x,ll y){
    ll res = 1;
    x %= MOD;
    while(y > 0){
        if(y & 1)res = (res*x)%MOD;
        y = y >> 1;
        x = (x * x)%MOD;
    }
    return res%MOD;
}

//  ==========      //\\       //||     ||====//||
//      ||         //  \\        ||     ||   // ||
//      ||        //====\\       ||     ||  //  ||
//      ||       //      \\      ||     || //   ||
//  ==========  //        \\  ========  ||//====|| 
//  code

vector<ll> a;
const int N = 3005;
ll dp[N][N][2];
ll rec(int left, int right, int chance){
    if(left > right){
        return 0;
    }

    if(dp[left][right][chance]){
        return dp[left][right][chance];
    }

    ll ans = 0LL;
    if(chance == 0){
        ans = max(a[left] + rec(left + 1, right, 1 - chance),
            a[right] + rec(left, right - 1, 1 - chance));
    } else {
        ans = min(-a[left] + rec(left + 1, right, 1 - chance),
            -a[right] + rec(left, right - 1, 1 - chance));
    }

    return dp[left][right][chance] = ans;
}

void solve(){
    int n,i,j,k,l,p;
    cin >> n;
    a.resize(n);
    meme(dp);
    for(auto &i : a){
        cin >> i;
    }
    cout << rec(0, n - 1, 0) << endc;
}

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


Measured memory_bytes: 145008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int n,r;
    cin >> n >> r;
    if(n < 10)cout << r + 100 * (10-n);
    else cout << r;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include<vector>
typedef long long ll;

using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> as(n);
	for (int i = 0; i < n; i++) {
		cin >> as[i];
	}
	ll kotae1 = 0; //as[0]が正の場合
	int sum1 = 0;
	ll kotae2 = 0; //as[0]が負の場合
	int sum2 = 0;

	
	for (int i = 0; i < n; i++) {
		sum1 += as[i];
		if (i % 2==0){
			if (sum1 <= 0) {
				kotae1 += (1 - sum1);
				sum1 = 1;
			}
		}
		else {
			if (sum1 >= 0) {
				kotae1 += (sum1-(-1));
				sum1 = -1;
			}
		}
	}

	for (int i = 0; i < n; i++) {
		sum2 += as[i];
		if (i % 2 == 1) {
			if (sum2 <= 0) {
				kotae2 += (1 - sum2);
				sum2 = 1;
			}
		}
		else {
			if (sum2 >= 0) {
				kotae2 += (sum2 - (-1));
				sum2 = -1;
			}
		}
	}
	ll kotae = 0;
	kotae = kotae1 < kotae2 ? kotae1 : kotae2;

	cout <<kotae<< endl;
	return 0;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(_r io.Reader, _w io.Writer) {
	var s []byte
	var k int
	Fscan(bufio.NewReader(_r), &s, &k)
	n := len(s)
	dp := make([][]int, n)
	for i := range dp {
		dp[i] = make([]int, n)
		for j := range dp[i] {
			dp[i][j] = -1
		}
	}
	var f func(p, sum int, isUpper bool) int
	f = func(p, sum int, isUpper bool) (cnt int) {
		if sum == k {
			return 1
		}
		if p >= n {
			return 0
		}
		dv := &dp[p][sum]
		if !isUpper && *dv >= 0 {
			return *dv
		}
		defer func() {
			if !isUpper {
				*dv = cnt
			}
		}()
		up := byte('9')
		if isUpper {
			up = s[p]
		}
		cnt += f(p+1, sum, isUpper && '0' == up)
		for digit := byte('1'); digit <= up; digit++ {
			cnt += f(p+1, sum+1, isUpper && digit == up)
		}
		return
	}
	Fprint(_w, f(0, 0, true))
}

func main() { run(os.Stdin, os.Stdout) }


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

int main()
{
  int n;
  cin>>n;
  if(n > 999 && n%1000 == 0)
    cout<<0<<endl;
  else
  {
    int ans = floor(n/1000) + 1;
    ans = ans*1000 - n;
    
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3468
#include <iostream>
#include <sstream>
using namespace std;
int main() {
    string  s;
    string test = "000";
    int x = 0 , y , z = 0,fasele = 1000 , f = 0;
    cin >> s;
    for(int i = 0;i < s.size()-2;i++){
        test[0] = s[i];
        test[1] = s[i+1];
        test[2] = s[i+2];
        stringstream geek(test);
        x=0;
        geek >> x;
        y = x;
        if(y > 753)
            f = y - 753;
        else
            f = 753 - y;
        if(f < fasele){
            fasele = f;
            z = y;
        }
    }
    if(z > 753){
        cout << z - 753<<endl;
        return 0;
    }
    cout << 753 - z<<endl;
    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

char s[52][52];

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

int main(){
    cin.sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    memset(s, '.', sizeof('.'));
    rep(i, h)rep(j, w) cin >> s[i + 1][j + 1];
    repl(i, 1, h + 1)repl(j, 1, w + 1) {
        if (s[i][j] == '.') {
            int tmp = 0;
            rep(k, 8) {
                int x = j + dx[k], y = i + dy[k];
                if (s[y][x] == '#') tmp++;
            }
            s[i][j] = (char)(tmp + '0');
        }
        cout << s[i][j];
        if (j == w) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	fio();
	cin>>s;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]=='7')flag=1;
	}
	if(flag==1)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}



Measured memory_bytes: 3612
S = input()

ans = 0

if len(S) == 0:
    print(0)
    exit()

# 0始まり
z = sum(x == '1' for x in S[0::2]) + sum(x == '0' for x in S[1::2])

# 1始まり
o = sum(x == '0' for x in S[0::2]) + sum(x == '1' for x in S[1::2])


print(min(z, o))

Measured memory_bytes: 3188
from collections import defaultdict
from heapq import heappop, heappush
from math import ceil

class Graph(object):

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, From, To, cost=1):
        self.graph[From].append((To,cost))

    def get_nodes(self):
        return self.graph.keys()

class Dijkstra(object):

    def __init__(self, graph, start):
        self.g = graph.graph
        self.dist = defaultdict(lambda:float('inf'))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)
        self.Q = []
        heappush(self.Q,(self.dist[start], start))

        while  self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, cost in self.g[u]:
                alt = dist_u + cost
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q,(alt, v))

    def shortest_distance(self, goal):
        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]

        return path[::-1]

N = int(input())
g = Graph()

for _ in range(N-1):
    a,b = map(int,input().split())
    g.add_edge(a,b)
    g.add_edge(b,a)

dij = Dijkstra(g,1)
path = dij.shortest_path(N)
c1 = path[ceil(len(path)/2)-1]
c2 = path[ceil(len(path)/2)]

g.graph[c1] = [(to,cost) for to,cost in g.graph[c1] if to != c2]
g.graph[c2] = [(to,cost) for to,cost in g.graph[c2] if to != c1]

dij = Dijkstra(g,1)
f = 0
for i in range(1,N):
    if dij.shortest_distance(i) != float('inf'):
        f += 1
if f > N-f:
    print('Fennec')
else:
    print('Snuke')

Measured memory_bytes: 125784
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
c = gets.chomp.split.map(&:to_i)
sum_manzoku = 0
n.times do |i|
    if i != 0 && a[i-1] == a[i] - 1
        sum_manzoku += c[a[i-1]-1]
    end
    sum_manzoku += b[a[i]-1]
end
p sum_manzoku

Measured memory_bytes: 1788
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T

main :: IO ()
main = do
  let
    f :: Int -> Int -> Int
    f k m = (2 * k) `min` (m - 1)
  [n, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    step :: Char -> [Bool] -> [Bool]
    step 'L' rest = False : rest
    step 'R' rest = True : rest
    step _ _ = []
  ds <- foldr step [] <$> getContents :: IO [Bool]
  let
    (m, s) = fst . foldl step ((0, 0), Nothing) $ ds :: (Int, Int)
      where
        step :: ((Int, Int), Maybe Bool) -> Bool -> ((Int, Int), Maybe Bool)
        step ((m, s), Just x) y | x == y    = ((m, s + 1), Just x)
        step ((m, s), _) y                  = ((m + 1, s), Just y)
  print $ s + f k m

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 4980
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define int long long
#define INF 1e9 + 7
#define cae cout << ans << endl;
#define cye cout << "Yes" << endl;
#define cne cout << "No" << endl;
#define r0 return 0;
#define ll long long
using namespace std;
typedef pair<int,int>P;
signed main() {
    int n;
    cin >> n;
    if (n % 10 == 9 || n / 10 == 9) {
        cye
    } else {
        cne
    }
    r0
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstdlib>
#include<iostream>
using namespace std;
const int N=1e5+10;

int n;
char ans[N];
string str[N];

void dfs(int i,int a,int b,int c) {
	if(i>n) {
		puts("Yes");
		for(int i=1;i<=n;i++) putchar(ans[i]),puts("");
		exit(0);
	}
	if(str[i]=="AB") {
		if(a) ans[i]='B',dfs(i+1,a-1,b+1,c);
		if(b) ans[i]='A',dfs(i+1,a+1,b-1,c);
	}
	else if(str[i]=="AC") {
		if(a) ans[i]='C',dfs(i+1,a-1,b,c+1);
		if(c) ans[i]='A',dfs(i+1,a+1,b,c-1);
	}
	else {
		if(b) ans[i]='C',dfs(i+1,a,b-1,c+1);
		if(c) ans[i]='B',dfs(i+1,a,b+1,c-1);
	}
}

int main() {
	scanf("%d",&n); int a,b,c; scanf("%d %d %d",&a,&b,&c);
	for(int i=1;i<=n;i++) cin>>str[i];
	dfs(1,a,b,c); puts("No");exit(0);
}



Measured memory_bytes: 14684
#include <cstdio>
#include <queue>

const int N=200005;

int n,p[N],f[N][20],Log[N];

int min(int x,int y){return p[x]<p[y]?x:y;}

int find(int x,int y)
{
    int z=Log[y-x+1];
    return min(f[x][z],f[y-(1<<z)+1][z]);
}

struct Rec
{
    int l,r,x,y;
    Rec(int a=0,int b=0):l(a),r(b),x(find(a,b)),y(find(x+1,b+1)){}
    inline bool operator<(const Rec &o)const{return p[x]>p[o.x];}
};

std::priority_queue<Rec> q;

int main()
{
    scanf("%d\n",&n);
    p[0]=n+1;Log[0]=-1;
    for (int i=1;i<=n;i++)
    {
        scanf("%d",&p[i]);
        f[i][0]=f[i][1]=i;
        Log[i]=Log[i>>1]+1;
    }
    for (int i=n;i;i--)
        for (int j=2;i+(1<<j)-1<=n+1;j++)
            f[i][j]=min(f[i][j-1],f[i+(1<<(j-1))][j-1]);
    q.push(Rec(1,n));
    for (;!q.empty();)
    {
        Rec a=q.top();q.pop();
        printf("%d %d ",p[a.x],p[a.y]);
        if (a.l<a.x) q.push(Rec(a.l,a.x-1));
        if (a.x+1<a.y) q.push(Rec(a.x+1,a.y-1));
        if (a.y<a.r) q.push(Rec(a.y+1,a.r));
    }
}


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

using namespace std;

int a,b,n,x,y;
int area[17][17];
bool stop[17][17];

void dp(int a, int b){
	for(int i = 1;i <= b; i++){
		for(int j = 1;j <= a;j++){
			if(i == 1 && j == 1)continue;
			if(stop[j][i] == 1)continue;
			area[j][i] = area[j - 1][i] + area[j][i - 1];
		}
	}
	return;
}

int main(){
	while(cin >> a >> b,a){
		fill_n(*area,17*17,0);
		fill_n(*stop,17*17,0);
		area[1][1] = 1;
		cin >> n;
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			stop[x][y] = 1;
		}
		dp(a,b);
		cout << area[a][b] << endl;
	}

}

Measured memory_bytes: 3000
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		//読み込む
		string[] line1 = Console.ReadLine().Split(' ');
		int A = int.Parse(line1[0]);
		int B = int.Parse(line1[1]);
		int M = int.Parse(line1[2]);

		//冷蔵庫・電子レンジの金額配列
		int[] an = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		int[] bn = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

		//割引券を使用しない場合の最小値
		int netMin = an.Min() + bn.Min();

		//割引券を使用した場合の金額を格納する配列
		int[] discountArray = new int[M];

		//ループ処理で、割引された金額を入力
		for(int i=0; i<M; i++){
				//読み込む
				string[] line = Console.ReadLine().Split(' ');
				int x = int.Parse(line[0]);
				int y = int.Parse(line[1]);
				int c = int.Parse(line[2]);

				//割引後の金額を計算
				int discount = an[x-1] + bn[y-1] - c;

				//配列に格納
				discountArray[i] = discount;
		}

		//割引した場合の最小値を取得
		int discountMin = discountArray.Min();

		//より小さい方を出力
		if(netMin > discountMin){
				Console.WriteLine(discountMin);
		}else{
				Console.WriteLine(netMin);
		}
	}
}



Measured memory_bytes: 34396
#include <stdio.h>
#include <stdlib.h>

void Swap(int* arg1, int* arg2) {
  int* tmp;
  tmp = arg1;
  arg2 = arg1;
  arg1 = tmp;
}

int Max(int* nums, int length) {
  int max = nums[0];
  for (int i = 0; i < length; i++) {
    if (nums[i] > max) max = nums[i];
  }

  return max;
}

int Min(int* nums, int length) {
  int min = nums[0];
  for (int i = 0; i < length; i++) {
    if (nums[i] < min) min = nums[i];
  }

  return min;
}

int main(void) {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);

  int array[] = {a, b, c};

  int min = Min(array, 3);
  int max = Max(array, 3);
  int middle;

  if (a == min) {
    if (b == max) middle = c;
    if (c == max) middle = b;
  }
  if (b == min) {
    if (a == max) middle = c;
    if (c == max) middle = a;
  }
  if (c == min) {
    if (a == max) middle = b;
    if (b == max) middle = a;
  }

  printf("%d %d %d\n", min, middle, max);

  return 0;
}



Measured memory_bytes: 2068
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

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

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

func main() {
	N := nextInt()
	m := make([]int, N)
	for i := 0; i < N; i++ {
		n := nextInt()
		m[i] = n
	}
	sort.Slice(m, func(i int, j int) bool { return m[i] < m[j] })
	fmt.Println(m[N/2] - m[N/2-1])
}

func abs(a int) int {
	if a < 0 {
		return -a
	} else {
		return a
	}
}

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


Measured memory_bytes: 3836
fun main(args: Array<String>) {
    val n = readLine()!!.split(" ").map { it.toInt() }[0]
    val a = readLine()!!.split(" ").map { it.toInt() }
    val bossArray = Array(n+1){ 0 }
    for (i in 0 until n-1){
        bossArray[a[i] - 1] += 1
    }
    for (i in 0 until n){
        println(bossArray[i])
    }
}


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

int main() {
 int N;
 cin >> N;
 vector<int> A(N);
 for(int i=0; i<N; i++){
  cin >> A[i];
 }
 sort(A.begin(),A.end());
  

 int count=0;
 for(int i=0; i<N-1; i++){
  if(A[i]==A[i+1]){
  count++;
  }
 }
 cout << N-count << endl;
}


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

using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int c=a+b;
    if(c%2==0){
        cout<<c/2;
    }
    else{
        cout<<"IMPOSSIBLE";
    }


    return 0;


}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>

#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
int main()
{
    int N;
    cin >> N;
    vector<long long> A(N);
    vector<long long> ans(N);
    rep(i, 0, N)
    {
        cin >> A[i];
    }
    long long sum = 0;
    rep(i, 0, N)
    {
        if (i % 2 == 1)
        {
            sum -= A[i];
        }
        else
        {
            sum += A[i];
        }
    }
    ans[0] = sum;
    cout << ans[0];
    rep(i, 1, N)
    {
        ans[i] = (A[i - 1] - ans[i - 1] / 2) * 2;
        cout << " " << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int A,B;
    cin>>A>>B;
    if(A<=5){
        cout<<0<<endl;
    }else if(6<=A && A<=12){
        cout<<B/2<<endl;
    }else{
        cout<<B<<endl;
    }
}


Measured memory_bytes: 256
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int t = 1;
		while (t-->0) {
		    String s = sc.nextLine();
		    int n = s.length();
		    if(n%2==0){
		        System.out.println("No");
		        continue;
		    }
		    boolean ok = isPalin(s)&isPalin(s.substring(0,n/2))&isPalin(s.substring(n/2+1));
		    System.out.println((ok?"Yes":"No"));
		}
	}
	static boolean isPalin(String s){
	    int n = s.length();
	    boolean ok = true;
		for(int i=0;i<n/2;i++){
		     if(s.charAt(i)!=s.charAt(n-i-1)){
		            ok = false;
		            break;
		    }
		}
		return ok;
	}
	static class Query {
		int x1, x2, y, id;
		public Query(int c, int d, int e, int a){
			x1 = c;
			x2 = d;
			y = e;
			id = a;
		}
	}
	static class Compare1 implements Comparator<Query>{
		@Override
		public int compare(Query q1, Query q2){
			if(q1.x2==q2.x2) return q1.x1-q2.x1;
			return q1.x2-q2.x2;
		}
	}
	static class Pair implements Comparable<Pair>{
		int a, b;
		public Pair(int c, int d){
			a = c;
			b = d;
		}
		public int compareTo(Pair p){
		    return a-p.a;
		}
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}
		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				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());
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	string S;
	cin >> S;
	if (S == "ABC")
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;
}



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


int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    vector <int> a(n);
    for (int i=0; i<n; i++){
        cin>>a[i];
        if ((a[i]%2==0) && (a[i]%3!=0) &&(a[i]%5!=0)){
            cout<<"DENIED";
            return 0;
        }
    }
    cout<<"APPROVED";
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
signed main(){
    int n,a,b;
    cin>>n>>a>>b;
    vector<char>v(n);
    rep(i,n)cin>>v[i];
    vector<char>u=v;
    int val=0;
    int now=0;
    rep(i,v.size()){
        if(now>a+b-1||v[i]=='c'){
            puts("No");
            continue;
        }
        if(u[i]=='b'&&val<=b-1){
            puts("Yes");
            val++;
            now++;
            continue;
        }
        else if(u[i]=='b'&&val>b-1){
            puts("No");
            continue;
        }
        now++;
        puts("Yes");
    }
}


Measured memory_bytes: 768
from bisect import bisect
import math

N, H = map(int, input().split())
A = []
B = []

for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)

aM = max(A)
B.sort()

r = N - bisect(B, aM)
cnt = 0

for i in range(r):
  H -= B[-1-i]
  cnt += 1
  if H <= 0:
    print(cnt)
    break
  
if H > 0:
  print(math.ceil(H/aM) + cnt)

Measured memory_bytes: 17216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e9;
const ll MOD = 998244353;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> dp(n+1, 0), sum(n+1, 0),l(k), r(k);
    rep1(i, k) cin >> r[i] >> l[i];
    rep2(i, 1, n+1){
        if (i==1){
            sum[i] = 1;
            continue;
        }
        rep1(j, k){
            if (i-r[j]>0){
                if (i-l[j]>0)dp[i] += (sum[i-r[j]] - sum[i-l[j]-1]%MOD+MOD)%MOD;
                else dp[i] += sum[i-r[j]];
            }
        }
        dp[i] %= MOD;
        sum[i] = (sum[i-1] + dp[i]) % MOD;
    }
    cout << dp[n] << endl;
    //printf("%.12f", ans);
}

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

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

  vector<int> h(n + 1);
  vector<int> ma(n, 0);
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    ma[a] = max(ma[a], h[b]);
    ma[b] = max(ma[b], h[a]);
  }

  int ans = 0;
  for (int i = 1; i <= n ; i++) {
    ans += h[i] > ma[i];
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)


// Write From This Line
int main()
{
	int n;
	cin >> n;
	while(n > 0){
		int a = n % 10;
		n /= 10;
		if( a == 7 ){
			cout <<"Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long Int;
Int n, res, x;
Int a[10800];
int main(){
	while(cin >> n, n){
		res = 0;
		for(int i = 0;i < n;i++)cin >> a[i];
		sort(a, a + n);
    	for(int i = 0;i < n;i++){
			res += a[i] * (n - i - 1);
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1252
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

typedef long long ll;
typedef long double db;
ll a;
db b;

int main() {
	cin >> a >> b;
	cout << (ll)((b + 1e-18) * 100 * a / 100) << endl;
	return 0;
}

Measured memory_bytes: 3728
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [x//400 if x//400 <= 7 else 8 for x in a]
p = [0]*8
for i in l:
    if i < 8:
        p[i] = 1
pmin = sum(p) if sum(p) != 0 else 1
pmax = sum(p) + l.count(8)
print(pmin, pmax)

Measured memory_bytes: 9112
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll a,b;cin>>a>>b;
	if(b%a==0)cout<<a+b;
	else cout<<b-a;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
P = sorted([tuple(map(int, input().split())) for _ in range(N)])

ans = 1e30
for lx in range(N):
    for rx in range(lx+K, N+1):
        Q = sorted(P[lx:rx], key=lambda x:x[1])
        for ly in range(len(Q)):
            R = Q[ly:ly+K]
            if len(R)>=K: ans = min(ans, (P[rx-1][0]-P[lx][0])*(R[-1][1]-R[0][1]))
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

vector<int> f(LL n, int& mx) {
    if (n == 1) {
        mx = 0; return {};
    }
    int t; vector<int> prev;
    if (n % 2 == 0) {
        prev = f(n / 2, t);
        prev.push_back(mx = t + 1);
    } else {
        prev = f(n - 1, t);
        prev.insert(prev.begin(), mx = t + 1);
    }
    dbg(prev);
    return prev;
}

int main() {
    LL n; int M; cin >> n;
    vector<int> a = f(++n, M);
    printf("%d\n", 2 * M);
    FOR (i, 0, M) printf("%d ", a[i]);
    FOR (i, 1, M + 1) printf("%d%c", i, i == _i - 1 ? '\n' : ' ');
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
using namespace std;
 
int main () {
long long a, b, c;
while(cin >> a >> b >> c) {
long long re = LLONG_MAX;
if(a % 2) re = min(re, b * c); else re = 0;
if(b % 2) re = min(re, a * c); else re = 0;
if(c % 2) re = min(re, a * b); else re = 0;
cout << re << endl;
}
return 0;
}

Measured memory_bytes: 256
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#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 int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define mod             	1000000007  //998244353// 1e9 + 7
#define inf             1000000007 // 1e9 + 7
#define MAX             10000007   // 1e7 + 7
#define MAXN 			10000004
#define mt 				make_tuple
#define eps             1e-6
#define endl			'\n'
#define test            int t; cin>>t; while(t--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define tree            tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
int fact[1000007]={0};
// int spf[(int)(1e7) + 20];
// bool prime[(int)((1e7) + 20)];
// int gcd(int a,int b){if(b==0)return a; return gcd(b,a%b);}
// void sp(int n){spf[1]=1;for(int i=2;i<n;i++)spf[i]=i;for(int i=4;i<n;i+=2)spf[i]=2;for(int i=3;i*i<n;i++){if(spf[i]==i){for(int j=i*i;j<n;j+=i)if(spf[j]==j)spf[j]=i;}}}
// void sieve(int n){memset(prime,true,sizeof(prime) );for(int p=2;p*p<=n;p++){if(prime[p]==true)for(int i=p*p;i<=n;i+=p)prime[i]=false;}prime[0]=false;prime[1]=false;}
int xyp(int x,int y){int res=1;while(y>0){if(y%2==1) res=(res*x)%mod;x=(x*x)%mod;y/=2;}return res%mod;}
int inv(int x){return xyp(x,mod - 2);}
void init() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
int ncr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[r],mod-2)))%mod; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res;}
// int npr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res; }
// bool isp(int a){if(a == 2)return true;if(a == 1)return false;for(int x= 2; x <= sqrt(a) + 1; x++)if(a % x == 0)return false;return true;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
// #define p_set tree< pair<int,int> ,  null_type ,  less<pair<int,int>> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// #define i_set tree< int ,  null_type ,  less< int > ,  rb_tree_tag ,  tree_order_statistics_node_update>
// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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


signed main()
{
	fast_io
	// test
	{
		int n, a, b;
		cin >> n >> a >> b;
		int ans = xyp(2, n);
		ans = sub(ans, 1);
		init();
		int pr1 = 1;
		int pr2 = 1;
		for(int i = n; i >= n - a + 1; i--)
			pr1 = mul(pr1, i);
		for(int i = n; i >= n - b + 1; i--)
			pr2 = mul(pr2, i);
		pr1 = mul(pr1, inv(fact[a]));
		pr2 = mul(pr2, inv(fact[b]));
		ans = sub(ans, add(pr1, pr2));
		cout << ans << endl;
	}
}


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

int main()
{
    int n,k;
    string s;
    cin >> n >> k >> s;
    vector<int> a;
    if(s[0] == '0')a.push_back(0);
    for(int i = 0; i < n;){
        if(s[i] == '1'){
            int j = i;
            while(s[j] == '1')j++;
            a.push_back(j - i);
            i = j;
        }else{
            int j = i;
            while(s[j] == '0')j++;
            a.push_back(j - i);
            i = j;
        }
    }
    if(s[n - 1] == '0')a.push_back(0);
    
    

    int maxi = 0;
    int cur = 0;
    for(int i = 0; i < k * 2 + 1 && i < (int)a.size(); i++)cur += a[i]; 
    maxi = cur;
    for(int i = k * 2 + 1; i < (int)a.size(); i += 2){
        cur -= a[i - (k * 2 + 1)];
        cur -= a[i - (k * 2)];
        cur += a[i];
        cur += a[i + 1];
        maxi = max(cur,maxi);
    }
    cout << maxi << endl;

}

Measured memory_bytes: 1020
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

//ABC
int main() {
	int n, m, time = 0, a, b;
	cin >> n;
	vector<int>t(n);
	for (int i = 0;i < n;i++) {
		cin >> t[i];
		time += t[i];
	}
	cin >> m;
	vector<int>ans(m);
	for (int i = 0;i < m;i++) {
		cin >> a >> b;
		ans[i] = time - t[a - 1] + b;
	}
	for (int i = 0;i < m;i++)cout << ans[i] << endl;
	/*ll n, sum1 = 0, sum2 = 0;
	cin >> n;
	vector<int>a(n);
	for (ll i = 0;i < n;i++) {
		cin >> a[i];
		sum2 += a[i];
	}
	ll ans = 10000000000;
	for (ll i = 0;i < n-1;i++) {
		sum1 += a[i];
		sum2 -= a[i];
		ans = min(ans, abs(sum1 - sum2));
	}
	cout << ans << endl;*/
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>

using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main() {

    ll N, K;
    cin >> N >> K;

    // 余りがiになる組み合わせ
    ll ans = 0;
    for(ll b = K + 1; b <= N; b++){
        // N までにある数的な
        ll div = N / b;
        ll rem = N % b;

        ans += (b - K) * (div + 1);
        ans -=  min((b - K),  max ( 0ll, (b - rem - 1) ));
        if(K == 0) ans --;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
wdai = []
wsaiko = []
kdai = []
ksaiko = []
for a in range(10):
  wdai.append(int(input()))
for c in range(10):
  kdai.append(int(input()))
for b in range(3):
  wsaiko.append(max(wdai))
  wdai.remove(max(wdai))
for d in range(3):
  ksaiko.append(max(kdai))
  kdai.remove(max(kdai))
print(sum(wsaiko),sum(ksaiko))


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;	cin>>s1>>s2;
	int n1=s1.size(), n2 = s2.size();

	int dp[n1+1][n2+1];

	memset(dp, 0, sizeof(dp));

	for(int i=1;i<=n1;++i)
	{
		for(int j=1;j<=n2;++j)
		{
			if(s1[i-1]==s2[j-1])
				dp[i][j] = 1+ dp[i-1][j-1];
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}

	string ans="";
	int i=n1, j=n2;

	while(i>0 && j>0)
	{
		if(dp[i][j] == dp[i-1][j])	i--;
		else if(dp[i][j] == dp[i][j-1])	j--;
		else	ans+= (char)s1[i-1], i--, j--; 
	}
	
	reverse(ans.begin(), ans.end());
	cout<<(ans.size()?ans:"")<<endl;
}

Measured memory_bytes: 38720
#include <iostream>
using namespace std;
 
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0014

int main() {
	int d;
	while (cin >> d) {
		int sum = 0;
		for (int i = d; i < 600; i += d) {
			sum += d * i * i;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
while True:
    n = int(input())
    
    if n == 0:
        break
    
    a=0
    for i in range(1,n):
        b = i
        
        for j in range(i+1,n):
            b += j
            
            if b==n:
                a+=1
                break
            elif b>n:
                break
            
    print(a)


Measured memory_bytes: 5588
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){
    int a,b,k; 
    cin>>a>>b>>k; 
    if (b-a+1<=2*k){
        while (a<=b){
          cout << (a++) << endl;
        }
    }
    else {
        for (int i=a;i<a+k;i++) cout << i << endl;
        for (int i=b-k+1;i<=b;i++) cout << i << endl;
    }
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
int main()
{
        int a[200],m,n,t=0;
        scanf("%d",&m);
        for(n=0;n<m;n++)
        {
            scanf("%d",&a[n]);
            if(a[n]%2==0)
            {
                if(a[n]%3!=0&&a[n]%5!=0)
                    t=1;
            }
        }
        if(t==0)
            printf("APPROVED");
        else if(t==1)
            printf("DENIED");
        return 0;

}

Measured memory_bytes: 128
import java.util.Scanner;
 
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int i=1,n=sc.nextInt();
        while(i<=n){
            int x=i;
            if(x%3==0){
                System.out.printf(" %d",i);
            }else{
                while(x>=1){
                    if(x%10==3){
                        System.out.printf(" %d",i);
                        break;
                    }
                    x/=10;
                }
            }
            i++;
        }
        System.out.printf("\n");
    }
};


Measured memory_bytes: 38296
#include<bits/stdc++.h>
using namespace std;
#define maxn 705
bool dis[maxn][maxn];
int fa[maxn*2],size[maxn*2],f[2][maxn*2];
int Find(int x){
	return fa[x]==x?x:fa[x]=Find(fa[x]);
}
int main(){
	int n,m;scanf("%d%d",&n,&m);
	int x1=n>>1,x2=n-x1,u,v;
	if(m<((x1-1)*x1+(x2-1)*x2)/2){
		puts("-1");return 0;
	}
	for(int i=0;i<m;i++){
		scanf("%d%d",&u,&v),dis[u][v]=dis[v][u]=1;
	}
	for(int i=1;i<=(n<<1);i++)fa[i]=i;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(!dis[i][j]){
				x1=Find(i),x2=Find(j);
				if(x1==x2){
					puts("-1");return 0;
				}
				int y2=Find(j+n),y1=Find(i+n);
				fa[y2]=x1,fa[y1]=x2;
			}
		}
	}
	for(int i=1;i<=n;i++){x1=Find(i),size[x1]++;}
	f[0][maxn]=1;
	for(int i=1;i<=n;i++){
		x1=Find(i),x2=Find(i+n);
		if(!size[x1]){
			memcpy(f[i&1],f[(~i)&1],sizeof(f[i&1]));
			continue;
		}
		int k=i&1,w=size[x1]-size[x2];size[x1]=size[x2]=0;
		memset(f[k],0,sizeof(f[k]));
		for(int i=0;i<maxn*2;i++){
			if(f[k^1][i])
			f[k][i-w]=f[k][i+w]=1;
		}
	}
	for(int i=maxn;;i++){
		if(f[n&1][i]){
			x1=(n-i+maxn)>>1,x2=n-x1;break;
		}
	}
	printf("%d",((x1-1)*x1+(x2-1)*x2)>>1);
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <fstream>
#include <cassert>
#include <string.h>
#include <vector>
#include <map>
#include <stack>

template <typename Container, typename Value>
typename Container::iterator binarySearch(Container& sorted_array, Value value)
{
    int left  = 0;
    int right = sorted_array.size();

    while (left < right) {
        int current = (left + right) / 2;
        if(value == sorted_array.at(current)){
            return sorted_array.begin() + current;
        }else if(value < sorted_array.at(current)){
            right = current;
        }else{
            left = current;
            if (left + 1 == right)
                break;
        }
    }

    return sorted_array.end();
}

// TODO reserveやpush_backはvecterにしかないはずなので､他のコンテナでどう汎化すべきか考える｡
template <typename Container>
Container createContainerFronCin(int cnt)
{
    Container ret;
    ret.reserve(cnt);

    int cur = 0;
    for (int i = 0; i < cnt; ++i) {
        std::cin >> cur;
        ret.push_back(cur);
    }

    return ret;
}

int main()
{
    int n = 0;
    int q = 0;

    std::cin >> n;
    std::vector<int> sorted_array = createContainerFronCin< std::vector<int> >(n);

    std::cin >> q;
    std::vector<int> values = createContainerFronCin< std::vector<int> >(q);

    int counter = 0;
    for (std::vector<int>::iterator it = values.begin(); it < values.end(); ++it) {
        std::vector<int>::iterator pos = binarySearch<std::vector<int>, int>(sorted_array, *it);
        if (pos != sorted_array.end())
           counter++;
    }

    std::cout << counter << std::endl;
}




Measured memory_bytes: 3348
main = do
  str <- getLine
  let [n, m] = map read (words str) ::[Int]
  print $ cul n m

cul n m
  | n == 1 && m == 1 = 0
  | n <= 1           = culM
  | m <= 1           = culN
  | otherwise        = culN + culM
      where culM = ceiling (fromIntegral (m*(m-1)) / 2)
            culN = ceiling (fromIntegral (n*(n-1)) / 2)

Measured memory_bytes: 508
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

const int siz = 1e5 + 10;
vector<int> v[siz];
int dp[siz]={0};
bool vis[siz]={0};

void dfs(int node)
{
    
    vis[node] = true;
    for (int x : v[node])
    {
        if (!vis[x])
        {
            dfs(x);
        }
        
        dp[node] = max(dp[node],1+dp[x]);
    }
}

int32_t main()
{
   // shuru_krte_hai_bina_kisi_bakchodi_ke();
    int n, m;
    cin >> n >> m;
    while (m--)
    {
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
    }
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            dfs(i);
        }
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        
        ans = max(ans,dp[i]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 12636
#include <iostream>
#include <vector>

using namespace std;

int bubbleSort(vector<int> &a) {
	int count = 0;
	int n = (int)a.size();
	for (int i = 0; i < n; i++) {
		for (int j = n-1; j > i; j--) {
			if (a[j] < a[j-1]) {
				swap(a[j], a[j-1]);
				count++;
			}
		}
	}
	return count;
}

void printVector(vector<int> a) {
	int n = (int)a.size();
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i != n-1) cout << " ";
	}
	cout << endl;
}

int main() {

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

	int ans = bubbleSort(a);
	printVector(a);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3156
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (int u = 0; u < 20; u++)
	{
		int a[10001];
		long n = 0,co[11];

		cin >> n;
		if (n == 0)
		{
			break;
		}

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

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

		for (int j = 0; j < 10; j++)
		{
			if (co[j] == 0)
			{
				cout << '-';
			}
			else
			{
				for (int k = 0; k < co[j]; k++)
				{
					cout << '*';
				}
			}
			cout << endl;
		}
	}
}



Measured memory_bytes: 3044