akhauriyash/Code-Regression huggingface dataset:
#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];
    }

    bool flag = 1;
    int cnt = 0;
    int tmp;
    while(flag){
        flag = 0;
        for(int j=n-1; j>0; j--){
            if(a[j] < a[j-1]){
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                cnt++;
                flag = 1;
            }
        }
    }

    for(int k=0; k<n; k++) {
        if(k != n-1){
            cout << a[k] << " ";
        }else{
            cout << a[k] << endl;
        }
    }
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3124
from sys import exit
from math import sqrt
X = int(input()) 
if X == 2: print(2)
elif X == 3: print(3)  
#elif X == 57: print(57)  
else:   
  for i in range(X,10**6):
    if i % 2 == 0: continue
    for j in range(3,X,2):
      if i % j == 0: break
      if j >= sqrt(i) :
        print(i)
        exit()

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

int main(){
  int box_string, balls, s1, s2, s3;
  cin >> box_string;
  s1 = box_string / 100;
  s2 = (box_string - box_string / 100 * 100) / 10;
  s3 = box_string % 10;
  balls = s1 + s2 + s3;
  cout << balls << endl;
}

Measured memory_bytes: 256
import numpy as np
import bisect

N, K = map(int, input().split())
AB = [list(map(int,input().split())) for i in range(N)]

AB.sort(key=lambda x:x[0])

pre_num = 0
lst = []
for i in range(N):
  if AB[i][0] == pre_num:
    lst[-1][1] += AB[i][1]
  else:
    pre_num = AB[i][0]
    lst.append(AB[i])
    
AB_cumsum = np.array(lst)[:,1].cumsum()
idx = bisect.bisect_left(AB_cumsum, K)
ans = lst[idx][0]
print(ans)



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

int main(){
  string s;
  while(getline(cin,s) && s != "END OF INPUT"){
    int p = -1;
    int a = 0;
    while(++p<(int)s.size()){
      if(s[p]==' '){
	cout << a;
	a = 0;
      }else a++;
    }
    cout << a << endl;
  }
}
      

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
  int suml = 0, sumr = 0, tmp, N;
  vector<int> W;
  cin >> N;
  for (int i=0; i<N; i++){
	cin >> tmp;
    sumr += tmp;
    W.push_back(tmp);
  }
  int minimum = 1e8;
  for (int i=0; i<N; i++){
    suml += W[i];
    sumr -= W[i];
    if (abs(suml - sumr) < minimum){
      minimum = abs(suml - sumr);
    }
  }
  cout << minimum << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
    {
        static Dictionary<int, List<int>> Nodes;
        static void Main(string[] args)
        {
            //C - One-stroke Path
            //https://atcoder.jp/contests/abc054/tasks/abc054_c
            var Array = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int N = Array[0];
            int M = Array[1];
            Nodes = new Dictionary<int, List<int>>();
            for (int i = 1; i <= N; i++)
            {
                Nodes.Add(i, new List<int>());
            }
            int Count = 0;
            while (Count < M)
            {
                Array = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                //無向グラフなのでどちらからでもいける
                Nodes[Array[0]].Add(Array[1]);
                Nodes[Array[1]].Add(Array[0]);
                Count++;
            }
            int Result = CheckPath(1, new List<int>());
          	Console.WriteLine(Result);
        }

        static int CheckPath(int CurrentNodeID, List<int> CheckedNum)
        {
            CheckedNum.Add(CurrentNodeID);
            //まだ調べていないものが次のNodeとなる
            var Next = Nodes[CurrentNodeID].Where(x => !CheckedNum.Exists(y => x == y));
            
            //次のNodeがなく、調べたノード数と全ノード数一致
            if (Next.Count() == 0 && (CheckedNum.Count == Nodes.Count()))
            {
                return 1;
            }
            //再起呼び出し
            var X = Next.Select(z => CheckPath(z, new List<int>(CheckedNum)));
            var Y = X.Sum();
            return Y;
        }
    }

Measured memory_bytes: 17504
#include<stdio.h>
int main(void)
{
  int n,h[100],count,i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&h[i]);
  }

  count = 1;
  int max = h[0];
  for(i=1;i<n;i++){
    if(h[i] >= max){
      max = h[i];
      count += 1;
    }
  }

  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 128
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $s = [];
  for($bit=0; $bit<(1<<3); $bit++){
    $s[$bit]="";
    for($i=0; $i<3; $i++){
      $mask = 1 << $i;
      if($bit & $mask){
        $s[$bit] .= "+";
      }else{
        $s[$bit] .= "-";
      }
    }
  }

  for($i=0;$i<count($s);$i++){
    $ans = $n[0];
    for($j=0;$j<3;$j++){
      if($s[$i][$j] == '+'){
        $ans += $n[$j+1];
      }else{
        $ans -= $n[$j+1];
      }
    }
    if($ans == 7){
      echo $n[0].$s[$i][0].$n[1].$s[$i][1].$n[2].$s[$i][2].$n[3]."=7";
      exit;
    }
  }

Measured memory_bytes: 16108
import heapq
import copy
N = int(input())
a = list(map(int,input().split()))
leftHeap = copy.copy(a[0:N])
rightHeap = [-a[i] for i in range(2*N,3*N)]
heapq.heapify(leftHeap)
heapq.heapify(rightHeap)
leftSideTakenSum = [0] #take smallest i num from left [0,N+i) 
rightSideTakenSum = [0] #take largest i num from right [2*N-i, 3*N)
for i in range(1,N+1):
  left = heapq.heappushpop(leftHeap,a[N+i-1])
  right = -heapq.heappushpop(rightHeap,-a[2*N-i])
  leftSideTakenSum.append(leftSideTakenSum[i-1]+left)
  rightSideTakenSum.append(rightSideTakenSum[i-1]+right)

leftSideSum = 0
for i in range(N):
  leftSideSum += a[i]
totalSum = sum(a)
rightSideSum = totalSum - leftSideSum
answer = -totalSum
for i in range(N+1):
  candidate = leftSideSum - leftSideTakenSum[i] - (rightSideSum - rightSideTakenSum[N-i])
  #print(i,N+i,leftSideSum,rightSideSum,candidate)
  answer = max(answer,candidate)
  leftSideSum += a[N+i]
  rightSideSum -= a[N+i]
print(answer)
  


Measured memory_bytes: 41684
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int n, s[100];
long long dp[102][30];

long long rec(int a, int b){ //s[a]を考える,現在の値はb
	if(dp[a][b]>=0) return dp[a][b];
	
	long long ret=0;
	if(a==n-1){
		if(b==s[n-1]) ret=1;
		else ret=0;	
	}
	else if(b<0 || b>20) return 0;
	else ret+=rec(a+1, b-s[a]) + rec(a+1, b+s[a]);
		
	return dp[a][b]=ret;
}

int main(){
	scanf(" %d", &n);
	for(int i=0; i<n; ++i) scanf(" %d", &s[i]);
	
	memset(dp, -1, sizeof(dp));
	printf("%lld\n", rec(1, s[0]));
}

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

int main() {

	char a, b;
	char res;
	do {
		cin >> a >> b;

	} while (a != 'H' && a != 'D' || b != 'H' && b != 'D' );

	if (a == 'H' && b == 'H') {
		res = 'H';
	}
	else if (a == 'H' && b == 'D') {
		res = 'D';
	}
	else if (a == 'D' && b == 'D') {
		res = 'H';
	}
	else {
		res = 'D';
	}

	cout << res << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
void read (int &x) {
	char ch = getchar(); x = 0;
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
} const int N = 3038, mod = 998244353;
int n, s, res, inv, a[N], f[N];    
int Pow (int x, int y) {
	int tmp = 1;
	while (y) {
		if (y & 1) tmp = tmp * x % mod;
		x = x * x % mod, y >>= 1;
	} return tmp;
}
signed main() {
	read (n), read (s); 
	for (int i = 1; i <= n; ++i) read (a[i]);
	f[0] = Pow (2, n); inv = Pow (2, mod - 2);
	for (int i = 1; i <= n; ++i) {
		for (int j = s; j >= a[i]; --j)
			f[j] = (f[j] + f[j - a[i]] * inv) % mod;
	} return printf ("%lld\n", f[s]), 0;
}

Measured memory_bytes: 3804
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		long x[] = new long[n];
		long xx[] = new long[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			x[i] = Long.parseLong(str[i]);
			xx[i] = x[i];
		}

		Arrays.sort(x);
		long mid = x[n / 2];

		//System.out.println(Arrays.toString(x) + " " + mid);

		for (int i = 0; i < n; i++) {
			if (xx[i] >= mid) {
				System.out.println(x[n / 2 - 1]);
			} else {
				System.out.println(x[n / 2]);
			}
		}
	}
}

Measured memory_bytes: 70764
#include<stdio.h>
int x[100010][2];
int ans[100010];
int n,a[3];

void f(int i,int p,int q){
	ans[i]=p;
	a[p]++;
	a[q]--;
}

int main(){
	scanf("%d%d%d%d",&n,a,a+1,a+2);

	for(int i=0;i<n;i++){
		char s[3];
		scanf("%s",s);
		x[i][0]=s[0]-'A';
		x[i][1]=s[1]-'A';
	}

	for(int i=0;i<n;i++){
		int p=x[i][0],q=x[i][1];
		if(!a[p]&&!a[q]){
			puts("No");
			return 0;
		}
		else if(!a[p])f(i,p,q);
		else if(!a[q])f(i,q,p);
		else{
			if(i!=n-1&&p==3-x[i+1][0]-x[i+1][1])f(i,q,p);
			else f(i,p,q);
		}
	}
	puts("Yes");
	for(int i=0;i<n;i++)printf("%c\n",ans[i]+'A');
}


Measured memory_bytes: 2904
def LI(): return list(map(int, input().split()))
n = int(input())
p = LI()
q = [i for i in range(1, n+1)]

diff = 0
for i in range(n):
    if p[i] != q[i]:
        diff += 1

if diff == 2 or diff == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060
#include<iostream>0=
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
int fun(int n){
    int cnt = 0;
    for (int i=1;i<=n;i++){
        if (n%i==0)
            cnt++;
    }
    return cnt==8;
}
int main(){
    int a,b;
    while (scanf("%d",&a)!=EOF){
        int ans = 0;
        for (int i=1;i<=a;i++){
            int num = i;
            if (fun(num)&&num%2)
                ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
#define PI 3.14159265359


int main() {
    string N;
    cin >> N;
    if(N[N.size()-1] =='2' or N[N.size()-1] =='4' or N[N.size()-1] =='5' or N[N.size()-1] =='7' or N[N.size()-1] =='9'){
        cout << "hon" << endl;
    }
    else if(N[N.size()-1] =='0' or N[N.size()-1] =='1' or N[N.size()-1] =='6' or N[N.size()-1] =='8'){
        cout << "pon" << endl;
    }
    else if(N[N.size()-1] == '3'){
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  string s;
  cin >> s;
  int a = s.size();
  rep(i, 0, a){
    if(i == 5 || i == 13){
      cout << " ";
    }
    else{
      cout << s[i];
    }
  }
}

Measured memory_bytes: 3592
n,m,x,y = map(int,input().split())

X = list(map(int,input().split()))
Y = list(map(int,input().split()))

c = 0

for i in range(x+1,y+1):
	if max(X) < i <= min(Y):
		c += 1

if c != 0:
	print('No War')
else:
	print('War')
      

Measured memory_bytes: 3060
#include <stdio.h>
int calc(int a,int b){
    int sum=0;
    while(a>10){
        sum =sum + a%10;
        a = a/10;
    }
    sum = sum + a;
    while(b>10){
        sum = sum + b%10;
        b = b/10;
    }
    sum = sum +b;
    return sum;
}
int main()
{
    int ans=1000000,N,sum[100000],i,a[100000],b[100000];
    scanf("%d",&N);
    if(N%2==0){
        for(i=0;i<N/2;i++){
         a[i]=N-i;
         b[i]=i;
         sum[i]=calc(a[i],b[i]);
         if(ans>sum[i]){
             ans=sum[i];
         }}
        }else{
            for(i=0;i<(N+1)/2;i++){
         a[i]=N-i;
         b[i]=i;
         sum[i]=calc(a[i],b[i]);
         if(ans>sum[i]){
             ans=sum[i];
        }}}
        printf("%d",ans);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>;
using namespace std;
int main() {
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = S/60-h*60;
	s = S % 3600-m*60;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
using namespace std;
int main(){
  int N, H[20];
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  int ans = 1;
  for(int i=1; i<N; i++){
    for(int j=0; j<i; j++){
      if(H[i] < H[j]) break;
      if(j==i-1) ans++;
    }
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  string S,T;
  cin >> S;
  cin >> T;
  int ssize = (int)S.size();
  int tsize = (int)T.size();
  int max_match = 0;
  for (int i = 0; i + tsize - 1 < ssize; i++) {
    int match_cnt = 0;
    for (int j = 0; j < tsize; j++) {
      if (S[i+j] == T[j]) match_cnt++; 
    }
    max_match = max(max_match, match_cnt);
  }
  cout << tsize - max_match << endl;

  return 0;
}


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

int main() {
    long long one, zr, mon, k, max = 0;
    
    scanf("%lld %lld %lld %lld", &one, &zr, &mon, &k);
    
    if (k - one <= 0){
        max = k;
        //printf("-\n");
    }
    else{
        if (k - (one + zr) > k){
            max = one;
            //printf("--\n");
        }
        else{ 
            max = one - (k - (one + zr));
            //printf("---\n");
        }
    }
    
    printf("%lld\n", max);
    
    
    return 0;
}


Measured memory_bytes: 1704
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

struct rect {
	ll hei; ll pos;
};

ll const MAX = 2005;
bool grid[MAX][MAX];
bool bad_point[MAX][MAX] = {};
ll h, w;

bool is_badpoint(ll i, ll j) {
	return grid[i][j] ^ grid[i + 1][j] ^ grid[i][j - 1] ^ grid[i + 1][j - 1];
}

ll a[MAX] = {};
void roof(ll x) {
	REP(j, 1, w) {
		while (a[j] <= x || !bad_point[a[j]][j]) {
			a[j]++;
		}
	}
}

rect c[MAX * 2];

ll make_rect(ll x) {
	ll ans = 0;
	stack<rect> st;
	REP(i, 1, w) {
		c[i * 2 - 1] = { a[i] - x,i };
		c[i * 2] = { h - x,i };
	}
	c[2 * w + 1] = { 0,w + 1 };
	
	REP(j, 1, 2 * w + 1) {
		if (st.empty()) {
			st.push(c[j]);
		}
		else {
			ll cur = c[j].pos;
			while (st.top().hei > c[j].hei) {
				rect c_rec = st.top();
				st.pop();
				ans = max(ans, c_rec.hei*(c[j].pos - c_rec.pos));
				//cout << c_rec.hei*(c[j].pos - c_rec.pos) << endl;
				cur = c_rec.pos;
				if (st.empty())break;
			}
			if (st.empty()) {
				st.push({ c[j].hei,cur });
			}
			else if (st.top().hei < c[j].hei) {
				st.push({ c[j].hei,cur });
			}
		}
	}
	return ans;
}

int main() {
	cin >> h >> w;
	REP(i, 1, h) {
		REP(j, 1, w) {
			char c;
			cin >> c;
			grid[i][j] = (c == '.');
		}
	}
	REP(i, 1, h - 1) {
		REP(j, 2, w) {
			bad_point[i][j] = is_badpoint(i, j);
		}
	}
	REP(j, 1, w) {
		bad_point[h][j] = 1;
	}
	ll ans = 0;
	REP(i, 0, h - 1) {
		roof(i);
		ans = max(ans, make_rect(i));
	}
	cout << ans << endl;
}

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

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

    cout << fixed << setprecision(12) << w*h/2.0 << " " << (x*2 == w && y*2 == h ? 1 : 0) << endl;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
A = getArray(N)
for i in range(N):
    A[i] -= 1
ignore = [0] * N
ignore[0] = 1

now = 0
cnt = 0
while True:
    now = A[now]
    cnt += 1
    if ignore[now] == 1:
        print(-1)
        break
    ignore[now] = 1
    if now == 1:
        print(cnt)
        break

Measured memory_bytes: 89196
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
using namespace std;

int main(){
  long int N;cin>>N;
  int a[N+10];REP(i,N)cin>>a[i];
  sort(a,a+N);
  if(N%3==0){
    int x=a[0],y=a[N/3],z=a[2*N/3];
    if(a[N/3-1]==x&&a[2*N/3-1]==y&&a[N-1]==z&&(x^y)==z&&(y^z)==x&&(x^z)==y){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }else{
    if(a[N-1]==0){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;
import java.util.Set;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer 降順ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] intarray = inputval();
        int w = intarray[0];
        int h = intarray[1];
        int n = intarray[2];
        int stx = 0;
        int endx = w;
        int sty = 0;
        int endy = h;

        for (int i=0; i<n; i++){
            int [] xya = inputval();
            int x = xya[0];
            int y = xya[1];
            int a = xya[2];
            if(a == 1){
                stx = Math.max(stx, x);
            }else if (a == 2){
                endx = Math.min(endx, x);
            }else if (a == 3){
                sty = Math.max(sty, y);
            }else{
                endy = Math.min(endy,y);
            }
        }

        System.out.println(Math.max(endx-stx,0) * Math.max(endy-sty,0));

    }

}



Measured memory_bytes: 32824
#include<iostream>
using namespace std;
int main(){
	int N;
	cin >> N;
	int *a = new int[N];

	int sum = 0;

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

	for (int i = 0; i < N; i++){
		sum += a[i] - 1;
	}

	cout << sum << endl;

	delete[] a;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  int cnt = 0;
  for (int i = 0; i < N; i++) if (H.at(i) >= K) cnt++;
  cout << cnt << "\n";
}

Measured memory_bytes: 640
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAX = 200001;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void comb_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算 (combination. nCkを求める.)
ll comb(int n, int k) {
  if (n < k) {
    return 0;
  }
  if (n < 0 || k < 0) {
    return 0;
  }
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll N, M, K;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  comb_init();
  cin >> N >> M >> K;

  // xを求める
  ll ans_x = 0;
  for (int d = 1; d < M; d++) {
    ll sum = d * (M - d) * N * N;
    ans_x += (sum * comb(N * M - 2, K - 2));
    ans_x = ans_x % MOD;
  }

  // yを求める
  ll ans_y = 0;
  for (int d = 1; d < N; d++) {
    ll sum = d * (N - d) * M * M;
    ans_y += (sum * comb(N * M - 2, K - 2));
    ans_y = ans_y % MOD;
  }

  ll ans = (ans_x + ans_y) % MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    
    set<int> ans;
    rep(i, K) {
        if (A + i <= B) ans.insert(A + i);
        if (B - i >= A) ans.insert(B - i);
    }
    while (ans.size() > 0) {
        int x = *begin(ans);
        cout << x << endl;
        ans.erase(x);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int N,M;
	int A[200] = { 0 };
	vector<string> v;
	
	cin >> N ;

	for (int i = 0; i < N; i++)
	{
		string tmp;
		cin >> tmp;
		int n = 0;
		bool is = false;
		for (vector<string>::iterator j = v.begin(); j !=v.end(); j++)
		{
			if (tmp == *j) {
				is=true;
				break;
			}
			n++;
		}

		if (is) {
			A[n]++;
		}
		else {
			v.push_back(tmp);
			A[n]++;
		}
	}

	/*for (int i = 0; i < N; i++)
	{
		cout << "array:" << A[i] << endl;
	}*/

	cin >> M;

	for (int i = 0; i < M; i++)
	{
		string tmp;
		cin >> tmp;
		int n = 0;
		bool is = false;
		for (vector<string>::iterator j = v.begin(); j != v.end(); j++)
		{
			if (tmp == *j) {
				is=true;
				break;
			}
			n++;
		}

		if (is) {
			A[n]--;
		}
	}

	int max = *max_element(A, A + 200);

	cout << max << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <climits>

void testprint(std::vector<long long> & input)
{
    int size = input.size();
    for(int i = 0; i < size ; i ++)
    {
        std::cout<<input[i]<<std::endl;
    }
}

long long min_search(std::vector<long long> & input)
{
    int size = input.size();

    long long min = LLONG_MAX;

    for(int i = 0 ; i < size ; i ++)
    {
        if(input[i] <= min)
        {
            min = input[i];
        }
    }

    return min;
}

int main(void)
{

int N;
int sub;
std::cin>> N ;
int Q[3];

Q[0] = int(N%10);
sub = N - Q[0];
Q[1] =int(int(sub%100)/10);
sub = sub - Q[1];
Q[2] = int (sub/100) ;

if(Q[0]==1)
{
    Q[0] =9;
}
else if(Q[0] == 9)
{
    Q[0] = 1;
}

if (Q[1] == 1)
{
    Q[1] = 9;
}
else if (Q[1] == 9)
{
    Q[1] = 1;
}

if (Q[2] == 1)
{
    Q[2] = 9;
}
else if (Q[2] == 9)
{
    Q[2] = 1;
}

int out;
out = Q[0] + Q[1]*10 + Q[2]*100;
std::cout<<out<<std::endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int x,y,z,res=0; cin>>x>>y>>z;



 cout<<z<<' '<<x<<' '<<y<<endl;
}

Measured memory_bytes: 256
a,b,c = gets.split.map(&:to_i).sort

d = b - a
e = c - b
f = d + e

ans = 0

ans += e
a += e
b += e

d = b - a
e = c - b
f = d + e

# p [a, b, c]
# p [d, e, f]
# p ans

if d.even?
  ans += d/2
else
  ans += d/2 + 2
end

puts ans






Measured memory_bytes: 1788
K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
max_dist = 0
for i in range(N):
    nxt = (i + 1 ) % N
    dist = A_ls[nxt] - A_ls[i]
    if dist < 0:
        dist += K
    max_dist = max(max_dist, dist)
print(K - max_dist)

Measured memory_bytes: 32224
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

func reverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

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()
}

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

var dp [1000000]int

const inf = 1 << 60

func solve(s string) int {
	var dp [10000100][2]int

	for i := 0; i < 10000100; i++ {
		dp[i][0] = inf
		dp[i][1] = inf
	}

	dp[0][0] = 0
	size := len(s)
	for i := 0; i < size; i++ {
		c := int(s[i] - '0')
		dp[i+1][0] = min(dp[i+1][0], dp[i][0]+c)
		dp[i+1][0] = min(dp[i+1][0], dp[i][1]+c+1)
		dp[i+1][1] = min(dp[i+1][1], dp[i][0]+10-c)
		dp[i+1][1] = min(dp[i+1][1], dp[i][1]+10-c-1)
	}
	return min(dp[size][0], dp[size][1]+1)
}

func readLine(r *bufio.Reader) []byte {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := r.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return buf
}
func main() {
	r := bufio.NewReaderSize(os.Stdin, 4096)

	s := reverse(string(readLine(r)))

	out(solve(s))
}


Measured memory_bytes: 172032
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
    static long MOD = (long)Math.pow(10, 9) + 7;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        long a[] = new long[60];
        long b[] = new long[60];
        for (int i=0; i<N; i++) {
            long val = in.nextLong();
            for(int j=0; j<60; j++) {
                if (val%2==0) {
                    a[j]++;
                } else {
                    b[j]++;
                }
                val /= 2;
            }
        }
        long ans = 0;
        for (int i=0; i<60; i++) {
            long t = (long)Math.pow(2,i) % MOD;
            t = (t * a[i]) % MOD;
            t = (t * b[i]) % MOD;
            ans = (ans + t)%MOD;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 89056
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_170
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] xn = ReadInts();
            int x = xn[0];
            int n = xn[1];
            if (n == 0)
            {
                WriteLine(x);
                return;
            }
            int[] ps = ReadInts();
            var hashset = new HashSet<int>();
            for (int i = 0; i < n; i++)
            {
                hashset.Add(ps[i]);
            }

            int res = -100;
            for(int i = -100; i < 200; i++)
            {
                if (hashset.Contains(i))
                {
                    continue;
                }

                int delta = Abs(x - i);
                if (delta < Abs(x - res))
                {
                    res = i;
                }
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

long N, A, B;
static int h[100000];
int binarySearch(int ok, int ng, bool f(int n)) {
	if (ok == ng) return ok; // 差が0は認めない(というか差が0って未定義では？)
	while (abs(ng - ok) > 1) { // okとngの差が1になるまで繰り返す
		int mid = ok + ng >> 1;
		(f(mid) ? ok : ng) = mid;
	}
	return ok;
}

bool f(int n) {
	long explosion = 0; // 爆発の中心となる回数
	for (int i = 0;i < N;++ i) {
		explosion += max(0L, (h[i] - n * B + A - B - 1) / (A - B));
		if (explosion > n) return false;
	}
	return true;
}
int main() {
	cin >> N >> A >> B;
	for (int i = 0;i < N;++ i) cin >> h[i];
	cout << binarySearch(2000000000, 0, f);
	return 0;
}

Measured memory_bytes: 640
A, B, N = map(int, input().split())

# from math import floor
# floor(A*x/B) - A*floor(x/B)
# (A*x-x%B) - A*(x-x%B)
# A*x - x%B - A*x + A*(x%B)
# x%B + A*(x%B)
# Aは定数なので x%B を最大化すればよい
# x%Bを最大化するにはxは基本的にはB-1
# NがB-1を取り得ない場合はN

x = B-1 if B-1 <= N else N
print(A*x//B - A*(x//B))

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX 110000

vector<int> G[MAX];
int con[MAX];
int ans = 1;
int K;

void solve(int node = 1, int par = 0, int b = 0){
	
	// cout<<"node = "<<node<<" par = "<<par<<" "<<con[par]<<" "<<b<<endl;
	if(con[par] + b <= K) ans *= (K - (con[par] + b));
	else ans = 0;
	
	ans %= MOD;
	
	con[par]++;
	// cout<<"PAR "<<par<<" "<<con[par]<<endl;
	
	for(int i = 0; i < G[node].size(); i++){
		if(G[node][i] == par) continue;
		
		solve(G[node][i], node, min(b+1,2ll));
	}
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int a, b;
	int N;
	
	cin>>N>>K;
	
	for(int i = 0; i < N-1; i++){
		cin>>a>>b;
		
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	solve();
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 11392
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC106_A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();

            out.print((a - 1) * (b - 1));

        }

    }
}



Measured memory_bytes: 21204
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        StringBuilder S = new StringBuilder(sc.next());
                        int N = sc.nextInt();
                        for (int i = 0; i < N; i++) {
                                String operator = sc.next();
                                        int a = sc.nextInt(), b = sc.nextInt() + 1;
                                if (operator.equals("print")) {
                                        System.out.println(S.substring(a, b));
                                } else if(operator.equals("reverse")) {
                                        S.replace(a, b, (new StringBuilder(S.substring(a, b))).reverse().toString());
                                } else {
                                        String x = sc.next();
                                        S.replace(a, b, x);
                                }
                        }
                }
        }
}


Measured memory_bytes: 29484
n, m = map(int,input().split())
X = []
for _ in range(m):
  k, *A = list(map(int,input().split()))
  b = 0
  for a in A:
    b += 1 << (a-1)
  X.append(b)
P = list(map(int,input().split()))

ans = 0
for i in range(1<<n):
  for x, p in zip(X,P):
    y = i & x
    c = bin(y).count("1") % 2
    if c != p:
      break
  else:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int l,r,d;
    cin >> l >> r >> d;
    int cnt = 0;
    for(int i = l; i <= r; i++){
        if(i%d == 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3600
#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() {
  vector<int> x(5);
  rep(i, 5) cin >> x.at(i);
  int res = INT_MAX;
  // 最後に注文するものを振る
  rep(i, 5) {
    int tmp = 0;
    rep(j, 5) {
      if (i == j) {
        tmp += x.at(j);
      } else {
        if (x.at(j) % 10 != 0) {
          tmp += (10 - x.at(j) % 10);
        }
        tmp += x.at(j);
      }
    }
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
const ll INF = 1e10;
int main()
{
    int h,n;
    cin >> h >> n;
    
    vector<vector<ll>> dp(n+1,vector<ll>(h+1,INF));
    vector<int>a(n),b(n);
    rep(i,n){
        
        cin >> a[i] >> b[i];
    }
    dp[0][0] = 0;

    
    rep(i,n){
        
      
        rep(j,h+1){
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
            dp[i+1][min(h,j+a[i])] = min(dp[i+1][min(h,j+a[i])],dp[i+1][j]+b[i]);
  
        }
    }
    cout << dp[n][h] << endl;


    return 0;
}

Measured memory_bytes: 78592
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

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

        Scanner sc = new Scanner(System.in);
        int alice = 0;
        int bob = 0;

        int N = sc.nextInt();
        Integer[] cards = new Integer[N];
        for (int i = 0; i < N; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards, Collections.reverseOrder());
        for (int i = 0; i < N; i++) {
            if (i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);

    }

}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    int n;cin>>n;
    ll dp[n][4][4][4];
    mem(dp,0);
    rep(i,4){
        rep(j,4){
            rep(k,4){
                if(i==0&&j==1&&k==2)continue;
                else if(i==0&&j==2&&k==1)continue;
                else if(i==1&&j==0&&k==2)continue;
                else dp[2][i][j][k]=1;
            }
        }
    }
    for(int i=3;i<n;++i){
        rep(j,4){
            rep(k,4){
                rep(l,4){
                    rep(m,4){
                        if((k==0||j==0)&&l==1&&m==2)continue;
                        else if(k==0&&l==2&&m==1)continue;
                        else if(k==1&&l==0&&m==2)continue;
                        else if(j==0&&k==1&&m==2)continue;
                        else{
                            dp[i][k][l][m]+=dp[i-1][j][k][l];
                            dp[i][k][l][m]%=MOD;
                        }
                    }
                }
            }
        }
    }
    ll ans=0;
    rep(i,4){
        rep(j,4){
            rep(k,4){
                ans+=dp[n-1][i][j][k];
                ans%=MOD;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int X, A, B;
	cin >> X >> A >> B;
	if((B - A) >= X + 1){
		cout << "dangerous" << endl;
	}
	else if((B - A) <= 0){
		cout << "delicious" << endl;
	}
	else{
		cout << "safe" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N;
int A[10000];
int c[10000];
long B[10000];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	long ans=0;
	vector<int>p;
	for(int i=0;i<N;i++)
	{
		B[i]=1;
		int a=A[i];
		for(int j=2;j*j<=a;j++)
		{
			if(a%j==0)
			{
				p.push_back(j);
				while(a%j==0)a/=j;
			}
		}
		if(a>1)p.push_back(a);
	}
	sort(p.begin(),p.end());
	p.erase(unique(p.begin(),p.end()),p.end());
	for(int x:p)
	{
		int mc=0;
		for(int i=0;i<N;i++)
		{
			c[i]=0;
			while(A[i]%x==0)
			{
				c[i]++;
				A[i]/=x;
			}
			mc=max(mc,c[i]);
		}
		for(int i=0;i<N;i++)
		{
			B[i]=B[i]*power(x,mc-c[i])%mod;
		}
	}
	for(int i=0;i<N;i++)ans+=B[i];
	cout<<ans%mod<<endl;
}


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

using namespace std;

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

  string s;
  cin >> s;
  int lastDigit = -1;
  for (auto &x : s)
  {
    int curDigit = x - '0';
    if (lastDigit == curDigit)
    {
      cout << "Bad\n";
      return 0;
    }
    lastDigit = curDigit;
  }
  cout << "Good\n";

  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int age, mon;

    cin >> age >> mon;
    if(age >= 13)
    {
        cout << mon  << endl;
    }
    else if(age <= 5)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << mon/ 2 << endl;
    }
    
    

    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll dp[3005][3005];

void Main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    for (int len = 1; len <= N; ++len) {
        for (int i = 0; i + len <= N; ++i) {
            int j = i + len;
            if ((N - len) % 2 == 0) dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1]);
            else dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1]);
        }
    }
    cout << dp[0][N] << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 70016
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
void error(const char* str) {
	puts(str);
	exit(0);
}
int main()
{
	int n;
	cin >> n;
	printf("%d\n", (1000 - n % 1000) % 1000);
	return 0;
}


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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

// primary judge O(sqrt(n))
bool is_prime(long long n) {
    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1; // exclude 1
}

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

    vi cum(100005, 0);
    repeat(i, 1, 100005) {
        if (is_prime(i) and is_prime((i + 1) / 2)) {
            cum[i] = cum[i - 1] + 1;
        } else
            cum[i] = cum[i - 1];
    }

    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        out(cum[r] - cum[l - 1]);
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a=0,b=1,temp,x;
  char N;
  while(cin>>N){x=N-'0';temp=a;a=min(a+x,b+10-x);b=min(temp+x+1,b+9-x);}
  return cout<<a<<endl,0;
}

Measured memory_bytes: 384
X = int(input())

if X <= 599:
    print("8")
elif X <= 799:
    print("7")
elif X <= 999:
    print("6")
elif X <= 1199:
    print("5")
elif X <= 1399:
    print("4")
elif X <= 1599:
    print("3")
elif X <= 1799:
    print("2")
else:
    print("1")

Measured memory_bytes: 9156
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  int n;
  cin>>n;
  string s1=to_string(n);
  int sum=0;
  rep(i,0,s1.length()) sum+= (s1[i]-'0');
  if(n%sum)cout<<"No";
  else cout<<"Yes";
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


Measured memory_bytes: 7020